diff options
-rw-r--r-- | sw/CppunitTest_sw_rtfimport.mk | 1 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/data/hidden-para-separator.rtf | 67 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 37 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 17 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 3 |
6 files changed, 120 insertions, 9 deletions
diff --git a/sw/CppunitTest_sw_rtfimport.mk b/sw/CppunitTest_sw_rtfimport.mk index 650abb178408..e961c4c2304b 100644 --- a/sw/CppunitTest_sw_rtfimport.mk +++ b/sw/CppunitTest_sw_rtfimport.mk @@ -25,6 +25,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_rtfimport, \ sfx \ subsequenttest \ i18nlangtag \ + svl \ sw \ swqahelper \ test \ diff --git a/sw/qa/extras/rtfimport/data/hidden-para-separator.rtf b/sw/qa/extras/rtfimport/data/hidden-para-separator.rtf new file mode 100644 index 000000000000..b35bdcf710e3 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/hidden-para-separator.rtf @@ -0,0 +1,67 @@ +{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch31506\stshfhich31506\stshfbi31506\deflang1033\deflangfe1033\themelang1038\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};}
+{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}{\f34\fbidi \froman\fcharset1\fprq2{\*\panose 02040503050406030204}Cambria Math;}{\f60\fbidi \fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Verdana;}
+{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};}{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};}
+{\fhimajor\f31502\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;}{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};}
+{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};}{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};}
+{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman{\*\falt Times New Roman};}
+{\f61\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times New Roman};}{\f62\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times New Roman};}{\f64\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times New Roman};}
+{\f65\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times New Roman};}{\f66\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times New Roman};}
+{\f67\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times New Roman};}{\f68\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times New Roman};}
+{\f69\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times New Roman};}{\f71\fbidi \fswiss\fcharset238\fprq2 Arial CE;}{\f72\fbidi \fswiss\fcharset204\fprq2 Arial Cyr;}{\f74\fbidi \fswiss\fcharset161\fprq2 Arial Greek;}
+{\f75\fbidi \fswiss\fcharset162\fprq2 Arial Tur;}{\f76\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f77\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);}{\f78\fbidi \fswiss\fcharset186\fprq2 Arial Baltic;}
+{\f79\fbidi \fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f661\fbidi \fswiss\fcharset238\fprq2 Verdana CE;}{\f662\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr;}{\f664\fbidi \fswiss\fcharset161\fprq2 Verdana Greek;}
+{\f665\fbidi \fswiss\fcharset162\fprq2 Verdana Tur;}{\f668\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic;}{\f669\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese);}
+{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times New Roman};}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times New Roman};}
+{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times New Roman};}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times New Roman};}
+{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times New Roman};}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times New Roman};}
+{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times New Roman};}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times New Roman};}
+{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times New Roman};}{\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times New Roman};}
+{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times New Roman};}{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times New Roman};}
+{\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times New Roman};}{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times New Roman};}
+{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times New Roman};}{\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times New Roman};}
+{\fhimajor\f31528\fbidi \fswiss\fcharset238\fprq2 Calibri Light CE;}{\fhimajor\f31529\fbidi \fswiss\fcharset204\fprq2 Calibri Light Cyr;}{\fhimajor\f31531\fbidi \fswiss\fcharset161\fprq2 Calibri Light Greek;}
+{\fhimajor\f31532\fbidi \fswiss\fcharset162\fprq2 Calibri Light Tur;}{\fhimajor\f31533\fbidi \fswiss\fcharset177\fprq2 Calibri Light (Hebrew);}{\fhimajor\f31534\fbidi \fswiss\fcharset178\fprq2 Calibri Light (Arabic);}
+{\fhimajor\f31535\fbidi \fswiss\fcharset186\fprq2 Calibri Light Baltic;}{\fhimajor\f31536\fbidi \fswiss\fcharset163\fprq2 Calibri Light (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times New Roman};}
+{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times New Roman};}{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times New Roman};}
+{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times New Roman};}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times New Roman};}
+{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times New Roman};}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times New Roman};}
+{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times New Roman};}{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times New Roman};}
+{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times New Roman};}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times New Roman};}
+{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times New Roman};}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times New Roman};}
+{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times New Roman};}{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times New Roman};}
+{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times New Roman};}{\fdbminor\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times New Roman};}
+{\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times New Roman};}{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times New Roman};}
+{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times New Roman};}{\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times New Roman};}
+{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times New Roman};}{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times New Roman};}
+{\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times New Roman};}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}
+{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\fhiminor\f31573\fbidi \fswiss\fcharset177\fprq2 Calibri (Hebrew);}
+{\fhiminor\f31574\fbidi \fswiss\fcharset178\fprq2 Calibri (Arabic);}{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}
+{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE{\*\falt Times New Roman};}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr{\*\falt Times New Roman};}
+{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek{\*\falt Times New Roman};}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur{\*\falt Times New Roman};}
+{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew){\*\falt Times New Roman};}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic){\*\falt Times New Roman};}
+{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic{\*\falt Times New Roman};}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese){\*\falt Times New Roman};}}{\colortbl;\red0\green0\blue0;
+\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
+\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\*\defchp \f31506\fs22\lang1038\langfe1033\langnp1038 }{\*\defpap \ql \li0\ri0\sa160\sl259\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0
+\fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 \snext0 \sqformat \spriority0 \styrsid5051456 Normal;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa160\sl259\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31506\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1038\langfe1033\cgrid\langnp1038\langfenp1033 \snext11 \ssemihidden \sunhideused Normal Table;}}
+{\*\rsidtbl \rsid3426558\rsid3606041\rsid5051456\rsid5772234\rsid8551883\rsid11037225\rsid11555902\rsid11828852\rsid13900948}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}
+{\info{\author G\'e1bor Kelemen2010}{\operator ms}{\creatim\yr2023\mo1\dy13\hr15\min26}{\revtim\yr2023\mo1\dy13\hr15\min26}{\version2}{\edmins1}{\nofpages1}{\nofwords1}{\nofchars8}{\nofcharsws8}{\vern57435}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.c
+om/office/word/2003/wordml}}\paperw11906\paperh16838\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\deftab708\widowctrl\ftnbj\aenddoc\hyphhotz425\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml1\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0
+\showxmlerrors1\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1440\dgvorigin1440\dghshow1\dgvshow1
+\jexpand\viewkind1\viewscale98\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
+\asianbrkrule\rsidroot5051456\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal \nouicompat \fet0
+{\*\wgrffmtfilter 2450}\nofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2
+\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang
+{\pntxtb (}{\pntxta )}}\pard\plain \ltrpar\ql \li57\ri0\sb80\sl216\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin57\itap0\pararsid5051456 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0
+\fs26\lang3079\langfe3079\cgrid\langnp3079\langfenp3079 {\rtlch\fcs1 \ab\af1 \ltrch\fcs0 \b\f60\chbrdr\brdrs\brdrw10 \insrsid5051456\charrsid11828852 C}{\rtlch\fcs1 \ab\af1 \ltrch\fcs0 \b\f60\insrsid5051456\charrsid11828852 }{\rtlch\fcs1 \ab\af1
+\ltrch\fcs0 \b\v\f60\insrsid5051456\charrsid11828852
+\par }{\rtlch\fcs1 \ab\af1 \ltrch\fcs0 \b\f60\chbrdr\brdrs\brdrw10 \insrsid11828852\charrsid11828852 D}{\rtlch\fcs1 \ab\af1 \ltrch\fcs0 \b\v\f60\chbrdr\brdrs\brdrw10 \insrsid5772234\charrsid3426558
+\par }{\rtlch\fcs1 \ab\af1 \ltrch\fcs0 \b\v\f60\insrsid13900948\charrsid3606041
+\par }{\rtlch\fcs1 \ab\af1 \ltrch\fcs0 \b\f60\insrsid11828852\charrsid11828852 E}{\rtlch\fcs1 \ab\af1 \ltrch\fcs0 \b\f60\insrsid11828852
+\par }{\rtlch\fcs1 \ab\af1 \ltrch\fcs0 \b\v\f60\insrsid11828852\charrsid11828852
+\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index eb8107f2f270..eb2596e44c44 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -45,6 +45,7 @@ #include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/text/XTextDocument.hpp> #include <com/sun/star/text/XTextSectionsSupplier.hpp> +#include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/document/XDocumentInsertable.hpp> @@ -55,6 +56,12 @@ #include <comphelper/sequenceashashmap.hxx> #include <comphelper/configuration.hxx> +#include <editeng/charhiddenitem.hxx> + +#include <ndindex.hxx> +#include <ndtxt.hxx> +#include <fmtautofmt.hxx> + class Test : public SwModelTestBase { public: @@ -995,6 +1002,36 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo44984) "TextPortionType")); } +CPPUNIT_TEST_FIXTURE(Test, testTdf131386) +{ + createSwDoc("hidden-para-separator.rtf"); + SwDoc const* const pDoc = getSwDoc(); + SwNodeIndex ix(pDoc->GetNodes().GetEndOfContent(), -1); + CPPUNIT_ASSERT(!ix.GetNode().GetTextNode()->GetAttr(RES_PARATR_LIST_AUTOFMT).GetStyleHandle()); + --ix; + --ix; + CPPUNIT_ASSERT(ix.GetNode() + .GetTextNode() + ->GetAttr(RES_PARATR_LIST_AUTOFMT) + .GetStyleHandle() + ->Get(RES_CHRATR_HIDDEN) + .GetValue()); + --ix; + CPPUNIT_ASSERT(ix.GetNode() + .GetTextNode() + ->GetAttr(RES_PARATR_LIST_AUTOFMT) + .GetStyleHandle() + ->Get(RES_CHRATR_HIDDEN) + .GetValue()); + --ix; + CPPUNIT_ASSERT(ix.GetNode() + .GetTextNode() + ->GetAttr(RES_PARATR_LIST_AUTOFMT) + .GetStyleHandle() + ->Get(RES_CHRATR_HIDDEN) + .GetValue()); +} + CPPUNIT_TEST_FIXTURE(Test, testFdo82071) { createSwDoc("fdo82071.rtf"); diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx index 3f9ed20bfae8..c884ba592f6a 100644 --- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx +++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx @@ -99,10 +99,8 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) if (m_aStates.top().getDestination() == Destination::FOOTNOTESEPARATOR) break; // just ignore it - only thing we read in here is CHFTNSEP checkFirstRun(); - bool bNeedPap = m_bNeedPap; checkNeedPap(); - if (bNeedPap) - runProps(); + runProps(); // tdf#152872 paragraph marker formatting if (!m_aStates.top().getCurrentBuffer()) { parBreak(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index ac5bbfb042f2..0dbe6a5bd1bb 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -625,7 +625,8 @@ void RTFDocumentImpl::runProps() { auto pValue = new RTFValue(m_aStates.top().getCharacterAttributes(), m_aStates.top().getCharacterSprms()); - bufferProperties(*m_aStates.top().getCurrentBuffer(), pValue, nullptr); + bufferProperties(*m_aStates.top().getCurrentBuffer(), pValue, nullptr, + NS_ooxml::LN_Value_ST_StyleType_character); } // Delete the sprm, so the trackchange range will be started only once. @@ -1717,11 +1718,13 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, RTFSprms* const pSprms, { Buf_t aTuple(rBuffer.front()); rBuffer.pop_front(); - if (std::get<0>(aTuple) == BUFFER_PROPS) + if (std::get<0>(aTuple) == BUFFER_PROPS || std::get<0>(aTuple) == BUFFER_PROPS_CHAR) { // Construct properties via getProperties() and not directly, to take care of deduplication. writerfilter::Reference<Properties>::Pointer_t const pProp(getProperties( - std::get<1>(aTuple)->getAttributes(), std::get<1>(aTuple)->getSprms(), 0)); + std::get<1>(aTuple)->getAttributes(), std::get<1>(aTuple)->getSprms(), + std::get<0>(aTuple) == BUFFER_PROPS_CHAR ? NS_ooxml::LN_Value_ST_StyleType_character + : 0)); Mapper().props(pProp); } else if (std::get<0>(aTuple) == BUFFER_NESTROW) @@ -3814,11 +3817,15 @@ RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl) void RTFDocumentImpl::resetFrame() { m_aStates.top().getFrame() = RTFFrame(&m_aStates.top()); } void RTFDocumentImpl::bufferProperties(RTFBuffer_t& rBuffer, const RTFValue::Pointer_t& pValue, - const tools::SvRef<TableRowBuffer>& pTableProperties) + const tools::SvRef<TableRowBuffer>& pTableProperties, + Id const nStyleType) { rBuffer.emplace_back(BUFFER_SETSTYLE, new RTFValue(m_aStates.top().getCurrentStyleIndex()), nullptr); - rBuffer.emplace_back(BUFFER_PROPS, pValue, pTableProperties); + assert(nStyleType == 0 || nStyleType == NS_ooxml::LN_Value_ST_StyleType_character); + rBuffer.emplace_back(nStyleType == NS_ooxml::LN_Value_ST_StyleType_character ? BUFFER_PROPS_CHAR + : BUFFER_PROPS, + pValue, pTableProperties); } RTFShape::RTFShape() = default; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index ac1263a41531..71ecd06c8cd8 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -73,6 +73,7 @@ enum RTFBufferTypes BUFFER_SETSTYLE, /// Stores properties, should be created only in bufferProperties(). BUFFER_PROPS, + BUFFER_PROPS_CHAR, BUFFER_NESTROW, BUFFER_CELLEND, BUFFER_STARTRUN, @@ -762,7 +763,7 @@ public: void resetFrame(); /// Buffers properties to be sent later. void bufferProperties(RTFBuffer_t& rBuffer, const RTFValue::Pointer_t& pValue, - const tools::SvRef<TableRowBuffer>& pTableProperties); + const tools::SvRef<TableRowBuffer>& pTableProperties, Id nStyleType = 0); /// implement non-obvious RTF specific style inheritance RTFReferenceTable::Entries_t deduplicateStyleTable(); |