[Bug 34555] Make cropping handles for images (as in Draw/Impress) available for all LibreOffice applications

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Jan 23 10:48:20 PST 2015


https://bugs.freedesktop.org/show_bug.cgi?id=34555

--- Comment #50 from Laurent Charrière <lcharriere at gmail.com> ---
(In reply to wepmaschda from comment #14)
> The files
> 
> (draw)
> http://cgit.freedesktop.org/libreoffice/core/tree/svx/source/tbxctrls/
> grafctrl.cxx
> and
> (writer)
> http://cgit.freedesktop.org/libreoffice/core/tree/sw/source/ui/shells/grfsh.
> cxx
> 
> are quite similar.
> 
> There are blocks labeled "SID_ATTR_GRAF_CROP" in
> SvxGrafAttrHelper::ExecuteGrafAttr() and
> SvxGrafAttrHelper::GetGrafAttrState() in the first file. 

So I started looking into this, and I think that SID_ATTR_GRAF_CROP is used
when cropping with the dialog, but I don't think it's used when doing an
interactive crop. I added debug statements here and there when doing a crop in
Draw, and the relevant SID is SID_OBJECT_CROP. Unfortunately this is not used
in Writer. I'm able to add a new 'Crop Image' option in the context menu for
inserted images in Writer, but then the problem becomes that Writer and Draw
don't seem to use the same data structure to insert graphics, and it looks like
only the one in Draw supports interactive crop. Details follow:

In Draw, once SID_OBJECT_CROP is sent, eventually what happens is that
FuSelection::Activate() sets the drag mode SDRDRAG_CROP on mpView.
SdrMarkView::SetDragMode get called. In turns, it calls
SdrMarkView::SetMarkHandles(). In that method, there is to test to see if
pMarkedObj is an instance of SdrGrafObj. When true, the instance of SdrGrafObj
is responsible for "handling crop" (according to the comments). This is true in
Draw, but not in Writer. In Writer, pMarkedObj is a SwVirtFlyDrawObj.

I'm stuck at this point. I don't know how to make the SwVirtFlyDrawObj draw the
crop handles. Interestingly enough, while the handles are not drawn, the corner
of an inserted image are draggable, and the cursor is changed to the cropping
cursor. But there is no visible cropping taking place as in Draw.

As a side note, OpenOffice.org has a whole page devoted to an ongoing
refactoring of Writer's usage of the Drawing layer at
https://wiki.openoffice.org/wiki/Refactoring_of_Writer%27s_usage_of_the_Drawing_layer.
I think this may be related.

I would appreciate any pointers on how to keep proceeding with this bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20150123/4f28a0e1/attachment.html>


More information about the LibreOffice mailing list