1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
9 * last change: $Author$ $Date$
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
15 * GNU Lesser General Public License Version 2.1
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License version 2.1, as published by the Free Software Foundation.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34 ************************************************************************/
35 #include "vbacheckbox.hxx"
36 #include <vbahelper/helperdecl.hxx>
39 using namespace com::sun::star
;
40 using namespace ooo::vba
;
43 const static rtl::OUString
LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
44 const static rtl::OUString
STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
45 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
)
50 rtl::OUString SAL_CALL
51 ScVbaCheckbox::getCaption() throw (css::uno::RuntimeException
)
54 m_xProps
->getPropertyValue( LABEL
) >>= Label
;
59 ScVbaCheckbox::setCaption( const rtl::OUString
& _caption
) throw (::com::sun::star::uno::RuntimeException
)
61 m_xProps
->setPropertyValue( LABEL
, uno::makeAny( _caption
) );
65 ScVbaCheckbox::getValue() throw (css::uno::RuntimeException
)
67 sal_Int16 nValue
= -1;
68 m_xProps
->getPropertyValue( STATE
) >>= nValue
;
71 // return uno::makeAny( nValue );
72 // I must be missing something MSO says value should be -1 if selected, 0 if not
74 return uno::makeAny( ( nValue
== -1 ) ? sal_True
: sal_False
);
78 ScVbaCheckbox::setValue( const uno::Any
& _value
) throw (css::uno::RuntimeException
)
81 sal_Bool bValue
= false;
82 if( _value
>>= nValue
)
87 else if ( _value
>>= bValue
)
92 m_xProps
->setPropertyValue( STATE
, uno::makeAny( nValue
) );
95 ScVbaCheckbox::getServiceImplName()
97 static rtl::OUString
sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCheckbox") );
101 uno::Sequence
< rtl::OUString
>
102 ScVbaCheckbox::getServiceNames()
104 static uno::Sequence
< rtl::OUString
> aServiceNames
;
105 if ( aServiceNames
.getLength() == 0 )
107 aServiceNames
.realloc( 1 );
108 aServiceNames
[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.CheckBox" ) );
110 return aServiceNames
;