Better, Faster, Freer

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: i386 ]
Version: HEAD ]

001 /*************************************************************************
002  *
003  *  OpenOffice.org - a multi-platform office productivity suite
004  *
005  *  $RCSfile: swdet2.cxx,v $
006  *
007  *  $Revision: 1.11 $
008  *
009  *  last change: $Author: hr $ $Date: 2007/09/27 12:41:27 $
010  *
011  *  The Contents of this file are made available subject to
012  *  the terms of GNU Lesser General Public License Version 2.1.
013  *
014  *
015  *    GNU Lesser General Public License Version 2.1
016  *    =============================================
017  *    Copyright 2005 by Sun Microsystems, Inc.
018  *    901 San Antonio Road, Palo Alto, CA 94303, USA
019  *
020  *    This library is free software; you can redistribute it and/or
021  *    modify it under the terms of the GNU Lesser General Public
022  *    License version 2.1, as published by the Free Software Foundation.
023  *
024  *    This library is distributed in the hope that it will be useful,
025  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
026  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
027  *    Lesser General Public License for more details.
028  *
029  *    You should have received a copy of the GNU Lesser General Public
030  *    License along with this library; if not, write to the Free Software
031  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
032  *    MA  02111-1307  USA
033  *
034  ************************************************************************/
035 
036 // MARKER(update_precomp.py): autogen include statement, do not remove
037 #include "precompiled_sw.hxx"
038 
039 #define _SWLIB_CXX
040 
041 #ifndef _SFX_OBJFAC_HXX //autogen
042 #include <sfx2/docfac.hxx>
043 #endif
044 #ifndef _SFX_DOCFILT_HACK_HXX //autogen
045 #include <sfx2/docfilt.hxx>
046 #endif
047 #ifndef _SFX_FCONTNR_HXX //autogen
048 #include <sfx2/fcontnr.hxx>
049 #endif
050 #ifndef _SFXDOCFILE_HXX //autogen
051 #include <sfx2/docfile.hxx>
052 #endif
053 #ifndef _SFXAPP_HXX //autogen
054 #include <sfx2/app.hxx>
055 #endif
056 #ifndef _SFXECODE_HXX
057 #include <svtools/sfxecode.hxx>
058 #endif
059 #ifndef _MSGBOX_HXX //autogen
060 #include <vcl/msgbox.hxx>
061 #endif
062 #ifndef _PARHTML_HXX //autogen
063 #include <svtools/parhtml.hxx>
064 #endif
065 #include <sot/clsids.hxx>
066 
067 #ifndef _SHELLIO_HXX //autogen
068 #include <shellio.hxx>
069 #endif
070 
071 #undef _DLL_
072 
073 #include <swdetect.hxx>
074 #include "iodetect.cxx"
075 
076 #include <app.hrc>
077 #include <web.hrc>
078 #include <globdoc.hrc>
079 
080 #include <svtools/moduleoptions.hxx>
081 
082 #include <unomid.h>
083 
084 
085 USHORT AutoDetec( const String& FileName, USHORT & rVersion );
086 
087 bool IsDocShellRegistered()
088 {
089     return SvtModuleOptions().IsWriter();
090 }
091 
092 extern const char __FAR_DATA sHTML[];
093 
094 //-------------------------------------------------------------------------
095 
096 ULONG SwFilterDetect::DetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter )
097 {
098         ULONG nRet = ERRCODE_NONE;
099     if( *ppFilter )
100     {
101         // verify the given filter
102         String aPrefFlt = (*ppFilter)->GetUserData();
103 
104         // detection for TextFilter needs an additional checking
105         BOOL bTxtFilter = aPrefFlt.EqualsAscii( FILTER_TEXT, 0, 4 );
106         BOOL bDetected = SwIoSystem::IsFileFilter( rMedium, aPrefFlt );
107         if (!bTxtFilter && bDetected )
108             return nRet;
109         else if (bTxtFilter)
110         {
111             // #50498#: SWDOS uses "txt" extension - so a file detected as "Text" could
112             // also be an SWDOS file
113             if (SwIoSystem::IsFileFilter( rMedium, C2S("SW6"), ppFilter))
114                 return nRet;
115         }
116         else if ( !bDetected )
117             // mba: don't guess filters, only verify it
118             return ERRCODE_ABORT;
119     }
120 
121     // mba: without preselection there is no PrefFlt
122     String aPrefFlt;
123     const SfxFilter* pTmp = SwIoSystem::GetFileFilter( rMedium.GetPhysicalName(), aPrefFlt, &rMedium );
124     if( !pTmp )
125         return ERRCODE_ABORT;
126     /*
127     else if( *ppFilter && (*ppFilter)->GetUserData().EqualsAscii( "W4W", 0, 3 )
128                 && pTmp->GetUserData().EqualsAscii( FILTER_TEXT, 0, 4 ) )
129     {
130         // Bug 95262 - if the user (or short  detect) select a
131         //              Word 4 Word filter, but the autodect of mastersoft
132         //              can't detect it, we normally return the ascii filter
133         //              But the user may have a change to use the W4W filter,
134         //              so the SFX must show now a dialog with the 2 filters
135         nRet = ERRCODE_SFX_CONSULTUSER;
136         *ppFilter = pTmp;
137     } */
138 
139     // sollte der voreingestellte Filter ASCII sein und wir haben
140     // ASCII erkannt, dann ist das ein gultiger Filter, ansonsten ist das
141     // ein Fehler und wir wollen die Filterbox sehen
142     /*
143     else if( pTmp->GetUserData().EqualsAscii( FILTER_TEXT ) )
144     {
145         // Bug 28974: "Text" erkannt, aber "Text Dos" "Text ..." eingestellt
146         //  -> keine FilterBox, sondern den eingestellten Filter benutzen
147         if( *ppFilter && (*ppFilter)->GetUserData().EqualsAscii( FILTER_TEXT, 0, 4 ) )
148             ;
149         else
150 //          if( !*ppFilter || COMPARE_EQUAL != pTmp->GetUserData().Compare((*ppFilter)->GetUserData(), 4 ))
151         {
152 //              nRet = ERRCODE_ABORT;
153             *ppFilter = pTmp;
154         }
155     } */
156     else
157     {
158         //Bug 41417: JP 09.07.97: HTML documents should be loaded by WebWriter
159         SfxFilterContainer aFilterContainer( String::CreateFromAscii("swriter/web") );
160         if( pTmp->GetUserData() != C2S(sHTML) ||
161             String::CreateFromAscii( "com.sun.star.text.WebDocument" ) ==
162             String( pTmp->GetServiceName() ) ||
163             0 == ( (*ppFilter) = SwIoSystem::GetFilterOfFormat( C2S(sHTML),
164                     &aFilterContainer ) ) )
165             *ppFilter = pTmp;
166     }
167 
168         return nRet;
169 }
170 

source navigation ] diff markup ] identifier search ] general search ]

This page was automatically generated by the LXR engine.
The LXR team
Valid HTML 4.01!