LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/vbahelper/source/msforms - vbatogglebutton.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 23 67 34.3 %
Date: 2013-07-09 Functions: 7 24 29.2 %
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             : 
      20             : #include "vbatogglebutton.hxx"
      21             : #include "vbanewfont.hxx"
      22             : 
      23             : using namespace com::sun::star;
      24             : using namespace ooo::vba;
      25             : 
      26             : 
      27           1 : const static OUString LABEL( "Label" );
      28           1 : const static OUString TOGGLE( "Toggle" );
      29           1 : const static OUString STATE( "State" );
      30          16 : ScVbaToggleButton::ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : ToggleButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
      31             : {
      32             :     SAL_INFO("vbahelper", "ScVbaToggleButton(ctor)");
      33          16 :     m_xProps->setPropertyValue( TOGGLE, uno::makeAny( sal_True ) );
      34          16 : }
      35             : 
      36          30 : ScVbaToggleButton::~ScVbaToggleButton()
      37             : {
      38             :     SAL_INFO("vbahelper", "~ScVbaToggleButton(dtor)");
      39          30 : }
      40             : 
      41             : // Attributes
      42             : OUString SAL_CALL
      43           0 : ScVbaToggleButton::getCaption() throw (css::uno::RuntimeException)
      44             : {
      45           0 :     OUString Label;
      46           0 :     m_xProps->getPropertyValue( LABEL ) >>= Label;
      47           0 :     return Label;
      48             : }
      49             : 
      50             : void SAL_CALL
      51           0 : ScVbaToggleButton::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
      52             : {
      53           0 :     m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
      54           0 : }
      55             : 
      56             : uno::Any SAL_CALL
      57          16 : ScVbaToggleButton::getValue() throw (uno::RuntimeException)
      58             : {
      59          16 :     sal_Int16 nState = 0;
      60          16 :         m_xProps->getPropertyValue( STATE ) >>= nState;
      61          16 :      return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
      62             : }
      63             : 
      64             : 
      65             : void SAL_CALL
      66           8 : ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
      67             : {
      68           8 :     sal_Int16 nState = 0;
      69           8 :     if ( ! ( _value >>= nState ) )
      70             :     {
      71           4 :         sal_Bool bState = false;
      72           4 :         _value >>= bState;
      73           4 :         if ( bState )
      74           2 :             nState = -1;
      75             :     }
      76             :     SAL_INFO("vbahelper", "nState - " << nState );
      77           8 :     nState = ( nState == -1 ) ?  1 : 0;
      78             :     SAL_INFO("vbahelper", "nState - " << nState );
      79           8 :     m_xProps->setPropertyValue( STATE, uno::makeAny(   nState ) );
      80           8 : }
      81             : 
      82           0 : sal_Bool SAL_CALL ScVbaToggleButton::getAutoSize() throw (uno::RuntimeException)
      83             : {
      84           0 :     return ScVbaControl::getAutoSize();
      85             : }
      86             : 
      87           0 : void SAL_CALL ScVbaToggleButton::setAutoSize( sal_Bool bAutoSize ) throw (uno::RuntimeException)
      88             : {
      89           0 :     ScVbaControl::setAutoSize( bAutoSize );
      90           0 : }
      91             : 
      92           0 : sal_Bool SAL_CALL ScVbaToggleButton::getCancel() throw (uno::RuntimeException)
      93             : {
      94             :     // #STUB
      95           0 :     return sal_False;
      96             : }
      97             : 
      98           0 : void SAL_CALL ScVbaToggleButton::setCancel( sal_Bool /*bCancel*/ ) throw (uno::RuntimeException)
      99             : {
     100             :     // #STUB
     101           0 : }
     102             : 
     103           0 : sal_Bool SAL_CALL ScVbaToggleButton::getDefault() throw (uno::RuntimeException)
     104             : {
     105             :     // #STUB
     106           0 :     return sal_False;
     107             : }
     108             : 
     109           0 : void SAL_CALL ScVbaToggleButton::setDefault( sal_Bool /*bDefault*/ ) throw (uno::RuntimeException)
     110             : {
     111             :     // #STUB
     112           0 : }
     113             : 
     114           0 : sal_Int32 SAL_CALL ScVbaToggleButton::getBackColor() throw (uno::RuntimeException)
     115             : {
     116           0 :     return ScVbaControl::getBackColor();
     117             : }
     118             : 
     119           0 : void SAL_CALL ScVbaToggleButton::setBackColor( sal_Int32 nBackColor ) throw (uno::RuntimeException)
     120             : {
     121           0 :     ScVbaControl::setBackColor( nBackColor );
     122           0 : }
     123             : 
     124           0 : sal_Int32 SAL_CALL ScVbaToggleButton::getForeColor() throw (uno::RuntimeException)
     125             : {
     126             :     // #STUB
     127           0 :     return 0;
     128             : }
     129             : 
     130           0 : void SAL_CALL ScVbaToggleButton::setForeColor( sal_Int32 /*nForeColor*/ ) throw (uno::RuntimeException)
     131             : {
     132             :     // #STUB
     133           0 : }
     134             : 
     135           0 : uno::Reference< msforms::XNewFont > SAL_CALL ScVbaToggleButton::getFont() throw (uno::RuntimeException)
     136             : {
     137           0 :     return new VbaNewFont( this, mxContext, m_xProps );
     138             : }
     139             : 
     140           0 : sal_Bool SAL_CALL ScVbaToggleButton::getLocked() throw (uno::RuntimeException)
     141             : {
     142           0 :     return ScVbaControl::getLocked();
     143             : }
     144             : 
     145           0 : void SAL_CALL ScVbaToggleButton::setLocked( sal_Bool bLocked ) throw (uno::RuntimeException)
     146             : {
     147           0 :     ScVbaControl::setLocked( bLocked );
     148           0 : }
     149             : 
     150             : OUString
     151           0 : ScVbaToggleButton::getServiceImplName()
     152             : {
     153           0 :     return OUString( "ScVbaToggleButton" );
     154             : }
     155             : 
     156             : uno::Sequence< OUString >
     157           0 : ScVbaToggleButton::getServiceNames()
     158             : {
     159           0 :     static uno::Sequence< OUString > aServiceNames;
     160           0 :     if ( aServiceNames.getLength() == 0 )
     161             :     {
     162           0 :         aServiceNames.realloc( 1 );
     163           0 :         aServiceNames[ 0 ] = "ooo.vba.msforms.ToggleButton";
     164             :     }
     165           0 :     return aServiceNames;
     166           3 : }
     167             : 
     168             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10