diff options
Diffstat (limited to 'inc/bf_starmath')
-rw-r--r-- | inc/bf_starmath/command.hxx | 54 | ||||
-rw-r--r-- | inc/bf_starmath/config.hxx | 55 | ||||
-rw-r--r-- | inc/bf_starmath/document.hxx | 201 | ||||
-rw-r--r-- | inc/bf_starmath/dynary.hxx | 96 | ||||
-rw-r--r-- | inc/bf_starmath/format.hxx | 171 | ||||
-rw-r--r-- | inc/bf_starmath/node.hxx | 808 | ||||
-rw-r--r-- | inc/bf_starmath/parse.hxx | 263 | ||||
-rw-r--r-- | inc/bf_starmath/rect.hxx | 259 | ||||
-rw-r--r-- | inc/bf_starmath/smdll.hxx | 65 | ||||
-rw-r--r-- | inc/bf_starmath/smdll0.hxx | 73 | ||||
-rw-r--r-- | inc/bf_starmath/smmod.hxx | 165 | ||||
-rw-r--r-- | inc/bf_starmath/starmath.hrc | 519 | ||||
-rw-r--r-- | inc/bf_starmath/symbol.hxx | 196 | ||||
-rw-r--r-- | inc/bf_starmath/types.hxx | 184 | ||||
-rw-r--r-- | inc/bf_starmath/unomodel.hxx | 89 | ||||
-rw-r--r-- | inc/bf_starmath/utility.hxx | 277 |
16 files changed, 3475 insertions, 0 deletions
diff --git a/inc/bf_starmath/command.hxx b/inc/bf_starmath/command.hxx new file mode 100644 index 000000000..706644bb5 --- /dev/null +++ b/inc/bf_starmath/command.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef MATH_COMMAND_HXX +#define MATH_COMMAND_HXX + + + +#include <vcl/bitmap.hxx> +class String; +namespace binfilter { + + + +class SmCommandDesc: public Resource +{ +protected: + String *pSample; + String *pCommand; + String *pText; + String *pHelp; + Bitmap *pGraphic; + +public: + SmCommandDesc(const ResId& rResId); + ~SmCommandDesc(); + + const String &GetSample() const { return (*pSample); } + const String &GetCommand() const { return (*pCommand); } + const String &GetText() const { return (*pText); } + const String &GetHelp() const { return (*pHelp); } + const Bitmap &GetGraphic() const { return (*pGraphic); } +}; + + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/inc/bf_starmath/config.hxx b/inc/bf_starmath/config.hxx new file mode 100644 index 000000000..e7e519c93 --- /dev/null +++ b/inc/bf_starmath/config.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef CONFIG_HXX +#define CONFIG_HXX + +#include <bf_svtools/brdcst.hxx> +#include <bf_svtools/lstner.hxx> +#include <bf_sfx2/cfgitem.hxx> + +#include "format.hxx" + +#include "cfgitem.hxx" +namespace binfilter { + +class SfxItemSet; + +class SmPreferenceDialog; +class SmPrintDialog; +class SmPrintOptionDialog; + + +class SmConfig : public SmMathConfig, public SfxBroadcaster +{ + SmFontPickList vFontPickList[7]; + +public: + SmConfig(); + virtual ~SmConfig(); + + SmFontPickList & GetFontPickList(USHORT nIdent) { return vFontPickList[nIdent]; } + + void ConfigToItemSet(SfxItemSet &rSet) const; +}; + +} //namespace binfilter +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/inc/bf_starmath/document.hxx b/inc/bf_starmath/document.hxx new file mode 100644 index 000000000..a3b2e6b67 --- /dev/null +++ b/inc/bf_starmath/document.hxx @@ -0,0 +1,201 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef DOCUMENT_HXX +#define DOCUMENT_HXX + +#include <bf_svtools/bf_solar.h> + +#define SMDLL 1 + +#include <bf_so3/svstor.hxx> +#include <sot/sotref.hxx> +#include <bf_sfx2/objsh.hxx> +#include <bf_sfx2/interno.hxx> +#include <bf_svtools/lstner.hxx> +#include <bf_sfx2/docfac.hxx> +#include <vcl/virdev.hxx> + +#include "format.hxx" +#include "parse.hxx" +#include "smmod.hxx" +class Printer; +namespace binfilter { + +class SmNode; +class SmSymSetManager; +class SfxPrinter; + + +#ifndef SO2_DECL_SVSTORAGESTREAM_DEFINED +#define SO2_DECL_SVSTORAGESTREAM_DEFINED +SO2_DECL_REF(SvStorageStream) +#endif + +#define HINT_DATACHANGED 1004 + +#define SM30BIDENT ((sal_uInt32)0x534D3033L) +#define SM30IDENT ((sal_uInt32)0x30334d53L) +#define SM304AIDENT ((sal_uInt32)0x34303330L) +#define SM30VERSION ((sal_uInt32)0x00010000L) +#define SM50VERSION ((sal_uInt32)0x00010001L) //Unterschied zur SM30VERSION ist + //der neue Border im Format. + +#define FRMIDENT ((sal_uInt32)0x03031963L) +#define FRMVERSION ((sal_uInt32)0x00010001L) + +#define STAROFFICE_XML "StarOffice XML (Math)" +#define MATHML_XML "MathML XML (Math)" + +/* Zugriff auf den Drucker sollte ausschliesslich ueber diese Klasse erfolgen + * ========================================================================== + * + * Der Drucker kann dem Dokument oder auch dem OLE-Container gehoeren. Wenn + * das Dokument also eine OLE-Dokument ist, so gehoert der Drucker auch + * grundsaetzlich dem Container. Der Container arbeitet aber eventuell mit + * einer anderen MapUnit als der Server. Der Drucker wird bezueglich des MapMode + * im Konstruktor entsprechend eingestellt und im Destruktor wieder restauriert. + * Das bedingt natuerlich, das diese Klasse immer nur kurze Zeit existieren darf + * (etwa waehrend des Paints). + * Die Kontrolle darueber ob der Drucker selbst angelegt, vom Server besorgt + * oder dann auch NULL ist, uebernimmt die DocShell in der Methode GetPrt(), + * fuer die der Access auch Friend der DocShell ist. +*/ + +class SmDocShell; +class EditEngine; +class EditEngineItemPool; + +class SmPrinterAccess +{ + Printer* pPrinter; + OutputDevice* pRefDev; +public: + SmPrinterAccess( SmDocShell &rDocShell ); + ~SmPrinterAccess(); + Printer* GetPrinter() { return pPrinter; } + OutputDevice* GetRefDev() { return pRefDev; } +}; + + +//////////////////////////////////////////////////////////// + +class SmDocShell : public SfxObjectShell, public SfxInPlaceObject, + public SfxListener +{ + friend class SmPrinterAccess; + + String aText; + SmFormat aFormat; + SmParser aInterpreter; + SvStorageStreamRef aDocStream; + String aAccText; + SmSymSetManager *pSymSetMgr; + SmNode *pTree; + SfxMenuBarManager *pMenuMgr; + SfxItemPool *pEditEngineItemPool; + EditEngine *pEditEngine; + SfxPrinter *pPrinter; //Siehe Kommentar zum SmPrinter Access! + Printer *pTmpPrinter; //ebenfalls + long nLeftBorder, + nRightBorder, + nTopBorder, + nBottomBorder; + USHORT nModifyCount; + BOOL bIsFormulaArranged; + + + + + + BOOL Try3x( SvStorage *pStor, StreamMode eMode); + BOOL Try2x( SvStorage *pStor, StreamMode eMode); + + + virtual void FillClass(SvGlobalName* pClassName, + ULONG* pFormat, + String* pAppName, + String* pFullTypeName, + String* pShortTypeName, + long nFileFormat = SOFFICE_FILEFORMAT_CURRENT) const; + + virtual ULONG GetMiscStatus() const; + virtual void OnDocumentPrinterChanged( Printer * ); + virtual BOOL InitNew(SvStorage *); + virtual BOOL Load(SvStorage *); + virtual BOOL Save() {return false;} + virtual void HandsOff(); + + Printer *GetPrt(); + OutputDevice* GetRefDev(); + + // used to convert the formula text between different office versions + void ConvertText( String &rText, SmConvert eConv ); + + BOOL IsFormulaArranged() const { return bIsFormulaArranged; } + void SetFormulaArranged(BOOL bVal) { bIsFormulaArranged = bVal; } + void ArrangeFormula(); + +public: + TYPEINFO(); + SFX_DECL_OBJECTFACTORY_DLL(SmDocShell, SM_MOD()); + + SmDocShell(SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED); + virtual ~SmDocShell(); + + + //Zugriff fuer die View. Diese Zugriffe sind nur fuer den nicht OLE-Fall! + //und fuer die Kommunikation mit dem SFX! + //Alle internen Verwendungen des Printers sollten ausschlieslich uber + //den SmPrinterAccess funktionieren. + BOOL HasPrinter() { return 0 != pPrinter; } + SfxPrinter *GetPrinter() { GetPrt(); return pPrinter; } + + void SetText(const String& rBuffer); + String& GetText() { return (aText); } + SmFormat& GetFormat() { return (aFormat); } + + void Parse(); + SmParser & GetParser() { return aInterpreter; } + const SmNode * GetFormulaTree() const { return pTree; } + void SetFormulaTree(SmNode *&rTree) { pTree = rTree; } + + + SmSymSetManager & GetSymSetManager(); + const SmSymSetManager & GetSymSetManager() const + { + return ((SmDocShell *) this)->GetSymSetManager(); + } + + Size GetSize(); + + void Resize(); + + + virtual SfxItemPool& GetPool(); + + virtual void SetVisArea (const Rectangle & rVisArea); + + virtual void SetModified(BOOL bModified); +}; + + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/inc/bf_starmath/dynary.hxx b/inc/bf_starmath/dynary.hxx new file mode 100644 index 000000000..5e6e60b3c --- /dev/null +++ b/inc/bf_starmath/dynary.hxx @@ -0,0 +1,96 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _DYNARY_HXX +#define _DYNARY_HXX + +#include <tools/solar.h> +#include <bf_tools/contnr.hxx> + +// ------------ +// - DynArray - +// ------------ + +#define DYNARRAY_ENTRY_NOTFOUND CONTAINER_ENTRY_NOTFOUND + +class DynArray : private binfilter::Container +{ +public: + using Container::SetSize; + using Container::GetSize; + using Container::Clear; + + DynArray( sal_uIntPtr nSize = 16 ) : Container( nSize ) {} + DynArray( const DynArray& rAry ) : Container( rAry ) {} + + void* Put( sal_uIntPtr nIndex, void* p ) + { return Container::Replace( p, nIndex ); } + void* Get( sal_uIntPtr nIndex ) const + { return Container::GetObject( nIndex ); } + + sal_uIntPtr GetIndex( const void* p ) const + { return Container::GetPos( p ); } + + DynArray& operator =( const DynArray& rAry ) + { Container::operator =( rAry ); return *this; } + + sal_Bool operator ==( const DynArray& rAry ) const + { return Container::operator ==( rAry ); } + sal_Bool operator !=( const DynArray& rAry ) const + { return Container::operator !=( rAry ); } +}; + +// -------------------- +// - DECLARE_DYNARRAY - +// -------------------- + +#define DECLARE_DYNARRAY( ClassName, Type ) \ +class ClassName : private DynArray \ +{ \ +public: \ + using DynArray::SetSize; \ + using DynArray::GetSize; \ + using DynArray::Clear; \ + \ + ClassName( sal_uIntPtr nSize = 16 ) : \ + DynArray( nSize ) {} \ + ClassName( const ClassName& rClassName ) : \ + DynArray( rClassName ) {} \ + \ + Type Put( sal_uIntPtr nIndex, Type p ) \ + { return (Type)DynArray::Put( nIndex, (void*)p ); } \ + Type Get( sal_uIntPtr nIndex ) const \ + { return (Type)DynArray::Get( nIndex ); } \ + \ + sal_uIntPtr GetIndex( const Type p ) const \ + { return DynArray::GetIndex( (const void*)p ); } \ + \ + ClassName& operator =( const ClassName& rClassName ) \ + { DynArray::operator =( rClassName ); \ + return *this; } \ + \ + sal_Bool operator ==( const ClassName& rAry ) const \ + { return DynArray::operator ==( rAry ); } \ + sal_Bool operator !=( const ClassName& rAry ) const \ + { return DynArray::operator !=( rAry ); } \ +}; + +#endif // _DYNARY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/inc/bf_starmath/format.hxx b/inc/bf_starmath/format.hxx new file mode 100644 index 000000000..6813d62e2 --- /dev/null +++ b/inc/bf_starmath/format.hxx @@ -0,0 +1,171 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef FORMAT_HXX +#define FORMAT_HXX + +#include <bf_svtools/bf_solar.h> + + +#include <bf_svtools/smplhint.hxx> +#include <bf_svtools/brdcst.hxx> + +#include "utility.hxx" +#include <types.hxx> +namespace binfilter { + + +#define SM_FMT_VERSION_51 ((BYTE) 0x01) +#define SM_FMT_VERSION_NOW SM_FMT_VERSION_51 + +#define FNTNAME_TIMES "Times" +#define FNTNAME_HELV "Helvetica" +#define FNTNAME_COUR "Courier" +#define FNTNAME_MATH FONTNAME_MATH + + +// symbolic names used as array indices +#define SIZ_BEGIN 0 +#define SIZ_TEXT 0 +#define SIZ_INDEX 1 +#define SIZ_FUNCTION 2 +#define SIZ_OPERATOR 3 +#define SIZ_LIMITS 4 +#define SIZ_END 4 + +// symbolic names used as array indices +#define FNT_BEGIN 0 +#define FNT_VARIABLE 0 +#define FNT_FUNCTION 1 +#define FNT_NUMBER 2 +#define FNT_TEXT 3 +#define FNT_SERIF 4 +#define FNT_SANS 5 +#define FNT_FIXED 6 +#define FNT_MATH 7 +#define FNT_END 7 + +// symbolic names used as array indices +#define DIS_BEGIN 0 +#define DIS_HORIZONTAL 0 +#define DIS_VERTICAL 1 +#define DIS_ROOT 2 +#define DIS_SUPERSCRIPT 3 +#define DIS_SUBSCRIPT 4 +#define DIS_NUMERATOR 5 +#define DIS_DENOMINATOR 6 +#define DIS_FRACTION 7 +#define DIS_STROKEWIDTH 8 +#define DIS_UPPERLIMIT 9 +#define DIS_LOWERLIMIT 10 +#define DIS_BRACKETSIZE 11 +#define DIS_BRACKETSPACE 12 +#define DIS_MATRIXROW 13 +#define DIS_MATRIXCOL 14 +#define DIS_ORNAMENTSIZE 15 +#define DIS_ORNAMENTSPACE 16 +#define DIS_OPERATORSIZE 17 +#define DIS_OPERATORSPACE 18 +#define DIS_LEFTSPACE 19 +#define DIS_RIGHTSPACE 20 +#define DIS_TOPSPACE 21 +#define DIS_BOTTOMSPACE 22 +#define DIS_NORMALBRACKETSIZE 23 +#define DIS_END 23 + + +// to be broadcastet on format changes: +#define HINT_FORMATCHANGED 10003 + +enum SmHorAlign { AlignLeft, AlignCenter, AlignRight }; + +String GetDefaultFontName( LanguageType nLang, USHORT nIdent ); + +class SmFormat : public SfxBroadcaster +{ + SmFace vFont[FNT_END + 1]; + BOOL bDefaultFont[FNT_END + 1]; + Size aBaseSize; + long nVersion; + USHORT vSize[SIZ_END + 1]; + USHORT vDist[DIS_END + 1]; + SmHorAlign eHorAlign; + BOOL bIsTextmode, + bScaleNormalBrackets; + +public: + SmFormat(); + SmFormat(const SmFormat &rFormat) : SfxBroadcaster() { *this = rFormat; } + + const Size & GetBaseSize() const { return aBaseSize; } + void SetBaseSize(const Size &rSize) { aBaseSize = rSize; } + + const SmFace & GetFont(USHORT nIdent) const { return vFont[nIdent]; } + void SetFont(USHORT nIdent, const SmFace &rFont, BOOL bDefault = FALSE); + void SetFontSize(USHORT nIdent, const Size &rSize) { vFont[nIdent].SetSize( rSize ); } + + void SetDefaultFont(USHORT nIdent, BOOL bVal) { bDefaultFont[nIdent] = bVal; } + BOOL IsDefaultFont(USHORT nIdent) const { return bDefaultFont[nIdent]; } + + USHORT GetRelSize(USHORT nIdent) const { return vSize[nIdent]; } + void SetRelSize(USHORT nIdent, USHORT nVal) { vSize[nIdent] = nVal;} + + USHORT GetDistance(USHORT nIdent) const { return vDist[nIdent]; } + void SetDistance(USHORT nIdent, USHORT nVal) { vDist[nIdent] = nVal; } + + SmHorAlign GetHorAlign() const { return eHorAlign; } + void SetHorAlign(SmHorAlign eAlign) { eHorAlign = eAlign; } + + BOOL IsTextmode() const { return bIsTextmode; } + void SetTextmode(BOOL bVal) { bIsTextmode = bVal; } + + BOOL IsScaleNormalBrackets() const { return bScaleNormalBrackets; } + void SetScaleNormalBrackets(BOOL bVal) { bScaleNormalBrackets = bVal; } + + long GetVersion() const { return nVersion; } + + //! at time (5.1) use only the lower byte!!! + void SetVersion(long nVer) { nVersion = nVer; } + + SmFormat & operator = (const SmFormat &rFormat); + + BOOL operator == (const SmFormat &rFormat) const; + inline BOOL operator != (const SmFormat &rFormat) const; + + void RequestApplyChanges() const + { + ((SmFormat *) this)->Broadcast(SfxSimpleHint(HINT_FORMATCHANGED)); + } + + // functions for compatibility with older versions + void ReadSM20Format(SvStream &rStream); + void From300To304a(); + + friend SvStream & operator << (SvStream &rStream, const SmFormat &rFormat); + friend SvStream & operator >> (SvStream &rStream, SmFormat &rFormat); +}; + +inline BOOL SmFormat::operator != (const SmFormat &rFormat) const +{ + return !(*this == rFormat); +} + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/inc/bf_starmath/node.hxx b/inc/bf_starmath/node.hxx new file mode 100644 index 000000000..9114dcee5 --- /dev/null +++ b/inc/bf_starmath/node.hxx @@ -0,0 +1,808 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + + +#ifndef NODE_HXX +#define NODE_HXX + +#include <bf_svtools/bf_solar.h> + + +#include <dynary.hxx> +#include "parse.hxx" +#include "types.hxx" +#include "rect.hxx" +#include "format.hxx" +namespace binfilter { + + +#define ATTR_BOLD 0x0001 +#define ATTR_ITALIC 0x0002 + +#define FNTSIZ_ABSOLUT 1 +#define FNTSIZ_PLUS 2 +#define FNTSIZ_MINUS 3 +#define FNTSIZ_MULTIPLY 4 +#define FNTSIZ_DIVIDE 5 + +// flags to interdict respective status changes +#define FLG_FONT 0x0001 +#define FLG_SIZE 0x0002 +#define FLG_BOLD 0x0004 +#define FLG_ITALIC 0x0008 +#define FLG_COLOR 0x0010 +#define FLG_VISIBLE 0x0020 +#define FLG_HORALIGN 0x0040 + + +extern SmFormat *pActiveFormat; + +class SmDocShell; + +class SmNode; +DECLARE_DYNARRAY(SmNodeArray, SmNode *) + +//////////////////////////////////////////////////////////////////////////////// + +enum SmScaleMode { SCALE_NONE, SCALE_WIDTH, SCALE_HEIGHT }; + +enum SmNodeType +{ + NTABLE, NBRACE, NBRACEBODY, NOPER, NALIGN, + NATTRIBUT, NFONT, NUNHOR, NBINHOR, NBINVER, + NBINDIAGONAL, NSUBSUP, NMATRIX, NPLACE, NTEXT, + NSPECIAL, NGLYPH_SPECIAL, NMATH, NBLANK, NERROR, + NLINE, NEXPRESSION, NPOLYLINE, NROOT, NROOTSYMBOL, + NRECTANGLE, NVERTICAL_BRACE +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmNode : public SmRect +{ + SmFace aFace; + + SmToken aNodeToken; + SmNodeType eType; + SmScaleMode eScaleMode; + RectHorAlign eRectHorAlign; + USHORT nFlags, + nAttributes; + BOOL bIsPhantom, + bIsDebug; +protected: + SmNode(SmNodeType eNodeType, const SmToken &rNodeToken); + + // index in accessible text -1 if not (yet) applicable + sal_Int32 nAccIndex; + +public: + virtual ~SmNode() {}; + + virtual BOOL IsVisible() const { return FALSE; } + + virtual USHORT GetNumSubNodes() const { return 0; } + virtual SmNode * GetSubNode(USHORT /*nIndex*/) { return NULL; } + + const SmNode * GetSubNode(USHORT nIndex) const + { + return ((SmNode *) this)->GetSubNode(nIndex); + } + + virtual SmNode * GetLeftMost(); + + const SmNode * GetLeftMost() const + { + return ((SmNode *) this)->GetLeftMost(); + } + + USHORT & Flags() { return nFlags; } + USHORT & Attributes() { return nAttributes; } + + BOOL IsDebug() const { return bIsDebug; } + BOOL IsPhantom() const { return bIsPhantom; } + void SetPhantom(BOOL bIsPhantom); + void SetColor(const Color &rColor); + + void SetAttribut(USHORT nAttrib); + void ClearAttribut(USHORT nAttrib); + + const SmFace & GetFont() const { return aFace; }; + SmFace & GetFont() { return aFace; }; + + void SetFont(const SmFace &rFace); + void SetFontSize(const Fraction &rRelSize, USHORT nType); + void SetSize(const Fraction &rScale); + + virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); + virtual void PrepareAttributes(); + + + void SetRectHorAlign(RectHorAlign eHorAlign, BOOL bApplyToSubTree = TRUE ); + RectHorAlign GetRectHorAlign() const { return eRectHorAlign; } + + const SmRect & GetRect() const { return *this; } + SmRect & GetRect() { return *this; } + + virtual void Move(const Point &rPosition); + void MoveTo(const Point &rPosition) { Move(rPosition - GetTopLeft()); } + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); + virtual void CreateTextFromNode(String /* &rText */) {}; + + virtual void Draw(OutputDevice &rDev, const Point &rPosition) const; + + + USHORT GetRow() const { return (USHORT)aNodeToken.nRow; } + USHORT GetColumn() const { return (USHORT)aNodeToken.nCol; } + + SmScaleMode GetScaleMode() const { return eScaleMode; } + void SetScaleMode(SmScaleMode eMode) { eScaleMode = eMode; } + + virtual void AdaptToX(const OutputDevice& /* rDev */, ULONG /* nWidth */) {} + virtual void AdaptToY(const OutputDevice& /* rDev */, ULONG /* nHeight */) {} + + SmNodeType GetType() const { return eType; } + const SmToken & GetToken() const { return aNodeToken; } + + const SmNode * FindTokenAt(USHORT nRow, USHORT nCol) const; +}; + + +//////////////////////////////////////////////////////////////////////////////// + +class SmStructureNode; + +DECLARE_DYNARRAY(SmStructureNodeArray, SmStructureNode *) + +class SmStructureNode : public SmNode +{ + SmNodeArray aSubNodes; + +protected: + SmStructureNode(SmNodeType eNodeType, const SmToken &rNodeToken) + : SmNode(eNodeType, rNodeToken) + {} + +public: + SmStructureNode( const SmStructureNode &rNode ); + virtual ~SmStructureNode(); + + virtual BOOL IsVisible() const { return FALSE; } + + virtual USHORT GetNumSubNodes() const; + void SetNumSubNodes(USHORT nSize) { aSubNodes.SetSize(nSize); } + + virtual SmNode * GetSubNode(USHORT nIndex); + void SetSubNodes(SmNode *pFirst, SmNode *pSecond, + SmNode *pThird = NULL); + void SetSubNodes(const SmNodeArray &rNodeArray); + + SmStructureNode & operator = ( const SmStructureNode &rNode ); + +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmVisibleNode : public SmNode +{ +protected: + SmVisibleNode(SmNodeType eNodeType, const SmToken &rNodeToken) + : SmNode(eNodeType, rNodeToken) + {} + +public: + + virtual BOOL IsVisible() const { return FALSE; } + virtual USHORT GetNumSubNodes() const { return 0; } + virtual SmNode * GetSubNode(USHORT /* nIndex */) { return NULL; } +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmGraphicNode : public SmVisibleNode +{ +protected: + SmGraphicNode(SmNodeType eNodeType, const SmToken &rNodeToken) + : SmVisibleNode(eNodeType, rNodeToken) + {} + +public: + +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmRectangleNode : public SmGraphicNode +{ + Size aToSize; + +public: + SmRectangleNode(const SmToken &rNodeToken) + : SmGraphicNode(NRECTANGLE, rNodeToken) + {} + + virtual void AdaptToX(const OutputDevice &rDev, ULONG nWidth); + virtual void AdaptToY(const OutputDevice &rDev, ULONG nHeight); + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); + virtual void Draw(OutputDevice &rDev, const Point &rPosition) const; +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmPolyLineNode : public SmGraphicNode +{ + Polygon aPoly; + Size aToSize; + long nWidth; + +public: + SmPolyLineNode(const SmToken &rNodeToken); + + long GetWidth() const { return nWidth; } + + virtual void AdaptToX(const OutputDevice &rDev, ULONG nWidth); + virtual void AdaptToY(const OutputDevice &rDev, ULONG nHeight); + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); + virtual void Draw(OutputDevice &rDev, const Point &rPosition) const; +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmTextNode : public SmVisibleNode +{ + XubString aText; + USHORT nFontDesc; + +protected: + SmTextNode(SmNodeType eNodeType, const SmToken &rNodeToken, USHORT nFontDescP) + : SmVisibleNode(eNodeType, rNodeToken) + { + nFontDesc = nFontDescP; + } + +public: + SmTextNode(const SmToken &rNodeToken, USHORT nFontDescP) + : SmVisibleNode(NTEXT, rNodeToken) + { + nFontDesc = nFontDescP; + } + + + USHORT GetFontDesc() const { return nFontDesc; } + void SetText(const XubString &rText) { aText = rText; } + const XubString & GetText() const { return aText; } + + virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); + + virtual void Draw(OutputDevice &rDev, const Point &rPosition) const; + +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmSpecialNode : public SmTextNode +{ +protected: + SmSpecialNode(SmNodeType eNodeType, const SmToken &rNodeToken, USHORT nFontDescIn) + : SmTextNode(eNodeType, rNodeToken, nFontDescIn) + {} + +public: + SmSpecialNode(const SmToken &rNodeToken) + : SmTextNode(NSPECIAL, rNodeToken, FNT_MATH) //! default Font nicht immer richtig + {} + + virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); + virtual void Draw(OutputDevice &rDev, const Point &rPosition) const; +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmGlyphSpecialNode : public SmSpecialNode +{ +public: + SmGlyphSpecialNode(const SmToken &rNodeToken) + : SmSpecialNode(NGLYPH_SPECIAL, rNodeToken, FNT_MATH) + {} + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmMathSymbolNode : public SmSpecialNode +{ +protected: + SmMathSymbolNode(SmNodeType eNodeType, const SmToken &rNodeToken) + : SmSpecialNode(eNodeType, rNodeToken, FNT_MATH) + { + xub_Unicode cChar = GetToken().cMathChar; + if ((xub_Unicode) '\0' != cChar) + SetText( cChar ); + } + +public: + SmMathSymbolNode(const SmToken &rNodeToken); + + virtual void AdaptToX(const OutputDevice &rDev, ULONG nWidth); + virtual void AdaptToY(const OutputDevice &rDev, ULONG nHeight); + + virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmRootSymbolNode : public SmMathSymbolNode +{ + ULONG nBodyWidth; // width of body (argument) of root sign + +public: + SmRootSymbolNode(const SmToken &rNodeToken) + : SmMathSymbolNode(NROOTSYMBOL, rNodeToken) + {} + + virtual void AdaptToX(const OutputDevice &rDev, ULONG nWidth); + virtual void AdaptToY(const OutputDevice &rDev, ULONG nHeight); + + virtual void Draw(OutputDevice &rDev, const Point &rPosition) const; +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmPlaceNode : public SmMathSymbolNode +{ +public: + SmPlaceNode(const SmToken &rNodeToken) + : SmMathSymbolNode(NPLACE, rNodeToken) + { + SetText((xub_Unicode) MS_PLACE); + } + + virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmErrorNode : public SmMathSymbolNode +{ +public: + SmErrorNode(SmParseError /*eError*/, const SmToken &rNodeToken) + : SmMathSymbolNode(NERROR, rNodeToken) + { + SetText((xub_Unicode) MS_ERROR); + } + + virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmTableNode : public SmStructureNode +{ +public: + SmTableNode(const SmToken &rNodeToken) + : SmStructureNode(NTABLE, rNodeToken) + {} + + virtual SmNode * GetLeftMost(); + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmLineNode : public SmStructureNode +{ +protected: + SmLineNode(SmNodeType eNodeType, const SmToken &rNodeToken) + : SmStructureNode(eNodeType, rNodeToken) + {} + +public: + SmLineNode(const SmToken &rNodeToken) + : SmStructureNode(NLINE, rNodeToken) + {} + + virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmExpressionNode : public SmLineNode +{ +public: + SmExpressionNode(const SmToken &rNodeToken) + : SmLineNode(NEXPRESSION, rNodeToken) + {} + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmUnHorNode : public SmStructureNode +{ +public: + SmUnHorNode(const SmToken &rNodeToken) + : SmStructureNode(NUNHOR, rNodeToken) + { + SetNumSubNodes(2); + } + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmRootNode : public SmStructureNode +{ +protected: + void GetHeightVerOffset(const SmRect &rRect, + long &rHeight, long &rVerOffset) const; + Point GetExtraPos(const SmRect &rRootSymbol, const SmRect &rExtra) const; + +public: + SmRootNode(const SmToken &rNodeToken) + : SmStructureNode(NROOT, rNodeToken) + { + SetNumSubNodes(3); + } + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmBinHorNode : public SmStructureNode +{ +public: + SmBinHorNode(const SmToken &rNodeToken) + : SmStructureNode(NBINHOR, rNodeToken) + { + SetNumSubNodes(3); + } + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmBinVerNode : public SmStructureNode +{ +public: + SmBinVerNode(const SmToken &rNodeToken) + : SmStructureNode(NBINVER, rNodeToken) + { + SetNumSubNodes(3); + } + + virtual SmNode * GetLeftMost(); + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmBinDiagonalNode : public SmStructureNode +{ + BOOL bAscending; + + void GetOperPosSize(Point &rPos, Size &rSize, + const Point &rDiagPoint, double fAngleDeg) const; + +public: + SmBinDiagonalNode(const SmToken &rNodeToken); + + BOOL IsAscending() const { return bAscending; } + void SetAscending(BOOL bVal) { bAscending = bVal; } + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +// enums used to index sub-/supscripts in the 'aSubNodes' array +// in 'SmSubSupNode' +// See graphic for positions at char: +// +// CSUP +// +// LSUP H H RSUP +// H H +// HHHH +// H H +// LSUB H H RSUB +// +// CSUB +// +enum SmSubSup +{ CSUB, CSUP, RSUB, RSUP, LSUB, LSUP +}; + +// numbers of entries in the above enum (that is: the number of possible +// sub-/supscripts) +#define SUBSUP_NUM_ENTRIES 6 + + +class SmSubSupNode : public SmStructureNode +{ + BOOL bUseLimits; + +public: + SmSubSupNode(const SmToken &rNodeToken) + : SmStructureNode(NSUBSUP, rNodeToken) + { + SetNumSubNodes(1 + SUBSUP_NUM_ENTRIES); + bUseLimits = FALSE; + } + + SmNode * GetBody() { return GetSubNode(0); } + const SmNode * GetBody() const + { + return ((SmSubSupNode *) this)->GetBody(); + } + + void SetUseLimits(BOOL bVal) { bUseLimits = bVal; } + BOOL IsUseLimits() const { return bUseLimits; }; + + SmNode * GetSubSup(SmSubSup eSubSup) { return GetSubNode(1 + eSubSup); }; + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); + +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmBraceNode : public SmStructureNode +{ +public: + SmBraceNode(const SmToken &rNodeToken) + : SmStructureNode(NBRACE, rNodeToken) + { + SetNumSubNodes(3); + } + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmBracebodyNode : public SmStructureNode +{ + long nBodyHeight; + +public: + inline SmBracebodyNode(const SmToken &rNodeToken); + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); + long GetBodyHeight() const { return nBodyHeight; } +}; + + +inline SmBracebodyNode::SmBracebodyNode(const SmToken &rNodeToken) : + SmStructureNode(NBRACEBODY, rNodeToken) +{ + nBodyHeight = 0; +} + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmVerticalBraceNode : public SmStructureNode +{ +public: + inline SmVerticalBraceNode(const SmToken &rNodeToken); + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +inline SmVerticalBraceNode::SmVerticalBraceNode(const SmToken &rNodeToken) : + SmStructureNode(NVERTICAL_BRACE, rNodeToken) +{ + SetNumSubNodes(3); +} + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmOperNode : public SmStructureNode +{ +public: + SmOperNode(const SmToken &rNodeToken) + : SmStructureNode(NOPER, rNodeToken) + { + SetNumSubNodes(2); + } + + SmNode * GetSymbol(); + const SmNode * GetSymbol() const + { + return ((SmOperNode *) this)->GetSymbol(); + } + + long CalcSymbolHeight(const SmNode &rSymbol, const SmFormat &rFormat) const; + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmAlignNode : public SmStructureNode +{ +public: + SmAlignNode(const SmToken &rNodeToken) + : SmStructureNode(NALIGN, rNodeToken) + {} + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmAttributNode : public SmStructureNode +{ +public: + SmAttributNode(const SmToken &rNodeToken) + : SmStructureNode(NATTRIBUT, rNodeToken) + {} + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmFontNode : public SmStructureNode +{ + USHORT nSizeType; + Fraction aFontSize; + +public: + SmFontNode(const SmToken &rNodeToken) + : SmStructureNode(NFONT, rNodeToken) + { + nSizeType = FNTSIZ_MULTIPLY; + aFontSize = Fraction(1L); + } + + void SetSizeParameter(const Fraction &rValue, USHORT nType); + const Fraction & GetSizeParameter() const {return aFontSize;} + const USHORT& GetSizeType() const {return nSizeType;} + + virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmMatrixNode : public SmStructureNode +{ + USHORT nNumRows, + nNumCols; + +public: + SmMatrixNode(const SmToken &rNodeToken) + : SmStructureNode(NMATRIX, rNodeToken) + { + nNumRows = nNumCols = 0; + } + + USHORT GetNumRows() const {return nNumRows;} + USHORT GetNumCols() const {return nNumCols;} + void SetRowCol(USHORT nMatrixRows, USHORT nMatrixCols); + + virtual SmNode * GetLeftMost(); + + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + + +class SmBlankNode : public SmGraphicNode +{ + USHORT nNum; + +public: + SmBlankNode(const SmToken &rNodeToken) + : SmGraphicNode(NBLANK, rNodeToken) + { + nNum = 0; + } + + void IncreaseBy(const SmToken &rToken); + void Clear() { nNum = 0; } + + virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); + virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); +}; + + +//////////////////////////////////////////////////////////////////////////////// + +} //namespace binfilter +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/inc/bf_starmath/parse.hxx b/inc/bf_starmath/parse.hxx new file mode 100644 index 000000000..98f82114e --- /dev/null +++ b/inc/bf_starmath/parse.hxx @@ -0,0 +1,263 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef PARSE_HXX +#define PARSE_HXX + +#include <bf_tools/stack.hxx> +#include <bf_svtools/bf_solar.h> + + +#include <vcl/svapp.hxx> +#include <vector> + +namespace binfilter { + +class SmNode; +class SmDocShell; + + +// TokenGroups +#define TGOPER 0x00000001 +#define TGRELATION 0x00000002 +#define TGSUM 0x00000004 +#define TGPRODUCT 0x00000008 +#define TGUNOPER 0x00000010 +#define TGPOWER 0x00000020 +#define TGATTRIBUT 0x00000040 +#define TGALIGN 0x00000080 +#define TGFUNCTION 0x00000100 +#define TGBLANK 0x00000200 +#define TGLBRACES 0x00000400 +#define TGRBRACES 0x00000800 +#define TGCOLOR 0x00001000 +#define TGFONT 0x00002000 +#define TGSTANDALONE 0x00004000 +#define TGDISCARDED 0x00008000 +#define TGLIMIT 0x00010000 +#define TGFONTATTR 0x00020000 + + +enum SmTokenType +{ + TEND, TLGROUP, TRGROUP, TLPARENT, TRPARENT, + TLBRACKET, TRBRACKET, TPLUS, TMINUS, TMULTIPLY, + TDIVIDEBY, TASSIGN, TPOUND, TSPECIAL, TSLASH, + TBACKSLASH, TBLANK, TSBLANK, TRSUB, TRSUP, + TCSUB, TCSUP, TLSUB, TLSUP, TGT, + TLT, TAND, TOR, TINTERSECT, TUNION, + TNEWLINE, TBINOM, TFROM, TTO, TINT, + TSUM, TOPER, TABS, TSQRT, TFACT, + TNROOT, TOVER, TTIMES, TGE, TLE, + TGG, TLL, TDOTSAXIS, TDOTSLOW, TDOTSVERT, + TDOTSDIAG, TDOTSUP, TDOTSDOWN, TACUTE, TBAR, + TBREVE, TCHECK, TCIRCLE, TDOT, TDDOT, + TDDDOT, TGRAVE, THAT, TTILDE, TVEC, + TUNDERLINE, TOVERLINE, TOVERSTRIKE, TITALIC, TNITALIC, + TBOLD, TNBOLD, TPHANTOM, TFONT, TSIZE, + TCOLOR, TALIGNL, TALIGNC, TALIGNR, TLEFT, + TRIGHT, TLANGLE, TLBRACE, TLLINE, TLDLINE, + TLCEIL, TLFLOOR, TNONE, TMLINE, TRANGLE, + TRBRACE, TRLINE, TRDLINE, TRCEIL, TRFLOOR, + TSIN, TCOS, TTAN, TCOT, TFUNC, + TSTACK, TMATRIX, TMATFORM, TDPOUND, TPLACE, + TTEXT, TNUMBER, TCHARACTER, TIDENT, TNEQ, + TEQUIV, TDEF, TPROP, TSIM, TSIMEQ, + TAPPROX, TPARALLEL, TORTHO, TIN, TNOTIN, + TSUBSET, TSUBSETEQ, TSUPSET, TSUPSETEQ, TPLUSMINUS, + TMINUSPLUS, TOPLUS, TOMINUS, TDIV, TOTIMES, + TODIVIDE, TTRANSL, TTRANSR, TIINT, TIIINT, + TLINT, TLLINT, TLLLINT, TPROD, TCOPROD, + TFORALL, TEXISTS, TLIM, TNABLA, TTOWARD, + TSINH, TCOSH, TTANH, TCOTH, TASIN, + TACOS, TATAN, TLN, TLOG, TUOPER, + TBOPER, TBLACK, TWHITE, TRED, TGREEN, + TBLUE, TCYAN, TMAGENTA, TYELLOW, TFIXED, + TSANS, TSERIF, TPOINT, TASINH, TACOSH, + TATANH, TACOTH, TACOT, TEXP, TCDOT, + TODOT, TLESLANT, TGESLANT, TNSUBSET, TNSUPSET, + TNSUBSETEQ, TNSUPSETEQ, TPARTIAL, TNEG, TNI, + TBACKEPSILON, TALEPH, TIM, TRE, TWP, + TEMPTYSET, TINFINITY, TESCAPE, TLIMSUP, TLIMINF, + TNDIVIDES, TDRARROW, TDLARROW, TDLRARROW, TUNDERBRACE, + TOVERBRACE, TCIRC, TTOP, THBAR, TLAMBDABAR, + TLEFTARROW, TRIGHTARROW, TUPARROW, TDOWNARROW, TDIVIDES, + TNDIBVIDES, TSETN, TSETZ, TSETQ, TSETR, + TSETC, TWIDEVEC, TWIDETILDE, TWIDEHAT, TWIDESLASH, + TWIDEBACKSLASH, TLDBRACKET, TRDBRACKET, + TUNKNOWN, TDEBUG +}; + + +struct SmToken +{ + // token text + String aText; + // token info + SmTokenType eType; + sal_Unicode cMathChar; + // parse-help info + ULONG nGroup; + USHORT nLevel; + // token position + INT32 nRow; + INT32 nCol; + + SmToken(); +}; + + +enum SmParseError +{ + PE_NONE, PE_UNEXPECTED_END_OF_INPUT, + PE_UNEXPECTED_CHAR, PE_UNEXPECTED_TOKEN, + PE_FUNC_EXPECTED, PE_UNOPER_EXPECTED, + PE_BINOPER_EXPECTED, PE_SYMBOL_EXPECTED, + PE_IDENTIFIER_EXPECTED, PE_POUND_EXPECTED, + PE_COLOR_EXPECTED, PE_LGROUP_EXPECTED, + PE_RGROUP_EXPECTED, PE_LBRACE_EXPECTED, + PE_RBRACE_EXPECTED, PE_PARENT_MISMATCH, + PE_RIGHT_EXPECTED, PE_FONT_EXPECTED, + PE_SIZE_EXPECTED, PE_DOUBLE_ALIGN, + PE_DOUBLE_SUBSUPSCRIPT +}; + + +struct SmErrorDesc +{ + SmParseError Type; + SmNode *pNode; + String Text; +}; + +DECLARE_STACK(SmNodeStack, SmNode *) +typedef ::std::vector< SmErrorDesc* > SmErrDescList; + +/**************************************************************************/ + +// defines possible conversions of the formula text from the format of +// one release to the one of another. +enum SmConvert +{ + CONVERT_NONE, + CONVERT_40_TO_50, + CONVERT_50_TO_60, + CONVERT_60_TO_50 +}; + + +class SmParser +{ + String BufferString; + SmToken CurToken; + SmNodeStack NodeStack; + SmErrDescList ErrDescList; + int CurError; + LanguageType nLang; + xub_StrLen BufferIndex, + nTokenIndex; + USHORT Row, + ColOff; + SmConvert eConversion; + BOOL bImportSymNames, + bExportSymNames; + + // declare copy-constructor and assignment-operator private + SmParser(const SmParser &); + SmParser & operator = (const SmParser &); + +protected: + +#if OSL_DEBUG_LEVEL > 1 + BOOL IsDelimiter( const String &rTxt, xub_StrLen nPos ); +#endif + + void NextToken(); + xub_StrLen GetTokenIndex() const { return nTokenIndex; } + void Insert(const String &rText, USHORT nPos); + void Replace( USHORT nPos, USHORT nLen, const String &rText ); + + inline BOOL TokenInGroup(ULONG nGroup); + + // grammar + void Table(); + void Line(); + void Expression(); + void Relation(); + void Sum(); + void Product(); + void SubSup(ULONG nActiveGroup); + void OpSubSup(); + void Power(); + void Blank(); + void Term(); + void Escape(); + void Operator(); + void Oper(); + void UnOper(); + void Align(); + void FontAttribut(); + void Attribut(); + void Font(); + void FontSize(); + void Color(); + void Brace(); + void Bracebody(BOOL bIsLeftRight); + void Function(); + void Binom(); // matrixfett.smf + void Stack(); // matrixfett.smf + void Matrix(); + void Special(); + void GlyphSpecial(); + // end of grammar + + LanguageType GetLanguage() const { return nLang; } + void SetLanguage( LanguageType nNewLang ) { nLang = nNewLang; } + + void Error(SmParseError Error); + +public: + SmParser(); + + SmNode *Parse(const String &rBuffer); + + const String & GetText() const { return BufferString; }; + + SmConvert GetConversion() const { return eConversion; } + void SetConversion(SmConvert eConv) { eConversion = eConv; } + + BOOL IsImportSymbolNames() const { return bImportSymNames; } + void SetImportSymbolNames(BOOL bVal) { bImportSymNames = bVal; } + BOOL IsExportSymbolNames() const { return bExportSymNames; } + void SetExportSymbolNames(BOOL bVal) { bExportSymNames = bVal; } + + void AddError(SmParseError Type, SmNode *pNode); + +}; + + +inline BOOL SmParser::TokenInGroup(ULONG nGroup) +{ + return (CurToken.nGroup & nGroup) ? TRUE : FALSE; +} + + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/inc/bf_starmath/rect.hxx b/inc/bf_starmath/rect.hxx new file mode 100644 index 000000000..849ec3cb4 --- /dev/null +++ b/inc/bf_starmath/rect.hxx @@ -0,0 +1,259 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef RECT_HXX +#define RECT_HXX + +#include <bf_svtools/bf_solar.h> + +#include <new> + + +#include <tools/gen.hxx> + +#include <vcl/outdev.hxx> + +#include <vcl/metric.hxx> + +#include <tools/debug.hxx> + +#include "format.hxx" +namespace binfilter { + + +BOOL SmGetGlyphBoundRect(const OutputDevice &rDev, + const XubString &rText, Rectangle &rRect); + +BOOL SmIsMathAlpha(const XubString &rText); + + +inline long SmFromTo(long nFrom, long nTo, double fRelDist) +{ + return nFrom + (long) (fRelDist * (nTo - nFrom)); +} + + +//////////////////////////////////////// +// SmRect +// ... (to be done) +// This Implementation assumes that the x-axis points to the right and the +// y-axis to the bottom. +// Note: however, italic spaces can be negative! +// + +// possible flags for the 'Draw' function below (just for debugging) +#define SM_RECT_CORE 0x0001 +#define SM_RECT_ITALIC 0x0002 +#define SM_RECT_LINES 0x0004 +#define SM_RECT_MID 0x0008 + +// possible positions and alignments for the 'AlignTo' function +enum RectPos + // (RP_LEFT : align the current object to the left of the argument, ...) +{ RP_LEFT, RP_RIGHT, + RP_TOP, RP_BOTTOM, + RP_ATTRIBUT +}; +enum RectHorAlign +{ RHA_LEFT, RHA_CENTER, RHA_RIGHT +}; +enum RectVerAlign +{ RVA_TOP, RVA_MID, RVA_BOTTOM, RVA_BASELINE, RVA_CENTERY, + RVA_ATTRIBUT_HI, RVA_ATTRIBUT_MID, RVA_ATTRIBUT_LO +}; + +// different methods of copying baselines and mid's in 'ExtendBy' function +enum RectCopyMBL +{ RCP_THIS, // keep baseline of current object even if it has none + RCP_ARG, // as above but for the argument + RCP_NONE, // result will have no baseline + RCP_XOR // if current object has a baseline keep it else copy + // the arguments baseline (even if it has none) +}; + + +class SmRect +{ + Point aTopLeft; + Size aSize; + long nBaseline, + nAlignT, + nAlignM, + nAlignB, + nGlyphTop, + nGlyphBottom, + nItalicLeftSpace, + nItalicRightSpace, + nLoAttrFence, + nHiAttrFence; + USHORT nBorderWidth; + BOOL bHasBaseline, + bHasAlignInfo; + +protected: + void BuildRect (const OutputDevice &rDev, const SmFormat *pFormat, + const XubString &rText, USHORT nBorderWidth); + void Init(const OutputDevice &rDev, const SmFormat *pFormat, + const XubString &rText, USHORT nBorderWidth); + + void ClearBaseline() { bHasBaseline = FALSE; }; + inline void CopyMBL(const SmRect& rRect); + void CopyAlignInfo(const SmRect& rRect); + + SmRect & Union(const SmRect &rRect); + +public: + SmRect(); + SmRect(const OutputDevice &rDev, const SmFormat *pFormat, + const XubString &rText, long nBorderWidth); + SmRect(long nWidth, long nHeight); + SmRect(const SmRect &rRect); + + + USHORT GetBorderWidth() const { return nBorderWidth; } + + void SetItalicSpaces(long nLeftSpace, long nRightSpace); + + void SetWidth(ULONG nWidth) { aSize.Width() = nWidth; } + void SetHeight(ULONG nHeight) { aSize.Height() = nHeight; } + + void SetLeft(long nLeft); + void SetRight(long nRight); + void SetBottom(long nBottom); + void SetTop(long nTop); + + const Point & GetTopLeft() const { return aTopLeft; } + + long GetTop() const { return GetTopLeft().Y(); } + long GetLeft() const { return GetTopLeft().X(); } + long GetBottom() const { return GetTop() + GetHeight() - 1; } + long GetRight() const { return GetLeft() + GetWidth() - 1; } + long GetCenterX() const { return (GetLeft() + GetRight()) / 2L; } + long GetCenterY() const { return (GetTop() + GetBottom()) / 2L; } + long GetWidth() const { return GetSize().Width(); } + long GetHeight() const { return GetSize().Height(); } + + long GetItalicLeftSpace() const { return nItalicLeftSpace; } + long GetItalicRightSpace() const { return nItalicRightSpace; } + + void SetHiAttrFence(long nVal) { nHiAttrFence = nVal; } + void SetLoAttrFence(long nVal) { nLoAttrFence = nVal; } + long GetHiAttrFence() const { return nHiAttrFence; } + long GetLoAttrFence() const { return nLoAttrFence; } + + long GetItalicLeft() const { return GetLeft() - GetItalicLeftSpace(); } + long GetItalicCenterX() const { return (GetItalicLeft() + GetItalicRight()) / 2; } + long GetItalicRight() const { return GetRight() + GetItalicRightSpace(); } + long GetItalicWidth() const { return GetWidth() + GetItalicLeftSpace() + GetItalicRightSpace(); } + + BOOL HasBaseline() const { return bHasBaseline; } + inline long GetBaseline() const; + long GetBaselineOffset() const { return GetBaseline() - GetTop(); } + + void SetAlignTop(long nVal) { nAlignT = nVal; } + + long GetAlignT() const { return nAlignT; } + long GetAlignM() const { return nAlignM; } + long GetAlignB() const { return nAlignB; } + + void SetAlignT(long nVal) { nAlignT = nVal; } + + const Point GetCenter() const + { return Point(GetCenterX(), GetCenterY()); } + + const Size & GetSize() const { return aSize; } + + const Size GetItalicSize() const + { return Size(GetItalicWidth(), GetHeight()); } + + void Move (const Point &rPosition); + void MoveTo(const Point &rPosition) { Move(rPosition - GetTopLeft()); } + + BOOL IsEmpty() const + { + return GetWidth() == 0 || GetHeight() == 0; + } + + BOOL HasAlignInfo() const { return bHasAlignInfo; } + + const Point AlignTo(const SmRect &rRect, RectPos ePos, + RectHorAlign eHor, RectVerAlign eVer) const; + + SmRect & ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode); + SmRect & ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode, + long nNewAlignM); + SmRect & ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode, + BOOL bKeepVerAlignParams); +// SmRect & ExtendBy(const Point &rPoint); + +// long OrientedDist(const Point &rPoint) const; +// BOOL IsInsideRect(const Point &rPoint) const; +// BOOL IsInsideItalicRect(const Point &rPoint) const; + + inline SmRect & operator = (const SmRect &rRect); + + inline Rectangle AsRectangle() const; + SmRect AsGlyphRect() const; + +}; + + +inline void SmRect::SetItalicSpaces(long nLeftSpace, long nRightSpace) + // set extra spacing to the left and right for (italic) + // letters/text +{ + nItalicLeftSpace = nLeftSpace; + nItalicRightSpace = nRightSpace; +} + + +inline void SmRect::CopyMBL(const SmRect &rRect) + // copy AlignM baseline and value of 'rRect' +{ + nBaseline = rRect.nBaseline; + bHasBaseline = rRect.bHasBaseline; + nAlignM = rRect.nAlignM; +} + + +inline long SmRect::GetBaseline() const +{ + DBG_ASSERT(HasBaseline(), "Sm: Baseline nicht vorhanden"); + return nBaseline; +} + + +inline SmRect & SmRect::operator = (const SmRect &rRect) +{ + new (this) SmRect(rRect); // placement new + return *this; +} + + +inline Rectangle SmRect::AsRectangle() const +{ + return Rectangle(Point(GetItalicLeft(), GetTop()), GetItalicSize()); +} + + + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/inc/bf_starmath/smdll.hxx b/inc/bf_starmath/smdll.hxx new file mode 100644 index 000000000..695407199 --- /dev/null +++ b/inc/bf_starmath/smdll.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SMDLL_HXX +#define SMDLL_HXX + +#include <bf_svtools/bf_solar.h> + +#define SMDLL 1 + +#include <bf_starmath/smdll0.hxx> +#include <tools/resid.hxx> +#include <bf_sfx2/sfxdefs.hxx> +namespace binfilter { + +class SmData; +class SfxMedium; +class SfxFilter; + +class SmDLL +{ + static BOOL bInitialized; +public: + SmDLL(); + ~SmDLL(); + + static void Init(); + static void LibInit(); + static void Exit(); + static void LibExit(); + + static ULONG DetectFilter( SfxMedium& rMedium, const SfxFilter **ppFilter, + SfxFilterFlags nMust, SfxFilterFlags nDont ); +}; + +#ifdef SMDLL +class SmResId : public ResId +{ +public: + SmResId(USHORT nId) : + ResId(nId, *SM_MOD()->GetResMgr()) + { + } +}; +#endif + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/inc/bf_starmath/smdll0.hxx b/inc/bf_starmath/smdll0.hxx new file mode 100644 index 000000000..047d109f5 --- /dev/null +++ b/inc/bf_starmath/smdll0.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SMDLL0_HXX +#define SMDLL0_HXX + +#include <bf_svtools/bf_solar.h> + +#include <bf_so3/pseudo.hxx> + +#include <bf_sfx2/module.hxx> +#include <tools/shl.hxx> +class SvFactory; +class SotFactory; + +namespace binfilter { + +/************************************************************************* +|* +|* define dummy-version only if not in Sd-DLL +|* +\************************************************************************/ + +#define SM_MOD() ( *(SmModuleDummy**) GetAppData(BF_SHL_SM) ) + +/************************************************************************* +|* +|* This tricky class keeps pointers to the SvFactories while +|* the DLL isn`t loaded. A pointer to the one instance is available +|* through SD_MOD() (shared-lib-app-data). +|* +\************************************************************************/ + +class SmModuleDummy : public SfxModule +{ +public: + TYPEINFO(); + + // SvFactory name convention: + // 'p' + SfxObjectShell-subclass + 'Factory' + SotFactory *pSmDocShellFactory; + + SmModuleDummy(ResMgr *pResMgrIn, BOOL bDummyIn, SotFactory *pObjFact) : + SfxModule(pResMgrIn, bDummyIn, (SfxObjectFactory*) pObjFact, NULL), pSmDocShellFactory(pObjFact) + { + } + + virtual SfxModule *Load (); + + static const SvGlobalName GetID(USHORT nFileFormat); + static USHORT HasID (const SvGlobalName& rID); +}; + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/inc/bf_starmath/smmod.hxx b/inc/bf_starmath/smmod.hxx new file mode 100644 index 000000000..f6f44a278 --- /dev/null +++ b/inc/bf_starmath/smmod.hxx @@ -0,0 +1,165 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SMMOD_HXX +#define _SMMOD_HXX + +#include <i18npool/lang.h> +#include <tools/rc.hxx> +#include <tools/resary.hxx> +#include <bf_svtools/lstner.hxx> +#include <bf_svtools/colorcfg.hxx> + +#ifndef _SMDLL_HXX +#define _SM_DLL // fuer SD_MOD() +#include <bf_starmath/smdll.hxx> // fuer SdModuleDummy +#endif +#include "starmath.hrc" +class VirtualDevice; + +namespace binfilter { + +class SvxErrorHandler; +class SvtSysLocale; +class SvFactory; + + +class SmConfig; +class SmModule; + +/************************************************************************* +|* +|* This subclass of <SfxModule> (which is a subclass of <SfxShell>) is +|* linked to the DLL. One instance of this class exists while the DLL is +|* loaded. +|* +|* SdModule is like to be compared with the <SfxApplication>-subclass. +|* +|* Remember: Don`t export this class! It uses DLL-internal symbols. +|* +\************************************************************************/ + +class SmRectCache; + +///////////////////////////////////////////////////////////////// + +/*N*/ class SmNamesArray : public Resource +/*N*/ { +/*N*/ ResStringArray aNamesAry; +/*N*/ LanguageType nLanguage; +/*N*/ +/*N*/ public: +/*N*/ SmNamesArray( LanguageType nLang, int nRID ) : +/*N*/ Resource( SmResId(RID_LOCALIZED_NAMES) ), +/*N*/ aNamesAry (SmResId(nRID)), +/*N*/ nLanguage (nLang) +/*N*/ { +/*N*/ FreeResource(); +/*N*/ } +/*N*/ +/*N*/ LanguageType GetLanguage() const { return nLanguage; } +/*N*/ const ResStringArray& GetNamesArray() const { return aNamesAry; } +/*N*/ }; + +///////////////////////////////////////////////////////////////// + +class SmLocalizedSymbolData : public Resource +{ + ResStringArray aUiSymbolNamesAry; + ResStringArray aExportSymbolNamesAry; + ResStringArray aUiSymbolSetNamesAry; + ResStringArray aExportSymbolSetNamesAry; + SmNamesArray *p50NamesAry; + SmNamesArray *p60NamesAry; + LanguageType n50NamesLang; + LanguageType n60NamesLang; + +public: + SmLocalizedSymbolData(); + ~SmLocalizedSymbolData(); + + const ResStringArray& GetUiSymbolNamesArray() const { return aUiSymbolNamesAry; } + const ResStringArray& GetExportSymbolNamesArray() const { return aExportSymbolNamesAry; } + const String GetUiSymbolName( const String &rExportName ) const; + const String GetExportSymbolName( const String &rUiName ) const; + + const ResStringArray& GetUiSymbolSetNamesArray() const { return aUiSymbolSetNamesAry; } + const ResStringArray& GetExportSymbolSetNamesArray() const { return aExportSymbolSetNamesAry; } + const String GetUiSymbolSetName( const String &rExportName ) const; + + const ResStringArray* Get50NamesArray( LanguageType nLang ); + const ResStringArray* Get60NamesArray( LanguageType nLang ); +}; + +///////////////////////////////////////////////////////////////// + +class SmModule : public SmModuleDummy, public SfxListener +{ + ColorConfig *pColorConfig; + SmConfig *pConfig; + SmLocalizedSymbolData *pLocSymbolData; + SmRectCache *pRectCache; + SvtSysLocale *pSysLocale; + VirtualDevice *pVirtualDev; + + void _CreateSysLocale() const; + void _CreateVirtualDev() const; + + void ApplyColorConfigValues( const ColorConfig &rColorCfg ); + +public: + TYPEINFO(); + + SmModule(SvFactory* pObjFact); + virtual ~SmModule(); + + + // SfxListener + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + ColorConfig & GetColorConfig(); + + SmConfig * GetConfig(); + SmRectCache * GetRectCache() { return pRectCache; } + + SmLocalizedSymbolData & GetLocSymbolData() const; + + const SvtSysLocale& GetSysLocale() const + { + if( !pSysLocale ) + _CreateSysLocale(); + return *pSysLocale; + } + + VirtualDevice & GetDefaultVirtualDev() + { + if (!pVirtualDev) + _CreateVirtualDev(); + return *pVirtualDev; + } + + //virtuelle Methoden fuer den Optionendialog +}; + +#define SM_MOD1() ( *(SmModule**) GetAppData(BF_SHL_SM) ) + +} //namespace binfilter +#endif // _SDMOD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/inc/bf_starmath/starmath.hrc b/inc/bf_starmath/starmath.hrc new file mode 100644 index 000000000..8ed6e3366 --- /dev/null +++ b/inc/bf_starmath/starmath.hrc @@ -0,0 +1,519 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _STARMATH_HRC +#define _STARMATH_HRC + +#ifndef _SVX_SVXIDS_HRC +#include <bf_svtools/solar.hrc> +#endif +#ifndef _SFXSIDS_HRC //autogen +#include <bf_sfx2/sfxsids.hrc> +#endif + + +#define SID_NEXTERR (SID_SMA_START + 1) +#define SID_PREVERR (SID_SMA_START + 2) +#define SID_NEXTMARK (SID_SMA_START + 3) +#define SID_PREVMARK (SID_SMA_START + 4) +#define SID_SYMBOLS_CATALOGUE (SID_SMA_START + 5) +#define SID_PREFERENCES (SID_SMA_START + 6) +#define SID_VIEW050 (SID_SMA_START + 7) +#define SID_VIEW100 (SID_SMA_START + 8) +#define SID_VIEW200 (SID_SMA_START + 9) +#define SID_ZOOMIN (SID_SMA_START + 10) +#define SID_ZOOMOUT (SID_SMA_START + 11) +#define SID_DRAW (SID_SMA_START + 12) +#define SID_ADJUST (SID_SMA_START + 13) +#define SID_TOOLBOX (SID_SMA_START + 14) +#define SID_FORMULACURSOR (SID_SMA_START + 15) +#define SID_FONT (SID_SMA_START + 50) +#define SID_FONTSIZE (SID_SMA_START + 51) +#define SID_DISTANCE (SID_SMA_START + 52) +#define SID_ALIGN (SID_SMA_START + 53) + +#define SID_AUTO_REDRAW (SID_SMA_START + 55) +#define SID_SYMBOLS (SID_SMA_START + 56) // Muss erstmal wieder aufgenommen werden ! +#define SID_TEXTMODE (SID_SMA_START + 57) +#define SID_INSERT_FORMULA (SID_SMA_START + 58) +#define SID_TEXT (SID_SMA_START + 100) +#define SID_GRAPHIC (SID_SMA_START + 101) +#define SID_FITINWINDOW (SID_SMA_START + 103) +#define SID_INSERTTEXT (SID_SMA_START + 104) +#define SID_INSERTCOMMAND (SID_SMA_START + 105) + +#define SID_LOADSYMBOLS (SID_SMA_START + 107) +#define SID_SAVESYMBOLS (SID_SMA_START + 108) +#define SID_ZOOMSTATUS (SID_SMA_START + 109) +#define SID_MODIFYSTATUS (SID_SMA_START + 110) +#define SID_TEXTSTATUS (SID_SMA_START + 111) + +#define SID_PRINTTITLE (SID_SMA_START + 112) +#define SID_PRINTTEXT (SID_SMA_START + 113) +#define SID_PRINTFRAME (SID_SMA_START + 114) +#define SID_PRINTSIZE (SID_SMA_START + 115) +#define SID_PRINTZOOM (SID_SMA_START + 116) + +#define SID_COPYOBJECT (SID_SMA_START + 117) +#define SID_PASTEOBJECT (SID_SMA_START + 118) +#define SID_AUTOREDRAW (SID_SMA_START + 119) + +#define SID_GETEDITTEXT (SID_SMA_START + 121) +#define SID_CMDBOXWINDOW (SID_SMA_START + 122) +#define SID_TOOLBOXWINDOW (SID_SMA_START + 123) +#define SID_NO_RIGHT_SPACES (SID_SMA_START + 124) +#define SID_DUMMY (SID_SMA_START + 254) + +//#define GID_ERROR (RID_GROUPS_OFFSET + 2) + +//#define RID_OPTIONSDIALOG (RID_APP_START + 1) +#define RID_EXTRAOPTIONPAGE (RID_APP_START + 10) +// wegen #58705# entfernt +//#define RID_DRAW_OBJECTBAR (RID_APP_START + 51) + +#define RID_WRITESYMBOLERROR (RID_APP_START + 202) +#define RID_READSYMBOLERROR (RID_APP_START + 203) +#define RID_NOMATHTYPEFACEWARNING (RID_APP_START + 204) +#define RID_VIEWNAME (RID_APP_START + 502) +#define RID_APPICO (RID_APP_START + 601) +#define RID_TMPICO (RID_APP_START + 603) +#define RID_STARTUPWINDOW (RID_APP_START + 800) +#define RID_TOOLBOXWINDOW (RID_APP_START + 801) +#define RID_CMDBOXWINDOW (RID_APP_START + 802) +//#define RID_PRINTOPTION (RID_APP_START + 807) +#define RID_DOCUMENTSTR (RID_APP_START + 808) +#define RID_CREATORSTR (RID_APP_START + 811) +#define RID_FILESMFTYP (RID_APP_START + 812) +#define RID_FILESYMTYP (RID_APP_START + 813) +#define RID_STATUSBAR (RID_APP_START + 816) +#define RID_APPNAMESTR (RID_APP_START + 817) +#define STR_MATH_DOCUMENT_FULLTYPE_40 (RID_APP_START + 818) +#define STR_MATH_DOCUMENT_FULLTYPE_31 (RID_APP_START + 819) +#define STR_MATH_DOCUMENT_FULLTYPE_50 (RID_APP_START + 820) +#define STR_MATH_DOCUMENT_FULLTYPE_60 (RID_APP_START + 821) +#define STR_STATSTR_READING (RID_APP_START + 823) +#define STR_STATSTR_WRITING (RID_APP_START + 824) + +#define RID_ERR_IDENT (RID_APP_START + 920) +#define RID_ERR_UNKOWN (RID_APP_START + 921) +#define RID_ERR_UNEXPECTEDCHARACTER (RID_APP_START + 922) +#define RID_ERR_LGROUPEXPECTED (RID_APP_START + 923) +#define RID_ERR_RGROUPEXPECTED (RID_APP_START + 924) +#define RID_ERR_LBRACEEXPECTED (RID_APP_START + 925) +#define RID_ERR_RBRACEEXPECTED (RID_APP_START + 926) +#define RID_ERR_FUNCEXPECTED (RID_APP_START + 927) +#define RID_ERR_UNOPEREXPECTED (RID_APP_START + 928) +#define RID_ERR_BINOPEREXPECTED (RID_APP_START + 929) +#define RID_ERR_SYMBOLEXPECTED (RID_APP_START + 930) +#define RID_ERR_IDENTEXPECTED (RID_APP_START + 931) +#define RID_ERR_POUNDEXPECTED (RID_APP_START + 932) +#define RID_ERR_COLOREXPECTED (RID_APP_START + 933) +#define RID_ERR_RIGHTEXPECTED (RID_APP_START + 936) + +#define RID_UNBINOPS_CAT (RID_APP_START + 1101) +#define RID_RELATIONS_CAT (RID_APP_START + 1102) +#define RID_SETOPERATIONS_CAT (RID_APP_START + 1103) +#define RID_FUNCTIONS_CAT (RID_APP_START + 1104) +#define RID_OPERATORS_CAT (RID_APP_START + 1105) +#define RID_ATTRIBUTES_CAT (RID_APP_START + 1106) +#define RID_BRACKETS_CAT (RID_APP_START + 1107) +#define RID_FORMAT_CAT (RID_APP_START + 1108) +#define RID_UNBINOPS_CAT_HLP (RID_APP_START + 1109) +#define RID_RELATIONS_CAT_HLP (RID_APP_START + 1110) +#define RID_SETOPEROPERATIONS_CAT_HLP (RID_APP_START + 1111) +#define RID_FUNCTIONS_CAT_HLP (RID_APP_START + 1112) +#define RID_OPERATORS_CAT_HLP (RID_APP_START + 1113) +#define RID_ATTRIBUTES_CAT_HLP (RID_APP_START + 1114) +#define RID_BRACKETS_CAT_HLP (RID_APP_START + 1115) +#define RID_FORMAT_CAT_HLP (RID_APP_START + 1116) +#define RID_MISC_CAT (RID_APP_START + 1117) +#define RID_MISC_CAT_HLP (RID_APP_START + 1118) + +// new resource ID's + +#define RID_XNEQY (RID_APP_START + 1302) + + +#define RID_EX (RID_APP_START + 1505) + + +#define RID_GRAVEX (RID_APP_START + 1702) + +#define RID_STACK (RID_APP_START + 1906) + +#define RID_RE (RID_APP_START + 2003) + +// new menue resource ID's +#define RID_UNBINOPS_MENU (RID_APP_START + 2164) +#define RID_RELATIONS_MENU (RID_APP_START + 2165) +#define RID_SETOPERATIONS_MENU (RID_APP_START + 2166) +#define RID_FUNCTIONS_MENU (RID_APP_START + 2167) +#define RID_OPERATORS_MENU (RID_APP_START + 2168) +#define RID_ATTRIBUTES_MENU (RID_APP_START + 2169) +#define RID_BRACKETS_MENU (RID_APP_START + 2170) +#define RID_FORMAT_MENU (RID_APP_START + 2171) +#define RID_MISC_MENU (RID_APP_START + 2172) +#define RID_FUNCTIONSOTHER1_MENU (RID_APP_START + 2173) + +#define RID_XPP_LINE (RID_APP_START + 3000) +#define RID_XPP_DLINE (RID_APP_START + 3001) +#define RID_XPP_SQRT (RID_APP_START + 3002) +#define RID_XPP_SQRT2 (RID_APP_START + 3003) +#define RID_XPP_HAT (RID_APP_START + 3004) +#define RID_XPP_TILDE (RID_APP_START + 3005) +#define RID_XPP_BAR (RID_APP_START + 3006) +#define RID_XPP_VEC (RID_APP_START + 3007) +#define RID_XPP_LBRACE (RID_APP_START + 3008) +#define RID_XPP_RBRACE (RID_APP_START + 3009) +#define RID_XPP_LPARENT (RID_APP_START + 3010) +#define RID_XPP_RPARENT (RID_APP_START + 3011) +#define RID_XPP_LANGLE (RID_APP_START + 3012) +#define RID_XPP_RANGLE (RID_APP_START + 3013) +#define RID_XPP_LBRACKET (RID_APP_START + 3014) +#define RID_XPP_RBRACKET (RID_APP_START + 3015) +#define RID_XPP_LDBRACKET (RID_APP_START + 3016) +#define RID_XPP_RDBRACKET (RID_APP_START + 3017) +#define RID_XPP_LCEIL (RID_APP_START + 3018) +#define RID_XPP_RCEIL (RID_APP_START + 3019) +#define RID_XPP_LFLOOR (RID_APP_START + 3020) +#define RID_XPP_RFLOOR (RID_APP_START + 3021) +#define RID_XPP_OVERBRACE (RID_APP_START + 3022) +#define RID_XPP_UNDERBRACE (RID_APP_START + 3023) + +#define RID_LOCALIZED_NAMES (RID_APP_START + 3101) +#define RID_UI_SYMBOL_NAMES (RID_APP_START + 3102) +#define RID_EXPORT_SYMBOL_NAMES (RID_APP_START + 3103) +#define RID_LOCALIZED_SYMBOLSET_NAMES (RID_APP_START + 3104) +#define RID_UI_SYMBOLSET_NAMES (RID_APP_START + 3105) +#define RID_EXPORT_SYMBOLSET_NAMES (RID_APP_START + 3106) +#define RID_FRENCH_50_NAMES (RID_APP_START + 3107) +#define RID_FRENCH_60_NAMES (RID_APP_START + 3108) +#define RID_ITALIAN_50_NAMES (RID_APP_START + 3109) +#define RID_ITALIAN_60_NAMES (RID_APP_START + 3110) +#define RID_SWEDISH_50_NAMES (RID_APP_START + 3111) +#define RID_SWEDISH_60_NAMES (RID_APP_START + 3112) +#define RID_SPANISH_50_NAMES (RID_APP_START + 3113) +#define RID_SPANISH_60_NAMES (RID_APP_START + 3114) + +#define MN_SUB_SENDTO (RID_APP_START + 3120) + +#define HID_SMA_OPTIONSDIALOG (HID_SMA_START + 1) +#define HID_SMA_FONTDIALOG (HID_SMA_START + 2) +#define HID_SMA_FONTSIZEDIALOG (HID_SMA_START + 3) +#define HID_SMA_FONTTYPEDIALOG (HID_SMA_START + 4) +#define HID_SMA_DISTANCEDIALOG (HID_SMA_START + 5) +#define HID_SMA_ALIGNDIALOG (HID_SMA_START + 6) +#define HID_SMA_PRINTOPTIONPAGE (HID_SMA_START + 7) +#define HID_SMA_SYMBOLDIALOG (HID_SMA_START + 8) +#define HID_SMA_SYMDEFINEDIALOG (HID_SMA_START + 9) +#define HID_SMA_EXTRAOPTIONPAGE (HID_SMA_START + 10) +#define HID_SMA_DOCSAVEQUERY (HID_SMA_START + 11) +#define HID_SMA_OBJECTSAVEQUERY (HID_SMA_START + 12) +#define HID_SMA_DEFAULTSAVEQUERY (HID_SMA_START + 13) +#define HID_SMA_ILLEGALOBJECTERROR (HID_SMA_START + 14) +#define HID_SMA_ILLEGALFILEERROR (HID_SMA_START + 15) +#define HID_SMA_WRITESYMBOLERROR (HID_SMA_START + 16) +#define HID_SMA_READSYMBOLERROR (HID_SMA_START + 17) +#define HID_SMA_NOMATHTYPEFACEWARNING (HID_SMA_START + 18) +#define HID_SMA_OBJECTNAME (HID_SMA_START + 19) +#define HID_SMA_VIEWNAME (HID_SMA_START + 20) +#define HID_SMA_UNDOEDITNAME (HID_SMA_START + 21) +#define HID_SMA_UNDOFORMATNAME (HID_SMA_START + 22) +#define HID_SMA_APPICO (HID_SMA_START + 23) +#define HID_SMA_DOCICO (HID_SMA_START + 24) +#define HID_SMA_TMPICO (HID_SMA_START + 25) +#define HID_SMA_COMMANDMENU (HID_SMA_START + 26) +#define HID_SMA_VIEWMENU (HID_SMA_START + 27) +#define HID_SMA_DISTANCEMENU (HID_SMA_START + 28) +#define HID_SMA_FONTMENU (HID_SMA_START + 29) +#define HID_SMA_STARTUPWINDOW (HID_SMA_START + 30) +#define HID_SMA_TOOLBOXWINDOW (HID_SMA_START + 31) +#define HID_SMA_CMDBOXWINDOW (HID_SMA_START + 32) +#define HID_SMA_UPDATEOBJECT (HID_SMA_START + 33) +#define HID_SMA_FONTREGULAR (HID_SMA_START + 34) +#define HID_SMA_FONTITALIC (HID_SMA_START + 35) +#define HID_SMA_FONTBOLD (HID_SMA_START + 36) +#define HID_SMA_PRINTOPTION (HID_SMA_START + 37) +#define HID_SMA_DOCUMENTSTR (HID_SMA_START + 38) +#define HID_SMA_SYMBOLFILESSTR (HID_SMA_START + 39) +#define HID_SMA_ALLFILESSTR (HID_SMA_START + 40) +#define HID_SMA_CREATORSTR (HID_SMA_START + 41) +#define HID_SMA_FILESMFTYP (HID_SMA_START + 42) +#define HID_SMA_FILESYMTYP (HID_SMA_START + 43) +#define HID_SMA_WIN_DOCUMENT (HID_SMA_START + 44) +#define HID_SMA_COMMAND_WIN_EDIT (HID_SMA_START + 45) + +#define HID_SMA_PLUSX (HID_SMA_START + 50) +#define HID_SMA_MINUSX (HID_SMA_START + 51) +#define HID_SMA_PLUSMINUSX (HID_SMA_START + 52) +#define HID_SMA_MINUSPLUSX (HID_SMA_START + 53) +#define HID_SMA_NEGX (HID_SMA_START + 54) +#define HID_SMA_XPLUSY (HID_SMA_START + 55) +#define HID_SMA_XMINUSY (HID_SMA_START + 56) +#define HID_SMA_XCDOTY (HID_SMA_START + 57) +#define HID_SMA_XTIMESY (HID_SMA_START + 58) +#define HID_SMA_XSYMTIMESY (HID_SMA_START + 59) +#define HID_SMA_XSYMDIVIDEY (HID_SMA_START + 60) +#define HID_SMA_XDIVY (HID_SMA_START + 61) +#define HID_SMA_XOVERY (HID_SMA_START + 62) +#define HID_SMA_XODIVIDEY (HID_SMA_START + 63) +#define HID_SMA_XODOTY (HID_SMA_START + 64) +#define HID_SMA_XOMINUSY (HID_SMA_START + 65) +#define HID_SMA_XOPLUSY (HID_SMA_START + 66) +#define HID_SMA_XOTIMESY (HID_SMA_START + 67) +#define HID_SMA_XANDY (HID_SMA_START + 68) +#define HID_SMA_XORY (HID_SMA_START + 69) +#define HID_SMA_XEQY (HID_SMA_START + 70) +#define HID_SMA_XNEQY (HID_SMA_START + 71) +#define HID_SMA_XLTY (HID_SMA_START + 72) +#define HID_SMA_XGTY (HID_SMA_START + 73) +#define HID_SMA_XLEY (HID_SMA_START + 74) +#define HID_SMA_XGEY (HID_SMA_START + 75) +#define HID_SMA_XLESLANTY (HID_SMA_START + 76) +#define HID_SMA_XGESLANTY (HID_SMA_START + 77) +#define HID_SMA_XLLY (HID_SMA_START + 78) +#define HID_SMA_XGGY (HID_SMA_START + 79) +#define HID_SMA_XDEFY (HID_SMA_START + 80) +#define HID_SMA_XEQUIVY (HID_SMA_START + 81) +#define HID_SMA_XAPPROXY (HID_SMA_START + 82) +#define HID_SMA_XSIMY (HID_SMA_START + 83) +#define HID_SMA_XSIMEQY (HID_SMA_START + 84) +#define HID_SMA_XPROPY (HID_SMA_START + 85) +#define HID_SMA_XORTHOY (HID_SMA_START + 86) +#define HID_SMA_XPARALLELY (HID_SMA_START + 87) +#define HID_SMA_XTOWARDY (HID_SMA_START + 88) +#define HID_SMA_XTRANSLY (HID_SMA_START + 89) +#define HID_SMA_XTRANSRY (HID_SMA_START + 90) +#define HID_SMA_XINY (HID_SMA_START + 91) +#define HID_SMA_XNOTINY (HID_SMA_START + 92) +#define HID_SMA_XOWNSY (HID_SMA_START + 93) +#define HID_SMA_XUNIONY (HID_SMA_START + 94) +#define HID_SMA_XINTERSECTIONY (HID_SMA_START + 95) +#define HID_SMA_XSETMINUSY (HID_SMA_START + 96) +#define HID_SMA_XSLASHY (HID_SMA_START + 97) +#define HID_SMA_XSUBSETY (HID_SMA_START + 98) +#define HID_SMA_XSUBSETEQY (HID_SMA_START + 99) +#define HID_SMA_XSUPSETY (HID_SMA_START + 100) +#define HID_SMA_XSUPSETEQY (HID_SMA_START + 101) +#define HID_SMA_XNSUBSETY (HID_SMA_START + 102) +#define HID_SMA_XNSUBSETEQY (HID_SMA_START + 103) +#define HID_SMA_XNSUPSETY (HID_SMA_START + 104) +#define HID_SMA_XNSUPSETEQY (HID_SMA_START + 105) +#define HID_SMA_ABSX (HID_SMA_START + 106) +#define HID_SMA_FACTX (HID_SMA_START + 107) +#define HID_SMA_SQRTX (HID_SMA_START + 108) +#define HID_SMA_NROOTXY (HID_SMA_START + 109) +#define HID_SMA_EX (HID_SMA_START + 110) +#define HID_SMA_EXPX (HID_SMA_START + 111) +#define HID_SMA_LNX (HID_SMA_START + 112) +#define HID_SMA_LOGX (HID_SMA_START + 113) +#define HID_SMA_SINX (HID_SMA_START + 114) +#define HID_SMA_COSX (HID_SMA_START + 115) +#define HID_SMA_TANX (HID_SMA_START + 116) +#define HID_SMA_COTX (HID_SMA_START + 117) +#define HID_SMA_ARCSINX (HID_SMA_START + 118) +#define HID_SMA_ARCCOSX (HID_SMA_START + 119) +#define HID_SMA_ARCTANX (HID_SMA_START + 120) +#define HID_SMA_ARCCOTX (HID_SMA_START + 121) +#define HID_SMA_SINHX (HID_SMA_START + 122) +#define HID_SMA_COSHX (HID_SMA_START + 123) +#define HID_SMA_TANHX (HID_SMA_START + 124) +#define HID_SMA_COTHX (HID_SMA_START + 125) +#define HID_SMA_ARSINHX (HID_SMA_START + 126) +#define HID_SMA_ARCOSHX (HID_SMA_START + 127) +#define HID_SMA_ARTANHX (HID_SMA_START + 128) +#define HID_SMA_ARCOTHX (HID_SMA_START + 129) +#define HID_SMA_SUMX (HID_SMA_START + 130) +#define HID_SMA_PRODX (HID_SMA_START + 131) +#define HID_SMA_COPRODX (HID_SMA_START + 132) +#define HID_SMA_LIMX (HID_SMA_START + 133) +#define HID_SMA_LIMINFX (HID_SMA_START + 134) +#define HID_SMA_LIMSUPX (HID_SMA_START + 135) +#define HID_SMA_EXISTS (HID_SMA_START + 136) +#define HID_SMA_FORALL (HID_SMA_START + 137) +#define HID_SMA_NABLA (HID_SMA_START + 138) +#define HID_SMA_INTX (HID_SMA_START + 139) +#define HID_SMA_IINTX (HID_SMA_START + 140) +#define HID_SMA_IIINTX (HID_SMA_START + 141) +#define HID_SMA_LINTX (HID_SMA_START + 142) +#define HID_SMA_LLINTX (HID_SMA_START + 143) +#define HID_SMA_LLLINTX (HID_SMA_START + 144) +#define HID_SMA_FROMX (HID_SMA_START + 145) +#define HID_SMA_TOX (HID_SMA_START + 146) +#define HID_SMA_FROMXTOY (HID_SMA_START + 147) +#define HID_SMA_XCIRCY (HID_SMA_START + 148) +#define HID_SMA_XDIVIDESY (HID_SMA_START + 149) +#define HID_SMA_XNDIVIDESY (HID_SMA_START + 150) +#define HID_SMA_DLARROW (HID_SMA_START + 151) +#define HID_SMA_DLRARROW (HID_SMA_START + 152) +#define HID_SMA_DRARROW (HID_SMA_START + 153) + +#define HID_SMA_MISC_CAT (HID_SMA_START + 154) +#define HID_SMA_UNBINOPS_CAT (HID_SMA_START + 155) +#define HID_SMA_RELATIONS_CAT (HID_SMA_START + 156) +#define HID_SMA_SETOPERATIONS_CAT (HID_SMA_START + 157) +#define HID_SMA_FUNCTIONS_CAT (HID_SMA_START + 158) +#define HID_SMA_OPERATORS_CAT (HID_SMA_START + 159) +#define HID_SMA_ATTRIBUTES_CAT (HID_SMA_START + 160) +#define HID_SMA_BRACKETS_CAT (HID_SMA_START + 161) +#define HID_SMA_FORMAT_CAT (HID_SMA_START + 162) + +#define HID_SMA_OPERATOR_WIN (HID_SMA_START + 163) +#define HID_SMA_UNBINOPS_TBX (HID_SMA_START + 164) +#define HID_SMA_RELATIONS_TBX (HID_SMA_START + 165) +#define HID_SMA_SETOPERATIONS_TBX (HID_SMA_START + 166) +#define HID_SMA_FUNCTIONS_TBX (HID_SMA_START + 167) +#define HID_SMA_OPERATORS_TBX (HID_SMA_START + 168) +#define HID_SMA_ATTRIBUTES_TBX (HID_SMA_START + 169) +#define HID_SMA_BRACKETS_TBX (HID_SMA_START + 170) +#define HID_SMA_FORMAT_TBX (HID_SMA_START + 171) +#define HID_SMA_SELECTION_TBX (HID_SMA_START + 172) +#define HID_SMA_COMMAND_WIN (HID_SMA_START + 173) +#define HID_SMA_MISC_MENU (HID_SMA_START + 174) +#define HID_SMA_FUNCTIONSOTHER1_MENU (HID_SMA_START + 175) + +#define HID_SMA_ACUTEX (HID_SMA_START + 180) +#define HID_SMA_BARX (HID_SMA_START + 181) +#define HID_SMA_BREVEX (HID_SMA_START + 182) +#define HID_SMA_CHECKX (HID_SMA_START + 183) +#define HID_SMA_CIRCLEX (HID_SMA_START + 184) +#define HID_SMA_DOTX (HID_SMA_START + 185) +#define HID_SMA_DDOTX (HID_SMA_START + 186) +#define HID_SMA_DDDOTX (HID_SMA_START + 187) +#define HID_SMA_GRAVEX (HID_SMA_START + 188) +#define HID_SMA_HATX (HID_SMA_START + 189) +#define HID_SMA_TILDEX (HID_SMA_START + 190) +#define HID_SMA_VECX (HID_SMA_START + 191) +#define HID_SMA_UNDERLINEX (HID_SMA_START + 192) +#define HID_SMA_OVERLINEX (HID_SMA_START + 193) +#define HID_SMA_OVERSTRIKEX (HID_SMA_START + 194) +#define HID_SMA_PHANTOMX (HID_SMA_START + 195) +#define HID_SMA_BOLDX (HID_SMA_START + 196) +#define HID_SMA_ITALX (HID_SMA_START + 197) +#define HID_SMA_SIZEXY (HID_SMA_START + 198) +#define HID_SMA_FONTXY (HID_SMA_START + 199) +#define HID_SMA_COLORX (HID_SMA_START + 200) +#define HID_SMA_LRGROUPX (HID_SMA_START + 201) +#define HID_SMA_LRPARENTX (HID_SMA_START + 202) +#define HID_SMA_LRBRACKETX (HID_SMA_START + 203) +#define HID_SMA_LRBRACEX (HID_SMA_START + 204) +#define HID_SMA_LRANGLEX (HID_SMA_START + 205) +#define HID_SMA_LRCEILX (HID_SMA_START + 206) +#define HID_SMA_LRFLOORX (HID_SMA_START + 207) +#define HID_SMA_LRLINEX (HID_SMA_START + 208) +#define HID_SMA_LRDLINEX (HID_SMA_START + 209) +#define HID_SMA_SLRPARENTX (HID_SMA_START + 210) +#define HID_SMA_SLRBRACKETX (HID_SMA_START + 211) +#define HID_SMA_SLRBRACEX (HID_SMA_START + 212) +#define HID_SMA_SLRANGLEX (HID_SMA_START + 213) +#define HID_SMA_SLRCEILX (HID_SMA_START + 214) +#define HID_SMA_SLRFLOORX (HID_SMA_START + 215) +#define HID_SMA_SLRLINEX (HID_SMA_START + 216) +#define HID_SMA_SLRDLINEX (HID_SMA_START + 217) +#define HID_SMA_RSUBX (HID_SMA_START + 218) +#define HID_SMA_RSUPX (HID_SMA_START + 219) +#define HID_SMA_LSUBX (HID_SMA_START + 220) +#define HID_SMA_LSUPX (HID_SMA_START + 221) +#define HID_SMA_SBLANK (HID_SMA_START + 222) +#define HID_SMA_BLANK (HID_SMA_START + 223) +#define HID_SMA_NEWLINE (HID_SMA_START + 224) +#define HID_SMA_BINOMXY (HID_SMA_START + 225) +#define HID_SMA_STACK (HID_SMA_START + 226) +#define HID_SMA_MATRIX (HID_SMA_START + 227) +#define HID_SMA_ALIGNLX (HID_SMA_START + 228) +#define HID_SMA_ALIGNCX (HID_SMA_START + 229) +#define HID_SMA_ALIGNRX (HID_SMA_START + 230) +#define HID_SMA_ALEPH (HID_SMA_START + 231) +#define HID_SMA_EMPTYSET (HID_SMA_START + 232) +#define HID_SMA_RE (HID_SMA_START + 233) +#define HID_SMA_IM (HID_SMA_START + 234) +#define HID_SMA_INFINITY (HID_SMA_START + 235) +#define HID_SMA_PARTIAL (HID_SMA_START + 236) +#define HID_SMA_WP (HID_SMA_START + 237) +#define HID_SMA_DOTSAXIS (HID_SMA_START + 238) +#define HID_SMA_DOTSUP (HID_SMA_START + 239) +#define HID_SMA_DOTSDOWN (HID_SMA_START + 240) +#define HID_SMA_DOTSLOW (HID_SMA_START + 241) +#define HID_SMA_DOTSVERT (HID_SMA_START + 242) + +#define HID_SMA_SETN (HID_SMA2_START + 1) +#define HID_SMA_SETZ (HID_SMA2_START + 2) +#define HID_SMA_SETQ (HID_SMA2_START + 3) +#define HID_SMA_SETR (HID_SMA2_START + 4) +#define HID_SMA_SETC (HID_SMA2_START + 5) +#define HID_SMA_WIDEHATX (HID_SMA2_START + 6) +#define HID_SMA_WIDETILDEX (HID_SMA2_START + 7) +#define HID_SMA_WIDEVECX (HID_SMA2_START + 8) +#define HID_SMA_CSUBX (HID_SMA2_START + 9) +#define HID_SMA_CSUPX (HID_SMA2_START + 10) +#define HID_SMA_HBAR (HID_SMA2_START + 11) +#define HID_SMA_LAMBDABAR (HID_SMA2_START + 12) +#define HID_SMA_LEFTARROW (HID_SMA2_START + 13) +#define HID_SMA_RIGHTARROW (HID_SMA2_START + 14) +#define HID_SMA_UPARROW (HID_SMA2_START + 15) +#define HID_SMA_DOWNARROW (HID_SMA2_START + 16) + +#define HID_SMA_DEFAULT_DIST (HID_SMA2_START + 17) +#define HID_SMA_LINE_DIST (HID_SMA2_START + 18) +#define HID_SMA_ROOT_DIST (HID_SMA2_START + 19) +#define HID_SMA_SUP_DIST (HID_SMA2_START + 20) +#define HID_SMA_SUB_DIST (HID_SMA2_START + 21) +#define HID_SMA_NUMERATOR_DIST (HID_SMA2_START + 22) +#define HID_SMA_DENOMINATOR_DIST (HID_SMA2_START + 23) +#define HID_SMA_FRACLINE_EXCWIDTH (HID_SMA2_START + 24) +#define HID_SMA_FRACLINE_LINEWIDTH (HID_SMA2_START + 25) +#define HID_SMA_UPPERLIMIT_DIST (HID_SMA2_START + 26) +#define HID_SMA_LOWERLIMIT_DIST (HID_SMA2_START + 27) +#define HID_SMA_BRACKET_EXCHEIGHT (HID_SMA2_START + 28) +#define HID_SMA_BRACKET_DIST (HID_SMA2_START + 29) +#define HID_SMA_MATRIXROW_DIST (HID_SMA2_START + 30) +#define HID_SMA_MATRIXCOL_DIST (HID_SMA2_START + 31) +#define HID_SMA_ATTRIBUT_DIST (HID_SMA2_START + 32) +#define HID_SMA_INTERATTRIBUT_DIST (HID_SMA2_START + 33) +#define HID_SMA_OPERATOR_EXCHEIGHT (HID_SMA2_START + 34) +#define HID_SMA_OPERATOR_DIST (HID_SMA2_START + 35) +#define HID_SMA_LEFTBORDER_DIST (HID_SMA2_START + 36) +#define HID_SMA_RIGHTBORDER_DIST (HID_SMA2_START + 37) +#define HID_SMA_UPPERBORDER_DIST (HID_SMA2_START + 38) +#define HID_SMA_LOWERBORDER_DIST (HID_SMA2_START + 39) +#define HID_SMA_SCALE_ALL_BRACKETS (HID_SMA2_START + 40) +#define HID_SMA_BRACKET_EXCHEIGHT2 (HID_SMA2_START + 41) +#define HID_SMA_LMRANGLEXY (HID_SMA2_START + 42) +#define HID_SMA_SLMRANGLEXY (HID_SMA2_START + 43) +#define HID_SMA_XWIDESLASHY (HID_SMA2_START + 44) +#define HID_SMA_XWIDEBSLASHY (HID_SMA2_START + 45) +#define HID_SMA_XOVERBRACEY (HID_SMA2_START + 46) +#define HID_SMA_XUNDERBRACEY (HID_SMA2_START + 47) +#define HID_SMA_LRDBRACKETX (HID_SMA2_START + 48) +#define HID_SMA_SLRDBRACKETX (HID_SMA2_START + 49) + + +#define BMP_ARROW_RIGHT 1 + +#define MN_WIN 60 +#define MN_SUB_VIEW 31 +#define MN_SUB_TOOLBAR 32 +#define MN_SUB_GRAPHIC 33 +#define MN_SUB_SPELLING 34 +#define MN_SUB_TEMPLATES 35 + +// 342 == SCH_IF_SMAVIEWSHELL, da SFX_INTERFACE_LIB kein +// Define sondern neuerdings ein Enum ist +#define HID_SMA_VIEWSHELL_DOCUMENT (342) + +#endif + diff --git a/inc/bf_starmath/symbol.hxx b/inc/bf_starmath/symbol.hxx new file mode 100644 index 000000000..f97b17f9e --- /dev/null +++ b/inc/bf_starmath/symbol.hxx @@ -0,0 +1,196 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SYMBOL_HXX +#define SYMBOL_HXX + +#include <bf_svtools/bf_solar.h> + +#include <vcl/font.hxx> +#include <tools/debug.hxx> +#include <dynary.hxx> +#include <bf_svtools/lstner.hxx> +#include <bf_svtools/svarray.hxx> + +#include "utility.hxx" +#include <smmod.hxx> +#include <vector> + +namespace binfilter { + +#define SS_ATTR_ACCESS 0x80 + +#define SYMBOLSET_NONE 0xFFFF +#define SYMBOL_NONE 0xFFFF + +class SmSymSetManager; + +//////////////////////////////////////////////////////////////////////////////// + + + +/*N*/ inline const String GetUiSymbolName( const String &rExportSymbolName ) +/*N*/ { +/*N*/ return SM_MOD1()->GetLocSymbolData().GetUiSymbolName( rExportSymbolName ); +/*N*/ } + + + +/*N*/ inline const String GetUiSymbolSetName( const String &rExportSymbolSetName ) +/*N*/ { +/*N*/ return SM_MOD1()->GetLocSymbolData().GetUiSymbolSetName( rExportSymbolSetName ); +/*N*/ } + +//////////////////////////////////////////////////////////////////////////////// + +class SmSym +{ + friend class SmSymSetManager; + + + SmFace Face; + String Name; + String aExportName; + String aSetName; + SmSym *pHashNext; + SmSymSetManager *pSymSetManager; + sal_Unicode Character; + BYTE Attribut; + BOOL bPredefined; + BOOL bDocSymbol; + +public: + SmSym(); + SmSym(const SmSym& rSymbol); + SmSym(const String& rName, const Font& rFont, sal_Unicode cChar, + const String& rSet, BOOL bIsPredefined = FALSE); + + SmSym& operator = (const SmSym& rSymbol); + + + const Font& GetFace() const { return Face; } + sal_Unicode GetCharacter() const { return Character; } + const String& GetName() const { return Name; } + + void SetFace( const Font& rFont ) { Face = rFont; } + void SetCharacter( sal_Unicode cChar ) { Character = cChar; } + void SetName( const String &rTxt ) { Name = rTxt; } + + BOOL IsPredefined() const { return bPredefined; } + const String & GetSetName() const { return aSetName; } + void SetSetName( const String &rName ) { aSetName = rName; } + const String & GetExportName() const { return aExportName; } + void SetExportName( const String &rName ) { aExportName = rName; } + + BOOL IsDocSymbol() const { return bDocSymbol; } + void SetDocSymbol( BOOL bVal ) { bDocSymbol = bVal; } +}; + +typedef ::std::vector< SmSym* > SmListSym; +SV_DECL_PTRARR( SymbolArray, SmSym *, 32, 32 ) + +/**************************************************************************/ + +class SmSymSet +{ + friend class SmSymSetManager; + + SmListSym SymbolList; + String Name; + SmSymSetManager *pSymSetManager; + +public: + SmSymSet(const String& rName); + + + const String& GetName() const { return Name; } + size_t GetCount() const { return SymbolList.size(); } + + const SmSym& GetSymbol(USHORT SymbolNo) const + { + return *SymbolList[ SymbolNo ]; + } + + USHORT AddSymbol(SmSym* pSymbol); +}; + +DECLARE_DYNARRAY(SmArraySymSet, SmSymSet *) + +/**************************************************************************/ + + + +struct SmSymSetManager_Impl +{ + SmArraySymSet SymbolSets; + SmSymSetManager & rSymSetMgr; + SmSym** HashEntries; + USHORT NoSymbolSets; + USHORT NoHashEntries; + BOOL Modified; + + SmSymSetManager_Impl( SmSymSetManager &rMgr, USHORT HashTableSize ); + +}; + + +class SmSymSetManager : public SfxListener +{ + friend struct SmSymSetManager_Impl; + + SmSymSetManager_Impl *pImpl; + + + UINT32 GetHashIndex(const String& rSymbolName); + void EnterHashTable(SmSym& rSymbol); + void EnterHashTable(SmSymSet& rSymbolSet); + void FillHashTable(); + +public: + SmSymSetManager(USHORT HashTableSize = 137); + + + + USHORT AddSymbolSet(SmSymSet* pSymbolSet); + void ChangeSymbolSet(SmSymSet* pSymbolSet); + USHORT GetSymbolSetPos(const String& rSymbolSetName) const; + USHORT GetSymbolSetCount() const { return pImpl->NoSymbolSets; } + SmSymSet *GetSymbolSet(USHORT SymbolSetNo) const + { + return pImpl->SymbolSets.Get(SymbolSetNo); + } + + SmSym * GetSymbolByName(const String& rSymbolName); + const SmSym * GetSymbolByName(const String& rSymbolName) const + { + return ((SmSymSetManager *) this)->GetSymbolByName(rSymbolName); + } + + USHORT GetSymbolCount() const; + const SmSym * GetSymbolByPos( USHORT nPos ) const; + + BOOL IsModified() const { return pImpl->Modified; } + void SetModified(BOOL Modify) { pImpl->Modified = Modify; } + + void Load(); +}; + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/inc/bf_starmath/types.hxx b/inc/bf_starmath/types.hxx new file mode 100644 index 000000000..f28dadf4b --- /dev/null +++ b/inc/bf_starmath/types.hxx @@ -0,0 +1,184 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef TYPES_HXX +#define TYPES_HXX +namespace binfilter { + + +#define FONTNAME_MATH "StarSymbol" +#define FONTNAME_MATH2 "OpenSymbol" + +///////////////////////////////////////////////////////////////// + +enum SmPrintSize { PRINT_SIZE_NORMAL, PRINT_SIZE_SCALED, PRINT_SIZE_ZOOMED }; + +///////////////////////////////////////////////////////////////// +// enum definitions for characters from the 'StarSymbol' font +// (some chars have more than one alias!) +//! Note: not listed here does not(!) mean "not used" +//! (see %alpha ... %gamma for example) +// +enum MathSymbol +{ + MS_FACT = (xub_Unicode) 0x0021, + MS_INFINITY = (xub_Unicode) 0x221E, + MS_SLASH = (xub_Unicode) 0x002F, + + MS_NDIVIDES = (xub_Unicode) 0x2224, + MS_DRARROW = (xub_Unicode) 0x21D2, + MS_DLARROW = (xub_Unicode) 0x21D0, + MS_DLRARROW = (xub_Unicode) 0x21D4, + MS_UNDERBRACE = (xub_Unicode) 0xE081, + MS_OVERBRACE = (xub_Unicode) 0xE082, + MS_CIRC = (xub_Unicode) 0x00B0, + MS_ASSIGN = (xub_Unicode) 0x003D, + MS_ERROR = (xub_Unicode) 0x00BF, + + MS_NEQ = (xub_Unicode) 0x2260, + MS_PLUS = (xub_Unicode) 0xE083, + MS_MINUS = (xub_Unicode) 0x2212, + MS_MULTIPLY = (xub_Unicode) 0x2217, + MS_TIMES = (xub_Unicode) 0x00D7, + MS_CDOT = (xub_Unicode) 0x22C5, + MS_DIV = (xub_Unicode) 0x00F7, + MS_PLUSMINUS = (xub_Unicode) 0x00B1, + MS_MINUSPLUS = (xub_Unicode) 0x2213, + MS_OPLUS = (xub_Unicode) 0x2295, + MS_OMINUS = (xub_Unicode) 0x2296, + MS_OTIMES = (xub_Unicode) 0x2297, + MS_ODIVIDE = (xub_Unicode) 0x2298, + MS_ODOT = (xub_Unicode) 0x2299, + MS_UNION = (xub_Unicode) 0x222A, + MS_INTERSECT = (xub_Unicode) 0x2229, + + MS_LT = (xub_Unicode) 0xE084, + MS_GT = (xub_Unicode) 0xE085, + MS_LE = (xub_Unicode) 0x2264, + MS_GE = (xub_Unicode) 0x2265, + MS_LESLANT = (xub_Unicode) 0xE086, + MS_GESLANT = (xub_Unicode) 0xE087, + MS_LL = (xub_Unicode) 0x226A, + MS_GG = (xub_Unicode) 0x226B, + MS_SIM = (xub_Unicode) 0x007E, + MS_SIMEQ = (xub_Unicode) 0x2243, + MS_APPROX = (xub_Unicode) 0x2248, + MS_DEF = (xub_Unicode) 0x225D, + MS_EQUIV = (xub_Unicode) 0x2261, + MS_PROP = (xub_Unicode) 0x221D, + MS_PARTIAL = (xub_Unicode) 0x2202, + MS_SUBSET = (xub_Unicode) 0x2282, + + MS_SUPSET = (xub_Unicode) 0x2283, + MS_SUBSETEQ = (xub_Unicode) 0x2286, + MS_SUPSETEQ = (xub_Unicode) 0x2287, + MS_NSUBSET = (xub_Unicode) 0x2284, + MS_NSUPSET = (xub_Unicode) 0x2285, + MS_NSUBSETEQ = (xub_Unicode) 0x2288, + MS_NSUPSETEQ = (xub_Unicode) 0x2289, + MS_IN = (xub_Unicode) 0x2208, + MS_NOTIN = (xub_Unicode) 0x2209, + MS_EXISTS = (xub_Unicode) 0x2203, + MS_BACKEPSILON = (xub_Unicode) 0x220D, + MS_ALEPH = (xub_Unicode) 0x2135, + MS_IM = (xub_Unicode) 0x2111, + MS_RE = (xub_Unicode) 0x211C, + MS_WP = (xub_Unicode) 0x2118, + + MS_LINE = (xub_Unicode) 0x2223, + MS_DLINE = (xub_Unicode) 0x2225, + MS_ORTHO = (xub_Unicode) 0x22A5, + MS_DOTSLOW = (xub_Unicode) 0xE08B, + MS_DOTSAXIS = (xub_Unicode) 0x22EF, + MS_DOTSVERT = (xub_Unicode) 0x22EE, + MS_DOTSUP = (xub_Unicode) 0x22F0, + MS_DOTSDOWN = (xub_Unicode) 0x22F1, + MS_TRANSR = (xub_Unicode) 0x22B6, + MS_TRANSL = (xub_Unicode) 0x22B7, + MS_RIGHTARROW = (xub_Unicode) 0xE08C, + MS_BACKSLASH = (xub_Unicode) 0x2216, + MS_NEG = (xub_Unicode) 0x00AC, + + MS_INT = (xub_Unicode) 0x222B, + MS_IINT = (xub_Unicode) 0x222C, + MS_IIINT = (xub_Unicode) 0x222D, + MS_LINT = (xub_Unicode) 0x222E, + MS_LLINT = (xub_Unicode) 0x222F, + MS_LLLINT = (xub_Unicode) 0x2230, + MS_SQRT = (xub_Unicode) 0xE08D, + MS_SQRT2 = (xub_Unicode) 0xE08F, + MS_COPROD = (xub_Unicode) 0x2210, + MS_PROD = (xub_Unicode) 0x220F, + MS_SUM = (xub_Unicode) 0x2211, + MS_NABLA = (xub_Unicode) 0x2207, + MS_FORALL = (xub_Unicode) 0x2200, + + MS_HAT = (xub_Unicode) 0xE091, + MS_CHECK = (xub_Unicode) 0xE092, + MS_BREVE = (xub_Unicode) 0xE093, + MS_ACUTE = (xub_Unicode) 0xE094, + MS_GRAVE = (xub_Unicode) 0xE095, + MS_TILDE = (xub_Unicode) 0xE096, + MS_BAR = (xub_Unicode) 0xE097, + MS_VEC = (xub_Unicode) 0xE098, + MS_DOT = (xub_Unicode) 0x02D9, + MS_DDOT = (xub_Unicode) 0x00A8, + MS_DDDOT = (xub_Unicode) 0xE09B, + MS_CIRCLE = (xub_Unicode) 0x02DA, + MS_AND = (xub_Unicode) 0x2227, + MS_OR = (xub_Unicode) 0x2228, + MS_NI = (xub_Unicode) 0x220B, + MS_EMPTYSET = (xub_Unicode) 0x2205, + + MS_LBRACE = (xub_Unicode) 0x007B, + MS_RBRACE = (xub_Unicode) 0x007D, + MS_LPARENT = (xub_Unicode) 0xE09E, + MS_RPARENT = (xub_Unicode) 0xE09F, + MS_LANGLE = (xub_Unicode) 0x2329, + MS_RANGLE = (xub_Unicode) 0x232A, + MS_LBRACKET = (xub_Unicode) 0x005B, + MS_RBRACKET = (xub_Unicode) 0x005D, + + MS_LDBRACKET = (xub_Unicode) 0x301A, + MS_RDBRACKET = (xub_Unicode) 0x301B, + MS_PLACE = (xub_Unicode) 0xE0AA, + + MS_LCEIL = (xub_Unicode) 0x2308, + MS_LFLOOR = (xub_Unicode) 0x230A, + MS_RCEIL = (xub_Unicode) 0x2309, + MS_RFLOOR = (xub_Unicode) 0x230B, + MS_SQRT2_X = (xub_Unicode) 0xE0AB, + + MS_TOP = (xub_Unicode) 0xE0D9, + MS_HBAR = (xub_Unicode) 0x210F, + MS_LAMBDABAR = (xub_Unicode) 0x019B, + MS_LEFTARROW = (xub_Unicode) 0xE0DB, + MS_UPARROW = (xub_Unicode) 0xE0DC, + MS_DOWNARROW = (xub_Unicode) 0xE0DD, + MS_SETN = (xub_Unicode) 0x2115, + MS_SETZ = (xub_Unicode) 0x2124, + MS_SETQ = (xub_Unicode) 0x211A, + MS_SETR = (xub_Unicode) 0x211D, + MS_SETC = (xub_Unicode) 0x2102 +}; + + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/inc/bf_starmath/unomodel.hxx b/inc/bf_starmath/unomodel.hxx new file mode 100644 index 000000000..81a499670 --- /dev/null +++ b/inc/bf_starmath/unomodel.hxx @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef UNOMODEL_HXX +#define UNOMODEL_HXX + +#include <bf_svtools/bf_solar.h> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/view/XRenderable.hpp> +#include <bf_sfx2/sfxbasemodel.hxx> +#include <comphelper/propertysethelper.hxx> +namespace binfilter { + +class SmFormat; + +//----------------------------------------------------------------------------- +class SmModel : public SfxBaseModel, + public comphelper::PropertySetHelper, + public ::com::sun::star::lang::XServiceInfo, + public ::com::sun::star::lang::XUnoTunnel, + public ::com::sun::star::view::XRenderable +{ +protected: + virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ); + virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ); +public: + SmModel( SfxObjectShell *pObjSh = 0 ); + virtual ~SmModel() throw (); + + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire( ) throw(); + virtual void SAL_CALL release( ) throw(); + + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + //XRenderable + virtual sal_Int32 SAL_CALL getRendererCount( const ::com::sun::star::uno::Any& rSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rxOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRenderer( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& rSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rxOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL render( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& rSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rxOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName(void) + throw( ::com::sun::star::uno::RuntimeException ); + virtual BOOL SAL_CALL supportsService(const ::rtl::OUString& ServiceName) + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) + throw( ::com::sun::star::uno::RuntimeException ); + + inline ::rtl::OUString getImplementationName_Static() throw( ); +}; + +inline ::rtl::OUString SmModel::getImplementationName_Static() throw( ) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "math.SmModel" )); +} + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/inc/bf_starmath/utility.hxx b/inc/bf_starmath/utility.hxx new file mode 100644 index 000000000..854623922 --- /dev/null +++ b/inc/bf_starmath/utility.hxx @@ -0,0 +1,277 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef UTILITY_HXX +#define UTILITY_HXX + +#include <bf_svtools/bf_solar.h> +#include <bf_tools/string.hxx> +#include <bf_sfx2/minarray.hxx> +#include <vcl/font.hxx> +#include <vcl/fixed.hxx> +#include <vcl/combobox.hxx> +#include <vcl/lstbox.hxx> +#include <tools/fract.hxx> +namespace binfilter { + +class String; + +class SmRect; + + +#define C2S(cChar) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(cChar)) + +///////////////////////////////////////////////////////////////// + +const String ImportString( const ByteString& rByteString ); + +///////////////////////////////////////////////////////////////// + +inline long SmPtsTo100th_mm(long nNumPts) + // returns the length (in 100th of mm) that corresponds to the length + // 'nNumPts' (in units points). + // 72.27 [pt] = 1 [inch] = 2,54 [cm] = 2540 [100th of mm]. + // result is being rounded to the nearest integer. +{ + DBG_ASSERT(nNumPts >= 0, "Sm : Ooops..."); + // broken into multiple and fraction of 'nNumPts' to reduce chance + // of overflow + // (7227 / 2) is added in order to round to the nearest integer + return 35 * nNumPts + (nNumPts * 1055L + (7227 / 2)) / 7227L; +} + + +inline long SmPtsTo100th_mm(const Fraction &rNumPts) + // as above but with argument 'rNumPts' as 'Fraction' +{ + Fraction aTmp (254000L, 7227L); + return aTmp *= rNumPts; +} + + +inline Fraction Sm100th_mmToPts(long nNum100th_mm) + // returns the length (in points) that corresponds to the length + // 'nNum100th_mm' (in 100th of mm). +{ + DBG_ASSERT(nNum100th_mm >= 0, "Sm : Ooops..."); + Fraction aTmp (7227L, 254000L); + return aTmp *= Fraction(nNum100th_mm); +} + + +inline long SmRoundFraction(const Fraction &rFrac) +{ + DBG_ASSERT(rFrac > Fraction(), "Sm : Ooops..."); + return (rFrac.GetNumerator() + rFrac.GetDenominator() / 2) / rFrac.GetDenominator(); +} + + +class SmViewShell; +SmViewShell * SmGetActiveView(); + + +//////////////////////////////////////////////////////////// + +class SmFace; + +SvStream& operator >> (SvStream& rStream, SmFace& rFont); + +void ReadSM20Font(SvStream& rStream, Font& rFont); + + +//////////////////////////////////////////////////////////// +// +// SmRectCache +// + +class SmRectCache +{ + VirtualDevice *pVirDev; + + SmRectCache(const SmRectCache &); + SmRectCache & operator = (const SmRectCache &); + +public: + struct Key + { XubString aText, + aFontName; + Size aFontSize; + FontWeight eFontWeight; + FontItalic eFontItalic; + + Key(const XubString& /* rText */, const Font& /* rFont */) {} + }; + + SmRectCache(); + ~SmRectCache(); + + const SmRect * Search(const Key & /* rKey */) const { return 0; } + + const SmRect * Add(const Key& /* rKey */, const SmRect& /* rRect */) + { return (const SmRect *)-1; } + + VirtualDevice * GetVirDev(); + + void Reset() {}; +}; + + +//////////////////////////////////////////////////////////// +// +// SmFace +// + + +class SmFace : public Font +{ + long nBorderWidth; + + void Impl_Init(); + +public: + SmFace() : + Font(), nBorderWidth(-1) { Impl_Init(); } + SmFace(const Font& rFont) : + Font(rFont), nBorderWidth(-1) { Impl_Init(); } + SmFace(const String& rName, const Size& rSize) : + Font(rName, rSize), nBorderWidth(-1) { Impl_Init(); } + SmFace( FontFamily eFamily, const Size& rSize) : + Font(eFamily, rSize), nBorderWidth(-1) { Impl_Init(); } + + SmFace(const SmFace &rFace) : + Font(rFace), nBorderWidth(-1) { Impl_Init(); } + + // overloaded version in order to supply a min value + // for font size (height). (Also used in ctor's to do so.) + void SetSize(const Size& rSize); + + void SetBorderWidth(long nWidth) { nBorderWidth = nWidth; } + long GetBorderWidth() const; + long GetDefaultBorderWidth() const { return GetSize().Height() / 20 ; } + void FreezeBorderWidth() { nBorderWidth = GetDefaultBorderWidth(); } + + SmFace & operator = (const SmFace &rFace); +}; + +SmFace & operator *= (SmFace &rFace, const Fraction &rFrac); + + +//////////////////////////////////////////////////////////// +// +// SmPickList +// + +class SmPickList : public SfxPtrArr +{ +protected: + USHORT nSize; + + virtual void *CreateItem(const String& rString) = 0; + virtual void *CreateItem(const void *pItem) = 0; + virtual void DestroyItem(void *pItem) = 0; + + virtual BOOL CompareItem(const void *pFirstItem, const void *pSecondItem) const = 0; + + virtual String GetStringItem(void *pItem) = 0; + + virtual void LoadItem(SvStream& rStream, void *pItem) = 0; + virtual void SaveItem(SvStream& rStream, const void *pItem) const = 0; + + void *GetPtr(USHORT nPos) const { return SfxPtrArr::GetObject(nPos); } + void *&GetPtr(USHORT nPos) { return SfxPtrArr::GetObject(nPos); } + void RemovePtr(USHORT nPos, USHORT nCount = 1) { SfxPtrArr::Remove(nPos, nCount); } + + SmPickList(USHORT nInitSize = 0, USHORT nMaxSize = 5); + ~SmPickList(); + +public: + void *Get(USHORT nPos = 0) const { return GetPtr(nPos); } + + void *operator [] (USHORT nPos) const { return GetPtr(nPos); } + + USHORT GetSize() const { return nSize; } + USHORT Count() const { return SfxPtrArr::Count(); } + + void Clear(); + +}; + +//////////////////////////////////////////////////////////// +// +// SmFontPickList +// + +class SmFontDialog; + +class SmFontPickList : public SmPickList +{ +protected: + virtual void *CreateItem(const String& /* rString */) + { return NULL; } + + virtual void *CreateItem(const void* /* pItem */) + { return NULL; } + + virtual void DestroyItem(void* /* pItem */) + {} + + virtual BOOL CompareItem(const void * /*pFirstItem*/, const void * /*pSecondItem*/) const + { return FALSE; } + + virtual String GetStringItem(void *pItem); + + virtual void LoadItem(SvStream& /* rStream */, void* /* pItem */) {} + virtual void SaveItem(SvStream& /* rStream */, const void* /* pItem */) const {}; + +public: + SmFontPickList() + : SmPickList(0, 5) {} + SmFontPickList(USHORT nInitSize, USHORT nMaxSize) + : SmPickList(nInitSize, nMaxSize) {} + SmFontPickList(const SmPickList& rOrig ) + : SmPickList(rOrig) {} + virtual ~SmFontPickList() { Clear(); } + + + inline BOOL Contains(const Font &rFont) const; + inline Font Get(USHORT nPos = 0) const; + + inline SmFontPickList& operator = (const SmFontPickList& rList); + inline Font operator [] (USHORT nPos) const; + +}; + +inline SmFontPickList& SmFontPickList::operator = (const SmFontPickList& rList) +{ + *(SmPickList *)this = *(SmPickList *)&rList; return *this; +} + +inline Font SmFontPickList::operator [] (USHORT nPos) const +{ + return *((Font *)SmPickList::operator[](nPos)); +} + +inline Font SmFontPickList::Get(USHORT nPos) const +{ + return nPos < Count() ? *((Font *)SmPickList::Get(nPos)) : Font(); +} + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |