LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbalisttemplates.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 33 0.0 %
Date: 2014-04-14 Functions: 0 13 0.0 %
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             : #include "vbalisttemplates.hxx"
      20             : #include "vbalisttemplate.hxx"
      21             : 
      22             : using namespace ::ooo::vba;
      23             : using namespace ::com::sun::star;
      24             : 
      25           0 : class ListTemplatesEnumWrapper : public EnumerationHelper_BASE
      26             : {
      27             :     SwVbaListTemplates* pListTemplates;
      28             :     sal_Int32 nIndex;
      29             : public:
      30           0 :     ListTemplatesEnumWrapper( SwVbaListTemplates* pTemplates ) : pListTemplates( pTemplates ), nIndex( 1 ) {}
      31           0 :     virtual sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
      32             :     {
      33           0 :         return ( nIndex <= pListTemplates->getCount() );
      34             :     }
      35             : 
      36           0 :     virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE
      37             :     {
      38           0 :         if ( nIndex <= pListTemplates->getCount() )
      39           0 :             return pListTemplates->Item( uno::makeAny( nIndex++ ), uno::Any() );
      40           0 :         throw container::NoSuchElementException();
      41             :     }
      42             : };
      43             : 
      44           0 : SwVbaListTemplates::SwVbaListTemplates( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw (uno::RuntimeException) : SwVbaListTemplates_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ),  mxTextDocument( xTextDoc ), mnGalleryType( nType )
      45             : {
      46           0 : }
      47             : 
      48           0 : ::sal_Int32 SAL_CALL SwVbaListTemplates::getCount() throw (uno::RuntimeException)
      49             : {
      50             :     // 3 types of list( bullet, numbered and outline )
      51           0 :     return 7;
      52             : }
      53             : 
      54           0 : uno::Any SAL_CALL SwVbaListTemplates::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
      55             : {
      56           0 :     sal_Int32 nIndex = 0;
      57           0 :     if( !( Index1 >>= nIndex ) )
      58           0 :         throw uno::RuntimeException();
      59           0 :     if( nIndex <=0 || nIndex > getCount() )
      60           0 :         throw  uno::RuntimeException("Index out of bounds", uno::Reference< uno::XInterface >() );
      61             : 
      62           0 :     return uno::makeAny( uno::Reference< word::XListTemplate >( new SwVbaListTemplate( this, mxContext, mxTextDocument, mnGalleryType, nIndex ) ) );
      63             : }
      64             : 
      65             : // XEnumerationAccess
      66             : uno::Type
      67           0 : SwVbaListTemplates::getElementType() throw (uno::RuntimeException)
      68             : {
      69           0 :     return cppu::UnoType<word::XListTemplate>::get();
      70             : }
      71             : 
      72             : uno::Reference< container::XEnumeration >
      73           0 : SwVbaListTemplates::createEnumeration() throw (uno::RuntimeException)
      74             : {
      75           0 :     return new ListTemplatesEnumWrapper( this );
      76             : }
      77             : 
      78             : uno::Any
      79           0 : SwVbaListTemplates::createCollectionObject( const css::uno::Any& aSource )
      80             : {
      81           0 :     return aSource;
      82             : }
      83             : 
      84             : OUString
      85           0 : SwVbaListTemplates::getServiceImplName()
      86             : {
      87           0 :     return OUString("SwVbaListTemplates");
      88             : }
      89             : 
      90             : css::uno::Sequence<OUString>
      91           0 : SwVbaListTemplates::getServiceNames()
      92             : {
      93           0 :     static uno::Sequence< OUString > sNames;
      94           0 :     if ( sNames.getLength() == 0 )
      95             :     {
      96           0 :         sNames.realloc( 1 );
      97           0 :         sNames[0] = "ooo.vba.word.ListTemplates";
      98             :     }
      99           0 :     return sNames;
     100             : }
     101             : 
     102             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10