starmath/inc/mathml/starmathdatabase.hxx    |   26 +++++++++++++-----------
 starmath/inc/token.hxx                      |   10 +++++----
 starmath/inc/types.hxx                      |    2 +
 starmath/qa/extras/data/hadd.mml            |   11 ++++++++++
 starmath/qa/extras/data/maj.mml             |   18 ++++++++++++++++
 starmath/qa/extras/mmlexport-test.cxx       |   30 ++++++++++++++++++++++++++++
 starmath/qa/extras/mmlimport-test.cxx       |   28 ++++++++++++++++++++++++++
 starmath/source/mathml/mathmlexport.cxx     |   20 ++++++------------
 starmath/source/mathml/mathmlimport.cxx     |   22 +++++++++-----------
 starmath/source/mathml/starmathdatabase.cxx |   19 ++++++++++++++---
 starmath/source/parse5.cxx                  |   13 ++++++++++--
 11 files changed, 152 insertions(+), 47 deletions(-)

New commits:
commit 9023cbc96c3538995f0ef9042aebcad14711cd60
Author:     Khaled Hosny <kha...@libreoffice.org>
AuthorDate: Sun Sep 17 19:31:27 2023 +0300
Commit:     خالد حسني <kha...@libreoffice.org>
CommitDate: Mon Sep 18 02:32:15 2023 +0200

    tdf#111705: Add support of Persian limits operator (U+1EEF1)
    
    Change-Id: I9936a206b2ce6c8d195967d1e14596c5903c1ef5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156995
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@libreoffice.org>

diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx
index a47e741a4358..8409af89dd8a 100644
--- a/starmath/inc/token.hxx
+++ b/starmath/inc/token.hxx
@@ -84,6 +84,7 @@ enum SmTokenType
     TIM,            TRE,            THBAR,          TLAMBDABAR,     // Complex 
and constants
     TPLUSMINUS,     TMINUSPLUS,     TSIM,           TSIMEQ,         // +- -+ ~ 
~=
     TLIM,           TLIMSUP,        TLIMINF,        TTOWARD,        // Limits
+    THADD,
     TOVER,          TTIMES,         TCDOT,          TDIV,           // Product 
type
     TSLASH,         TBACKSLASH,     TWIDESLASH,     TWIDEBACKSLASH, //Slash
     TFRAC,          TIT,                                            // mathml 
related
diff --git a/starmath/inc/types.hxx b/starmath/inc/types.hxx
index 597f6dcd187f..e91d6da7f363 100644
--- a/starmath/inc/types.hxx
+++ b/starmath/inc/types.hxx
@@ -126,6 +126,7 @@ sal_Unicode const MS_PROD = 0x220F;
 sal_Unicode const MS_COPROD = 0x2210;
 sal_Unicode const MS_SUM = 0x2211;
 sal_uInt32 const MS_MAJ = 0x1EEF0;
+sal_uInt32 const MS_HADD = 0x1EEF1;
 sal_Unicode const MS_SQRT = 0x221A;
 sal_Unicode const MS_INT = 0x222B;
 sal_Unicode const MS_IINT = 0x222C;
diff --git a/starmath/qa/extras/data/hadd.mml b/starmath/qa/extras/data/hadd.mml
new file mode 100644
index 000000000000..b6ebd374a57f
--- /dev/null
+++ b/starmath/qa/extras/data/hadd.mml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<math xmlns="http://www.w3.org/1998/Math/MathML"; display="block">
+ <mrow>
+  <munderover>
+   <mi>𞻱</mi>
+   <mi>𞹎</mi>
+   <mi>𞹎</mi>
+  </munderover>
+  <mi>𞹎</mi>
+ </mrow>
+</math>
diff --git a/starmath/qa/extras/mmlexport-test.cxx 
b/starmath/qa/extras/mmlexport-test.cxx
index 01528199086f..615dcd7dfa98 100644
--- a/starmath/qa/extras/mmlexport-test.cxx
+++ b/starmath/qa/extras/mmlexport-test.cxx
@@ -32,12 +32,14 @@ public:
     void testTdf97049();
     void testTdf101022();
     void testMaj();
