LCOV - code coverage report
Current view: top level - oox/source/ole - axcontrol.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 609 1494 40.8 %
Date: 2015-06-13 12:38:46 Functions: 80 181 44.2 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11