summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-06-20 21:08:01 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-06-21 09:05:53 +0200
commitfa827a8beb7e590baf8eb39d3568bb81bcc925f3 (patch)
treee98888f4b7d4dea48d2a6e255aae639883a1b39e
parent8729c98bbe6843e875be3903c2e5a7783984ae48 (diff)
sw btlr writing mode: implement TextFrame tbrl export to drawingML
Also remove the checkFrameBtlr() call in DocxSdrExport::writeOnlyTextOfFrame(), which was added in commit 1c876f5616522ab695de8c0316cdb0c601081815 (fdo#78590: Fix for Corruption of para with framePr & drawing object into para, 2014-06-13), but that looks like a copy&paste error, given that the old-style DOCX frames can't have a custom writing direction, it seems. Change-Id: I0940bbbf3adadd1fc480f3d754b4c8854a9c56b4 Reviewed-on: https://gerrit.libreoffice.org/74466 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tbrl-frame-vml.docx (renamed from sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx)bin22756 -> 22756 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport13.cxx25
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx11
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx6
4 files changed, 29 insertions, 13 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx b/sw/qa/extras/ooxmlexport/data/tbrl-frame-vml.docx
index c697e5846ce6..c697e5846ce6 100644
--- a/sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx
+++ b/sw/qa/extras/ooxmlexport/data/tbrl-frame-vml.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index c754acafc9ed..408590660b82 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -341,6 +341,31 @@ DECLARE_OOXMLIMPORT_TEST(testTdf121784, "tdf121784.docx")
CPPUNIT_ASSERT_EQUAL( OUString( "i" ), getRun( getParagraph( 2 ), 3 )->getString());
}
+DECLARE_OOXMLEXPORT_TEST(testTbrlFrameVml, "tbrl-frame-vml.docx")
+{
+ uno::Reference<beans::XPropertySet> xTextFrame(getShape(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xTextFrame.is());
+
+ if (mbExported)
+ {
+ // DML import: creates a TextBox.
+
+ comphelper::SequenceAsHashMap aGeometry(xTextFrame->getPropertyValue("CustomShapeGeometry"));
+ // Without the accompanying fix in place, this test would have failed with 'Expected: -90;
+ // Actual: 0', i.e. the tblr writing mode was lost during DML export of a TextFrame.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-90), aGeometry["TextPreRotateAngle"].get<sal_Int32>());
+ }
+ else
+ {
+ // VML import: creates a TextFrame.
+
+ auto nActual = getProperty<sal_Int16>(xTextFrame, "WritingMode");
+ // Without the accompanying fix in place, this test would have failed with 'Expected: 2; Actual:
+ // 4', i.e. writing direction was inherited from page, instead of explicit tbrl.
+ CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, nActual);
+ }
+}
+
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf125657, "tdf125657.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 80967be606d7..1f1e03043d3c 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -256,17 +256,6 @@ DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx")
CPPUNIT_ASSERT_EQUAL(OUString("1695"), aTop);
}
-DECLARE_OOXMLIMPORT_TEST(testTbrlFrameVml, "tbrl-frame-vml.docx")
-{
- uno::Reference<beans::XPropertySet> xTextFrame(getShape(1), uno::UNO_QUERY);
- CPPUNIT_ASSERT(xTextFrame.is());
-
- auto nActual = getProperty<sal_Int16>(xTextFrame, "WritingMode");
- // Without the accompanying fix in place, this test would have failed with 'Expected: 2; Actual:
- // 4', i.e. writing direction was inherited from page, instead of explicit tbrl.
- CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, nActual);
-}
-
DECLARE_OOXMLIMPORT_TEST(testTdf121804, "tdf121804.docx")
{
uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index eee4bd1cc0fb..507dc6b4646f 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -1146,8 +1146,6 @@ void DocxSdrExport::writeOnlyTextOfFrame(ww8::Frame const* pParentFrame)
ExportDataSaveRestore aDataGuard(m_pImpl->getExport(), nStt, nEnd, pParentFrame);
m_pImpl->setBodyPrAttrList(sax_fastparser::FastSerializerHelper::createAttrList());
- m_pImpl->setFrameBtLr(
- m_pImpl->checkFrameBtlr(m_pImpl->getExport().m_pDoc->GetNodes()[nStt], /*bDML=*/true));
m_pImpl->setFlyFrameGraphic(true);
m_pImpl->getExport().WriteText();
m_pImpl->setFlyFrameGraphic(false);
@@ -1404,6 +1402,10 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
pFS->startElementNS(XML_w, XML_txbxContent);
+ const SvxFrameDirectionItem& rDirection = rFrameFormat.GetFrameDir();
+ if (rDirection.GetValue() == SvxFrameDirection::Vertical_RL_TB)
+ m_pImpl->getBodyPrAttrList()->add(XML_vert, "vert");
+
m_pImpl->setFrameBtLr(
m_pImpl->checkFrameBtlr(m_pImpl->getExport().m_pDoc->GetNodes()[nStt], /*bDML=*/true));
m_pImpl->setFlyFrameGraphic(true);