oox/inc/oox/ppt/pptshape.hxx                |    2 ++
 oox/source/ppt/animationspersist.cxx        |   10 ++++++++--
 oox/source/ppt/pptshape.cxx                 |   13 +++++++++++--
 oox/source/ppt/pptshapegroupcontext.cxx     |    3 ++-
 oox/source/ppt/timetargetelementcontext.cxx |    6 ++++++
 5 files changed, 29 insertions(+), 5 deletions(-)

New commits:
commit 84de950a6f393e3c9a74624f683affd31864e53c
Author: Thorsten Behrens <tbehr...@suse.com>
Date:   Fri Apr 26 13:25:11 2013 +0200

    Fix bnc#705982 - make animations inside SmartArt work.
    
    With the fallback loading of extDrawing for SmartArt graphics,
    slideshow animations into that drawingml fragment didn't work -
    for it being modelId diagram references instead of plain shape IDs.
    
    So use the modelId if present, and only then fallback to shape id.
    
    Conflicts:
        oox/source/ppt/animationspersist.cxx
    
    Change-Id: Iac2b8bc16255611d7ab165b72fb251cd2a65073a

diff --git a/oox/inc/oox/ppt/pptshape.hxx b/oox/inc/oox/ppt/pptshape.hxx
index aa485ad..2a15dcd 100644
--- a/oox/inc/oox/ppt/pptshape.hxx
+++ b/oox/inc/oox/ppt/pptshape.hxx
@@ -27,6 +27,7 @@ namespace oox { namespace ppt {
 
 class PPTShape : public oox::drawingml::Shape
 {
+    OUString                    msModelId;              // fallback dgs 
smartart shape reference
     ShapeLocation               meShapeLocation;        // placeholdershapes 
(mnSubType != 0) on Master are never displayed
     sal_Bool                    mbReferenced;           // placeholdershapes 
on Layout are displayed only, if they are not referenced
                                                         // placeholdershapes 
on Slide are displayed always
@@ -55,6 +56,7 @@ public:
     sal_Bool isReferenced() const { return mbReferenced; };
     void setReferenced( sal_Bool bReferenced ){ mbReferenced = bReferenced; };
     void setPlaceholder( oox::drawingml::ShapePtr pPlaceholder ) { 
mpPlaceholder = pPlaceholder; }
+    void setModelId( const OUString& rId ) { msModelId = rId; }
 
     static oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 
nMasterPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes, bool 
bMasterOnly = false );
     static oox::drawingml::ShapePtr findPlaceholderByIndex( const sal_Int32 
nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly = 
false );
diff --git a/oox/source/ppt/animationspersist.cxx 
b/oox/source/ppt/animationspersist.cxx
index bf2a53a..d2d79ab 100644
--- a/oox/source/ppt/animationspersist.cxx
+++ b/oox/source/ppt/animationspersist.cxx
@@ -98,9 +98,15 @@ namespace oox { namespace ppt {
             break;
         case XML_spTgt:
         {
+            OUString sShapeName = msValue;
+
+            // bnc#705982 - catch referenced diagram fallback shapes
+            if( maShapeTarget.mnType == XML_dgm )
+                sShapeName = maShapeTarget.msSubShapeId;
+
             Any rTarget;
-            ::oox::drawingml::ShapePtr pShape = pSlide->getShape(msValue);
-            OSL_ENSURE( pShape, "failed to locate Shape");
+            ::oox::drawingml::ShapePtr pShape = pSlide->getShape(sShapeName);
+            SAL_WARN_IF( !pShape, "oox.ppt", "failed to locate Shape");
             if( pShape )
             {
                 Reference< XShape > xShape( pShape->getXShape() );
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index c0764e5..de0cdae 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -351,9 +351,18 @@ void PPTShape::addShape(
 
                     }
                 }
-                if( pShapeMap && !msId.isEmpty() )
+                if( pShapeMap )
                 {
-                    (*pShapeMap)[ msId ] = shared_from_this();
+                    // bnc#705982 - if optional model id reference is
+                    // there, use that to obtain target shape
+                    if( !msModelId.isEmpty() )
+                    {
+                        (*pShapeMap)[ msModelId ] = shared_from_this();
+                    }
+                    else if( !msId.isEmpty() )
+                    {
+                        (*pShapeMap)[ msId ] = shared_from_this();
+                    }
                 }
 
                 // if this is a group shape, we have to add also each child 
shape
diff --git a/oox/source/ppt/pptshapegroupcontext.cxx 
b/oox/source/ppt/pptshapegroupcontext.cxx
index 9ade8fa..5a4e166 100644
--- a/oox/source/ppt/pptshapegroupcontext.cxx
+++ b/oox/source/ppt/pptshapegroupcontext.cxx
@@ -102,7 +102,7 @@ Reference< XFastContextHandler > 
PPTShapeGroupContext::createFastChildContext( s
     case PPT_TOKEN( sp ):           // Shape
         {
             AttributeList aAttribs( xAttribs );
-            oox::drawingml::ShapePtr pShape = oox::drawingml::ShapePtr( new 
PPTShape( meShapeLocation, "com.sun.star.drawing.CustomShape" ) );
+            boost::shared_ptr<PPTShape> pShape( new PPTShape( meShapeLocation, 
"com.sun.star.drawing.CustomShape" ) );
             if( aAttribs.getBool( XML_useBgFill, false ) )
             {
                 ::oox::drawingml::FillProperties &aFill = 
pShape->getFillProperties();
@@ -111,6 +111,7 @@ Reference< XFastContextHandler > 
PPTShapeGroupContext::createFastChildContext( s
                 // TODO: We are using white here, because thats the closest we 
can assume (?)
                 aFill.maFillColor.setSrgbClr( API_RGB_WHITE );
             }
+            pShape->setModelId(xAttribs->getOptionalValue( XML_modelId ));
             xRet.set( new PPTShapeContext( *this, mpSlidePersistPtr, 
mpGroupShapePtr, pShape ) );
         }
         break;
diff --git a/oox/source/ppt/timetargetelementcontext.cxx 
b/oox/source/ppt/timetargetelementcontext.cxx
index ed6fbab..5068304 100644
--- a/oox/source/ppt/timetargetelementcontext.cxx
+++ b/oox/source/ppt/timetargetelementcontext.cxx
@@ -67,6 +67,12 @@ namespace oox { namespace ppt {
                     maShapeTarget.msSubShapeId = rAttribs.getString( XML_spid, 
OUString() );
                     return this;
                 case PPT_TOKEN( graphicEl ):
+                    return this; // needs a:dgm for the target
+                case A_TOKEN( dgm ):
+                    bTargetSet = true;
+                    maShapeTarget.mnType = XML_dgm;
+                    maShapeTarget.msSubShapeId = rAttribs.getString( XML_id, 
OUString() );
+                    return this;
                 case PPT_TOKEN( oleChartEl ):
                     bTargetSet = true;
                     // TODO
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to