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