LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbavariable.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 30 0.0 %
Date: 2012-08-25 Functions: 0 10 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 40 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 "vbavariable.hxx"
      29                 :            : #include <vbahelper/vbahelper.hxx>
      30                 :            : #include <tools/diagnose_ex.h>
      31                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      32                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      33                 :            : 
      34                 :            : using namespace ::ooo::vba;
      35                 :            : using namespace ::com::sun::star;
      36                 :            : 
      37                 :          0 : SwVbaVariable::SwVbaVariable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
      38                 :            :     const uno::Reference< beans::XPropertyAccess >& rUserDefined, const rtl::OUString& rName ) throw ( uno::RuntimeException ) :
      39                 :          0 :     SwVbaVariable_BASE( rParent, rContext ), mxUserDefined( rUserDefined ), maName( rName )
      40                 :            : {
      41                 :          0 : }
      42                 :            : 
      43                 :          0 : SwVbaVariable::~SwVbaVariable()
      44                 :            : {
      45         [ #  # ]:          0 : }
      46                 :            : 
      47                 :            : rtl::OUString SAL_CALL
      48                 :          0 : SwVbaVariable::getName() throw ( css::uno::RuntimeException )
      49                 :            : {
      50                 :          0 :     return maName;
      51                 :            : }
      52                 :            : 
      53                 :            : void SAL_CALL
      54                 :          0 : SwVbaVariable::setName( const rtl::OUString& ) throw ( css::uno::RuntimeException )
      55                 :            : {
      56                 :            :     throw uno::RuntimeException( rtl::OUString(
      57 [ #  # ][ #  # ]:          0 :             RTL_CONSTASCII_USTRINGPARAM(" Fail to set name")), uno::Reference< uno::XInterface >() );
      58                 :            : }
      59                 :            : 
      60                 :            : uno::Any SAL_CALL
      61                 :          0 : SwVbaVariable::getValue() throw ( css::uno::RuntimeException )
      62                 :            : {
      63         [ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xProp( mxUserDefined, uno::UNO_QUERY_THROW );
      64 [ #  # ][ #  # ]:          0 :     return xProp->getPropertyValue( maName );
      65                 :            : }
      66                 :            : 
      67                 :            : void SAL_CALL
      68                 :          0 : SwVbaVariable::setValue( const uno::Any& rValue ) throw ( css::uno::RuntimeException )
      69                 :            : {
      70                 :            :     // FIXME: fail to set the value if the new type of vaue is differenct from the original one.
      71         [ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xProp( mxUserDefined, uno::UNO_QUERY_THROW );
      72 [ #  # ][ #  # ]:          0 :     xProp->setPropertyValue( maName, rValue );
      73                 :          0 : }
      74                 :            : 
      75                 :            : sal_Int32 SAL_CALL
      76                 :          0 : SwVbaVariable::getIndex() throw ( css::uno::RuntimeException )
      77                 :            : {
      78 [ #  # ][ #  # ]:          0 :     const uno::Sequence< beans::PropertyValue > props = mxUserDefined->getPropertyValues();
      79         [ #  # ]:          0 :     for (sal_Int32 i = 0; i < props.getLength(); ++i)
      80                 :            :     {
      81         [ #  # ]:          0 :         if( maName.equals( props[i].Name ) )
      82                 :          0 :             return i+1;
      83                 :            :     }
      84                 :            : 
      85         [ #  # ]:          0 :     return 0;
      86                 :            : }
      87                 :            : 
      88                 :            : rtl::OUString
      89                 :          0 : SwVbaVariable::getServiceImplName()
      90                 :            : {
      91                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwVbaVariable"));
      92                 :            : }
      93                 :            : 
      94                 :            : uno::Sequence< rtl::OUString >
      95                 :          0 : SwVbaVariable::getServiceNames()
      96                 :            : {
      97 [ #  # ][ #  # ]:          0 :     static uno::Sequence< rtl::OUString > aServiceNames;
         [ #  # ][ #  # ]
      98         [ #  # ]:          0 :     if ( aServiceNames.getLength() == 0 )
      99                 :            :     {
     100                 :          0 :         aServiceNames.realloc( 1 );
     101         [ #  # ]:          0 :         aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Variable" ) );
     102                 :            :     }
     103                 :          0 :     return aServiceNames;
     104                 :            : }
     105                 :            : 
     106                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10