diff options
-rw-r--r-- | filter/source/msfilter/svdfppt.cxx | 139 | ||||
-rw-r--r-- | include/filter/msfilter/svdfppt.hxx | 3 | ||||
-rw-r--r-- | sd/qa/unit/data/xml/fdo64586_0.xml | 4 | ||||
-rw-r--r-- | sd/qa/unit/data/xml/n758621_0.xml | 8 | ||||
-rw-r--r-- | sd/qa/unit/data/xml/n758621_1.xml | 8 | ||||
-rw-r--r-- | sd/source/filter/ppt/pptin.cxx | 2 |
6 files changed, 154 insertions, 10 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index e4e1ae13707c..91891c9c23c8 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -7627,4 +7627,143 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab return pRet; } +sal_Bool SdrPowerPointImport::IsVerticalText() const +{ + sal_Bool bVerticalText = sal_False; + if ( IsProperty( DFF_Prop_txflTextFlow ) ) + { + MSO_TextFlow eTextFlow = (MSO_TextFlow)( GetPropertyValue( DFF_Prop_txflTextFlow ) & 0xFFFF ); + switch( eTextFlow ) + { + case mso_txflTtoBA : // Top to Bottom @-font, above -> below + case mso_txflTtoBN : // Top to Bottom non-@, above -> below + case mso_txflVertN : // Vertical, non-@, above -> below + bVerticalText = !bVerticalText; + break; + default: break; + } + } + + return bVerticalText; +} + +void SdrPowerPointImport::ApplyTextAnchorAttributes( PPTTextObj& rTextObj, SfxItemSet& rSet ) const +{ + SdrTextVertAdjust eTVA; + SdrTextHorzAdjust eTHA; + + sal_uInt32 nTextFlags = rTextObj.GetTextFlags(); + + nTextFlags &= PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT + | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK; + + if ( IsVerticalText() ) + { + eTVA = SDRTEXTVERTADJUST_BLOCK; + eTHA = SDRTEXTHORZADJUST_CENTER; + + // Textverankerung lesen + MSO_Anchor eTextAnchor = (MSO_Anchor)GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop ); + + switch( eTextAnchor ) + { + case mso_anchorTop: + case mso_anchorTopCentered: + eTHA = SDRTEXTHORZADJUST_RIGHT; + break; + + case mso_anchorMiddle : + case mso_anchorMiddleCentered: + eTHA = SDRTEXTHORZADJUST_CENTER; + break; + + case mso_anchorBottom: + case mso_anchorBottomCentered: + eTHA = SDRTEXTHORZADJUST_LEFT; + break; + + default: + break; + } + // if there is a 100% use of following attributes, the textbox can been aligned also in vertical direction + switch ( eTextAnchor ) + { + case mso_anchorTopCentered : + case mso_anchorMiddleCentered : + case mso_anchorBottomCentered : + { + // check if it is sensible to use the centered alignment + sal_uInt32 nMask = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT; + if ( ( nTextFlags & nMask ) != nMask ) // if the textobject has left or also right aligned pararagraphs + eTVA = SDRTEXTVERTADJUST_CENTER; // the text has to be displayed using the full width; + } + break; + + default : + { + if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT ) + eTVA = SDRTEXTVERTADJUST_TOP; + else if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT ) + eTVA = SDRTEXTVERTADJUST_BOTTOM; + } + break; + } + } + else + { + eTVA = SDRTEXTVERTADJUST_CENTER; + eTHA = SDRTEXTHORZADJUST_BLOCK; + + // Textverankerung lesen + MSO_Anchor eTextAnchor = (MSO_Anchor)GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop ); + + switch( eTextAnchor ) + { + case mso_anchorTop: + case mso_anchorTopCentered: + eTVA = SDRTEXTVERTADJUST_TOP; + break; + + case mso_anchorMiddle : + case mso_anchorMiddleCentered: + eTVA = SDRTEXTVERTADJUST_CENTER; + break; + + case mso_anchorBottom: + case mso_anchorBottomCentered: + eTVA = SDRTEXTVERTADJUST_BOTTOM; + break; + + default: + break; + } + + // if there is a 100% usage of following attributes, the textbox can be aligned also in horizontal direction + switch ( eTextAnchor ) + { + case mso_anchorTopCentered : + case mso_anchorMiddleCentered : + case mso_anchorBottomCentered : + { + // check if it is sensible to use the centered alignment + sal_uInt32 nMask = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT; + if ( ( nTextFlags & nMask ) != nMask ) // if the textobject has left or also right aligned pararagraphs + eTHA = SDRTEXTHORZADJUST_CENTER; // the text has to be displayed using the full width; + } + break; + + default : + { + if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT ) + eTHA = SDRTEXTHORZADJUST_LEFT; + else if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT ) + eTHA = SDRTEXTHORZADJUST_RIGHT; + } + break; + } + } + rSet.Put( SdrTextVertAdjustItem( eTVA ) ); + rSet.Put( SdrTextHorzAdjustItem( eTHA ) ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx index c32b9de25556..4cba0ec06e30 100644 --- a/include/filter/msfilter/svdfppt.hxx +++ b/include/filter/msfilter/svdfppt.hxx @@ -573,6 +573,9 @@ protected: SdrOutliner* GetDrawOutliner( SdrTextObj* pSdrText ) const; void SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions ); + void ApplyTextAnchorAttributes( PPTTextObj& rTextObj, SfxItemSet& rSet ) const; + sal_Bool IsVerticalText() const; + public: SdrPowerPointImport( PowerPointImportParam&, const OUString& rBaseURL ); virtual ~SdrPowerPointImport(); diff --git a/sd/qa/unit/data/xml/fdo64586_0.xml b/sd/qa/unit/data/xml/fdo64586_0.xml index bcfa520ebbeb..ebd4b63c0bea 100644 --- a/sd/qa/unit/data/xml/fdo64586_0.xml +++ b/sd/qa/unit/data/xml/fdo64586_0.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <XShapes> - <XShape positionX="1397" positionY="963" sizeX="25197" sizeY="3507" type="com.sun.star.presentation.TitleTextShape" fontHeight="44.000000" fontColor="000000" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="3507" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName=""> + <XShape positionX="1397" positionY="838" sizeX="25197" sizeY="3507" type="com.sun.star.presentation.TitleTextShape" fontHeight="44.000000" fontColor="000000" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="3507" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" 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="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/> <FillHatch style="SINGLE" color="3465af" distance="20" angle="0"/> @@ -10,7 +10,7 @@ <LineEnd/> <Transformation> <Line1 column1="25198.000000" column2="0.000000" column3="1397.000000"/> - <Line2 column1="0.000000" column2="3508.000000" column3="963.000000"/> + <Line2 column1="0.000000" column2="3508.000000" column3="838.000000"/> <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/> </Transformation> </XShape> diff --git a/sd/qa/unit/data/xml/n758621_0.xml b/sd/qa/unit/data/xml/n758621_0.xml index b569f2307eb4..34a9de99f3d6 100644 --- a/sd/qa/unit/data/xml/n758621_0.xml +++ b/sd/qa/unit/data/xml/n758621_0.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <XShapes> - <XShape positionX="12042" positionY="1899" sizeX="12087" sizeY="9782" type="com.sun.star.presentation.TitleTextShape" fontHeight="60.000000" fontColor="004990" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="130" textLowerDistance="130" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="9522" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName=""> + <XShape positionX="12042" positionY="1774" sizeX="12087" sizeY="9782" type="com.sun.star.presentation.TitleTextShape" fontHeight="60.000000" fontColor="004990" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="130" textLowerDistance="130" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="9522" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" 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="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/> <FillHatch style="SINGLE" color="3465af" distance="20" angle="0"/> @@ -10,11 +10,11 @@ <LineEnd/> <Transformation> <Line1 column1="12088.000000" column2="0.000000" column3="12042.000000"/> - <Line2 column1="0.000000" column2="9783.000000" column3="1899.000000"/> + <Line2 column1="0.000000" column2="9783.000000" column3="1774.000000"/> <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/> </Transformation> </XShape> - <XShape positionX="14176" positionY="13248" sizeX="9953" sizeY="3811" type="com.sun.star.presentation.SubtitleShape" fontHeight="36.000000" fontColor="92d050" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="3811" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName=""> + <XShape positionX="14176" positionY="13123" sizeX="9953" sizeY="3811" type="com.sun.star.presentation.SubtitleShape" fontHeight="36.000000" fontColor="92d050" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="TOP" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="3811" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" 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="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/> <FillHatch style="SINGLE" color="3465af" distance="20" angle="0"/> @@ -24,7 +24,7 @@ <LineEnd/> <Transformation> <Line1 column1="9954.000000" column2="0.000000" column3="14176.000000"/> - <Line2 column1="0.000000" column2="3812.000000" column3="13248.000000"/> + <Line2 column1="0.000000" column2="3812.000000" column3="13123.000000"/> <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/> </Transformation> </XShape> diff --git a/sd/qa/unit/data/xml/n758621_1.xml b/sd/qa/unit/data/xml/n758621_1.xml index 689cc0028132..86e8294cb678 100644 --- a/sd/qa/unit/data/xml/n758621_1.xml +++ b/sd/qa/unit/data/xml/n758621_1.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <XShapes> - <XShape positionX="1485" positionY="629" sizeX="18411" sizeY="2166" type="com.sun.star.presentation.TitleTextShape" fontHeight="40.000000" fontColor="ff0000" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="130" textLowerDistance="130" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="1906" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName=""> + <XShape positionX="1485" positionY="504" sizeX="18411" sizeY="2166" type="com.sun.star.presentation.TitleTextShape" fontHeight="40.000000" fontColor="ff0000" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="130" textLowerDistance="130" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="1906" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" 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="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/> <FillHatch style="SINGLE" color="3465af" distance="20" angle="0"/> @@ -10,11 +10,11 @@ <LineEnd/> <Transformation> <Line1 column1="18412.000000" column2="0.000000" column3="1485.000000"/> - <Line2 column1="0.000000" column2="2167.000000" column3="629.000000"/> + <Line2 column1="0.000000" column2="2167.000000" column3="504.000000"/> <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/> </Transformation> </XShape> - <XShape positionX="1692" positionY="4444" sizeX="22217" sizeY="12312" type="com.sun.star.presentation.OutlinerShape" fontHeight="24.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="AUTOFIT" textHorizontalAdjust="LEFT" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="130" textLowerDistance="130" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="12062" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName=""> + <XShape positionX="1692" positionY="4444" sizeX="22217" sizeY="12061" type="com.sun.star.presentation.OutlinerShape" fontHeight="24.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="AUTOFIT" textHorizontalAdjust="LEFT" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="130" textLowerDistance="130" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="12062" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" 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="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/> <FillHatch style="SINGLE" color="3465af" distance="20" angle="0"/> @@ -24,7 +24,7 @@ <LineEnd/> <Transformation> <Line1 column1="22218.000000" column2="0.000000" column3="1692.000000"/> - <Line2 column1="0.000000" column2="12313.000000" column3="4444.000000"/> + <Line2 column1="0.000000" column2="12062.000000" column3="4444.000000"/> <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/> </Transformation> </XShape> diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 9e3eab593647..67a5e185e504 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -2391,6 +2391,8 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj SfxItemSet aSet( pSdrModel->GetItemPool() ); ApplyAttributes( rStCtrl, aSet ); + pPresObj->SetLogicRect(pText->GetLogicRect()); + ApplyTextAnchorAttributes( *pTextObj, aSet ); pPresObj->SetMergedItemSet(aSet); if ( ( eAktPageKind != PPT_NOTEPAGE ) && ( nPlacementId != 0xffffffff ) ) |