1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _SFX_OBJSH_HXX
20 #define _SFX_OBJSH_HXX
22 #include <config_features.h>
24 #include "sal/config.h"
26 #include "tools/solar.h"
27 #include "sfx2/dllapi.h"
28 #include "sal/types.h"
29 #include <com/sun/star/frame/XFrame.hpp>
30 #include <com/sun/star/uno/Reference.h>
31 #include <com/sun/star/uno/Sequence.hxx>
32 #include <com/sun/star/script/XLibraryContainer.hpp>
33 #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
34 #include <com/sun/star/embed/XStorage.hpp>
35 #include <com/sun/star/beans/PropertyValue.hpp>
36 #include <com/sun/star/security/DocumentSignatureInformation.hpp>
37 #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
38 #include <com/sun/star/task/XInteractionHandler.hpp>
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 #include <boost/shared_ptr.hpp>
42 //________________________________________________________________________________________________________________
43 // include something else
44 //________________________________________________________________________________________________________________
46 #include <vcl/timer.hxx>
47 #include <svl/poolitem.hxx>
48 #include <vcl/bitmap.hxx>
49 #include <sot/storage.hxx>
50 #include <rsc/rscsfx.hxx>
52 #include <sfx2/XmlIdRegistry.hxx>
53 #include <sfx2/shell.hxx>
54 #include <comphelper/embeddedobjectcontainer.hxx>
55 #include <com/sun/star/frame/XModel.hpp>
62 class SfxObjectFactory
;
63 class SfxDocumentInfoDialog
;
64 class SfxStyleSheetBasePool
;
66 class SfxStyleSheetPool
;
71 class SvKeyValueIterator
;
85 #define ASPECT_CONTENT 1
86 #define ASPECT_THUMBNAIL 2 /* 120 * 120, 6 Colors DIB in MetaFile */
88 #define ASPECT_DOCPRINT 8
89 #define ASPECT_ALL (ASPECT_CONTENT | ASPECT_THUMBNAIL | ASPECT_ICON | ASPECT_DOCPRINT)
91 // from pseudo.hxx; must be the same as in OLE2
92 #define SVOBJ_MISCSTATUS_SERVERRESIZE 1
93 #define SVOBJ_MISCSTATUS_NOTREPLACE 4
94 #define SVOBJ_MISCSTATUS_CANTLINKINSIDE 16
95 #define SVOBJ_MISCSTATUS_LINK 64
96 #define SVOBJ_MISCSTATUS_INSIDEOUT 128
97 #define SVOBJ_MISCSTATUS_ACTIVATEWHENVISIBLE 256
98 #define SVOBJ_MISCSTATUS_NOTRESIZEABLE 512
99 #define SVOBJ_MISCSTATUS_ALWAYSACTIVATE 1024
100 #define SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE 2048
101 #define SVOBJ_MISCSTATUS_SPECIALOBJECT 4096
109 namespace com
{ namespace sun
{ namespace star
{ namespace datatransfer
{ class XTransferable
; } } } }
111 namespace com
{ namespace sun
{ namespace star
{
113 class XDocumentProperties
;
120 typedef sal_uInt32 SfxObjectShellFlags
;
121 #define SFXOBJECTSHELL_HASOPENDOC 0x01L
122 #define SFXOBJECTSHELL_DONTREPLACE 0x02L
123 #define SFXOBJECTSHELL_HASMENU 0x04L
124 #define SFXOBJECTSHELL_DONTLOADFILTERS 0x08L
125 #define SFXOBJECTSHELL_DONTCLOSE 0x10L
126 #define SFXOBJECTSHELL_NODOCINFO 0x20L
127 #define SFXOBJECTSHELL_STD_NORMAL ( SFXOBJECTSHELL_HASOPENDOC )
128 #define SFXOBJECTSHELL_STD_SPECIAL ( SFXOBJECTSHELL_DONTLOADFILTERS )
129 #define SFXOBJECTSHELL_UNDEFINED 0xf000000
131 //--------------------------------------------------------------------
133 #define SFX_TITLE_TITLE 0
134 #define SFX_TITLE_FILENAME 1
135 #define SFX_TITLE_FULLNAME 2
136 #define SFX_TITLE_APINAME 3
137 #define SFX_TITLE_DETECT 4
138 #define SFX_TITLE_CAPTION 5
139 #define SFX_TITLE_PICKLIST 6
140 #define SFX_TITLE_HISTORY 7
141 #define SFX_TITLE_MAXLEN 10 // this gives the limits on length
143 #define SFX_LOADED_MAINDOCUMENT 1
144 #define SFX_LOADED_IMAGES 2
145 #define SFX_LOADED_ALL 3
147 //--------------------------------------------------------------------
149 #define HIDDENINFORMATION_RECORDEDCHANGES 0x0001
150 #define HIDDENINFORMATION_NOTES 0x0002
151 #define HIDDENINFORMATION_DOCUMENTVERSIONS 0x0004
153 enum HiddenWarningFact
161 //--------------------------------------------------------------------
163 enum SfxObjectCreateMode
165 SFX_CREATE_MODE_EMBEDDED
,
166 SFX_CREATE_MODE_STANDARD
,
167 SFX_CREATE_MODE_PREVIEW
,
168 SFX_CREATE_MODE_ORGANIZER
,
169 SFX_CREATE_MODE_PLUGIN
,
170 SFX_CREATE_MODE_INTERNAL
173 /*====================================================================
175 The class SfxObjectShell is the base class for SFx-objects, ie documents
176 and parts of documents that can be integrated as separate objects
177 into foreign objects.
179 ----------------------------------------------------------------------*/
181 class SfxToolBoxConfig
;
182 struct TransferableObjectDescriptor
;
184 class SFX2_DLLPUBLIC SfxObjectShell
:
185 public SfxShell
, virtual public SotObject
,
186 public ::comphelper::IEmbeddedHelper
, public ::sfx2::IXmlIdRegistrySupplier
188 friend struct ModifyBlocker_Impl
;
189 friend class SfxObjectShellLock
;
192 struct SfxObjectShell_Impl
* pImp
; // internal data
194 SfxMedium
* pMedium
; // Description of the file for example
195 // storage that contains the object
196 SfxStyleSheetBasePool
* pStyleSheetPool
; // StyleSheets
197 SfxObjectCreateMode eCreateMode
; // Purpose of the object
198 sal_Bool bHasName
:1, // sal_True := existing object,
199 // sal_False := new object
200 bIsTmp
:1; // temporary Storage
203 SAL_DLLPRIVATE
void UpdateTime_Impl(const ::com::sun::star::uno::Reference
<
204 ::com::sun::star::document::XDocumentProperties
> & i_xDocProps
);
206 SAL_DLLPRIVATE sal_Bool
SaveTo_Impl(SfxMedium
&rMedium
, const SfxItemSet
* pSet
);
209 SfxObjectShell(SfxObjectCreateMode
);
210 SfxObjectShell( const sal_uInt64 i_nCreationFlags
); // see sfxmodelfactory.hxx
211 virtual ~SfxObjectShell();
213 virtual void ModifyChanged();
214 virtual sal_Bool
Close();
216 /** declares the document to have capabilities to contain basic/dialog libraries
218 void SetHasNoBasic();
220 /// template method, called by FlushDocInfo; this implementation is empty
221 virtual void DoFlushDocInfo();
224 void AddToRecentlyUsedList();
228 SFX_DECL_INTERFACE(SFX_INTERFACE_SFXDOCSH
)
230 static const com::sun::star::uno::Sequence
<sal_Int8
>& getUnoTunnelId();
231 /* Stampit disable/enable cancel button for print jobs
232 default = true = enable! */
233 void Stamp_SetPrintCancelState(sal_Bool bState
);
234 sal_Bool
Stamp_GetPrintCancelState() const;
236 using SotObject::GetInterface
;
238 // Document-Shell Iterator
239 static SfxObjectShell
* GetFirst( const TypeId
* pType
= 0,
240 sal_Bool bOnlyVisible
= sal_True
);
241 static SfxObjectShell
* GetNext( const SfxObjectShell
& rPrev
,
242 const TypeId
* pType
= 0,
243 sal_Bool bOnlyVisible
= sal_True
);
244 static SfxObjectShell
* Current();
245 static ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>
246 GetCurrentComponent();
247 static void SetCurrentComponent( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& _rxComponent
);
249 virtual void Invalidate(sal_uInt16 nId
= 0);
251 SfxObjectShellFlags
GetFlags( ) const ;
253 SfxModule
* GetModule() const;
255 virtual SfxObjectFactory
& GetFactory() const=0;
256 SfxMedium
* GetMedium() const { return pMedium
; }
257 void ForgetMedium() { pMedium
= 0; }
258 ::com::sun::star::uno::Reference
<
259 ::com::sun::star::document::XDocumentProperties
> getDocProperties();
260 void UpdateDocInfoForSave( );
262 sal_Bool
HasName() const { return bHasName
; }
263 virtual String
GetAPIName() const;
265 sal_Bool
IsReadOnly() const;
266 sal_Bool
IsReadOnlyMedium() const;
267 bool IsOriginallyReadOnlyMedium() const;
268 void SetReadOnlyUI( sal_Bool bReadOnly
= sal_True
);
269 sal_Bool
IsReadOnlyUI() const;
271 sal_Bool
IsInModalMode() const;
272 sal_Bool
IsInPrepareClose() const;
273 virtual sal_Bool
AcceptStateUpdate() const;
274 sal_Bool
IsHelpDocument() const;
276 #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
277 sal_Bool
IsDocShared() const;
278 OUString
GetSharedFileURL() const;
279 sal_Bool
SwitchToShared( sal_Bool bShared
, sal_Bool bSave
);
280 SAL_DLLPRIVATE
void FreeSharedFile();
281 SAL_DLLPRIVATE
void FreeSharedFile( const OUString
& aTempFileURL
);
282 SAL_DLLPRIVATE
void DoNotCleanShareControlFile();
283 void SetSharedXMLFlag( sal_Bool bFlag
) const;
284 sal_Bool
HasSharedXMLFlagSet() const;
286 sal_Bool
IsDocShared() const
287 { return sal_False
; };
288 OUString
GetSharedFileURL() const
289 { return OUString(); };
292 SAL_DLLPRIVATE
void SetModalMode_Impl(sal_Bool bModal
=sal_True
);
293 SAL_DLLPRIVATE
void SetMacroMode_Impl(sal_Bool bModal
=sal_True
);
296 sal_uInt32
GetError() const;
297 sal_uInt32
GetErrorCode() const;
298 void SetError( sal_uInt32 rErr
, const OUString
& aLogMessage
);
300 void AddLog( const OUString
& aMessage
);
304 * Initialize bare minimum just enough for unit test runs.
306 * @return true if the initialization is successful, false otherwise.
308 bool DoInitUnitTest();
309 sal_Bool
DoInitNew( SfxMedium
* pMedium
=0 );
310 sal_Bool
DoLoad( SfxMedium
* pMedium
);
311 bool DoLoadExternal( SfxMedium
* pMed
);
313 sal_Bool
DoSaveAs( SfxMedium
&rNewStor
);
314 sal_Bool
DoSaveObjectAs( SfxMedium
&rNewStor
, sal_Bool bCommit
);
316 // TODO/LATER: currently only overloaded in Calc, should be made non-virtual
317 virtual sal_Bool
DoSaveCompleted( SfxMedium
* pNewStor
=0 );
319 virtual sal_Bool
LoadOwnFormat( SfxMedium
& pMedium
);
320 virtual sal_Bool
SaveAsOwnFormat( SfxMedium
& pMedium
);
321 virtual sal_Bool
ConvertFrom( SfxMedium
&rMedium
);
322 virtual sal_Bool
ConvertTo( SfxMedium
&rMedium
);
323 virtual sal_Bool
InitNew( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
);
324 virtual sal_Bool
Load( SfxMedium
&rMedium
);
325 virtual sal_Bool
LoadFrom( SfxMedium
& rMedium
);
326 virtual sal_Bool
Save();
327 virtual sal_Bool
SaveAs( SfxMedium
&rMedium
);
328 virtual sal_Bool
SaveCompleted( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
);
329 virtual sal_Bool
SwitchPersistance(
330 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
);
331 virtual void UpdateLinks();
332 virtual bool LoadExternal( SfxMedium
& rMedium
);
334 * Called when the Options dialog is dismissed with the OK button, to
335 * handle potentially conflicting option settings.
337 virtual void CheckConfigOptions();
338 sal_Bool
IsConfigOptionsChecked() const;
339 void SetConfigOptionsChecked( sal_Bool bChecked
);
341 // called for a few slots like SID_SAVE[AS]DOC, SID_PRINTDOC[DIRECT], derived classes may abort the action
342 virtual sal_Bool
QuerySlotExecutable( sal_uInt16 nSlotId
);
344 sal_Bool
SaveChildren(sal_Bool bObjectsOnly
=sal_False
);
345 sal_Bool
SaveAsChildren( SfxMedium
&rMedium
);
346 sal_Bool
SwitchChildrenPersistance(
347 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
,
348 sal_Bool bForceNonModified
= sal_False
);
349 sal_Bool
SaveCompletedChildren( sal_Bool bSuccess
);
351 virtual sal_Bool
ImportFrom( SfxMedium
&rMedium
, bool bInsert
);
352 sal_Bool
ExportTo( SfxMedium
&rMedium
);
354 // xmlsec05, check with SFX team
355 sal_uInt16
GetDocumentSignatureState();
356 void SignDocumentContent();
357 sal_uInt16
GetScriptingSignatureState();
358 void SignScriptingContent();
360 virtual SfxDocumentInfoDialog
* CreateDocumentInfoDialog(
361 Window
*pParent
, const SfxItemSet
& );
363 ErrCode
CallBasic( const String
& rMacro
, const String
& rBasicName
,
364 SbxArray
* pArgs
= 0, SbxValue
* pRet
= 0 );
367 const String
& rScriptURL
,
368 const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aParams
,
369 ::com::sun::star::uno::Any
& aRet
,
370 ::com::sun::star::uno::Sequence
< sal_Int16
>& aOutParamIndex
,
371 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aOutParam
,
372 bool bRaiseError
= true,
373 const ::com::sun::star::uno::Any
* aCaller
= 0 );
375 static ErrCode
CallXScript(
376 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& _rxScriptContext
,
377 const OUString
& rScriptURL
,
378 const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aParams
,
379 ::com::sun::star::uno::Any
& aRet
,
380 ::com::sun::star::uno::Sequence
< sal_Int16
>& aOutParamIndex
,
381 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aOutParam
,
382 bool bRaiseError
= true,
383 const ::com::sun::star::uno::Any
* aCaller
= 0
386 /** adjusts the internal macro mode, according to the current security settings
388 Finally, the macro mode is either NEVER_EXECUTE or ALWAYS_EXECUTE_NO_WARN.
391 whether macros from this document should be executed
393 bool AdjustMacroMode( const String
& rScriptType
, bool _bSuppressUI
= false );
395 SvKeyValueIterator
* GetHeaderAttributes();
396 void ClearHeaderAttributesForSourceViewHack();
397 void SetHeaderAttributesForSourceViewHack();
399 sal_Bool
IsTemplate() const;
401 sal_Bool
IsQueryLoadTemplate() const;
402 sal_Bool
IsUseUserData() const;
403 sal_Bool
IsLoadReadonly() const;
404 sal_Bool
IsSaveVersionOnClose() const;
405 void SetQueryLoadTemplate( sal_Bool b
);
406 void SetUseUserData( sal_Bool bNew
);
407 void SetLoadReadonly( sal_Bool _bReadonly
);
408 void SetSaveVersionOnClose( sal_Bool bSet
);
409 void ResetFromTemplate( const String
& rTemplateName
, const String
& rFileName
);
411 // TODO/LATER: the following two methods should be replaced by Get/SetModifPasswordInfo in future
412 sal_uInt32
GetModifyPasswordHash() const;
413 sal_Bool
SetModifyPasswordHash( sal_uInt32 nHash
);
415 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> GetModifyPasswordInfo() const;
416 sal_Bool
SetModifyPasswordInfo( const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& aInfo
);
418 static sal_uInt32
HandleFilter( SfxMedium
* pMedium
, SfxObjectShell
* pDoc
);
420 virtual void ViewAssigned();
421 virtual sal_uInt16
PrepareClose( sal_Bool bUI
= sal_True
, sal_Bool bForBrowsing
= sal_False
);
422 virtual sal_Bool
IsInformationLost();
423 virtual sal_uInt16
GetHiddenInformationState( sal_uInt16 nStates
);
424 sal_Int16
QueryHiddenInformation( HiddenWarningFact eFact
, Window
* pParent
);
425 virtual sal_Bool
HasSecurityOptOpenReadOnly() const;
426 sal_Bool
IsSecurityOptOpenReadOnly() const;
427 void SetSecurityOptOpenReadOnly( sal_Bool bOpenReadOnly
= sal_True
);
429 virtual Size
GetFirstPageSize();
430 virtual sal_Bool
DoClose();
431 virtual void PrepareReload();
432 virtual ::boost::shared_ptr
<GDIMetaFile
> GetPreviewMetaFile( sal_Bool bFullContent
= sal_False
) const;
433 virtual void CancelTransfers();
435 sal_Bool
GenerateAndStoreThumbnail(
438 sal_Bool bIsTemplate
,
439 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStor
);
441 sal_Bool
WriteThumbnail(
444 sal_Bool bIsTemplate
,
445 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
>& xStream
);
449 sal_Bool
IsAbortingImport() const;
450 sal_Bool
IsReloading() const;
451 void FinishedLoading( sal_uInt16 nWhich
= SFX_LOADED_ALL
);
452 void TemplateDisconnectionAfterLoad();
453 sal_Bool
IsLoading() const;
454 sal_Bool
IsLoadingFinished() const;
455 void SetAutoLoad( const INetURLObject
&, sal_uInt32 nTime
, sal_Bool bReload
= sal_True
);
456 sal_Bool
IsAutoLoadLocked() const;
457 void NotifyReloadAvailable();
460 sal_Bool
IsPreview() const;
461 SfxObjectCreateMode
GetCreateMode() const { return eCreateMode
; }
462 SfxProgress
* GetProgress() const;
463 void SetWaitCursor( sal_Bool bSet
) const;
466 void SetTitle( const String
& rTitle
);
467 String
GetTitle( sal_uInt16 nMaxLen
= 0 ) const;
468 void InvalidateName(); // Re-set to unnamed
471 virtual long DdeExecute( const String
& rCmd
);
472 virtual long DdeGetData( const String
& rItem
,
473 const String
& rMimeType
,
474 ::com::sun::star::uno::Any
& rValue
);
475 virtual long DdeSetData( const String
& rItem
,
476 const String
& rMimeType
,
477 const ::com::sun::star::uno::Any
& rValue
);
478 virtual ::sfx2::SvLinkSource
* DdeCreateLinkSource( const String
& rItem
);
479 virtual void ReconnectDdeLink(SfxObjectShell
& rServer
);
481 static void ReconnectDdeLinks(SfxObjectShell
& rServer
);
484 virtual SfxStyleSheetBasePool
* GetStyleSheetPool();
485 void SetStyleSheetPool(SfxStyleSheetBasePool
*pBasePool
) {
486 pStyleSheetPool
= pBasePool
; }
488 // Determine the position of the "Automatic" filter in the stylist
489 void SetAutoStyleFilterIndex(sal_uInt16 nSet
);
490 sal_uInt16
GetAutoStyleFilterIndex();
491 virtual sal_Bool
HasBasic() const;
492 BasicManager
* GetBasicManager() const;
493 com::sun::star::uno::Reference
< com::sun::star::script::XLibraryContainer
>
495 com::sun::star::uno::Reference
< com::sun::star::script::XLibraryContainer
>
496 GetDialogContainer();
497 StarBASIC
* GetBasic() const;
499 // Interface Document content, Organizer
500 #define INDEX_IGNORE USHRT_MAX
502 #define CONTENT_STYLE 0
503 #define CONTENT_CONFIG 1
504 #define CONTENT_MACRO 2
505 #define DEF_CONTENT_COUNT 1
508 virtual void SetOrganizerSearchMask(
509 SfxStyleSheetBasePool
* ) const;
511 virtual sal_Bool
CanHaveChildren(
513 sal_uInt16 nIdx2
= INDEX_IGNORE
516 virtual void GetContent( String
&,
517 Bitmap
&rClosedBitmap
,
518 Bitmap
&rOpenedBitmap
,
519 sal_Bool
&bCanDelete
,
524 virtual Bitmap
GetStyleFamilyBitmap(SfxStyleFamily eFamily
);
526 virtual sal_Bool
Insert( SfxObjectShell
&rSource
,
527 sal_uInt16 nSourceIdx1
,
528 sal_uInt16 nSourceIdx2
,
529 sal_uInt16 nSourceIdx3
,
533 sal_uInt16
&rIdxDeleted
);
535 virtual sal_Bool
Remove( sal_uInt16 nIdx1
,
536 sal_uInt16 nIdx2
= INDEX_IGNORE
,
537 sal_uInt16 nIdx3
= INDEX_IGNORE
);
539 virtual void LoadStyles( SfxObjectShell
&rSource
);
540 void ReadNote( INote
* );
541 void UpdateNote( INote
* );
543 // Documents, for which to format the view size
545 virtual SfxObjectShell
* GetObjectShell();
547 virtual SfxFrame
* GetSmartSelf( SfxFrame
* pSelf
, SfxMedium
& rMedium
);
549 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
>
551 // Only temporarily for the applications!
552 void SetBaseModel( SfxBaseModel
* pModel
);
553 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
> GetBaseModel() const;
554 // Only temporarily for the applications!
556 virtual ::com::sun::star::uno::Sequence
< OUString
> GetEventNames();
558 Window
* GetDialogParent( SfxMedium
* pMedium
=0 );
559 static SfxObjectShell
* CreateObject( const String
& rServiceName
, SfxObjectCreateMode
= SFX_CREATE_MODE_STANDARD
);
560 static SfxObjectShell
* CreateObjectByFactoryName( const String
& rURL
, SfxObjectCreateMode
= SFX_CREATE_MODE_STANDARD
);
561 static ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>
562 CreateAndLoadComponent( const SfxItemSet
& rSet
, SfxFrame
* pFrame
= NULL
);
563 static SfxObjectShell
* GetShellFromComponent( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>& xComp
);
564 static String
GetServiceNameFromFactory( const String
& rFact
);
565 sal_Bool
IsInPlaceActive();
566 sal_Bool
IsUIActive();
567 virtual void InPlaceActivate( sal_Bool
);
568 virtual void UIActivate( sal_Bool
);
570 static sal_Bool
CopyStoragesOfUnknownMediaType(
571 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xSource
,
572 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xTarget
);
574 // ==== The functions from SvPersist
575 void EnableSetModified( sal_Bool bEnable
= sal_True
);
576 sal_Bool
IsEnableSetModified() const;
577 virtual void SetModified( sal_Bool bModified
= sal_True
);
578 sal_Bool
IsModified();
581 * @param bChart true if the file is a chart doc and FillClass should not be called
584 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
,
585 sal_Int32 nVersion
, sal_Bool bTemplate
, bool bChart
= false ) const;
587 ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
> GetStorage();
589 SvGlobalName
GetClassName() const;
591 // comphelper::IEmbeddedHelper
592 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
> getInteractionHandler() const;
593 virtual com::sun::star::uno::Reference
< com::sun::star::embed::XStorage
> getStorage() const
595 return const_cast<SfxObjectShell
*>(this)->GetStorage();
597 virtual comphelper::EmbeddedObjectContainer
& getEmbeddedObjectContainer() const
599 return GetEmbeddedObjectContainer();
601 bool isEnableSetModified() const
603 return IsEnableSetModified();
605 comphelper::EmbeddedObjectContainer
& GetEmbeddedObjectContainer() const;
606 void ClearEmbeddedObjects();
608 // ==== The functions from SvEmbeddedObject
609 virtual Printer
* GetDocumentPrinter();
610 virtual OutputDevice
* GetDocumentRefDev();
611 virtual void OnDocumentPrinterChanged( Printer
* pNewPrinter
);
612 virtual Rectangle
GetVisArea( sal_uInt16 nAspect
) const;
613 virtual void SetVisArea( const Rectangle
& rVisArea
);
614 const Rectangle
& GetVisArea() const;
615 void SetVisAreaSize( const Size
& rVisSize
);
616 virtual sal_uIntPtr
GetMiscStatus() const;
618 MapUnit
GetMapUnit() const;
619 void SetMapUnit( MapUnit nMUnit
);
621 void FillTransferableObjectDescriptor( TransferableObjectDescriptor
& rDesc
) const;
622 void DoDraw( OutputDevice
*, const Point
& rObjPos
,
624 const JobSetup
& rSetup
,
625 sal_uInt16 nAspect
= ASPECT_CONTENT
);
626 virtual void Draw( OutputDevice
*, const JobSetup
& rSetup
,
627 sal_uInt16 nAspect
= ASPECT_CONTENT
) = 0;
630 virtual void FillClass( SvGlobalName
* pClassName
,
631 sal_uInt32
* pFormat
,
633 OUString
* pFullTypeName
,
634 OUString
* pShortTypeName
,
636 sal_Bool bTemplate
= sal_False
) const = 0;
638 // change recording and respective passwword protection for Writer and Calc
639 // slots available for Writer: FN_REDLINE_ON, FN_REDLINE_ON
640 // slots used for Calc: FID_CHG_RECORD, SID_CHG_PROTECT
641 virtual bool IsChangeRecording() const;
642 virtual bool HasChangeRecordProtection() const;
643 virtual void SetChangeRecording( bool bActivate
);
644 virtual bool SetProtectionPassword( const String
&rPassword
);
645 virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence
< sal_Int8
> &rPasswordHash
);
647 // =================================
649 SAL_DLLPRIVATE ::boost::shared_ptr
<GDIMetaFile
> CreatePreviewMetaFile_Impl( sal_Bool bFullContent
) const;
651 SAL_DLLPRIVATE sal_Bool
IsOwnStorageFormat_Impl(const SfxMedium
&) const;
653 SAL_DLLPRIVATE sal_Bool
IsPackageStorageFormat_Impl(const SfxMedium
&) const;
655 SAL_DLLPRIVATE sal_Bool
ConnectTmpStorage_Impl( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
, SfxMedium
* pMedium
);
656 SAL_DLLPRIVATE sal_Bool
DisconnectStorage_Impl( SfxMedium
& rSrcMedium
, SfxMedium
& rTargetMedium
);
658 SAL_DLLPRIVATE sal_Bool
PutURLContentsToVersionStream_Impl(
660 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xDocStorage
,
661 OUString aStreamName
);
663 SAL_DLLPRIVATE OUString
CreateTempCopyOfStorage_Impl(
664 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
);
666 SAL_DLLPRIVATE
void InitOwnModel_Impl();
667 SAL_DLLPRIVATE
void BreakMacroSign_Impl( sal_Bool bBreakMacroSing
);
668 SAL_DLLPRIVATE
void CheckSecurityOnLoading_Impl();
669 SAL_DLLPRIVATE
void CheckForBrokenDocSignatures_Impl( const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
>& xHandler
);
670 SAL_DLLPRIVATE sal_uInt16
ImplCheckSignaturesInformation(
671 const ::com::sun::star::uno::Sequence
< ::com::sun::star::security::DocumentSignatureInformation
>& aInfos
);
672 SAL_DLLPRIVATE
void CheckEncryption_Impl( const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
>& xHandler
);
673 SAL_DLLPRIVATE
void SetModifyPasswordEntered( sal_Bool bEntered
= sal_True
);
674 SAL_DLLPRIVATE sal_Bool
IsModifyPasswordEntered();
676 SAL_DLLPRIVATE
void InitBasicManager_Impl();
677 SAL_DLLPRIVATE SfxObjectShell_Impl
* Get_Impl() { return pImp
; }
679 SAL_DLLPRIVATE
static sal_Bool
UseInteractionToHandleError(
680 const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
>& xHandler
,
682 SAL_DLLPRIVATE
const SfxObjectShell_Impl
* Get_Impl() const { return pImp
; }
684 SAL_DLLPRIVATE
void SetCreateMode_Impl( SfxObjectCreateMode nMode
);
686 SAL_DLLPRIVATE
void DoDraw_Impl( OutputDevice
* pDev
,
687 const Point
& rViewPos
,
688 const Fraction
& rScaleX
,
689 const Fraction
& rScaleY
,
690 const JobSetup
& rSetup
,
691 sal_uInt16 nAspect
);
694 SAL_DLLPRIVATE
void ExecFile_Impl(SfxRequest
&);
695 SAL_DLLPRIVATE
void GetState_Impl(SfxItemSet
&);
696 SAL_DLLPRIVATE
void PrintExec_Impl(SfxRequest
&);
697 SAL_DLLPRIVATE
void PrintState_Impl(SfxItemSet
&);
698 SAL_DLLPRIVATE
void ExecProps_Impl(SfxRequest
&);
699 SAL_DLLPRIVATE
void StateProps_Impl(SfxItemSet
&);
700 SAL_DLLPRIVATE
void ExecView_Impl(SfxRequest
&);
701 SAL_DLLPRIVATE
void StateView_Impl(SfxItemSet
&);
703 // Load/Save public internals
704 SAL_DLLPRIVATE sal_Bool
ImportFromGeneratedStream_Impl(
705 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
>& xStream
,
706 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& aMediaDescr
);
707 SAL_DLLPRIVATE
void PositionView_Impl();
708 SAL_DLLPRIVATE
void UpdateFromTemplate_Impl();
709 SAL_DLLPRIVATE sal_Bool
CanReload_Impl();
710 SAL_DLLPRIVATE
void SetNamedVisibility_Impl();
711 SAL_DLLPRIVATE sal_Bool
DoSave_Impl( const SfxItemSet
* pSet
=0 );
712 SAL_DLLPRIVATE sal_Bool
Save_Impl( const SfxItemSet
* pSet
=0 );
713 SAL_DLLPRIVATE sal_Bool
PreDoSaveAs_Impl(const String
&rFileName
, const String
&rFiltName
, SfxItemSet
*);
714 SAL_DLLPRIVATE sal_Bool
APISaveAs_Impl ( const String
& aFileName
, SfxItemSet
* aParams
);
715 SAL_DLLPRIVATE sal_Bool
CommonSaveAs_Impl ( const INetURLObject
& aURL
, const String
& aFilterName
, SfxItemSet
* aParams
);
716 SAL_DLLPRIVATE sal_Bool
GeneralInit_Impl(
717 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
,
718 sal_Bool bTypeMustBeSetAlready
);
719 SAL_DLLPRIVATE
void PrepareSecondTryLoad_Impl();
720 SAL_DLLPRIVATE
void SetInitialized_Impl( const bool i_fromInitNew
);
723 SAL_DLLPRIVATE IndexBitSet
& GetNoSet_Impl();
724 SAL_DLLPRIVATE
void SetProgress_Impl( SfxProgress
*pProgress
);
725 SAL_DLLPRIVATE
void PostActivateEvent_Impl( SfxViewFrame
* );
726 SAL_DLLPRIVATE
void SetActivateEvent_Impl(sal_uInt16
);
727 SAL_DLLPRIVATE SfxObjectShell
* GetParentShellByModel_Impl();
729 // configuration items
730 SAL_DLLPRIVATE SfxToolBoxConfig
* GetToolBoxConfig_Impl();
731 SAL_DLLPRIVATE sal_uInt16
ImplGetSignatureState( sal_Bool bScriptingContent
= sal_False
);
733 SAL_DLLPRIVATE ::com::sun::star::uno::Sequence
< ::com::sun::star::security::DocumentSignatureInformation
>
734 ImplAnalyzeSignature(
735 sal_Bool bScriptingContent
,
736 const ::com::sun::star::uno::Reference
< ::com::sun::star::security::XDocumentDigitalSignatures
>& xSigner
737 = ::com::sun::star::uno::Reference
< ::com::sun::star::security::XDocumentDigitalSignatures
>() );
739 SAL_DLLPRIVATE
void ImplSign( sal_Bool bScriptingContent
= sal_False
);
740 SAL_DLLPRIVATE sal_Bool
QuerySaveSizeExceededModules_Impl( const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
>& xHandler
);
742 SAL_DLLPRIVATE
void CheckOut( );
743 SAL_DLLPRIVATE
void CancelCheckOut( );
744 SAL_DLLPRIVATE
void CheckIn( );
747 #define SFX_GLOBAL_CLASSID \
748 0x9eaba5c3, 0xb232, 0x4309, \
749 0x84, 0x5f, 0x5f, 0x15, 0xea, 0x50, 0xd0, 0x74
751 struct ModifyBlocker_Impl
753 SfxObjectShell
* pPersist
;
754 sal_Bool bWasEnabled
;
755 ModifyBlocker_Impl( SfxObjectShell
* pPersistP
) : pPersist( pPersistP
)
757 bWasEnabled
= pPersistP
->IsEnableSetModified();
759 pPersistP
->EnableSetModified( sal_False
);
761 ~ModifyBlocker_Impl()
764 pPersist
->EnableSetModified( bWasEnabled
);
769 //--------------------------------------------------------------------
770 #ifndef SFX_DECL_OBJECTSHELL_DEFINED
771 #define SFX_DECL_OBJECTSHELL_DEFINED
772 SV_DECL_REF(SfxObjectShell
)
774 SV_DECL_LOCK(SfxObjectShell
)
775 SV_IMPL_LOCK(SfxObjectShell
)
776 SV_IMPL_REF(SfxObjectShell
)
778 //--------------------------------------------------------------------
779 class AutoReloadTimer_Impl
: public Timer
782 SfxObjectShell
* pObjSh
;
785 AutoReloadTimer_Impl( const String
& rURL
, sal_uInt32 nTime
,
786 SfxObjectShell
* pSh
);
787 virtual void Timeout();
790 //-------------------------------------------------------------------------
792 class SFX2_DLLPUBLIC SfxObjectShellItem
: public SfxPoolItem
794 SfxObjectShell
* pObjSh
;
798 SfxObjectShellItem() :
802 SfxObjectShellItem( SfxObjectShell
*pObjShell
):
806 SfxObjectShellItem( sal_uInt16 nWhichId
,
807 SfxObjectShell
*pObjShell
):
808 SfxPoolItem( nWhichId
),
812 virtual int operator==( const SfxPoolItem
& ) const;
813 virtual String
GetValueText() const;
814 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
815 virtual bool QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const;
816 virtual bool PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 );
817 SfxObjectShell
* GetObjectShell() const
824 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */