[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Review Request: Kword drawing order fix
From:       "Matus Hanzes" <matus.hanzes () ixonos ! com>
Date:       2010-06-08 9:26:20
Message-ID: 20100608092620.4216.30890 () localhost
[Download RAW message or body]



> On 2010-06-07 13:50:21, Thomas Zander wrote:
> > > There is problem in my previous fix because page background is bind to text
> > > frame and it is not possible to draw something behind text frame.
> > > 
> > > To fix it I have created separate frame for page background, which has the
> > > lowest zIndex and is drawn always first.
> > > 
> > > I have tried to use KoShapeLayer as proposed, but I see no possibility how
> > > to use it with current kword data model. But maybe I have missed something
> > > so if someone has an idea how to do it lets discuss it in more detail.
> > 
> > There seems to be a slight confusion; the shapeLayer was not a suggestion to \
> > solve your problem. Your review request still needs an explanation of what it is \
> > you are fixing in the first place. What is wrong with the drawing order and what \
> > did you do to test this? 
> > Changes this big require unit tests, so this is a great time to start writing \
> > them :) Please
> > a) make sure unit tests do not regress (stop failing)
> > b) add new unit tests for the new functionality.

Detailed explanation.

Under drawing order I understand order in which objects on kword page are drawn.
Kword page consist of this object – page background, header text, main text, footer \
text and objects anchored to header, footer or main text. Anchored objects (pictures, \
drawing objects …) can be drawn behind text, inside text or in front of text. When \
object is anchored into one of three frames (header, footer and main text) it can be \
positioned in area of other frames.

Description of drawing order in kword as it is now :

KOffice uses KoShape::compareShapeZIndex() function to set drawing order. It uses \
ZIndex and parent-child model to order objects.

 KoShape::compareShapeZIndex () implements this rules:
- parent is always drawn before child
- if children have same parent, child with lower zIndex is drawn first.
- if children don't have same parent, parents zIndex are compared and child which \
parent has lower zIndex is drawn first.

Header, footer and main text are text shapes and all have the same ZIndex value.
Page background is drawn as background of these text shapes.

Problems with drawing order as it is now :

Header, footer and main text have the same ZIndex value and order in which they are \
drawn is random. Page background is drawn as background of main text and it is not \
possible to draw something behind main text. compareShapeZIndex()function doesn't \
support "style:run-through" property, which in combination with "style:wrap" defines \
that anchored shape is behind text, inside text or in front text.

What I have done:

Page background is moved from main text frame to separate frame. I didn't find shape \
that just draws background, so I have created KWPageBackground class which draws the \
page background.

ZIndex of text shape, footer shape and header shape are not equal and kword page is \
drawn in this order - page background
header with anchored shapes
footer with anchored shapes
main text with anchored shapes

Support added for "style:run-through" property. Now it is possible to draw something \
behind text or before text.


- Matus


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/4173/#review6013
-----------------------------------------------------------


On 2010-06-07 12:31:47, Matus Hanzes wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/4173/
> -----------------------------------------------------------
> 
> (Updated 2010-06-07 12:31:47)
> 
> 
> Review request for KOffice.
> 
> 
> Summary
> -------
> 
> KWOdfLoader
> Added support for loading of frame properties for objects anchored in header or \
> footer, but I am not sure it is the right way to do it. 
> KOshape
> Added support for something like layers, so that shape placed in lower layer are \
> drawn earlyer than shape in higher layer. 
> KWFrame
> Have added support for placing shapes in layers.
> 
> RunThrough-Backgrond is placed in layer -1.
> RunThrough-Foreground is placed in layer 1.
> All others runAround properties are placed in layer 0.
> 
> 
> Diffs
> -----
> 
> trunk/koffice/kword/part/CMakeLists.txt 1135394 
> trunk/koffice/kword/part/KWOdfLoader.cpp 1135394 
> trunk/koffice/kword/part/KWOdfSharedLoadingData.cpp 1135394 
> trunk/koffice/kword/part/KWPageBackground.h PRE-CREATION 
> trunk/koffice/kword/part/KWPageBackground.cpp PRE-CREATION 
> trunk/koffice/kword/part/KWord.h 1135394 
> trunk/koffice/kword/part/KWord.cpp 1135394 
> trunk/koffice/kword/part/frames/KWFrame.h 1135394 
> trunk/koffice/kword/part/frames/KWFrame.cpp 1135394 
> trunk/koffice/kword/part/frames/KWFrameLayout.h 1135394 
> trunk/koffice/kword/part/frames/KWFrameLayout.cpp 1135394 
> trunk/koffice/kword/part/frames/KWTextFrameSet.cpp 1135394 
> trunk/koffice/libs/flake/KoShape.h 1135394 
> trunk/koffice/libs/flake/KoShape.cpp 1135394 
> trunk/koffice/libs/flake/KoShape_p.h 1135394 
> 
> Diff: http://reviewboard.kde.org/r/4173/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Matus
> 
> 

_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic