fdo#82114 RTF import: fix handling of first page in non-first section
Change-Id: If06c6bcdda97447e6014223d997c7ff8abd64b48
This commit is contained in:
parent
4d3c88805d
commit
04fe5e6a31
3 changed files with 32 additions and 4 deletions
14
sw/qa/extras/rtfimport/data/fdo82114.rtf
Normal file
14
sw/qa/extras/rtfimport/data/fdo82114.rtf
Normal file
|
@ -0,0 +1,14 @@
|
|||
{\rtf1
|
||||
\paperw11906\paperh16838\margl1134\margr567\margt1418\margb851\gutter0\ltrsect
|
||||
\viewkind1\viewscale110\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nojkernpunct\rsidroot13516616\utinl \fet0
|
||||
\titlepg
|
||||
{\headerr Right page header, section 1\par
|
||||
}
|
||||
{\headerf First page header, section 1\par
|
||||
}
|
||||
\pard\plain First page, section 1.\par\sect
|
||||
\sectd\titlepg
|
||||
{\headerf First page header, section 2\par
|
||||
}
|
||||
\pard\plain First page, section 2.\par
|
||||
}
|
|
@ -1932,6 +1932,15 @@ DECLARE_RTFIMPORT_TEST(testCsBold, "cs-bold.rtf")
|
|||
CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(getRun(getParagraph(1), 1), "CharWeight"));
|
||||
}
|
||||
|
||||
DECLARE_RTFIMPORT_TEST(testFdo82114, "fdo82114.rtf")
|
||||
{
|
||||
uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Converted1"), "HeaderText");
|
||||
OUString aActual = xHeaderText->getString();
|
||||
OUString aExpected("First page header, section 2");
|
||||
// This was 'Right page header, section 1'.
|
||||
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
|
||||
}
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -524,14 +524,18 @@ uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle(
|
|||
m_aFirstPageStyle = uno::Reference< beans::XPropertySet > (
|
||||
xTextFactory->createInstance("com.sun.star.style.PageStyle"),
|
||||
uno::UNO_QUERY);
|
||||
|
||||
// Call insertByName() before GetPageStyle(), otherwise the
|
||||
// first and the follow page style will have the same name, and
|
||||
// insertByName() will fail.
|
||||
if (xPageStyles.is())
|
||||
xPageStyles->insertByName( m_sFirstPageStyleName, uno::makeAny(m_aFirstPageStyle) );
|
||||
|
||||
// Ensure that m_aFollowPageStyle has been created
|
||||
GetPageStyle( xPageStyles, xTextFactory, false );
|
||||
// Chain m_aFollowPageStyle to be after m_aFirstPageStyle
|
||||
m_aFirstPageStyle->setPropertyValue("FollowStyle",
|
||||
uno::makeAny(m_sFollowPageStyleName));
|
||||
|
||||
if (xPageStyles.is())
|
||||
xPageStyles->insertByName( m_sFirstPageStyleName, uno::makeAny(m_aFirstPageStyle) );
|
||||
}
|
||||
else if( !m_aFirstPageStyle.is() && xPageStyles.is() )
|
||||
{
|
||||
|
@ -558,8 +562,9 @@ uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle(
|
|||
}
|
||||
|
||||
}
|
||||
catch( const uno::Exception& )
|
||||
catch( const uno::Exception& rException )
|
||||
{
|
||||
SAL_WARN("writerfilter", "SectionPropertyMap::GetPageStyle() failed: " << rException.Message);
|
||||
}
|
||||
|
||||
return xRet;
|
||||
|
|
Loading…
Reference in a new issue