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 "vbacheckbox.hxx"
21 #include "vbanewfont.hxx"
23 using namespace com::sun::star
;
24 using namespace ooo::vba
;
26 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
, std::unique_ptr
<ov::AbstractGeometryAttributes
> pGeomHelper
)
27 : CheckBoxImpl_BASE( xParent
, xContext
, xControl
, xModel
, std::move(pGeomHelper
) )
33 ScVbaCheckbox::getCaption()
36 m_xProps
->getPropertyValue( u
"Label"_ustr
) >>= Label
;
41 ScVbaCheckbox::setCaption( const OUString
& _caption
)
43 m_xProps
->setPropertyValue( u
"Label"_ustr
, uno::Any( _caption
) );
47 ScVbaCheckbox::getValue()
49 sal_Int16 nValue
= -1;
50 m_xProps
->getPropertyValue( u
"State"_ustr
) >>= nValue
;
53 // return uno::makeAny( nValue );
54 // I must be missing something MSO says value should be -1 if selected, 0 if not
56 return uno::Any( nValue
== -1 );
60 ScVbaCheckbox::setValue( const uno::Any
& _value
)
63 sal_Int16 nOldValue
= 0;
64 m_xProps
->getPropertyValue( u
"State"_ustr
) >>= nOldValue
;
65 if( !( _value
>>= nValue
) )
75 m_xProps
->setPropertyValue( u
"State"_ustr
, uno::Any( nValue
) );
76 if ( nValue
!= nOldValue
)
80 uno::Reference
< msforms::XNewFont
> SAL_CALL
ScVbaCheckbox::getFont()
82 return new VbaNewFont( m_xProps
);
86 ScVbaCheckbox::getServiceImplName()
88 return u
"ScVbaCheckbox"_ustr
;
91 uno::Sequence
< OUString
>
92 ScVbaCheckbox::getServiceNames()
94 static uno::Sequence
< OUString
> const aServiceNames
96 u
"ooo.vba.msforms.CheckBox"_ustr
101 sal_Int32 SAL_CALL
ScVbaCheckbox::getBackColor()
103 return ScVbaControl::getBackColor();
106 void SAL_CALL
ScVbaCheckbox::setBackColor( sal_Int32 nBackColor
)
108 ScVbaControl::setBackColor( nBackColor
);
111 sal_Bool SAL_CALL
ScVbaCheckbox::getAutoSize()
113 return ScVbaControl::getAutoSize();
116 void SAL_CALL
ScVbaCheckbox::setAutoSize( sal_Bool bAutoSize
)
118 ScVbaControl::setAutoSize( bAutoSize
);
121 sal_Bool SAL_CALL
ScVbaCheckbox::getLocked()
123 return ScVbaControl::getLocked();
126 void SAL_CALL
ScVbaCheckbox::setLocked( sal_Bool bLocked
)
128 ScVbaControl::setLocked( bLocked
);
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */