merged tag ooo/OOO330_m14
[LibreOffice.git] / starmath / inc / document.hxx
blobf03cd43fc9656ed705725a49528691e0c85ee35e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef DOCUMENT_HXX
28 #define DOCUMENT_HXX
30 #define SMDLL 1
32 #include <sot/storage.hxx>
33 #include <sot/sotref.hxx>
34 #include <sfx2/objsh.hxx>
35 #include <svl/lstner.hxx>
36 #include <sfx2/docfac.hxx>
37 #include <vcl/virdev.hxx>
39 #include "format.hxx"
40 #include "parse.hxx"
41 #include "smmod.hxx"
43 #include <vcl/jobset.hxx>
45 class SmNode;
46 class SfxMenuBarManager;
47 class SfxPrinter;
48 class Printer;
50 #define HINT_DATACHANGED 1004
52 #define SM30BIDENT ((ULONG)0x534D3033L)
53 #define SM30IDENT ((ULONG)0x30334d53L)
54 #define SM304AIDENT ((ULONG)0x34303330L)
55 #define SM30VERSION ((ULONG)0x00010000L)
56 #define SM50VERSION ((ULONG)0x00010001L) //Unterschied zur SM30VERSION ist
57 //der neue Border im Format.
59 #define FRMIDENT ((ULONG)0x03031963L)
60 #define FRMVERSION ((ULONG)0x00010001L)
62 #define STAROFFICE_XML "StarOffice XML (Math)"
63 #define MATHML_XML "MathML XML (Math)"
65 /* Zugriff auf den Drucker sollte ausschliesslich ueber diese Klasse erfolgen
66 * ==========================================================================
68 * Der Drucker kann dem Dokument oder auch dem OLE-Container gehoeren. Wenn
69 * das Dokument also eine OLE-Dokument ist, so gehoert der Drucker auch
70 * grundsaetzlich dem Container. Der Container arbeitet aber eventuell mit
71 * einer anderen MapUnit als der Server. Der Drucker wird bezueglich des MapMode
72 * im Konstruktor entsprechend eingestellt und im Destruktor wieder restauriert.
73 * Das bedingt natuerlich, das diese Klasse immer nur kurze Zeit existieren darf
74 * (etwa waehrend des Paints).
75 * Die Kontrolle darueber ob der Drucker selbst angelegt, vom Server besorgt
76 * oder dann auch NULL ist, uebernimmt die DocShell in der Methode GetPrt(),
77 * fuer die der Access auch Friend der DocShell ist.
80 class SmDocShell;
81 class EditEngine;
83 ////////////////////////////////////////////////////////////
85 class SmPrinterAccess
87 Printer* pPrinter;
88 OutputDevice* pRefDev;
89 public:
90 SmPrinterAccess( SmDocShell &rDocShell );
91 ~SmPrinterAccess();
92 Printer* GetPrinter() { return pPrinter; }
93 OutputDevice* GetRefDev() { return pRefDev; }
97 ////////////////////////////////////////////////////////////
99 void SetEditEngineDefaultFonts(
100 EditEngine &rEditEngine,
101 SfxItemPool &rEditEngineItemPool );
103 ////////////////////////////////////////////////////////////
105 class SmDocShell : public SfxObjectShell, public SfxListener
107 friend class SmPrinterAccess;
108 friend class SmModel;
110 String aText;
111 SmFormat aFormat;
112 SmParser aInterpreter;
113 String aAccText;
114 SmNode *pTree;
115 SfxMenuBarManager *pMenuMgr;
116 SfxItemPool *pEditEngineItemPool;
117 EditEngine *pEditEngine;
118 SfxPrinter *pPrinter; //Siehe Kommentar zum SmPrinter Access!
119 Printer *pTmpPrinter; //ebenfalls
120 long nLeftBorder,
121 nRightBorder,
122 nTopBorder,
123 nBottomBorder;
124 USHORT nModifyCount;
125 BOOL bIsFormulaArranged;
129 virtual void SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType,
130 const SfxHint& rHint, const TypeId& rHintType);
132 BOOL WriteAsMathType3( SfxMedium& );
134 virtual void Draw(OutputDevice *pDevice,
135 const JobSetup & rSetup,
136 USHORT nAspect = ASPECT_CONTENT);
138 virtual void FillClass(SvGlobalName* pClassName,
139 sal_uInt32* pFormat,
140 String* pAppName,
141 String* pFullTypeName,
142 String* pShortTypeName,
143 sal_Int32 nFileFormat,
144 sal_Bool bTemplate = sal_False ) const;
146 virtual BOOL SetData( const String& rData );
147 virtual ULONG GetMiscStatus() const;
148 virtual void OnDocumentPrinterChanged( Printer * );
149 virtual sal_Bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
150 virtual BOOL Load( SfxMedium& rMedium );
151 void ImplSave( SvStorageStreamRef xStrm );
152 virtual BOOL Save();
153 virtual BOOL SaveAs( SfxMedium& rMedium );
154 virtual BOOL ConvertTo( SfxMedium &rMedium );
155 virtual BOOL SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
157 Printer *GetPrt();
158 OutputDevice* GetRefDev();
160 BOOL IsFormulaArranged() const { return bIsFormulaArranged; }
161 void SetFormulaArranged(BOOL bVal) { bIsFormulaArranged = bVal; }
163 virtual BOOL ConvertFrom(SfxMedium &rMedium);
165 public:
166 TYPEINFO();
167 SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+1)
168 using SotObject::GetInterface;
169 SFX_DECL_OBJECTFACTORY();
171 SmDocShell( const sal_uInt64 i_nSfxCreationFlags );
172 virtual ~SmDocShell();
174 void LoadSymbols();
175 void SaveSymbols();
177 void ArrangeFormula();
179 //Zugriff fuer die View. Diese Zugriffe sind nur fuer den nicht OLE-Fall!
180 //und fuer die Kommunikation mit dem SFX!
181 //Alle internen Verwendungen des Printers sollten ausschlieslich uber
182 //den SmPrinterAccess funktionieren.
183 BOOL HasPrinter() { return 0 != pPrinter; }
184 SfxPrinter *GetPrinter() { GetPrt(); return pPrinter; }
185 void SetPrinter( SfxPrinter * );
187 const String GetComment() const;
189 // to replace chars that can not be saved with the document...
190 sal_Bool ReplaceBadChars();
192 void UpdateText();
193 void SetText(const String& rBuffer);
194 String& GetText() { return (aText); }
195 void SetFormat(SmFormat& rFormat);
196 const SmFormat& GetFormat() { return (aFormat); }
198 void Parse();
199 SmParser & GetParser() { return aInterpreter; }
200 const SmNode * GetFormulaTree() const { return pTree; }
201 void SetFormulaTree(SmNode *&rTree) { pTree = rTree; }
203 String GetAccessibleText();
205 EditEngine & GetEditEngine();
206 SfxItemPool & GetEditEngineItemPool();
208 void Draw(OutputDevice &rDev, Point &rPosition);
209 Size GetSize();
211 void Repaint();
213 virtual SfxUndoManager *GetUndoManager ();
215 virtual SfxItemPool& GetPool() const;
217 void Execute( SfxRequest& rReq );
218 void GetState(SfxItemSet &);
220 virtual void SetVisArea (const Rectangle & rVisArea);
221 virtual void SetModified(BOOL bModified);
225 #endif