summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-02-15 14:06:15 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-02-15 15:05:07 +0100
commit8fdbda18b593e7014e44a0fd590bbf98d83258b7 (patch)
tree6f01a202ed9c6b09f0169ec20c7d85f940af143e /sw
parent3473e1df1fa3483bae68a3c01fdd1b18def99745 (diff)
sw btlr writing mode: implement DOCX filter
Replace the old trick with character-level rotation with the usage of the new writing direction. This means that finally table cells with btlr text direction and multiple paragraphs show all content, not only the first paragraph, as before (seen as data loss by users). Change-Id: I094f36fa6ba0701579e487e8e0212707987b1b2f Reviewed-on: https://gerrit.libreoffice.org/67870 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport8.cxx12
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx25
2 files changed, 8 insertions, 29 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index b42933eb3513..114f0a310570 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -775,9 +775,8 @@ DECLARE_OOXMLEXPORT_TEST(testTbLrHeight, "tblr-height.docx")
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
- uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
- // btLr text direction was imported as MIN, it should be FIX to avoid incorrectly large height in case of too much content.
- CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, getProperty<sal_Int16>(xTableRows->getByIndex(0), "SizeType"));
+ uno::Reference<table::XCell> xCell = xTable->getCellByName("B1");
+ CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, getProperty<sal_Int16>(xCell, "WritingMode"));
}
DECLARE_OOXMLEXPORT_TEST(testBnc865381, "bnc865381.docx")
@@ -785,11 +784,8 @@ DECLARE_OOXMLEXPORT_TEST(testBnc865381, "bnc865381.docx")
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
- uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
- // Second row has a vertically merged cell, make sure size type is not FIX in that case (otherwise B2 is not readable).
- CPPUNIT_ASSERT(text::SizeType::FIX != getProperty<sal_Int16>(xTableRows->getByIndex(1), "SizeType"));
- // Explicit size of 41 mm100 was set, so the vertical text in A2 was not readable.
- CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xTableRows->getByIndex(1), "Height"));
+ uno::Reference<table::XCell> xCell = xTextTable->getCellByName("A2");
+ CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, getProperty<sal_Int16>(xCell, "WritingMode"));
}
DECLARE_OOXMLEXPORT_TEST(testFdo53985, "fdo53985.docx")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4fbfef4aa374..8e3b4af3303d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4192,28 +4192,11 @@ void DocxAttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer
m_pSerializer->singleElementNS( XML_w, XML_textDirection,
FSNS( XML_w, XML_val ), "tbRl",
FSEND );
- else if ( SvxFrameDirection::Horizontal_LR_TB == m_rExport.TrueFrameDirection( *pFrameFormat ) )
+ else if ( SvxFrameDirection::Vertical_LR_BT == m_rExport.TrueFrameDirection( *pFrameFormat ) )
{
- // Undo the text direction mangling done by the btLr handler in writerfilter::dmapper::DomainMapperTableManager::sprm()
- const SwStartNode* pSttNd = pTabBox->GetSttNd();
- if (pSttNd)
- {
- SwPaM aPam(*pSttNd, 0);
- ++aPam.GetPoint()->nNode;
- if (aPam.GetPoint()->nNode.GetNode().IsTextNode())
- {
- const SwTextNode& rTextNode = static_cast<const SwTextNode&>(aPam.GetPoint()->nNode.GetNode());
- if( const SwAttrSet* pAttrSet = rTextNode.GetpSwAttrSet())
- {
- const SvxCharRotateItem& rCharRotate = pAttrSet->GetCharRotate();
- if (rCharRotate.GetValue() == 900)
- {
- m_pSerializer->singleElementNS( XML_w, XML_textDirection, FSNS( XML_w, XML_val ), "btLr", FSEND );
- m_bBtLr = true;
- }
- }
- }
- }
+ m_pSerializer->singleElementNS( XML_w, XML_textDirection,
+ FSNS( XML_w, XML_val ), "btLr",
+ FSEND );
}
const SwWriteTableRows& rRows = m_xTableWrt->GetRows( );