LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unoredlines.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 10 83 12.0 %
Date: 2012-08-25 Functions: 4 21 19.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 5 114 4.4 %

           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                 :            : 
      30                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      31                 :            : 
      32                 :            : #include <osl/mutex.hxx>
      33                 :            : #include <vcl/svapp.hxx>
      34                 :            : 
      35                 :            : #include <unoredlines.hxx>
      36                 :            : #include <unoredline.hxx>
      37                 :            : #include <unomid.h>
      38                 :            : #include <pagedesc.hxx>
      39                 :            : #include "poolfmt.hxx"
      40                 :            : #include <doc.hxx>
      41                 :            : #include <docary.hxx>
      42                 :            : #include <redline.hxx>
      43                 :            : #include <switerator.hxx>
      44                 :            : 
      45                 :            : using namespace ::com::sun::star;
      46                 :            : using ::rtl::OUString;
      47                 :            : 
      48                 :         19 : SwXRedlines::SwXRedlines(SwDoc* _pDoc) :
      49                 :         19 :     SwUnoCollection(_pDoc)
      50                 :            : {
      51                 :         19 : }
      52                 :            : 
      53                 :         19 : SwXRedlines::~SwXRedlines()
      54                 :            : {
      55         [ -  + ]:         38 : }
      56                 :            : 
      57                 :          0 : sal_Int32 SwXRedlines::getCount(  ) throw(uno::RuntimeException)
      58                 :            : {
      59         [ #  # ]:          0 :     SolarMutexGuard aGuard;
      60         [ #  # ]:          0 :     if(!IsValid())
      61         [ #  # ]:          0 :         throw uno::RuntimeException();
      62         [ #  # ]:          0 :     const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
      63         [ #  # ]:          0 :     return rRedTbl.size();
      64                 :            : }
      65                 :            : 
      66                 :          0 : uno::Any SwXRedlines::getByIndex(sal_Int32 nIndex)
      67                 :            :     throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
      68                 :            : {
      69         [ #  # ]:          0 :     SolarMutexGuard aGuard;
      70         [ #  # ]:          0 :     if(!IsValid())
      71         [ #  # ]:          0 :         throw uno::RuntimeException();
      72         [ #  # ]:          0 :     const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
      73                 :          0 :     uno::Any aRet;
      74 [ #  # ][ #  # ]:          0 :     if ((rRedTbl.size() > static_cast<size_t>(nIndex)) && (nIndex >= 0))
                 [ #  # ]
      75                 :            :     {
      76 [ #  # ][ #  # ]:          0 :         uno::Reference <beans::XPropertySet> xRet = SwXRedlines::GetObject( *rRedTbl[nIndex], *GetDoc() );
                 [ #  # ]
      77         [ #  # ]:          0 :         aRet <<= xRet;
      78                 :            :     }
      79                 :            :     else
      80         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
      81         [ #  # ]:          0 :     return aRet;
      82                 :            : }
      83                 :            : 
      84                 :          0 : uno::Reference< container::XEnumeration >  SwXRedlines::createEnumeration(void)
      85                 :            :     throw( uno::RuntimeException )
      86                 :            : {
      87         [ #  # ]:          0 :     SolarMutexGuard aGuard;
      88         [ #  # ]:          0 :     if(!IsValid())
      89         [ #  # ]:          0 :         throw uno::RuntimeException();
      90 [ #  # ][ #  # ]:          0 :     return uno::Reference< container::XEnumeration >(new SwXRedlineEnumeration(*GetDoc()));
         [ #  # ][ #  # ]
      91                 :            : }
      92                 :            : 
      93                 :          0 : uno::Type SwXRedlines::getElementType(  ) throw(uno::RuntimeException)
      94                 :            : {
      95                 :          0 :     return ::getCppuType((uno::Reference<beans::XPropertySet>*)0);
      96                 :            : }
      97                 :            : 
      98                 :         42 : sal_Bool SwXRedlines::hasElements(  ) throw(uno::RuntimeException)
      99                 :            : {
     100         [ +  - ]:         42 :     SolarMutexGuard aGuard;
     101         [ -  + ]:         42 :     if(!IsValid())
     102         [ #  # ]:          0 :         throw uno::RuntimeException();
     103         [ +  - ]:         42 :     const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
     104         [ +  - ]:         42 :     return rRedTbl.size() > 0;
     105                 :            : }
     106                 :            : 
     107                 :          0 : OUString SwXRedlines::getImplementationName(void) throw( uno::RuntimeException )
     108                 :            : {
     109                 :          0 :     return C2U("SwXRedlines");
     110                 :            : }
     111                 :            : 
     112                 :          0 : sal_Bool SwXRedlines::supportsService(const rtl::OUString& /*ServiceName*/)
     113                 :            :     throw( uno::RuntimeException )
     114                 :            : {
     115                 :            :     OSL_FAIL("not implemented");
     116                 :          0 :     return sal_False;
     117                 :            : }
     118                 :            : 
     119                 :          0 : uno::Sequence< OUString > SwXRedlines::getSupportedServiceNames(void)
     120                 :            :     throw( uno::RuntimeException )
     121                 :            : {
     122                 :            :     OSL_FAIL("not implemented");
     123                 :          0 :     return uno::Sequence< OUString >();
     124                 :            : }
     125                 :            : 
     126                 :          0 : beans::XPropertySet*    SwXRedlines::GetObject( SwRedline& rRedline, SwDoc& rDoc )
     127                 :            : {
     128         [ #  # ]:          0 :     SwPageDesc* pStdDesc = rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD);
     129         [ #  # ]:          0 :     SwIterator<SwXRedline,SwPageDesc> aIter(*pStdDesc);
     130         [ #  # ]:          0 :     SwXRedline* pxRedline = aIter.First();
     131         [ #  # ]:          0 :     while(pxRedline)
     132                 :            :     {
     133         [ #  # ]:          0 :         if(pxRedline->GetRedline() == &rRedline)
     134                 :          0 :             break;
     135         [ #  # ]:          0 :         pxRedline = aIter.Next();
     136                 :            :     }
     137         [ #  # ]:          0 :     if( !pxRedline )
     138         [ #  # ]:          0 :         pxRedline = new SwXRedline(rRedline, rDoc);
     139 [ #  # ][ #  # ]:          0 :     return pxRedline;
     140                 :            : }
     141                 :            : 
     142                 :          0 : SwXRedlineEnumeration::SwXRedlineEnumeration(SwDoc& rDoc) :
     143                 :            :     pDoc(&rDoc),
     144                 :          0 :     nCurrentIndex(0)
     145                 :            : {
     146 [ #  # ][ #  # ]:          0 :     pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
     147                 :          0 : }
     148                 :            : 
     149         [ #  # ]:          0 : SwXRedlineEnumeration::~SwXRedlineEnumeration()
     150                 :            : {
     151         [ #  # ]:          0 : }
     152                 :            : 
     153                 :          0 : sal_Bool SwXRedlineEnumeration::hasMoreElements(void) throw( uno::RuntimeException )
     154                 :            : {
     155         [ #  # ]:          0 :     if(!pDoc)
     156         [ #  # ]:          0 :         throw uno::RuntimeException();
     157                 :          0 :     return pDoc->GetRedlineTbl().size() > nCurrentIndex;
     158                 :            : }
     159                 :            : 
     160                 :          0 : uno::Any SwXRedlineEnumeration::nextElement(void)
     161                 :            :     throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
     162                 :            : {
     163         [ #  # ]:          0 :     if(!pDoc)
     164         [ #  # ]:          0 :         throw uno::RuntimeException();
     165         [ #  # ]:          0 :     const SwRedlineTbl& rRedTbl = pDoc->GetRedlineTbl();
     166         [ #  # ]:          0 :     if( rRedTbl.size() <= nCurrentIndex )
     167         [ #  # ]:          0 :         throw container::NoSuchElementException();
     168 [ #  # ][ #  # ]:          0 :     uno::Reference <beans::XPropertySet> xRet = SwXRedlines::GetObject( *rRedTbl[nCurrentIndex++], *pDoc );
                 [ #  # ]
     169                 :          0 :     uno::Any aRet;
     170         [ #  # ]:          0 :     aRet <<= xRet;
     171                 :          0 :     return aRet;
     172                 :            : }
     173                 :            : 
     174                 :          0 : rtl::OUString SwXRedlineEnumeration::getImplementationName(void) throw( uno::RuntimeException )
     175                 :            : {
     176                 :          0 :     return C2U("SwXRedlineEnumeration");
     177                 :            : }
     178                 :            : 
     179                 :          0 : sal_Bool SwXRedlineEnumeration::supportsService(const rtl::OUString& /*ServiceName*/) throw( uno::RuntimeException )
     180                 :            : {
     181                 :          0 :     return sal_False;
     182                 :            : }
     183                 :            : 
     184                 :          0 : uno::Sequence< OUString > SwXRedlineEnumeration::getSupportedServiceNames(void) throw( uno::RuntimeException )
     185                 :            : {
     186                 :          0 :     return uno::Sequence< OUString >();
     187                 :            : }
     188                 :            : 
     189                 :          0 : void SwXRedlineEnumeration::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
     190                 :            : {
     191                 :          0 :     ClientModify(this, pOld, pNew);
     192         [ #  # ]:          0 :     if(!GetRegisteredIn())
     193                 :          0 :         pDoc = 0;
     194                 :          0 : }
     195                 :            : 
     196                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10