starmath/source/ooxmlimport.cxx | 31 ++++++++++++++++++++++++++++++- starmath/source/ooxmlimport.hxx | 1 + 2 files changed, 31 insertions(+), 1 deletion(-)
New commits: commit 5ecd7a5a20edad01c1ed7fd111cd4e5f7f4e5bb5 Author: Pranam Lashkari <[email protected]> AuthorDate: Wed Dec 24 18:15:27 2025 +0530 Commit: Gabor Kelemen <[email protected]> CommitDate: Wed Jan 7 15:54:23 2026 +0100 tdf#162972 math: special treatment for apostrophe(') in MSO problem: in MSO is only apostrophe is in superscript, MSO treats it as normal text i.e: in question 2' ^' both apostrophe will be displayed on same level Change-Id: Idc1eb144115ed0cb51c18a76b6d8b9423eb5e910 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196198 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Tested-by: Caolán McNamara <[email protected]> (cherry picked from commit 3c20957c43c3a8bb86b21a22acdbc762efc82566) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196568 Tested-by: Gabor Kelemen <[email protected]> Reviewed-by: Pranam Lashkari <[email protected]> diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx index 2de300649fbb..6fe2e367f40f 100644 --- a/starmath/source/ooxmlimport.cxx +++ b/starmath/source/ooxmlimport.cxx @@ -708,6 +708,8 @@ OUString SmOoxmlImport::handleSsup() OUString e = readOMathArgInElement( M_TOKEN( e )); OUString sup = readOMathArgInElement( M_TOKEN( sup )); m_rStream.ensureClosingTag( M_TOKEN( sSup )); + if (sup == "'") + return "{" + e + "} {" + sup + "}"; return "{" + e + "} ^ {" + sup + "}"; } commit 92ce8c2909db97bcc2b3705d3f6c07634eac8dc6 Author: Pranam Lashkari <[email protected]> AuthorDate: Wed Dec 24 18:24:16 2025 +0530 Commit: Gabor Kelemen <[email protected]> CommitDate: Wed Jan 7 15:54:08 2026 +0100 tdf#169843 math: OOXML set letter not interpreted correctly problem: OOXML has special property to define set names m:scr with value "double-struck" means text should be interpreted as set names and double-struck letters should be used Change-Id: I8acefb369694ae901fc4df2505a85d0691a2cb16 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196199 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> (cherry picked from commit f325e0de3447c0403656ebb2a2fe4789aa59e78e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196569 Reviewed-by: Pranam Lashkari <[email protected]> Tested-by: Gabor Kelemen <[email protected]> diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx index f7821f67b4a3..2de300649fbb 100644 --- a/starmath/source/ooxmlimport.cxx +++ b/starmath/source/ooxmlimport.cxx @@ -21,6 +21,7 @@ #include <sal/log.hxx> #include <o3tl/string_view.hxx> #include <parse5.hxx> +#include <unordered_set> using namespace oox::formulaimport; @@ -580,6 +581,7 @@ OUString SmOoxmlImport::handleR() m_rStream.ensureOpeningTag( M_TOKEN( r )); bool normal = false; bool literal = false; + OUString scrString; if( XmlStream::Tag rPr = m_rStream.checkOpeningTag( M_TOKEN( rPr ))) { if( XmlStream::Tag litTag = m_rStream.checkOpeningTag( M_TOKEN( lit ))) @@ -592,6 +594,11 @@ OUString SmOoxmlImport::handleR() normal = norTag.attribute( M_TOKEN( val ), true ); m_rStream.ensureClosingTag( M_TOKEN( nor )); } + if (XmlStream::Tag srcTag = m_rStream.checkOpeningTag( M_TOKEN( scr ))) + { + scrString = srcTag.attribute( M_TOKEN( val ), scrString ); + m_rStream.ensureClosingTag( M_TOKEN( scr )); + } m_rStream.ensureClosingTag( M_TOKEN( rPr )); } OUStringBuffer text; @@ -605,6 +612,10 @@ OUString SmOoxmlImport::handleR() isTagT = true; XmlStream::Tag rtag = m_rStream.ensureOpeningTag( M_TOKEN( t )); OUString sTagText = rtag.text; + if (scrString == "double-struck") + { + sTagText = SmOoxmlImport::handleSetString(sTagText); + } if( rtag.attribute( OOX_TOKEN( xml, space )) != "preserve" ) sTagText = o3tl::trim(sTagText); text.append(sTagText); @@ -617,13 +628,29 @@ OUString SmOoxmlImport::handleR() } } m_rStream.ensureClosingTag( M_TOKEN( r )); - if (normal || literal || isTagT) + if (scrString.isEmpty() && (normal || literal || isTagT)) { return encloseOrEscapeLiteral(text.makeStringAndClear(), normal || literal); } return text.makeStringAndClear(); } +OUString SmOoxmlImport::handleSetString(const OUString& setOUstring) +{ + std::unordered_set<sal_Unicode> setList= {'C', 'N', 'Q', 'R', 'Z', 'c', 'n', 'q', 'r', 'z'}; + OUString result; + for (sal_Int32 i = 0; i < setOUstring.getLength(); i++) + { + if (setList.contains(setOUstring[i])) + { + result += OUString::Concat(" set" ) + OUStringChar(setOUstring[i]) + OUString::Concat(" "); + } + else + result += OUStringChar(setOUstring[i]); + } + return result; +} + OUString SmOoxmlImport::handleRad() { m_rStream.ensureOpeningTag( M_TOKEN( rad )); diff --git a/starmath/source/ooxmlimport.hxx b/starmath/source/ooxmlimport.hxx index 4f8df14bfd16..e3621fdc0dec 100644 --- a/starmath/source/ooxmlimport.hxx +++ b/starmath/source/ooxmlimport.hxx @@ -44,6 +44,7 @@ private: OUString handleSsup(); OUString readOMathArg( int stoptoken ); OUString readOMathArgInElement( int token ); + static OUString handleSetString(const OUString& setOUstring); oox::formulaimport::XmlStream& m_rStream; };
