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

fdo#53985 DOCX import: don't try to set empty PageDescName

Regression from 50cb1667.

Change-Id: Ie04d5ad37555ed4cfeb34ccb8dc021675fbd25ea
üst 26ea7f4d
......@@ -117,6 +117,7 @@ public:
void testGroupshapeLine();
void testN779642();
void testTbLrHeight();
void testFdo53985();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
......@@ -185,6 +186,7 @@ void Test::run()
{"groupshape-line.docx", &Test::testGroupshapeLine},
{"n779642.docx", &Test::testN779642},
{"tblr-height.docx", &Test::testTbLrHeight},
{"fdo53985.docx", &Test::testFdo53985},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
......@@ -1196,6 +1198,15 @@ void Test::testTbLrHeight()
CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, getProperty<sal_Int16>(xTableRows->getByIndex(0), "SizeType"));
}
void Test::testFdo53985()
{
// Unhandled excetion prevented import of the rest of the document.
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xTables->getCount()); // Only 4 tables were imported.
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -840,7 +840,20 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
ApplyColumnProperties( xSection );
uno::Reference<beans::XPropertySet> xRangeProperties(lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, m_xStartingRange));
if (xRangeProperties.is())
xRangeProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_PAGE_DESC_NAME), uno::makeAny(m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName));
{
OUString aName = m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName;
if (!aName.isEmpty())
{
try
{
xRangeProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_PAGE_DESC_NAME), uno::makeAny(aName));
}
catch( const uno::Exception& )
{
SAL_WARN("writerfilter", "failed to set PageDescName!");
}
}
}
}
// If the section is of type "New column" (0x01), then simply insert a column break.
// But only if there actually are columns on the page, otherwise a column break
......
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