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