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 11447 : 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 163 : 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 : bool DoLoadExternal(SfxMedium* pMed, const rtl::OUString& rProvider);
298 : sal_Bool DoSave();
299 : sal_Bool DoSaveAs( SfxMedium &rNewStor );
300 : sal_Bool DoSaveObjectAs( SfxMedium &rNewStor, sal_Bool bCommit );
301 :
302 : // TODO/LATER: currently only overloaded in Calc, should be made non-virtual
303 : virtual sal_Bool DoSaveCompleted( SfxMedium* pNewStor=0 );
304 :
305 : virtual sal_Bool LoadOwnFormat( SfxMedium& pMedium );
306 : virtual sal_Bool SaveAsOwnFormat( SfxMedium& pMedium );
307 : virtual sal_Bool ConvertFrom( SfxMedium &rMedium );
308 : virtual sal_Bool ConvertTo( SfxMedium &rMedium );
309 : virtual sal_Bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
310 : virtual sal_Bool Load( SfxMedium &rMedium );
311 : virtual sal_Bool LoadFrom( SfxMedium& rMedium );
312 : virtual sal_Bool Save();
313 : virtual sal_Bool SaveAs( SfxMedium &rMedium );
314 : virtual sal_Bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
315 : virtual sal_Bool SwitchPersistance(
316 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
317 : virtual void UpdateLinks();
318 : virtual bool LoadExternal(SfxMedium& rMedium, const rtl::OUString& rProvider);
319 : /**
320 : * Called when the Options dialog is dismissed with the OK button, to
321 : * handle potentially conflicting option settings.
322 : */
323 : virtual void CheckConfigOptions();
324 : sal_Bool IsConfigOptionsChecked() const;
325 : void SetConfigOptionsChecked( sal_Bool bChecked );
326 :
327 : // called for a few slots like SID_SAVE[AS]DOC, SID_PRINTDOC[DIRECT], derived classes may abort the action
328 : virtual sal_Bool QuerySlotExecutable( sal_uInt16 nSlotId );
329 :
330 : sal_Bool SaveChildren(sal_Bool bObjectsOnly=sal_False);
331 : sal_Bool SaveAsChildren( SfxMedium &rMedium );
332 : sal_Bool SwitchChildrenPersistance(
333 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
334 : sal_Bool bForceNonModified = sal_False );
335 : sal_Bool SaveCompletedChildren( sal_Bool bSuccess );
336 :
337 : virtual sal_Bool ImportFrom( SfxMedium &rMedium, bool bInsert );
338 : sal_Bool ExportTo( SfxMedium &rMedium );
339 :
340 : // xmlsec05, check with SFX team
341 : sal_uInt16 GetDocumentSignatureState();
342 : void SignDocumentContent();
343 : sal_uInt16 GetScriptingSignatureState();
344 : void SignScriptingContent();
345 :
346 : virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog(
347 : Window *pParent, const SfxItemSet& );
348 :
349 : ErrCode CallBasic( const String& rMacro, const String& rBasicName,
350 : SbxArray* pArgs = 0, SbxValue* pRet = 0 );
351 :
352 : ErrCode CallXScript(
353 : const String& rScriptURL,
354 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
355 : ::com::sun::star::uno::Any& aRet,
356 : ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
357 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
358 : bool bRaiseError = true,
359 : const ::com::sun::star::uno::Any* aCaller = 0 );
360 :
361 : static ErrCode CallXScript(
362 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxScriptContext,
363 : const ::rtl::OUString& rScriptURL,
364 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
365 : ::com::sun::star::uno::Any& aRet,
366 : ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
367 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
368 : bool bRaiseError = true,
369 : const ::com::sun::star::uno::Any* aCaller = 0
370 : );
371 :
372 : /** adjusts the internal macro mode, according to the current security settings
373 :
374 : Finally, the macro mode is either NEVER_EXECUTE or ALWAYS_EXECUTE_NO_WARN.
375 :
376 : @return
377 : whether macros from this document should be executed
378 : */
379 : bool AdjustMacroMode( const String& rScriptType, bool _bSuppressUI = false );
380 :
381 : SvKeyValueIterator* GetHeaderAttributes();
382 : void ClearHeaderAttributesForSourceViewHack();
383 : void SetHeaderAttributesForSourceViewHack();
384 :
385 : sal_Bool IsTemplate() const;
386 :
387 : sal_Bool IsQueryLoadTemplate() const;
388 : sal_Bool IsUseUserData() const;
389 : sal_Bool IsLoadReadonly() const;
390 : sal_Bool IsSaveVersionOnClose() const;
391 : void SetQueryLoadTemplate( sal_Bool b );
392 : void SetUseUserData( sal_Bool bNew );
393 : void SetLoadReadonly( sal_Bool _bReadonly );
394 : void SetSaveVersionOnClose( sal_Bool bSet );
395 : void ResetFromTemplate( const String& rTemplateName, const String& rFileName );
396 :
397 : // TODO/LATER: the following two methods should be replaced by Get/SetModifPasswordInfo in future
398 : sal_uInt32 GetModifyPasswordHash() const;
399 : sal_Bool SetModifyPasswordHash( sal_uInt32 nHash );
400 :
401 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetModifyPasswordInfo() const;
402 : sal_Bool SetModifyPasswordInfo( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aInfo );
403 :
404 : static sal_uInt32 HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc );
405 :
406 : virtual void ViewAssigned();
407 : virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
408 : virtual sal_Bool IsInformationLost();
409 : virtual sal_uInt16 GetHiddenInformationState( sal_uInt16 nStates );
410 : sal_Int16 QueryHiddenInformation( HiddenWarningFact eFact, Window* pParent );
411 : virtual sal_Bool HasSecurityOptOpenReadOnly() const;
412 : sal_Bool IsSecurityOptOpenReadOnly() const;
413 : void SetSecurityOptOpenReadOnly( sal_Bool bOpenReadOnly = sal_True );
414 :
415 : virtual Size GetFirstPageSize();
416 : virtual sal_Bool DoClose();
417 : virtual void PrepareReload();
418 : virtual ::boost::shared_ptr<GDIMetaFile> GetPreviewMetaFile( sal_Bool bFullContent = sal_False ) const;
419 : virtual void CancelTransfers();
420 :
421 : sal_Bool GenerateAndStoreThumbnail(
422 : sal_Bool bEncrypted,
423 : sal_Bool bSigned,
424 : sal_Bool bIsTemplate,
425 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor );
426 :
427 : sal_Bool WriteThumbnail(
428 : sal_Bool bEncrypted,
429 : sal_Bool bSigned,
430 : sal_Bool bIsTemplate,
431 : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream );
432 :
433 : // Transfer IFace
434 : void AbortImport();
435 : sal_Bool IsAbortingImport() const;
436 : sal_Bool IsReloading() const;
437 : void FinishedLoading( sal_uInt16 nWhich = SFX_LOADED_ALL );
438 : void TemplateDisconnectionAfterLoad();
439 : sal_Bool IsLoading() const;
440 : sal_Bool IsLoadingFinished() const;
441 : void SetAutoLoad( const INetURLObject&, sal_uInt32 nTime, sal_Bool bReload = sal_True );
442 : sal_Bool IsAutoLoadLocked() const;
443 : void NotifyReloadAvailable();
444 :
445 : // Misc
446 : sal_Bool IsPreview() const;
447 6784 : SfxObjectCreateMode GetCreateMode() const { return eCreateMode; }
448 : SfxProgress* GetProgress() const;
449 : void SetWaitCursor( sal_Bool bSet ) const;
450 :
451 : // Naming Interface
452 : void SetTitle( const String& rTitle );
453 : String GetTitle( sal_uInt16 nMaxLen = 0 ) const;
454 : void InvalidateName(); // Re-set to unnamed
455 :
456 : // DDE-Interface
457 : virtual long DdeExecute( const String& rCmd );
458 : virtual long DdeGetData( const String& rItem,
459 : const String& rMimeType,
460 : ::com::sun::star::uno::Any & rValue );
461 : virtual long DdeSetData( const String& rItem,
462 : const String& rMimeType,
463 : const ::com::sun::star::uno::Any & rValue );
464 : virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem );
465 : virtual void ReconnectDdeLink(SfxObjectShell& rServer);
466 :
467 : static void ReconnectDdeLinks(SfxObjectShell& rServer);
468 :
469 : // Contents
470 : virtual SfxStyleSheetBasePool* GetStyleSheetPool();
471 : void SetStyleSheetPool(SfxStyleSheetBasePool *pBasePool ) {
472 : pStyleSheetPool = pBasePool; }
473 :
474 : // Determine the position of the "Automatic" filter in the stylist
475 : void SetAutoStyleFilterIndex(sal_uInt16 nSet);
476 : sal_uInt16 GetAutoStyleFilterIndex();
477 : virtual sal_Bool HasBasic() const;
478 : BasicManager* GetBasicManager() const;
479 : com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >
480 : GetBasicContainer();
481 : com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >
482 : GetDialogContainer();
483 : StarBASIC* GetBasic() const;
484 :
485 : // Interface Document content, Organizer
486 : #define INDEX_IGNORE USHRT_MAX
487 :
488 : #define CONTENT_STYLE 0
489 : #define CONTENT_CONFIG 1
490 : #define CONTENT_MACRO 2
491 : #define DEF_CONTENT_COUNT 1
492 :
493 :
494 : virtual void SetOrganizerSearchMask(
495 : SfxStyleSheetBasePool* ) const;
496 :
497 : virtual sal_uInt16 GetContentCount( sal_uInt16 nIdx1 = INDEX_IGNORE );
498 :
499 : virtual sal_Bool CanHaveChildren(
500 : sal_uInt16 nIdx1,
501 : sal_uInt16 nIdx2 = INDEX_IGNORE
502 : );
503 :
504 : virtual void GetContent( String &,
505 : Bitmap &rClosedBitmap,
506 : Bitmap &rOpenedBitmap,
507 : sal_Bool &bCanDelete,
508 : sal_uInt16 nPos,
509 : sal_uInt16 nIdx1
510 : );
511 :
512 : virtual void TriggerHelpPI( sal_uInt16 nIdx1, sal_uInt16 nIdx2 );
513 :
514 : virtual Bitmap GetStyleFamilyBitmap(SfxStyleFamily eFamily);
515 :
516 : virtual sal_Bool Insert( SfxObjectShell &rSource,
517 : sal_uInt16 nSourceIdx1,
518 : sal_uInt16 nSourceIdx2,
519 : sal_uInt16 nSourceIdx3,
520 : sal_uInt16 &nIdx1,
521 : sal_uInt16 &nIdx2,
522 : sal_uInt16 &nIdx3,
523 : sal_uInt16 &rIdxDeleted);
524 :
525 : virtual sal_Bool Remove( sal_uInt16 nIdx1,
526 : sal_uInt16 nIdx2 = INDEX_IGNORE,
527 : sal_uInt16 nIdx3 = INDEX_IGNORE);
528 :
529 : sal_Bool Print( Printer &rPrt,
530 : sal_uInt16 nIdx1,
531 : sal_uInt16 nIdx2 = INDEX_IGNORE,
532 : sal_uInt16 nIdx3 = INDEX_IGNORE,
533 : const String *pObjectName = 0 );
534 :
535 : virtual void LoadStyles( SfxObjectShell &rSource );
536 : void ReadNote( INote * );
537 : void UpdateNote( INote * );
538 :
539 : // Documents, for which to format the view size
540 :
541 : virtual SfxObjectShell* GetObjectShell();
542 :
543 : virtual SfxFrame* GetSmartSelf( SfxFrame* pSelf, SfxMedium& rMedium );
544 :
545 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
546 : GetModel() const;
547 : // Only temporarily for the applications!
548 : void SetBaseModel( SfxBaseModel* pModel );
549 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetBaseModel() const;
550 : // Only temporarily for the applications!
551 :
552 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > GetEventNames();
553 :
554 : Window* GetDialogParent( SfxMedium* pMedium=0 );
555 : static SfxObjectShell* CreateObject( const String& rServiceName, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD );
556 : static SfxObjectShell* CreateObjectByFactoryName( const String& rURL, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD );
557 : static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
558 : CreateAndLoadComponent( const SfxItemSet& rSet, SfxFrame* pFrame = NULL );
559 : static SfxObjectShell* GetShellFromComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComp );
560 : static String GetServiceNameFromFactory( const String& rFact );
561 : sal_Bool IsInPlaceActive();
562 : sal_Bool IsUIActive();
563 : virtual void InPlaceActivate( sal_Bool );
564 : virtual void UIActivate( sal_Bool );
565 :
566 : static sal_Bool CopyStoragesOfUnknownMediaType(
567 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xSource,
568 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTarget );
569 :
570 : // ==== The functions from SvPersist
571 : void EnableSetModified( sal_Bool bEnable = sal_True );
572 : sal_Bool IsEnableSetModified() const;
573 : virtual void SetModified( sal_Bool bModified = sal_True );
574 : sal_Bool IsModified();
575 :
576 : void SetupStorage(
577 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
578 : sal_Int32 nVersion,
579 : sal_Bool bTemplate ) const;
580 :
581 : ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorage();
582 :
583 : SvGlobalName GetClassName() const;
584 :
585 : // comphelper::IEmbeddedHelper
586 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler() const;
587 6 : virtual com::sun::star::uno::Reference < com::sun::star::embed::XStorage > getStorage() const
588 : {
589 6 : return const_cast<SfxObjectShell*>(this)->GetStorage();
590 : }
591 60 : virtual comphelper::EmbeddedObjectContainer& getEmbeddedObjectContainer() const
592 : {
593 60 : return GetEmbeddedObjectContainer();
594 : }
595 0 : bool isEnableSetModified() const
596 : {
597 0 : return IsEnableSetModified();
598 : }
599 : comphelper::EmbeddedObjectContainer& GetEmbeddedObjectContainer() const;
600 : void ClearEmbeddedObjects();
601 :
602 : // ==== The functions from SvEmbeddedObject
603 : virtual Printer * GetDocumentPrinter();
604 : virtual OutputDevice* GetDocumentRefDev();
605 : virtual void OnDocumentPrinterChanged( Printer * pNewPrinter );
606 : virtual Rectangle GetVisArea( sal_uInt16 nAspect ) const;
607 : virtual void SetVisArea( const Rectangle & rVisArea );
608 : const Rectangle & GetVisArea() const;
609 : void SetVisAreaSize( const Size & rVisSize );
610 : virtual sal_uIntPtr GetMiscStatus() const;
611 :
612 : MapUnit GetMapUnit() const;
613 : void SetMapUnit( MapUnit nMUnit );
614 :
615 : void FillTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc ) const;
616 : void DoDraw( OutputDevice *, const Point & rObjPos,
617 : const Size & rSize,
618 : const JobSetup & rSetup,
619 : sal_uInt16 nAspect = ASPECT_CONTENT );
620 : virtual void Draw( OutputDevice *, const JobSetup & rSetup,
621 : sal_uInt16 nAspect = ASPECT_CONTENT ) = 0;
622 :
623 :
624 : virtual void FillClass( SvGlobalName * pClassName,
625 : sal_uInt32 * pFormat,
626 : String * pAppName,
627 : String * pFullTypeName,
628 : String * pShortTypeName,
629 : sal_Int32 nVersion,
630 : sal_Bool bTemplate = sal_False) const = 0;
631 :
632 : // change recording and respective passwword protection for Writer and Calc
633 : // slots available for Writer: FN_REDLINE_ON, FN_REDLINE_ON
634 : // slots used for Calc: FID_CHG_RECORD, SID_CHG_PROTECT
635 : virtual bool IsChangeRecording() const;
636 : virtual bool HasChangeRecordProtection() const;
637 : virtual void SetChangeRecording( bool bActivate );
638 : virtual bool SetProtectionPassword( const String &rPassword );
639 : virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash );
640 :
641 : // =================================
642 :
643 : SAL_DLLPRIVATE ::boost::shared_ptr<GDIMetaFile> CreatePreviewMetaFile_Impl( sal_Bool bFullContent ) const;
644 :
645 : SAL_DLLPRIVATE sal_Bool IsOwnStorageFormat_Impl(const SfxMedium &) const;
646 :
647 : SAL_DLLPRIVATE sal_Bool IsPackageStorageFormat_Impl(const SfxMedium &) const;
648 :
649 : SAL_DLLPRIVATE sal_Bool ConnectTmpStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, SfxMedium* pMedium );
650 : SAL_DLLPRIVATE sal_Bool DisconnectStorage_Impl( SfxMedium& rSrcMedium, SfxMedium& rTargetMedium );
651 :
652 : SAL_DLLPRIVATE sal_Bool PutURLContentsToVersionStream_Impl(
653 : ::rtl::OUString aURL,
654 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDocStorage,
655 : ::rtl::OUString aStreamName );
656 :
657 : SAL_DLLPRIVATE ::rtl::OUString CreateTempCopyOfStorage_Impl(
658 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
659 :
660 : SAL_DLLPRIVATE void InitOwnModel_Impl();
661 : SAL_DLLPRIVATE void BreakMacroSign_Impl( sal_Bool bBreakMacroSing );
662 : SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl();
663 : SAL_DLLPRIVATE void CheckForBrokenDocSignatures_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
664 : SAL_DLLPRIVATE sal_uInt16 ImplCheckSignaturesInformation(
665 : const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos );
666 : SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
667 : SAL_DLLPRIVATE void SetModifyPasswordEntered( sal_Bool bEntered = sal_True );
668 : SAL_DLLPRIVATE sal_Bool IsModifyPasswordEntered();
669 :
670 : SAL_DLLPRIVATE void InitBasicManager_Impl();
671 : SAL_DLLPRIVATE SfxObjectShell_Impl* Get_Impl() { return pImp; }
672 :
673 : SAL_DLLPRIVATE static sal_Bool UseInteractionToHandleError(
674 : const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler,
675 : sal_uInt32 nError );
676 : SAL_DLLPRIVATE const SfxObjectShell_Impl* Get_Impl() const { return pImp; }
677 :
678 : SAL_DLLPRIVATE void SetCreateMode_Impl( SfxObjectCreateMode nMode );
679 :
680 : SAL_DLLPRIVATE void DoDraw_Impl( OutputDevice* pDev,
681 : const Point & rViewPos,
682 : const Fraction & rScaleX,
683 : const Fraction & rScaleY,
684 : const JobSetup & rSetup,
685 : sal_uInt16 nAspect );
686 :
687 : // Shell Interface
688 : SAL_DLLPRIVATE void ExecFile_Impl(SfxRequest &);
689 : SAL_DLLPRIVATE void GetState_Impl(SfxItemSet&);
690 : SAL_DLLPRIVATE void PrintExec_Impl(SfxRequest &);
691 : SAL_DLLPRIVATE void PrintState_Impl(SfxItemSet&);
692 : SAL_DLLPRIVATE void ExecProps_Impl(SfxRequest &);
693 : SAL_DLLPRIVATE void StateProps_Impl(SfxItemSet &);
694 : SAL_DLLPRIVATE void ExecView_Impl(SfxRequest &);
695 : SAL_DLLPRIVATE void StateView_Impl(SfxItemSet &);
696 :
697 : // Load/Save public internals
698 : SAL_DLLPRIVATE sal_Bool ImportFromGeneratedStream_Impl(
699 : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream,
700 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr );
701 : SAL_DLLPRIVATE void PositionView_Impl();
702 : SAL_DLLPRIVATE void UpdateFromTemplate_Impl();
703 : SAL_DLLPRIVATE sal_Bool CanReload_Impl();
704 : SAL_DLLPRIVATE void SetNamedVisibility_Impl();
705 : SAL_DLLPRIVATE sal_Bool DoSave_Impl( const SfxItemSet* pSet=0 );
706 : SAL_DLLPRIVATE sal_Bool Save_Impl( const SfxItemSet* pSet=0 );
707 : SAL_DLLPRIVATE sal_Bool PreDoSaveAs_Impl(const String &rFileName, const String &rFiltName, SfxItemSet *);
708 : SAL_DLLPRIVATE sal_Bool APISaveAs_Impl ( const String& aFileName, SfxItemSet* aParams );
709 : SAL_DLLPRIVATE sal_Bool CommonSaveAs_Impl ( const INetURLObject& aURL, const String& aFilterName, SfxItemSet* aParams );
710 : SAL_DLLPRIVATE sal_Bool GeneralInit_Impl(
711 : const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
712 : sal_Bool bTypeMustBeSetAlready );
713 : SAL_DLLPRIVATE void PrepareSecondTryLoad_Impl();
714 : SAL_DLLPRIVATE void SetInitialized_Impl( const bool i_fromInitNew );
715 :
716 : // public-internals
717 : SAL_DLLPRIVATE IndexBitSet& GetNoSet_Impl();
718 : SAL_DLLPRIVATE void SetProgress_Impl( SfxProgress *pProgress );
719 : SAL_DLLPRIVATE void PostActivateEvent_Impl( SfxViewFrame* );
720 : SAL_DLLPRIVATE void SetActivateEvent_Impl(sal_uInt16 );
721 : SAL_DLLPRIVATE SfxObjectShell* GetParentShellByModel_Impl();
722 :
723 : // configuration items
724 : SAL_DLLPRIVATE SfxToolBoxConfig* GetToolBoxConfig_Impl();
725 : SAL_DLLPRIVATE sal_uInt16 ImplGetSignatureState( sal_Bool bScriptingContent = sal_False );
726 :
727 : SAL_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >
728 : ImplAnalyzeSignature(
729 : sal_Bool bScriptingContent,
730 : const ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >& xSigner
731 : = ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >() );
732 :
733 : SAL_DLLPRIVATE void ImplSign( sal_Bool bScriptingContent = sal_False );
734 : SAL_DLLPRIVATE sal_Bool QuerySaveSizeExceededModules_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
735 :
736 : SAL_DLLPRIVATE void CheckOut( );
737 : SAL_DLLPRIVATE void CancelCheckOut( );
738 : SAL_DLLPRIVATE void CheckIn( );
739 : };
740 :
741 : #define SFX_GLOBAL_CLASSID \
742 : 0x9eaba5c3, 0xb232, 0x4309, \
743 : 0x84, 0x5f, 0x5f, 0x15, 0xea, 0x50, 0xd0, 0x74
744 :
745 : struct ModifyBlocker_Impl
746 : {
747 : SfxObjectShell* pPersist;
748 : sal_Bool bWasEnabled;
749 5 : ModifyBlocker_Impl( SfxObjectShell* pPersistP ) : pPersist( pPersistP )
750 : {
751 5 : bWasEnabled = pPersistP->IsEnableSetModified();
752 5 : if ( bWasEnabled )
753 2 : pPersistP->EnableSetModified( sal_False );
754 5 : }
755 5 : ~ModifyBlocker_Impl()
756 : {
757 5 : if ( bWasEnabled )
758 2 : pPersist->EnableSetModified( bWasEnabled );
759 5 : }
760 : };
761 :
762 :
763 : //--------------------------------------------------------------------
764 : #ifndef SFX_DECL_OBJECTSHELL_DEFINED
765 : #define SFX_DECL_OBJECTSHELL_DEFINED
766 0 : SV_DECL_REF(SfxObjectShell)
767 : #endif
768 512 : SV_DECL_LOCK(SfxObjectShell)
769 165 : SV_IMPL_LOCK(SfxObjectShell)
770 0 : SV_IMPL_REF(SfxObjectShell)
771 :
772 : //--------------------------------------------------------------------
773 : class AutoReloadTimer_Impl : public Timer
774 : {
775 : String aUrl;
776 : SfxObjectShell* pObjSh;
777 :
778 : public:
779 : AutoReloadTimer_Impl( const String& rURL, sal_uInt32 nTime,
780 : SfxObjectShell* pSh );
781 : virtual void Timeout();
782 : };
783 :
784 : //-------------------------------------------------------------------------
785 :
786 0 : class SFX2_DLLPUBLIC SfxObjectShellItem: public SfxPoolItem
787 : {
788 : SfxObjectShell* pObjSh;
789 :
790 : public:
791 : TYPEINFO();
792 : SfxObjectShellItem() :
793 : SfxPoolItem( 0 ),
794 : pObjSh( 0 )
795 : {}
796 : SfxObjectShellItem( SfxObjectShell *pObjShell ):
797 : SfxPoolItem( 0 ),
798 : pObjSh( pObjShell )
799 : {}
800 0 : SfxObjectShellItem( sal_uInt16 nWhichId,
801 : SfxObjectShell *pObjShell ):
802 : SfxPoolItem( nWhichId ),
803 0 : pObjSh( pObjShell )
804 0 : {}
805 :
806 : virtual int operator==( const SfxPoolItem& ) const;
807 : virtual String GetValueText() const;
808 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
809 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
810 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
811 : SfxObjectShell* GetObjectShell() const
812 : { return pObjSh; }
813 :
814 : };
815 :
816 : #endif
817 :
818 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|