1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: docfile.hxx,v $
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>
36 #ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
37 #include <com/sun/star/io/XInputStream.hpp>
39 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
40 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
42 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
43 #include <com/sun/star/lang/XServiceInfo.hpp>
45 #ifndef _COM_SUN_STAR_UCB_XCONTENT_HPP_
46 #include <com/sun/star/ucb/XContent.hpp>
48 #ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP_
49 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
51 #ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
52 #include <com/sun/star/task/XInteractionHandler.hpp>
54 #ifndef _SVSTOR_HXX //autogen
55 #include <bf_so3/svstor.hxx>
57 #ifndef _STREAM_HXX //autogen
58 #include <tools/stream.hxx>
60 #ifndef _STRING_HXX //autogen
61 #include <tools/string.hxx>
63 #ifndef _LIST_HXX //autogen
64 #include <tools/list.hxx>
66 #ifndef _SFXLSTNER_HXX //autogen
67 #include <bf_svtools/lstner.hxx>
70 #include <bf_svtools/cancel.hxx>
71 #include <cppuhelper/weak.hxx>
73 #include <bf_sfx2/sfxuno.hxx>
74 #include <bf_sfx2/docinf.hxx>
81 class SvKeyValueIterator
;
85 class SfxObjectFactory
;
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
106 DECLARE_LIST( StringList
, String
* )//STRIP008 DECLARE_LIST( StringList, String* );
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
,
130 SfxCancelManagerWeak wParent
;
132 ~SfxPoolCancelManager();
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
145 SfxStamp aCreateStamp
;
148 SfxVersionInfo( const SfxVersionInfo
& rInfo
)
151 SfxVersionInfo
& operator=( const SfxVersionInfo
&rInfo
)
154 aComment
= rInfo
.aComment
;
155 aCreateStamp
= rInfo
.aCreateStamp
;
159 DECLARE_LIST( _SfxVersionTable
, SfxVersionInfo
* )
160 class SfxVersionTableDtor
: public _SfxVersionTable
163 SfxVersionTableDtor( const sal_uInt16 nInitSz
=0, const sal_uInt16 nReSz
=1 )
164 : _SfxVersionTable( nInitSz
, nReSz
)
167 SfxVersionTableDtor( const SfxVersionTableDtor
&rCpy
)
170 ~SfxVersionTableDtor()
174 SvStream
& Read( SvStream
& );
177 class SfxMedium
: public SvRefBase
184 StreamMode nStorOpenMode
;
185 INetURLObject
* pURLObj
;
187 SvGlobalName aFilterClass
;
189 SvStream
* pOutStream
;
190 SvStorageRef aStorage
;
191 const SfxFilter
* pFilter
;
193 SfxMedium_Impl
* pImp
;
199 void SetIsRemote_Impl();
200 void CloseInStream_Impl();
201 sal_Bool
CloseOutStream_Impl();
202 DECL_STATIC_LINK( SfxMedium
, UCBHdl_Impl
, sal_uInt32
* );
207 SvCompatWeakHdl
* GetHdl();
210 SfxMedium( const String
&rName
,
211 StreamMode nOpenMode
,
213 const SfxFilter
*pFilter
= 0,
214 SfxItemSet
*pSet
= 0 );
215 SfxMedium( SvStorage
*pTheStorage
, sal_Bool bRoot
= sal_False
);
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;
235 const String
& GetName() const {return aLogicName
;}
236 #if defined SINIX && defined GCC && defined C272
237 const INetURLObject
& GetURLObject();
239 const INetURLObject
& GetURLObject() const;
241 ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XContent
> GetContent() const;
242 const String
& GetPhysicalName() const;
243 sal_Bool
IsTemporary() const;
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
; }
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();
273 sal_Bool
TryStorage();
274 sal_Bool
IsStorage();
275 SvStorage
* GetStorage();
276 SvStorage
* GetOutputStorage( BOOL bUCBStorage
= FALSE
);
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();
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;
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();
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
);
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* );
353 }//end of namespace binfilter