Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / oox / source / ppt / extdrawingfragmenthandler.cxx
bloba0d40ea0412c0868add121c68308c3d53c248d55
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 : FragmentHandler2( rFilter, rFragmentPath ),
29 mpSlidePersistPtr (rSlidePersistPtr ),
30 meShapeLocation( eShapeLocation ),
31 mpGroupShapePtr( pGroupShapePtr ),
32 mpOrgShapePtr( pShapePtr )
36 ExtDrawingFragmentHandler::~ExtDrawingFragmentHandler( ) throw ()
38 // Empty DrawingML fallback, need to warn the user at the end.
39 if (mpShapePtr && mpShapePtr->getChildren().empty())
40 getFilter().setMissingExtDrawing();
43 ContextHandlerRef
44 ExtDrawingFragmentHandler::onCreateContext( ::sal_Int32 aElement,
45 const AttributeList& )
47 switch( aElement )
49 case DSP_TOKEN( drawing ):
50 break;
51 case DSP_TOKEN( spTree ):
52 mpShapePtr = oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GroupShape" ) );
53 mpShapePtr->setPosition( mpOrgShapePtr->getPosition() );
54 mpShapePtr->setName( mpOrgShapePtr->getName() );
56 return new PPTShapeGroupContext(
57 *this, mpSlidePersistPtr, meShapeLocation, mpGroupShapePtr,
58 mpShapePtr );
59 default:
60 break;
63 return this;
66 } }
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */