[PATCH libreoffice-3-6-6] fdo#62617 display groups on multiple layers correctly
David Tardon (via Code Review)
gerrit at gerrit.libreoffice.org
Sun Mar 24 06:46:07 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/2964
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/64/2964/1
fdo#62617 display groups on multiple layers correctly
It is possible to group objects from different layers, so it is an error
to rely on layer ID when checking visibility of a group. This problem
was partially obscured by the fact that SdrObjGroup::GetLayer() returns
0 if its subobjects are on different layers and 0 is a valid layer ID.
Change-Id: I0ef75544a26817154642185864cafd4e6734fa38
(cherry picked from commit 09d4525b11f396a68ca7c5cbb1ae3462db40c77c)
---
M svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx
M svx/inc/svx/sdr/contact/viewobjectcontactofsdrobj.hxx
M svx/source/sdr/contact/viewobjectcontactofgroup.cxx
M svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx
4 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx
index e189a63..7a0596a 100644
--- a/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx
@@ -49,6 +49,9 @@
// This method recursively paints the draw hierarchy.
virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const;
+
+ private:
+ virtual bool isPrimitiveVisibleOnAnyLayer(const SetOfByte& aLayers) const;
};
} // end of namespace contact
} // end of namespace sdr
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofsdrobj.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofsdrobj.hxx
index e366bbd..e5b1f13 100644
--- a/svx/inc/svx/sdr/contact/viewobjectcontactofsdrobj.hxx
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofsdrobj.hxx
@@ -34,6 +34,7 @@
//////////////////////////////////////////////////////////////////////////////
// predeclarations
class SdrObject;
+class SetOfByte;
//////////////////////////////////////////////////////////////////////////////
@@ -43,6 +44,14 @@
{
class SVX_DLLPUBLIC ViewObjectContactOfSdrObj : public ViewObjectContact
{
+ /** Test whether the primitive is visible on any layer from @c aLayers
+
+ This should be overriden by ViewObjectContacts of SDR classes
+ that have subparts which can be on different layers (that is,
+ SdrObjGroup .-)
+ */
+ virtual bool isPrimitiveVisibleOnAnyLayer(const SetOfByte& aLayers) const;
+
protected:
const SdrObject& getSdrObject() const;
diff --git a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
index 3f47bb4..ee2c630 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
@@ -34,6 +34,7 @@
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <basegfx/tools/canvastools.hxx>
#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/svdobj.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -107,6 +108,14 @@
}
return xRetval;
}
+
+ bool ViewObjectContactOfGroup::isPrimitiveVisibleOnAnyLayer(const SetOfByte& aLayers) const
+ {
+ SetOfByte aObjectLayers;
+ getSdrObject().getMergedHierarchyLayerSet(aObjectLayers);
+ aObjectLayers &= aLayers;
+ return !aObjectLayers.IsEmpty();
+ }
} // end of namespace contact
} // end of namespace sdr
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx
index d9a285f..b1e9fa9 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx
@@ -57,12 +57,17 @@
{
}
+ bool ViewObjectContactOfSdrObj::isPrimitiveVisibleOnAnyLayer(const SetOfByte& aLayers) const
+ {
+ return aLayers.IsSet(getSdrObject().GetLayer());
+ }
+
bool ViewObjectContactOfSdrObj::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
{
const SdrObject& rObject = getSdrObject();
// Test layer visibility
- if(!rDisplayInfo.GetProcessLayers().IsSet(rObject.GetLayer()))
+ if(!isPrimitiveVisibleOnAnyLayer(rDisplayInfo.GetProcessLayers()))
{
return false;
}
--
To view, visit https://gerrit.libreoffice.org/2964
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ef75544a26817154642185864cafd4e6734fa38
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-3-6-6
Gerrit-Owner: David Tardon <dtardon at redhat.com>
More information about the LibreOffice
mailing list