+    void testHadd();
 
     CPPUNIT_TEST_SUITE(MathMLExportTest);
     CPPUNIT_TEST(testBlank);
     CPPUNIT_TEST(testTdf97049);
     CPPUNIT_TEST(testTdf101022);
     CPPUNIT_TEST(testMaj);
+    CPPUNIT_TEST(testHadd);
     CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -132,6 +134,18 @@ void MathMLExportTest::testMaj()
     assertXPathContent(pDoc, "/m:math/m:semantics/m:mrow/m:munderover/m:mo", 
u"\U0001EEF0");
 }
 
+void MathMLExportTest::testHadd()
+{
+    mxComponent = loadFromDesktop("private:factory/smath");
+    SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get());
+    SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell());
+    pDocShell->SetText(u"hadd to { \U0001EE4E } from { \U0001EE4E } 
\U0001EE4E");
+    save("MathML XML (Math)");
+    xmlDocUniquePtr pDoc = parseXml(maTempFile);
+    CPPUNIT_ASSERT(pDoc);
+    assertXPathContent(pDoc, "/m:math/m:semantics/m:mrow/m:munderover/m:mi", 
u"\U0001EEF1");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(MathMLExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/starmath/qa/extras/mmlimport-test.cxx 
b/starmath/qa/extras/mmlimport-test.cxx
index 03f5e7bcfac5..2fcb1de13744 100644
--- a/starmath/qa/extras/mmlimport-test.cxx
+++ b/starmath/qa/extras/mmlimport-test.cxx
@@ -37,6 +37,7 @@ public:
     void testTdf151842();
     void testMathmlEntities();
     void testMaj();
+    void testHadd();
 
     CPPUNIT_TEST_SUITE(Test);
     CPPUNIT_TEST(testColor);
@@ -51,6 +52,7 @@ public:
     CPPUNIT_TEST(testTdf151842);
     CPPUNIT_TEST(testMathmlEntities);
     CPPUNIT_TEST(testMaj);
+    CPPUNIT_TEST(testHadd);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -191,6 +193,18 @@ void Test::testMaj()
                          pDocShell->GetText());
 }
 
+void Test::testHadd()
+{
+    loadFromURL(u"hadd.mml");
+    SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get());
+    CPPUNIT_ASSERT(pModel);
+    SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell());
+    CPPUNIT_ASSERT(pDocShell);
+    CPPUNIT_ASSERT_EQUAL(OUString(u"{ nitalic \U0001EEF1 csup nitalic 
\U0001EE4E csub nitalic "
+                                  u"\U0001EE4E nitalic \U0001EE4E }"),
+                         pDocShell->GetText());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/starmath/source/parse5.cxx b/starmath/source/parse5.cxx
index c3f75f430d22..04c4702683b1 100644
--- a/starmath/source/parse5.cxx
+++ b/starmath/source/parse5.cxx
@@ -110,6 +110,7 @@ const SmTokenTableEntry aTokenTable[]
         { u"gg", TGG, MS_GG, TG::Relation, 0 },
         { u"grave", TGRAVE, MS_GRAVE, TG::Attribute, 5 },
         { u"gt", TGT, MS_GT, TG::Relation, 0 },
+        { u"hadd", THADD, MS_HADD, TG::Oper, 5 },
         { u"harpoon", THARPOON, MS_HARPOON, TG::Attribute, 5 },
         { u"hat", THAT, MS_HAT, TG::Attribute, 5 },
         { u"hbar", THBAR, MS_HBAR, TG::Standalone, 5 },
@@ -1897,8 +1898,15 @@ std::unique_ptr<SmNode> SmParser5::DoOper()
         case TLIM:
         case TLIMSUP:
         case TLIMINF:
