merge the formfield patch from ooo-build
[ooovba.git] / starmath / inc / document.hxx
blob3f015a924eda5a0a7cf0f01085ca7b1deb5fd1e4
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.35.26.1 $
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 #include <sot/storage.hxx>
36 #include <sot/sotref.hxx>
37 #include <sfx2/objsh.hxx>
38 #include <svtools/lstner.hxx>
39 #include <sfx2/docfac.hxx>
40 #include <vcl/virdev.hxx>
41 #include "format.hxx"
42 #include "parse.hxx"
43 #ifndef SMMOD_HXX
44 #include "smmod.hxx"
45 #endif
47 #include <vcl/jobset.hxx>
49 class SmNode;
50 class SfxMenuBarManager;
51 class SfxPrinter;
52 class Printer;
54 #define HINT_DATACHANGED 1004
56 #define SM30BIDENT ((ULONG)0x534D3033L)
57 #define SM30IDENT ((ULONG)0x30334d53L)
58 #define SM304AIDENT ((ULONG)0x34303330L)
59 #define SM30VERSION ((ULONG)0x00010000L)
60 #define SM50VERSION ((ULONG)0x00010001L) //Unterschied zur SM30VERSION ist
61 //der neue Border im Format.
63 #define FRMIDENT ((ULONG)0x03031963L)
64 #define FRMVERSION ((ULONG)0x00010001L)
66 #define STAROFFICE_XML "StarOffice XML (Math)"
67 #define MATHML_XML "MathML XML (Math)"
69 /* Zugriff auf den Drucker sollte ausschliesslich ueber diese Klasse erfolgen
70 * ==========================================================================
72 * Der Drucker kann dem Dokument oder auch dem OLE-Container gehoeren. Wenn
73 * das Dokument also eine OLE-Dokument ist, so gehoert der Drucker auch
74 * grundsaetzlich dem Container. Der Container arbeitet aber eventuell mit
75 * einer anderen MapUnit als der Server. Der Drucker wird bezueglich des MapMode
76 * im Konstruktor entsprechend eingestellt und im Destruktor wieder restauriert.
77 * Das bedingt natuerlich, das diese Klasse immer nur kurze Zeit existieren darf
78 * (etwa waehrend des Paints).
79 * Die Kontrolle darueber ob der Drucker selbst angelegt, vom Server besorgt
80 * oder dann auch NULL ist, uebernimmt die DocShell in der Methode GetPrt(),
81 * fuer die der Access auch Friend der DocShell ist.
84 class SmDocShell;
85 class EditEngine;
87 class SmPrinterAccess
89 Printer* pPrinter;
90 OutputDevice* pRefDev;
91 public:
92 SmPrinterAccess( SmDocShell &rDocShell );
93 ~SmPrinterAccess();
94 Printer* GetPrinter() { return pPrinter; }
95 OutputDevice* GetRefDev() { return pRefDev; }
99 ////////////////////////////////////////////////////////////
101 void SetEditEngineDefaultFonts(
102 EditEngine &rEditEngine,
103 SfxItemPool &rEditEngineItemPool );
105 ////////////////////////////////////////////////////////////
107 class SmDocShell : public SfxObjectShell, public SfxListener
109 friend class SmPrinterAccess;
110 friend class SmModel;
112 String aText;
113 SmFormat aFormat;
114 SmParser aInterpreter;
115 String aAccText;
116 SmNode *pTree;
117 SfxMenuBarManager *pMenuMgr;
118 SfxItemPool *pEditEngineItemPool;
119 EditEngine *pEditEngine;
120 SfxPrinter *pPrinter; //Siehe Kommentar zum SmPrinter Access!
121 Printer *pTmpPrinter; //ebenfalls
122 long nLeftBorder,
123 nRightBorder,
124 nTopBorder,
125 nBottomBorder;
126 USHORT nModifyCount;
127 BOOL bIsFormulaArranged;
131 virtual void SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType,
132 const SfxHint& rHint, const TypeId& rHintType);
134 BOOL WriteAsMathType3( SfxMedium& );
136 virtual void Draw(OutputDevice *pDevice,
137 const JobSetup & rSetup,
138 USHORT nAspect = ASPECT_CONTENT);
140 virtual void FillClass(SvGlobalName* pClassName,
141 sal_uInt32* pFormat,
142 String* pAppName,
143 String* pFullTypeName,
144 String* pShortTypeName,
145 sal_Int32 nFileFormat,
146 sal_Bool bTemplate = sal_False ) const;
148 virtual BOOL SetData( const String& rData );
149 virtual ULONG GetMiscStatus() const;
150 virtual void OnDocumentPrinterChanged( Printer * );
151 virtual sal_Bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
152 virtual BOOL Load( SfxMedium& rMedium );
153 void ImplSave( SvStorageStreamRef xStrm );
154 virtual BOOL Save();
155 virtual BOOL SaveAs( SfxMedium& rMedium );
156 virtual BOOL ConvertTo( SfxMedium &rMedium );
157 virtual BOOL SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
159 Printer *GetPrt();
160 OutputDevice* GetRefDev();
162 BOOL IsFormulaArranged() const { return bIsFormulaArranged; }
163 void SetFormulaArranged(BOOL bVal) { bIsFormulaArranged = bVal; }
165 virtual BOOL ConvertFrom(SfxMedium &rMedium);
167 public:
168 TYPEINFO();
169 SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+1)
170 using SotObject::GetInterface;
171 SFX_DECL_OBJECTFACTORY();
173 SmDocShell(SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED, const sal_Bool _bScriptSupport = sal_True);
174 virtual ~SmDocShell();
176 void LoadSymbols();
177 void SaveSymbols();
179 void ArrangeFormula();
181 //Zugriff fuer die View. Diese Zugriffe sind nur fuer den nicht OLE-Fall!
182 //und fuer die Kommunikation mit dem SFX!
183 //Alle internen Verwendungen des Printers sollten ausschlieslich uber
184 //den SmPrinterAccess funktionieren.
185 BOOL HasPrinter() { return 0 != pPrinter; }
186 SfxPrinter *GetPrinter() { GetPrt(); return pPrinter; }
187 void SetPrinter( SfxPrinter * );
189 const String GetComment() const;
191 // to replace chars that can not be saved with the document...
192 sal_Bool ReplaceBadChars();
194 void UpdateText();
195 void SetText(const String& rBuffer);
196 String& GetText() { return (aText); }
197 void SetFormat(SmFormat& rFormat);
198 const SmFormat& GetFormat() { return (aFormat); }
200 void Parse();
201 SmParser & GetParser() { return aInterpreter; }
202 const SmNode * GetFormulaTree() const { return pTree; }
203 void SetFormulaTree(SmNode *&rTree) { pTree = rTree; }
205 String GetAccessibleText();
207 EditEngine & GetEditEngine();
208 SfxItemPool & GetEditEngineItemPool();
210 void Draw(OutputDevice &rDev, Point &rPosition);
211 Size GetSize();
213 void Repaint();
215 virtual SfxUndoManager *GetUndoManager ();
217 virtual SfxItemPool& GetPool() const;
219 void Execute( SfxRequest& rReq );
220 void GetState(SfxItemSet &);
222 virtual void SetVisArea (const Rectangle & rVisArea);
223 virtual void SetModified(BOOL bModified);
227 #endif