LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbapanes.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 36 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 18 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 "vbapanes.hxx"
      20             : #include "vbapane.hxx"
      21             : #include <cppuhelper/implbase.hxx>
      22             : 
      23             : using namespace ::ooo::vba;
      24             : using namespace ::com::sun::star;
      25             : 
      26             : // I assume there is only one pane in Writer
      27             : typedef ::cppu::WeakImplHelper<container::XIndexAccess > PanesIndexAccess_Base;
      28             : class PanesIndexAccess : public PanesIndexAccess_Base
      29             : {
      30             : private:
      31             :     uno::Reference< XHelperInterface > mxParent;
      32             :     uno::Reference< uno::XComponentContext > mxContext;
      33             :     uno::Reference< frame::XModel > mxModel;
      34             : 
      35             : public:
      36           0 :     PanesIndexAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ) {}
      37           0 :     virtual ~PanesIndexAccess(){}
      38             : 
      39             :     // XIndexAccess
      40           0 :     virtual sal_Int32 SAL_CALL getCount(  ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
      41             :     {
      42           0 :         return 1;
      43             :     }
      44           0 :     virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE
      45             :     {
      46           0 :         if( Index != 1 )
      47           0 :             throw lang::IndexOutOfBoundsException();
      48           0 :         return uno::makeAny( uno::Reference< word::XPane >( new SwVbaPane( mxParent,  mxContext, mxModel ) ) );
      49             :     }
      50           0 :     virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
      51             :     {
      52           0 :         return cppu::UnoType<word::XPane>::get();
      53             :     }
      54           0 :     virtual sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
      55             :     {
      56           0 :         return sal_True;
      57             :     }
      58             : };
      59             : 
      60           0 : class PanesEnumWrapper : public EnumerationHelper_BASE
      61             : {
      62             :     uno::Reference<container::XIndexAccess > m_xIndexAccess;
      63             :     sal_Int32 nIndex;
      64             : public:
      65           0 :     explicit PanesEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {}
      66           0 :     virtual sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
      67             :     {
      68           0 :         return ( nIndex < m_xIndexAccess->getCount() );
      69             :     }
      70             : 
      71           0 :     virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE
      72             :     {
      73           0 :         if ( nIndex < m_xIndexAccess->getCount() )
      74           0 :             return m_xIndexAccess->getByIndex( nIndex++ );
      75           0 :         throw container::NoSuchElementException();
      76             :     }
      77             : };
      78             : 
      79           0 : SwVbaPanes::SwVbaPanes( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaPanes_BASE( xParent, xContext, new PanesIndexAccess( xParent, xContext, xModel ) ),  mxModel( xModel )
      80             : {
      81           0 : }
      82             : // XEnumerationAccess
      83             : uno::Type
      84           0 : SwVbaPanes::getElementType() throw (uno::RuntimeException)
      85             : {
      86           0 :     return cppu::UnoType<word::XPane>::get();
      87             : }
      88             : uno::Reference< container::XEnumeration >
      89           0 : SwVbaPanes::createEnumeration() throw (uno::RuntimeException)
      90             : {
      91           0 :     return new PanesEnumWrapper( m_xIndexAccess );
      92             : }
      93             : 
      94             : uno::Any
      95           0 : SwVbaPanes::createCollectionObject( const css::uno::Any& aSource )
      96             : {
      97           0 :     return aSource;
      98             : }
      99             : 
     100             : OUString
     101           0 : SwVbaPanes::getServiceImplName()
     102             : {
     103           0 :     return OUString("SwVbaPanes");
     104             : }
     105             : 
     106             : css::uno::Sequence<OUString>
     107           0 : SwVbaPanes::getServiceNames()
     108             : {
     109           0 :     static uno::Sequence< OUString > sNames;
     110           0 :     if ( sNames.getLength() == 0 )
     111             :     {
     112           0 :         sNames.realloc( 1 );
     113           0 :         sNames[0] = "ooo.vba.word.Panes";
     114             :     }
     115           0 :     return sNames;
     116             : }
     117             : 
     118             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11