diff options
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/table-btlr-center.docx | bin | 0 -> 10686 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 9 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 17 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableManager.cxx | 7 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.cxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.hxx | 1 |
6 files changed, 35 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/table-btlr-center.docx b/sw/qa/extras/ooxmlimport/data/table-btlr-center.docx Binary files differnew file mode 100644 index 000000000000..79cb53eed06d --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/table-btlr-center.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index b2097558e326..6562b974d6ff 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2221,6 +2221,15 @@ DECLARE_OOXMLIMPORT_TEST(testFootnote, "footnote.docx") CPPUNIT_ASSERT(aFootnote.endsWith("bar")); } +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 16b367cceda7..8243bf62fcc1 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_DOMAINMAPPER dmapper_logger->endElement(); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 7502a84b0ec0..d776561026c3 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -328,6 +328,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 66e1773e6e0d..e5b9918adfb1 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 4106e32e5ee7..f1543befba4f 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 |