LibreOffice Module vbahelper (master) 1
vbatogglebutton.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include "vbatogglebutton.hxx"
21#include "vbanewfont.hxx"
22#include <sal/log.hxx>
23
24using namespace com::sun::star;
25using namespace ooo::vba;
26
27ScVbaToggleButton::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) )
29{
30 SAL_INFO("vbahelper", "ScVbaToggleButton(ctor)");
31 m_xProps->setPropertyValue( "Toggle", uno::Any( true ) );
32}
33
35{
36 SAL_INFO("vbahelper", "~ScVbaToggleButton(dtor)");
37}
38
39// Attributes
40OUString SAL_CALL
42{
43 OUString Label;
44 m_xProps->getPropertyValue( "Label" ) >>= Label;
45 return Label;
46}
47
48void SAL_CALL
49ScVbaToggleButton::setCaption( const OUString& _caption )
50{
51 m_xProps->setPropertyValue( "Label", uno::Any( _caption ) );
52}
53
54uno::Any SAL_CALL
56{
57 sal_Int16 nState = 0;
58 m_xProps->getPropertyValue( "State" ) >>= nState;
59 return uno::Any( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
60}
61
62
63void SAL_CALL
65{
66 sal_Int16 nState = 0;
67 if ( ! ( _value >>= nState ) )
68 {
69 bool bState = false;
70 _value >>= bState;
71 if ( bState )
72 nState = -1;
73 }
74 SAL_INFO("vbahelper", "nState - " << nState );
75 nState = ( nState == -1 ) ? 1 : 0;
76 SAL_INFO("vbahelper", "nState - " << nState );
77 m_xProps->setPropertyValue( "State", uno::Any( nState ) );
78}
79
81{
83}
84
85void SAL_CALL ScVbaToggleButton::setAutoSize( sal_Bool bAutoSize )
86{
87 ScVbaControl::setAutoSize( bAutoSize );
88}
89
91{
92 // #STUB
93 return false;
94}
95
96void SAL_CALL ScVbaToggleButton::setCancel( sal_Bool /*bCancel*/ )
97{
98 // #STUB
99}
100
102{
103 // #STUB
104 return false;
105}
106
107void SAL_CALL ScVbaToggleButton::setDefault( sal_Bool /*bDefault*/ )
108{
109 // #STUB
110}
111
113{
115}
116
117void SAL_CALL ScVbaToggleButton::setBackColor( sal_Int32 nBackColor )
118{
119 ScVbaControl::setBackColor( nBackColor );
120}
121
123{
124 // #STUB
125 return 0;
126}
127
128void SAL_CALL ScVbaToggleButton::setForeColor( sal_Int32 /*nForeColor*/ )
129{
130 // #STUB
131}
132
133uno::Reference< msforms::XNewFont > SAL_CALL ScVbaToggleButton::getFont()
134{
135 return new VbaNewFont( m_xProps );
136}
137
139{
141}
142
144{
145 ScVbaControl::setLocked( bLocked );
146}
147
148OUString
150{
151 return "ScVbaToggleButton";
152}
153
154uno::Sequence< OUString >
156{
157 static uno::Sequence< OUString > const aServiceNames
158 {
159 "ooo.vba.msforms.ToggleButton"
160 };
161 return aServiceNames;
162}
163
164/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XPropertySet > m_xProps
bool getLocked()
Definition: vbacontrol.cxx:745
sal_Int32 getBackColor()
Definition: vbacontrol.cxx:708
bool getAutoSize() const
Definition: vbacontrol.cxx:726
void setAutoSize(bool bAutoSize)
Definition: vbacontrol.cxx:737
void setBackColor(sal_Int32 nBackColor)
Definition: vbacontrol.cxx:715
void setLocked(bool bAutoSize)
Definition: vbacontrol.cxx:752
virtual void SAL_CALL setLocked(sal_Bool bAutoSize) override
virtual sal_Bool SAL_CALL getDefault() override
ScVbaToggleButton(const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::uno::XInterface > &xControl, const css::uno::Reference< css::frame::XModel > &xModel, std::unique_ptr< ov::AbstractGeometryAttributes > pGeomHelper)
virtual void SAL_CALL setCaption(const OUString &_caption) override
virtual void SAL_CALL setForeColor(sal_Int32 nForeColor) override
virtual sal_Int32 SAL_CALL getBackColor() override
virtual sal_Bool SAL_CALL getAutoSize() override
virtual void SAL_CALL setValue(const css::uno::Any &_value) override
virtual sal_Int32 SAL_CALL getForeColor() override
virtual void SAL_CALL setDefault(sal_Bool bDefault) override
virtual ~ScVbaToggleButton() override
virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() override
virtual void SAL_CALL setCancel(sal_Bool bCancel) override
virtual void SAL_CALL setBackColor(sal_Int32 nBackColor) override
virtual sal_Bool SAL_CALL getCancel() override
virtual void SAL_CALL setAutoSize(sal_Bool bAutoSize) override
virtual OUString getServiceImplName() override
virtual css::uno::Sequence< OUString > getServiceNames() override
virtual css::uno::Any SAL_CALL getValue() override
virtual sal_Bool SAL_CALL getLocked() override
virtual OUString SAL_CALL getCaption() override
sal_Int32 nState
Sequence< OUString > aServiceNames
#define SAL_INFO(area, stream)
Reference< XModel > xModel
unsigned char sal_Bool
cppu::ImplInheritanceHelper< ScVbaControl, ov::msforms::XToggleButton, css::script::XDefaultProperty > ToggleButtonImpl_BASE