[Libreoffice-commits] .: Branch 'libreoffice-3-5' - oox/source svx/inc svx/source

2012-04-09 Thread Ivan Timofeev
 oox/source/drawingml/customshapeproperties.cxx|1 +
 oox/source/token/properties.txt   |1 +
 svx/inc/svx/EnhancedCustomShape2d.hxx |1 +
 svx/inc/svx/svdoashp.hxx  |1 +
 svx/source/customshapes/EnhancedCustomShape2d.cxx |5 +
 svx/source/customshapes/EnhancedCustomShapeEngine.cxx |   10 --
 svx/source/svdraw/svdoashp.cxx|   12 
 7 files changed, 29 insertions(+), 2 deletions(-)

New commits:
commit d2e74fcd33c36d190c0cefa9615e810e2e713a24
Author: Muthu Subramanian 
Date:   Mon Apr 9 18:24:11 2012 +0530

fdo43752: PPTX import fix affected odp imports.

Related bugs: n#719989, n#719997
(cherry picked from commit 1c44b263d789b4c20e9178c6432300e301df94d6)

Signed-off-by: Ivan Timofeev 

diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index 1b0cac2..020d87a 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -158,6 +158,7 @@ void CustomShapeProperties::pushToPropSet( const 
::oox::core::FilterBase& /* rFi
 aPropertyMap[ PROP_MirroredX ] <<= Any( mbMirroredX );
 aPropertyMap[ PROP_MirroredY ] <<= Any( mbMirroredY );
 aPropertyMap[ PROP_TextPreRotateAngle ] <<= Any( mnTextRotateAngle );
+aPropertyMap[ PROP_IsPostRotateAngle ] <<= true; // For OpenXML Imports
 Sequence< PropertyValue > aSeq = 
aPropertyMap.makePropertyValueSequence();
 aPropSet.setProperty( PROP_CustomShapeGeometry, aSeq );
 
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index b754f1d..0cc7bf4 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -242,6 +242,7 @@ IsLoaded
 IsNumbering
 IsOutlineSymbolsSet
 IsPlaceholderDependent
+IsPostRotateAngle
 IsSharedFormula
 IsStartOfNewPage
 IsTextWrapped
diff --git a/svx/inc/svx/EnhancedCustomShape2d.hxx 
b/svx/inc/svx/EnhancedCustomShape2d.hxx
index 415385c..0d9da95 100644
--- a/svx/inc/svx/EnhancedCustomShape2d.hxx
+++ b/svx/inc/svx/EnhancedCustomShape2d.hxx
@@ -182,6 +182,7 @@ class EnhancedCustomShape2d : public SfxItemSet
 sal_BoolIsFlipVert() { return bFlipV; };
 sal_BoolIsFlipHorz() { return bFlipH; };
 sal_Int32   GetRotateAngle() { return nRotateAngle; };
+SVX_DLLPUBLIC bool  IsPostRotate() const;
 
 SVX_DLLPUBLIC SdrObject*CreateLineGeometry();
 SVX_DLLPUBLIC SdrObject*CreateObject( sal_Bool 
bLineGeometryNeededOnly );
diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx
index 013e150..0f54019 100644
--- a/svx/inc/svx/svdoashp.hxx
+++ b/svx/inc/svx/svdoashp.hxx
@@ -145,6 +145,7 @@ public:
 
 sal_Bool IsMirroredX() const;
 sal_Bool IsMirroredY() const;
+bool IsPostRotate() const;
 void SetMirroredX( const sal_Bool bMirroredX );
 void SetMirroredY( const sal_Bool bMirroredY );
 
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx 
b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 3e5f340..d0fa902 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2330,6 +2330,11 @@ void EnhancedCustomShape2d::ApplyGluePoints( SdrObject* 
pObj )
 }
 }
 
+bool EnhancedCustomShape2d::IsPostRotate() const
+{
+return pCustomShapeObj->ISA( SdrObjCustomShape ) ? 
((SdrObjCustomShape*)pCustomShapeObj)->IsPostRotate() : false;
+}
+
 SdrObject* EnhancedCustomShape2d::CreateLineGeometry()
 {
 return CreateObject( sal_True );
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx 
b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index a92a962..b8a2be0 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -276,6 +276,7 @@ REF( com::sun::star::drawing::XShape ) SAL_CALL 
EnhancedCustomShapeEngine::rende
 
 EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
 sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
+bool bPostRotateAngle = aCustomShape2d.IsPostRotate();
 
 sal_Bool bFlipV = aCustomShape2d.IsFlipVert();
 sal_Bool bFlipH = aCustomShape2d.IsFlipHorz();
@@ -315,6 +316,11 @@ REF( com::sun::star::drawing::XShape ) SAL_CALL 
EnhancedCustomShapeEngine::rende
 }
 pRenderedShape->Shear( 
pSdrObjCustomShape->GetSnapRect().Center(), nShearWink, nTan, sal_False);
 }
+if( !bPostRotateAngle && nRotateAngle )
+{
+double a = nRotateAngle * F_PI18000;
+pRenderedShape->NbcRotate( 
pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a ) );
+}
 if ( bFlipV )

[Libreoffice-commits] .: Branch 'libreoffice-3-5' - oox/source svx/inc svx/source

2012-01-11 Thread Muthu Subramanian
 oox/source/drawingml/customshapeproperties.cxx|2 +-
 oox/source/drawingml/shapecontext.cxx |6 ++
 oox/source/ppt/pptshapecontext.cxx|6 ++
 oox/source/token/properties.txt   |1 +
 oox/source/token/tokens.txt   |1 +
 svx/inc/svx/svdoashp.hxx  |2 +-
 svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx |8 
 svx/source/svdraw/svdoashp.cxx|5 +++--
 8 files changed, 27 insertions(+), 4 deletions(-)

New commits:
commit 0b63bb1d5f37ad673b0aadefe4bfe1e61ae667b9
Author: Muthu Subramanian 
Date:   Wed Jan 11 15:24:27 2012 +0530

n#734734: Text rotation fixes.

PPTX would need rotation of text _inside_ text/object
boundaries, rather than the rotation of the text/object itself.

cherrypick: 5c4d1b05faa8a3d704fc74a186a173f8cc019cc1

diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index 5da446a..a03e42c 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -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 );
 
diff --git a/oox/source/drawingml/shapecontext.cxx 
b/oox/source/drawingml/shapecontext.cxx
index f613e89..389bfac 100644
--- a/oox/source/drawingml/shapecontext.cxx
+++ b/oox/source/drawingml/shapecontext.cxx
@@ -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() )
diff --git a/oox/source/ppt/pptshapecontext.cxx 
b/oox/source/ppt/pptshapecontext.cxx
index dce07b8..cc62b82 100644
--- a/oox/source/ppt/pptshapecontext.cxx
+++ b/oox/source/ppt/pptshapecontext.cxx
@@ -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() )
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 65d2cb0..50c46bd 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -457,6 +457,7 @@ TextHorizontalAdjust
 TextLeftDistance
 TextLowerDistance
 TextOverlap
+TextPreRotateAngle
 TextRightDistance
 TextRotateAngle
 TextRotation
diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index 594468e..cec24b5 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -5334,6 +5334,7 @@ txOverObj
 txPr
 txSp
 txStyles
+txXfrm
 txbxContent
 txtBox
 ty
diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx
index 3d91549..013e150 100644
--- a/svx/inc/svx/svdoashp.hxx
+++ b/svx/inc/svx/svdoashp.hxx
@@ -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();
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx 
b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index 2e63da2..85628ca 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -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((