From 193ecefaef948272695b0dd0a42a3bcc3256f631 Mon Sep 17 00:00:00 2001 From: Muthu Subramanian Date: Mon, 31 Mar 2014 15:04:31 +0530 Subject: n#862510: anchorCtr controls the anchoring as well. Ported from: c17eb67460293fbe72ffa8e80cd10743df493afa Change-Id: I7b5885c3ac9ec30970bdb8b2c9318dc181dda5bd --- oox/inc/oox/drawingml/textbodyproperties.hxx | 1 + oox/source/drawingml/textbodyproperties.cxx | 4 ++-- oox/source/drawingml/textbodypropertiescontext.cxx | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/oox/inc/oox/drawingml/textbodyproperties.hxx b/oox/inc/oox/drawingml/textbodyproperties.hxx index f8800be29659..c026b4e1d108 100644 --- a/oox/inc/oox/drawingml/textbodyproperties.hxx +++ b/oox/inc/oox/drawingml/textbodyproperties.hxx @@ -34,6 +34,7 @@ struct TextBodyProperties { PropertyMap maPropertyMap; OptValue< sal_Int32 > moRotation; + bool mbAnchorCtr; OptValue< sal_Int32 > moVert; boost::optional< sal_Int32 > moInsets[4]; boost::optional< sal_Int32 > moTextOffX; diff --git a/oox/source/drawingml/textbodyproperties.cxx b/oox/source/drawingml/textbodyproperties.cxx index 36f39d93953f..9e538973201e 100644 --- a/oox/source/drawingml/textbodyproperties.cxx +++ b/oox/source/drawingml/textbodyproperties.cxx @@ -80,8 +80,8 @@ void TextBodyProperties::pushRotationAdjustments( sal_Int32 nRotation ) // Hack for n#760986 // TODO: Preferred method would be to have a textbox on top // of the shape and the place it according to the (off,ext) - if( nOff == 0 && moTextOffX ) nVal = *moTextOffX; - if( nOff == 1 && moTextOffY ) nVal = *moTextOffY; + if( nOff == 0 && moTextOffX && mbAnchorCtr ) nVal = *moTextOffX; + if( nOff == 1 && moTextOffY && mbAnchorCtr ) nVal = *moTextOffY; if( nVal < 0 ) nVal = 0; if( moInsets[i] ) diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index 273c5cf63719..f8e0594bccf0 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -61,9 +61,9 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, mrTextBodyProp.moInsets[i] = GetCoordinate( sValue ); } - bool bAnchorCenter = aAttribs.getBool( XML_anchorCtr, false ); + mrTextBodyProp.mbAnchorCtr = aAttribs.getBool( XML_anchorCtr, false ); if( xAttributes->hasAttribute( XML_anchorCtr ) ) { - if( bAnchorCenter ) + if( mrTextBodyProp.mbAnchorCtr ) mrTextBodyProp.maPropertyMap[ PROP_TextHorizontalAdjust ] <<= TextHorizontalAdjust_CENTER; } -- cgit v1.2.3