diff options
author | Thomas Lange [tl] <Thomas.Lange@oracle.com> | 2010-10-13 11:39:15 +0200 |
---|---|---|
committer | Thomas Lange [tl] <Thomas.Lange@oracle.com> | 2010-10-13 11:39:15 +0200 |
commit | 9a1374b54144b15cfef1a0d8eeba861a69fec875 (patch) | |
tree | efacb059428e02abe44a194619195082f88e413d | |
parent | 8780cc5c294085fe7379a24eee58ac446cc40d0c (diff) |
cws tl84: #i114767# Math: added option to save only used symbols
-rwxr-xr-x[-rw-r--r--] | starmath/inc/dialog.hxx | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | starmath/inc/document.hxx | 16 | ||||
-rwxr-xr-x[-rw-r--r--] | starmath/inc/parse.hxx | 80 | ||||
-rwxr-xr-x[-rw-r--r--] | starmath/inc/starmath.hrc | 1 | ||||
-rw-r--r-- | starmath/source/cfgitem.cxx | 28 | ||||
-rw-r--r-- | starmath/source/cfgitem.hxx | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | starmath/source/config.cxx | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | starmath/source/dialog.cxx | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | starmath/source/dialog.hrc | 9 | ||||
-rwxr-xr-x[-rw-r--r--] | starmath/source/document.cxx | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | starmath/source/makefile.mk | 22 | ||||
-rwxr-xr-x[-rw-r--r--] | starmath/source/mathmlexport.cxx | 13 | ||||
-rwxr-xr-x[-rw-r--r--] | starmath/source/mathmlimport.cxx | 8 | ||||
-rwxr-xr-x[-rw-r--r--] | starmath/source/mathmlimport.hxx | 8 | ||||
-rwxr-xr-x[-rw-r--r--] | starmath/source/parse.cxx | 917 | ||||
-rwxr-xr-x[-rw-r--r--] | starmath/source/smmod.cxx | 1 | ||||
-rwxr-xr-x | starmath/source/smres.src | 7 | ||||
-rw-r--r-- | starmath/source/symbol.cxx | 17 | ||||
-rwxr-xr-x[-rw-r--r--] | starmath/source/unomodel.cxx | 16 |
19 files changed, 637 insertions, 524 deletions
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index 75aee6fd2009..fae8b9aece41 100644..100755 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -73,6 +73,7 @@ class SmPrintOptionsTabPage : public SfxTabPage MetricField aZoom; FixedLine aFixedLine3; CheckBox aNoRightSpaces; + CheckBox aSaveOnlyUsedSymbols; DECL_LINK(SizeButtonClickHdl, Button *); diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index f03cd43fc965..3aea9e3e4e09 100644..100755 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -29,19 +29,21 @@ #define SMDLL 1 -#include <sot/storage.hxx> -#include <sot/sotref.hxx> +#include <rtl/ustring.hxx> +#include <sfx2/docfac.hxx> #include <sfx2/objsh.hxx> +#include <sot/sotref.hxx> +#include <sot/storage.hxx> #include <svl/lstner.hxx> -#include <sfx2/docfac.hxx> +#include <vcl/jobset.hxx> #include <vcl/virdev.hxx> +#include <set> + #include "format.hxx" #include "parse.hxx" #include "smmod.hxx" -#include <vcl/jobset.hxx> - class SmNode; class SfxMenuBarManager; class SfxPrinter; @@ -124,6 +126,8 @@ class SmDocShell : public SfxObjectShell, public SfxListener USHORT nModifyCount; BOOL bIsFormulaArranged; + std::set< rtl::OUString > aUsedSymbols; // to export used symbols only when saving + virtual void SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType, @@ -200,6 +204,8 @@ public: const SmNode * GetFormulaTree() const { return pTree; } void SetFormulaTree(SmNode *&rTree) { pTree = rTree; } + const std::set< rtl::OUString > & GetUsedSymbols() const { return aUsedSymbols; } + String GetAccessibleText(); EditEngine & GetEditEngine(); diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index facf17d561e2..4c672df058ce 100644..100755 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -33,11 +33,16 @@ #include <tools/list.hxx> #include <tools/string.hxx> +#include <set> +#include <stack> +#include <list> + #include "types.hxx" class SmNode; class SmDocShell; +////////////////////////////////////////////////////////////////////// // TokenGroups #define TGOPER 0x00000001 @@ -113,17 +118,18 @@ enum SmTokenType struct SmToken { - // token text - String aText; - // token info - SmTokenType eType; + + String aText; // token text + SmTokenType eType; // token info sal_Unicode cMathChar; + // parse-help info - ULONG nGroup; - USHORT nLevel; + ULONG nGroup; + USHORT nLevel; + // token position - USHORT nRow; - xub_StrLen nCol; + USHORT nRow; + xub_StrLen nCol; SmToken(); }; @@ -152,6 +158,7 @@ struct SmErrorDesc String Text; }; + DECLARE_STACK(SmNodeStack, SmNode *) DECLARE_LIST(SmErrDescList, SmErrorDesc *) @@ -170,19 +177,22 @@ enum SmConvert 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; + String m_aBufferString; + SmToken m_aCurToken; + SmNodeStack m_aNodeStack; + SmErrDescList m_aErrDescList; + int m_nCurError; + LanguageType m_nLang; + xub_StrLen m_nBufferIndex, + m_nTokenIndex; + USHORT m_Row, + m_nColOff; + SmConvert m_eConversion; + BOOL m_bImportSymNames, + m_bExportSymNames; + + // map of used symbols (used to reduce file size by exporting only actually used symbols) + std::set< rtl::OUString > m_aUsedSymbols; // declare copy-constructor and assignment-operator private SmParser(const SmParser &); @@ -193,7 +203,7 @@ protected: BOOL IsDelimiter( const String &rTxt, xub_StrLen nPos ); #endif void NextToken(); - xub_StrLen GetTokenIndex() const { return nTokenIndex; } + xub_StrLen GetTokenIndex() const { return m_nTokenIndex; } void Insert(const String &rText, USHORT nPos); void Replace( USHORT nPos, USHORT nLen, const String &rText ); @@ -231,37 +241,43 @@ protected: void GlyphSpecial(); // end of grammar - LanguageType GetLanguage() const { return nLang; } - void SetLanguage( LanguageType nNewLang ) { nLang = nNewLang; } + LanguageType GetLanguage() const { return m_nLang; } + void SetLanguage( LanguageType nNewLang ) { m_nLang = nNewLang; } void Error(SmParseError Error); + void ClearUsedSymbols() { m_aUsedSymbols.clear(); } + void AddToUsedSymbols( const String &rSymbolName ) { m_aUsedSymbols.insert( rSymbolName ); } + public: SmParser(); SmNode *Parse(const String &rBuffer); - const String & GetText() const { return BufferString; }; + const String & GetText() const { return m_aBufferString; }; - SmConvert GetConversion() const { return eConversion; } - void SetConversion(SmConvert eConv) { eConversion = eConv; } + SmConvert GetConversion() const { return m_eConversion; } + void SetConversion(SmConvert eConv) { m_eConversion = eConv; } - BOOL IsImportSymbolNames() const { return bImportSymNames; } - void SetImportSymbolNames(BOOL bVal) { bImportSymNames = bVal; } - BOOL IsExportSymbolNames() const { return bExportSymNames; } - void SetExportSymbolNames(BOOL bVal) { bExportSymNames = bVal; } + BOOL IsImportSymbolNames() const { return m_bImportSymNames; } + void SetImportSymbolNames(BOOL bVal) { m_bImportSymNames = bVal; } + BOOL IsExportSymbolNames() const { return m_bExportSymNames; } + void SetExportSymbolNames(BOOL bVal) { m_bExportSymNames = bVal; } USHORT AddError(SmParseError Type, SmNode *pNode); const SmErrorDesc * NextError(); const SmErrorDesc * PrevError(); const SmErrorDesc * GetError(USHORT i = 0xFFFF); + + bool IsUsedSymbol( const String &rSymbolName ) const { m_aUsedSymbols.find( rSymbolName ) != m_aUsedSymbols.end(); } + std::set< rtl::OUString > GetUsedSymbols() const { return m_aUsedSymbols; } }; inline BOOL SmParser::TokenInGroup(ULONG nGroup) { - return (CurToken.nGroup & nGroup) ? TRUE : FALSE; + return (m_aCurToken.nGroup & nGroup) ? TRUE : FALSE; } diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index 8d156792e1d3..fbe86766aeb8 100644..100755 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -81,6 +81,7 @@ #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_SAVE_ONLY_USED_SYMBOLS (SID_SMA_START + 125) #define SID_DUMMY (SID_SMA_START + 254) //#define GID_FORMEL (RID_GROUPS_OFFSET + 1) diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 43c0fbe27dd0..31b5f731022a 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -113,7 +113,8 @@ static const char * aMathPropNames[] = "Print/Frame", "Print/Size", "Print/ZoomFactor", - //"Misc/NoSymbolsWarning", + "LoadSave/IsSaveOnlyUsedSymbols", + //"Misc/NoSymbolsWarning", @deprecated "Misc/IgnoreSpacesRight", "View/ToolboxVisible", "View/AutoRedraw", @@ -208,6 +209,7 @@ struct SmCfgOther BOOL bPrintTitle; BOOL bPrintFormulaText; BOOL bPrintFrame; + BOOL bIsSaveOnlyUsedSymbols; BOOL bIgnoreSpacesRight; BOOL bToolboxVisible; BOOL bAutoRedraw; @@ -225,7 +227,7 @@ SmCfgOther::SmCfgOther() bPrintTitle = bPrintFormulaText = bPrintFrame = bIgnoreSpacesRight = bToolboxVisible = bAutoRedraw = - bFormulaCursor = /*bNoSymbolsWarning =*/ TRUE; + bFormulaCursor = bIsSaveOnlyUsedSymbols = TRUE; } ///////////////////////////////////////////////////////////////// @@ -902,6 +904,10 @@ void SmMathConfig::LoadOther() // Print/ZoomFactor if (pVal->hasValue() && (*pVal >>= nTmp16)) pOther->nPrintZoomFactor = nTmp16; + ++pVal; + // LoadSave/IsSaveOnlyUsedSymbols + if (pVal->hasValue() && (*pVal >>= bTmp)) + pOther->bIsSaveOnlyUsedSymbols = bTmp; /* ++pVal; // Misc/NoSymbolsWarning if (pVal->hasValue() && (*pVal >>= bTmp)) @@ -953,6 +959,8 @@ void SmMathConfig::SaveOther() *pValue++ <<= (INT16) pOther->ePrintSize; // Print/ZoomFactor *pValue++ <<= (INT16) pOther->nPrintZoomFactor; + // LoadSave/IsSaveOnlyUsedSymbols + *pValue++ <<= (BOOL) pOther->bIsSaveOnlyUsedSymbols; /* // Misc/NoSymbolsWarning *pValue++ <<= (BOOL) pOther->bNoSymbolsWarning; */ @@ -1237,6 +1245,22 @@ void SmMathConfig::SetPrintFrame( BOOL bVal ) } +BOOL SmMathConfig::IsSaveOnlyUsedSymbols() const +{ + if (!pOther) + ((SmMathConfig *) this)->LoadOther(); + return pOther->bIsSaveOnlyUsedSymbols; +} + + +void SmMathConfig::SetSaveOnlyUsedSymbols( BOOL bVal ) +{ + if (!pOther) + LoadOther(); + SetOtherIfNotEqual( pOther->bIsSaveOnlyUsedSymbols, bVal ); +} + + BOOL SmMathConfig::IsIgnoreSpacesRight() const { if (!pOther) diff --git a/starmath/source/cfgitem.hxx b/starmath/source/cfgitem.hxx index 9e4aa9f39f2f..f8e0625a8a06 100644 --- a/starmath/source/cfgitem.hxx +++ b/starmath/source/cfgitem.hxx @@ -200,6 +200,9 @@ public: USHORT GetPrintZoomFactor() const; void SetPrintZoomFactor( USHORT nVal ); + BOOL IsSaveOnlyUsedSymbols() const; + void SetSaveOnlyUsedSymbols( BOOL bVal ); + BOOL IsIgnoreSpacesRight() const; void SetIgnoreSpacesRight( BOOL bVal ); BOOL IsAutoRedraw() const; diff --git a/starmath/source/config.cxx b/starmath/source/config.cxx index 16b3b97afd96..c7adf9e07446 100644..100755 --- a/starmath/source/config.cxx +++ b/starmath/source/config.cxx @@ -101,6 +101,10 @@ void SmConfig::ItemSetToConfig(const SfxItemSet &rSet) Broadcast(SfxSimpleHint(HINT_FORMATCHANGED)); } } + if (rSet.GetItemState(SID_SAVE_ONLY_USED_SYMBOLS, TRUE, &pItem) == SFX_ITEM_SET) + { bVal = ((const SfxBoolItem *) pItem)->GetValue(); + SetSaveOnlyUsedSymbols( bVal ); + } SaveOther(); } @@ -120,6 +124,7 @@ void SmConfig::ConfigToItemSet(SfxItemSet &rSet) const rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTFRAME), IsPrintFrame())); rSet.Put(SfxBoolItem(pPool->GetWhich(SID_AUTOREDRAW), IsAutoRedraw())); rSet.Put(SfxBoolItem(pPool->GetWhich(SID_NO_RIGHT_SPACES), IsIgnoreSpacesRight())); + rSet.Put(SfxBoolItem(pPool->GetWhich(SID_SAVE_ONLY_USED_SYMBOLS), IsSaveOnlyUsedSymbols())); } diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 0dc58c8ed640..c04642ec0e9f 100644..100755 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -187,8 +187,9 @@ SmPrintOptionsTabPage::SmPrintOptionsTabPage(Window *pParent, const SfxItemSet & aSizeScaled (this, SmResId( RB_FIT_TO_PAGE )), aSizeZoomed (this, SmResId( RB_ZOOM )), aZoom (this, SmResId( MF_ZOOM )), - aFixedLine3 (this, SmResId( FL_MISC_OPTIONS )), - aNoRightSpaces (this, SmResId( CB_IGNORE_SPACING )) + aFixedLine3 (this, SmResId( FL_MISC_OPTIONS )), + aNoRightSpaces (this, SmResId( CB_IGNORE_SPACING )), + aSaveOnlyUsedSymbols (this, SmResId( CB_SAVE_ONLY_USED_SYMBOLS )) { FreeResource(); @@ -216,6 +217,7 @@ BOOL SmPrintOptionsTabPage::FillItemSet(SfxItemSet& rSet) rSet.Put(SfxBoolItem(GetWhich(SID_PRINTTEXT), aText.IsChecked())); rSet.Put(SfxBoolItem(GetWhich(SID_PRINTFRAME), aFrame.IsChecked())); rSet.Put(SfxBoolItem(GetWhich(SID_NO_RIGHT_SPACES), aNoRightSpaces.IsChecked())); + rSet.Put(SfxBoolItem(GetWhich(SID_SAVE_ONLY_USED_SYMBOLS), aSaveOnlyUsedSymbols.IsChecked())); return TRUE; } @@ -237,6 +239,7 @@ void SmPrintOptionsTabPage::Reset(const SfxItemSet& rSet) aText.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_PRINTTEXT))).GetValue()); aFrame.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_PRINTFRAME))).GetValue()); aNoRightSpaces.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_NO_RIGHT_SPACES))).GetValue()); + aSaveOnlyUsedSymbols.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_SAVE_ONLY_USED_SYMBOLS))).GetValue()); } diff --git a/starmath/source/dialog.hrc b/starmath/source/dialog.hrc index 29d87ba1d287..9e3e58493ab3 100644..100755 --- a/starmath/source/dialog.hrc +++ b/starmath/source/dialog.hrc @@ -31,17 +31,18 @@ #define FL_PRINTOPTIONS 10 #define CB_TITLEROW 11 -#define CB_EQUATION_TEXT 12 +#define CB_EQUATION_TEXT 12 #define CB_FRAME 13 #define FL_PRINT_FORMAT 20 -#define RB_ORIGINAL_SIZE 21 -#define RB_FIT_TO_PAGE 22 +#define RB_ORIGINAL_SIZE 21 +#define RB_FIT_TO_PAGE 22 #define RB_ZOOM 23 #define MF_ZOOM 24 #define FL_MISC_OPTIONS 30 -#define CB_IGNORE_SPACING 31 +#define CB_IGNORE_SPACING 31 +#define CB_SAVE_ONLY_USED_SYMBOLS 32 #define FT_FONTS_SUBSET 110 #define LB_FONTS_SUBSET 111 diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index ab1382b97879..51232513b84a 100644..100755 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -251,6 +251,8 @@ void SmDocShell::Parse() pTree = aInterpreter.Parse(aText); nModifyCount++; //! see comment for SID_GAPHIC_SM in SmDocShell::GetState SetFormulaArranged( FALSE ); + + aUsedSymbols = aInterpreter.GetUsedSymbols(); } diff --git a/starmath/source/makefile.mk b/starmath/source/makefile.mk index a409e55d2462..8df7220f2aae 100644..100755 --- a/starmath/source/makefile.mk +++ b/starmath/source/makefile.mk @@ -51,31 +51,31 @@ SRC2FILES = smres.src \ SLO1FILES = \ $(SLO)$/accessibility.obj \ - $(SLO)$/edit.obj \ - $(SLO)$/eqnolefilehdr.obj \ - $(SLO)$/mathmlexport.obj \ - $(SLO)$/mathmlimport.obj \ - $(SLO)$/symbol.obj \ - $(SLO)$/types.obj \ - $(SLO)$/unodoc.obj \ $(SLO)$/action.obj \ $(SLO)$/cfgitem.obj \ $(SLO)$/config.obj \ $(SLO)$/dialog.obj \ $(SLO)$/document.obj \ + $(SLO)$/edit.obj \ + $(SLO)$/eqnolefilehdr.obj \ $(SLO)$/format.obj \ + $(SLO)$/mathmlexport.obj \ + $(SLO)$/mathmlimport.obj \ $(SLO)$/mathtype.obj \ $(SLO)$/node.obj \ $(SLO)$/parse.obj \ + $(SLO)$/rect.obj \ $(SLO)$/register.obj \ $(SLO)$/smdll.obj \ + $(SLO)$/smmod.obj \ + $(SLO)$/symbol.obj \ $(SLO)$/toolbox.obj \ $(SLO)$/typemap.obj \ - $(SLO)$/smmod.obj \ + $(SLO)$/types.obj \ + $(SLO)$/unodoc.obj \ $(SLO)$/utility.obj \ - $(SLO)$/rect.obj \ - $(SLO)$/unomodel.obj \ - $(SLO)$/view.obj + $(SLO)$/view.obj \ + $(SLO)$/unomodel.obj SLO2FILES = \ $(SLO)$/register.obj \ diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index bec69eb01b95..b80a65a089c8 100644..100755 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -79,6 +79,7 @@ #include <unomodel.hxx> #include <document.hxx> #include <utility.hxx> +#include <config.hxx> using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; @@ -742,6 +743,9 @@ void SmXMLExport::GetConfigurationSettings( Sequence < PropertyValue > & rProps) PropertyValue* pProps = rProps.getArray(); if (pProps) { + SmConfig *pConfig = SM_MOD()->GetConfig(); + const bool bUsedSymbolsOnly = pConfig ? pConfig->IsSaveOnlyUsedSymbols() : false; + const OUString sFormula ( RTL_CONSTASCII_USTRINGPARAM ( "Formula" ) ); const OUString sBasicLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "BasicLibraries" ) ); const OUString sDialogLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "DialogLibraries" ) ); @@ -755,7 +759,14 @@ void SmXMLExport::GetConfigurationSettings( Sequence < PropertyValue > & rProps) rPropName != sRuntimeUID) { pProps->Name = rPropName; - pProps->Value = xProps->getPropertyValue(rPropName); + + rtl::OUString aActualName( rPropName ); + + // handle 'save used symbols only' + if (bUsedSymbolsOnly && rPropName.equalsAscii("Symbols")) + aActualName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "UserDefinedSymbolsInUse" ) ); + + pProps->Value = xProps->getPropertyValue( aActualName ); } } } diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index 36c009757eac..10a0f78e754c 100644..100755 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -3168,8 +3168,14 @@ void SmXMLImport::SetConfigurationSettings(const Sequence<PropertyValue>& aConfP if ( xInfo->hasPropertyByName( pValues->Name ) ) xProps->setPropertyValue( pValues->Name, pValues->Value ); } - catch( Exception& ) + catch (beans::PropertyVetoException &e) { + (void) e; + // dealing with read-only properties here. Nothing to do... + } + catch( Exception& e) + { + (void) e; DBG_ERROR( "SmXMLImport::SetConfigurationSettings: Exception!" ); } } diff --git a/starmath/source/mathmlimport.hxx b/starmath/source/mathmlimport.hxx index 22c2017c61b1..3225c2f85eb6 100644..100755 --- a/starmath/source/mathmlimport.hxx +++ b/starmath/source/mathmlimport.hxx @@ -251,10 +251,10 @@ public: const SvXMLTokenMap &GetPresTableElemTokenMap(); const SvXMLTokenMap &GetColorTokenMap(); - SmNodeStack & GetNodeStack() {return aNodeStack;} - SmNode *GetTree() { return aNodeStack.Pop();} - sal_Bool GetSuccess() { return bSuccess; } - String &GetText() { return aText;} + SmNodeStack & GetNodeStack() { return aNodeStack; } + SmNode *GetTree() { return aNodeStack.Pop(); } + sal_Bool GetSuccess() { return bSuccess; } + String &GetText() { return aText; } virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps); virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps); diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index d12f3df07400..3cd2f134f119 100644..100755 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -392,22 +392,22 @@ BOOL SmParser::IsDelimiter( const String &rTxt, xub_StrLen nPos ) void SmParser::Insert(const String &rText, USHORT nPos) { - BufferString.Insert(rText, nPos); + m_aBufferString.Insert(rText, nPos); xub_StrLen nLen = rText.Len(); - BufferIndex = BufferIndex + nLen; - nTokenIndex = nTokenIndex + nLen; + m_nBufferIndex = m_nBufferIndex + nLen; + m_nTokenIndex = m_nTokenIndex + nLen; } void SmParser::Replace( USHORT nPos, USHORT nLen, const String &rText ) { - DBG_ASSERT( nPos + nLen <= BufferString.Len(), "argument mismatch" ); + DBG_ASSERT( nPos + nLen <= m_aBufferString.Len(), "argument mismatch" ); - BufferString.Replace( nPos, nLen, rText ); + m_aBufferString.Replace( nPos, nLen, rText ); INT16 nChg = rText.Len() - nLen; - BufferIndex = BufferIndex + nChg; - nTokenIndex = nTokenIndex + nChg; + m_nBufferIndex = m_nBufferIndex + nChg; + m_nTokenIndex = m_nTokenIndex + nChg; } @@ -434,7 +434,7 @@ void SmParser::NextToken() { static const String aEmptyStr; - xub_StrLen nBufLen = BufferString.Len(); + xub_StrLen nBufLen = m_aBufferString.Len(); ParseResult aRes; xub_StrLen nRealStart; BOOL bCont; @@ -444,12 +444,12 @@ void SmParser::NextToken() { // skip white spaces while (UnicodeType::SPACE_SEPARATOR == - aCC.getType( BufferString, BufferIndex )) - ++BufferIndex; + aCC.getType( m_aBufferString, m_nBufferIndex )) + ++m_nBufferIndex; sal_Int32 nStartFlags = coStartFlags; sal_Int32 nContFlags = coContFlags; - sal_Unicode cFirstChar = BufferString.GetChar( BufferIndex ); + sal_Unicode cFirstChar = m_aBufferString.GetChar( m_nBufferIndex ); /* removed because of #i11752# bNumStart = cFirstChar == '.' || ('0' <= cFirstChar && cFirstChar <= '9'); @@ -459,7 +459,7 @@ void SmParser::NextToken() nContFlags = coNumContFlags; } */ - aRes = aCC.parseAnyToken( BufferString, BufferIndex, + aRes = aCC.parseAnyToken( m_aBufferString, m_nBufferIndex, nStartFlags, aEmptyStr, nContFlags, aEmptyStr ); @@ -476,7 +476,7 @@ void SmParser::NextToken() aCC.setLocale( aDotLoc ); aTmpRes = aCC.parsePredefinedToken( KParseType::ASC_NUMBER, - BufferString, BufferIndex, + m_aBufferString, m_nBufferIndex, KParseTokens::ASC_DIGIT, aEmptyStr, KParseTokens::ASC_DIGIT | KParseTokens::ASC_DOT, aEmptyStr ); aCC.setLocale( aOldLoc ); @@ -484,29 +484,29 @@ void SmParser::NextToken() aRes.TokenType = aTmpRes.TokenType; } - nRealStart = BufferIndex + sal::static_int_cast< xub_StrLen >(aRes.LeadingWhiteSpace); - BufferIndex = nRealStart; + nRealStart = m_nBufferIndex + sal::static_int_cast< xub_StrLen >(aRes.LeadingWhiteSpace); + m_nBufferIndex = nRealStart; bCont = FALSE; if ( aRes.TokenType == 0 && nRealStart < nBufLen && - '\n' == BufferString.GetChar( nRealStart ) ) + '\n' == m_aBufferString.GetChar( nRealStart ) ) { // keep data needed for tokens row and col entry up to date - ++Row; - BufferIndex = ColOff = nRealStart + 1; + ++m_Row; + m_nBufferIndex = m_nColOff = nRealStart + 1; bCont = TRUE; } else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR) { - String aName( BufferString.Copy( nRealStart, 2 )); + String aName( m_aBufferString.Copy( nRealStart, 2 )); if ( aName.EqualsAscii( "%%" )) { //SkipComment - BufferIndex = nRealStart + 2; - while (BufferIndex < nBufLen && - '\n' != BufferString.GetChar( BufferIndex )) - ++BufferIndex; + m_nBufferIndex = nRealStart + 2; + while (m_nBufferIndex < nBufLen && + '\n' != m_aBufferString.GetChar( m_nBufferIndex )) + ++m_nBufferIndex; bCont = TRUE; } } @@ -514,33 +514,33 @@ void SmParser::NextToken() } while (bCont); // set index of current token - nTokenIndex = BufferIndex; + m_nTokenIndex = m_nBufferIndex; - CurToken.nRow = Row; - CurToken.nCol = nRealStart - ColOff + 1; + m_aCurToken.nRow = m_Row; + m_aCurToken.nCol = nRealStart - m_nColOff + 1; BOOL bHandled = TRUE; if (nRealStart >= nBufLen) { - CurToken.eType = TEND; - CurToken.cMathChar = '\0'; - CurToken.nGroup = 0; - CurToken.nLevel = 0; - CurToken.aText.Erase(); + m_aCurToken.eType = TEND; + m_aCurToken.cMathChar = '\0'; + m_aCurToken.nGroup = 0; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.Erase(); } else if ((aRes.TokenType & (KParseType::ASC_NUMBER | KParseType::UNI_NUMBER)) || (bNumStart && (aRes.TokenType & KParseType::IDENTNAME))) { INT32 n = aRes.EndPos - nRealStart; DBG_ASSERT( n >= 0, "length < 0" ); - CurToken.eType = TNUMBER; - CurToken.cMathChar = '\0'; - CurToken.nGroup = 0; - CurToken.nLevel = 5; - CurToken.aText = BufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) ); + m_aCurToken.eType = TNUMBER; + m_aCurToken.cMathChar = '\0'; + m_aCurToken.nGroup = 0; + m_aCurToken.nLevel = 5; + m_aCurToken.aText = m_aBufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) ); #if OSL_DEBUG_LEVEL > 1 - if (!IsDelimiter( BufferString, static_cast< xub_StrLen >(aRes.EndPos) )) + if (!IsDelimiter( m_aBufferString, static_cast< xub_StrLen >(aRes.EndPos) )) { DBG_WARNING( "identifier really finished? (compatibility!)" ); } @@ -548,59 +548,59 @@ void SmParser::NextToken() } else if (aRes.TokenType & KParseType::DOUBLE_QUOTE_STRING) { - CurToken.eType = TTEXT; - CurToken.cMathChar = '\0'; - CurToken.nGroup = 0; - CurToken.nLevel = 5; - CurToken.aText = aRes.DequotedNameOrString; - CurToken.nRow = Row; - CurToken.nCol = nRealStart - ColOff + 2; + m_aCurToken.eType = TTEXT; + m_aCurToken.cMathChar = '\0'; + m_aCurToken.nGroup = 0; + m_aCurToken.nLevel = 5; + m_aCurToken.aText = aRes.DequotedNameOrString; + m_aCurToken.nRow = m_Row; + m_aCurToken.nCol = nRealStart - m_nColOff + 2; } else if (aRes.TokenType & KParseType::IDENTNAME) { INT32 n = aRes.EndPos - nRealStart; DBG_ASSERT( n >= 0, "length < 0" ); - String aName( BufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) ) ); + String aName( m_aBufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) ) ); const SmTokenTableEntry *pEntry = GetTokenTableEntry( aName ); if (pEntry) { - CurToken.eType = pEntry->eType; - CurToken.cMathChar = pEntry->cMathChar; - CurToken.nGroup = pEntry->nGroup; - CurToken.nLevel = pEntry->nLevel; - CurToken.aText.AssignAscii( pEntry->pIdent ); + m_aCurToken.eType = pEntry->eType; + m_aCurToken.cMathChar = pEntry->cMathChar; + m_aCurToken.nGroup = pEntry->nGroup; + m_aCurToken.nLevel = pEntry->nLevel; + m_aCurToken.aText.AssignAscii( pEntry->pIdent ); } else { - CurToken.eType = TIDENT; - CurToken.cMathChar = '\0'; - CurToken.nGroup = 0; - CurToken.nLevel = 5; - CurToken.aText = aName; + m_aCurToken.eType = TIDENT; + m_aCurToken.cMathChar = '\0'; + m_aCurToken.nGroup = 0; + m_aCurToken.nLevel = 5; + m_aCurToken.aText = aName; #if OSL_DEBUG_LEVEL > 1 - if (!IsDelimiter( BufferString, static_cast< xub_StrLen >(aRes.EndPos) )) + if (!IsDelimiter( m_aBufferString, static_cast< xub_StrLen >(aRes.EndPos) )) { DBG_WARNING( "identifier really finished? (compatibility!)" ); } #endif } } - else if (aRes.TokenType == 0 && '_' == BufferString.GetChar( nRealStart )) + else if (aRes.TokenType == 0 && '_' == m_aBufferString.GetChar( nRealStart )) { - CurToken.eType = TRSUB; - CurToken.cMathChar = '\0'; - CurToken.nGroup = TGPOWER; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "_" ); + m_aCurToken.eType = TRSUB; + m_aCurToken.cMathChar = '\0'; + m_aCurToken.nGroup = TGPOWER; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "_" ); aRes.EndPos = nRealStart + 1; } else if (aRes.TokenType & KParseType::BOOLEAN) { sal_Int32 &rnEndPos = aRes.EndPos; - String aName( BufferString.Copy( nRealStart, + String aName( m_aBufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(rnEndPos - nRealStart) )); if (2 >= aName.Len()) { @@ -609,91 +609,91 @@ void SmParser::NextToken() { case '<': { - if (BufferString.Copy( nRealStart, 2 ). + if (m_aBufferString.Copy( nRealStart, 2 ). EqualsAscii( "<<" )) { - CurToken.eType = TLL; - CurToken.cMathChar = MS_LL; - CurToken.nGroup = TGRELATION; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "<<" ); + m_aCurToken.eType = TLL; + m_aCurToken.cMathChar = MS_LL; + m_aCurToken.nGroup = TGRELATION; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "<<" ); rnEndPos = nRealStart + 2; } - else if (BufferString.Copy( nRealStart, 2 ). + else if (m_aBufferString.Copy( nRealStart, 2 ). EqualsAscii( "<=" )) { - CurToken.eType = TLE; - CurToken.cMathChar = MS_LE; - CurToken.nGroup = TGRELATION; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "<=" ); + m_aCurToken.eType = TLE; + m_aCurToken.cMathChar = MS_LE; + m_aCurToken.nGroup = TGRELATION; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "<=" ); rnEndPos = nRealStart + 2; } - else if (BufferString.Copy( nRealStart, 2 ). + else if (m_aBufferString.Copy( nRealStart, 2 ). EqualsAscii( "<>" )) { - CurToken.eType = TNEQ; - CurToken.cMathChar = MS_NEQ; - CurToken.nGroup = TGRELATION; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "<>" ); + m_aCurToken.eType = TNEQ; + m_aCurToken.cMathChar = MS_NEQ; + m_aCurToken.nGroup = TGRELATION; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "<>" ); rnEndPos = nRealStart + 2; } - else if (BufferString.Copy( nRealStart, 3 ). + else if (m_aBufferString.Copy( nRealStart, 3 ). EqualsAscii( "<?>" )) { - CurToken.eType = TPLACE; - CurToken.cMathChar = MS_PLACE; - CurToken.nGroup = 0; - CurToken.nLevel = 5; - CurToken.aText.AssignAscii( "<?>" ); + m_aCurToken.eType = TPLACE; + m_aCurToken.cMathChar = MS_PLACE; + m_aCurToken.nGroup = 0; + m_aCurToken.nLevel = 5; + m_aCurToken.aText.AssignAscii( "<?>" ); rnEndPos = nRealStart + 3; } else { - CurToken.eType = TLT; - CurToken.cMathChar = MS_LT; - CurToken.nGroup = TGRELATION; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "<" ); + m_aCurToken.eType = TLT; + m_aCurToken.cMathChar = MS_LT; + m_aCurToken.nGroup = TGRELATION; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "<" ); } } break; case '>': { - if (BufferString.Copy( nRealStart, 2 ). + if (m_aBufferString.Copy( nRealStart, 2 ). EqualsAscii( ">=" )) { - CurToken.eType = TGE; - CurToken.cMathChar = MS_GE; - CurToken.nGroup = TGRELATION; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( ">=" ); + m_aCurToken.eType = TGE; + m_aCurToken.cMathChar = MS_GE; + m_aCurToken.nGroup = TGRELATION; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( ">=" ); rnEndPos = nRealStart + 2; } - else if (BufferString.Copy( nRealStart, 2 ). + else if (m_aBufferString.Copy( nRealStart, 2 ). EqualsAscii( ">>" )) { - CurToken.eType = TGG; - CurToken.cMathChar = MS_GG; - CurToken.nGroup = TGRELATION; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( ">>" ); + m_aCurToken.eType = TGG; + m_aCurToken.cMathChar = MS_GG; + m_aCurToken.nGroup = TGRELATION; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( ">>" ); rnEndPos = nRealStart + 2; } else { - CurToken.eType = TGT; - CurToken.cMathChar = MS_GT; - CurToken.nGroup = TGRELATION; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( ">" ); + m_aCurToken.eType = TGT; + m_aCurToken.cMathChar = MS_GT; + m_aCurToken.nGroup = TGRELATION; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( ">" ); } } break; @@ -705,7 +705,7 @@ void SmParser::NextToken() else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR) { sal_Int32 &rnEndPos = aRes.EndPos; - String aName( BufferString.Copy( nRealStart, + String aName( m_aBufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(rnEndPos - nRealStart) ) ); if (1 == aName.Len()) @@ -718,12 +718,12 @@ void SmParser::NextToken() //! modifies aRes.EndPos DBG_ASSERT( rnEndPos >= nBufLen || - '%' != BufferString.GetChar( sal::static_int_cast< xub_StrLen >(rnEndPos) ), + '%' != m_aBufferString.GetChar( sal::static_int_cast< xub_StrLen >(rnEndPos) ), "unexpected comment start" ); // get identifier of user-defined character ParseResult aTmpRes = aCC.parseAnyToken( - BufferString, rnEndPos, + m_aBufferString, rnEndPos, KParseTokens::ANY_LETTER, aEmptyStr, coContFlags, @@ -735,20 +735,20 @@ void SmParser::NextToken() // default setting for the case that no identifier // i.e. a valid symbol-name is following the '%' // character - CurToken.eType = TTEXT; - CurToken.cMathChar = '\0'; - CurToken.nGroup = 0; - CurToken.nLevel = 5; - CurToken.aText = String(); - CurToken.nRow = sal::static_int_cast< xub_StrLen >(Row); - CurToken.nCol = nTmpStart - ColOff; + m_aCurToken.eType = TTEXT; + m_aCurToken.cMathChar = '\0'; + m_aCurToken.nGroup = 0; + m_aCurToken.nLevel = 5; + m_aCurToken.aText = String(); + m_aCurToken.nRow = sal::static_int_cast< xub_StrLen >(m_Row); + m_aCurToken.nCol = nTmpStart - m_nColOff; if (aTmpRes.TokenType & KParseType::IDENTNAME) { xub_StrLen n = sal::static_int_cast< xub_StrLen >(aTmpRes.EndPos - nTmpStart); - CurToken.eType = TSPECIAL; - CurToken.aText = BufferString.Copy( sal::static_int_cast< xub_StrLen >(nTmpStart-1), n+1 ); + m_aCurToken.eType = TSPECIAL; + m_aCurToken.aText = m_aBufferString.Copy( sal::static_int_cast< xub_StrLen >(nTmpStart-1), n+1 ); DBG_ASSERT( aTmpRes.EndPos > rnEndPos, "empty identifier" ); @@ -765,187 +765,187 @@ void SmParser::NextToken() break; case '[': { - CurToken.eType = TLBRACKET; - CurToken.cMathChar = MS_LBRACKET; - CurToken.nGroup = TGLBRACES; - CurToken.nLevel = 5; - CurToken.aText.AssignAscii( "[" ); + m_aCurToken.eType = TLBRACKET; + m_aCurToken.cMathChar = MS_LBRACKET; + m_aCurToken.nGroup = TGLBRACES; + m_aCurToken.nLevel = 5; + m_aCurToken.aText.AssignAscii( "[" ); } break; case '\\': { - CurToken.eType = TESCAPE; - CurToken.cMathChar = '\0'; - CurToken.nGroup = 0; - CurToken.nLevel = 5; - CurToken.aText.AssignAscii( "\\" ); + m_aCurToken.eType = TESCAPE; + m_aCurToken.cMathChar = '\0'; + m_aCurToken.nGroup = 0; + m_aCurToken.nLevel = 5; + m_aCurToken.aText.AssignAscii( "\\" ); } break; case ']': { - CurToken.eType = TRBRACKET; - CurToken.cMathChar = MS_RBRACKET; - CurToken.nGroup = TGRBRACES; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "]" ); + m_aCurToken.eType = TRBRACKET; + m_aCurToken.cMathChar = MS_RBRACKET; + m_aCurToken.nGroup = TGRBRACES; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "]" ); } break; case '^': { - CurToken.eType = TRSUP; - CurToken.cMathChar = '\0'; - CurToken.nGroup = TGPOWER; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "^" ); + m_aCurToken.eType = TRSUP; + m_aCurToken.cMathChar = '\0'; + m_aCurToken.nGroup = TGPOWER; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "^" ); } break; case '`': { - CurToken.eType = TSBLANK; - CurToken.cMathChar = '\0'; - CurToken.nGroup = TGBLANK; - CurToken.nLevel = 5; - CurToken.aText.AssignAscii( "`" ); + m_aCurToken.eType = TSBLANK; + m_aCurToken.cMathChar = '\0'; + m_aCurToken.nGroup = TGBLANK; + m_aCurToken.nLevel = 5; + m_aCurToken.aText.AssignAscii( "`" ); } break; case '{': { - CurToken.eType = TLGROUP; - CurToken.cMathChar = MS_LBRACE; - CurToken.nGroup = 0; - CurToken.nLevel = 5; - CurToken.aText.AssignAscii( "{" ); + m_aCurToken.eType = TLGROUP; + m_aCurToken.cMathChar = MS_LBRACE; + m_aCurToken.nGroup = 0; + m_aCurToken.nLevel = 5; + m_aCurToken.aText.AssignAscii( "{" ); } break; case '|': { - CurToken.eType = TOR; - CurToken.cMathChar = MS_OR; - CurToken.nGroup = TGSUM; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "|" ); + m_aCurToken.eType = TOR; + m_aCurToken.cMathChar = MS_OR; + m_aCurToken.nGroup = TGSUM; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "|" ); } break; case '}': { - CurToken.eType = TRGROUP; - CurToken.cMathChar = MS_RBRACE; - CurToken.nGroup = 0; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "}" ); + m_aCurToken.eType = TRGROUP; + m_aCurToken.cMathChar = MS_RBRACE; + m_aCurToken.nGroup = 0; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "}" ); } break; case '~': { - CurToken.eType = TBLANK; - CurToken.cMathChar = '\0'; - CurToken.nGroup = TGBLANK; - CurToken.nLevel = 5; - CurToken.aText.AssignAscii( "~" ); + m_aCurToken.eType = TBLANK; + m_aCurToken.cMathChar = '\0'; + m_aCurToken.nGroup = TGBLANK; + m_aCurToken.nLevel = 5; + m_aCurToken.aText.AssignAscii( "~" ); } break; case '#': { - if (BufferString.Copy( nRealStart, 2 ). + if (m_aBufferString.Copy( nRealStart, 2 ). EqualsAscii( "##" )) { - CurToken.eType = TDPOUND; - CurToken.cMathChar = '\0'; - CurToken.nGroup = 0; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "##" ); + m_aCurToken.eType = TDPOUND; + m_aCurToken.cMathChar = '\0'; + m_aCurToken.nGroup = 0; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "##" ); rnEndPos = nRealStart + 2; } else { - CurToken.eType = TPOUND; - CurToken.cMathChar = '\0'; - CurToken.nGroup = 0; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "#" ); + m_aCurToken.eType = TPOUND; + m_aCurToken.cMathChar = '\0'; + m_aCurToken.nGroup = 0; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "#" ); } } break; case '&': { - CurToken.eType = TAND; - CurToken.cMathChar = MS_AND; - CurToken.nGroup = TGPRODUCT; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "&" ); + m_aCurToken.eType = TAND; + m_aCurToken.cMathChar = MS_AND; + m_aCurToken.nGroup = TGPRODUCT; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "&" ); } break; case '(': { - CurToken.eType = TLPARENT; - CurToken.cMathChar = MS_LPARENT; - CurToken.nGroup = TGLBRACES; - CurToken.nLevel = 5; //! 0 to continue expression - CurToken.aText.AssignAscii( "(" ); + m_aCurToken.eType = TLPARENT; + m_aCurToken.cMathChar = MS_LPARENT; + m_aCurToken.nGroup = TGLBRACES; + m_aCurToken.nLevel = 5; //! 0 to continue expression + m_aCurToken.aText.AssignAscii( "(" ); } break; case ')': { - CurToken.eType = TRPARENT; - CurToken.cMathChar = MS_RPARENT; - CurToken.nGroup = TGRBRACES; - CurToken.nLevel = 0; //! 0 to terminate expression - CurToken.aText.AssignAscii( ")" ); + m_aCurToken.eType = TRPARENT; + m_aCurToken.cMathChar = MS_RPARENT; + m_aCurToken.nGroup = TGRBRACES; + m_aCurToken.nLevel = 0; //! 0 to terminate expression + m_aCurToken.aText.AssignAscii( ")" ); } break; case '*': { - CurToken.eType = TMULTIPLY; - CurToken.cMathChar = MS_MULTIPLY; - CurToken.nGroup = TGPRODUCT; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "*" ); + m_aCurToken.eType = TMULTIPLY; + m_aCurToken.cMathChar = MS_MULTIPLY; + m_aCurToken.nGroup = TGPRODUCT; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "*" ); } break; case '+': { - if (BufferString.Copy( nRealStart, 2 ). + if (m_aBufferString.Copy( nRealStart, 2 ). EqualsAscii( "+-" )) { - CurToken.eType = TPLUSMINUS; - CurToken.cMathChar = MS_PLUSMINUS; - CurToken.nGroup = TGUNOPER | TGSUM; - CurToken.nLevel = 5; - CurToken.aText.AssignAscii( "+-" ); + m_aCurToken.eType = TPLUSMINUS; + m_aCurToken.cMathChar = MS_PLUSMINUS; + m_aCurToken.nGroup = TGUNOPER | TGSUM; + m_aCurToken.nLevel = 5; + m_aCurToken.aText.AssignAscii( "+-" ); rnEndPos = nRealStart + 2; } else { - CurToken.eType = TPLUS; - CurToken.cMathChar = MS_PLUS; - CurToken.nGroup = TGUNOPER | TGSUM; - CurToken.nLevel = 5; - CurToken.aText.AssignAscii( "+" ); + m_aCurToken.eType = TPLUS; + m_aCurToken.cMathChar = MS_PLUS; + m_aCurToken.nGroup = TGUNOPER | TGSUM; + m_aCurToken.nLevel = 5; + m_aCurToken.aText.AssignAscii( "+" ); } } break; case '-': { - if (BufferString.Copy( nRealStart, 2 ). + if (m_aBufferString.Copy( nRealStart, 2 ). EqualsAscii( "-+" )) { - CurToken.eType = TMINUSPLUS; - CurToken.cMathChar = MS_MINUSPLUS; - CurToken.nGroup = TGUNOPER | TGSUM; - CurToken.nLevel = 5; - CurToken.aText.AssignAscii( "-+" ); + m_aCurToken.eType = TMINUSPLUS; + m_aCurToken.cMathChar = MS_MINUSPLUS; + m_aCurToken.nGroup = TGUNOPER | TGSUM; + m_aCurToken.nLevel = 5; + m_aCurToken.aText.AssignAscii( "-+" ); rnEndPos = nRealStart + 2; } else { - CurToken.eType = TMINUS; - CurToken.cMathChar = MS_MINUS; - CurToken.nGroup = TGUNOPER | TGSUM; - CurToken.nLevel = 5; - CurToken.aText.AssignAscii( "-" ); + m_aCurToken.eType = TMINUS; + m_aCurToken.cMathChar = MS_MINUS; + m_aCurToken.nGroup = TGUNOPER | TGSUM; + m_aCurToken.nLevel = 5; + m_aCurToken.aText.AssignAscii( "-" ); } } break; @@ -954,40 +954,40 @@ void SmParser::NextToken() // for compatibility with SO5.2 // texts like .34 ...56 ... h ...78..90 // will be treated as numbers - CurToken.eType = TNUMBER; - CurToken.cMathChar = '\0'; - CurToken.nGroup = 0; - CurToken.nLevel = 5; + m_aCurToken.eType = TNUMBER; + m_aCurToken.cMathChar = '\0'; + m_aCurToken.nGroup = 0; + m_aCurToken.nLevel = 5; - xub_StrLen nTxtStart = BufferIndex; + xub_StrLen nTxtStart = m_nBufferIndex; sal_Unicode cChar; do { - cChar = BufferString.GetChar( ++BufferIndex ); + cChar = m_aBufferString.GetChar( ++m_nBufferIndex ); } while ( cChar == '.' || IsDigit( cChar ) ); - CurToken.aText = BufferString.Copy( sal::static_int_cast< xub_StrLen >(nTxtStart), - sal::static_int_cast< xub_StrLen >(BufferIndex - nTxtStart) ); - aRes.EndPos = BufferIndex; + m_aCurToken.aText = m_aBufferString.Copy( sal::static_int_cast< xub_StrLen >(nTxtStart), + sal::static_int_cast< xub_StrLen >(m_nBufferIndex - nTxtStart) ); + aRes.EndPos = m_nBufferIndex; } break; case '/': { - CurToken.eType = TDIVIDEBY; - CurToken.cMathChar = MS_SLASH; - CurToken.nGroup = TGPRODUCT; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "/" ); + m_aCurToken.eType = TDIVIDEBY; + m_aCurToken.cMathChar = MS_SLASH; + m_aCurToken.nGroup = TGPRODUCT; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "/" ); } break; case '=': { - CurToken.eType = TASSIGN; - CurToken.cMathChar = MS_ASSIGN; - CurToken.nGroup = TGRELATION; - CurToken.nLevel = 0; - CurToken.aText.AssignAscii( "=" ); + m_aCurToken.eType = TASSIGN; + m_aCurToken.cMathChar = MS_ASSIGN; + m_aCurToken.nGroup = TGRELATION; + m_aCurToken.nLevel = 0; + m_aCurToken.aText.AssignAscii( "=" ); } break; default: @@ -1000,17 +1000,17 @@ void SmParser::NextToken() if (!bHandled) { - CurToken.eType = TCHARACTER; - CurToken.cMathChar = '\0'; - CurToken.nGroup = 0; - CurToken.nLevel = 5; - CurToken.aText = BufferString.Copy( nRealStart, 1 ); + m_aCurToken.eType = TCHARACTER; + m_aCurToken.cMathChar = '\0'; + m_aCurToken.nGroup = 0; + m_aCurToken.nLevel = 5; + m_aCurToken.aText = m_aBufferString.Copy( nRealStart, 1 ); aRes.EndPos = nRealStart + 1; } - if (TEND != CurToken.eType) - BufferIndex = sal::static_int_cast< xub_StrLen >(aRes.EndPos); + if (TEND != m_aCurToken.eType) + m_nBufferIndex = sal::static_int_cast< xub_StrLen >(aRes.EndPos); } @@ -1024,25 +1024,25 @@ void SmParser::Table() SmNodeArray LineArray; Line(); - while (CurToken.eType == TNEWLINE) + while (m_aCurToken.eType == TNEWLINE) { NextToken(); Line(); } - if (CurToken.eType != TEND) + if (m_aCurToken.eType != TEND) Error(PE_UNEXPECTED_CHAR); - ULONG n = NodeStack.Count(); + ULONG n = m_aNodeStack.Count(); LineArray.resize(n); for (ULONG i = 0; i < n; i++) - LineArray[n - (i + 1)] = NodeStack.Pop(); + LineArray[n - (i + 1)] = m_aNodeStack.Pop(); - SmStructureNode *pSNode = new SmTableNode(CurToken); + SmStructureNode *pSNode = new SmTableNode(m_aCurToken); pSNode->SetSubNodes(LineArray); - NodeStack.Push(pSNode); + m_aNodeStack.Push(pSNode); } @@ -1064,19 +1064,21 @@ void SmParser::Align() // (the dominant one in 4.0) and erase all others (especially old // discarded tokens) from command string. while (TokenInGroup(TGALIGN)) - { if (TokenInGroup(TGDISCARDED) || pSNode) - { BufferIndex = GetTokenIndex(); - BufferString.Erase(BufferIndex, CurToken.aText.Len()); + { + if (TokenInGroup(TGDISCARDED) || pSNode) + { + m_nBufferIndex = GetTokenIndex(); + m_aBufferString.Erase(m_nBufferIndex, m_aCurToken.aText.Len()); } else - pSNode = new SmAlignNode(CurToken); + pSNode = new SmAlignNode(m_aCurToken); NextToken(); } } else { - pSNode = new SmAlignNode(CurToken); + pSNode = new SmAlignNode(m_aCurToken); NextToken(); @@ -1094,8 +1096,8 @@ void SmParser::Align() Insert('}', GetTokenIndex()); if (pSNode) - { pSNode->SetSubNodes(NodeStack.Pop(), 0); - NodeStack.Push(pSNode); + { pSNode->SetSubNodes(m_aNodeStack.Pop(), 0); + m_aNodeStack.Push(pSNode); } } @@ -1110,37 +1112,37 @@ void SmParser::Line() // start with single expression that may have an alignment statement // (and go on with expressions that must not have alignment // statements in 'while' loop below. See also 'Expression()'.) - if (CurToken.eType != TEND && CurToken.eType != TNEWLINE) + if (m_aCurToken.eType != TEND && m_aCurToken.eType != TNEWLINE) { Align(); ExpressionArray.resize(++n); - ExpressionArray[n - 1] = NodeStack.Pop(); + ExpressionArray[n - 1] = m_aNodeStack.Pop(); } - while (CurToken.eType != TEND && CurToken.eType != TNEWLINE) + while (m_aCurToken.eType != TEND && m_aCurToken.eType != TNEWLINE) { if (CONVERT_40_TO_50 != GetConversion()) Expression(); else Align(); ExpressionArray.resize(++n); - ExpressionArray[n - 1] = NodeStack.Pop(); + ExpressionArray[n - 1] = m_aNodeStack.Pop(); } - SmStructureNode *pSNode = new SmLineNode(CurToken); + SmStructureNode *pSNode = new SmLineNode(m_aCurToken); pSNode->SetSubNodes(ExpressionArray); - NodeStack.Push(pSNode); + m_aNodeStack.Push(pSNode); } void SmParser::Expression() { BOOL bUseExtraSpaces = TRUE; - SmNode *pNode = NodeStack.Pop(); + SmNode *pNode = m_aNodeStack.Pop(); if (pNode) { if (pNode->GetToken().eType == TNOSPACE) bUseExtraSpaces = FALSE; else - NodeStack.Push(pNode); // push the node from above again (now to be used as argument to this current 'nospace' node) + m_aNodeStack.Push(pNode); // push the node from above again (now to be used as argument to this current 'nospace' node) } USHORT n = 0; @@ -1150,18 +1152,18 @@ void SmParser::Expression() Relation(); RelationArray.resize(++n); - RelationArray[n - 1] = NodeStack.Pop(); + RelationArray[n - 1] = m_aNodeStack.Pop(); - while (CurToken.nLevel >= 4) + while (m_aCurToken.nLevel >= 4) { Relation(); RelationArray.resize(++n); - RelationArray[n - 1] = NodeStack.Pop(); + RelationArray[n - 1] = m_aNodeStack.Pop(); } - SmExpressionNode *pSNode = new SmExpressionNode(CurToken); + SmExpressionNode *pSNode = new SmExpressionNode(m_aCurToken); pSNode->SetSubNodes(RelationArray); pSNode->SetUseExtraSpaces(bUseExtraSpaces); - NodeStack.Push(pSNode); + m_aNodeStack.Push(pSNode); } @@ -1170,16 +1172,16 @@ void SmParser::Relation() Sum(); while (TokenInGroup(TGRELATION)) { - SmStructureNode *pSNode = new SmBinHorNode(CurToken); - SmNode *pFirst = NodeStack.Pop(); + SmStructureNode *pSNode = new SmBinHorNode(m_aCurToken); + SmNode *pFirst = m_aNodeStack.Pop(); OpSubSup(); - SmNode *pSecond = NodeStack.Pop(); + SmNode *pSecond = m_aNodeStack.Pop(); Sum(); - pSNode->SetSubNodes(pFirst, pSecond, NodeStack.Pop()); - NodeStack.Push(pSNode); + pSNode->SetSubNodes(pFirst, pSecond, m_aNodeStack.Pop()); + m_aNodeStack.Push(pSNode); } } @@ -1189,16 +1191,16 @@ void SmParser::Sum() Product(); while (TokenInGroup(TGSUM)) { - SmStructureNode *pSNode = new SmBinHorNode(CurToken); - SmNode *pFirst = NodeStack.Pop(); + SmStructureNode *pSNode = new SmBinHorNode(m_aCurToken); + SmNode *pFirst = m_aNodeStack.Pop(); OpSubSup(); - SmNode *pSecond = NodeStack.Pop(); + SmNode *pSecond = m_aNodeStack.Pop(); Product(); - pSNode->SetSubNodes(pFirst, pSecond, NodeStack.Pop()); - NodeStack.Push(pSNode); + pSNode->SetSubNodes(pFirst, pSecond, m_aNodeStack.Pop()); + m_aNodeStack.Push(pSNode); } } @@ -1209,32 +1211,32 @@ void SmParser::Product() while (TokenInGroup(TGPRODUCT)) { SmStructureNode *pSNode; - SmNode *pFirst = NodeStack.Pop(), + SmNode *pFirst = m_aNodeStack.Pop(), *pOper; BOOL bSwitchArgs = FALSE; - SmTokenType eType = CurToken.eType; + SmTokenType eType = m_aCurToken.eType; switch (eType) { case TOVER: - pSNode = new SmBinVerNode(CurToken); - pOper = new SmRectangleNode(CurToken); + pSNode = new SmBinVerNode(m_aCurToken); + pOper = new SmRectangleNode(m_aCurToken); NextToken(); break; case TBOPER: - pSNode = new SmBinHorNode(CurToken); + pSNode = new SmBinHorNode(m_aCurToken); NextToken(); GlyphSpecial(); - pOper = NodeStack.Pop(); + pOper = m_aNodeStack.Pop(); break; case TOVERBRACE : case TUNDERBRACE : - pSNode = new SmVerticalBraceNode(CurToken); - pOper = new SmMathSymbolNode(CurToken); + pSNode = new SmVerticalBraceNode(m_aCurToken); + pOper = new SmMathSymbolNode(m_aCurToken); NextToken(); break; @@ -1242,11 +1244,11 @@ void SmParser::Product() case TWIDEBACKSLASH: case TWIDESLASH: { - SmBinDiagonalNode *pSTmp = new SmBinDiagonalNode(CurToken); + SmBinDiagonalNode *pSTmp = new SmBinDiagonalNode(m_aCurToken); pSTmp->SetAscending(eType == TWIDESLASH); pSNode = pSTmp; - pOper = new SmPolyLineNode(CurToken); + pOper = new SmPolyLineNode(m_aCurToken); NextToken(); bSwitchArgs =TRUE; @@ -1254,20 +1256,20 @@ void SmParser::Product() } default: - pSNode = new SmBinHorNode(CurToken); + pSNode = new SmBinHorNode(m_aCurToken); OpSubSup(); - pOper = NodeStack.Pop(); + pOper = m_aNodeStack.Pop(); } Power(); if (bSwitchArgs) //! vgl siehe SmBinDiagonalNode::Arrange - pSNode->SetSubNodes(pFirst, NodeStack.Pop(), pOper); + pSNode->SetSubNodes(pFirst, m_aNodeStack.Pop(), pOper); else - pSNode->SetSubNodes(pFirst, pOper, NodeStack.Pop()); - NodeStack.Push(pSNode); + pSNode->SetSubNodes(pFirst, pOper, m_aNodeStack.Pop()); + m_aNodeStack.Push(pSNode); } } @@ -1281,8 +1283,8 @@ void SmParser::SubSup(ULONG nActiveGroup) // already finish return; - SmSubSupNode *pNode = new SmSubSupNode(CurToken); - //! Of course 'CurToken' is just the first sub-/supscript token. + SmSubSupNode *pNode = new SmSubSupNode(m_aCurToken); + //! Of course 'm_aCurToken' is just the first sub-/supscript token. //! It should be of no further interest. The positions of the //! sub-/supscripts will be identified by the corresponding subnodes //! index in the 'aSubNodes' array (enum value from 'SmSubSup'). @@ -1292,14 +1294,14 @@ void SmParser::SubSup(ULONG nActiveGroup) // initialize subnodes array SmNodeArray aSubNodes; aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES); - aSubNodes[0] = NodeStack.Pop(); + aSubNodes[0] = m_aNodeStack.Pop(); for (USHORT i = 1; i < aSubNodes.size(); i++) aSubNodes[i] = NULL; // process all sub-/supscripts int nIndex = 0; while (TokenInGroup(nActiveGroup)) - { SmTokenType eType (CurToken.eType); + { SmTokenType eType (m_aCurToken.eType); // skip sub-/supscript token NextToken(); @@ -1332,18 +1334,18 @@ void SmParser::SubSup(ULONG nActiveGroup) // set sub-/supscript if not already done if (aSubNodes[nIndex] != NULL) Error(PE_DOUBLE_SUBSUPSCRIPT); - aSubNodes[nIndex] = NodeStack.Pop(); + aSubNodes[nIndex] = m_aNodeStack.Pop(); } pNode->SetSubNodes(aSubNodes); - NodeStack.Push(pNode); + m_aNodeStack.Push(pNode); } void SmParser::OpSubSup() { // push operator symbol - NodeStack.Push(new SmMathSymbolNode(CurToken)); + m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken)); // skip operator token NextToken(); // get sub- supscripts if any @@ -1364,28 +1366,28 @@ void SmParser::Power() void SmParser::Blank() { DBG_ASSERT(TokenInGroup(TGBLANK), "Sm : falsches Token"); - SmBlankNode *pBlankNode = new SmBlankNode(CurToken); + SmBlankNode *pBlankNode = new SmBlankNode(m_aCurToken); while (TokenInGroup(TGBLANK)) { - pBlankNode->IncreaseBy(CurToken); + pBlankNode->IncreaseBy(m_aCurToken); NextToken(); } // Blanks am Zeilenende ignorieren wenn die entsprechende Option gesetzt ist - if ( CurToken.eType == TNEWLINE || - (CurToken.eType == TEND && SM_MOD()->GetConfig()->IsIgnoreSpacesRight()) ) + if ( m_aCurToken.eType == TNEWLINE || + (m_aCurToken.eType == TEND && SM_MOD()->GetConfig()->IsIgnoreSpacesRight()) ) { pBlankNode->Clear(); } - NodeStack.Push(pBlankNode); + m_aNodeStack.Push(pBlankNode); } void SmParser::Term() { - switch (CurToken.eType) + switch (m_aCurToken.eType) { case TESCAPE : Escape(); @@ -1394,15 +1396,15 @@ void SmParser::Term() case TNOSPACE : case TLGROUP : { - bool bNoSpace = CurToken.eType == TNOSPACE; + bool bNoSpace = m_aCurToken.eType == TNOSPACE; if (bNoSpace) // push 'no space' node and continue to parse expression { - NodeStack.Push(new SmExpressionNode(CurToken)); + m_aNodeStack.Push(new SmExpressionNode(m_aCurToken)); NextToken(); } - if (CurToken.eType != TLGROUP) + if (m_aCurToken.eType != TLGROUP) { - NodeStack.Pop(); // get rid of the 'no space' node pushed above + m_aNodeStack.Pop(); // get rid of the 'no space' node pushed above Term(); } else @@ -1410,20 +1412,20 @@ void SmParser::Term() NextToken(); // allow for empty group - if (CurToken.eType == TRGROUP) + if (m_aCurToken.eType == TRGROUP) { if (bNoSpace) // get rid of the 'no space' node pushed above - NodeStack.Pop(); - SmStructureNode *pSNode = new SmExpressionNode(CurToken); + m_aNodeStack.Pop(); + SmStructureNode *pSNode = new SmExpressionNode(m_aCurToken); pSNode->SetSubNodes(NULL, NULL); - NodeStack.Push(pSNode); + m_aNodeStack.Push(pSNode); NextToken(); } else // go as usual { Align(); - if (CurToken.eType != TRGROUP) + if (m_aCurToken.eType != TRGROUP) Error(PE_RGROUP_EXPECTED); else NextToken(); @@ -1442,16 +1444,16 @@ void SmParser::Term() break; case TTEXT : - NodeStack.Push(new SmTextNode(CurToken, FNT_TEXT)); + m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_TEXT)); NextToken(); break; case TIDENT : case TCHARACTER : - NodeStack.Push(new SmTextNode(CurToken, FNT_VARIABLE)); + m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_VARIABLE)); NextToken(); break; case TNUMBER : - NodeStack.Push(new SmTextNode(CurToken, FNT_NUMBER)); + m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_NUMBER)); NextToken(); break; @@ -1488,12 +1490,12 @@ void SmParser::Term() case TDOTSLOW : case TDOTSUP : case TDOTSVERT : - NodeStack.Push(new SmMathSymbolNode(CurToken)); + m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken)); NextToken(); break; case TPLACE: - NodeStack.Push(new SmPlaceNode(CurToken)); + m_aNodeStack.Push(new SmPlaceNode(m_aCurToken)); NextToken(); break; @@ -1539,21 +1541,21 @@ void SmParser::Term() FontAttribut(); // check if casting in following line is ok - DBG_ASSERT(!NodeStack.Top()->IsVisible(), "Sm : Ooops..."); + DBG_ASSERT(!m_aNodeStack.Top()->IsVisible(), "Sm : Ooops..."); - aArray[n] = (SmStructureNode *) NodeStack.Pop(); + aArray[n] = (SmStructureNode *) m_aNodeStack.Pop(); n++; } Power(); - SmNode *pFirstNode = NodeStack.Pop(); + SmNode *pFirstNode = m_aNodeStack.Pop(); while (n > 0) { aArray[n - 1]->SetSubNodes(0, pFirstNode); pFirstNode = aArray[n - 1]; n--; } - NodeStack.Push(pFirstNode); + m_aNodeStack.Push(pFirstNode); } else if (TokenInGroup(TGFUNCTION)) { if (CONVERT_40_TO_50 != GetConversion()) @@ -1569,9 +1571,9 @@ void SmParser::Term() // Function(); - SmNode *pFunc = NodeStack.Pop(); + SmNode *pFunc = m_aNodeStack.Pop(); - if (CurToken.eType == TLPARENT) + if (m_aCurToken.eType == TLPARENT) { Term(); } else @@ -1582,8 +1584,8 @@ void SmParser::Term() Insert('}', GetTokenIndex()); SmStructureNode *pSNode = new SmExpressionNode(pFunc->GetToken()); - pSNode->SetSubNodes(pFunc, NodeStack.Pop()); - NodeStack.Push(pSNode); + pSNode->SetSubNodes(pFunc, m_aNodeStack.Pop()); + m_aNodeStack.Push(pSNode); } } else @@ -1597,7 +1599,7 @@ void SmParser::Escape() NextToken(); sal_Unicode cChar; - switch (CurToken.eType) + switch (m_aCurToken.eType) { case TLPARENT : cChar = MS_LPARENT; break; case TRPARENT : cChar = MS_RPARENT; break; case TLBRACKET : cChar = MS_LBRACKET; break; @@ -1622,8 +1624,8 @@ void SmParser::Escape() Error(PE_UNEXPECTED_TOKEN); } - SmNode *pNode = new SmMathSymbolNode(CurToken); - NodeStack.Push(pNode); + SmNode *pNode = new SmMathSymbolNode(m_aCurToken); + m_aNodeStack.Push(pNode); NextToken(); } @@ -1632,27 +1634,27 @@ void SmParser::Escape() void SmParser::Operator() { if (TokenInGroup(TGOPER)) - { SmStructureNode *pSNode = new SmOperNode(CurToken); + { SmStructureNode *pSNode = new SmOperNode(m_aCurToken); // put operator on top of stack Oper(); if (TokenInGroup(TGLIMIT) || TokenInGroup(TGPOWER)) - SubSup(CurToken.nGroup); - SmNode *pOperator = NodeStack.Pop(); + SubSup(m_aCurToken.nGroup); + SmNode *pOperator = m_aNodeStack.Pop(); // get argument Power(); - pSNode->SetSubNodes(pOperator, NodeStack.Pop()); - NodeStack.Push(pSNode); + pSNode->SetSubNodes(pOperator, m_aNodeStack.Pop()); + m_aNodeStack.Push(pSNode); } } void SmParser::Oper() { - SmTokenType eType (CurToken.eType); + SmTokenType eType (m_aCurToken.eType); SmNode *pNode = NULL; switch (eType) @@ -1666,7 +1668,7 @@ void SmParser::Oper() case TLINT : case TLLINT : case TLLLINT : - pNode = new SmMathSymbolNode(CurToken); + pNode = new SmMathSymbolNode(m_aCurToken); break; case TLIM : @@ -1683,27 +1685,27 @@ void SmParser::Oper() break; } if( pLim ) - CurToken.aText.AssignAscii( pLim ); - pNode = new SmTextNode(CurToken, FNT_TEXT); + m_aCurToken.aText.AssignAscii( pLim ); + pNode = new SmTextNode(m_aCurToken, FNT_TEXT); } break; case TOVERBRACE : case TUNDERBRACE : - pNode = new SmMathSymbolNode(CurToken); + pNode = new SmMathSymbolNode(m_aCurToken); break; case TOPER : NextToken(); - DBG_ASSERT(CurToken.eType == TSPECIAL, "Sm: falsches Token"); - pNode = new SmGlyphSpecialNode(CurToken); + DBG_ASSERT(m_aCurToken.eType == TSPECIAL, "Sm: falsches Token"); + pNode = new SmGlyphSpecialNode(m_aCurToken); break; default : DBG_ASSERT(0, "Sm: unbekannter Fall"); } - NodeStack.Push(pNode); + m_aNodeStack.Push(pNode); NextToken(); } @@ -1713,8 +1715,8 @@ void SmParser::UnOper() { DBG_ASSERT(TokenInGroup(TGUNOPER), "Sm: falsches Token"); - SmToken aNodeToken = CurToken; - SmTokenType eType = CurToken.eType; + SmToken aNodeToken = m_aCurToken; + SmTokenType eType = m_aCurToken.eType; BOOL bIsPostfix = eType == TFACT; SmStructureNode *pSNode; @@ -1732,13 +1734,13 @@ void SmParser::UnOper() case TNROOT : NextToken(); Power(); - pExtra = NodeStack.Pop(); + pExtra = m_aNodeStack.Pop(); break; case TUOPER : NextToken(); GlyphSpecial(); - pOper = NodeStack.Pop(); + pOper = m_aNodeStack.Pop(); break; case TPLUS : @@ -1748,7 +1750,7 @@ void SmParser::UnOper() case TNEG : case TFACT : OpSubSup(); - pOper = NodeStack.Pop(); + pOper = m_aNodeStack.Pop(); break; default : @@ -1757,7 +1759,7 @@ void SmParser::UnOper() // get argument Power(); - pArg = NodeStack.Pop(); + pArg = m_aNodeStack.Pop(); if (eType == TABS) { pSNode = new SmBraceNode(aNodeToken); @@ -1791,7 +1793,7 @@ void SmParser::UnOper() pSNode->SetSubNodes(pOper, pArg); } - NodeStack.Push(pSNode); + m_aNodeStack.Push(pSNode); } @@ -1799,35 +1801,35 @@ void SmParser::Attribut() { DBG_ASSERT(TokenInGroup(TGATTRIBUT), "Sm: falsche Tokengruppe"); - SmStructureNode *pSNode = new SmAttributNode(CurToken); + SmStructureNode *pSNode = new SmAttributNode(m_aCurToken); SmNode *pAttr; SmScaleMode eScaleMode = SCALE_NONE; // get appropriate node for the attribut itself - switch (CurToken.eType) + switch (m_aCurToken.eType) { case TUNDERLINE : case TOVERLINE : case TOVERSTRIKE : - pAttr = new SmRectangleNode(CurToken); + pAttr = new SmRectangleNode(m_aCurToken); eScaleMode = SCALE_WIDTH; break; case TWIDEVEC : case TWIDEHAT : case TWIDETILDE : - pAttr = new SmMathSymbolNode(CurToken); + pAttr = new SmMathSymbolNode(m_aCurToken); eScaleMode = SCALE_WIDTH; break; default : - pAttr = new SmMathSymbolNode(CurToken); + pAttr = new SmMathSymbolNode(m_aCurToken); } NextToken(); pSNode->SetSubNodes(pAttr, 0); pSNode->SetScaleMode(eScaleMode); - NodeStack.Push(pSNode); + m_aNodeStack.Push(pSNode); } @@ -1835,14 +1837,14 @@ void SmParser::FontAttribut() { DBG_ASSERT(TokenInGroup(TGFONTATTR), "Sm: falsche Tokengruppe"); - switch (CurToken.eType) + switch (m_aCurToken.eType) { case TITALIC : case TNITALIC : case TBOLD : case TNBOLD : case TPHANTOM : - NodeStack.Push(new SmFontNode(CurToken)); + m_aNodeStack.Push(new SmFontNode(m_aCurToken)); NextToken(); break; @@ -1866,7 +1868,7 @@ void SmParser::FontAttribut() void SmParser::Color() { - DBG_ASSERT(CurToken.eType == TCOLOR, "Sm : Ooops..."); + DBG_ASSERT(m_aCurToken.eType == TCOLOR, "Sm : Ooops..."); // last color rules, get that one SmToken aToken; @@ -1874,20 +1876,20 @@ void SmParser::Color() { NextToken(); if (TokenInGroup(TGCOLOR)) - { aToken = CurToken; + { aToken = m_aCurToken; NextToken(); } else Error(PE_COLOR_EXPECTED); - } while (CurToken.eType == TCOLOR); + } while (m_aCurToken.eType == TCOLOR); - NodeStack.Push(new SmFontNode(aToken)); + m_aNodeStack.Push(new SmFontNode(aToken)); } void SmParser::Font() { - DBG_ASSERT(CurToken.eType == TFONT, "Sm : Ooops..."); + DBG_ASSERT(m_aCurToken.eType == TFONT, "Sm : Ooops..."); // last font rules, get that one SmToken aToken; @@ -1895,14 +1897,14 @@ void SmParser::Font() { NextToken(); if (TokenInGroup(TGFONT)) - { aToken = CurToken; + { aToken = m_aCurToken; NextToken(); } else Error(PE_FONT_EXPECTED); - } while (CurToken.eType == TFONT); + } while (m_aCurToken.eType == TFONT); - NodeStack.Push(new SmFontNode(aToken)); + m_aNodeStack.Push(new SmFontNode(aToken)); } @@ -1930,14 +1932,14 @@ BOOL lcl_IsNumber(const UniString& rText) void SmParser::FontSize() { - DBG_ASSERT(CurToken.eType == TSIZE, "Sm : Ooops..."); + DBG_ASSERT(m_aCurToken.eType == TSIZE, "Sm : Ooops..."); USHORT Type; - SmFontNode *pFontNode = new SmFontNode(CurToken); + SmFontNode *pFontNode = new SmFontNode(m_aCurToken); NextToken(); - switch (CurToken.eType) + switch (m_aCurToken.eType) { case TNUMBER: Type = FNTSIZ_ABSOLUT; break; case TPLUS: Type = FNTSIZ_PLUS; break; @@ -1954,7 +1956,7 @@ void SmParser::FontSize() if (Type != FNTSIZ_ABSOLUT) { NextToken(); - if (CurToken.eType != TNUMBER) + if (m_aCurToken.eType != TNUMBER) { delete pFontNode; Error(PE_SIZE_EXPECTED); @@ -1964,10 +1966,10 @@ void SmParser::FontSize() // get number argument Fraction aValue( 1L ); - if (lcl_IsNumber( CurToken.aText )) + if (lcl_IsNumber( m_aCurToken.aText )) { double fTmp; - if ((fTmp = CurToken.aText.ToDouble()) != 0.0) + if ((fTmp = m_aCurToken.aText.ToDouble()) != 0.0) { aValue = fTmp; @@ -1993,23 +1995,23 @@ void SmParser::FontSize() NextToken(); pFontNode->SetSizeParameter(aValue, Type); - NodeStack.Push(pFontNode); + m_aNodeStack.Push(pFontNode); } void SmParser::Brace() { - DBG_ASSERT(CurToken.eType == TLEFT || TokenInGroup(TGLBRACES), + DBG_ASSERT(m_aCurToken.eType == TLEFT || TokenInGroup(TGLBRACES), "Sm: kein Klammer Ausdruck"); - SmStructureNode *pSNode = new SmBraceNode(CurToken); + SmStructureNode *pSNode = new SmBraceNode(m_aCurToken); SmNode *pBody = 0, *pLeft = 0, *pRight = 0; SmScaleMode eScaleMode = SCALE_NONE; SmParseError eError = PE_NONE; - if (CurToken.eType == TLEFT) + if (m_aCurToken.eType == TLEFT) { NextToken(); eScaleMode = SCALE_HEIGHT; @@ -2017,19 +2019,19 @@ void SmParser::Brace() // check for left bracket if (TokenInGroup(TGLBRACES) || TokenInGroup(TGRBRACES)) { - pLeft = new SmMathSymbolNode(CurToken); + pLeft = new SmMathSymbolNode(m_aCurToken); NextToken(); Bracebody(TRUE); - pBody = NodeStack.Pop(); + pBody = m_aNodeStack.Pop(); - if (CurToken.eType == TRIGHT) + if (m_aCurToken.eType == TRIGHT) { NextToken(); // check for right bracket if (TokenInGroup(TGLBRACES) || TokenInGroup(TGRBRACES)) { - pRight = new SmMathSymbolNode(CurToken); + pRight = new SmMathSymbolNode(m_aCurToken); NextToken(); } else @@ -2045,11 +2047,11 @@ void SmParser::Brace() { if (TokenInGroup(TGLBRACES)) { - pLeft = new SmMathSymbolNode(CurToken); + pLeft = new SmMathSymbolNode(m_aCurToken); NextToken(); Bracebody(FALSE); - pBody = NodeStack.Pop(); + pBody = m_aNodeStack.Pop(); SmTokenType eExpectedType = TUNKNOWN; switch (pLeft->GetToken().eType) @@ -2066,9 +2068,9 @@ void SmParser::Brace() DBG_ASSERT(0, "Sm: unbekannter Fall"); } - if (CurToken.eType == eExpectedType) + if (m_aCurToken.eType == eExpectedType) { - pRight = new SmMathSymbolNode(CurToken); + pRight = new SmMathSymbolNode(m_aCurToken); NextToken(); } else @@ -2083,7 +2085,7 @@ void SmParser::Brace() DBG_ASSERT(pRight, "Sm: NULL pointer"); pSNode->SetSubNodes(pLeft, pBody, pRight); pSNode->SetScaleMode(eScaleMode); - NodeStack.Push(pSNode); + m_aNodeStack.Push(pSNode); } else { delete pSNode; @@ -2098,7 +2100,7 @@ void SmParser::Brace() void SmParser::Bracebody(BOOL bIsLeftRight) { - SmStructureNode *pBody = new SmBracebodyNode(CurToken); + SmStructureNode *pBody = new SmBracebodyNode(m_aCurToken); SmNodeArray aNodes; USHORT nNum = 0; @@ -2107,28 +2109,28 @@ void SmParser::Bracebody(BOOL bIsLeftRight) { do { - if (CurToken.eType == TMLINE) + if (m_aCurToken.eType == TMLINE) { - NodeStack.Push(new SmMathSymbolNode(CurToken)); + m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken)); NextToken(); nNum++; } - else if (CurToken.eType != TRIGHT) + else if (m_aCurToken.eType != TRIGHT) { Align(); nNum++; - if (CurToken.eType != TMLINE && CurToken.eType != TRIGHT) + if (m_aCurToken.eType != TMLINE && m_aCurToken.eType != TRIGHT) Error(PE_RIGHT_EXPECTED); } - } while (CurToken.eType != TEND && CurToken.eType != TRIGHT); + } while (m_aCurToken.eType != TEND && m_aCurToken.eType != TRIGHT); } else { do { - if (CurToken.eType == TMLINE) + if (m_aCurToken.eType == TMLINE) { - NodeStack.Push(new SmMathSymbolNode(CurToken)); + m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken)); NextToken(); nNum++; } @@ -2136,26 +2138,26 @@ void SmParser::Bracebody(BOOL bIsLeftRight) { Align(); nNum++; - if (CurToken.eType != TMLINE && !TokenInGroup(TGRBRACES)) + if (m_aCurToken.eType != TMLINE && !TokenInGroup(TGRBRACES)) Error(PE_RBRACE_EXPECTED); } - } while (CurToken.eType != TEND && !TokenInGroup(TGRBRACES)); + } while (m_aCurToken.eType != TEND && !TokenInGroup(TGRBRACES)); } // build argument vector in parsing order aNodes.resize(nNum); for (USHORT i = 0; i < nNum; i++) - aNodes[nNum - 1 - i] = NodeStack.Pop(); + aNodes[nNum - 1 - i] = m_aNodeStack.Pop(); pBody->SetSubNodes(aNodes); pBody->SetScaleMode(bIsLeftRight ? SCALE_HEIGHT : SCALE_NONE); - NodeStack.Push(pBody); + m_aNodeStack.Push(pBody); } void SmParser::Function() { - switch (CurToken.eType) + switch (m_aCurToken.eType) { case TFUNC: NextToken(); // skip "FUNC"-statement @@ -2180,7 +2182,7 @@ void SmParser::Function() case TLN : case TLOG : case TEXP : - NodeStack.Push(new SmTextNode(CurToken, FNT_FUNCTION)); + m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_FUNCTION)); NextToken(); break; @@ -2193,7 +2195,7 @@ void SmParser::Function() void SmParser::Binom() { SmNodeArray ExpressionArray; - SmStructureNode *pSNode = new SmTableNode(CurToken); + SmStructureNode *pSNode = new SmTableNode(m_aCurToken); NextToken(); @@ -2203,10 +2205,10 @@ void SmParser::Binom() ExpressionArray.resize(2); for (int i = 0; i < 2; i++) - ExpressionArray[2 - (i + 1)] = NodeStack.Pop(); + ExpressionArray[2 - (i + 1)] = m_aNodeStack.Pop(); pSNode->SetSubNodes(ExpressionArray); - NodeStack.Push(pSNode); + m_aNodeStack.Push(pSNode); } @@ -2214,7 +2216,7 @@ void SmParser::Stack() { SmNodeArray ExpressionArray; NextToken(); - if (CurToken.eType == TLGROUP) + if (m_aCurToken.eType == TLGROUP) { USHORT n = 0; @@ -2224,21 +2226,21 @@ void SmParser::Stack() Align(); n++; } - while (CurToken.eType == TPOUND); + while (m_aCurToken.eType == TPOUND); ExpressionArray.resize(n); for (USHORT i = 0; i < n; i++) - ExpressionArray[n - (i + 1)] = NodeStack.Pop(); + ExpressionArray[n - (i + 1)] = m_aNodeStack.Pop(); - if (CurToken.eType != TRGROUP) + if (m_aCurToken.eType != TRGROUP) Error(PE_RGROUP_EXPECTED); NextToken(); - SmStructureNode *pSNode = new SmTableNode(CurToken); + SmStructureNode *pSNode = new SmTableNode(m_aCurToken); pSNode->SetSubNodes(ExpressionArray); - NodeStack.Push(pSNode); + m_aNodeStack.Push(pSNode); } else Error(PE_LGROUP_EXPECTED); @@ -2250,7 +2252,7 @@ void SmParser::Matrix() SmNodeArray ExpressionArray; NextToken(); - if (CurToken.eType == TLGROUP) + if (m_aCurToken.eType == TLGROUP) { USHORT c = 0; @@ -2260,11 +2262,11 @@ void SmParser::Matrix() Align(); c++; } - while (CurToken.eType == TPOUND); + while (m_aCurToken.eType == TPOUND); USHORT r = 1; - while (CurToken.eType == TDPOUND) + while (m_aCurToken.eType == TDPOUND) { NextToken(); for (USHORT i = 0; i < c; i++) @@ -2272,7 +2274,7 @@ void SmParser::Matrix() Align(); if (i < (c - 1)) { - if (CurToken.eType == TPOUND) + if (m_aCurToken.eType == TPOUND) { NextToken(); } @@ -2289,17 +2291,17 @@ void SmParser::Matrix() ExpressionArray.resize(nRC); for (USHORT i = 0; i < (nRC); i++) - ExpressionArray[(nRC) - (i + 1)] = NodeStack.Pop(); + ExpressionArray[(nRC) - (i + 1)] = m_aNodeStack.Pop(); - if (CurToken.eType != TRGROUP) + if (m_aCurToken.eType != TRGROUP) Error(PE_RGROUP_EXPECTED); NextToken(); - SmMatrixNode *pMNode = new SmMatrixNode(CurToken); + SmMatrixNode *pMNode = new SmMatrixNode(m_aCurToken); pMNode->SetSubNodes(ExpressionArray); pMNode->SetRowCol(r, c); - NodeStack.Push(pMNode); + m_aNodeStack.Push(pMNode); } else Error(PE_LGROUP_EXPECTED); @@ -2309,7 +2311,7 @@ void SmParser::Matrix() void SmParser::Special() { BOOL bReplace = FALSE; - String &rName = CurToken.aText; + String &rName = m_aCurToken.aText; String aNewName; if (CONVERT_NONE == GetConversion()) @@ -2371,28 +2373,33 @@ void SmParser::Special() rName = aNewName; } - NodeStack.Push(new SmSpecialNode(CurToken)); + // add symbol name to list of used symbols + const String aSymbolName( m_aCurToken.aText.Copy( 1 ) ); + if (aSymbolName.Len() > 0 ) + AddToUsedSymbols( aSymbolName ); + + m_aNodeStack.Push(new SmSpecialNode(m_aCurToken)); NextToken(); } void SmParser::GlyphSpecial() { - NodeStack.Push(new SmGlyphSpecialNode(CurToken)); + m_aNodeStack.Push(new SmGlyphSpecialNode(m_aCurToken)); NextToken(); } void SmParser::Error(SmParseError eError) { - SmStructureNode *pSNode = new SmExpressionNode(CurToken); - SmErrorNode *pErr = new SmErrorNode(eError, CurToken); + SmStructureNode *pSNode = new SmExpressionNode(m_aCurToken); + SmErrorNode *pErr = new SmErrorNode(eError, m_aCurToken); pSNode->SetSubNodes(pErr, 0); //! put a structure node on the stack (instead of the error node itself) //! because sometimes such a node is expected in order to attach some //! subnodes - NodeStack.Push(pSNode); + m_aNodeStack.Push(pSNode); AddError(eError, pSNode); @@ -2405,34 +2412,36 @@ void SmParser::Error(SmParseError eError) SmParser::SmParser() { - eConversion = CONVERT_NONE; - bImportSymNames = bExportSymNames = FALSE; - nLang = Application::GetSettings().GetUILanguage(); + m_eConversion = CONVERT_NONE; + m_bImportSymNames = m_bExportSymNames = FALSE; + m_nLang = Application::GetSettings().GetUILanguage(); } SmNode *SmParser::Parse(const String &rBuffer) { - BufferString = rBuffer; - BufferString.ConvertLineEnd( LINEEND_LF ); - BufferIndex = - nTokenIndex = 0; - Row = 1; - ColOff = 0; - CurError = -1; + ClearUsedSymbols(); + + m_aBufferString = rBuffer; + m_aBufferString.ConvertLineEnd( LINEEND_LF ); + m_nBufferIndex = + m_nTokenIndex = 0; + m_Row = 1; + m_nColOff = 0; + m_nCurError = -1; - for (USHORT i = 0; i < ErrDescList.Count(); i++) - delete ErrDescList.Remove(i); + for (USHORT i = 0; i < m_aErrDescList.Count(); i++) + delete m_aErrDescList.Remove(i); - ErrDescList.Clear(); + m_aErrDescList.Clear(); - NodeStack.Clear(); + m_aNodeStack.Clear(); SetLanguage( Application::GetSettings().GetUILanguage() ); NextToken(); Table(); - return NodeStack.Pop(); + return m_aNodeStack.Pop(); } @@ -2466,20 +2475,20 @@ USHORT SmParser::AddError(SmParseError Type, SmNode *pNode) } pErrDesc->Text += SmResId(nRID); - ErrDescList.Insert(pErrDesc); + m_aErrDescList.Insert(pErrDesc); - return (USHORT) ErrDescList.GetPos(pErrDesc); + return (USHORT) m_aErrDescList.GetPos(pErrDesc); } const SmErrorDesc *SmParser::NextError() { - if (ErrDescList.Count()) - if (CurError > 0) return ErrDescList.Seek(--CurError); + if (m_aErrDescList.Count()) + if (m_nCurError > 0) return m_aErrDescList.Seek(--m_nCurError); else { - CurError = 0; - return ErrDescList.Seek(CurError); + m_nCurError = 0; + return m_aErrDescList.Seek(m_nCurError); } else return 0; } @@ -2487,12 +2496,12 @@ const SmErrorDesc *SmParser::NextError() const SmErrorDesc *SmParser::PrevError() { - if (ErrDescList.Count()) - if (CurError < (int) (ErrDescList.Count() - 1)) return ErrDescList.Seek(++CurError); + if (m_aErrDescList.Count()) + if (m_nCurError < (int) (m_aErrDescList.Count() - 1)) return m_aErrDescList.Seek(++m_nCurError); else { - CurError = (int) (ErrDescList.Count() - 1); - return ErrDescList.Seek(CurError); + m_nCurError = (int) (m_aErrDescList.Count() - 1); + return m_aErrDescList.Seek(m_nCurError); } else return 0; } @@ -2500,9 +2509,9 @@ const SmErrorDesc *SmParser::PrevError() const SmErrorDesc *SmParser::GetError(USHORT i) { - return (/*i >= 0 &&*/ i < ErrDescList.Count()) - ? ErrDescList.Seek(i) - : ErrDescList.Seek(CurError); + return (/*i >= 0 &&*/ i < m_aErrDescList.Count()) + ? m_aErrDescList.Seek(i) + : m_aErrDescList.Seek(m_nCurError); } diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx index da6259076adc..5d401d2d279c 100644..100755 --- a/starmath/source/smmod.cxx +++ b/starmath/source/smmod.cxx @@ -362,6 +362,7 @@ SfxItemSet* SmModule::CreateItemSet( USHORT nId ) SID_PRINTTEXT, SID_PRINTTEXT, SID_PRINTFRAME, SID_PRINTFRAME, SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES, + SID_SAVE_ONLY_USED_SYMBOLS, SID_SAVE_ONLY_USED_SYMBOLS, 0 ); GetConfig()->ConfigToItemSet(*pRet); diff --git a/starmath/source/smres.src b/starmath/source/smres.src index c35d77c9afcf..e753573b91c8 100755 --- a/starmath/source/smres.src +++ b/starmath/source/smres.src @@ -1058,6 +1058,13 @@ TabPage RID_PRINTOPTIONPAGE Size = MAP_APPFONT ( 236 , 10 ) ; Text [ en-US ] = "Ig~nore ~~ and ` at the end of the line"; }; + CheckBox CB_SAVE_ONLY_USED_SYMBOLS + { + TabStop = TRUE ; + Pos = MAP_APPFONT ( 12 , 154 ) ; + Size = MAP_APPFONT ( 236 , 10 ) ; + Text [ en-US ] = "Embed only used symbols (smaller file size)"; + }; }; ModalDialog RID_SYMBOLDIALOG diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx index 5208ce3644ce..5692b6f0ad69 100644 --- a/starmath/source/symbol.cxx +++ b/starmath/source/symbol.cxx @@ -218,14 +218,19 @@ bool SmSymbolManager::AddOrReplaceSymbol( const SmSym &rSymbol, bool bForceChang } else if (pFound && !bForceChange && bSymbolConflict) { - // TODO: but what ... - DBG_ASSERT( 0, "symbol conflict, different symbol with same name found!" ); + // TODO: to solve this a document owned symbol manager would be required ... + // But for now we have a global one to easily support availability of all + // symbols in all formulas. A copy of the global one would be needed here + // and then the new symbol has to be forcefully applied. This would keep + // the current formula intact but will leave the set of symbols in the + // global symbol manager somewhat to chance. + DBG_ASSERT( 0, "symbol conflict, different symbol with same name found!" ); } - } - DBG_ASSERT( bAdded, "failed to add symbol" ); - if (bAdded) - m_bModified = true; + if (bAdded) + m_bModified = true; + DBG_ASSERT( bAdded || (pFound && !bSymbolConflict), "AddOrReplaceSymbol: unresolved symbol conflict" ); + } return bAdded; } diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 9d008f326d2f..e5a4d0794c02 100644..100755 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -171,7 +171,11 @@ SmPrintUIOptions::SmPrintUIOptions() // // class SmModel // -#define PROPERTY_NONE 0 + +// values from com/sun/star/beans/PropertyAttribute +#define PROPERTY_NONE 0 +#define PROPERTY_READONLY 16 + enum SmModelPropertyHandles { HANDLE_FORMULA, @@ -233,6 +237,7 @@ enum SmModelPropertyHandles HANDLE_PRINTER_NAME, HANDLE_PRINTER_SETUP, HANDLE_SYMBOLS, + HANDLE_USED_SYMBOLS, HANDLE_BASIC_LIBRARIES, /* #93295# */ HANDLE_RUNTIME_UID, // --> PB 2004-08-25 #i33095# Security Options @@ -306,6 +311,7 @@ PropertySetInfo * lcl_createModelPropertyInfo () { RTL_CONSTASCII_STRINGPARAM( "RightMargin" ), HANDLE_RIGHT_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_RIGHTSPACE }, { RTL_CONSTASCII_STRINGPARAM( "RuntimeUID" ), HANDLE_RUNTIME_UID , &::getCppuType(static_cast< const rtl::OUString * >(0)), PropertyAttribute::READONLY, 0 }, { RTL_CONSTASCII_STRINGPARAM( "Symbols" ), HANDLE_SYMBOLS , &::getCppuType((const Sequence < SymbolDescriptor > *)0), PROPERTY_NONE, 0 }, + { RTL_CONSTASCII_STRINGPARAM( "UserDefinedSymbolsInUse" ), HANDLE_USED_SYMBOLS , &::getCppuType((const Sequence < SymbolDescriptor > *)0), PropertyAttribute::READONLY, 0 }, { RTL_CONSTASCII_STRINGPARAM( "TopMargin" ), HANDLE_TOP_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_TOPSPACE }, // --> PB 2004-08-25 #i33095# Security Options { RTL_CONSTASCII_STRINGPARAM( "LoadReadonly" ), HANDLE_LOAD_READONLY, &::getBooleanCppuType(), PROPERTY_NONE, 0 }, @@ -900,7 +906,11 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu } break; case HANDLE_SYMBOLS: + case HANDLE_USED_SYMBOLS: { + const bool bUsedSymbolsOnly = (*ppEntries)->mnHandle == HANDLE_USED_SYMBOLS; + const std::set< rtl::OUString > &rUsedSymbols = pDocSh->GetUsedSymbols(); + // this is get SmModule *pp = SM_MOD(); const SmSymbolManager &rManager = pp->GetSymbolManager(); @@ -911,7 +921,9 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu for (size_t i = 0; i < aSymbols.size(); ++i) { const SmSym * pSymbol = aSymbols[ i ]; - if (pSymbol && !pSymbol->IsPredefined () ) + const bool bIsUsedSymbol = rUsedSymbols.find( pSymbol->GetName() ) != rUsedSymbols.end(); + if (pSymbol && !pSymbol->IsPredefined() && + (!bUsedSymbolsOnly || bIsUsedSymbol)) { aVector.push_back ( pSymbol ); nCount++; |