-            m_aCurToken.aText
-                = eType == TLIMSUP ? u"lim sup" : eType == TLIMINF ? u"lim 
inf" : u"lim";
+        case THADD:
+            if (eType == TLIMSUP)
+                m_aCurToken.aText = u"lim sup";
+            else if (eType == TLIMINF)
+                m_aCurToken.aText = u"lim inf";
+            else if (eType == THADD)
+                m_aCurToken.aText = OUString(&MS_HADD, 1);
+            else
+                m_aCurToken.aText = u"lim";
             pNode.reset(new SmTextNode(m_aCurToken, FNT_TEXT));
             pNode->SetSelection(m_aCurESelection);
             break;
commit d4edecb26cc5a801815a612cdd27f3dc621d5038
Author:     Khaled Hosny <kha...@libreoffice.org>
AuthorDate: Sun Sep 17 17:50:22 2023 +0300
Commit:     خالد حسني <kha...@libreoffice.org>
CommitDate: Mon Sep 18 02:32:05 2023 +0200

    tdf#111705: Add support of Arabic summation operator (U+1EEF0)
    
    Needed to fix a punch of code to work with UTF-16 not just UCS-2 (in
    other words, handle surrogate pairs).
    
    Change-Id: Idd7aa823349a032f20f37abbb588856afbc548d6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156994
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@libreoffice.org>

diff --git a/starmath/inc/mathml/starmathdatabase.hxx 
b/starmath/inc/mathml/starmathdatabase.hxx
index cd5fe8ecdbdd..3af9b009b5d0 100644
--- a/starmath/inc/mathml/starmathdatabase.hxx
+++ b/starmath/inc/mathml/starmathdatabase.hxx
@@ -207,51 +207,53 @@ extern const SmColorTokenTableEntry 
aColorTokenTableERROR[1];
 
 /**
   * Identifies operator chars tokens for importing mathml.
-  * Identifies from char cChar
+  * Identifies from rText
   *
   * While loading MO or MI elements might find an unicode16 symbol.
   * This code allows to generate appropriate token for them.
   *
-  * @param cChar
+  * @param rText
   * @return closing fences' token
   */
-SmToken Identify_SmXMLOperatorContext_Impl(sal_Unicode cChar, bool bIsStretchy 
= true);
+SmToken Identify_SmXMLOperatorContext_Impl(std::u16string_view rText, bool 
bIsStretchy = true,
+                                           sal_Int32 nIndex = 0);
 
 /**
   * Identifies opening / closing brace tokens for importing mathml.
-  * Identifies from char cChar
+  * Identifies from rText
   *
   * While loading MO fenced elements might find braces symbols.
   * This code allows to generate appropriate token for them.
   *
-  * @param cChar
+  * @param rText
   * @return closing fences' token
   */
-SmToken Identify_PrefixPostfix_SmXMLOperatorContext_Impl(sal_Unicode cChar);
+SmToken Identify_PrefixPostfix_SmXMLOperatorContext_Impl(std::u16string_view 
rText,
+                                                         sal_Int32 nIndex = 0);
 
 /**
   * Identifies opening brace tokens for importing mathml.
-  * Identifies from char cChar
+  * Identifies from rText
   *
   * While loading MO elements ( with prefix value for form attribute ) might 
find braces symbols.
   * This code allows to generate appropriate token for them.
   *
-  * @param cChar
+  * @param rText
   * @return closing fences' token
   */
-SmToken Identify_Prefix_SmXMLOperatorContext_Impl(sal_Unicode cChar);
+SmToken Identify_Prefix_SmXMLOperatorContext_Impl(std::u16string_view rText, 
sal_Int32 nIndex = 0);
 
 /**
   * Identifies closing brace tokens for importing mathml.
-  * Identifies from char cChar
+  * Identifies from rText
   *
   * While loading MO elements ( with postfix value for form attribute ) might 
find braces symbols.
   * This code allows to generate appropriate token for them.
   *
-  * @param cChar
+  * @param rText
   * @return closing fences' token
   */
