Branch data 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 css = ::com::sun::star;
34 : :
35 : : namespace oox { namespace shape {
36 : :
37 [ - + ]: 36 : class ShapeFragmentHandler : public core::FragmentHandler
38 : : {
39 : : public:
40 : : typedef boost::shared_ptr<ShapeFragmentHandler> Pointer_t;
41 : :
42 : 18 : explicit ShapeFragmentHandler(core::XmlFilterBase& rFilter,
43 : : const ::rtl::OUString& rFragmentPath )
44 : 18 : : FragmentHandler(rFilter, rFragmentPath)
45 : : {
46 : 18 : }
47 : : };
48 : :
49 : : class ShapeContextHandler:
50 : : public ::cppu::WeakImplHelper1<
51 : : css::xml::sax::XFastShapeContextHandler>
52 : : {
53 : : public:
54 : : explicit ShapeContextHandler
55 : : (css::uno::Reference< css::uno::XComponentContext > const & context);
56 : :
57 : : virtual ~ShapeContextHandler();
58 : :
59 : : // ::com::sun::star::lang::XServiceInfo:
60 : : virtual ::rtl::OUString SAL_CALL getImplementationName()
61 : : throw (css::uno::RuntimeException);
62 : :
63 : : virtual ::sal_Bool SAL_CALL supportsService
64 : : (const ::rtl::OUString & ServiceName) throw (css::uno::RuntimeException);
65 : :
66 : : virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL
67 : : getSupportedServiceNames() throw (css::uno::RuntimeException);
68 : :
69 : : // ::com::sun::star::xml::sax::XFastContextHandler:
70 : : virtual void SAL_CALL startFastElement
71 : : (::sal_Int32 Element,
72 : : const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs)
73 : : throw (css::uno::RuntimeException, css::xml::sax::SAXException);
74 : :
75 : : virtual void SAL_CALL startUnknownElement
76 : : (const ::rtl::OUString & Namespace,
77 : : const ::rtl::OUString & Name,
78 : : const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs)
79 : : throw (css::uno::RuntimeException, css::xml::sax::SAXException);
80 : :
81 : : virtual void SAL_CALL endFastElement(::sal_Int32 Element)
82 : : throw (css::uno::RuntimeException, css::xml::sax::SAXException);
83 : :
84 : : virtual void SAL_CALL endUnknownElement
85 : : (const ::rtl::OUString & Namespace,
86 : : const ::rtl::OUString & Name)
87 : : throw (css::uno::RuntimeException, css::xml::sax::SAXException);
88 : :
89 : : virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
90 : : createFastChildContext
91 : : (::sal_Int32 Element,
92 : : const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs)
93 : : throw (css::uno::RuntimeException, css::xml::sax::SAXException);
94 : :
95 : : virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
96 : : createUnknownChildContext
97 : : (const ::rtl::OUString & Namespace,
98 : : const ::rtl::OUString & Name,
99 : : const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs)
100 : : throw (css::uno::RuntimeException, css::xml::sax::SAXException);
101 : :
102 : : virtual void SAL_CALL characters(const ::rtl::OUString & aChars)
103 : : throw (css::uno::RuntimeException, css::xml::sax::SAXException);
104 : :
105 : : // ::com::sun::star::xml::sax::XFastShapeContextHandler:
106 : : virtual css::uno::Reference< css::drawing::XShape > SAL_CALL getShape()
107 : : throw (css::uno::RuntimeException);
108 : :
109 : : virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getDrawPage()
110 : : throw (css::uno::RuntimeException);
111 : :
112 : : virtual void SAL_CALL setDrawPage
113 : : (const css::uno::Reference< css::drawing::XDrawPage > & the_value)
114 : : throw (css::uno::RuntimeException);
115 : :
116 : : virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel()
117 : : throw (css::uno::RuntimeException);
118 : :
119 : : virtual void SAL_CALL setModel
120 : : (const css::uno::Reference< css::frame::XModel > & the_value)
121 : : throw (css::uno::RuntimeException);
122 : :
123 : : virtual css::uno::Reference< css::io::XInputStream > SAL_CALL
124 : : getInputStream() throw (css::uno::RuntimeException);
125 : :
126 : : virtual void SAL_CALL setInputStream
127 : : (const css::uno::Reference< css::io::XInputStream > & the_value)
128 : : throw (css::uno::RuntimeException);
129 : :
130 : : virtual ::rtl::OUString SAL_CALL getRelationFragmentPath()
131 : : throw (css::uno::RuntimeException);
132 : : virtual void SAL_CALL setRelationFragmentPath
133 : : (const ::rtl::OUString & the_value)
134 : : throw (css::uno::RuntimeException);
135 : :
136 : : virtual ::sal_Int32 SAL_CALL getStartToken() throw (::com::sun::star::uno::RuntimeException);
137 : : virtual void SAL_CALL setStartToken( ::sal_Int32 _starttoken ) throw (::com::sun::star::uno::RuntimeException);
138 : :
139 : : private:
140 : : ShapeContextHandler(ShapeContextHandler &); // not defined
141 : : void operator =(ShapeContextHandler &); // not defined
142 : :
143 : : ::sal_uInt32 mnStartToken;
144 : :
145 : : css::uno::Reference< css::uno::XComponentContext > m_xContext;
146 : : drawingml::ShapePtr mpShape;
147 : : ::boost::shared_ptr< vml::Drawing > mpDrawing;
148 : :
149 : : typedef boost::shared_ptr<drawingml::GraphicShapeContext>
150 : : GraphicShapeContextPtr;
151 : : css::uno::Reference<XFastContextHandler> mxDrawingFragmentHandler;
152 : : css::uno::Reference<XFastContextHandler> mxGraphicShapeContext;
153 : : css::uno::Reference<XFastContextHandler> mxDiagramShapeContext;
154 : :
155 : : core::XmlFilterRef mxFilterBase;
156 : : drawingml::ThemePtr mpThemePtr;
157 : : css::uno::Reference<css::drawing::XDrawPage> mxDrawPage;
158 : : css::uno::Reference<css::io::XInputStream> mxInputStream;
159 : : ::rtl::OUString msRelationFragmentPath;
160 : :
161 : : css::uno::Reference<XFastContextHandler> getGraphicShapeContext(::sal_Int32 Element);
162 : : css::uno::Reference<XFastContextHandler> getDrawingShapeContext();
163 : : css::uno::Reference<XFastContextHandler> getDiagramShapeContext();
164 : : css::uno::Reference<XFastContextHandler> getContextHandler();
165 : : };
166 : :
167 : : }}
168 : :
169 : : #endif // OOX_SHAPE_SHAPE_CONTEXT_HANDLER_HXX
170 : :
171 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|