LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbaframes.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 28 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 11 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 "vbaframes.hxx"
      20             : #include "vbaframe.hxx"
      21             : #include <com/sun/star/text/XTextDocument.hpp>
      22             : #include <com/sun/star/text/XTextViewCursor.hpp>
      23             : #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
      24             : #include "wordvbahelper.hxx"
      25             : #include <cppuhelper/implbase.hxx>
      26             : 
      27             : using namespace ::ooo::vba;
      28             : using namespace ::com::sun::star;
      29             : 
      30             : typedef ::cppu::WeakImplHelper< container::XEnumeration > FramesEnumeration_Base;
      31           0 : class FramesEnumeration : public FramesEnumeration_Base
      32             : {
      33             : private:
      34             :     uno::Reference< XHelperInterface > mxParent;
      35             :     uno::Reference< uno::XComponentContext > mxContext;
      36             :     uno::Reference< container::XIndexAccess> mxIndexAccess;
      37             :     uno::Reference< frame::XModel > mxModel;
      38             :     sal_Int32 nCurrentPos;
      39             : public:
      40           0 :     FramesEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess,  const uno::Reference< frame::XModel >& xModel  ) throw ( uno::RuntimeException ) : mxParent( xParent ), mxContext( xContext), mxIndexAccess( xIndexAccess ), mxModel( xModel ), nCurrentPos(0)
      41             :     {
      42           0 :     }
      43           0 :     virtual sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE
      44             :     {
      45           0 :         return ( nCurrentPos < mxIndexAccess->getCount() );
      46             :     }
      47             : 
      48           0 :     virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception) SAL_OVERRIDE
      49             :     {
      50           0 :         if ( !hasMoreElements() )
      51           0 :             throw container::NoSuchElementException();
      52           0 :         uno::Reference< text::XTextFrame > xTextFrame( mxIndexAccess->getByIndex( nCurrentPos++ ), uno::UNO_QUERY_THROW );
      53           0 :         return uno::makeAny( uno::Reference< word::XFrame > ( new SwVbaFrame( mxParent, mxContext, mxModel, xTextFrame ) ) );
      54             :     }
      55             : 
      56             : };
      57             : 
      58           0 : SwVbaFrames::SwVbaFrames( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xFrames, const uno::Reference< frame::XModel >& xModel ): SwVbaFrames_BASE( xParent, xContext, xFrames ), mxModel( xModel )
      59             : {
      60           0 :     mxFramesSupplier.set( mxModel, uno::UNO_QUERY_THROW );
      61           0 : }
      62             : // XEnumerationAccess
      63             : uno::Type
      64           0 : SwVbaFrames::getElementType() throw (uno::RuntimeException)
      65             : {
      66           0 :     return cppu::UnoType<word::XFrame>::get();
      67             : }
      68             : 
      69             : uno::Reference< container::XEnumeration >
      70           0 : SwVbaFrames::createEnumeration() throw (uno::RuntimeException)
      71             : {
      72           0 :     return new FramesEnumeration( this, mxContext,m_xIndexAccess, mxModel );
      73             : }
      74             : 
      75             : uno::Any
      76           0 : SwVbaFrames::createCollectionObject( const css::uno::Any& aSource )
      77             : {
      78           0 :     uno::Reference< text::XTextFrame > xTextFrame( aSource, uno::UNO_QUERY_THROW );
      79           0 :     return uno::makeAny( uno::Reference< word::XFrame > ( new SwVbaFrame( this, mxContext, mxModel, xTextFrame ) ) );
      80             : }
      81             : 
      82             : OUString
      83           0 : SwVbaFrames::getServiceImplName()
      84             : {
      85           0 :     return OUString("SwVbaFrames");
      86             : }
      87             : 
      88             : css::uno::Sequence<OUString>
      89           0 : SwVbaFrames::getServiceNames()
      90             : {
      91           0 :     static uno::Sequence< OUString > sNames;
      92           0 :     if ( sNames.getLength() == 0 )
      93             :     {
      94           0 :         sNames.realloc( 1 );
      95           0 :         sNames[0] = "ooo.vba.word.Frames";
      96             :     }
      97           0 :     return sNames;
      98             : }
      99             : 
     100             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11