Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef OOX_XLS_DRAWINGFRAGMENT_HXX
30 : : #define OOX_XLS_DRAWINGFRAGMENT_HXX
31 : :
32 : : #include <com/sun/star/awt/Rectangle.hpp>
33 : : #include <com/sun/star/awt/Size.hpp>
34 : : #include "oox/drawingml/shape.hxx"
35 : : #include "oox/drawingml/shapegroupcontext.hxx"
36 : : #include "oox/ole/axcontrol.hxx"
37 : : #include "oox/ole/vbaproject.hxx"
38 : : #include "oox/vml/vmldrawing.hxx"
39 : : #include "oox/vml/vmldrawingfragment.hxx"
40 : : #include "oox/vml/vmltextbox.hxx"
41 : : #include "drawingbase.hxx"
42 : : #include "excelhandlers.hxx"
43 : :
44 : : namespace oox { namespace ole {
45 : : struct AxFontData;
46 : : class AxMorphDataModelBase;
47 : : } }
48 : :
49 : : namespace oox {
50 : : namespace xls {
51 : :
52 : : // ============================================================================
53 : : // DrawingML
54 : : // ============================================================================
55 : :
56 [ # # ]: 0 : class ShapeMacroAttacher : public ::oox::ole::VbaMacroAttacherBase
57 : : {
58 : : public:
59 : : explicit ShapeMacroAttacher( const ::rtl::OUString& rMacroName,
60 : : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape );
61 : :
62 : : private:
63 : : virtual void attachMacro( const ::rtl::OUString& rMacroUrl );
64 : :
65 : : private:
66 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
67 : : };
68 : :
69 : : // ============================================================================
70 : :
71 [ # # ][ # # ]: 0 : class Shape : public ::oox::drawingml::Shape, public WorksheetHelper
72 : : {
73 : : public:
74 : : explicit Shape(
75 : : const WorksheetHelper& rHelper,
76 : : const AttributeList& rAttribs,
77 : : const sal_Char* pcServiceName = 0 );
78 : :
79 : : protected:
80 : : virtual void finalizeXShape(
81 : : ::oox::core::XmlFilterBase& rFilter,
82 : : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
83 : :
84 : : private:
85 : : ::rtl::OUString maMacroName;
86 : : };
87 : :
88 : : // ============================================================================
89 : :
90 : : /** Context handler for creation of shapes embedded in group shapes. */
91 [ # # ][ # # ]: 0 : class GroupShapeContext : public ::oox::drawingml::ShapeGroupContext, public WorksheetHelper
92 : : {
93 : : public:
94 : : explicit GroupShapeContext(
95 : : ::oox::core::ContextHandler& rParent,
96 : : const WorksheetHelper& rHelper,
97 : : const ::oox::drawingml::ShapePtr& rxParentShape,
98 : : const ::oox::drawingml::ShapePtr& rxShape );
99 : :
100 : : static ::oox::core::ContextHandlerRef
101 : : createShapeContext(
102 : : ::oox::core::ContextHandler& rParent,
103 : : const WorksheetHelper& rHelper,
104 : : sal_Int32 nElement,
105 : : const AttributeList& rAttribs,
106 : : const ::oox::drawingml::ShapePtr& rxParentShape,
107 : : ::oox::drawingml::ShapePtr* pxShape = 0 );
108 : :
109 : : protected:
110 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
111 : : createFastChildContext(
112 : : sal_Int32 nElement,
113 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
114 : : throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
115 : : };
116 : :
117 : : // ============================================================================
118 : :
119 : : /** Fragment handler for a complete sheet drawing. */
120 [ + - ][ + - ]: 12 : class DrawingFragment : public WorksheetFragmentBase
[ - + ]
121 : : {
122 : : public:
123 : : explicit DrawingFragment(
124 : : const WorksheetHelper& rHelper,
125 : : const ::rtl::OUString& rFragmentPath );
126 : :
127 : : protected:
128 : : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
129 : : virtual void onCharacters( const ::rtl::OUString& rChars );
130 : : virtual void onEndElement();
131 : :
132 : : private:
133 : : typedef ::std::auto_ptr< ShapeAnchor > ShapeAnchorRef;
134 : :
135 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
136 : : mxDrawPage; /// Drawing page of this sheet.
137 : : ::oox::drawingml::ShapePtr mxShape; /// Current top-level shape.
138 : : ShapeAnchorRef mxAnchor; /// Current anchor of top-level shape.
139 : : };
140 : :
141 : : // ============================================================================
142 : : // VML
143 : : // ============================================================================
144 : :
145 [ # # ]: 0 : class VmlControlMacroAttacher : public ::oox::ole::VbaMacroAttacherBase
146 : : {
147 : : public:
148 : : explicit VmlControlMacroAttacher( const ::rtl::OUString& rMacroName,
149 : : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rxCtrlFormIC,
150 : : sal_Int32 nCtrlIndex, sal_Int32 nCtrlType, sal_Int32 nDropStyle );
151 : :
152 : : private:
153 : : virtual void attachMacro( const ::rtl::OUString& rMacroUrl );
154 : :
155 : : private:
156 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > mxCtrlFormIC;
157 : : sal_Int32 mnCtrlIndex;
158 : : sal_Int32 mnCtrlType;
159 : : sal_Int32 mnDropStyle;
160 : : };
161 : :
162 : : // ============================================================================
163 : :
164 [ + - ][ + - ]: 120 : class VmlDrawing : public ::oox::vml::Drawing, public WorksheetHelper
[ + - ][ - + ]
165 : : {
166 : : public:
167 : : explicit VmlDrawing( const WorksheetHelper& rHelper );
168 : :
169 : : /** Returns the drawing shape for a cell note at the specified position. */
170 : : const ::oox::vml::ShapeBase* getNoteShape( const ::com::sun::star::table::CellAddress& rPos ) const;
171 : :
172 : : /** Filters cell note shapes. */
173 : : virtual bool isShapeSupported( const ::oox::vml::ShapeBase& rShape ) const;
174 : :
175 : : /** Returns additional base names for automatic shape name creation. */
176 : : virtual ::rtl::OUString getShapeBaseName( const ::oox::vml::ShapeBase& rShape ) const;
177 : :
178 : : /** Calculates the shape rectangle from a cell anchor string. */
179 : : virtual bool convertClientAnchor(
180 : : ::com::sun::star::awt::Rectangle& orShapeRect,
181 : : const ::rtl::OUString& rShapeAnchor ) const;
182 : :
183 : : /** Creates a UNO control shape for legacy drawing controls. */
184 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
185 : : createAndInsertClientXShape(
186 : : const ::oox::vml::ShapeBase& rShape,
187 : : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
188 : : const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
189 : :
190 : : /** Updates the bounding box covering all shapes of this drawing. */
191 : : virtual void notifyXShapeInserted(
192 : : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
193 : : const ::com::sun::star::awt::Rectangle& rShapeRect,
194 : : const ::oox::vml::ShapeBase& rShape, bool bGroupChild );
195 : :
196 : : private:
197 : : /** Converts the passed VML textbox text color to an OLE color. */
198 : : sal_uInt32 convertControlTextColor( const ::rtl::OUString& rTextColor ) const;
199 : : /** Converts the passed VML textbox font to an ActiveX form control font. */
200 : : void convertControlFontData(
201 : : ::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor,
202 : : const ::oox::vml::TextFontModel& rFontModel ) const;
203 : : /** Converts the caption, the font settings, and the horizontal alignment
204 : : from the passed VML textbox to ActiveX form control settings. */
205 : : void convertControlText(
206 : : ::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor, ::rtl::OUString& rCaption,
207 : : const ::oox::vml::TextBox* pTextBox, sal_Int32 nTextHAlign ) const;
208 : : /** Converts the passed VML shape background formatting to ActiveX control formatting. */
209 : : void convertControlBackground(
210 : : ::oox::ole::AxMorphDataModelBase& rAxModel,
211 : : const ::oox::vml::ShapeBase& rShape ) const;
212 : :
213 : : private:
214 : : ::oox::ole::ControlConverter maControlConv;
215 : : ::oox::vml::TextFontModel maListBoxFont;
216 : : };
217 : :
218 : : // ============================================================================
219 : :
220 [ + - ][ - + ]: 12 : class VmlDrawingFragment : public ::oox::vml::DrawingFragment, public WorksheetHelper
221 : : {
222 : : public:
223 : : explicit VmlDrawingFragment(
224 : : const WorksheetHelper& rHelper,
225 : : const ::rtl::OUString& rFragmentPath );
226 : :
227 : : protected:
228 : : virtual void finalizeImport();
229 : : };
230 : :
231 : : // ============================================================================
232 : :
233 : : } // namespace xls
234 : : } // namespace oox
235 : :
236 : : #endif
237 : :
238 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|