diff options
author | dante <dante19031999@gmail.com> | 2021-02-05 13:39:29 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-02-08 13:58:21 +0100 |
commit | 667a84c69140bae1020fa1cc019d310b0d382d14 (patch) | |
tree | 0459df0637188055a4c37884615c316b3f3f4d53 /starmath | |
parent | 89d770f9727b9e7eddf933c96771df98082b3efb (diff) |
Simplified addition of color palettes
For use of LO based code, won't implement more palettes
But will be helpfull for definecolor command
Change-Id: Id68b075fb69254a8d5e9c4c0358b3ee3cd99a0c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110474
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/parse.hxx | 2 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 22 |
2 files changed, 16 insertions, 8 deletions
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index 88024572db82..591db3637714 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -134,7 +134,7 @@ class SmParser // Moves between tokens inside starmath code. void NextToken(); - void NextTokenColor(bool dvipload); + void NextTokenColor(SmTokenType dvipload); void NextTokenFontSize(); sal_Int32 GetTokenIndex() const { return m_nTokenIndex; } void Replace( sal_Int32 nPos, sal_Int32 nLen, const OUString &rText ); diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 7584c712b96e..41a6d482cf8f 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -980,7 +980,7 @@ void SmParser::NextToken() //Central part of the parser m_nBufferIndex = aRes.EndPos; } -void SmParser::NextTokenColor(bool dvipload) +void SmParser::NextTokenColor(SmTokenType dvipload) { sal_Int32 nBufLen = m_aBufferString.getLength(); @@ -1033,10 +1033,18 @@ void SmParser::NextTokenColor(bool dvipload) sal_Int32 n = aRes.EndPos - nRealStart; assert(n >= 0); OUString aName( m_aBufferString.copy( nRealStart, n ) ); - const SmColorTokenTableEntry* aSmColorTokenTableEntry; - if(dvipload) aSmColorTokenTableEntry = starmathdatabase::Identify_ColorName_DVIPSNAMES( aName ); - else aSmColorTokenTableEntry = starmathdatabase::Identify_ColorName_Parser( aName ); - m_aCurToken = aSmColorTokenTableEntry; + switch(dvipload) + { + case TCOLOR: + m_aCurToken = starmathdatabase::Identify_ColorName_Parser( aName ); + break; + case TDVIPSNAMESCOL: + m_aCurToken = starmathdatabase::Identify_ColorName_DVIPSNAMES( aName ); + break; + default: + m_aCurToken = starmathdatabase::Identify_ColorName_Parser( aName ); + break; + } } else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR) { @@ -2070,10 +2078,10 @@ std::unique_ptr<SmStructureNode> SmParser::DoColor() DepthProtect aDepthGuard(m_nParseDepth); assert(m_aCurToken.eType == TCOLOR); - NextTokenColor(false); + NextTokenColor(TCOLOR); SmToken aToken; - if( m_aCurToken.eType == TDVIPSNAMESCOL ) NextTokenColor(true); + if( m_aCurToken.eType == TDVIPSNAMESCOL ) NextTokenColor(TDVIPSNAMESCOL); if( m_aCurToken.eType == TERROR ) return DoError(SmParseError::ColorExpected); if (TokenInGroup(TG::Color)) { |