Kaydet (Commit) 88b8bd64 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: #i119874 Fixed text alignment in RTL layout

This reverts commit 979def88,
this time manually confirmed that the import layout does change, but that it
appears to be all desirable changes

Change-Id: Iee5e5ebd16989f65569b02f8b4f6570985157dfc
üst 0cc22835
......@@ -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: */
......@@ -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();
......
<?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>
......
<?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>
......
<?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>
......
......@@ -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 ) )
......
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