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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 2 06:46:36 UTC 2019


 sw/qa/extras/rtfexport/data/tbrl-frame.odt  |binary
 sw/qa/extras/rtfexport/rtfexport4.cxx       |   11 +++++++++++
 sw/source/filter/ww8/rtfattributeoutput.cxx |   10 ++++++++++
 writerfilter/source/rtftok/rtfsdrimport.cxx |    9 +++++++--
 4 files changed, 28 insertions(+), 2 deletions(-)

New commits:
commit 8f36d40426fa83bf7923a818377cc50048199dfd
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Aug 1 19:28:07 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Aug 2 08:45:48 2019 +0200

    sw btlr writing mode: RTF filter of Writer tbrl textframes
    
    Fix both import and export. Values 1 and 3 seems to be the same. Accept
    both on import, but write 3, as DOCX only has a single value and Word
    uses 3 when doing DOCX->RTF conversion.
    
    Change-Id: Ic5420091ffee9eb20c6aaac61a127e93289aa9fe
    Reviewed-on: https://gerrit.libreoffice.org/76823
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/rtfexport/data/tbrl-frame.odt b/sw/qa/extras/rtfexport/data/tbrl-frame.odt
new file mode 100644
index 000000000000..3cc79deb66e5
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/tbrl-frame.odt differ
diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx
index 6b75eda278fd..59ce2b0b3bb5 100644
--- a/sw/qa/extras/rtfexport/rtfexport4.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport4.cxx
@@ -152,6 +152,17 @@ DECLARE_RTFEXPORT_TEST(testBtlrCell, "btlr-cell.rtf")
     CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, getProperty<sal_Int16>(xC1, "WritingMode"));
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTbrlFrame, "tbrl-frame.odt")
+{
+    uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
+    auto nActual = getProperty<sal_Int16>(xShape, "WritingMode");
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 2
+    // - Actual  : 0
+    // i.e. custom wrting mode was lost.
+    CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, nActual);
+}
+
 DECLARE_RTFIMPORT_TEST(testPageBorder, "page-border.rtf")
 {
     uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"),
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index b7a6141f60a7..81875b744fb1 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3524,6 +3524,16 @@ void RtfAttributeOutput::FormatLineNumbering(const SwFormatLineNumber& rNumberin
 
 void RtfAttributeOutput::FormatFrameDirection(const SvxFrameDirectionItem& rDirection)
 {
+    if (m_rExport.GetRTFFlySyntax())
+    {
+        if (rDirection.GetValue() == SvxFrameDirection::Vertical_RL_TB)
+        {
+            // Top to bottom non-ASCII font
+            m_aFlyProperties.push_back(std::make_pair<OString, OString>("txflTextFlow", "3"));
+        }
+        return;
+    }
+
     if (!m_rExport.m_bOutPageDescs)
     {
         SvxFrameDirection nDir = rDirection.GetValue();
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index b9e227439f4b..a7a9efa32ff8 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -454,8 +454,13 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
             ; // Ignore: complementer of lineColor
         else if (rProperty.first == "txflTextFlow" && xPropertySet.is())
         {
-            if (rProperty.second.toInt32() == 1)
-                eWritingMode = text::WritingMode_TB_RL;
+            switch (rProperty.second.toInt32())
+            {
+                case 1: // Top to bottom ASCII font
+                case 3: // Top to bottom non-ASCII font
+                    eWritingMode = text::WritingMode_TB_RL;
+                    break;
+            }
         }
         else if (rProperty.first == "fLine" && xPropertySet.is())
             resolveFLine(xPropertySet, rProperty.second.toInt32());


More information about the Libreoffice-commits mailing list