LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbavariables.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 34 0.0 %
Date: 2012-08-25 Functions: 0 8 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 66 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 "vbavariables.hxx"
      29                 :            : #include "vbavariable.hxx"
      30                 :            : #include <com/sun/star/beans/XPropertyContainer.hpp>
      31                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      32                 :            : 
      33                 :            : using namespace ::ooo::vba;
      34                 :            : using namespace ::com::sun::star;
      35                 :            : 
      36                 :          0 : uno::Reference< container::XIndexAccess > createVariablesAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< beans::XPropertyAccess >& xUserDefined ) throw ( uno::RuntimeException )
      37                 :            : {
      38                 :            :     // FIXME: the performance is poor?
      39         [ #  # ]:          0 :     XNamedObjectCollectionHelper< word::XVariable >::XNamedVec mVariables;
      40 [ #  # ][ #  # ]:          0 :     const uno::Sequence< beans::PropertyValue > props = xUserDefined->getPropertyValues();
      41                 :          0 :     sal_Int32 nCount = props.getLength();
      42         [ #  # ]:          0 :     mVariables.reserve( nCount );
      43         [ #  # ]:          0 :     for( sal_Int32 i=0; i < nCount; i++ )
      44 [ #  # ][ #  # ]:          0 :         mVariables.push_back( uno::Reference< word::XVariable > ( new SwVbaVariable( xParent, xContext, xUserDefined, props[i].Name ) ) );
         [ #  # ][ #  # ]
      45                 :            : 
      46 [ #  # ][ #  # ]:          0 :     uno::Reference< container::XIndexAccess > xVariables( new XNamedObjectCollectionHelper< word::XVariable >( mVariables ) );
                 [ #  # ]
      47         [ #  # ]:          0 :     return xVariables;
      48                 :            : }
      49                 :            : 
      50         [ #  # ]:          0 : SwVbaVariables::SwVbaVariables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertyAccess >& rUserDefined ): SwVbaVariables_BASE( xParent, xContext, createVariablesAccess( xParent, xContext, rUserDefined ) ),  mxUserDefined( rUserDefined )
      51                 :            : {
      52                 :          0 : }
      53                 :            : // XEnumerationAccess
      54                 :            : uno::Type
      55                 :          0 : SwVbaVariables::getElementType() throw (uno::RuntimeException)
      56                 :            : {
      57                 :          0 :     return word::XVariable::static_type(0);
      58                 :            : }
      59                 :            : uno::Reference< container::XEnumeration >
      60                 :          0 : SwVbaVariables::createEnumeration() throw (uno::RuntimeException)
      61                 :            : {
      62         [ #  # ]:          0 :     uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
      63 [ #  # ][ #  # ]:          0 :     return xEnumerationAccess->createEnumeration();
      64                 :            : }
      65                 :            : 
      66                 :            : uno::Any
      67                 :          0 : SwVbaVariables::createCollectionObject( const css::uno::Any& aSource )
      68                 :            : {
      69                 :          0 :     return aSource;
      70                 :            : }
      71                 :            : 
      72                 :            : uno::Any SAL_CALL
      73                 :          0 : SwVbaVariables::Add( const rtl::OUString& rName, const uno::Any& rValue ) throw (uno::RuntimeException)
      74                 :            : {
      75                 :          0 :     uno::Any aValue;
      76         [ #  # ]:          0 :     if( rValue.hasValue() )
      77                 :          0 :         aValue = rValue;
      78                 :            :     else
      79         [ #  # ]:          0 :         aValue <<= rtl::OUString();
      80         [ #  # ]:          0 :     uno::Reference< beans::XPropertyContainer > xPropertyContainer( mxUserDefined, uno::UNO_QUERY_THROW );
      81 [ #  # ][ #  # ]:          0 :     xPropertyContainer->addProperty( rName, beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::REMOVEABLE, aValue );
      82                 :            : 
      83 [ #  # ][ #  # ]:          0 :     return uno::makeAny( uno::Reference< word::XVariable >( new SwVbaVariable( getParent(), mxContext, mxUserDefined, rName ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
      84                 :            : }
      85                 :            : 
      86                 :            : rtl::OUString
      87                 :          0 : SwVbaVariables::getServiceImplName()
      88                 :            : {
      89                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwVbaVariables"));
      90                 :            : }
      91                 :            : 
      92                 :            : css::uno::Sequence<rtl::OUString>
      93                 :          0 : SwVbaVariables::getServiceNames()
      94                 :            : {
      95 [ #  # ][ #  # ]:          0 :     static uno::Sequence< rtl::OUString > sNames;
         [ #  # ][ #  # ]
      96         [ #  # ]:          0 :     if ( sNames.getLength() == 0 )
      97                 :            :     {
      98                 :          0 :         sNames.realloc( 1 );
      99         [ #  # ]:          0 :         sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Variables") );
     100                 :            :     }
     101                 :          0 :     return sNames;
     102                 :            : }
     103                 :            : 
     104                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10