Kaydet (Commit) af686aa8 authored tarafından Andras Timar's avatar Andras Timar

bnc#902652 OOXML: fix import of insets when shape and/or shape text is rotated

5ac575ee did not get it right, the vert attribute (i.e. the
rotation of text) is relevant, not the rotation of the shape. In
that case both text and shape rotation were 270 degrees. I checked
that the bugdoc of bnc#773048 looked good after this.

Change-Id: I6e0401cd138a82040df82d7da1a47311db7771e4
Reviewed-on: https://gerrit.libreoffice.org/15076Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarAndras Timar <andras.timar@collabora.com>
üst 420acb53
......@@ -45,7 +45,7 @@ struct TextBodyProperties
explicit TextBodyProperties();
void pushRotationAdjustments( sal_Int32 nRotation );
void pushRotationAdjustments();
void pushVertSimulation();
};
......
......@@ -652,7 +652,7 @@ Reference< XShape > Shape::createAndInsert(
// add properties from textbody to shape properties
if( mpTextBody.get() )
{
mpTextBody->getTextProperties().pushRotationAdjustments( mnRotation );
mpTextBody->getTextProperties().pushRotationAdjustments();
aShapeProps.assignUsed( mpTextBody->getTextProperties().maPropertyMap );
// Push char properties as well - specifically useful when this is a placeholder
if( mpMasterTextListStyle && mpMasterTextListStyle->getListStyle()[0]->getTextCharacterProperties().moHeight.has() )
......
......@@ -58,17 +58,17 @@ void TextBodyProperties::pushVertSimulation()
}
/* Push adjusted values, taking into consideration Shape Rotation */
void TextBodyProperties::pushRotationAdjustments( sal_Int32 nRotation )
void TextBodyProperties::pushRotationAdjustments()
{
sal_Int32 nOff = 0;
sal_Int32 aProps[] = { PROP_TextLeftDistance, PROP_TextUpperDistance, PROP_TextRightDistance, PROP_TextLowerDistance };
sal_Int32 n = ( sal_Int32 )( sizeof( aProps ) / sizeof( sal_Int32 ) );
switch( nRotation ) // TODO: What happens for part rotations ?
switch( moRotation.get(0) )
{
case (90*1*60000): nOff = 1; break;
case (90*1*60000): nOff = 3; break;
case (90*2*60000): nOff = 2; break;
case (90*3*60000): nOff = 3; break;
case (90*3*60000): nOff = 1; break;
default: break;
}
......
<?xml version="1.0"?>
<XShapes>
<XShape positionX="899" positionY="9525" sizeX="9000" sizeY="4800" type="com.sun.star.drawing.CustomShape" name="Rounded Rectangle 3" text=" LibreOffice" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="3000" textRightDistance="500" textUpperDistance="300" textLowerDistance="3000" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="SOLID" fillColor="9bbb59" fillTransparence="0" fillTransparenceGradientName="">
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillGradient style="LINEAR" startColor="3465a4" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
<FillBitmap width="32" height="32"/>
<LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
<LineStart/>
<LineEnd/>
<Transformation>
<Line1 column1="0.000000" column2="4801.000000" column3="899.000000"/>
<Line2 column1="-9001.000000" column2="0.000000" column3="9525.000000"/>
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
</Transformation>
<CustomShapeGeometry>
<PropertyValue name="AdjustmentValues">
<AdjustmentValues>
<EnhancedCustomShapeAdjustmentValue value="16667" propertyState="DIRECT_VALUE"/>
</AdjustmentValues>
</PropertyValue>
<PropertyValue name="Equations" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="Handles" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="IsPostRotateAngle" value="true" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="MirroredX" value="false" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="MirroredY" value="false" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="Path">
<Path>
<PropertyValue name="Coordinates">
<Coordinates>
<EnhancedCustomShapeParameterPair>
<First value="0" type="0"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="12" type="1"/>
<Second value="13" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="3" type="1"/>
<Second value="0" type="0"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="14" type="1"/>
<Second value="15" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="11" type="1"/>
<Second value="4" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="16" type="1"/>
<Second value="17" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="10" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="18" type="1"/>
<Second value="19" type="1"/>
</EnhancedCustomShapeParameterPair>
</Coordinates>
</PropertyValue>
<PropertyValue name="Segments">
<Segments>
<EnhancedCustomShapeSegment command="1" count="1"/>
<EnhancedCustomShapeSegment command="17" count="1"/>
<EnhancedCustomShapeSegment command="2" count="1"/>
<EnhancedCustomShapeSegment command="17" count="1"/>
<EnhancedCustomShapeSegment command="2" count="1"/>
<EnhancedCustomShapeSegment command="17" count="1"/>
<EnhancedCustomShapeSegment command="2" count="1"/>
<EnhancedCustomShapeSegment command="17" count="1"/>
<EnhancedCustomShapeSegment command="4" count="0"/>
<EnhancedCustomShapeSegment command="5" count="0"/>
</Segments>
</PropertyValue>
<PropertyValue name="TextFrames" handle="0" propertyState="DIRECT_VALUE"/>
</Path>
</PropertyValue>
<PropertyValue name="TextPreRotateAngle" value="0" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="Type" value="ooxml-roundRect" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="ViewBox">
<ViewBox x="0" y="0" width="0" height="0"/>
</PropertyValue>
</CustomShapeGeometry>
</XShape>
<XShape positionX="15800" positionY="7848" sizeX="9000" sizeY="4800" type="com.sun.star.drawing.CustomShape" name="Rounded Rectangle 4" text=" LibreOffice" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="1000" textRightDistance="0" textUpperDistance="3000" textLowerDistance="300" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="SOLID" fillColor="9bbb59" fillTransparence="0" fillTransparenceGradientName="">
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillGradient style="LINEAR" startColor="3465a4" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
<FillBitmap width="32" height="32"/>
<LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
<LineStart/>
<LineEnd/>
<Transformation>
<Line1 column1="-9001.000000" column2="-0.000000" column3="15800.000000"/>
<Line2 column1="0.000000" column2="-4801.000000" column3="7848.000000"/>
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
</Transformation>
<CustomShapeGeometry>
<PropertyValue name="AdjustmentValues">
<AdjustmentValues>
<EnhancedCustomShapeAdjustmentValue value="16667" propertyState="DIRECT_VALUE"/>
</AdjustmentValues>
</PropertyValue>
<PropertyValue name="Equations" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="Handles" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="IsPostRotateAngle" value="true" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="MirroredX" value="false" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="MirroredY" value="false" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="Path">
<Path>
<PropertyValue name="Coordinates">
<Coordinates>
<EnhancedCustomShapeParameterPair>
<First value="0" type="0"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="12" type="1"/>
<Second value="13" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="3" type="1"/>
<Second value="0" type="0"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="14" type="1"/>
<Second value="15" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="11" type="1"/>
<Second value="4" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="16" type="1"/>
<Second value="17" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="10" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="18" type="1"/>
<Second value="19" type="1"/>
</EnhancedCustomShapeParameterPair>
</Coordinates>
</PropertyValue>
<PropertyValue name="Segments">
<Segments>
<EnhancedCustomShapeSegment command="1" count="1"/>
<EnhancedCustomShapeSegment command="17" count="1"/>
<EnhancedCustomShapeSegment command="2" count="1"/>
<EnhancedCustomShapeSegment command="17" count="1"/>
<EnhancedCustomShapeSegment command="2" count="1"/>
<EnhancedCustomShapeSegment command="17" count="1"/>
<EnhancedCustomShapeSegment command="2" count="1"/>
<EnhancedCustomShapeSegment command="17" count="1"/>
<EnhancedCustomShapeSegment command="4" count="0"/>
<EnhancedCustomShapeSegment command="5" count="0"/>
</Segments>
</PropertyValue>
<PropertyValue name="TextFrames" handle="0" propertyState="DIRECT_VALUE"/>
</Path>
</PropertyValue>
<PropertyValue name="TextPreRotateAngle" value="-90" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="Type" value="ooxml-roundRect" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="ViewBox">
<ViewBox x="0" y="0" width="0" height="0"/>
</PropertyValue>
</CustomShapeGeometry>
</XShape>
<XShape positionX="16224" positionY="14365" sizeX="9000" sizeY="4800" type="com.sun.star.drawing.CustomShape" name="Rounded Rectangle 5" text=" LibreOffice" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="0" textRightDistance="1000" textUpperDistance="900" textLowerDistance="3000" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="SOLID" fillColor="9bbb59" fillTransparence="0" fillTransparenceGradientName="">
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillGradient style="LINEAR" startColor="3465a4" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
<FillBitmap width="32" height="32"/>
<LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
<LineStart/>
<LineEnd/>
<Transformation>
<Line1 column1="-9001.000000" column2="-0.000000" column3="16224.000000"/>
<Line2 column1="0.000000" column2="-4801.000000" column3="14365.000000"/>
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
</Transformation>
<CustomShapeGeometry>
<PropertyValue name="AdjustmentValues">
<AdjustmentValues>
<EnhancedCustomShapeAdjustmentValue value="16667" propertyState="DIRECT_VALUE"/>
</AdjustmentValues>
</PropertyValue>
<PropertyValue name="Equations" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="Handles" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="IsPostRotateAngle" value="true" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="MirroredX" value="false" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="MirroredY" value="false" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="Path">
<Path>
<PropertyValue name="Coordinates">
<Coordinates>
<EnhancedCustomShapeParameterPair>
<First value="0" type="0"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="12" type="1"/>
<Second value="13" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="3" type="1"/>
<Second value="0" type="0"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="14" type="1"/>
<Second value="15" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="11" type="1"/>
<Second value="4" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="16" type="1"/>
<Second value="17" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="10" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="2" type="1"/>
<Second value="2" type="1"/>
</EnhancedCustomShapeParameterPair>
<EnhancedCustomShapeParameterPair>
<First value="18" type="1"/>
<Second value="19" type="1"/>
</EnhancedCustomShapeParameterPair>
</Coordinates>
</PropertyValue>
<PropertyValue name="Segments">
<Segments>
<EnhancedCustomShapeSegment command="1" count="1"/>
<EnhancedCustomShapeSegment command="17" count="1"/>
<EnhancedCustomShapeSegment command="2" count="1"/>
<EnhancedCustomShapeSegment command="17" count="1"/>
<EnhancedCustomShapeSegment command="2" count="1"/>
<EnhancedCustomShapeSegment command="17" count="1"/>
<EnhancedCustomShapeSegment command="2" count="1"/>
<EnhancedCustomShapeSegment command="17" count="1"/>
<EnhancedCustomShapeSegment command="4" count="0"/>
<EnhancedCustomShapeSegment command="5" count="0"/>
</Segments>
</PropertyValue>
<PropertyValue name="TextFrames" handle="0" propertyState="DIRECT_VALUE"/>
</Path>
</PropertyValue>
<PropertyValue name="TextPreRotateAngle" value="-270" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="Type" value="ooxml-roundRect" handle="0" propertyState="DIRECT_VALUE"/>
<PropertyValue name="ViewBox">
<ViewBox x="0" y="0" width="0" height="0"/>
</PropertyValue>
</CustomShapeGeometry>
</XShape>
</XShapes>
......@@ -179,6 +179,7 @@ void SdImportTest::testDocumentLayout()
{ "n762695.pptx", "xml/n762695_", PPTX, -1 },
{ "n593612.pptx", "xml/n593612_", PPTX, -1 },
{ "fdo71434.pptx", "xml/fdo71434_", PPTX, -1 },
{ "n902652.pptx", "xml/n902652_", PPTX, -1 },
// { "pptx/n828390.pptx", "pptx/xml/n828390_", PPTX, PPTX }, // Example
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment