Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / oox / source / shape / ShapeContextHandler.hxx
blob2de45f5336379c8a9134d5bf2ab03bce6edd902f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <memory>
23 #include <com/sun/star/uno/XComponentContext.hpp>
24 #include <cppuhelper/implbase.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 <oox/shape/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
39 public:
40 typedef std::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::WeakImplHelper< css::xml::sax::XFastShapeContextHandler,
51 css::lang::XServiceInfo >
53 public:
54 explicit ShapeContextHandler
55 (css::uno::Reference< css::uno::XComponentContext > const & context);
57 virtual ~ShapeContextHandler() override;
59 // css::lang::XServiceInfo:
60 virtual OUString SAL_CALL getImplementationName() override;
62 virtual sal_Bool SAL_CALL supportsService
63 (const OUString & ServiceName) override;
65 virtual css::uno::Sequence< OUString > SAL_CALL
66 getSupportedServiceNames() override;
68 // css::xml::sax::XFastContextHandler:
69 virtual void SAL_CALL startFastElement
70 (::sal_Int32 Element,
71 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
73 virtual void SAL_CALL startUnknownElement
74 (const OUString & Namespace,
75 const OUString & Name,
76 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
78 virtual void SAL_CALL endFastElement(::sal_Int32 Element) override;
80 virtual void SAL_CALL endUnknownElement
81 (const OUString & Namespace,
82 const OUString & Name) override;
84 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
85 createFastChildContext
86 (::sal_Int32 Element,
87 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
89 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
90 createUnknownChildContext
91 (const OUString & Namespace,
92 const OUString & Name,
93 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
95 virtual void SAL_CALL characters(const OUString & aChars) override;
97 // css::xml::sax::XFastShapeContextHandler:
98 virtual css::uno::Reference< css::drawing::XShape > SAL_CALL getShape() override;
100 virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getDrawPage() override;
102 virtual void SAL_CALL setDrawPage
103 (const css::uno::Reference< css::drawing::XDrawPage > & the_value) override;
105 virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel() override;
107 virtual void SAL_CALL setModel
108 (const css::uno::Reference< css::frame::XModel > & the_value) override;
110 virtual OUString SAL_CALL getRelationFragmentPath() override;
111 virtual void SAL_CALL setRelationFragmentPath
112 (const OUString & the_value) override;
114 virtual ::sal_Int32 SAL_CALL getStartToken() override;
115 virtual void SAL_CALL setStartToken( ::sal_Int32 _starttoken ) override;
117 virtual css::awt::Point SAL_CALL getPosition() override;
118 virtual void SAL_CALL setPosition(const css::awt::Point& rPosition) override;
120 virtual void SAL_CALL setDocumentProperties(const css::uno::Reference<css::document::XDocumentProperties>& xDocProps) override;
121 virtual css::uno::Reference<css::document::XDocumentProperties> SAL_CALL getDocumentProperties() override;
122 virtual css::uno::Sequence<css::beans::PropertyValue> SAL_CALL getMediaDescriptor() override;
123 virtual void SAL_CALL setMediaDescriptor(const css::uno::Sequence<css::beans::PropertyValue>& rMediaDescriptor) override;
125 private:
126 ShapeContextHandler(ShapeContextHandler const &) = delete;
127 void operator =(ShapeContextHandler const &) = delete;
129 ::sal_uInt32 mnStartToken;
130 css::awt::Point maPosition;
132 drawingml::ShapePtr mpShape;
133 std::shared_ptr< vml::Drawing > mpDrawing;
135 typedef std::shared_ptr<drawingml::GraphicShapeContext>
136 GraphicShapeContextPtr;
137 css::uno::Reference<XFastContextHandler> mxDrawingFragmentHandler;
138 css::uno::Reference<XFastContextHandler> mxGraphicShapeContext;
139 css::uno::Reference<XFastContextHandler> mxDiagramShapeContext;
140 css::uno::Reference<XFastContextHandler> mxLockedCanvasContext;
141 css::uno::Reference<XFastContextHandler> mxWpsContext;
142 css::uno::Reference<css::drawing::XShape> mxSavedShape;
143 css::uno::Reference<XFastContextHandler> mxWpgContext;
144 css::uno::Reference<XFastContextHandler> mxChartShapeContext;
145 css::uno::Reference<css::document::XDocumentProperties> mxDocumentProperties;
146 css::uno::Sequence<css::beans::PropertyValue> maMediaDescriptor;
148 ::rtl::Reference< core::XmlFilterBase > mxFilterBase;
149 drawingml::ThemePtr mpThemePtr;
150 css::uno::Reference<css::drawing::XDrawPage> mxDrawPage;
151 OUString msRelationFragmentPath;
153 css::uno::Reference<XFastContextHandler> const & getGraphicShapeContext(::sal_Int32 Element);
154 css::uno::Reference<XFastContextHandler> const & getChartShapeContext(::sal_Int32 Element);
155 css::uno::Reference<XFastContextHandler> const & getDrawingShapeContext();
156 css::uno::Reference<XFastContextHandler> const & getDiagramShapeContext();
157 css::uno::Reference<XFastContextHandler> const & getLockedCanvasContext(sal_Int32 nElement);
158 css::uno::Reference<XFastContextHandler> const & getWpsContext(sal_Int32 nStartElement, sal_Int32 nElement);
159 css::uno::Reference<XFastContextHandler> const & getWpgContext(sal_Int32 nElement);
160 css::uno::Reference<XFastContextHandler> getContextHandler(sal_Int32 nElement = 0);
165 #endif // INCLUDED_OOX_SOURCE_SHAPE_SHAPECONTEXTHANDLER_HXX
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */