summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-09-05 10:36:08 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-09-08 12:48:26 +0200
commited0af187f9e9fb63b311684369e3f2fe1aba700b (patch)
tree053e00ab014701a6c806b81e61c3540b0bddd4c5 /sw
parent5a43ee13e3d1153939bc6bbdcf948806e164d757 (diff)
abi#10039 RTF export: support page-anchored frames
(cherry picked from commit 845fb7bf6753ec9582d0b1d1c9b4276aa9e6c65e) Conflicts: sw/qa/extras/rtfexport/rtfexport.cxx Change-Id: I71c961799f76446cdf24faeba86f881ae02ffe3b
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfexport/data/abi10039.odtbin0 -> 12293 bytes
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx6
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx22
3 files changed, 21 insertions, 7 deletions
diff --git a/sw/qa/extras/rtfexport/data/abi10039.odt b/sw/qa/extras/rtfexport/data/abi10039.odt
new file mode 100644
index 000000000000..4d5dde5af96a
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/abi10039.odt
Binary files differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index c10def0222e8..593dc9815a4f 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -617,6 +617,12 @@ DECLARE_RTFEXPORT_TEST(testFdo32613, "fdo32613.odt")
CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
}
+DECLARE_RTFEXPORT_TEST(testAbi10039, "abi10039.odt")
+{
+ // Make sure we don't just crash on export, and additionally the shape should not be inline (as it's at-page anchored originally).
+ CPPUNIT_ASSERT(text::TextContentAnchorType_AS_CHARACTER != getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index ff482d9d6c8e..ec3c74886836 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3706,8 +3706,16 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const S
aRendered.Height() = rS.GetHeight();
}
- const SwPosition* pAnchor = pFlyFrmFmt->GetAnchor().GetCntntAnchor();
- sw::Frame aFrame(*pFlyFrmFmt, *pAnchor);
+ sw::Frame* pFrame = 0;
+ for (sw::FrameIter it = m_rExport.maFrames.begin(); it != m_rExport.maFrames.end(); ++it)
+ {
+ if (pFlyFrmFmt == &it->GetFrmFmt())
+ {
+ pFrame = &(*it);
+ break;
+ }
+ }
+ assert(pFrame);
/*
If the graphic is not of type WMF then we will have to store two
@@ -3716,7 +3724,7 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const S
a wmf already then we don't need any such wrapping
*/
bool bIsWMF = pBLIPType && std::strcmp(pBLIPType, OOO_STRING_SVTOOLS_RTF_WMETAFILE) == 0;
- if (aFrame.IsInline())
+ if (pFrame->IsInline())
{
if (!bIsWMF)
m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT;
@@ -3725,9 +3733,9 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const S
{
m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_SHP "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPINST;
m_pFlyFrameSize = &aRendered;
- m_rExport.mpParentFrame = &aFrame;
+ m_rExport.mpParentFrame = pFrame;
m_rExport.bOutFlyFrmAttrs = m_rExport.bRTFFlySyntax = true;
- m_rExport.OutputFormat(aFrame.GetFrmFmt(), false, false, true);
+ m_rExport.OutputFormat(pFrame->GetFrmFmt(), false, false, true);
m_rExport.bOutFlyFrmAttrs = m_rExport.bRTFFlySyntax = false;
m_rExport.mpParentFrame = NULL;
m_pFlyFrameSize = 0;
@@ -3748,7 +3756,7 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const S
m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_SP "{" OOO_STRING_SVTOOLS_RTF_SN " pib" "}{" OOO_STRING_SVTOOLS_RTF_SV " ";
}
- bool bWritePicProp = aFrame.IsInline();
+ bool bWritePicProp = pFrame->IsInline();
if (pBLIPType)
ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport, &m_rExport.Strm(), bWritePicProp);
else
@@ -3763,7 +3771,7 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const S
ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport, &m_rExport.Strm(), bWritePicProp);
}
- if (aFrame.IsInline())
+ if (pFrame->IsInline())
{
if (!bIsWMF)
{