office-gobmx/oox/source/shape
Regina Henschel 7e23cbdbb6 tdf#149551 separate TextRotateAngle from TextPreRotateAngle
The import filter had only one member for both and had it mapped to
TextPreRotateAngle. That resulted in lost text area rotation when a
shape had both types of rotations, and sheared text when only text
area rotation existed.

The patch introduces a new 'moTextAreaRotation' member for the 'rot'
attribute of the <bodyPr> element. It is mapped to 'TextRotateAngle'
property. It becomes the 'draw:text-rotate-angle' attribute of the
<draw:enhanced-geometry> element for a shape and 'style:rotate-angle'
for chart elements in ODF. It must also be used to simulate 'upright'
and is used for the 'rot' attribute in <txXfrm> of diagram shapes.

The 'moRotation' member is now only used for the 'TextPreRotateAngle'
property. That angle describes a rotation of the text without changing
the text area. Valid values are multiples of 90deg. It is used for
simulating vertical writing modes that are not yet implemented. It has
no corresponding attribute in ODF. To make the meaning clear in code,
the member is renamed to 'moTextPreRotation'.

MS Office recalutes a diagram on file opening from layout.xml and
data.xml. That is not yet implemented in LO, but we use drawing.xml,
which gives the state of the diagram at time of saving. The patch
handles the 'rot' attribute of <txXfrm> element as well. It has to be
mapped to moTextAreaRotation, because it might contain angles, which
are not multiples of 90deg, for example diagram 'Gear'.

The <off> and <ext> child elements of <txXfrm> describe the actual used
text area rectangle. The existing import calculates the difference of
the actual used text area rectangle to the predefined one and
incorporates it into the TextArea*Distance attributes. The patch adds
calculating the current values of the text area rectangle as it would
be using the preset markup. At that time in import there is no
SdrObjCustomShape object, thus we cannot use its GetTextBounds() method.
So it is down manually, covering most of those types, which are used in
diagrams of MS Office.

Remarks to unit tests:
Now the rotation introduced by txXfrm is no longer in
TextPreRotateAngle, but in TextRotateAngle. According changes are in
SdImportTest::testN86510_2
Test, testFdo87488

Now the correct preset text area rectangles are used. That requires
adaption of the needed distances. Done in
SdImportTest::testBnc870237()
SdImportTest::testTdf93830()
SdImportTestSmartArt::testTdf134221()

The buggy 'upright' export is fixed. Adaption in
ScExportTest2::testTdf137000_handle_upright()

Change-Id: I79df1559f88b76e96988fe745304dc4162de6316
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136447
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-07-20 08:16:03 +02:00
..
LockedCanvasContext.cxx almost nobody is using the oox::AttributeList::get methods properly 2022-06-24 10:40:19 +02:00
LockedCanvasContext.hxx
ShapeContextHandler.cxx
ShapeDrawingFragmentHandler.cxx
ShapeDrawingFragmentHandler.hxx
ShapeFilterBase.cxx
WpgContext.cxx
WpgContext.hxx
WpsContext.cxx tdf#149551 separate TextRotateAngle from TextPreRotateAngle 2022-07-20 08:16:03 +02:00
WpsContext.hxx