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

n#773048: PPTX shape margins need to be rotated as well.

üst 919ec40f
......@@ -23,6 +23,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 {
......@@ -34,10 +35,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();
};
......
......@@ -516,7 +516,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() );
......
......@@ -58,6 +58,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
......
......@@ -53,25 +53,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 );
......
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