1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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)");
41 ScVbaToggleButton::getCaption()
44 m_xProps
->getPropertyValue( "Label" ) >>= Label
;
49 ScVbaToggleButton::setCaption( const OUString
& _caption
)
51 m_xProps
->setPropertyValue( "Label", uno::makeAny( _caption
) );
55 ScVbaToggleButton::getValue()
58 m_xProps
->getPropertyValue( "State" ) >>= nState
;
59 return uno::makeAny( nState
? sal_Int16( -1 ) : sal_Int16( 0 ) );
64 ScVbaToggleButton::setValue( const uno::Any
& _value
)
67 if ( ! ( _value
>>= nState
) )
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()
96 void SAL_CALL
ScVbaToggleButton::setCancel( sal_Bool
/*bCancel*/ )
101 sal_Bool SAL_CALL
ScVbaToggleButton::getDefault()
107 void SAL_CALL
ScVbaToggleButton::setDefault( sal_Bool
/*bDefault*/ )
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()
128 void SAL_CALL
ScVbaToggleButton::setForeColor( sal_Int32
/*nForeColor*/ )
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
);
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: */