00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef DOCUMENT_HXX
00036 #define DOCUMENT_HXX
00037
00038 #define SMDLL 1
00039
00040 #ifndef _SOT_STORAGE_HXX
00041 #include <sot/storage.hxx>
00042 #endif
00043 #ifndef _SOT_SOTREF_HXX //autogen
00044 #include <sot/sotref.hxx>
00045 #endif
00046 #ifndef _SFX_OBJSH_HXX //autogen
00047 #include <sfx2/objsh.hxx>
00048 #endif
00049 #ifndef _SFXLSTNER_HXX //autogen
00050 #include <svtools/lstner.hxx>
00051 #endif
00052 #ifndef _SFX_OBJFAC_HXX //autogen
00053 #include <sfx2/docfac.hxx>
00054 #endif
00055 #ifndef _SV_VIRDEV_HXX //autogen
00056 #include <vcl/virdev.hxx>
00057 #endif
00058
00059 #ifndef _FORMAT_HXX
00060 #include "format.hxx"
00061 #endif
00062 #ifndef PARSE_HXX
00063 #include "parse.hxx"
00064 #endif
00065 #ifndef SMMOD_HXX
00066 #include "smmod.hxx"
00067 #endif
00068
00069 #include <vcl/jobset.hxx>
00070
00071 class SmNode;
00072 class SfxMenuBarManager;
00073 class SfxPrinter;
00074 class Printer;
00075
00076 #define HINT_DATACHANGED 1004
00077
00078 #define SM30BIDENT ((ULONG)0x534D3033L)
00079 #define SM30IDENT ((ULONG)0x30334d53L)
00080 #define SM304AIDENT ((ULONG)0x34303330L)
00081 #define SM30VERSION ((ULONG)0x00010000L)
00082 #define SM50VERSION ((ULONG)0x00010001L) //Unterschied zur SM30VERSION ist
00083
00084
00085 #define FRMIDENT ((ULONG)0x03031963L)
00086 #define FRMVERSION ((ULONG)0x00010001L)
00087
00088 #define STAROFFICE_XML "StarOffice XML (Math)"
00089 #define MATHML_XML "MathML XML (Math)"
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106 class SmDocShell;
00107 class EditEngine;
00108
00109 class SmPrinterAccess
00110 {
00111 Printer* pPrinter;
00112 OutputDevice* pRefDev;
00113 public:
00114 SmPrinterAccess( SmDocShell &rDocShell );
00115 ~SmPrinterAccess();
00116 Printer* GetPrinter() { return pPrinter; }
00117 OutputDevice* GetRefDev() { return pRefDev; }
00118 };
00119
00120
00122
00123 void SetEditEngineDefaultFonts(
00124 EditEngine &rEditEngine,
00125 SfxItemPool &rEditEngineItemPool );
00126
00128
00129 class SmDocShell : public SfxObjectShell, public SfxListener
00130 {
00131 friend class SmPrinterAccess;
00132 friend class SmModel;
00133
00134 String aText;
00135 SmFormat aFormat;
00136 SmParser aInterpreter;
00137 String aAccText;
00138 SmNode *pTree;
00139 SfxMenuBarManager *pMenuMgr;
00140 SfxItemPool *pEditEngineItemPool;
00141 EditEngine *pEditEngine;
00142 SfxPrinter *pPrinter;
00143 Printer *pTmpPrinter;
00144 long nLeftBorder,
00145 nRightBorder,
00146 nTopBorder,
00147 nBottomBorder;
00148 USHORT nModifyCount;
00149 BOOL bIsFormulaArranged;
00150
00151
00152
00153 virtual void SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType,
00154 const SfxHint& rHint, const TypeId& rHintType);
00155
00156 BOOL WriteAsMathType3( SfxMedium& );
00157
00158 virtual void Draw(OutputDevice *pDevice,
00159 const JobSetup & rSetup,
00160 USHORT nAspect = ASPECT_CONTENT);
00161
00162 virtual void FillClass(SvGlobalName* pClassName,
00163 sal_uInt32* pFormat,
00164 String* pAppName,
00165 String* pFullTypeName,
00166 String* pShortTypeName,
00167 sal_Int32 nFileFormat ) const;
00168
00169 virtual BOOL SetData( const String& rData );
00170 virtual ULONG GetMiscStatus() const;
00171 virtual void OnDocumentPrinterChanged( Printer * );
00172 virtual sal_Bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
00173 virtual BOOL Load( SfxMedium& rMedium );
00174 void ImplSave( SvStorageStreamRef xStrm );
00175 virtual BOOL Save();
00176 virtual BOOL SaveAs( SfxMedium& rMedium );
00177 virtual BOOL ConvertTo( SfxMedium &rMedium );
00178 virtual BOOL SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
00179
00180 Printer *GetPrt();
00181 OutputDevice* GetRefDev();
00182
00183 BOOL IsFormulaArranged() const { return bIsFormulaArranged; }
00184 void SetFormulaArranged(BOOL bVal) { bIsFormulaArranged = bVal; }
00185
00186 virtual BOOL ConvertFrom(SfxMedium &rMedium);
00187
00188 public:
00189 TYPEINFO();
00190 SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+1)
00191 using SotObject::GetInterface;
00192 SFX_DECL_OBJECTFACTORY();
00193
00194 SmDocShell(SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED);
00195 virtual ~SmDocShell();
00196
00197 void LoadSymbols();
00198 void SaveSymbols();
00199
00200 void ArrangeFormula();
00201
00202
00203
00204
00205
00206 BOOL HasPrinter() { return 0 != pPrinter; }
00207 SfxPrinter *GetPrinter() { GetPrt(); return pPrinter; }
00208 void SetPrinter( SfxPrinter * );
00209
00210 const String &GetComment() const;
00211
00212
00213 sal_Bool ReplaceBadChars();
00214
00215 void UpdateText();
00216 void SetText(const String& rBuffer);
00217 String& GetText() { return (aText); }
00218 void SetFormat(SmFormat& rFormat);
00219 const SmFormat& GetFormat() { return (aFormat); }
00220
00221 void Parse();
00222 SmParser & GetParser() { return aInterpreter; }
00223 const SmNode * GetFormulaTree() const { return pTree; }
00224 void SetFormulaTree(SmNode *&rTree) { pTree = rTree; }
00225
00226 String GetAccessibleText();
00227
00228 EditEngine & GetEditEngine();
00229 SfxItemPool & GetEditEngineItemPool();
00230
00231 void Draw(OutputDevice &rDev, Point &rPosition);
00232 Size GetSize();
00233
00234 void Repaint();
00235
00236 virtual SfxUndoManager *GetUndoManager ();
00237
00238 virtual SfxItemPool& GetPool() const;
00239
00240 void Execute( SfxRequest& rReq );
00241 void GetState(SfxItemSet &);
00242
00243 virtual void SetVisArea (const Rectangle & rVisArea);
00244 virtual void SetModified(BOOL bModified);
00245 };
00246
00247
00248 #endif
00249