diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-07-02 17:33:03 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-07-03 10:27:26 +0200 |
commit | 6e20fc2414a625f9f2419af6bbba46bccd93d2b1 (patch) | |
tree | 1c47a17b7c0a52b1a14bcc015704d1443da02e78 /writerfilter | |
parent | d4088f84a9617f886173fddf4a3426345ce1704b (diff) |
bnc#865381 DOCX import: handle w:jc=center inside w:textDirection=btLr
Change-Id: I102c70429457515b34e74cb8e82e1417e6276d1d
(cherry picked from commit 3325e0f206ce864730468c3556ce06760042c157)
Diffstat (limited to 'writerfilter')
4 files changed, 26 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 0827cc919968..7b8d9cd9a42d 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> #ifdef DEBUG_DMAPPER_TABLE_HANDLER @@ -715,6 +717,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 764a0650f3a6..6a95be382ec2 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -324,6 +324,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 bacbcd3bc8e4..d693ddbe475d 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -346,6 +346,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_FOOTNOTE_LINE_RELATIVE_WIDTH: sName = "FootnoteLineRelativeWidth"; break; case PROP_HORIZONTAL_MERGE: sName = "HorizontalMerge"; 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 a4e362166e6b..1f6317985588 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -317,6 +317,7 @@ enum PropertyIds ,PROP_PARA_BOTTOM_MARGIN_AFTER_AUTO_SPACING ,PROP_HORIZONTAL_MERGE ,PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING + ,PROP_CELL_DIRECTION }; struct PropertyNameSupplier_Impl; class PropertyNameSupplier |