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