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"
22 #include <vbahelper/helperdecl.hxx>
24 using namespace com::sun::star
;
25 using namespace ooo::vba
;
27 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
)
28 : CheckBoxImpl_BASE( xParent
, xContext
, xControl
, xModel
, std::move(pGeomHelper
) )
34 ScVbaCheckbox::getCaption()
37 m_xProps
->getPropertyValue( "Label" ) >>= Label
;
42 ScVbaCheckbox::setCaption( const OUString
& _caption
)
44 m_xProps
->setPropertyValue( "Label", uno::makeAny( _caption
) );
48 ScVbaCheckbox::getValue()
50 sal_Int16 nValue
= -1;
51 m_xProps
->getPropertyValue( "State" ) >>= nValue
;
54 // return uno::makeAny( nValue );
55 // I must be missing something MSO says value should be -1 if selected, 0 if not
57 return uno::makeAny( nValue
== -1 );
61 ScVbaCheckbox::setValue( const uno::Any
& _value
)
64 sal_Int16 nOldValue
= 0;
65 m_xProps
->getPropertyValue( "State" ) >>= nOldValue
;
66 if( !( _value
>>= nValue
) )
76 m_xProps
->setPropertyValue( "State", uno::makeAny( nValue
) );
77 if ( nValue
!= nOldValue
)
81 uno::Reference
< msforms::XNewFont
> SAL_CALL
ScVbaCheckbox::getFont()
83 return new VbaNewFont( m_xProps
);
87 ScVbaCheckbox::getServiceImplName()
89 return OUString("ScVbaCheckbox");
92 uno::Sequence
< OUString
>
93 ScVbaCheckbox::getServiceNames()
95 static uno::Sequence
< OUString
> const aServiceNames
97 "ooo.vba.msforms.CheckBox"
102 sal_Int32 SAL_CALL
ScVbaCheckbox::getBackColor()
104 return ScVbaControl::getBackColor();
107 void SAL_CALL
ScVbaCheckbox::setBackColor( sal_Int32 nBackColor
)
109 ScVbaControl::setBackColor( nBackColor
);
112 sal_Bool SAL_CALL
ScVbaCheckbox::getAutoSize()
114 return ScVbaControl::getAutoSize();
117 void SAL_CALL
ScVbaCheckbox::setAutoSize( sal_Bool bAutoSize
)
119 ScVbaControl::setAutoSize( bAutoSize
);
122 sal_Bool SAL_CALL
ScVbaCheckbox::getLocked()
124 return ScVbaControl::getLocked();
127 void SAL_CALL
ScVbaCheckbox::setLocked( sal_Bool bLocked
)
129 ScVbaControl::setLocked( bLocked
);
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */