Kaydet (Commit) 3325e0f2 authored tarafından Miklos Vajna's avatar Miklos Vajna

bnc#865381 DOCX import: handle w:jc=center inside w:textDirection=btLr

Change-Id: I102c70429457515b34e74cb8e82e1417e6276d1d
üst ffef410b
...@@ -2221,6 +2221,15 @@ DECLARE_OOXMLIMPORT_TEST(testFootnote, "footnote.docx") ...@@ -2221,6 +2221,15 @@ DECLARE_OOXMLIMPORT_TEST(testFootnote, "footnote.docx")
CPPUNIT_ASSERT(aFootnote.endsWith("bar")); 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 #endif
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <com/sun/star/text/HoriOrientation.hpp> #include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/RelOrientation.hpp> #include <com/sun/star/text/RelOrientation.hpp>
#include <com/sun/star/text/SizeType.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 <dmapperLoggers.hxx>
#include <TablePositionHandler.hxx> #include <TablePositionHandler.hxx>
...@@ -826,6 +828,21 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl ...@@ -826,6 +828,21 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl
} }
aCellIterator->get()->erase(PROP_HORIZONTAL_MERGE); 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(); pSingleCellProperties[nCell] = aCellIterator->get()->GetPropertyValues();
#ifdef DEBUG_DOMAINMAPPER #ifdef DEBUG_DOMAINMAPPER
dmapper_logger->endElement(); dmapper_logger->endElement();
......
...@@ -328,6 +328,13 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) ...@@ -328,6 +328,13 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
case NS_ooxml::LN_CT_TcPrBase_textDirection: case NS_ooxml::LN_CT_TcPrBase_textDirection:
{ {
TablePropertyMapPtr pPropMap( new TablePropertyMap ); 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; bool bInsertCellProps = true;
switch ( nIntValue ) switch ( nIntValue )
{ {
......
...@@ -392,6 +392,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const ...@@ -392,6 +392,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const
case PROP_CELL_INTEROP_GRAB_BAG : sName = "CellInteropGrabBag"; break; case PROP_CELL_INTEROP_GRAB_BAG : sName = "CellInteropGrabBag"; break;
case PROP_TABLE_INTEROP_GRAB_BAG : sName = "TableInteropGrabBag"; break; case PROP_TABLE_INTEROP_GRAB_BAG : sName = "TableInteropGrabBag"; break;
case PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING : sName = "ApplyParagraphMarkFormatToNumbering"; 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 = ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt =
m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName )); m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName ));
......
...@@ -364,6 +364,7 @@ enum PropertyIds ...@@ -364,6 +364,7 @@ enum PropertyIds
,PROP_TABLE_INTEROP_GRAB_BAG ,PROP_TABLE_INTEROP_GRAB_BAG
,PROP_INDEX_ENTRY_TYPE ,PROP_INDEX_ENTRY_TYPE
,PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING ,PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING
,PROP_CELL_DIRECTION
}; };
struct PropertyNameSupplier_Impl; struct PropertyNameSupplier_Impl;
class PropertyNameSupplier class PropertyNameSupplier
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment