1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef OOX_SHAPE_SHAPE_CONTEXT_HANDLER_HXX 28*cdf0e10cSrcweir #define OOX_SHAPE_SHAPE_CONTEXT_HANDLER_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 31*cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 32*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 33*cdf0e10cSrcweir #include <com/sun/star/xml/sax/XFastShapeContextHandler.hpp> 34*cdf0e10cSrcweir #include "oox/drawingml/graphicshapecontext.hxx" 35*cdf0e10cSrcweir #include "oox/drawingml/shape.hxx" 36*cdf0e10cSrcweir #include "oox/drawingml/theme.hxx" 37*cdf0e10cSrcweir #include "oox/core/fragmenthandler.hxx" 38*cdf0e10cSrcweir #include "oox/core/xmlfilterbase.hxx" 39*cdf0e10cSrcweir #include "ShapeFilterBase.hxx" 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir namespace css = ::com::sun::star; 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir namespace oox { namespace shape { 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir class ShapeFragmentHandler : public core::FragmentHandler 46*cdf0e10cSrcweir { 47*cdf0e10cSrcweir public: 48*cdf0e10cSrcweir typedef boost::shared_ptr<ShapeFragmentHandler> Pointer_t; 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir explicit ShapeFragmentHandler(core::XmlFilterBase& rFilter, 51*cdf0e10cSrcweir const ::rtl::OUString& rFragmentPath ) 52*cdf0e10cSrcweir : FragmentHandler(rFilter, rFragmentPath) 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir } 55*cdf0e10cSrcweir }; 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir class ShapeContextHandler: 58*cdf0e10cSrcweir public ::cppu::WeakImplHelper1< 59*cdf0e10cSrcweir css::xml::sax::XFastShapeContextHandler> 60*cdf0e10cSrcweir { 61*cdf0e10cSrcweir public: 62*cdf0e10cSrcweir explicit ShapeContextHandler 63*cdf0e10cSrcweir (css::uno::Reference< css::uno::XComponentContext > const & context); 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir virtual ~ShapeContextHandler(); 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir // ::com::sun::star::lang::XServiceInfo: 68*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() 69*cdf0e10cSrcweir throw (css::uno::RuntimeException); 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL supportsService 72*cdf0e10cSrcweir (const ::rtl::OUString & ServiceName) throw (css::uno::RuntimeException); 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL 75*cdf0e10cSrcweir getSupportedServiceNames() throw (css::uno::RuntimeException); 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir // ::com::sun::star::xml::sax::XFastContextHandler: 78*cdf0e10cSrcweir virtual void SAL_CALL startFastElement 79*cdf0e10cSrcweir (::sal_Int32 Element, 80*cdf0e10cSrcweir const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) 81*cdf0e10cSrcweir throw (css::uno::RuntimeException, css::xml::sax::SAXException); 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir virtual void SAL_CALL startUnknownElement 84*cdf0e10cSrcweir (const ::rtl::OUString & Namespace, 85*cdf0e10cSrcweir const ::rtl::OUString & Name, 86*cdf0e10cSrcweir const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) 87*cdf0e10cSrcweir throw (css::uno::RuntimeException, css::xml::sax::SAXException); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir virtual void SAL_CALL endFastElement(::sal_Int32 Element) 90*cdf0e10cSrcweir throw (css::uno::RuntimeException, css::xml::sax::SAXException); 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir virtual void SAL_CALL endUnknownElement 93*cdf0e10cSrcweir (const ::rtl::OUString & Namespace, 94*cdf0e10cSrcweir const ::rtl::OUString & Name) 95*cdf0e10cSrcweir throw (css::uno::RuntimeException, css::xml::sax::SAXException); 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL 98*cdf0e10cSrcweir createFastChildContext 99*cdf0e10cSrcweir (::sal_Int32 Element, 100*cdf0e10cSrcweir const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) 101*cdf0e10cSrcweir throw (css::uno::RuntimeException, css::xml::sax::SAXException); 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL 104*cdf0e10cSrcweir createUnknownChildContext 105*cdf0e10cSrcweir (const ::rtl::OUString & Namespace, 106*cdf0e10cSrcweir const ::rtl::OUString & Name, 107*cdf0e10cSrcweir const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) 108*cdf0e10cSrcweir throw (css::uno::RuntimeException, css::xml::sax::SAXException); 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir virtual void SAL_CALL characters(const ::rtl::OUString & aChars) 111*cdf0e10cSrcweir throw (css::uno::RuntimeException, css::xml::sax::SAXException); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir // ::com::sun::star::xml::sax::XFastShapeContextHandler: 114*cdf0e10cSrcweir virtual css::uno::Reference< css::drawing::XShape > SAL_CALL getShape() 115*cdf0e10cSrcweir throw (css::uno::RuntimeException); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getDrawPage() 118*cdf0e10cSrcweir throw (css::uno::RuntimeException); 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir virtual void SAL_CALL setDrawPage 121*cdf0e10cSrcweir (const css::uno::Reference< css::drawing::XDrawPage > & the_value) 122*cdf0e10cSrcweir throw (css::uno::RuntimeException); 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel() 125*cdf0e10cSrcweir throw (css::uno::RuntimeException); 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir virtual void SAL_CALL setModel 128*cdf0e10cSrcweir (const css::uno::Reference< css::frame::XModel > & the_value) 129*cdf0e10cSrcweir throw (css::uno::RuntimeException); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir virtual css::uno::Reference< css::io::XInputStream > SAL_CALL 132*cdf0e10cSrcweir getInputStream() throw (css::uno::RuntimeException); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir virtual void SAL_CALL setInputStream 135*cdf0e10cSrcweir (const css::uno::Reference< css::io::XInputStream > & the_value) 136*cdf0e10cSrcweir throw (css::uno::RuntimeException); 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getRelationFragmentPath() 139*cdf0e10cSrcweir throw (css::uno::RuntimeException); 140*cdf0e10cSrcweir virtual void SAL_CALL setRelationFragmentPath 141*cdf0e10cSrcweir (const ::rtl::OUString & the_value) 142*cdf0e10cSrcweir throw (css::uno::RuntimeException); 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getStartToken() throw (::com::sun::star::uno::RuntimeException); 145*cdf0e10cSrcweir virtual void SAL_CALL setStartToken( ::sal_Int32 _starttoken ) throw (::com::sun::star::uno::RuntimeException); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir private: 148*cdf0e10cSrcweir ShapeContextHandler(ShapeContextHandler &); // not defined 149*cdf0e10cSrcweir void operator =(ShapeContextHandler &); // not defined 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir ::sal_uInt32 mnStartToken; 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir css::uno::Reference< css::uno::XComponentContext > m_xContext; 154*cdf0e10cSrcweir drawingml::ShapePtr mpShape; 155*cdf0e10cSrcweir ::boost::shared_ptr< vml::Drawing > mpDrawing; 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir typedef boost::shared_ptr<drawingml::GraphicShapeContext> 158*cdf0e10cSrcweir GraphicShapeContextPtr; 159*cdf0e10cSrcweir css::uno::Reference<XFastContextHandler> mxDrawingFragmentHandler; 160*cdf0e10cSrcweir css::uno::Reference<XFastContextHandler> mxGraphicShapeContext; 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir core::XmlFilterRef mxFilterBase; 163*cdf0e10cSrcweir drawingml::ThemePtr mpThemePtr; 164*cdf0e10cSrcweir css::uno::Reference<css::drawing::XDrawPage> mxDrawPage; 165*cdf0e10cSrcweir css::uno::Reference<css::io::XInputStream> mxInputStream; 166*cdf0e10cSrcweir ::rtl::OUString msRelationFragmentPath; 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir css::uno::Reference<XFastContextHandler> getGraphicShapeContext(::sal_Int32 Element); 169*cdf0e10cSrcweir css::uno::Reference<XFastContextHandler> getDrawingShapeContext(); 170*cdf0e10cSrcweir css::uno::Reference<XFastContextHandler> getContextHandler(); 171*cdf0e10cSrcweir }; 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir }} 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir #endif // OOX_SHAPE_SHAPE_CONTEXT_HANDLER_HXX 176