LCOV - code coverage report
Current view: top level - libreoffice/vbahelper/source/msforms - vbacheckbox.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 57 0.0 %
Date: 2012-12-17 Functions: 0 16 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             : 
      20             : #include "vbacheckbox.hxx"
      21             : #include "vbanewfont.hxx"
      22             : #include <vbahelper/helperdecl.hxx>
      23             : 
      24             : using namespace com::sun::star;
      25             : using namespace ooo::vba;
      26             : 
      27             : 
      28           0 : const static OUString LABEL( "Label" );
      29           0 : const static OUString STATE( "State" );
      30           0 : ScVbaCheckbox::ScVbaCheckbox( const 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 ) : CheckBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
      31             : {
      32           0 : }
      33             : 
      34             : // Attributes
      35             : OUString SAL_CALL
      36           0 : ScVbaCheckbox::getCaption() throw (css::uno::RuntimeException)
      37             : {
      38           0 :     OUString Label;
      39           0 :     m_xProps->getPropertyValue( LABEL ) >>= Label;
      40           0 :     return Label;
      41             : }
      42             : 
      43             : void SAL_CALL
      44           0 : ScVbaCheckbox::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
      45             : {
      46           0 :     m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
      47           0 : }
      48             : 
      49             : uno::Any SAL_CALL
      50           0 : ScVbaCheckbox::getValue() throw (css::uno::RuntimeException)
      51             : {
      52           0 :     sal_Int16 nValue = -1;
      53           0 :     m_xProps->getPropertyValue( STATE ) >>= nValue;
      54           0 :     if( nValue != 0 )
      55           0 :         nValue = -1;
      56             : //    return uno::makeAny( nValue );
      57             : // I must be missing something MSO says value should be -1 if selected, 0 if not
      58             : // selected
      59           0 :     return uno::makeAny( ( nValue == -1 ) ? sal_True : sal_False );
      60             : }
      61             : 
      62             : void SAL_CALL
      63           0 : ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
      64             : {
      65           0 :     sal_Int16 nValue = 0;
      66           0 :     sal_Int16 nOldValue = 0;
      67           0 :     m_xProps->getPropertyValue( STATE ) >>= nOldValue;
      68           0 :     sal_Bool bValue = false;
      69           0 :     if( _value >>= nValue )
      70             :     {
      71           0 :         if( nValue == -1)
      72           0 :             nValue = 1;
      73             :     }
      74           0 :     else if ( _value >>= bValue )
      75             :     {
      76           0 :         if ( bValue )
      77           0 :             nValue = 1;
      78             :     }
      79           0 :     m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
      80           0 :     if ( nValue != nOldValue )
      81           0 :         fireClickEvent();
      82           0 : }
      83             : 
      84           0 : uno::Reference< msforms::XNewFont > SAL_CALL ScVbaCheckbox::getFont() throw (uno::RuntimeException)
      85             : {
      86           0 :     return new VbaNewFont( this, mxContext, m_xProps );
      87             : }
      88             : 
      89             : OUString
      90           0 : ScVbaCheckbox::getServiceImplName()
      91             : {
      92           0 :     return OUString("ScVbaCheckbox");
      93             : }
      94             : 
      95             : uno::Sequence< OUString >
      96           0 : ScVbaCheckbox::getServiceNames()
      97             : {
      98           0 :     static uno::Sequence< OUString > aServiceNames;
      99           0 :     if ( aServiceNames.getLength() == 0 )
     100             :     {
     101           0 :         aServiceNames.realloc( 1 );
     102           0 :         aServiceNames[ 0 ] = "ooo.vba.msforms.CheckBox";
     103             :     }
     104           0 :     return aServiceNames;
     105             : }
     106             : 
     107           0 : sal_Int32 SAL_CALL ScVbaCheckbox::getBackColor() throw (uno::RuntimeException)
     108             : {
     109           0 :     return ScVbaControl::getBackColor();
     110             : }
     111             : 
     112           0 : void SAL_CALL ScVbaCheckbox::setBackColor( sal_Int32 nBackColor ) throw (uno::RuntimeException)
     113             : {
     114           0 :     ScVbaControl::setBackColor( nBackColor );
     115           0 : }
     116             : 
     117           0 : sal_Bool SAL_CALL ScVbaCheckbox::getAutoSize() throw (uno::RuntimeException)
     118             : {
     119           0 :     return ScVbaControl::getAutoSize();
     120             : }
     121             : 
     122           0 : void SAL_CALL ScVbaCheckbox::setAutoSize( sal_Bool bAutoSize ) throw (uno::RuntimeException)
     123             : {
     124           0 :     ScVbaControl::setAutoSize( bAutoSize );
     125           0 : }
     126             : 
     127           0 : sal_Bool SAL_CALL ScVbaCheckbox::getLocked() throw (uno::RuntimeException)
     128             : {
     129           0 :     return ScVbaControl::getLocked();
     130             : }
     131             : 
     132           0 : void SAL_CALL ScVbaCheckbox::setLocked( sal_Bool bLocked ) throw (uno::RuntimeException)
     133             : {
     134           0 :     ScVbaControl::setLocked( bLocked );
     135           0 : }
     136             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10