[Libreoffice-commits] core.git: starmath/inc starmath/source
dante (via logerrit)
logerrit at kemper.freedesktop.org
Sat Feb 6 19:54:08 UTC 2021
starmath/inc/node.hxx | 3 -
starmath/inc/token.hxx | 14 ++--
starmath/source/cursor.cxx | 18 +++---
starmath/source/mathml/mathmlimport.cxx | 68 +++++++++++------------
starmath/source/node.cxx | 8 +-
starmath/source/ooxmlexport.cxx | 3 -
starmath/source/parse.cxx | 94 ++++++++++++++++----------------
starmath/source/visitors.cxx | 2
8 files changed, 105 insertions(+), 105 deletions(-)
New commits:
commit 96e9870b3204eabc6bca1c92f714f80592a54102
Author: dante <dante19031999 at gmail.com>
AuthorDate: Fri Feb 5 16:27:40 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Feb 6 20:53:22 2021 +0100
Use multichar operators
There are no functional changes, only type change.
This patch unlocks other possibilities like:
- Syntax highlight for errors
- Visual editor for structure nodes
- Implement some mathml features
Change-Id: I76a1b62126ae5fcb6a7285b07b24e9defa63fd44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110481
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index 3c267bb4a9ad..61f98ec75d87 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -972,8 +972,7 @@ protected:
SmMathSymbolNode(SmNodeType eNodeType, const SmToken &rNodeToken)
: SmSpecialNode(eNodeType, rNodeToken, FNT_MATH)
{
- sal_Unicode cChar = GetToken().cMathChar;
- if (u'\0' != cChar) SetText(OUString(cChar));
+ SetText(GetToken().cMathChar);
}
public:
diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx
index 600c29b9f889..5b903cc7bc1c 100644
--- a/starmath/inc/token.hxx
+++ b/starmath/inc/token.hxx
@@ -211,7 +211,7 @@ struct SmToken
{
OUString aText; // token text
SmTokenType eType; // token info
- sal_Unicode cMathChar;
+ OUString cMathChar;
// parse-help info
TG nGroup;
@@ -247,7 +247,7 @@ struct SmToken
{
aText = aTokenTableEntry.pIdent;
eType = aTokenTableEntry.eType;
- cMathChar = aTokenTableEntry.cMathChar;
+ cMathChar = OUString(&aTokenTableEntry.cMathChar, 1);
nGroup = aTokenTableEntry.nGroup;
nLevel = aTokenTableEntry.nLevel;
nRow = 0;
@@ -258,7 +258,7 @@ struct SmToken
{
aText = aTokenTableEntry->pIdent;
eType = aTokenTableEntry->eType;
- cMathChar = aTokenTableEntry->cMathChar;
+ cMathChar = OUString(&aTokenTableEntry->cMathChar, 1);
nGroup = aTokenTableEntry->nGroup;
nLevel = aTokenTableEntry->nLevel;
nRow = 0;
@@ -269,7 +269,7 @@ struct SmToken
{
aText = OUString::number(static_cast<sal_uInt32>(aTokenTableEntry.cColor), 16);
eType = aTokenTableEntry.eType;
- cMathChar = MS_NULLCHAR;
+ cMathChar = u"";
nGroup = TG::Color;
nLevel = 0;
nRow = 0;
@@ -280,7 +280,7 @@ struct SmToken
{
aText = OUString::number(static_cast<sal_uInt32>(aTokenTableEntry->cColor), 16);
eType = aTokenTableEntry->eType;
- cMathChar = MS_NULLCHAR;
+ cMathChar = u"";
nGroup = TG::Color;
nLevel = 0;
nRow = 0;
@@ -291,12 +291,14 @@ struct SmToken
{
aText = OUString::number(static_cast<sal_uInt32>(aTokenTableEntry->cColor), 16);
eType = aTokenTableEntry->eType;
- cMathChar = MS_NULLCHAR;
+ cMathChar = u"";
nGroup = TG::Color;
nLevel = 0;
nRow = 0;
nCol = 0;
}
+
+ void setChar(sal_Unicode cChar) { cMathChar = OUString(&cChar, 1); }
};
#endif
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index cdac53d4a234..a7d5ba76c542 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -864,7 +864,7 @@ void SmCursor::InsertText(const OUString& aString)
SmToken token;
token.eType = TIDENT;
- token.cMathChar = '\0';
+ token.cMathChar = u"";
token.nGroup = TG::NONE;
token.nLevel = 5;
token.aText = aString;
@@ -908,7 +908,7 @@ void SmCursor::InsertElement(SmFormulaElement element){
{
SmToken token;
token.eType = TPLUS;
- token.cMathChar = MS_PLUS;
+ token.setChar(MS_PLUS);
token.nGroup = TG::UnOper | TG::Sum;
token.nLevel = 5;
token.aText = "+";
@@ -918,7 +918,7 @@ void SmCursor::InsertElement(SmFormulaElement element){
{
SmToken token;
token.eType = TMINUS;
- token.cMathChar = MS_MINUS;
+ token.setChar(MS_MINUS);
token.nGroup = TG::UnOper | TG::Sum;
token.nLevel = 5;
token.aText = "-";
@@ -928,7 +928,7 @@ void SmCursor::InsertElement(SmFormulaElement element){
{
SmToken token;
token.eType = TCDOT;
- token.cMathChar = MS_CDOT;
+ token.setChar(MS_CDOT);
token.nGroup = TG::Product;
token.aText = "cdot";
pNewNode = new SmMathSymbolNode(token);
@@ -937,7 +937,7 @@ void SmCursor::InsertElement(SmFormulaElement element){
{
SmToken token;
token.eType = TASSIGN;
- token.cMathChar = MS_ASSIGN;
+ token.setChar(MS_ASSIGN);
token.nGroup = TG::Relation;
token.aText = "=";
pNewNode = new SmMathSymbolNode(token);
@@ -946,7 +946,7 @@ void SmCursor::InsertElement(SmFormulaElement element){
{
SmToken token;
token.eType = TLT;
- token.cMathChar = MS_LT;
+ token.setChar(MS_LT);
token.nGroup = TG::Relation;
token.aText = "<";
pNewNode = new SmMathSymbolNode(token);
@@ -955,7 +955,7 @@ void SmCursor::InsertElement(SmFormulaElement element){
{
SmToken token;
token.eType = TGT;
- token.cMathChar = MS_GT;
+ token.setChar(MS_GT);
token.nGroup = TG::Relation;
token.aText = ">";
pNewNode = new SmMathSymbolNode(token);
@@ -964,7 +964,7 @@ void SmCursor::InsertElement(SmFormulaElement element){
{
SmToken token;
token.eType = TTEXT;
- token.cMathChar = MS_PERCENT;
+ token.setChar(MS_PERCENT);
token.nGroup = TG::NONE;
token.aText = "\"%\"";
pNewNode = new SmMathSymbolNode(token);
@@ -993,7 +993,7 @@ void SmCursor::InsertSpecial(const OUString& _aString)
//Create instance of special node
SmToken token;
token.eType = TSPECIAL;
- token.cMathChar = '\0';
+ token.cMathChar = u"";
token.nGroup = TG::NONE;
token.nLevel = 5;
token.aText = aString;
diff --git a/starmath/source/mathml/mathmlimport.cxx b/starmath/source/mathml/mathmlimport.cxx
index 2da898e31e48..3c2f0e5aa2bf 100644
--- a/starmath/source/mathml/mathmlimport.cxx
+++ b/starmath/source/mathml/mathmlimport.cxx
@@ -634,7 +634,7 @@ void SmXMLContext_Helper::ApplyAttrs()
return;
SmToken aToken;
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.nLevel = 5;
if (nIsBold != -1)
@@ -824,7 +824,7 @@ void SmXMLTokenAttrHelper::ApplyAttrs(MathMLMathvariantValue eDefaultMv)
{
SmToken aToken;
aToken.eType = eType;
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.nLevel = 5;
std::unique_ptr<SmFontNode> pFontNode(new SmFontNode(aToken));
pFontNode->SetSubNodes(nullptr, popOrZero(rNodeStack));
@@ -1020,7 +1020,7 @@ void SmXMLPhantomContext_Impl::endFastElement(sal_Int32 nElement)
SmXMLRowContext_Impl::endFastElement(nElement);
SmToken aToken;
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.nLevel = 5;
aToken.eType = TPHANTOM;
@@ -1082,7 +1082,7 @@ void SmXMLFencedContext_Impl::startFastElement(
void SmXMLFencedContext_Impl::endFastElement(sal_Int32 /*nElement*/)
{
SmToken aToken;
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.aText = ",";
aToken.nLevel = 5;
@@ -1104,7 +1104,7 @@ void SmXMLFencedContext_Impl::endFastElement(sal_Int32 /*nElement*/)
SmNodeArray aRelationArray;
SmNodeStack& rNodeStack = GetSmImport().GetNodeStack();
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.eType = TIDENT;
auto i = rNodeStack.size() - nElementCount;
@@ -1172,7 +1172,7 @@ public:
SmXMLNumberContext_Impl(SmXMLImport& rImport)
: SmXMLImportContext(rImport)
{
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.nLevel = 5;
aToken.eType = TNUMBER;
}
@@ -1245,7 +1245,7 @@ public:
SmXMLTextContext_Impl(SmXMLImport& rImport)
: SmXMLImportContext(rImport)
{
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.nLevel = 5;
aToken.eType = TTEXT;
}
@@ -1274,7 +1274,7 @@ public:
SmXMLStringContext_Impl(SmXMLImport& rImport)
: SmXMLImportContext(rImport)
{
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.nLevel = 5;
aToken.eType = TTEXT;
}
@@ -1319,7 +1319,7 @@ public:
, maTokenAttrHelper(*this)
, aStyleHelper(*this)
{
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.nLevel = 5;
aToken.eType = TIDENT;
}
@@ -1402,23 +1402,25 @@ public:
void SmXMLOperatorContext_Impl::TCharacters(const OUString& rChars)
{
- aToken.cMathChar = rChars[0];
+ aToken.setChar(rChars[0]);
SmToken bToken;
if (bIsFenced)
{
if (isPrefix)
- bToken = starmathdatabase::Identify_Prefix_SmXMLOperatorContext_Impl(aToken.cMathChar);
+ bToken
+ = starmathdatabase::Identify_Prefix_SmXMLOperatorContext_Impl(aToken.cMathChar[0]);
else if (isInfix)
bToken = SmToken(TMLINE, MS_VERTLINE, "mline", TG::NONE, 0);
else if (isPostfix)
- bToken = starmathdatabase::Identify_Postfix_SmXMLOperatorContext_Impl(aToken.cMathChar);
+ bToken
+ = starmathdatabase::Identify_Postfix_SmXMLOperatorContext_Impl(aToken.cMathChar[0]);
else
bToken = starmathdatabase::Identify_PrefixPostfix_SmXMLOperatorContext_Impl(
- aToken.cMathChar);
+ aToken.cMathChar[0]);
}
else
- bToken
- = starmathdatabase::Identify_SmXMLOperatorContext_Impl(aToken.cMathChar, bIsStretchy);
+ bToken = starmathdatabase::Identify_SmXMLOperatorContext_Impl(aToken.cMathChar[0],
+ bIsStretchy);
if (bToken.eType != TERROR)
aToken = bToken;
}
@@ -1434,7 +1436,7 @@ void SmXMLOperatorContext_Impl::endFastElement(sal_Int32)
GetSmImport().GetNodeStack().push_front(std::move(pNode));
// TODO: apply to non-alphabetic characters too
- if (rtl::isAsciiAlpha(aToken.cMathChar))
+ if (rtl::isAsciiAlpha(aToken.cMathChar[0]))
maTokenAttrHelper.ApplyAttrs(MathMLMathvariantValue::Normal);
}
@@ -1533,7 +1535,7 @@ void SmXMLSpaceContext_Impl::startFastElement(
}
SmToken aToken;
aToken.eType = TBLANK;
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.nGroup = TG::Blank;
aToken.nLevel = 5;
std::unique_ptr<SmBlankNode> pBlank(new SmBlankNode(aToken));
@@ -1573,7 +1575,7 @@ void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup eSubSup
return;
SmToken aToken;
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.eType = eType;
std::unique_ptr<SmSubSupNode> pNode(new SmSubSupNode(aToken));
SmNodeStack& rNodeStack = GetSmImport().GetNodeStack();
@@ -1627,7 +1629,7 @@ void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup aSub
return;
SmToken aToken;
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.eType = eType;
std::unique_ptr<SmSubSupNode> pNode(new SmSubSupNode(aToken));
SmNodeStack& rNodeStack = GetSmImport().GetNodeStack();
@@ -1685,12 +1687,12 @@ void SmXMLUnderContext_Impl::HandleAccent()
SmNodeStack& rNodeStack = GetSmImport().GetNodeStack();
std::unique_ptr<SmNode> pTest = popOrZero(rNodeStack);
SmToken aToken;
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.eType = TUNDERLINE;
std::unique_ptr<SmNode> pFirst;
std::unique_ptr<SmStructureNode> pNode(new SmAttributeNode(aToken));
- if ((pTest->GetToken().cMathChar & 0x0FFF) == 0x0332)
+ if ((pTest->GetToken().cMathChar[0] & 0x0FFF) == 0x0332)
{
pFirst.reset(new SmRectangleNode(aToken));
}
@@ -1756,7 +1758,7 @@ void SmXMLOverContext_Impl::HandleAccent()
return;
SmToken aToken;
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.eType = TACUTE;
std::unique_ptr<SmAttributeNode> pNode(new SmAttributeNode(aToken));
@@ -1815,7 +1817,7 @@ public:
void SmXMLNoneContext_Impl::endFastElement(sal_Int32)
{
SmToken aToken;
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.aText.clear();
aToken.nLevel = 5;
aToken.eType = TIDENT;
@@ -2080,7 +2082,7 @@ void SmXMLFracContext_Impl::endFastElement(sal_Int32)
return;
SmToken aToken;
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.eType = TFRAC;
std::unique_ptr<SmStructureNode> pSNode(new SmBinVerNode(aToken));
std::unique_ptr<SmNode> pOper(new SmRectangleNode(aToken));
@@ -2099,7 +2101,7 @@ void SmXMLRootContext_Impl::endFastElement(sal_Int32)
return;
SmToken aToken;
- aToken.cMathChar = MS_SQRT; //Temporary: alert, based on StarSymbol font
+ aToken.setChar(MS_SQRT); //Temporary: alert, based on StarSymbol font
aToken.eType = TNROOT;
std::unique_ptr<SmStructureNode> pSNode(new SmRootNode(aToken));
std::unique_ptr<SmNode> pOper(new SmRootSymbolNode(aToken));
@@ -2121,7 +2123,7 @@ void SmXMLSqrtContext_Impl::endFastElement(sal_Int32 nElement)
SmXMLRowContext_Impl::endFastElement(nElement);
SmToken aToken;
- aToken.cMathChar = MS_SQRT; //Temporary: alert, based on StarSymbol font
+ aToken.setChar(MS_SQRT); //Temporary: alert, based on StarSymbol font
aToken.eType = TSQRT;
std::unique_ptr<SmStructureNode> pSNode(new SmRootNode(aToken));
std::unique_ptr<SmNode> pOper(new SmRootSymbolNode(aToken));
@@ -2158,7 +2160,7 @@ void SmXMLRowContext_Impl::endFastElement(sal_Int32)
&& (aRelationArray[nSize - 1]->GetType() == SmNodeType::Math)))
{
SmToken aToken;
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.nLevel = 5;
int nLeft = 0, nRight = 0;
@@ -2169,7 +2171,7 @@ void SmXMLRowContext_Impl::endFastElement(sal_Int32)
nLeft = 1;
}
else
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.eType = TLPARENT;
std::unique_ptr<SmNode> pLeft(new SmMathSymbolNode(aToken));
@@ -2181,7 +2183,7 @@ void SmXMLRowContext_Impl::endFastElement(sal_Int32)
nRight = 1;
}
else
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.eType = TRPARENT;
std::unique_ptr<SmNode> pRight(new SmMathSymbolNode(aToken));
@@ -2223,14 +2225,14 @@ void SmXMLRowContext_Impl::endFastElement(sal_Int32)
// to StarMath.
aRelationArray.resize(2);
SmToken aToken;
- aToken.cMathChar = MS_LBRACE;
+ aToken.setChar(MS_LBRACE);
aToken.nLevel = 5;
aToken.eType = TLGROUP;
aToken.nGroup = TG::NONE;
aToken.aText = "{";
aRelationArray[0] = new SmLineNode(aToken);
- aToken.cMathChar = MS_RBRACE;
+ aToken.setChar(MS_RBRACE);
aToken.nLevel = 0;
aToken.eType = TRGROUP;
aToken.nGroup = TG::NONE;
@@ -2337,7 +2339,7 @@ void SmXMLMultiScriptsContext_Impl::ProcessSubSupPairs(bool bIsPrescript)
if (nCount % 2 == 0)
{
SmToken aToken;
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.eType = bIsPrescript ? TLSUB : TRSUB;
SmNodeStack aReverseStack;
@@ -2445,7 +2447,7 @@ void SmXMLTableContext_Impl::endFastElement(sal_Int32)
aReverseStack.clear();
SmToken aToken;
- aToken.cMathChar = '\0';
+ aToken.cMathChar = u"";
aToken.eType = TMATRIX;
std::unique_ptr<SmMatrixNode> pSNode(new SmMatrixNode(aToken));
pSNode->SetSubNodes(std::move(aExpressionArray));
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index bf56f8dddb75..7dd72829b47f 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -1360,12 +1360,12 @@ void SmBraceNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
aTmpSize.setWidth( aTmpSize.Width() * 182 );
aTmpSize.setWidth( aTmpSize.Width() / 267 );
- sal_Unicode cChar = pLeft->GetToken().cMathChar;
+ sal_Unicode cChar = pLeft->GetToken().cMathChar[0];
if (cChar != MS_LINE && cChar != MS_DLINE &&
cChar != MS_VERTLINE && cChar != MS_DVERTLINE)
pLeft ->GetFont().SetSize(aTmpSize);
- cChar = pRight->GetToken().cMathChar;
+ cChar = pRight->GetToken().cMathChar[0];
if (cChar != MS_LINE && cChar != MS_DLINE &&
cChar != MS_VERTLINE && cChar != MS_DVERTLINE)
pRight->GetFont().SetSize(aTmpSize);
@@ -2084,9 +2084,7 @@ const SmNode * SmMatrixNode::GetLeftMost() const
SmMathSymbolNode::SmMathSymbolNode(const SmToken &rNodeToken)
: SmSpecialNode(SmNodeType::Math, rNodeToken, FNT_MATH)
{
- sal_Unicode cChar = GetToken().cMathChar;
- if (u'\0' != cChar)
- SetText(OUString(cChar));
+ SetText(GetToken().cMathChar);
}
void SmMathSymbolNode::AdaptToX(OutputDevice &rDev, sal_uLong nWidth)
diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx
index 984447a35f24..3b0836c12ceb 100644
--- a/starmath/source/ooxmlexport.cxx
+++ b/starmath/source/ooxmlexport.cxx
@@ -216,8 +216,7 @@ void SmOoxmlExport::HandleAttribute( const SmAttributeNode* pNode, int nLevel )
{
m_pSerializer->startElementNS(XML_m, XML_acc);
m_pSerializer->startElementNS(XML_m, XML_accPr);
- OString value = OUStringToOString(
- OUStringChar( pNode->Attribute()->GetToken().cMathChar ), RTL_TEXTENCODING_UTF8 );
+ OString value = OUStringToOString(pNode->Attribute()->GetToken().cMathChar, RTL_TEXTENCODING_UTF8 );
m_pSerializer->singleElementNS(XML_m, XML_chr, FSNS(XML_m, XML_val), value);
m_pSerializer->endElementNS( XML_m, XML_accPr );
m_pSerializer->startElementNS(XML_m, XML_e);
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index fbf27478d2c7..68aab9e8dc77 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -476,7 +476,7 @@ void SmParser::NextToken() //Central part of the parser
if (nRealStart >= nBufLen)
{
m_aCurToken.eType = TEND;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 0;
m_aCurToken.aText.clear();
@@ -494,7 +494,7 @@ void SmParser::NextToken() //Central part of the parser
sal_Int32 n = aRes.EndPos - nRealStart;
assert(n >= 0);
m_aCurToken.eType = TNUMBER;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = m_aBufferString.copy( nRealStart, n );
@@ -504,7 +504,7 @@ void SmParser::NextToken() //Central part of the parser
else if (aRes.TokenType & KParseType::DOUBLE_QUOTE_STRING)
{
m_aCurToken.eType = TTEXT;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = aRes.DequotedNameOrString;
@@ -521,7 +521,7 @@ void SmParser::NextToken() //Central part of the parser
if (pEntry)
{
m_aCurToken.eType = pEntry->eType;
- m_aCurToken.cMathChar = pEntry->cMathChar;
+ m_aCurToken.setChar(pEntry->cMathChar);
m_aCurToken.nGroup = pEntry->nGroup;
m_aCurToken.nLevel = pEntry->nLevel;
m_aCurToken.aText = pEntry->pIdent;
@@ -529,7 +529,7 @@ void SmParser::NextToken() //Central part of the parser
else
{
m_aCurToken.eType = TIDENT;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = aName;
@@ -540,7 +540,7 @@ void SmParser::NextToken() //Central part of the parser
else if (aRes.TokenType == 0 && '_' == m_aBufferString[ nRealStart ])
{
m_aCurToken.eType = TRSUB;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::Power;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "_";
@@ -560,7 +560,7 @@ void SmParser::NextToken() //Central part of the parser
if (m_aBufferString.match("<<", nRealStart))
{
m_aCurToken.eType = TLL;
- m_aCurToken.cMathChar = MS_LL;
+ m_aCurToken.setChar(MS_LL);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "<<";
@@ -570,7 +570,7 @@ void SmParser::NextToken() //Central part of the parser
else if (m_aBufferString.match("<=", nRealStart))
{
m_aCurToken.eType = TLE;
- m_aCurToken.cMathChar = MS_LE;
+ m_aCurToken.setChar(MS_LE);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "<=";
@@ -580,7 +580,7 @@ void SmParser::NextToken() //Central part of the parser
else if (m_aBufferString.match("<-", nRealStart))
{
m_aCurToken.eType = TLEFTARROW;
- m_aCurToken.cMathChar = MS_LEFTARROW;
+ m_aCurToken.setChar(MS_LEFTARROW);
m_aCurToken.nGroup = TG::Standalone;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "<-";
@@ -590,7 +590,7 @@ void SmParser::NextToken() //Central part of the parser
else if (m_aBufferString.match("<>", nRealStart))
{
m_aCurToken.eType = TNEQ;
- m_aCurToken.cMathChar = MS_NEQ;
+ m_aCurToken.setChar(MS_NEQ);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "<>";
@@ -600,7 +600,7 @@ void SmParser::NextToken() //Central part of the parser
else if (m_aBufferString.match("<?>", nRealStart))
{
m_aCurToken.eType = TPLACE;
- m_aCurToken.cMathChar = MS_PLACE;
+ m_aCurToken.setChar(MS_PLACE);
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "<?>";
@@ -610,7 +610,7 @@ void SmParser::NextToken() //Central part of the parser
else
{
m_aCurToken.eType = TLT;
- m_aCurToken.cMathChar = MS_LT;
+ m_aCurToken.setChar(MS_LT);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "<";
@@ -622,7 +622,7 @@ void SmParser::NextToken() //Central part of the parser
if (m_aBufferString.match(">=", nRealStart))
{
m_aCurToken.eType = TGE;
- m_aCurToken.cMathChar = MS_GE;
+ m_aCurToken.setChar(MS_GE);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = ">=";
@@ -632,7 +632,7 @@ void SmParser::NextToken() //Central part of the parser
else if (m_aBufferString.match(">>", nRealStart))
{
m_aCurToken.eType = TGG;
- m_aCurToken.cMathChar = MS_GG;
+ m_aCurToken.setChar(MS_GG);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = ">>";
@@ -642,7 +642,7 @@ void SmParser::NextToken() //Central part of the parser
else
{
m_aCurToken.eType = TGT;
- m_aCurToken.cMathChar = MS_GT;
+ m_aCurToken.setChar(MS_GT);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = ">";
@@ -684,7 +684,7 @@ void SmParser::NextToken() //Central part of the parser
// i.e. a valid symbol-name is following the '%'
// character
m_aCurToken.eType = TTEXT;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText ="%";
@@ -714,7 +714,7 @@ void SmParser::NextToken() //Central part of the parser
case '[':
{
m_aCurToken.eType = TLBRACKET;
- m_aCurToken.cMathChar = MS_LBRACKET;
+ m_aCurToken.setChar(MS_LBRACKET);
m_aCurToken.nGroup = TG::LBrace;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "[";
@@ -723,7 +723,7 @@ void SmParser::NextToken() //Central part of the parser
case '\\':
{
m_aCurToken.eType = TESCAPE;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "\\";
@@ -732,7 +732,7 @@ void SmParser::NextToken() //Central part of the parser
case ']':
{
m_aCurToken.eType = TRBRACKET;
- m_aCurToken.cMathChar = MS_RBRACKET;
+ m_aCurToken.setChar(MS_RBRACKET);
m_aCurToken.nGroup = TG::RBrace;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "]";
@@ -741,7 +741,7 @@ void SmParser::NextToken() //Central part of the parser
case '^':
{
m_aCurToken.eType = TRSUP;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::Power;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "^";
@@ -750,7 +750,7 @@ void SmParser::NextToken() //Central part of the parser
case '`':
{
m_aCurToken.eType = TSBLANK;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::Blank;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "`";
@@ -759,7 +759,7 @@ void SmParser::NextToken() //Central part of the parser
case '{':
{
m_aCurToken.eType = TLGROUP;
- m_aCurToken.cMathChar = MS_LBRACE;
+ m_aCurToken.setChar(MS_LBRACE);
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "{";
@@ -768,7 +768,7 @@ void SmParser::NextToken() //Central part of the parser
case '|':
{
m_aCurToken.eType = TOR;
- m_aCurToken.cMathChar = MS_OR;
+ m_aCurToken.setChar(MS_OR);
m_aCurToken.nGroup = TG::Sum;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "|";
@@ -777,7 +777,7 @@ void SmParser::NextToken() //Central part of the parser
case '}':
{
m_aCurToken.eType = TRGROUP;
- m_aCurToken.cMathChar = MS_RBRACE;
+ m_aCurToken.setChar(MS_RBRACE);
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "}";
@@ -786,7 +786,7 @@ void SmParser::NextToken() //Central part of the parser
case '~':
{
m_aCurToken.eType = TBLANK;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::Blank;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "~";
@@ -797,7 +797,7 @@ void SmParser::NextToken() //Central part of the parser
if (m_aBufferString.match("##", nRealStart))
{
m_aCurToken.eType = TDPOUND;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "##";
@@ -807,7 +807,7 @@ void SmParser::NextToken() //Central part of the parser
else
{
m_aCurToken.eType = TPOUND;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "#";
@@ -817,7 +817,7 @@ void SmParser::NextToken() //Central part of the parser
case '&':
{
m_aCurToken.eType = TAND;
- m_aCurToken.cMathChar = MS_AND;
+ m_aCurToken.setChar(MS_AND);
m_aCurToken.nGroup = TG::Product;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "&";
@@ -826,7 +826,7 @@ void SmParser::NextToken() //Central part of the parser
case '(':
{
m_aCurToken.eType = TLPARENT;
- m_aCurToken.cMathChar = MS_LPARENT;
+ m_aCurToken.setChar(MS_LPARENT);
m_aCurToken.nGroup = TG::LBrace;
m_aCurToken.nLevel = 5; //! 0 to continue expression
m_aCurToken.aText = "(";
@@ -835,7 +835,7 @@ void SmParser::NextToken() //Central part of the parser
case ')':
{
m_aCurToken.eType = TRPARENT;
- m_aCurToken.cMathChar = MS_RPARENT;
+ m_aCurToken.setChar(MS_RPARENT);
m_aCurToken.nGroup = TG::RBrace;
m_aCurToken.nLevel = 0; //! 0 to terminate expression
m_aCurToken.aText = ")";
@@ -844,7 +844,7 @@ void SmParser::NextToken() //Central part of the parser
case '*':
{
m_aCurToken.eType = TMULTIPLY;
- m_aCurToken.cMathChar = MS_MULTIPLY;
+ m_aCurToken.setChar(MS_MULTIPLY);
m_aCurToken.nGroup = TG::Product;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "*";
@@ -855,7 +855,7 @@ void SmParser::NextToken() //Central part of the parser
if (m_aBufferString.match("+-", nRealStart))
{
m_aCurToken.eType = TPLUSMINUS;
- m_aCurToken.cMathChar = MS_PLUSMINUS;
+ m_aCurToken.setChar(MS_PLUSMINUS);
m_aCurToken.nGroup = TG::UnOper | TG::Sum;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "+-";
@@ -865,7 +865,7 @@ void SmParser::NextToken() //Central part of the parser
else
{
m_aCurToken.eType = TPLUS;
- m_aCurToken.cMathChar = MS_PLUS;
+ m_aCurToken.setChar(MS_PLUS);
m_aCurToken.nGroup = TG::UnOper | TG::Sum;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "+";
@@ -877,7 +877,7 @@ void SmParser::NextToken() //Central part of the parser
if (m_aBufferString.match("-+", nRealStart))
{
m_aCurToken.eType = TMINUSPLUS;
- m_aCurToken.cMathChar = MS_MINUSPLUS;
+ m_aCurToken.setChar(MS_MINUSPLUS);
m_aCurToken.nGroup = TG::UnOper | TG::Sum;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "-+";
@@ -887,7 +887,7 @@ void SmParser::NextToken() //Central part of the parser
else if (m_aBufferString.match("->", nRealStart))
{
m_aCurToken.eType = TRIGHTARROW;
- m_aCurToken.cMathChar = MS_RIGHTARROW;
+ m_aCurToken.setChar(MS_RIGHTARROW);
m_aCurToken.nGroup = TG::Standalone;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "->";
@@ -897,7 +897,7 @@ void SmParser::NextToken() //Central part of the parser
else
{
m_aCurToken.eType = TMINUS;
- m_aCurToken.cMathChar = MS_MINUS;
+ m_aCurToken.setChar(MS_MINUS);
m_aCurToken.nGroup = TG::UnOper | TG::Sum;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "-";
@@ -913,7 +913,7 @@ void SmParser::NextToken() //Central part of the parser
// texts like .34 ...56 ... h ...78..90
// will be treated as numbers
m_aCurToken.eType = TNUMBER;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
@@ -937,7 +937,7 @@ void SmParser::NextToken() //Central part of the parser
case '/':
{
m_aCurToken.eType = TDIVIDEBY;
- m_aCurToken.cMathChar = MS_SLASH;
+ m_aCurToken.setChar(MS_SLASH);
m_aCurToken.nGroup = TG::Product;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "/";
@@ -946,7 +946,7 @@ void SmParser::NextToken() //Central part of the parser
case '=':
{
m_aCurToken.eType = TASSIGN;
- m_aCurToken.cMathChar = MS_ASSIGN;
+ m_aCurToken.setChar(MS_ASSIGN);
m_aCurToken.nGroup = TG::Relation;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "=";
@@ -963,7 +963,7 @@ void SmParser::NextToken() //Central part of the parser
if (!bHandled)
{
m_aCurToken.eType = TCHARACTER;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
@@ -1043,7 +1043,7 @@ void SmParser::NextTokenColor(bool dvipload)
if( m_aBufferString[ nRealStart ] == '#' && !m_aBufferString.match("##", nRealStart) )
{
m_aCurToken.eType = THEX;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::Color;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "hex";
@@ -1117,28 +1117,28 @@ void SmParser::NextTokenFontSize()
{
case '*':
m_aCurToken.eType = TMULTIPLY;
- m_aCurToken.cMathChar = MS_MULTIPLY;
+ m_aCurToken.setChar(MS_MULTIPLY);
m_aCurToken.nGroup = TG::Product;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "*";
break;
case '+':
m_aCurToken.eType = TPLUS;
- m_aCurToken.cMathChar = MS_PLUS;
+ m_aCurToken.setChar(MS_PLUS);
m_aCurToken.nGroup = TG::UnOper | TG::Sum;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "+";
break;
case '-':
m_aCurToken.eType = TMINUS;
- m_aCurToken.cMathChar = MS_MINUS;
+ m_aCurToken.setChar(MS_MINUS);
m_aCurToken.nGroup = TG::UnOper | TG::Sum;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = "-";
break;
case '/':
m_aCurToken.eType = TDIVIDEBY;
- m_aCurToken.cMathChar = MS_SLASH;
+ m_aCurToken.setChar(MS_SLASH);
m_aCurToken.nGroup = TG::Product;
m_aCurToken.nLevel = 0;
m_aCurToken.aText = "/";
@@ -1156,7 +1156,7 @@ void SmParser::NextTokenFontSize()
sal_Int32 n = aRes.EndPos - nRealStart;
assert(n >= 0);
m_aCurToken.eType = THEX;
- m_aCurToken.cMathChar = '\0';
+ m_aCurToken.cMathChar = u"";
m_aCurToken.nGroup = TG::NONE;
m_aCurToken.nLevel = 5;
m_aCurToken.aText = m_aBufferString.copy( nRealStart, n );
@@ -2001,7 +2001,7 @@ std::unique_ptr<SmStructureNode> SmParser::DoUnOper()
// we'll use row & column of the keyword for abs
aNodeToken.eType = TABS;
- aNodeToken.cMathChar = MS_VERTLINE;
+ aNodeToken.setChar(MS_VERTLINE);
std::unique_ptr<SmNode> xLeft(new SmMathSymbolNode(aNodeToken));
std::unique_ptr<SmNode> xRight(new SmMathSymbolNode(aNodeToken));
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index 8d72859c6b7b..c2926f32e062 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -2444,7 +2444,7 @@ void SmNodeToTextVisitor::Visit( SmMathSymbolNode* pNode )
Append( pNode->GetToken().aText );
return;
}
- sal_Unicode cChar = pNode->GetToken().cMathChar;
+ sal_Unicode cChar = pNode->GetToken().cMathChar[0];
Separate( );
switch(cChar){
case MS_NONE:
More information about the Libreoffice-commits
mailing list