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