[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 2 commits - oox/inc oox/source
Petr Mladek
pmladek at kemper.freedesktop.org
Thu Aug 9 05:34:04 PDT 2012
oox/inc/oox/ppt/pptshapegroupcontext.hxx | 1
oox/source/drawingml/diagram/diagram.cxx | 69 ++++++++++++++++---------------
oox/source/ppt/pptshapegroupcontext.cxx | 11 ++++
3 files changed, 47 insertions(+), 34 deletions(-)
New commits:
commit f3826fda8ac280d20f70ae273f20a438d6040453
Author: Muthu Subramanian <sumuthu at suse.com>
Date: Mon Jun 25 19:25:52 2012 +0530
n#759210: Certain smartart drawings weren't imported.
SmartArt info was reset, when there was a chart (e.g.)
in the same slide.
This also fixes fdo#50907.
Conflicts:
oox/source/drawingml/diagram/diagram.cxx
(cherry picked from commit 11c5699dad06fb0d7fc0e458550a1dac82f8ee5f)
Signed-off-by: Petr Mladek <pmladek at suse.cz>
diff --git a/oox/inc/oox/ppt/pptshapegroupcontext.hxx b/oox/inc/oox/ppt/pptshapegroupcontext.hxx
index 7e2a6d3..841e741 100644
--- a/oox/inc/oox/ppt/pptshapegroupcontext.hxx
+++ b/oox/inc/oox/ppt/pptshapegroupcontext.hxx
@@ -39,6 +39,7 @@ class PPTShapeGroupContext : public ::oox::drawingml::ShapeGroupContext
SlidePersistPtr mpSlidePersistPtr;
ShapeLocation meShapeLocation;
oox::drawingml::ShapePtr pGraphicShape;
+ void importExtDrawings();
public:
PPTShapeGroupContext(
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx
index d262dd8..d7ad02e 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -408,40 +408,44 @@ void loadDiagram( ShapePtr& pShape,
pShape->addExtDrawingRelId( *aIt );
}
- // layout
- if( rLayoutPath.getLength() > 0 )
+ // extLst is present, lets bet on that and ignore the rest of the data from here
+ if( !pData->getExtDrawings().size() )
{
- rtl::Reference< core::FragmentHandler > xRef(
- new DiagramLayoutFragmentHandler( rFilter, rLayoutPath, pLayout ));
- importFragment(rFilter,
- loadFragment(rFilter,xRef),
- "DiagramLayout",
- pShape,
- xRef);
- }
+ // layout
+ if( !rLayoutPath.isEmpty() )
+ {
+ rtl::Reference< core::FragmentHandler > xRef(
+ new DiagramLayoutFragmentHandler( rFilter, rLayoutPath, pLayout ));
+ importFragment(rFilter,
+ loadFragment(rFilter,xRef),
+ "DiagramLayout",
+ pShape,
+ xRef);
+ }
- // style
- if( rQStylePath.getLength() > 0 )
- {
- rtl::Reference< core::FragmentHandler > xRef(
- new DiagramQStylesFragmentHandler( rFilter, rQStylePath, pDiagram->getStyles() ));
- importFragment(rFilter,
- loadFragment(rFilter,xRef),
- "DiagramQStyle",
- pShape,
- xRef);
- }
+ // style
+ if( !rQStylePath.isEmpty() )
+ {
+ rtl::Reference< core::FragmentHandler > xRef(
+ new DiagramQStylesFragmentHandler( rFilter, rQStylePath, pDiagram->getStyles() ));
+ importFragment(rFilter,
+ loadFragment(rFilter,xRef),
+ "DiagramQStyle",
+ pShape,
+ xRef);
+ }
- // colors
- if( rColorStylePath.getLength() > 0 )
- {
- rtl::Reference< core::FragmentHandler > xRef(
- new ColorFragmentHandler( rFilter, rColorStylePath, pDiagram->getColors() ));
- importFragment(rFilter,
- loadFragment(rFilter,xRef),
- "DiagramColorStyle",
- pShape,
- xRef);
+ // colors
+ if( !rColorStylePath.isEmpty() )
+ {
+ rtl::Reference< core::FragmentHandler > xRef(
+ new ColorFragmentHandler( rFilter, rColorStylePath, pDiagram->getColors() ));
+ importFragment(rFilter,
+ loadFragment(rFilter,xRef),
+ "DiagramColorStyle",
+ pShape,
+ xRef);
+ }
}
// diagram loaded. now lump together & attach to shape
diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx
index cf982cf..a33951c 100644
--- a/oox/source/ppt/pptshapegroupcontext.cxx
+++ b/oox/source/ppt/pptshapegroupcontext.cxx
@@ -115,6 +115,8 @@ Reference< XFastContextHandler > PPTShapeGroupContext::createFastChildContext( s
break;
case PPT_TOKEN( graphicFrame ): // CT_GraphicalObjectFrame
{
+ if( pGraphicShape )
+ importExtDrawings();
pGraphicShape = oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.OLE2Shape" ) );
xRet.set( new oox::drawingml::GraphicalObjectFrameContext( *this, mpGroupShapePtr, pGraphicShape, true ) );
}
@@ -128,9 +130,9 @@ Reference< XFastContextHandler > PPTShapeGroupContext::createFastChildContext( s
return xRet;
}
-void PPTShapeGroupContext::endFastElement( sal_Int32 nElement ) throw (SAXException, RuntimeException)
+void PPTShapeGroupContext::importExtDrawings( )
{
- if( nElement == PPT_TOKEN( spTree ) && pGraphicShape )
+ if( pGraphicShape )
{
for( ::std::vector<OUString>::const_iterator aIt = pGraphicShape->getExtDrawings().begin(), aEnd = pGraphicShape->getExtDrawings().end();
aIt != aEnd; ++aIt )
@@ -147,6 +149,11 @@ void PPTShapeGroupContext::endFastElement( sal_Int32 nElement ) throw (SAXExcept
}
}
+void PPTShapeGroupContext::endFastElement( sal_Int32 /*nElement*/ ) throw (SAXException, RuntimeException)
+{
+ importExtDrawings();
+}
+
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 0a7453043f35a9a49f0482168b48d378a099a238
Author: Muthu Subramanian <sumuthu at suse.com>
Date: Wed Feb 1 13:32:56 2012 +0530
Fixes crashing while loading manipulated pptx files.
Signed-off-by: Petr Mladek <pmladek at suse.cz>
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx
index ad53443..d262dd8 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -340,7 +340,8 @@ void Diagram::addTo( const ShapePtr & pParentShape )
// create Shape hierarchy
ShapeCreationVisitor aCreationVisitor(pParentShape, *this);
- mpLayout->getNode()->accept(aCreationVisitor);
+ if( mpLayout->getNode() )
+ mpLayout->getNode()->accept( aCreationVisitor );
}
OUString Diagram::getLayoutId() const
More information about the Libreoffice-commits
mailing list