LCOV - code coverage report
Current view: top level - sd/source/core/annotations - AnnotationEnumeration.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 9 13 69.2 %
Date: 2012-08-25 Functions: 5 6 83.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 18 33.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                 :            : 
      21                 :            : #include "sal/config.h"
      22                 :            : 
      23                 :            : #include "cppuhelper/implbase1.hxx"
      24                 :            : 
      25                 :            : #include "com/sun/star/uno/XComponentContext.hpp"
      26                 :            : #include "com/sun/star/office/XAnnotationEnumeration.hpp"
      27                 :            : 
      28                 :            : #include "sdpage.hxx"
      29                 :            : namespace css = ::com::sun::star;
      30                 :            : 
      31                 :            : using namespace ::com::sun::star::uno;
      32                 :            : using namespace ::com::sun::star::office;
      33                 :            : using namespace ::com::sun::star::container;
      34                 :            : using namespace ::com::sun::star::lang;
      35                 :            : 
      36                 :            : namespace sd {
      37                 :            : 
      38         [ -  + ]:        388 : class AnnotationEnumeration: public ::cppu::WeakImplHelper1< css::office::XAnnotationEnumeration >
      39                 :            : {
      40                 :            : public:
      41                 :            :     AnnotationEnumeration( const AnnotationVector& rAnnotations );
      42                 :            : 
      43                 :            :     // ::com::sun::star::office::XAnnotationEnumeration:
      44                 :            :     virtual ::sal_Bool SAL_CALL hasMoreElements() throw (css::uno::RuntimeException);
      45                 :            :     virtual css::uno::Reference< css::office::XAnnotation > SAL_CALL nextElement() throw (css::uno::RuntimeException, css::container::NoSuchElementException);
      46                 :            : 
      47                 :            : private:
      48                 :            :     AnnotationEnumeration(const AnnotationEnumeration &); // not defined
      49                 :            :     AnnotationEnumeration& operator=(const AnnotationEnumeration &); // not defined
      50                 :            : 
      51                 :            :     // destructor is private and will be called indirectly by the release call    virtual ~AnnotationEnumeration() {}
      52                 :            : 
      53                 :            :     AnnotationVector maAnnotations;
      54                 :            :     AnnotationVector::iterator maIter;
      55                 :            : };
      56                 :            : 
      57                 :        194 : Reference< XAnnotationEnumeration > createAnnotationEnumeration( const sd::AnnotationVector& rAnnotations )
      58                 :            : {
      59 [ +  - ][ +  - ]:        194 :     return new AnnotationEnumeration( rAnnotations );
      60                 :            : }
      61                 :            : 
      62                 :        194 : AnnotationEnumeration::AnnotationEnumeration( const AnnotationVector& rAnnotations )
      63         [ +  - ]:        194 : : maAnnotations(rAnnotations)
      64                 :            : {
      65                 :        194 :     maIter = maAnnotations.begin();
      66                 :        194 : }
      67                 :            : 
      68                 :            : // ::com::sun::star::office::XAnnotationEnumeration:
      69                 :        194 : ::sal_Bool SAL_CALL AnnotationEnumeration::hasMoreElements() throw (css::uno::RuntimeException)
      70                 :            : {
      71 [ +  - ][ -  + ]:        194 :     return maIter != maAnnotations.end() ? sal_True : sal_False;
      72                 :            : }
      73                 :            : 
      74                 :          0 : css::uno::Reference< css::office::XAnnotation > SAL_CALL AnnotationEnumeration::nextElement() throw (css::uno::RuntimeException, css::container::NoSuchElementException)
      75                 :            : {
      76 [ #  # ][ #  # ]:          0 :     if( maIter == maAnnotations.end() )
      77         [ #  # ]:          0 :         throw css::container::NoSuchElementException();
      78                 :            : 
      79                 :          0 :     return (*maIter++);
      80                 :            : }
      81                 :            : 
      82                 :            : } // namespace sd
      83                 :            : 
      84                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10