LCOV - code coverage report
Current view: top level - forms/source/component - navigationbar.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 202 225 89.8 %
Date: 2012-08-25 Functions: 23 24 95.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 168 379 44.3 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include "navigationbar.hxx"
      21                 :            : #include "frm_module.hxx"
      22                 :            : 
      23                 :            : #include <com/sun/star/text/WritingMode2.hpp>
      24                 :            : 
      25                 :            : #include <comphelper/streamsection.hxx>
      26                 :            : #include <comphelper/basicio.hxx>
      27                 :            : 
      28                 :            : //--------------------------------------------------------------------------
      29                 :         30 : extern "C" void SAL_CALL createRegistryInfo_ONavigationBarModel()
      30                 :            : {
      31 [ +  - ][ +  - ]:         30 :     static ::frm::OMultiInstanceAutoRegistration< ::frm::ONavigationBarModel > aAutoRegistration;
         [ +  - ][ #  # ]
      32                 :         30 : }
      33                 :            : 
      34                 :            : //.........................................................................
      35                 :            : namespace frm
      36                 :            : {
      37                 :            : //.........................................................................
      38                 :            : 
      39                 :            :     using namespace ::com::sun::star::uno;
      40                 :            :     using namespace ::com::sun::star::beans;
      41                 :            :     using namespace ::com::sun::star::form;
      42                 :            :     using namespace ::com::sun::star::awt;
      43                 :            :     using namespace ::com::sun::star::io;
      44                 :            :     using namespace ::com::sun::star::lang;
      45                 :            :     using namespace ::com::sun::star::util;
      46                 :            :     using namespace ::com::sun::star::container;
      47                 :            :     using namespace ::comphelper;
      48                 :            : 
      49                 :            :     namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
      50                 :            : 
      51                 :            : #define REGISTER_VOID_PROP( prop, memberAny, type ) \
      52                 :            :     registerMayBeVoidProperty( PROPERTY_##prop, PROPERTY_ID_##prop, PropertyAttribute::BOUND | PropertyAttribute::MAYBEDEFAULT | PropertyAttribute::MAYBEVOID, \
      53                 :            :         &memberAny, ::getCppuType( static_cast< type* >( NULL ) ) );
      54                 :            : 
      55                 :            :     //==================================================================
      56                 :            :     // ONavigationBarModel
      57                 :            :     //==================================================================
      58                 :            :     DBG_NAME( ONavigationBarModel )
      59                 :            :     //------------------------------------------------------------------
      60                 :         20 :     ONavigationBarModel::ONavigationBarModel( const Reference< XMultiServiceFactory >& _rxFactory )
      61                 :            :         :OControlModel( _rxFactory, ::rtl::OUString() )
      62 [ +  - ][ +  - ]:         20 :         ,FontControlModel( true )
                 [ +  - ]
      63                 :            :     {
      64                 :            :         DBG_CTOR( ONavigationBarModel, NULL );
      65                 :            : 
      66                 :         20 :         m_nClassId = FormComponentType::NAVIGATIONBAR;
      67         [ +  - ]:         20 :         implInitPropertyContainer();
      68                 :            : 
      69         [ +  - ]:         20 :         getPropertyDefaultByHandle( PROPERTY_ID_DEFAULTCONTROL          ) >>= m_sDefaultControl;
      70         [ +  - ]:         20 :         getPropertyDefaultByHandle( PROPERTY_ID_ICONSIZE                ) >>= m_nIconSize;
      71         [ +  - ]:         20 :         getPropertyDefaultByHandle( PROPERTY_ID_BORDER                  ) >>= m_nBorder;
      72         [ +  - ]:         20 :         getPropertyDefaultByHandle( PROPERTY_ID_DELAY                   ) >>= m_nDelay;
      73         [ +  - ]:         20 :         getPropertyDefaultByHandle( PROPERTY_ID_ENABLED                 ) >>= m_bEnabled;
      74         [ +  - ]:         20 :         getPropertyDefaultByHandle( PROPERTY_ID_ENABLEVISIBLE           ) >>= m_bEnableVisible;
      75         [ +  - ]:         20 :         getPropertyDefaultByHandle( PROPERTY_ID_SHOW_POSITION           ) >>= m_bShowPosition;
      76         [ +  - ]:         20 :         getPropertyDefaultByHandle( PROPERTY_ID_SHOW_NAVIGATION         ) >>= m_bShowNavigation;
      77         [ +  - ]:         20 :         getPropertyDefaultByHandle( PROPERTY_ID_SHOW_RECORDACTIONS      ) >>= m_bShowActions;
      78         [ +  - ]:         20 :         getPropertyDefaultByHandle( PROPERTY_ID_SHOW_FILTERSORT         ) >>= m_bShowFilterSort;
      79         [ +  - ]:         20 :         getPropertyDefaultByHandle( PROPERTY_ID_WRITING_MODE            ) >>= m_nWritingMode;
      80         [ +  - ]:         20 :         getPropertyDefaultByHandle( PROPERTY_ID_CONTEXT_WRITING_MODE    ) >>= m_nContextWritingMode;
      81                 :         20 :     }
      82                 :            : 
      83                 :            :     //------------------------------------------------------------------
      84                 :          2 :     ONavigationBarModel::ONavigationBarModel( const ONavigationBarModel* _pOriginal, const Reference< XMultiServiceFactory >& _rxFactory )
      85                 :            :         :OControlModel( _pOriginal, _rxFactory )
      86 [ +  - ][ +  - ]:          2 :         ,FontControlModel( _pOriginal )
                 [ +  - ]
      87                 :            :     {
      88                 :            :         DBG_CTOR( ONavigationBarModel, NULL );
      89                 :            : 
      90         [ +  - ]:          2 :         implInitPropertyContainer();
      91                 :            : 
      92                 :          2 :         m_aTabStop              = _pOriginal->m_aTabStop;
      93                 :          2 :         m_aBackgroundColor      = _pOriginal->m_aBackgroundColor;
      94                 :          2 :         m_sDefaultControl       = _pOriginal->m_sDefaultControl;
      95                 :          2 :         m_sHelpText             = _pOriginal->m_sHelpText;
      96                 :          2 :         m_sHelpURL              = _pOriginal->m_sHelpURL;
      97                 :          2 :         m_bEnabled              = _pOriginal->m_bEnabled;
      98                 :          2 :         m_bEnableVisible        = _pOriginal->m_bEnableVisible;
      99                 :          2 :         m_nIconSize             = _pOriginal->m_nIconSize;
     100                 :          2 :         m_nBorder               = _pOriginal->m_nBorder;
     101                 :          2 :         m_nDelay                = _pOriginal->m_nDelay;
     102                 :          2 :         m_bShowPosition         = _pOriginal->m_bShowPosition;
     103                 :          2 :         m_bShowNavigation       = _pOriginal->m_bShowNavigation;
     104                 :          2 :         m_bShowActions          = _pOriginal->m_bShowActions;
     105                 :          2 :         m_bShowFilterSort       = _pOriginal->m_bShowFilterSort;
     106                 :          2 :         m_nWritingMode          = _pOriginal->m_nWritingMode;
     107                 :          2 :         m_nContextWritingMode   = _pOriginal->m_nContextWritingMode;
     108                 :          2 :     }
     109                 :            : 
     110                 :            :     //------------------------------------------------------------------
     111                 :         22 :     void ONavigationBarModel::implInitPropertyContainer()
     112                 :            :     {
     113         [ +  - ]:         22 :         REGISTER_PROP_2( DEFAULTCONTROL,      m_sDefaultControl,        BOUND, MAYBEDEFAULT );
     114         [ +  - ]:         22 :         REGISTER_PROP_2( HELPTEXT,            m_sHelpText,              BOUND, MAYBEDEFAULT );
     115         [ +  - ]:         22 :         REGISTER_PROP_2( HELPURL,             m_sHelpURL,               BOUND, MAYBEDEFAULT );
     116         [ +  - ]:         22 :         REGISTER_PROP_2( ENABLED,             m_bEnabled,               BOUND, MAYBEDEFAULT );
     117         [ +  - ]:         22 :         REGISTER_PROP_2( ENABLEVISIBLE,       m_bEnableVisible,         BOUND, MAYBEDEFAULT );
     118         [ +  - ]:         22 :         REGISTER_PROP_2( ICONSIZE,            m_nIconSize,              BOUND, MAYBEDEFAULT );
     119         [ +  - ]:         22 :         REGISTER_PROP_2( BORDER,              m_nBorder,                BOUND, MAYBEDEFAULT );
     120         [ +  - ]:         22 :         REGISTER_PROP_2( DELAY,               m_nDelay,                 BOUND, MAYBEDEFAULT );
     121         [ +  - ]:         22 :         REGISTER_PROP_2( SHOW_POSITION,       m_bShowPosition,          BOUND, MAYBEDEFAULT );
     122         [ +  - ]:         22 :         REGISTER_PROP_2( SHOW_NAVIGATION,     m_bShowNavigation,        BOUND, MAYBEDEFAULT );
     123         [ +  - ]:         22 :         REGISTER_PROP_2( SHOW_RECORDACTIONS,  m_bShowActions,           BOUND, MAYBEDEFAULT );
     124         [ +  - ]:         22 :         REGISTER_PROP_2( SHOW_FILTERSORT,     m_bShowFilterSort,        BOUND, MAYBEDEFAULT );
     125         [ +  - ]:         22 :         REGISTER_PROP_2( WRITING_MODE,        m_nWritingMode,           BOUND, MAYBEDEFAULT );
     126         [ +  - ]:         22 :         REGISTER_PROP_3( CONTEXT_WRITING_MODE,m_nContextWritingMode,    BOUND, MAYBEDEFAULT, TRANSIENT );
     127                 :            : 
     128         [ +  - ]:         22 :         REGISTER_VOID_PROP( TABSTOP,         m_aTabStop,         sal_Bool );
     129         [ +  - ]:         22 :         REGISTER_VOID_PROP( BACKGROUNDCOLOR, m_aBackgroundColor, sal_Int32 );
     130                 :         22 :     }
     131                 :            : 
     132                 :            :     //------------------------------------------------------------------
     133         [ +  - ]:         22 :     ONavigationBarModel::~ONavigationBarModel()
     134                 :            :     {
     135         [ -  + ]:         22 :         if ( !OComponentHelper::rBHelper.bDisposed )
     136                 :            :         {
     137                 :          0 :             acquire();
     138         [ #  # ]:          0 :             dispose();
     139                 :            :         }
     140                 :            : 
     141                 :            :         DBG_DTOR( ONavigationBarModel, NULL );
     142         [ -  + ]:         44 :     }
     143                 :            : 
     144                 :            :     //------------------------------------------------------------------
     145                 :       6565 :     Any SAL_CALL ONavigationBarModel::queryAggregation( const Type& _rType ) throw ( RuntimeException )
     146                 :            :     {
     147                 :       6565 :         Any aReturn = ONavigationBarModel_BASE::queryInterface( _rType );
     148                 :            : 
     149         [ +  + ]:       6565 :         if ( !aReturn.hasValue() )
     150         [ +  - ]:       2328 :             aReturn = OControlModel::queryAggregation( _rType );
     151                 :            : 
     152                 :       6565 :         return aReturn;
     153                 :            :     }
     154                 :            : 
     155                 :            :     //------------------------------------------------------------------
     156 [ #  # ][ #  # ]:          4 :     IMPLEMENT_FORWARD_XTYPEPROVIDER2( ONavigationBarModel, OControlModel, ONavigationBarModel_BASE )
                 [ #  # ]
     157                 :            : 
     158                 :            :     //------------------------------------------------------------------------------
     159 [ +  - ][ +  - ]:          2 :     IMPLEMENT_DEFAULT_CLONING( ONavigationBarModel )
     160                 :            : 
     161                 :            :     //------------------------------------------------------------------
     162                 :         12 :     ::rtl::OUString SAL_CALL ONavigationBarModel::getImplementationName()  throw(RuntimeException)
     163                 :            :     {
     164                 :         12 :         return getImplementationName_Static();
     165                 :            :     }
     166                 :            : 
     167                 :            :     //------------------------------------------------------------------
     168                 :         10 :     Sequence< ::rtl::OUString > SAL_CALL ONavigationBarModel::getSupportedServiceNames()  throw(RuntimeException)
     169                 :            :     {
     170                 :         10 :         return getSupportedServiceNames_Static();
     171                 :            :     }
     172                 :            : 
     173                 :            :     //------------------------------------------------------------------
     174                 :         72 :     ::rtl::OUString SAL_CALL ONavigationBarModel::getImplementationName_Static()
     175                 :            :     {
     176                 :         72 :         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.form.ONavigationBarModel" ) );
     177                 :            :     }
     178                 :            : 
     179                 :            :     //------------------------------------------------------------------
     180                 :         40 :     Sequence< ::rtl::OUString > SAL_CALL ONavigationBarModel::getSupportedServiceNames_Static()
     181                 :            :     {
     182                 :         40 :         Sequence< ::rtl::OUString > aSupported = OControlModel::getSupportedServiceNames_Static();
     183         [ +  - ]:         40 :         aSupported.realloc( aSupported.getLength() + 2 );
     184                 :            : 
     185         [ +  - ]:         40 :         ::rtl::OUString* pArray = aSupported.getArray();
     186         [ +  - ]:         40 :         pArray[ aSupported.getLength() - 2 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlModel" ) );
     187         [ +  - ]:         40 :         pArray[ aSupported.getLength() - 1 ] = FRM_SUN_COMPONENT_NAVTOOLBAR;
     188                 :         40 :         return aSupported;
     189                 :            :     }
     190                 :            : 
     191                 :            :     //------------------------------------------------------------------
     192                 :         20 :     Reference< XInterface > SAL_CALL ONavigationBarModel::Create( const Reference< XMultiServiceFactory >& _rxFactory )
     193                 :            :     {
     194         [ +  - ]:         20 :         return *( new ONavigationBarModel( _rxFactory ) );
     195                 :            :     }
     196                 :            : 
     197                 :            :     //------------------------------------------------------------------
     198                 :         22 :     void SAL_CALL ONavigationBarModel::disposing()
     199                 :            :     {
     200                 :         22 :         OControlModel::disposing( );
     201                 :         22 :     }
     202                 :            : 
     203                 :            :     //------------------------------------------------------------------
     204                 :          2 :     ::rtl::OUString SAL_CALL ONavigationBarModel::getServiceName() throw ( RuntimeException )
     205                 :            :     {
     206                 :          2 :         return FRM_SUN_COMPONENT_NAVTOOLBAR;
     207                 :            :     }
     208                 :            : 
     209                 :            :     //------------------------------------------------------------------
     210                 :            :     #define PERSIST_TABSTOP         0x0001
     211                 :            :     #define PERSIST_BACKGROUND      0x0002
     212                 :            :     #define PERSIST_TEXTCOLOR       0x0004
     213                 :            :     #define PERSIST_TEXTLINECOLOR   0x0008
     214                 :            : 
     215                 :            :     #define PERSIST_ENABLED         0x0001
     216                 :            :     #define PERSIST_LARGEICONS      0x0002
     217                 :            :         // leaf a leap here - this will allow for two more icon size values to be stored compatibly
     218                 :            :     #define PERSIST_SHOW_POSITION   0x0008
     219                 :            :     #define PERSIST_SHOW_NAVIGATION 0x0010
     220                 :            :     #define PERSIST_SHOW_ACTIONS    0x0020
     221                 :            :     #define PERSIST_SHOW_FILTERSORT 0x0040
     222                 :            : 
     223                 :            :     //------------------------------------------------------------------
     224                 :          2 :     void SAL_CALL ONavigationBarModel::write( const Reference< XObjectOutputStream >& _rxOutStream ) throw ( IOException, RuntimeException )
     225                 :            :     {
     226                 :            :         // open a section for compatibility - if we later on write additional members,
     227                 :            :         // then older versions can skip them
     228         [ +  - ]:          2 :         Reference< XDataOutputStream > xDataOut( _rxOutStream, UNO_QUERY );
     229         [ +  - ]:          2 :         OStreamSection aEnsureBlockCompat( xDataOut );
     230                 :            : 
     231                 :            :         // base class
     232         [ +  - ]:          2 :         OControlModel::write( _rxOutStream );
     233                 :            : 
     234                 :            :         {
     235         [ +  - ]:          2 :             OStreamSection aEnsureCompat( xDataOut );
     236                 :            :             // determine which properties are not void and need to be written
     237                 :          2 :             sal_Int32 nNonVoids = 0;
     238         [ -  + ]:          2 :             if ( m_aTabStop.hasValue() )
     239                 :          0 :                 nNonVoids |= PERSIST_TABSTOP;
     240         [ -  + ]:          2 :             if ( m_aBackgroundColor.hasValue() )
     241                 :          0 :                 nNonVoids |= PERSIST_BACKGROUND;
     242         [ -  + ]:          2 :             if ( hasTextColor() )
     243                 :          0 :                 nNonVoids |= PERSIST_TEXTCOLOR;
     244         [ -  + ]:          2 :             if ( hasTextLineColor() )
     245                 :          0 :                 nNonVoids |= PERSIST_TEXTLINECOLOR;
     246                 :            : 
     247 [ +  - ][ +  - ]:          2 :             _rxOutStream->writeLong( nNonVoids );
     248                 :            : 
     249                 :            :             // the maybeboid anys
     250         [ -  + ]:          2 :             if ( nNonVoids & PERSIST_TABSTOP )
     251                 :            :             {
     252                 :          0 :                 sal_Bool bTabStop( sal_False );
     253                 :          0 :                 m_aTabStop >>= bTabStop;
     254 [ #  # ][ #  # ]:          0 :                 _rxOutStream->writeBoolean( bTabStop );
     255                 :            :             }
     256         [ -  + ]:          2 :             if ( nNonVoids & PERSIST_BACKGROUND )
     257                 :            :             {
     258                 :          0 :                 sal_Int32 nBackgroundColor = 0;
     259                 :          0 :                 m_aBackgroundColor >>= nBackgroundColor;
     260 [ #  # ][ #  # ]:          0 :                 _rxOutStream->writeLong( nBackgroundColor );
     261                 :            :             }
     262         [ -  + ]:          2 :             if ( nNonVoids & PERSIST_TEXTCOLOR )
     263                 :            :             {
     264 [ #  # ][ #  # ]:          0 :                _rxOutStream->writeLong( getTextColor() );
                 [ #  # ]
     265                 :            :             }
     266         [ -  + ]:          2 :             if ( nNonVoids & PERSIST_TEXTLINECOLOR )
     267                 :            :             {
     268 [ #  # ][ #  # ]:          0 :                 _rxOutStream->writeLong( getTextLineColor() );
                 [ #  # ]
     269         [ +  - ]:          2 :             }
     270                 :            :         }
     271                 :            : 
     272                 :            :         {
     273         [ +  - ]:          2 :             OStreamSection aEnsureCompat( xDataOut );
     274 [ +  - ][ +  - ]:          2 :             ::comphelper::operator<<( _rxOutStream, getFont() );
     275                 :            :         }
     276                 :            : 
     277                 :            :         // our boolean flags
     278                 :          2 :         sal_Int32 nFlags = 0;
     279         [ +  - ]:          2 :         if ( m_bEnabled        ) nFlags |= PERSIST_ENABLED;
     280         [ -  + ]:          2 :         if ( m_nIconSize       ) nFlags |= PERSIST_LARGEICONS;   // at the moment, this is quasi boolean
     281         [ +  - ]:          2 :         if ( m_bShowPosition   ) nFlags |= PERSIST_SHOW_POSITION;
     282         [ +  - ]:          2 :         if ( m_bShowNavigation ) nFlags |= PERSIST_SHOW_NAVIGATION;
     283         [ +  - ]:          2 :         if ( m_bShowActions    ) nFlags |= PERSIST_SHOW_ACTIONS;
     284         [ +  - ]:          2 :         if ( m_bShowFilterSort ) nFlags |= PERSIST_SHOW_FILTERSORT;
     285 [ +  - ][ +  - ]:          2 :         _rxOutStream->writeLong( nFlags );
     286                 :            : 
     287                 :            :         // our strings
     288 [ +  - ][ +  - ]:          2 :         _rxOutStream->writeUTF( m_sHelpText       );
     289 [ +  - ][ +  - ]:          2 :         _rxOutStream->writeUTF( m_sHelpURL        );
     290 [ +  - ][ +  - ]:          2 :         _rxOutStream->writeUTF( m_sDefaultControl );
     291                 :            : 
     292                 :            :         // misc
     293 [ +  - ][ +  - ]:          2 :         _rxOutStream->writeShort( m_nBorder );
     294 [ +  - ][ +  - ]:          2 :         _rxOutStream->writeLong ( m_nDelay  );
                 [ +  - ]
     295                 :          2 :     }
     296                 :            : 
     297                 :            :     //------------------------------------------------------------------
     298                 :          2 :     void SAL_CALL ONavigationBarModel::read( const Reference< XObjectInputStream >& _rxInStream ) throw ( IOException, RuntimeException )
     299                 :            :     {
     300         [ +  - ]:          2 :         Reference< XDataInputStream > xDataIn( _rxInStream, UNO_QUERY );
     301         [ +  - ]:          2 :         OStreamSection aEnsureBlockCompat( xDataIn );
     302                 :            : 
     303                 :            :         // base class
     304         [ +  - ]:          2 :         OControlModel::read( _rxInStream );
     305                 :            : 
     306                 :            :         {
     307         [ +  - ]:          2 :             OStreamSection aEnsureCompat( xDataIn );
     308                 :            :             // determine which properties were non-void
     309 [ +  - ][ +  - ]:          2 :             sal_Int32 nNonVoids = _rxInStream->readLong( );
     310                 :            : 
     311                 :            :             // the maybeboid anys
     312         [ -  + ]:          2 :             if ( nNonVoids & PERSIST_TABSTOP )
     313 [ #  # ][ #  # ]:          0 :                 m_aTabStop = makeAny( _rxInStream->readBoolean() );
                 [ #  # ]
     314                 :            :             else
     315                 :          2 :                 m_aTabStop.clear();
     316                 :            : 
     317         [ -  + ]:          2 :             if ( nNonVoids & PERSIST_BACKGROUND )
     318 [ #  # ][ #  # ]:          0 :                 m_aBackgroundColor = makeAny( _rxInStream->readLong() );
                 [ #  # ]
     319                 :            :             else
     320                 :          2 :                 m_aBackgroundColor.clear();
     321                 :            : 
     322         [ -  + ]:          2 :             if ( nNonVoids & PERSIST_TEXTCOLOR )
     323 [ #  # ][ #  # ]:          0 :                 setTextColor( _rxInStream->readLong() );
                 [ #  # ]
     324                 :            :             else
     325                 :          2 :                 clearTextColor();
     326                 :            : 
     327         [ -  + ]:          2 :             if ( nNonVoids & PERSIST_TEXTLINECOLOR )
     328 [ #  # ][ #  # ]:          0 :                 setTextLineColor( _rxInStream->readLong() );
                 [ #  # ]
     329                 :            :             else
     330         [ +  - ]:          2 :                 clearTextLineColor();
     331                 :            :         }
     332                 :            : 
     333                 :            :         {
     334         [ +  - ]:          2 :             OStreamSection aEnsureCompat( xDataIn );
     335                 :          2 :             FontDescriptor aFont;
     336         [ +  - ]:          2 :             ::comphelper::operator>>( _rxInStream, aFont );
     337         [ +  - ]:          2 :             setFont( aFont );
     338                 :            :         }
     339                 :            : 
     340                 :            :         // our boolean flags
     341 [ +  - ][ +  - ]:          2 :         sal_Int32 nFlags = _rxInStream->readLong( );
     342                 :          2 :         m_bEnabled        = ( nFlags & PERSIST_ENABLED         ) ? sal_True : sal_False;
     343         [ -  + ]:          2 :         m_nIconSize       = ( nFlags & PERSIST_LARGEICONS      ) ?        1 :         0;
     344         [ +  - ]:          2 :         m_bShowPosition   = ( nFlags & PERSIST_SHOW_POSITION   ) ? sal_True : sal_False;
     345         [ +  - ]:          2 :         m_bShowNavigation = ( nFlags & PERSIST_SHOW_NAVIGATION ) ? sal_True : sal_False;
     346         [ +  - ]:          2 :         m_bShowActions    = ( nFlags & PERSIST_SHOW_ACTIONS    ) ? sal_True : sal_False;
     347         [ +  - ]:          2 :         m_bShowFilterSort = ( nFlags & PERSIST_SHOW_FILTERSORT ) ? sal_True : sal_False;
     348                 :            : 
     349                 :            :         // our strings
     350 [ +  - ][ +  - ]:          2 :         m_sHelpText       = _rxInStream->readUTF( );
     351 [ +  - ][ +  - ]:          2 :         m_sHelpURL        = _rxInStream->readUTF( );
     352 [ +  - ][ +  - ]:          2 :         m_sDefaultControl = _rxInStream->readUTF( );
     353                 :            : 
     354                 :            :         // misc
     355 [ +  - ][ +  - ]:          2 :         m_nBorder = _rxInStream->readShort();
     356 [ +  - ][ +  - ]:          2 :         m_nDelay  = _rxInStream->readLong();
                 [ +  - ]
     357                 :          2 :     }
     358                 :            : 
     359                 :            :     //------------------------------------------------------------------
     360                 :       4224 :     void SAL_CALL ONavigationBarModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const
     361                 :            :     {
     362         [ +  + ]:       4224 :         if ( isRegisteredProperty( _nHandle ) )
     363                 :            :         {
     364                 :       1834 :             OPropertyContainerHelper::getFastPropertyValue( _rValue, _nHandle );
     365                 :            :         }
     366         [ +  + ]:       2390 :         else if ( isFontRelatedProperty( _nHandle ) )
     367                 :            :         {
     368                 :       1283 :             FontControlModel::getFastPropertyValue( _rValue, _nHandle );
     369                 :            :         }
     370                 :            :         else
     371                 :            :         {
     372                 :       1107 :             OControlModel::getFastPropertyValue( _rValue, _nHandle );
     373                 :            :         }
     374                 :       4224 :     }
     375                 :            : 
     376                 :            :     //------------------------------------------------------------------
     377                 :       1336 :     sal_Bool SAL_CALL ONavigationBarModel::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue,
     378                 :            :         sal_Int32 _nHandle, const Any& _rValue ) throw( IllegalArgumentException )
     379                 :            :     {
     380                 :       1336 :         sal_Bool bModified = sal_False;
     381                 :            : 
     382         [ +  + ]:       1336 :         if ( isRegisteredProperty( _nHandle ) )
     383                 :            :         {
     384                 :        854 :             bModified = OPropertyContainerHelper::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
     385                 :            :         }
     386         [ +  + ]:        482 :         else if ( isFontRelatedProperty( _nHandle ) )
     387                 :            :         {
     388                 :        216 :             bModified = FontControlModel::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
     389                 :            :         }
     390                 :            :         else
     391                 :            :         {
     392                 :        266 :             bModified = OControlModel::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
     393                 :            :         }
     394                 :            : 
     395                 :       1334 :         return bModified;
     396                 :            :     }
     397                 :            : 
     398                 :            :     //------------------------------------------------------------------
     399                 :        456 :     void SAL_CALL ONavigationBarModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw ( Exception )
     400                 :            :     {
     401         [ +  + ]:        456 :         if ( isRegisteredProperty( _nHandle ) )
     402                 :            :         {
     403                 :        254 :             OPropertyContainerHelper::setFastPropertyValue( _nHandle, _rValue );
     404                 :            :         }
     405         [ +  + ]:        202 :         else if ( isFontRelatedProperty( _nHandle ) )
     406                 :            :         {
     407                 :         96 :             FontDescriptor aOldFont( getFont() );
     408                 :            : 
     409         [ +  - ]:         96 :             FontControlModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
     410                 :            : 
     411 [ +  - ][ +  + ]:         96 :             if ( isFontAggregateProperty( _nHandle ) )
     412 [ +  - ][ +  - ]:         96 :                 firePropertyChange( PROPERTY_ID_FONT, makeAny( getFont() ), makeAny( aOldFont ) );
                 [ +  - ]
     413                 :            :         }
     414                 :            :         else
     415                 :            :         {
     416                 :        106 :             OControlModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
     417                 :            :         }
     418                 :        456 :     }
     419                 :            : 
     420                 :            :     //------------------------------------------------------------------
     421                 :        248 :     Any ONavigationBarModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const
     422                 :            :     {
     423                 :        248 :         Any aDefault;
     424                 :            : 
     425   [ +  +  +  +  :        248 :         switch ( _nHandle )
             +  -  +  +  
                      - ]
     426                 :            :         {
     427                 :            :         case PROPERTY_ID_TABSTOP:
     428                 :            :         case PROPERTY_ID_BACKGROUNDCOLOR:
     429                 :            :             /* void */
     430                 :          8 :             break;
     431                 :            :         case PROPERTY_ID_WRITING_MODE:
     432                 :            :         case PROPERTY_ID_CONTEXT_WRITING_MODE:
     433         [ +  - ]:         40 :             aDefault <<= WritingMode2::CONTEXT;
     434                 :         40 :             break;
     435                 :            : 
     436                 :            :         case PROPERTY_ID_ENABLED:
     437                 :            :         case PROPERTY_ID_ENABLEVISIBLE:
     438                 :            :         case PROPERTY_ID_SHOW_POSITION:
     439                 :            :         case PROPERTY_ID_SHOW_NAVIGATION:
     440                 :            :         case PROPERTY_ID_SHOW_RECORDACTIONS:
     441                 :            :         case PROPERTY_ID_SHOW_FILTERSORT:
     442         [ +  - ]:        120 :             aDefault <<= (sal_Bool)sal_True;
     443                 :        120 :             break;
     444                 :            : 
     445                 :            :         case PROPERTY_ID_ICONSIZE:
     446         [ +  - ]:         20 :             aDefault <<= (sal_Int16)0;
     447                 :         20 :             break;
     448                 :            : 
     449                 :            :         case PROPERTY_ID_DEFAULTCONTROL:
     450 [ +  - ][ +  - ]:         20 :             aDefault <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.control.NavigationToolBar" ) );
     451                 :         20 :             break;
     452                 :            : 
     453                 :            :         case PROPERTY_ID_HELPTEXT:
     454                 :            :         case PROPERTY_ID_HELPURL:
     455         [ #  # ]:          0 :             aDefault <<= ::rtl::OUString();
     456                 :          0 :             break;
     457                 :            : 
     458                 :            :         case PROPERTY_ID_BORDER:
     459         [ +  - ]:         20 :             aDefault <<= (sal_Int16)0;
     460                 :         20 :             break;
     461                 :            : 
     462                 :            :         case PROPERTY_ID_DELAY:
     463         [ +  - ]:         20 :             aDefault <<= (sal_Int32)20;
     464                 :         20 :             break;
     465                 :            : 
     466                 :            :         default:
     467 [ #  # ][ #  # ]:          0 :             if ( isFontRelatedProperty( _nHandle ) )
     468         [ #  # ]:          0 :                 aDefault = FontControlModel::getPropertyDefaultByHandle( _nHandle );
     469                 :            :             else
     470         [ #  # ]:          0 :                 aDefault = OControlModel::getPropertyDefaultByHandle( _nHandle );
     471                 :            :         }
     472                 :        248 :         return aDefault;
     473                 :            :     }
     474                 :            : 
     475                 :            :     //------------------------------------------------------------------
     476                 :         24 :     void ONavigationBarModel::describeFixedProperties( Sequence< Property >& _rProps ) const
     477                 :            :     {
     478 [ +  - ][ +  - ]:         24 :         BEGIN_DESCRIBE_PROPERTIES( 1, OControlModel )
                 [ +  - ]
     479 [ +  - ][ +  - ]:         24 :             DECL_PROP2( TABINDEX,           sal_Int16,          BOUND, MAYBEDEFAULT );
     480                 :            :         END_DESCRIBE_PROPERTIES();
     481                 :            : 
     482                 :            :         // properties which the OPropertyContainerHelper is responsible for
     483         [ +  - ]:         24 :         Sequence< Property > aContainedProperties;
     484         [ +  - ]:         24 :         describeProperties( aContainedProperties );
     485                 :            : 
     486                 :            :         // properties which the FontControlModel is responsible for
     487         [ +  - ]:         24 :         Sequence< Property > aFontProperties;
     488         [ +  - ]:         24 :         describeFontRelatedProperties( aFontProperties );
     489                 :            : 
     490                 :            :         _rProps = concatSequences(
     491                 :            :             aContainedProperties,
     492                 :            :             aFontProperties,
     493                 :            :             _rProps
     494 [ +  - ][ +  - ]:         24 :         );
         [ +  - ][ +  - ]
                 [ +  - ]
     495                 :         24 :     }
     496                 :            : 
     497                 :            : //.........................................................................
     498                 :            : }   // namespace frm
     499                 :            : //.........................................................................
     500                 :            : 
     501                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10