[Libreoffice-commits] .: 2 commits - oox/source

Radek Doulík rodo at kemper.freedesktop.org
Wed Dec 7 05:08:40 PST 2011


 oox/source/drawingml/customshapeproperties.cxx |   77 ++++++++++++++++++++++---
 1 file changed, 68 insertions(+), 9 deletions(-)

New commits:
commit e9877935b0d09c7a8321632632c440496a957b0c
Author: Radek Doulik <rodo at novell.com>
Date:   Wed Dec 7 13:37:12 2011 +0100

    pptx: make sure we set right type for connector shapes

diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx
index e0c1fd7..77eb296 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -167,8 +167,10 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi
             OSL_TRACE("connector shape: %s (%d)", USS(sConnectorShapeType), mnShapePresetType);
             //const uno::Reference < drawing::XShape > xShape( xPropSet, UNO_QUERY );
             Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( xShape, UNO_QUERY );
-            if( xDefaulter.is() )
+            if( xDefaulter.is() ) {
                 xDefaulter->createCustomShapeDefaults( sConnectorShapeType );
+                aPropertyMap[ PROP_Type ] <<= Any( sConnectorShapeType );
+            }
         }
         else if (maPresetsMap.find(mnShapePresetType) != maPresetsMap.end())
         {
@@ -229,7 +231,10 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi
                     }
                     else if ( aGeoPropSeq[ i ].Name.equals( sType ) )
                     {
-                        aGeoPropSeq[ i ].Value <<= CREATE_OUSTRING( "ooxml-CustomShape" );
+                        if ( sConnectorShapeType.getLength() > 0 )
+                            aGeoPropSeq[ i ].Value <<= sConnectorShapeType;
+                        else
+                            aGeoPropSeq[ i ].Value <<= CREATE_OUSTRING( "ooxml-CustomShape" );
                     }
                 }
             }
commit f0bf2a2ae95ddad3d08ddd1413ec56bf04224a94
Author: Radek Doulik <rodo at novell.com>
Date:   Thu Dec 1 12:13:33 2011 +0100

    do not use new presets for connector shapes
    
     - until we have better implementation

diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx
index 322043d..e0c1fd7 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -97,6 +97,56 @@ sal_Int32 CustomShapeProperties::GetCustomShapeGuideValue( const std::vector< Cu
 
 CustomShapeProperties::PresetsMap CustomShapeProperties::maPresetsMap;
 
+static OUString GetConnectorShapeType( sal_Int32 nType )
+{
+    OSL_TRACE("GetConnectorShapeType preset: %d %d", nType, XML_straightConnector1);
+
+    OUString sType;
+    switch( nType )
+    {
+        case XML_straightConnector1: {
+            static const OUString sStraightConnector1 = CREATE_OUSTRING( "mso-spt32" );
+            sType = sStraightConnector1;
+            } break;
+        case XML_bentConnector2: {
+            static const OUString sBentConnector2 = CREATE_OUSTRING( "mso-spt33" );
+            sType = sBentConnector2;
+            } break;
+        case XML_bentConnector3: {
+            static const OUString sBentConnector3 = CREATE_OUSTRING( "mso-spt34" );
+            sType = sBentConnector3;
+            } break;
+        case XML_bentConnector4: {
+            static const OUString sBentConnector4 = CREATE_OUSTRING( "mso-spt35" );
+            sType = sBentConnector4;
+            } break;
+        case XML_bentConnector5: {
+            static const OUString sBentConnector5 = CREATE_OUSTRING( "mso-spt36" );
+            sType = sBentConnector5;
+            } break;
+        case XML_curvedConnector2: {
+            static const OUString sCurvedConnector2 = CREATE_OUSTRING( "mso-spt37" );
+            sType = sCurvedConnector2;
+            } break;
+        case XML_curvedConnector3: {
+            static const OUString sCurvedConnector3 = CREATE_OUSTRING( "mso-spt38" );
+            sType = sCurvedConnector3;
+            } break;
+        case XML_curvedConnector4: {
+            static const OUString sCurvedConnector4 = CREATE_OUSTRING( "mso-spt39" );
+            sType = sCurvedConnector4;
+            } break;
+        case XML_curvedConnector5: {
+            static const OUString sCurvedConnector5 = CREATE_OUSTRING( "mso-spt40" );
+            sType = sCurvedConnector5;
+            } break;
+        default:
+            break;
+    }
+    return sType;
+}
+
+
 void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFilterBase */,
     const Reference < XPropertySet >& xPropSet, const Reference < XShape > & xShape )
 {
@@ -110,7 +160,18 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi
         PropertyMap aPropertyMap;
         PropertySet aPropSet( xPropSet );
 
-        if (maPresetsMap.find(mnShapePresetType) != maPresetsMap.end()) {
+        OUString sConnectorShapeType = GetConnectorShapeType( mnShapePresetType );
+
+        if (sConnectorShapeType.getLength() > 0)
+        {
+            OSL_TRACE("connector shape: %s (%d)", USS(sConnectorShapeType), mnShapePresetType);
+            //const uno::Reference < drawing::XShape > xShape( xPropSet, UNO_QUERY );
+            Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( xShape, UNO_QUERY );
+            if( xDefaulter.is() )
+                xDefaulter->createCustomShapeDefaults( sConnectorShapeType );
+        }
+        else if (maPresetsMap.find(mnShapePresetType) != maPresetsMap.end())
+        {
             OSL_TRACE("found property map for preset: %s (%d)", USS(getShapePresetTypeName()), mnShapePresetType);
 
             aPropertyMap = maPresetsMap[ mnShapePresetType ];
@@ -118,13 +179,6 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi
             aPropertyMap.dumpCode();
 #endif
         }
-        else
-        {
-            //const uno::Reference < drawing::XShape > xShape( xPropSet, UNO_QUERY );
-            Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( xShape, UNO_QUERY );
-            if( xDefaulter.is() )
-                xDefaulter->createCustomShapeDefaults( getShapePresetTypeName() );
-        }
 
         aPropertyMap[ PROP_MirroredX ] <<= Any( mbMirroredX );
         aPropertyMap[ PROP_MirroredY ] <<= Any( mbMirroredY );


More information about the Libreoffice-commits mailing list