sw/qa/extras/ooxmlimport/data/table-btlr-center.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 9 +++++++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 17 +++++++++++++++ writerfilter/source/dmapper/DomainMapperTableManager.cxx | 7 ++++++ writerfilter/source/dmapper/PropertyIds.cxx | 1 writerfilter/source/dmapper/PropertyIds.hxx | 1 6 files changed, 35 insertions(+)
New commits: commit c65aa400296a1a1b59b43223bdac030c749e51e3 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Jul 2 17:33:03 2014 +0200 bnc#865381 DOCX import: handle w:jc=center inside w:textDirection=btLr (cherry picked from commit 3325e0f206ce864730468c3556ce06760042c157) Reviewed-on: https://gerrit.libreoffice.org/10049 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: I102c70429457515b34e74cb8e82e1417e6276d1d Reviewed-on: https://gerrit.libreoffice.org/10046 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/qa/extras/ooxmlimport/data/table-btlr-center.docx b/sw/qa/extras/ooxmlimport/data/table-btlr-center.docx new file mode 100644 index 0000000..79cb53e Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/table-btlr-center.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index b55c64d..a0c09c9 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2193,6 +2193,15 @@ DECLARE_OOXMLIMPORT_TEST(testFdo80555, "fdo80555.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(245), xShape->getPosition().Y); } +DECLARE_OOXMLIMPORT_TEST(testTableBtlrCenter, "table-btlr-center.docx") +{ + uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + // Cell vertical alignment was NONE, should be CENTER. + CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getProperty<sal_Int16>(xTable->getCellByName("A2"), "VertOrient")); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 57bbd32..a8650a5 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -28,6 +28,8 @@ #include <com/sun/star/text/HoriOrientation.hpp> #include <com/sun/star/text/RelOrientation.hpp> #include <com/sun/star/text/SizeType.hpp> +#include <com/sun/star/text/VertOrientation.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> #include <dmapperLoggers.hxx> #include <TablePositionHandler.hxx> @@ -826,6 +828,21 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl } aCellIterator->get()->erase(PROP_HORIZONTAL_MERGE); } + + // Cell direction is not an UNO Property, either. + const PropertyMap::const_iterator aCellDirectionIter = aCellIterator->get()->find(PROP_CELL_DIRECTION); + if (aCellDirectionIter != aCellIterator->get()->end()) + { + if (aCellDirectionIter->second.getValue().get<sal_Int32>() == 3) + { + // btLr, so map ParagraphAdjust_CENTER to VertOrientation::CENTER. + uno::Reference<beans::XPropertySet> xPropertySet((*m_pTableSeq)[nRow][nCell][0], uno::UNO_QUERY); + if (xPropertySet->getPropertyValue("ParaAdjust").get<sal_Int16>() == style::ParagraphAdjust_CENTER) + aCellIterator->get()->Insert(PROP_VERT_ORIENT, uno::makeAny(text::VertOrientation::CENTER)); + } + aCellIterator->get()->erase(PROP_CELL_DIRECTION); + } + pSingleCellProperties[nCell] = aCellIterator->get()->GetPropertyValues(); #ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->endElement(); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 98fa11a..8eaeccc 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -330,6 +330,13 @@ 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(sal_Int32(3))); + bool bInsertCellProps = true; switch ( nIntValue ) { diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index 66e1773..e5b9918 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -392,6 +392,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const 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; } ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt = m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName )); diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index 4106e32..f1543be 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -364,6 +364,7 @@ enum PropertyIds ,PROP_TABLE_INTEROP_GRAB_BAG ,PROP_INDEX_ENTRY_TYPE ,PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING + ,PROP_CELL_DIRECTION }; struct PropertyNameSupplier_Impl; class PropertyNameSupplier
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits