Commit 816eac47 authored by C. Boemann's avatar C. Boemann

Handle z ordering of anchored shapes correctly like LO do

BUG:286589
parent 7215bb63
......@@ -461,6 +461,11 @@ QTransform KoShape::transformation() const
return d->localMatrix;
}
bool KoShape::overruleChildZValues()
{
return true;
}
bool KoShape::compareShapeZIndex(KoShape *s1, KoShape *s2)
{
bool foundCommonParent = false;
......@@ -479,13 +484,17 @@ bool KoShape::compareShapeZIndex(KoShape *s1, KoShape *s2)
foundCommonParent = true;
break;
}
index2 = parentShapeS2->zIndex();
if (parentShapeS2->overruleChildZValues()) {
index2 = parentShapeS2->zIndex();
}
runThrough2 = parentShapeS2->runThrough();
parentShapeS2 = parentShapeS2->parent();
}
if (!foundCommonParent) {
index1 = parentShapeS1->zIndex();
if (parentShapeS1->overruleChildZValues()) {
index1 = parentShapeS1->zIndex();
}
runThrough1 = parentShapeS1->runThrough();
parentShapeS1 = parentShapeS1->parent();
}
......
......@@ -593,6 +593,14 @@ public:
*/
virtual void update(const QRectF &rect) const;
/**
* Returns if during compareShapeZIndex() this shape should overrule
* it childrens z alues with it's own. The default behaviour is to do so
* but for special cases (like Calligra's TextShape) it can be overloaded
* @returns if we overrule z order (default impl. returns true)
*/
virtual bool overruleChildZValues();
/**
* This is a method used to sort a list using the STL sorting methods.
* @param s1 the first shape
......
......@@ -61,6 +61,9 @@ public:
/// reimplemented
QRectF outlineRect() const;
///reimplemented
bool overruleChildZValues() {return false;}
/// set the image collection which is needed to draw bullet from images
void setImageCollection(KoImageCollection *collection) { m_imageCollection = collection; }
......
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