LCOV - code coverage report
Current view: top level - sd/source/core/annotations - AnnotationEnumeration.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 10 14 71.4 %
Date: 2014-11-03 Functions: 7 8 87.5 %
Legend: Lines: hit not hit

          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 "sal/config.h"
      21             : 
      22             : #include "boost/noncopyable.hpp"
      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 "AnnotationEnumeration.hxx"
      29             : #include "sdpage.hxx"
      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         632 : class AnnotationEnumeration: public ::cppu::WeakImplHelper1< css::office::XAnnotationEnumeration >, private boost::noncopyable
      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, std::exception) SAL_OVERRIDE;
      45             :     virtual css::uno::Reference< css::office::XAnnotation > SAL_CALL nextElement() throw (css::uno::RuntimeException, css::container::NoSuchElementException, std::exception) SAL_OVERRIDE;
      46             : 
      47             : private:
      48             :     // destructor is private and will be called indirectly by the release call    virtual ~AnnotationEnumeration() {}
      49             : 
      50             :     AnnotationVector maAnnotations;
      51             :     AnnotationVector::iterator maIter;
      52             : };
      53             : 
      54         316 : Reference< XAnnotationEnumeration > createAnnotationEnumeration( const sd::AnnotationVector& rAnnotations )
      55             : {
      56         316 :     return new AnnotationEnumeration( rAnnotations );
      57             : }
      58             : 
      59         316 : AnnotationEnumeration::AnnotationEnumeration( const AnnotationVector& rAnnotations )
      60         316 : : maAnnotations(rAnnotations)
      61             : {
      62         316 :     maIter = maAnnotations.begin();
      63         316 : }
      64             : 
      65             : // ::com::sun::star::office::XAnnotationEnumeration:
      66         316 : sal_Bool SAL_CALL AnnotationEnumeration::hasMoreElements() throw (css::uno::RuntimeException, std::exception)
      67             : {
      68         316 :     return maIter != maAnnotations.end() ? sal_True : sal_False;
      69             : }
      70             : 
      71           0 : css::uno::Reference< css::office::XAnnotation > SAL_CALL AnnotationEnumeration::nextElement() throw (css::uno::RuntimeException, css::container::NoSuchElementException, std::exception)
      72             : {
      73           0 :     if( maIter == maAnnotations.end() )
      74           0 :         throw css::container::NoSuchElementException();
      75             : 
      76           0 :     return (*maIter++);
      77             : }
      78             : 
      79         114 : } // namespace sd
      80             : 
      81             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10