[Libreoffice-commits] core.git: starmath/inc starmath/source
dante (via logerrit)
logerrit at kemper.freedesktop.org
Mon Feb 8 12:59:00 UTC 2021
starmath/inc/parse.hxx | 2 +-
starmath/source/parse.cxx | 22 +++++++++++++++-------
2 files changed, 16 insertions(+), 8 deletions(-)
New commits:
commit 667a84c69140bae1020fa1cc019d310b0d382d14
Author: dante <dante19031999 at gmail.com>
AuthorDate: Fri Feb 5 13:39:29 2021 +0100
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Feb 8 13:58:21 2021 +0100
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 at collabora.co.uk>
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))
{
More information about the Libreoffice-commits
mailing list