1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_OOX_SOURCE_SHAPE_SHAPECONTEXTHANDLER_HXX
20 #define INCLUDED_OOX_SOURCE_SHAPE_SHAPECONTEXTHANDLER_HXX
22 #include <boost/shared_ptr.hpp>
23 #include <com/sun/star/uno/XComponentContext.hpp>
24 #include <cppuhelper/implbase2.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/fragmenthandler2.hxx"
30 #include "oox/core/xmlfilterbase.hxx"
31 #include "ShapeFilterBase.hxx"
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/document/XDocumentProperties.hpp>
35 namespace oox
{ namespace shape
{
37 class ShapeFragmentHandler
: public core::FragmentHandler2
40 typedef boost::shared_ptr
<ShapeFragmentHandler
> Pointer_t
;
42 explicit ShapeFragmentHandler(core::XmlFilterBase
& rFilter
,
43 const OUString
& rFragmentPath
)
44 : FragmentHandler2(rFilter
, rFragmentPath
)
49 class ShapeContextHandler
:
50 public ::cppu::WeakImplHelper2
< css::xml::sax::XFastShapeContextHandler
,
51 css::lang::XServiceInfo
>
54 explicit ShapeContextHandler
55 (css::uno::Reference
< css::uno::XComponentContext
> const & context
);
57 virtual ~ShapeContextHandler();
59 // ::com::sun::star::lang::XServiceInfo:
60 virtual OUString SAL_CALL
getImplementationName()
61 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
63 virtual sal_Bool SAL_CALL supportsService
64 (const OUString
& ServiceName
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
66 virtual css::uno::Sequence
< OUString
> SAL_CALL
67 getSupportedServiceNames() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
69 // ::com::sun::star::xml::sax::XFastContextHandler:
70 virtual void SAL_CALL startFastElement
72 const css::uno::Reference
< css::xml::sax::XFastAttributeList
> & Attribs
)
73 throw (css::uno::RuntimeException
, css::xml::sax::SAXException
, std::exception
) SAL_OVERRIDE
;
75 virtual void SAL_CALL startUnknownElement
76 (const OUString
& Namespace
,
77 const OUString
& Name
,
78 const css::uno::Reference
< css::xml::sax::XFastAttributeList
> & Attribs
)
79 throw (css::uno::RuntimeException
, css::xml::sax::SAXException
, std::exception
) SAL_OVERRIDE
;
81 virtual void SAL_CALL
endFastElement(::sal_Int32 Element
)
82 throw (css::uno::RuntimeException
, css::xml::sax::SAXException
, std::exception
) SAL_OVERRIDE
;
84 virtual void SAL_CALL endUnknownElement
85 (const OUString
& Namespace
,
86 const OUString
& Name
)
87 throw (css::uno::RuntimeException
, css::xml::sax::SAXException
, std::exception
) SAL_OVERRIDE
;
89 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
90 createFastChildContext
92 const css::uno::Reference
< css::xml::sax::XFastAttributeList
> & Attribs
)
93 throw (css::uno::RuntimeException
, css::xml::sax::SAXException
, std::exception
) SAL_OVERRIDE
;
95 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
96 createUnknownChildContext
97 (const OUString
& Namespace
,
98 const OUString
& Name
,
99 const css::uno::Reference
< css::xml::sax::XFastAttributeList
> & Attribs
)
100 throw (css::uno::RuntimeException
, css::xml::sax::SAXException
, std::exception
) SAL_OVERRIDE
;
102 virtual void SAL_CALL
characters(const OUString
& aChars
)
103 throw (css::uno::RuntimeException
, css::xml::sax::SAXException
, std::exception
) SAL_OVERRIDE
;
105 // ::com::sun::star::xml::sax::XFastShapeContextHandler:
106 virtual css::uno::Reference
< css::drawing::XShape
> SAL_CALL
getShape()
107 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
109 virtual css::uno::Reference
< css::drawing::XDrawPage
> SAL_CALL
getDrawPage()
110 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
112 virtual void SAL_CALL setDrawPage
113 (const css::uno::Reference
< css::drawing::XDrawPage
> & the_value
)
114 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
116 virtual css::uno::Reference
< css::frame::XModel
> SAL_CALL
getModel()
117 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
119 virtual void SAL_CALL setModel
120 (const css::uno::Reference
< css::frame::XModel
> & the_value
)
121 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
123 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
124 getInputStream() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
126 virtual void SAL_CALL setInputStream
127 (const css::uno::Reference
< css::io::XInputStream
> & the_value
)
128 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
130 virtual OUString SAL_CALL
getRelationFragmentPath()
131 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
132 virtual void SAL_CALL setRelationFragmentPath
133 (const OUString
& the_value
)
134 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
136 virtual ::sal_Int32 SAL_CALL
getStartToken() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
137 virtual void SAL_CALL
setStartToken( ::sal_Int32 _starttoken
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
139 virtual css::awt::Point SAL_CALL
getPosition() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
140 virtual void SAL_CALL
setPosition(const css::awt::Point
& rPosition
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
142 virtual void SAL_CALL
setDocumentProperties(const css::uno::Reference
<css::document::XDocumentProperties
>& xDocProps
)
143 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
144 virtual css::uno::Reference
<css::document::XDocumentProperties
> SAL_CALL
getDocumentProperties()
145 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
148 ShapeContextHandler(ShapeContextHandler
&) SAL_DELETED_FUNCTION
;
149 void operator =(ShapeContextHandler
&) SAL_DELETED_FUNCTION
;
151 ::sal_uInt32 mnStartToken
;
152 css::awt::Point maPosition
;
154 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
155 drawingml::ShapePtr mpShape
;
156 ::boost::shared_ptr
< vml::Drawing
> mpDrawing
;
158 typedef boost::shared_ptr
<drawingml::GraphicShapeContext
>
159 GraphicShapeContextPtr
;
160 css::uno::Reference
<XFastContextHandler
> mxDrawingFragmentHandler
;
161 css::uno::Reference
<XFastContextHandler
> mxGraphicShapeContext
;
162 css::uno::Reference
<XFastContextHandler
> mxDiagramShapeContext
;
163 css::uno::Reference
<XFastContextHandler
> mxLockedCanvasContext
;
164 css::uno::Reference
<XFastContextHandler
> mxWpsContext
;
165 css::uno::Reference
<css::drawing::XShape
> mxSavedShape
;
166 css::uno::Reference
<XFastContextHandler
> mxWpgContext
;
167 css::uno::Reference
<XFastContextHandler
> mxChartShapeContext
;
168 css::uno::Reference
<css::document::XDocumentProperties
> mxDocumentProperties
;
170 core::XmlFilterRef mxFilterBase
;
171 drawingml::ThemePtr mpThemePtr
;
172 css::uno::Reference
<css::drawing::XDrawPage
> mxDrawPage
;
173 css::uno::Reference
<css::io::XInputStream
> mxInputStream
;
174 OUString msRelationFragmentPath
;
176 css::uno::Reference
<XFastContextHandler
> getGraphicShapeContext(::sal_Int32 Element
);
177 css::uno::Reference
<XFastContextHandler
> getChartShapeContext(::sal_Int32 Element
);
178 css::uno::Reference
<XFastContextHandler
> getDrawingShapeContext();
179 css::uno::Reference
<XFastContextHandler
> getDiagramShapeContext();
180 css::uno::Reference
<XFastContextHandler
> getLockedCanvasContext(sal_Int32 nElement
);
181 css::uno::Reference
<XFastContextHandler
> getWpsContext(sal_Int32 nStartElement
, sal_Int32 nElement
);
182 css::uno::Reference
<XFastContextHandler
> getWpgContext(sal_Int32 nElement
);
183 css::uno::Reference
<XFastContextHandler
> getContextHandler(sal_Int32 nElement
= 0);
188 #endif // INCLUDED_OOX_SOURCE_SHAPE_SHAPECONTEXTHANDLER_HXX
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */