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