[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 6 10:48:45 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 8fad7ee194b8f049ea845bdf9654060111b4e841
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Aug 5 21:48:24 2019 +0200
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Tue Aug 6 12:47:59 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.
    
    (cherry picked from commit 600025475630c59c53a9086ba6d95124416725b3)
    
    Conflicts:
            sw/qa/extras/rtfexport/rtfexport4.cxx
    
    Change-Id: Ibd52e3dc9e782e1d985418085b82b2e2628bc1dd
    Reviewed-on: https://gerrit.libreoffice.org/77004
    Tested-by: Xisco Faulí <xiscofauli at libreoffice.org>
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

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 f26f558267b2..65b1ffbdce9a 100644
--- a/sw/qa/extras/rtfexport/rtfexport4.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport4.cxx
@@ -129,6 +129,15 @@ DECLARE_RTFEXPORT_TEST(testBtlrCell, "btlr-cell.rtf")
     CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, getProperty<sal_Int16>(xC1, "WritingMode"));
 }
 
+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 195e360a671d..47bd773cec2b 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1209,8 +1209,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