1*e3508121SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*e3508121SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*e3508121SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*e3508121SAndrew Rist  * distributed with this work for additional information
6*e3508121SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*e3508121SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*e3508121SAndrew Rist  * "License"); you may not use this file except in compliance
9*e3508121SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*e3508121SAndrew Rist  *
11*e3508121SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*e3508121SAndrew Rist  *
13*e3508121SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*e3508121SAndrew Rist  * software distributed under the License is distributed on an
15*e3508121SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*e3508121SAndrew Rist  * KIND, either express or implied.  See the License for the
17*e3508121SAndrew Rist  * specific language governing permissions and limitations
18*e3508121SAndrew Rist  * under the License.
19*e3508121SAndrew Rist  *
20*e3508121SAndrew Rist  *************************************************************/
21*e3508121SAndrew Rist 
22*e3508121SAndrew Rist 
23cdf0e10cSrcweir #ifndef OOX_SHAPE_SHAPE_CONTEXT_HANDLER_HXX
24cdf0e10cSrcweir #define OOX_SHAPE_SHAPE_CONTEXT_HANDLER_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
27cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
28cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
29cdf0e10cSrcweir #include <com/sun/star/xml/sax/XFastShapeContextHandler.hpp>
30cdf0e10cSrcweir #include "oox/drawingml/graphicshapecontext.hxx"
31cdf0e10cSrcweir #include "oox/drawingml/shape.hxx"
32cdf0e10cSrcweir #include "oox/drawingml/theme.hxx"
33cdf0e10cSrcweir #include "oox/core/fragmenthandler.hxx"
34cdf0e10cSrcweir #include "oox/core/xmlfilterbase.hxx"
35cdf0e10cSrcweir #include "ShapeFilterBase.hxx"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace css = ::com::sun::star;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir namespace oox { namespace shape {
40cdf0e10cSrcweir 
41cdf0e10cSrcweir class ShapeFragmentHandler : public core::FragmentHandler
42cdf0e10cSrcweir {
43cdf0e10cSrcweir public:
44cdf0e10cSrcweir     typedef boost::shared_ptr<ShapeFragmentHandler> Pointer_t;
45cdf0e10cSrcweir 
ShapeFragmentHandler(core::XmlFilterBase & rFilter,const::rtl::OUString & rFragmentPath)46cdf0e10cSrcweir     explicit ShapeFragmentHandler(core::XmlFilterBase& rFilter,
47cdf0e10cSrcweir                                   const ::rtl::OUString& rFragmentPath )
48cdf0e10cSrcweir     : FragmentHandler(rFilter, rFragmentPath)
49cdf0e10cSrcweir     {
50cdf0e10cSrcweir     }
51cdf0e10cSrcweir };
52cdf0e10cSrcweir 
53cdf0e10cSrcweir class ShapeContextHandler:
54cdf0e10cSrcweir     public ::cppu::WeakImplHelper1<
55cdf0e10cSrcweir         css::xml::sax::XFastShapeContextHandler>
56cdf0e10cSrcweir {
57cdf0e10cSrcweir public:
58cdf0e10cSrcweir     explicit ShapeContextHandler
59cdf0e10cSrcweir     (css::uno::Reference< css::uno::XComponentContext > const & context);
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     virtual ~ShapeContextHandler();
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     // ::com::sun::star::lang::XServiceInfo:
64cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName()
65cdf0e10cSrcweir         throw (css::uno::RuntimeException);
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL supportsService
68cdf0e10cSrcweir     (const ::rtl::OUString & ServiceName) throw (css::uno::RuntimeException);
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL
71cdf0e10cSrcweir     getSupportedServiceNames() throw (css::uno::RuntimeException);
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     // ::com::sun::star::xml::sax::XFastContextHandler:
74cdf0e10cSrcweir     virtual void SAL_CALL startFastElement
75cdf0e10cSrcweir     (::sal_Int32 Element,
76cdf0e10cSrcweir      const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs)
77cdf0e10cSrcweir         throw (css::uno::RuntimeException, css::xml::sax::SAXException);
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     virtual void SAL_CALL startUnknownElement
80cdf0e10cSrcweir     (const ::rtl::OUString & Namespace,
81cdf0e10cSrcweir      const ::rtl::OUString & Name,
82cdf0e10cSrcweir      const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs)
83cdf0e10cSrcweir         throw (css::uno::RuntimeException, css::xml::sax::SAXException);
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     virtual void SAL_CALL endFastElement(::sal_Int32 Element)
86cdf0e10cSrcweir         throw (css::uno::RuntimeException, css::xml::sax::SAXException);
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     virtual void SAL_CALL endUnknownElement
89cdf0e10cSrcweir     (const ::rtl::OUString & Namespace,
90cdf0e10cSrcweir      const ::rtl::OUString & Name)
91cdf0e10cSrcweir         throw (css::uno::RuntimeException, css::xml::sax::SAXException);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
94cdf0e10cSrcweir     createFastChildContext
95cdf0e10cSrcweir     (::sal_Int32 Element,
96cdf0e10cSrcweir      const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs)
97cdf0e10cSrcweir         throw (css::uno::RuntimeException, css::xml::sax::SAXException);
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
100cdf0e10cSrcweir     createUnknownChildContext
101cdf0e10cSrcweir     (const ::rtl::OUString & Namespace,
102cdf0e10cSrcweir      const ::rtl::OUString & Name,
103cdf0e10cSrcweir      const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs)
104cdf0e10cSrcweir         throw (css::uno::RuntimeException, css::xml::sax::SAXException);
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     virtual void SAL_CALL characters(const ::rtl::OUString & aChars)
107cdf0e10cSrcweir         throw (css::uno::RuntimeException, css::xml::sax::SAXException);
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     // ::com::sun::star::xml::sax::XFastShapeContextHandler:
110cdf0e10cSrcweir     virtual css::uno::Reference< css::drawing::XShape > SAL_CALL getShape()
111cdf0e10cSrcweir         throw (css::uno::RuntimeException);
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getDrawPage()
114cdf0e10cSrcweir         throw (css::uno::RuntimeException);
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     virtual void SAL_CALL setDrawPage
117cdf0e10cSrcweir     (const css::uno::Reference< css::drawing::XDrawPage > & the_value)
118cdf0e10cSrcweir         throw (css::uno::RuntimeException);
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel()
121cdf0e10cSrcweir         throw (css::uno::RuntimeException);
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     virtual void SAL_CALL setModel
124cdf0e10cSrcweir     (const css::uno::Reference< css::frame::XModel > & the_value)
125cdf0e10cSrcweir         throw (css::uno::RuntimeException);
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     virtual css::uno::Reference< css::io::XInputStream > SAL_CALL
128cdf0e10cSrcweir     getInputStream() throw (css::uno::RuntimeException);
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     virtual void SAL_CALL setInputStream
131cdf0e10cSrcweir     (const css::uno::Reference< css::io::XInputStream > & the_value)
132cdf0e10cSrcweir         throw (css::uno::RuntimeException);
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getRelationFragmentPath()
135cdf0e10cSrcweir         throw (css::uno::RuntimeException);
136cdf0e10cSrcweir     virtual void SAL_CALL setRelationFragmentPath
137cdf0e10cSrcweir     (const ::rtl::OUString & the_value)
138cdf0e10cSrcweir         throw (css::uno::RuntimeException);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getStartToken() throw (::com::sun::star::uno::RuntimeException);
141cdf0e10cSrcweir     virtual void SAL_CALL setStartToken( ::sal_Int32 _starttoken ) throw (::com::sun::star::uno::RuntimeException);
142cdf0e10cSrcweir 
143cdf0e10cSrcweir private:
144cdf0e10cSrcweir     ShapeContextHandler(ShapeContextHandler &); // not defined
145cdf0e10cSrcweir     void operator =(ShapeContextHandler &); // not defined
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     ::sal_uInt32 mnStartToken;
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     css::uno::Reference< css::uno::XComponentContext > m_xContext;
150cdf0e10cSrcweir     drawingml::ShapePtr mpShape;
151cdf0e10cSrcweir     ::boost::shared_ptr< vml::Drawing > mpDrawing;
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     typedef boost::shared_ptr<drawingml::GraphicShapeContext>
154cdf0e10cSrcweir     GraphicShapeContextPtr;
155cdf0e10cSrcweir 	css::uno::Reference<XFastContextHandler> mxDrawingFragmentHandler;
156cdf0e10cSrcweir     css::uno::Reference<XFastContextHandler> mxGraphicShapeContext;
157cdf0e10cSrcweir 
158cdf0e10cSrcweir     core::XmlFilterRef mxFilterBase;
159cdf0e10cSrcweir     drawingml::ThemePtr mpThemePtr;
160cdf0e10cSrcweir     css::uno::Reference<css::drawing::XDrawPage> mxDrawPage;
161cdf0e10cSrcweir     css::uno::Reference<css::io::XInputStream> mxInputStream;
162cdf0e10cSrcweir     ::rtl::OUString msRelationFragmentPath;
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     css::uno::Reference<XFastContextHandler> getGraphicShapeContext(::sal_Int32 Element);
165cdf0e10cSrcweir     css::uno::Reference<XFastContextHandler> getDrawingShapeContext();
166cdf0e10cSrcweir     css::uno::Reference<XFastContextHandler> getContextHandler();
167cdf0e10cSrcweir };
168cdf0e10cSrcweir 
169cdf0e10cSrcweir }}
170cdf0e10cSrcweir 
171cdf0e10cSrcweir #endif // OOX_SHAPE_SHAPE_CONTEXT_HANDLER_HXX
172