LibreOffice Module oox (master)  1
axcontrol.cxx
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 #include <oox/ole/axcontrol.hxx>
21 
22 #include <com/sun/star/awt/FontSlant.hpp>
23 #include <com/sun/star/awt/FontStrikeout.hpp>
24 #include <com/sun/star/awt/FontUnderline.hpp>
25 #include <com/sun/star/awt/FontWeight.hpp>
26 #include <com/sun/star/awt/ImagePosition.hpp>
27 #include <com/sun/star/awt/ImageScaleMode.hpp>
28 #include <com/sun/star/awt/Point.hpp>
29 #include <com/sun/star/awt/ScrollBarOrientation.hpp>
30 #include <com/sun/star/awt/Size.hpp>
31 #include <com/sun/star/awt/TextAlign.hpp>
32 #include <com/sun/star/awt/VisualEffect.hpp>
33 #include <com/sun/star/awt/XControlModel.hpp>
34 #include <com/sun/star/beans/NamedValue.hpp>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <com/sun/star/container/XIndexContainer.hpp>
37 #include <com/sun/star/drawing/XDrawPage.hpp>
38 #include <com/sun/star/form/XForm.hpp>
39 #include <com/sun/star/form/XFormComponent.hpp>
40 #include <com/sun/star/form/XFormsSupplier.hpp>
41 #include <com/sun/star/form/binding/XBindableValue.hpp>
42 #include <com/sun/star/form/binding/XListEntrySink.hpp>
43 #include <com/sun/star/form/binding/XListEntrySource.hpp>
44 #include <com/sun/star/form/binding/XValueBinding.hpp>
45 #include <com/sun/star/frame/XModel.hpp>
46 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
47 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
48 #include <com/sun/star/sheet/XCellRangeReferrer.hpp>
49 #include <com/sun/star/style/VerticalAlignment.hpp>
50 #include <com/sun/star/table/CellAddress.hpp>
51 #include <com/sun/star/table/CellRangeAddress.hpp>
52 #include <rtl/tencinfo.h>
53 #include <osl/diagnose.h>
54 #include <vcl/font.hxx>
55 #include <vcl/outdev.hxx>
56 #include <vcl/settings.hxx>
57 #include <vcl/svapp.hxx>
63 #include <oox/token/properties.hxx>
64 #include <oox/token/tokens.hxx>
65 #include <tools/diagnose_ex.h>
66 #include <o3tl/string_view.hxx>
67 
68 namespace oox::ole {
69 
70 using namespace ::com::sun::star;
71 using namespace ::com::sun::star::awt;
72 using namespace ::com::sun::star::beans;
73 using namespace ::com::sun::star::container;
74 using namespace ::com::sun::star::drawing;
75 using namespace ::com::sun::star::form;
76 using namespace ::com::sun::star::form::binding;
77 using namespace ::com::sun::star::frame;
78 using namespace ::com::sun::star::lang;
79 using namespace ::com::sun::star::sheet;
80 using namespace ::com::sun::star::style;
81 using namespace ::com::sun::star::table;
82 using namespace ::com::sun::star::uno;
83 
84 namespace {
85 
86 const sal_uInt32 COMCTL_ID_SIZE = 0x12344321;
87 
88 const sal_uInt32 COMCTL_ID_COMMONDATA = 0xABCDEF01;
89 const sal_uInt32 COMCTL_COMMON_FLATBORDER = 0x00000001;
90 const sal_uInt32 COMCTL_COMMON_ENABLED = 0x00000002;
91 const sal_uInt32 COMCTL_COMMON_3DBORDER = 0x00000004;
92 
93 const sal_uInt32 COMCTL_ID_COMPLEXDATA = 0xBDECDE1F;
94 const sal_uInt32 COMCTL_COMPLEX_FONT = 0x00000001;
95 const sal_uInt32 COMCTL_COMPLEX_MOUSEICON = 0x00000002;
96 
97 const sal_uInt32 COMCTL_ID_SCROLLBAR_60 = 0x99470A83;
98 const sal_uInt32 COMCTL_SCROLLBAR_HOR = 0x00000010;
99 
100 const sal_uInt32 COMCTL_ID_PROGRESSBAR_50 = 0xE6E17E84;
101 const sal_uInt32 COMCTL_ID_PROGRESSBAR_60 = 0x97AB8A01;
102 
103 const sal_uInt32 AX_CMDBUTTON_DEFFLAGS = 0x0000001B;
104 const sal_uInt32 AX_LABEL_DEFFLAGS = 0x0080001B;
105 const sal_uInt32 AX_IMAGE_DEFFLAGS = 0x0000001B;
106 const sal_uInt32 AX_MORPHDATA_DEFFLAGS = 0x2C80081B;
107 const sal_uInt32 AX_SPINBUTTON_DEFFLAGS = 0x0000001B;
108 const sal_uInt32 AX_SCROLLBAR_DEFFLAGS = 0x0000001B;
109 
110 const sal_uInt16 AX_POS_TOPLEFT = 0;
111 const sal_uInt16 AX_POS_TOP = 1;
112 const sal_uInt16 AX_POS_TOPRIGHT = 2;
113 const sal_uInt16 AX_POS_LEFT = 3;
114 const sal_uInt16 AX_POS_CENTER = 4;
115 const sal_uInt16 AX_POS_RIGHT = 5;
116 const sal_uInt16 AX_POS_BOTTOMLEFT = 6;
117 const sal_uInt16 AX_POS_BOTTOM = 7;
118 const sal_uInt16 AX_POS_BOTTOMRIGHT = 8;
119 
120 #define AX_PICPOS_IMPL( label, image ) ((AX_POS_##label << 16) | AX_POS_##image)
121 const sal_uInt32 AX_PICPOS_LEFTTOP = AX_PICPOS_IMPL( TOPRIGHT, TOPLEFT );
122 const sal_uInt32 AX_PICPOS_LEFTCENTER = AX_PICPOS_IMPL( RIGHT, LEFT );
123 const sal_uInt32 AX_PICPOS_LEFTBOTTOM = AX_PICPOS_IMPL( BOTTOMRIGHT, BOTTOMLEFT );
124 const sal_uInt32 AX_PICPOS_RIGHTTOP = AX_PICPOS_IMPL( TOPLEFT, TOPRIGHT );
125 const sal_uInt32 AX_PICPOS_RIGHTCENTER = AX_PICPOS_IMPL( LEFT, RIGHT );
126 const sal_uInt32 AX_PICPOS_RIGHTBOTTOM = AX_PICPOS_IMPL( BOTTOMLEFT, BOTTOMRIGHT );
127 const sal_uInt32 AX_PICPOS_ABOVELEFT = AX_PICPOS_IMPL( BOTTOMLEFT, TOPLEFT );
128 const sal_uInt32 AX_PICPOS_ABOVECENTER = AX_PICPOS_IMPL( BOTTOM, TOP );
129 const sal_uInt32 AX_PICPOS_ABOVERIGHT = AX_PICPOS_IMPL( BOTTOMRIGHT, TOPRIGHT );
130 const sal_uInt32 AX_PICPOS_BELOWLEFT = AX_PICPOS_IMPL( TOPLEFT, BOTTOMLEFT );
131 const sal_uInt32 AX_PICPOS_BELOWCENTER = AX_PICPOS_IMPL( TOP, BOTTOM );
132 const sal_uInt32 AX_PICPOS_BELOWRIGHT = AX_PICPOS_IMPL( TOPRIGHT, BOTTOMRIGHT );
133 const sal_uInt32 AX_PICPOS_CENTER = AX_PICPOS_IMPL( CENTER, CENTER );
134 #undef AX_PICPOS_IMPL
135 
136 const sal_Int32 AX_MATCHENTRY_FIRSTLETTER = 0;
137 const sal_Int32 AX_MATCHENTRY_COMPLETE = 1;
138 const sal_Int32 AX_MATCHENTRY_NONE = 2;
139 
140 const sal_Int32 AX_ORIENTATION_AUTO = -1;
141 const sal_Int32 AX_ORIENTATION_VERTICAL = 0;
142 const sal_Int32 AX_ORIENTATION_HORIZONTAL = 1;
143 
144 const sal_Int32 AX_PROPTHUMB_ON = -1;
145 
146 const sal_uInt32 AX_TABSTRIP_TABS = 0;
147 const sal_uInt32 AX_TABSTRIP_NONE = 2;
148 
149 const sal_uInt32 AX_CONTAINER_ENABLED = 0x00000004;
150 const sal_uInt32 AX_CONTAINER_NOCLASSTABLE = 0x00008000;
151 
152 const sal_uInt32 AX_CONTAINER_DEFFLAGS = 0x00000004;
153 
154 const sal_Int32 AX_CONTAINER_DEFWIDTH = 4000;
155 const sal_Int32 AX_CONTAINER_DEFHEIGHT = 3000;
156 
157 const sal_Int32 AX_CONTAINER_CYCLEALL = 0;
158 
159 const sal_Int32 AX_CONTAINER_SCR_NONE = 0x00;
160 
161 const sal_Int16 API_BORDER_NONE = 0;
162 const sal_Int16 API_BORDER_SUNKEN = 1;
163 const sal_Int16 API_BORDER_FLAT = 2;
164 
165 const sal_Int16 API_STATE_UNCHECKED = 0;
166 const sal_Int16 API_STATE_CHECKED = 1;
167 const sal_Int16 API_STATE_DONTKNOW = 2;
168 
170 bool lclExtractRangeFromName( CellRangeAddress& orRangeAddr, const Reference< XModel >& rxDocModel, const OUString& rAddressString )
171 {
172  try
173  {
174  PropertySet aPropSet( rxDocModel );
175  Reference< XNameAccess > xRangesNA( aPropSet.getAnyProperty( PROP_NamedRanges ), UNO_QUERY_THROW );
176  Reference< XCellRangeReferrer > xReferrer( xRangesNA->getByName( rAddressString ), UNO_QUERY_THROW );
177  Reference< XCellRangeAddressable > xAddressable( xReferrer->getReferredCells(), UNO_QUERY_THROW );
178  orRangeAddr = xAddressable->getRangeAddress();
179  return true;
180  }
181  catch (const Exception&)
182  {
183  TOOLS_WARN_EXCEPTION("oox", "");
184  }
185  return false;
186 }
187 
188 bool lclExtractAddressFromName( CellAddress& orAddress, const Reference< XModel >& rxDocModel, const OUString& rAddressString )
189 {
190  CellRangeAddress aRangeAddr;
191  if( lclExtractRangeFromName( aRangeAddr, rxDocModel, rAddressString ) &&
192  (aRangeAddr.StartColumn == aRangeAddr.EndColumn) &&
193  (aRangeAddr.StartRow == aRangeAddr.EndRow) )
194  {
195  orAddress.Sheet = aRangeAddr.Sheet;
196  orAddress.Column = aRangeAddr.StartColumn;
197  orAddress.Row = aRangeAddr.StartRow;
198  return true;
199  }
200  return false;
201 }
202 
203 void lclPrepareConverter( PropertySet& rConverter, const Reference< XModel >& rxDocModel,
204  const OUString& rAddressString, sal_Int32 nRefSheet, bool bRange )
205 {
206  if( !rConverter.is() ) try
207  {
208  Reference< XMultiServiceFactory > xModelFactory( rxDocModel, UNO_QUERY_THROW );
209  OUString aServiceName = bRange ?
210  OUString( "com.sun.star.table.CellRangeAddressConversion" ) :
211  OUString( "com.sun.star.table.CellAddressConversion" );
212  rConverter.set( xModelFactory->createInstance( aServiceName ) );
213  }
214  catch (const Exception&)
215  {
216  TOOLS_WARN_EXCEPTION("oox", "");
217  }
218  rConverter.setProperty( PROP_XLA1Representation, rAddressString );
219  rConverter.setProperty( PROP_ReferenceSheet, nRefSheet );
220 }
221 
222 } // namespace
223 
224 ControlConverter::ControlConverter( const Reference< XModel >& rxDocModel,
225  const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) :
226  mxDocModel( rxDocModel ),
227  mrGraphicHelper( rGraphicHelper ),
228  mbDefaultColorBgr( bDefaultColorBgr )
229 {
230  OSL_ENSURE( mxDocModel.is(), "ControlConverter::ControlConverter - missing document model" );
231 }
232 
234 {
235 }
236 
237 // Generic conversion ---------------------------------------------------------
238 
239 void ControlConverter::convertPosition( PropertyMap& rPropMap, const AxPairData& rPos ) const
240 {
241  // position is given in 1/100 mm, UNO needs AppFont units
242  awt::Point aAppFontPos = mrGraphicHelper.convertHmmToAppFont( awt::Point( rPos.first, rPos.second ) );
243  rPropMap.setProperty( PROP_PositionX, aAppFontPos.X );
244  rPropMap.setProperty( PROP_PositionY, aAppFontPos.Y );
245 }
246 
247 void ControlConverter::convertSize( PropertyMap& rPropMap, const AxPairData& rSize ) const
248 {
249  // size is given in 1/100 mm, UNO needs AppFont units
250  awt::Size aAppFontSize = mrGraphicHelper.convertHmmToAppFont( awt::Size( rSize.first, rSize.second ) );
251  rPropMap.setProperty( PROP_Width, aAppFontSize.Width );
252  rPropMap.setProperty( PROP_Height, aAppFontSize.Height );
253 }
254 
255 void ControlConverter::convertColor( PropertyMap& rPropMap, sal_Int32 nPropId, sal_uInt32 nOleColor ) const
256 {
257  rPropMap.setProperty( nPropId, OleHelper::decodeOleColor( mrGraphicHelper, nOleColor, mbDefaultColorBgr ) );
258 }
259 
260 void ControlConverter::convertToMSColor( PropertySet const & rPropSet, sal_Int32 nPropId, sal_uInt32& nOleColor, sal_uInt32 nDefault )
261 {
262  sal_uInt32 nRGB = 0;
263  if (rPropSet.getProperty( nRGB, nPropId ))
264  nOleColor = OleHelper::encodeOleColor( nRGB );
265  else
266  nOleColor = nDefault;
267 }
268 void ControlConverter::convertPicture( PropertyMap& rPropMap, const StreamDataSequence& rPicData ) const
269 {
270  if( rPicData.hasElements() )
271  {
272  uno::Reference<graphic::XGraphic> xGraphic = mrGraphicHelper.importGraphic(rPicData);
273  if (xGraphic.is())
274  rPropMap.setProperty(PROP_Graphic, xGraphic);
275  }
276 }
277 
278 void ControlConverter::convertOrientation( PropertyMap& rPropMap, bool bHorizontal )
279 {
280  sal_Int32 nScrollOrient = bHorizontal ? ScrollBarOrientation::HORIZONTAL : ScrollBarOrientation::VERTICAL;
281  rPropMap.setProperty( PROP_Orientation, nScrollOrient );
282 }
283 
284 void ControlConverter::convertToMSOrientation( PropertySet const & rPropSet, bool& bHorizontal )
285 {
286  sal_Int32 nScrollOrient = ScrollBarOrientation::HORIZONTAL;
287  if ( rPropSet.getProperty( nScrollOrient, PROP_Orientation ) )
288  bHorizontal = ( nScrollOrient == ScrollBarOrientation::HORIZONTAL );
289 }
290 
291 void ControlConverter::convertVerticalAlign( PropertyMap& rPropMap, sal_Int32 nVerticalAlign )
292 {
293  VerticalAlignment eAlign = VerticalAlignment_TOP;
294  switch( nVerticalAlign )
295  {
296  case XML_Top: eAlign = VerticalAlignment_TOP; break;
297  case XML_Center: eAlign = VerticalAlignment_MIDDLE; break;
298  case XML_Bottom: eAlign = VerticalAlignment_BOTTOM; break;
299  }
300  rPropMap.setProperty( PROP_VerticalAlign, eAlign );
301 }
302 
304  const AxPairData& rScrollPos, const AxPairData& rScrollArea,
305  sal_Int32 nScrollBars ) const
306 {
307  awt::Size tmpSize = mrGraphicHelper.convertHmmToAppFont( awt::Size( rScrollArea.first, rScrollArea.second ) );
308  awt::Point tmpPos = mrGraphicHelper.convertHmmToAppFont( awt::Point( rScrollPos.first, rScrollPos.second ) );
309  rPropMap.setProperty( PROP_ScrollHeight, tmpSize.Height );
310  rPropMap.setProperty( PROP_ScrollWidth, tmpSize.Width );
311  rPropMap.setProperty( PROP_ScrollTop, tmpPos.Y );
312  rPropMap.setProperty( PROP_ScrollLeft, tmpPos.X );
313  rPropMap.setProperty( PROP_HScroll, ( nScrollBars & 0x1 ) == 0x1 );
314  rPropMap.setProperty( PROP_VScroll, ( nScrollBars & 0x2 ) == 0x2 );
315 }
316 
318  sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition,
319  sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel )
320 {
321  rPropMap.setProperty( PROP_ScrollValueMin, ::std::min( nMin, nMax ) );
322  rPropMap.setProperty( PROP_ScrollValueMax, ::std::max( nMin, nMax ) );
323  rPropMap.setProperty( PROP_LineIncrement, nSmallChange );
324  rPropMap.setProperty( PROP_BlockIncrement, nLargeChange );
325  rPropMap.setProperty( bAwtModel ? PROP_ScrollValue : PROP_DefaultScrollValue, nPosition );
326 }
327 
328 void ControlConverter::bindToSources( const Reference< XControlModel >& rxCtrlModel,
329  const OUString& rCtrlSource, const OUString& rRowSource, sal_Int32 nRefSheet ) const
330 {
331  // value binding
332  if( !rCtrlSource.isEmpty() ) try
333  {
334  // first check if the XBindableValue interface is supported
335  Reference< XBindableValue > xBindable( rxCtrlModel, UNO_QUERY_THROW );
336 
337  // convert address string to cell address struct
338  CellAddress aAddress;
339  if( !lclExtractAddressFromName( aAddress, mxDocModel, rCtrlSource ) )
340  {
341  lclPrepareConverter( maAddressConverter, mxDocModel, rCtrlSource, nRefSheet, false );
342  if( !maAddressConverter.getProperty( aAddress, PROP_Address ) )
343  throw RuntimeException();
344  }
345 
346  // create argument sequence
347  Sequence< Any > aArgs{ Any(NamedValue("BoundCell", Any(aAddress))) };
348 
349  // create the CellValueBinding instance and set at the control model
350  Reference< XMultiServiceFactory > xModelFactory( mxDocModel, UNO_QUERY_THROW );
351  Reference< XValueBinding > xBinding( xModelFactory->createInstanceWithArguments( "com.sun.star.table.CellValueBinding", aArgs ), UNO_QUERY_THROW );
352  xBindable->setValueBinding( xBinding );
353  }
354  catch (const Exception&)
355  {
356  TOOLS_WARN_EXCEPTION("oox", "");
357  }
358 
359  // list entry source
360  if( rRowSource.isEmpty() )
361  return;
362 
363  try
364  {
365  // first check if the XListEntrySink interface is supported
366  Reference< XListEntrySink > xEntrySink( rxCtrlModel, UNO_QUERY_THROW );
367 
368  // convert address string to cell range address struct
369  CellRangeAddress aRangeAddr;
370  if( !lclExtractRangeFromName( aRangeAddr, mxDocModel, rRowSource ) )
371  {
372  lclPrepareConverter( maRangeConverter, mxDocModel, rRowSource, nRefSheet, true );
373  if( !maRangeConverter.getProperty( aRangeAddr, PROP_Address ) )
374  throw RuntimeException();
375  }
376 
377  // create argument sequence
378  Sequence< Any > aArgs{ Any(NamedValue("CellRange", Any(aRangeAddr))) };
379 
380  // create the EntrySource instance and set at the control model
381  Reference< XMultiServiceFactory > xModelFactory( mxDocModel, UNO_QUERY_THROW );
382  Reference< XListEntrySource > xEntrySource( xModelFactory->createInstanceWithArguments("com.sun.star.table.CellRangeListSource", aArgs ), UNO_QUERY_THROW );
383  xEntrySink->setListEntrySource( xEntrySource );
384  }
385  catch (const Exception&)
386  {
387  TOOLS_WARN_EXCEPTION("oox", "");
388  }
389 }
390 
391 // ActiveX (Forms 2.0) specific conversion ------------------------------------
392 
394  sal_uInt32 nBackColor, sal_uInt32 nFlags, ApiTransparencyMode eTranspMode ) const
395 {
396  bool bOpaque = getFlag( nFlags, AX_FLAGS_OPAQUE );
397  switch( eTranspMode )
398  {
400  // fake transparency by using system window background if needed
401  convertColor( rPropMap, PROP_BackgroundColor, bOpaque ? nBackColor : AX_SYSCOLOR_WINDOWBACK );
402  break;
404  // keep transparency by leaving the (void) default property value
405  if( bOpaque )
406  convertColor( rPropMap, PROP_BackgroundColor, nBackColor );
407  break;
408  }
409 }
410 
412  sal_uInt32 nBorderColor, sal_Int32 nBorderStyle, sal_Int32 nSpecialEffect ) const
413 {
414  sal_Int16 nBorder = (nBorderStyle == AX_BORDERSTYLE_SINGLE) ? API_BORDER_FLAT :
415  ((nSpecialEffect == AX_SPECIALEFFECT_FLAT) ? API_BORDER_NONE : API_BORDER_SUNKEN);
416  rPropMap.setProperty( PROP_Border, nBorder );
417  convertColor( rPropMap, PROP_BorderColor, nBorderColor );
418 }
419 
421  sal_uInt32& nBorderColor, sal_Int32& nBorderStyle, sal_Int32& nSpecialEffect )
422 {
423  sal_Int16 nBorder = API_BORDER_NONE;
424  rPropSet.getProperty( nBorder, PROP_Border );
425  nBorderStyle = AX_BORDERSTYLE_NONE;
426  nSpecialEffect = AX_SPECIALEFFECT_FLAT;
427  switch ( nBorder )
428  {
429  case API_BORDER_FLAT:
430  nBorderStyle = AX_BORDERSTYLE_SINGLE;
431  break;
432  case API_BORDER_SUNKEN:
433  nSpecialEffect = AX_SPECIALEFFECT_SUNKEN;
434  break;
435  case API_BORDER_NONE:
436  default:
437  break;
438  }
439  convertToMSColor( rPropSet, PROP_BorderColor, nBorderColor );
440 }
441 
442 void ControlConverter::convertAxVisualEffect( PropertyMap& rPropMap, sal_Int32 nSpecialEffect )
443 {
444  sal_Int16 nVisualEffect = (nSpecialEffect == AX_SPECIALEFFECT_FLAT) ? VisualEffect::FLAT : VisualEffect::LOOK3D;
445  rPropMap.setProperty( PROP_VisualEffect, nVisualEffect );
446 }
447 
448 void ControlConverter::convertToAxVisualEffect( PropertySet const & rPropSet, sal_Int32& nSpecialEffect )
449 {
450  sal_Int16 nVisualEffect = AX_SPECIALEFFECT_FLAT;
451  rPropSet.getProperty( nVisualEffect, PROP_VisualEffect );
452  // is this appropriate AX_SPECIALEFFECT_XXXX value ?
453  if (nVisualEffect == VisualEffect::LOOK3D )
454  nSpecialEffect = AX_SPECIALEFFECT_RAISED;
455 }
456 
457 void ControlConverter::convertAxPicture( PropertyMap& rPropMap, const StreamDataSequence& rPicData, sal_uInt32 nPicPos ) const
458 {
459  // the picture
460  convertPicture( rPropMap, rPicData );
461 
462  // picture position
463  sal_Int16 nImagePos = ImagePosition::LeftCenter;
464  switch( nPicPos )
465  {
466  case AX_PICPOS_LEFTTOP: nImagePos = ImagePosition::LeftTop; break;
467  case AX_PICPOS_LEFTCENTER: nImagePos = ImagePosition::LeftCenter; break;
468  case AX_PICPOS_LEFTBOTTOM: nImagePos = ImagePosition::LeftBottom; break;
469  case AX_PICPOS_RIGHTTOP: nImagePos = ImagePosition::RightTop; break;
470  case AX_PICPOS_RIGHTCENTER: nImagePos = ImagePosition::RightCenter; break;
471  case AX_PICPOS_RIGHTBOTTOM: nImagePos = ImagePosition::RightBottom; break;
472  case AX_PICPOS_ABOVELEFT: nImagePos = ImagePosition::AboveLeft; break;
473  case AX_PICPOS_ABOVECENTER: nImagePos = ImagePosition::AboveCenter; break;
474  case AX_PICPOS_ABOVERIGHT: nImagePos = ImagePosition::AboveRight; break;
475  case AX_PICPOS_BELOWLEFT: nImagePos = ImagePosition::BelowLeft; break;
476  case AX_PICPOS_BELOWCENTER: nImagePos = ImagePosition::BelowCenter; break;
477  case AX_PICPOS_BELOWRIGHT: nImagePos = ImagePosition::BelowRight; break;
478  case AX_PICPOS_CENTER: nImagePos = ImagePosition::Centered; break;
479  default: OSL_FAIL( "ControlConverter::convertAxPicture - unknown picture position" );
480  }
481  rPropMap.setProperty( PROP_ImagePosition, nImagePos );
482 }
483 
485  sal_Int32 nPicSizeMode ) const
486 {
487  // the picture
488  convertPicture( rPropMap, rPicData );
489 
490  // picture scale mode
491  sal_Int16 nScaleMode = ImageScaleMode::NONE;
492  switch( nPicSizeMode )
493  {
494  case AX_PICSIZE_CLIP: nScaleMode = ImageScaleMode::NONE; break;
495  case AX_PICSIZE_STRETCH: nScaleMode = ImageScaleMode::ANISOTROPIC; break;
496  case AX_PICSIZE_ZOOM: nScaleMode = ImageScaleMode::ISOTROPIC; break;
497  default: OSL_FAIL( "ControlConverter::convertAxPicture - unknown picture size mode" );
498  }
499  rPropMap.setProperty( PROP_ScaleMode, nScaleMode );
500 }
501 
503  const OUString& rValue, sal_Int32 nMultiSelect, ApiDefaultStateMode eDefStateMode, bool bAwtModel )
504 {
505  bool bBooleanState = eDefStateMode == API_DEFAULTSTATE_BOOLEAN;
506  bool bSupportsTriState = eDefStateMode == API_DEFAULTSTATE_TRISTATE;
507 
508  // state
509  sal_Int16 nState = bSupportsTriState ? API_STATE_DONTKNOW : API_STATE_UNCHECKED;
510  if( rValue.getLength() == 1 ) switch( rValue[ 0 ] )
511  {
512  case '0': nState = API_STATE_UNCHECKED; break;
513  case '1': nState = API_STATE_CHECKED; break;
514  // any other string (also empty) means 'dontknow'
515  }
516  sal_Int32 nPropId = bAwtModel ? PROP_State : PROP_DefaultState;
517  if( bBooleanState )
518  rPropMap.setProperty( nPropId, nState != API_STATE_UNCHECKED );
519  else
520  rPropMap.setProperty( nPropId, nState );
521 
522  // tristate
523  if( bSupportsTriState )
524  rPropMap.setProperty( PROP_TriState, nMultiSelect == AX_SELECTION_MULTI );
525 }
526 
528  OUString& rValue, sal_Int32& nMultiSelect, ApiDefaultStateMode eDefStateMode )
529 {
530  bool bSupportsTriState = eDefStateMode == API_DEFAULTSTATE_TRISTATE;
531 
532  sal_Int16 nState = API_STATE_DONTKNOW;
533 
534  // need to use State for current state ( I think this is regardless of whether
535  // control is awt or not )
536  rPropSet.getProperty( nState, PROP_State );
537 
538  rValue.clear(); // empty e.g. 'don't know'
539  if ( nState == API_STATE_UNCHECKED )
540  rValue = "0";
541  else if ( nState == API_STATE_CHECKED )
542  rValue = "1";
543 
544  // tristate
545  if( bSupportsTriState )
546  {
547  bool bTriStateEnabled = false;
548  bool bPropertyExists = rPropSet.getProperty( bTriStateEnabled, PROP_TriState );
549  if( bPropertyExists && bTriStateEnabled )
550  nMultiSelect = AX_SELECTION_MULTI;
551  }
552 }
553 
555  const AxPairData& rSize, sal_Int32 nOrientation )
556 {
557  bool bHorizontal = true;
558  switch( nOrientation )
559  {
560  case AX_ORIENTATION_AUTO: bHorizontal = rSize.first > rSize.second; break;
561  case AX_ORIENTATION_VERTICAL: bHorizontal = false; break;
562  case AX_ORIENTATION_HORIZONTAL: bHorizontal = true; break;
563  default: OSL_FAIL( "ControlConverter::convertAxOrientation - unknown orientation" );
564  }
565  convertOrientation( rPropMap, bHorizontal );
566 }
567 
569  sal_Int32& nOrientation )
570 {
571  bool bHorizontal = true;
572  convertToMSOrientation( rPropSet, bHorizontal );
573 
574  if ( bHorizontal )
575  nOrientation = AX_ORIENTATION_HORIZONTAL;
576  else
577  nOrientation = AX_ORIENTATION_VERTICAL;
578 }
579 
581  maSize( 0, 0 ),
582  mbAwtModel( false )
583 {
584 }
585 
587 {
588 }
589 
591 {
592  ApiControlType eCtrlType = getControlType();
593  if( mbAwtModel ) switch( eCtrlType )
594  {
595  case API_CONTROL_BUTTON: return "com.sun.star.awt.UnoControlButtonModel";
596  case API_CONTROL_FIXEDTEXT: return "com.sun.star.awt.UnoControlFixedTextModel";
597  case API_CONTROL_IMAGE: return "com.sun.star.awt.UnoControlImageControlModel";
598  case API_CONTROL_CHECKBOX: return "com.sun.star.awt.UnoControlCheckBoxModel";
599  case API_CONTROL_RADIOBUTTON: return "com.sun.star.form.component.RadioButton";
600  case API_CONTROL_EDIT: return "com.sun.star.awt.UnoControlEditModel";
601  case API_CONTROL_NUMERIC: return "com.sun.star.awt.UnoControlNumericFieldModel";
602  case API_CONTROL_LISTBOX: return "com.sun.star.form.component.ListBox";
603  case API_CONTROL_COMBOBOX: return "com.sun.star.form.component.ComboBox";
604  case API_CONTROL_SPINBUTTON: return "com.sun.star.form.component.SpinButton";
605  case API_CONTROL_SCROLLBAR: return "com.sun.star.form.component.ScrollBar";
606  case API_CONTROL_PROGRESSBAR: return "com.sun.star.awt.UnoControlProgressBarModel";
607  case API_CONTROL_GROUPBOX: return "com.sun.star.form.component.GroupBox";
608  case API_CONTROL_FRAME: return "com.sun.star.awt.UnoFrameModel";
609  case API_CONTROL_PAGE: return "com.sun.star.awt.UnoPageModel";
610  case API_CONTROL_MULTIPAGE: return "com.sun.star.awt.UnoMultiPageModel";
611  case API_CONTROL_DIALOG: return "com.sun.star.awt.UnoControlDialogModel";
612  default: OSL_FAIL( "ControlModelBase::getServiceName - no AWT model service supported" );
613  }
614  else switch( eCtrlType )
615  {
616  case API_CONTROL_BUTTON: return "com.sun.star.form.component.CommandButton";
617  case API_CONTROL_FIXEDTEXT: return "com.sun.star.form.component.FixedText";
618  case API_CONTROL_IMAGE: return "com.sun.star.form.component.DatabaseImageControl";
619  case API_CONTROL_CHECKBOX: return "com.sun.star.form.component.CheckBox";
620  case API_CONTROL_RADIOBUTTON: return "com.sun.star.form.component.RadioButton";
621  case API_CONTROL_EDIT: return "com.sun.star.form.component.TextField";
622  case API_CONTROL_NUMERIC: return "com.sun.star.form.component.NumericField";
623  case API_CONTROL_LISTBOX: return "com.sun.star.form.component.ListBox";
624  case API_CONTROL_COMBOBOX: return "com.sun.star.form.component.ComboBox";
625  case API_CONTROL_SPINBUTTON: return "com.sun.star.form.component.SpinButton";
626  case API_CONTROL_SCROLLBAR: return "com.sun.star.form.component.ScrollBar";
627  case API_CONTROL_GROUPBOX: return "com.sun.star.form.component.GroupBox";
628  default: OSL_FAIL( "ControlModelBase::getServiceName - no form component service supported" );
629  }
630  return OUString();
631 }
632 
633 void ControlModelBase::importProperty( sal_Int32 /*nPropId*/, const OUString& /*rValue*/ )
634 {
635 }
636 
637 void ControlModelBase::importPictureData( sal_Int32 /*nPropId*/, BinaryInputStream& /*rInStrm*/ )
638 {
639 }
640 
641 void ControlModelBase::convertProperties( PropertyMap& /*rPropMap*/, const ControlConverter& /*rConv*/ ) const
642 {
643 }
644 
646 {
647 }
648 
649 void ControlModelBase::convertSize( PropertyMap& rPropMap, const ControlConverter& rConv ) const
650 {
651  rConv.convertSize( rPropMap, maSize );
652 }
653 
654 ComCtlModelBase::ComCtlModelBase( sal_uInt32 nDataPartId5, sal_uInt32 nDataPartId6,
655  sal_uInt16 nVersion ) :
656  maFontData( "Tahoma", 82500 ),
657  mnFlags( 0 ),
658  mnVersion( nVersion ),
659  mnDataPartId5( nDataPartId5 ),
660  mnDataPartId6( nDataPartId6 ),
661  mbCommonPart( true ),
662  mbComplexPart( true )
663 {
664 }
665 
667 {
668  // read initial size part and header of the control data part
669  if( importSizePart( rInStrm ) && readPartHeader( rInStrm, getDataPartId(), mnVersion ) )
670  {
671  // if flags part exists, the first int32 of the data part contains its size
672  sal_uInt32 nCommonPartSize = 0;
673  if (mbCommonPart)
674  nCommonPartSize = rInStrm.readuInt32();
675  // implementations must read the exact amount of data, stream must point to its end afterwards
676  importControlData( rInStrm );
677  // read following parts
678  if( !rInStrm.isEof() &&
679  (!mbCommonPart || importCommonPart( rInStrm, nCommonPartSize )) &&
680  (!mbComplexPart || importComplexPart( rInStrm )) )
681  {
682  return !rInStrm.isEof();
683  }
684  }
685  return false;
686 }
687 
689 {
690  if( mbCommonPart )
691  rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, COMCTL_COMMON_ENABLED ) );
692  ControlModelBase::convertProperties( rPropMap, rConv );
693 }
694 
696 {
697  switch( mnVersion )
698  {
699  case COMCTL_VERSION_50: return mnDataPartId5;
700  case COMCTL_VERSION_60: return mnDataPartId6;
701  }
702  OSL_FAIL( "ComCtlObjectBase::getDataPartId - unexpected version" );
703  return SAL_MAX_UINT32;
704 }
705 
706 bool ComCtlModelBase::readPartHeader( BinaryInputStream& rInStrm, sal_uInt32 nExpPartId, sal_uInt16 nExpMajor, sal_uInt16 nExpMinor )
707 {
708  // no idea if all this is correct...
709  sal_uInt32 nPartId = rInStrm.readuInt32();
710  sal_uInt16 nMinor = rInStrm.readuInt16();
711  sal_uInt16 nMajor = rInStrm.readuInt16();
712  bool bPartId = nPartId == nExpPartId;
713  OSL_ENSURE( bPartId, "ComCtlObjectBase::readPartHeader - unexpected part identifier" );
714  bool bVersion = ((nExpMajor == SAL_MAX_UINT16) || (nExpMajor == nMajor)) && ((nExpMinor == SAL_MAX_UINT16) || (nExpMinor == nMinor));
715  OSL_ENSURE( bVersion, "ComCtlObjectBase::readPartHeader - unexpected part version" );
716  return !rInStrm.isEof() && bPartId && bVersion;
717 }
718 
720 {
721  if( readPartHeader( rInStrm, COMCTL_ID_SIZE, 0, 8 ) )
722  {
723  maSize.first = rInStrm.readInt32();
724  maSize.second = rInStrm.readInt32();
725  return !rInStrm.isEof();
726  }
727  return false;
728 }
729 
730 bool ComCtlModelBase::importCommonPart( BinaryInputStream& rInStrm, sal_uInt32 nPartSize )
731 {
732  sal_Int64 nEndPos = rInStrm.tell() + nPartSize;
733  if( (nPartSize >= 16) && readPartHeader( rInStrm, COMCTL_ID_COMMONDATA, 5, 0 ) )
734  {
735  rInStrm.skip( 4 );
736  mnFlags = rInStrm.readuInt32();
737  rInStrm.seek( nEndPos );
738  return !rInStrm.isEof();
739  }
740  return false;
741 }
742 
744 {
745  if( readPartHeader( rInStrm, COMCTL_ID_COMPLEXDATA, 5, 1 ) )
746  {
747  sal_uInt32 nContFlags = rInStrm.readuInt32();
748  bool bReadOk =
749  (!getFlag( nContFlags, COMCTL_COMPLEX_FONT ) || OleHelper::importStdFont( maFontData, rInStrm, true )) &&
750  (!getFlag( nContFlags, COMCTL_COMPLEX_MOUSEICON ) || OleHelper::importStdPic( maMouseIcon, rInStrm ));
751  return bReadOk && !rInStrm.isEof();
752  }
753  return false;
754 }
755 
757  ComCtlModelBase( SAL_MAX_UINT32, COMCTL_ID_SCROLLBAR_60, nVersion ),
758  mnScrollBarFlags( 0x00000011 ),
759  mnLargeChange( 1 ),
760  mnSmallChange( 1 ),
761  mnMin( 0 ),
762  mnMax( 32767 ),
763  mnPosition( 0 )
764 {
765 }
766 
768 {
769  return API_CONTROL_SCROLLBAR;
770 }
771 
773 {
774  rPropMap.setProperty( PROP_Border, API_BORDER_NONE );
775  ControlConverter::convertOrientation( rPropMap, getFlag( mnScrollBarFlags, COMCTL_SCROLLBAR_HOR ) );
777  ComCtlModelBase::convertProperties( rPropMap, rConv );
778 }
779 
781 {
782  mnScrollBarFlags = rInStrm.readuInt32();
783  mnLargeChange = rInStrm.readInt32();
784  mnSmallChange = rInStrm.readInt32();
785  mnMin = rInStrm.readInt32();
786  mnMax = rInStrm.readInt32();
787  mnPosition = rInStrm.readInt32();
788 }
789 
791  ComCtlModelBase( COMCTL_ID_PROGRESSBAR_50, COMCTL_ID_PROGRESSBAR_60, nVersion ),
792  mfMin( 0.0 ),
793  mfMax( 100.0 ),
794  mnVertical( 0 ),
795  mnSmooth( 0 )
796 {
797 }
798 
800 {
802 }
803 
805 {
806  sal_uInt16 nBorder = getFlag( mnFlags, COMCTL_COMMON_3DBORDER ) ? API_BORDER_SUNKEN :
807  (getFlag( mnFlags, COMCTL_COMMON_FLATBORDER ) ? API_BORDER_FLAT : API_BORDER_NONE);
808  rPropMap.setProperty( PROP_Border, nBorder );
809  rPropMap.setProperty( PROP_ProgressValueMin, getLimitedValue< sal_Int32, double >( ::std::min( mfMin, mfMax ), 0.0, SAL_MAX_INT32 ) );
810  rPropMap.setProperty( PROP_ProgressValueMax, getLimitedValue< sal_Int32, double >( ::std::max( mfMin, mfMax ), 0.0, SAL_MAX_INT32 ) );
811  // ComCtl model does not provide current value?
812  ComCtlModelBase::convertProperties( rPropMap, rConv );
813 }
814 
816 {
817  mfMin = rInStrm.readFloat();
818  mfMax = rInStrm.readFloat();
820  {
821  mnVertical = rInStrm.readuInt16();
822  mnSmooth = rInStrm.readuInt16();
823  }
824 }
825 
827 {
828 }
829 
830 void AxControlModelBase::importProperty( sal_Int32 nPropId, const OUString& rValue )
831 {
832  switch( nPropId )
833  {
834  // size of the control shape: format is "width;height"
835  case XML_Size:
836  {
837  sal_Int32 nSepPos = rValue.indexOf( ';' );
838  OSL_ENSURE( nSepPos >= 0, "AxControlModelBase::importProperty - missing separator in 'Size' property" );
839  if( nSepPos >= 0 )
840  {
841  maSize.first = o3tl::toInt32(rValue.subView( 0, nSepPos ));
842  maSize.second = o3tl::toInt32(rValue.subView( nSepPos + 1 ));
843  }
844  }
845  break;
846  }
847 }
848 
849 AxFontDataModel::AxFontDataModel( bool bSupportsAlign ) :
850  mbSupportsAlign( bSupportsAlign )
851 {
852 }
853 
854 void AxFontDataModel::importProperty( sal_Int32 nPropId, const OUString& rValue )
855 {
856  switch( nPropId )
857  {
858  case XML_FontName: maFontData.maFontName = rValue; break;
859  case XML_FontEffects:
861  break;
862  case XML_FontHeight: maFontData.mnFontHeight = AttributeConversion::decodeInteger( rValue ); break;
863  case XML_FontCharSet: maFontData.mnFontCharSet = AttributeConversion::decodeInteger( rValue ); break;
864  case XML_ParagraphAlign:
866  break;
867  default: AxControlModelBase::importProperty( nPropId, rValue );
868  }
869 }
870 
872 {
873  return maFontData.importBinaryModel( rInStrm );
874 }
875 
877 {
878  maFontData.exportBinaryModel( rOutStrm );
879 }
881 {
882  // font name
883  if( !maFontData.maFontName.isEmpty() )
884  rPropMap.setProperty( PROP_FontName, maFontData.maFontName );
885 
886  // font effects
887  rPropMap.setProperty( PROP_FontWeight, maFontData.mnFontEffects & AxFontFlags::Bold ? awt::FontWeight::BOLD : awt::FontWeight::NORMAL );
888  rPropMap.setProperty( PROP_FontSlant, maFontData.mnFontEffects & AxFontFlags::Italic ? FontSlant_ITALIC : FontSlant_NONE );
890  rPropMap.setProperty( PROP_FontUnderline, maFontData.mbDblUnderline ? awt::FontUnderline::DOUBLE : awt::FontUnderline::SINGLE );
891  else
892  rPropMap.setProperty( PROP_FontUnderline, awt::FontUnderline::NONE );
893  rPropMap.setProperty( PROP_FontStrikeout, maFontData.mnFontEffects & AxFontFlags::Strikeout ? awt::FontStrikeout::SINGLE : awt::FontStrikeout::NONE );
894  rPropMap.setProperty( PROP_FontHeight, maFontData.getHeightPoints() );
895 
896  // font character set
897  rtl_TextEncoding eFontEnc = RTL_TEXTENCODING_DONTKNOW;
899  eFontEnc = rtl_getTextEncodingFromWindowsCharset( static_cast< sal_uInt8 >( maFontData.mnFontCharSet ) );
900  if( eFontEnc != RTL_TEXTENCODING_DONTKNOW )
901  rPropMap.setProperty( PROP_FontCharset, static_cast< sal_Int16 >( eFontEnc ) );
902 
903  // text alignment
904  if( mbSupportsAlign )
905  {
906  sal_Int32 nAlign = awt::TextAlign::LEFT;
907  switch( maFontData.mnHorAlign )
908  {
909  case AxHorizontalAlign::Left: nAlign = awt::TextAlign::LEFT; break;
910  case AxHorizontalAlign::Right: nAlign = awt::TextAlign::RIGHT; break;
911  case AxHorizontalAlign::Center: nAlign = awt::TextAlign::CENTER; break;
912  default: OSL_FAIL( "AxFontDataModel::convertProperties - unknown text alignment" );
913  }
914  // form controls expect short value
915  rPropMap.setProperty( PROP_Align, static_cast< sal_Int16 >( nAlign ) );
916  }
917 
918  // process base class properties
919  AxControlModelBase::convertProperties( rPropMap, rConv );
920 }
921 
923 {
924  rPropSet.getProperty( maFontData.maFontName, PROP_FontName );
925  float fontWeight = float(0);
926  if ( rPropSet.getProperty(fontWeight, PROP_FontWeight ) )
927  setFlag( maFontData.mnFontEffects, AxFontFlags::Bold, ( fontWeight == awt::FontWeight::BOLD ) );
928  FontSlant nSlant = FontSlant_NONE;
929  if ( rPropSet.getProperty( nSlant, PROP_FontSlant ) )
930  setFlag( maFontData.mnFontEffects, AxFontFlags::Italic, ( nSlant == FontSlant_ITALIC ) );
931 
932  sal_Int16 nUnderLine = awt::FontUnderline::NONE;
933  if ( rPropSet.getProperty( nUnderLine, PROP_FontUnderline ) )
934  setFlag( maFontData.mnFontEffects, AxFontFlags::Underline, nUnderLine != awt::FontUnderline::NONE && nUnderLine != awt::FontUnderline::DONTKNOW);
935  sal_Int16 nStrikeout = awt::FontStrikeout::NONE ;
936  if ( rPropSet.getProperty( nStrikeout, PROP_FontStrikeout ) )
937  setFlag( maFontData.mnFontEffects, AxFontFlags::Strikeout, nStrikeout != awt::FontStrikeout::NONE && nStrikeout != awt::FontStrikeout::DONTKNOW);
938 
939  float fontHeight = 0.0;
940  if ( rPropSet.getProperty( fontHeight, PROP_FontHeight ) )
941  {
942  if ( fontHeight == 0 ) // tdf#118684
943  {
945  fontHeight = static_cast< float >( aDefaultVCLFont.GetFontHeight() );
946  }
947  maFontData.setHeightPoints( static_cast< sal_Int16 >( fontHeight ) );
948  }
949 
950  // TODO - handle textencoding
951  sal_Int16 nAlign = 0;
952  if ( rPropSet.getProperty( nAlign, PROP_Align ) )
953  {
954  switch ( nAlign )
955  {
956  case awt::TextAlign::LEFT: maFontData.mnHorAlign = AxHorizontalAlign::Left; break;
957  case awt::TextAlign::RIGHT: maFontData.mnHorAlign = AxHorizontalAlign::Right; break;
958  case awt::TextAlign::CENTER: maFontData.mnHorAlign = AxHorizontalAlign::Center; break;
959  default: OSL_FAIL( "AxFontDataModel::convertFromProperties - unknown text alignment" );
960  }
961  }
962 }
963 
965  mnTextColor( AX_SYSCOLOR_BUTTONTEXT ),
966  mnBackColor( AX_SYSCOLOR_BUTTONFACE ),
967  mnFlags( AX_CMDBUTTON_DEFFLAGS ),
968  mnPicturePos( AX_PICPOS_ABOVECENTER ),
969  mnVerticalAlign( XML_Center ),
970  mbFocusOnClick( true )
971 {
972 }
973 
974 void AxCommandButtonModel::importProperty( sal_Int32 nPropId, const OUString& rValue )
975 {
976  switch( nPropId )
977  {
978  case XML_Caption: maCaption = rValue; break;
979  case XML_ForeColor: mnTextColor = AttributeConversion::decodeUnsigned( rValue ); break;
980  case XML_BackColor: mnBackColor = AttributeConversion::decodeUnsigned( rValue ); break;
981  case XML_VariousPropertyBits: mnFlags = AttributeConversion::decodeUnsigned( rValue ); break;
982  case XML_PicturePosition: mnPicturePos = AttributeConversion::decodeUnsigned( rValue ); break;
983  case XML_TakeFocusOnClick: mbFocusOnClick = AttributeConversion::decodeInteger( rValue ) != 0; break;
984  default: AxFontDataModel::importProperty( nPropId, rValue );
985  }
986 }
987 
989 {
990  switch( nPropId )
991  {
992  case XML_Picture: OleHelper::importStdPic( maPictureData, rInStrm ); break;
993  default: AxFontDataModel::importPictureData( nPropId, rInStrm );
994  }
995 }
996 
998 {
999  AxBinaryPropertyReader aReader( rInStrm );
1000  aReader.readIntProperty< sal_uInt32 >( mnTextColor );
1001  aReader.readIntProperty< sal_uInt32 >( mnBackColor );
1002  aReader.readIntProperty< sal_uInt32 >( mnFlags );
1003  aReader.readStringProperty( maCaption );
1004  aReader.readIntProperty< sal_uInt32 >( mnPicturePos );
1005  aReader.readPairProperty( maSize );
1006  aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer
1008  aReader.skipIntProperty< sal_uInt16 >(); // accelerator
1009  aReader.readBoolProperty( mbFocusOnClick, true ); // binary flag means "do not take focus"
1010  aReader.skipPictureProperty(); // mouse icon
1011  return aReader.finalizeImport() && AxFontDataModel::importBinaryModel( rInStrm );
1012 }
1013 
1015 {
1016  AxBinaryPropertyWriter aWriter( rOutStrm );
1017  aWriter.writeIntProperty< sal_uInt32 >( mnTextColor );
1018  if ( mnBackColor )
1019  aWriter.writeIntProperty< sal_uInt32 >( mnBackColor );
1020  else
1021  aWriter.skipProperty(); // default backcolour
1022  aWriter.writeIntProperty< sal_uInt32 >( mnFlags );
1023  aWriter.writeStringProperty( maCaption );
1024  aWriter.skipProperty(); // pict pos
1025  aWriter.writePairProperty( maSize );
1026  aWriter.skipProperty(); // mouse pointer
1027  aWriter.skipProperty(); // picture data
1028  aWriter.skipProperty(); // accelerator
1029  aWriter.writeBoolProperty( mbFocusOnClick ); // binary flag means "do not take focus"
1030  aWriter.skipProperty(); // mouse icon
1031  aWriter.finalizeExport();
1033 }
1034 
1036 {
1037  // should be able to replace this hardcoded foo with
1038  // proper export info from MS-OLEDS spec.
1039  static sal_uInt8 const aCompObj[] = {
1040  0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
1041  0xFF, 0xFF, 0xFF, 0xFF, 0x40, 0x32, 0x05, 0xD7,
1042  0x69, 0xCE, 0xCD, 0x11, 0xA7, 0x77, 0x00, 0xDD,
1043  0x01, 0x14, 0x3C, 0x57, 0x22, 0x00, 0x00, 0x00,
1044  0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
1045  0x74, 0x20, 0x46, 0x6F, 0x72, 0x6d, 0x73, 0x20,
1046  0x32, 0x2e, 0x30, 0x20, 0x43, 0x6F, 0x6D, 0x6D,
1047  0x61, 0x6E, 0x64, 0x42, 0x75, 0x74, 0x74, 0x6F,
1048  0x6E, 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D,
1049  0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F,
1050  0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x16, 0x00,
1051  0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E,
1052  0x43, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x42,
1053  0x75, 0x74, 0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00,
1054  0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
1055  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1056  };
1057  rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
1058 }
1059 
1061 {
1062  return API_CONTROL_BUTTON;
1063 }
1064 
1066 {
1067  rPropMap.setProperty( PROP_Label, maCaption );
1068  rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
1069  rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
1070  rPropMap.setProperty( PROP_FocusOnClick, mbFocusOnClick );
1071  rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor );
1074  rConv.convertAxPicture( rPropMap, maPictureData, mnPicturePos );
1075  AxFontDataModel::convertProperties( rPropMap, rConv );
1076 }
1077 
1079 {
1080  (void)rPropSet.getProperty(maCaption, PROP_Label);
1081  bool bRes = false;
1082  if ( rPropSet.getProperty( bRes, PROP_Enabled ) )
1083  setFlag( mnFlags, AX_FLAGS_ENABLED, bRes );
1084  if ( rPropSet.getProperty( bRes, PROP_MultiLine ) )
1085  setFlag( mnFlags, AX_FLAGS_WORDWRAP, bRes );
1086  (void)rPropSet.getProperty(mbFocusOnClick, PROP_FocusOnClick);
1087 
1088  ControlConverter::convertToMSColor( rPropSet, PROP_TextColor, mnTextColor );
1089  ControlConverter::convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
1090 
1091  AxFontDataModel::convertFromProperties( rPropSet, rConv );
1092 }
1093 
1095  mnTextColor( AX_SYSCOLOR_BUTTONTEXT ),
1096  mnBackColor( AX_SYSCOLOR_BUTTONFACE ),
1097  mnFlags( AX_LABEL_DEFFLAGS ),
1098  mnBorderColor( AX_SYSCOLOR_WINDOWFRAME ),
1099  mnBorderStyle( AX_BORDERSTYLE_NONE ),
1100  mnSpecialEffect( AX_SPECIALEFFECT_FLAT ),
1101  mnVerticalAlign( XML_Top )
1102 {
1103 }
1104 
1105 void AxLabelModel::importProperty( sal_Int32 nPropId, const OUString& rValue )
1106 {
1107  switch( nPropId )
1108  {
1109  case XML_Caption: maCaption = rValue; break;
1110  case XML_ForeColor: mnTextColor = AttributeConversion::decodeUnsigned( rValue ); break;
1111  case XML_BackColor: mnBackColor = AttributeConversion::decodeUnsigned( rValue ); break;
1112  case XML_VariousPropertyBits: mnFlags = AttributeConversion::decodeUnsigned( rValue ); break;
1113  case XML_BorderColor: mnBorderColor = AttributeConversion::decodeUnsigned( rValue ); break;
1114  case XML_BorderStyle: mnBorderStyle = AttributeConversion::decodeInteger( rValue ); break;
1115  case XML_SpecialEffect: mnSpecialEffect = AttributeConversion::decodeInteger( rValue ); break;
1116  default: AxFontDataModel::importProperty( nPropId, rValue );
1117  }
1118 }
1119 
1121 {
1122  AxBinaryPropertyReader aReader( rInStrm );
1123  aReader.readIntProperty< sal_uInt32 >( mnTextColor );
1124  aReader.readIntProperty< sal_uInt32 >( mnBackColor );
1125  aReader.readIntProperty< sal_uInt32 >( mnFlags );
1126  aReader.readStringProperty( maCaption );
1127  aReader.skipIntProperty< sal_uInt32 >(); // picture position
1128  aReader.readPairProperty( maSize );
1129  aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer
1130  aReader.readIntProperty< sal_uInt32 >( mnBorderColor );
1131  aReader.readIntProperty< sal_uInt16 >( mnBorderStyle );
1132  aReader.readIntProperty< sal_uInt16 >( mnSpecialEffect );
1133  aReader.skipPictureProperty(); // picture
1134  aReader.skipIntProperty< sal_uInt16 >(); // accelerator
1135  aReader.skipPictureProperty(); // mouse icon
1136  return aReader.finalizeImport() && AxFontDataModel::importBinaryModel( rInStrm );
1137 }
1138 
1140 {
1141  AxBinaryPropertyWriter aWriter( rOutStrm );
1142  aWriter.writeIntProperty< sal_uInt32 >( mnTextColor );
1143  if ( mnBackColor )
1144  aWriter.writeIntProperty< sal_uInt32 >( mnBackColor );
1145  else
1146  // if mnBackColor == 0 then it's the libreoffice default backcolour is
1147  // the MSO Label default which is AX_SYSCOLOR_BUTTONFACE
1148  aWriter.writeIntProperty< sal_uInt32 >( AX_SYSCOLOR_WINDOWBACK );
1149  aWriter.writeIntProperty< sal_uInt32 >( mnFlags );
1150  aWriter.writeStringProperty( maCaption );
1151  aWriter.skipProperty(); // picture position
1152  aWriter.writePairProperty( maSize );
1153  aWriter.skipProperty(); // mouse pointer
1154  aWriter.writeIntProperty< sal_uInt32 >( mnBorderColor );
1155  aWriter.writeIntProperty< sal_uInt16 >( mnBorderStyle );
1156  aWriter.writeIntProperty< sal_uInt16 >( mnSpecialEffect );
1157  aWriter.skipProperty(); // picture
1158  aWriter.skipProperty(); // accelerator
1159  aWriter.skipProperty(); // mouse icon
1160  aWriter.finalizeExport();
1162 }
1163 
1165 {
1166  rPropSet.getProperty( maCaption, PROP_Label );
1167  bool bRes = false;
1168  if ( rPropSet.getProperty( bRes, PROP_Enabled ) )
1169  setFlag( mnFlags, AX_FLAGS_ENABLED, bRes );
1170  if ( rPropSet.getProperty( bRes, PROP_MultiLine ) )
1171  setFlag( mnFlags, AX_FLAGS_WORDWRAP, bRes );
1172 
1173  ControlConverter::convertToMSColor( rPropSet, PROP_TextColor, mnTextColor );
1174  // VerticalAlign doesn't seem to be read from binary
1175 
1176  // not sure about background color, how do we decide when to set
1177  // AX_FLAGS_OPAQUE ?
1178  ControlConverter::convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
1180 
1181  AxFontDataModel::convertFromProperties( rPropSet, rConv );
1182 }
1183 
1185 {
1186  // should be able to replace this hardcoded foo with
1187  // proper export info from MS-OLEDS spec.
1188  static sal_uInt8 const aCompObj[] = {
1189  0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
1190  0xFF, 0xFF, 0xFF, 0xFF, 0x23, 0x9E, 0x8C, 0x97,
1191  0xB0, 0xD4, 0xCE, 0x11, 0xBF, 0x2D, 0x00, 0xAA,
1192  0x00, 0x3F, 0x40, 0xD0, 0x1A, 0x00, 0x00, 0x00,
1193  0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
1194  0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
1195  0x32, 0x2E, 0x30, 0x20, 0x4C, 0x61, 0x62, 0x65,
1196  0x6C, 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D,
1197  0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F,
1198  0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x0E, 0x00,
1199  0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E,
1200  0x4C, 0x61, 0x62, 0x65, 0x6C, 0x2E, 0x31, 0x00,
1201  0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
1202  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1203  };
1204  rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
1205 }
1206 
1208 {
1209  return API_CONTROL_FIXEDTEXT;
1210 }
1211 
1212 void AxLabelModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
1213 {
1214  rPropMap.setProperty( PROP_Label, maCaption );
1215  rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
1216  rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
1217  rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor );
1221  AxFontDataModel::convertProperties( rPropMap, rConv );
1222 }
1223 
1225  mnBackColor( AX_SYSCOLOR_BUTTONFACE ),
1226  mnFlags( AX_IMAGE_DEFFLAGS ),
1227  mnBorderColor( AX_SYSCOLOR_WINDOWFRAME ),
1228  mnBorderStyle( AX_BORDERSTYLE_SINGLE ),
1229  mnSpecialEffect( AX_SPECIALEFFECT_FLAT ),
1230  mnPicSizeMode( AX_PICSIZE_CLIP ),
1231  mnPicAlign( AX_PICALIGN_CENTER ),
1232  mbPicTiling( false )
1233 {
1234 }
1235 
1236 void AxImageModel::importProperty( sal_Int32 nPropId, const OUString& rValue )
1237 {
1238  switch( nPropId )
1239  {
1240  case XML_BackColor: mnBackColor = AttributeConversion::decodeUnsigned( rValue ); break;
1241  case XML_VariousPropertyBits: mnFlags = AttributeConversion::decodeUnsigned( rValue ); break;
1242  case XML_BorderColor: mnBorderColor = AttributeConversion::decodeUnsigned( rValue ); break;
1243  case XML_BorderStyle: mnBorderStyle = AttributeConversion::decodeInteger( rValue ); break;
1244  case XML_SpecialEffect: mnSpecialEffect = AttributeConversion::decodeInteger( rValue ); break;
1245  case XML_SizeMode: mnPicSizeMode = AttributeConversion::decodeInteger( rValue ); break;
1246  case XML_PictureAlignment: mnPicAlign = AttributeConversion::decodeInteger( rValue ); break;
1247  case XML_PictureTiling: mbPicTiling = AttributeConversion::decodeInteger( rValue ) != 0; break;
1248  default: AxControlModelBase::importProperty( nPropId, rValue );
1249  }
1250 }
1251 
1252 void AxImageModel::importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm )
1253 {
1254  switch( nPropId )
1255  {
1256  case XML_Picture: OleHelper::importStdPic( maPictureData, rInStrm ); break;
1257  default: AxControlModelBase::importPictureData( nPropId, rInStrm );
1258  }
1259 }
1260 
1262 {
1263  AxBinaryPropertyReader aReader( rInStrm );
1264  aReader.skipUndefinedProperty();
1265  aReader.skipUndefinedProperty();
1266  aReader.skipBoolProperty(); // auto-size
1267  aReader.readIntProperty< sal_uInt32 >( mnBorderColor );
1268  aReader.readIntProperty< sal_uInt32 >( mnBackColor );
1269  aReader.readIntProperty< sal_uInt8 >( mnBorderStyle );
1270  aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer
1271  aReader.readIntProperty< sal_uInt8 >( mnPicSizeMode );
1273  aReader.readPairProperty( maSize );
1275  aReader.readIntProperty< sal_uInt8 >( mnPicAlign );
1276  aReader.readBoolProperty( mbPicTiling );
1277  aReader.readIntProperty< sal_uInt32 >( mnFlags );
1278  aReader.skipPictureProperty(); // mouse icon
1279  return aReader.finalizeImport();
1280 }
1281 
1283 {
1284  AxBinaryPropertyWriter aWriter( rOutStrm );
1285  aWriter.skipProperty(); //undefined
1286  aWriter.skipProperty(); //undefined
1287  aWriter.skipProperty(); //auto-size
1288  aWriter.writeIntProperty< sal_uInt32 >( mnBorderColor );
1289  if ( mnBackColor )
1290  aWriter.writeIntProperty< sal_uInt32 >( mnBackColor );
1291  else
1292  aWriter.skipProperty(); // default backcolour
1294  aWriter.skipProperty(); // mouse pointer
1297  aWriter.writePairProperty( maSize );
1298  aWriter.skipProperty(); //maPictureData );
1299  aWriter.writeIntProperty< sal_uInt8 >( mnPicAlign );
1300  aWriter.writeBoolProperty( mbPicTiling );
1301  aWriter.writeIntProperty< sal_uInt32 >( mnFlags );
1302  aWriter.skipProperty(); // mouse icon
1303  aWriter.finalizeExport();
1304 }
1305 
1307 {
1308  // should be able to replace this hardcoded foo with
1309  // proper export info from MS-OLEDS spec.
1310  static sal_uInt8 const aCompObj[] = {
1311  0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
1312  0xFF, 0xFF, 0xFF, 0xFF, 0x41, 0x92, 0x59, 0x4C,
1313  0x26, 0x69, 0x1B, 0x10, 0x99, 0x92, 0x00, 0x00,
1314  0x0B, 0x65, 0xC6, 0xF9, 0x1A, 0x00, 0x00, 0x00,
1315  0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
1316  0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
1317  0x32, 0x2E, 0x30, 0x20, 0x49, 0x6D, 0x61, 0x67,
1318  0x65, 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D,
1319  0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F,
1320  0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x0E, 0x00,
1321  0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E,
1322  0x49, 0x6D, 0x61, 0x67, 0x65, 0x2E, 0x31, 0x00,
1323  0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
1324  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1325  };
1326  rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
1327 }
1328 
1330 {
1331  return API_CONTROL_IMAGE;
1332 }
1333 
1334 void AxImageModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
1335 {
1336  rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
1339  rConv.convertAxPicture( rPropMap, maPictureData, mnPicSizeMode );
1340  AxControlModelBase::convertProperties( rPropMap, rConv );
1341 }
1342 
1344  mnListIndex( 0 ),
1345  mnTabStyle( 0 ),
1346  mnTabData( 0 ),
1347  mnVariousPropertyBits( 0 )
1348 {
1349 }
1350 
1352 {
1353  // not worth reading much here, basically we are interested
1354  // in whether we have tabs, the width, the height and the
1355  // captions, everything else we can pretty much discard ( for now )
1356  AxBinaryPropertyReader aReader( rInStrm );
1357  aReader.readIntProperty< sal_uInt32 >( mnListIndex ); // ListIndex
1358  aReader.skipIntProperty< sal_uInt32 >(); // Backcolor
1359  aReader.skipIntProperty< sal_uInt32 >(); // ForeColor
1360  aReader.skipUndefinedProperty();
1361  aReader.readPairProperty( maSize );
1362  aReader.readArrayStringProperty( maItems );
1363  aReader.skipIntProperty< sal_uInt8 >(); // MousePointer
1364  aReader.skipUndefinedProperty();
1365  aReader.skipIntProperty< sal_uInt32 >(); // TabOrientation
1366  aReader.readIntProperty< sal_uInt32 >(mnTabStyle); // TabStyle
1367  aReader.skipBoolProperty(); // MultiRow
1368  aReader.skipIntProperty< sal_uInt32 >(); // TabFixedWidth
1369  aReader.skipIntProperty< sal_uInt32 >(); // TabFixedHeight
1370  aReader.skipBoolProperty(); // ToolTips
1371  aReader.skipUndefinedProperty();
1372  aReader.skipArrayStringProperty(); // ToolTip strings
1373  aReader.skipUndefinedProperty();
1374  aReader.readArrayStringProperty( maTabNames ); // Tab names
1375  aReader.readIntProperty< sal_uInt32 >(mnVariousPropertyBits); // VariousPropertyBits
1376  aReader.skipBoolProperty();// NewVersion
1377  aReader.skipIntProperty< sal_uInt32 >(); // TabsAllocated
1378  aReader.skipArrayStringProperty(); // Tags
1379  aReader.readIntProperty<sal_uInt32 >(mnTabData); // TabData
1380  aReader.skipArrayStringProperty(); // Accelerators
1381  aReader.skipPictureProperty(); // Mouse Icon
1382  return aReader.finalizeImport() && AxFontDataModel::importBinaryModel( rInStrm );
1383 }
1384 
1386 {
1387  return API_CONTROL_TABSTRIP;
1388 }
1389 
1391  mnTextColor( AX_SYSCOLOR_WINDOWTEXT ),
1392  mnBackColor( AX_SYSCOLOR_WINDOWBACK ),
1393  mnFlags( AX_MORPHDATA_DEFFLAGS ),
1394  mnPicturePos( AX_PICPOS_ABOVECENTER ),
1395  mnBorderColor( AX_SYSCOLOR_WINDOWFRAME ),
1396  mnBorderStyle( AX_BORDERSTYLE_NONE ),
1397  mnSpecialEffect( AX_SPECIALEFFECT_SUNKEN ),
1398  mnDisplayStyle( AX_DISPLAYSTYLE_TEXT ),
1399  mnMultiSelect( AX_SELECTION_SINGLE ),
1400  mnScrollBars( AX_SCROLLBAR_NONE ),
1401  mnMatchEntry( AX_MATCHENTRY_NONE ),
1402  mnShowDropButton( AX_SHOWDROPBUTTON_NEVER ),
1403  mnMaxLength( 0 ),
1404  mnPasswordChar( 0 ),
1405  mnListRows( 8 ),
1406  mnVerticalAlign( XML_Center )
1407 {
1408 }
1409 
1410 void AxMorphDataModelBase::importProperty( sal_Int32 nPropId, const OUString& rValue )
1411 {
1412  switch( nPropId )
1413  {
1414  case XML_Caption: maCaption = rValue; break;
1415  case XML_Value: maValue = rValue; break;
1416  case XML_GroupName: maGroupName = rValue; break;
1417  case XML_ForeColor: mnTextColor = AttributeConversion::decodeUnsigned( rValue ); break;
1418  case XML_BackColor: mnBackColor = AttributeConversion::decodeUnsigned( rValue ); break;
1419  case XML_VariousPropertyBits: mnFlags = AttributeConversion::decodeUnsigned( rValue ); break;
1420  case XML_PicturePosition: mnPicturePos = AttributeConversion::decodeUnsigned( rValue ); break;
1421  case XML_BorderColor: mnBorderColor = AttributeConversion::decodeUnsigned( rValue ); break;
1422  case XML_BorderStyle: mnBorderStyle = AttributeConversion::decodeInteger( rValue ); break;
1423  case XML_SpecialEffect: mnSpecialEffect = AttributeConversion::decodeInteger( rValue ); break;
1424  case XML_DisplayStyle: mnDisplayStyle = AttributeConversion::decodeInteger( rValue ); break;
1425  case XML_MultiSelect: mnMultiSelect = AttributeConversion::decodeInteger( rValue ); break;
1426  case XML_ScrollBars: mnScrollBars = AttributeConversion::decodeInteger( rValue ); break;
1427  case XML_MatchEntry: mnMatchEntry = AttributeConversion::decodeInteger( rValue ); break;
1428  case XML_ShowDropButtonWhen: mnShowDropButton = AttributeConversion::decodeInteger( rValue );break;
1429  case XML_MaxLength: mnMaxLength = AttributeConversion::decodeInteger( rValue ); break;
1430  case XML_PasswordChar: mnPasswordChar = AttributeConversion::decodeInteger( rValue ); break;
1431  case XML_ListRows: mnListRows = AttributeConversion::decodeInteger( rValue ); break;
1432  default: AxFontDataModel::importProperty( nPropId, rValue );
1433  }
1434 }
1435 
1437 {
1438  switch( nPropId )
1439  {
1440  case XML_Picture: OleHelper::importStdPic( maPictureData, rInStrm ); break;
1441  default: AxFontDataModel::importPictureData( nPropId, rInStrm );
1442  }
1443 }
1444 
1446 {
1447  AxBinaryPropertyReader aReader( rInStrm, true );
1448  aReader.readIntProperty< sal_uInt32 >( mnFlags );
1449  aReader.readIntProperty< sal_uInt32 >( mnBackColor );
1450  aReader.readIntProperty< sal_uInt32 >( mnTextColor );
1451  aReader.readIntProperty< sal_Int32 >( mnMaxLength );
1452  aReader.readIntProperty< sal_uInt8 >( mnBorderStyle );
1453  aReader.readIntProperty< sal_uInt8 >( mnScrollBars );
1455  aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer
1456  aReader.readPairProperty( maSize );
1457  aReader.readIntProperty< sal_uInt16 >( mnPasswordChar );
1458  aReader.skipIntProperty< sal_uInt32 >(); // list width
1459  aReader.skipIntProperty< sal_uInt16 >(); // bound column
1460  aReader.skipIntProperty< sal_Int16 >(); // text column
1461  aReader.skipIntProperty< sal_Int16 >(); // column count
1462  aReader.readIntProperty< sal_uInt16 >( mnListRows );
1463  aReader.skipIntProperty< sal_uInt16 >(); // column info count
1464  aReader.readIntProperty< sal_uInt8 >( mnMatchEntry );
1465  aReader.skipIntProperty< sal_uInt8 >(); // list style
1467  aReader.skipUndefinedProperty();
1468  aReader.skipIntProperty< sal_uInt8 >(); // drop down style
1469  aReader.readIntProperty< sal_uInt8 >( mnMultiSelect );
1470  aReader.readStringProperty( maValue );
1471  aReader.readStringProperty( maCaption );
1472  aReader.readIntProperty< sal_uInt32 >( mnPicturePos );
1473  aReader.readIntProperty< sal_uInt32 >( mnBorderColor );
1474  aReader.readIntProperty< sal_uInt32 >( mnSpecialEffect );
1475  aReader.skipPictureProperty(); // mouse icon
1477  aReader.skipIntProperty< sal_uInt16 >(); // accelerator
1478  aReader.skipUndefinedProperty();
1479  aReader.skipBoolProperty();
1480  aReader.readStringProperty( maGroupName );
1481  return aReader.finalizeImport() && AxFontDataModel::importBinaryModel( rInStrm );
1482 }
1483 
1485 {
1486  AxBinaryPropertyWriter aWriter( rOutStrm, true );
1487  if ( mnFlags != AX_MORPHDATA_DEFFLAGS )
1488  aWriter.writeIntProperty< sal_uInt32 >( mnFlags );
1489  else
1490  aWriter.skipProperty(); //mnFlags
1491  if ( mnBackColor )
1492  aWriter.writeIntProperty< sal_uInt32 >( mnBackColor );
1493  else
1494  aWriter.skipProperty(); // default backcolour
1495  aWriter.writeIntProperty< sal_uInt32 >( mnTextColor );
1496 
1497  // only write if different from default
1499  aWriter.writeIntProperty< sal_Int32 >( mnMaxLength );
1500  else
1501  aWriter.skipProperty(); //mnMaxLength
1504  else
1505  aWriter.skipProperty(); //mnBorderStyle
1506 
1508  aWriter.writeIntProperty< sal_uInt8 >( mnScrollBars );
1509  else
1510  aWriter.skipProperty(); //mnScrollBars
1512  aWriter.skipProperty(); // mouse pointer
1513  aWriter.writePairProperty( maSize );
1515  aWriter.writeIntProperty< sal_uInt16 >( mnPasswordChar );
1516  else
1517  aWriter.skipProperty(); // mnPasswordChar
1518  aWriter.skipProperty(); // list width
1519  aWriter.skipProperty(); // bound column
1520  aWriter.skipProperty(); // text column
1521  aWriter.skipProperty(); // column count
1522  aWriter.skipProperty(); // mnListRows
1523  aWriter.skipProperty(); // column info count
1524  aWriter.skipProperty(); // mnMatchEntry
1525  aWriter.skipProperty(); // list style
1526  aWriter.skipProperty(); // mnShowDropButton );
1527  aWriter.skipProperty();
1528  aWriter.skipProperty(); // drop down style
1531  // although CheckBox, ListBox, OptionButton, ToggleButton are also supported
1532  // they can only have the fileformat default
1533  else
1534  aWriter.skipProperty(); //mnMultiSelect
1535  aWriter.writeStringProperty( maValue );
1536 
1538  aWriter.writeStringProperty( maCaption );
1539  else
1540  aWriter.skipProperty(); // mnCaption
1541  aWriter.skipProperty(); // mnPicturePos );
1543  aWriter.writeIntProperty< sal_uInt32 >( mnBorderColor );
1544  else
1545  aWriter.skipProperty(); // mnBorderColor
1547  aWriter.writeIntProperty< sal_uInt32 >( mnSpecialEffect );
1548  else
1549  aWriter.skipProperty(); //mnSpecialEffect
1550  aWriter.skipProperty(); // mouse icon
1551  aWriter.skipProperty(); // maPictureData
1552  aWriter.skipProperty(); // accelerator
1553  aWriter.skipProperty(); // undefined
1554  aWriter.writeBoolProperty(true); // must be 1 for morph
1556  aWriter.writeStringProperty( maGroupName );
1557  else
1558  aWriter.skipProperty(); //maGroupName
1559  aWriter.finalizeExport();
1561 }
1562 
1564 {
1565  rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
1566  rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor );
1568  {
1569  // If unspecified, radio buttons autoGroup in the same document/sheet
1570  // NOTE: form controls should not autoGroup with ActiveX controls - see drawingfragment.cxx
1571  OUString sGroupName = !maGroupName.isEmpty() ? maGroupName : "autoGroup_";
1572  rPropMap.setProperty( PROP_GroupName, sGroupName );
1573  }
1574  AxFontDataModel::convertProperties( rPropMap, rConv );
1575 }
1576 
1578 {
1580  rPropSet.getProperty( maGroupName, PROP_GroupName );
1581  AxFontDataModel::convertFromProperties( rPropSet, rConv );
1582 }
1583 
1585 {
1587 }
1588 
1590 {
1591  OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_TOGGLE, "AxToggleButtonModel::getControlType - invalid control type" );
1592  return API_CONTROL_BUTTON;
1593 }
1594 
1596 {
1597  rPropSet.getProperty( maCaption, PROP_Label );
1598 
1599  bool bRes = false;
1600  if ( rPropSet.getProperty( bRes, PROP_MultiLine ) )
1601  setFlag( mnFlags, AX_FLAGS_WORDWRAP, bRes );
1602 
1603  ControlConverter::convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
1604  ControlConverter::convertToMSColor( rPropSet, PROP_TextColor, mnTextColor );
1605  // need to process the image if one exists
1608 }
1609 
1611 {
1612  rPropMap.setProperty( PROP_Label, maCaption );
1613  rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
1614  rPropMap.setProperty( PROP_Toggle, true );
1617  rConv.convertAxPicture( rPropMap, maPictureData, mnPicturePos );
1619  AxMorphDataModelBase::convertProperties( rPropMap, rConv );
1620 }
1621 
1623 {
1624  // should be able to replace this hardcoded foo with
1625  // proper export info from MS-OLEDS spec.
1626  static sal_uInt8 const aCompObj[] = {
1627  0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
1628  0xFF, 0xFF, 0xFF, 0xFF, 0x60, 0x1D, 0xD2, 0x8B,
1629  0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
1630  0x00, 0x60, 0x02, 0xF3, 0x21, 0x00, 0x00, 0x00,
1631  0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
1632  0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
1633  0x32, 0x2E, 0x30, 0x20, 0x54, 0x6F, 0x67, 0x67,
1634  0x6C, 0x65, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E,
1635  0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D, 0x62,
1636  0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F, 0x62,
1637  0x6A, 0x65, 0x63, 0x74, 0x00, 0x15, 0x00, 0x00,
1638  0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E, 0x54,
1639  0x6F, 0x67, 0x67, 0x6C, 0x65, 0x42, 0x75, 0x74,
1640  0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00, 0xF4, 0x39,
1641  0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1642  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1643  };
1644  rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
1645 }
1646 
1648 {
1650 }
1651 
1653 {
1654  OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_CHECKBOX, "AxCheckBoxModel::getControlType - invalid control type" );
1655  return API_CONTROL_CHECKBOX;
1656 }
1657 
1659 {
1660  rPropMap.setProperty( PROP_Label, maCaption );
1661  rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
1665  rConv.convertAxPicture( rPropMap, maPictureData, mnPicturePos );
1667  AxMorphDataModelBase::convertProperties( rPropMap, rConv );
1668 }
1669 
1671 {
1672  rPropSet.getProperty( maCaption, PROP_Label );
1673 
1674  bool bRes = false;
1675  if ( rPropSet.getProperty( bRes, PROP_MultiLine ) )
1676  setFlag( mnFlags, AX_FLAGS_WORDWRAP, bRes );
1677 
1679  ControlConverter::convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
1680  ControlConverter::convertToMSColor( rPropSet, PROP_TextColor, mnTextColor );
1681  // need to process the image if one exists
1684 }
1685 
1687 {
1688  // should be able to replace this hardcoded foo with
1689  // proper export info from MS-OLEDS spec.
1690  static sal_uInt8 const aCompObj[] = {
1691  0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
1692  0xFF, 0xFF, 0xFF, 0xFF, 0x40, 0x1D, 0xD2, 0x8B,
1693  0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
1694  0x00, 0x60, 0x02, 0xF3, 0x1D, 0x00, 0x00, 0x00,
1695  0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
1696  0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
1697  0x32, 0x2E, 0x30, 0x20, 0x43, 0x68, 0x65, 0x63,
1698  0x6B, 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00,
1699  0x00, 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65,
1700  0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74,
1701  0x00, 0x11, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72,
1702  0x6D, 0x73, 0x2E, 0x43, 0x68, 0x65, 0x63, 0x6B,
1703  0x42, 0x6F, 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39,
1704  0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1705  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1706  };
1707  rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
1708 }
1709 
1711 {
1713 }
1714 
1716 {
1717  OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_OPTBUTTON, "AxOptionButtonModel::getControlType - invalid control type" );
1718  return API_CONTROL_RADIOBUTTON;
1719 }
1720 
1722 {
1723  rPropMap.setProperty( PROP_Label, maCaption );
1724  rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_WORDWRAP ) );
1728  rConv.convertAxPicture( rPropMap, maPictureData, mnPicturePos );
1730  AxMorphDataModelBase::convertProperties( rPropMap, rConv );
1731 }
1732 
1734 {
1735  rPropSet.getProperty( maCaption, PROP_Label );
1736 
1737  bool bRes = false;
1738  if ( rPropSet.getProperty( bRes, PROP_MultiLine ) )
1739  setFlag( mnFlags, AX_FLAGS_WORDWRAP, bRes );
1740 
1742  ControlConverter::convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
1743  ControlConverter::convertToMSColor( rPropSet, PROP_TextColor, mnTextColor );
1744  // need to process the image if one exists
1747 }
1748 
1750 {
1751  // should be able to replace this hardcoded foo with
1752  // proper export info from MS-OLEDS spec.
1753  static sal_uInt8 const aCompObj[] = {
1754  0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
1755  0xFF, 0xFF, 0xFF, 0xFF, 0x50, 0x1D, 0xD2, 0x8B,
1756  0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
1757  0x00, 0x60, 0x02, 0xF3, 0x21, 0x00, 0x00, 0x00,
1758  0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
1759  0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
1760  0x32, 0x2E, 0x30, 0x20, 0x4F, 0x70, 0x74, 0x69,
1761  0x6F, 0x6E, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E,
1762  0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D, 0x62,
1763  0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F, 0x62,
1764  0x6A, 0x65, 0x63, 0x74, 0x00, 0x15, 0x00, 0x00,
1765  0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E, 0x4F,
1766  0x70, 0x74, 0x69, 0x6F, 0x6E, 0x42, 0x75, 0x74,
1767  0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00, 0xF4, 0x39,
1768  0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1769  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1770  };
1771  rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
1772 }
1773 
1775 {
1777 }
1778 
1780 {
1781  OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_TEXT, "AxTextBoxModel::getControlType - invalid control type" );
1782  return API_CONTROL_EDIT;
1783 }
1784 
1786 {
1788  rPropMap.setProperty( PROP_MultiLine, true );
1789  else
1790  rPropMap.setProperty( PROP_MultiLine, false );
1791  rPropMap.setProperty( PROP_HideInactiveSelection, getFlag( mnFlags, AX_FLAGS_HIDESELECTION ) );
1792  rPropMap.setProperty( PROP_ReadOnly, getFlag( mnFlags, AX_FLAGS_LOCKED ) );
1793  rPropMap.setProperty( mbAwtModel ? PROP_Text : PROP_DefaultText, maValue );
1794  rPropMap.setProperty( PROP_MaxTextLen, getLimitedValue< sal_Int16, sal_Int32 >( mnMaxLength, 0, SAL_MAX_INT16 ) );
1795  if( (0 < mnPasswordChar) && (mnPasswordChar <= SAL_MAX_INT16) )
1796  rPropMap.setProperty( PROP_EchoChar, static_cast< sal_Int16 >( mnPasswordChar ) );
1797  rPropMap.setProperty( PROP_HScroll, getFlag( mnScrollBars, AX_SCROLLBAR_HORIZONTAL ) );
1798  rPropMap.setProperty( PROP_VScroll, getFlag( mnScrollBars, AX_SCROLLBAR_VERTICAL ) );
1801  AxMorphDataModelBase::convertProperties( rPropMap, rConv );
1802 }
1803 
1805 {
1806  bool bRes = false;
1807  if ( rPropSet.getProperty( bRes, PROP_MultiLine ) ) {
1808  setFlag( mnFlags, AX_FLAGS_WORDWRAP, bRes );
1810  }
1811  if ( rPropSet.getProperty( bRes, PROP_HideInactiveSelection ) )
1813  if ( rPropSet.getProperty( bRes, PROP_ReadOnly ) )
1814  setFlag( mnFlags, AX_FLAGS_LOCKED, bRes );
1815  rPropSet.getProperty( maValue, ( mbAwtModel ? PROP_Text : PROP_DefaultText ) );
1816  if (maValue.isEmpty() && !mbAwtModel)
1817  // No default value? Then try exporting the current one.
1818  rPropSet.getProperty( maValue, PROP_Text);
1819  sal_Int16 nTmp(0);
1820  if ( rPropSet.getProperty( nTmp, PROP_MaxTextLen ) )
1821  mnMaxLength = nTmp;
1822  if ( rPropSet.getProperty( nTmp, PROP_EchoChar ) )
1823  mnPasswordChar = nTmp;
1824  if ( rPropSet.getProperty( bRes, PROP_HScroll ) )
1826  if ( rPropSet.getProperty( bRes, PROP_VScroll ) )
1828 
1829  ControlConverter::convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor, 0x80000005L );
1830  ControlConverter::convertToMSColor( rPropSet, PROP_TextColor, mnTextColor );
1831 
1834 }
1835 
1837 {
1838  // should be able to replace this hardcoded foo with
1839  // proper export info from MS-OLEDS spec.
1840  static sal_uInt8 const aCompObj[] = {
1841  0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
1842  0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x1D, 0xD2, 0x8B,
1843  0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
1844  0x00, 0x60, 0x02, 0xF3, 0x1C, 0x00, 0x00, 0x00,
1845  0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
1846  0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
1847  0x32, 0x2E, 0x30, 0x20, 0x54, 0x65, 0x78, 0x74,
1848  0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00, 0x00,
1849  0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64,
1850  0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00,
1851  0x10, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D,
1852  0x73, 0x2E, 0x54, 0x65, 0x78, 0x74, 0x42, 0x6F,
1853  0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71,
1854  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1855  0x00, 0x00, 0x00, 0x00
1856  };
1857  rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
1858 }
1859 
1861 {
1863 }
1864 
1866 {
1867  OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_TEXT, "AxNumericFieldModel::getControlType - invalid control type" );
1868  return API_CONTROL_NUMERIC;
1869 }
1870 
1872 {
1873  rPropMap.setProperty( PROP_HideInactiveSelection, getFlag( mnFlags, AX_FLAGS_HIDESELECTION ) );
1874  // TODO: OUString::toDouble() does not handle local decimal separator
1875  rPropMap.setProperty( mbAwtModel ? PROP_Value : PROP_DefaultValue, maValue.toDouble() );
1876  rPropMap.setProperty( PROP_Spin, getFlag( mnScrollBars, AX_SCROLLBAR_VERTICAL ) );
1877  rPropMap.setProperty( PROP_Repeat, true );
1880  AxMorphDataModelBase::convertProperties( rPropMap, rConv );
1881 }
1882 
1884 {
1885  bool bRes = false;
1886  if ( rPropSet.getProperty( bRes, PROP_HideInactiveSelection ) )
1888  rPropSet.getProperty( maValue, ( mbAwtModel ? PROP_Text : PROP_DefaultText ) );
1889  if ( rPropSet.getProperty( bRes, PROP_Spin ) )
1891 
1892  ControlConverter::convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
1893  ControlConverter::convertToMSColor( rPropSet, PROP_TextColor, mnTextColor );
1894 
1897 }
1898 
1900 {
1901  // should be able to replace this hardcoded foo with
1902  // proper export info from MS-OLEDS spec.
1903  static sal_uInt8 const aCompObj[] = {
1904  0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
1905  0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x1D, 0xD2, 0x8B,
1906  0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
1907  0x00, 0x60, 0x02, 0xF3, 0x1C, 0x00, 0x00, 0x00,
1908  0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
1909  0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
1910  0x32, 0x2E, 0x30, 0x20, 0x54, 0x65, 0x78, 0x74,
1911  0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00, 0x00,
1912  0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64,
1913  0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00,
1914  0x10, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D,
1915  0x73, 0x2E, 0x54, 0x65, 0x78, 0x74, 0x42, 0x6F,
1916  0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71,
1917  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1918  0x00, 0x00, 0x00, 0x00
1919  };
1920  rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
1921 }
1922 
1924 {
1926 }
1927 
1929 {
1930  OSL_ENSURE( mnDisplayStyle == AX_DISPLAYSTYLE_LISTBOX, "AxListBoxModel::getControlType - invalid control type" );
1931  return API_CONTROL_LISTBOX;
1932 }
1933 
1935 {
1936  bool bMultiSelect = (mnMultiSelect == AX_SELECTION_MULTI) || (mnMultiSelect == AX_SELECTION_EXTENDED);
1937  rPropMap.setProperty( PROP_MultiSelection, bMultiSelect );
1938  rPropMap.setProperty( PROP_Dropdown, false );
1941  AxMorphDataModelBase::convertProperties( rPropMap, rConv );
1942 }
1943 
1945 {
1946  bool bRes = false;
1947  if ( rPropSet.getProperty( bRes, PROP_MultiSelection ) )
1948  ControlConverter::convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
1949 
1951  ControlConverter::convertToMSColor( rPropSet, PROP_TextColor, mnTextColor );
1953 }
1954 
1956 {
1957  // should be able to replace this hardcoded foo with
1958  // proper export info from MS-OLEDS spec.
1959  static sal_uInt8 const aCompObj[] = {
1960  0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
1961  0xFF, 0xFF, 0xFF, 0xFF, 0x20, 0x1D, 0xD2, 0x8B,
1962  0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
1963  0x00, 0x60, 0x02, 0xF3, 0x1C, 0x00, 0x00, 0x00,
1964  0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
1965  0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
1966  0x32, 0x2E, 0x30, 0x20, 0x4C, 0x69, 0x73, 0x74,
1967  0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00, 0x00,
1968  0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64,
1969  0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00,
1970  0x10, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D,
1971  0x73, 0x2E, 0x4C, 0x69, 0x73, 0x74, 0x42, 0x6F,
1972  0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71,
1973  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1974  0x00, 0x00, 0x00, 0x00
1975  };
1976  rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
1977 }
1978 
1980 {
1982  mnFlags = 0x2c80481b;
1983 }
1984 
1986 {
1987  OSL_ENSURE( (mnDisplayStyle == AX_DISPLAYSTYLE_COMBOBOX) || (mnDisplayStyle == AX_DISPLAYSTYLE_DROPDOWN), "AxComboBoxModel::getControlType - invalid control type" );
1989 }
1990 
1992 {
1994  {
1995  rPropMap.setProperty( PROP_HideInactiveSelection, getFlag( mnFlags, AX_FLAGS_HIDESELECTION ) );
1996  rPropMap.setProperty( mbAwtModel ? PROP_Text : PROP_DefaultText, maValue );
1997  rPropMap.setProperty( PROP_MaxTextLen, getLimitedValue< sal_Int16, sal_Int32 >( mnMaxLength, 0, SAL_MAX_INT16 ) );
1998  bool bAutoComplete = (mnMatchEntry == AX_MATCHENTRY_FIRSTLETTER) || (mnMatchEntry == AX_MATCHENTRY_COMPLETE);
1999  rPropMap.setProperty( PROP_Autocomplete, bAutoComplete );
2000  }
2002  rPropMap.setProperty( PROP_Dropdown, bShowDropdown );
2003  rPropMap.setProperty( PROP_LineCount, getLimitedValue< sal_Int16, sal_Int32 >( mnListRows, 1, SAL_MAX_INT16 ) );
2006  AxMorphDataModelBase::convertProperties( rPropMap, rConv );
2007 }
2008 
2010 {
2011  // when would we have mnDisplayStyle = AX_DISPLAYSTYLE_DROPDOWN ?
2012  // #TODO check against msocximex
2014  bool bRes = false;
2015 
2016  if ( rPropSet.getProperty( bRes, PROP_HideInactiveSelection ) )
2018  rPropSet.getProperty( maValue, ( mbAwtModel ? PROP_Text : PROP_DefaultText ) );
2019 
2020  sal_Int16 nTmp(0);
2021  if ( rPropSet.getProperty( nTmp, PROP_MaxTextLen ) )
2022  mnMaxLength = nTmp;
2023  if ( rPropSet.getProperty( bRes, PROP_Autocomplete ) )
2024  {
2025  // when to choose AX_MATCHENTRY_FIRSTLETTER ?
2026  // #TODO check against msocximex
2027  if ( bRes )
2028  mnMatchEntry = AX_MATCHENTRY_COMPLETE;
2029  }
2030  if ( rPropSet.getProperty( bRes, PROP_Dropdown ) )
2031  {
2032  rPropSet.getProperty( mnListRows, PROP_LineCount );
2033  if ( !mnListRows )
2034  mnListRows = 1;
2035  }
2036  ControlConverter::convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
2037  ControlConverter::convertToMSColor( rPropSet, PROP_TextColor, mnTextColor );
2038 
2041 }
2042 
2044 {
2045  // should be able to replace this hardcoded foo with
2046  // proper export info from MS-OLEDS spec.
2047  static sal_uInt8 const aCompObj[] = {
2048  0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
2049  0xFF, 0xFF, 0xFF, 0xFF, 0x30, 0x1D, 0xD2, 0x8B,
2050  0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
2051  0x00, 0x60, 0x02, 0xF3, 0x1D, 0x00, 0x00, 0x00,
2052  0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
2053  0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
2054  0x32, 0x2E, 0x30, 0x20, 0x43, 0x6F, 0x6D, 0x62,
2055  0x6F, 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00,
2056  0x00, 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65,
2057  0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74,
2058  0x00, 0x11, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72,
2059  0x6D, 0x73, 0x2E, 0x43, 0x6F, 0x6D, 0x62, 0x6F,
2060  0x42, 0x6F, 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39,
2061  0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2062  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2063  };
2064  rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
2065 }
2066 
2068  mnArrowColor( AX_SYSCOLOR_BUTTONTEXT ),
2069  mnBackColor( AX_SYSCOLOR_BUTTONFACE ),
2070  mnFlags( AX_SPINBUTTON_DEFFLAGS ),
2071  mnOrientation( AX_ORIENTATION_AUTO ),
2072  mnMin( 0 ),
2073  mnMax( 100 ),
2074  mnPosition( 0 ),
2075  mnSmallChange( 1 ),
2076  mnDelay( 50 )
2077 {
2078 }
2079 
2081 {
2082  return API_CONTROL_SPINBUTTON;
2083 }
2084 
2085 void AxSpinButtonModel::importProperty( sal_Int32 nPropId, const OUString& rValue )
2086 {
2087  switch( nPropId )
2088  {
2089  case XML_ForeColor: mnArrowColor = AttributeConversion::decodeUnsigned( rValue ); break;
2090  case XML_BackColor: mnBackColor = AttributeConversion::decodeUnsigned( rValue ); break;
2091  case XML_VariousPropertyBits: mnFlags = AttributeConversion::decodeUnsigned( rValue ); break;
2092  case XML_Orientation: mnOrientation = AttributeConversion::decodeInteger( rValue ); break;
2093  case XML_Min: mnMin = AttributeConversion::decodeInteger( rValue ); break;
2094  case XML_Max: mnMax = AttributeConversion::decodeInteger( rValue ); break;
2095  case XML_Position: mnPosition = AttributeConversion::decodeInteger( rValue ); break;
2096  case XML_SmallChange: mnSmallChange = AttributeConversion::decodeInteger( rValue ); break;
2097  case XML_Delay: mnDelay = AttributeConversion::decodeInteger( rValue ); break;
2098  default: AxControlModelBase::importProperty( nPropId, rValue );
2099  }
2100 }
2101 
2103 {
2104  AxBinaryPropertyReader aReader( rInStrm );
2105  aReader.readIntProperty< sal_uInt32 >( mnArrowColor );
2106  aReader.readIntProperty< sal_uInt32 >( mnBackColor );
2107  aReader.readIntProperty< sal_uInt32 >( mnFlags );
2108  aReader.readPairProperty( maSize );
2109  aReader.skipIntProperty< sal_uInt32 >(); // unused
2110  aReader.readIntProperty< sal_Int32 >( mnMin );
2111  aReader.readIntProperty< sal_Int32 >( mnMax );
2112  aReader.readIntProperty< sal_Int32 >( mnPosition );
2113  aReader.skipIntProperty< sal_uInt32 >(); // prev enabled
2114  aReader.skipIntProperty< sal_uInt32 >(); // next enabled
2115  aReader.readIntProperty< sal_Int32 >( mnSmallChange );
2116  aReader.readIntProperty< sal_Int32 >( mnOrientation );
2117  aReader.readIntProperty< sal_Int32 >( mnDelay );
2118  aReader.skipPictureProperty(); // mouse icon
2119  aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer
2120  return aReader.finalizeImport();
2121 }
2122 
2124 {
2125  AxBinaryPropertyWriter aWriter( rOutStrm );
2126  aWriter.writeIntProperty< sal_uInt32 >( mnArrowColor );
2127  if ( mnBackColor )
2128  aWriter.writeIntProperty< sal_uInt32 >( mnBackColor );
2129  else
2130  aWriter.skipProperty(); // default backcolour
2131  aWriter.writeIntProperty< sal_uInt32 >( mnFlags );
2132  aWriter.writePairProperty( maSize );
2133  aWriter.skipProperty(); // unused
2134  aWriter.writeIntProperty< sal_Int32 >( mnMin );
2135  aWriter.writeIntProperty< sal_Int32 >( mnMax );
2136  aWriter.writeIntProperty< sal_Int32 >( mnPosition );
2137  aWriter.skipProperty(); // prev enabled
2138  aWriter.skipProperty(); // next enabled
2139  aWriter.writeIntProperty< sal_Int32 >( mnSmallChange );
2140  aWriter.writeIntProperty< sal_Int32 >( mnOrientation );
2141  aWriter.writeIntProperty< sal_Int32 >( mnDelay );
2142  aWriter.skipProperty(); // mouse icon
2143  aWriter.skipProperty(); // mouse pointer
2144 
2145  aWriter.finalizeExport();
2146 }
2147 
2149 {
2150  sal_Int32 nMin = ::std::min( mnMin, mnMax );
2151  sal_Int32 nMax = ::std::max( mnMin, mnMax );
2152  rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
2153  rPropMap.setProperty( PROP_SpinValueMin, nMin );
2154  rPropMap.setProperty( PROP_SpinValueMax, nMax );
2155  rPropMap.setProperty( PROP_SpinIncrement, mnSmallChange );
2156  rPropMap.setProperty( mbAwtModel ? PROP_SpinValue : PROP_DefaultSpinValue, mnPosition );
2157  rPropMap.setProperty( PROP_Repeat, true );
2158  rPropMap.setProperty( PROP_RepeatDelay, mnDelay );
2159  rPropMap.setProperty( PROP_Border, API_BORDER_NONE );
2160  rConv.convertColor( rPropMap, PROP_SymbolColor, mnArrowColor );
2163  AxControlModelBase::convertProperties( rPropMap, rConv );
2164 }
2165 
2167 {
2168  bool bRes = false;
2169  if ( rPropSet.getProperty( bRes, PROP_Enabled ) )
2170  setFlag( mnFlags, AX_FLAGS_ENABLED, bRes );
2171  rPropSet.getProperty( mnMin, PROP_SpinValueMin );
2172  rPropSet.getProperty( mnMax, PROP_SpinValueMax );
2173  rPropSet.getProperty( mnSmallChange, PROP_SpinIncrement );
2174  rPropSet.getProperty( mnPosition, ( mbAwtModel ? PROP_SpinValue : PROP_DefaultSpinValue ) );
2175  rPropSet.getProperty( mnDelay, PROP_RepeatDelay );
2176  ControlConverter::convertToMSColor( rPropSet, PROP_SymbolColor, mnArrowColor);
2177  ControlConverter::convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
2178 
2180 }
2181 
2183 {
2184  // should be able to replace this hardcoded foo with
2185  // proper export info from MS-OLEDS spec.
2186  static sal_uInt8 const aCompObj[] =
2187  {
2188  0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
2189  0xFF, 0xFF, 0xFF, 0xFF, 0xB0, 0x6F, 0x17, 0x79,
2190  0xF2, 0xB7, 0xCE, 0x11, 0x97, 0xEF, 0x00, 0xAA,
2191  0x00, 0x6D, 0x27, 0x76, 0x1F, 0x00, 0x00, 0x00,
2192  0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
2193  0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
2194  0x32, 0x2E, 0x30, 0x20, 0x53, 0x70, 0x69, 0x6E,
2195  0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x00, 0x10,
2196  0x00, 0x00, 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64,
2197  0x64, 0x65, 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65,
2198  0x63, 0x74, 0x00, 0x13, 0x00, 0x00, 0x00, 0x46,
2199  0x6F, 0x72, 0x6D, 0x73, 0x2E, 0x53, 0x70, 0x69,
2200  0x6E, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x2E,
2201  0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00,
2202  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2203  0x00, 0x00
2204  };
2205 
2206  rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
2207 }
2208 
2210  mnArrowColor( AX_SYSCOLOR_BUTTONTEXT ),
2211  mnBackColor( AX_SYSCOLOR_BUTTONFACE ),
2212  mnFlags( AX_SCROLLBAR_DEFFLAGS ),
2213  mnOrientation( AX_ORIENTATION_AUTO ),
2214  mnPropThumb( AX_PROPTHUMB_ON ),
2215  mnMin( 0 ),
2216  mnMax( 32767 ),
2217  mnPosition( 0 ),
2218  mnSmallChange( 1 ),
2219  mnLargeChange( 1 ),
2220  mnDelay( 50 )
2221 {
2222 }
2223 
2225 {
2226  return API_CONTROL_SCROLLBAR;
2227 }
2228 
2229 void AxScrollBarModel::importProperty( sal_Int32 nPropId, const OUString& rValue )
2230 {
2231  switch( nPropId )
2232  {
2233  case XML_ForeColor: mnArrowColor = AttributeConversion::decodeUnsigned( rValue ); break;
2234  case XML_BackColor: mnBackColor = AttributeConversion::decodeUnsigned( rValue ); break;
2235  case XML_VariousPropertyBits: mnFlags = AttributeConversion::decodeUnsigned( rValue ); break;
2236  case XML_Orientation: mnOrientation = AttributeConversion::decodeInteger( rValue ); break;
2237  case XML_ProportionalThumb: mnPropThumb = AttributeConversion::decodeInteger( rValue ); break;
2238  case XML_Min: mnMin = AttributeConversion::decodeInteger( rValue ); break;
2239  case XML_Max: mnMax = AttributeConversion::decodeInteger( rValue ); break;
2240  case XML_Position: mnPosition = AttributeConversion::decodeInteger( rValue ); break;
2241  case XML_SmallChange: mnSmallChange = AttributeConversion::decodeInteger( rValue ); break;
2242  case XML_LargeChange: mnLargeChange = AttributeConversion::decodeInteger( rValue ); break;
2243  case XML_Delay: mnDelay = AttributeConversion::decodeInteger( rValue ); break;
2244  default: AxControlModelBase::importProperty( nPropId, rValue );
2245  }
2246 }
2247 
2249 {
2250  AxBinaryPropertyReader aReader( rInStrm );
2251  aReader.readIntProperty< sal_uInt32 >( mnArrowColor );
2252  aReader.readIntProperty< sal_uInt32 >( mnBackColor );
2253  aReader.readIntProperty< sal_uInt32 >( mnFlags );
2254  aReader.readPairProperty( maSize );
2255  aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer
2256  aReader.readIntProperty< sal_Int32 >( mnMin );
2257  aReader.readIntProperty< sal_Int32 >( mnMax );
2258  aReader.readIntProperty< sal_Int32 >( mnPosition );
2259  aReader.skipIntProperty< sal_uInt32 >(); // unused
2260  aReader.skipIntProperty< sal_uInt32 >(); // prev enabled
2261  aReader.skipIntProperty< sal_uInt32 >(); // next enabled
2262  aReader.readIntProperty< sal_Int32 >( mnSmallChange );
2263  aReader.readIntProperty< sal_Int32 >( mnLargeChange );
2264  aReader.readIntProperty< sal_Int32 >( mnOrientation );
2265  aReader.readIntProperty< sal_Int16 >( mnPropThumb );
2266  aReader.readIntProperty< sal_Int32 >( mnDelay );
2267  aReader.skipPictureProperty(); // mouse icon
2268  return aReader.finalizeImport();
2269 }
2270 
2272 {
2273  AxBinaryPropertyWriter aWriter( rOutStrm );
2274  aWriter.writeIntProperty< sal_uInt32 >( mnArrowColor );
2275  if ( mnBackColor )
2276  aWriter.writeIntProperty< sal_uInt32 >( mnBackColor );
2277  else
2278  aWriter.skipProperty(); // default backcolour
2279  aWriter.writeIntProperty< sal_uInt32 >( mnFlags );
2280  aWriter.writePairProperty( maSize );
2281  aWriter.skipProperty(); // mouse pointer
2282  aWriter.writeIntProperty< sal_Int32 >( mnMin );
2283  aWriter.writeIntProperty< sal_Int32 >( mnMax );
2284  aWriter.writeIntProperty< sal_Int32 >( mnPosition );
2285  aWriter.skipProperty(); // unused
2286  aWriter.skipProperty(); // prev enabled
2287  aWriter.skipProperty(); // next enabled
2288  aWriter.writeIntProperty< sal_Int32 >( mnSmallChange );
2289  aWriter.writeIntProperty< sal_Int32 >( mnLargeChange );
2290  aWriter.writeIntProperty< sal_Int32 >( mnOrientation );
2291  aWriter.writeIntProperty< sal_Int16 >( mnPropThumb );
2292  aWriter.writeIntProperty< sal_Int32 >( mnDelay );
2293  aWriter.skipProperty(); // mouse icon
2294  aWriter.finalizeExport();
2295 }
2296 
2298 {
2299  // should be able to replace this hardcoded foo with
2300  // proper export info from MS-OLEDS spec.
2301  static sal_uInt8 const aCompObj[] =
2302  {
2303  0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
2304  0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x81, 0xD1, 0xDF,
2305  0x2F, 0x5E, 0xCE, 0x11, 0xA4, 0x49, 0x00, 0xAA,
2306  0x00, 0x4A, 0x80, 0x3D, 0x1E, 0x00, 0x00, 0x00,
2307  0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
2308  0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
2309  0x32, 0x2E, 0x30, 0x20, 0x53, 0x63, 0x72, 0x6F,
2310  0x6C, 0x6C, 0x42, 0x61, 0x72, 0x00, 0x10, 0x00,
2311  0x00, 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64,
2312  0x65, 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63,
2313  0x74, 0x00, 0x12, 0x00, 0x00, 0x00, 0x46, 0x6F,
2314  0x72, 0x6D, 0x73, 0x2E, 0x53, 0x63, 0x72, 0x6F,
2315  0x6C, 0x6C, 0x42, 0x61, 0x72, 0x2E, 0x31, 0x00,
2316  0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
2317  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2318  };
2319  rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
2320 }
2321 
2323 {
2324  rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
2325  rPropMap.setProperty( PROP_RepeatDelay, mnDelay );
2326  rPropMap.setProperty( PROP_Border, API_BORDER_NONE );
2327  if( (mnPropThumb == AX_PROPTHUMB_ON) && (mnMin != mnMax) && (mnLargeChange > 0) )
2328  {
2329  // use double to prevent integer overflow in division (fInterval+mnLargeChange may become 0 when performed as int)
2330  double fInterval = fabs( static_cast< double >( mnMax - mnMin ) );
2331  sal_Int32 nThumbLen = getLimitedValue< sal_Int32, double >( (fInterval * mnLargeChange) / (fInterval + mnLargeChange), 1, SAL_MAX_INT32 );
2332  rPropMap.setProperty( PROP_VisibleSize, nThumbLen );
2333  }
2334  rConv.convertColor( rPropMap, PROP_SymbolColor, mnArrowColor );
2338  AxControlModelBase::convertProperties( rPropMap, rConv );
2339 }
2340 
2342 {
2343  bool bRes = false;
2344  if ( rPropSet.getProperty( bRes, PROP_Enabled ) )
2345  setFlag( mnFlags, AX_FLAGS_ENABLED, bRes );
2346  rPropSet.getProperty( mnDelay, PROP_RepeatDelay );
2347  mnPropThumb = AX_PROPTHUMB_ON; // default
2348  ControlConverter::convertToMSColor( rPropSet, PROP_SymbolColor, mnArrowColor);
2349  ControlConverter::convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
2351 
2352  rPropSet.getProperty( mnMin, PROP_ScrollValueMin );
2353  rPropSet.getProperty( mnMax, PROP_ScrollValueMax );
2354  rPropSet.getProperty( mnSmallChange, PROP_LineIncrement );
2355  rPropSet.getProperty( mnLargeChange, PROP_BlockIncrement );
2356  rPropSet.getProperty( mnPosition, ( mbAwtModel ? PROP_ScrollValue : PROP_DefaultScrollValue ) );
2357 
2358 }
2359 
2361  AxFontDataModel( false ), // no support for alignment properties
2362  maLogicalSize( AX_CONTAINER_DEFWIDTH, AX_CONTAINER_DEFHEIGHT ),
2363  maScrollPos( 0, 0 ),
2364  mnBackColor( AX_SYSCOLOR_BUTTONFACE ),
2365  mnTextColor( AX_SYSCOLOR_BUTTONTEXT ),
2366  mnFlags( AX_CONTAINER_DEFFLAGS ),
2367  mnBorderColor( AX_SYSCOLOR_BUTTONTEXT ),
2368  mnBorderStyle( AX_BORDERSTYLE_NONE ),
2369  mnScrollBars( AX_CONTAINER_SCR_NONE ),
2370  mnCycleType( AX_CONTAINER_CYCLEALL ),
2371  mnSpecialEffect( AX_SPECIALEFFECT_FLAT ),
2372  mnPicAlign( AX_PICALIGN_CENTER ),
2373  mnPicSizeMode( AX_PICSIZE_CLIP ),
2374  mbPicTiling( false ),
2375  mbFontSupport( bFontSupport )
2376 {
2377  setAwtModelMode();
2378  // different default size for frame
2379  maSize = AxPairData( AX_CONTAINER_DEFWIDTH, AX_CONTAINER_DEFHEIGHT );
2380 }
2381 
2382 void AxContainerModelBase::importProperty( sal_Int32 nPropId, const OUString& rValue )
2383 {
2384  if( nPropId == XML_Caption )
2385  maCaption = rValue;
2386 }
2387 
2389 {
2390  AxBinaryPropertyReader aReader( rInStrm );
2391  aReader.skipUndefinedProperty();
2392  aReader.readIntProperty< sal_uInt32 >( mnBackColor );
2393  aReader.readIntProperty< sal_uInt32 >( mnTextColor );
2394  aReader.skipIntProperty< sal_uInt32 >(); // next available control ID
2395  aReader.skipUndefinedProperty();
2396  aReader.skipUndefinedProperty();
2397  aReader.readIntProperty< sal_uInt32 >( mnFlags );
2398  aReader.readIntProperty< sal_uInt8 >( mnBorderStyle );
2399  aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer
2400  aReader.readIntProperty< sal_uInt8 >( mnScrollBars );
2401  aReader.readPairProperty( maSize );
2402  aReader.readPairProperty( maLogicalSize );
2403  aReader.readPairProperty( maScrollPos );
2404  aReader.skipIntProperty< sal_uInt32 >(); // number of control groups
2405  aReader.skipUndefinedProperty();
2406  aReader.skipPictureProperty(); // mouse icon
2407  aReader.readIntProperty< sal_uInt8 >( mnCycleType );
2409  aReader.readIntProperty< sal_uInt32 >( mnBorderColor );
2410  aReader.readStringProperty( maCaption );
2411  aReader.readFontProperty( maFontData );
2413  aReader.skipIntProperty< sal_Int32 >(); // zoom
2414  aReader.readIntProperty< sal_uInt8 >( mnPicAlign );
2415  aReader.readBoolProperty( mbPicTiling );
2416  aReader.readIntProperty< sal_uInt8 >( mnPicSizeMode );
2417  aReader.skipIntProperty< sal_uInt32 >(); // shape cookie
2418  aReader.skipIntProperty< sal_uInt32 >(); // draw buffer size
2419  return aReader.finalizeImport();
2420 }
2421 
2423 {
2424  if( mbFontSupport )
2425  {
2426  rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor );
2427  AxFontDataModel::convertProperties( rPropMap, rConv );
2428  }
2429 }
2430 
2432 {
2433  bool bValid = true;
2434  orClassTable.clear();
2435  if( !getFlag( mnFlags, AX_CONTAINER_NOCLASSTABLE ) )
2436  {
2437  sal_uInt16 nCount = rInStrm.readuInt16();
2438  for( sal_uInt16 nIndex = 0; bValid && (nIndex < nCount); ++nIndex )
2439  {
2440  orClassTable.emplace_back( );
2441  AxBinaryPropertyReader aReader( rInStrm );
2442  aReader.readGuidProperty( orClassTable.back() );
2443  aReader.skipGuidProperty(); // source interface GUID
2444  aReader.skipUndefinedProperty();
2445  aReader.skipGuidProperty(); // default interface GUID
2446  aReader.skipIntProperty< sal_uInt32 >(); // class table and var flags
2447  aReader.skipIntProperty< sal_uInt32 >(); // method count
2448  aReader.skipIntProperty< sal_Int32 >(); // IDispatch identifier for linked cell access
2449  aReader.skipIntProperty< sal_uInt16 >(); // get function index for linked cell access
2450  aReader.skipIntProperty< sal_uInt16 >(); // put function index for linked cell access
2451  aReader.skipIntProperty< sal_uInt16 >(); // linked cell access property type
2452  aReader.skipIntProperty< sal_uInt16 >(); // get function index of value
2453  aReader.skipIntProperty< sal_uInt16 >(); // put function index of value
2454  aReader.skipIntProperty< sal_uInt16 >(); // value type
2455  aReader.skipIntProperty< sal_Int32 >(); // IDispatch identifier for source range access
2456  aReader.skipIntProperty< sal_uInt16 >(); // get function index for source range access
2457  bValid = aReader.finalizeImport();
2458  }
2459  }
2460  return bValid;
2461 }
2462 
2464  AxContainerModelBase( true )
2465 {
2466 }
2467 
2469 {
2471 }
2472 
2473 void AxFrameModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
2474 {
2475  rPropMap.setProperty( PROP_Label, maCaption );
2476  rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_CONTAINER_ENABLED ) );
2477  AxContainerModelBase::convertProperties( rPropMap, rConv );
2478 }
2479 
2481 {
2482 }
2483 
2485 {
2486  return API_CONTROL_PAGE;
2487 }
2488 
2489 void AxPageModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
2490 {
2491  rPropMap.setProperty( PROP_Title, maCaption );
2492  rConv.convertColor( rPropMap, PROP_BackgroundColor, mnBackColor );
2493  rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_CONTAINER_ENABLED ) );
2494  AxContainerModelBase::convertProperties( rPropMap, rConv );
2495 }
2496 
2498  mnActiveTab( 0 ),
2499  mnTabStyle( AX_TABSTRIP_TABS )
2500 {
2501 }
2502 
2504 {
2505  return API_CONTROL_MULTIPAGE;
2506 }
2507 
2509 {
2510  // PageProperties
2511  for ( sal_Int32 nPage = 0; nPage < nPages; ++nPage )
2512  {
2513  AxBinaryPropertyReader aReader( rInStrm );
2514  aReader.skipUndefinedProperty();
2515  aReader.skipIntProperty< sal_uInt32 >(); // TransitionEffect
2516  aReader.skipIntProperty< sal_uInt32 >(); // TransitionPeriod
2517  }
2518  // MultiPageProperties
2519  AxBinaryPropertyReader aReader( rInStrm );
2520  sal_uInt32 nPageCount = 0;
2521  aReader.skipUndefinedProperty();
2522  aReader.readIntProperty< sal_uInt32 >(nPageCount); // PageCount
2523  aReader.skipIntProperty< sal_uInt32 >(); //ID
2524 
2525  // IDs
2526  for ( sal_uInt32 count = 0; count < nPageCount; ++count )
2527  {
2528  mnIDs.push_back( rInStrm.readInt32() );
2529  }
2530 }
2531 
2533 {
2534  rPropMap.setProperty( PROP_Title, maCaption );
2535  rPropMap.setProperty( PROP_MultiPageValue, mnActiveTab + 1);
2536  rConv.convertColor( rPropMap, PROP_BackgroundColor, mnBackColor );
2537  rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_CONTAINER_ENABLED ) );
2538  rPropMap.setProperty( PROP_Decoration, mnTabStyle != AX_TABSTRIP_NONE );
2539 
2540  AxContainerModelBase::convertProperties( rPropMap, rConv );
2541 }
2542 
2544 {
2545 }
2546 
2548 {
2549  return API_CONTROL_DIALOG;
2550 }
2551 
2553 {
2554  rPropMap.setProperty( PROP_Title, maCaption );
2555  rConv.convertColor( rPropMap, PROP_BackgroundColor, mnBackColor );
2556  rConv.convertAxPicture( rPropMap, maPictureData, AX_PICPOS_CENTER );
2558  AxContainerModelBase::convertProperties( rPropMap, rConv );
2559 }
2560 
2562 {
2563 }
2564 
2565 bool
2567 {
2568  if (rInStrm.size()<=0)
2569  return true;
2570 
2571  OUString sStringContents = rInStrm.readUnicodeArray( rInStrm.size() );
2572 
2573  // replace crlf with lf
2574  OUString data = sStringContents.replaceAll( "\x0D\x0A" , "\x0A" );
2575 
2576  std::vector< OUString > listValues;
2577  std::vector< sal_Int16 > selectedIndices;
2578 
2579  // Ultra hacky parser for the info
2580  sal_Int32 nLineIdx {0};
2581  // first line will tell us if multiselect is enabled
2582  if (o3tl::getToken(data, 0, '\n', nLineIdx ) == u"<SELECT MULTIPLE")
2584  // skip first and last lines, no data there
2585  if (nLineIdx>0)
2586  {
2587  for (;;)
2588  {
2589  std::u16string_view sLine( o3tl::getToken(data, 0, '\n', nLineIdx ) );
2590  if (nLineIdx<0)
2591  break; // skip last line
2592 
2593  if ( !sLine.empty() )
2594  {
2595  OUString displayValue( o3tl::getToken(sLine, 1, '>' ) );
2596  if ( displayValue.getLength() )
2597  {
2598  // Really we should be using a proper html parser
2599  // escaping some common bits to be escaped
2600  displayValue = displayValue.replaceAll( "&lt;", "<" );
2601  displayValue = displayValue.replaceAll( "&gt;", ">" );
2602  displayValue = displayValue.replaceAll( "&quot;", "\"" );
2603  displayValue = displayValue.replaceAll( "&amp;", "&" );
2604  listValues.push_back( displayValue );
2605  if( sLine.find( u"OPTION SELECTED" ) != std::u16string_view::npos )
2606  selectedIndices.push_back( static_cast< sal_Int16 >( listValues.size() ) - 1 );
2607  }
2608  }
2609  }
2610  }
2611  if ( !listValues.empty() )
2612  {
2613  msListData.realloc( listValues.size() );
2614  auto psListData = msListData.getArray();
2615  sal_Int32 index = 0;
2616  for (auto const& listValue : listValues)
2617  psListData[ index++ ] = listValue;
2618  }
2619  if ( !selectedIndices.empty() )
2620  {
2621  msIndices.realloc( selectedIndices.size() );
2622  auto psIndices = msIndices.getArray();
2623  sal_Int32 index = 0;
2624  for (auto const& selectedIndice : selectedIndices)
2625  psIndices[ index++ ] = selectedIndice;
2626  }
2627  return true;
2628 }
2629 
2630 void
2632 {
2633  rPropMap.setProperty( PROP_StringItemList, msListData );
2634  rPropMap.setProperty( PROP_SelectedItems, msIndices );
2635  rPropMap.setProperty( PROP_Dropdown, true );
2636  AxListBoxModel::convertProperties( rPropMap, rConv );
2637 }
2638 
2640 {
2641 }
2642 
2643 bool
2645 {
2646 #ifdef DEBUG
2647  OUString sStringContents = rInStrm.readUnicodeArray( rInStrm.size() );
2648  // in msocximex ( where this is ported from, it appears *nothing* is read
2649  // from the control stream ), surely there is some useful info there ?
2650  SAL_WARN("oox", "HtmlTextBoxModel::importBinaryModel - string contents of stream: " << sStringContents );
2651 #else
2652  (void) rInStrm;
2653 #endif
2654  return true;
2655 }
2656 
2657 EmbeddedControl::EmbeddedControl( const OUString& rName ) :
2658  maName( rName )
2659 {
2660 }
2661 
2663 {
2664  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_COMMANDBUTTON ) ) return &createModel< AxCommandButtonModel >();
2665  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_LABEL ) ) return &createModel< AxLabelModel >();
2666  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_IMAGE ) ) return &createModel< AxImageModel >();
2667  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_TOGGLEBUTTON ) ) return &createModel< AxToggleButtonModel >();
2668  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_CHECKBOX ) ) return &createModel< AxCheckBoxModel >();
2669  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_OPTIONBUTTON ) ) return &createModel< AxOptionButtonModel >();
2670  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_TEXTBOX ) ) return &createModel< AxTextBoxModel >();
2671  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_LISTBOX ) ) return &createModel< AxListBoxModel >();
2672  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_COMBOBOX ) ) return &createModel< AxComboBoxModel >();
2673  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_SPINBUTTON ) ) return &createModel< AxSpinButtonModel >();
2674  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_SCROLLBAR ) ) return &createModel< AxScrollBarModel >();
2675  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" AX_GUID_FRAME ) ) return &createModel< AxFrameModel >();
2676  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" COMCTL_GUID_SCROLLBAR_60 ) ) return &createModel< ComCtlScrollBarModel >( COMCTL_VERSION_60 );
2677  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" HTML_GUID_SELECT ) ) return &createModel< HtmlSelectModel >();
2678  if( o3tl::equalsIgnoreAsciiCase(rClassId, u"" HTML_GUID_TEXTBOX ) ) return &createModel< HtmlTextBoxModel >();
2679 
2680  mxModel.reset();
2681  return nullptr;
2682 }
2683 
2685 {
2686  return mxModel ? mxModel->getServiceName() : OUString();
2687 }
2688 
2689 bool EmbeddedControl::convertProperties( const Reference< XControlModel >& rxCtrlModel, const ControlConverter& rConv ) const
2690 {
2691  if( mxModel && rxCtrlModel.is() && !maName.isEmpty() )
2692  {
2693  PropertyMap aPropMap;
2694  aPropMap.setProperty( PROP_Name, maName );
2695  try
2696  {
2697  aPropMap.setProperty( PROP_GenerateVbaEvents, true);
2698  }
2699  catch (const Exception&)
2700  {
2701  TOOLS_WARN_EXCEPTION("oox", "");
2702  }
2703  mxModel->convertProperties( aPropMap, rConv );
2704  PropertySet aPropSet( rxCtrlModel );
2705  aPropSet.setProperties( aPropMap );
2706  return true;
2707  }
2708  return false;
2709 }
2710 
2711 void EmbeddedControl::convertFromProperties( const Reference< XControlModel >& rxCtrlModel, const ControlConverter& rConv )
2712 {
2713  if( mxModel && rxCtrlModel.is() && !maName.isEmpty() )
2714  {
2715  PropertySet aPropSet( rxCtrlModel );
2716  aPropSet.getProperty( maName, PROP_Name );
2717  mxModel->convertFromProperties( aPropSet, rConv );
2718  }
2719 }
2720 
2721 EmbeddedForm::EmbeddedForm( const Reference< XModel >& rxDocModel,
2722  const Reference< XDrawPage >& rxDrawPage, const GraphicHelper& rGraphicHelper ) :
2723  maControlConv( rxDocModel, rGraphicHelper, true/*bDefaultColorBgr*/ ),
2724  mxModelFactory( rxDocModel, UNO_QUERY ),
2725  mxFormsSupp( rxDrawPage, UNO_QUERY )
2726 {
2727  OSL_ENSURE( mxModelFactory.is(), "EmbeddedForm::EmbeddedForm - missing service factory" );
2728 }
2729 
2730 Reference< XControlModel > EmbeddedForm::convertAndInsert( const EmbeddedControl& rControl, sal_Int32& rnCtrlIndex )
2731 {
2732  Reference< XControlModel > xRet;
2733  if( mxModelFactory.is() && rControl.hasModel() ) try
2734  {
2735  // create the UNO control model
2736  OUString aServiceName = rControl.getServiceName();
2737  Reference< XFormComponent > xFormComp( mxModelFactory->createInstance( aServiceName ), UNO_QUERY_THROW );
2738  Reference< XControlModel > xCtrlModel( xFormComp, UNO_QUERY_THROW );
2739 
2740  // convert the control properties
2741  if( rControl.convertProperties( xCtrlModel, maControlConv ) )
2742  xRet = xCtrlModel;
2743  // insert the control into the form
2744  Reference< XIndexContainer > xFormIC( createXForm(), UNO_SET_THROW );
2745  rnCtrlIndex = xFormIC->getCount();
2746  xFormIC->insertByIndex( rnCtrlIndex, Any( xFormComp ) );
2747  }
2748  catch (const Exception&)
2749  {
2750  TOOLS_WARN_EXCEPTION("oox", "exception creating Control");
2751  }
2752  return xRet;
2753 }
2754 
2755 Reference< XIndexContainer > const & EmbeddedForm::createXForm()
2756 {
2757  if( mxFormsSupp.is() )
2758  {
2759  try
2760  {
2761  Reference< XNameContainer > xFormsNC( mxFormsSupp->getForms(), UNO_SET_THROW );
2762  OUString aFormName = "Standard";
2763  if( xFormsNC->hasByName( aFormName ) )
2764  {
2765  mxFormIC.set( xFormsNC->getByName( aFormName ), UNO_QUERY_THROW );
2766  }
2767  else if( mxModelFactory.is() )
2768  {
2769  Reference< XForm > xForm( mxModelFactory->createInstance( "com.sun.star.form.component.Form" ), UNO_QUERY_THROW );
2770  xFormsNC->insertByName( aFormName, Any( xForm ) );
2771  mxFormIC.set( xForm, UNO_QUERY_THROW );
2772  }
2773  }
2774  catch (const Exception&)
2775  {
2776  TOOLS_WARN_EXCEPTION("oox", "exception creating Form");
2777  }
2778  // always clear the forms supplier to not try to create the form again
2779  mxFormsSupp.clear();
2780  }
2781  return mxFormIC;
2782 }
2783 
2784 } // namespace oox
2785 
2786 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void convertFromProperties(PropertySet &rPropSet, const ControlConverter &rConv) override
Derived classes convert from uno control properties to equiv.
Definition: axcontrol.cxx:1804
bool mbSupportsAlign
True = UNO model supports Align property.
Definition: axcontrol.hxx:500
Export helper to write simple and complex ActiveX form control properties to a binary input stream...
sal_Int32 mnSmallChange
Increment step size (buttons).
Definition: axcontrol.hxx:788
OUString maCaption
Visible caption of the button.
Definition: axcontrol.hxx:548
sal_Int32 mnFontHeight
Height of the font (not really twips, see code).
Definition: axfontdata.hxx:57
sal_uInt32 mnFlags
Various flags.
Definition: axcontrol.hxx:625
Provides helper functions for colors, device measurement conversion, graphics, and graphic objects ha...
void convertPicture(PropertyMap &rPropMap, const StreamDataSequence &rPicData) const
Converts the passed StdPic picture stream to UNO properties.
Definition: axcontrol.cxx:268
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:2503
void readPairProperty(AxPairData &orPairData)
Reads the next pair property from the stream, if the respective flag in the property mask is set...
void readFontProperty(AxFontData &orFontData)
Reads the next font property from the stream, if the respective flag in the property mask is set...
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Converts font settings if supported.
Definition: axcontrol.cxx:2422
ComCtlProgressBarModel(sal_uInt16 nVersion)
Definition: axcontrol.cxx:790
virtual void convertFromProperties(PropertySet &rPropSet, const ControlConverter &rConv) override
Derived classes convert from uno control properties to equiv.
Definition: axcontrol.cxx:1733
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:1779
void setAwtModelMode()
Sets this control model to AWT model mode.
Definition: axcontrol.hxx:353
ControlModelBase * createModelFromGuid(std::u16string_view rClassId)
Creates and returns the internal control model according to the passed MS class identifier.
Definition: axcontrol.cxx:2662
virtual void importProperty(sal_Int32 nPropId, const OUString &rValue) override
Derived classes set specific OOXML properties at the model structure.
Definition: axcontrol.cxx:1236
sal_Int32 mnVerticalAlign
Vertical alignment (legacy VML drawing controls only).
Definition: axcontrol.hxx:638
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:1928
sal_Int32 nIndex
sal_Int32 mnShowDropButton
When to show the dropdown button.
Definition: axcontrol.hxx:634
#define AX_PICPOS_IMPL(label, image)
Definition: axcontrol.cxx:120
virtual void importProperty(sal_Int32 nPropId, const OUString &rValue) override
Derived classes set specific OOXML properties at the model structure.
Definition: axcontrol.cxx:1105
void writeIntProperty(DataType ornValue)
Write an integer property value to the stream, the respective flag in the property mask is set...
sal_uInt32 mnArrowColor
Button arrow color.
Definition: axcontrol.hxx:780
StreamDataSequence maPictureData
Binary picture stream.
Definition: axcontrol.hxx:575
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:1589
A helper that maps property identifiers to property values.
Definition: propertymap.hxx:51
virtual void exportBinaryModel(BinaryOutputStream &rOutStrm) override
Derived classes export a form control model to the passed output stream.
Definition: axcontrol.cxx:1014
sal_Int32 mnDisplayStyle
Type of the morph control.
Definition: axcontrol.hxx:630
const sal_Int32 AX_DISPLAYSTYLE_OPTBUTTON
Definition: axcontrol.hxx:133
const sal_Int32 AX_BORDERSTYLE_SINGLE
Definition: axcontrol.hxx:111
static void convertAxVisualEffect(PropertyMap &rPropMap, sal_Int32 nSpecialEffect)
Converts the Forms 2.0 special effect to UNO properties.
Definition: axcontrol.cxx:442
ControlConverter maControlConv
Definition: axcontrol.hxx:982
void convertPosition(PropertyMap &rPropMap, const AxPairData &rPos) const
Converts the passed position in 1/100 mm to UNO properties.
Definition: axcontrol.cxx:239
sal_uInt32 mnFlags
Various flags.
Definition: axcontrol.hxx:821
const sal_uInt32 AX_FLAGS_OPAQUE
Definition: axcontrol.hxx:90
virtual void exportCompObj(BinaryOutputStream &rOutStrm) override
Derived classes export CompObjStream contents.
Definition: axcontrol.cxx:1899
const sal_Int32 AX_SPECIALEFFECT_SUNKEN
Definition: axcontrol.hxx:115
bool getProperty(Type &orValue, sal_Int32 nPropId) const
Gets the specified property from the property set.
Definition: propertyset.hxx:94
bool mbCommonPart
True = the COMCTL_COMMONDATA part exists.
Definition: axcontrol.hxx:426
OOX_DLLPUBLIC bool importStdPic(StreamDataSequence &orGraphicData, BinaryInputStream &rInStrm)
Imports an OLE StdPic picture from the current position of the passed binary stream.
Definition: olehelper.cxx:302
virtual void convertFromProperties(PropertySet &rPropSet, const ControlConverter &rConv) override
Derived classes convert from uno control properties to equiv.
Definition: axcontrol.cxx:1577
sal_Int32 mnPasswordChar
Password character in edit fields.
Definition: axcontrol.hxx:636
const sal_Int32 AX_PICSIZE_STRETCH
Definition: axcontrol.hxx:120
ApiDefaultStateMode
Specifies how a form control supports the DefaultState property.
Definition: axcontrol.hxx:182
#define AX_GUID_FRAME
Definition: axcontrol.hxx:75
#define AX_GUID_COMBOBOX
Definition: axcontrol.hxx:72
StreamDataSequence maPictureData
Binary picture stream.
Definition: axcontrol.hxx:815
std::vector< sal_uInt32 > mnIDs
Definition: axcontrol.hxx:861
void readArrayStringProperty(std::vector< OUString > &rStrings)
Reads ArrayString, an array of fmString ( compressed or uncompressed ) is read from the stream and in...
void convertSize(PropertyMap &rPropMap, const AxPairData &rSize) const
Converts the passed size in 1/100 mm to UNO properties.
Definition: axcontrol.cxx:247
static void convertScrollBar(PropertyMap &rPropMap, sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition, sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel)
Converts common scrollbar settings to UNO properties.
Definition: axcontrol.cxx:317
#define AX_GUID_TOGGLEBUTTON
Definition: axcontrol.hxx:67
virtual void importProperty(sal_Int32 nPropId, const OUString &rValue) override
Derived classes set specific OOXML properties at the model structure.
Definition: axcontrol.cxx:854
AxFontData maFontData
The font settings.
Definition: axcontrol.hxx:497
Transparency is enabled by missing fill color.
#define AX_GUID_IMAGE
Definition: axcontrol.hxx:66
const StyleSettings & GetStyleSettings() const
sal_uInt32 mnTextColor
Text color.
Definition: axcontrol.hxx:523
bool mbComplexPart
True = the COMCTL_COMPLEXDATA part exists.
Definition: axcontrol.hxx:427
sal_Int32 mnSmallChange
Increment step size (buttons).
Definition: axcontrol.hxx:445
sal_uInt32 mnFlags
Various flags.
Definition: axcontrol.hxx:577
const sal_Int32 AX_SCROLLBAR_HORIZONTAL
Definition: axcontrol.hxx:146
static void convertToAxState(PropertySet const &rPropSet, OUString &rValue, sal_Int32 &nMultiSelect, ApiDefaultStateMode eDefStateMode)
Definition: axcontrol.cxx:527
bool importClassTable(BinaryInputStream &rInStrm, AxClassTable &orClassTable)
Reads the class table structure for embedded controls following the own model from the 'f' stream...
Definition: axcontrol.cxx:2431
virtual void convertFromProperties(PropertySet &rPropSet, const ControlConverter &rConv)
Derived classes convert from uno control properties to equiv.
Definition: axcontrol.cxx:645
virtual void exportBinaryModel(BinaryOutputStream &rOutStrm) override
Derived classes export a form control model to the passed output stream.
Definition: axcontrol.cxx:876
static void convertOrientation(PropertyMap &rPropMap, bool bHorizontal)
Converts the control orientation to UNO properties.
Definition: axcontrol.cxx:278
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:2547
virtual void convertFromProperties(PropertySet &rPropSet, const ControlConverter &rConv) override
Derived classes convert from uno control properties to equiv.
Definition: axcontrol.cxx:1595
void bindToSources(const css::uno::Reference< css::awt::XControlModel > &rxCtrlModel, const OUString &rCtrlSource, const OUString &rRowSource, sal_Int32 nRefSheet=0) const
Binds the passed control model to the passed data sources.
Definition: axcontrol.cxx:328
bool setProperty(sal_Int32 nPropId, Type &&rValue)
Sets the specified property to the passed value.
Definition: propertymap.hxx:72
const sal_uInt32 AX_FLAGS_ENABLED
Definition: axcontrol.hxx:88
virtual void exportBinaryModel(BinaryOutputStream &rOutStrm) override
Derived classes export a form control model to the passed output stream.
Definition: axcontrol.cxx:1139
OOX_DLLPUBLIC bool importStdFont(StdFontInfo &orFontInfo, BinaryInputStream &rInStrm, bool bWithGuid)
Imports an OLE StdFont font structure from the current position of the passed binary stream...
Definition: olehelper.cxx:279
const sal_Int32 AX_SHOWDROPBUTTON_ALWAYS
Definition: axcontrol.hxx:143
::std::pair< sal_Int32, sal_Int32 > AxPairData
A pair of integer values as a property.
#define AX_GUID_COMMANDBUTTON
Definition: axcontrol.hxx:64
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
sal_uInt32 mnDataPartId5
Identifier for version 5.0 control data.
Definition: axcontrol.hxx:424
sal_Int32 mnVerticalAlign
Vertical alignment (legacy VML drawing controls only).
Definition: axcontrol.hxx:555
bool importSizePart(BinaryInputStream &rInStrm)
Definition: axcontrol.cxx:719
bool mbAwtModel
True = AWT control model, false = form component.
Definition: axcontrol.hxx:385
const sal_Int32 AX_PICSIZE_CLIP
Definition: axcontrol.hxx:119
void setHeightPoints(sal_Int16 nPoints)
Converts the passed font height from points to the internal representation.
Definition: axfontdata.cxx:44
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:2484
void convertFromProperties(const css::uno::Reference< css::awt::XControlModel > &rxCtrlModel, const ControlConverter &rConv)
Definition: axcontrol.cxx:2711
sal_Int32 mnPicSizeMode
Clip, stretch, zoom.
Definition: axcontrol.hxx:828
virtual bool importBinaryModel(BinaryInputStream &rInStrm) override
Reads the leading structure in the 'f' stream containing the model for this control.
Definition: axcontrol.cxx:2388
bool mbFocusOnClick
True = take focus on click.
Definition: axcontrol.hxx:528
sal_Int32 mnVerticalAlign
Vertical alignment (legacy VML drawing controls only).
Definition: axcontrol.hxx:527
sal_Int32 mnOrientation
Orientation of the buttons.
Definition: axcontrol.hxx:783
virtual void exportCompObj(BinaryOutputStream &rOutStrm) override
Derived classes export CompObjStream contents.
Definition: axcontrol.cxx:1955
sal_uInt32 mnFlags
Common flags for ComCtl controls.
Definition: axcontrol.hxx:420
#define COMCTL_GUID_SCROLLBAR_60
Definition: axcontrol.hxx:56
sal_Int32 mnCycleType
Cycle in all forms or in this form.
Definition: axcontrol.hxx:825
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Converts font settings if supported.
Definition: axcontrol.cxx:2552
Interface for binary output stream classes.
sal_Int32 mnPosition
Value of the spin button.
Definition: axcontrol.hxx:787
const sal_Int32 AX_SCROLLBAR_NONE
Definition: axcontrol.hxx:145
bool mbDblUnderline
True = double underline style (legacy VML drawing controls only).
Definition: axfontdata.hxx:60
const sal_uInt32 AX_SYSCOLOR_BUTTONTEXT
Definition: axcontrol.hxx:86
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:1715
tools::Long GetFontHeight() const
css::awt::Point convertHmmToAppFont(const css::awt::Point &rHmm) const
Converts the passed point from 1/100 mm to AppFont units.
sal_Int32 mnPicAlign
Anchor position of the picture.
Definition: axcontrol.hxx:582
void writeBoolProperty(bool orbValue)
Write a boolean property value to the stream, the respective flag in the property mask is set...
static bool readPartHeader(BinaryInputStream &rInStrm, sal_uInt32 nExpPartId, sal_uInt16 nExpMajor=SAL_MAX_UINT16, sal_uInt16 nExpMinor=SAL_MAX_UINT16)
Definition: axcontrol.cxx:706
virtual sal_Int64 size() const =0
Implementations return the size of the stream, if possible.
bool mbFontSupport
True = control supports the font property.
Definition: axcontrol.hxx:830
const sal_uInt32 AX_SYSCOLOR_WINDOWBACK
Definition: axcontrol.hxx:82
static OutputDevice * GetDefaultDevice()
A form control embedded in a document draw page.
Definition: axcontrol.hxx:897
static void convertToAxOrientation(PropertySet const &rPropSet, sal_Int32 &nOrientation)
Definition: axcontrol.cxx:568
void setProperties(const css::uno::Sequence< OUString > &rPropNames, const css::uno::Sequence< css::uno::Any > &rValues)
Puts the passed properties into the property set.
#define SAL_MAX_UINT32
sal_uInt32 getDataPartId() const
Returns the data part identifier according to the model version.
Definition: axcontrol.cxx:695
virtual void convertFromProperties(PropertySet &rPropSet, const ControlConverter &rConv) override
Derived classes convert from uno control properties to equiv.
Definition: axcontrol.cxx:1164
#define AX_GUID_OPTIONBUTTON
Definition: axcontrol.hxx:69
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:1065
FuncFlags mnFlags
void finalizeExport()
Final processing, write contents of all complex properties, writes record size.
const sal_Int32 AX_PICALIGN_CENTER
Definition: axcontrol.hxx:125
const sal_Int32 AX_PICSIZE_ZOOM
Definition: axcontrol.hxx:121
bool mbPicTiling
True = picture is repeated.
Definition: axcontrol.hxx:583
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:1721
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Converts font settings if supported.
Definition: axcontrol.cxx:2473
ApiControlType
Enumerates all UNO API control types supported by these filters.
Definition: axcontrol.hxx:151
#define HTML_GUID_SELECT
Definition: axcontrol.hxx:79
sal_uInt16 mnSmooth
0 = progress blocks, 1 = pixel resolution.
Definition: axcontrol.hxx:467
::std::vector< OUString > AxClassTable
Definition: axcontrol.hxx:794
sal_Int32 mnPicSizeMode
Clip, stretch, zoom.
Definition: axcontrol.hxx:581
virtual void importPictureData(sal_Int32 nPropId, BinaryInputStream &rInStrm) override
Derived classes set binary data (picture, mouse icon) at the model structure.
Definition: axcontrol.cxx:1436
#define SAL_MAX_UINT16
ControlModelRef mxModel
Control model containing the properties.
Definition: axcontrol.hxx:934
sal_Int32 mnSpecialEffect
3D border effect.
Definition: axcontrol.hxx:580
OUString maCaption
Visible caption of the button.
Definition: axcontrol.hxx:522
AxHorizontalAlign mnHorAlign
Horizontal text alignment.
Definition: axfontdata.hxx:59
sal_Int32 mnSpecialEffect
3D border effect.
Definition: axcontrol.hxx:554
StreamDataSequence maPictureData
Binary picture stream.
Definition: axcontrol.hxx:521
virtual void exportCompObj(BinaryOutputStream &rOutStrm) override
Derived classes export CompObjStream contents.
Definition: axcontrol.cxx:2043
int nCount
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:1871
void skipBoolProperty()
Skips the next boolean property value in the stream, if the respective flag in the property mask is s...
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:1207
virtual bool importBinaryModel(BinaryInputStream &rInStrm) override
Derived classes import a form control model from the passed input stream.
Definition: axcontrol.cxx:1120
float mfMax
Maximum of the value range.
Definition: axcontrol.hxx:465
OUString maFontName
Name of the used font.
Definition: axfontdata.hxx:55
Base class for all models of ComCtl form controls.
Definition: axcontrol.hxx:392
const sal_Int32 AX_DISPLAYSTYLE_TEXT
Definition: axcontrol.hxx:129
Control does not support tri-state, state is given as boolean.
Definition: axcontrol.hxx:184
virtual bool importBinaryModel(BinaryInputStream &rInStrm) override
Derived classes import a form control model from the passed input stream.
Definition: axcontrol.cxx:871
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:2468
void convertSize(PropertyMap &rPropMap, const ControlConverter &rConv) const
Converts the control size to UNO properties.
Definition: axcontrol.cxx:649
sal_Int32 mnListRows
Number of rows in dropdown box.
Definition: axcontrol.hxx:637
sal_Int32 mnMin
Minimum of the value range.
Definition: axcontrol.hxx:756
StreamDataSequence maMouseIcon
Binary picture stream for mouse icon.
Definition: axcontrol.hxx:419
PropertySet maAddressConverter
Definition: axcontrol.hxx:339
const sal_Int32 AX_SHOWDROPBUTTON_FOCUS
Definition: axcontrol.hxx:142
void skipIntProperty()
Skips the next integer property value in the stream, if the respective flag in the property mask is s...
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:2631
bool getFlag(Type nBitField, Type nMask)
Returns true, if at least one of the bits set in nMask is set in nBitField.
Definition: helper.hxx:135
virtual void convertFromProperties(PropertySet &rPropSet, const ControlConverter &rConv) override
Derived classes convert from uno control properties to equiv.
Definition: axcontrol.cxx:2166
sal_Int32 mnLargeChange
Increment step size (thumb).
Definition: axcontrol.hxx:789
css::uno::Reference< css::form::XFormsSupplier > mxFormsSupp
Definition: axcontrol.hxx:984
OUString getServiceName() const
Returns the UNO service name used to construct the AWT control model, or the control form component...
Definition: axcontrol.cxx:590
#define AX_GUID_TEXTBOX
Definition: axcontrol.hxx:70
void convertColor(PropertyMap &rPropMap, sal_Int32 nPropId, sal_uInt32 nOleColor) const
Converts the passed encoded OLE color to UNO properties.
Definition: axcontrol.cxx:255
sal_Int32 mnOrientation
Orientation of the buttons.
Definition: axcontrol.hxx:755
virtual void exportCompObj(BinaryOutputStream &rOutStrm) override
Derived classes export CompObjStream contents.
Definition: axcontrol.cxx:1035
void readIntProperty(DataType &ornValue)
Reads the next integer property value from the stream, if the respective flag in the property mask is...
Interface for binary input stream classes.
void writePairProperty(AxPairData &orPairData)
Write a pair property the stream, the respective flag in the property mask is set.
sal_uInt32 mnDataPartId6
Identifier for version 6.0 control data.
Definition: axcontrol.hxx:425
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:2080
void setFlag(Type &ornBitField, Type nMask, bool bSet=true)
Sets or clears (according to bSet) all set bits of nMask in ornBitField.
Definition: helper.hxx:165
StreamDataSequence maPictureData
Binary picture stream.
Definition: axcontrol.hxx:619
virtual bool importBinaryModel(BinaryInputStream &rInStrm) override
Derived classes import a form control model from the passed input stream.
Definition: axcontrol.cxx:2566
sal_Int32 mnScrollBars
Horizontal/vertical scroll bar.
Definition: axcontrol.hxx:824
sal_Int32 mnPropThumb
Proportional thumb size.
Definition: axcontrol.hxx:784
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:1985
sal_Int32 mnSmallChange
Increment step size.
Definition: axcontrol.hxx:759
Import helper to read simple and complex ActiveX form control properties from a binary input stream...
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:767
AxFontFlags mnFontEffects
Font effect flags.
Definition: axfontdata.hxx:56
const GraphicHelper & mrGraphicHelper
Definition: axcontrol.hxx:338
css::uno::Sequence< sal_Int8 > StreamDataSequence
sal_uInt32 mnBackColor
Fill color.
Definition: axcontrol.hxx:624
#define TOOLS_WARN_EXCEPTION(area, stream)
StdFontInfo maFontData
Font formatting.
Definition: axcontrol.hxx:418
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:1334
A base class with useful helper functions for something that is able to convert ActiveX and ComCtl fo...
Definition: axcontrol.hxx:193
#define SAL_MAX_INT32
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:1212
virtual void importProperty(sal_Int32 nPropId, const OUString &rValue) override
Allows to set single properties specified by XML token identifier.
Definition: axcontrol.cxx:2382
static void convertToAxVisualEffect(PropertySet const &rPropSet, sal_Int32 &nSpecialEffect)
Definition: axcontrol.cxx:448
static sal_Int32 decodeInteger(std::u16string_view rValue)
Returns the 32-bit signed integer value from the passed string (decimal).
const sal_Int32 AX_SHOWDROPBUTTON_NEVER
Definition: axcontrol.hxx:141
sal_uInt32 mnTextColor
Text color.
Definition: axcontrol.hxx:820
virtual bool importBinaryModel(BinaryInputStream &rInStrm) override
Derived classes import a form control model from the passed input stream.
Definition: axcontrol.cxx:2102
virtual void convertFromProperties(PropertySet &rPropSet, const ControlConverter &rConv) override
Derived classes convert from uno control properties to equiv.
Definition: axcontrol.cxx:1944
virtual bool importBinaryModel(BinaryInputStream &rInStrm) override
Derived classes import a form control model from the passed input stream.
Definition: axcontrol.cxx:1445
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Converts font settings if supported.
Definition: axcontrol.cxx:2489
virtual void exportCompObj(BinaryOutputStream &rOutStrm) override
Derived classes export CompObjStream contents.
Definition: axcontrol.cxx:1836
AxFontDataModel(bool bSupportsAlign=true)
Definition: axcontrol.cxx:849
EmbeddedControl(const OUString &rName)
Definition: axcontrol.cxx:2657
virtual bool importBinaryModel(BinaryInputStream &rInStrm) override
Derived classes import a form control model from the passed input stream.
Definition: axcontrol.cxx:2248
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:1563
sal_Int16 getHeightPoints() const
Converts the internal representation of the font height to points.
Definition: axfontdata.cxx:36
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:799
virtual void exportCompObj(BinaryOutputStream &rOutStrm) override
Derived classes export CompObjStream contents.
Definition: axcontrol.cxx:1749
virtual bool importBinaryModel(BinaryInputStream &rInStrm) override
Derived classes import a form control model from the passed input stream.
Definition: axcontrol.cxx:666
const sal_Int32 AX_SCROLLBAR_VERTICAL
Definition: axcontrol.hxx:147
const sal_Int32 AX_BORDERSTYLE_NONE
Definition: axcontrol.hxx:110
sal_uInt32 mnVariousPropertyBits
Definition: axcontrol.hxx:599
sal_Int32 mnDelay
Repeat delay in milliseconds.
Definition: axcontrol.hxx:790
void skipProperty()
Skips the next property clears the respective flag in the property mask.
OUString maCaption
Visible caption of the button.
Definition: axcontrol.hxx:620
const sal_uInt32 AX_SYSCOLOR_BUTTONFACE
Definition: axcontrol.hxx:85
sal_Int32 mnFontCharSet
Windows character set of the font.
Definition: axfontdata.hxx:58
OUString maName
Name of the control.
Definition: axcontrol.hxx:935
virtual void importProperty(sal_Int32 nPropId, const OUString &rValue) override
Derived classes set specific OOXML properties at the model structure.
Definition: axcontrol.cxx:2229
static void convertToMSColor(PropertySet const &rPropSet, sal_Int32 nPropId, sal_uInt32 &nOleColor, sal_uInt32 nDefault=0)
Definition: axcontrol.cxx:260
AxContainerModelBase(bool bFontSupport=false)
Definition: axcontrol.cxx:2360
Base class for Forms 2.0 controls supporting text formatting.
Definition: axcontrol.hxx:482
bool hasModel() const
Returns true, if the internal control model exists.
Definition: axcontrol.hxx:915
sal_uInt32 mnPicturePos
Position of the picture relative to text.
Definition: axcontrol.hxx:626
sal_Int32 mnMin
Minimum of the value range.
Definition: axcontrol.hxx:785
const sal_uInt32 AX_FLAGS_HIDESELECTION
Definition: axcontrol.hxx:106
float u
void convertAxBackground(PropertyMap &rPropMap, sal_uInt32 nBackColor, sal_uInt32 nFlags, ApiTransparencyMode eTranspMode) const
Converts the Forms 2.0 background formatting to UNO properties.
Definition: axcontrol.cxx:393
#define HTML_GUID_TEXTBOX
Definition: axcontrol.hxx:80
css::uno::Reference< css::graphic::XGraphic > importGraphic(const css::uno::Reference< css::io::XInputStream > &rxInStrm, const WmfExternal *pExtHeader=nullptr) const
Imports a graphic from the passed input stream.
virtual bool importBinaryModel(BinaryInputStream &rInStrm) override
Derived classes import a form control model from the passed input stream.
Definition: axcontrol.cxx:1351
css::uno::Reference< css::lang::XMultiServiceFactory > mxModelFactory
Definition: axcontrol.hxx:983
const sal_Int32 AX_SPECIALEFFECT_FLAT
Definition: axcontrol.hxx:113
virtual void writeMemory(const void *pMem, sal_Int32 nBytes, size_t nAtomSize=1)=0
Derived classes implement writing the contents of the (preallocated!) memory buffer pMem...
sal_Int32 mnPosition
Value of the spin button.
Definition: axcontrol.hxx:758
#define AX_GUID_CHECKBOX
Definition: axcontrol.hxx:68
virtual sal_Int64 tell() const =0
Implementations return the current stream position, if possible.
const sal_uInt32 AX_FLAGS_MULTILINE
Definition: axcontrol.hxx:108
sal_Int32 mnScrollBars
Horizontal/vertical scroll bar.
Definition: axcontrol.hxx:632
virtual void convertFromProperties(PropertySet &rPropSet, const ControlConverter &rConv) override
Derived classes convert from uno control properties to equiv.
Definition: axcontrol.cxx:1078
const sal_uInt32 AX_SYSCOLOR_WINDOWFRAME
Definition: axcontrol.hxx:83
const AllSettings & GetSettings() const
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
tuple index
A wrapper for a UNO property set.
Definition: propertyset.hxx:57
AxPairData maSize
Size of the control in 1/100 mm.
Definition: axcontrol.hxx:382
sal_uInt32 mnPicturePos
Position of the picture relative to text.
Definition: axcontrol.hxx:526
const sal_Int32 AX_SELECTION_MULTI
Definition: axcontrol.hxx:138
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:1060
virtual void importPictureData(sal_Int32 nPropId, BinaryInputStream &rInStrm) override
Derived classes set binary data (picture, mouse icon) at the model structure.
Definition: axcontrol.cxx:988
void exportBinaryModel(BinaryOutputStream &rOutStrm)
Definition: axfontdata.cxx:68
const sal_uInt32 AX_FLAGS_LOCKED
Definition: axcontrol.hxx:89
virtual void exportBinaryModel(BinaryOutputStream &rOutStrm) override
Derived classes export a form control model to the passed output stream.
Definition: axcontrol.cxx:2123
OUString getServiceName() const
Returns the UNO service name needed to construct the control model.
Definition: axcontrol.cxx:2684
sal_Int32 mnMax
Maximum of the value range.
Definition: axcontrol.hxx:786
sal_uInt32 mnFlags
Various flags.
Definition: axcontrol.hxx:782
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:2148
const sal_Int32 AX_DISPLAYSTYLE_COMBOBOX
Definition: axcontrol.hxx:131
const sal_Int32 AX_SELECTION_SINGLE
Definition: axcontrol.hxx:137
void skipGuidProperty()
Skips the next GUID property in the stream, if the respective flag in the property mask is set...
AxPairData maLogicalSize
Logical form size (scroll area).
Definition: axcontrol.hxx:817
sal_Int32 mnMultiSelect
Selection mode.
Definition: axcontrol.hxx:631
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:880
const sal_uInt16 COMCTL_VERSION_50
Definition: axcontrol.hxx:60
const sal_uInt64 mnPosition
exports com.sun.star.chart2. data
sal_uInt32 mnFlags
Various flags.
Definition: axcontrol.hxx:525
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:1934
void readStringProperty(OUString &orValue)
Reads the next string property from the stream, if the respective flag in the property mask is set...
void readPictureProperty(StreamDataSequence &orPicData)
Reads the next picture property from the stream, if the respective flag in the property mask is set...
sal_uInt32 mnFlags
Various flags.
Definition: axcontrol.hxx:754
virtual void convertFromProperties(PropertySet &rPropSet, const ControlConverter &rConv) override
Derived classes convert from uno control properties to equiv.
Definition: axcontrol.cxx:2009
virtual void convertFromProperties(PropertySet &rPropSet, const ControlConverter &rConv) override
Derived classes convert from uno control properties to equiv.
Definition: axcontrol.cxx:2341
tools::Long const nBorder
#define AX_GUID_LISTBOX
Definition: axcontrol.hxx:71
sal_Int32 mnMatchEntry
Auto completion mode.
Definition: axcontrol.hxx:633
const sal_uInt16 COMCTL_VERSION_60
Definition: axcontrol.hxx:61
bool importBinaryModel(BinaryInputStream &rInStrm)
Reads the font data settings from the passed input stream.
Definition: axfontdata.cxx:49
const sal_Int32 AX_DISPLAYSTYLE_CHECKBOX
Definition: axcontrol.hxx:132
sal_Int32 mnBorderStyle
Flat border style.
Definition: axcontrol.hxx:579
virtual void importPictureData(sal_Int32 nPropId, BinaryInputStream &rInStrm)
Derived classes set binary data (picture, mouse icon) at the model structure.
Definition: axcontrol.cxx:637
Base class for all models of form controls.
Definition: axcontrol.hxx:346
sal_Int32 mnBorderStyle
Flat border style.
Definition: axcontrol.hxx:553
sal_Int32 mnSpecialEffect
3D border effect.
Definition: axcontrol.hxx:826
virtual void importPictureData(sal_Int32 nPropId, BinaryInputStream &rInStrm) override
Derived classes set binary data (picture, mouse icon) at the model structure.
Definition: axcontrol.cxx:1252
sal_Int32 mnMax
Maximum of the value range.
Definition: axcontrol.hxx:447
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:1658
const sal_Int32 AX_SPECIALEFFECT_RAISED
Definition: axcontrol.hxx:114
sal_uInt32 mnTextColor
Text color.
Definition: axcontrol.hxx:549
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:1785
Base class for ActiveX container controls.
Definition: axcontrol.hxx:797
OUString maGroupName
Group name for option buttons.
Definition: axcontrol.hxx:622
sal_uInt32 mnBorderColor
Flat border color.
Definition: axcontrol.hxx:822
void convertAxPicture(PropertyMap &rPropMap, const StreamDataSequence &rPicData, sal_uInt32 nPicPos) const
Converts the passed picture stream and Forms 2.0 position to UNO properties.
Definition: axcontrol.cxx:457
virtual void importProperty(sal_Int32 nPropId, const OUString &rValue) override
Derived classes set specific OOXML properties at the model structure.
Definition: axcontrol.cxx:2085
virtual void exportCompObj(BinaryOutputStream &rOutStrm) override
Derived classes export CompObjStream contents.
Definition: axcontrol.cxx:1686
const sal_uInt16 mnVersion
Current version of the ComCtl control model.
Definition: axcontrol.hxx:421
OUString maValue
Current value of the control.
Definition: axcontrol.hxx:621
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:1385
static void convertVerticalAlign(PropertyMap &rPropMap, sal_Int32 nVerticalAlign)
Converts the vertical alignment to UNO properties.
Definition: axcontrol.cxx:291
AxPairData maScrollPos
Scroll position.
Definition: axcontrol.hxx:818
static sal_uInt32 decodeUnsigned(std::u16string_view rValue)
Returns the 32-bit unsigned integer value from the passed string (decimal).
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:804
const sal_Int32 AX_SELECTION_EXTENDED
Definition: axcontrol.hxx:139
css::uno::Reference< css::awt::XControlModel > convertAndInsert(const EmbeddedControl &rControl, sal_Int32 &rnCtrlIndex)
Converts the passed control and inserts the control model into the form.
Definition: axcontrol.cxx:2730
virtual void exportCompObj(BinaryOutputStream &rOutStrm) override
Derived classes export CompObjStream contents.
Definition: axcontrol.cxx:2297
#define AX_GUID_SPINBUTTON
Definition: axcontrol.hxx:73
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
ApiTransparencyMode
Specifies how a form control supports transparent background.
Definition: axcontrol.hxx:175
css::uno::Reference< css::frame::XModel > mxDocModel
Definition: axcontrol.hxx:337
sal_uInt32 mnBackColor
Fill color.
Definition: axcontrol.hxx:781
void importPageAndMultiPageProperties(BinaryInputStream &rInStrm, sal_Int32 nPages)
Definition: axcontrol.cxx:2508
void skipArrayStringProperty()
Skips the next ArrayString property in the stream, if the respective flag in the property mask is set...
OUString maCaption
Visible caption of the form.
Definition: axcontrol.hxx:816
virtual void seek(sal_Int64 nPos)=0
Implementations seek the stream to the passed position, if the stream is seekable.
void writeStringProperty(OUString &orValue)
Write a string property to the stream, the respective flag in the property mask is set...
unsigned char sal_uInt8
#define SAL_MAX_UINT8
sal_uInt32 mnBackColor
Fill color.
Definition: axcontrol.hxx:753
void skipUndefinedProperty()
Has to be called for undefined properties.
OOX_DLLPUBLIC sal_uInt32 encodeOleColor(sal_Int32 nRgbColor)
Returns the OLE color from the passed UNO RGB color.
Definition: olehelper.cxx:247
virtual void exportBinaryModel(BinaryOutputStream &rOutStrm) override
Derived classes export a form control model to the passed output stream.
Definition: axcontrol.cxx:1484
virtual void convertFromProperties(PropertySet &rPropSet, const ControlConverter &rConv) override
Derived classes convert from uno control properties to equiv.
Definition: axcontrol.cxx:1670
static void convertToAxBorder(PropertySet const &rPropSet, sal_uInt32 &nBorderColor, sal_Int32 &nBorderStyle, sal_Int32 &nSpecialEffect)
Definition: axcontrol.cxx:420
virtual void exportCompObj(BinaryOutputStream &rOutStrm) override
Derived classes export CompObjStream contents.
Definition: axcontrol.cxx:1622
ComCtlScrollBarModel(sal_uInt16 nVersion)
Definition: axcontrol.cxx:756
sal_Int32 mnPicAlign
Anchor position of the picture.
Definition: axcontrol.hxx:827
EmbeddedForm(const css::uno::Reference< css::frame::XModel > &rxDocModel, const css::uno::Reference< css::drawing::XDrawPage > &rxDrawPage, const GraphicHelper &rGraphicHelper)
Definition: axcontrol.cxx:2721
#define AX_GUID_LABEL
Definition: axcontrol.hxx:65
sal_Int32 mnBorderStyle
Flat border style.
Definition: axcontrol.hxx:823
#define SAL_MAX_INT16
const sal_uInt32 AX_SYSCOLOR_WINDOWTEXT
Definition: axcontrol.hxx:84
static void convertAxOrientation(PropertyMap &rPropMap, const AxPairData &rSize, sal_Int32 nOrientation)
Converts the Forms 2.0 control orientation to UNO properties.
Definition: axcontrol.cxx:554
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:1652
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:1865
sal_Int32 mnMax
Maximum of the value range.
Definition: axcontrol.hxx:757
const sal_Int32 AX_DISPLAYSTYLE_LISTBOX
Definition: axcontrol.hxx:130
css::uno::Reference< css::container::XIndexContainer > mxFormIC
Definition: axcontrol.hxx:985
sal_Int32 mnSpecialEffect
3D border effect.
Definition: axcontrol.hxx:629
virtual void convertFromProperties(PropertySet &rPropSet, const ControlConverter &rConv) override
Derived classes convert from uno control properties to equiv.
Definition: axcontrol.cxx:1883
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:1329
sal_Int32 mnMin
Minimum of the value range.
Definition: axcontrol.hxx:446
sal_uInt32 mnScrollBarFlags
Special flags for scroll bar model.
Definition: axcontrol.hxx:443
OUString readUnicodeArray(sal_Int32 nChars)
Reads a Unicode character array and returns the string.
const sal_uInt32 AX_FLAGS_WORDWRAP
Definition: axcontrol.hxx:101
void skipPictureProperty()
Skips the next picture property in the stream, if the respective flag in the property mask is set...
sal_uInt32 mnBackColor
Fill color.
Definition: axcontrol.hxx:550
bool convertProperties(const css::uno::Reference< css::awt::XControlModel > &rxCtrlModel, const ControlConverter &rConv) const
Converts all control properties and inserts them into the passed model.
Definition: axcontrol.cxx:2689
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:1991
virtual void importProperty(sal_Int32 nPropId, const OUString &rValue) override
Derived classes set specific OOXML properties at the model structure.
Definition: axcontrol.cxx:1410
virtual void importProperty(sal_Int32 nPropId, const OUString &rValue)
Derived classes set specific OOXML properties at the model structure.
Definition: axcontrol.cxx:633
sal_uInt32 mnBorderColor
Flat border color.
Definition: axcontrol.hxx:552
const vcl::Font & GetAppFont() const
void readGuidProperty(OUString &orGuid)
Reads the next GUID property from the stream, if the respective flag in the property mask is set...
#define AX_GUID_SCROLLBAR
Definition: axcontrol.hxx:74
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Converts font settings if supported.
Definition: axcontrol.cxx:2532
Control does not support transparency.
virtual void skip(sal_Int32 nBytes, size_t nAtomSize=1)=0
Derived classes implement seeking the stream forward by the passed number of bytes.
virtual bool importBinaryModel(BinaryInputStream &rInStrm) override
Derived classes import a form control model from the passed input stream.
Definition: axcontrol.cxx:997
virtual void importProperty(sal_Int32 nPropId, const OUString &rValue) override
Derived classes set specific OOXML properties at the model structure.
Definition: axcontrol.cxx:830
virtual ApiControlType getControlType() const override
Derived classes return the UNO control type enum value.
Definition: axcontrol.cxx:2224
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const
Derived classes convert all control properties.
Definition: axcontrol.cxx:641
void convertAxBorder(PropertyMap &rPropMap, sal_uInt32 nBorderColor, sal_Int32 nBorderStyle, sal_Int32 nSpecialEffect) const
Converts the Forms 2.0 border formatting to UNO properties.
Definition: axcontrol.cxx:411
virtual void importControlData(BinaryInputStream &rInStrm) override
Definition: axcontrol.cxx:815
virtual void exportBinaryModel(BinaryOutputStream &rOutStrm) override
Derived classes export a form control model to the passed output stream.
Definition: axcontrol.cxx:1282
std::vector< OUString > maTabNames
Definition: axcontrol.hxx:601
#define SAL_WARN(area, stream)
const sal_Int32 AX_DISPLAYSTYLE_TOGGLE
Definition: axcontrol.hxx:134
bool importComplexPart(BinaryInputStream &rInStrm)
Definition: axcontrol.cxx:743
ControlConverter(const css::uno::Reference< css::frame::XModel > &rxDocModel, const GraphicHelper &rGraphicHelper, bool bDefaultColorBgr=true)
Definition: axcontrol.cxx:224
sal_Int32 mnBorderStyle
Flat border style.
Definition: axcontrol.hxx:628
bool importCommonPart(BinaryInputStream &rInStrm, sal_uInt32 nPartSize)
Definition: axcontrol.cxx:730
virtual bool importBinaryModel(BinaryInputStream &rInStrm) override
Derived classes import a form control model from the passed input stream.
Definition: axcontrol.cxx:2644
OUString maName
Definition: dffdumper.cxx:160
sal_uInt32 mnFlags
Various flags.
Definition: axcontrol.hxx:551
ComCtlModelBase(sal_uInt32 nDataPartId5, sal_uInt32 nDataPartId6, sal_uInt16 nVersion)
Definition: axcontrol.cxx:654
sal_uInt32 mnBackColor
Fill color.
Definition: axcontrol.hxx:819
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:2322
virtual void exportCompObj(BinaryOutputStream &rOutStrm) override
Derived classes export CompObjStream contents.
Definition: axcontrol.cxx:1184
sal_Int32 mnPosition
Value of the spin button.
Definition: axcontrol.hxx:448
sal_uInt32 mnTextColor
Text color.
Definition: axcontrol.hxx:623
bool isEof() const
Returns true, if the stream position is invalid (EOF).
const sal_Int32 AX_DISPLAYSTYLE_DROPDOWN
Definition: axcontrol.hxx:135
virtual bool importBinaryModel(BinaryInputStream &rInStrm) override
Derived classes import a form control model from the passed input stream.
Definition: axcontrol.cxx:1261
sal_Int32 mnMaxLength
Maximum character count.
Definition: axcontrol.hxx:635
sal_uInt16 mnVertical
0 = horizontal, 1 = vertical.
Definition: axcontrol.hxx:466
sal_uInt32 mnBackColor
Fill color.
Definition: axcontrol.hxx:576
bool mbPicTiling
True = picture is repeated.
Definition: axcontrol.hxx:829
float mfMin
Minimum of the value range.
Definition: axcontrol.hxx:464
sal_uInt32 mnBorderColor
Flat border color.
Definition: axcontrol.hxx:578
virtual void exportBinaryModel(BinaryOutputStream &rOutStrm) override
Derived classes export a form control model to the passed output stream.
Definition: axcontrol.cxx:2271
css::uno::Reference< css::container::XIndexContainer > const & createXForm()
Creates the form that will hold the form controls.
Definition: axcontrol.cxx:2755
Control does not support tri-state, state is given as short.
Definition: axcontrol.hxx:185
virtual void convertFromProperties(PropertySet &rPropSet, const ControlConverter &rConv) override
Derived classes convert from uno control properties to equiv.
Definition: axcontrol.cxx:922
virtual ApiControlType getControlType() const =0
Derived classes return the UNO control type enum value.
sal_uInt32 mnBackColor
Fill color.
Definition: axcontrol.hxx:524
void convertScrollabilitySettings(PropertyMap &rPropMap, const AxPairData &rScrollPos, const AxPairData &rScrollArea, sal_Int32 nScrollBars) const
Converts scrollability settings to UNO properties.
Definition: axcontrol.cxx:303
sal_Int32 mnDelay
Repeat delay in milliseconds.
Definition: axcontrol.hxx:760
static void convertToMSOrientation(PropertySet const &rPropMap, bool &bHorizontal)
Definition: axcontrol.cxx:284
css::uno::Sequence< OUString > msListData
Definition: axcontrol.hxx:879
sal_Int32 mnLargeChange
Increment step size (thumb).
Definition: axcontrol.hxx:444
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:772
sal_Int32 nState
virtual void importProperty(sal_Int32 nPropId, const OUString &rValue) override
Derived classes set specific OOXML properties at the model structure.
Definition: axcontrol.cxx:974
bool finalizeImport()
Final processing, reads contents of all complex properties.
static void convertAxState(PropertyMap &rPropMap, const OUString &rValue, sal_Int32 nMultiSelect, ApiDefaultStateMode eDefStateMode, bool bAwtModel)
Converts the Forms 2.0 value for checked/unchecked/dontknow to UNO properties.
Definition: axcontrol.cxx:502
AxFontFlags
Definition: axfontdata.hxx:33
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:688
virtual void convertProperties(PropertyMap &rPropMap, const ControlConverter &rConv) const override
Derived classes convert all control properties.
Definition: axcontrol.cxx:1610
Control supports tri-state, state is given as short.
Definition: axcontrol.hxx:186
void readBoolProperty(bool &orbValue, bool bReverse=false)
Reads the next boolean property value from the stream, if the respective flag in the property mask is...
virtual void exportCompObj(BinaryOutputStream &rOutStrm) override
Derived classes export CompObjStream contents.
Definition: axcontrol.cxx:2182
css::uno::Sequence< sal_Int16 > msIndices
Definition: axcontrol.hxx:880
OOX_DLLPUBLIC::Color decodeOleColor(const GraphicHelper &rGraphicHelper, sal_uInt32 nOleColor, bool bDefaultColorBgr)
Returns the UNO RGB color from the passed encoded OLE color.
Definition: olehelper.cxx:215
::basegfx::B2IVector maSize
virtual void exportCompObj(BinaryOutputStream &rOutStrm) override
Derived classes export CompObjStream contents.
Definition: axcontrol.cxx:1306
sal_uInt32 mnBorderColor
Flat border color.
Definition: axcontrol.hxx:627
bool m_bDetectedRangeSegmentation false
std::vector< OUString > maItems
Definition: axcontrol.hxx:600
virtual void importControlData(BinaryInputStream &rInStrm)=0
sal_uInt32 mnArrowColor
Button arrow color.
Definition: axcontrol.hxx:752
virtual void importControlData(BinaryInputStream &rInStrm) override
Definition: axcontrol.cxx:780
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo