fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / filter / inc / drawingfragment.hxx
blob4e36ad63a1996f54b6d504e80afd71779e639dff
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_DRAWINGFRAGMENT_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_DRAWINGFRAGMENT_HXX
23 #include <com/sun/star/awt/Rectangle.hpp>
24 #include <com/sun/star/awt/Size.hpp>
25 #include <oox/drawingml/shapegroupcontext.hxx>
26 #include <oox/ole/axcontrol.hxx>
27 #include <oox/drawingml/shape.hxx>
28 #include <oox/ole/vbaproject.hxx>
29 #include <oox/vml/vmldrawing.hxx>
30 #include <oox/vml/vmldrawingfragment.hxx>
31 #include <oox/vml/vmltextbox.hxx>
32 #include "drawingbase.hxx"
33 #include "excelhandlers.hxx"
35 namespace oox { namespace ole {
36 struct AxFontData;
37 class AxMorphDataModelBase;
38 } }
40 namespace oox {
41 namespace xls {
43 // DrawingML
45 class ShapeMacroAttacher : public ::oox::ole::VbaMacroAttacherBase
47 public:
48 explicit ShapeMacroAttacher( const OUString& rMacroName,
49 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape );
51 private:
52 virtual void attachMacro( const OUString& rMacroUrl ) SAL_OVERRIDE;
54 private:
55 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
58 class Shape : public ::oox::drawingml::Shape, public WorksheetHelper
60 public:
61 explicit Shape(
62 const WorksheetHelper& rHelper,
63 const AttributeList& rAttribs,
64 const sal_Char* pcServiceName = 0 );
66 protected:
67 virtual void finalizeXShape(
68 ::oox::core::XmlFilterBase& rFilter,
69 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes ) SAL_OVERRIDE;
71 private:
72 OUString maMacroName;
75 /** Context handler for creation of shapes embedded in group shapes. */
76 class GroupShapeContext : public ::oox::drawingml::ShapeGroupContext, public WorksheetHelper
78 public:
79 explicit GroupShapeContext(
80 ::oox::core::ContextHandler2Helper& rParent,
81 const WorksheetHelper& rHelper,
82 const ::oox::drawingml::ShapePtr& rxParentShape,
83 const ::oox::drawingml::ShapePtr& rxShape );
85 static ::oox::core::ContextHandlerRef
86 createShapeContext(
87 ::oox::core::ContextHandler2Helper& rParent,
88 const WorksheetHelper& rHelper,
89 sal_Int32 nElement,
90 const AttributeList& rAttribs,
91 const ::oox::drawingml::ShapePtr& rxParentShape,
92 ::oox::drawingml::ShapePtr* pxShape = 0 );
94 protected:
95 virtual ::oox::core::ContextHandlerRef
96 onCreateContext(
97 sal_Int32 nElement,
98 const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
101 /** Fragment handler for a complete sheet drawing. */
102 class DrawingFragment : public WorksheetFragmentBase
104 public:
105 explicit DrawingFragment(
106 const WorksheetHelper& rHelper,
107 const OUString& rFragmentPath );
109 protected:
110 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
111 virtual void onCharacters( const OUString& rChars ) SAL_OVERRIDE;
112 virtual void onEndElement() SAL_OVERRIDE;
114 private:
115 typedef ::std::unique_ptr< ShapeAnchor > ShapeAnchorRef;
117 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
118 mxDrawPage; /// Drawing page of this sheet.
119 ::oox::drawingml::ShapePtr mxShape; /// Current top-level shape.
120 ShapeAnchorRef mxAnchor; /// Current anchor of top-level shape.
123 // VML
125 class VmlControlMacroAttacher : public ::oox::ole::VbaMacroAttacherBase
127 public:
128 explicit VmlControlMacroAttacher( const OUString& rMacroName,
129 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rxCtrlFormIC,
130 sal_Int32 nCtrlIndex, sal_Int32 nCtrlType, sal_Int32 nDropStyle );
132 private:
133 virtual void attachMacro( const OUString& rMacroUrl ) SAL_OVERRIDE;
135 private:
136 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > mxCtrlFormIC;
137 sal_Int32 mnCtrlIndex;
138 sal_Int32 mnCtrlType;
139 sal_Int32 mnDropStyle;
142 class VmlDrawing : public ::oox::vml::Drawing, public WorksheetHelper
144 public:
145 explicit VmlDrawing( const WorksheetHelper& rHelper );
147 /** Returns the drawing shape for a cell note at the specified position. */
148 const ::oox::vml::ShapeBase* getNoteShape( const ::com::sun::star::table::CellAddress& rPos ) const;
150 /** Filters cell note shapes. */
151 virtual bool isShapeSupported( const ::oox::vml::ShapeBase& rShape ) const SAL_OVERRIDE;
153 /** Returns additional base names for automatic shape name creation. */
154 virtual OUString getShapeBaseName( const ::oox::vml::ShapeBase& rShape ) const SAL_OVERRIDE;
156 /** Calculates the shape rectangle from a cell anchor string. */
157 virtual bool convertClientAnchor(
158 ::com::sun::star::awt::Rectangle& orShapeRect,
159 const OUString& rShapeAnchor ) const SAL_OVERRIDE;
161 /** Creates a UNO control shape for legacy drawing controls. */
162 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
163 createAndInsertClientXShape(
164 const ::oox::vml::ShapeBase& rShape,
165 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
166 const ::com::sun::star::awt::Rectangle& rShapeRect ) const SAL_OVERRIDE;
168 /** Updates the bounding box covering all shapes of this drawing. */
169 virtual void notifyXShapeInserted(
170 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
171 const ::com::sun::star::awt::Rectangle& rShapeRect,
172 const ::oox::vml::ShapeBase& rShape, bool bGroupChild ) SAL_OVERRIDE;
174 private:
175 /** Converts the passed VML textbox text color to an OLE color. */
176 sal_uInt32 convertControlTextColor( const OUString& rTextColor ) const;
177 /** Converts the passed VML textbox font to an ActiveX form control font. */
178 void convertControlFontData(
179 ::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor,
180 const ::oox::vml::TextFontModel& rFontModel ) const;
181 /** Converts the caption, the font settings, and the horizontal alignment
182 from the passed VML textbox to ActiveX form control settings. */
183 void convertControlText(
184 ::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor, OUString& rCaption,
185 const ::oox::vml::TextBox* pTextBox, sal_Int32 nTextHAlign ) const;
186 /** Converts the passed VML shape background formatting to ActiveX control formatting. */
187 void convertControlBackground(
188 ::oox::ole::AxMorphDataModelBase& rAxModel,
189 const ::oox::vml::ShapeBase& rShape ) const;
191 private:
192 ::oox::ole::ControlConverter maControlConv;
193 ::oox::vml::TextFontModel maListBoxFont;
196 class VmlDrawingFragment : public ::oox::vml::DrawingFragment, public WorksheetHelper
198 public:
199 explicit VmlDrawingFragment(
200 const WorksheetHelper& rHelper,
201 const OUString& rFragmentPath );
203 protected:
204 virtual void finalizeImport() SAL_OVERRIDE;
207 } // namespace xls
208 } // namespace oox
210 #endif
212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */