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 <stack>
28#include <rtl/ref.hxx>
29#include <com/sun/star/document/XDocumentProperties.hpp>
30#include <com/sun/star/graphic/XGraphicMapper.hpp>
31#include <com/sun/star/drawing/XDrawPage.hpp>
32#include <com/sun/star/frame/XModel.hpp>
33
34namespace oox::vml { class DrawingFragment; }
35
36namespace oox::shape {
37
38class LockedCanvasContext;
39class ShapeFilterBase;
40class WpgContext;
41class WpsContext;
42
44{
45public:
47
49 const OUString& rFragmentPath )
50 : FragmentHandler2(rFilter, rFragmentPath)
51 {
52 }
53};
54
56 public ::cppu::WeakImplHelper< css::xml::sax::XFastContextHandler >
57{
58public:
60
61 virtual ~ShapeContextHandler() override;
62
63 // css::xml::sax::XFastContextHandler:
64 virtual void SAL_CALL startFastElement
65 (::sal_Int32 Element,
66 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
67
68 virtual void SAL_CALL startUnknownElement
69 (const OUString & Namespace,
70 const OUString & Name,
71 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
72
73 virtual void SAL_CALL endFastElement(::sal_Int32 Element) override;
74
75 virtual void SAL_CALL endUnknownElement
76 (const OUString & Namespace,
77 const OUString & Name) override;
78
79 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
80 createFastChildContext
81 (::sal_Int32 Element,
82 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
83
84 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
85 createUnknownChildContext
86 (const OUString & Namespace,
87 const OUString & Name,
88 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
89
90 virtual void SAL_CALL characters(const OUString & aChars) override;
91
92 css::uno::Reference< css::drawing::XShape > getShape();
93
94 void setDrawPage(const css::uno::Reference< css::drawing::XDrawPage > & the_value);
95
96 void setModel(const css::uno::Reference< css::frame::XModel > & the_value);
97
98 void setRelationFragmentPath(const OUString & the_value);
99
100 sal_Int32 getStartToken() const;
101 void popStartToken();
102 void pushStartToken( sal_Int32 _starttoken );
103
104 void setPosition(const css::awt::Point& rPosition);
105 void setSize(const css::awt::Size& rSize);
106
107 const bool& getFullWPGSupport() { return m_bFullWPGSUpport; }
108 void setFullWPGSupport(bool bUse) { m_bFullWPGSUpport = bUse; }
109
110 bool isWordProcessingGroupShape() const { return mxWpgContext ? true : false; }
111
112 void setDocumentProperties(const css::uno::Reference<css::document::XDocumentProperties>& xDocProps);
113 void setMediaDescriptor(const css::uno::Sequence<css::beans::PropertyValue>& rMediaDescriptor);
114
115 void setGraphicMapper(css::uno::Reference<css::graphic::XGraphicMapper> const & rGraphicMapper);
116
117 void setTheme(const oox::drawingml::ThemePtr& pTheme) { mpThemePtr = pTheme; }
118 const oox::drawingml::ThemePtr& getTheme() const { return mpThemePtr; }
119
120private:
122 void operator =(ShapeContextHandler const &) = delete;
123
124 // Special stack which always has at least one element.
125 // In case of group shapes with embedded content it will have more element than one.
126 std::stack<sal_uInt32> mnStartTokenStack;
127
128 css::awt::Point maPosition;
129 css::awt::Size maSize; // from cx and cy, in EMU
130 bool m_bFullWPGSUpport; // Is this DrawingML shape supposed to be processed as WPG?
131
133 std::shared_ptr< vml::Drawing > mpDrawing;
134
138 css::uno::Reference<XFastContextHandler> mxGraphicShapeContext;
142 css::uno::Reference<css::drawing::XShape> mxSavedShape;
145 css::uno::Reference<css::document::XDocumentProperties> mxDocumentProperties;
146 css::uno::Sequence<css::beans::PropertyValue> maMediaDescriptor;
147
150 css::uno::Reference<css::drawing::XDrawPage> mxDrawPage;
152
153 css::uno::Reference<XFastContextHandler> const & getGraphicShapeContext(::sal_Int32 Element);
154 css::uno::Reference<XFastContextHandler> getChartShapeContext(::sal_Int32 Element);
155 css::uno::Reference<XFastContextHandler> getDrawingShapeContext();
156 css::uno::Reference<XFastContextHandler> getDiagramShapeContext();
157 css::uno::Reference<XFastContextHandler> getLockedCanvasContext(sal_Int32 nElement);
158 css::uno::Reference<XFastContextHandler> getWpsContext(sal_Int32 nStartElement, sal_Int32 nElement);
159 css::uno::Reference<XFastContextHandler> getWpgContext(sal_Int32 nElement);
160 css::uno::Reference<XFastContextHandler> getContextHandler(sal_Int32 nElement = 0);
161
162 void applyFontRefColor(const oox::drawingml::ShapePtr& pShape,
163 const oox::drawingml::Color& rFontRefColor);
164};
165}
166
167/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const oox::drawingml::ThemePtr & getTheme() const
css::uno::Sequence< css::beans::PropertyValue > maMediaDescriptor
css::uno::Reference< XFastContextHandler > mxGraphicShapeContext
rtl::Reference< drawingml::ChartGraphicDataContext > mxChartShapeContext
css::uno::Reference< css::document::XDocumentProperties > mxDocumentProperties
::rtl::Reference< ShapeFilterBase > mxShapeFilterBase
std::shared_ptr< vml::Drawing > mpDrawing
rtl::Reference< drawingml::GraphicShapeContext > GraphicShapeContextPtr
ShapeContextHandler(ShapeContextHandler const &)=delete
css::uno::Reference< css::drawing::XShape > mxSavedShape
void setTheme(const oox::drawingml::ThemePtr &pTheme)
rtl::Reference< vml::DrawingFragment > mxDrawingFragmentHandler
css::uno::Reference< css::drawing::XDrawPage > mxDrawPage
rtl::Reference< LockedCanvasContext > mxLockedCanvasContext
std::stack< sal_uInt32 > mnStartTokenStack
rtl::Reference< WpsContext > mxWpsContext
rtl::Reference< WpgContext > mxWpgContext
rtl::Reference< drawingml::DiagramGraphicDataContext > mxDiagramShapeContext
ShapeFragmentHandler(core::XmlFilterBase &rFilter, const OUString &rFragmentPath)
rtl::Reference< ShapeFragmentHandler > Pointer_t
#define OOX_DLLPUBLIC
Definition: dllapi.h:28
std::shared_ptr< Shape > ShapePtr
std::shared_ptr< Theme > ThemePtr
OUString Name