Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Initial Developer of the Original Code is
16 : * Novell, Inc.
17 : *
18 : * Portions created by the Initial Developer are Copyright (C) 2011 the
19 : * Initial Developer. All Rights Reserved.
20 : *
21 : * Contributor(s): Muthu Subramanian <sumuthu@suse.com>
22 : *
23 : * Alternatively, the contents of this file may be used under the terms of
24 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
25 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
26 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
27 : * instead of those above.
28 : */
29 :
30 : #include "extdrawingfragmenthandler.hxx"
31 :
32 : using namespace ::oox::core;
33 : using namespace ::com::sun::star::xml::sax;
34 : using namespace ::com::sun::star::uno;
35 : using ::rtl::OUString;
36 :
37 : namespace oox { namespace ppt {
38 :
39 0 : ExtDrawingFragmentHandler::ExtDrawingFragmentHandler( XmlFilterBase& rFilter,
40 : const OUString& rFragmentPath,
41 : const oox::ppt::SlidePersistPtr pSlidePersistPtr,
42 : const oox::ppt::ShapeLocation eShapeLocation,
43 : oox::drawingml::ShapePtr pMasterShapePtr,
44 : oox::drawingml::ShapePtr pGroupShapePtr,
45 : oox::drawingml::ShapePtr pShapePtr)
46 : throw( )
47 : : FragmentHandler( rFilter, rFragmentPath ),
48 : mpSlidePersistPtr (pSlidePersistPtr ),
49 : meShapeLocation( eShapeLocation ),
50 : mpMasterShapePtr( pMasterShapePtr ),
51 : mpGroupShapePtr( pGroupShapePtr ),
52 0 : mpOrgShapePtr( pShapePtr )
53 : {
54 0 : }
55 :
56 0 : ExtDrawingFragmentHandler::~ExtDrawingFragmentHandler( ) throw ()
57 : {
58 :
59 0 : }
60 :
61 : Reference< XFastContextHandler > SAL_CALL
62 0 : ExtDrawingFragmentHandler::createFastChildContext( ::sal_Int32 aElement,
63 : const Reference< XFastAttributeList >& )
64 : throw ( SAXException, RuntimeException)
65 : {
66 0 : Reference< XFastContextHandler > xRet;
67 :
68 0 : switch( aElement )
69 : {
70 : case DSP_TOKEN( drawing ):
71 0 : break;
72 : case DSP_TOKEN( spTree ):
73 0 : mpShapePtr = oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GroupShape" ) );
74 : xRet.set( new PPTShapeGroupContext(
75 : *this, mpSlidePersistPtr, meShapeLocation, mpSlidePersistPtr->getShapes(),
76 0 : mpShapePtr ) );
77 0 : break;
78 : default:
79 0 : break;
80 : }
81 :
82 0 : if( !xRet.is() )
83 0 : xRet = getFastContextHandler();
84 :
85 0 : return xRet;
86 : }
87 0 : void SAL_CALL ExtDrawingFragmentHandler::endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
88 : {
89 0 : mpShapePtr->moveAllToPosition( mpOrgShapePtr->getPosition() );
90 0 : mpShapePtr->setName( mpOrgShapePtr->getName() );
91 0 : }
92 :
93 51 : } }
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|