1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef _SWDOCSH_HXX 28*cdf0e10cSrcweir #define _SWDOCSH_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #include <rtl/ref.hxx> 31*cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h> 33*cdf0e10cSrcweir #include <vcl/timer.hxx> 34*cdf0e10cSrcweir #include <sfx2/docfac.hxx> 35*cdf0e10cSrcweir #include <sfx2/objsh.hxx> 36*cdf0e10cSrcweir #include "swdllapi.h" 37*cdf0e10cSrcweir #include <swdll.hxx> 38*cdf0e10cSrcweir #include <shellid.hxx> 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #include <svl/lstner.hxx> 41*cdf0e10cSrcweir #include <svtools/embedhlp.hxx> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir class SwDoc; 44*cdf0e10cSrcweir class SfxDocumentInfoDialog; 45*cdf0e10cSrcweir class SfxStyleSheetBasePool; 46*cdf0e10cSrcweir class SfxInPlaceClient; 47*cdf0e10cSrcweir class FontList; 48*cdf0e10cSrcweir class SwView; 49*cdf0e10cSrcweir class SwWrtShell; 50*cdf0e10cSrcweir class SwFEShell; 51*cdf0e10cSrcweir class Reader; 52*cdf0e10cSrcweir class SwReader; 53*cdf0e10cSrcweir class SwCrsrShell; 54*cdf0e10cSrcweir class SwSrcView; 55*cdf0e10cSrcweir class SwPaM; 56*cdf0e10cSrcweir class SwgReaderOption; 57*cdf0e10cSrcweir class SwOLEObj; 58*cdf0e10cSrcweir class IDocumentDeviceAccess; 59*cdf0e10cSrcweir class IDocumentSettingAccess; 60*cdf0e10cSrcweir class IDocumentTimerAccess; 61*cdf0e10cSrcweir class IDocumentChartDataProviderAccess; 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir SwDoc* pDoc; // Document 67*cdf0e10cSrcweir rtl::Reference< SfxStyleSheetBasePool > mxBasePool; // Durchreiche fuer Formate 68*cdf0e10cSrcweir FontList* pFontList; // aktuelle FontListe 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir // Nix geht ohne die WrtShell (historische Gruende) 71*cdf0e10cSrcweir // RuekwaertsPointer auf die View (historische Gruende) 72*cdf0e10cSrcweir // Dieser gilt solange bis im Activate ein neuer gesetzt wird 73*cdf0e10cSrcweir // oder dieser im Dtor der View geloescht wird 74*cdf0e10cSrcweir // 75*cdf0e10cSrcweir SwView* pView; 76*cdf0e10cSrcweir SwWrtShell* pWrtShell; 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir Timer aFinishedTimer; // Timer fuers ueberpriefen der 79*cdf0e10cSrcweir // Grafik-Links. Sind alle da, 80*cdf0e10cSrcweir // dann ist Doc voll. geladen 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir //SvPersistRef xOLEChildList; // fuers RemoveOLEObjects 83*cdf0e10cSrcweir comphelper::EmbeddedObjectContainer* pOLEChildList; 84*cdf0e10cSrcweir sal_Int16 nUpdateDocMode; // contains the com::sun::star::document::UpdateDocMode 85*cdf0e10cSrcweir bool bInUpdateFontList; //prevent nested calls of UpdateFontList 86*cdf0e10cSrcweir // Methoden fuer den Zugriff aufs Doc 87*cdf0e10cSrcweir SW_DLLPRIVATE void AddLink(); 88*cdf0e10cSrcweir SW_DLLPRIVATE void RemoveLink(); 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir // Hint abfangen fuer DocInfo 91*cdf0e10cSrcweir SW_DLLPRIVATE virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir // FileIO 94*cdf0e10cSrcweir SW_DLLPRIVATE virtual sal_Bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); 95*cdf0e10cSrcweir SW_DLLPRIVATE virtual sal_Bool Load( SfxMedium& rMedium ); 96*cdf0e10cSrcweir SW_DLLPRIVATE virtual sal_Bool LoadFrom( SfxMedium& rMedium ); 97*cdf0e10cSrcweir SW_DLLPRIVATE virtual sal_Bool ConvertFrom( SfxMedium &rMedium ); 98*cdf0e10cSrcweir SW_DLLPRIVATE virtual sal_Bool ConvertTo( SfxMedium &rMedium ); 99*cdf0e10cSrcweir SW_DLLPRIVATE virtual sal_Bool SaveAs( SfxMedium& rMedium ); 100*cdf0e10cSrcweir SW_DLLPRIVATE virtual sal_Bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir SW_DLLPRIVATE virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False ); 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir // DocInfo dem Doc melden 105*cdf0e10cSrcweir // 106*cdf0e10cSrcweir SW_DLLPRIVATE virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog( 107*cdf0e10cSrcweir Window *pParent, const SfxItemSet &); 108*cdf0e10cSrcweir // OLE-Geraffel 109*cdf0e10cSrcweir SW_DLLPRIVATE virtual void Draw( OutputDevice*, const JobSetup&, sal_uInt16); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir // Methoden fuer StyleSheets 112*cdf0e10cSrcweir SW_DLLPRIVATE sal_uInt16 Edit( const String &rName, const String& rParent, sal_uInt16 nFamily, 113*cdf0e10cSrcweir sal_uInt16 nMask, sal_Bool bNew, 114*cdf0e10cSrcweir sal_Bool bColumn = sal_False, 115*cdf0e10cSrcweir SwWrtShell* pActShell = 0, 116*cdf0e10cSrcweir sal_Bool bBasic = sal_False ); 117*cdf0e10cSrcweir SW_DLLPRIVATE sal_uInt16 Delete(const String &rName, sal_uInt16 nFamily); 118*cdf0e10cSrcweir SW_DLLPRIVATE sal_uInt16 ApplyStyles(const String &rName, sal_uInt16 nFamily, SwWrtShell* pShell = 0, 119*cdf0e10cSrcweir sal_uInt16 nMode = 0 ); 120*cdf0e10cSrcweir SW_DLLPRIVATE sal_uInt16 DoWaterCan( const String &rName, sal_uInt16 nFamily); 121*cdf0e10cSrcweir SW_DLLPRIVATE sal_uInt16 UpdateStyle(const String &rName, sal_uInt16 nFamily, SwWrtShell* pShell = 0); 122*cdf0e10cSrcweir SW_DLLPRIVATE sal_uInt16 MakeByExample(const String &rName, 123*cdf0e10cSrcweir sal_uInt16 nFamily, sal_uInt16 nMask, SwWrtShell* pShell = 0); 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir SW_DLLPRIVATE void InitDraw(); 126*cdf0e10cSrcweir SW_DLLPRIVATE void SubInitNew(); // fuer InitNew und HtmlSourceModus 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir SW_DLLPRIVATE void RemoveOLEObjects(); 129*cdf0e10cSrcweir SW_DLLPRIVATE void CalcLayoutForOLEObjects(); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir SW_DLLPRIVATE void Init_Impl(); 132*cdf0e10cSrcweir SW_DLLPRIVATE DECL_STATIC_LINK( SwDocShell, IsLoadFinished, void* ); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir using SfxObjectShell::GetVisArea; 136*cdf0e10cSrcweir using SfxObjectShell::GetStyleFamilyBitmap; 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir protected: 139*cdf0e10cSrcweir /// override to update text fields 140*cdf0e10cSrcweir virtual void DoFlushDocInfo(); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir public: 143*cdf0e10cSrcweir using SotObject::GetInterface; 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir // aber selbst implementieren 146*cdf0e10cSrcweir SFX_DECL_INTERFACE(SW_DOCSHELL) 147*cdf0e10cSrcweir SFX_DECL_OBJECTFACTORY() 148*cdf0e10cSrcweir TYPEINFO(); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir static SfxInterface *_GetInterface() { return GetStaticInterface(); } 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir static rtl::OUString GetEventName( sal_Int32 nId ); 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir //Das Doc wird fuer SO-Datenaustausch benoetigt! 155*cdf0e10cSrcweir SwDocShell( SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED ); 156*cdf0e10cSrcweir SwDocShell( const sal_uInt64 i_nSfxCreationFlags ); 157*cdf0e10cSrcweir SwDocShell( SwDoc *pDoc, SfxObjectCreateMode eMode = SFX_CREATE_MODE_STANDARD ); 158*cdf0e10cSrcweir ~SwDocShell(); 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir // OLE 2.0-Benachrichtigung 161*cdf0e10cSrcweir DECL_LINK( Ole2ModifiedHdl, void * ); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir // OLE-Geraffel 164*cdf0e10cSrcweir virtual void SetVisArea( const Rectangle &rRect ); 165*cdf0e10cSrcweir virtual Rectangle GetVisArea( sal_uInt16 nAspect ) const; 166*cdf0e10cSrcweir virtual Printer *GetDocumentPrinter(); 167*cdf0e10cSrcweir virtual OutputDevice* GetDocumentRefDev(); 168*cdf0e10cSrcweir virtual void OnDocumentPrinterChanged( Printer * pNewPrinter ); 169*cdf0e10cSrcweir virtual sal_uLong GetMiscStatus() const; 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir virtual void PrepareReload(); 172*cdf0e10cSrcweir virtual void SetModified( sal_Bool = sal_True ); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir // Dispatcher 175*cdf0e10cSrcweir void Execute(SfxRequest &); 176*cdf0e10cSrcweir void ExecStyleSheet(SfxRequest&); 177*cdf0e10cSrcweir void ExecDB(SfxRequest&); 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir void GetState(SfxItemSet &); 180*cdf0e10cSrcweir void StateAlways(SfxItemSet &); 181*cdf0e10cSrcweir void StateStyleSheet(SfxItemSet&, SwWrtShell* pSh = 0 ); 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir // Doc rausreichen aber VORSICHT 184*cdf0e10cSrcweir inline SwDoc* GetDoc() { return pDoc; } 185*cdf0e10cSrcweir inline const SwDoc* GetDoc() const { return pDoc; } 186*cdf0e10cSrcweir IDocumentDeviceAccess* getIDocumentDeviceAccess(); 187*cdf0e10cSrcweir const IDocumentSettingAccess* getIDocumentSettingAccess() const; 188*cdf0e10cSrcweir IDocumentChartDataProviderAccess* getIDocumentChartDataProviderAccess(); 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir void UpdateFontList(); 192*cdf0e10cSrcweir void UpdateChildWindows(); 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir // globaler IO 195*cdf0e10cSrcweir virtual sal_Bool Save(); 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir // fuer VorlagenPI 198*cdf0e10cSrcweir virtual SfxStyleSheetBasePool* GetStyleSheetPool(); 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir // Fuer Organizer 201*cdf0e10cSrcweir virtual sal_Bool Insert(SfxObjectShell &rSource, 202*cdf0e10cSrcweir sal_uInt16 nSourceIdx1, 203*cdf0e10cSrcweir sal_uInt16 nSourceIdx2, 204*cdf0e10cSrcweir sal_uInt16 nSourceIdx3, 205*cdf0e10cSrcweir sal_uInt16& nIdx1, 206*cdf0e10cSrcweir sal_uInt16& nIdx2, 207*cdf0e10cSrcweir sal_uInt16& nIdx3, 208*cdf0e10cSrcweir sal_uInt16& nRemovedIdx); 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir virtual sal_Bool Remove(sal_uInt16 nIdx1, 211*cdf0e10cSrcweir sal_uInt16 nIdx2 = INDEX_IGNORE, 212*cdf0e10cSrcweir sal_uInt16 nIdx3 = INDEX_IGNORE); 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir virtual Bitmap GetStyleFamilyBitmap( SfxStyleFamily eFamily, BmpColorMode eColorMode ); 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir // View setzen fuer Aktionen ueber Shell 217*cdf0e10cSrcweir void SetView(SwView* pVw); 218*cdf0e10cSrcweir const SwView *GetView() const { return pView; } 219*cdf0e10cSrcweir SwView *GetView() { return pView; } 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir // Zugriff auf die zur SwView gehoerige SwWrtShell 222*cdf0e10cSrcweir SwWrtShell *GetWrtShell() { return pWrtShell; } 223*cdf0e10cSrcweir const SwWrtShell *GetWrtShell() const { return pWrtShell; } 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir // fuer die Core - die kennt die DocShell aber keine WrtShell! 226*cdf0e10cSrcweir SwFEShell *GetFEShell(); 227*cdf0e10cSrcweir const SwFEShell *GetFEShell() const 228*cdf0e10cSrcweir { return ((SwDocShell*)this)->GetFEShell(); } 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir // Fuer Einfuegen Dokument 232*cdf0e10cSrcweir Reader* StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr, 233*cdf0e10cSrcweir SwCrsrShell* pCrsrSh = 0, SwPaM* pPaM = 0); 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir virtual long DdeGetData( const String& rItem, const String& rMimeType, 236*cdf0e10cSrcweir ::com::sun::star::uno::Any & rValue ); 237*cdf0e10cSrcweir virtual long DdeSetData( const String& rItem, const String& rMimeType, 238*cdf0e10cSrcweir const ::com::sun::star::uno::Any & rValue ); 239*cdf0e10cSrcweir virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem ); 240*cdf0e10cSrcweir virtual void FillClass( SvGlobalName * pClassName, 241*cdf0e10cSrcweir sal_uInt32 * pClipFormat, 242*cdf0e10cSrcweir String * pAppName, 243*cdf0e10cSrcweir String * pLongUserName, 244*cdf0e10cSrcweir String * pUserName, 245*cdf0e10cSrcweir sal_Int32 nFileFormat, 246*cdf0e10cSrcweir sal_Bool bTemplate = sal_False ) const; 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir virtual void LoadStyles( SfxObjectShell& rSource ); 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir void _LoadStyles( SfxObjectShell& rSource, sal_Bool bPreserveCurrentDocument ); 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir // Seitenvorlagedialog anzeigen, ggf. auf Spaltenpage 253*cdf0e10cSrcweir void FormatPage( const String& rPage, 254*cdf0e10cSrcweir sal_Bool bColumn = sal_False, 255*cdf0e10cSrcweir SwWrtShell* pActShell = 0 ); 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir // --> OD 2006-11-07 #i59688# 258*cdf0e10cSrcweir // linked graphics are now loaded on demand. 259*cdf0e10cSrcweir // Thus, loading of linked graphics no longer needed and necessary for 260*cdf0e10cSrcweir // the load of document being finished. 261*cdf0e10cSrcweir // // Timer starten fuers ueberpruefen der Grafik-Links. Sind alle 262*cdf0e10cSrcweir // // vollstaendig geladen, dann ist das Doc fertig 263*cdf0e10cSrcweir // void StartLoadFinishedTimer(); 264*cdf0e10cSrcweir void LoadingFinished(); 265*cdf0e10cSrcweir // <-- 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir // eine Uebertragung wird abgebrochen (wird aus dem SFX gerufen) 268*cdf0e10cSrcweir virtual void CancelTransfers(); 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir // Doc aus Html-Source neu laden 271*cdf0e10cSrcweir void ReloadFromHtml( const String& rStreamName, SwSrcView* pSrcView ); 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir sal_Int16 GetUpdateDocMode() const {return nUpdateDocMode;} 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir //Activate wait cursor for all windows of this document 276*cdf0e10cSrcweir //Optionally all dispatcher could be Locked 277*cdf0e10cSrcweir //Usually locking should be done using the class: SwWaitObject! 278*cdf0e10cSrcweir void EnterWait( sal_Bool bLockDispatcher ); 279*cdf0e10cSrcweir void LeaveWait( sal_Bool bLockDispatcher ); 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir void ToggleBrowserMode(sal_Bool bOn, SwView* pView); 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir sal_uLong LoadStylesFromFile( const String& rURL, SwgReaderOption& rOpt, 284*cdf0e10cSrcweir sal_Bool bUnoCall ); 285*cdf0e10cSrcweir void InvalidateModel(); 286*cdf0e10cSrcweir void ReactivateModel(); 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > GetEventNames(); 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir // --> FME 2004-08-05 #i20883# Digital Signatures and Encryption 291*cdf0e10cSrcweir virtual sal_uInt16 GetHiddenInformationState( sal_uInt16 nStates ); 292*cdf0e10cSrcweir // <-- 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir // --> FME 2005-02-25 #i42634# Overwrites SfxObjectShell::UpdateLinks 295*cdf0e10cSrcweir // This new function is necessary to trigger update of links in docs 296*cdf0e10cSrcweir // read by the binary filter: 297*cdf0e10cSrcweir virtual void UpdateLinks(); 298*cdf0e10cSrcweir // <-- 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > 301*cdf0e10cSrcweir GetController(); 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir SfxInPlaceClient* GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef ); 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir virtual const ::sfx2::IXmlIdRegistry* GetXmlIdRegistry() const; 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir // passwword protection for Writer (derived from SfxObjectShell) 308*cdf0e10cSrcweir // see also: FN_REDLINE_ON, FN_REDLINE_ON 309*cdf0e10cSrcweir virtual bool IsChangeRecording() const; 310*cdf0e10cSrcweir virtual bool HasChangeRecordProtection() const; 311*cdf0e10cSrcweir virtual void SetChangeRecording( bool bActivate ); 312*cdf0e10cSrcweir virtual bool SetProtectionPassword( const String &rPassword ); 313*cdf0e10cSrcweir virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash ); 314*cdf0e10cSrcweir }; 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir class Graphic; 317*cdf0e10cSrcweir //implemented in source/ui/docvw/romenu.cxx 318*cdf0e10cSrcweir String ExportGraphic( const Graphic &rGraphic, const String &rGrfName ); 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir #endif 321