bnc#865381 DOCX import: fix w:trHeight for cells with btLr text direction
Also extend testcase: I made sure that the new version fails without
this fix and without the fix from
48b5b7641d
as well.
Change-Id: If33aa6d33cdc287620c12b84ad3f50279568bc8d
This commit is contained in:
@@ -1106,8 +1106,10 @@ DECLARE_OOXMLIMPORT_TEST(testBnc865381, "bnc865381.docx")
|
||||
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
||||
uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
|
||||
uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
|
||||
// Second row has a vertically merged cell, make sure size type is MIN in that case (otherwise B2 is not readable).
|
||||
CPPUNIT_ASSERT_EQUAL(text::SizeType::MIN, getProperty<sal_Int16>(xTableRows->getByIndex(1), "SizeType"));
|
||||
// Second row has a vertically merged cell, make sure size type is not FIX in that case (otherwise B2 is not readable).
|
||||
CPPUNIT_ASSERT(text::SizeType::FIX != getProperty<sal_Int16>(xTableRows->getByIndex(1), "SizeType"));
|
||||
// Explicit size of 41 mm100 was set, so the vertical text in A2 was not readable.
|
||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xTableRows->getByIndex(1), "Height"));
|
||||
}
|
||||
|
||||
DECLARE_OOXMLIMPORT_TEST(testFdo53985, "fdo53985.docx")
|
||||
|
@@ -54,6 +54,7 @@ DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) :
|
||||
m_aTmpTableProperties(),
|
||||
m_bPushCurrentWidth(false),
|
||||
m_bRowSizeTypeInserted(false),
|
||||
m_bHasBtlrCell(false),
|
||||
m_bTableSizeTypeInserted(false),
|
||||
m_nLayoutType(0),
|
||||
m_nMaxFixedWidth(0),
|
||||
@@ -354,6 +355,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
|
||||
m_bRowSizeTypeInserted = true;
|
||||
insertRowProps(pRowPropMap);
|
||||
}
|
||||
m_bHasBtlrCell = true;
|
||||
}
|
||||
break;
|
||||
case 4: // lrTbV
|
||||
@@ -758,6 +760,7 @@ void DomainMapperTableManager::endOfRowAction()
|
||||
|
||||
m_nGridBefore = m_nGridAfter = 0;
|
||||
m_bRowSizeTypeInserted = false;
|
||||
m_bHasBtlrCell = false;
|
||||
m_bTableSizeTypeInserted = false;
|
||||
|
||||
#ifdef DEBUG_DOMAINMAPPER
|
||||
|
@@ -58,6 +58,8 @@ class DomainMapperTableManager : public DomainMapperTableManager_Base_t
|
||||
::std::vector< IntVectorPtr > m_aCellWidths;
|
||||
/// Remember if a cell already set this, then it should not be set at a row level.
|
||||
bool m_bRowSizeTypeInserted;
|
||||
/// At least one cell in the current row has the btLr text direction.
|
||||
bool m_bHasBtlrCell;
|
||||
/// Remember if table width was already set, when we lack a w:tblW, it should be set manually at the end.
|
||||
bool m_bTableSizeTypeInserted;
|
||||
/// Table layout algorithm, IOW if we should consider fixed column width or not.
|
||||
@@ -130,6 +132,11 @@ public:
|
||||
return m_bRowSizeTypeInserted;
|
||||
}
|
||||
|
||||
bool HasBtlrCell() const
|
||||
{
|
||||
return m_bHasBtlrCell;
|
||||
}
|
||||
|
||||
bool IsTableSizeTypeInserted() const
|
||||
{
|
||||
return m_bTableSizeTypeInserted;
|
||||
|
@@ -96,12 +96,16 @@ namespace dmapper {
|
||||
pProperties->resolve(*pMeasureHandler);
|
||||
TablePropertyMapPtr pPropMap( new TablePropertyMap );
|
||||
|
||||
// In case a cell already wanted fixed size, we should not overwrite it here.
|
||||
DomainMapperTableManager* pManager = dynamic_cast<DomainMapperTableManager*>(m_pTableManager);
|
||||
if (!pManager || !pManager->IsRowSizeTypeInserted())
|
||||
pPropMap->Insert( PROP_SIZE_TYPE, uno::makeAny( pMeasureHandler->GetRowHeightSizeType() ), false);
|
||||
// In case any of the cells has the btLr cell direction, then an explicit minimal size will just hide the whole row, don't do that.
|
||||
if (pMeasureHandler->GetRowHeightSizeType() != text::SizeType::MIN || !pManager->HasBtlrCell())
|
||||
{
|
||||
// In case a cell already wanted fixed size, we should not overwrite it here.
|
||||
if (!pManager || !pManager->IsRowSizeTypeInserted())
|
||||
pPropMap->Insert( PROP_SIZE_TYPE, uno::makeAny( pMeasureHandler->GetRowHeightSizeType() ), false);
|
||||
|
||||
pPropMap->Insert( PROP_HEIGHT, uno::makeAny(pMeasureHandler->getMeasureValue() ));
|
||||
pPropMap->Insert( PROP_HEIGHT, uno::makeAny(pMeasureHandler->getMeasureValue() ));
|
||||
}
|
||||
insertRowProps(pPropMap);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user