[Libreoffice-commits] core.git: sw/CppunitTest_sw_rtfimport.mk sw/qa writerfilter/source

2023-01-13 Thread Michael Stahl (via logerrit)
 sw/CppunitTest_sw_rtfimport.mk|1 
 sw/qa/extras/rtfimport/data/hidden-para-separator.rtf |   67 ++
 sw/qa/extras/rtfimport/rtfimport.cxx  |   37 +
 writerfilter/source/rtftok/rtfdispatchsymbol.cxx  |4 -
 writerfilter/source/rtftok/rtfdocumentimpl.cxx|   17 +++-
 writerfilter/source/rtftok/rtfdocumentimpl.hxx|3 
 6 files changed, 120 insertions(+), 9 deletions(-)

New commits:
commit a25eda715591cfa96136bcfd95360156516239d1
Author: Michael Stahl 
AuthorDate: Fri Jan 13 17:49:58 2023 +0100
Commit: Michael Stahl 
CommitDate: Fri Jan 13 19:31:53 2023 +

tdf#131386 writerfilter: RTF import paragraph mark formatting

One obstacle was remove in commit 02f53bd61222d7999b847a22fd24d65195f129e5

To fix it, when \par is handled, runProps() just has to be called
unconditionally.

Now one test fails with:

rtfexport5.cxx:438:Assertion
Test name: testTdf107413::Load_Verify_Reload_Verify
equality assertion failed
- Expected: 14578
- Actual  : 14698

The spacing above the first paragraph in the table in the footer
is not imported - because this is recorded in a buffer, and when replaying,
getProperties() is called with Id 0, and not LN_Value_ST_StyleType_character
as when it's called immediately without buffering.

Change-Id: If86ed2fa88eb2ac0eafd7a8be411bbfa341619b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145490
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

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 ..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 }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;}

[Libreoffice-commits] core.git: sw/CppunitTest_sw_rtfimport.mk sw/qa writerfilter/source

2013-09-09 Thread Miklos Vajna
 sw/CppunitTest_sw_rtfimport.mk |1 +
 sw/qa/extras/rtfimport/data/fdo68291-paste.rtf |   17 +
 sw/qa/extras/rtfimport/data/fdo68291.odt   |binary
 sw/qa/extras/rtfimport/rtfimport.cxx   |   13 +
 writerfilter/source/dmapper/PropertyMap.cxx|2 +-
 5 files changed, 32 insertions(+), 1 deletion(-)

New commits:
commit b226dcb50d6728b62f39c9fa2e016724324944e3
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Sep 9 10:14:19 2013 +0200

fdo#68291 RTF paste: don't set PageDescName during paste

In general, paste should not deal with page styles. In this case, it
even caused an additional page break.

Change-Id: Ia7c5a9ad844821b6622babfbd94469ec3c04cf0a

diff --git a/sw/CppunitTest_sw_rtfimport.mk b/sw/CppunitTest_sw_rtfimport.mk
index 8cedeeb..be6613a 100644
--- a/sw/CppunitTest_sw_rtfimport.mk
+++ b/sw/CppunitTest_sw_rtfimport.mk
@@ -75,6 +75,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_rtfimport,\
 unotools/util/utl \
 unoxml/source/service/unoxml \
writerfilter/util/writerfilter \
+xmloff/util/xo \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,sw_rtfimport))
diff --git a/sw/qa/extras/rtfimport/data/fdo68291-paste.rtf 
b/sw/qa/extras/rtfimport/data/fdo68291-paste.rtf
new file mode 100644
index 000..cb86b60
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo68291-paste.rtf
@@ -0,0 +1,17 @@
+{\rtf1\ansi\deff3\adeflang1025
+{\fonttbl{\f0\froman\fprq2\fcharset0 Times New 
Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 
Arial;}{\f3\froman\fprq2\fcharset0 Times New Roman;}{\f4\fswiss\fprq2\fcharset0 
Arial;}{\f5\fnil\fprq2\fcharset0 DejaVu Sans;}}
+{\colortbl;\red0\green0\blue0;\red128\green128\blue128;}
+{\stylesheet{\s0\snext0\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\cf0\kerning1\dbch\af5\langfe2052\dbch\af5\alang1081\fs24\lang1038
 Normal;}
+{\s15\sbasedon0\snext15\noline Index;}
+{\s16\sbasedon0\snext16\sb120\sa120\noline\i\afs24\ai\fs24 Caption;}
+{\s17\sbasedon18\snext17\sb0\sa120 List;}
+{\s18\sbasedon0\snext18\sb0\sa120 Text Body;}
+{\s19\sbasedon0\snext18\sb240\sa120\keepn\dbch\af5\dbch\af5\afs28\loch\f4\fs28 
Heading;}
+}{\info{\comment LibreOffice}{\vern67239936}}\deftab709
+
+{\*\pgdsctbl
+{\pgdsc0\pgdscuse451\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0
 Default Style;}}
+\formshade\paperh16838\paperw11906\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\sectunlocked1\pgndec\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
+\pgndec\pard\plain 
\s0\nowidctlpar{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}\cf0\kerning1\dbch\af5\langfe2052\dbch\af5\alang1081\fs24\lang1038{\rtlch
 \ltrch\loch
+aaa}
+\par }
diff --git a/sw/qa/extras/rtfimport/data/fdo68291.odt 
b/sw/qa/extras/rtfimport/data/fdo68291.odt
new file mode 100644
index 000..ddf7d30
Binary files /dev/null and b/sw/qa/extras/rtfimport/data/fdo68291.odt differ
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 0041729..c5dfd25 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -165,6 +165,7 @@ public:
 void testGroupshapeRotation();
 void testFdo44715();
 void testFdo68076();
+void testFdo68291();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -315,6 +316,7 @@ void Test::run()
 {groupshape-rotation.rtf, Test::testGroupshapeRotation},
 {fdo44715.rtf, Test::testFdo44715},
 {fdo68076.rtf, Test::testFdo68076},
+{fdo68291.odt, Test::testFdo68291},
 };
 header();
 for (unsigned int i = 0; i  SAL_N_ELEMENTS(aMethods); ++i)
@@ -1512,6 +1514,17 @@ void Test::testFdo68076()
 getParagraph(1, aExpected);
 }
 
+void Test::testFdo68291()
+{
+uno::Referencetext::XTextDocument xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Referencetext::XTextRange xText(xTextDocument-getText(), 
uno::UNO_QUERY);
+uno::Referencetext::XTextRange xEnd = xText-getEnd();
+paste(fdo68291-paste.rtf, xEnd);
+
+// This was Standard, causing an unwanted page break on next paste.
+CPPUNIT_ASSERT_EQUAL(OUString(), getPropertyOUString(getParagraph(1), 
PageDescName));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 91ab014..c3a6523 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1084,7 +1084,7 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl rDM_Impl )
 0 - No break 1 - New Column 2 - New page 3 - Even page 4 - odd 
page */
 if ((m_bTitlePage  m_bIsFirstSection) || !m_bTitlePage)
 {
-if