summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@suse.com>2012-08-16 16:57:47 +0530
committerMuthu Subramanian K <sumuthu@suse.com>2012-10-13 13:23:54 +0530
commitb1653c6b3968921ffee34bab2106c6d4e800179c (patch)
treeca77908c2fa47e055a020563498d0bc543a761f0 /oox
parentd3d19085e3b1132c7aad9767b20e76d0ac7c6cd3 (diff)
n#773048: PPTX shape margins need to be rotated as well.
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/drawingml/textbodyproperties.hxx3
-rw-r--r--oox/source/drawingml/shape.cxx3
-rw-r--r--oox/source/drawingml/textbodyproperties.cxx22
-rw-r--r--oox/source/drawingml/textbodypropertiescontext.cxx25
4 files changed, 34 insertions, 19 deletions
diff --git a/oox/inc/oox/drawingml/textbodyproperties.hxx b/oox/inc/oox/drawingml/textbodyproperties.hxx
index adb9c1fb84bc..addad6e5c975 100644
--- a/oox/inc/oox/drawingml/textbodyproperties.hxx
+++ b/oox/inc/oox/drawingml/textbodyproperties.hxx
@@ -32,6 +32,7 @@
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include "oox/helper/helper.hxx"
#include "oox/helper/propertymap.hxx"
+#include <boost/optional.hpp>
namespace oox {
namespace drawingml {
@@ -43,10 +44,12 @@ struct TextBodyProperties
PropertyMap maPropertyMap;
OptValue< sal_Int32 > moRotation;
OptValue< sal_Int32 > moVert;
+ boost::optional< sal_Int32 > moInsets[4];
::com::sun::star::drawing::TextVerticalAdjust meVA;
explicit TextBodyProperties();
+ void pushRotationAdjustments( sal_Int32 nRotation );
void pushVertSimulation();
};
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 66a1ee16005d..242dd43d5ac5 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -525,7 +525,10 @@ Reference< XShape > Shape::createAndInsert(
// add properties from textbody to shape properties
if( mpTextBody.get() )
+ {
+ mpTextBody->getTextProperties().pushRotationAdjustments( mnRotation );
aShapeProps.assignUsed( mpTextBody->getTextProperties().maPropertyMap );
+ }
// applying properties
aShapeProps.assignUsed( getShapeProperties() );
diff --git a/oox/source/drawingml/textbodyproperties.cxx b/oox/source/drawingml/textbodyproperties.cxx
index d00764770e12..8438ed5afc55 100644
--- a/oox/source/drawingml/textbodyproperties.cxx
+++ b/oox/source/drawingml/textbodyproperties.cxx
@@ -67,6 +67,28 @@ void TextBodyProperties::pushVertSimulation()
}
}
+/* Push adjusted values, taking into consideration Shape Rotation */
+void TextBodyProperties::pushRotationAdjustments( sal_Int32 nRotation )
+{
+ sal_Int32 nOff = 0;
+ sal_Int32 aProps[] = { PROP_TextLeftDistance, PROP_TextUpperDistance, PROP_TextRightDistance, PROP_TextLowerDistance };
+ sal_Int32 n = ( sal_Int32 )( sizeof( aProps ) / sizeof( sal_Int32 ) );
+
+ switch( nRotation ) // TODO: What happens for part rotations ?
+ {
+ case (90*1*60000): nOff = 1; break;
+ case (90*2*60000): nOff = 2; break;
+ case (90*3*60000): nOff = 3; break;
+ default: break;
+ }
+
+ for( sal_Int32 i = 0; i < n; i++ )
+ {
+ if( moInsets[i] )
+ maPropertyMap[ aProps[ ( nOff++ ) % n ] ] <<= static_cast< sal_Int32 >( *moInsets[i] );
+ }
+}
+
// ============================================================================
} // namespace drawingml
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx
index a654fb6f96dd..711da4c88713 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -63,25 +63,12 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent,
// ST_Coordinate
OUString sValue;
- sValue = xAttributes->getOptionalValue( XML_lIns );
- if( !sValue.isEmpty() ) {
- sal_Int32 nLeftInset = ( !sValue.isEmpty() ? GetCoordinate( sValue ) : 91440 / 360 );
- mrTextBodyProp.maPropertyMap[ PROP_TextLeftDistance ] <<= static_cast< sal_Int32 >( nLeftInset );
- }
- sValue = xAttributes->getOptionalValue( XML_tIns );
- if( !sValue.isEmpty() ) {
- sal_Int32 nTopInset = ( !sValue.isEmpty() ? GetCoordinate( sValue ) : 91440 / 360 );
- mrTextBodyProp.maPropertyMap[ PROP_TextUpperDistance ] <<= static_cast< sal_Int32 >( nTopInset );
- }
- sValue = xAttributes->getOptionalValue( XML_rIns );
- if( !sValue.isEmpty() ) {
- sal_Int32 nRightInset = ( !sValue.isEmpty() ? GetCoordinate( sValue ) : 91440 / 360 );
- mrTextBodyProp.maPropertyMap[ PROP_TextRightDistance ] <<= static_cast< sal_Int32 >( nRightInset );
- }
- sValue = xAttributes->getOptionalValue( XML_bIns );
- if( !sValue.isEmpty() ) {
- sal_Int32 nBottonInset = ( !sValue.isEmpty() ? GetCoordinate( sValue ) : 45720 / 360 );
- mrTextBodyProp.maPropertyMap[ PROP_TextLowerDistance ] <<= static_cast< sal_Int32 >( nBottonInset );
+ sal_Int32 aIns[] = { XML_lIns, XML_tIns, XML_rIns, XML_bIns };
+ for( sal_Int32 i = 0; i < ( sal_Int32 )( sizeof( aIns ) / sizeof( sal_Int32 ) ); i++)
+ {
+ sValue = xAttributes->getOptionalValue( aIns[i] );
+ if( !sValue.isEmpty() )
+ mrTextBodyProp.moInsets[i] = GetCoordinate( sValue );
}
bool bAnchorCenter = aAttribs.getBool( XML_anchorCtr, false );