bump product version to 4.2.0.1
[LibreOffice.git] / include / sfx2 / objsh.hxx
blobde041fbf3bc728c1f159d43277e13d2660db69a5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_SFX2_OBJSH_HXX
20 #define INCLUDED_SFX2_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 <com/sun/star/document/CmisVersion.hpp>
41 #include <boost/shared_ptr.hpp>
43 //________________________________________________________________________________________________________________
44 // include something else
45 //________________________________________________________________________________________________________________
47 #include <vcl/timer.hxx>
48 #include <svl/poolitem.hxx>
49 #include <vcl/bitmap.hxx>
50 #include <sot/storage.hxx>
51 #include <rsc/rscsfx.hxx>
53 #include <sfx2/XmlIdRegistry.hxx>
54 #include <sfx2/shell.hxx>
55 #include <comphelper/embeddedobjectcontainer.hxx>
56 #include <com/sun/star/frame/XModel.hpp>
58 class SbxValue;
59 class SvxMacro;
60 class SbxArray;
61 class BasicManager;
62 class SfxMedium;
63 class SfxObjectFactory;
64 class SfxDocumentInfoDialog;
65 class SfxStyleSheetBasePool;
66 class INote;
67 class SfxStyleSheetPool;
68 class SfxFrame;
69 class SbMethod;
70 class StarBASIC;
71 class Printer;
72 class SvKeyValueIterator;
73 class SfxBaseModel;
74 class SfxModule;
75 class SvData;
76 class SfxProgress;
77 class GDIMetaFile;
78 class Bitmap;
79 class INetURLObject;
80 class IndexBitSet;
81 class JobSetup;
82 class Size;
83 class Point;
85 // From embobj.hxx
86 #define ASPECT_CONTENT 1
87 #define ASPECT_THUMBNAIL 2 /* 120 * 120, 6 Colors DIB in MetaFile */
88 #define ASPECT_ICON 4
89 #define ASPECT_DOCPRINT 8
90 #define ASPECT_ALL (ASPECT_CONTENT | ASPECT_THUMBNAIL | ASPECT_ICON | ASPECT_DOCPRINT)
92 // from pseudo.hxx; must be the same as in OLE2
93 #define SVOBJ_MISCSTATUS_SERVERRESIZE 1
94 #define SVOBJ_MISCSTATUS_NOTREPLACE 4
95 #define SVOBJ_MISCSTATUS_CANTLINKINSIDE 16
96 #define SVOBJ_MISCSTATUS_LINK 64
97 #define SVOBJ_MISCSTATUS_INSIDEOUT 128
98 #define SVOBJ_MISCSTATUS_ACTIVATEWHENVISIBLE 256
99 #define SVOBJ_MISCSTATUS_NOTRESIZEABLE 512
100 #define SVOBJ_MISCSTATUS_ALWAYSACTIVATE 1024
101 #define SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE 2048
102 #define SVOBJ_MISCSTATUS_SPECIALOBJECT 4096
105 namespace sfx2
107 class SvLinkSource;
110 namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
112 namespace com { namespace sun { namespace star {
113 namespace document {
114 class XDocumentProperties;
116 namespace lang {
117 class XComponent;
119 namespace text {
120 class XTextRange;
122 } } }
124 typedef sal_uInt32 SfxObjectShellFlags;
125 #define SFXOBJECTSHELL_HASOPENDOC 0x01L
126 #define SFXOBJECTSHELL_DONTREPLACE 0x02L
127 #define SFXOBJECTSHELL_HASMENU 0x04L
128 #define SFXOBJECTSHELL_DONTLOADFILTERS 0x08L
129 #define SFXOBJECTSHELL_DONTCLOSE 0x10L
130 #define SFXOBJECTSHELL_NODOCINFO 0x20L
131 #define SFXOBJECTSHELL_STD_NORMAL ( SFXOBJECTSHELL_HASOPENDOC )
132 #define SFXOBJECTSHELL_STD_SPECIAL ( SFXOBJECTSHELL_DONTLOADFILTERS )
133 #define SFXOBJECTSHELL_UNDEFINED 0xf000000
135 //--------------------------------------------------------------------
137 #define SFX_TITLE_TITLE 0
138 #define SFX_TITLE_FILENAME 1
139 #define SFX_TITLE_FULLNAME 2
140 #define SFX_TITLE_APINAME 3
141 #define SFX_TITLE_DETECT 4
142 #define SFX_TITLE_CAPTION 5
143 #define SFX_TITLE_PICKLIST 6
144 #define SFX_TITLE_HISTORY 7
145 #define SFX_TITLE_MAXLEN 10 // this gives the limits on length
147 #define SFX_LOADED_MAINDOCUMENT 1
148 #define SFX_LOADED_IMAGES 2
149 #define SFX_LOADED_ALL 3
151 //--------------------------------------------------------------------
153 #define HIDDENINFORMATION_RECORDEDCHANGES 0x0001
154 #define HIDDENINFORMATION_NOTES 0x0002
155 #define HIDDENINFORMATION_DOCUMENTVERSIONS 0x0004
157 enum HiddenWarningFact
159 WhenSaving = 0,
160 WhenPrinting,
161 WhenSigning,
162 WhenCreatingPDF
165 //--------------------------------------------------------------------
167 enum SfxObjectCreateMode
169 SFX_CREATE_MODE_EMBEDDED,
170 SFX_CREATE_MODE_STANDARD,
171 SFX_CREATE_MODE_PREVIEW,
172 SFX_CREATE_MODE_ORGANIZER,
173 SFX_CREATE_MODE_PLUGIN,
174 SFX_CREATE_MODE_INTERNAL
177 /*====================================================================
179 The class SfxObjectShell is the base class for SFx-objects, ie documents
180 and parts of documents that can be integrated as separate objects
181 into foreign objects.
183 ----------------------------------------------------------------------*/
185 class SfxToolBoxConfig;
186 struct TransferableObjectDescriptor;
188 class SFX2_DLLPUBLIC SfxObjectShell :
189 public SfxShell, virtual public SotObject,
190 public ::comphelper::IEmbeddedHelper, public ::sfx2::IXmlIdRegistrySupplier
192 friend struct ModifyBlocker_Impl;
193 friend class SfxObjectShellLock;
195 private:
196 struct SfxObjectShell_Impl* pImp; // internal data
198 SfxMedium * pMedium; // Description of the file for example
199 // storage that contains the object
200 SfxStyleSheetBasePool* pStyleSheetPool; // StyleSheets
201 SfxObjectCreateMode eCreateMode; // Purpose of the object
202 sal_Bool bHasName :1; // sal_True := existing object,
203 // sal_False := new object
204 sal_Bool bIsInGenerateThumbnail; //optimize thumbnail generate and store procedure to improve odt saving performance, i120030
206 private:
207 SAL_DLLPRIVATE void UpdateTime_Impl(const ::com::sun::star::uno::Reference<
208 ::com::sun::star::document::XDocumentProperties> & i_xDocProps);
210 SAL_DLLPRIVATE sal_Bool SaveTo_Impl(SfxMedium &rMedium, const SfxItemSet* pSet );
212 protected:
213 SfxObjectShell(SfxObjectCreateMode);
214 SfxObjectShell( const sal_uInt64 i_nCreationFlags ); // see sfxmodelfactory.hxx
215 virtual ~SfxObjectShell();
217 virtual void ModifyChanged();
218 virtual bool Close();
220 /** declares the document to have capabilities to contain basic/dialog libraries
222 void SetHasNoBasic();
224 /// template method, called by FlushDocInfo; this implementation is empty
225 virtual void DoFlushDocInfo();
227 // helper method
228 void AddToRecentlyUsedList();
230 public:
231 TYPEINFO();
232 SFX_DECL_INTERFACE(SFX_INTERFACE_SFXDOCSH)
234 static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
235 /* Stampit disable/enable cancel button for print jobs
236 default = true = enable! */
237 void Stamp_SetPrintCancelState(sal_Bool bState);
238 sal_Bool Stamp_GetPrintCancelState() const;
240 using SotObject::GetInterface;
242 // Document-Shell Iterator
243 static SfxObjectShell* GetFirst( const TypeId* pType = 0,
244 sal_Bool bOnlyVisible = sal_True );
245 static SfxObjectShell* GetNext( const SfxObjectShell& rPrev,
246 const TypeId* pType = 0,
247 sal_Bool bOnlyVisible = sal_True );
248 static SfxObjectShell* Current();
249 static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
250 GetCurrentComponent();
251 static void SetCurrentComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
253 virtual void Invalidate(sal_uInt16 nId = 0);
255 SfxObjectShellFlags GetFlags( ) const ;
257 SfxModule* GetModule() const;
259 virtual SfxObjectFactory& GetFactory() const=0;
260 SfxMedium * GetMedium() const { return pMedium; }
261 ::com::sun::star::uno::Reference<
262 ::com::sun::star::document::XDocumentProperties > getDocProperties();
263 void UpdateDocInfoForSave( );
264 void FlushDocInfo();
265 sal_Bool HasName() const { return bHasName; }
266 virtual OUString GetAPIName() const;
267 void SetReadOnly();
268 sal_Bool IsReadOnly() const;
269 sal_Bool IsReadOnlyMedium() const;
270 bool IsOriginallyReadOnlyMedium() const;
271 void SetReadOnlyUI( sal_Bool bReadOnly = sal_True );
272 sal_Bool IsReadOnlyUI() const;
273 void SetNoName();
274 sal_Bool IsInModalMode() const;
275 sal_Bool IsInPrepareClose() const;
276 virtual sal_Bool AcceptStateUpdate() const;
277 sal_Bool IsHelpDocument() const;
279 #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
280 sal_Bool IsDocShared() const;
281 OUString GetSharedFileURL() const;
282 sal_Bool SwitchToShared( sal_Bool bShared, sal_Bool bSave );
283 SAL_DLLPRIVATE void FreeSharedFile();
284 SAL_DLLPRIVATE void FreeSharedFile( const OUString& aTempFileURL );
285 SAL_DLLPRIVATE void DoNotCleanShareControlFile();
286 void SetSharedXMLFlag( sal_Bool bFlag ) const;
287 sal_Bool HasSharedXMLFlagSet() const;
288 #else
289 sal_Bool IsDocShared() const
290 { return sal_False; };
291 OUString GetSharedFileURL() const
292 { return OUString(); };
293 #endif
295 SAL_DLLPRIVATE void SetModalMode_Impl(sal_Bool bModal=sal_True);
296 SAL_DLLPRIVATE void SetMacroMode_Impl(sal_Bool bModal=sal_True);
298 void ResetError();
299 sal_uInt32 GetError() const;
300 sal_uInt32 GetErrorCode() const;
301 void SetError( sal_uInt32 rErr, const OUString& aLogMessage );
303 void AddLog( const OUString& aMessage );
304 void StoreLog();
307 * Initialize bare minimum just enough for unit test runs.
309 * @return true if the initialization is successful, false otherwise.
311 bool DoInitUnitTest();
312 sal_Bool DoInitNew( SfxMedium* pMedium=0 );
313 sal_Bool DoLoad( SfxMedium* pMedium );
314 bool DoLoadExternal( SfxMedium* pMed );
315 sal_Bool DoSave();
316 sal_Bool DoSaveAs( SfxMedium &rNewStor );
317 sal_Bool DoSaveObjectAs( SfxMedium &rNewStor, sal_Bool bCommit );
319 // TODO/LATER: currently only overloaded in Calc, should be made non-virtual
320 virtual sal_Bool DoSaveCompleted( SfxMedium* pNewStor=0 );
322 virtual sal_Bool LoadOwnFormat( SfxMedium& pMedium );
323 virtual sal_Bool SaveAsOwnFormat( SfxMedium& pMedium );
324 virtual sal_Bool ConvertFrom( SfxMedium &rMedium );
325 virtual sal_Bool ConvertTo( SfxMedium &rMedium );
326 virtual sal_Bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
327 virtual sal_Bool Load( SfxMedium &rMedium );
328 virtual sal_Bool LoadFrom( SfxMedium& rMedium );
329 virtual sal_Bool Save();
330 virtual sal_Bool SaveAs( SfxMedium &rMedium );
331 virtual sal_Bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
332 virtual sal_Bool SwitchPersistance(
333 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
334 virtual void UpdateLinks();
335 virtual bool LoadExternal( SfxMedium& rMedium );
337 * Called when the Options dialog is dismissed with the OK button, to
338 * handle potentially conflicting option settings.
340 virtual void CheckConfigOptions();
341 sal_Bool IsConfigOptionsChecked() const;
342 void SetConfigOptionsChecked( sal_Bool bChecked );
344 // called for a few slots like SID_SAVE[AS]DOC, SID_PRINTDOC[DIRECT], derived classes may abort the action
345 virtual sal_Bool QuerySlotExecutable( sal_uInt16 nSlotId );
347 sal_Bool SaveChildren(sal_Bool bObjectsOnly=sal_False);
348 sal_Bool SaveAsChildren( SfxMedium &rMedium );
349 sal_Bool SwitchChildrenPersistance(
350 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
351 sal_Bool bForceNonModified = sal_False );
352 sal_Bool SaveCompletedChildren( sal_Bool bSuccess );
354 /** a very special case to insert at a position in Writer from UNO,
355 via OwnSubFilterService */
356 virtual bool InsertGeneratedStream(SfxMedium& rMedium,
357 css::uno::Reference<css::text::XTextRange> const& xInsertPosition);
358 virtual bool ImportFrom( SfxMedium &rMedium,
359 css::uno::Reference<css::text::XTextRange> const& xInsertPosition);
360 sal_Bool ExportTo( SfxMedium &rMedium );
362 // xmlsec05, check with SFX team
363 sal_uInt16 GetDocumentSignatureState();
364 void SignDocumentContent();
365 sal_uInt16 GetScriptingSignatureState();
366 void SignScriptingContent();
368 virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog(
369 Window *pParent, const SfxItemSet& );
371 ErrCode CallBasic( const OUString& rMacro, const OUString& rBasicName,
372 SbxArray* pArgs = 0, SbxValue* pRet = 0 );
374 ErrCode CallXScript(
375 const OUString& rScriptURL,
376 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
377 ::com::sun::star::uno::Any& aRet,
378 ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
379 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
380 bool bRaiseError = true,
381 const ::com::sun::star::uno::Any* aCaller = 0 );
383 static ErrCode CallXScript(
384 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxScriptContext,
385 const OUString& rScriptURL,
386 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
387 ::com::sun::star::uno::Any& aRet,
388 ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
389 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
390 bool bRaiseError = true,
391 const ::com::sun::star::uno::Any* aCaller = 0
394 /** adjusts the internal macro mode, according to the current security settings
396 Finally, the macro mode is either NEVER_EXECUTE or ALWAYS_EXECUTE_NO_WARN.
398 @return
399 whether macros from this document should be executed
401 bool AdjustMacroMode( const OUString& rScriptType, bool _bSuppressUI = false );
403 SvKeyValueIterator* GetHeaderAttributes();
404 void ClearHeaderAttributesForSourceViewHack();
405 void SetHeaderAttributesForSourceViewHack();
407 sal_Bool IsTemplate() const;
409 sal_Bool IsQueryLoadTemplate() const;
410 sal_Bool IsUseUserData() const;
411 sal_Bool IsLoadReadonly() const;
412 sal_Bool IsSaveVersionOnClose() const;
413 void SetQueryLoadTemplate( sal_Bool b );
414 void SetUseUserData( sal_Bool bNew );
415 void SetLoadReadonly( sal_Bool _bReadonly );
416 void SetSaveVersionOnClose( sal_Bool bSet );
417 void ResetFromTemplate( const OUString& rTemplateName, const OUString& rFileName );
419 // TODO/LATER: the following two methods should be replaced by Get/SetModifPasswordInfo in future
420 sal_uInt32 GetModifyPasswordHash() const;
421 sal_Bool SetModifyPasswordHash( sal_uInt32 nHash );
423 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetModifyPasswordInfo() const;
424 sal_Bool SetModifyPasswordInfo( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aInfo );
426 static sal_uInt32 HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc );
428 virtual void ViewAssigned();
429 virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
430 virtual sal_Bool IsInformationLost();
431 virtual sal_uInt16 GetHiddenInformationState( sal_uInt16 nStates );
432 sal_Int16 QueryHiddenInformation( HiddenWarningFact eFact, Window* pParent );
433 virtual sal_Bool HasSecurityOptOpenReadOnly() const;
434 sal_Bool IsSecurityOptOpenReadOnly() const;
435 void SetSecurityOptOpenReadOnly( sal_Bool bOpenReadOnly = sal_True );
437 virtual Size GetFirstPageSize();
438 virtual sal_Bool DoClose();
439 virtual void PrepareReload();
440 virtual ::boost::shared_ptr<GDIMetaFile> GetPreviewMetaFile( sal_Bool bFullContent = sal_False ) const;
441 virtual void CancelTransfers();
443 sal_Bool GenerateAndStoreThumbnail(
444 sal_Bool bEncrypted,
445 sal_Bool bSigned,
446 sal_Bool bIsTemplate,
447 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor );
449 sal_Bool WriteThumbnail(
450 sal_Bool bEncrypted,
451 sal_Bool bSigned,
452 sal_Bool bIsTemplate,
453 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream );
455 sal_Bool IsInGenerateAndStoreThumbnail() const {return bIsInGenerateThumbnail;}//optimize thumbnail generate and store procedure to improve odt saving performance, i120030
457 // Transfer IFace
458 void AbortImport();
459 sal_Bool IsAbortingImport() const;
460 sal_Bool IsReloading() const;
461 void FinishedLoading( sal_uInt16 nWhich = SFX_LOADED_ALL );
462 void TemplateDisconnectionAfterLoad();
463 sal_Bool IsLoading() const;
464 sal_Bool IsLoadingFinished() const;
465 void SetAutoLoad( const INetURLObject&, sal_uInt32 nTime, sal_Bool bReload = sal_True );
466 sal_Bool IsAutoLoadLocked() const;
467 void NotifyReloadAvailable();
469 // Misc
470 sal_Bool IsPreview() const;
471 SfxObjectCreateMode GetCreateMode() const { return eCreateMode; }
472 SfxProgress* GetProgress() const;
473 void SetWaitCursor( sal_Bool bSet ) const;
475 // Naming Interface
476 void SetTitle( const OUString& rTitle );
477 OUString GetTitle( sal_uInt16 nMaxLen = 0 ) const;
478 void InvalidateName(); // Re-set to unnamed
480 // DDE-Interface
481 virtual long DdeExecute( const OUString& rCmd );
482 virtual long DdeGetData( const OUString& rItem,
483 const OUString& rMimeType,
484 ::com::sun::star::uno::Any & rValue );
485 virtual long DdeSetData( const OUString& rItem,
486 const OUString& rMimeType,
487 const ::com::sun::star::uno::Any & rValue );
488 virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const OUString& rItem );
489 virtual void ReconnectDdeLink(SfxObjectShell& rServer);
491 static void ReconnectDdeLinks(SfxObjectShell& rServer);
493 // Contents
494 virtual SfxStyleSheetBasePool* GetStyleSheetPool();
495 void SetStyleSheetPool(SfxStyleSheetBasePool *pBasePool ) {
496 pStyleSheetPool = pBasePool; }
498 // Determine the position of the "Automatic" filter in the stylist
499 void SetAutoStyleFilterIndex(sal_uInt16 nSet);
500 sal_uInt16 GetAutoStyleFilterIndex();
501 virtual sal_Bool HasBasic() const;
502 BasicManager* GetBasicManager() const;
503 com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >
504 GetBasicContainer();
505 com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >
506 GetDialogContainer();
507 StarBASIC* GetBasic() const;
509 // Interface Document content, Organizer
510 #define INDEX_IGNORE USHRT_MAX
512 #define CONTENT_STYLE 0
513 #define CONTENT_CONFIG 1
514 #define CONTENT_MACRO 2
515 #define DEF_CONTENT_COUNT 1
518 virtual void LoadStyles( SfxObjectShell &rSource );
519 void ReadNote( INote * );
520 void UpdateNote( INote * );
522 // Documents, for which to format the view size
524 virtual SfxObjectShell* GetObjectShell();
526 virtual SfxFrame* GetSmartSelf( SfxFrame* pSelf, SfxMedium& rMedium );
528 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
529 GetModel() const;
530 // Only temporarily for the applications!
531 void SetBaseModel( SfxBaseModel* pModel );
532 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetBaseModel() const;
533 // Only temporarily for the applications!
535 virtual ::com::sun::star::uno::Sequence< OUString > GetEventNames();
537 Window* GetDialogParent( SfxMedium* pMedium=0 );
538 static SfxObjectShell* CreateObject( const OUString& rServiceName, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD );
539 static SfxObjectShell* CreateObjectByFactoryName( const OUString& rURL, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD );
540 static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
541 CreateAndLoadComponent( const SfxItemSet& rSet, SfxFrame* pFrame = NULL );
542 static SfxObjectShell* GetShellFromComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComp );
543 static OUString GetServiceNameFromFactory( const OUString& rFact );
544 sal_Bool IsInPlaceActive();
545 sal_Bool IsUIActive();
546 virtual void InPlaceActivate( sal_Bool );
547 virtual void UIActivate( sal_Bool );
549 static sal_Bool CopyStoragesOfUnknownMediaType(
550 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xSource,
551 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTarget );
553 // ==== The functions from SvPersist
554 void EnableSetModified( sal_Bool bEnable = sal_True );
555 sal_Bool IsEnableSetModified() const;
556 virtual void SetModified( sal_Bool bModified = sal_True );
557 sal_Bool IsModified();
560 * @param bChart true if the file is a chart doc and FillClass should not be called
562 void SetupStorage(
563 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
564 sal_Int32 nVersion, sal_Bool bTemplate, bool bChart = false ) const;
566 ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorage();
568 SvGlobalName GetClassName() const;
570 // comphelper::IEmbeddedHelper
571 virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler() const;
572 virtual com::sun::star::uno::Reference < com::sun::star::embed::XStorage > getStorage() const
574 return const_cast<SfxObjectShell*>(this)->GetStorage();
576 virtual comphelper::EmbeddedObjectContainer& getEmbeddedObjectContainer() const
578 return GetEmbeddedObjectContainer();
580 bool isEnableSetModified() const
582 return IsEnableSetModified();
584 comphelper::EmbeddedObjectContainer& GetEmbeddedObjectContainer() const;
585 void ClearEmbeddedObjects();
587 // ==== The functions from SvEmbeddedObject
588 virtual Printer * GetDocumentPrinter();
589 virtual OutputDevice* GetDocumentRefDev();
590 virtual void OnDocumentPrinterChanged( Printer * pNewPrinter );
591 virtual Rectangle GetVisArea( sal_uInt16 nAspect ) const;
592 virtual void SetVisArea( const Rectangle & rVisArea );
593 const Rectangle & GetVisArea() const;
594 void SetVisAreaSize( const Size & rVisSize );
595 virtual sal_uIntPtr GetMiscStatus() const;
597 MapUnit GetMapUnit() const;
598 void SetMapUnit( MapUnit nMUnit );
600 void FillTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc ) const;
601 void DoDraw( OutputDevice *, const Point & rObjPos,
602 const Size & rSize,
603 const JobSetup & rSetup,
604 sal_uInt16 nAspect = ASPECT_CONTENT );
605 virtual void Draw( OutputDevice *, const JobSetup & rSetup,
606 sal_uInt16 nAspect = ASPECT_CONTENT ) = 0;
609 virtual void FillClass( SvGlobalName * pClassName,
610 sal_uInt32 * pFormat,
611 OUString * pAppName,
612 OUString * pFullTypeName,
613 OUString * pShortTypeName,
614 sal_Int32 nVersion,
615 sal_Bool bTemplate = sal_False) const = 0;
617 // change recording and respective passwword protection for Writer and Calc
618 // slots available for Writer: FN_REDLINE_ON, FN_REDLINE_ON
619 // slots used for Calc: FID_CHG_RECORD, SID_CHG_PROTECT
620 virtual bool IsChangeRecording() const;
621 virtual bool HasChangeRecordProtection() const;
622 virtual void SetChangeRecording( bool bActivate );
623 virtual bool SetProtectionPassword( const OUString &rPassword );
624 virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash );
626 // =================================
628 SAL_DLLPRIVATE ::boost::shared_ptr<GDIMetaFile> CreatePreviewMetaFile_Impl( sal_Bool bFullContent ) const;
630 SAL_DLLPRIVATE sal_Bool IsOwnStorageFormat_Impl(const SfxMedium &) const;
632 SAL_DLLPRIVATE sal_Bool IsPackageStorageFormat_Impl(const SfxMedium &) const;
634 SAL_DLLPRIVATE sal_Bool ConnectTmpStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, SfxMedium* pMedium );
635 SAL_DLLPRIVATE sal_Bool DisconnectStorage_Impl( SfxMedium& rSrcMedium, SfxMedium& rTargetMedium );
637 SAL_DLLPRIVATE sal_Bool PutURLContentsToVersionStream_Impl(
638 OUString aURL,
639 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDocStorage,
640 OUString aStreamName );
642 SAL_DLLPRIVATE OUString CreateTempCopyOfStorage_Impl(
643 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
645 SAL_DLLPRIVATE void InitOwnModel_Impl();
646 SAL_DLLPRIVATE void BreakMacroSign_Impl( sal_Bool bBreakMacroSing );
647 SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl();
648 SAL_DLLPRIVATE void CheckForBrokenDocSignatures_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
649 SAL_DLLPRIVATE sal_uInt16 ImplCheckSignaturesInformation(
650 const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos );
651 SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
652 SAL_DLLPRIVATE void SetModifyPasswordEntered( sal_Bool bEntered = sal_True );
653 SAL_DLLPRIVATE sal_Bool IsModifyPasswordEntered();
655 SAL_DLLPRIVATE void InitBasicManager_Impl();
656 SAL_DLLPRIVATE SfxObjectShell_Impl* Get_Impl() { return pImp; }
658 SAL_DLLPRIVATE static sal_Bool UseInteractionToHandleError(
659 const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler,
660 sal_uInt32 nError );
661 SAL_DLLPRIVATE const SfxObjectShell_Impl* Get_Impl() const { return pImp; }
663 SAL_DLLPRIVATE void SetCreateMode_Impl( SfxObjectCreateMode nMode );
665 SAL_DLLPRIVATE void DoDraw_Impl( OutputDevice* pDev,
666 const Point & rViewPos,
667 const Fraction & rScaleX,
668 const Fraction & rScaleY,
669 const JobSetup & rSetup,
670 sal_uInt16 nAspect );
672 // Shell Interface
673 SAL_DLLPRIVATE void ExecFile_Impl(SfxRequest &);
674 SAL_DLLPRIVATE void GetState_Impl(SfxItemSet&);
675 SAL_DLLPRIVATE void PrintExec_Impl(SfxRequest &);
676 SAL_DLLPRIVATE void PrintState_Impl(SfxItemSet&);
677 SAL_DLLPRIVATE void ExecProps_Impl(SfxRequest &);
678 SAL_DLLPRIVATE void StateProps_Impl(SfxItemSet &);
679 SAL_DLLPRIVATE void ExecView_Impl(SfxRequest &);
680 SAL_DLLPRIVATE void StateView_Impl(SfxItemSet &);
682 // Load/Save public internals
683 SAL_DLLPRIVATE sal_Bool ImportFromGeneratedStream_Impl(
684 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream,
685 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr );
686 SAL_DLLPRIVATE void PositionView_Impl();
687 SAL_DLLPRIVATE void UpdateFromTemplate_Impl();
688 SAL_DLLPRIVATE sal_Bool CanReload_Impl();
689 SAL_DLLPRIVATE void SetNamedVisibility_Impl();
690 SAL_DLLPRIVATE sal_Bool DoSave_Impl( const SfxItemSet* pSet=0 );
691 SAL_DLLPRIVATE sal_Bool Save_Impl( const SfxItemSet* pSet=0 );
692 SAL_DLLPRIVATE sal_Bool PreDoSaveAs_Impl(const OUString &rFileName, const OUString &rFiltName, SfxItemSet *);
693 SAL_DLLPRIVATE sal_Bool APISaveAs_Impl ( const OUString& aFileName, SfxItemSet* aParams );
694 SAL_DLLPRIVATE sal_Bool CommonSaveAs_Impl ( const INetURLObject& aURL, const OUString& aFilterName, SfxItemSet* aParams );
695 SAL_DLLPRIVATE sal_Bool GeneralInit_Impl(
696 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
697 sal_Bool bTypeMustBeSetAlready );
698 SAL_DLLPRIVATE void PrepareSecondTryLoad_Impl();
699 SAL_DLLPRIVATE void SetInitialized_Impl( const bool i_fromInitNew );
701 // public-internals
702 SAL_DLLPRIVATE IndexBitSet& GetNoSet_Impl();
703 SAL_DLLPRIVATE void SetProgress_Impl( SfxProgress *pProgress );
704 SAL_DLLPRIVATE void PostActivateEvent_Impl( SfxViewFrame* );
705 SAL_DLLPRIVATE void SetActivateEvent_Impl(sal_uInt16 );
706 SAL_DLLPRIVATE SfxObjectShell* GetParentShellByModel_Impl();
708 // configuration items
709 SAL_DLLPRIVATE SfxToolBoxConfig* GetToolBoxConfig_Impl();
710 SAL_DLLPRIVATE sal_uInt16 ImplGetSignatureState( sal_Bool bScriptingContent = sal_False );
712 SAL_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >
713 ImplAnalyzeSignature(
714 sal_Bool bScriptingContent,
715 const ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >& xSigner
716 = ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >() );
718 SAL_DLLPRIVATE void ImplSign( sal_Bool bScriptingContent = sal_False );
719 SAL_DLLPRIVATE sal_Bool QuerySaveSizeExceededModules_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
721 SAL_DLLPRIVATE void CheckOut( );
722 SAL_DLLPRIVATE void CancelCheckOut( );
723 SAL_DLLPRIVATE void CheckIn( );
724 SAL_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::document::CmisVersion > GetCmisVersions();
727 #define SFX_GLOBAL_CLASSID \
728 0x9eaba5c3, 0xb232, 0x4309, \
729 0x84, 0x5f, 0x5f, 0x15, 0xea, 0x50, 0xd0, 0x74
731 struct ModifyBlocker_Impl
733 SfxObjectShell* pPersist;
734 sal_Bool bWasEnabled;
735 ModifyBlocker_Impl( SfxObjectShell* pPersistP ) : pPersist( pPersistP )
737 bWasEnabled = pPersistP->IsEnableSetModified();
738 if ( bWasEnabled )
739 pPersistP->EnableSetModified( sal_False );
741 ~ModifyBlocker_Impl()
743 if ( bWasEnabled )
744 pPersist->EnableSetModified( bWasEnabled );
749 //--------------------------------------------------------------------
750 #ifndef SFX_DECL_OBJECTSHELL_DEFINED
751 #define SFX_DECL_OBJECTSHELL_DEFINED
752 SV_DECL_REF(SfxObjectShell)
753 #endif
754 SV_DECL_LOCK(SfxObjectShell)
755 SV_IMPL_LOCK(SfxObjectShell)
756 SV_IMPL_REF(SfxObjectShell)
758 //--------------------------------------------------------------------
759 class AutoReloadTimer_Impl : public Timer
761 OUString aUrl;
762 SfxObjectShell* pObjSh;
764 public:
765 AutoReloadTimer_Impl( const OUString& rURL, sal_uInt32 nTime,
766 SfxObjectShell* pSh );
767 virtual void Timeout();
770 //-------------------------------------------------------------------------
772 class SFX2_DLLPUBLIC SfxObjectShellItem: public SfxPoolItem
774 SfxObjectShell* pObjSh;
776 public:
777 TYPEINFO();
778 SfxObjectShellItem() :
779 SfxPoolItem( 0 ),
780 pObjSh( 0 )
782 SfxObjectShellItem( SfxObjectShell *pObjShell ):
783 SfxPoolItem( 0 ),
784 pObjSh( pObjShell )
786 SfxObjectShellItem( sal_uInt16 nWhichId,
787 SfxObjectShell *pObjShell ):
788 SfxPoolItem( nWhichId ),
789 pObjSh( pObjShell )
792 virtual int operator==( const SfxPoolItem& ) const;
793 virtual OUString GetValueText() const;
794 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
795 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
796 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
797 SfxObjectShell* GetObjectShell() const
798 { return pObjSh; }
802 #endif
804 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */