From 0013f21ecd918e0541f165c3526a58f42dd75481 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 11 Apr 2019 21:37:16 +0200 Subject: tdf#124344 sw btlr writing mode, DOCX import: fix vertical alignment The hack added in commit 3325e0f206ce864730468c3556ce06760042c157 (bnc#865381 DOCX import: handle w:jc=center inside w:textDirection=btLr, 2014-07-02) is no longer needed, actually just reverting it fixes the problem, as then layout does the right thing. No need to center paragraph adjustment to any kind of vertical orientation, now that we have proper layout support. Change-Id: I6aa74f5289a014c148fbd7c7ab03ec885d931daf Reviewed-on: https://gerrit.libreoffice.org/70610 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 12 ++++++++++-- .../source/dmapper/DomainMapperTableHandler.cxx | 17 ----------------- .../source/dmapper/DomainMapperTableManager.cxx | 7 ------- writerfilter/source/dmapper/PropertyIds.cxx | 1 - writerfilter/source/dmapper/PropertyIds.hxx | 1 - 5 files changed, 10 insertions(+), 28 deletions(-) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index 768ab16c8a48..dbe64afdc1dd 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -694,11 +694,19 @@ DECLARE_OOXMLEXPORT_TEST(testFootnote, "footnote.docx") DECLARE_OOXMLEXPORT_TEST(testTableBtlrCenter, "table-btlr-center.docx") { + // Note that this is btLr text, so layout and doc model horizontal/vertical is the opposite of + // each other. uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference xTable(xTables->getByIndex(0), uno::UNO_QUERY); - // Cell vertical alignment was NONE, should be CENTER. - CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getProperty(xTable->getCellByName("A2"), "VertOrient")); + uno::Reference xCell = xTable->getCellByName("A2"); + // Cell vertical alignment was CENTER, should be NONE. + CPPUNIT_ASSERT_EQUAL(text::VertOrientation::NONE, getProperty(xCell, "VertOrient")); + + // Cell horizontal alignment should be CENTER. + uno::Reference xCellText(xCell, uno::UNO_QUERY); + auto nActual = getProperty(getParagraphOfText(1, xCellText), "ParaAdjust"); + CPPUNIT_ASSERT_EQUAL(static_cast(style::ParagraphAdjust_CENTER), nActual); } DECLARE_OOXMLEXPORT_TEST(testFdo80555, "fdo80555.docx") diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 15a7c558820a..6d4e4c86537b 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -29,9 +29,7 @@ #include #include #include -#include #include -#include #include "TablePositionHandler.hxx" #include "ConversionHelper.hxx" #include "util.hxx" @@ -848,21 +846,6 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl } (*aCellIterator)->Erase(PROP_HORIZONTAL_MERGE); } - - // Cell direction is not an UNO Property, either. - const boost::optional aCellDirectionVal = (*aCellIterator)->getProperty(PROP_CELL_DIRECTION); - if (aCellDirectionVal) - { - if (aCellDirectionVal->second.get() == static_cast(NS_ooxml::LN_Value_ST_TextDirection_btLr)) - { - // btLr, so map ParagraphAdjust_CENTER to VertOrientation::CENTER. - uno::Reference xPropertySet(m_aTableRanges[nRow][nCell][0], uno::UNO_QUERY); - if (xPropertySet.is() && xPropertySet->getPropertyValue("ParaAdjust").get() == sal_Int16(style::ParagraphAdjust_CENTER)) - (*aCellIterator)->Insert(PROP_VERT_ORIENT, uno::makeAny(text::VertOrientation::CENTER)); - } - (*aCellIterator)->Erase(PROP_CELL_DIRECTION); - } - pSingleCellProperties[nCell] = (*aCellIterator)->GetPropertyValues(); #ifdef DBG_UTIL TagLogger::getInstance().endElement(); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index df7db6e93f26..2c33628615be 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -279,13 +279,6 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) case NS_ooxml::LN_CT_TcPrBase_textDirection: { TablePropertyMapPtr pPropMap( new TablePropertyMap ); - - // Remember the cell direction, so later in - // DomainMapperTableHandler::endTableGetCellProperties() can we - // handle the combination of the cell direction and paragraph - // alignment as necessary. - pPropMap->Insert(PROP_CELL_DIRECTION, uno::Any(nIntValue)); - bool bInsertCellProps = true; switch ( nIntValue ) { diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index d47fec1613d0..e51062541d47 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -333,7 +333,6 @@ OUString getPropertyName( PropertyIds eId ) case PROP_CELL_INTEROP_GRAB_BAG : sName = "CellInteropGrabBag"; break; case PROP_TABLE_INTEROP_GRAB_BAG : sName = "TableInteropGrabBag"; break; case PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING : sName = "ApplyParagraphMarkFormatToNumbering"; break; - case PROP_CELL_DIRECTION: sName = "CellDirection"; break; case PROP_SDT_END_BEFORE: sName = "SdtEndBefore"; break; case PROP_PARA_SDT_END_BEFORE: sName = "ParaSdtEndBefore"; break; case META_PROP_TABLE_LOOK: sName = "TableStyleLook"; break; diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index f8047b0aa76c..331a978d0d42 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -331,7 +331,6 @@ enum PropertyIds ,PROP_TABLE_INTEROP_GRAB_BAG ,PROP_INDEX_ENTRY_TYPE ,PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING - ,PROP_CELL_DIRECTION ,PROP_SDT_END_BEFORE ,PROP_PARA_SDT_END_BEFORE ,META_PROP_TABLE_LOOK -- cgit v1.2.3