Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_sw / docsh.hxx
blob92409740b4dee0269cd00d92448b98a96976cdbb
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.10 $
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 #ifndef _TIMER_HXX //autogen
34 #include <vcl/timer.hxx>
35 #endif
36 #ifndef _SFX_OBJFAC_HXX //autogen
37 #include <bf_sfx2/docfac.hxx>
38 #endif
39 #ifndef _SFX_INTERNO_HXX //autogen
40 #include <bf_sfx2/interno.hxx>
41 #endif
42 #ifndef _SFX_OBJSH_HXX //autogen
43 #include <bf_sfx2/objsh.hxx>
44 #endif
45 #ifndef SW_SWDLL_HXX
46 #include <swdll.hxx>
47 #endif
48 #ifndef _SHELLID_HXX
49 #include <shellid.hxx>
50 #endif
52 #include <bf_svtools/lstner.hxx>
54 class SfxStyleSheetBasePool;
55 class FontList;
56 class PushButton;
57 class FixedText;
59 namespace binfilter {
61 class SwDoc;
62 class Sw3Io;
63 class SfxDocumentInfoDialog;
64 class SwView;
65 class SwWrtShell;
66 class SwFEShell;
67 class Reader;
68 class SwReader;
69 class SwCrsrShell;
70 class SwSrcView;
71 class SwPaM;
72 class SwgReaderOption;
74 class SwDocShell: public SfxObjectShell, public SfxInPlaceObject,
75 public SfxListener
77 SwDoc* pDoc; // Document
78 Sw3Io* pIo; // Reader / Writer
79 SfxStyleSheetBasePool* pBasePool; // Durchreiche fuer Formate
80 FontList* pFontList; // aktuelle FontListe
82 // Nix geht ohne die WrtShell (historische Gruende)
83 // RuekwaertsPointer auf die View (historische Gruende)
84 // Dieser gilt solange bis im Activate ein neuer gesetzt wird
85 // oder dieser im Dtor der View geloescht wird
87 SwView* pView;
88 SwWrtShell* pWrtShell;
90 Timer aFinishedTimer; // Timer fuers ueberpriefen der
91 // Grafik-Links. Sind alle da,
92 // dann ist Doc voll. geladen
94 SvPersistRef xOLEChildList; // fuers RemoveOLEObjects
95 sal_Int16 nUpdateDocMode; // contains the ::com::sun::star::document::UpdateDocMode
97 // Methoden fuer den Zugriff aufs Doc
98 void AddLink();
99 void RemoveLink();
101 // Hint abfangen fuer DocInfo
102 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
104 // FileIO
105 virtual BOOL InitNew(SvStorage* pNewStor);
106 virtual BOOL Load(SvStorage* pStor);
107 virtual BOOL LoadFrom(SvStorage* pStor);
108 virtual BOOL ConvertFrom( SfxMedium &rMedium );
109 virtual void HandsOff();
110 virtual BOOL SaveAs(SvStorage * pNewStor );
111 virtual BOOL SaveCompleted(SvStorage * pNewStor );
113 // DocInfo dem Doc melden
115 // OLE-Geraffel
117 // Methoden fuer StyleSheets
119 void InitDraw();
120 void SubInitNew(); // fuer InitNew und HtmlSourceModus
121 inline void SetWrtShell(SwWrtShell* pShell)
122 { pWrtShell = pShell; }
124 void RemoveOLEObjects();
125 void CalcLayoutForOLEObjects();
127 void Init_Impl();
128 DECL_STATIC_LINK( SwDocShell, IsLoadFinished, void* );
130 public:
132 // aber selbst implementieren
133 SFX_DECL_OBJECTFACTORY_DLL(SwDocShell, SW_DLL());
134 TYPEINFO();
136 //Das Doc wird fuer SO-Datenaustausch benoetigt!
137 SwDocShell(SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED);
138 SwDocShell( SwDoc *pDoc, SfxObjectCreateMode eMode = SFX_CREATE_MODE_STANDARD );
139 ~SwDocShell();
141 // OLE 2.0-Benachrichtigung
142 DECL_LINK( Ole2ModifiedHdl, void * );
144 // OLE-Geraffel
145 virtual void SetVisArea( const Rectangle &rRect );
146 virtual Rectangle GetVisArea( USHORT nAspect ) const;
147 virtual Printer *GetDocumentPrinter();
148 virtual OutputDevice* GetDocumentRefDev();
149 virtual void OnDocumentPrinterChanged( Printer * pNewPrinter );
150 virtual ULONG GetMiscStatus() const;
152 virtual void SetModified( BOOL = TRUE );
154 // Doc rausreichen aber VORSICHT
155 inline SwDoc* GetDoc() { return pDoc; }
156 void UpdateFontList();
157 void UpdateChildWindows();
159 // DocumentInfo neu setzen
161 // globaler IO
162 virtual BOOL Save();
163 inline BOOL SaveAsChilds( SvStorage *pStor );
164 inline BOOL SaveCompletedChilds( SvStorage *pStor );
166 // fuer VorlagenPI
167 virtual SfxStyleSheetBasePool* GetStyleSheetPool();
169 // Fuer Organizer
173 const SwView *GetView() const { return pView; }
174 SwView *GetView() { return pView; }
176 // Zugriff auf die zur SwView gehoerige SwWrtShell
177 SwWrtShell *GetWrtShell() { return pWrtShell; }
178 const SwWrtShell *GetWrtShell() const { return pWrtShell; }
180 // fuer die Core - die kennt die DocShell aber keine WrtShell!
181 const SwFEShell *GetFEShell() const
182 { return ((SwDocShell*)this)->GetFEShell(); }
185 // Fuer Einfuegen Dokument
186 Reader* StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr,
187 SwCrsrShell* pCrsrSh = 0, SwPaM* pPaM = 0);
189 // Anforderung der pIo-Struktur fuer den Zugriff auf Substorages
190 // und Streams
191 Sw3Io* GetIoSystem() { return pIo; }
193 virtual void FillClass( SvGlobalName * pClassName,
194 ULONG * pClipFormat,
195 String * pAppName,
196 String * pLongUserName,
197 String * pUserName,
198 long nVersion = SOFFICE_FILEFORMAT_CURRENT ) const;
201 // Seitenvorlagedialog anzeigen, ggf. auf Spaltenpage
203 // Timer starten fuers ueberpruefen der Grafik-Links. Sind alle
204 // vollstaendig geladen, dann ist das Doc fertig
205 void StartLoadFinishedTimer();
207 // eine Uebertragung wird abgebrochen (wird aus dem SFX gerufen)
208 virtual void CancelTransfers();
210 // Doc aus Html-Source neu laden
212 // embedded alle lokalen Links (Bereiche/Grafiken)
213 sal_Int16 GetUpdateDocMode() const {return nUpdateDocMode;}
215 //Activate wait cursor for all windows of this document
216 //Optionally all dispatcher could be Locked
217 //Usually locking should be done using the class: SwWaitObject!
218 void EnterWait( BOOL bLockDispatcher );
219 void LeaveWait( BOOL bLockDispatcher );
221 ULONG LoadStylesFromFile( const String& rURL, SwgReaderOption& rOpt,
222 BOOL bUnoCall );
224 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > GetEventNames();
227 inline BOOL SwDocShell::SaveAsChilds( SvStorage *pStor )
229 return SfxInPlaceObject::SaveAsChilds( pStor );
232 inline BOOL SwDocShell::SaveCompletedChilds( SvStorage *pStor )
234 return SfxInPlaceObject::SaveCompletedChilds( pStor );
236 } //namespace binfilter
237 #endif