bump product version to 6.3.0.0.beta1
[LibreOffice.git] / vbahelper / source / msforms / vbatogglebutton.cxx
blob61b6562f0bebcd467cf62cd64ad2e2cf58a190a4
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"
22 #include <sal/log.hxx>
24 using namespace com::sun::star;
25 using namespace ooo::vba;
27 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, std::unique_ptr<ov::AbstractGeometryAttributes> pGeomHelper )
28 : ToggleButtonImpl_BASE( xParent, xContext, xControl, xModel, std::move(pGeomHelper) )
30 SAL_INFO("vbahelper", "ScVbaToggleButton(ctor)");
31 m_xProps->setPropertyValue( "Toggle", uno::makeAny( true ) );
34 ScVbaToggleButton::~ScVbaToggleButton()
36 SAL_INFO("vbahelper", "~ScVbaToggleButton(dtor)");
39 // Attributes
40 OUString SAL_CALL
41 ScVbaToggleButton::getCaption()
43 OUString Label;
44 m_xProps->getPropertyValue( "Label" ) >>= Label;
45 return Label;
48 void SAL_CALL
49 ScVbaToggleButton::setCaption( const OUString& _caption )
51 m_xProps->setPropertyValue( "Label", uno::makeAny( _caption ) );
54 uno::Any SAL_CALL
55 ScVbaToggleButton::getValue()
57 sal_Int16 nState = 0;
58 m_xProps->getPropertyValue( "State" ) >>= nState;
59 return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
63 void SAL_CALL
64 ScVbaToggleButton::setValue( const uno::Any& _value )
66 sal_Int16 nState = 0;
67 if ( ! ( _value >>= nState ) )
69 bool bState = false;
70 _value >>= bState;
71 if ( bState )
72 nState = -1;
74 SAL_INFO("vbahelper", "nState - " << nState );
75 nState = ( nState == -1 ) ? 1 : 0;
76 SAL_INFO("vbahelper", "nState - " << nState );
77 m_xProps->setPropertyValue( "State", uno::makeAny( nState ) );
80 sal_Bool SAL_CALL ScVbaToggleButton::getAutoSize()
82 return ScVbaControl::getAutoSize();
85 void SAL_CALL ScVbaToggleButton::setAutoSize( sal_Bool bAutoSize )
87 ScVbaControl::setAutoSize( bAutoSize );
90 sal_Bool SAL_CALL ScVbaToggleButton::getCancel()
92 // #STUB
93 return false;
96 void SAL_CALL ScVbaToggleButton::setCancel( sal_Bool /*bCancel*/ )
98 // #STUB
101 sal_Bool SAL_CALL ScVbaToggleButton::getDefault()
103 // #STUB
104 return false;
107 void SAL_CALL ScVbaToggleButton::setDefault( sal_Bool /*bDefault*/ )
109 // #STUB
112 sal_Int32 SAL_CALL ScVbaToggleButton::getBackColor()
114 return ScVbaControl::getBackColor();
117 void SAL_CALL ScVbaToggleButton::setBackColor( sal_Int32 nBackColor )
119 ScVbaControl::setBackColor( nBackColor );
122 sal_Int32 SAL_CALL ScVbaToggleButton::getForeColor()
124 // #STUB
125 return 0;
128 void SAL_CALL ScVbaToggleButton::setForeColor( sal_Int32 /*nForeColor*/ )
130 // #STUB
133 uno::Reference< msforms::XNewFont > SAL_CALL ScVbaToggleButton::getFont()
135 return new VbaNewFont( m_xProps );
138 sal_Bool SAL_CALL ScVbaToggleButton::getLocked()
140 return ScVbaControl::getLocked();
143 void SAL_CALL ScVbaToggleButton::setLocked( sal_Bool bLocked )
145 ScVbaControl::setLocked( bLocked );
148 OUString
149 ScVbaToggleButton::getServiceImplName()
151 return OUString( "ScVbaToggleButton" );
154 uno::Sequence< OUString >
155 ScVbaToggleButton::getServiceNames()
157 static uno::Sequence< OUString > const aServiceNames
159 "ooo.vba.msforms.ToggleButton"
161 return aServiceNames;
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */