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

DOCX import: fix <w:tblW w:type="auto"/> handling when cells have fixed widths

Commit 74c5ed19 (DOCX import fix for
table with auto size, 2013-06-26) correctly recognized that in case the
width type is auto, that doesn't always mean text::SizeType::VARIABLE.

However, when the size is fixed, then we should simply not do anything,
and that'll lead to the right behavior (by setting the column separators
on each row), don't try to be smart and try to set
TablePropertyMap::TABLE_WIDTH here.

Change-Id: I997b88e5fa34bbabe7c6940879c81a1d62d69043
üst f355bad3
......@@ -1393,6 +1393,15 @@ DECLARE_OOXMLIMPORT_TEST(testTableAutoColumnFixedSize, "table-auto-column-fixed-
CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(3996)), getProperty<sal_Int32>(xTextTable, "Width"));
}
DECLARE_OOXMLIMPORT_TEST(testTableAutoColumnFixedSize2, "table-auto-column-fixed-size2.docx")
{
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
// This was 17907, i.e. the sum of the width of the 3 cells (10152 twips each), which is too wide.
CPPUNIT_ASSERT_EQUAL(sal_Int32(16891), getProperty<sal_Int32>(xTextTable, "Width"));
}
DECLARE_OOXMLIMPORT_TEST(testFdo46361, "fdo46361.docx")
{
uno::Reference<container::XIndexAccess> xGroupShape(getShape(1), uno::UNO_QUERY);
......
......@@ -202,16 +202,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
}
// Check whether the total width of given row is compared with the maximum value of rows (m_nMaxFixedWidth).
if (bFixed )
{
// Check if total width
if (m_nMaxFixedWidth < nRowFixedWidth)
m_nMaxFixedWidth = nRowFixedWidth;
pPropMap->setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::FIX );
pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nMaxFixedWidth );
}
else
if (!bFixed)
{
// Set the width type of table with 'Auto' and set the width value to 100(%)
pPropMap->setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE );
......
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