[Libreoffice-commits] .: sw/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Thu Jun 14 06:01:50 PDT 2012
sw/source/filter/ww8/wrtw8esh.cxx | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
New commits:
commit d21e1215f6a1742a52638a79582c7c833dd8869a
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Thu Jun 14 13:30:57 2012 +0200
n#325936 fix ww8 export of not-in-background anchored images in header
Regression from commit 2ad707b3, which only updated the import, but
forgot to remove the fake "in background" property on export.
Change-Id: I2b42c5fa7873d946b10d311800049586bc214071
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 477eaa4..e47d881 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -75,6 +75,8 @@
#include <fmtfollowtextflow.hxx> // #i30669#
#include <dcontact.hxx>
#include <frmfmt.hxx>
+#include <flyfrm.hxx>
+#include <pagefrm.hxx>
#include <fmtcntnt.hxx>
#include <ndindex.hxx>
#include <doc.hxx>
@@ -1656,6 +1658,25 @@ void SwBasicEscherEx::WriteBrushAttr(const SvxBrushItem &rBrush,
}
}
+bool lcl_isInHeader(const SwFrmFmt& rFmt)
+{
+ const SwFlyFrmFmt* pFlyFrmFmt = dynamic_cast<const SwFlyFrmFmt*>(&rFmt);
+ SwFlyFrm* pFlyFrm = const_cast<SwFlyFrm*>(pFlyFrmFmt->GetFrm());
+ SwPageFrm* pPageFrm = pFlyFrm->FindPageFrmOfAnchor();
+ SwFrm* pHeader = pPageFrm->Lower();
+ if (pHeader->GetType() == FRM_HEADER)
+ {
+ const SwFrm* pFrm = pFlyFrm->GetAnchorFrm();
+ while (pFrm)
+ {
+ if (pFrm == pHeader)
+ return true;
+ pFrm = pFrm->GetUpper();
+ }
+ }
+ return false;
+}
+
sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrmFmt& rFmt,
MSO_SPT eShapeType, EscherPropertyContainer& rPropOpt)
{
@@ -1746,8 +1767,14 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrmFmt& rFmt,
WriteBrushAttr(aBrush, rPropOpt);
const SdrObject* pObj = rFmt.FindRealSdrObject();
+
+ // SwWW8ImplReader::Read_GrafLayer() imports these as opaque
+ // unconditionally, so if both are true, don't export the property.
+ bool bIsInHeader = lcl_isInHeader(rFmt);
+ bool bIsThrought = rFmt.GetSurround().GetValue() == SURROUND_THROUGHT;
+
if( pObj && (pObj->GetLayer() == GetHellLayerId() ||
- pObj->GetLayer() == GetInvisibleHellId() ))
+ pObj->GetLayer() == GetInvisibleHellId() ) && !(bIsInHeader && bIsThrought))
{
rPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x200020 );
}
More information about the Libreoffice-commits
mailing list