bump product version to 5.0.4.1
[LibreOffice.git] / include / sfx2 / objsh.hxx
blobce8ab3018f6f0ad8526a3d764a8e08df67315397
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 <sal/config.h>
23 #include <sfx2/dllapi.h>
24 #include <sfx2/signaturestate.hxx>
25 #include <sal/types.h>
26 #include <tools/errcode.hxx>
27 #include <com/sun/star/frame/XFrame.hpp>
28 #include <com/sun/star/uno/Reference.h>
29 #include <com/sun/star/uno/Sequence.hxx>
30 #include <com/sun/star/script/XLibraryContainer.hpp>
31 #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
32 #include <com/sun/star/embed/XStorage.hpp>
33 #include <com/sun/star/beans/PropertyValue.hpp>
34 #include <com/sun/star/security/DocumentSignatureInformation.hpp>
35 #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
36 #include <com/sun/star/task/XInteractionHandler.hpp>
37 #include <com/sun/star/beans/XPropertySet.hpp>
38 #include <com/sun/star/document/CmisVersion.hpp>
40 #include <vcl/timer.hxx>
41 #include <vcl/vclptr.hxx>
42 #include <svl/poolitem.hxx>
43 #include <vcl/bitmap.hxx>
44 #include <sot/formats.hxx>
45 #include <sot/object.hxx>
46 #include <rsc/rscsfx.hxx>
48 #include <sfx2/XmlIdRegistry.hxx>
49 #include <sfx2/shell.hxx>
50 #include <comphelper/embeddedobjectcontainer.hxx>
51 #include <com/sun/star/frame/XModel.hpp>
52 #include <memory>
53 #include <set>
54 #include <o3tl/typed_flags_set.hxx>
56 #define LOK_USE_UNSTABLE_API
57 #include <LibreOfficeKit/LibreOfficeKitTypes.h>
59 class SbxValue;
60 class SvxMacro;
61 class SbxArray;
62 class BasicManager;
63 class SfxMedium;
64 class SfxObjectFactory;
65 class SfxDocumentInfoDialog;
66 class SfxStyleSheetBasePool;
67 class INote;
68 class SfxStyleSheetPool;
69 class SfxFrame;
70 class SbMethod;
71 class StarBASIC;
72 class Printer;
73 class SvKeyValueIterator;
74 class SfxBaseModel;
75 class SfxModule;
76 class SvData;
77 class SfxProgress;
78 class GDIMetaFile;
79 class Bitmap;
80 class INetURLObject;
81 class IndexBitSet;
82 class JobSetup;
83 class Size;
84 class Point;
85 enum class SfxModelFlags;
87 // These values presumably must match exactly the corresponding
88 // css::embed::Aspects ones (in offapi/com/sun/star/embed/Aspects.idl)
89 // and the DVASPECT_* ones in the Win32 API.
91 #define ASPECT_CONTENT 1
92 #define ASPECT_THUMBNAIL 2 /* 120 * 120, 6 Colors DIB in MetaFile */
93 #define ASPECT_ICON 4
94 #define ASPECT_DOCPRINT 8
96 // must be the same as in OLE2
97 #define SVOBJ_MISCSTATUS_NOTRESIZEABLE 512
98 #define SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE 2048
100 namespace sfx2
102 class SvLinkSource;
103 class StyleManager;
106 namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
108 namespace com { namespace sun { namespace star {
109 namespace document {
110 class XDocumentProperties;
112 namespace lang {
113 class XComponent;
115 namespace text {
116 class XTextRange;
118 } } }
120 enum class SfxObjectShellFlags
122 HASOPENDOC = 0x01L,
123 HASMENU = 0x04L,
124 DONTLOADFILTERS = 0x08L,
125 DONTCLOSE = 0x10L,
126 NODOCINFO = 0x20L,
127 STD_NORMAL = HASOPENDOC,
128 STD_SPECIAL = DONTLOADFILTERS,
129 UNDEFINED = 0xf000000
131 namespace o3tl
133 template<> struct typed_flags<SfxObjectShellFlags> : is_typed_flags<SfxObjectShellFlags, 0xf00003d> {};
136 #define SFX_TITLE_TITLE 0
137 #define SFX_TITLE_FILENAME 1
138 #define SFX_TITLE_FULLNAME 2
139 #define SFX_TITLE_APINAME 3
140 #define SFX_TITLE_DETECT 4
141 #define SFX_TITLE_CAPTION 5
142 #define SFX_TITLE_PICKLIST 6
143 #define SFX_TITLE_HISTORY 7
144 #define SFX_TITLE_MAXLEN 10 // this gives the limits on length
146 enum class SfxLoadedFlags
148 NONE = 0,
149 MAINDOCUMENT = 1,
150 IMAGES = 2,
151 ALL = MAINDOCUMENT | IMAGES
153 namespace o3tl
155 template<> struct typed_flags<SfxLoadedFlags> : is_typed_flags<SfxLoadedFlags, 0x03> {};
158 enum class HiddenInformation
160 NONE = 0x0000,
161 RECORDEDCHANGES = 0x0001,
162 NOTES = 0x0002,
163 DOCUMENTVERSIONS = 0x0004
165 namespace o3tl
167 template<> struct typed_flags<HiddenInformation> : is_typed_flags<HiddenInformation, 0x07> {};
170 enum class HiddenWarningFact
172 WhenSaving = 0,
173 WhenPrinting,
174 WhenSigning,
175 WhenCreatingPDF
178 enum class SfxObjectCreateMode
180 EMBEDDED,
181 STANDARD,
182 PREVIEW,
183 ORGANIZER,
184 PLUGIN,
185 INTERNAL
189 The class SfxObjectShell is the base class for SFx-objects, ie documents
190 and parts of documents that can be integrated as separate objects
191 into foreign objects.
194 class SfxToolBoxConfig;
195 struct TransferableObjectDescriptor;
197 class SFX2_DLLPUBLIC SfxObjectShell :
198 public SfxShell, virtual public SotObject,
199 public ::comphelper::IEmbeddedHelper, public ::sfx2::IXmlIdRegistrySupplier
201 friend struct ModifyBlocker_Impl;
202 friend class SfxObjectShellLock;
204 private:
205 struct SfxObjectShell_Impl* pImp; // internal data
207 SfxMedium * pMedium; // Description of the file for example
208 // storage that contains the object
209 SfxStyleSheetBasePool* pStyleSheetPool; // StyleSheets
210 SfxObjectCreateMode eCreateMode; // Purpose of the object
211 bool bHasName :1; // sal_True := existing object,
212 // sal_False := new object
213 bool bIsInGenerateThumbnail; //optimize thumbnail generate and store procedure to improve odt saving performance, i120030
215 bool CloseInternal();
216 private:
217 SAL_DLLPRIVATE void UpdateTime_Impl(const ::com::sun::star::uno::Reference<
218 ::com::sun::star::document::XDocumentProperties> & i_xDocProps);
220 SAL_DLLPRIVATE bool SaveTo_Impl(SfxMedium &rMedium, const SfxItemSet* pSet );
222 protected:
223 SfxObjectShell(SfxObjectCreateMode);
224 SfxObjectShell(SfxModelFlags); // see sfxmodelfactory.hxx
225 virtual ~SfxObjectShell();
227 void ModifyChanged();
228 virtual bool Close() SAL_OVERRIDE;
230 /** declares the document to have capabilities to contain basic/dialog libraries
232 void SetHasNoBasic();
234 /// template method, called by FlushDocInfo; this implementation is empty
235 virtual void DoFlushDocInfo();
237 // helper method
238 void AddToRecentlyUsedList();
240 public:
241 TYPEINFO_OVERRIDE();
242 SFX_DECL_INTERFACE(SFX_INTERFACE_SFXDOCSH)
244 private:
245 /// SfxInterface initializer.
246 static void InitInterface_Impl();
248 public:
249 static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
250 /* Stampit disable/enable cancel button for print jobs
251 default = true = enable! */
252 void Stamp_SetPrintCancelState(bool bState);
253 bool Stamp_GetPrintCancelState() const;
255 static OUString CreateShellID( const SfxObjectShell* pShell );
257 // Document-Shell Iterator
258 static SfxObjectShell* GetFirst( const TypeId* pType = 0,
259 bool bOnlyVisible = true );
260 static SfxObjectShell* GetNext( const SfxObjectShell& rPrev,
261 const TypeId* pType = 0,
262 bool bOnlyVisible = true );
263 static SfxObjectShell* Current();
264 static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
265 GetCurrentComponent();
266 static void SetCurrentComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
268 virtual void Invalidate(sal_uInt16 nId = 0) SAL_OVERRIDE;
270 SfxObjectShellFlags GetFlags( ) const;
272 SfxModule* GetModule() const;
274 virtual SfxObjectFactory& GetFactory() const=0;
275 SfxMedium * GetMedium() const { return pMedium; }
276 ::com::sun::star::uno::Reference<
277 ::com::sun::star::document::XDocumentProperties > getDocProperties();
278 void UpdateDocInfoForSave( );
279 void FlushDocInfo();
280 bool HasName() const { return bHasName; }
281 OUString GetAPIName() const;
282 void SetReadOnly();
283 bool IsReadOnly() const;
284 bool IsReadOnlyMedium() const;
285 bool IsOriginallyReadOnlyMedium() const;
286 void SetReadOnlyUI( bool bReadOnly = true );
287 bool IsReadOnlyUI() const;
288 void SetNoName();
289 bool IsInModalMode() const;
290 bool IsInPrepareClose() const;
291 bool AcceptStateUpdate() const;
292 bool IsHelpDocument() const;
294 bool IsDocShared() const;
295 OUString GetSharedFileURL() const;
296 bool SwitchToShared( bool bShared, bool bSave );
297 SAL_DLLPRIVATE void FreeSharedFile();
298 SAL_DLLPRIVATE void FreeSharedFile( const OUString& aTempFileURL );
299 SAL_DLLPRIVATE void DoNotCleanShareControlFile();
300 void SetSharedXMLFlag( bool bFlag ) const;
301 bool HasSharedXMLFlagSet() const;
303 SAL_DLLPRIVATE void SetModalMode_Impl(bool bModal=true);
304 SAL_DLLPRIVATE void SetMacroMode_Impl(bool bModal=true);
306 void ResetError();
307 sal_uInt32 GetError() const;
308 sal_uInt32 GetErrorCode() const;
309 void SetError( sal_uInt32 rErr, const OUString& aLogMessage );
311 void AddLog( const OUString& aMessage );
312 void StoreLog();
315 * Initialize bare minimum just enough for unit test runs.
317 * @return true if the initialization is successful, false otherwise.
319 bool DoInitUnitTest();
320 bool DoInitNew( SfxMedium* pMedium=0 );
321 bool DoLoad( SfxMedium* pMedium );
322 bool DoLoadExternal( SfxMedium* pMed );
323 bool DoSave();
324 bool DoSaveAs( SfxMedium &rNewStor );
325 bool DoSaveObjectAs( SfxMedium &rNewStor, bool bCommit );
327 // TODO/LATER: currently only overridden in Calc, should be made non-virtual
328 virtual bool DoSaveCompleted( SfxMedium* pNewStor=0 );
330 bool LoadOwnFormat( SfxMedium& pMedium );
331 virtual bool SaveAsOwnFormat( SfxMedium& pMedium );
332 virtual bool ConvertFrom( SfxMedium &rMedium );
333 virtual bool ConvertTo( SfxMedium &rMedium );
334 virtual bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
335 virtual bool Load( SfxMedium &rMedium );
336 virtual bool LoadFrom( SfxMedium& rMedium );
337 virtual bool Save();
338 virtual bool SaveAs( SfxMedium &rMedium );
339 virtual bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
340 bool SwitchPersistance(
341 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
342 virtual void UpdateLinks();
343 virtual bool LoadExternal( SfxMedium& rMedium );
345 * Called when the Options dialog is dismissed with the OK button, to
346 * handle potentially conflicting option settings.
348 virtual void CheckConfigOptions();
349 bool IsConfigOptionsChecked() const;
350 void SetConfigOptionsChecked( bool bChecked );
352 // called for a few slots like SID_SAVE[AS]DOC, SID_PRINTDOC[DIRECT], derived classes may abort the action
353 virtual bool QuerySlotExecutable( sal_uInt16 nSlotId );
355 bool SaveChildren(bool bObjectsOnly=false);
356 bool SaveAsChildren( SfxMedium &rMedium );
357 bool SwitchChildrenPersistance(
358 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
359 bool bForceNonModified = false );
360 bool SaveCompletedChildren( bool bSuccess );
362 /** a very special case to insert at a position in Writer from UNO,
363 via OwnSubFilterService */
364 virtual bool InsertGeneratedStream(SfxMedium& rMedium,
365 css::uno::Reference<css::text::XTextRange> const& xInsertPosition);
366 virtual bool ImportFrom( SfxMedium &rMedium,
367 css::uno::Reference<css::text::XTextRange> const& xInsertPosition);
368 bool ExportTo( SfxMedium &rMedium );
370 // xmlsec05, check with SFX team
371 SignatureState GetDocumentSignatureState();
372 void SignDocumentContent();
373 SignatureState GetScriptingSignatureState();
374 void SignScriptingContent();
376 virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog(
377 vcl::Window *pParent, const SfxItemSet& );
379 ErrCode CallBasic( const OUString& rMacro, const OUString& rBasicName,
380 SbxArray* pArgs = 0, SbxValue* pRet = 0 );
382 ErrCode CallXScript(
383 const OUString& rScriptURL,
384 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
385 ::com::sun::star::uno::Any& aRet,
386 ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
387 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
388 bool bRaiseError = true,
389 const ::com::sun::star::uno::Any* aCaller = 0 );
391 static ErrCode CallXScript(
392 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxScriptContext,
393 const OUString& rScriptURL,
394 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
395 ::com::sun::star::uno::Any& aRet,
396 ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
397 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
398 bool bRaiseError = true,
399 const ::com::sun::star::uno::Any* aCaller = 0
402 /** adjusts the internal macro mode, according to the current security settings
404 Finally, the macro mode is either NEVER_EXECUTE or ALWAYS_EXECUTE_NO_WARN.
406 @return
407 whether macros from this document should be executed
409 bool AdjustMacroMode( const OUString& rScriptType, bool _bSuppressUI = false );
411 SvKeyValueIterator* GetHeaderAttributes();
412 void ClearHeaderAttributesForSourceViewHack();
413 void SetHeaderAttributesForSourceViewHack();
415 bool IsTemplate() const;
417 bool IsQueryLoadTemplate() const;
418 bool IsUseUserData() const;
419 bool IsLoadReadonly() const;
420 bool IsSaveVersionOnClose() const;
421 void SetQueryLoadTemplate( bool b );
422 void SetUseUserData( bool bNew );
423 void SetLoadReadonly( bool _bReadonly );
424 void SetSaveVersionOnClose( bool bSet );
425 void ResetFromTemplate( const OUString& rTemplateName, const OUString& rFileName );
427 // TODO/LATER: the following two methods should be replaced by Get/SetModifPasswordInfo in future
428 sal_uInt32 GetModifyPasswordHash() const;
429 bool SetModifyPasswordHash( sal_uInt32 nHash );
431 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetModifyPasswordInfo() const;
432 bool SetModifyPasswordInfo( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aInfo );
434 static sal_uInt32 HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc );
436 virtual bool PrepareClose(bool bUI = true);
437 virtual bool IsInformationLost();
438 virtual HiddenInformation GetHiddenInformationState( HiddenInformation nStates );
439 sal_Int16 QueryHiddenInformation( HiddenWarningFact eFact, vcl::Window* pParent );
440 bool IsSecurityOptOpenReadOnly() const;
441 void SetSecurityOptOpenReadOnly( bool bOpenReadOnly = true );
443 virtual Size GetFirstPageSize();
444 bool DoClose();
445 virtual void PrepareReload();
446 std::shared_ptr<GDIMetaFile> GetPreviewMetaFile( bool bFullContent = false ) const;
447 virtual void CancelTransfers();
449 bool GenerateAndStoreThumbnail(
450 bool bEncrypted,
451 bool bIsTemplate,
452 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor );
454 bool WriteThumbnail(
455 bool bEncrypted,
456 bool bIsTemplate,
457 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream );
459 bool IsInGenerateAndStoreThumbnail() const {return bIsInGenerateThumbnail;}//optimize thumbnail generate and store procedure to improve odt saving performance, i120030
461 // Transfer IFace
462 void AbortImport();
463 bool IsAbortingImport() const;
464 bool IsReloading() const;
465 void FinishedLoading( SfxLoadedFlags nWhich = SfxLoadedFlags::ALL );
466 void TemplateDisconnectionAfterLoad();
467 bool IsLoading() const;
468 bool IsLoadingFinished() const;
469 void SetAutoLoad( const INetURLObject&, sal_uInt32 nTime, bool bReload = true );
470 bool IsAutoLoadLocked() const;
471 void NotifyReloadAvailable();
473 // Misc
474 bool IsPreview() const;
475 SfxObjectCreateMode GetCreateMode() const { return eCreateMode; }
476 SfxProgress* GetProgress() const;
477 void SetWaitCursor( bool bSet ) const;
479 // Naming Interface
480 void SetTitle( const OUString& rTitle );
481 OUString GetTitle( sal_uInt16 nMaxLen = 0 ) const;
482 void InvalidateName(); // Re-set to unnamed
484 #if defined WNT
485 // DDE-Interface
486 long DdeExecute( const OUString& rCmd );
487 virtual bool DdeGetData( const OUString& rItem,
488 const OUString& rMimeType,
489 ::com::sun::star::uno::Any & rValue );
490 virtual bool DdeSetData( const OUString& rItem,
491 const OUString& rMimeType,
492 const ::com::sun::star::uno::Any & rValue );
493 #endif
494 virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const OUString& rItem );
495 virtual void ReconnectDdeLink(SfxObjectShell& rServer);
497 static void ReconnectDdeLinks(SfxObjectShell& rServer);
499 // Contents
500 virtual SfxStyleSheetBasePool* GetStyleSheetPool();
501 void SetStyleSheetPool(SfxStyleSheetBasePool *pBasePool )
503 pStyleSheetPool = pBasePool;
506 virtual void LoadStyles(SfxObjectShell &rSource);
508 virtual sfx2::StyleManager* GetStyleManager();
510 // Determine the position of the "Automatic" filter in the stylist
511 void SetAutoStyleFilterIndex(sal_uInt16 nSet);
512 sal_uInt16 GetAutoStyleFilterIndex();
513 bool HasBasic() const;
514 BasicManager* GetBasicManager() const;
515 com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >
516 GetBasicContainer();
517 com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >
518 GetDialogContainer();
519 StarBASIC* GetBasic() const;
521 virtual std::set<Color> GetDocColors();
523 void ReadNote( INote * );
524 void UpdateNote( INote * );
526 // Documents, for which to format the view size
528 virtual SfxObjectShell* GetObjectShell() SAL_OVERRIDE;
530 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
531 GetModel() const;
532 // Only temporarily for the applications!
533 void SetBaseModel( SfxBaseModel* pModel );
534 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetBaseModel() const;
535 // Only temporarily for the applications!
537 virtual ::com::sun::star::uno::Sequence< OUString > GetEventNames();
539 vcl::Window* GetDialogParent( SfxMedium* pMedium=0 );
540 static SfxObjectShell* CreateObject( const OUString& rServiceName, SfxObjectCreateMode = SfxObjectCreateMode::STANDARD );
541 static SfxObjectShell* CreateObjectByFactoryName( const OUString& rURL, SfxObjectCreateMode = SfxObjectCreateMode::STANDARD );
542 static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
543 CreateAndLoadComponent( const SfxItemSet& rSet, SfxFrame* pFrame = NULL );
544 static SfxObjectShell* GetShellFromComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComp );
545 static OUString GetServiceNameFromFactory( const OUString& rFact );
546 bool IsInPlaceActive();
547 bool IsUIActive();
548 virtual void InPlaceActivate( bool );
550 static bool CopyStoragesOfUnknownMediaType(
551 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xSource,
552 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTarget );
554 // The functions from SvPersist
555 void EnableSetModified( bool bEnable = true );
556 bool IsEnableSetModified() const;
557 virtual void SetModified( bool bModified = true );
558 bool IsModified();
561 * @param bChart true if the file is a chart doc and FillClass should not be called
563 void SetupStorage(
564 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
565 sal_Int32 nVersion, bool bTemplate, bool bChart = false ) const;
567 ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorage();
569 SvGlobalName GetClassName() const;
571 // comphelper::IEmbeddedHelper
572 virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler() const SAL_OVERRIDE;
573 virtual com::sun::star::uno::Reference < com::sun::star::embed::XStorage > getStorage() const SAL_OVERRIDE
575 return const_cast<SfxObjectShell*>(this)->GetStorage();
577 virtual comphelper::EmbeddedObjectContainer& getEmbeddedObjectContainer() const SAL_OVERRIDE
579 return GetEmbeddedObjectContainer();
581 bool isEnableSetModified() const SAL_OVERRIDE
583 return IsEnableSetModified();
585 comphelper::EmbeddedObjectContainer& GetEmbeddedObjectContainer() const;
586 void ClearEmbeddedObjects();
588 // The functions from SvEmbeddedObject
589 virtual Printer * GetDocumentPrinter();
590 virtual OutputDevice* GetDocumentRefDev();
591 virtual void OnDocumentPrinterChanged( Printer * pNewPrinter );
592 virtual Rectangle GetVisArea( sal_uInt16 nAspect ) const;
593 virtual void SetVisArea( const Rectangle & rVisArea );
594 const Rectangle & GetVisArea() const;
595 void SetVisAreaSize( const Size & rVisSize );
596 virtual sal_uIntPtr GetMiscStatus() const;
598 MapUnit GetMapUnit() const;
599 void SetMapUnit( MapUnit nMUnit );
601 void FillTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc ) const;
602 void DoDraw( OutputDevice *, const Point & rObjPos,
603 const Size & rSize,
604 const JobSetup & rSetup,
605 sal_uInt16 nAspect = ASPECT_CONTENT );
606 virtual void Draw( OutputDevice *, const JobSetup & rSetup,
607 sal_uInt16 nAspect = ASPECT_CONTENT ) = 0;
610 virtual void FillClass( SvGlobalName * pClassName,
611 SotClipboardFormatId * pFormat,
612 OUString * pAppName,
613 OUString * pFullTypeName,
614 OUString * pShortTypeName,
615 sal_Int32 nVersion,
616 bool bTemplate = false) const = 0;
618 // change recording and respective passwword protection for Writer and Calc
619 // slots available for Writer: FN_REDLINE_ON, FN_REDLINE_ON
620 // slots used for Calc: FID_CHG_RECORD, SID_CHG_PROTECT
621 virtual bool IsChangeRecording() const;
622 virtual bool HasChangeRecordProtection() const;
623 virtual void SetChangeRecording( bool bActivate );
624 virtual bool SetProtectionPassword( const OUString &rPassword );
625 virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash );
627 SAL_DLLPRIVATE std::shared_ptr<GDIMetaFile> CreatePreviewMetaFile_Impl( bool bFullContent ) const;
629 SAL_DLLPRIVATE bool IsOwnStorageFormat_Impl(const SfxMedium &) const;
631 SAL_DLLPRIVATE bool IsPackageStorageFormat_Impl(const SfxMedium &) const;
633 SAL_DLLPRIVATE bool ConnectTmpStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, SfxMedium* pMedium );
634 SAL_DLLPRIVATE bool DisconnectStorage_Impl( SfxMedium& rSrcMedium, SfxMedium& rTargetMedium );
636 SAL_DLLPRIVATE bool PutURLContentsToVersionStream_Impl(
637 const OUString& aURL,
638 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDocStorage,
639 const OUString& aStreamName );
641 SAL_DLLPRIVATE OUString CreateTempCopyOfStorage_Impl(
642 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
644 SAL_DLLPRIVATE void InitOwnModel_Impl();
645 SAL_DLLPRIVATE void BreakMacroSign_Impl( bool bBreakMacroSing );
646 SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl();
647 SAL_DLLPRIVATE void CheckForBrokenDocSignatures_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
648 SAL_DLLPRIVATE SignatureState ImplCheckSignaturesInformation(
649 const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos );
650 SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
651 SAL_DLLPRIVATE void SetModifyPasswordEntered( bool bEntered = true );
652 SAL_DLLPRIVATE bool IsModifyPasswordEntered();
654 SAL_DLLPRIVATE void InitBasicManager_Impl();
655 SAL_DLLPRIVATE SfxObjectShell_Impl* Get_Impl() { return pImp; }
657 SAL_DLLPRIVATE static bool UseInteractionToHandleError(
658 const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler,
659 sal_uInt32 nError );
660 SAL_DLLPRIVATE const SfxObjectShell_Impl* Get_Impl() const { return pImp; }
662 SAL_DLLPRIVATE void SetCreateMode_Impl( SfxObjectCreateMode nMode );
664 SAL_DLLPRIVATE void DoDraw_Impl( OutputDevice* pDev,
665 const Point & rViewPos,
666 const Fraction & rScaleX,
667 const Fraction & rScaleY,
668 const JobSetup & rSetup,
669 sal_uInt16 nAspect );
671 // Shell Interface
672 SAL_DLLPRIVATE void ExecFile_Impl(SfxRequest &);
673 SAL_DLLPRIVATE void GetState_Impl(SfxItemSet&);
674 SAL_DLLPRIVATE void PrintExec_Impl(SfxRequest &);
675 SAL_DLLPRIVATE void PrintState_Impl(SfxItemSet&);
676 SAL_DLLPRIVATE void ExecProps_Impl(SfxRequest &);
677 SAL_DLLPRIVATE void StateProps_Impl(SfxItemSet &);
678 SAL_DLLPRIVATE void ExecView_Impl(SfxRequest &);
679 SAL_DLLPRIVATE void StateView_Impl(SfxItemSet &);
681 // Load/Save public internals
682 SAL_DLLPRIVATE bool ImportFromGeneratedStream_Impl(
683 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream,
684 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr );
685 SAL_DLLPRIVATE void PositionView_Impl();
686 SAL_DLLPRIVATE void UpdateFromTemplate_Impl();
687 SAL_DLLPRIVATE bool CanReload_Impl();
688 SAL_DLLPRIVATE void SetNamedVisibility_Impl();
689 SAL_DLLPRIVATE bool DoSave_Impl( const SfxItemSet* pSet=0 );
690 SAL_DLLPRIVATE bool Save_Impl( const SfxItemSet* pSet=0 );
691 SAL_DLLPRIVATE bool PreDoSaveAs_Impl(const OUString &rFileName, const OUString &rFiltName, SfxItemSet *);
692 SAL_DLLPRIVATE bool APISaveAs_Impl ( const OUString& aFileName, SfxItemSet* aParams );
693 SAL_DLLPRIVATE bool CommonSaveAs_Impl ( const INetURLObject& aURL, const OUString& aFilterName, SfxItemSet* aParams );
694 SAL_DLLPRIVATE bool GeneralInit_Impl(
695 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
696 bool bTypeMustBeSetAlready );
697 SAL_DLLPRIVATE void PrepareSecondTryLoad_Impl();
698 SAL_DLLPRIVATE void SetInitialized_Impl( const bool i_fromInitNew );
700 // public-internals
701 SAL_DLLPRIVATE IndexBitSet& GetNoSet_Impl();
702 SAL_DLLPRIVATE void SetProgress_Impl( SfxProgress *pProgress );
703 SAL_DLLPRIVATE void PostActivateEvent_Impl( SfxViewFrame* );
704 SAL_DLLPRIVATE void SetActivateEvent_Impl(sal_uInt16 );
705 SAL_DLLPRIVATE SfxObjectShell* GetParentShellByModel_Impl();
707 // configuration items
708 SAL_DLLPRIVATE SfxToolBoxConfig* GetToolBoxConfig_Impl();
709 SAL_DLLPRIVATE SignatureState ImplGetSignatureState( bool bScriptingContent = false );
711 SAL_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >
712 ImplAnalyzeSignature(
713 bool bScriptingContent,
714 const ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >& xSigner
715 = ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >() );
717 SAL_DLLPRIVATE void ImplSign( bool bScriptingContent = false );
718 SAL_DLLPRIVATE bool QuerySaveSizeExceededModules_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
720 SAL_DLLPRIVATE void CheckOut( );
721 SAL_DLLPRIVATE void CancelCheckOut( );
722 SAL_DLLPRIVATE void CheckIn( );
723 SAL_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::document::CmisVersion > GetCmisVersions();
726 * Interface shared by document shell. Allow LOK calls from sfx.
727 * Default behavior doesn't do anything. relevant SfxObjectShells should override
728 * the default behavior and implements LOK calls.
730 virtual void libreOfficeKitCallback(int nType, const char* pPayload) const;
731 virtual bool isTiledRendering() const;
734 #define SFX_GLOBAL_CLASSID \
735 0x9eaba5c3, 0xb232, 0x4309, \
736 0x84, 0x5f, 0x5f, 0x15, 0xea, 0x50, 0xd0, 0x74
738 struct ModifyBlocker_Impl
740 SfxObjectShell* pPersist;
741 bool bWasEnabled;
742 ModifyBlocker_Impl( SfxObjectShell* pPersistP ) : pPersist( pPersistP )
744 bWasEnabled = pPersistP->IsEnableSetModified();
745 if ( bWasEnabled )
746 pPersistP->EnableSetModified( false );
748 ~ModifyBlocker_Impl()
750 if ( bWasEnabled )
751 pPersist->EnableSetModified( bWasEnabled );
756 #ifndef SFX_DECL_OBJECTSHELL_DEFINED
757 #define SFX_DECL_OBJECTSHELL_DEFINED
758 typedef tools::SvRef<SfxObjectShell> SfxObjectShellRef;
759 #endif
761 class SfxObjectShellLock
763 protected:
764 SfxObjectShell * pObj;
765 public:
766 inline SfxObjectShellLock() { pObj = 0; }
767 inline SfxObjectShellLock( const SfxObjectShellLock & rObj );
768 inline SfxObjectShellLock( SfxObjectShell * pObjP );
769 inline void Clear();
770 inline ~SfxObjectShellLock();
771 inline SfxObjectShellLock & operator = ( const SfxObjectShellLock & rObj );
772 inline SfxObjectShellLock & operator = ( SfxObjectShell * pObj );
773 inline bool Is() const { return pObj != NULL; }
774 inline SfxObjectShell * operator & () const { return pObj; }
775 inline SfxObjectShell * operator -> () const { return pObj; }
776 inline SfxObjectShell & operator * () const { return *pObj; }
777 inline operator SfxObjectShell * () const { return pObj; }
779 inline SfxObjectShellLock::SfxObjectShellLock( const SfxObjectShellLock & rObj )
780 { pObj = rObj.pObj; if( pObj ) { pObj->OwnerLock( true ); } }
781 inline SfxObjectShellLock::SfxObjectShellLock( SfxObjectShell * pObjP )
782 { pObj = pObjP; if( pObj ) { pObj->OwnerLock( true ); } }
783 inline void SfxObjectShellLock::Clear()
785 if( pObj )
787 SfxObjectShell* const pRefObj = pObj;
788 pObj = 0;
789 pRefObj->OwnerLock( false );
792 inline SfxObjectShellLock::~SfxObjectShellLock()
793 { if( pObj ) { pObj->OwnerLock( false ); } }
794 inline SfxObjectShellLock & SfxObjectShellLock::
795 operator = ( const SfxObjectShellLock & rObj )
797 if( rObj.pObj ) rObj.pObj->OwnerLock( true );
798 SfxObjectShell* const pRefObj = pObj;
799 pObj = rObj.pObj;
800 if( pRefObj ) { pRefObj->OwnerLock( false ); }
801 return *this;
803 inline SfxObjectShellLock & SfxObjectShellLock::operator = ( SfxObjectShell * pObjP )
804 { return *this = SfxObjectShellLock( pObjP ); }
806 class AutoReloadTimer_Impl : public Timer
808 OUString aUrl;
809 SfxObjectShell* pObjSh;
811 public:
812 AutoReloadTimer_Impl( const OUString& rURL, sal_uInt32 nTime,
813 SfxObjectShell* pSh );
814 virtual void Invoke() SAL_OVERRIDE;
817 class SFX2_DLLPUBLIC SfxObjectShellItem: public SfxPoolItem
819 SfxObjectShell* pObjSh;
821 public:
822 TYPEINFO_OVERRIDE();
823 SfxObjectShellItem() :
824 SfxPoolItem( 0 ),
825 pObjSh( 0 )
827 SfxObjectShellItem( SfxObjectShell *pObjShell ):
828 SfxPoolItem( 0 ),
829 pObjSh( pObjShell )
831 SfxObjectShellItem( sal_uInt16 nWhichId,
832 SfxObjectShell *pObjShell ):
833 SfxPoolItem( nWhichId ),
834 pObjSh( pObjShell )
837 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
838 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
839 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
840 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
841 SfxObjectShell* GetObjectShell() const
842 { return pObjSh; }
846 #endif
848 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */