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 /** Execute a script URL. 373 * 374 * @param rScriptURL URL of the script. 375 * @param aParams parameters for the macro. 376 * @param aRet variable that will hold the return value. 377 * @param aOutParamIndex index of output parameters. 378 * @param aOutParam output parameters. 379 * @param aReferer "Referer" calling the script. 380 * @param bRaiseError true to show a dialog in case of error. 381 */ 382 ErrCode CallXScript( 383 const String& 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 const ::rtl::OUString& aReferer = ::rtl::OUString(), 389 bool bRaiseError = true 390 ); 391 392 /** Execute a script URL. 393 * 394 * @param _rxScriptContext script context. 395 * @param rScriptURL URL of the script. 396 * @param aParams parameters for the macro. 397 * @param aRet variable that will hold the return value. 398 * @param aOutParamIndex index of output parameters. 399 * @param aOutParam output parameters. 400 * @param aReferer "Referer" calling the script. 401 * @param bRaiseError true to show a dialog in case of error. 402 */ 403 static ErrCode CallXScript( 404 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxScriptContext, 405 const ::rtl::OUString& rScriptURL, 406 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, 407 ::com::sun::star::uno::Any& aRet, 408 ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex, 409 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam, 410 const ::rtl::OUString& aReferer = ::rtl::OUString(), 411 bool bRaiseError = true 412 ); 413 414 /** adjusts the internal macro mode, according to the current security settings 415 416 Finally, the macro mode is either NEVER_EXECUTE or ALWAYS_EXECUTE_NO_WARN. 417 418 @return 419 whether macros from this document should be executed 420 */ 421 bool AdjustMacroMode( const String& rScriptType, bool _bSuppressUI = false ); 422 423 SvKeyValueIterator* GetHeaderAttributes(); 424 void ClearHeaderAttributesForSourceViewHack(); 425 void SetHeaderAttributesForSourceViewHack(); 426 427 sal_Bool IsTemplate() const; 428 void SetTemplate(sal_Bool bIs); 429 430 sal_Bool IsQueryLoadTemplate() const; 431 sal_Bool IsUseUserData() const; 432 sal_Bool IsLoadReadonly() const; 433 sal_Bool IsSaveVersionOnClose() const; 434 void SetQueryLoadTemplate( sal_Bool b ); 435 void SetUseUserData( sal_Bool bNew ); 436 void SetLoadReadonly( sal_Bool _bReadonly ); 437 void SetSaveVersionOnClose( sal_Bool bSet ); 438 void ResetFromTemplate( const String& rTemplateName, const String& rFileName ); 439 440 // TODO/LATER: the following two methods should be replaced by Get/SetModifPasswordInfo in future 441 sal_uInt32 GetModifyPasswordHash() const; 442 sal_Bool SetModifyPasswordHash( sal_uInt32 nHash ); 443 444 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetModifyPasswordInfo() const; 445 sal_Bool SetModifyPasswordInfo( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aInfo ); 446 447 static sal_uInt32 HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc ); 448 449 virtual void ViewAssigned(); 450 virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False ); 451 virtual sal_Bool IsInformationLost(); 452 virtual sal_uInt16 GetHiddenInformationState( sal_uInt16 nStates ); 453 sal_Int16 QueryHiddenInformation( HiddenWarningFact eFact, Window* pParent ); 454 virtual sal_Bool HasSecurityOptOpenReadOnly() const; 455 sal_Bool IsSecurityOptOpenReadOnly() const; 456 void SetSecurityOptOpenReadOnly( sal_Bool bOpenReadOnly = sal_True ); 457 458 virtual Size GetFirstPageSize(); 459 virtual sal_Bool DoClose(); 460 virtual void PrepareReload(); 461 virtual ::boost::shared_ptr<GDIMetaFile> GetPreviewMetaFile( sal_Bool bFullContent = sal_False ) const; 462 virtual void CancelTransfers(); 463 464 sal_Bool GenerateAndStoreThumbnail( 465 sal_Bool bEncrypted, 466 sal_Bool bSigned, 467 sal_Bool bIsTemplate, 468 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor ); 469 470 sal_Bool WriteThumbnail( 471 sal_Bool bEncrypted, 472 sal_Bool bSigned, 473 sal_Bool bIsTemplate, 474 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream ); 475 IsInGenerateAndStoreThumbnail() const476 sal_Bool IsInGenerateAndStoreThumbnail() const {return bIsInGenerateThumbnail;}//optimize thumbnail generate and store procedure to improve odt saving performance, i120030 477 478 // Transfer IFace 479 void AbortImport(); 480 sal_Bool IsAbortingImport() const; 481 void RegisterTransfer( SfxMedium& rMedium ); 482 sal_Bool IsReloading() const; 483 void FinishedLoading( sal_uInt16 nWhich = SFX_LOADED_ALL ); 484 void TemplateDisconnectionAfterLoad(); 485 sal_Bool IsLoading() const; 486 sal_Bool IsLoadingFinished() const; 487 void SetAutoLoad( const INetURLObject&, sal_uInt32 nTime, sal_Bool bReload = sal_True ); 488 void LockAutoLoad( sal_Bool bLock ); 489 sal_Bool IsAutoLoadLocked() const; 490 void NotifyReloadAvailable(); 491 sal_Bool IsSecure(); 492 493 // Misc 494 sal_Bool IsPreview() const; GetCreateMode() const495 SfxObjectCreateMode GetCreateMode() const { return eCreateMode; } 496 virtual void MemoryError(); 497 SfxProgress* GetProgress() const; 498 void SetWaitCursor( sal_Bool bSet ) const; 499 500 //(mba) virtual SotObjectRef CreateAggObj( const SotFactory* pFact ); 501 502 // Naming Interface 503 void SetTitle( const String& rTitle ); 504 String GetTitle( sal_uInt16 nMaxLen = 0 ) const; 505 void InvalidateName(); // Zuruecksetzen auf unbenannt 506 507 // DDE-Interface 508 virtual long DdeExecute( const String& rCmd ); 509 virtual long DdeGetData( const String& rItem, 510 const String& rMimeType, 511 ::com::sun::star::uno::Any & rValue ); 512 virtual long DdeSetData( const String& rItem, 513 const String& rMimeType, 514 const ::com::sun::star::uno::Any & rValue ); 515 virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem ); 516 517 // Contents 518 virtual SfxStyleSheetBasePool* GetStyleSheetPool(); SetStyleSheetPool(SfxStyleSheetBasePool * pBasePool)519 void SetStyleSheetPool( SfxStyleSheetBasePool *pBasePool ) { 520 pStyleSheetPool = pBasePool; } 521 522 //determine the position of the "Automatic" filter in the stylist 523 void SetAutoStyleFilterIndex(sal_uInt16 nSet); 524 sal_uInt16 GetAutoStyleFilterIndex(); 525 virtual sal_Bool HasBasic() const; 526 BasicManager* GetBasicManager() const; 527 com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > 528 GetBasicContainer(); 529 com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > 530 GetDialogContainer(); 531 StarBASIC* GetBasic() const; 532 533 // Interface Dok-Inhalte, Organizer 534 #define INDEX_IGNORE USHRT_MAX 535 536 #define CONTENT_STYLE 0 537 #define CONTENT_CONFIG 1 538 #define CONTENT_MACRO 2 539 #define DEF_CONTENT_COUNT 1 540 541 542 virtual void SetOrganizerSearchMask( 543 SfxStyleSheetBasePool* ) const; 544 545 546 virtual sal_uInt16 GetContentCount( 547 sal_uInt16 nIdx1 = INDEX_IGNORE, 548 sal_uInt16 nIdx2 = INDEX_IGNORE ); 549 virtual sal_Bool CanHaveChilds( 550 sal_uInt16 nIdx1, 551 sal_uInt16 nIdx2 = INDEX_IGNORE ); 552 virtual void GetContent( String &, 553 Bitmap &rClosedBitmap, 554 Bitmap &rOpenedBitmap, 555 sal_Bool &bCanDelete, 556 sal_uInt16 nPos, 557 sal_uInt16 nIdx1, 558 sal_uInt16 nIdx2 = INDEX_IGNORE ); 559 560 virtual void GetContent( String &, 561 Bitmap &rClosedBitmap, 562 Bitmap &rOpenedBitmap, 563 BmpColorMode eColorMode, 564 sal_Bool &bCanDelete, 565 sal_uInt16 nPos, 566 sal_uInt16 nIdx1, 567 sal_uInt16 nIdx2 = INDEX_IGNORE ); 568 569 virtual void TriggerHelpPI( 570 sal_uInt16 nIdx1, sal_uInt16 nIdx2, sal_uInt16 nIdx3); 571 572 virtual Bitmap GetStyleFamilyBitmap(SfxStyleFamily eFamily ); 573 574 virtual Bitmap GetStyleFamilyBitmap(SfxStyleFamily eFamily, BmpColorMode eColorMode ); 575 576 virtual sal_Bool Insert( SfxObjectShell &rSource, 577 sal_uInt16 nSourceIdx1, 578 sal_uInt16 nSourceIdx2, 579 sal_uInt16 nSourceIdx3, 580 sal_uInt16 &nIdx1, 581 sal_uInt16 &nIdx2, 582 sal_uInt16 &nIdx3, 583 sal_uInt16 &rIdxDeleted); 584 585 virtual sal_Bool Remove( sal_uInt16 nIdx1, 586 sal_uInt16 nIdx2 = INDEX_IGNORE, 587 sal_uInt16 nIdx3 = INDEX_IGNORE); 588 589 sal_Bool Print( Printer &rPrt, 590 sal_uInt16 nIdx1, 591 sal_uInt16 nIdx2 = INDEX_IGNORE, 592 sal_uInt16 nIdx3 = INDEX_IGNORE, 593 const String *pObjectName = 0 ); 594 595 virtual void LoadStyles( SfxObjectShell &rSource ); 596 void ReadNote( INote * ); 597 void UpdateNote( INote * ); 598 599 // F"ur Docs, die zum Formatieren die Viewgr"o\se 600 // ben"otigen 601 virtual SfxObjectShell* GetObjectShell(); 602 //void SetBaseURL( const String& rURL ); 603 //const String& GetBaseURL() const; 604 //const String& GetBaseURLForSaving() const; 605 //void SetEmptyBaseURL(); 606 607 virtual SfxFrame* GetSmartSelf( SfxFrame* pSelf, SfxMedium& rMedium ); 608 609 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > 610 GetModel() const; 611 // Nur uebergangsweise fuer die Applikationen !!! 612 void SetBaseModel( SfxBaseModel* pModel ); 613 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetBaseModel() const; 614 // Nur uebergangsweise fuer die Applikationen !!! 615 616 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > GetEventNames(); 617 618 Window* GetDialogParent( SfxMedium* pMedium=0 ); 619 String UpdateTitle( SfxMedium* pMed=NULL, sal_uInt16 nDocViewNo=0 ); 620 static SfxObjectShell* CreateObject( const String& rServiceName, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD ); 621 static SfxObjectShell* CreateObjectByFactoryName( const String& rURL, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD ); 622 static SfxObjectShell* CreateAndLoadObject( const SfxItemSet& rSet, SfxFrame* pFrame=0 ); 623 static String GetServiceNameFromFactory( const String& rFact ); 624 sal_Bool IsInPlaceActive(); 625 sal_Bool IsUIActive(); 626 virtual void InPlaceActivate( sal_Bool ); 627 virtual void UIActivate( sal_Bool ); 628 629 static sal_Bool CopyStoragesOfUnknownMediaType( 630 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xSource, 631 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTarget ); 632 633 // ==== The functions from SvPersist 634 void EnableSetModified( sal_Bool bEnable = sal_True ); 635 sal_Bool IsEnableSetModified() const; 636 virtual void SetModified( sal_Bool bModified = sal_True ); 637 sal_Bool IsModified(); 638 639 void SetupStorage( 640 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, 641 sal_Int32 nVersion, 642 sal_Bool bTemplate ) const; 643 644 ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorage(); 645 646 //REMOVE void SetFileName( const ::rtl::OUString& ); 647 SvGlobalName GetClassName() const; 648 649 // comphelper::IEmbeddedHelper 650 virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler() const; getStorage() const651 virtual com::sun::star::uno::Reference < com::sun::star::embed::XStorage > getStorage() const 652 { 653 return const_cast<SfxObjectShell*>(this)->GetStorage(); 654 } getEmbeddedObjectContainer() const655 virtual comphelper::EmbeddedObjectContainer& getEmbeddedObjectContainer() const 656 { 657 return GetEmbeddedObjectContainer(); 658 } isEnableSetModified() const659 bool isEnableSetModified() const 660 { 661 return IsEnableSetModified(); 662 } 663 comphelper::EmbeddedObjectContainer& GetEmbeddedObjectContainer() const; 664 void ClearEmbeddedObjects(); 665 666 // ==== The functions from SvEmbeddedObject 667 virtual Printer * GetDocumentPrinter(); 668 virtual OutputDevice* GetDocumentRefDev(); 669 virtual void OnDocumentPrinterChanged( Printer * pNewPrinter ); 670 virtual Rectangle GetVisArea( sal_uInt16 nAspect ) const; 671 virtual void SetVisArea( const Rectangle & rVisArea ); 672 const Rectangle & GetVisArea() const; 673 void SetVisAreaSize( const Size & rVisSize ); 674 virtual sal_uIntPtr GetMiscStatus() const; 675 676 MapUnit GetMapUnit() const; 677 void SetMapUnit( MapUnit nMUnit ); 678 679 void FillTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc ) const; 680 void DoDraw( OutputDevice *, const Point & rObjPos, 681 const Size & rSize, 682 const JobSetup & rSetup, 683 sal_uInt16 nAspect = ASPECT_CONTENT ); 684 virtual void Draw( OutputDevice *, const JobSetup & rSetup, 685 sal_uInt16 nAspect = ASPECT_CONTENT ) = 0; 686 687 688 virtual void FillClass( SvGlobalName * pClassName, 689 sal_uInt32 * pFormat, 690 String * pAppName, 691 String * pFullTypeName, 692 String * pShortTypeName, 693 sal_Int32 nVersion, 694 sal_Bool bTemplate = sal_False) const = 0; 695 696 // change recording and respective passwword protection for Writer and Calc 697 // slots available for Writer: FN_REDLINE_ON, FN_REDLINE_ON 698 // slots used for Calc: FID_CHG_RECORD, SID_CHG_PROTECT 699 virtual bool IsChangeRecording() const; 700 virtual bool HasChangeRecordProtection() const; 701 virtual void SetChangeRecording( bool bActivate ); 702 virtual bool SetProtectionPassword( const String &rPassword ); 703 virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash ); 704 705 // ================================= 706 707 //#if 0 // _SOLAR__PRIVATE 708 709 SAL_DLLPRIVATE ::boost::shared_ptr<GDIMetaFile> CreatePreviewMetaFile_Impl( sal_Bool bFullContent, sal_Bool bHighContrast ) const; 710 711 SAL_DLLPRIVATE sal_Bool IsOwnStorageFormat_Impl(const SfxMedium &) const; 712 713 SAL_DLLPRIVATE sal_Bool IsPackageStorageFormat_Impl(const SfxMedium &) const; 714 715 SAL_DLLPRIVATE sal_Bool ConnectTmpStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, SfxMedium* pMedium ); 716 SAL_DLLPRIVATE sal_Bool DisconnectStorage_Impl( SfxMedium& rSrcMedium, SfxMedium& rTargetMedium ); 717 718 SAL_DLLPRIVATE sal_Bool PutURLContentsToVersionStream_Impl( 719 ::rtl::OUString aURL, 720 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDocStorage, 721 ::rtl::OUString aStreamName ); 722 723 SAL_DLLPRIVATE ::rtl::OUString CreateTempCopyOfStorage_Impl( 724 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); 725 726 SAL_DLLPRIVATE void InitOwnModel_Impl(); 727 SAL_DLLPRIVATE void BreakMacroSign_Impl( sal_Bool bBreakMacroSing ); 728 SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl(); 729 SAL_DLLPRIVATE void CheckForBrokenDocSignatures_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); 730 SAL_DLLPRIVATE sal_uInt16 ImplCheckSignaturesInformation( 731 const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos ); 732 SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); 733 SAL_DLLPRIVATE void SetModifyPasswordEntered( sal_Bool bEntered = sal_True ); 734 SAL_DLLPRIVATE sal_Bool IsModifyPasswordEntered(); 735 736 SAL_DLLPRIVATE void InitBasicManager_Impl(); Get_Impl()737 SAL_DLLPRIVATE SfxObjectShell_Impl* Get_Impl() { return pImp; } 738 739 SAL_DLLPRIVATE static sal_Bool UseInteractionToHandleError( 740 const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler, 741 sal_uInt32 nError ); Get_Impl() const742 SAL_DLLPRIVATE const SfxObjectShell_Impl* Get_Impl() const { return pImp; } 743 744 SAL_DLLPRIVATE void SetCreateMode_Impl( SfxObjectCreateMode nMode ); 745 746 SAL_DLLPRIVATE void DoDraw_Impl( OutputDevice* pDev, 747 const Point & rViewPos, 748 const Fraction & rScaleX, 749 const Fraction & rScaleY, 750 const JobSetup & rSetup, 751 sal_uInt16 nAspect ); 752 753 // Shell Interface 754 SAL_DLLPRIVATE void ExecFile_Impl(SfxRequest &); 755 SAL_DLLPRIVATE void GetState_Impl(SfxItemSet&); 756 SAL_DLLPRIVATE void PrintExec_Impl(SfxRequest &); 757 SAL_DLLPRIVATE void PrintState_Impl(SfxItemSet&); 758 SAL_DLLPRIVATE void ExecProps_Impl(SfxRequest &); 759 SAL_DLLPRIVATE void StateProps_Impl(SfxItemSet &); 760 SAL_DLLPRIVATE void ExecView_Impl(SfxRequest &); 761 SAL_DLLPRIVATE void StateView_Impl(SfxItemSet &); 762 763 // Laden-speichern public internals 764 SAL_DLLPRIVATE sal_Bool ImportFromGeneratedStream_Impl( 765 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream, 766 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr ); 767 SAL_DLLPRIVATE void PositionView_Impl(); 768 SAL_DLLPRIVATE void UpdateFromTemplate_Impl(); 769 SAL_DLLPRIVATE sal_Bool CanReload_Impl(); 770 SAL_DLLPRIVATE void SetNamedVisibility_Impl(); 771 SAL_DLLPRIVATE sal_Bool DoSave_Impl( const SfxItemSet* pSet=0 ); 772 SAL_DLLPRIVATE sal_Bool Save_Impl( const SfxItemSet* pSet=0 ); 773 SAL_DLLPRIVATE sal_Bool PreDoSaveAs_Impl(const String &rFileName, const String &rFiltName, SfxItemSet *); 774 SAL_DLLPRIVATE sal_Bool APISaveAs_Impl ( const String& aFileName, SfxItemSet* aParams ); 775 SAL_DLLPRIVATE sal_Bool CommonSaveAs_Impl ( const INetURLObject& aURL, const String& aFilterName, SfxItemSet* aParams ); 776 SAL_DLLPRIVATE sal_Bool GeneralInit_Impl( 777 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, 778 sal_Bool bTypeMustBeSetAlready ); 779 SAL_DLLPRIVATE void PrepareSecondTryLoad_Impl(); 780 SAL_DLLPRIVATE void SetInitialized_Impl( const bool i_fromInitNew ); 781 782 // public-internals 783 SAL_DLLPRIVATE IndexBitSet& GetNoSet_Impl(); 784 SAL_DLLPRIVATE void SetProgress_Impl( SfxProgress *pProgress ); 785 SAL_DLLPRIVATE void PostActivateEvent_Impl( SfxViewFrame* ); 786 SAL_DLLPRIVATE void SetActivateEvent_Impl(sal_uInt16 ); 787 SAL_DLLPRIVATE SfxObjectShell* GetParentShellByModel_Impl(); 788 789 // configuration items 790 SAL_DLLPRIVATE SfxToolBoxConfig* GetToolBoxConfig_Impl(); 791 SAL_DLLPRIVATE sal_uInt16 ImplGetSignatureState( sal_Bool bScriptingContent = sal_False ); 792 793 SAL_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation > 794 ImplAnalyzeSignature( 795 sal_Bool bScriptingContent, 796 const ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >& xSigner 797 = ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >() ); 798 799 SAL_DLLPRIVATE void ImplSign( sal_Bool bScriptingContent = sal_False ); 800 SAL_DLLPRIVATE sal_Bool QuerySaveSizeExceededModules_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); 801 //#endif 802 }; 803 804 #define SFX_GLOBAL_CLASSID \ 805 0x9eaba5c3, 0xb232, 0x4309, \ 806 0x84, 0x5f, 0x5f, 0x15, 0xea, 0x50, 0xd0, 0x74 807 808 //#if 0 // _SOLAR__PRIVATE 809 810 struct ModifyBlocker_Impl 811 { 812 SfxObjectShell* pPersist; 813 sal_Bool bWasEnabled; ModifyBlocker_ImplModifyBlocker_Impl814 ModifyBlocker_Impl( SfxObjectShell* pPersistP ) : pPersist( pPersistP ) 815 { 816 bWasEnabled = pPersistP->IsEnableSetModified(); 817 if ( bWasEnabled ) 818 pPersistP->EnableSetModified( sal_False ); 819 } ~ModifyBlocker_ImplModifyBlocker_Impl820 ~ModifyBlocker_Impl() 821 { 822 if ( bWasEnabled ) 823 pPersist->EnableSetModified( bWasEnabled ); 824 } 825 }; 826 //#endif 827 828 //-------------------------------------------------------------------- 829 #ifndef SFX_DECL_OBJECTSHELL_DEFINED 830 #define SFX_DECL_OBJECTSHELL_DEFINED 831 SV_DECL_REF(SfxObjectShell) 832 #endif 833 SV_DECL_LOCK(SfxObjectShell) 834 SV_IMPL_LOCK(SfxObjectShell) 835 SV_IMPL_REF(SfxObjectShell) 836 837 //#if 0 // _SOLAR__PRIVATE 838 //-------------------------------------------------------------------- 839 class AutoReloadTimer_Impl : public Timer 840 { 841 String aUrl; 842 sal_Bool bReload; 843 SfxObjectShell* pObjSh; 844 845 public: 846 AutoReloadTimer_Impl( const String& rURL, sal_uInt32 nTime, sal_Bool bReloadP, 847 SfxObjectShell* pSh ); 848 virtual void Timeout(); 849 }; 850 //#endif 851 852 //------------------------------------------------------------------------- 853 854 class SFX2_DLLPUBLIC SfxObjectShellItem: public SfxPoolItem 855 { 856 SfxObjectShell* pObjSh; 857 858 public: 859 TYPEINFO(); SfxObjectShellItem()860 SfxObjectShellItem() : 861 SfxPoolItem( 0 ), 862 pObjSh( 0 ) 863 {} SfxObjectShellItem(SfxObjectShell * pObjShell)864 SfxObjectShellItem( SfxObjectShell *pObjShell ): 865 SfxPoolItem( 0 ), 866 pObjSh( pObjShell ) 867 {} SfxObjectShellItem(sal_uInt16 nWhichId,SfxObjectShell * pObjShell)868 SfxObjectShellItem( sal_uInt16 nWhichId, 869 SfxObjectShell *pObjShell ): 870 SfxPoolItem( nWhichId ), 871 pObjSh( pObjShell ) 872 {} 873 874 virtual int operator==( const SfxPoolItem& ) const; 875 virtual String GetValueText() const; 876 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 877 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 878 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); GetObjectShell() const879 SfxObjectShell* GetObjectShell() const 880 { return pObjSh; } 881 882 }; 883 884 #endif 885 886