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
This commit is contained in:
Miklos Vajna
2019-09-18 16:55:58 +02:00
parent 77ea053527
commit c3940a9fb2
2 changed files with 16 additions and 0 deletions

View File

@@ -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;
};

View File

@@ -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);
}