From 8148dd6ed3c61eaf5f9fe3a060ecda9d11611f39 Mon Sep 17 00:00:00 2001 From: Irgaliev Amin Date: Mon, 25 Dec 2023 20:13:34 +0400 Subject: [PATCH] tdf#158023 Add \ before parentheses if they are in the tag. MSO allows you to write unpair opening or closing parentheses in the t tag. The patch adds a backslash before parentheses, which allows you to correctly recognize and correctly save such formulas when exporting. Also add a test to check whether the parentheses are wrapped correctly. Change-Id: Ib1a941858f0843742b56b8089f3c14983ba1222c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158794 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- starmath/source/ooxmlimport.cxx | 4 ++-- .../ooxmlexport/data/tdf158023_export.docx | Bin 0 -> 10504 bytes sw/qa/extras/ooxmlexport/ooxmlexport2.cxx | 9 +++++++- .../ooxmlimport/data/tdf158023_import.docx | Bin 0 -> 10329 bytes sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 20 ++++++++++++++++++ sw/qa/extras/rtfexport/data/tdf158023.rtf | 8 +++++++ sw/qa/extras/rtfexport/rtfexport.cxx | 10 ++++++++- 7 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf158023_export.docx create mode 100644 sw/qa/extras/ooxmlimport/data/tdf158023_import.docx create mode 100644 sw/qa/extras/rtfexport/data/tdf158023.rtf diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx index 4023a5e652ac..b0932c43919c 100644 --- a/starmath/source/ooxmlimport.cxx +++ b/starmath/source/ooxmlimport.cxx @@ -602,9 +602,9 @@ OUString SmOoxmlImport::handleR() { XmlStream::Tag rtag = m_rStream.ensureOpeningTag( M_TOKEN( t )); if( rtag.attribute( OOX_TOKEN( xml, space )) != "preserve" ) - text.append(o3tl::trim(rtag.text)); + text.append(o3tl::trim(rtag.text.replaceAll("(", "\\(").replaceAll(")", "\\)"))); else - text.append(rtag.text); + text.append(rtag.text.replaceAll("(", "\\(").replaceAll(")", "\\)")); m_rStream.ensureClosingTag( M_TOKEN( t )); break; } diff --git a/sw/qa/extras/ooxmlexport/data/tdf158023_export.docx b/sw/qa/extras/ooxmlexport/data/tdf158023_export.docx new file mode 100644 index 0000000000000000000000000000000000000000..289619a7e4b6fceda66662df16c0bdb4a789734b GIT binary patch literal 10504 zcmeHt^;?wP+V;>Pozh*>ASJDIw}8R`k`hCQbeE)bx4_WSDLuqc(jC$ujYxi@`+MH) z<9?3!A9(lr;l9@#_ng<<>zeagS1mO~1VjP=G5{3-0MG!IZW9H};Q#pzlZX7z*XZ6CDmQ}9!v2!OE=52$xitnqxrihK5%Q;PKJVox;YN5vlnp4>74hLX?~~x=S%A+j z0vT4g2`1+<2n7 z>px!r<_GUE6i8*g(yS$9tzFm`FQr@SleqRJe6`5&ZbB$pj9$f4D4l8#%Bm)$hfAFo z;_A{biy~EXfY*H#+tLTp@Jn!8g?{p_N5LGHAB^w`4^JT#Oh0;gs=xDrR)@>GBjsl0 zb4yU|j}Kz^o$v2l)ZM7$C_vvD)`(%udU!wpsQt}6DdR{R&R|beVAl5tW}ZMtGaDyP zj-S{6n&tmtTl{V5@8cH~5F{}|j*wQ2A>IND=(H1a%W}DHwEGA_sRwXwSi=SL?QQwg z&1wsVTj$$Ds?+I#>65}AMUX3v^`>%W(~V?Ttle!JB2m=zAg|H_EHGt9s;ull)0`r4 z3ArNgxxsnspF$+*#c0iWtMXq5L)x{PW69;wG-Kk1$u8c5o7?-(Um~QX7R~EnT3H-P z)b;D~1E;YJ1W0|*&5ve>!U-WL#-KS4lP5OveU4FYSuWT}ZMa4mGUH6j(D_%b@}@4N z9)OY2!E9)`XyK!0UM?93`i9ufb9o;9mBLgsdTd1Ao;NQ7KXF=$!5r0p+Q_u&C-rNX zLbwqC0CE5-oEyl|l=EMPVhVcWVhi(TKi$}0Mgs@)WiUDaw?|n#^ldj6PS8avu0wLbVJCaF>j!YR^9 z0Z-yKf}IIH0phQj7GFI zfB$h6{fk33;%g&Da*KUL8ct-!#S2-bl;jJ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#Gw@HgGZ0$uAGfpt-7xiazOeVk5U@$*=CO`?*yd@_TaEW`L4h^;gZa?1Wn2Vsa zqFU>iYlPkQ-njV;D4a#~3ShnUz#OptE)_(Z#nEkpIXT!J+ZwUS05!F zzJ)iF_$e%ap!1uHl__v_NV)B~;vCW%5132fF%h;+QtO_~JPoIe_-0?1ezg68=f-Ryv)(bdp(1q~u&~qKBN0`J+5rIQGNzu%pU| zsaFP%HofsBX_$&zLA1`aVwE6RH-K}#H(t8E%CHtun zwx91Tj3in2EYv6tU&~1EM5Zdoko4C(h!9DI7gL4-Y;=aZyp-8ecqid=M`E_T zAXrplS29p~%rhR^>ElKl^#&(LRDiVn4!`Rcb65rPFb1(3S z*i{Gb2aShll23a-(6GDR*rw02!lW<2G}(+>Rt*R@MxB#V^x-KlV`A1)1l?<(era>9 zyjvP5>Y|(Dj$&)oduQ`}hi&X%>{MFPFc!26MMArJN8IaxWJoQBw0H4Lg}nEx6G0`E zE!fRwShvO$Cbl*eRbRez=49(M?DbAsU7qJI4&Q!>zR$;fLhYXWtO}Ds7o{GEevlHJ zt7hOk)>y^IjQ?TJt#yFh7^O#0po7g{gW{d`1_N6}?V;m}p$(`-X0C;ZR0-M`_!u=wg1{Ld!dpCbOOi2hrI1+2L9uK?_~#QsnC zpT(em!@;mV;xG8$N<)9*|12i_hKHR*`i1|awD6~dzh~(G#sdH;j{$%`^YuT`e@~Kr xM{B}bq5p&aD`ol<{%64YZvn`Ze`)W3!dEp#Bp5w@9-w*z=!7L@+>Adz{Xb{hWOM)k literal 0 HcmV?d00001 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx index 6e27f9a6a1ab..e18c1eebca5e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx @@ -261,7 +261,14 @@ CPPUNIT_TEST_FIXTURE(Test, testCommentsNested) CPPUNIT_TEST_FIXTURE(Test, testMathEscape) { loadAndReload("math-escape.docx"); - CPPUNIT_ASSERT_EQUAL(OUString("\\{ left [ right ] left ( right ) \\}"), getFormula(getRun(getParagraph(1), 1))); + CPPUNIT_ASSERT_EQUAL(OUString("\\{ left [ right ] \\( \\) \\}"), getFormula(getRun(getParagraph(1), 1))); +} + +// Saving left and right for parentheses when importing not from the m:t tag (docx) +CPPUNIT_TEST_FIXTURE(Test, testTdf158023Export) +{ + loadAndReload("tdf158023_export.docx"); + CPPUNIT_ASSERT_EQUAL(OUString("left [ right ] left ( right ) left lbrace right rbrace"), getFormula(getRun(getParagraph(1), 1))); } CPPUNIT_TEST_FIXTURE(Test, testFdo51034) diff --git a/sw/qa/extras/ooxmlimport/data/tdf158023_import.docx b/sw/qa/extras/ooxmlimport/data/tdf158023_import.docx new file mode 100644 index 0000000000000000000000000000000000000000..1095499e2ebff41a4f89bb30b8e1ba8ea2044ebd GIT binary patch literal 10329 zcmeHt^9o*fWKuB;W!QI{6J-8%Du)%}#on+s;$<5x+ z`w#5)4?We>{haPP^_)6Vr6>ahjRk-Ozykn)=YZAw_uOU>000>b0DuXAhtv@T+Buur zIqR!>*qb`(GP~Q_kmW){(q;o7!O#Ei_%GH#t?GzfH!FIp#=f9fyLv=USaC5t(JfEC zhj809(Yk$=c>Pr5%1M7l!Dd2DQrA*G_(xOCEW3s*H_aPS=P@B z*`vxA%hXY+#b&5oJ`gOX*z6a&^~2U#VfLKnjTNAj_u@?>-5+C6eG>Yx8B(jTzm6Q z;IS+E!9~f9RFW8Y+^~rYX4caa6hQHB=1CGy&~OgEBM-JdB(QnvJDS=!u`vHQ|IaM{ zi*50@u16;RD5+)zjJm)hI%$eI!|H zM-=AMg3@OB3ix3w47KL6Kc^YIUbl9)ZHR(X)Ed-D4Kzo2Jzi;P2b^c&k5A0uk7g^$ z-Kq%{rW7DIW3SA66EfJY+WeMC3PB|>%;6ei`HRaQi7K)`gNT_Z=lS_Xd zRhOH<7tsv#c_adR5Y7;|$Z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_)CN#xEAxT`0KYc{ZIIxwVPjXIq>q_Px#*|Ie+5+EDij^ zGlRGG{KWrJDEL#t-}CKXcmRM94*>Wx`~DOC_oU}{^en+|=)Y2+KjDAItG@(j691*W ae@Cy1GB99z{MeC%1n2@MS%FkPuKo`R2G literal 0 HcmV?d00001 diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index d86a6bffe861..ed2d5371dfc4 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -699,6 +699,26 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf119200) CPPUNIT_ASSERT_EQUAL(u" size 12{ func \u2287 } {}"_ustr, getFormula(getRun(xPara, 7))); } +// Checking a formula where the closing brackets +// come first, and then the opening ones +CPPUNIT_TEST_FIXTURE(Test, testTdf158023Import) +{ + auto verify = [this]() { + auto xPara = getParagraph(1); + CPPUNIT_ASSERT_EQUAL(u"\\) sqrt {\\)2\\(} \\("_ustr, getFormula(getRun(xPara, 1))); + }; + auto verifyReload = [this]() { + auto xPara = getParagraph(1); + CPPUNIT_ASSERT_EQUAL(u"\\) sqrt {\\) 2 \\(} \\("_ustr, getFormula(getRun(xPara, 1))); + }; + + createSwDoc("tdf158023_import.docx"); + verify(); + + saveAndReload("Office Open XML Text"); + verifyReload(); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf115094) { createSwDoc("tdf115094.docx"); diff --git a/sw/qa/extras/rtfexport/data/tdf158023.rtf b/sw/qa/extras/rtfexport/data/tdf158023.rtf new file mode 100644 index 000000000000..cdcddc4532fc --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf158023.rtf @@ -0,0 +1,8 @@ +{\rtf1 +{\mmath {\*\moMath +{\md {\mdPr {\mbegChr [}{\mendChr ]}}{\me {\mr a}}} +{\md {\mdPr {\mbegChr (}{\mendChr )}}{\me {\mr b}}} +{\md {\mdPr {\mbegChr \{}{\mendChr \}}}{\me {\mr c}}} +}} +\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 972206b9ff75..227eedf78f6f 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -376,7 +376,15 @@ CPPUNIT_TEST_FIXTURE(Test, testMathRuns) { loadAndReload("math-runs.rtf"); // was [](){}, i.e. first curly bracket had an incorrect position - CPPUNIT_ASSERT_EQUAL(OUString("\\{ left [ right ] left ( right ) \\}"), + CPPUNIT_ASSERT_EQUAL(OUString("\\{ left [ right ] \\( \\) \\}"), + getFormula(getRun(getParagraph(1), 1))); +} + +// Saving left and right for parentheses when importing not from the m:t tag (rtf) +CPPUNIT_TEST_FIXTURE(Test, testTdf158023_rtf) +{ + loadAndReload("tdf158023.rtf"); + CPPUNIT_ASSERT_EQUAL(OUString("left [a right ] left (b right ) left lbrace c right rbrace"), getFormula(getRun(getParagraph(1), 1))); }