[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Thu Aug 15 06:38:43 UTC 2019
sw/qa/extras/rtfexport/data/btlr-frame.odt |binary
sw/qa/extras/rtfexport/rtfexport4.cxx | 11 +++++++++++
sw/source/filter/ww8/rtfattributeoutput.cxx | 5 +++++
writerfilter/source/rtftok/rtfsdrimport.cxx | 15 ++++++++++-----
4 files changed, 26 insertions(+), 5 deletions(-)
New commits:
commit be92468ae3595d4384510a9cc0e15629c7cb0692
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Aug 14 23:01:07 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Aug 15 08:37:35 2019 +0200
sw btlr writing mode: RTF filter of Writer textframes
Both import and export needed fixing.
Change-Id: Ie1728c3e67d8637e3720748d7f61a69c058eafe3
Reviewed-on: https://gerrit.libreoffice.org/77474
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/sw/qa/extras/rtfexport/data/btlr-frame.odt b/sw/qa/extras/rtfexport/data/btlr-frame.odt
new file mode 100644
index 000000000000..31cb03849c53
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/btlr-frame.odt differ
diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx
index 7d0f98096ac1..6e4458efb600 100644
--- a/sw/qa/extras/rtfexport/rtfexport4.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport4.cxx
@@ -196,6 +196,17 @@ DECLARE_RTFEXPORT_TEST(testTbrlFrame, "tbrl-frame.odt")
CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, nActual);
}
+DECLARE_RTFEXPORT_TEST(testBtlrFrame, "btlr-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: 5
+ // - Actual : 0
+ // i.e. custom writing mode was lost.
+ CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, 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 81875b744fb1..85b775ad5bb1 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3531,6 +3531,11 @@ void RtfAttributeOutput::FormatFrameDirection(const SvxFrameDirectionItem& rDire
// Top to bottom non-ASCII font
m_aFlyProperties.push_back(std::make_pair<OString, OString>("txflTextFlow", "3"));
}
+ else if (rDirection.GetValue() == SvxFrameDirection::Vertical_LR_BT)
+ {
+ // Bottom to top non-ASCII font
+ m_aFlyProperties.push_back(std::make_pair<OString, OString>("txflTextFlow", "2"));
+ }
return;
}
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index a7a9efa32ff8..9a904e1058d7 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <com/sun/star/text/XTextRange.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -367,7 +368,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
uno::Any aLineColor = uno::makeAny(COL_BLACK);
// Default line width is 0.75 pt (26 mm100) in Word, 0 in Writer.
uno::Any aLineWidth = uno::makeAny(sal_Int32(26));
- text::WritingMode eWritingMode = text::WritingMode_LR_TB;
+ sal_Int16 eWritingMode = text::WritingMode2::LR_TB;
// Groupshape support
boost::optional<sal_Int32> oGroupLeft;
boost::optional<sal_Int32> oGroupTop;
@@ -458,7 +459,10 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
{
case 1: // Top to bottom ASCII font
case 3: // Top to bottom non-ASCII font
- eWritingMode = text::WritingMode_TB_RL;
+ eWritingMode = text::WritingMode2::TB_RL;
+ break;
+ case 2: // Bottom to top non-ASCII font
+ eWritingMode = text::WritingMode2::BT_LR;
break;
}
}
@@ -865,10 +869,11 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
resolveDhgt(xPropertySet, rShape.getZ(), bOldStyle);
}
if (m_bTextFrame)
- // Writer textframes implement text::WritingMode2, which is a different data type.
- xPropertySet->setPropertyValue("WritingMode", uno::makeAny(sal_Int16(eWritingMode)));
+ xPropertySet->setPropertyValue("WritingMode", uno::makeAny(eWritingMode));
else
- xPropertySet->setPropertyValue("TextWritingMode", uno::makeAny(eWritingMode));
+ // Only Writer textframes implement text::WritingMode2.
+ xPropertySet->setPropertyValue("TextWritingMode",
+ uno::makeAny(text::WritingMode(eWritingMode)));
}
if (!m_aParents.empty() && m_aParents.top().is() && !m_bTextFrame)
More information about the Libreoffice-commits
mailing list