LCOV - code coverage report
Current view: top level - sd/source/filter/eppt - pptx-grouptable.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 50 0.0 %
Date: 2012-08-25 Functions: 0 8 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 38 0.0 %

           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 "grouptable.hxx"
      30                 :            : 
      31                 :            : using ::com::sun::star::uno::Reference;
      32                 :            : using ::com::sun::star::container::XIndexAccess;
      33                 :            : 
      34                 :          0 : GroupTable::GroupTable() :
      35                 :            :     mnCurrentGroupEntry ( 0 ),
      36                 :            :     mnMaxGroupEntry     ( 0 ),
      37                 :            :     mnGroupsClosed      ( 0 ),
      38                 :          0 :     mpGroupEntry        ( NULL )
      39                 :            : {
      40                 :          0 :     ImplResizeGroupTable( 32 );
      41                 :          0 : }
      42                 :            : 
      43                 :            : // ---------------------------------------------------------------------------------------------
      44                 :            : 
      45                 :          0 : GroupTable::~GroupTable()
      46                 :            : {
      47 [ #  # ][ #  # ]:          0 :     for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; delete mpGroupEntry[ i++ ] ) ;
      48         [ #  # ]:          0 :     delete[] mpGroupEntry;
      49                 :          0 : }
      50                 :            : 
      51                 :            : // ---------------------------------------------------------------------------------------------
      52                 :            : 
      53                 :          0 : void GroupTable::ImplResizeGroupTable( sal_uInt32 nEntrys )
      54                 :            : {
      55         [ #  # ]:          0 :     if ( nEntrys > mnMaxGroupEntry )
      56                 :            :     {
      57                 :          0 :         mnMaxGroupEntry         = nEntrys;
      58                 :          0 :         GroupEntry** pTemp = new GroupEntry*[ nEntrys ];
      59         [ #  # ]:          0 :         for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; i++ )
      60                 :          0 :             pTemp[ i ] = mpGroupEntry[ i ];
      61         [ #  # ]:          0 :         if ( mpGroupEntry )
      62         [ #  # ]:          0 :             delete[] mpGroupEntry;
      63                 :          0 :         mpGroupEntry = pTemp;
      64                 :            :     }
      65                 :          0 : }
      66                 :            : 
      67                 :            : // ---------------------------------------------------------------------------------------------
      68                 :            : 
      69                 :          0 : sal_Bool GroupTable::EnterGroup( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rXIndexAccessRef )
      70                 :            : {
      71                 :          0 :     sal_Bool bRet = sal_False;
      72         [ #  # ]:          0 :     if ( rXIndexAccessRef.is() )
      73                 :            :     {
      74         [ #  # ]:          0 :         GroupEntry* pNewGroup = new GroupEntry( rXIndexAccessRef );
      75         [ #  # ]:          0 :         if ( pNewGroup->mnCount )
      76                 :            :         {
      77         [ #  # ]:          0 :             if ( mnMaxGroupEntry == mnCurrentGroupEntry )
      78                 :          0 :                 ImplResizeGroupTable( mnMaxGroupEntry + 8 );
      79                 :          0 :             mpGroupEntry[ mnCurrentGroupEntry++ ] = pNewGroup;
      80                 :          0 :             bRet = sal_True;
      81                 :            :         }
      82                 :            :         else
      83         [ #  # ]:          0 :             delete pNewGroup;
      84                 :            :     }
      85                 :          0 :     return bRet;
      86                 :            : }
      87                 :            : 
      88                 :            : // ---------------------------------------------------------------------------------------------
      89                 :            : 
      90                 :          0 : sal_uInt32 GroupTable::GetGroupsClosed()
      91                 :            : {
      92                 :          0 :     sal_uInt32 nRet = mnGroupsClosed;
      93                 :          0 :     mnGroupsClosed = 0;
      94                 :          0 :     return nRet;
      95                 :            : }
      96                 :            : 
      97                 :            : // ---------------------------------------------------------------------------------------------
      98                 :            : 
      99                 :          0 : void GroupTable::ClearGroupTable()
     100                 :            : {
     101 [ #  # ][ #  # ]:          0 :     for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; i++, delete mpGroupEntry[ i ] ) ;
     102                 :          0 :     mnCurrentGroupEntry = 0;
     103                 :          0 : }
     104                 :            : 
     105                 :            : // ---------------------------------------------------------------------------------------------
     106                 :            : 
     107                 :          0 : void GroupTable::ResetGroupTable( sal_uInt32 nCount )
     108                 :            : {
     109                 :          0 :     ClearGroupTable();
     110         [ #  # ]:          0 :     mpGroupEntry[ mnCurrentGroupEntry++ ] = new GroupEntry( nCount );
     111                 :          0 : }
     112                 :            : 
     113                 :            : // ---------------------------------------------------------------------------------------------
     114                 :            : 
     115                 :          0 : sal_Bool GroupTable::GetNextGroupEntry()
     116                 :            : {
     117         [ #  # ]:          0 :     while ( mnCurrentGroupEntry )
     118                 :            :     {
     119                 :          0 :         mnIndex = mpGroupEntry[ mnCurrentGroupEntry - 1 ]->mnCurrentPos++;
     120                 :            : 
     121         [ #  # ]:          0 :         if ( mpGroupEntry[ mnCurrentGroupEntry - 1 ]->mnCount > mnIndex )
     122                 :          0 :             return sal_True;
     123                 :            : 
     124         [ #  # ]:          0 :         delete ( mpGroupEntry[ --mnCurrentGroupEntry ] );
     125                 :            : 
     126         [ #  # ]:          0 :         if ( mnCurrentGroupEntry )
     127                 :          0 :             mnGroupsClosed++;
     128                 :            :     }
     129                 :          0 :     return sal_False;
     130                 :            : }
     131                 :            : 
     132                 :            : // ---------------------------------------------------------------------------------------------
     133                 :            : 
     134                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10