-SmToken Identify_Postfix_SmXMLOperatorContext_Impl(sal_Unicode cChar);
+SmToken Identify_Postfix_SmXMLOperatorContext_Impl(std::u16string_view rText, 
sal_Int32 nIndex = 0);
 
 /**
   * Identifies color from color code cColor.
diff --git a/starmath/inc/token.hxx b/starmath/inc/token.hxx
index df026efbf30e..a47e741a4358 100644
--- a/starmath/inc/token.hxx
+++ b/starmath/inc/token.hxx
@@ -152,7 +152,7 @@ struct SmTokenTableEntry
 {
     OUString aIdent;
     SmTokenType eType;
-    sal_Unicode cMathChar;
+    sal_uInt32 cMathChar;
     TG nGroup;
     sal_uInt16 nLevel;
 };
@@ -225,11 +225,11 @@ struct SmToken
     {
     }
 
-    SmToken(SmTokenType eTokenType, sal_Unicode cMath, OUString rText, TG 
nTokenGroup = TG::NONE,
+    SmToken(SmTokenType eTokenType, sal_uInt32 cMath, OUString rText, TG 
nTokenGroup = TG::NONE,
             sal_uInt16 nTokenLevel = 0)
         : aText(std::move(rText))
         , eType(eTokenType)
-        , cMathChar(cMath)
+        , cMathChar(&cMath, 1)
         , nGroup(nTokenGroup)
         , nLevel(nTokenLevel)
     {
@@ -280,7 +280,8 @@ struct SmToken
         nLevel = 0;
     }
 
-    void setChar(sal_Unicode cChar) { cMathChar = OUString(&cChar, 1); }
+    void setChar(sal_uInt32 cChar) { cMathChar = OUString(&cChar, 1); }
+    void setChar(const OUString& rText) { cMathChar = rText; }
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/inc/types.hxx b/starmath/inc/types.hxx
index 39d2f5c6fe05..597f6dcd187f 100644
--- a/starmath/inc/types.hxx
+++ b/starmath/inc/types.hxx
@@ -125,6 +125,7 @@ sal_Unicode const MS_NABLA = 0x2207;
 sal_Unicode const MS_PROD = 0x220F;
 sal_Unicode const MS_COPROD = 0x2210;
 sal_Unicode const MS_SUM = 0x2211;
+sal_uInt32 const MS_MAJ = 0x1EEF0;
 sal_Unicode const MS_SQRT = 0x221A;
 sal_Unicode const MS_INT = 0x222B;
 sal_Unicode const MS_IINT = 0x222C;
diff --git a/starmath/qa/extras/data/maj.mml b/starmath/qa/extras/data/maj.mml
new file mode 100644
index 000000000000..ea3b4067d587
--- /dev/null
+++ b/starmath/qa/extras/data/maj.mml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<math xmlns="http://www.w3.org/1998/Math/MathML"; display="block">
+ <mrow>
+  <munderover>
+   <mo stretchy="false">𞻰</mo>
+   <mrow>
+    <mi>𞸊</mi>
+    <mo stretchy="false">=</mo>
+    <mn>٠</mn>
+   </mrow>
+   <mn>١</mn>
+  </munderover>
+  <mfrac>
+   <mn>١</mn>
+   <mi>𞸊</mi>
+  </mfrac>
+ </mrow>
+</math>
diff --git a/starmath/qa/extras/mmlexport-test.cxx 
b/starmath/qa/extras/mmlexport-test.cxx
index f2cfa2d238b9..01528199086f 100644
--- a/starmath/qa/extras/mmlexport-test.cxx
+++ b/starmath/qa/extras/mmlexport-test.cxx
@@ -31,11 +31,13 @@ public:
     void testBlank();
     void testTdf97049();
     void testTdf101022();
+    void testMaj();
 
     CPPUNIT_TEST_SUITE(MathMLExportTest);
     CPPUNIT_TEST(testBlank);
     CPPUNIT_TEST(testTdf97049);
     CPPUNIT_TEST(testTdf101022);
+    CPPUNIT_TEST(testMaj);
     CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -116,6 +118,20 @@ void MathMLExportTest::testTdf101022()
     checkMathVariant(*pDocShell, false, false);
 }
 
+void MathMLExportTest::testMaj()
+{
+    mxComponent = loadFromDesktop("private:factory/smath");
+    SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get());
+    SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell());
+    pDocShell->SetText(
+        u"maj to { \u0661 } from { \U0001EE0A = \u0660 } { \u0661 over 
\U0001EE0A }");
+    save("MathML XML (Math)");
+    xmlDocUniquePtr pDoc = parseXml(maTempFile);
+    CPPUNIT_ASSERT(pDoc);
+    assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:munderover/m:mo", 
"stretchy", "false");
+    assertXPathContent(pDoc, "/m:math/m:semantics/m:mrow/m:munderover/m:mo", 
u"\U0001EEF0");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(MathMLExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/starmath/qa/extras/mmlimport-test.cxx 
b/starmath/qa/extras/mmlimport-test.cxx
index 3411953aabcc..03f5e7bcfac5 100644
--- a/starmath/qa/extras/mmlimport-test.cxx
+++ b/starmath/qa/extras/mmlimport-test.cxx
@@ -36,6 +36,7 @@ public:
     void testTdf137008();
     void testTdf151842();
     void testMathmlEntities();
+    void testMaj();
 
     CPPUNIT_TEST_SUITE(Test);
     CPPUNIT_TEST(testColor);
@@ -49,6 +50,7 @@ public:
     CPPUNIT_TEST(testTdf137008);
     CPPUNIT_TEST(testTdf151842);
     CPPUNIT_TEST(testMathmlEntities);
+    CPPUNIT_TEST(testMaj);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -177,6 +179,18 @@ void Test::testMathmlEntities()
     CPPUNIT_ASSERT_EQUAL(OUString(u"{ \u03C3 \u221E \u221E \u03C3 }"), 
pDocShell->GetText());
 }
 
+void Test::testMaj()
+{
+    loadFromURL(u"maj.mml");
+    SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get());
+    CPPUNIT_ASSERT(pModel);
+    SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell());
+    CPPUNIT_ASSERT(pDocShell);
+    CPPUNIT_ASSERT_EQUAL(OUString(u"{ maj csup \u0661 csub { nitalic 
\U0001EE0A = \u0660 } { frac "
+                                  u"{ \u0661 } { nitalic \U0001EE0A } } }"),
+                         pDocShell->GetText());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/starmath/source/mathml/mathmlexport.cxx 
b/starmath/source/mathml/mathmlexport.cxx
index d12b11aafdd5..c498187222e9 100644
--- a/starmath/source/mathml/mathmlexport.cxx
+++ b/starmath/source/mathml/mathmlexport.cxx
@@ -74,12 +74,12 @@ using namespace ::xmloff::token;
 
 namespace
 {
-bool IsInPrivateUseArea(sal_Unicode cChar) { return 0xE000 <= cChar && cChar 
<= 0xF8FF; }
+bool IsInPrivateUseArea(sal_uInt32 cChar) { return 0xE000 <= cChar && cChar <= 
0xF8FF; }
 
-sal_Unicode ConvertMathToMathML(sal_Unicode cChar)
+sal_uInt32 ConvertMathToMathML(std::u16string_view rText, sal_Int32 nIndex = 0)
 {
-    sal_Unicode cRes = cChar;
-    if (IsInPrivateUseArea(cChar))
+    auto cRes = o3tl::iterateCodePoints(rText, &nIndex);
+    if (IsInPrivateUseArea(cRes))
     {
         SAL_WARN("starmath", "Error: private use area characters should no 
longer be in use!");
         cRes = u'@'; // just some character that should easily be notice as 
odd in the context
@@ -749,12 +749,9 @@ void SmXMLExport::ExportMath(const SmNode* pNode)
         AddAttribute(XML_NAMESPACE_MATH, XML_MATHVARIANT, XML_NORMAL);
         pMath.reset(new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MI, 
true, false));
     }
-    sal_Unicode nArse = pTemp->GetText()[0];
-    sal_Unicode cTmp = ConvertMathToMathML(nArse);
-    if (cTmp != 0)
-        nArse = cTmp;
+    auto nArse = ConvertMathToMathML(pTemp->GetText());
     OSL_ENSURE(nArse != 0xffff, "Non existent symbol");
-    GetDocHandler()->characters(OUString(nArse));
+    GetDocHandler()->characters(OUString(&nArse, 1));
 }
 
 void SmXMLExport::ExportText(const SmNode* pNode)
@@ -1350,11 +1347,8 @@ void SmXMLExport::ExportNodes(const SmNode* pNode, int 
nLevel)
         case SmNodeType::GlyphSpecial:
         case SmNodeType::Math:
         {
-            sal_Unicode cTmp = 0;
             const SmTextNode* pTemp = static_cast<const SmTextNode*>(pNode);
-            if (!pTemp->GetText().isEmpty())
-                cTmp = ConvertMathToMathML(pTemp->GetText()[0]);
-            if (cTmp == 0)
+            if (pTemp->GetText().isEmpty())
             {
                 // no conversion to MathML implemented -> export it as text
                 // thus at least it will not vanish into nothing
diff --git a/starmath/source/mathml/mathmlimport.cxx 
b/starmath/source/mathml/mathmlimport.cxx
index e83d4e292016..b4d0b0ac8470 100644
--- a/starmath/source/mathml/mathmlimport.cxx
+++ b/starmath/source/mathml/mathmlimport.cxx
@@ -1006,8 +1006,8 @@ namespace
 class SmXMLFencedContext_Impl : public SmXMLRowContext_Impl
 {
 protected:
-    sal_Unicode cBegin;
-    sal_Unicode cEnd;
+    OUString cBegin;
+    OUString cEnd;
     bool bIsStretchy;
 
 public:
@@ -1034,10 +1034,10 @@ void SmXMLFencedContext_Impl::startFastElement(
         {
             //temp, starmath cannot handle multichar brackets (I think)
             case XML_OPEN:
-                cBegin = aIter.toString()[0];
+                cBegin = aIter.toString();
                 break;
             case XML_CLOSE:
-                cEnd = aIter.toString()[0];
+                cEnd = aIter.toString();
                 break;
             case XML_STRETCHY:
                 bIsStretchy = IsXMLToken(aIter, XML_TRUE);
@@ -1377,25 +1377,23 @@ public:
 
 void SmXMLOperatorContext_Impl::TCharacters(const OUString& rChars)
 {
-    aToken.setChar(rChars[0]);
+    aToken.setChar(rChars);
     SmToken bToken;
     if (bIsFenced)
     {
         if (isPrefix)
-            bToken
-                = 
starmathdatabase::Identify_Prefix_SmXMLOperatorContext_Impl(aToken.cMathChar[0]);
+            bToken = 
starmathdatabase::Identify_Prefix_SmXMLOperatorContext_Impl(aToken.cMathChar);
         else if (isInfix)
             bToken = SmToken(TMLINE, MS_VERTLINE, "mline", TG::NONE, 0);
         else if (isPostfix)
-            bToken
-                = 
starmathdatabase::Identify_Postfix_SmXMLOperatorContext_Impl(aToken.cMathChar[0]);
+            bToken = 
starmathdatabase::Identify_Postfix_SmXMLOperatorContext_Impl(aToken.cMathChar);
         else
             bToken = 
starmathdatabase::Identify_PrefixPostfix_SmXMLOperatorContext_Impl(
-                aToken.cMathChar[0]);
+                aToken.cMathChar);
     }
     else
-        bToken = 
starmathdatabase::Identify_SmXMLOperatorContext_Impl(aToken.cMathChar[0],
-                                                                      
bIsStretchy);
+        bToken
+            = 
starmathdatabase::Identify_SmXMLOperatorContext_Impl(aToken.cMathChar, 
bIsStretchy);
     if (bToken.eType != TERROR)
         aToken = bToken;
 }
diff --git a/starmath/source/mathml/starmathdatabase.cxx 
b/starmath/source/mathml/starmathdatabase.cxx
index cc6614cee4f1..6eb6d209c8e1 100644
--- a/starmath/source/mathml/starmathdatabase.cxx
+++ b/starmath/source/mathml/starmathdatabase.cxx
@@ -20,8 +20,10 @@
 #include <starmathdatabase.hxx>
 #include <types.hxx>
 
-SmToken starmathdatabase::Identify_SmXMLOperatorContext_Impl(sal_Unicode 
cChar, bool bIsStretchy)
+SmToken 
starmathdatabase::Identify_SmXMLOperatorContext_Impl(std::u16string_view rText,
+                                                             bool bIsStretchy, 
sal_Int32 nIndex)
 {
+    auto cChar = o3tl::iterateCodePoints(rText, &nIndex);
     switch (cChar)
     {
         case MS_COPROD:
@@ -45,6 +47,8 @@ SmToken 
starmathdatabase::Identify_SmXMLOperatorContext_Impl(sal_Unicode cChar,
             return SmToken(TPROD, MS_PROD, "prod", TG::Oper, 5);
         case MS_SUM:
             return SmToken(TSUM, MS_SUM, "sum", TG::Oper, 5);
+        case MS_MAJ:
+            return SmToken(TSUM, MS_MAJ, "maj", TG::Oper, 5);
         case MS_FACT:
             return SmToken(TFACT, MS_FACT, "!", TG::UnOper, 5);
         case MS_NEG:
@@ -217,8 +221,10 @@ SmToken 
starmathdatabase::Identify_SmXMLOperatorContext_Impl(sal_Unicode cChar,
     }
 }
 
-SmToken 
starmathdatabase::Identify_Prefix_SmXMLOperatorContext_Impl(sal_Unicode cChar)
+SmToken 
starmathdatabase::Identify_Prefix_SmXMLOperatorContext_Impl(std::u16string_view 
rText,
+                                                                    sal_Int32 
nIndex)
 {
+    auto cChar = o3tl::iterateCodePoints(rText, &nIndex);
     switch (cChar)
     {
         case MS_VERTLINE:
@@ -264,8 +270,10 @@ SmToken 
starmathdatabase::Identify_Prefix_SmXMLOperatorContext_Impl(sal_Unicode
     }
 }
 
-SmToken 
starmathdatabase::Identify_Postfix_SmXMLOperatorContext_Impl(sal_Unicode cChar)
+SmToken 
starmathdatabase::Identify_Postfix_SmXMLOperatorContext_Impl(std::u16string_view
 rText,
+                                                                     sal_Int32 
nIndex)
 {
+    auto cChar = o3tl::iterateCodePoints(rText, &nIndex);
     switch (cChar)
     {
         case MS_VERTLINE:
@@ -311,8 +319,11 @@ SmToken 
starmathdatabase::Identify_Postfix_SmXMLOperatorContext_Impl(sal_Unicode
     }
 }
 
-SmToken 
starmathdatabase::Identify_PrefixPostfix_SmXMLOperatorContext_Impl(sal_Unicode 
cChar)
+SmToken
+starmathdatabase::Identify_PrefixPostfix_SmXMLOperatorContext_Impl(std::u16string_view
 rText,
+                                                                   sal_Int32 
nIndex)
 {
+    auto cChar = o3tl::iterateCodePoints(rText, &nIndex);
     switch (cChar)
     {
         case MS_VERTLINE:
diff --git a/starmath/source/parse5.cxx b/starmath/source/parse5.cxx
index 13f3701db26a..c3f75f430d22 100644
--- a/starmath/source/parse5.cxx
+++ b/starmath/source/parse5.cxx
@@ -153,6 +153,7 @@ const SmTokenTableEntry aTokenTable[]
         { u"lsub", TLSUB, '\0', TG::Power, 0 },
         { u"lsup", TLSUP, '\0', TG::Power, 0 },
         { u"lt", TLT, MS_LT, TG::Relation, 0 },
+        { u"maj", TSUM, MS_MAJ, TG::Oper, 5 },
         { u"matrix", TMATRIX, '\0', TG::NONE, 5 },
         { u"minusplus", TMINUSPLUS, MS_MINUSPLUS, TG::UnOper | TG::Sum, 5 },
         { u"mline", TMLINE, MS_VERTLINE, TG::NONE, 0 }, //! not in TG::RBrace, 
Level 0

Reply via email to