[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Fri Aug 23 07:19:40 UTC 2019
sw/qa/extras/rtfexport/data/tbrl-page.rtf | 3 ++
sw/qa/extras/rtfexport/rtfexport4.cxx | 12 ++++++++
sw/source/filter/ww8/rtfattributeoutput.cxx | 33 +++++++++++++++---------
writerfilter/source/rtftok/rtfdispatchvalue.cxx | 20 ++++++++++++++
4 files changed, 56 insertions(+), 12 deletions(-)
New commits:
commit 1aed241deb816b2a6b9f3f97978443939f61d076
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Aug 23 08:34:29 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Aug 23 09:18:50 2019 +0200
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 at collabora.com>
Tested-by: Jenkins
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)
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index fa6bcc46f024..3b7434228ab7 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -1655,6 +1655,26 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
outputSettingsTable();
break;
}
+ case RTF_STEXTFLOW:
+ {
+ nId = 0;
+ switch (nParam)
+ {
+ case 0:
+ nId = NS_ooxml::LN_Value_ST_TextDirection_lrTb;
+ break;
+ case 1:
+ nId = NS_ooxml::LN_Value_ST_TextDirection_tbRl;
+ break;
+ }
+
+ if (nId > 0)
+ {
+ m_aStates.top().getSectionSprms().set(NS_ooxml::LN_EG_SectPrContents_textDirection,
+ new RTFValue(nId));
+ }
+ }
+ break;
default:
{
SAL_INFO("writerfilter", "TODO handle value '" << keywordToString(nKeyword) << "'");
More information about the Libreoffice-commits
mailing list