GSoC progress for week #3 and week #4.
Group selection does not work with raster images / Writer
- Bug: tdf#34438 (Image-Group) - [feature request, FORMATTING] group selection does not work with raster images.
Writer can group
Drawing objects. For example shapes(rectangles, circles), text boxes and draw images can be grouped together to drag & drop.
However, when copy/paste or drag&drop an image into the writer document canvas, (raster/bitmap)images are handled as
Frame objects (holding images/bitmaps), not
Drawing objects. Drawing objects have the group feature, but this feature is not implemented for Graphics(Frame objects/bitmap). This is why Writer can’t group raster images.
In week #3 and #4, I tried to understand the logic behind the grouping Drawing objects. It seems more complex than it looks. To keep the blog post simple and short, I will share only the key points of my research.
All CLICK and SHIFT+CLICK operations for grouping Drawing objects handled in ./sw/source/uibase/docvw/edtwin.cxx:2770 : https://opengrok.libreoffice.org/xref/core/sw/source/uibase/docvw/edtwin.cxx?r=216a43bc#2770
SHIFT+CLICK occurs in: https://opengrok.libreoffice.org/xref/core/sw/source/uibase/docvw/edtwin.cxx?r=216a43bc#3470
Select objects : SwFEShell::SelectObj: https://opengrok.libreoffice.org/xref/core/sw/source/core/frmedt/feshview.cxx?r=715797bc#177
Types of forms of content: https://opengrok.libreoffice.org/xref/core/sw/inc/editsh.hxx?r=1feb59c3#130
SAL_DEBUG( rMrkList.GetMarkDescription() ); output: (in SwFEShell::SelectObj)
For 2+ shapes:
For draw images:
Image with transparency
For text box:
For raster images:
Raster images seem to have
NONE object name:
rMrkList.GetMarkDescription() can’t classify the raster images?
SAL_DEBUG( rMrkList.GetMarkCount() ); always increases by
1 when selecting drawing objects via SHIFT+CLICK. But always gives
1 when selecting raster images.
All selected objects store in
This means raster images added to the list but always be unmarked when GetMarkCount reaches
1. The actual reason of unmarking issue is:
pOldSelFly = ::GetFlyFromMarked( &rMrkList, this ); returns 0(null) when selecting the second, third … shape (which is expected); and it doesn’t set
bUnmark = true, so it doesn’t execute
pOldSelFly = ::GetFlyFromMarked( &rMrkList, this ); always returns an address which is evaluated
true in an
if ( pOldSelFly ) case. This causes
bUnmark = true; and executes
if ( bUnmark ). Therefore, when
rMrkList.GetMarkCount() == 1 and
::GetFlyFromMarked( &rMrkList, this ) returns an address;
rMrkList doesn’t add the second selected raster image to itself and do unmark it.
Frame is not accessible
Another interesting issue is when trying to add(select) a raster image to the shape list (unmarking disabled) debugging warns
warn: /*...*/ frame is not accessible.
pFESh->IsObjSelected() should return
"frame is not accessible".
When selecting raster images, in SwFEShell::IsFrameSelected():
GetFlyFromMarked should return
false (0(null)), not an address which make
nullptr != 0x01...
I also looked at Draw and Calc to see how images are handled. Images are converted a drawing objects and have the same attributes like shapes. But in Writer, images have different attributes and handling.
Summary of last 2 weeks
- Tried to understand how shapes grouped together
Next Week TO-DO
- Make raster images selectable(group) with SHIFT+CLICK