summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2013-03-24 14:08:14 +0100
committerThorsten Behrens <tbehrens@suse.com>2013-03-25 20:39:19 +0000
commit3535986f37406508b2fd84f6a79ed1c4f33b3e8a (patch)
treea9d1c16e486174308c9b22fa9af56aeb0a91f4b9 /svx
parentd53e6dea138397104b32bed53a082f892d9fa2e9 (diff)
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) Reviewed-on: https://gerrit.libreoffice.org/2963 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Reviewed-by: Petr Mladek <pmladek@suse.cz> Tested-by: Petr Mladek <pmladek@suse.cz> Reviewed-by: Thorsten Behrens <tbehrens@suse.com> Tested-by: Thorsten Behrens <tbehrens@suse.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx3
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofsdrobj.hxx9
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofgroup.cxx9
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx7
4 files changed, 27 insertions, 1 deletions
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx
index b925889eb9c9..fda5610e0568 100644
--- a/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx
@@ -40,6 +40,9 @@ namespace sdr
// 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 d7609bdcbb39..e0384426add3 100644
--- a/svx/inc/svx/sdr/contact/viewobjectcontactofsdrobj.hxx
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofsdrobj.hxx
@@ -25,6 +25,7 @@
//////////////////////////////////////////////////////////////////////////////
// predeclarations
class SdrObject;
+class SetOfByte;
//////////////////////////////////////////////////////////////////////////////
@@ -34,6 +35,14 @@ namespace sdr
{
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 cdd21dbbc4f0..724b77ea5ba4 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
@@ -25,6 +25,7 @@
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <basegfx/tools/canvastools.hxx>
#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/svdobj.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -98,6 +99,14 @@ namespace sdr
}
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 e184bde10216..77c97cd431d0 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx
@@ -48,12 +48,17 @@ namespace sdr
{
}
+ 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;
}