diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-08-23 08:34:29 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-08-23 09:18:50 +0200 |
commit | 1aed241deb816b2a6b9f3f97978443939f61d076 (patch) | |
tree | 37df75437b6069294d0a503c26d3af6d8cab9a2c /sw | |
parent | 9d5b9bf881606e83a051cc192d08c4690f98a8ba (diff) |
RTF filter: handle tbrl section text direction
Makes no sense to support btlr, Word can't handle it. (UI is disabled.)
Change-Id: I036a1e98e8b1ac07e688eedf45b4a2c21c4a8859
Reviewed-on: https://gerrit.libreoffice.org/77986
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/rtfexport/data/tbrl-page.rtf | 3 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport4.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 33 |
3 files changed, 36 insertions, 12 deletions
diff --git a/sw/qa/extras/rtfexport/data/tbrl-page.rtf b/sw/qa/extras/rtfexport/data/tbrl-page.rtf new file mode 100644 index 000000000000..ecaa2b3e05ff --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tbrl-page.rtf @@ -0,0 +1,3 @@ +{\rtf1\sectd\stextflow1 +\pard\plain asdf\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index 6e4458efb600..bcac3b291cb7 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -224,6 +224,18 @@ DECLARE_RTFIMPORT_TEST(testPageBorder, "page-border.rtf") CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(71), aRightBorder.LineWidth); } +DECLARE_RTFEXPORT_TEST(testTbrlPage, "tbrl-page.rtf") +{ + uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); + auto nActual = getProperty<sal_Int16>(xPageStyle, "WritingMode"); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 2 + // - Actual : 0 + // i.e. custom writing mode was lost. + CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, nActual); +} + DECLARE_RTFIMPORT_TEST(testTdf126309, "tdf126309.rtf") { // Without the accompanying fix in place, this test would have failed, as diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index a073df08cb18..d8afcc351867 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3524,9 +3524,25 @@ void RtfAttributeOutput::FormatLineNumbering(const SwFormatLineNumber& rNumberin void RtfAttributeOutput::FormatFrameDirection(const SvxFrameDirectionItem& rDirection) { + SvxFrameDirection nDir = rDirection.GetValue(); + if (nDir == SvxFrameDirection::Environment) + nDir = GetExport().GetDefaultFrameDirection(); + + if (m_rExport.m_bOutPageDescs) + { + if (nDir == SvxFrameDirection::Vertical_RL_TB) + { + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_STEXTFLOW); + m_aSectionBreaks.append(static_cast<sal_Int32>(1)); + if (!m_bBufferSectionBreaks) + m_rExport.Strm().WriteCharPtr(m_aSectionBreaks.makeStringAndClear().getStr()); + } + return; + } + if (m_rExport.GetRTFFlySyntax()) { - if (rDirection.GetValue() == SvxFrameDirection::Vertical_RL_TB) + if (nDir == SvxFrameDirection::Vertical_RL_TB) { // Top to bottom non-ASCII font m_aFlyProperties.push_back(std::make_pair<OString, OString>("txflTextFlow", "3")); @@ -3539,17 +3555,10 @@ void RtfAttributeOutput::FormatFrameDirection(const SvxFrameDirectionItem& rDire return; } - if (!m_rExport.m_bOutPageDescs) - { - SvxFrameDirection nDir = rDirection.GetValue(); - if (nDir == SvxFrameDirection::Environment) - nDir = GetExport().GetDefaultFrameDirection(); - - if (nDir == SvxFrameDirection::Horizontal_RL_TB) - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_RTLPAR); - else - m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LTRPAR); - } + if (nDir == SvxFrameDirection::Horizontal_RL_TB) + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_RTLPAR); + else + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LTRPAR); } void RtfAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem) |