summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorGülşah Köse <gulsah.kose@collabora.com>2019-10-03 08:37:00 +0300
committerMiklos Vajna <vmiklos@collabora.com>2019-10-30 09:42:04 +0100
commit96d3c1ad905e4c694df4dccba51079b8f0a54d32 (patch)
tree0637576aca97e4e2f4ff74b99ac9b5f73ec2a444 /oox
parent09dfad2098d1737c0519c8ad74dd67b4292e73d1 (diff)
tdf#126060 Handle text camera z rotation while pptx import.
Reviewed-on: https://gerrit.libreoffice.org/80587 Tested-by: Jenkins Reviewed-by: Gülşah Köse <gulsah.kose@collabora.com> tdf#128209 Add check for crash handling 3D rotation. Handling text 3D z rotation works only for custom shapes. Prevent to use it for other services. Reviewed-on: https://gerrit.libreoffice.org/80974 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com> 49e0127419dbad8a75f1899db02115a2fe54aacd Change-Id: Ifa4589fb50affc4c5ffb52288db8533c98ec6dd9 Reviewed-on: https://gerrit.libreoffice.org/80928 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@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 048fb4610709..fe3be0c97de2 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 16b0c5b04824..7bb7b39e482b 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1372,7 +1372,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 44320afe0e87..a6b3f5471f3c 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -509,6 +509,7 @@ Text
TextAutoGrowHeight
TextBox
TextBreak
+TextCameraZRotateAngle
TextColor
TextFitToSize
TextFrames