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