sw/qa/extras/rtfexport/data/btlr-frame.odt |binary sw/qa/extras/rtfexport/rtfexport3.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 424984afa82c090e974e3e87d94589079545284b Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Aug 14 23:01:07 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Aug 15 15:28:56 2019 +0200 sw btlr writing mode: RTF filter of Writer textframes Both import and export needed fixing. (cherry picked from commit be92468ae3595d4384510a9cc0e15629c7cb0692) Conflicts: sw/qa/extras/rtfexport/rtfexport4.cxx Change-Id: Ie1728c3e67d8637e3720748d7f61a69c058eafe3 Reviewed-on: https://gerrit.libreoffice.org/77506 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@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/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index 12b1e84d77c6..1f282f79ac85 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -266,6 +266,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); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 24be7b8904af..266b63ad57d4 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3491,6 +3491,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 35addd606640..7cfd76f21a14 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> @@ -366,7 +367,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, oGroupTop, oGroupRight, oGroupBottom; boost::optional<sal_Int32> oRelLeft, oRelTop, oRelRight, oRelBottom; @@ -450,7 +451,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; } } @@ -857,10 +861,11 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap resolveDhgt(xPropertySet, *rShape.oZ, 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) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits