[Libreoffice-commits] core.git: sw/qa writerfilter/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 6 07:06:51 UTC 2019
sw/qa/extras/rtfexport/data/tdf126309.rtf | 8 ++++++++
sw/qa/extras/rtfexport/rtfexport4.cxx | 9 +++++++++
writerfilter/source/dmapper/DomainMapper.cxx | 5 ++++-
3 files changed, 21 insertions(+), 1 deletion(-)
New commits:
commit 600025475630c59c53a9086ba6d95124416725b3
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Aug 5 21:48:24 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Aug 6 09:06:01 2019 +0200
tdf#126309 RTF import: fix not needed para adjust swap for bidi text
Regression from commit 4ee2a882dddb395a816cd54004b634d57cfb2446
(tdf#86182 RTF import: fix handling of \rtlpar, 2015-04-17), now that we
don't ignore \rtlpar, it turned out that dmapper should not do paragraph
alignment left/right swapping for RTF.
It seems this is needed for DOCX, but not for legacy DOC/RTF.
See how SwWW8ImplReader::Read_Justify() doesn't do this, either, so this
is one of those rare cases when dmapper has to know if the token stream
is generated by the DOCX or the RTF tokenizers.
Change-Id: Ibd52e3dc9e782e1d985418085b82b2e2628bc1dd
Reviewed-on: https://gerrit.libreoffice.org/76995
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/sw/qa/extras/rtfexport/data/tdf126309.rtf b/sw/qa/extras/rtfexport/data/tdf126309.rtf
new file mode 100644
index 000000000000..513061e49875
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf126309.rtf
@@ -0,0 +1,8 @@
+{\rtf1
+\pard\plain \rtlpar
+\s33\qr \li0\ri0\sb240\keepn\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid14905282 \rtlch\fcs1 \ab\af0\afs20\alang1025 \ltrch\fcs0 \b\fs20\lang1031\langfe1033\loch\af1\hich\af1\dbch\af13\cgrid\langnp1031\langfenp1033
+{
+\ltrch\fcs1 \alang1037 \rtlch\fcs0 \f1\fs20\lang1037\langnp1037\langfenp1037\insrsid7674863 1}
+{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe1033\langnp1033\insrsid7674863\charrsid14905282
+\par }
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx
index 253c3b3b4735..1a261892661e 100644
--- a/sw/qa/extras/rtfexport/rtfexport4.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport4.cxx
@@ -180,6 +180,15 @@ DECLARE_RTFIMPORT_TEST(testPageBorder, "page-border.rtf")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(71), aRightBorder.LineWidth);
}
+DECLARE_RTFIMPORT_TEST(testTdf126309, "tdf126309.rtf")
+{
+ // Without the accompanying fix in place, this test would have failed, as
+ // the paragraph was aligned to left, not right.
+ CPPUNIT_ASSERT_EQUAL(
+ style::ParagraphAdjust_RIGHT,
+ static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust")));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index bc5a5e5d1489..c7c57a7682ad 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1208,8 +1208,11 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
switch(nSprmId)
{
case NS_ooxml::LN_CT_PPrBase_jc:
- handleParaJustification(nIntValue, rContext, ExchangeLeftRight( rContext, *m_pImpl ));
+ {
+ bool bExchangeLeftRight = !IsRTFImport() && ExchangeLeftRight(rContext, *m_pImpl);
+ handleParaJustification(nIntValue, rContext, bExchangeLeftRight);
break;
+ }
case NS_ooxml::LN_CT_PPrBase_keepLines:
rContext->Insert(PROP_PARA_SPLIT, uno::makeAny(nIntValue == 0));
break;
More information about the Libreoffice-commits
mailing list