Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_sfx2 / docfile.hxx
blob018d7b957a229bf7f81d3cfaf2dfe2ecea16da63
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: docfile.hxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SFXDOCFILE_HXX
31 #define _SFXDOCFILE_HXX
33 #ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
34 #include <com/sun/star/io/XOutputStream.hpp>
35 #endif
36 #ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
37 #include <com/sun/star/io/XInputStream.hpp>
38 #endif
39 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
40 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
41 #endif
42 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
43 #include <com/sun/star/lang/XServiceInfo.hpp>
44 #endif
45 #ifndef _COM_SUN_STAR_UCB_XCONTENT_HPP_
46 #include <com/sun/star/ucb/XContent.hpp>
47 #endif
48 #ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP_
49 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
50 #endif
51 #ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
52 #include <com/sun/star/task/XInteractionHandler.hpp>
53 #endif
54 #ifndef _SVSTOR_HXX //autogen
55 #include <bf_so3/svstor.hxx>
56 #endif
57 #ifndef _STREAM_HXX //autogen
58 #include <tools/stream.hxx>
59 #endif
60 #ifndef _STRING_HXX //autogen
61 #include <tools/string.hxx>
62 #endif
63 #ifndef _LIST_HXX //autogen
64 #include <tools/list.hxx>
65 #endif
66 #ifndef _SFXLSTNER_HXX //autogen
67 #include <bf_svtools/lstner.hxx>
68 #endif
70 #include <bf_svtools/cancel.hxx>
71 #include <cppuhelper/weak.hxx>
73 #include <bf_sfx2/sfxuno.hxx>
74 #include <bf_sfx2/docinf.hxx>
75 class Timer;
76 class DateTime;
77 class SvStringsDtor;
78 class SvEaMgr;
79 class INetURLObject;
80 namespace binfilter {
81 class SvKeyValueIterator;
83 class SfxItemSet;
85 class SfxObjectFactory;
86 class SfxFilter;
87 class SfxMedium_Impl;
88 class SfxObjectShell;
89 class SfxFrame;
90 class LoadEnvironment_Impl;
92 class SfxLoadEnvironment;
94 #define SFX_TFPRIO_SYNCHRON 0
95 #define SFX_TFPRIO_DOC 10
96 #define SFX_TFPRIO_VISIBLE_LOWRES_GRAPHIC 20
97 #define SFX_TFPRIO_VISIBLE_HIGHRES_GRAPHIC 21
98 #define SFX_TFPRIO_PLUGINS 40
99 #define SFX_TFPRIO_INVISIBLE_LOWRES_GRAPHIC 50
100 #define SFX_TFPRIO_INVISIBLE_HIGHRES_GRAPHIC 51
101 #define SFX_TFPRIO_DOWNLOADS 60
103 #if _SOLAR__PRIVATE
104 #ifndef STRING_LIST
105 #define STRING_LIST
106 DECLARE_LIST( StringList, String* )//STRIP008 DECLARE_LIST( StringList, String* );
107 #endif
108 #endif
110 //____________________________________________________________________________________________________________________________________
111 // defines for namespaces
112 //____________________________________________________________________________________________________________________________________
114 #define OUSTRING ::rtl::OUString
115 #define XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
116 #define XSERVICEINFO ::com::sun::star::lang::XServiceInfo
117 #define OWEAKOBJECT ::cppu::OWeakObject
118 #define REFERENCE ::com::sun::star::uno::Reference
119 #define XINTERFACE ::com::sun::star::uno::XInterface
120 #define SEQUENCE ::com::sun::star::uno::Sequence
121 #define EXCEPTION ::com::sun::star::uno::Exception
122 #define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
123 #define ANY ::com::sun::star::uno::Any
125 class SfxPoolCancelManager : public SfxCancelManager ,
126 public SfxCancellable ,
127 public SfxListener ,
128 public SvRefBase
130 SfxCancelManagerWeak wParent;
132 ~SfxPoolCancelManager();
133 public:
134 SfxPoolCancelManager( SfxCancelManager* pParent, const String& rName );
135 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
136 virtual void Cancel();
139 SV_DECL_IMPL_REF( SfxPoolCancelManager )
141 struct SfxVersionInfo
143 String aName;
144 String aComment;
145 SfxStamp aCreateStamp;
147 SfxVersionInfo();
148 SfxVersionInfo( const SfxVersionInfo& rInfo )
149 { *this = rInfo; }
151 SfxVersionInfo& operator=( const SfxVersionInfo &rInfo )
153 aName = rInfo.aName;
154 aComment = rInfo.aComment;
155 aCreateStamp = rInfo.aCreateStamp;
156 return *this;
159 DECLARE_LIST( _SfxVersionTable, SfxVersionInfo* )
160 class SfxVersionTableDtor : public _SfxVersionTable
162 public:
163 SfxVersionTableDtor( const sal_uInt16 nInitSz=0, const sal_uInt16 nReSz=1 )
164 : _SfxVersionTable( nInitSz, nReSz )
167 SfxVersionTableDtor( const SfxVersionTableDtor &rCpy )
168 { *this = rCpy; }
170 ~SfxVersionTableDtor()
171 { DelDtor(); }
173 void DelDtor();
174 SvStream& Read( SvStream & );
177 class SfxMedium : public SvRefBase
179 sal_uInt32 eError;
180 sal_Bool bDirect:1,
181 bRoot:1,
182 bSetFilter:1,
183 bTriedStorage;
184 StreamMode nStorOpenMode;
185 INetURLObject* pURLObj;
186 String aName;
187 SvGlobalName aFilterClass;
188 SvStream* pInStream;
189 SvStream* pOutStream;
190 SvStorageRef aStorage;
191 const SfxFilter* pFilter;
192 SfxItemSet* pSet;
193 SfxMedium_Impl* pImp;
194 String aLogicName;
195 String aLongName;
196 sal_Bool bRemote;
198 #if _SOLAR__PRIVATE
199 void SetIsRemote_Impl();
200 void CloseInStream_Impl();
201 sal_Bool CloseOutStream_Impl();
202 DECL_STATIC_LINK( SfxMedium, UCBHdl_Impl, sal_uInt32 * );
203 #endif
205 public:
207 SvCompatWeakHdl* GetHdl();
209 SfxMedium();
210 SfxMedium( const String &rName,
211 StreamMode nOpenMode,
212 sal_Bool bDirect,
213 const SfxFilter *pFilter = 0,
214 SfxItemSet *pSet = 0 );
215 SfxMedium( SvStorage *pTheStorage, sal_Bool bRoot = sal_False );
216 ~SfxMedium();
218 void UseInteractionHandler( BOOL );
219 ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >
220 GetInteractionHandler();
222 void SetLoadTargetFrame(SfxFrame* pFrame );
223 SfxFrame* GetLoadTargetFrame() const;
224 void CancelTransfers();
226 void SetReferer( const String& rRefer );
227 void SetTransferPriority( sal_uInt16 nPrio );
228 void SetFilter( const SfxObjectFactory &rFact, const String & rFilter );
229 void SetFilter(const SfxFilter *pFlt, sal_Bool bResetOrig = sal_False);
230 const SfxFilter * GetFilter() const { return pFilter; }
231 const String& GetOrigURL() const;
232 SfxItemSet * GetItemSet() const;
233 void Close();
234 void ReOpen();
235 const String& GetName() const {return aLogicName;}
236 #if defined SINIX && defined GCC && defined C272
237 const INetURLObject& GetURLObject();
238 #else
239 const INetURLObject& GetURLObject() const;
240 #endif
241 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > GetContent() const;
242 const String& GetPhysicalName() const;
243 sal_Bool IsTemporary() const;
244 sal_Bool IsRemote();
245 sal_Bool IsOpen() const { return aStorage.Is() || pInStream; }
246 void StartDownload();
247 void DownLoad( const Link& aLink = Link());
248 void SetDoneLink( const Link& rLink );
249 void SetDataAvailableLink( const Link& rLink );
251 sal_uInt32 GetMIMEAndRedirect( String& );
252 sal_uInt32 GetErrorCode() const;
253 sal_uInt32 GetError() const
254 { return ERRCODE_TOERROR(GetErrorCode()); }
255 sal_uInt32 GetLastStorageCreationState();
257 void SetError( sal_uInt32 nError ) { eError = nError; }
259 void CloseInStream();
260 sal_Bool CloseOutStream();
262 sal_Bool IsRoot() const { return bRoot; }
263 void CloseStorage();
265 StreamMode GetOpenMode() const { return nStorOpenMode; }
266 void SetOpenMode( StreamMode nStorOpen, sal_Bool bDirect, sal_Bool bDontClose = sal_False );
267 sal_Bool IsDirect() const { return bDirect? sal_True: sal_False; }
269 SvStream* GetInStream();
270 SvStream* GetOutStream();
272 sal_Bool Commit();
273 sal_Bool TryStorage();
274 sal_Bool IsStorage();
275 SvStorage* GetStorage();
276 SvStorage* GetOutputStorage( BOOL bUCBStorage = FALSE );
277 void ResetError();
278 sal_Bool UsesCache() const;
279 void SetUsesCache( sal_Bool );
280 void SetDontCreateCancellable();
281 sal_Bool IsAllowedForExternalBrowser() const;
282 long GetFileVersion() const;
284 const SfxVersionTableDtor* GetVersionList();
285 sal_Bool IsReadOnly();
287 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetInputStream();
289 void CreateTempFile();
290 void CreateTempFileNoCopy();
291 void TryToSwitchToRepairedTemp();
293 void SetLoadEnvironment( SfxLoadEnvironment* pEnv );
294 SfxLoadEnvironment* GetLoadEnvironment() const;
296 ::rtl::OUString GetCharset();
297 const String& GetBaseURL();
299 #if _SOLAR__PRIVATE
300 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetInputStream_Impl();
301 SvStorage* GetStorage_Impl( BOOL bUCBStorage );
302 SfxPoolCancelManager* GetCancelManager_Impl() const;
303 void SetCancelManager_Impl( SfxPoolCancelManager* pMgr );
305 SvKeyValueIterator* GetHeaderAttributes_Impl();
306 void SetLoadEnvironment_Impl( LoadEnvironment_Impl* pEnv );
307 LoadEnvironment_Impl* GetLoadEnvironment_Impl() const;
309 // Diese Protokolle liefern MIME Typen
310 sal_Bool SupportsMIME_Impl() const;
312 void Init_Impl();
313 void ForceSynchronStream_Impl( sal_Bool bSynchron );
315 void GetMedium_Impl();
316 void Transfer_Impl();
317 void CreateFileStream();
318 void SetUpdatePickList(sal_Bool);
320 void SetLongName(const String &rName)
321 { aLongName = rName; }
322 const String & GetLongName() const { return aLongName; }
323 ErrCode CheckOpenMode_Impl( sal_Bool bSilent, sal_Bool bAllowRO = sal_True );
324 sal_Bool IsDownloadDone_Impl();
325 void ClearBackup_Impl();
326 void Done_Impl( ErrCode );
327 void DataAvailable_Impl();
328 void Cancel_Impl();
329 void SetPhysicalName_Impl(const String& rName);
331 void DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent,
332 const String& aPrefix,
333 const String& aExtension,
334 const String& aDestDir );
336 sal_Bool TransactedTransferForFS_Impl( const INetURLObject& aSource,
337 const INetURLObject& aDest,
338 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xComEnv );
340 #endif
342 static SfxVersionTableDtor* GetVersionList( SvStorage* pStor );
345 SV_DECL_IMPL_REF( SfxMedium )
346 SV_DECL_COMPAT_WEAK( SfxMedium )
348 #ifndef SFXMEDIUM_LIST
349 #define SFXMEDIUM_LIST
350 DECLARE_LIST( SfxMediumList, SfxMedium* )//STRIP008 DECLARE_LIST( SfxMediumList, SfxMedium* );
351 #endif
353 }//end of namespace binfilter
354 #endif