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 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_DRAWINGFRAGMENT_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_DRAWINGFRAGMENT_HXX
22 
23 #include <memory>
25 #include <oox/ole/axcontrol.hxx>
26 #include <oox/drawingml/shape.hxx>
27 #include <oox/ole/vbaproject.hxx>
28 #include <oox/vml/vmldrawing.hxx>
30 #include <oox/vml/vmltextbox.hxx>
31 #include "drawingbase.hxx"
32 #include "excelhandlers.hxx"
33 
34 namespace oox::ole {
35  struct AxFontData;
36 }
37 
38 namespace oox::xls {
39 
40 // DrawingML
41 
43 {
44 public:
45  explicit ShapeMacroAttacher( const OUString& rMacroName,
46  const css::uno::Reference< css::drawing::XShape >& rxShape );
47 
48 private:
49  virtual void attachMacro( const OUString& rMacroUrl ) override;
50 
51 private:
52  css::uno::Reference< css::drawing::XShape > mxShape;
53 };
54 
56 {
57 public:
58  explicit Shape(
59  const WorksheetHelper& rHelper,
60  const AttributeList& rAttribs,
61  const char* pcServiceName );
62 
63 protected:
64  virtual void finalizeXShape(
65  ::oox::core::XmlFilterBase& rFilter,
66  const css::uno::Reference< css::drawing::XShapes >& rxShapes ) override;
67 
68 private:
69  OUString maMacroName;
70 };
71 
74 {
75 public:
76  explicit GroupShapeContext(
77  const ::oox::core::FragmentHandler2& rParent,
78  const WorksheetHelper& rHelper,
79  const ::oox::drawingml::ShapePtr& rxParentShape,
80  const ::oox::drawingml::ShapePtr& rxShape );
81 
82  static ::oox::core::ContextHandlerRef
84  ::oox::core::FragmentHandler2& rParent,
85  const WorksheetHelper& rHelper,
86  sal_Int32 nElement,
87  const AttributeList& rAttribs,
88  const ::oox::drawingml::ShapePtr& rxParentShape,
89  ::oox::drawingml::ShapePtr* pxShape = nullptr );
90 
91 protected:
92  virtual ::oox::core::ContextHandlerRef
94  sal_Int32 nElement,
95  const ::oox::AttributeList& rAttribs ) override;
96 };
97 
100 {
101 public:
102  explicit DrawingFragment(
103  const WorksheetHelper& rHelper,
104  const OUString& rFragmentPath );
105 
106 protected:
107  virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
108  virtual void onCharacters( const OUString& rChars ) override;
109  virtual void onEndElement() override;
110 
111 private:
112  typedef ::std::unique_ptr< ShapeAnchor > ShapeAnchorRef;
113 
114  css::uno::Reference< css::drawing::XShapes >
117  ShapeAnchorRef mxAnchor;
118 };
119 
120 // VML
121 
123 {
124 public:
125  explicit VmlControlMacroAttacher( const OUString& rMacroName,
126  const css::uno::Reference< css::container::XIndexContainer >& rxCtrlFormIC,
127  sal_Int32 nCtrlIndex, sal_Int32 nCtrlType, sal_Int32 nDropStyle );
128 
129 private:
130  virtual void attachMacro( const OUString& rMacroUrl ) override;
131 
132 private:
133  css::uno::Reference< css::container::XIndexContainer > mxCtrlFormIC;
134  sal_Int32 mnCtrlIndex;
135  sal_Int32 mnCtrlType;
136  sal_Int32 mnDropStyle;
137 };
138 
140 {
141 public:
142  explicit VmlDrawing( const WorksheetHelper& rHelper );
143 
145  const ::oox::vml::ShapeBase* getNoteShape( const ScAddress& rPos ) const;
146 
148  virtual bool isShapeSupported( const ::oox::vml::ShapeBase& rShape ) const override;
149 
151  virtual OUString getShapeBaseName( const ::oox::vml::ShapeBase& rShape ) const override;
152 
154  virtual bool convertClientAnchor(
155  css::awt::Rectangle& orShapeRect,
156  const OUString& rShapeAnchor ) const override;
157 
159  virtual css::uno::Reference< css::drawing::XShape >
161  const ::oox::vml::ShapeBase& rShape,
162  const css::uno::Reference< css::drawing::XShapes >& rxShapes,
163  const css::awt::Rectangle& rShapeRect ) const override;
164 
166  virtual void notifyXShapeInserted(
167  const css::uno::Reference< css::drawing::XShape >& rxShape,
168  const css::awt::Rectangle& rShapeRect,
169  const ::oox::vml::ShapeBase& rShape, bool bGroupChild ) override;
170 
171 private:
173  sal_uInt32 convertControlTextColor( const OUString& rTextColor ) const;
176  ::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor,
177  const ::oox::vml::TextFontModel& rFontModel ) const;
180  void convertControlText(
181  ::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor, OUString& rCaption,
182  const ::oox::vml::TextBox* pTextBox, sal_Int32 nTextHAlign ) const;
185  ::oox::ole::AxMorphDataModelBase& rAxModel,
186  const ::oox::vml::ShapeBase& rShape ) const;
187 
188 private:
191 };
192 
194 {
195 public:
196  explicit VmlDrawingFragment(
197  const WorksheetHelper& rHelper,
198  const OUString& rFragmentPath );
199 
200 protected:
201  virtual void finalizeImport() override;
202 };
203 
204 } // namespace oox::xls
205 
206 #endif
207 
208 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
VmlDrawingFragment(const WorksheetHelper &rHelper, const OUString &rFragmentPath)
virtual OUString getShapeBaseName(const ::oox::vml::ShapeBase &rShape) const override
Returns additional base names for automatic shape name creation.
css::uno::Reference< css::drawing::XShape > mxShape
::oox::ole::ControlConverter maControlConv
Shape(const WorksheetHelper &rHelper, const AttributeList &rAttribs, const char *pcServiceName)
virtual bool isShapeSupported(const ::oox::vml::ShapeBase &rShape) const override
Filters cell note shapes.
Context handler for creation of shapes embedded in group shapes.
Fragment handler for a complete sheet drawing.
ShapeMacroAttacher(const OUString &rMacroName, const css::uno::Reference< css::drawing::XShape > &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 void finalizeXShape(::oox::core::XmlFilterBase &rFilter, const css::uno::Reference< css::drawing::XShapes > &rxShapes) override
virtual bool convertClientAnchor(css::awt::Rectangle &orShapeRect, const OUString &rShapeAnchor) const override
Calculates the shape rectangle from a cell anchor string.
const ::oox::vml::ShapeBase * getNoteShape(const ScAddress &rPos) const
Returns the drawing shape for a cell note at the specified position.
::oox::drawingml::ShapePtr mxShape
Drawing page of this sheet.
::std::unique_ptr< ShapeAnchor > ShapeAnchorRef
virtual void onEndElement() override
virtual void finalizeImport() override
css::uno::Reference< css::drawing::XShapes > mxDrawPage
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.
css::uno::Reference< css::container::XIndexContainer > mxCtrlFormIC
DrawingFragment(const WorksheetHelper &rHelper, const OUString &rFragmentPath)
virtual void attachMacro(const OUString &rMacroUrl) override
Fragment handler derived from the WorksheetHelper helper class.
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.
void convertControlBackground(::oox::ole::AxMorphDataModelBase &rAxModel, const ::oox::vml::ShapeBase &rShape) const
Converts the passed VML shape background formatting to ActiveX control formatting.
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 ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const ::oox::AttributeList &rAttribs) override
VmlControlMacroAttacher(const OUString &rMacroName, const css::uno::Reference< css::container::XIndexContainer > &rxCtrlFormIC, sal_Int32 nCtrlIndex, sal_Int32 nCtrlType, sal_Int32 nDropStyle)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
GroupShapeContext(const ::oox::core::FragmentHandler2 &rParent, const WorksheetHelper &rHelper, const ::oox::drawingml::ShapePtr &rxParentShape, const ::oox::drawingml::ShapePtr &rxShape)
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.
std::shared_ptr< Shape > ShapePtr
::oox::vml::TextFontModel maListBoxFont
VmlDrawing(const WorksheetHelper &rHelper)
ShapeAnchorRef mxAnchor
Current top-level shape.
virtual void onCharacters(const OUString &rChars) override
sal_uInt32 convertControlTextColor(const OUString &rTextColor) const
Converts the passed VML textbox text color to an OLE color.
virtual void attachMacro(const OUString &rMacroUrl) override