summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2024-05-08 14:20:26 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2024-05-10 23:34:35 +0200
commitda7e1d686a586fa93b1e96adb3d837ea3ae59b98 (patch)
treefd7f130d6bab8bccc2d17c46160da6bc9b1bc5cf
parent323f7ee7344e3d039693c80144cc7034ca634d53 (diff)
tdf#156484 svx,sw: fix visibility of shapes in header/footer
Similar to commit ae132145ff42a95dc24fb124847c04af4b8c8dab, also forward IsVisible() and IsPrintable() from SdrVirtObj to its real object; evidently the properties aren't copied when creating SdrVirtObj but there is no reason for that to have these properties independent. This triggers an assert in VOCOfDrawVirtObj::createPrimitive2DSequence() because that is called during layout from getObjectRange(); the assert was added in commit ae3ec0d53a22ae5d2b7fb244a6056d0627b71873 and intended for painting, but this isn't painting, and it's not easily possible to detect if the function is called during painting, so remove the assert. Change-Id: Id2a04a5d07f43b86eb9c524b30ba74ecaf6a95c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167350 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins (cherry picked from commit 9fb9bd54a82ee20f5916aa68e428e0fb67f02ed6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167452 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
-rw-r--r--include/svx/svdobj.hxx8
-rw-r--r--include/svx/svdovirt.hxx4
-rw-r--r--svx/source/svdraw/svdobj.cxx10
-rw-r--r--svx/source/svdraw/svdovirt.cxx20
-rw-r--r--sw/source/core/draw/dcontact.cxx5
5 files changed, 41 insertions, 6 deletions
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 892beb56668c..396c09e8cd94 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -752,10 +752,10 @@ public:
bool IsMoveProtect() const { return m_bMovProt;}
void SetResizeProtect(bool bProt);
bool IsResizeProtect() const { return m_bSizProt;}
- void SetPrintable(bool bPrn);
- bool IsPrintable() const { return !m_bNoPrint;}
- void SetVisible(bool bVisible);
- bool IsVisible() const { return mbVisible;}
+ virtual void SetPrintable(bool isPrintable);
+ virtual bool IsPrintable() const;
+ virtual void SetVisible(bool isVisible);
+ virtual bool IsVisible() const;
void SetMarkProtect(bool bProt);
bool IsMarkProtect() const { return m_bMarkProt;}
virtual bool IsSdrTextObj() const { return false; }
diff --git a/include/svx/svdovirt.hxx b/include/svx/svdovirt.hxx
index 17c869313067..ca5f6858ecaa 100644
--- a/include/svx/svdovirt.hxx
+++ b/include/svx/svdovirt.hxx
@@ -61,6 +61,10 @@ public:
const SdrObject& GetReferencedObj() const;
virtual void NbcSetAnchorPos(const Point& rAnchorPos) override;
+ virtual void SetPrintable(bool isPrintable) override;
+ virtual bool IsPrintable() const override;
+ virtual void SetVisible(bool isVisible) override;
+ virtual bool IsVisible() const override;
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
virtual SdrInventor GetObjInventor() const override;
virtual SdrObjKind GetObjIdentifier() const override;
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index f4d13219db0d..b23e18a6a4d3 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -2675,6 +2675,11 @@ void SdrObject::SetResizeProtect(bool bProt)
}
}
+bool SdrObject::IsPrintable() const
+{
+ return !m_bNoPrint;
+}
+
void SdrObject::SetPrintable(bool bPrn)
{
if( bPrn == m_bNoPrint )
@@ -2689,6 +2694,11 @@ void SdrObject::SetPrintable(bool bPrn)
}
}
+bool SdrObject::IsVisible() const
+{
+ return mbVisible;
+}
+
void SdrObject::SetVisible(bool bVisible)
{
if( bVisible != mbVisible )
diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx
index b1fe6f5cb9bb..2e1641d3864e 100644
--- a/svx/source/svdraw/svdovirt.cxx
+++ b/svx/source/svdraw/svdovirt.cxx
@@ -97,6 +97,26 @@ void SdrVirtObj::NbcSetAnchorPos(const Point& rAnchorPos)
m_aAnchor=rAnchorPos;
}
+bool SdrVirtObj::IsPrintable() const
+{
+ return mxRefObj->IsPrintable();
+}
+
+void SdrVirtObj::SetPrintable(bool const isPrintable)
+{
+ mxRefObj->SetPrintable(isPrintable);
+}
+
+bool SdrVirtObj::IsVisible() const
+{
+ return mxRefObj->IsVisible();
+}
+
+void SdrVirtObj::SetVisible(bool const isVisible)
+{
+ mxRefObj->SetVisible(isVisible);
+}
+
void SdrVirtObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
{
mxRefObj->TakeObjInfo(rInfo);
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index aac8f2393c61..115887a368dc 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -2216,8 +2216,9 @@ namespace sdr::contact
void VOCOfDrawVirtObj::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const
{
- // tdf#91260 have already checked top-level one is on the right page
- assert(isPrimitiveVisible(rDisplayInfo));
+ // this may be called for painting where it's a precondition that
+ // isPrimitiveVisible() is true, or for e.g. getObjectRange() (even
+ // during layout) where there are no preconditions...
// nasty corner case: override to clear page frame to disable the
// sub-objects' anchor check, because their anchor is always on
// the first page that the page style is applied to