sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 12 ++----- sw/source/filter/ww8/docxattributeoutput.cxx | 25 ++------------- writerfilter/source/dmapper/DomainMapperTableManager.cxx | 15 --------- 3 files changed, 9 insertions(+), 43 deletions(-)
New commits: commit 8fdbda18b593e7014e44a0fd590bbf98d83258b7 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Fri Feb 15 14:06:15 2019 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Feb 15 15:05:07 2019 +0100 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 <vmik...@collabora.com> Tested-by: Jenkins 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( ); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 5e0f322648be..20d6fb60b3a9 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -298,20 +298,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) SAL_INFO( "writerfilter", "Have inserted textDirection " << nIntValue ); break; case NS_ooxml::LN_Value_ST_TextDirection_btLr: - { - // We have to fake this text direction - pPropMap->Insert( PROP_FRM_DIRECTION, uno::makeAny( text::WritingMode2::LR_TB )); - pPropMap->Insert( PROP_CHAR_ROTATION, uno::makeAny( sal_Int16( 900 ) )); - SAL_INFO( "writerfilter", "Have inserted textDirection " << nIntValue ); - - // We're faking a text direction, so don't allow multiple lines. - if (!getCellProps() || !getCellProps()->isSet(PROP_VERTICAL_MERGE)) - { - // Though in case there will be a vertical merge, don't do this, it hides text that is supposed to be visible. - m_bRowSizeTypeInserted = true; - } - m_bHasBtlrCell = true; - } + pPropMap->Insert( PROP_FRM_DIRECTION, uno::makeAny( text::WritingMode2::BT_LR )); break; case NS_ooxml::LN_Value_ST_TextDirection_lrTbV: pPropMap->Insert( PROP_FRM_DIRECTION, uno::makeAny( text::WritingMode2::LR_TB )); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits