diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-06-05 11:37:20 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-06-05 11:41:47 +0200 |
commit | baa591a93566632471a804a3425d1e04a9166126 (patch) | |
tree | c7105a85673a0769dd91870d655a1f7a2188219b /oox | |
parent | 5ed17233908c7f87b08b0964b55e4504d964ed71 (diff) |
oox: move ShapeDrawingFragmentHandler to its own file
Change-Id: I12b057555e00f3623c45c831f4042747f140ff92
Diffstat (limited to 'oox')
-rw-r--r-- | oox/Library_oox.mk | 1 | ||||
-rw-r--r-- | oox/source/shape/ShapeContextHandler.cxx | 50 | ||||
-rw-r--r-- | oox/source/shape/ShapeDrawingFragmentHandler.cxx | 71 | ||||
-rw-r--r-- | oox/source/shape/ShapeDrawingFragmentHandler.hxx | 56 |
4 files changed, 130 insertions, 48 deletions
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk index 2301fd7cce2c..928e0b641b1d 100644 --- a/oox/Library_oox.mk +++ b/oox/Library_oox.mk @@ -275,6 +275,7 @@ $(eval $(call gb_Library_add_exception_objects,oox,\ oox/source/ppt/timetargetelementcontext \ oox/source/ppt/extdrawingfragmenthandler \ oox/source/shape/ShapeContextHandler \ + oox/source/shape/ShapeDrawingFragmentHandler \ oox/source/shape/ShapeFilterBase \ oox/source/token/namespacemap \ oox/source/token/propertynames \ diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index 77223c0d0e2b..0d59ffec3978 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -29,13 +29,9 @@ #include <com/sun/star/xml/sax/XFastSAXSerializable.hpp> #include "ShapeContextHandler.hxx" +#include "ShapeDrawingFragmentHandler.hxx" #include "oox/vml/vmldrawingfragment.hxx" #include "oox/vml/vmlshape.hxx" -#include "oox/vml/vmlshapecontainer.hxx" -#include "oox/drawingml/diagram/diagram.hxx" -#include "oox/drawingml/shapegroupcontext.hxx" -#include "oox/drawingml/shapestylecontext.hxx" -#include "oox/drawingml/textbodycontext.hxx" #include "oox/drawingml/themefragmenthandler.hxx" namespace oox { namespace shape { @@ -272,48 +268,6 @@ void SAL_CALL ShapeContextHandler::characters(const ::rtl::OUString & aChars) xContextHandler->characters(aChars); } -/// Generic (i.e. not specific to PPTX) handler for the prerendered diagram parsing. -class ShapeExtDrawingFragmentHandler : public ::oox::core::FragmentHandler -{ -public: - ShapeExtDrawingFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, - oox::drawingml::ShapePtr pGroupShapePtr ) throw() - : FragmentHandler( rFilter, rFragmentPath ), - mpGroupShapePtr( pGroupShapePtr ) - { - } - - virtual ~ShapeExtDrawingFragmentHandler() throw() - { - } - - virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& /*Attribs*/ ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - uno::Reference< XFastContextHandler > xRet; - - switch( Element ) - { - case DSP_TOKEN( spTree ): - xRet.set( new ShapeGroupContext(*this, ShapePtr((Shape*)0), mpGroupShapePtr)); - break; - default: - break; - } - - if( !xRet.is() ) - xRet = getFastContextHandler(); - - return xRet; - } - -private: - oox::drawingml::ShapePtr mpGroupShapePtr; -}; - // ::com::sun::star::xml::sax::XFastShapeContextHandler: uno::Reference< drawing::XShape > SAL_CALL ShapeContextHandler::getShape() throw (uno::RuntimeException) @@ -345,7 +299,7 @@ ShapeContextHandler::getShape() throw (uno::RuntimeException) DiagramGraphicDataContext* pDiagramGraphicDataContext = dynamic_cast<DiagramGraphicDataContext*>(mxDiagramShapeContext.get()); rtl::OUString aFragmentPath(pDiagramGraphicDataContext->getFragmentPathFromRelId(*aIt)); oox::drawingml::ShapePtr pShapePtr( new Shape( "com.sun.star.drawing.GroupShape" ) ); - mxFilterBase->importFragment(new ShapeExtDrawingFragmentHandler(*mxFilterBase, aFragmentPath, pShapePtr)); + mxFilterBase->importFragment(new ShapeDrawingFragmentHandler(*mxFilterBase, aFragmentPath, pShapePtr)); pShapePtr->addShape( *mxFilterBase, mpThemePtr.get(), xShapes, aMatrix ); xResult = pShapePtr->getXShape(); } diff --git a/oox/source/shape/ShapeDrawingFragmentHandler.cxx b/oox/source/shape/ShapeDrawingFragmentHandler.cxx new file mode 100644 index 000000000000..6e2381c24af4 --- /dev/null +++ b/oox/source/shape/ShapeDrawingFragmentHandler.cxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@suse.cz> (SUSE, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2012 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "ShapeDrawingFragmentHandler.hxx" + +using namespace com::sun::star; +using rtl::OUString; + +namespace oox { namespace shape { + +ShapeDrawingFragmentHandler::ShapeDrawingFragmentHandler(oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, oox::drawingml::ShapePtr pGroupShapePtr ) throw() + : FragmentHandler(rFilter, rFragmentPath), + mpGroupShapePtr(pGroupShapePtr) +{ +} + +ShapeDrawingFragmentHandler::~ShapeDrawingFragmentHandler() throw() +{ +} + +void SAL_CALL ShapeDrawingFragmentHandler::endDocument() throw (xml::sax::SAXException, uno::RuntimeException) +{ +} + +uno::Reference<xml::sax::XFastContextHandler> SAL_CALL ShapeDrawingFragmentHandler::createFastChildContext(sal_Int32 Element, const uno::Reference<xml::sax::XFastAttributeList>& /*Attribs*/ ) throw (xml::sax::SAXException, uno::RuntimeException) +{ + uno::Reference< XFastContextHandler > xRet; + + switch( Element ) + { + case DSP_TOKEN( spTree ): + xRet.set( new oox::drawingml::ShapeGroupContext(*this, oox::drawingml::ShapePtr((oox::drawingml::Shape*)0), mpGroupShapePtr)); + break; + default: + break; + } + + if( !xRet.is() ) + xRet = getFastContextHandler(); + + return xRet; +} + +} } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/shape/ShapeDrawingFragmentHandler.hxx b/oox/source/shape/ShapeDrawingFragmentHandler.hxx new file mode 100644 index 000000000000..e7a8fdd6b976 --- /dev/null +++ b/oox/source/shape/ShapeDrawingFragmentHandler.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@suse.cz> (SUSE, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2012 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef OOX_SHAPE_DRAWINGFRAGMENTHANDLER +#define OOX_SHAPE_DRAWINGFRAGMENTHANDLER + +#include "oox/core/fragmenthandler.hxx" +#include "oox/drawingml/shapegroupcontext.hxx" + +namespace oox { namespace shape { + +/// Generic (i.e. not specific to PPTX) handler for the prerendered diagram parsing. +class ShapeDrawingFragmentHandler : public oox::core::FragmentHandler +{ +public: + ShapeDrawingFragmentHandler( oox::core::XmlFilterBase& rFilter, const rtl::OUString& rFragmentPath, oox::drawingml::ShapePtr pGroupShapePtr ) throw(); + virtual ~ShapeDrawingFragmentHandler() throw(); + virtual void SAL_CALL endDocument() throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext(sal_Int32 Element, const com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList>& Attribs ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); + +private: + oox::drawingml::ShapePtr mpGroupShapePtr; +}; + + +} } + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |