diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-07-13 14:38:37 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-07-13 14:38:37 +0200 |
commit | b50b76d1d7f70e5c9702ad8b885acba1ee216e6d (patch) | |
tree | 5a1bdc2089fd554fc9974218016b3a390779da9f /starmath/inc | |
parent | c80988b0107424ba6de85531ed55fd493a0a64cb (diff) | |
parent | 5c62576e5d8af7379a57b45392d3c51c0bcd0fcc (diff) |
CWS changehid: resync to m84
Diffstat (limited to 'starmath/inc')
-rw-r--r-- | starmath/inc/dialog.hxx | 85 | ||||
-rw-r--r-- | starmath/inc/node.hxx | 13 | ||||
-rw-r--r-- | starmath/inc/parse.hxx | 2 | ||||
-rw-r--r-- | starmath/inc/smmod.hxx | 5 | ||||
-rw-r--r-- | starmath/inc/starmath.hrc | 2 | ||||
-rw-r--r-- | starmath/inc/symbol.hxx | 176 |
6 files changed, 115 insertions, 168 deletions
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index 1b21f6696f71..ad4e69c7308a 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -300,7 +300,7 @@ public: class SmShowSymbolSet : public Control { - SmSymSet aSymbolSet; + SymbolPtrVec_t aSymbolSet; ScrollBar aVScrollBar; Size aOutputSize; Link aSelectHdlLink; @@ -318,7 +318,7 @@ class SmShowSymbolSet : public Control public: SmShowSymbolSet(Window *pParent, const ResId& rResId); - void SetSymbolSet(const SmSymSet& rSymbolSet); + void SetSymbolSet(const SymbolPtrVec_t& rSymbolSet); void SelectSymbol(USHORT nSymbol); USHORT GetSelectSymbol() const { return nSelectSymbol; } @@ -360,8 +360,10 @@ class SmSymbolDialog : public ModalDialog PushButton aEditBtn; SmViewShell &rViewSh; - SmSymSetManager &rSymSetMgr; - const SmSymSet *pSymSet; + SmSymbolManager &rSymbolMgr; + + String aSymbolSetName; + SymbolPtrVec_t aSymbolSet; OutputDevice *pFontListDev; @@ -373,7 +375,7 @@ class SmSymbolDialog : public ModalDialog DECL_LINK(GetClickHdl, Button *); void FillSymbolSets(BOOL bDeleteText = TRUE); - void SetSymbolSetManager(SmSymSetManager &rMgr); + void SetSymbolSetManager(SmSymbolManager &rMgr); const SmSym *GetSymbol() const; void InitColor_Impl(); @@ -381,7 +383,7 @@ class SmSymbolDialog : public ModalDialog public: SmSymbolDialog(Window * pParent, OutputDevice *pFntListDevice, - SmSymSetManager &rSymSetMgr, SmViewShell &rViewShell, BOOL bFreeRes = TRUE); + SmSymbolManager &rSymbolMgr, SmViewShell &rViewShell, BOOL bFreeRes = TRUE); virtual ~SmSymbolDialog(); BOOL SelectSymbolSet(const XubString &rSymbolSetName); @@ -439,8 +441,8 @@ class SmSymDefineDialog : public ModalDialog Image aRigthArrow_Im; Image aRigthArrow_Im_HC; // hi-contrast version - SmSymSetManager aSymSetMgrCopy, - &rSymSetMgr; + SmSymbolManager aSymbolMgrCopy, + &rSymbolMgr; const SmSym *pOrigSymbol; const SubsetMap *pSubsetMap; @@ -462,7 +464,7 @@ class SmSymDefineDialog : public ModalDialog void FillFonts(BOOL bDeleteText = TRUE); void FillStyles(BOOL bDeleteText = TRUE); - void SetSymbolSetManager(const SmSymSetManager &rMgr); + void SetSymbolSetManager(const SmSymbolManager &rMgr); void SetFont(const XubString &rFontName, const XubString &rStyleName); void SetOrigSymbol(const SmSym *pSymbol, const XubString &rSymbolSetName); void UpdateButtons(); @@ -474,18 +476,18 @@ class SmSymDefineDialog : public ModalDialog BOOL SelectFont(const XubString &rFontName, BOOL bApplyFont); BOOL SelectStyle(const XubString &rStyleName, BOOL bApplyFont); - - SmSymSet *GetSymbolSet(const ComboBox &rComboBox); - inline const SmSymSet *GetSymbolSet(const ComboBox &rComboBox) const; - SmSym *GetSymbol(const ComboBox &rComboBox); - inline const SmSym *GetSymbol(const ComboBox &rComboBox) const; + SmSym * GetSymbol(const ComboBox &rComboBox); + const SmSym * GetSymbol(const ComboBox &rComboBox) const + { + return ((SmSymDefineDialog *) this)->GetSymbol(rComboBox); + } void InitColor_Impl(); virtual void DataChanged( const DataChangedEvent& rDCEvt ); public: - SmSymDefineDialog(Window *pParent, OutputDevice *pFntListDevice, SmSymSetManager &rMgr, BOOL bFreeRes = TRUE); + SmSymDefineDialog(Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr, BOOL bFreeRes = TRUE); ~SmSymDefineDialog(); using OutputDevice::SetFont; @@ -493,44 +495,31 @@ public: // Dialog virtual short Execute(); - inline BOOL SelectOldSymbolSet(const XubString &rSymbolSetName); - inline BOOL SelectOldSymbol(const XubString &rSymbolName); - inline BOOL SelectSymbolSet(const XubString &rSymbolSetName); - inline BOOL SelectSymbol(const XubString &rSymbolName); - BOOL SelectFont(const XubString &rFontName) { return SelectFont(rFontName, TRUE); } - BOOL SelectStyle(const XubString &rStyleName) { return SelectStyle(rStyleName, TRUE); }; - void SelectChar(xub_Unicode cChar); -}; - -inline const SmSymSet * SmSymDefineDialog::GetSymbolSet(const ComboBox &rComboBox) const -{ - return ((SmSymDefineDialog *) this)->GetSymbolSet(rComboBox); -} + BOOL SelectOldSymbolSet(const XubString &rSymbolSetName) + { + return SelectSymbolSet(aOldSymbolSets, rSymbolSetName, FALSE); + } -inline const SmSym * SmSymDefineDialog::GetSymbol(const ComboBox &rComboBox) const -{ - return ((SmSymDefineDialog *) this)->GetSymbol(rComboBox); -} + BOOL SelectOldSymbol(const XubString &rSymbolName) + { + return SelectSymbol(aOldSymbols, rSymbolName, FALSE); + } -inline BOOL SmSymDefineDialog::SelectOldSymbolSet(const XubString &rSymbolSetName) -{ - return SelectSymbolSet(aOldSymbolSets, rSymbolSetName, FALSE); -} + BOOL SelectSymbolSet(const XubString &rSymbolSetName) + { + return SelectSymbolSet(aSymbolSets, rSymbolSetName, FALSE); + } -inline BOOL SmSymDefineDialog::SelectOldSymbol(const XubString &rSymbolName) -{ - return SelectSymbol(aOldSymbols, rSymbolName, FALSE); -} + BOOL SelectSymbol(const XubString &rSymbolName) + { + return SelectSymbol(aSymbols, rSymbolName, FALSE); + } -inline BOOL SmSymDefineDialog::SelectSymbolSet(const XubString &rSymbolSetName) -{ - return SelectSymbolSet(aSymbolSets, rSymbolSetName, FALSE); -} + BOOL SelectFont(const XubString &rFontName) { return SelectFont(rFontName, TRUE); } + BOOL SelectStyle(const XubString &rStyleName) { return SelectStyle(rStyleName, TRUE); }; + void SelectChar(xub_Unicode cChar); +}; -inline BOOL SmSymDefineDialog::SelectSymbol(const XubString &rSymbolName) -{ - return SelectSymbol(aSymbols, rSymbolName, FALSE); -} #endif diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index f9fed9c9602a..6ef89ea5ec1b 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -484,15 +484,24 @@ public: class SmLineNode : public SmStructureNode { + BOOL bUseExtraSpaces; + protected: SmLineNode(SmNodeType eNodeType, const SmToken &rNodeToken) : SmStructureNode(eNodeType, rNodeToken) - {} + { + bUseExtraSpaces = TRUE; + } public: SmLineNode(const SmToken &rNodeToken) : SmStructureNode(NLINE, rNodeToken) - {} + { + bUseExtraSpaces = TRUE; + } + + void SetUseExtraSpaces(BOOL bVal) { bUseExtraSpaces = bVal; } + BOOL IsUseExtraSpaces() const { return bUseExtraSpaces; }; virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell); virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index b3ad5ef5bdc3..facf17d561e2 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -106,7 +106,7 @@ enum SmTokenType TLEFTARROW, TRIGHTARROW, TUPARROW, TDOWNARROW, TDIVIDES, TNDIBVIDES, TSETN, TSETZ, TSETQ, TSETR, TSETC, TWIDEVEC, TWIDETILDE, TWIDEHAT, TWIDESLASH, - TWIDEBACKSLASH, TLDBRACKET, TRDBRACKET, + TWIDEBACKSLASH, TLDBRACKET, TRDBRACKET, TNOSPACE, TUNKNOWN, TDEBUG }; diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx index 1dd4792e72d8..4de625e449e1 100644 --- a/starmath/inc/smmod.hxx +++ b/starmath/inc/smmod.hxx @@ -47,7 +47,7 @@ class SvxErrorHandler; class SfxObjectFactory; class SmConfig; class SmModule; -class SmSymSetManager; +class SmSymbolManager; /************************************************************************* |* @@ -148,7 +148,7 @@ public: svtools::ColorConfig & GetColorConfig(); SmConfig * GetConfig(); - SmSymSetManager & GetSymSetManager(); + SmSymbolManager & GetSymbolManager(); SmLocalizedSymbolData & GetLocSymbolData() const; @@ -175,7 +175,6 @@ public: }; #define SM_MOD() ( *(SmModule**) GetAppData(SHL_SM) ) -#define SM_MOD1() ( *(SmModule**) GetAppData(SHL_SM) ) #endif // _SDMOD_HXX diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index ffc06d6174e9..9f3777e7512c 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -379,6 +379,7 @@ #define RID_LSUPX (RID_APP_START + 1916) #define RID_CSUBX (RID_APP_START + 1917) #define RID_CSUPX (RID_APP_START + 1918) +#define RID_NOSPACE (RID_APP_START + 1919) #define RID_ALEPH (RID_APP_START + 2001) #define RID_EMPTYSET (RID_APP_START + 2002) @@ -749,6 +750,7 @@ #define HID_SMA_CONTROL_SYMBOLSET_VIEW "STARMATH_HID_SMA_CONTROL_SYMBOLSET_VIEW" #define HID_SMA_CONTROL_FONTCHAR_VIEW "STARMATH_HID_SMA_CONTROL_FONTCHAR_VIEW" +#define HID_SMA_NOSPACE "STARMATH_HID_SMA_NOSPACE" #define BMP_ARROW_RIGHT 1 #define MN_WIN 60 diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx index 8c8df60c2c6e..503859485095 100644 --- a/starmath/inc/symbol.hxx +++ b/starmath/inc/symbol.hxx @@ -28,198 +28,146 @@ #define SYMBOL_HXX #include <vos/refernce.hxx> -#ifndef _FONT_HXX //autogen #include <vcl/font.hxx> -#endif #include <tools/list.hxx> #include <tools/debug.hxx> #include <tools/dynary.hxx> #include <svl/lstner.hxx> #include <svl/svarray.hxx> + +#include <map> +#include <vector> +#include <set> + #include "utility.hxx" -#include <smmod.hxx> +#include "smmod.hxx" -#define SS_ATTR_ACCESS 0x80 #define SYMBOLSET_NONE 0xFFFF #define SYMBOL_NONE 0xFFFF -class SmSymSetManager; //////////////////////////////////////////////////////////////////////////////// inline const String GetExportSymbolName( const String &rUiSymbolName ) { - return SM_MOD1()->GetLocSymbolData().GetExportSymbolName( rUiSymbolName ); + return SM_MOD()->GetLocSymbolData().GetExportSymbolName( rUiSymbolName ); } inline const String GetUiSymbolName( const String &rExportSymbolName ) { - return SM_MOD1()->GetLocSymbolData().GetUiSymbolName( rExportSymbolName ); + return SM_MOD()->GetLocSymbolData().GetUiSymbolName( rExportSymbolName ); } inline const String GetExportSymbolSetName( const String &rUiSymbolSetName ) { - return SM_MOD1()->GetLocSymbolData().GetExportSymbolSetName( rUiSymbolSetName ); + return SM_MOD()->GetLocSymbolData().GetExportSymbolSetName( rUiSymbolSetName ); } inline const String GetUiSymbolSetName( const String &rExportSymbolSetName ) { - return SM_MOD1()->GetLocSymbolData().GetUiSymbolSetName( rExportSymbolSetName ); + return SM_MOD()->GetLocSymbolData().GetUiSymbolSetName( rExportSymbolSetName ); } //////////////////////////////////////////////////////////////////////////////// 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; + SmFace m_aFace; + String m_aName; + String m_aExportName; + String m_aSetName; + sal_Unicode m_cChar; + BOOL m_bPredefined; + BOOL m_bDocSymbol; public: SmSym(); - SmSym(const SmSym& rSymbol); SmSym(const String& rName, const Font& rFont, sal_Unicode cChar, const String& rSet, BOOL bIsPredefined = FALSE); + SmSym(const SmSym& rSymbol); SmSym& operator = (const SmSym& rSymbol); - const Font& GetFace() const { return Face; } - sal_Unicode GetCharacter() const { return Character; } - const String& GetName() const { return Name; } + const Font& GetFace() const { return m_aFace; } + sal_Unicode GetCharacter() const { return m_cChar; } + const String& GetName() const { return m_aName; } - void SetFace( const Font& rFont ) { Face = rFont; } - void SetCharacter( sal_Unicode cChar ) { Character = cChar; } - void SetName( const String &rTxt ) { Name = rTxt; } + void SetFace( const Font& rFont ) { m_aFace = rFont; } + void SetCharacter( sal_Unicode cChar ) { m_cChar = cChar; } - 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; } +//! since the symbol name is also used as key in the map it should not be possible to change the name +//! because ten the key would not be the same as its supposed copy here +// void SetName( const String &rTxt ) { m_aName = rTxt; } - BOOL IsDocSymbol() const { return bDocSymbol; } - void SetDocSymbol( BOOL bVal ) { bDocSymbol = bVal; } -}; + BOOL IsPredefined() const { return m_bPredefined; } + const String & GetSymbolSetName() const { return m_aSetName; } + void SetSymbolSetName( const String &rName ) { m_aSetName = rName; } + const String & GetExportName() const { return m_aExportName; } + void SetExportName( const String &rName ) { m_aExportName = rName; } + + BOOL IsDocSymbol() const { return m_bDocSymbol; } + void SetDocSymbol( BOOL bVal ) { m_bDocSymbol = bVal; } -DECLARE_LIST(SmListSym, SmSym *) -SV_DECL_PTRARR( SymbolArray, SmSym *, 32, 32 ) + // true if rSymbol has the same name, font and character + bool IsEqualInUI( const SmSym& rSymbol ) const; +}; /**************************************************************************/ -class SmSymSet +struct lt_String { - friend class SmSymSetManager; - - SmListSym SymbolList; - String Name; - SmSymSetManager *pSymSetManager; - -public: - SmSymSet(); - SmSymSet(const SmSymSet& rSymbolSet); - SmSymSet(const String& rName); - ~SmSymSet(); - - SmSymSet& operator = (const SmSymSet& rSymbolSet); - - const String& GetName() const { return Name; } - USHORT GetCount() const { return (USHORT) SymbolList.Count(); } - - const SmSym& GetSymbol(USHORT SymbolNo) const + bool operator()( const String &r1, const String &r2 ) const { - DBG_ASSERT(SymbolList.GetObject(SymbolNo), "Symbol nicht vorhanden"); - return *SymbolList.GetObject(SymbolNo); + // r1 < r2 ? + return r1.CompareTo( r2 ) == COMPARE_LESS; } - - USHORT AddSymbol(SmSym* pSymbol); - void DeleteSymbol(USHORT SymbolNo); - SmSym * RemoveSymbol(USHORT SymbolNo); - USHORT GetSymbolPos(const String& rName); }; -DECLARE_DYNARRAY(SmArraySymSet, SmSymSet *) - -/**************************************************************************/ - -class SmSymbolDialog; - - -struct SmSymSetManager_Impl -{ - SmArraySymSet SymbolSets; - SmSymSetManager & rSymSetMgr; - SmSym** HashEntries; - USHORT NoSymbolSets; - USHORT NoHashEntries; - BOOL Modified; - - SmSymSetManager_Impl( SmSymSetManager &rMgr, USHORT HashTableSize ); - ~SmSymSetManager_Impl(); - SmSymSetManager_Impl & operator = ( const SmSymSetManager_Impl &rImpl ); -}; +// type of the actual container to hold the symbols +typedef std::map< String, SmSym, lt_String > SymbolMap_t; +// vector of pointers to the actual symbols in the above container +typedef std::vector< const SmSym * > SymbolPtrVec_t; -class SmSymSetManager : public SfxListener +class SmSymbolManager : public SfxListener { - friend struct SmSymSetManager_Impl; - - SmSymSetManager_Impl *pImpl; + SymbolMap_t m_aSymbols; + bool m_bModified; virtual void SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType); - UINT32 GetHashIndex(const String& rSymbolName); - void EnterHashTable(SmSym& rSymbol); - void EnterHashTable(SmSymSet& rSymbolSet); - void FillHashTable(); void Init(); void Exit(); public: - SmSymSetManager(USHORT HashTableSize = 137); - SmSymSetManager(const SmSymSetManager& rSymbolSetManager); - ~SmSymSetManager(); + SmSymbolManager(); + SmSymbolManager(const SmSymbolManager& rSymbolSetManager); + ~SmSymbolManager(); - SmSymSetManager& operator = (const SmSymSetManager& rSymbolSetManager); + SmSymbolManager & operator = (const SmSymbolManager& rSymbolSetManager); - void GetSymbols( std::vector< SmSym > &rSymbols ) const; + // symbol sets are for UI purpose only, thus we assemble them here + std::set< String > GetSymbolSetNames() const; + const SymbolPtrVec_t GetSymbolSet( const String& rSymbolSetName ); - - USHORT AddSymbolSet(SmSymSet* pSymbolSet); - void ChangeSymbolSet(SmSymSet* pSymbolSet); - void DeleteSymbolSet(USHORT SymbolSetNo); - USHORT GetSymbolSetPos(const String& rSymbolSetName) const; - USHORT GetSymbolSetCount() const { return pImpl->NoSymbolSets; } - SmSymSet *GetSymbolSet(USHORT SymbolSetNo) const - { - return pImpl->SymbolSets.Get(SymbolSetNo); - } + USHORT GetSymbolCount() const { return static_cast< USHORT >(m_aSymbols.size()); } + const SymbolPtrVec_t GetSymbols() const; + bool AddOrReplaceSymbol( const SmSym & rSymbol, bool bForceChange = false ); + void RemoveSymbol( const String & rSymbolName ); SmSym * GetSymbolByName(const String& rSymbolName); const SmSym * GetSymbolByName(const String& rSymbolName) const { - return ((SmSymSetManager *) this)->GetSymbolByName(rSymbolName); + return ((SmSymbolManager *) this)->GetSymbolByName(rSymbolName); } - void AddReplaceSymbol( const SmSym & rSymbol ); - USHORT GetSymbolCount() const; - const SmSym * GetSymbolByPos( USHORT nPos ) const; - - BOOL IsModified() const { return pImpl->Modified; } - void SetModified(BOOL Modify) { pImpl->Modified = Modify; } + bool IsModified() const { return m_bModified; } + void SetModified(bool bModify) { m_bModified = bModify; } void Load(); void Save(); |