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