Kaydet (Commit) 7016708e authored tarafından David Tardon's avatar David Tardon Kaydeden (comit) Fridrich Strba

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 09d4525b)
Reviewed-on: https://gerrit.libreoffice.org/2962Reviewed-by: 's avatarFridrich Strba <fridrich@documentfoundation.org>
Tested-by: 's avatarFridrich Strba <fridrich@documentfoundation.org>
üst 76063620
...@@ -40,6 +40,9 @@ namespace sdr ...@@ -40,6 +40,9 @@ namespace sdr
// This method recursively paints the draw hierarchy. // This method recursively paints the draw hierarchy.
virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const; virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const;
private:
virtual bool isPrimitiveVisibleOnAnyLayer(const SetOfByte& aLayers) const;
}; };
} // end of namespace contact } // end of namespace contact
} // end of namespace sdr } // end of namespace sdr
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// predeclarations // predeclarations
class SdrObject; class SdrObject;
class SetOfByte;
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
...@@ -34,6 +35,14 @@ namespace sdr ...@@ -34,6 +35,14 @@ namespace sdr
{ {
class SVX_DLLPUBLIC ViewObjectContactOfSdrObj : public ViewObjectContact 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: protected:
const SdrObject& getSdrObject() const; const SdrObject& getSdrObject() const;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <basegfx/tools/canvastools.hxx> #include <basegfx/tools/canvastools.hxx>
#include <svx/sdr/contact/viewcontact.hxx> #include <svx/sdr/contact/viewcontact.hxx>
#include <svx/svdobj.hxx>
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
...@@ -98,6 +99,14 @@ namespace sdr ...@@ -98,6 +99,14 @@ namespace sdr
} }
return xRetval; 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 contact
} // end of namespace sdr } // end of namespace sdr
......
...@@ -48,12 +48,17 @@ namespace sdr ...@@ -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 bool ViewObjectContactOfSdrObj::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
{ {
const SdrObject& rObject = getSdrObject(); const SdrObject& rObject = getSdrObject();
// Test layer visibility // Test layer visibility
if(!rDisplayInfo.GetProcessLayers().IsSet(rObject.GetLayer())) if(!isPrimitiveVisibleOnAnyLayer(rDisplayInfo.GetProcessLayers()))
{ {
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment