Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / oox / source / ppt / extdrawingfragmenthandler.cxx
blob7d1a3cf6a4a781c75de9c509424eafd065af9e12
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include "extdrawingfragmenthandler.hxx"
12 #include <oox/token/namespaces.hxx>
13 #include <oox/token/tokens.hxx>
14 #include <oox/core/xmlfilterbase.hxx>
16 using namespace ::oox::core;
17 using namespace ::com::sun::star::xml::sax;
18 using namespace ::com::sun::star::uno;
20 namespace oox { namespace ppt {
22 ExtDrawingFragmentHandler::ExtDrawingFragmentHandler( XmlFilterBase& rFilter,
23 const OUString& rFragmentPath,
24 const oox::ppt::SlidePersistPtr& rSlidePersistPtr,
25 const oox::ppt::ShapeLocation eShapeLocation,
26 oox::drawingml::ShapePtr const & pGroupShapePtr,
27 oox::drawingml::ShapePtr const & pShapePtr)
28 throw( )
29 : FragmentHandler2( rFilter, rFragmentPath ),
30 mpSlidePersistPtr (rSlidePersistPtr ),
31 meShapeLocation( eShapeLocation ),
32 mpGroupShapePtr( pGroupShapePtr ),
33 mpOrgShapePtr( pShapePtr )
37 ExtDrawingFragmentHandler::~ExtDrawingFragmentHandler( ) throw ()
39 // Empty DrawingML fallback, need to warn the user at the end.
40 if (mpShapePtr && mpShapePtr->getChildren().empty())
41 getFilter().setMissingExtDrawing();
44 ContextHandlerRef
45 ExtDrawingFragmentHandler::onCreateContext( ::sal_Int32 aElement,
46 const AttributeList& )
48 switch( aElement )
50 case DSP_TOKEN( drawing ):
51 break;
52 case DSP_TOKEN( spTree ):
53 mpShapePtr = oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GroupShape" ) );
54 mpShapePtr->setPosition( mpOrgShapePtr->getPosition() );
55 mpShapePtr->setName( mpOrgShapePtr->getName() );
57 return new PPTShapeGroupContext(
58 *this, mpSlidePersistPtr, meShapeLocation, mpGroupShapePtr,
59 mpShapePtr );
60 default:
61 break;
64 return this;
67 } }
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */