<div dir="ltr"><div>Hi Regina,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Regina Henschel <<a href="mailto:rb.henschel@t-online.de">rb.henschel@t-online.de</a>> 於 2019年4月10日 週三 上午2:38寫道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Mark,<br>
<br>
Mark Hung schrieb am 09-Apr-19 um 11:27:<br>
> Hi Regina,<br>
> <br>
> Regina Henschel <<a href="mailto:rb.henschel@t-online.de" target="_blank">rb.henschel@t-online.de</a> <br>
> <mailto:<a href="mailto:rb.henschel@t-online.de" target="_blank">rb.henschel@t-online.de</a>>> 於 2019年4月9日 週二 上午7:06寫道:<br>
> <br>
> Hi all,<br>
> <br>
> I'm looking at<br>
> <a href="https://bugs.documentfoundation.org/show_bug.cgi?id=115813" rel="noreferrer" target="_blank">https://bugs.documentfoundation.org/show_bug.cgi?id=115813</a><br>
> "Position shifted while moving the handle of OOXML Callout shape".<br>
> <br>
> Unfortunately not only the Callout shape is affected.<br>
> There are 106 shapes in MS Office, which have handles. 38 are OK with<br>
> the current implementation and 68 have at least one handle, which<br>
> reacts<br>
> wrongly. These are only those from ooxml, not from binary format.<br>
> <br>
> The calculation is in method<br>
> EnhancedCustomShape2d::SetHandleControllerPosition in<br>
> svx\source\customshapes\EnhancedCustomShape2d.cxx. The relevant part<br>
> starts about #1230<br>
> <br>
> <br>
> It's not clear to me what makes control point of Impress callout shape <br>
> attach to the pointer,<br>
<br>
The definition of the handle position has a direct reference to an <br>
adjustment value or an indirect reference via a formula and is <br>
calculated from that. A user handle-drag requires a new adjust value, <br>
which will then produce a new handle position. If the calculation is <br>
wrong, then the new position of the handle is not there, where the user <br>
has released the mouse. Calculating an adjustment value from the <br>
drag-end position is done in method SetHandleControllerPosition.<br>
<br>
and<br>
> what are the differences between the Impress one and the PowerPoint one.<br>
<br>
The PowerPoint shape uses other formulas, even if you convert from pptx <br>
to odp. The used formulas are direct translations of the formulas in the <br>
OOXML spec.<br>
<br>
For example (only for the x-coordinate):<br>
OOXML has<br>
gdRefX="adj1" and x="xPos" in the handle description<br>
and the formulas<br>
xPos: fmla="+- hc dxPos 0" means: horizontal center + dxPos - 0<br>
dxPos: fmla="*/ w adj1 100000" means: width * adj1 / 100000<br>
<br>
That is translated by the part Miklos has mentioned and results in these <br>
formulas, when written as odp:<br>
handle-position="?f3 ?f5"<br>
f3: formula="?f2 +?f0 -0"<br>
f2: formula="logwidth/2"<br>
f0: formula="logwidth*$0 /100000"<br>
<br>
A ? means a reference to a formula.<br>
A $ means a reference to an adjust value.<br>
<br>
Our own callout has<br>
handle-position ="$0 $1"<br>
The handle position is directly bind to the adjustment values.<br>
In that case only scaling is needed.<br>
<br></blockquote><div>Thanks for explaining in detail.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> <br>
> Have you checked how custom shapes are imported already? > Relevant codes are in<br>
> /oox/source/drawingml/customshapes/customshapeproperties.cxx<br>
<br>
Yes, the generated formulas look correct for me.<br>
<br>
The problem in the example above is this:<br>
If you put the formulas together you get<br>
handlePositionX = logwidth/2 + logwidth * $0 /100000<br>
Solve the equation for $0. You get<br>
$0 = (handlePositionX - logwidth/2) * 100000 / logwidth<br>
<br>
But current calculation has only * 100000 / logwidth without the <br>
subtraction.<br>
<br></blockquote><div><br></div><div>I'm thinking if we can use delta(handlePosition) as an estimation of delta(adjustment),</div><div>in case the position is a formula instead of an adjustment. Might be a naive idea.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I see no general rule. I think, I need to look at each individual handle <br>
to get its correct formula.<br>
<br>
Kind regards<br>
Regina<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Mark Hung<br></div></div></div></div>