[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.3' - 2 commits - sw/qa sw/source writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Sat Jan 24 07:13:29 PST 2015
sw/qa/extras/rtfexport/data/abi10076.odt |binary
sw/qa/extras/rtfexport/rtfexport.cxx | 5 +++++
sw/qa/extras/rtfimport/data/fdo82114.rtf | 14 ++++++++++++++
sw/qa/extras/rtfimport/rtfimport.cxx | 9 +++++++++
sw/source/filter/ww8/rtfattributeoutput.cxx | 7 +++----
writerfilter/source/dmapper/PropertyMap.cxx | 13 +++++++++----
6 files changed, 40 insertions(+), 8 deletions(-)
New commits:
commit 6ee0c2823f02376adf45291ce6e1aeab2687dc4f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Sep 11 12:23:18 2014 +0200
fdo#82114 RTF import: fix handling of first page in non-first section
Change-Id: If06c6bcdda97447e6014223d997c7ff8abd64b48
(cherry picked from commit 04fe5e6a31c9701177a744bbc8a53b2f664fe71c)
diff --git a/sw/qa/extras/rtfimport/data/fdo82114.rtf b/sw/qa/extras/rtfimport/data/fdo82114.rtf
new file mode 100644
index 0000000..073d281
--- /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 1c8f15d..69bbb3b 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2102,6 +2102,15 @@ DECLARE_RTFIMPORT_TEST(testFdo79959, "fdo79959.rtf")
CPPUNIT_ASSERT_EQUAL(true, static_cast<bool>(getStyles("ParagraphStyles")->hasByName("Test")));
}
+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 5014d63..1ae318d 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -428,14 +428,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() )
{
@@ -462,8 +466,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;
commit bacd7f92003991689c48806e2597456635d00c84
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Sep 9 17:15:56 2014 +0200
abi#10076 RTF export: handle frames without a valid anchor point
Ideally all frames have an anchor point in the maFrames vector, as
provided by MSWordExportBase. If that's not the case, then we have no
idea what would be a valid anchor point: just export those as inline, as
we did before.
Change-Id: I81134d9fb8dc4ca166084964d277ac02ceccde7b
(cherry picked from commit 2f33111510c87ca310fde346e223bd6e750b2248)
diff --git a/sw/qa/extras/rtfexport/data/abi10076.odt b/sw/qa/extras/rtfexport/data/abi10076.odt
new file mode 100644
index 0000000..4ac6aa5
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/abi10076.odt differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index d405b91..baca0a9 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -685,6 +685,11 @@ DECLARE_RTFEXPORT_TEST(testAbi10039, "abi10039.odt")
CPPUNIT_ASSERT(text::TextContentAnchorType_AS_CHARACTER != getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
}
+DECLARE_RTFEXPORT_TEST(testAbi10076, "abi10076.odt")
+{
+ // Just make sure that we don't crash after exporting a fully calculated layout.
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 20a49e2..bebfb71 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3707,7 +3707,6 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrmFmt* pFlyFrmFmt, const Sw
break;
}
}
- assert(pFrame);
/*
If the graphic is not of type WMF then we will have to store two
@@ -3716,7 +3715,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrmFmt* pFlyFrmFmt, const Sw
a wmf already then we don't need any such wrapping
*/
bool bIsWMF = pBLIPType && std::strcmp(pBLIPType, OOO_STRING_SVTOOLS_RTF_WMETAFILE) == 0;
- if (pFrame->IsInline())
+ if (!pFrame || pFrame->IsInline())
{
if (!bIsWMF)
m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT);
@@ -3748,7 +3747,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrmFmt* pFlyFrmFmt, const Sw
m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{" OOO_STRING_SVTOOLS_RTF_SN " pib" "}{" OOO_STRING_SVTOOLS_RTF_SV " ");
}
- bool bWritePicProp = pFrame->IsInline();
+ bool bWritePicProp = !pFrame || pFrame->IsInline();
if (pBLIPType)
ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport, &m_rExport.Strm(), bWritePicProp);
else
@@ -3763,7 +3762,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrmFmt* pFlyFrmFmt, const Sw
ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport, &m_rExport.Strm(), bWritePicProp);
}
- if (pFrame->IsInline())
+ if (!pFrame || pFrame->IsInline())
{
if (!bIsWMF)
{
More information about the Libreoffice-commits
mailing list