Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_starmath / document.hxx
blobc98a56ed2fa07f9fbb08ffee8c129157dec4de28
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: document.hxx,v $
10 * $Revision: 1.11 $
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 DOCUMENT_HXX
31 #define DOCUMENT_HXX
33 #define SMDLL 1
35 #ifndef _SVSTOR_HXX //autogen
36 #include <bf_so3/svstor.hxx>
37 #endif
38 #ifndef _SOT_SOTREF_HXX //autogen
39 #include <sot/sotref.hxx>
40 #endif
41 #ifndef _SFX_OBJSH_HXX //autogen
42 #include <bf_sfx2/objsh.hxx>
43 #endif
44 #ifndef _SFX_INTERNO_HXX //autogen
45 #include <bf_sfx2/interno.hxx>
46 #endif
47 #ifndef _SFXLSTNER_HXX //autogen
48 #include <bf_svtools/lstner.hxx>
49 #endif
50 #ifndef _SFX_OBJFAC_HXX //autogen
51 #include <bf_sfx2/docfac.hxx>
52 #endif
53 #ifndef _SV_VIRDEV_HXX //autogen
54 #include <vcl/virdev.hxx>
55 #endif
57 #ifndef _FORMAT_HXX
58 #include "format.hxx"
59 #endif
60 #ifndef PARSE_HXX
61 #include "parse.hxx"
62 #endif
63 #ifndef SMMOD_HXX
64 #include "smmod.hxx"
65 #endif
66 class Printer;
67 namespace binfilter {
69 class SmNode;
70 class SmSymSetManager;
71 class SfxPrinter;
74 #ifndef SO2_DECL_SVSTORAGESTREAM_DEFINED
75 #define SO2_DECL_SVSTORAGESTREAM_DEFINED
76 SO2_DECL_REF(SvStorageStream)
77 #endif
79 #define HINT_DATACHANGED 1004
81 #define SM30BIDENT ((sal_uInt32)0x534D3033L)
82 #define SM30IDENT ((sal_uInt32)0x30334d53L)
83 #define SM304AIDENT ((sal_uInt32)0x34303330L)
84 #define SM30VERSION ((sal_uInt32)0x00010000L)
85 #define SM50VERSION ((sal_uInt32)0x00010001L) //Unterschied zur SM30VERSION ist
86 //der neue Border im Format.
88 #define FRMIDENT ((sal_uInt32)0x03031963L)
89 #define FRMVERSION ((sal_uInt32)0x00010001L)
91 #define STAROFFICE_XML "StarOffice XML (Math)"
92 #define MATHML_XML "MathML XML (Math)"
94 /* Zugriff auf den Drucker sollte ausschliesslich ueber diese Klasse erfolgen
95 * ==========================================================================
97 * Der Drucker kann dem Dokument oder auch dem OLE-Container gehoeren. Wenn
98 * das Dokument also eine OLE-Dokument ist, so gehoert der Drucker auch
99 * grundsaetzlich dem Container. Der Container arbeitet aber eventuell mit
100 * einer anderen MapUnit als der Server. Der Drucker wird bezueglich des MapMode
101 * im Konstruktor entsprechend eingestellt und im Destruktor wieder restauriert.
102 * Das bedingt natuerlich, das diese Klasse immer nur kurze Zeit existieren darf
103 * (etwa waehrend des Paints).
104 * Die Kontrolle darueber ob der Drucker selbst angelegt, vom Server besorgt
105 * oder dann auch NULL ist, uebernimmt die DocShell in der Methode GetPrt(),
106 * fuer die der Access auch Friend der DocShell ist.
109 class SmDocShell;
110 class EditEngine;
111 class EditEngineItemPool;
113 class SmPrinterAccess
115 Printer* pPrinter;
116 OutputDevice* pRefDev;
117 public:
118 SmPrinterAccess( SmDocShell &rDocShell );
119 ~SmPrinterAccess();
120 Printer* GetPrinter() { return pPrinter; }
121 OutputDevice* GetRefDev() { return pRefDev; }
125 ////////////////////////////////////////////////////////////
127 class SmDocShell : public SfxObjectShell, public SfxInPlaceObject,
128 public SfxListener
130 friend class SmPrinterAccess;
132 String aText;
133 SmFormat aFormat;
134 SmParser aInterpreter;
135 SvStorageStreamRef aDocStream;
136 String aAccText;
137 SmSymSetManager *pSymSetMgr;
138 SmNode *pTree;
139 SfxMenuBarManager *pMenuMgr;
140 SfxItemPool *pEditEngineItemPool;
141 EditEngine *pEditEngine;
142 SfxPrinter *pPrinter; //Siehe Kommentar zum SmPrinter Access!
143 Printer *pTmpPrinter; //ebenfalls
144 long nLeftBorder,
145 nRightBorder,
146 nTopBorder,
147 nBottomBorder;
148 USHORT nModifyCount;
149 BOOL bIsFormulaArranged;
155 BOOL Try3x( SvStorage *pStor, StreamMode eMode);
156 BOOL Try2x( SvStorage *pStor, StreamMode eMode);
159 virtual void FillClass(SvGlobalName* pClassName,
160 ULONG* pFormat,
161 String* pAppName,
162 String* pFullTypeName,
163 String* pShortTypeName,
164 long nFileFormat = SOFFICE_FILEFORMAT_CURRENT) const;
166 virtual ULONG GetMiscStatus() const;
167 virtual void OnDocumentPrinterChanged( Printer * );
168 virtual BOOL InitNew(SvStorage *);
169 virtual BOOL Load(SvStorage *);
170 void ImplSave( SvStorageStreamRef xStrm );
171 virtual BOOL Save();
172 virtual BOOL SaveAs( SvStorage *pNewStor );
173 virtual BOOL SaveCompleted( SvStorage *pNewStor );
174 virtual void HandsOff();
176 Printer *GetPrt();
177 OutputDevice* GetRefDev();
179 // used to convert the formula text between different office versions
180 void ConvertText( String &rText, SmConvert eConv );
182 BOOL IsFormulaArranged() const { return bIsFormulaArranged; }
183 void SetFormulaArranged(BOOL bVal) { bIsFormulaArranged = bVal; }
184 void ArrangeFormula();
188 void UpdateText();
190 public:
191 TYPEINFO();
192 SFX_DECL_OBJECTFACTORY_DLL(SmDocShell, SM_MOD());
194 SmDocShell(SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED);
195 virtual ~SmDocShell();
198 //Zugriff fuer die View. Diese Zugriffe sind nur fuer den nicht OLE-Fall!
199 //und fuer die Kommunikation mit dem SFX!
200 //Alle internen Verwendungen des Printers sollten ausschlieslich uber
201 //den SmPrinterAccess funktionieren.
202 BOOL HasPrinter() { return 0 != pPrinter; }
203 SfxPrinter *GetPrinter() { GetPrt(); return pPrinter; }
204 void SetPrinter( SfxPrinter * );
207 void SetText(const String& rBuffer);
208 String& GetText() { return (aText); }
209 SmFormat& GetFormat() { return (aFormat); }
211 void Parse();
212 SmParser & GetParser() { return aInterpreter; }
213 const SmNode * GetFormulaTree() const { return pTree; }
214 void SetFormulaTree(SmNode *&rTree) { pTree = rTree; }
217 SmSymSetManager & GetSymSetManager();
218 const SmSymSetManager & GetSymSetManager() const
220 return ((SmDocShell *) this)->GetSymSetManager();
223 Size GetSize();
225 void Resize();
228 virtual SfxItemPool& GetPool();
230 virtual void SetVisArea (const Rectangle & rVisArea);
232 virtual void SetModified(BOOL bModified);
236 } //namespace binfilter
237 #endif