[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jun 21 07:07:10 UTC 2019
sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 25 +++++++++++++++++++++++++
sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 11 -----------
sw/source/filter/ww8/docxsdrexport.cxx | 6 ++++--
3 files changed, 29 insertions(+), 13 deletions(-)
New commits:
commit fa827a8beb7e590baf8eb39d3568bb81bcc925f3
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Jun 20 21:08:01 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jun 21 09:05:53 2019 +0200
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 at collabora.com>
diff --git a/sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx b/sw/qa/extras/ooxmlexport/data/tbrl-frame-vml.docx
similarity index 100%
rename from sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx
rename to sw/qa/extras/ooxmlexport/data/tbrl-frame-vml.docx
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);
More information about the Libreoffice-commits
mailing list