LCOV - code coverage report
Current view: top level - toolkit/source/controls - stdtabcontrollermodel.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 16 223 7.2 %
Date: 2012-08-25 Functions: 7 31 22.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 13 370 3.5 %

           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/io/XMarkableStream.hpp>
      30                 :            : 
      31                 :            : #include <toolkit/controls/stdtabcontrollermodel.hxx>
      32                 :            : #include <toolkit/helper/macros.hxx>
      33                 :            : #include <toolkit/helper/servicenames.hxx>
      34                 :            : #include <toolkit/helper/property.hxx>
      35                 :            : #include <cppuhelper/typeprovider.hxx>
      36                 :            : #include <rtl/memory.h>
      37                 :            : #include <rtl/uuid.h>
      38                 :            : 
      39                 :            : #include <tools/debug.hxx>
      40                 :            : 
      41                 :            : #define UNOCONTROL_STREAMVERSION    (short)2
      42                 :            : 
      43                 :            : //  ----------------------------------------------------
      44                 :            : //  class UnoControlModelEntryList
      45                 :            : //  ----------------------------------------------------
      46                 :          2 : UnoControlModelEntryList::UnoControlModelEntryList()
      47                 :            : {
      48                 :          2 : }
      49                 :            : 
      50                 :          2 : UnoControlModelEntryList::~UnoControlModelEntryList()
      51                 :            : {
      52         [ +  - ]:          2 :     Reset();
      53                 :          2 : }
      54                 :            : 
      55                 :          2 : void UnoControlModelEntryList::Reset()
      56                 :            : {
      57         [ -  + ]:          2 :     for ( size_t n = maList.size(); n; )
      58                 :          0 :         DestroyEntry( --n );
      59                 :          2 : }
      60                 :            : 
      61                 :          0 : void UnoControlModelEntryList::DestroyEntry( size_t nEntry )
      62                 :            : {
      63                 :          0 :     UnoControlModelEntryListBase::iterator it = maList.begin();
      64         [ #  # ]:          0 :     ::std::advance( it, nEntry );
      65                 :            : 
      66         [ #  # ]:          0 :     if ( (*it)->bGroup )
      67 [ #  # ][ #  # ]:          0 :         delete (*it)->pGroup;
      68                 :            :     else
      69         [ #  # ]:          0 :         delete (*it)->pxControl;
      70                 :            : 
      71                 :          0 :     delete *it;
      72         [ #  # ]:          0 :     maList.erase( it );
      73                 :          0 : }
      74                 :            : 
      75                 :          0 : size_t  UnoControlModelEntryList::size() const {
      76                 :          0 :     return maList.size();
      77                 :            : }
      78                 :            : 
      79                 :          0 : UnoControlModelEntry* UnoControlModelEntryList::operator[]( size_t i ) const {
      80         [ #  # ]:          0 :     return ( i < maList.size() ) ? maList[ i ] : NULL;
      81                 :            : }
      82                 :            : 
      83                 :          0 : void UnoControlModelEntryList::push_back( UnoControlModelEntry* item ) {
      84                 :          0 :     maList.push_back( item );
      85                 :          0 : }
      86                 :            : 
      87                 :          0 : void UnoControlModelEntryList::insert( size_t i, UnoControlModelEntry* item ) {
      88         [ #  # ]:          0 :     if ( i < maList.size() ) {
      89                 :          0 :         UnoControlModelEntryListBase::iterator it = maList.begin();
      90         [ #  # ]:          0 :         ::std::advance( it, i );
      91         [ #  # ]:          0 :         maList.insert( it, item );
      92                 :            :     } else {
      93                 :          0 :         maList.push_back( item );
      94                 :            :     }
      95                 :          0 : }
      96                 :            : 
      97                 :            : 
      98                 :            : //  ----------------------------------------------------
      99                 :            : //  class StdTabControllerModel
     100                 :            : //  ----------------------------------------------------
     101 [ +  - ][ +  - ]:          2 : StdTabControllerModel::StdTabControllerModel()
                 [ +  - ]
     102                 :            : {
     103                 :          2 :     mbGroupControl = sal_True;
     104                 :          2 : }
     105                 :            : 
     106 [ +  - ][ +  - ]:          2 : StdTabControllerModel::~StdTabControllerModel()
                 [ +  - ]
     107                 :            : {
     108         [ -  + ]:          4 : }
     109                 :            : 
     110                 :          0 : sal_uInt32 StdTabControllerModel::ImplGetControlCount( const UnoControlModelEntryList& rList ) const
     111                 :            : {
     112                 :          0 :     sal_uInt32 nCount = 0;
     113                 :          0 :     size_t nEntries = rList.size();
     114         [ #  # ]:          0 :     for ( size_t n = 0; n < nEntries; n++ )
     115                 :            :     {
     116                 :          0 :         UnoControlModelEntry* pEntry = rList[ n ];
     117         [ #  # ]:          0 :         if ( pEntry->bGroup )
     118                 :          0 :             nCount += ImplGetControlCount( *pEntry->pGroup );
     119                 :            :         else
     120                 :          0 :             nCount++;
     121                 :            :     }
     122                 :          0 :     return nCount;
     123                 :            : }
     124                 :            : 
     125                 :          0 : void StdTabControllerModel::ImplGetControlModels( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ** ppRefs, const UnoControlModelEntryList& rList ) const
     126                 :            : {
     127                 :          0 :     size_t nEntries = rList.size();
     128         [ #  # ]:          0 :     for ( size_t n = 0; n < nEntries; n++ )
     129                 :            :     {
     130                 :          0 :         UnoControlModelEntry* pEntry = rList[ n ];
     131         [ #  # ]:          0 :         if ( pEntry->bGroup )
     132                 :          0 :             ImplGetControlModels( ppRefs, *pEntry->pGroup );
     133                 :            :         else
     134                 :            :         {
     135                 :          0 :             **ppRefs = *pEntry->pxControl;
     136                 :          0 :             (*ppRefs)++;
     137                 :            :         }
     138                 :            :     }
     139                 :          0 : }
     140                 :            : 
     141                 :          0 : void StdTabControllerModel::ImplSetControlModels( UnoControlModelEntryList& rList, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) const
     142                 :            : {
     143                 :          0 :     const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = Controls.getConstArray();
     144                 :          0 :     sal_uInt32 nControls = Controls.getLength();
     145         [ #  # ]:          0 :     for ( sal_uInt32 n = 0; n < nControls; n++ )
     146                 :            :     {
     147                 :          0 :         UnoControlModelEntry* pNewEntry = new UnoControlModelEntry;
     148                 :          0 :         pNewEntry->bGroup = sal_False;
     149                 :          0 :         pNewEntry->pxControl = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ;
     150                 :          0 :         *pNewEntry->pxControl = pRefs[n];
     151                 :          0 :         rList.push_back( pNewEntry );
     152                 :            :     }
     153                 :          0 : }
     154                 :            : 
     155                 :          0 : sal_uInt32 StdTabControllerModel::ImplGetControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >  xCtrl, const UnoControlModelEntryList& rList ) const
     156                 :            : {
     157         [ #  # ]:          0 :     for ( size_t n = rList.size(); n; )
     158                 :            :     {
     159                 :          0 :         UnoControlModelEntry* pEntry = rList[ --n ];
     160 [ #  # ][ #  # ]:          0 :         if ( !pEntry->bGroup && ( *pEntry->pxControl == xCtrl ) )
                 [ #  # ]
     161                 :          0 :             return n;
     162                 :            :     }
     163                 :          0 :     return CONTROLPOS_NOTFOUND;
     164                 :            : }
     165                 :            : 
     166                 :          0 : void ImplWriteControls( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream > & OutStream, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rCtrls )
     167                 :            : {
     168         [ #  # ]:          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream >  xMark( OutStream, ::com::sun::star::uno::UNO_QUERY );
     169                 :            :     DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" );
     170                 :            : 
     171                 :          0 :     sal_uInt32 nStoredControls = 0;
     172 [ #  # ][ #  # ]:          0 :     sal_Int32 nDataBeginMark = xMark->createMark();
     173                 :            : 
     174 [ #  # ][ #  # ]:          0 :     OutStream->writeLong( 0L ); // DataLen
     175 [ #  # ][ #  # ]:          0 :     OutStream->writeLong( 0L ); // nStoredControls
     176                 :            : 
     177                 :          0 :     sal_uInt32 nCtrls = rCtrls.getLength();
     178         [ #  # ]:          0 :     for ( sal_uInt32 n = 0; n < nCtrls; n++ )
     179                 :            :     {
     180                 :          0 :         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >  xI = rCtrls.getConstArray()[n];
     181         [ #  # ]:          0 :         ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject >  xPO( xI, ::com::sun::star::uno::UNO_QUERY );
     182                 :            :         DBG_ASSERT( xPO.is(), "write: Control doesn't support XPersistObject" );
     183         [ #  # ]:          0 :         if ( xPO.is() )
     184                 :            :         {
     185 [ #  # ][ #  # ]:          0 :             OutStream->writeObject( xPO );
     186                 :          0 :             nStoredControls++;
     187                 :            :         }
     188                 :          0 :     }
     189 [ #  # ][ #  # ]:          0 :     sal_Int32 nDataLen = xMark->offsetToMark( nDataBeginMark );
     190 [ #  # ][ #  # ]:          0 :     xMark->jumpToMark( nDataBeginMark );
     191 [ #  # ][ #  # ]:          0 :     OutStream->writeLong( nDataLen );
     192 [ #  # ][ #  # ]:          0 :     OutStream->writeLong( nStoredControls );
     193 [ #  # ][ #  # ]:          0 :     xMark->jumpToFurthest();
     194 [ #  # ][ #  # ]:          0 :     xMark->deleteMark(nDataBeginMark);
     195                 :          0 : }
     196                 :            : 
     197                 :          0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > ImplReadControls( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream > & InStream )
     198                 :            : {
     199         [ #  # ]:          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream >  xMark( InStream, ::com::sun::star::uno::UNO_QUERY );
     200                 :            :     DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" );
     201                 :            : 
     202 [ #  # ][ #  # ]:          0 :     sal_Int32 nDataBeginMark = xMark->createMark();
     203                 :            : 
     204 [ #  # ][ #  # ]:          0 :     sal_Int32 nDataLen = InStream->readLong();
     205 [ #  # ][ #  # ]:          0 :     sal_uInt32 nCtrls = InStream->readLong();
     206                 :            : 
     207         [ #  # ]:          0 :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq( nCtrls );
     208         [ #  # ]:          0 :     for ( sal_uInt32 n = 0; n < nCtrls; n++ )
     209                 :            :     {
     210 [ #  # ][ #  # ]:          0 :         ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject >  xObj = InStream->readObject();
     211         [ #  # ]:          0 :         ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >  xI( xObj, ::com::sun::star::uno::UNO_QUERY );
     212 [ #  # ][ #  # ]:          0 :         aSeq.getArray()[n] = xI;
     213                 :          0 :     }
     214                 :            : 
     215                 :            :     // Skip remainder if more data exists than this version recognizes
     216 [ #  # ][ #  # ]:          0 :     xMark->jumpToMark( nDataBeginMark );
     217 [ #  # ][ #  # ]:          0 :     InStream->skipBytes( nDataLen );
     218 [ #  # ][ #  # ]:          0 :     xMark->deleteMark(nDataBeginMark);
     219                 :          0 :     return aSeq;
     220                 :            : }
     221                 :            : 
     222                 :            : 
     223                 :            : // ::com::sun::star::uno::XInterface
     224                 :         10 : ::com::sun::star::uno::Any StdTabControllerModel::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
     225                 :            : {
     226                 :            :     ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
     227                 :            :                                         (static_cast< ::com::sun::star::awt::XTabControllerModel* >(this)),
     228                 :            :                                         (static_cast< ::com::sun::star::lang::XServiceInfo* >(this)),
     229                 :            :                                         (static_cast< ::com::sun::star::io::XPersistObject* >(this)),
     230         [ +  - ]:         10 :                                         (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)) );
     231 [ +  + ][ +  - ]:         10 :     return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType ));
     232                 :            : }
     233                 :            : 
     234                 :            : // ::com::sun::star::lang::XTypeProvider
     235 [ #  # ][ #  # ]:          0 : IMPL_XTYPEPROVIDER_START( StdTabControllerModel )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     236         [ #  # ]:          0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel>* ) NULL ),
     237         [ #  # ]:          0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ),
     238         [ #  # ]:          0 :     getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject>* ) NULL )
     239 [ #  # ][ #  # ]:          0 : IMPL_XTYPEPROVIDER_END
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     240                 :            : 
     241                 :          0 : sal_Bool StdTabControllerModel::getGroupControl(  ) throw(::com::sun::star::uno::RuntimeException)
     242                 :            : {
     243         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     244                 :            : 
     245         [ #  # ]:          0 :     return mbGroupControl;
     246                 :            : }
     247                 :            : 
     248                 :          0 : void StdTabControllerModel::setGroupControl( sal_Bool GroupControl ) throw(::com::sun::star::uno::RuntimeException)
     249                 :            : {
     250         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     251                 :            : 
     252         [ #  # ]:          0 :     mbGroupControl = GroupControl;
     253                 :          0 : }
     254                 :            : 
     255                 :          0 : void StdTabControllerModel::setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw(::com::sun::star::uno::RuntimeException)
     256                 :            : {
     257         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     258                 :            : 
     259         [ #  # ]:          0 :     maControls.Reset();
     260 [ #  # ][ #  # ]:          0 :     ImplSetControlModels( maControls, Controls );
     261                 :          0 : }
     262                 :            : 
     263                 :          0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > StdTabControllerModel::getControlModels(  ) throw(::com::sun::star::uno::RuntimeException)
     264                 :            : {
     265         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     266                 :            : 
     267 [ #  # ][ #  # ]:          0 :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq( ImplGetControlCount( maControls ) );
     268         [ #  # ]:          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = aSeq.getArray();
     269         [ #  # ]:          0 :     ImplGetControlModels( &pRefs, maControls );
     270         [ #  # ]:          0 :     return aSeq;
     271                 :            : }
     272                 :            : 
     273                 :          0 : void StdTabControllerModel::setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const ::rtl::OUString& GroupName ) throw(::com::sun::star::uno::RuntimeException)
     274                 :            : {
     275         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     276                 :            : 
     277                 :            :     // The controls might occur as a flat list and will be grouped.
     278                 :            :     // Nested groups are not possible.
     279                 :            :     // The first element of a group determines its position.
     280         [ #  # ]:          0 :     UnoControlModelEntry* pNewEntry = new UnoControlModelEntry;
     281                 :          0 :     pNewEntry->bGroup = sal_True;
     282 [ #  # ][ #  # ]:          0 :     pNewEntry->pGroup = new UnoControlModelEntryList;
     283                 :          0 :     pNewEntry->pGroup->SetName( GroupName );
     284         [ #  # ]:          0 :     ImplSetControlModels( *pNewEntry->pGroup, Group );
     285                 :            : 
     286                 :          0 :     sal_Bool bInserted = sal_False;
     287                 :          0 :     size_t nElements = pNewEntry->pGroup->size();
     288         [ #  # ]:          0 :     for ( size_t n = 0; n < nElements; n++ )
     289                 :            :     {
     290         [ #  # ]:          0 :         UnoControlModelEntry* pEntry = (*pNewEntry->pGroup)[ n ];
     291         [ #  # ]:          0 :         if ( !pEntry->bGroup )
     292                 :            :         {
     293         [ #  # ]:          0 :             sal_uInt32 nPos = ImplGetControlPos( *pEntry->pxControl, maControls );
     294                 :            :             // At the beginning, all Controls should be in a flattened list
     295                 :            :             DBG_ASSERT( nPos != CONTROLPOS_NOTFOUND, "setGroup - Element not found" );
     296         [ #  # ]:          0 :             if ( nPos != CONTROLPOS_NOTFOUND )
     297                 :            :             {
     298         [ #  # ]:          0 :                 maControls.DestroyEntry( nPos );
     299         [ #  # ]:          0 :                 if ( !bInserted )
     300                 :            :                 {
     301         [ #  # ]:          0 :                     maControls.insert( nPos, pNewEntry );
     302                 :          0 :                     bInserted = sal_True;
     303                 :            :                 }
     304                 :            :             }
     305                 :            :         }
     306                 :            :     }
     307         [ #  # ]:          0 :     if ( !bInserted )
     308 [ #  # ][ #  # ]:          0 :         maControls.push_back( pNewEntry );
     309                 :          0 : }
     310                 :            : 
     311                 :          0 : sal_Int32 StdTabControllerModel::getGroupCount(  ) throw(::com::sun::star::uno::RuntimeException)
     312                 :            : {
     313         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     314                 :            : 
     315                 :            :     // Start with only one group layer, even though Model and Impl-methods
     316                 :            :     // work recursively, this is not presented to the outside.
     317                 :            : 
     318                 :          0 :     sal_Int32 nGroups = 0;
     319                 :          0 :     size_t nEntries = maControls.size();
     320         [ #  # ]:          0 :     for ( size_t n = 0; n < nEntries; n++ )
     321                 :            :     {
     322         [ #  # ]:          0 :         UnoControlModelEntry* pEntry = maControls[ n ];
     323         [ #  # ]:          0 :         if ( pEntry->bGroup )
     324                 :          0 :             nGroups++;
     325                 :            :     }
     326         [ #  # ]:          0 :     return nGroups;
     327                 :            : }
     328                 :            : 
     329                 :          0 : void StdTabControllerModel::getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rGroup, ::rtl::OUString& rName ) throw(::com::sun::star::uno::RuntimeException)
     330                 :            : {
     331         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     332                 :            : 
     333         [ #  # ]:          0 :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq;
     334                 :          0 :     sal_uInt32 nG = 0;
     335                 :          0 :     size_t nEntries = maControls.size();
     336         [ #  # ]:          0 :     for ( size_t n = 0; n < nEntries; n++ )
     337                 :            :     {
     338         [ #  # ]:          0 :         UnoControlModelEntry* pEntry = maControls[ n ];
     339         [ #  # ]:          0 :         if ( pEntry->bGroup )
     340                 :            :         {
     341         [ #  # ]:          0 :             if ( nG == (sal_uInt32)nGroup )
     342                 :            :             {
     343         [ #  # ]:          0 :                 sal_uInt32 nCount = ImplGetControlCount( *pEntry->pGroup );
     344 [ #  # ][ #  # ]:          0 :                 aSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >( nCount );
                 [ #  # ]
     345         [ #  # ]:          0 :                 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = aSeq.getArray();
     346         [ #  # ]:          0 :                 ImplGetControlModels( &pRefs, *pEntry->pGroup );
     347                 :          0 :                 rName = pEntry->pGroup->GetName();
     348                 :            :                 break;
     349                 :            :             }
     350                 :          0 :             nG++;
     351                 :            :         }
     352                 :            :     }
     353 [ #  # ][ #  # ]:          0 :     rGroup = aSeq;
                 [ #  # ]
     354                 :          0 : }
     355                 :            : 
     356                 :          0 : void StdTabControllerModel::getGroupByName( const ::rtl::OUString& rName, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rGroup ) throw(::com::sun::star::uno::RuntimeException)
     357                 :            : {
     358         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     359                 :            : 
     360                 :          0 :     sal_uInt32 nGroup = 0;
     361                 :          0 :     size_t nEntries = maControls.size();
     362         [ #  # ]:          0 :     for ( size_t n = 0; n < nEntries; n++ )
     363                 :            :     {
     364         [ #  # ]:          0 :         UnoControlModelEntry* pEntry = maControls[ n ];
     365         [ #  # ]:          0 :         if ( pEntry->bGroup )
     366                 :            :         {
     367         [ #  # ]:          0 :             if ( pEntry->pGroup->GetName() == rName )
     368                 :            :             {
     369                 :          0 :                 ::rtl::OUString Dummy;
     370         [ #  # ]:          0 :                 getGroup( nGroup, rGroup, Dummy );
     371                 :          0 :                 break;
     372                 :            :             }
     373                 :          0 :             nGroup++;
     374                 :            :         }
     375         [ #  # ]:          0 :     }
     376                 :          0 : }
     377                 :            : 
     378                 :            : 
     379                 :            : // ::com::sun::star::io::XPersistObject
     380                 :          0 : ::rtl::OUString StdTabControllerModel::getServiceName(  ) throw(::com::sun::star::uno::RuntimeException)
     381                 :            : {
     382                 :          0 :     return ::rtl::OUString::createFromAscii( szServiceName_TabControllerModel );
     383                 :            : }
     384                 :            : 
     385                 :          0 : void StdTabControllerModel::write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
     386                 :            : {
     387         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     388                 :            : 
     389         [ #  # ]:          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream >  xMark( OutStream, ::com::sun::star::uno::UNO_QUERY );
     390                 :            :     DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" );
     391                 :            : 
     392 [ #  # ][ #  # ]:          0 :     OutStream->writeShort( UNOCONTROL_STREAMVERSION );
     393                 :            : 
     394         [ #  # ]:          0 :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aCtrls = getControlModels();
     395         [ #  # ]:          0 :     ImplWriteControls( OutStream, aCtrls );
     396                 :            : 
     397         [ #  # ]:          0 :     sal_uInt32 nGroups = getGroupCount();
     398 [ #  # ][ #  # ]:          0 :     OutStream->writeLong( nGroups );
     399         [ #  # ]:          0 :     for ( sal_uInt32 n = 0; n < nGroups; n++ )
     400                 :            :     {
     401         [ #  # ]:          0 :         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aGroupCtrls;
     402                 :          0 :         ::rtl::OUString aGroupName;
     403         [ #  # ]:          0 :         getGroup( n, aGroupCtrls, aGroupName );
     404 [ #  # ][ #  # ]:          0 :         OutStream->writeUTF( aGroupName );
     405         [ #  # ]:          0 :         ImplWriteControls( OutStream, aGroupCtrls );
     406 [ #  # ][ #  # ]:          0 :     }
                 [ #  # ]
     407                 :          0 : }
     408                 :            : 
     409                 :          0 : void StdTabControllerModel::read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
     410                 :            : {
     411         [ #  # ]:          0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     412                 :            : 
     413         [ #  # ]:          0 :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq = ImplReadControls( InStream );
     414         [ #  # ]:          0 :     setControlModels( aSeq );
     415                 :            : 
     416 [ #  # ][ #  # ]:          0 :     sal_uInt32 nGroups = InStream->readLong();
     417         [ #  # ]:          0 :     for ( sal_uInt32 n = 0; n < nGroups; n++ )
     418                 :            :     {
     419 [ #  # ][ #  # ]:          0 :         ::rtl::OUString aGroupName = InStream->readUTF();
     420         [ #  # ]:          0 :         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aCtrlSeq = ImplReadControls( InStream );
     421         [ #  # ]:          0 :         setGroup( aCtrlSeq, aGroupName );
     422 [ #  # ][ #  # ]:          0 :     }
                 [ #  # ]
     423                 :          0 : }
     424                 :            : 
     425                 :            : 
     426                 :            : 
     427                 :            : 
     428                 :            : 
     429                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10