Bug 149077 - Change how Rounded Rectangle Callout is drawn in LibreOffice
Summary: Change how Rounded Rectangle Callout is drawn in LibreOffice
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
7.3.2.2 release
Hardware: All All
: low normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Shapes
  Show dependency treegraph
 
Reported: 2022-05-13 17:49 UTC by Rafael Lima
Modified: 2023-10-23 21:14 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Comparison of callouts between LO Impress and MS PowerPoint (44.55 KB, application/vnd.oasis.opendocument.graphics)
2022-05-13 17:49 UTC, Rafael Lima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Lima 2022-05-13 17:49:07 UTC
Created attachment 180099 [details]
Comparison of callouts between LO Impress and MS PowerPoint

In presentations it is very common to use Rounded Rectangle Callouts, specially when the user is trying to highlight something.

LibreOffice provides the "Rounded Rectangle Callout" tool to draw such shape, however it calculates the rounded corners in a weird manner. Because of this, every time one draws a very wide callout the rounded corners end up looking weird because the start/end points of where the curve is drawn seem out of place.

See attached ODG for comparison between LO Impress and MS PowerPoint. Notice that in PowerPoint the points where the curve is drawn are fixed regardless of the proportion of the callout rectangle. This ends up looking smoother.

Hence, my suggestion is to use the same approach to draw Rounded Rectangle Callouts in LibreOffice.

System info:
Version: 7.3.3.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 16; OS: Linux 5.13; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.3~rc2-0ubuntu0.21.10.1~lo1
Calc: threaded
Comment 1 Buovjaga 2022-05-23 11:35:38 UTC
Sounds good -> NEW
Comment 2 Regina Henschel 2022-05-23 12:44:01 UTC
If you do not intend to save to the binary ppt format, then you can use the ooxml-callout. That is in the Gallery theme "Shapes".
Comment 3 Rafael Lima 2022-05-26 19:37:59 UTC
(In reply to Regina Henschel from comment #2)
> If you do not intend to save to the binary ppt format, then you can use the
> ooxml-callout. That is in the Gallery theme "Shapes".

Regina, do you have a code pointer to where the rectangle callout is defined in LO?

I was looking for .uno:CalloutShapes and SID_DRAWTBX_CS_CALLOUT to try to figure out where LO pulls the coordinates for the callout, but I could not find it.
Comment 4 Regina Henschel 2022-05-26 22:13:20 UTC
(In reply to Rafael Lima from comment #3)
> (In reply to Regina Henschel from comment #2)
> > If you do not intend to save to the binary ppt format, then you can use the
> > ooxml-callout. That is in the Gallery theme "Shapes".
> 
> Regina, do you have a code pointer to where the rectangle callout is defined
> in LO?

The shape belongs to those, which have a corresponding shape in binary MS Office. By import in filter/source/msfilter/msdffimp.cxx it gets a type from enum MSO_SPT, in this case mso_sptWedgeRRectCallout = 62.
Coming from ODF we have the map from the value of draw:type="rounded-rectangular-callout" in ODF to MSO_SPT in /svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx.

The MSO_SPT enum value is then mapped to a mso_CustomShape* in method GetCustomShapeContent() at the end of svx/source/customshapes/EnhancedCustomShapeGeometry.cxx, here msoWedgeRRectCallout. The details for this shape are then around #5800 above in this file.

> 
> I was looking for .uno:CalloutShapes and SID_DRAWTBX_CS_CALLOUT to try to
> figure out where LO pulls the coordinates for the callout, but I could not
> find it.

Depending on what you want to do, you likely need some more info. No problem with that, but I need to know what you want to do, to help you further.
Comment 5 Regina Henschel 2022-05-27 19:53:13 UTC
The shape "Alternate Process" from category "Flowchart" has the same problem, that the corners do not remain circular.
Comment 6 Rafael Lima 2022-05-27 20:29:10 UTC
(In reply to Regina Henschel from comment #5)
> The shape "Alternate Process" from category "Flowchart" has the same
> problem, that the corners do not remain circular.

Indeed, the "Alternate Process" shape has the same problem. OTOH "Rectangle, Rounded" (Basic Shapes) is a very similar shape and it does not have the same problem.

Note that "Rectangle, Rounded" has a handle and it prevents the corners from being distorted.

I was trying to figure out the code in [1] to see if we could change the way these corner vertices are calculated. However, I still could not figure out what the calculation data means in the mso_CustomShape struct.

[1] https://opengrok.libreoffice.org/xref/core/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx?r=4cfe4699#5820
Comment 7 Regina Henschel 2022-05-27 21:26:26 UTC
What do you already know about custom shapes? Do you know, how the ODF markup in file is written? Do you know how the information is hold in property CustomShapeGeometry (Development Tools)? Do you now how shapes were defined in VML? Do you know "limo stretch" or "stretchpoint"? Then I would know where to start to explain the mso_CustomShape struct. Should we discuss it in direct mails? Or we start a Wiki-page about this topic? I think it is a little bit off-topic for Bugzilla.
Comment 8 Eyal Rozenberg 2023-10-21 18:45:05 UTC
This is a major annoyance for presentation authors. The weird elliptic quadrants make this shape incredibly ugly. I wish someone would work on it, since it's not some systemic bug so it should not be that much work beyond realizing how the shape is specified.
Comment 9 Khushi Gautam 2023-10-23 21:14:10 UTC
(In reply to Regina Henschel from comment #7)
> What do you already know about custom shapes? Do you know, how the ODF
> markup in file is written? Do you know how the information is hold in
> property CustomShapeGeometry (Development Tools)? Do you now how shapes were
> defined in VML? Do you know "limo stretch" or "stretchpoint"? Then I would
> know where to start to explain the mso_CustomShape struct. Should we discuss
> it in direct mails? Or we start a Wiki-page about this topic? I think it is
> a little bit off-topic for Bugzilla.

I want to know about how the shapes are defined in VML, Also if I am making any changes in the EnhancedCustomShapeGeometry.cxx , will the changed reflect in impress document or draw document. Also whenever I am editing "msoWedgeRRectCallout" I am unable to see any differences. Just wants to know from where this shape is coded