LibreOffice Module oox (master)  1
ShapeContextHandler.hxx
Go to the documentation of this file.
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 #pragma once
20 
21 #include <memory>
22 #include <cppuhelper/implbase.hxx>
26 #include <com/sun/star/uno/XComponentContext.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/document/XDocumentProperties.hpp>
29 #include <com/sun/star/graphic/XGraphicMapper.hpp>
30 #include <com/sun/star/drawing/XDrawPage.hpp>
31 #include <com/sun/star/frame/XModel.hpp>
32 
33 namespace oox::shape {
34 
35 class ShapeFilterBase;
36 
38 {
39 public:
41 
43  const OUString& rFragmentPath )
44  : FragmentHandler2(rFilter, rFragmentPath)
45  {
46  }
47 };
48 
50  public ::cppu::WeakImplHelper< css::xml::sax::XFastContextHandler >
51 {
52 public:
53  explicit ShapeContextHandler(const rtl::Reference<ShapeFilterBase>& xFilterBase);
54 
55  virtual ~ShapeContextHandler() override;
56 
57  // css::xml::sax::XFastContextHandler:
58  virtual void SAL_CALL startFastElement
59  (::sal_Int32 Element,
60  const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
61 
62  virtual void SAL_CALL startUnknownElement
63  (const OUString & Namespace,
64  const OUString & Name,
65  const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
66 
67  virtual void SAL_CALL endFastElement(::sal_Int32 Element) override;
68 
69  virtual void SAL_CALL endUnknownElement
70  (const OUString & Namespace,
71  const OUString & Name) override;
72 
73  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
74  createFastChildContext
75  (::sal_Int32 Element,
76  const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
77 
78  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
79  createUnknownChildContext
80  (const OUString & Namespace,
81  const OUString & Name,
82  const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
83 
84  virtual void SAL_CALL characters(const OUString & aChars) override;
85 
86  css::uno::Reference< css::drawing::XShape > getShape();
87 
88  void setDrawPage(const css::uno::Reference< css::drawing::XDrawPage > & the_value);
89 
90  void setModel(const css::uno::Reference< css::frame::XModel > & the_value);
91 
92  void setRelationFragmentPath(const OUString & the_value);
93 
94  sal_Int32 getStartToken();
95  void setStartToken( sal_Int32 _starttoken );
96 
97  void setPosition(const css::awt::Point& rPosition);
98 
99  void setDocumentProperties(const css::uno::Reference<css::document::XDocumentProperties>& xDocProps);
100  void setMediaDescriptor(const css::uno::Sequence<css::beans::PropertyValue>& rMediaDescriptor);
101 
102  void setGraphicMapper(css::uno::Reference<css::graphic::XGraphicMapper> const & rGraphicMapper);
103 
104  void setTheme(const oox::drawingml::ThemePtr& pTheme) { mpThemePtr = pTheme; }
105  const oox::drawingml::ThemePtr& getTheme() { return mpThemePtr; }
106 
107 private:
108  ShapeContextHandler(ShapeContextHandler const &) = delete;
109  void operator =(ShapeContextHandler const &) = delete;
110 
111  ::sal_uInt32 mnStartToken;
112  css::awt::Point maPosition;
113 
115  std::shared_ptr< vml::Drawing > mpDrawing;
116 
119  css::uno::Reference<XFastContextHandler> mxDrawingFragmentHandler;
120  css::uno::Reference<XFastContextHandler> mxGraphicShapeContext;
121  css::uno::Reference<XFastContextHandler> mxDiagramShapeContext;
122  css::uno::Reference<XFastContextHandler> mxLockedCanvasContext;
123  css::uno::Reference<XFastContextHandler> mxWpsContext;
124  css::uno::Reference<css::drawing::XShape> mxSavedShape;
125  css::uno::Reference<XFastContextHandler> mxWpgContext;
126  css::uno::Reference<XFastContextHandler> mxChartShapeContext;
127  css::uno::Reference<css::document::XDocumentProperties> mxDocumentProperties;
128  css::uno::Sequence<css::beans::PropertyValue> maMediaDescriptor;
129 
132  css::uno::Reference<css::drawing::XDrawPage> mxDrawPage;
134 
135  css::uno::Reference<XFastContextHandler> const & getGraphicShapeContext(::sal_Int32 Element);
136  css::uno::Reference<XFastContextHandler> const & getChartShapeContext(::sal_Int32 Element);
137  css::uno::Reference<XFastContextHandler> const & getDrawingShapeContext();
138  css::uno::Reference<XFastContextHandler> const & getDiagramShapeContext();
139  css::uno::Reference<XFastContextHandler> const & getLockedCanvasContext(sal_Int32 nElement);
140  css::uno::Reference<XFastContextHandler> const & getWpsContext(sal_Int32 nStartElement, sal_Int32 nElement);
141  css::uno::Reference<XFastContextHandler> const & getWpgContext(sal_Int32 nElement);
142  css::uno::Reference<XFastContextHandler> getContextHandler(sal_Int32 nElement = 0);
143 };
144 
145 }
146 
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::drawing::XDrawPage > mxDrawPage
css::uno::Reference< XFastContextHandler > mxDiagramShapeContext
css::uno::Reference< XFastContextHandler > mxWpgContext
css::uno::Reference< XFastContextHandler > mxChartShapeContext
::rtl::Reference< ShapeFilterBase > mxShapeFilterBase
css::uno::Reference< XFastContextHandler > mxDrawingFragmentHandler
OUString Name
ShapeFragmentHandler(core::XmlFilterBase &rFilter, const OUString &rFragmentPath)
css::uno::Sequence< css::beans::PropertyValue > maMediaDescriptor
const oox::drawingml::ThemePtr & getTheme()
rtl::Reference< ShapeFragmentHandler > Pointer_t
css::uno::Reference< XFastContextHandler > mxGraphicShapeContext
css::uno::Reference< css::drawing::XShape > mxSavedShape
rtl::Reference< drawingml::GraphicShapeContext > GraphicShapeContextPtr
css::uno::Reference< css::document::XDocumentProperties > mxDocumentProperties
css::uno::Reference< XFastContextHandler > mxWpsContext
#define OOX_DLLPUBLIC
Definition: dllapi.h:28
css::uno::Reference< XFastContextHandler > mxLockedCanvasContext
std::shared_ptr< vml::Drawing > mpDrawing
std::shared_ptr< Shape > ShapePtr
void setTheme(const oox::drawingml::ThemePtr &pTheme)
std::shared_ptr< Theme > ThemePtr