1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #include "vbatogglebutton.hxx"
30 using namespace com::sun::star
;
31 using namespace ooo::vba
;
34 const static rtl::OUString
LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
35 const static rtl::OUString
TOGGLE( RTL_CONSTASCII_USTRINGPARAM("Toggle") );
36 const static rtl::OUString
STATE( RTL_CONSTASCII_USTRINGPARAM("State") );
37 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
)
39 OSL_TRACE("ScVbaToggleButton(ctor)");
40 m_xProps
->setPropertyValue( TOGGLE
, uno::makeAny( sal_True
) );
43 ScVbaToggleButton::~ScVbaToggleButton()
45 OSL_TRACE("~ScVbaToggleButton(dtor)");
49 rtl::OUString SAL_CALL
50 ScVbaToggleButton::getCaption() throw (css::uno::RuntimeException
)
53 m_xProps
->getPropertyValue( LABEL
) >>= Label
;
58 ScVbaToggleButton::setCaption( const rtl::OUString
& _caption
) throw (::com::sun::star::uno::RuntimeException
)
60 m_xProps
->setPropertyValue( LABEL
, uno::makeAny( _caption
) );
64 ScVbaToggleButton::getValue() throw (uno::RuntimeException
)
67 m_xProps
->getPropertyValue( STATE
) >>= nState
;
68 return uno::makeAny( nState
? sal_Int16( -1 ) : sal_Int16( 0 ) );
72 ScVbaToggleButton::setValue( const uno::Any
& _value
) throw (uno::RuntimeException
)
76 OSL_TRACE( "nState - %d", nState
);
77 nState
= ( nState
== -1 ) ? 1 : 0;
78 OSL_TRACE( "nState - %d", nState
);
79 m_xProps
->setPropertyValue( STATE
, uno::makeAny( nState
) );
83 ScVbaToggleButton::getServiceImplName()
85 static rtl::OUString
sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaToggleButton") );
89 uno::Sequence
< rtl::OUString
>
90 ScVbaToggleButton::getServiceNames()
92 static uno::Sequence
< rtl::OUString
> aServiceNames
;
93 if ( aServiceNames
.getLength() == 0 )
95 aServiceNames
.realloc( 1 );
96 aServiceNames
[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ToggleButton" ) );