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>
27#include <com/sun/star/document/XDocumentProperties.hpp>
28#include <com/sun/star/graphic/XGraphicMapper.hpp>
29#include <com/sun/star/drawing/XDrawPage.hpp>
30#include <com/sun/star/frame/XModel.hpp>
31
32namespace oox::shape {
33
34class ShapeFilterBase;
35
37{
38public:
40
42 const OUString& rFragmentPath )
43 : FragmentHandler2(rFilter, rFragmentPath)
44 {
45 }
46};
47
49 public ::cppu::WeakImplHelper< css::xml::sax::XFastContextHandler >
50{
51public:
53
54 virtual ~ShapeContextHandler() override;
55
56 // css::xml::sax::XFastContextHandler:
57 virtual void SAL_CALL startFastElement
58 (::sal_Int32 Element,
59 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
60
61 virtual void SAL_CALL startUnknownElement
62 (const OUString & Namespace,
63 const OUString & Name,
64 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
65
66 virtual void SAL_CALL endFastElement(::sal_Int32 Element) override;
67
68 virtual void SAL_CALL endUnknownElement
69 (const OUString & Namespace,
70 const OUString & Name) override;
71
72 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
73 createFastChildContext
74 (::sal_Int32 Element,
75 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
76
77 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
78 createUnknownChildContext
79 (const OUString & Namespace,
80 const OUString & Name,
81 const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
82
83 virtual void SAL_CALL characters(const OUString & aChars) override;
84
85 css::uno::Reference< css::drawing::XShape > getShape();
86
87 void setDrawPage(const css::uno::Reference< css::drawing::XDrawPage > & the_value);
88
89 void setModel(const css::uno::Reference< css::frame::XModel > & the_value);
90
91 void setRelationFragmentPath(const OUString & the_value);
92
93 sal_Int32 getStartToken() const;
94 void popStartToken();
95 void pushStartToken( sal_Int32 _starttoken );
96
97 void setPosition(const css::awt::Point& rPosition);
98
99 const bool& getFullWPGSupport() { return m_bFullWPGSUpport; }
100 void setFullWPGSupport(bool bUse) { m_bFullWPGSUpport = bUse; }
101
102 bool isWordProcessingGroupShape() const { return mxWpgContext ? true : false; }
103
104 void setDocumentProperties(const css::uno::Reference<css::document::XDocumentProperties>& xDocProps);
105 void setMediaDescriptor(const css::uno::Sequence<css::beans::PropertyValue>& rMediaDescriptor);
106
107 void setGraphicMapper(css::uno::Reference<css::graphic::XGraphicMapper> const & rGraphicMapper);
108
109 void setTheme(const oox::drawingml::ThemePtr& pTheme) { mpThemePtr = pTheme; }
110 const oox::drawingml::ThemePtr& getTheme() const { return mpThemePtr; }
111
112private:
114 void operator =(ShapeContextHandler const &) = delete;
115
116 // Special stack which always has at least one element.
117 // In case of group shapes with embedded content it will have more element than one.
118 std::stack<sal_uInt32> mnStartTokenStack;
119
120 css::awt::Point maPosition;
121 bool m_bFullWPGSUpport; // Is this DrawingML shape supposed to be processed as WPG?
122
124 std::shared_ptr< vml::Drawing > mpDrawing;
125
128 css::uno::Reference<XFastContextHandler> mxDrawingFragmentHandler;
129 css::uno::Reference<XFastContextHandler> mxGraphicShapeContext;
130 css::uno::Reference<XFastContextHandler> mxDiagramShapeContext;
131 css::uno::Reference<XFastContextHandler> mxLockedCanvasContext;
132 css::uno::Reference<XFastContextHandler> mxWpsContext;
133 css::uno::Reference<css::drawing::XShape> mxSavedShape;
134 css::uno::Reference<XFastContextHandler> mxWpgContext;
135 css::uno::Reference<XFastContextHandler> mxChartShapeContext;
136 css::uno::Reference<css::document::XDocumentProperties> mxDocumentProperties;
137 css::uno::Sequence<css::beans::PropertyValue> maMediaDescriptor;
138
141 css::uno::Reference<css::drawing::XDrawPage> mxDrawPage;
143
144 css::uno::Reference<XFastContextHandler> const & getGraphicShapeContext(::sal_Int32 Element);
145 css::uno::Reference<XFastContextHandler> const & getChartShapeContext(::sal_Int32 Element);
146 css::uno::Reference<XFastContextHandler> const & getDrawingShapeContext();
147 css::uno::Reference<XFastContextHandler> const & getDiagramShapeContext();
148 css::uno::Reference<XFastContextHandler> const & getLockedCanvasContext(sal_Int32 nElement);
149 css::uno::Reference<XFastContextHandler> const & getWpsContext(sal_Int32 nStartElement, sal_Int32 nElement);
150 css::uno::Reference<XFastContextHandler> const & getWpgContext(sal_Int32 nElement);
151 css::uno::Reference<XFastContextHandler> getContextHandler(sal_Int32 nElement = 0);
152};
153
154}
155
156/* 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
css::uno::Reference< XFastContextHandler > 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< XFastContextHandler > mxDiagramShapeContext
css::uno::Reference< css::drawing::XShape > mxSavedShape
void setTheme(const oox::drawingml::ThemePtr &pTheme)
css::uno::Reference< css::drawing::XDrawPage > mxDrawPage
std::stack< sal_uInt32 > mnStartTokenStack
css::uno::Reference< XFastContextHandler > mxWpsContext
css::uno::Reference< XFastContextHandler > mxWpgContext
css::uno::Reference< XFastContextHandler > mxLockedCanvasContext
css::uno::Reference< XFastContextHandler > mxDrawingFragmentHandler
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