Line data Source code
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_OOX_OLE_AXCONTROL_HXX
21 : #define INCLUDED_OOX_OLE_AXCONTROL_HXX
22 :
23 : #include <oox/helper/binarystreambase.hxx>
24 : #include <oox/helper/propertyset.hxx>
25 : #include <oox/ole/axbinaryreader.hxx>
26 : #include <oox/ole/olehelper.hxx>
27 : #include <oox/dllapi.h>
28 : #include <memory>
29 :
30 : namespace com { namespace sun { namespace star {
31 : namespace awt { class XControlModel; }
32 : namespace container { class XIndexContainer; }
33 : namespace drawing { class XDrawPage; }
34 : namespace frame { class XModel; }
35 : namespace form { class XFormsSupplier; }
36 : namespace lang { class XMultiServiceFactory; }
37 : } } }
38 :
39 : namespace oox {
40 : class BinaryInputStream;
41 : class GraphicHelper;
42 : class PropertyMap;
43 : }
44 :
45 : namespace oox {
46 : namespace ole {
47 :
48 :
49 :
50 : #define COMCTL_GUID_SCROLLBAR_60 "{FE38753A-44A3-11D1-B5B7-0000C09000C4}"
51 : #define COMCTL_GUID_PROGRESSBAR_50 "{0713E8D2-850A-101B-AFC0-4210102A8DA7}"
52 : #define COMCTL_GUID_PROGRESSBAR_60 "{35053A22-8589-11D1-B16A-00C0F0283628}"
53 :
54 : const sal_uInt16 COMCTL_VERSION_50 = 5;
55 : const sal_uInt16 COMCTL_VERSION_60 = 6;
56 :
57 :
58 :
59 : #define AX_GUID_COMMANDBUTTON "{D7053240-CE69-11CD-a777-00dd01143c57}"
60 : #define AX_GUID_LABEL "{978C9E23-D4B0-11CE-bf2d-00aa003f40d0}"
61 : #define AX_GUID_IMAGE "{4C599241-6926-101B-9992-00000b65c6f9}"
62 : #define AX_GUID_TOGGLEBUTTON "{8BD21D60-EC42-11CE-9e0d-00aa006002f3}"
63 : #define AX_GUID_CHECKBOX "{8BD21D40-EC42-11CE-9e0d-00aa006002f3}"
64 : #define AX_GUID_OPTIONBUTTON "{8BD21D50-EC42-11CE-9e0d-00aa006002f3}"
65 : #define AX_GUID_TEXTBOX "{8BD21D10-EC42-11CE-9e0d-00aa006002f3}"
66 : #define AX_GUID_LISTBOX "{8BD21D20-EC42-11CE-9e0d-00aa006002f3}"
67 : #define AX_GUID_COMBOBOX "{8BD21D30-EC42-11CE-9e0d-00aa006002f3}"
68 : #define AX_GUID_SPINBUTTON "{79176FB0-B7F2-11CE-97ef-00aa006d2776}"
69 : #define AX_GUID_SCROLLBAR "{DFD181E0-5E2F-11CE-a449-00aa004a803d}"
70 : #define AX_GUID_FRAME "{6E182020-F460-11CE-9bcd-00aa00608e01}"
71 :
72 : // Html control GUID(s)
73 :
74 : #define HTML_GUID_SELECT "{5512D122-5CC6-11CF-8d67-00aa00bdce1d}"
75 : #define HTML_GUID_TEXTBOX "{5512D124-5CC6-11CF-8d67-00aa00bdce1d}"
76 :
77 : const sal_uInt32 AX_SYSCOLOR_WINDOWBACK = 0x80000005;
78 : const sal_uInt32 AX_SYSCOLOR_WINDOWFRAME = 0x80000006;
79 : const sal_uInt32 AX_SYSCOLOR_WINDOWTEXT = 0x80000008;
80 : const sal_uInt32 AX_SYSCOLOR_BUTTONFACE = 0x8000000F;
81 : const sal_uInt32 AX_SYSCOLOR_BUTTONTEXT = 0x80000012;
82 :
83 : const sal_uInt32 AX_FLAGS_ENABLED = 0x00000002;
84 : const sal_uInt32 AX_FLAGS_LOCKED = 0x00000004;
85 : const sal_uInt32 AX_FLAGS_OPAQUE = 0x00000008;
86 : const sal_uInt32 AX_FLAGS_COLUMNHEADS = 0x00000400;
87 : const sal_uInt32 AX_FLAGS_ENTIREROWS = 0x00000800;
88 : const sal_uInt32 AX_FLAGS_EXISTINGENTRIES = 0x00001000;
89 : const sal_uInt32 AX_FLAGS_CAPTIONLEFT = 0x00002000;
90 : const sal_uInt32 AX_FLAGS_EDITABLE = 0x00004000;
91 : const sal_uInt32 AX_FLAGS_IMEMODE_MASK = 0x00078000;
92 : const sal_uInt32 AX_FLAGS_DRAGENABLED = 0x00080000;
93 : const sal_uInt32 AX_FLAGS_ENTERASNEWLINE = 0x00100000;
94 : const sal_uInt32 AX_FLAGS_KEEPSELECTION = 0x00200000;
95 : const sal_uInt32 AX_FLAGS_TABASCHARACTER = 0x00400000;
96 : const sal_uInt32 AX_FLAGS_WORDWRAP = 0x00800000;
97 : const sal_uInt32 AX_FLAGS_BORDERSSUPPRESSED = 0x02000000;
98 : const sal_uInt32 AX_FLAGS_SELECTLINE = 0x04000000;
99 : const sal_uInt32 AX_FLAGS_SINGLECHARSELECT = 0x08000000;
100 : const sal_uInt32 AX_FLAGS_AUTOSIZE = 0x10000000;
101 : const sal_uInt32 AX_FLAGS_HIDESELECTION = 0x20000000;
102 : const sal_uInt32 AX_FLAGS_MAXLENAUTOTAB = 0x40000000;
103 : const sal_uInt32 AX_FLAGS_MULTILINE = 0x80000000;
104 :
105 : const sal_Int32 AX_BORDERSTYLE_NONE = 0;
106 : const sal_Int32 AX_BORDERSTYLE_SINGLE = 1;
107 :
108 : const sal_Int32 AX_SPECIALEFFECT_FLAT = 0;
109 : const sal_Int32 AX_SPECIALEFFECT_RAISED = 1;
110 : const sal_Int32 AX_SPECIALEFFECT_SUNKEN = 2;
111 : const sal_Int32 AX_SPECIALEFFECT_ETCHED = 3;
112 : const sal_Int32 AX_SPECIALEFFECT_BUMPED = 6;
113 :
114 : const sal_Int32 AX_PICSIZE_CLIP = 0;
115 : const sal_Int32 AX_PICSIZE_STRETCH = 1;
116 : const sal_Int32 AX_PICSIZE_ZOOM = 3;
117 :
118 : const sal_Int32 AX_PICALIGN_TOPLEFT = 0;
119 : const sal_Int32 AX_PICALIGN_TOPRIGHT = 1;
120 : const sal_Int32 AX_PICALIGN_CENTER = 2;
121 : const sal_Int32 AX_PICALIGN_BOTTOMLEFT = 3;
122 : const sal_Int32 AX_PICALIGN_BOTTOMRIGHT = 4;
123 :
124 : const sal_Int32 AX_DISPLAYSTYLE_TEXT = 1;
125 : const sal_Int32 AX_DISPLAYSTYLE_LISTBOX = 2;
126 : const sal_Int32 AX_DISPLAYSTYLE_COMBOBOX = 3;
127 : const sal_Int32 AX_DISPLAYSTYLE_CHECKBOX = 4;
128 : const sal_Int32 AX_DISPLAYSTYLE_OPTBUTTON = 5;
129 : const sal_Int32 AX_DISPLAYSTYLE_TOGGLE = 6;
130 : const sal_Int32 AX_DISPLAYSTYLE_DROPDOWN = 7;
131 :
132 : const sal_Int32 AX_SELECTION_SINGLE = 0;
133 : const sal_Int32 AX_SELECTION_MULTI = 1;
134 : const sal_Int32 AX_SELECTION_EXTENDED = 2;
135 :
136 : const sal_Int32 AX_SHOWDROPBUTTON_NEVER = 0;
137 : const sal_Int32 AX_SHOWDROPBUTTON_FOCUS = 1;
138 : const sal_Int32 AX_SHOWDROPBUTTON_ALWAYS = 2;
139 :
140 : const sal_Int32 AX_SCROLLBAR_NONE = 0x00;
141 : const sal_Int32 AX_SCROLLBAR_HORIZONTAL = 0x01;
142 : const sal_Int32 AX_SCROLLBAR_VERTICAL = 0x02;
143 :
144 :
145 :
146 : /** Enumerates all UNO API control types supported by these filters. */
147 : enum ApiControlType
148 : {
149 : API_CONTROL_BUTTON,
150 : API_CONTROL_FIXEDTEXT,
151 : API_CONTROL_IMAGE,
152 : API_CONTROL_CHECKBOX,
153 : API_CONTROL_RADIOBUTTON,
154 : API_CONTROL_EDIT,
155 : API_CONTROL_NUMERIC,
156 : API_CONTROL_LISTBOX,
157 : API_CONTROL_COMBOBOX,
158 : API_CONTROL_SPINBUTTON,
159 : API_CONTROL_SCROLLBAR,
160 : API_CONTROL_TABSTRIP, //11
161 : API_CONTROL_PROGRESSBAR,
162 : API_CONTROL_GROUPBOX,
163 : API_CONTROL_FRAME, // 14
164 : API_CONTROL_PAGE, // 15
165 : API_CONTROL_MULTIPAGE, // 16
166 : API_CONTROL_DIALOG // 17
167 : };
168 :
169 :
170 :
171 : /** Specifies how a form control supports transparent background. */
172 : enum ApiTransparencyMode
173 : {
174 : API_TRANSPARENCY_NOTSUPPORTED, ///< Control does not support transparency.
175 : API_TRANSPARENCY_VOID, ///< Transparency is enabled by missing fill color.
176 : API_TRANSPARENCY_PAINTTRANSPARENT ///< Transparency is enabled by the 'PaintTransparent' property.
177 : };
178 :
179 : /** Specifies how a form control supports the DefaultState property. */
180 : enum ApiDefaultStateMode
181 : {
182 : API_DEFAULTSTATE_BOOLEAN, ///< Control does not support tri-state, state is given as boolean.
183 : API_DEFAULTSTATE_SHORT, ///< Control does not support tri-state, state is given as short.
184 : API_DEFAULTSTATE_TRISTATE ///< Control supports tri-state, state is given as short.
185 : };
186 :
187 :
188 :
189 : /** A base class with useful helper functions for something that is able to
190 : convert ActiveX and ComCtl form controls.
191 : */
192 : class OOX_DLLPUBLIC ControlConverter
193 : {
194 : public:
195 : explicit ControlConverter(
196 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
197 : const GraphicHelper& rGraphicHelper,
198 : bool bDefaultColorBgr = true );
199 : virtual ~ControlConverter();
200 :
201 : // Generic conversion -----------------------------------------------------
202 :
203 : /** Converts the passed position in 1/100 mm to UNO properties. */
204 : void convertPosition(
205 : PropertyMap& rPropMap,
206 : const AxPairData& rPos ) const;
207 :
208 : /** Converts the passed size in 1/100 mm to UNO properties. */
209 : void convertSize(
210 : PropertyMap& rPropMap,
211 : const AxPairData& rSize ) const;
212 :
213 : /** Converts the passed encoded OLE color to UNO properties. */
214 : void convertColor(
215 : PropertyMap& rPropMap,
216 : sal_Int32 nPropId,
217 : sal_uInt32 nOleColor ) const;
218 :
219 : static void convertToMSColor(
220 : PropertySet& rPropSet,
221 : sal_Int32 nPropId,
222 : sal_uInt32& nOleColor,
223 : sal_uInt32 nDefault = 0 );
224 :
225 :
226 : /** Converts the passed StdPic picture stream to UNO properties. */
227 : void convertPicture(
228 : PropertyMap& rPropMap,
229 : const StreamDataSequence& rPicData ) const;
230 :
231 : /** Converts the control orientation to UNO properties. */
232 : static void convertOrientation(
233 : PropertyMap& rPropMap,
234 : bool bHorizontal );
235 :
236 : static void convertToMSOrientation(
237 : PropertySet& rPropMap,
238 : bool& bHorizontal );
239 :
240 : /** Converts the vertical alignment to UNO properties. */
241 : static void convertVerticalAlign(
242 : PropertyMap& rPropMap,
243 : sal_Int32 nVerticalAlign );
244 :
245 : /** Converts common scrollbar settings to UNO properties. */
246 : static void convertScrollBar(
247 : PropertyMap& rPropMap,
248 : sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition,
249 : sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel );
250 :
251 : /** Converts scrollability settings to UNO properties. */
252 : void convertScrollabilitySettings(
253 : PropertyMap& rPropMap,
254 : const AxPairData& rScrollPos, const AxPairData& rScrollArea,
255 : sal_Int32 nScrollBars ) const;
256 :
257 : /** Binds the passed control model to the passed data sources. The
258 : implementation will check which source types are supported. */
259 : void bindToSources(
260 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
261 : const OUString& rCtrlSource,
262 : const OUString& rRowSource,
263 : sal_Int32 nRefSheet = 0 ) const;
264 :
265 : // ActiveX (Forms 2.0) specific conversion --------------------------------
266 :
267 : /** Converts the Forms 2.0 background formatting to UNO properties. */
268 : void convertAxBackground(
269 : PropertyMap& rPropMap,
270 : sal_uInt32 nBackColor,
271 : sal_uInt32 nFlags,
272 : ApiTransparencyMode eTranspMode ) const;
273 :
274 : /** Converts the Forms 2.0 border formatting to UNO properties. */
275 : void convertAxBorder(
276 : PropertyMap& rPropMap,
277 : sal_uInt32 nBorderColor,
278 : sal_Int32 nBorderStyle,
279 : sal_Int32 nSpecialEffect ) const;
280 :
281 : static void convertToAxBorder(
282 : PropertySet& rPropSet,
283 : sal_uInt32& nBorderColor,
284 : sal_Int32& nBorderStyle,
285 : sal_Int32& nSpecialEffect );
286 :
287 : /** Converts the Forms 2.0 special effect to UNO properties. */
288 : static void convertAxVisualEffect(
289 : PropertyMap& rPropMap,
290 : sal_Int32 nSpecialEffect );
291 :
292 : static void convertToAxVisualEffect(
293 : PropertySet& rPropSet,
294 : sal_Int32& nSpecialEffect );
295 :
296 : /** Converts the passed picture stream and Forms 2.0 position to UNO
297 : properties. */
298 : void convertAxPicture(
299 : PropertyMap& rPropMap,
300 : const StreamDataSequence& rPicData,
301 : sal_uInt32 nPicPos ) const;
302 :
303 : /** Converts the passed picture stream and Forms 2.0 position to UNO
304 : properties. */
305 : void convertAxPicture(
306 : PropertyMap& rPropMap,
307 : const StreamDataSequence& rPicData,
308 : sal_Int32 nPicSizeMode,
309 : sal_Int32 nPicAlign,
310 : bool bPicTiling ) const;
311 :
312 : /** Converts the Forms 2.0 value for checked/unchecked/dontknow to UNO
313 : properties. */
314 : static void convertAxState(
315 : PropertyMap& rPropMap,
316 : const OUString& rValue,
317 : sal_Int32 nMultiSelect,
318 : ApiDefaultStateMode eDefStateMode,
319 : bool bAwtModel );
320 :
321 : static void convertToAxState(
322 : PropertySet& rPropSet,
323 : OUString& rValue,
324 : sal_Int32& nMultiSelect,
325 : ApiDefaultStateMode eDefStateMode,
326 : bool bAwtModel );
327 :
328 : /** Converts the Forms 2.0 control orientation to UNO properties. */
329 : static void convertAxOrientation(
330 : PropertyMap& rPropMap,
331 : const AxPairData& rSize,
332 : sal_Int32 nOrientation );
333 :
334 : static void convertToAxOrientation(
335 : PropertySet& rPropSet,
336 : const AxPairData& rSize,
337 : sal_Int32& nOrientation );
338 :
339 : private:
340 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel;
341 : const GraphicHelper& mrGraphicHelper;
342 : mutable PropertySet maAddressConverter;
343 : mutable PropertySet maRangeConverter;
344 : bool mbDefaultColorBgr;
345 : };
346 :
347 :
348 :
349 : /** Base class for all models of form controls. */
350 : class OOX_DLLPUBLIC ControlModelBase
351 : {
352 : public:
353 : explicit ControlModelBase();
354 : virtual ~ControlModelBase();
355 :
356 : /** Sets this control model to AWT model mode. */
357 8 : void setAwtModelMode() { mbAwtModel = true; }
358 : /** Sets this control model to form component mode. */
359 36 : void setFormComponentMode() { mbAwtModel = false; }
360 :
361 : /** Returns the UNO service name used to construct the AWT control model,
362 : or the control form component. */
363 : OUString getServiceName() const;
364 :
365 : /** Derived classes set specific OOXML properties at the model structure. */
366 : virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
367 : /** Derived classes set binary data (picture, mouse icon) at the model structure. */
368 : virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
369 : /** Derived classes import a form control model from the passed input stream. */
370 : virtual bool importBinaryModel( BinaryInputStream& rInStrm ) = 0;
371 : /** Derived classes export a form control model to the passed output stream. */
372 0 : virtual void exportBinaryModel( BinaryOutputStream& /*rOutStrm*/ ) {}
373 : /** Derived classes export CompObjStream contents. */
374 0 : virtual void exportCompObj( BinaryOutputStream& /*rOutStrm*/ ) {}
375 : /** Derived classes return the UNO control type enum value. */
376 : virtual ApiControlType getControlType() const = 0;
377 : /** Derived classes convert all control properties. */
378 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
379 : /** Derived classes convert from uno control properties to equiv. MS values. */
380 : virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
381 :
382 : /** Converts the control size to UNO properties. */
383 : void convertSize( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
384 :
385 : public: // direct access needed for legacy VML drawing controls
386 : AxPairData maSize; ///< Size of the control in 1/100 mm.
387 :
388 : protected:
389 : bool mbAwtModel; ///< True = AWT control model, false = form component.
390 : };
391 :
392 : typedef std::shared_ptr< ControlModelBase > ControlModelRef;
393 :
394 :
395 :
396 : /** Base class for all models of ComCtl form controls. */
397 0 : class ComCtlModelBase : public ControlModelBase
398 : {
399 : public:
400 : explicit ComCtlModelBase(
401 : sal_uInt32 nDataPartId5, sal_uInt32 nDataPartId6, sal_uInt16 nVersion,
402 : bool bCommonPart, bool bComplexPart );
403 :
404 : virtual bool importBinaryModel( BinaryInputStream& rInStrm ) SAL_OVERRIDE;
405 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
406 :
407 : protected:
408 : virtual void importControlData( BinaryInputStream& rInStrm ) = 0;
409 :
410 : private:
411 : /** Returns the data part identifier according to the model version. */
412 : sal_uInt32 getDataPartId() const;
413 :
414 : static bool readPartHeader( BinaryInputStream& rInStrm,
415 : sal_uInt32 nExpPartId,
416 : sal_uInt16 nExpMajor = SAL_MAX_UINT16,
417 : sal_uInt16 nExpMinor = SAL_MAX_UINT16 );
418 :
419 : bool importSizePart( BinaryInputStream& rInStrm );
420 : bool importCommonPart( BinaryInputStream& rInStrm, sal_uInt32 nPartSize );
421 : bool importComplexPart( BinaryInputStream& rInStrm );
422 :
423 : protected:
424 : StdFontInfo maFontData; ///< Font formatting.
425 : StreamDataSequence maMouseIcon; ///< Binary picture stream for mouse icon.
426 : sal_uInt32 mnFlags; ///< Common flags for ComCtl controls.
427 : const sal_uInt16 mnVersion; ///< Current version of the ComCtl control model.
428 :
429 : private:
430 : sal_uInt32 mnDataPartId5; ///< Identifier for version 5.0 control data.
431 : sal_uInt32 mnDataPartId6; ///< Identifier for version 6.0 control data.
432 : bool mbCommonPart; ///< True = the COMCTL_COMMONDATA part exists.
433 : bool mbComplexPart; ///< True = the COMCTL_COMPLEXDATA part exists.
434 : };
435 :
436 :
437 :
438 : /** Model for a ComCtl scroll bar. */
439 0 : class ComCtlScrollBarModel : public ComCtlModelBase
440 : {
441 : public:
442 : explicit ComCtlScrollBarModel( sal_uInt16 nVersion );
443 :
444 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
445 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
446 :
447 : protected:
448 : virtual void importControlData( BinaryInputStream& rInStrm ) SAL_OVERRIDE;
449 :
450 : private:
451 : sal_uInt32 mnScrollBarFlags; ///< Special flags for scroll bar model.
452 : sal_Int32 mnLargeChange; ///< Increment step size (thumb).
453 : sal_Int32 mnSmallChange; ///< Increment step size (buttons).
454 : sal_Int32 mnMin; ///< Minimum of the value range.
455 : sal_Int32 mnMax; ///< Maximum of the value range.
456 : sal_Int32 mnPosition; ///< Value of the spin button.
457 : };
458 :
459 :
460 :
461 : /** Model for a ComCtl progress bar. */
462 0 : class ComCtlProgressBarModel : public ComCtlModelBase
463 : {
464 : public:
465 : explicit ComCtlProgressBarModel( sal_uInt16 nVersion );
466 :
467 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
468 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
469 :
470 : protected:
471 : virtual void importControlData( BinaryInputStream& rInStrm ) SAL_OVERRIDE;
472 :
473 : private:
474 : float mfMin; ///< Minimum of the value range.
475 : float mfMax; ///< Maximum of the value range.
476 : sal_uInt16 mnVertical; ///< 0 = horizontal, 1 = vertical.
477 : sal_uInt16 mnSmooth; ///< 0 = progress blocks, 1 = pixel resolution.
478 : };
479 :
480 :
481 :
482 : /** Base class for all models of Form 2.0 form controls. */
483 44 : class OOX_DLLPUBLIC AxControlModelBase : public ControlModelBase
484 : {
485 : public:
486 : explicit AxControlModelBase();
487 :
488 : virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) SAL_OVERRIDE;
489 : };
490 :
491 :
492 :
493 : /** Base class for Forms 2.0 controls supporting text formatting. */
494 44 : class OOX_DLLPUBLIC AxFontDataModel : public AxControlModelBase
495 : {
496 : public:
497 : explicit AxFontDataModel( bool bSupportsAlign = true );
498 :
499 : virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) SAL_OVERRIDE;
500 : virtual bool importBinaryModel( BinaryInputStream& rInStrm ) SAL_OVERRIDE;
501 : virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
502 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
503 : virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) SAL_OVERRIDE;
504 :
505 : /** Returns the font height in points. */
506 0 : sal_Int16 getFontHeight() const { return maFontData.getHeightPoints(); }
507 :
508 : public: // direct access needed for legacy VML drawing controls
509 : AxFontData maFontData; ///< The font settings.
510 :
511 : private:
512 : bool mbSupportsAlign; ///< True = UNO model supports Align property.
513 : };
514 :
515 :
516 :
517 : /** Model for a Forms 2.0 command button. */
518 42 : class OOX_DLLPUBLIC AxCommandButtonModel : public AxFontDataModel
519 : {
520 : public:
521 : explicit AxCommandButtonModel();
522 :
523 : virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) SAL_OVERRIDE;
524 : virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm ) SAL_OVERRIDE;
525 : virtual bool importBinaryModel( BinaryInputStream& rInStrm ) SAL_OVERRIDE;
526 : virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
527 : virtual void exportCompObj( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
528 :
529 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
530 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
531 : virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) SAL_OVERRIDE;
532 :
533 : public: // direct access needed for legacy VML drawing controls
534 : StreamDataSequence maPictureData; ///< Binary picture stream.
535 : OUString maCaption; ///< Visible caption of the button.
536 : sal_uInt32 mnTextColor; ///< Text color.
537 : sal_uInt32 mnBackColor; ///< Fill color.
538 : sal_uInt32 mnFlags; ///< Various flags.
539 : sal_uInt32 mnPicturePos; ///< Position of the picture relative to text.
540 : sal_Int32 mnVerticalAlign; ///< Vertical alignment (legacy VML drawing controls only).
541 : bool mbFocusOnClick; ///< True = take focus on click.
542 : };
543 :
544 :
545 :
546 : /** Model for a Forms 2.0 label. */
547 2 : class OOX_DLLPUBLIC AxLabelModel : public AxFontDataModel
548 : {
549 : public:
550 : explicit AxLabelModel();
551 :
552 : virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) SAL_OVERRIDE;
553 : virtual bool importBinaryModel( BinaryInputStream& rInStrm ) SAL_OVERRIDE;
554 : virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
555 : virtual void exportCompObj( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
556 :
557 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
558 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
559 : virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) SAL_OVERRIDE;
560 :
561 : public: // direct access needed for legacy VML drawing controls
562 : OUString maCaption; ///< Visible caption of the button.
563 : sal_uInt32 mnTextColor; ///< Text color.
564 : sal_uInt32 mnBackColor; ///< Fill color.
565 : sal_uInt32 mnFlags; ///< Various flags.
566 : sal_uInt32 mnBorderColor; ///< Flat border color.
567 : sal_Int32 mnBorderStyle; ///< Flat border style.
568 : sal_Int32 mnSpecialEffect; ///< 3D border effect.
569 : sal_Int32 mnVerticalAlign; ///< Vertical alignment (legacy VML drawing controls only).
570 : };
571 :
572 :
573 :
574 : /** Model for a Forms 2.0 image. */
575 0 : class OOX_DLLPUBLIC AxImageModel : public AxControlModelBase
576 : {
577 : public:
578 : explicit AxImageModel();
579 :
580 : virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) SAL_OVERRIDE;
581 : virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm ) SAL_OVERRIDE;
582 : virtual bool importBinaryModel( BinaryInputStream& rInStrm ) SAL_OVERRIDE;
583 : virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
584 : virtual void exportCompObj( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
585 :
586 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
587 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
588 :
589 : private:
590 : StreamDataSequence maPictureData; ///< Binary picture stream.
591 : sal_uInt32 mnBackColor; ///< Fill color.
592 : sal_uInt32 mnFlags; ///< Various flags.
593 : sal_uInt32 mnBorderColor; ///< Flat border color.
594 : sal_Int32 mnBorderStyle; ///< Flat border style.
595 : sal_Int32 mnSpecialEffect; ///< 3D border effect.
596 : sal_Int32 mnPicSizeMode; ///< Clip, stretch, zoom.
597 : sal_Int32 mnPicAlign; ///< Anchor position of the picture.
598 : bool mbPicTiling; ///< True = picture is repeated.
599 : };
600 :
601 0 : class OOX_DLLPUBLIC AxTabStripModel : public AxFontDataModel
602 : {
603 : public:
604 : explicit AxTabStripModel();
605 :
606 : virtual bool importBinaryModel( BinaryInputStream& rInStrm ) SAL_OVERRIDE;
607 :
608 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
609 :
610 : public:
611 : sal_uInt32 mnListIndex;
612 : sal_uInt32 mnTabStyle;
613 : sal_uInt32 mnTabData;
614 : sal_uInt32 mnVariousPropertyBits;
615 : std::vector< ::rtl::OUString > maItems; // captions for each tab
616 : std::vector< ::rtl::OUString > maTabNames; // names for each tab
617 : };
618 :
619 :
620 :
621 : /** Base class for a Forms 2.0 morph data control. */
622 20 : class OOX_DLLPUBLIC AxMorphDataModelBase : public AxFontDataModel
623 : {
624 : public:
625 : explicit AxMorphDataModelBase();
626 :
627 : virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) SAL_OVERRIDE;
628 : virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm ) SAL_OVERRIDE;
629 : virtual bool importBinaryModel( BinaryInputStream& rInStrm ) SAL_OVERRIDE;
630 : virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
631 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
632 :
633 : public: // direct access needed for legacy VML drawing controls
634 : StreamDataSequence maPictureData; ///< Binary picture stream.
635 : OUString maCaption; ///< Visible caption of the button.
636 : OUString maValue; ///< Current value of the control.
637 : OUString maGroupName; ///< Group name for option buttons.
638 : sal_uInt32 mnTextColor; ///< Text color.
639 : sal_uInt32 mnBackColor; ///< Fill color.
640 : sal_uInt32 mnFlags; ///< Various flags.
641 : sal_uInt32 mnPicturePos; ///< Position of the picture relative to text.
642 : sal_uInt32 mnBorderColor; ///< Flat border color.
643 : sal_Int32 mnBorderStyle; ///< Flat border style.
644 : sal_Int32 mnSpecialEffect; ///< 3D border effect.
645 : sal_Int32 mnDisplayStyle; ///< Type of the morph control.
646 : sal_Int32 mnMultiSelect; ///< Selection mode.
647 : sal_Int32 mnScrollBars; ///< Horizontal/vertical scroll bar.
648 : sal_Int32 mnMatchEntry; ///< Auto completion mode.
649 : sal_Int32 mnShowDropButton; ///< When to show the dropdown button.
650 : sal_Int32 mnMaxLength; ///< Maximum character count.
651 : sal_Int32 mnPasswordChar; ///< Password character in edit fields.
652 : sal_Int32 mnListRows; ///< Number of rows in dropdown box.
653 : sal_Int32 mnVerticalAlign; ///< Vertical alignment (legacy VML drawing controls only).
654 : };
655 :
656 :
657 :
658 : /** Model for a Forms 2.0 toggle button. */
659 4 : class OOX_DLLPUBLIC AxToggleButtonModel : public AxMorphDataModelBase
660 : {
661 : public:
662 : explicit AxToggleButtonModel();
663 :
664 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
665 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
666 : virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) SAL_OVERRIDE;
667 : virtual void exportCompObj( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
668 : };
669 :
670 :
671 :
672 : /** Model for a Forms 2.0 check box. */
673 10 : class OOX_DLLPUBLIC AxCheckBoxModel : public AxMorphDataModelBase
674 : {
675 : public:
676 : explicit AxCheckBoxModel();
677 :
678 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
679 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
680 : virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) SAL_OVERRIDE;
681 : virtual void exportCompObj( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
682 : };
683 :
684 :
685 :
686 : /** Model for a Forms 2.0 option button. */
687 8 : class OOX_DLLPUBLIC AxOptionButtonModel : public AxMorphDataModelBase
688 : {
689 : public:
690 : explicit AxOptionButtonModel();
691 :
692 : /** Returns the group name used to goup several option buttons gogether. */
693 1 : const OUString& getGroupName() const { return maGroupName; }
694 :
695 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
696 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
697 : virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) SAL_OVERRIDE;
698 : virtual void exportCompObj( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
699 : };
700 :
701 :
702 :
703 : /** Model for a Forms 2.0 text box. */
704 10 : class OOX_DLLPUBLIC AxTextBoxModel : public AxMorphDataModelBase
705 : {
706 : public:
707 : explicit AxTextBoxModel();
708 :
709 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
710 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
711 : virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) SAL_OVERRIDE;
712 : virtual void exportCompObj( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
713 : };
714 :
715 :
716 :
717 : /** Model for a numeric field (legacy drawing controls only). */
718 0 : class OOX_DLLPUBLIC AxNumericFieldModel : public AxMorphDataModelBase
719 : {
720 : public:
721 : explicit AxNumericFieldModel();
722 :
723 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
724 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
725 : virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) SAL_OVERRIDE;
726 : virtual void exportCompObj( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
727 : };
728 :
729 :
730 :
731 : /** Model for a Forms 2.0 list box. */
732 4 : class OOX_DLLPUBLIC AxListBoxModel : public AxMorphDataModelBase
733 : {
734 : public:
735 : explicit AxListBoxModel();
736 :
737 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
738 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
739 : virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) SAL_OVERRIDE;
740 : virtual void exportCompObj( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
741 : };
742 :
743 :
744 :
745 : /** Model for a Forms 2.0 combo box. */
746 4 : class OOX_DLLPUBLIC AxComboBoxModel : public AxMorphDataModelBase
747 : {
748 : public:
749 : explicit AxComboBoxModel();
750 :
751 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
752 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
753 : virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) SAL_OVERRIDE;
754 : virtual void exportCompObj( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
755 : };
756 :
757 :
758 :
759 : /** Model for a Forms 2.0 spin button. */
760 0 : class OOX_DLLPUBLIC AxSpinButtonModel : public AxControlModelBase
761 : {
762 : public:
763 : explicit AxSpinButtonModel();
764 :
765 : virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) SAL_OVERRIDE;
766 : virtual bool importBinaryModel( BinaryInputStream& rInStrm ) SAL_OVERRIDE;
767 : virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
768 :
769 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
770 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
771 : virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) SAL_OVERRIDE;
772 : virtual void exportCompObj( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
773 :
774 : public: // direct access needed for legacy VML drawing controls
775 : sal_uInt32 mnArrowColor; ///< Button arrow color.
776 : sal_uInt32 mnBackColor; ///< Fill color.
777 : sal_uInt32 mnFlags; ///< Various flags.
778 : sal_Int32 mnOrientation; ///< Orientation of the buttons.
779 : sal_Int32 mnMin; ///< Minimum of the value range.
780 : sal_Int32 mnMax; ///< Maximum of the value range.
781 : sal_Int32 mnPosition; ///< Value of the spin button.
782 : sal_Int32 mnSmallChange; ///< Increment step size.
783 : sal_Int32 mnDelay; ///< Repeat delay in milliseconds.
784 : };
785 :
786 :
787 :
788 : /** Model for a Forms 2.0 scroll bar. */
789 0 : class OOX_DLLPUBLIC AxScrollBarModel : public AxControlModelBase
790 : {
791 : public:
792 : explicit AxScrollBarModel();
793 :
794 : virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) SAL_OVERRIDE;
795 : virtual bool importBinaryModel( BinaryInputStream& rInStrm ) SAL_OVERRIDE;
796 : virtual void exportBinaryModel( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
797 : virtual void exportCompObj( BinaryOutputStream& rOutStrm ) SAL_OVERRIDE;
798 :
799 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
800 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
801 : virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) SAL_OVERRIDE;
802 :
803 : public: // direct access needed for legacy VML drawing controls
804 : sal_uInt32 mnArrowColor; ///< Button arrow color.
805 : sal_uInt32 mnBackColor; ///< Fill color.
806 : sal_uInt32 mnFlags; ///< Various flags.
807 : sal_Int32 mnOrientation; ///< Orientation of the buttons.
808 : sal_Int32 mnPropThumb; ///< Proportional thumb size.
809 : sal_Int32 mnMin; ///< Minimum of the value range.
810 : sal_Int32 mnMax; ///< Maximum of the value range.
811 : sal_Int32 mnPosition; ///< Value of the spin button.
812 : sal_Int32 mnSmallChange; ///< Increment step size (buttons).
813 : sal_Int32 mnLargeChange; ///< Increment step size (thumb).
814 : sal_Int32 mnDelay; ///< Repeat delay in milliseconds.
815 : };
816 :
817 :
818 :
819 : typedef ::std::vector< OUString > AxClassTable;
820 :
821 : /** Base class for ActiveX container controls. */
822 2 : class OOX_DLLPUBLIC AxContainerModelBase : public AxFontDataModel
823 : {
824 : public:
825 : explicit AxContainerModelBase( bool bFontSupport = false );
826 :
827 : /** Allows to set single properties specified by XML token identifier. */
828 : virtual void importProperty( sal_Int32 nPropId, const OUString& rValue ) SAL_OVERRIDE;
829 : /** Reads the leading structure in the 'f' stream containing the model for
830 : this control. */
831 : virtual bool importBinaryModel( BinaryInputStream& rInStrm ) SAL_OVERRIDE;
832 : /** Converts font settings if supported. */
833 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
834 :
835 : /** Reads the class table structure for embedded controls following the own
836 : model from the 'f' stream. */
837 : bool importClassTable( BinaryInputStream& rInStrm, AxClassTable& orClassTable );
838 :
839 : public: // direct access needed for legacy VML drawing controls
840 : StreamDataSequence maPictureData; ///< Binary picture stream.
841 : OUString maCaption; ///< Visible caption of the form.
842 : AxPairData maLogicalSize; ///< Logical form size (scroll area).
843 : AxPairData maScrollPos; ///< Scroll position.
844 : sal_uInt32 mnBackColor; ///< Fill color.
845 : sal_uInt32 mnTextColor; ///< Text color.
846 : sal_uInt32 mnFlags; ///< Various flags.
847 : sal_uInt32 mnBorderColor; ///< Flat border color.
848 : sal_Int32 mnBorderStyle; ///< Flat border style.
849 : sal_Int32 mnScrollBars; ///< Horizontal/vertical scroll bar.
850 : sal_Int32 mnCycleType; ///< Cycle in all forms or in this form.
851 : sal_Int32 mnSpecialEffect; ///< 3D border effect.
852 : sal_Int32 mnPicAlign; ///< Anchor position of the picture.
853 : sal_Int32 mnPicSizeMode; ///< Clip, stretch, zoom.
854 : bool mbPicTiling; ///< True = picture is repeated.
855 : bool mbFontSupport; ///< True = control supports the font property.
856 : };
857 :
858 :
859 :
860 :
861 : /** Model for a Forms 2.0 frame control. */
862 0 : class OOX_DLLPUBLIC AxFrameModel : public AxContainerModelBase
863 : {
864 : public:
865 : explicit AxFrameModel();
866 :
867 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
868 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
869 : };
870 :
871 0 : class OOX_DLLPUBLIC AxPageModel : public AxContainerModelBase
872 : {
873 : public:
874 : explicit AxPageModel();
875 :
876 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
877 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
878 : };
879 :
880 0 : class OOX_DLLPUBLIC AxMultiPageModel : public AxContainerModelBase
881 : {
882 : public:
883 : explicit AxMultiPageModel();
884 :
885 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
886 : bool importPageAndMultiPageProperties( BinaryInputStream& rInStrm, sal_Int32 nPages );
887 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
888 : std::vector<sal_uInt32> mnIDs;
889 : sal_uInt32 mnActiveTab;
890 : sal_uInt32 mnTabStyle;
891 : };
892 :
893 :
894 :
895 :
896 : /** Model for a Forms 2.0 user form. */
897 4 : class OOX_DLLPUBLIC AxUserFormModel : public AxContainerModelBase
898 : {
899 : public:
900 : explicit AxUserFormModel();
901 :
902 : virtual ApiControlType getControlType() const SAL_OVERRIDE;
903 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
904 : };
905 :
906 0 : class HtmlSelectModel : public AxListBoxModel
907 : {
908 : com::sun::star::uno::Sequence< OUString > msListData;
909 : com::sun::star::uno::Sequence< sal_Int16 > msIndices;
910 : public:
911 : HtmlSelectModel();
912 : virtual bool importBinaryModel( BinaryInputStream& rInStrm ) SAL_OVERRIDE;
913 : virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const SAL_OVERRIDE;
914 : };
915 :
916 0 : class HtmlTextBoxModel : public AxTextBoxModel
917 : {
918 : public:
919 : explicit HtmlTextBoxModel();
920 : virtual bool importBinaryModel( BinaryInputStream& rInStrm ) SAL_OVERRIDE;
921 : };
922 :
923 :
924 : /** A form control embedded in a document draw page. Contains a specific model
925 : structure according to the type of the control. */
926 1 : class OOX_DLLPUBLIC EmbeddedControl
927 : {
928 : public:
929 : explicit EmbeddedControl( const OUString& rName );
930 : virtual ~EmbeddedControl();
931 :
932 : /** Creates and returns the internal control model of the specified type. */
933 : template< typename ModelType >
934 : inline ModelType& createModel();
935 :
936 : /** Creates and returns the internal control model of the specified type. */
937 : template< typename ModelType, typename ParamType >
938 : inline ModelType& createModel( const ParamType& rParam );
939 :
940 : /** Creates and returns the internal control model according to the passed
941 : MS class identifier. */
942 : ControlModelBase* createModelFromGuid( const OUString& rClassId );
943 :
944 : /** Returns true, if the internal control model exists. */
945 1 : bool hasModel() const { return mxModel.get() != 0; }
946 : /** Returns read-only access to the internal control model. */
947 : const ControlModelBase* getModel() const { return mxModel.get(); }
948 : /** Returns read/write access to the internal control model. */
949 1 : ControlModelBase* getModel() { return mxModel.get(); }
950 :
951 : /** Returns the UNO service name needed to construct the control model. */
952 : OUString getServiceName() const;
953 :
954 : /** Converts all control properties and inserts them into the passed model. */
955 : bool convertProperties(
956 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
957 : const ControlConverter& rConv ) const;
958 :
959 : bool convertFromProperties(
960 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
961 : const ControlConverter& rConv );
962 :
963 : private:
964 : ControlModelRef mxModel; ///< Control model containing the properties.
965 : OUString maName; ///< Name of the control.
966 : };
967 :
968 :
969 :
970 : template< typename ModelType >
971 36 : inline ModelType& EmbeddedControl::createModel()
972 : {
973 36 : std::shared_ptr< ModelType > xModel( new ModelType );
974 36 : mxModel = xModel;
975 36 : xModel->setFormComponentMode();
976 36 : return *xModel;
977 : }
978 :
979 : template< typename ModelType, typename ParamType >
980 0 : inline ModelType& EmbeddedControl::createModel( const ParamType& rParam )
981 : {
982 0 : std::shared_ptr< ModelType > xModel( new ModelType( rParam ) );
983 0 : mxModel = xModel;
984 0 : xModel->setFormComponentMode();
985 0 : return *xModel;
986 : }
987 :
988 :
989 :
990 : /** A wrapper for a control form embedded directly in a draw page. */
991 1 : class EmbeddedForm
992 : {
993 : public:
994 : explicit EmbeddedForm(
995 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
996 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
997 : const GraphicHelper& rGraphicHelper,
998 : bool bDefaultColorBgr = true );
999 :
1000 : /** Converts the passed control and inserts the control model into the form.
1001 : @return The API control model, if conversion was successful. */
1002 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
1003 : convertAndInsert( const EmbeddedControl& rControl, sal_Int32& rnCtrlIndex );
1004 :
1005 : /** Returns the XIndexContainer interface of the UNO control form, if existing. */
1006 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >
1007 0 : getXForm() const { return mxFormIC; }
1008 :
1009 : private:
1010 : /** Creates the form that will hold the form controls. */
1011 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >
1012 : createXForm();
1013 :
1014 : private:
1015 : ControlConverter maControlConv;
1016 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxModelFactory;
1017 : ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier > mxFormsSupp;
1018 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > mxFormIC;
1019 : };
1020 :
1021 :
1022 :
1023 : } // namespace ole
1024 : } // namespace oox
1025 :
1026 : #endif
1027 :
1028 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|