diff options
author | László Németh <nemeth@numbertext.org> | 2019-11-11 10:05:12 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-11-11 11:38:36 +0100 |
commit | 24f17f0336badfbba276c1e6713a89b4f9bb7cb8 (patch) | |
tree | 186b623027bc0edca336ae448716904b8c6436e8 /sw | |
parent | 5e279f175289234b91f272bbbf48e70315fff5ac (diff) |
tdf#128428 RTF: clean-up for longer space sequence mode
Fix regressions from commit 24b04db5a63b57a74e58a7616091437ad68548ac
(tdf#123703 RTF import: fix length of space character sequence).
It seems, longer space sequence is an obsolete RTF-only feature, eg.
new RTF documents created in MSO don't use it, but old RTF documents
still keep their layout (only in RTF).
- Only old-style (without \stshfdbch) or compatible (\stshfdbch31505)
RTF documents get longer space sequences using a one-time conversion;
- because Writer always exports old-style RTF documents, to avoid of
enlargement of space sequences of new-style RTF documents later, RTF
import doesn't modify the RTF documents saved in Writer (checking
\generator);
- text in monospaced font "Courier New" doesn't get longer space
sequence (despite its \prq2 (not monospaced) font setting).
Change-Id: I308ab06db57a2db5deec1d4c4573da3317cad8e9
Reviewed-on: https://gerrit.libreoffice.org/82145
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/rtfexport/data/tdf123703_compatible.rtf | 37 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/data/tdf123703_stshfdbch.rtf | 31 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/data/tdf128428_compatible_monospaced.rtf | 38 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/data/tdf128428_monospaced.rtf | 33 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport3.cxx | 29 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 11 |
6 files changed, 168 insertions, 11 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf123703_compatible.rtf b/sw/qa/extras/rtfexport/data/tdf123703_compatible.rtf new file mode 100644 index 000000000000..3713b5fe54eb --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf123703_compatible.rtf @@ -0,0 +1,37 @@ +{\rtf1\adeflang1025\ansi\ansicpg1250\uc1\adeff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi31507\deflang1038\deflangfe1038\themelang1038\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;} +{\f11\fbidi \fmodern\fcharset128\fprq1{\*\panose 02020609040205080304}MS Mincho{\*\falt \'82\'6c\'82\'72 \'96\'be\'92\'a9};}{\f11\fbidi \fmodern\fcharset128\fprq1{\*\panose 02020609040205080304}MS Mincho{\*\falt \'82\'6c\'82\'72 \'96\'be\'92\'a9};} +{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f128\fbidi \fmodern\fcharset128\fprq1{\*\panose 02020609040205080304}@MS Mincho;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;} +{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;} +{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f369\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f370\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}} +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +} diff --git a/sw/qa/extras/rtfexport/data/tdf123703_stshfdbch.rtf b/sw/qa/extras/rtfexport/data/tdf123703_stshfdbch.rtf new file mode 100644 index 000000000000..7d074c41ced3 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf123703_stshfdbch.rtf @@ -0,0 +1,31 @@ +{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1036\deflangfe1036{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}} +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +} diff --git a/sw/qa/extras/rtfexport/data/tdf128428_compatible_monospaced.rtf b/sw/qa/extras/rtfexport/data/tdf128428_compatible_monospaced.rtf new file mode 100644 index 000000000000..24f0a6648cda --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf128428_compatible_monospaced.rtf @@ -0,0 +1,38 @@ +{\rtf1\adeflang1025\ansi\ansicpg1250\uc1\adeff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi31507\deflang1038\deflangfe1038\themelang1038\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;} +{\f11\fbidi \fmodern\fcharset128\fprq1{\*\panose 02020609040205080304}MS Mincho{\*\falt \'82\'6c\'82\'72 \'96\'be\'92\'a9};}{\f11\fbidi \fmodern\fcharset128\fprq1{\*\panose 02020609040205080304}MS Mincho{\*\falt \'82\'6c\'82\'72 \'96\'be\'92\'a9};} +{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f128\fbidi \fmodern\fcharset128\fprq1{\*\panose 02020609040205080304}@MS Mincho;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;} +{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;} +{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f369\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f370\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}} +\af2 +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +} diff --git a/sw/qa/extras/rtfexport/data/tdf128428_monospaced.rtf b/sw/qa/extras/rtfexport/data/tdf128428_monospaced.rtf new file mode 100644 index 000000000000..18c9381dfc22 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf128428_monospaced.rtf @@ -0,0 +1,33 @@ +{\rtf1{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Courier New;}} +\af0 +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +word word2\par +} +} diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index 8845e893472b..749da3194b88 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -265,6 +265,35 @@ DECLARE_RTFEXPORT_TEST(testTdf123703, "tdf123703.rtf") #endif } +DECLARE_RTFEXPORT_TEST(testTdf123703_stshfdbch, "tdf123703_stshfdbch.rtf") +{ + // still 1 here + CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + +DECLARE_RTFEXPORT_TEST(testTdf123703_compatible, "tdf123703_compatible.rtf") +{ +#if !defined(MACOSX) + // in the case of compatibility font id 31505 + CPPUNIT_ASSERT_EQUAL(2, getPages()); +#else + // still 1 here + CPPUNIT_ASSERT_EQUAL(1, getPages()); +#endif +} + +DECLARE_RTFEXPORT_TEST(testTdf128428_monospaced, "tdf128428_monospaced.rtf") +{ + // still 1 here + CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + +DECLARE_RTFEXPORT_TEST(testTdf128428_compatible_monospaced, "tdf128428_compatible_monospaced.rtf") +{ + // still 1 here + CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 6fe0624e0305..89de28bf5182 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1676,17 +1676,6 @@ OUString SwWW8AttrIter::GetSnippet(const OUString &rStr, sal_Int32 nCurrentPos, aSnippet = aSnippet.replace(CHAR_HARDHYPHEN, 0x1e); aSnippet = aSnippet.replace(CHAR_SOFTHYPHEN, 0x1f); - // tdf#123703 revert import workaround for longer space characters in consecutive spaces - sal_Int32 nPos; - if ((nPos = aSnippet.indexOf(0x2006)) > -1) - { - const sal_Unicode aExtraSpace[5] = { 0x2006, 0x20, 0x2006, 0x20, 0 }; - const sal_Unicode aExtraSpace2[4] = { 0x20, 0x2006, 0x20, 0 }; - OUString sDoubleSpace(" "); - aSnippet = aSnippet.replaceAll(aExtraSpace, sDoubleSpace, nPos) - .replaceAll(aExtraSpace2, sDoubleSpace); - } - m_rExport.m_aCurrentCharPropStarts.push( nCurrentPos ); const SfxPoolItem &rItem = GetItem(RES_CHRATR_CASEMAP); |