LibreOffice Module sc (master) 1
drawingfragment.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
20#pragma once
21
22#include <memory>
25#include <oox/ole/axcontrol.hxx>
31#include "drawingbase.hxx"
32#include "excelhandlers.hxx"
33
34namespace oox::ole {
35 struct AxFontData;
36}
37
38namespace oox::xls {
39
40// DrawingML
41
43{
44public:
45 explicit ShapeMacroAttacher( const OUString& rMacroName,
46 const css::uno::Reference< css::drawing::XShape >& rxShape );
47
48private:
49 virtual void attachMacro( const OUString& rMacroUrl ) override;
50
51private:
52 css::uno::Reference< css::drawing::XShape > mxShape;
53};
54
55class Shape final : public ::oox::drawingml::Shape, public WorksheetHelper
56{
57public:
58 explicit Shape(
59 const WorksheetHelper& rHelper,
60 const AttributeList& rAttribs,
61 const char* pcServiceName );
62
63private:
64 virtual void finalizeXShape(
66 const css::uno::Reference< css::drawing::XShapes >& rxShapes ) override;
67
68 OUString maMacroName;
69};
70
73{
74public:
76 const ::oox::core::FragmentHandler2& rParent,
77 const WorksheetHelper& rHelper,
78 const ::oox::drawingml::ShapePtr& rxParentShape,
79 const ::oox::drawingml::ShapePtr& rxShape );
80
81 static ::oox::core::ContextHandlerRef
84 const WorksheetHelper& rHelper,
85 sal_Int32 nElement,
86 const AttributeList& rAttribs,
87 const ::oox::drawingml::ShapePtr& rxParentShape,
88 ::oox::drawingml::ShapePtr* pxShape = nullptr );
89
90private:
91 virtual ::oox::core::ContextHandlerRef
93 sal_Int32 nElement,
94 const ::oox::AttributeList& rAttribs ) override;
95};
96
99{
100public:
101 explicit DrawingFragment(
102 const WorksheetHelper& rHelper,
103 const OUString& rFragmentPath );
104
105private:
106 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
107 virtual void onCharacters( const OUString& rChars ) override;
108 virtual void onEndElement() override;
109
110 typedef ::std::unique_ptr< ShapeAnchor > ShapeAnchorRef;
111
112 css::uno::Reference< css::drawing::XShapes >
116 // for SmartArt. Apply the colors in rFontRefColor (from clrScheme) to all shapes in pShape,
117 // the group object which represents the SmartArt.
119 const oox::drawingml::Color& rFontRefColor);
120};
121
122// VML
123
125{
126public:
127 explicit VmlControlMacroAttacher( const OUString& rMacroName,
128 const css::uno::Reference< css::container::XIndexContainer >& rxCtrlFormIC,
129 sal_Int32 nCtrlIndex, sal_Int32 nCtrlType, sal_Int32 nDropStyle );
130
131private:
132 virtual void attachMacro( const OUString& rMacroUrl ) override;
133
134private:
135 css::uno::Reference< css::container::XIndexContainer > mxCtrlFormIC;
136 sal_Int32 mnCtrlIndex;
137 sal_Int32 mnCtrlType;
138 sal_Int32 mnDropStyle;
139};
140
142{
143public:
144 explicit VmlDrawing( const WorksheetHelper& rHelper );
145
147 const ::oox::vml::ShapeBase* getNoteShape( const ScAddress& rPos ) const;
148
150 virtual bool isShapeSupported( const ::oox::vml::ShapeBase& rShape ) const override;
151
153 virtual OUString getShapeBaseName( const ::oox::vml::ShapeBase& rShape ) const override;
154
156 virtual bool convertClientAnchor(
157 css::awt::Rectangle& orShapeRect,
158 const OUString& rShapeAnchor ) const override;
159
161 virtual css::uno::Reference< css::drawing::XShape >
163 const ::oox::vml::ShapeBase& rShape,
164 const css::uno::Reference< css::drawing::XShapes >& rxShapes,
165 const css::awt::Rectangle& rShapeRect ) const override;
166
168 virtual void notifyXShapeInserted(
169 const css::uno::Reference< css::drawing::XShape >& rxShape,
170 const css::awt::Rectangle& rShapeRect,
171 const ::oox::vml::ShapeBase& rShape, bool bGroupChild ) override;
172
173private:
175 sal_uInt32 convertControlTextColor( std::u16string_view aTextColor ) const;
178 ::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor,
179 const ::oox::vml::TextFontModel& rFontModel ) const;
183 ::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor, OUString& rCaption,
184 const ::oox::vml::TextBox* pTextBox, sal_Int32 nTextHAlign ) const;
188 const ::oox::vml::ShapeBase& rShape ) const;
189
190private:
193};
194
196{
197public:
198 explicit VmlDrawingFragment(
199 const WorksheetHelper& rHelper,
200 const OUString& rFragmentPath );
201
202private:
203 virtual void finalizeImport() override;
204};
205
206} // namespace oox::xls
207
208/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Fragment handler for a complete sheet drawing.
ShapeAnchorRef mxAnchor
Current top-level shape.
::oox::drawingml::ShapePtr mxShape
Drawing page of this sheet.
void applyFontRefColor(const oox::drawingml::ShapePtr &pShape, const oox::drawingml::Color &rFontRefColor)
Current anchor of top-level shape.
virtual void onEndElement() override
virtual void onCharacters(const OUString &rChars) override
css::uno::Reference< css::drawing::XShapes > mxDrawPage
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
DrawingFragment(const WorksheetHelper &rHelper, const OUString &rFragmentPath)
::std::unique_ptr< ShapeAnchor > ShapeAnchorRef
Context handler for creation of shapes embedded in group shapes.
GroupShapeContext(const ::oox::core::FragmentHandler2 &rParent, const WorksheetHelper &rHelper, const ::oox::drawingml::ShapePtr &rxParentShape, const ::oox::drawingml::ShapePtr &rxShape)
::oox::core::ContextHandlerRef createShapeContext(::oox::core::FragmentHandler2 &rParent, const WorksheetHelper &rHelper, sal_Int32 nElement, const AttributeList &rAttribs, const ::oox::drawingml::ShapePtr &rxParentShape, ::oox::drawingml::ShapePtr *pxShape=nullptr)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const ::oox::AttributeList &rAttribs) override
css::uno::Reference< css::drawing::XShape > mxShape
virtual void attachMacro(const OUString &rMacroUrl) override
ShapeMacroAttacher(const OUString &rMacroName, const css::uno::Reference< css::drawing::XShape > &rxShape)
virtual void finalizeXShape(::oox::core::XmlFilterBase &rFilter, const css::uno::Reference< css::drawing::XShapes > &rxShapes) override
Shape(const WorksheetHelper &rHelper, const AttributeList &rAttribs, const char *pcServiceName)
virtual void attachMacro(const OUString &rMacroUrl) override
VmlControlMacroAttacher(const OUString &rMacroName, const css::uno::Reference< css::container::XIndexContainer > &rxCtrlFormIC, sal_Int32 nCtrlIndex, sal_Int32 nCtrlType, sal_Int32 nDropStyle)
css::uno::Reference< css::container::XIndexContainer > mxCtrlFormIC
virtual void finalizeImport() override
VmlDrawingFragment(const WorksheetHelper &rHelper, const OUString &rFragmentPath)
virtual bool isShapeSupported(const ::oox::vml::ShapeBase &rShape) const override
Filters cell note shapes.
VmlDrawing(const WorksheetHelper &rHelper)
void convertControlText(::oox::ole::AxFontData &rAxFontData, sal_uInt32 &rnOleTextColor, OUString &rCaption, const ::oox::vml::TextBox *pTextBox, sal_Int32 nTextHAlign) const
Converts the caption, the font settings, and the horizontal alignment from the passed VML textbox to ...
virtual bool convertClientAnchor(css::awt::Rectangle &orShapeRect, const OUString &rShapeAnchor) const override
Calculates the shape rectangle from a cell anchor string.
void convertControlBackground(::oox::ole::AxMorphDataModelBase &rAxModel, const ::oox::vml::ShapeBase &rShape) const
Converts the passed VML shape background formatting to ActiveX control formatting.
virtual OUString getShapeBaseName(const ::oox::vml::ShapeBase &rShape) const override
Returns additional base names for automatic shape name creation.
const ::oox::vml::ShapeBase * getNoteShape(const ScAddress &rPos) const
Returns the drawing shape for a cell note at the specified position.
void convertControlFontData(::oox::ole::AxFontData &rAxFontData, sal_uInt32 &rnOleTextColor, const ::oox::vml::TextFontModel &rFontModel) const
Converts the passed VML textbox font to an ActiveX form control font.
::oox::vml::TextFontModel maListBoxFont
virtual void notifyXShapeInserted(const css::uno::Reference< css::drawing::XShape > &rxShape, const css::awt::Rectangle &rShapeRect, const ::oox::vml::ShapeBase &rShape, bool bGroupChild) override
Updates the bounding box covering all shapes of this drawing.
virtual css::uno::Reference< css::drawing::XShape > createAndInsertClientXShape(const ::oox::vml::ShapeBase &rShape, const css::uno::Reference< css::drawing::XShapes > &rxShapes, const css::awt::Rectangle &rShapeRect) const override
Creates a UNO control shape for legacy drawing controls.
::oox::ole::ControlConverter maControlConv
sal_uInt32 convertControlTextColor(std::u16string_view aTextColor) const
Converts the passed VML textbox text color to an OLE color.
Fragment handler derived from the WorksheetHelper helper class.
std::shared_ptr< Shape > ShapePtr