LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbaparagraph.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 71 0.0 %
Date: 2012-08-25 Functions: 0 23 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 148 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #include "vbaparagraph.hxx"
      29                 :            : #include <vbahelper/vbahelper.hxx>
      30                 :            : #include <tools/diagnose_ex.h>
      31                 :            : #include "vbarange.hxx"
      32                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      33                 :            : 
      34                 :            : using namespace ::ooo::vba;
      35                 :            : using namespace ::com::sun::star;
      36                 :            : 
      37                 :          0 : SwVbaParagraph::SwVbaParagraph( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xDocument, const uno::Reference< text::XTextRange >& xTextRange ) throw ( uno::RuntimeException ) :
      38                 :          0 :     SwVbaParagraph_BASE( rParent, rContext ), mxTextDocument( xDocument ), mxTextRange( xTextRange )
      39                 :            : {
      40                 :          0 : }
      41                 :            : 
      42                 :          0 : SwVbaParagraph::~SwVbaParagraph()
      43                 :            : {
      44         [ #  # ]:          0 : }
      45                 :            : 
      46                 :            : uno::Reference< word::XRange > SAL_CALL
      47                 :          0 : SwVbaParagraph::getRange( ) throw ( uno::RuntimeException )
      48                 :            : {
      49 [ #  # ][ #  # ]:          0 :     return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, mxTextRange->getStart(), mxTextRange->getEnd(), mxTextRange->getText(), sal_True ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
      50                 :            : }
      51                 :            : 
      52                 :            : uno::Any SAL_CALL
      53                 :          0 : SwVbaParagraph::getStyle( ) throw ( uno::RuntimeException )
      54                 :            : {
      55         [ #  # ]:          0 :     uno::Reference< word::XRange > xRange = getRange();
      56 [ #  # ][ #  # ]:          0 :     return xRange->getStyle();
      57                 :            : }
      58                 :            : 
      59                 :            : void SAL_CALL
      60                 :          0 : SwVbaParagraph::setStyle( const uno::Any& style ) throw ( uno::RuntimeException )
      61                 :            : {
      62         [ #  # ]:          0 :     uno::Reference< word::XRange > xRange = getRange();
      63 [ #  # ][ #  # ]:          0 :     xRange->setStyle( style );
      64                 :          0 : }
      65                 :            : 
      66                 :            : rtl::OUString
      67                 :          0 : SwVbaParagraph::getServiceImplName()
      68                 :            : {
      69                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraph"));
      70                 :            : }
      71                 :            : 
      72                 :            : uno::Sequence< rtl::OUString >
      73                 :          0 : SwVbaParagraph::getServiceNames()
      74                 :            : {
      75 [ #  # ][ #  # ]:          0 :     static uno::Sequence< rtl::OUString > aServiceNames;
         [ #  # ][ #  # ]
      76         [ #  # ]:          0 :     if ( aServiceNames.getLength() == 0 )
      77                 :            :     {
      78                 :          0 :         aServiceNames.realloc( 1 );
      79         [ #  # ]:          0 :         aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Paragraph" ) );
      80                 :            :     }
      81                 :          0 :     return aServiceNames;
      82                 :            : }
      83                 :            : 
      84                 :            : typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > ParagraphCollectionHelper_BASE;
      85                 :            : 
      86         [ #  # ]:          0 : class ParagraphCollectionHelper : public ParagraphCollectionHelper_BASE
      87                 :            : {
      88                 :            : private:
      89                 :            :     uno::Reference< text::XTextDocument > mxTextDocument;
      90                 :            : 
      91                 :          0 :     uno::Reference< container::XEnumeration > getEnumeration() throw (uno::RuntimeException)
      92                 :            :     {
      93 [ #  # ][ #  # ]:          0 :         uno::Reference< container::XEnumerationAccess > xParEnumAccess( mxTextDocument->getText(), uno::UNO_QUERY_THROW );
                 [ #  # ]
      94 [ #  # ][ #  # ]:          0 :         return xParEnumAccess->createEnumeration();
      95                 :            :     }
      96                 :            : 
      97                 :            : public:
      98                 :          0 :     ParagraphCollectionHelper( const uno::Reference< text::XTextDocument >& xDocument ) throw (uno::RuntimeException): mxTextDocument( xDocument )
      99                 :            :     {
     100                 :          0 :     }
     101                 :            :     // XElementAccess
     102                 :          0 :     virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException) { return  text::XTextRange::static_type(0); }
     103                 :          0 :     virtual ::sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException) { return sal_True; }
     104                 :            :     // XIndexAccess
     105                 :          0 :     virtual ::sal_Int32 SAL_CALL getCount(  ) throw (uno::RuntimeException)
     106                 :            :     {
     107                 :          0 :         sal_Int32 nCount = 0;
     108         [ #  # ]:          0 :         uno::Reference< container::XEnumeration > xParEnum = getEnumeration();
     109 [ #  # ][ #  # ]:          0 :         while( xParEnum->hasMoreElements() )
                 [ #  # ]
     110                 :            :         {
     111 [ #  # ][ #  # ]:          0 :             uno::Reference< lang::XServiceInfo > xServiceInfo( xParEnum->nextElement(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     112 [ #  # ][ #  # ]:          0 :             if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph") ) ) )
         [ #  # ][ #  # ]
     113                 :            :             {
     114                 :          0 :                 nCount++;
     115                 :            :             }
     116                 :          0 :         }
     117                 :          0 :         return nCount;
     118                 :            :     }
     119                 :          0 :     virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
     120                 :            :     {
     121         [ #  # ]:          0 :         if( Index < getCount() )
     122                 :            :         {
     123                 :          0 :             sal_Int32 nCount = 0;
     124         [ #  # ]:          0 :             uno::Reference< container::XEnumeration > xParEnum = getEnumeration();
     125 [ #  # ][ #  # ]:          0 :             while( xParEnum->hasMoreElements() )
                 [ #  # ]
     126                 :            :             {
     127 [ #  # ][ #  # ]:          0 :                 uno::Reference< lang::XServiceInfo > xServiceInfo( xParEnum->nextElement(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     128 [ #  # ][ #  # ]:          0 :                 if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph") ) ) )
         [ #  # ][ #  # ]
     129                 :            :                 {
     130         [ #  # ]:          0 :                     if( Index == nCount )
     131         [ #  # ]:          0 :                         return uno::makeAny( xServiceInfo );
     132                 :          0 :                     nCount++;
     133                 :            :                 }
     134 [ #  # ][ #  # ]:          0 :             }
     135                 :            :         }
     136         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
     137                 :            :     }
     138                 :            :     // XEnumerationAccess
     139                 :          0 :     virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration(  ) throw (uno::RuntimeException)
     140                 :            :     {
     141                 :          0 :         return getEnumeration();
     142                 :            :     }
     143                 :            : };
     144                 :            : 
     145 [ #  # ][ #  # ]:          0 : SwVbaParagraphs::SwVbaParagraphs( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDocument ) throw (uno::RuntimeException) : SwVbaParagraphs_BASE( xParent, xContext, new ParagraphCollectionHelper( xDocument ) ), mxTextDocument( xDocument )
                 [ #  # ]
     146                 :            : {
     147                 :          0 : }
     148                 :            : 
     149                 :            : // XEnumerationAccess
     150                 :            : uno::Type
     151                 :          0 : SwVbaParagraphs::getElementType() throw (uno::RuntimeException)
     152                 :            : {
     153                 :          0 :     return word::XParagraph::static_type(0);
     154                 :            : }
     155                 :            : uno::Reference< container::XEnumeration >
     156                 :          0 : SwVbaParagraphs::createEnumeration() throw (uno::RuntimeException)
     157                 :            : {
     158         [ #  # ]:          0 :     uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
     159 [ #  # ][ #  # ]:          0 :     return xEnumerationAccess->createEnumeration();
     160                 :            : }
     161                 :            : 
     162                 :            : uno::Any
     163                 :          0 : SwVbaParagraphs::createCollectionObject( const css::uno::Any& aSource )
     164                 :            : {
     165         [ #  # ]:          0 :     uno::Reference< text::XTextRange > xTextRange( aSource, uno::UNO_QUERY_THROW );
     166 [ #  # ][ #  # ]:          0 :     return uno::makeAny( uno::Reference< word::XParagraph >( new SwVbaParagraph( this, mxContext, mxTextDocument, xTextRange ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     167                 :            : }
     168                 :            : 
     169                 :            : rtl::OUString
     170                 :          0 : SwVbaParagraphs::getServiceImplName()
     171                 :            : {
     172                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraphs"));
     173                 :            : }
     174                 :            : 
     175                 :            : css::uno::Sequence<rtl::OUString>
     176                 :          0 : SwVbaParagraphs::getServiceNames()
     177                 :            : {
     178 [ #  # ][ #  # ]:          0 :     static uno::Sequence< rtl::OUString > sNames;
         [ #  # ][ #  # ]
     179         [ #  # ]:          0 :     if ( sNames.getLength() == 0 )
     180                 :            :     {
     181                 :          0 :         sNames.realloc( 1 );
     182         [ #  # ]:          0 :         sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Paragraphs") );
     183                 :            :     }
     184                 :          0 :     return sNames;
     185                 :            : }
     186                 :            : 
     187                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10