Draw: set Adjustment Values for Custom shapes
Introduction
See Issue 120519
Many shapes like ring, smiley or callout had a yellow handle to modify a specific parameter.
But it only set up with mouse. It unable to set up with a dialogbox if you need a fine adjustment.
Custom shape
These shape are designed by a specific handle (yellow colored).
Each shape can have one or more yellow handles.
Some shapes with one handle
Some shapes with two or more handles
API Analysis
If you inspect the SvxShapeText object through API, you have a CustomShapeGeometry property.
- This property result a structure of 6 arrays com.sun.star.beans.PropertyValue.
- The 3th array is named AdjustmentValues
- This structure contains a variant named Value
- This Value is a com.sun.star.drawing.EnhancedCustomShapeAdjustmentValue structure
- Depending on the number of handles, the number of structures varies.
- Each structure contains a default Value (type variant).
Default value of shape with one handle:
- For a ring shape, the default value is: 5400
- For a smiley shape: 17520.
- For a frame shape: 2000.
Default values of shape with more handles:
The "left-right-arrow-callout" with 3 yellow handles match to 4 structures:
- Array(0): 5400
- Array(1): 5500
- Array(2): 2700
- Array(3): 8100
Design option
Proposal of a new design for "Position and size" dialog.
A specific tab will be added. It is much easy to set up these values in dialog.
Sample dialog for smiley shape:
The adjustment value of the smile is in degrees.
Difficulties
Beyond the programmation, I see some difficulties :
- No information about value is available. Hard to know which value set specific handle.
- Look for all the services starting with "EnhancedCustomShape..." in the index of the IDL reference. There you will find the Handles.
- The first decision is to look, whether the property 'polar' exists. That will make the difference between using degree or not. Next step is to look into 'Position'. It has a value pair first/second. Each of first/second has a value and a type. The type determines how the value is used. Type 0 means to use it literal, type 1 means it is the index in Equations (in file format a ?), and type 2 means it is the index in AdjustmentValues (in file format a $).
- You can examine the custom shapes in the watch window in the Basic IDE. Or you unpack the file and look into the content.xml. A useful guide to their file format is the article "Custom Shapes in OpenOffice.org" by J. David Eisenberg[1]. For general information about the file format use the ODF1.2 specification itself.
- No tag or text is available through API to design dialog fields.
==