summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-09-18 16:55:58 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-09-18 19:23:53 +0200
commitc3940a9fb2de7ba09f7d82497491918fd9bb3d0e (patch)
treed8292282aa0aa6c2fbbe69f69946c5c3917b4d80
parent77ea0535271d3fb3d49c8d916ecf80e0a7f70653 (diff)
Related: tdf#124600 sw anchored object allow overlap: add doc model
This is initial code to support DOCX's <wp:anchor ... allowOverlap="0"> markup as a full feature in core. Currently anchored objects can unconditionally overlap, the new bool allows opting in to prevent that. Layout is not yet using the new SwFormatWrapInfluenceOnObjPos::GetAllowOverlap(), to be done in a follow-up commit. Change-Id: I2f299571223c039741c81860ea17d42cd63140b3 Reviewed-on: https://gerrit.libreoffice.org/79105 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
-rw-r--r--sw/inc/fmtwrapinfluenceonobjpos.hxx5
-rw-r--r--sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx11
2 files changed, 16 insertions, 0 deletions
diff --git a/sw/inc/fmtwrapinfluenceonobjpos.hxx b/sw/inc/fmtwrapinfluenceonobjpos.hxx
index 8d2b4a73032c..8e56be1ed653 100644
--- a/sw/inc/fmtwrapinfluenceonobjpos.hxx
+++ b/sw/inc/fmtwrapinfluenceonobjpos.hxx
@@ -28,6 +28,8 @@ class SW_DLLPUBLIC SwFormatWrapInfluenceOnObjPos: public SfxPoolItem
{
private:
sal_Int16 mnWrapInfluenceOnPosition;
+ /// Allow objects to overlap, permitted by default.
+ bool mbAllowOverlap = true;
public:
@@ -55,6 +57,9 @@ public:
sal_Int16 GetWrapInfluenceOnObjPos(
const bool _bIterativeAsOnceConcurrent = false ) const;
+ void SetAllowOverlap(bool bAllowOverlap);
+ bool GetAllowOverlap() const;
+
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
};
diff --git a/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx b/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
index bda1f3d136a5..0a1ef3221e94 100644
--- a/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
+++ b/sw/source/core/attr/fmtwrapinfluenceonobjpos.cxx
@@ -125,11 +125,22 @@ sal_Int16 SwFormatWrapInfluenceOnObjPos::GetWrapInfluenceOnObjPos(
return nWrapInfluenceOnPosition;
}
+void SwFormatWrapInfluenceOnObjPos::SetAllowOverlap(bool bAllowOverlap)
+{
+ mbAllowOverlap = bAllowOverlap;
+}
+
+bool SwFormatWrapInfluenceOnObjPos::GetAllowOverlap() const
+{
+ return mbAllowOverlap;
+}
+
void SwFormatWrapInfluenceOnObjPos::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatWrapInfluenceOnObjPos"));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nWrapInfluenceOnPosition"), BAD_CAST(OString::number(mnWrapInfluenceOnPosition).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("mbAllowOverlap"), BAD_CAST(OString::boolean(mbAllowOverlap).getStr()));
xmlTextWriterEndElement(pWriter);
}