bump product version to 5.0.4.1
[LibreOffice.git] / vbahelper / source / msforms / vbatogglebutton.cxx
blobf108bac61f898920c46b7bd05365253aa36390ca
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "vbatogglebutton.hxx"
21 #include "vbanewfont.hxx"
23 using namespace com::sun::star;
24 using namespace ooo::vba;
26 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 )
28 SAL_INFO("vbahelper", "ScVbaToggleButton(ctor)");
29 m_xProps->setPropertyValue( "Toggle", uno::makeAny( sal_True ) );
32 ScVbaToggleButton::~ScVbaToggleButton()
34 SAL_INFO("vbahelper", "~ScVbaToggleButton(dtor)");
37 // Attributes
38 OUString SAL_CALL
39 ScVbaToggleButton::getCaption() throw (css::uno::RuntimeException, std::exception)
41 OUString Label;
42 m_xProps->getPropertyValue( "Label" ) >>= Label;
43 return Label;
46 void SAL_CALL
47 ScVbaToggleButton::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception)
49 m_xProps->setPropertyValue( "Label", uno::makeAny( _caption ) );
52 uno::Any SAL_CALL
53 ScVbaToggleButton::getValue() throw (uno::RuntimeException, std::exception)
55 sal_Int16 nState = 0;
56 m_xProps->getPropertyValue( "State" ) >>= nState;
57 return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
61 void SAL_CALL
62 ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException, std::exception)
64 sal_Int16 nState = 0;
65 if ( ! ( _value >>= nState ) )
67 bool bState = false;
68 _value >>= bState;
69 if ( bState )
70 nState = -1;
72 SAL_INFO("vbahelper", "nState - " << nState );
73 nState = ( nState == -1 ) ? 1 : 0;
74 SAL_INFO("vbahelper", "nState - " << nState );
75 m_xProps->setPropertyValue( "State", uno::makeAny( nState ) );
78 sal_Bool SAL_CALL ScVbaToggleButton::getAutoSize() throw (uno::RuntimeException, std::exception)
80 return ScVbaControl::getAutoSize();
83 void SAL_CALL ScVbaToggleButton::setAutoSize( sal_Bool bAutoSize ) throw (uno::RuntimeException, std::exception)
85 ScVbaControl::setAutoSize( bAutoSize );
88 sal_Bool SAL_CALL ScVbaToggleButton::getCancel() throw (uno::RuntimeException, std::exception)
90 // #STUB
91 return sal_False;
94 void SAL_CALL ScVbaToggleButton::setCancel( sal_Bool /*bCancel*/ ) throw (uno::RuntimeException, std::exception)
96 // #STUB
99 sal_Bool SAL_CALL ScVbaToggleButton::getDefault() throw (uno::RuntimeException, std::exception)
101 // #STUB
102 return sal_False;
105 void SAL_CALL ScVbaToggleButton::setDefault( sal_Bool /*bDefault*/ ) throw (uno::RuntimeException, std::exception)
107 // #STUB
110 sal_Int32 SAL_CALL ScVbaToggleButton::getBackColor() throw (uno::RuntimeException, std::exception)
112 return ScVbaControl::getBackColor();
115 void SAL_CALL ScVbaToggleButton::setBackColor( sal_Int32 nBackColor ) throw (uno::RuntimeException, std::exception)
117 ScVbaControl::setBackColor( nBackColor );
120 sal_Int32 SAL_CALL ScVbaToggleButton::getForeColor() throw (uno::RuntimeException)
122 // #STUB
123 return 0;
126 void SAL_CALL ScVbaToggleButton::setForeColor( sal_Int32 /*nForeColor*/ ) throw (uno::RuntimeException)
128 // #STUB
131 uno::Reference< msforms::XNewFont > SAL_CALL ScVbaToggleButton::getFont() throw (uno::RuntimeException, std::exception)
133 return new VbaNewFont( m_xProps );
136 sal_Bool SAL_CALL ScVbaToggleButton::getLocked() throw (uno::RuntimeException, std::exception)
138 return ScVbaControl::getLocked();
141 void SAL_CALL ScVbaToggleButton::setLocked( sal_Bool bLocked ) throw (uno::RuntimeException, std::exception)
143 ScVbaControl::setLocked( bLocked );
146 OUString
147 ScVbaToggleButton::getServiceImplName()
149 return OUString( "ScVbaToggleButton" );
152 uno::Sequence< OUString >
153 ScVbaToggleButton::getServiceNames()
155 static uno::Sequence< OUString > aServiceNames;
156 if ( aServiceNames.getLength() == 0 )
158 aServiceNames.realloc( 1 );
159 aServiceNames[ 0 ] = "ooo.vba.msforms.ToggleButton";
161 return aServiceNames;
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */