diff options
author | Mark Hung <marklh9@gmail.com> | 2019-12-28 10:01:20 +0800 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-01-17 17:17:13 +0100 |
commit | bc47eabad3f593aedd71307334fa50b222604bdd (patch) | |
tree | 43213d8e06164312f0e0761f04af035d239a6d65 /sw | |
parent | c212cf92c59946e1431e38396ac0e78fef3f23d8 (diff) |
tdf#129655 Sync TextWritingMode to frame direction.
Sync the text writing mode of a shape to the frame
direction of the attached text box ( a text frame ).
Change-Id: Ied9ff1a1d0f53d7ef78a83a086af0a2c1ca5eb36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86638
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Signed-off-by: xisco <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86961
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data2/tdf129655-vtextbox.odt | bin | 0 -> 9958 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/doc/textboxhelper.cxx | 10 |
3 files changed, 16 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data2/tdf129655-vtextbox.odt b/sw/qa/extras/uiwriter/data2/tdf129655-vtextbox.odt Binary files differnew file mode 100644 index 000000000000..8d668400c386 --- /dev/null +++ b/sw/qa/extras/uiwriter/data2/tdf129655-vtextbox.odt diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 79601dfddcd5..921c7dcd1468 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -2421,4 +2421,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testOfz18563) TestImportDOCX(aFileStream); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf129655) +{ + createDoc("tdf129655-vtextbox.odt"); + xmlDocPtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "//fly/txt[@WritingMode='Vertical']", 1); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 3c4e63a12b2f..37939224daf6 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/text/WrapTextMode.hpp> #include <com/sun/star/text/XTextDocument.hpp> #include <com/sun/star/table/BorderLine2.hpp> +#include <com/sun/star/text/WritingMode.hpp> #include <com/sun/star/text/WritingMode2.hpp> using namespace com::sun::star; @@ -124,6 +125,9 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape) xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT)); syncProperty(pShape, RES_TEXT_VERT_ADJUST, 0, xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_VERT_ADJUST)); + text::WritingMode eMode; + if (xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_WRITINGMODE) >>= eMode) + syncProperty(pShape, RES_FRAMEDIR, 0, uno::makeAny(sal_Int16(eMode))); } void SwTextBoxHelper::destroy(SwFrameFormat* pShape) @@ -386,6 +390,12 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, const OUString& rPrope syncProperty(pShape, RES_BOX, TOP_BORDER_DISTANCE, rValue); else if (rPropertyName == UNO_NAME_TEXT_LOWERDIST) syncProperty(pShape, RES_BOX, BOTTOM_BORDER_DISTANCE, rValue); + else if (rPropertyName == UNO_NAME_TEXT_WRITINGMODE) + { + text::WritingMode eMode; + if (rValue >>= eMode) + syncProperty(pShape, RES_FRAMEDIR, 0, uno::makeAny(sal_Int16(eMode))); + } } void SwTextBoxHelper::getProperty(SwFrameFormat const* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, |