LCOV - code coverage report
Current view: top level - toolkit/source/controls - unocontrolmodel.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 538 722 74.5 %
Date: 2012-08-25 Functions: 31 39 79.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 624 1494 41.8 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <com/sun/star/beans/PropertyState.hpp>
      30                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      31                 :            : #include <com/sun/star/awt/FontDescriptor.hpp>
      32                 :            : #include <com/sun/star/awt/FontWidth.hpp>
      33                 :            : #include <com/sun/star/awt/FontWeight.hpp>
      34                 :            : #include <com/sun/star/awt/FontSlant.hpp>
      35                 :            : #include <com/sun/star/awt/MouseWheelBehavior.hpp>
      36                 :            : #include <com/sun/star/graphic/XGraphicProvider.hpp>
      37                 :            : #include <com/sun/star/awt/XDevice.hpp>
      38                 :            : #include <com/sun/star/text/WritingMode2.hpp>
      39                 :            : #include <com/sun/star/io/XMarkableStream.hpp>
      40                 :            : #include <toolkit/controls/unocontrolmodel.hxx>
      41                 :            : #include <toolkit/helper/macros.hxx>
      42                 :            : #include <cppuhelper/typeprovider.hxx>
      43                 :            : #include <rtl/memory.h>
      44                 :            : #include <rtl/uuid.h>
      45                 :            : #include <tools/diagnose_ex.h>
      46                 :            : #include <tools/date.hxx>
      47                 :            : #include <tools/time.hxx>
      48                 :            : #include <tools/debug.hxx>
      49                 :            : #include <toolkit/helper/property.hxx>
      50                 :            : #include <toolkit/helper/vclunohelper.hxx>
      51                 :            : #include <toolkit/helper/emptyfontdescriptor.hxx>
      52                 :            : #include <com/sun/star/lang/Locale.hpp>
      53                 :            : #include <unotools/localedatawrapper.hxx>
      54                 :            : #include <unotools/configmgr.hxx>
      55                 :            : #include <comphelper/processfactory.hxx>
      56                 :            : #include <comphelper/sequence.hxx>
      57                 :            : #include <comphelper/extract.hxx>
      58                 :            : #include <vcl/svapp.hxx>
      59                 :            : #include <uno/data.h>
      60                 :            : 
      61                 :            : #include <memory>
      62                 :            : #include <set>
      63                 :            : 
      64                 :            : using namespace ::com::sun::star;
      65                 :            : using namespace ::com::sun::star::uno;
      66                 :            : using namespace ::com::sun::star::lang;
      67                 :            : using namespace ::com::sun::star::i18n;
      68                 :            : using ::com::sun::star::awt::FontDescriptor;
      69                 :            : 
      70                 :            : 
      71                 :            : #define UNOCONTROL_STREAMVERSION    (short)2
      72                 :            : 
      73                 :      35700 : static void lcl_ImplMergeFontProperty( FontDescriptor& rFD, sal_uInt16 nPropId, const Any& rValue )
      74                 :            : {
      75                 :            :     // some props are defined with other types than the matching FontDescriptor members have
      76                 :            :     // (e.g. FontWidth, FontSlant)
      77                 :            :     // 78474 - 09/19/2000 - FS
      78                 :      35700 :     float       nExtractFloat = 0;
      79                 :      35700 :     sal_Int16   nExtractShort = 0;
      80                 :            : 
      81   [ +  +  +  +  :      35700 :     switch ( nPropId )
          +  +  +  +  +  
          +  +  +  +  +  
                +  +  - ]
      82                 :            :     {
      83                 :       2239 :         case BASEPROPERTY_FONTDESCRIPTORPART_NAME:          rValue >>= rFD.Name;
      84                 :       2239 :                                                             break;
      85                 :       2218 :         case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME:     rValue >>= rFD.StyleName;
      86                 :       2218 :                                                             break;
      87                 :       2234 :         case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY:        rValue >>= rFD.Family;
      88                 :       2234 :                                                             break;
      89                 :       2244 :         case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET:       rValue >>= rFD.CharSet;
      90                 :       2244 :                                                             break;
      91                 :       2248 :         case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT:        rValue >>= nExtractFloat; rFD.Height = (sal_Int16)nExtractFloat;
      92                 :       2248 :                                                             break;
      93                 :       2248 :         case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT:        rValue >>= rFD.Weight;
      94                 :       2248 :                                                             break;
      95         [ +  + ]:       2247 :         case BASEPROPERTY_FONTDESCRIPTORPART_SLANT:         if ( rValue >>= nExtractShort )
      96                 :       2228 :                                                                 rFD.Slant = (::com::sun::star::awt::FontSlant)nExtractShort;
      97                 :            :                                                             else
      98         [ +  - ]:         19 :                                                                 rValue >>= rFD.Slant;
      99                 :       2247 :                                                             break;
     100                 :       2247 :         case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE:     rValue >>= rFD.Underline;
     101                 :       2247 :                                                             break;
     102                 :       2248 :         case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT:     rValue >>= rFD.Strikeout;
     103                 :       2248 :                                                             break;
     104                 :       2218 :         case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH:         rValue >>= rFD.Width;
     105                 :       2218 :                                                             break;
     106                 :       2218 :         case BASEPROPERTY_FONTDESCRIPTORPART_PITCH:         rValue >>= rFD.Pitch;
     107                 :       2218 :                                                             break;
     108                 :       2218 :         case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH:     rValue >>= rFD.CharacterWidth;
     109                 :       2218 :                                                             break;
     110                 :       2218 :         case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION:   rValue >>= rFD.Orientation;
     111                 :       2218 :                                                             break;
     112                 :       2218 :         case BASEPROPERTY_FONTDESCRIPTORPART_KERNING:       rValue >>= rFD.Kerning;
     113                 :       2218 :                                                             break;
     114                 :       2219 :         case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE:  rValue >>= rFD.WordLineMode;
     115                 :       2219 :                                                             break;
     116                 :       2218 :         case BASEPROPERTY_FONTDESCRIPTORPART_TYPE:          rValue >>= rFD.Type;
     117                 :       2218 :                                                             break;
     118                 :            :         default:                                            OSL_FAIL( "FontProperty?!" );
     119                 :            :     }
     120                 :      35700 : }
     121                 :            : 
     122                 :            : //  ----------------------------------------------------
     123                 :            : //  class UnoControlModel
     124                 :            : //  ----------------------------------------------------
     125                 :       1386 : UnoControlModel::UnoControlModel( const Reference< XMultiServiceFactory >& i_factory )
     126                 :            :     :UnoControlModel_Base()
     127                 :            :     ,MutexAndBroadcastHelper()
     128                 :            :     ,OPropertySetHelper( BrdcstHelper )
     129                 :            :     ,maDisposeListeners( *this )
     130 [ +  - ][ +  - ]:       1386 :     ,maContext( i_factory )
         [ +  - ][ +  - ]
                 [ +  - ]
     131                 :            : {
     132                 :            :     // Insert properties from Model into table,
     133                 :            :     // only existing properties are valid, even if they're VOID
     134                 :       1386 : }
     135                 :            : 
     136                 :         82 : UnoControlModel::UnoControlModel( const UnoControlModel& rModel )
     137                 :            :     : UnoControlModel_Base()
     138                 :            :     , MutexAndBroadcastHelper()
     139                 :            :     , OPropertySetHelper( BrdcstHelper )
     140                 :            :     , maData( rModel.maData )
     141                 :            :     , maDisposeListeners( *this )
     142 [ +  - ][ +  - ]:         82 :     , maContext( rModel.maContext )
         [ +  - ][ +  - ]
                 [ +  - ]
     143                 :            : {
     144                 :         82 : }
     145                 :            : 
     146                 :        196 : ::com::sun::star::uno::Sequence<sal_Int32> UnoControlModel::ImplGetPropertyIds() const
     147                 :            : {
     148                 :        196 :     sal_uInt32 nIDs = maData.size();
     149                 :        196 :     ::com::sun::star::uno::Sequence<sal_Int32>  aIDs( nIDs );
     150         [ +  - ]:        196 :     sal_Int32* pIDs = aIDs.getArray();
     151                 :        196 :     sal_uInt32 n = 0;
     152         [ +  + ]:       4227 :     for ( ImplPropertyTable::const_iterator it = maData.begin(); it != maData.end(); ++it )
     153                 :       4031 :         pIDs[n++] = it->first;
     154                 :        196 :     return aIDs;
     155                 :            : }
     156                 :            : 
     157                 :      15743 : sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const
     158                 :            : {
     159 [ -  + ][ #  # ]:      15743 :     if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
     160                 :          0 :         nPropId = BASEPROPERTY_FONTDESCRIPTOR;
     161                 :            : 
     162 [ +  - ][ +  + ]:      15743 :     return maData.find( nPropId ) != maData.end() ? sal_True : sal_False;
     163                 :            : }
     164                 :            : 
     165                 :      24079 : ::com::sun::star::uno::Any UnoControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
     166                 :            : {
     167                 :      24079 :     ::com::sun::star::uno::Any aDefault;
     168                 :            : 
     169 [ -  + ][ #  # ]:      24079 :     if (
                 [ +  + ]
     170                 :            :         (nPropId == BASEPROPERTY_FONTDESCRIPTOR) ||
     171                 :            :         (
     172                 :            :          (nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START) &&
     173                 :            :          (nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END)
     174                 :            :         )
     175                 :            :        )
     176                 :            :     {
     177                 :        683 :         EmptyFontDescriptor aFD;
     178   [ +  -  -  -  :        683 :         switch ( nPropId )
          -  -  -  -  -  
          -  -  -  -  -  
             -  -  -  - ]
     179                 :            :         {
     180         [ +  - ]:        683 :             case BASEPROPERTY_FONTDESCRIPTOR:                   aDefault <<= aFD;                   break;
     181         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_NAME:          aDefault <<= aFD.Name;              break;
     182         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME:     aDefault <<= aFD.StyleName;         break;
     183         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY:        aDefault <<= aFD.Family;            break;
     184         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET:       aDefault <<= aFD.CharSet;           break;
     185         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT:        aDefault <<= (float)aFD.Height;     break;
     186         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT:        aDefault <<= aFD.Weight;            break;
     187         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_SLANT:         aDefault <<= (sal_Int16)aFD.Slant;  break;
     188         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE:     aDefault <<= aFD.Underline;         break;
     189         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT:     aDefault <<= aFD.Strikeout;         break;
     190         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH:         aDefault <<= aFD.Width;             break;
     191         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_PITCH:         aDefault <<= aFD.Pitch;             break;
     192         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH:     aDefault <<= aFD.CharacterWidth;    break;
     193         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION:   aDefault <<= aFD.Orientation;       break;
     194         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_KERNING:       aDefault <<= aFD.Kerning;           break;
     195         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE:  aDefault <<= aFD.WordLineMode;      break;
     196         [ #  # ]:          0 :             case BASEPROPERTY_FONTDESCRIPTORPART_TYPE:          aDefault <<= aFD.Type;              break;
     197                 :            :             default: OSL_FAIL( "FontProperty?!" );
     198                 :        683 :         }
     199                 :            :     }
     200                 :            :     else
     201                 :            :     {
     202   [ +  +  +  +  :      23396 :         switch ( nPropId )
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
                      + ]
     203                 :            :         {
     204                 :            :             case BASEPROPERTY_GRAPHIC:
     205         [ +  - ]:          8 :                 aDefault <<= Reference< graphic::XGraphic >();
     206                 :          8 :                 break;
     207                 :            : 
     208                 :            :             case BASEPROPERTY_REFERENCE_DEVICE:
     209         [ +  - ]:        351 :                 aDefault <<= Reference< awt::XDevice >();
     210                 :        351 :                 break;
     211                 :            : 
     212                 :            :             case BASEPROPERTY_ITEM_SEPARATOR_POS:
     213                 :            :             case BASEPROPERTY_VERTICALALIGN:
     214                 :            :             case BASEPROPERTY_BORDERCOLOR:
     215                 :            :             case BASEPROPERTY_SYMBOL_COLOR:
     216                 :            :             case BASEPROPERTY_TABSTOP:
     217                 :            :             case BASEPROPERTY_TEXTCOLOR:
     218                 :            :             case BASEPROPERTY_TEXTLINECOLOR:
     219                 :            :             case BASEPROPERTY_DATE:
     220                 :            :             case BASEPROPERTY_DATESHOWCENTURY:
     221                 :            :             case BASEPROPERTY_TIME:
     222                 :            :             case BASEPROPERTY_VALUE_DOUBLE:
     223                 :            :             case BASEPROPERTY_PROGRESSVALUE:
     224                 :            :             case BASEPROPERTY_SCROLLVALUE:
     225                 :            :             case BASEPROPERTY_VISIBLESIZE:
     226                 :            :             case BASEPROPERTY_BACKGROUNDCOLOR:
     227                 :       5722 :             case BASEPROPERTY_FILLCOLOR:            break;  // Void
     228                 :            : 
     229                 :            :             case BASEPROPERTY_FONTRELIEF:
     230                 :            :             case BASEPROPERTY_FONTEMPHASISMARK:
     231                 :            :             case BASEPROPERTY_MAXTEXTLEN:
     232                 :            :             case BASEPROPERTY_STATE:
     233                 :            :             case BASEPROPERTY_EXTDATEFORMAT:
     234                 :            :             case BASEPROPERTY_EXTTIMEFORMAT:
     235         [ +  - ]:       1746 :             case BASEPROPERTY_ECHOCHAR:             aDefault <<= (sal_Int16) 0; break;
     236         [ +  - ]:        396 :             case BASEPROPERTY_BORDER:               aDefault <<= (sal_Int16) 1; break;
     237         [ +  - ]:         60 :             case BASEPROPERTY_DECIMALACCURACY:      aDefault <<= (sal_Int16) 2; break;
     238         [ +  - ]:         58 :             case BASEPROPERTY_LINECOUNT:            aDefault <<= (sal_Int16) 5; break;
     239         [ +  - ]:        624 :             case BASEPROPERTY_ALIGN:                aDefault <<= (sal_Int16) PROPERTY_ALIGN_LEFT; break;
     240         [ +  - ]:         71 :             case BASEPROPERTY_IMAGEALIGN:           aDefault <<= (sal_Int16) 1 /*ImageAlign::TOP*/; break;
     241         [ +  - ]:        225 :             case BASEPROPERTY_IMAGEPOSITION:        aDefault <<= (sal_Int16) 12 /*ImagePosition::Centered*/; break;
     242         [ +  - ]:         71 :             case BASEPROPERTY_PUSHBUTTONTYPE:       aDefault <<= (sal_Int16) 0 /*PushButtonType::STANDARD*/; break;
     243         [ +  - ]:        263 :             case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR:aDefault <<= (sal_Int16) awt::MouseWheelBehavior::SCROLL_FOCUS_ONLY; break;
     244                 :            : 
     245         [ +  - ]:         45 :             case BASEPROPERTY_DATEMAX:              aDefault <<= (sal_Int32) Date( 31, 12, 2200 ).GetDate();    break;
     246         [ +  - ]:         45 :             case BASEPROPERTY_DATEMIN:              aDefault <<= (sal_Int32) Date( 1, 1, 1900 ).GetDate();  break;
     247 [ +  - ][ +  - ]:         31 :             case BASEPROPERTY_TIMEMAX:              aDefault <<= (sal_Int32) Time( 23, 59 ).GetTime();  break;
     248         [ +  - ]:         31 :             case BASEPROPERTY_TIMEMIN:              aDefault <<= (sal_Int32) 0;     break;
     249         [ +  - ]:         60 :             case BASEPROPERTY_VALUEMAX_DOUBLE:      aDefault <<= (double) 1000000;  break;
     250         [ +  - ]:         60 :             case BASEPROPERTY_VALUEMIN_DOUBLE:      aDefault <<= (double) -1000000; break;
     251         [ +  - ]:         60 :             case BASEPROPERTY_VALUESTEP_DOUBLE:     aDefault <<= (double ) 1;       break;
     252         [ +  - ]:         10 :             case BASEPROPERTY_PROGRESSVALUE_MAX:    aDefault <<= (sal_Int32) 100;   break;
     253         [ +  - ]:         10 :             case BASEPROPERTY_PROGRESSVALUE_MIN:    aDefault <<= (sal_Int32)   0;   break;
     254         [ +  - ]:         24 :             case BASEPROPERTY_SCROLLVALUE_MAX:      aDefault <<= (sal_Int32) 100;   break;
     255         [ +  - ]:         24 :             case BASEPROPERTY_SCROLLVALUE_MIN:      aDefault <<= (sal_Int32)   0;   break;
     256         [ +  - ]:         24 :             case BASEPROPERTY_LINEINCREMENT:        aDefault <<= (sal_Int32)   1;   break;
     257         [ +  - ]:         24 :             case BASEPROPERTY_BLOCKINCREMENT:       aDefault <<= (sal_Int32)  10;   break;
     258         [ +  - ]:         56 :             case BASEPROPERTY_ORIENTATION:          aDefault <<= (sal_Int32)   0;   break;
     259         [ +  - ]:         22 :             case BASEPROPERTY_SPINVALUE:            aDefault <<= (sal_Int32)   0;   break;
     260         [ +  - ]:         22 :             case BASEPROPERTY_SPININCREMENT:        aDefault <<= (sal_Int32)   1;   break;
     261         [ +  - ]:         22 :             case BASEPROPERTY_SPINVALUE_MIN:        aDefault <<= (sal_Int32)   0;   break;
     262         [ +  - ]:         22 :             case BASEPROPERTY_SPINVALUE_MAX:        aDefault <<= (sal_Int32) 100;   break;
     263         [ +  - ]:        293 :             case BASEPROPERTY_REPEAT_DELAY:         aDefault <<= (sal_Int32)  50;   break;    // 50 milliseconds
     264 [ +  - ][ +  - ]:        663 :             case BASEPROPERTY_DEFAULTCONTROL:       aDefault <<= ((UnoControlModel*)this)->getServiceName();    break;
     265                 :            : 
     266                 :            :             case BASEPROPERTY_AUTOHSCROLL:
     267                 :            :             case BASEPROPERTY_AUTOVSCROLL:
     268                 :            :             case BASEPROPERTY_MOVEABLE:
     269                 :            :             case BASEPROPERTY_CLOSEABLE:
     270                 :            :             case BASEPROPERTY_SIZEABLE:
     271                 :            :             case BASEPROPERTY_HSCROLL:
     272                 :            :             case BASEPROPERTY_DEFAULTBUTTON:
     273                 :            :             case BASEPROPERTY_MULTILINE:
     274                 :            :             case BASEPROPERTY_MULTISELECTION:
     275                 :            :             case BASEPROPERTY_TRISTATE:
     276                 :            :             case BASEPROPERTY_DROPDOWN:
     277                 :            :             case BASEPROPERTY_SPIN:
     278                 :            :             case BASEPROPERTY_READONLY:
     279                 :            :             case BASEPROPERTY_VSCROLL:
     280                 :            :             case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
     281                 :            :             case BASEPROPERTY_STRICTFORMAT:
     282                 :            :             case BASEPROPERTY_REPEAT:
     283                 :            :             case BASEPROPERTY_PAINTTRANSPARENT:
     284                 :            :             case BASEPROPERTY_DESKTOP_AS_PARENT:
     285                 :            :             case BASEPROPERTY_HARDLINEBREAKS:
     286         [ +  - ]:       1880 :             case BASEPROPERTY_NOLABEL:              aDefault <<= (sal_Bool) sal_False; break;
     287                 :            : 
     288                 :            :             case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
     289                 :            :             case BASEPROPERTY_HIDEINACTIVESELECTION:
     290                 :            :             case BASEPROPERTY_ENFORCE_FORMAT:
     291                 :            :             case BASEPROPERTY_AUTOCOMPLETE:
     292                 :            :             case BASEPROPERTY_SCALEIMAGE:
     293                 :            :             case BASEPROPERTY_ENABLED:
     294                 :            :             case BASEPROPERTY_PRINTABLE:
     295                 :            :             case BASEPROPERTY_ENABLEVISIBLE:
     296         [ +  - ]:       4282 :             case BASEPROPERTY_DECORATION:           aDefault <<= (sal_Bool) sal_True; break;
     297                 :            : 
     298                 :            :             case BASEPROPERTY_GROUPNAME:
     299                 :            :             case BASEPROPERTY_HELPTEXT:
     300                 :            :             case BASEPROPERTY_HELPURL:
     301                 :            :             case BASEPROPERTY_IMAGEURL:
     302                 :            :             case BASEPROPERTY_DIALOGSOURCEURL:
     303                 :            :             case BASEPROPERTY_EDITMASK:
     304                 :            :             case BASEPROPERTY_LITERALMASK:
     305                 :            :             case BASEPROPERTY_LABEL:
     306                 :            :             case BASEPROPERTY_TITLE:
     307         [ +  - ]:       4521 :             case BASEPROPERTY_TEXT:                 aDefault <<= ::rtl::OUString(); break;
     308                 :            : 
     309                 :            :             case BASEPROPERTY_WRITING_MODE:
     310                 :            :             case BASEPROPERTY_CONTEXT_WRITING_MODE:
     311         [ +  - ]:       1450 :                 aDefault <<= text::WritingMode2::CONTEXT;
     312                 :       1450 :                 break;
     313                 :            : 
     314                 :            :             case BASEPROPERTY_STRINGITEMLIST:
     315                 :            :             {
     316         [ +  - ]:         58 :                 ::com::sun::star::uno::Sequence< ::rtl::OUString> aStringSeq;
     317 [ +  - ][ +  - ]:         58 :                 aDefault <<= aStringSeq;
     318                 :            : 
     319                 :            :             }
     320                 :         58 :             break;
     321                 :            :             case BASEPROPERTY_SELECTEDITEMS:
     322                 :            :             {
     323         [ +  - ]:         27 :                 ::com::sun::star::uno::Sequence<sal_Int16> aINT16Seq;
     324 [ +  - ][ +  - ]:         27 :                 aDefault <<= aINT16Seq;
     325                 :            :             }
     326                 :         27 :             break;
     327                 :            :             case BASEPROPERTY_CURRENCYSYMBOL:
     328                 :            :             {
     329                 :            :                 rtl::OUString sDefaultCurrency(
     330         [ +  - ]:         29 :                     utl::ConfigManager::getDefaultCurrency() );
     331                 :            : 
     332                 :            :                 // extract the bank symbol
     333                 :         29 :                 sal_Int32 nSepPos = sDefaultCurrency.indexOf( '-' );
     334                 :         29 :                 ::rtl::OUString sBankSymbol;
     335         [ -  + ]:         29 :                 if ( nSepPos >= 0 )
     336                 :            :                 {
     337                 :          0 :                     sBankSymbol = sDefaultCurrency.copy( 0, nSepPos );
     338                 :          0 :                     sDefaultCurrency = sDefaultCurrency.copy( nSepPos + 1 );
     339                 :            :                 }
     340                 :            : 
     341                 :            :                 // the remaming is the locale
     342                 :         29 :                 Locale aLocale;
     343                 :         29 :                 nSepPos = sDefaultCurrency.indexOf( '-' );
     344         [ -  + ]:         29 :                 if ( nSepPos >= 0 )
     345                 :            :                 {
     346                 :          0 :                     aLocale.Language = sDefaultCurrency.copy( 0, nSepPos );
     347                 :          0 :                     aLocale.Country = sDefaultCurrency.copy( nSepPos + 1 );
     348                 :            :                 }
     349                 :            : 
     350 [ +  - ][ +  - ]:         29 :                 LocaleDataWrapper aLocaleInfo( maContext.getLegacyServiceFactory(), aLocale );
     351         [ +  - ]:         29 :                 if ( sBankSymbol.isEmpty() )
     352         [ +  - ]:         29 :                     sBankSymbol = aLocaleInfo.getCurrBankSymbol();
     353                 :            : 
     354                 :            :                 // look for the currency entry (for this language) which has the given bank symbol
     355         [ +  - ]:         29 :                 Sequence< Currency2 > aAllCurrencies = aLocaleInfo.getAllCurrencies();
     356                 :         29 :                 const Currency2* pAllCurrencies     =                       aAllCurrencies.getConstArray();
     357                 :         29 :                 const Currency2* pAllCurrenciesEnd  =   pAllCurrencies  +   aAllCurrencies.getLength();
     358                 :            : 
     359         [ +  - ]:         29 :                 ::rtl::OUString sCurrencySymbol = aLocaleInfo.getCurrSymbol();
     360         [ -  + ]:         29 :                 if ( sBankSymbol.isEmpty() )
     361                 :            :                 {
     362                 :            :                     DBG_ASSERT( pAllCurrencies != pAllCurrenciesEnd, "UnoControlModel::ImplGetDefaultValue: no currencies at all!" );
     363         [ #  # ]:          0 :                     if ( pAllCurrencies != pAllCurrenciesEnd )
     364                 :            :                     {
     365                 :          0 :                         sBankSymbol = pAllCurrencies->BankSymbol;
     366                 :          0 :                         sCurrencySymbol = pAllCurrencies->Symbol;
     367                 :            :                     }
     368                 :            :                 }
     369                 :            : 
     370         [ +  - ]:         29 :                 if ( !sBankSymbol.isEmpty() )
     371                 :            :                 {
     372                 :         29 :                     bool bLegacy = false;
     373         [ +  - ]:         58 :                     for ( ;pAllCurrencies != pAllCurrenciesEnd; ++pAllCurrencies )
     374         [ +  - ]:         29 :                         if ( pAllCurrencies->BankSymbol == sBankSymbol )
     375                 :            :                         {
     376                 :         29 :                             sCurrencySymbol = pAllCurrencies->Symbol;
     377         [ -  + ]:         29 :                             if ( pAllCurrencies->LegacyOnly )
     378                 :          0 :                                 bLegacy = true;
     379                 :            :                             else
     380                 :         29 :                                 break;
     381                 :            :                         }
     382                 :            :                     DBG_ASSERT( bLegacy || pAllCurrencies != pAllCurrenciesEnd, "UnoControlModel::ImplGetDefaultValue: did not find the given bank symbol!" );
     383                 :            :                     (void)bLegacy;
     384                 :            :                 }
     385                 :            : 
     386 [ +  - ][ +  - ]:         29 :                 aDefault <<= sCurrencySymbol;
                 [ +  - ]
     387                 :            :             }
     388                 :         29 :             break;
     389                 :            : 
     390                 :            :             default:    OSL_FAIL( "ImplGetDefaultValue - unknown Property" );
     391                 :            :         }
     392                 :            :     }
     393                 :            : 
     394                 :      24079 :     return aDefault;
     395                 :            : }
     396                 :            : 
     397                 :      24668 : void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rDefault )
     398                 :            : {
     399                 :      24668 :     maData[ nPropId ] = rDefault;
     400                 :      24668 : }
     401                 :            : 
     402                 :       9165 : void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
     403                 :            : {
     404         [ +  - ]:       9165 :     ImplRegisterProperty( nPropId, ImplGetDefaultValue( nPropId ) );
     405                 :            : 
     406         [ +  + ]:       9165 :     if ( nPropId == BASEPROPERTY_FONTDESCRIPTOR )
     407                 :            :     {
     408                 :            :         // some properties are not included in the FontDescriptor, but everytime
     409                 :            :         // when we have a FontDescriptor we want to have these properties too.
     410                 :            :         // => Easier to register the here, istead everywhere where I register the FontDescriptor...
     411                 :            : 
     412                 :        113 :         ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
     413                 :        113 :         ImplRegisterProperty( BASEPROPERTY_TEXTLINECOLOR );
     414                 :        113 :         ImplRegisterProperty( BASEPROPERTY_FONTRELIEF );
     415                 :        113 :         ImplRegisterProperty( BASEPROPERTY_FONTEMPHASISMARK );
     416                 :            :     }
     417                 :       9165 : }
     418                 :            : 
     419                 :        576 : void UnoControlModel::ImplRegisterProperties( const std::list< sal_uInt16 > &rIds )
     420                 :            : {
     421         [ +  - ]:        576 :     std::list< sal_uInt16 >::const_iterator iter;
     422 [ +  - ][ +  - ]:      16001 :     for( iter = rIds.begin(); iter != rIds.end(); ++iter)
                 [ +  + ]
     423                 :            :     {
     424 [ +  - ][ +  - ]:      15425 :         if( !ImplHasProperty( *iter ) )
                 [ +  - ]
     425 [ +  - ][ +  - ]:      15425 :             ImplRegisterProperty( *iter, ImplGetDefaultValue( *iter ) );
         [ +  - ][ +  - ]
     426                 :            :     }
     427                 :        576 : }
     428                 :            : 
     429                 :            : // ::com::sun::star::uno::XInterface
     430                 :      69807 : ::com::sun::star::uno::Any UnoControlModel::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
     431                 :            : {
     432                 :      69807 :     Any aRet = UnoControlModel_Base::queryAggregation( rType );
     433         [ +  + ]:      69807 :     if ( !aRet.hasValue() )
     434         [ +  - ]:       9779 :         aRet = ::cppu::OPropertySetHelper::queryInterface( rType );
     435                 :      69807 :     return aRet;
     436                 :            : }
     437                 :            : 
     438                 :            : // ::com::sun::star::lang::XUnoTunnel
     439 [ #  # ][ #  # ]:          0 : IMPL_XUNOTUNNEL_MINIMAL( UnoControlModel )
                 [ #  # ]
     440                 :            : 
     441                 :            : // XInterface
     442                 :     345035 : IMPLEMENT_FORWARD_REFCOUNT( UnoControlModel, UnoControlModel_Base )
     443                 :            : 
     444                 :            : // ::com::sun::star::lang::XTypeProvider
     445 [ +  - ][ +  - ]:        172 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoControlModel, UnoControlModel_Base, ::cppu::OPropertySetHelper )
                 [ +  - ]
     446                 :            : 
     447                 :            : 
     448                 :         82 : uno::Reference< util::XCloneable > UnoControlModel::createClone() throw(::com::sun::star::uno::RuntimeException)
     449                 :            : {
     450                 :         82 :     UnoControlModel* pClone = Clone();
     451                 :         82 :     uno::Reference< util::XCloneable > xClone( (::cppu::OWeakObject*) pClone, uno::UNO_QUERY );
     452                 :         82 :     return xClone;
     453                 :            : }
     454                 :            : 
     455                 :            : // ::com::sun::star::lang::XComponent
     456                 :        583 : void UnoControlModel::dispose(  ) throw(::com::sun::star::uno::RuntimeException)
     457                 :            : {
     458         [ +  - ]:        583 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     459                 :            : 
     460         [ +  - ]:        583 :     ::com::sun::star::lang::EventObject aEvt;
     461         [ +  - ]:        583 :     aEvt.Source = (::com::sun::star::uno::XAggregation*)(::cppu::OWeakAggObject*)this;
     462         [ +  - ]:        583 :     maDisposeListeners.disposeAndClear( aEvt );
     463                 :            : 
     464         [ +  - ]:        583 :     BrdcstHelper.aLC.disposeAndClear( aEvt );
     465                 :            : 
     466                 :            :     // let the property set helper notify our property listeners
     467 [ +  - ][ +  - ]:        583 :     OPropertySetHelper::disposing();
                 [ +  - ]
     468                 :        583 : }
     469                 :            : 
     470                 :          0 : void UnoControlModel::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
     471                 :            : {
     472         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     473                 :            : 
     474 [ #  # ][ #  # ]:          0 :     maDisposeListeners.addInterface( rxListener );
     475                 :          0 : }
     476                 :            : 
     477                 :          0 : void UnoControlModel::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
     478                 :            : {
     479         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     480                 :            : 
     481 [ #  # ][ #  # ]:          0 :     maDisposeListeners.removeInterface( rxListener );
     482                 :          0 : }
     483                 :            : 
     484                 :            : 
     485                 :            : // ::com::sun::star::beans::XPropertyState
     486                 :       1982 : ::com::sun::star::beans::PropertyState UnoControlModel::getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
     487                 :            : {
     488         [ +  - ]:       1982 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     489                 :            : 
     490         [ +  - ]:       1982 :     sal_uInt16 nPropId = GetPropertyId( PropertyName );
     491                 :            : 
     492         [ +  - ]:       1982 :     ::com::sun::star::uno::Any aValue = getPropertyValue( PropertyName );
     493         [ +  - ]:       1982 :     ::com::sun::star::uno::Any aDefault = ImplGetDefaultValue( nPropId );
     494                 :            : 
     495 [ +  - ][ +  + ]:       1982 :     return CompareProperties( aValue, aDefault ) ? ::com::sun::star::beans::PropertyState_DEFAULT_VALUE : ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
                 [ +  - ]
     496                 :            : }
     497                 :            : 
     498                 :          0 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > UnoControlModel::getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
     499                 :            : {
     500         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     501                 :            : 
     502                 :          0 :     sal_uInt32 nNames = PropertyNames.getLength();
     503                 :          0 :     const ::rtl::OUString* pNames = PropertyNames.getConstArray();
     504                 :            : 
     505         [ #  # ]:          0 :     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > aStates( nNames );
     506         [ #  # ]:          0 :     ::com::sun::star::beans::PropertyState* pStates = aStates.getArray();
     507                 :            : 
     508         [ #  # ]:          0 :     for ( sal_uInt32 n = 0; n < nNames; n++ )
     509         [ #  # ]:          0 :         pStates[n] = getPropertyState( pNames[n] );
     510                 :            : 
     511         [ #  # ]:          0 :     return aStates;
     512                 :            : }
     513                 :            : 
     514                 :         30 : void UnoControlModel::setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
     515                 :            : {
     516                 :         30 :     Any aDefaultValue;
     517                 :            :     {
     518         [ +  - ]:         30 :         ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     519 [ +  - ][ +  - ]:         30 :         aDefaultValue = ImplGetDefaultValue( GetPropertyId( PropertyName ) );
                 [ +  - ]
     520                 :            :     }
     521         [ +  - ]:         30 :     setPropertyValue( PropertyName, aDefaultValue );
     522                 :         30 : }
     523                 :            : 
     524                 :         30 : ::com::sun::star::uno::Any UnoControlModel::getPropertyDefault( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
     525                 :            : {
     526         [ +  - ]:         30 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     527                 :            : 
     528 [ +  - ][ +  - ]:         30 :     return ImplGetDefaultValue( GetPropertyId( rPropertyName ) );
                 [ +  - ]
     529                 :            : }
     530                 :            : 
     531                 :            : 
     532                 :            : // ::com::sun::star::io::XPersistObjec
     533                 :          0 : ::rtl::OUString UnoControlModel::getServiceName(  ) throw(::com::sun::star::uno::RuntimeException)
     534                 :            : {
     535         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     536                 :            : 
     537                 :            :     OSL_FAIL( "ServiceName von UnoControlModel ?!" );
     538         [ #  # ]:          0 :     return ::rtl::OUString();
     539                 :            : }
     540                 :            : 
     541                 :         80 : void UnoControlModel::write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
     542                 :            : {
     543         [ +  - ]:         80 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     544                 :            : 
     545         [ +  - ]:         80 :     ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( OutStream, ::com::sun::star::uno::UNO_QUERY );
     546                 :            :     DBG_ASSERT( xMark.is(), "write: no ::com::sun::star::io::XMarkableStream!" );
     547                 :            : 
     548 [ +  - ][ +  - ]:         80 :     OutStream->writeShort( UNOCONTROL_STREAMVERSION );
     549                 :            : 
     550         [ +  - ]:         80 :     std::set<sal_uInt16> aProps;
     551                 :            : 
     552         [ +  + ]:       2118 :     for (ImplPropertyTable::const_iterator it = maData.begin(); it != maData.end(); ++it )
     553                 :            :     {
     554 [ +  - ][ +  + ]:       3960 :         if ( ( ( GetPropertyAttribs( it->first ) & ::com::sun::star::beans::PropertyAttribute::TRANSIENT ) == 0 )
         [ +  + ][ +  + ]
     555 [ +  - ][ +  - ]:       1922 :             && ( getPropertyState( GetPropertyName( it->first ) ) != ::com::sun::star::beans::PropertyState_DEFAULT_VALUE ) )
     556                 :            :         {
     557         [ +  - ]:         58 :             aProps.insert( it->first );
     558                 :            :         }
     559                 :            :     }
     560                 :            : 
     561                 :         80 :     sal_uInt32 nProps = aProps.size();
     562                 :            : 
     563                 :            :     // Save FontProperty always in the old format (due to missing distinction
     564                 :            :     // between 5.0 and 5.1)
     565 [ +  - ][ +  - ]:         80 :     OutStream->writeLong( (long) ( aProps.find( BASEPROPERTY_FONTDESCRIPTOR ) != aProps.end() ) ? ( nProps + 3 ) : nProps );
         [ +  + ][ +  - ]
                 [ +  - ]
     566 [ +  - ][ +  - ]:        138 :     for ( std::set<sal_uInt16>::const_iterator it = aProps.begin(); it != aProps.end(); ++it )
                 [ +  + ]
     567                 :            :     {
     568 [ +  - ][ +  - ]:         58 :         sal_Int32 nPropDataBeginMark = xMark->createMark();
     569 [ +  - ][ +  - ]:         58 :         OutStream->writeLong( 0L ); // DataLen
     570                 :            : 
     571 [ +  - ][ +  - ]:         58 :         const ::com::sun::star::uno::Any* pProp = &(maData[*it]);
     572 [ +  - ][ +  - ]:         58 :         OutStream->writeShort( *it );
                 [ +  - ]
     573                 :            : 
     574                 :         58 :         sal_Bool bVoid = pProp->getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
     575                 :            : 
     576 [ +  - ][ +  - ]:         58 :         OutStream->writeBoolean( bVoid );
     577                 :            : 
     578         [ +  - ]:         58 :         if ( !bVoid )
     579                 :            :         {
     580                 :         58 :             const ::com::sun::star::uno::Any& rValue = *pProp;
     581                 :         58 :             const ::com::sun::star::uno::Type& rType = rValue.getValueType();
     582                 :            : 
     583 [ +  + ][ +  - ]:         58 :             if ( rType == ::getBooleanCppuType() )
     584                 :            :             {
     585                 :         10 :                 sal_Bool b = false;
     586                 :         10 :                 rValue >>= b;
     587 [ +  - ][ +  - ]:         10 :                 OutStream->writeBoolean( b );
     588                 :            :             }
     589 [ +  - ][ +  + ]:         48 :             else if ( rType == ::getCppuType((const ::rtl::OUString*)0) )
     590                 :            :             {
     591                 :         38 :                 ::rtl::OUString aUString;
     592                 :         38 :                 rValue >>= aUString;
     593 [ +  - ][ +  - ]:         38 :                 OutStream->writeUTF( aUString );
     594                 :            :             }
     595 [ +  - ][ -  + ]:         10 :             else if ( rType == ::getCppuType((const sal_uInt16*)0) )
     596                 :            :             {
     597                 :          0 :                 sal_uInt16 n = 0;
     598                 :          0 :                 rValue >>= n;
     599 [ #  # ][ #  # ]:          0 :                 OutStream->writeShort( n );
     600                 :            :             }
     601 [ +  - ][ -  + ]:         10 :             else if ( rType == ::getCppuType((const sal_Int16*)0) )
     602                 :            :             {
     603                 :          0 :                 sal_Int16 n = 0;
     604                 :          0 :                 rValue >>= n;
     605 [ #  # ][ #  # ]:          0 :                 OutStream->writeShort( n );
     606                 :            :             }
     607 [ +  - ][ -  + ]:         10 :             else if ( rType == ::getCppuType((const sal_uInt32*)0) )
     608                 :            :             {
     609                 :          0 :                 sal_uInt32 n = 0;
     610                 :          0 :                 rValue >>= n;
     611 [ #  # ][ #  # ]:          0 :                 OutStream->writeLong( n );
     612                 :            :             }
     613 [ +  - ][ +  + ]:         10 :             else if ( rType == ::getCppuType((const sal_Int32*)0) )
     614                 :            :             {
     615                 :          6 :                 sal_Int32 n = 0;
     616                 :          6 :                 rValue >>= n;
     617 [ +  - ][ +  - ]:          6 :                 OutStream->writeLong( n );
     618                 :            :             }
     619 [ +  - ][ -  + ]:          4 :             else if ( rType == ::getCppuType((const double*)0) )
     620                 :            :             {
     621                 :          0 :                 double n = 0;
     622                 :          0 :                 rValue >>= n;
     623 [ #  # ][ #  # ]:          0 :                 OutStream->writeDouble( n );
     624                 :            :             }
     625 [ +  - ][ +  - ]:          4 :             else if ( rType == ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0) )
     626                 :            :             {
     627                 :          4 :                 ::com::sun::star::awt::FontDescriptor aFD;
     628         [ +  - ]:          4 :                 rValue >>= aFD;
     629 [ +  - ][ +  - ]:          4 :                 OutStream->writeUTF( aFD.Name );
     630 [ +  - ][ +  - ]:          4 :                 OutStream->writeShort( aFD.Height );
     631 [ +  - ][ +  - ]:          4 :                 OutStream->writeShort( aFD.Width );
     632 [ +  - ][ +  - ]:          4 :                 OutStream->writeUTF( aFD.StyleName );
     633 [ +  - ][ +  - ]:          4 :                 OutStream->writeShort( aFD.Family );
     634 [ +  - ][ +  - ]:          4 :                 OutStream->writeShort( aFD.CharSet );
     635 [ +  - ][ +  - ]:          4 :                 OutStream->writeShort( aFD.Pitch );
     636 [ +  - ][ +  - ]:          4 :                 OutStream->writeDouble( aFD.CharacterWidth );
     637 [ +  - ][ +  - ]:          4 :                 OutStream->writeDouble( aFD.Weight );
     638         [ +  - ]:          4 :                 OutStream->writeShort(
     639         [ +  - ]:          4 :                     sal::static_int_cast< sal_Int16 >(aFD.Slant) );
     640 [ +  - ][ +  - ]:          4 :                 OutStream->writeShort( aFD.Underline );
     641 [ +  - ][ +  - ]:          4 :                 OutStream->writeShort( aFD.Strikeout );
     642 [ +  - ][ +  - ]:          4 :                 OutStream->writeDouble( aFD.Orientation );
     643 [ +  - ][ +  - ]:          4 :                 OutStream->writeBoolean( aFD.Kerning );
     644 [ +  - ][ +  - ]:          4 :                 OutStream->writeBoolean( aFD.WordLineMode );
     645 [ +  - ][ +  - ]:          4 :                 OutStream->writeShort( aFD.Type );
     646                 :            :             }
     647 [ #  # ][ #  # ]:          0 :             else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence< ::rtl::OUString>*)0 ) )
     648                 :            :             {
     649         [ #  # ]:          0 :                 ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
     650         [ #  # ]:          0 :                 rValue >>= aSeq;
     651                 :          0 :                 long nEntries = aSeq.getLength();
     652 [ #  # ][ #  # ]:          0 :                 OutStream->writeLong( nEntries );
     653         [ #  # ]:          0 :                 for ( long n = 0; n < nEntries; n++ )
     654 [ #  # ][ #  # ]:          0 :                     OutStream->writeUTF( aSeq.getConstArray()[n] );
                 [ #  # ]
     655                 :            :             }
     656 [ #  # ][ #  # ]:          0 :             else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_uInt16>*)0 ) )
     657                 :            :             {
     658         [ #  # ]:          0 :                 ::com::sun::star::uno::Sequence<sal_uInt16> aSeq;
     659         [ #  # ]:          0 :                 rValue >>= aSeq;
     660                 :          0 :                 long nEntries = aSeq.getLength();
     661 [ #  # ][ #  # ]:          0 :                 OutStream->writeLong( nEntries );
     662         [ #  # ]:          0 :                 for ( long n = 0; n < nEntries; n++ )
     663 [ #  # ][ #  # ]:          0 :                     OutStream->writeShort( aSeq.getConstArray()[n] );
                 [ #  # ]
     664                 :            :             }
     665 [ #  # ][ #  # ]:          0 :             else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_Int16>*)0 ) )
     666                 :            :             {
     667         [ #  # ]:          0 :                 ::com::sun::star::uno::Sequence<sal_Int16> aSeq;
     668         [ #  # ]:          0 :                 rValue >>= aSeq;
     669                 :          0 :                 long nEntries = aSeq.getLength();
     670 [ #  # ][ #  # ]:          0 :                 OutStream->writeLong( nEntries );
     671         [ #  # ]:          0 :                 for ( long n = 0; n < nEntries; n++ )
     672 [ #  # ][ #  # ]:          0 :                     OutStream->writeShort( aSeq.getConstArray()[n] );
                 [ #  # ]
     673                 :            :             }
     674         [ #  # ]:          0 :             else if ( rType.getTypeClass() == TypeClass_ENUM )
     675                 :            :             {
     676                 :          0 :                 sal_Int32 nAsInt = 0;
     677                 :          0 :                 ::cppu::enum2int( nAsInt, rValue );
     678 [ #  # ][ #  # ]:          0 :                 OutStream->writeLong( nAsInt );
     679                 :            :             }
     680                 :            : #if OSL_DEBUG_LEVEL > 0
     681                 :            :             else
     682                 :            :             {
     683                 :            :                 ::rtl::OString sMessage( "UnoControlModel::write: don't know how to handle a property of type '" );
     684                 :            :                 ::rtl::OUString sTypeName( rType.getTypeName() );
     685                 :            :                 sMessage += ::rtl::OString( sTypeName.getStr(), sTypeName.getLength(), RTL_TEXTENCODING_ASCII_US );
     686                 :            :                 sMessage += "'.\n(Currently handling property '";
     687                 :            :                 ::rtl::OUString sPropertyName( GetPropertyName( *it ) );
     688                 :            :                 sMessage += ::rtl::OString( sPropertyName.getStr(), sPropertyName.getLength(), osl_getThreadTextEncoding() );
     689                 :            :                 sMessage += "'.)";
     690                 :            :                 OSL_FAIL( sMessage.getStr() );
     691                 :            :             }
     692                 :            : #endif
     693                 :            :         }
     694                 :            : 
     695 [ +  - ][ +  - ]:         58 :         sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark );
     696 [ +  - ][ +  - ]:         58 :         xMark->jumpToMark( nPropDataBeginMark );
     697 [ +  - ][ +  - ]:         58 :         OutStream->writeLong( nPropDataLen );
     698 [ +  - ][ +  - ]:         58 :         xMark->jumpToFurthest();
     699 [ +  - ][ +  - ]:         58 :         xMark->deleteMark(nPropDataBeginMark);
     700                 :            :     }
     701                 :            : 
     702 [ +  - ][ +  - ]:         80 :     if ( aProps.find( BASEPROPERTY_FONTDESCRIPTOR ) != aProps.end() )
                 [ +  + ]
     703                 :            :     {
     704         [ +  - ]:          4 :         const ::com::sun::star::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ];
     705                 :            :         // Until 5.0 export arrives, write old format..
     706                 :          4 :         ::com::sun::star::awt::FontDescriptor aFD;
     707         [ +  - ]:          4 :         (*pProp) >>= aFD;
     708                 :            : 
     709         [ +  + ]:         16 :         for ( sal_uInt16 n = BASEPROPERTY_FONT_TYPE; n <= BASEPROPERTY_FONT_ATTRIBS; n++ )
     710                 :            :         {
     711 [ +  - ][ +  - ]:         12 :             sal_Int32 nPropDataBeginMark = xMark->createMark();
     712 [ +  - ][ +  - ]:         12 :             OutStream->writeLong( 0L ); // DataLen
     713 [ +  - ][ +  - ]:         12 :             OutStream->writeShort( n ); // PropId
     714 [ +  - ][ +  - ]:         12 :             OutStream->writeBoolean( sal_False );   // Void
     715                 :            : 
     716         [ +  + ]:         12 :             if ( n == BASEPROPERTY_FONT_TYPE )
     717                 :            :             {
     718 [ +  - ][ +  - ]:          4 :                 OutStream->writeUTF( aFD.Name );
     719 [ +  - ][ +  - ]:          4 :                 OutStream->writeUTF( aFD.StyleName );
     720 [ +  - ][ +  - ]:          4 :                 OutStream->writeShort( aFD.Family );
     721 [ +  - ][ +  - ]:          4 :                 OutStream->writeShort( aFD.CharSet );
     722 [ +  - ][ +  - ]:          4 :                 OutStream->writeShort( aFD.Pitch );
     723                 :            :             }
     724         [ +  + ]:          8 :             else if ( n == BASEPROPERTY_FONT_SIZE )
     725                 :            :             {
     726 [ +  - ][ +  - ]:          4 :                 OutStream->writeLong( aFD.Width );
     727 [ +  - ][ +  - ]:          4 :                 OutStream->writeLong( aFD.Height );
     728         [ +  - ]:          4 :                 OutStream->writeShort(
     729                 :            :                     sal::static_int_cast< sal_Int16 >(
     730 [ +  - ][ +  - ]:          4 :                         VCLUnoHelper::ConvertFontWidth( aFD.CharacterWidth )) );
     731                 :            :             }
     732         [ +  - ]:          4 :             else if ( n == BASEPROPERTY_FONT_ATTRIBS )
     733                 :            :             {
     734         [ +  - ]:          4 :                 OutStream->writeShort(
     735                 :            :                     sal::static_int_cast< sal_Int16 >(
     736 [ +  - ][ +  - ]:          4 :                         VCLUnoHelper::ConvertFontWeight( aFD.Weight )) );
     737         [ +  - ]:          4 :                 OutStream->writeShort(
     738         [ +  - ]:          4 :                     sal::static_int_cast< sal_Int16 >(aFD.Slant) );
     739 [ +  - ][ +  - ]:          4 :                 OutStream->writeShort( aFD.Underline );
     740 [ +  - ][ +  - ]:          4 :                 OutStream->writeShort( aFD.Strikeout );
     741 [ +  - ][ +  - ]:          4 :                 OutStream->writeShort( (short)(aFD.Orientation * 10) );
     742 [ +  - ][ +  - ]:          4 :                 OutStream->writeBoolean( aFD.Kerning );
     743 [ +  - ][ +  - ]:          4 :                 OutStream->writeBoolean( aFD.WordLineMode );
     744                 :            :             }
     745                 :            :             else
     746                 :            :             {
     747                 :            :                 OSL_FAIL( "Property?!" );
     748                 :            :             }
     749                 :            : 
     750 [ +  - ][ +  - ]:         12 :             sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark );
     751 [ +  - ][ +  - ]:         12 :             xMark->jumpToMark( nPropDataBeginMark );
     752 [ +  - ][ +  - ]:         12 :             OutStream->writeLong( nPropDataLen );
     753 [ +  - ][ +  - ]:         12 :             xMark->jumpToFurthest();
     754 [ +  - ][ +  - ]:         12 :             xMark->deleteMark(nPropDataBeginMark);
     755                 :          4 :         }
     756         [ +  - ]:         80 :     }
     757                 :         80 : }
     758                 :            : 
     759                 :         80 : void UnoControlModel::read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
     760                 :            : {
     761         [ +  - ]:         80 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     762                 :            : 
     763         [ +  - ]:         80 :     ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( InStream, ::com::sun::star::uno::UNO_QUERY );
     764                 :            :     DBG_ASSERT( xMark.is(), "read: no ::com::sun::star::io::XMarkableStream!" );
     765                 :            : 
     766 [ +  - ][ +  - ]:         80 :     short nVersion = InStream->readShort();
     767 [ +  - ][ +  - ]:         80 :     sal_uInt32 nProps = (sal_uInt32)InStream->readLong();
     768         [ +  - ]:         80 :     ::com::sun::star::uno::Sequence< ::rtl::OUString> aProps( nProps );
     769         [ +  - ]:         80 :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> aValues( nProps );
     770                 :         80 :     sal_Bool bInvalidEntries = sal_False;
     771                 :            : 
     772                 :            :     // Unfortunately, there's no mark for the whole block, thus only properties may be changed.
     773                 :            :     // No data for the model may be added following the properties
     774                 :            : 
     775                 :            :     // Used for import of old parts in ::com::sun::star::awt::FontDescriptor
     776                 :         80 :     ::com::sun::star::awt::FontDescriptor* pFD = NULL;
     777                 :            : 
     778                 :            :     sal_uInt32 i;
     779         [ +  + ]:        150 :     for ( i = 0; i < nProps; i++ )
     780                 :            :     {
     781 [ +  - ][ +  - ]:         70 :         sal_Int32 nPropDataBeginMark = xMark->createMark();
     782 [ +  - ][ +  - ]:         70 :         sal_Int32 nPropDataLen = InStream->readLong();
     783                 :            : 
     784 [ +  - ][ +  - ]:         70 :         sal_uInt16 nPropId = (sal_uInt16)InStream->readShort();
     785                 :            : 
     786                 :         70 :         ::com::sun::star::uno::Any aValue;
     787 [ +  - ][ +  - ]:         70 :         sal_Bool bIsVoid = InStream->readBoolean();
     788         [ +  - ]:         70 :         if ( !bIsVoid )
     789                 :            :         {
     790 [ +  - ][ +  + ]:         70 :             if ( maData.find( nPropId ) != maData.end() )
     791                 :            :             {
     792         [ +  - ]:         58 :                 const ::com::sun::star::uno::Type* pType = GetPropertyType( nPropId );
     793 [ +  - ][ +  + ]:         58 :                 if ( *pType == ::getBooleanCppuType() )
     794                 :            :                 {
     795 [ +  - ][ +  - ]:         10 :                     sal_Bool b = InStream->readBoolean();
     796         [ +  - ]:         10 :                     aValue <<= b;
     797                 :            :                 }
     798 [ +  - ][ +  + ]:         48 :                 else if ( *pType == ::getCppuType((const ::rtl::OUString*)0) )
     799                 :            :                 {
     800 [ +  - ][ +  - ]:         38 :                     ::rtl::OUString aUTF = InStream->readUTF();
     801         [ +  - ]:         38 :                     aValue <<= aUTF;
     802                 :            :                 }
     803 [ +  - ][ -  + ]:         10 :                 else if ( *pType == ::getCppuType((const sal_uInt16*)0) )
     804                 :            :                 {
     805 [ #  # ][ #  # ]:          0 :                     sal_uInt16 n = InStream->readShort();
     806         [ #  # ]:          0 :                     aValue <<= n;
     807                 :            :                 }
     808 [ +  - ][ -  + ]:         10 :                 else if ( *pType == ::getCppuType((const sal_Int16*)0) )
     809                 :            :                 {
     810 [ #  # ][ #  # ]:          0 :                     sal_Int16 n = InStream->readShort();
     811         [ #  # ]:          0 :                     aValue <<= n;
     812                 :            :                 }
     813 [ +  - ][ -  + ]:         10 :                 else if ( *pType == ::getCppuType((const sal_uInt32*)0) )
     814                 :            :                 {
     815 [ #  # ][ #  # ]:          0 :                     sal_uInt32 n = InStream->readLong();
     816         [ #  # ]:          0 :                     aValue <<= n;
     817                 :            :                 }
     818 [ +  - ][ +  + ]:         10 :                 else if ( *pType == ::getCppuType((const sal_Int32*)0) )
     819                 :            :                 {
     820 [ +  - ][ +  - ]:          6 :                     sal_Int32 n = InStream->readLong();
     821         [ +  - ]:          6 :                     aValue <<= n;
     822                 :            :                 }
     823 [ +  - ][ -  + ]:          4 :                 else if ( *pType == ::getCppuType((const double*)0) )
     824                 :            :                 {
     825 [ #  # ][ #  # ]:          0 :                     double n = InStream->readDouble();
     826         [ #  # ]:          0 :                     aValue <<= n;
     827                 :            :                 }
     828 [ +  - ][ +  - ]:          4 :                 else if ( *pType == ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0) )
     829                 :            :                 {
     830                 :          4 :                     ::com::sun::star::awt::FontDescriptor aFD;
     831 [ +  - ][ +  - ]:          4 :                     aFD.Name = InStream->readUTF();
     832 [ +  - ][ +  - ]:          4 :                     aFD.Height = InStream->readShort();
     833 [ +  - ][ +  - ]:          4 :                     aFD.Width = InStream->readShort();
     834 [ +  - ][ +  - ]:          4 :                     aFD.StyleName = InStream->readUTF();
     835 [ +  - ][ +  - ]:          4 :                     aFD.Family = InStream->readShort();
     836 [ +  - ][ +  - ]:          4 :                     aFD.CharSet = InStream->readShort();
     837 [ +  - ][ +  - ]:          4 :                     aFD.Pitch = InStream->readShort();
     838 [ +  - ][ +  - ]:          4 :                     aFD.CharacterWidth = (float)InStream->readDouble();
     839 [ +  - ][ +  - ]:          4 :                     aFD.Weight = (float)InStream->readDouble();
     840 [ +  - ][ +  - ]:          4 :                     aFD.Slant =  (::com::sun::star::awt::FontSlant)InStream->readShort();
     841 [ +  - ][ +  - ]:          4 :                     aFD.Underline = InStream->readShort();
     842 [ +  - ][ +  - ]:          4 :                     aFD.Strikeout = InStream->readShort();
     843 [ +  - ][ +  - ]:          4 :                     aFD.Orientation = (float)InStream->readDouble();
     844 [ +  - ][ +  - ]:          4 :                     aFD.Kerning = InStream->readBoolean();
     845 [ +  - ][ +  - ]:          4 :                     aFD.WordLineMode = InStream->readBoolean();
     846 [ +  - ][ +  - ]:          4 :                     aFD.Type = InStream->readShort();
     847         [ +  - ]:          4 :                     aValue <<= aFD;
     848                 :            :                 }
     849 [ #  # ][ #  # ]:          0 :                 else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence< ::rtl::OUString>*)0 ) )
     850                 :            :                 {
     851 [ #  # ][ #  # ]:          0 :                     long nEntries = InStream->readLong();
     852         [ #  # ]:          0 :                     ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nEntries );
     853         [ #  # ]:          0 :                     for ( long n = 0; n < nEntries; n++ )
     854 [ #  # ][ #  # ]:          0 :                         aSeq.getArray()[n] = InStream->readUTF();
                 [ #  # ]
     855 [ #  # ][ #  # ]:          0 :                     aValue <<= aSeq;
     856                 :            : 
     857                 :            :                 }
     858 [ #  # ][ #  # ]:          0 :                 else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_uInt16>*)0 ) )
     859                 :            : 
     860                 :            :                 {
     861 [ #  # ][ #  # ]:          0 :                     long nEntries = InStream->readLong();
     862         [ #  # ]:          0 :                     ::com::sun::star::uno::Sequence<sal_uInt16> aSeq( nEntries );
     863         [ #  # ]:          0 :                     for ( long n = 0; n < nEntries; n++ )
     864 [ #  # ][ #  # ]:          0 :                         aSeq.getArray()[n] = (sal_uInt16)InStream->readShort();
                 [ #  # ]
     865 [ #  # ][ #  # ]:          0 :                     aValue <<= aSeq;
     866                 :            :                 }
     867 [ #  # ][ #  # ]:          0 :                 else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_Int16>*)0 ) )
     868                 :            :                 {
     869 [ #  # ][ #  # ]:          0 :                     long nEntries = InStream->readLong();
     870         [ #  # ]:          0 :                     ::com::sun::star::uno::Sequence<sal_Int16> aSeq( nEntries );
     871         [ #  # ]:          0 :                     for ( long n = 0; n < nEntries; n++ )
     872 [ #  # ][ #  # ]:          0 :                         aSeq.getArray()[n] = (sal_Int16)InStream->readShort();
                 [ #  # ]
     873 [ #  # ][ #  # ]:          0 :                     aValue <<= aSeq;
     874                 :            :                 }
     875         [ #  # ]:          0 :                 else if ( pType->getTypeClass() == TypeClass_ENUM )
     876                 :            :                 {
     877 [ #  # ][ #  # ]:          0 :                     sal_Int32 nAsInt = InStream->readLong();
     878                 :          0 :                     aValue = ::cppu::int2enum( nAsInt, *pType );
     879                 :            :                 }
     880                 :            :                 else
     881                 :            :                 {
     882                 :          0 :                     ::rtl::OString sMessage( "UnoControlModel::read: don't know how to handle a property of type '" );
     883                 :          0 :                     ::rtl::OUString sTypeName( pType->getTypeName() );
     884         [ #  # ]:          0 :                     sMessage += ::rtl::OString( sTypeName.getStr(), sTypeName.getLength(), RTL_TEXTENCODING_ASCII_US );
     885                 :          0 :                     sMessage += "'.\n(Currently handling property '";
     886         [ #  # ]:          0 :                     ::rtl::OUString sPropertyName( GetPropertyName( nPropId ) );
     887 [ #  # ][ #  # ]:          0 :                     sMessage += ::rtl::OString( sPropertyName.getStr(), sPropertyName.getLength(), osl_getThreadTextEncoding() );
     888                 :          0 :                     sMessage += "'.)";
     889                 :          0 :                     OSL_FAIL( sMessage.getStr() );
     890                 :            :                 }
     891                 :            :             }
     892                 :            :             else
     893                 :            :             {
     894                 :            :                 // Old trash from 5.0
     895         [ +  + ]:         12 :                 if ( nPropId == BASEPROPERTY_FONT_TYPE )
     896                 :            :                 {
     897                 :            :                     // Redundant information for older versions
     898                 :            :                     // is skipped by MarkableStream
     899         [ -  + ]:          4 :                     if ( nVersion < 2 )
     900                 :            :                     {
     901         [ #  # ]:          0 :                         if ( !pFD )
     902                 :            :                         {
     903         [ #  # ]:          0 :                             pFD = new ::com::sun::star::awt::FontDescriptor;
     904 [ #  # ][ #  # ]:          0 :                             if ( maData.find( BASEPROPERTY_FONTDESCRIPTOR ) != maData.end() ) // wegen den Defaults...
     905 [ #  # ][ #  # ]:          0 :                                 maData[ BASEPROPERTY_FONTDESCRIPTOR ] >>= *pFD;
     906                 :            :                         }
     907 [ #  # ][ #  # ]:          0 :                         pFD->Name = InStream->readUTF();
     908 [ #  # ][ #  # ]:          0 :                         pFD->StyleName = InStream->readUTF();
     909 [ #  # ][ #  # ]:          0 :                         pFD->Family = InStream->readShort();
     910 [ #  # ][ #  # ]:          0 :                         pFD->CharSet = InStream->readShort();
     911 [ #  # ][ #  # ]:          0 :                         pFD->Pitch = InStream->readShort();
     912                 :            :                     }
     913                 :            :                 }
     914         [ +  + ]:          8 :                 else if ( nPropId == BASEPROPERTY_FONT_SIZE )
     915                 :            :                 {
     916         [ -  + ]:          4 :                     if ( nVersion < 2 )
     917                 :            :                     {
     918         [ #  # ]:          0 :                         if ( !pFD )
     919                 :            :                         {
     920         [ #  # ]:          0 :                             pFD = new ::com::sun::star::awt::FontDescriptor;
     921 [ #  # ][ #  # ]:          0 :                             if ( maData.find(BASEPROPERTY_FONTDESCRIPTOR) != maData.end() ) // due to defaults...
     922 [ #  # ][ #  # ]:          0 :                                 maData[BASEPROPERTY_FONTDESCRIPTOR] >>= *pFD;
     923                 :            :                         }
     924 [ #  # ][ #  # ]:          0 :                         pFD->Width = (sal_Int16)InStream->readLong();
     925 [ #  # ][ #  # ]:          0 :                         pFD->Height = (sal_Int16)InStream->readLong();
     926 [ #  # ][ #  # ]:          0 :                         InStream->readShort(); // ignore ::com::sun::star::awt::FontWidth - it was
     927                 :            :                                                // misspelled and is no longer needed
     928                 :          0 :                         pFD->CharacterWidth = ::com::sun::star::awt::FontWidth::DONTKNOW;
     929                 :            :                     }
     930                 :            :                 }
     931         [ +  - ]:          4 :                 else if ( nPropId == BASEPROPERTY_FONT_ATTRIBS )
     932                 :            :                 {
     933         [ -  + ]:          4 :                     if ( nVersion < 2 )
     934                 :            :                     {
     935         [ #  # ]:          0 :                          if ( !pFD )
     936                 :            :                         {
     937         [ #  # ]:          0 :                             pFD = new ::com::sun::star::awt::FontDescriptor;
     938 [ #  # ][ #  # ]:          0 :                             if ( maData.find(BASEPROPERTY_FONTDESCRIPTOR) != maData.end() ) // due to defaults...
     939 [ #  # ][ #  # ]:          0 :                                 maData[BASEPROPERTY_FONTDESCRIPTOR] >>= *pFD;
     940                 :            :                         }
     941 [ #  # ][ #  # ]:          0 :                         pFD->Weight = VCLUnoHelper::ConvertFontWeight( (FontWeight) InStream->readShort() );
                 [ #  # ]
     942 [ #  # ][ #  # ]:          0 :                         pFD->Slant =  (::com::sun::star::awt::FontSlant)InStream->readShort();
     943 [ #  # ][ #  # ]:          0 :                         pFD->Underline = InStream->readShort();
     944 [ #  # ][ #  # ]:          0 :                         pFD->Strikeout = InStream->readShort();
     945 [ #  # ][ #  # ]:          0 :                         pFD->Orientation = ( (float)(double)InStream->readShort() ) / 10;
     946 [ #  # ][ #  # ]:          0 :                         pFD->Kerning = InStream->readBoolean();
     947 [ #  # ][ #  # ]:          0 :                         pFD->WordLineMode = InStream->readBoolean();
     948                 :            :                     }
     949                 :            :                 }
     950                 :            :                 else
     951                 :            :                 {
     952                 :            :                     OSL_FAIL( "read: unknown Property!" );
     953                 :            :                 }
     954                 :            :             }
     955                 :            :         }
     956                 :            :         else // bVoid
     957                 :            :         {
     958         [ #  # ]:          0 :             if ( nPropId == BASEPROPERTY_FONTDESCRIPTOR )
     959                 :            :             {
     960                 :          0 :                 EmptyFontDescriptor aFD;
     961         [ #  # ]:          0 :                 aValue <<= aFD;
     962                 :            :             }
     963                 :            :         }
     964                 :            : 
     965 [ +  - ][ +  + ]:         70 :         if ( maData.find( nPropId ) != maData.end() )
     966                 :            :         {
     967 [ +  - ][ +  - ]:         58 :             aProps.getArray()[i] = GetPropertyName( nPropId );
     968         [ +  - ]:         58 :             aValues.getArray()[i] = aValue;
     969                 :            :         }
     970                 :            :         else
     971                 :            :         {
     972                 :         12 :             bInvalidEntries = sal_True;
     973                 :            :         }
     974                 :            : 
     975                 :            :         // Skip rest of input if there is more data in stream than this version can handle
     976 [ +  - ][ +  - ]:         70 :         xMark->jumpToMark( nPropDataBeginMark );
     977 [ +  - ][ +  - ]:         70 :         InStream->skipBytes( nPropDataLen );
     978 [ +  - ][ +  - ]:         70 :         xMark->deleteMark(nPropDataBeginMark);
     979         [ #  # ]:         70 :     }
     980         [ +  + ]:         80 :     if ( bInvalidEntries )
     981                 :            :     {
     982         [ +  + ]:         26 :         for ( i = 0; i < (sal_uInt32)aProps.getLength(); i++ )
     983                 :            :         {
     984         [ +  + ]:         22 :             if ( aProps.getConstArray()[i].isEmpty() )
     985                 :            :             {
     986         [ +  - ]:         12 :                 ::comphelper::removeElementAt( aProps, i );
     987         [ +  - ]:         12 :                 ::comphelper::removeElementAt( aValues, i );
     988                 :         12 :                 i--;
     989                 :            :             }
     990                 :            :         }
     991                 :            :     }
     992                 :            : 
     993                 :            :     try
     994                 :            :     {
     995         [ +  - ]:         80 :         setPropertyValues( aProps, aValues );
     996                 :            :     }
     997         [ #  # ]:          0 :     catch ( const Exception& )
     998                 :            :     {
     999                 :            :         DBG_UNHANDLED_EXCEPTION();
    1000                 :            :     }
    1001                 :            : 
    1002         [ -  + ]:         80 :     if ( pFD )
    1003                 :            :     {
    1004                 :          0 :         ::com::sun::star::uno::Any aValue;
    1005         [ #  # ]:          0 :         aValue <<= *pFD;
    1006 [ #  # ][ #  # ]:          0 :         setPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ), aValue );
    1007         [ #  # ]:          0 :         delete pFD;
    1008 [ +  - ][ +  - ]:         80 :     }
                 [ +  - ]
    1009                 :         80 : }
    1010                 :            : 
    1011                 :            : 
    1012                 :            : // ::com::sun::star::lang::XServiceInfo
    1013                 :          0 : ::rtl::OUString UnoControlModel::getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException)
    1014                 :            : {
    1015                 :            :     OSL_FAIL( "This method should be overloaded!" );
    1016                 :          0 :     return ::rtl::OUString();
    1017                 :            : 
    1018                 :            : }
    1019                 :            : 
    1020                 :        140 : sal_Bool UnoControlModel::supportsService( const ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException)
    1021                 :            : {
    1022         [ +  - ]:        140 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
    1023                 :            : 
    1024         [ +  - ]:        140 :     ::com::sun::star::uno::Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
    1025                 :        140 :     const ::rtl::OUString * pArray = aSNL.getConstArray();
    1026         [ +  + ]:        264 :     for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
    1027         [ +  + ]:        218 :         if( pArray[i] == rServiceName )
    1028                 :         94 :             return sal_True;
    1029 [ +  - ][ +  - ]:        140 :     return sal_False;
    1030                 :            : }
    1031                 :            : 
    1032                 :        336 : ::com::sun::star::uno::Sequence< ::rtl::OUString > UnoControlModel::getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException)
    1033                 :            : {
    1034         [ +  - ]:        336 :     ::rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlModel" ) );
    1035         [ +  - ]:        336 :     return Sequence< ::rtl::OUString >( &sName, 1 );
    1036                 :            : }
    1037                 :            : 
    1038                 :            : // ------------------------------------------------------------------
    1039                 :            : template <class TYPE>
    1040                 :            : sal_Bool convertType(Any& _rConvertedValue, const Any& _rNewValueTest, const TYPE* /* _pTypeDisambiguation */)
    1041                 :            : {
    1042                 :            :     TYPE tValue;
    1043                 :            :     if (_rNewValueTest >>= tValue)
    1044                 :            :     {
    1045                 :            :         _rConvertedValue <<= tValue;
    1046                 :            :         return sal_True;
    1047                 :            :     }
    1048                 :            : }
    1049                 :            : 
    1050                 :            : // ..................................................................
    1051                 :      61176 : sal_Bool UnoControlModel::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nPropId, const Any& rValue ) throw (IllegalArgumentException)
    1052                 :            : {
    1053         [ +  - ]:      61176 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
    1054                 :            : 
    1055                 :      61176 :     sal_Bool bVoid = rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
    1056         [ +  + ]:      61176 :     if ( bVoid )
    1057                 :            :     {
    1058                 :        119 :         rConvertedValue.clear();
    1059                 :            :     }
    1060                 :            :     else
    1061                 :            :     {
    1062         [ +  - ]:      61057 :         const ::com::sun::star::uno::Type* pDestType = GetPropertyType( (sal_uInt16)nPropId );
    1063         [ +  + ]:      61057 :         if ( pDestType->getTypeClass() == TypeClass_ANY )
    1064                 :            :         {
    1065                 :         32 :             rConvertedValue = rValue;
    1066                 :            :         }
    1067                 :            :         else
    1068                 :            :         {
    1069         [ +  + ]:      61025 :             if ( pDestType->equals( rValue.getValueType() ) )
    1070                 :            :             {
    1071                 :      60943 :                 rConvertedValue = rValue;
    1072                 :            :             }
    1073                 :            :             else
    1074                 :            :             {
    1075                 :         82 :                 sal_Bool bConverted = sal_False;
    1076                 :            :                 // 13.03.2001 - 84923 - frank.schoenheit@germany.sun.com
    1077                 :            : 
    1078   [ +  -  -  -  :         82 :                 switch (pDestType->getTypeClass())
             -  +  -  + ]
    1079                 :            :                 {
    1080                 :            :                     case TypeClass_DOUBLE:
    1081                 :            :                     {
    1082                 :            :                         // try as double
    1083                 :         12 :                         double nAsDouble = 0;
    1084                 :         12 :                         bConverted = ( rValue >>= nAsDouble );
    1085         [ +  + ]:         12 :                         if ( bConverted )
    1086         [ +  - ]:          8 :                             rConvertedValue <<= nAsDouble;
    1087                 :            :                         else
    1088                 :            :                         {   // try as integer
    1089                 :          4 :                             sal_Int32 nAsInteger = 0;
    1090                 :          4 :                             bConverted = ( rValue >>= nAsInteger );
    1091         [ -  + ]:          4 :                             if ( bConverted )
    1092         [ #  # ]:          4 :                                 rConvertedValue <<= (double)nAsInteger;
    1093                 :            :                         }
    1094                 :            :                     }
    1095                 :         12 :                     break;
    1096                 :            :                     case TypeClass_SHORT:
    1097                 :            :                     {
    1098                 :            :                         sal_Int16 n;
    1099                 :          0 :                         bConverted = ( rValue >>= n );
    1100         [ #  # ]:          0 :                         if ( bConverted )
    1101         [ #  # ]:          0 :                             rConvertedValue <<= n;
    1102                 :            :                     }
    1103                 :          0 :                     break;
    1104                 :            :                     case TypeClass_UNSIGNED_SHORT:
    1105                 :            :                     {
    1106                 :            :                         sal_uInt16 n;
    1107                 :          0 :                         bConverted = ( rValue >>= n );
    1108         [ #  # ]:          0 :                         if ( bConverted )
    1109         [ #  # ]:          0 :                             rConvertedValue <<= n;
    1110                 :            :                     }
    1111                 :          0 :                     break;
    1112                 :            :                     case TypeClass_LONG:
    1113                 :            :                     {
    1114                 :            :                         sal_Int32 n;
    1115                 :          0 :                         bConverted = ( rValue >>= n );
    1116         [ #  # ]:          0 :                         if ( bConverted )
    1117         [ #  # ]:          0 :                             rConvertedValue <<= n;
    1118                 :            :                     }
    1119                 :          0 :                     break;
    1120                 :            :                     case TypeClass_UNSIGNED_LONG:
    1121                 :            :                     {
    1122                 :            :                         sal_uInt32 n;
    1123                 :          0 :                         bConverted = ( rValue >>= n );
    1124         [ #  # ]:          0 :                         if ( bConverted )
    1125         [ #  # ]:          0 :                             rConvertedValue <<= n;
    1126                 :            :                     }
    1127                 :          0 :                     break;
    1128                 :            :                     case TypeClass_INTERFACE:
    1129                 :            :                     {
    1130         [ +  - ]:         40 :                         if ( rValue.getValueType().getTypeClass() == TypeClass_INTERFACE )
    1131                 :            :                         {
    1132         [ +  - ]:         40 :                             Reference< XInterface > xPure( rValue, UNO_QUERY );
    1133         [ -  + ]:         40 :                             if ( xPure.is() )
    1134 [ #  # ][ #  # ]:          0 :                                 rConvertedValue = xPure->queryInterface( *pDestType );
    1135                 :            :                             else
    1136                 :         40 :                                 rConvertedValue.setValue( NULL, *pDestType );
    1137                 :         40 :                             bConverted = sal_True;
    1138                 :            :                         }
    1139                 :            :                     }
    1140                 :         40 :                     break;
    1141                 :            :                     case TypeClass_ENUM:
    1142                 :            :                     {
    1143                 :          0 :                         sal_Int32 nValue = 0;
    1144                 :          0 :                         bConverted = ( rValue >>= nValue );
    1145         [ #  # ]:          0 :                         if ( bConverted )
    1146                 :          0 :                             rConvertedValue = ::cppu::int2enum( nValue, *pDestType );
    1147                 :            :                     }
    1148                 :          0 :                     break;
    1149                 :            :                     default: ; // avoid compiler warning
    1150                 :            :                 }
    1151                 :            : 
    1152         [ +  + ]:         82 :                 if (!bConverted)
    1153                 :            :                 {
    1154                 :         34 :                     ::rtl::OUStringBuffer aErrorMessage;
    1155         [ +  - ]:         34 :                     aErrorMessage.appendAscii( "Unable to convert the given value for the property " );
    1156 [ +  - ][ +  - ]:         34 :                     aErrorMessage.append     ( GetPropertyName( (sal_uInt16)nPropId ) );
    1157         [ +  - ]:         34 :                     aErrorMessage.appendAscii( ".\n" );
    1158         [ +  - ]:         34 :                     aErrorMessage.appendAscii( "Expected type: " );
    1159         [ +  - ]:         34 :                     aErrorMessage.append     ( pDestType->getTypeName() );
    1160         [ +  - ]:         34 :                     aErrorMessage.appendAscii( "\n" );
    1161         [ +  - ]:         34 :                     aErrorMessage.appendAscii( "Found type: " );
    1162         [ +  - ]:         34 :                     aErrorMessage.append     ( rValue.getValueType().getTypeName() );
    1163                 :            :                     throw ::com::sun::star::lang::IllegalArgumentException(
    1164                 :            :                         aErrorMessage.makeStringAndClear(),
    1165                 :            :                         static_cast< ::com::sun::star::beans::XPropertySet* >(this),
    1166 [ +  - ][ +  - ]:         34 :                         1);
                 [ +  - ]
    1167                 :            :                 }
    1168                 :            :             }
    1169                 :            :         }
    1170                 :            :     }
    1171                 :            : 
    1172                 :            :     // the current value
    1173         [ +  - ]:      61142 :     getFastPropertyValue( rOldValue, nPropId );
    1174 [ +  - ][ +  - ]:      61176 :     return !CompareProperties( rConvertedValue, rOldValue );
    1175                 :            : }
    1176                 :            : 
    1177                 :      15020 : void UnoControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
    1178                 :            : {
    1179                 :            :     // Missing: the fake solo properties of the FontDescriptor
    1180                 :            : 
    1181         [ +  - ]:      15020 :     ImplPropertyTable::const_iterator it = maData.find( nPropId );
    1182         [ -  + ]:      15020 :     const ::com::sun::star::uno::Any* pProp = it == maData.end() ? NULL : &(it->second);
    1183         [ +  - ]:      30040 :     ENSURE_OR_RETURN_VOID( pProp, "UnoControlModel::setFastPropertyValue_NoBroadcast: invalid property id!" );
    1184                 :            : 
    1185                 :            :     DBG_ASSERT( ( rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID ) || ( GetPropertyAttribs( (sal_uInt16)nPropId ) & ::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), "Property darf nicht VOID sein!" );
    1186         [ +  - ]:      15020 :     maData[ nPropId ] = rValue;
    1187                 :            : }
    1188                 :            : 
    1189                 :     201484 : void UnoControlModel::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nPropId ) const
    1190                 :            : {
    1191         [ +  - ]:     201484 :     ::osl::Guard< ::osl::Mutex > aGuard( ((UnoControlModel*)this)->GetMutex() );
    1192                 :            : 
    1193         [ +  - ]:     201484 :     ImplPropertyTable::const_iterator it = maData.find( nPropId );
    1194         [ +  + ]:     201484 :     const ::com::sun::star::uno::Any* pProp = it == maData.end() ? NULL : &(it->second);
    1195                 :            : 
    1196         [ +  + ]:     201484 :     if ( pProp )
    1197                 :     151913 :         rValue = *pProp;
    1198 [ +  - ][ +  - ]:      49571 :     else if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
    1199                 :            :     {
    1200         [ +  - ]:      49571 :         pProp = &( maData.find( BASEPROPERTY_FONTDESCRIPTOR )->second );
    1201                 :      49571 :         ::com::sun::star::awt::FontDescriptor aFD;
    1202         [ +  - ]:      49571 :         (*pProp) >>= aFD;
    1203   [ +  +  +  +  :      49571 :         switch ( nPropId )
          +  +  +  +  +  
          +  +  +  +  +  
                +  +  - ]
    1204                 :            :         {
    1205         [ +  - ]:       4431 :             case BASEPROPERTY_FONTDESCRIPTORPART_NAME:          rValue <<= aFD.Name;
    1206                 :       4431 :                                                                 break;
    1207         [ +  - ]:       3009 :             case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME:     rValue <<= aFD.StyleName;
    1208                 :       3009 :                                                                 break;
    1209         [ +  - ]:       3010 :             case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY:        rValue <<= aFD.Family;
    1210                 :       3010 :                                                                 break;
    1211         [ +  - ]:       3010 :             case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET:       rValue <<= aFD.CharSet;
    1212                 :       3010 :                                                                 break;
    1213         [ +  - ]:       3011 :             case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT:        rValue <<= (float)aFD.Height;
    1214                 :       3011 :                                                                 break;
    1215         [ +  - ]:       3010 :             case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT:        rValue <<= aFD.Weight;
    1216                 :       3010 :                                                                 break;
    1217         [ +  - ]:       3009 :             case BASEPROPERTY_FONTDESCRIPTORPART_SLANT:         rValue <<= (sal_Int16)aFD.Slant;
    1218                 :       3009 :                                                                 break;
    1219         [ +  - ]:       3008 :             case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE:     rValue <<= aFD.Underline;
    1220                 :       3008 :                                                                 break;
    1221         [ +  - ]:       3010 :             case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT:     rValue <<= aFD.Strikeout;
    1222                 :       3010 :                                                                 break;
    1223         [ +  - ]:       3010 :             case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH:         rValue <<= aFD.Width;
    1224                 :       3010 :                                                                 break;
    1225         [ +  - ]:       3009 :             case BASEPROPERTY_FONTDESCRIPTORPART_PITCH:         rValue <<= aFD.Pitch;
    1226                 :       3009 :                                                                 break;
    1227         [ +  - ]:       3009 :             case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH:     rValue <<= aFD.CharacterWidth;
    1228                 :       3009 :                                                                 break;
    1229         [ +  - ]:       3008 :             case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION:   rValue <<= aFD.Orientation;
    1230                 :       3008 :                                                                 break;
    1231         [ +  - ]:       3009 :             case BASEPROPERTY_FONTDESCRIPTORPART_KERNING:       rValue <<= aFD.Kerning;
    1232                 :       3009 :                                                                 break;
    1233         [ +  - ]:       3010 :             case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE:  rValue <<= aFD.WordLineMode;
    1234                 :       3010 :                                                                 break;
    1235         [ +  - ]:       3008 :             case BASEPROPERTY_FONTDESCRIPTORPART_TYPE:          rValue <<= aFD.Type;
    1236                 :       3008 :                                                                 break;
    1237                 :            :             default: OSL_FAIL( "FontProperty?!" );
    1238                 :      49571 :         }
    1239                 :            :     }
    1240                 :            :     else
    1241                 :            :     {
    1242                 :            :         OSL_FAIL( "getFastPropertyValue - invalid Property!" );
    1243         [ +  - ]:     201484 :     }
    1244                 :     201484 : }
    1245                 :            : 
    1246                 :            : // ::com::sun::star::beans::XPropertySet
    1247                 :       3676 : void UnoControlModel::setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
    1248                 :            : {
    1249                 :       3676 :     sal_Int32 nPropId = 0;
    1250                 :            :     {
    1251         [ +  - ]:       3676 :         ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
    1252         [ +  - ]:       3676 :         nPropId = (sal_Int32) GetPropertyId( rPropertyName );
    1253         [ +  - ]:       3676 :         DBG_ASSERT( nPropId, "Invalid ID in UnoControlModel::setPropertyValue" );
    1254                 :            :     }
    1255         [ +  - ]:       3676 :     if( nPropId )
    1256                 :       3676 :         setFastPropertyValue( nPropId, rValue );
    1257                 :            :     else
    1258         [ #  # ]:          0 :         throw ::com::sun::star::beans::UnknownPropertyException();
    1259                 :       3676 : }
    1260                 :            : 
    1261                 :            : // ::com::sun::star::beans::XFastPropertySet
    1262                 :      10801 : void UnoControlModel::setFastPropertyValue( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
    1263                 :            : {
    1264 [ +  + ][ +  - ]:      10801 :     if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
    1265                 :            :     {
    1266         [ +  - ]:        710 :         ::osl::ClearableMutexGuard aGuard( GetMutex() );
    1267                 :            : 
    1268                 :        710 :         Any aOldSingleValue;
    1269         [ +  - ]:        710 :         getFastPropertyValue( aOldSingleValue, BASEPROPERTY_FONTDESCRIPTORPART_START );
    1270                 :            : 
    1271         [ +  - ]:        710 :         ::com::sun::star::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ];
    1272                 :        710 :         FontDescriptor aOldFontDescriptor;
    1273         [ +  - ]:        710 :         (*pProp) >>= aOldFontDescriptor;
    1274                 :            : 
    1275                 :        710 :         FontDescriptor aNewFontDescriptor( aOldFontDescriptor );
    1276         [ +  - ]:        710 :         lcl_ImplMergeFontProperty( aNewFontDescriptor, (sal_uInt16)nPropId, rValue );
    1277                 :            : 
    1278                 :        710 :         Any aNewValue;
    1279         [ +  - ]:        710 :         aNewValue <<= aNewFontDescriptor;
    1280                 :        710 :         sal_Int32 nDescriptorId( BASEPROPERTY_FONTDESCRIPTOR );
    1281                 :        710 :         nDescriptorId = BASEPROPERTY_FONTDESCRIPTOR;
    1282                 :            : 
    1283                 :            :         // also, we need  fire a propertyChange event for the single property, since with
    1284                 :            :         // the above line, only an event for the FontDescriptor property will be fired
    1285                 :        710 :         Any aNewSingleValue;
    1286         [ +  - ]:        710 :         getFastPropertyValue( aNewSingleValue, BASEPROPERTY_FONTDESCRIPTORPART_START );
    1287                 :            : 
    1288         [ +  - ]:        710 :         aGuard.clear();
    1289         [ +  - ]:        710 :         setFastPropertyValues( 1, &nDescriptorId, &aNewValue, 1 );
    1290 [ +  - ][ +  - ]:        710 :         fire( &nPropId, &aNewSingleValue, &aOldSingleValue, 1, sal_False );
    1291                 :            :        }
    1292                 :            :     else
    1293                 :      10091 :         setFastPropertyValues( 1, &nPropId, &rValue, 1 );
    1294                 :      10767 : }
    1295                 :            : 
    1296                 :            : // ::com::sun::star::beans::XMultiPropertySet
    1297                 :          0 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlModel::getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException)
    1298                 :            : {
    1299                 :            :     OSL_FAIL( "UnoControlModel::getPropertySetInfo() not possible!" );
    1300                 :          0 :     return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >();
    1301                 :            : }
    1302                 :            : 
    1303                 :       2614 : void UnoControlModel::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
    1304                 :            : {
    1305         [ +  - ]:       2614 :     ::osl::ClearableMutexGuard aGuard( GetMutex() );
    1306                 :            : 
    1307                 :       2614 :     sal_Int32 nProps = rPropertyNames.getLength();
    1308                 :            : 
    1309                 :            : //  sal_Int32* pHandles = new sal_Int32[nProps];
    1310                 :            :         // don't do this - it leaks in case of an exception
    1311         [ +  - ]:       2614 :     Sequence< sal_Int32 > aHandles( nProps );
    1312         [ +  - ]:       2614 :     sal_Int32* pHandles = aHandles.getArray();
    1313                 :            : 
    1314                 :            :     // may need to change the order in the sequence, for this we need a non-const value sequence
    1315         [ +  - ]:       2614 :     uno::Sequence< uno::Any > aValues( Values );
    1316         [ +  - ]:       2614 :     uno::Any* pValues = aValues.getArray();
    1317                 :            : 
    1318 [ +  - ][ +  - ]:       2614 :     sal_Int32 nValidHandles = getInfoHelper().fillHandles( pHandles, rPropertyNames );
    1319                 :            : 
    1320         [ +  + ]:       2614 :     if ( nValidHandles )
    1321                 :            :     {
    1322                 :            :         // if somebody sets properties which are single aspects of a font descriptor,
    1323                 :            :         // remove them, and build a font descriptor instead
    1324                 :       2570 :         ::std::auto_ptr< awt::FontDescriptor > pFD;
    1325         [ +  + ]:      85445 :         for ( sal_uInt16 n = 0; n < nProps; ++n )
    1326                 :            :         {
    1327 [ +  + ][ +  - ]:      82875 :             if ( ( pHandles[n] >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( pHandles[n] <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
    1328                 :            :             {
    1329         [ +  + ]:      34990 :                 if ( !pFD.get() )
    1330                 :            :                 {
    1331         [ +  - ]:       2203 :                     ::com::sun::star::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ];
    1332         [ +  - ]:       2203 :                     pFD.reset( new awt::FontDescriptor );
    1333         [ +  - ]:       2203 :                     (*pProp) >>= *pFD;
    1334                 :            :                 }
    1335         [ +  - ]:      34990 :                 lcl_ImplMergeFontProperty( *pFD, (sal_uInt16)pHandles[n], pValues[n] );
    1336                 :      34990 :                 pHandles[n] = -1;
    1337                 :      34990 :                 nValidHandles--;
    1338                 :            :             }
    1339                 :            :         }
    1340                 :            : 
    1341         [ +  - ]:       2570 :         if ( nValidHandles )
    1342                 :            :         {
    1343         [ +  - ]:       2570 :             ImplNormalizePropertySequence( nProps, pHandles, pValues, &nValidHandles );
    1344         [ +  - ]:       2570 :             aGuard.clear();
    1345                 :            :                 // clear our guard before calling into setFastPropertyValues - this method
    1346                 :            :                 // will implicitly call property listeners, and this should not happen with
    1347                 :            :                 // our mutex locked
    1348                 :            :                 // #i23451#
    1349         [ +  - ]:       2570 :              setFastPropertyValues( nProps, pHandles, pValues, nValidHandles );
    1350                 :            :         }
    1351                 :            :         else
    1352         [ #  # ]:          0 :             aGuard.clear();
    1353                 :            :             // same as a few lines above
    1354                 :            : 
    1355                 :            :         // Don't merge FD property into array, as it is sorted
    1356         [ +  + ]:       2570 :         if ( pFD.get() )
    1357                 :            :         {
    1358                 :       2203 :             ::com::sun::star::uno::Any aValue;
    1359         [ +  - ]:       2203 :             aValue <<= *pFD;
    1360                 :       2203 :             sal_Int32 nHandle = BASEPROPERTY_FONTDESCRIPTOR;
    1361         [ +  - ]:       2203 :             setFastPropertyValues( 1, &nHandle, &aValue, 1 );
    1362                 :       2570 :         }
    1363 [ +  - ][ +  - ]:       2614 :     }
                 [ +  - ]
    1364                 :       2614 : }
    1365                 :            : 
    1366                 :            : 
    1367                 :            : 
    1368                 :       2570 : void UnoControlModel::ImplNormalizePropertySequence( const sal_Int32, sal_Int32*,
    1369                 :            :     uno::Any*, sal_Int32* ) const SAL_THROW(())
    1370                 :            : {
    1371                 :            :     // nothing to do here
    1372                 :       2570 : }
    1373                 :            : 
    1374                 :        432 : void UnoControlModel::ImplEnsureHandleOrder( const sal_Int32 _nCount, sal_Int32* _pHandles,
    1375                 :            :         uno::Any* _pValues, sal_Int32 _nFirstHandle, sal_Int32 _nSecondHandle ) const
    1376                 :            : {
    1377         [ +  + ]:      15226 :     for ( sal_Int32 i=0; i < _nCount; ++_pHandles, ++_pValues, ++i )
    1378                 :            :     {
    1379         [ +  + ]:      14794 :         if ( _nSecondHandle  == *_pHandles )
    1380                 :            :         {
    1381                 :        328 :             sal_Int32* pLaterHandles = _pHandles + 1;
    1382                 :        328 :             uno::Any* pLaterValues = _pValues + 1;
    1383         [ +  + ]:        650 :             for ( sal_Int32 j = i + 1; j < _nCount; ++j, ++pLaterHandles, ++pLaterValues )
    1384                 :            :             {
    1385         [ +  + ]:        394 :                 if ( _nFirstHandle == *pLaterHandles )
    1386                 :            :                 {
    1387                 :            :                     // indeed it is -> exchange the both places in the sequences
    1388                 :         72 :                     sal_Int32 nHandle( *_pHandles );
    1389                 :         72 :                     *_pHandles = *pLaterHandles;
    1390                 :         72 :                     *pLaterHandles = nHandle;
    1391                 :            : 
    1392                 :         72 :                     uno::Any aValue( *_pValues );
    1393                 :         72 :                     *_pValues = *pLaterValues;
    1394                 :         72 :                     *pLaterValues = aValue;
    1395                 :            : 
    1396                 :         72 :                     break;
    1397                 :            :                     // this will leave the inner loop, and continue with the outer loop.
    1398                 :            :                     // Note that this means we will encounter the _nSecondHandle handle, again, once we reached
    1399                 :            :                     // (in the outer loop) the place where we just put it.
    1400                 :            :                 }
    1401                 :            :             }
    1402                 :            :         }
    1403                 :            :     }
    1404                 :        432 : }
    1405                 :            : 
    1406                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10