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