summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/rtfimport/data/fdo82114.rtf14
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx9
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx13
3 files changed, 32 insertions, 4 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo82114.rtf b/sw/qa/extras/rtfimport/data/fdo82114.rtf
new file mode 100644
index 000000000000..073d2818b207
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo82114.rtf
@@ -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
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index acd78d0461fe..1dda1c45b972 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -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: */
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index e774010e5764..c6dcc394ffcc 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -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;