summaryrefslogtreecommitdiffstats
path: root/oox
diff options
context:
space:
mode:
authorGülşah Köse <gulsah.kose@collabora.com>2019-10-03 08:37:00 +0300
committerAndras Timar <andras.timar@collabora.com>2019-10-18 10:08:13 +0200
commit946ac247c2cf02f48b6a8009064e0763fd9e97af (patch)
tree8772585ba6b326faf0aa73fb67a6608ca77babc4 /oox
parentchart2: Move some headers to inc (diff)
downloadcore-946ac247c2cf02f48b6a8009064e0763fd9e97af.tar.gz
core-946ac247c2cf02f48b6a8009064e0763fd9e97af.zip
tdf#126060 Handle text camera z rotation while pptx import.
Change-Id: Ifa4589fb50affc4c5ffb52288db8533c98ec6dd9 Reviewed-on: https://gerrit.libreoffice.org/80587 Tested-by: Jenkins Reviewed-by: Gülşah Köse <gulsah.kose@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/80891 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/drawingml/customshapeproperties.hxx2
-rw-r--r--oox/source/drawingml/customshapeproperties.cxx2
-rw-r--r--oox/source/drawingml/shape.cxx4
-rw-r--r--oox/source/drawingml/textbodypropertiescontext.cxx7
-rw-r--r--oox/source/token/properties.txt1
5 files changed, 16 insertions, 0 deletions
diff --git a/oox/inc/drawingml/customshapeproperties.hxx b/oox/inc/drawingml/customshapeproperties.hxx
index ddd29199ff41..5ac65ad5b799 100644
--- a/oox/inc/drawingml/customshapeproperties.hxx
+++ b/oox/inc/drawingml/customshapeproperties.hxx
@@ -118,6 +118,7 @@ public:
void setMirroredX( bool bMirroredX ) { mbMirroredX = bMirroredX; };
void setMirroredY( bool bMirroredY ) { mbMirroredY = bMirroredY; };
void setTextRotateAngle( sal_Int32 nAngle ) { mnTextRotateAngle = nAngle; };
+ void setTextCameraZRotateAngle( sal_Int32 nAngle ) { mnTextCameraZRotateAngle = nAngle; };
static sal_Int32 SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide );
static sal_Int32 GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, const OUString& rFormulaName );
@@ -140,6 +141,7 @@ private:
bool mbMirroredX;
bool mbMirroredY;
sal_Int32 mnTextRotateAngle;
+ sal_Int32 mnTextCameraZRotateAngle;
typedef std::unordered_map< sal_Int32, PropertyMap > PresetDataMap;
diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx
index 323831166f59..1b1f6513ab22 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -46,6 +46,7 @@ CustomShapeProperties::CustomShapeProperties()
, mbMirroredX ( false )
, mbMirroredY ( false )
, mnTextRotateAngle ( 0 )
+, mnTextCameraZRotateAngle ( 0 )
, mnArcNum ( 0 )
{
}
@@ -150,6 +151,7 @@ void CustomShapeProperties::pushToPropSet(
aPropertyMap.setProperty( PROP_MirroredX, mbMirroredX );
aPropertyMap.setProperty( PROP_MirroredY, mbMirroredY );
aPropertyMap.setProperty( PROP_TextPreRotateAngle, mnTextRotateAngle );
+ aPropertyMap.setProperty( PROP_TextCameraZRotateAngle, mnTextCameraZRotateAngle );
Sequence< PropertyValue > aSeq = aPropertyMap.makePropertyValueSequence();
aPropSet.setProperty( PROP_CustomShapeGeometry, aSeq );
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 23e9537f4b32..93619d0e7642 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1320,7 +1320,11 @@ Reference< XShape > const & Shape::createAndInsert(
mpCustomShapePropertiesPtr->setMirroredY( true );
if( getTextBody() )
{
+ sal_Int32 nTextCameraZRotation = static_cast< sal_Int32 >( get3DProperties().maCameraRotation.mnRevolution.get() );
+ mpCustomShapePropertiesPtr->setTextCameraZRotateAngle( nTextCameraZRotation / 60000 );
+
sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.get( 0 ) );
+
nTextRotateAngle -= mnDiagramRotation;
/* OOX measures text rotation clockwise in 1/60000th degrees,
relative to the containing shape. setTextRotateAngle wants
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx
index 9c18536a4a86..4e0a5ca5a297 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -27,6 +27,7 @@
#include <drawingml/textbodyproperties.hxx>
#include <drawingml/textbody.hxx>
#include <drawingml/customshapegeometry.hxx>
+#include <drawingml/scene3dcontext.hxx>
#include <oox/drawingml/drawingmltypes.hxx>
#include <oox/helper/attributelist.hxx>
#include <oox/helper/propertymap.hxx>
@@ -170,6 +171,12 @@ ContextHandlerRef TextBodyPropertiesContext::onCreateContext( sal_Int32 aElement
break;
case A_TOKEN( scene3d ): // CT_Scene3D
+ {
+ if(mpShapePtr && mpShapePtr->getServiceName() == "com.sun.star.drawing.CustomShape")
+ return new Scene3DPropertiesContext( *this, mpShapePtr->get3DProperties() );
+
+ break;
+ }
// EG_Text3D
case A_TOKEN( sp3d ): // CT_Shape3D
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 1b06aa741d94..7b107ffc4aec 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -507,6 +507,7 @@ Text
TextAutoGrowHeight
TextBox
TextBreak
+TextCameraZRotateAngle
TextColor
TextFitToSize
TextFrames