Kaydet (Commit) 5c4d1b05 authored tarafından Muthu Subramanian's avatar Muthu Subramanian

n#734734: Text rotation fixes.

PPTX would need rotation of text _inside_ text/object
boundaries, rather than the rotation of the text/object itself.
üst ee24a236
......@@ -154,7 +154,7 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi
aPropertyMap[ PROP_MirroredX ] <<= Any( mbMirroredX );
aPropertyMap[ PROP_MirroredY ] <<= Any( mbMirroredY );
aPropertyMap[ PROP_TextRotateAngle ] <<= Any( mnTextRotateAngle );
aPropertyMap[ PROP_TextPreRotateAngle ] <<= Any( mnTextRotateAngle );
Sequence< PropertyValue > aSeq = aPropertyMap.makePropertyValueSequence();
aPropSet.setProperty( PROP_CustomShapeGeometry, aSeq );
......
......@@ -119,6 +119,12 @@ Reference< XFastContextHandler > ShapeContext::createFastChildContext( sal_Int32
xRet = new TextBodyContext( *this, *xTextBody );
break;
}
case XML_txXfrm:
{
AttributeList aAttribs( xAttribs );
mpShapePtr->getTextBody()->getTextProperties().moRotation = aAttribs.getInteger( XML_rot );
break;
}
}
if( !xRet.is() )
......
......@@ -218,6 +218,12 @@ Reference< XFastContextHandler > PPTShapeContext::createFastChildContext( sal_In
xRet = new oox::drawingml::TextBodyContext( *this, *xTextBody );
break;
}
case PPT_TOKEN( txXfrm ):
{
AttributeList aAttribs( xAttribs );
mpShapePtr->getTextBody()->getTextProperties().moRotation = aAttribs.getInteger( XML_rot );
break;
}
}
if( !xRet.is() )
......
......@@ -457,6 +457,7 @@ TextHorizontalAdjust
TextLeftDistance
TextLowerDistance
TextOverlap
TextPreRotateAngle
TextRightDistance
TextRotateAngle
TextRotation
......
......@@ -5334,6 +5334,7 @@ txOverObj
txPr
txSp
txStyles
txXfrm
txbxContent
txtBox
ty
......
......@@ -149,7 +149,7 @@ public:
void SetMirroredY( const sal_Bool bMirroredY );
double GetObjectRotation() const;
double GetExtraTextRotation() const;
double GetExtraTextRotation( const bool bPreRotation = false ) const;
TYPEINFO();
SdrObjCustomShape();
......
......@@ -160,6 +160,14 @@ namespace sdr
// #i101684# get the text range unrotated and absolute to the object range
const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect());
// Rotation before scaling
if(!basegfx::fTools::equalZero(GetCustomShapeObj().GetExtraTextRotation(true)))
{
basegfx::B2DVector aTranslation(0.5, 0.5);
aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() );
aTextBoxMatrix.rotate((360.0 - GetCustomShapeObj().GetExtraTextRotation(true)) * F_PI180);
aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() );
}
// give text object a size
aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight());
......
......@@ -537,12 +537,13 @@ double SdrObjCustomShape::GetObjectRotation() const
return fObjectRotation;
}
double SdrObjCustomShape::GetExtraTextRotation() const
double SdrObjCustomShape::GetExtraTextRotation( const bool bPreRotation ) const
{
const com::sun::star::uno::Any* pAny;
SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
const rtl::OUString sTextRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "TextRotateAngle" ) );
pAny = rGeometryItem.GetPropertyValueByName( sTextRotateAngle );
const rtl::OUString sTextPreRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "TextPreRotateAngle" ) );
pAny = rGeometryItem.GetPropertyValueByName( bPreRotation ? sTextPreRotateAngle : sTextRotateAngle );
double fExtraTextRotateAngle = 0.0;
if ( pAny )
*pAny >>= fExtraTextRotateAngle;
......
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