[Libreoffice-commits] core.git: oox/source

Mark Hung marklh9 at gmail.com
Sat Nov 12 03:18:40 UTC 2016


 oox/source/drawingml/customshapegeometry.cxx   |    3 +++
 oox/source/drawingml/customshapeproperties.cxx |   18 ++++++++++++++++++
 2 files changed, 21 insertions(+)

New commits:
commit 4c742c4726e9dee47f6ae9fa3654bfb486b86e54
Author: Mark Hung <marklh9 at gmail.com>
Date:   Sun Nov 6 12:28:00 2016 +0800

    tdf#100733 oox: imports RefR and RefAngle of polar handles.
    
    RefR and RefAngle was ignored when importing polar
    handles for customshapes.
    
    Change-Id: I2d2aa1b0e54cf4946417c6dc81ecdbe58f6b50e9
    Reviewed-on: https://gerrit.libreoffice.org/30601
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mark Hung <marklh9 at gmail.com>

diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx
index 13a8198..56d00f322 100644
--- a/oox/source/drawingml/customshapegeometry.cxx
+++ b/oox/source/drawingml/customshapegeometry.cxx
@@ -706,6 +706,7 @@ PolarAdjustHandleContext::PolarAdjustHandleContext( ContextHandler2Helper& rPare
     const OUString aEmptyDefault;
     if ( rAttribs.hasAttribute( XML_gdRefR ) )
     {
+        mrAdjustHandle.polar = true ;
         mrAdjustHandle.gdRef1 = GetGeomGuideName( rAttribs.getString( XML_gdRefR, aEmptyDefault ) );
     }
     if ( rAttribs.hasAttribute( XML_minR ) )
@@ -718,6 +719,7 @@ PolarAdjustHandleContext::PolarAdjustHandleContext( ContextHandler2Helper& rPare
     }
     if ( rAttribs.hasAttribute( XML_gdRefAng ) )
     {
+        mrAdjustHandle.polar = true ;
         mrAdjustHandle.gdRef2 = GetGeomGuideName( rAttribs.getString( XML_gdRefAng, aEmptyDefault ) );
     }
     if ( rAttribs.hasAttribute( XML_minAng ) )
@@ -732,6 +734,7 @@ PolarAdjustHandleContext::PolarAdjustHandleContext( ContextHandler2Helper& rPare
 
 ContextHandlerRef PolarAdjustHandleContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
 {
+    // mrAdjustHandle.pos uses planar coordinates.
     if ( aElementToken == A_TOKEN( pos ) )
         return new AdjPoint2DContext( *this, rAttribs, mrCustomShapeProperties, mrAdjustHandle.pos );   // CT_AdjPoint2D
     return nullptr;
diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx
index 3ef04b4..5fddf19 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -328,7 +328,25 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi
             // adjustment value is decisive
             if ( maAdjustHandleList[ i ].polar )
             {
+                // Polar handles in DrawingML
+                // 1. don't have reference center, so PROP_Polar isn't needed.
+                // 2. position always use planar coordinates.
+                // 3. use RefAngle and RefR to specify adjustment value to be updated.
+                // 4. The unit of angular adjustment values are 6000th degree.
+
                 aHandle.setProperty( PROP_Position, maAdjustHandleList[ i ].pos);
+                if ( maAdjustHandleList[ i ].gdRef1.has() )
+                {
+                    sal_Int32 nIndex = GetCustomShapeGuideValue( maAdjustmentGuideList, maAdjustHandleList[ i ].gdRef1.get() );
+                    if ( nIndex >= 0 )
+                        aHandle.setProperty( PROP_RefR, nIndex);
+                }
+                if ( maAdjustHandleList[ i ].gdRef2.has() )
+                {
+                    sal_Int32 nIndex = GetCustomShapeGuideValue( maAdjustmentGuideList, maAdjustHandleList[ i ].gdRef2.get() );
+                    if ( nIndex >= 0 )
+                        aHandle.setProperty( PROP_RefAngle, nIndex);
+                }
                 if ( maAdjustHandleList[ i ].min1.has() )
                     aHandle.setProperty( PROP_RadiusRangeMinimum, maAdjustHandleList[ i ].min1.get());
                 if ( maAdjustHandleList[ i ].max1.has() )


More information about the Libreoffice-commits mailing list