LCOV - code coverage report
Current view: top level - vbahelper/source/msforms - vbacheckbox.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 57 0.0 %
Date: 2014-04-14 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, std::exception)
      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, std::exception)
      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, std::exception)
      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, std::exception)
      64             : {
      65           0 :     sal_Int16 nValue = 0;
      66           0 :     sal_Int16 nOldValue = 0;
      67           0 :     m_xProps->getPropertyValue( STATE ) >>= nOldValue;
      68           0 :     if( !( _value >>= nValue ) )
      69             :     {
      70           0 :         sal_Bool bValue = false;
      71           0 :         _value >>= bValue;
      72           0 :         if ( bValue )
      73           0 :             nValue = -1;
      74             :     }
      75             : 
      76           0 :     if( nValue == -1)
      77           0 :         nValue = 1;
      78           0 :     m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
      79           0 :     if ( nValue != nOldValue )
      80           0 :         fireClickEvent();
      81           0 : }
      82             : 
      83           0 : uno::Reference< msforms::XNewFont > SAL_CALL ScVbaCheckbox::getFont() throw (uno::RuntimeException, std::exception)
      84             : {
      85           0 :     return new VbaNewFont( this, mxContext, m_xProps );
      86             : }
      87             : 
      88             : OUString
      89           0 : ScVbaCheckbox::getServiceImplName()
      90             : {
      91           0 :     return OUString("ScVbaCheckbox");
      92             : }
      93             : 
      94             : uno::Sequence< OUString >
      95           0 : ScVbaCheckbox::getServiceNames()
      96             : {
      97           0 :     static uno::Sequence< OUString > aServiceNames;
      98           0 :     if ( aServiceNames.getLength() == 0 )
      99             :     {
     100           0 :         aServiceNames.realloc( 1 );
     101           0 :         aServiceNames[ 0 ] = "ooo.vba.msforms.CheckBox";
     102             :     }
     103           0 :     return aServiceNames;
     104             : }
     105             : 
     106           0 : sal_Int32 SAL_CALL ScVbaCheckbox::getBackColor() throw (uno::RuntimeException, std::exception)
     107             : {
     108           0 :     return ScVbaControl::getBackColor();
     109             : }
     110             : 
     111           0 : void SAL_CALL ScVbaCheckbox::setBackColor( sal_Int32 nBackColor ) throw (uno::RuntimeException, std::exception)
     112             : {
     113           0 :     ScVbaControl::setBackColor( nBackColor );
     114           0 : }
     115             : 
     116           0 : sal_Bool SAL_CALL ScVbaCheckbox::getAutoSize() throw (uno::RuntimeException, std::exception)
     117             : {
     118           0 :     return ScVbaControl::getAutoSize();
     119             : }
     120             : 
     121           0 : void SAL_CALL ScVbaCheckbox::setAutoSize( sal_Bool bAutoSize ) throw (uno::RuntimeException, std::exception)
     122             : {
     123           0 :     ScVbaControl::setAutoSize( bAutoSize );
     124           0 : }
     125             : 
     126           0 : sal_Bool SAL_CALL ScVbaCheckbox::getLocked() throw (uno::RuntimeException, std::exception)
     127             : {
     128           0 :     return ScVbaControl::getLocked();
     129             : }
     130             : 
     131           0 : void SAL_CALL ScVbaCheckbox::setLocked( sal_Bool bLocked ) throw (uno::RuntimeException, std::exception)
     132             : {
     133           0 :     ScVbaControl::setLocked( bLocked );
     134           0 : }
     135             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10