Line data Source code
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 :
23 : using namespace com::sun::star;
24 : using namespace ooo::vba;
25 :
26 32 : 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, ov::AbstractGeometryAttributes* pGeomHelper ) : ToggleButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
27 : {
28 : SAL_INFO("vbahelper", "ScVbaToggleButton(ctor)");
29 32 : m_xProps->setPropertyValue( "Toggle", uno::makeAny( sal_True ) );
30 32 : }
31 :
32 64 : ScVbaToggleButton::~ScVbaToggleButton()
33 : {
34 : SAL_INFO("vbahelper", "~ScVbaToggleButton(dtor)");
35 64 : }
36 :
37 : // Attributes
38 : OUString SAL_CALL
39 0 : ScVbaToggleButton::getCaption() throw (css::uno::RuntimeException, std::exception)
40 : {
41 0 : OUString Label;
42 0 : m_xProps->getPropertyValue( "Label" ) >>= Label;
43 0 : return Label;
44 : }
45 :
46 : void SAL_CALL
47 0 : ScVbaToggleButton::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception)
48 : {
49 0 : m_xProps->setPropertyValue( "Label", uno::makeAny( _caption ) );
50 0 : }
51 :
52 : uno::Any SAL_CALL
53 32 : ScVbaToggleButton::getValue() throw (uno::RuntimeException, std::exception)
54 : {
55 32 : sal_Int16 nState = 0;
56 32 : m_xProps->getPropertyValue( "State" ) >>= nState;
57 32 : return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
58 : }
59 :
60 :
61 : void SAL_CALL
62 16 : ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException, std::exception)
63 : {
64 16 : sal_Int16 nState = 0;
65 16 : if ( ! ( _value >>= nState ) )
66 : {
67 8 : bool bState = false;
68 8 : _value >>= bState;
69 8 : if ( bState )
70 4 : nState = -1;
71 : }
72 : SAL_INFO("vbahelper", "nState - " << nState );
73 16 : nState = ( nState == -1 ) ? 1 : 0;
74 : SAL_INFO("vbahelper", "nState - " << nState );
75 16 : m_xProps->setPropertyValue( "State", uno::makeAny( nState ) );
76 16 : }
77 :
78 0 : sal_Bool SAL_CALL ScVbaToggleButton::getAutoSize() throw (uno::RuntimeException, std::exception)
79 : {
80 0 : return ScVbaControl::getAutoSize();
81 : }
82 :
83 0 : void SAL_CALL ScVbaToggleButton::setAutoSize( sal_Bool bAutoSize ) throw (uno::RuntimeException, std::exception)
84 : {
85 0 : ScVbaControl::setAutoSize( bAutoSize );
86 0 : }
87 :
88 0 : sal_Bool SAL_CALL ScVbaToggleButton::getCancel() throw (uno::RuntimeException, std::exception)
89 : {
90 : // #STUB
91 0 : return sal_False;
92 : }
93 :
94 0 : void SAL_CALL ScVbaToggleButton::setCancel( sal_Bool /*bCancel*/ ) throw (uno::RuntimeException, std::exception)
95 : {
96 : // #STUB
97 0 : }
98 :
99 0 : sal_Bool SAL_CALL ScVbaToggleButton::getDefault() throw (uno::RuntimeException, std::exception)
100 : {
101 : // #STUB
102 0 : return sal_False;
103 : }
104 :
105 0 : void SAL_CALL ScVbaToggleButton::setDefault( sal_Bool /*bDefault*/ ) throw (uno::RuntimeException, std::exception)
106 : {
107 : // #STUB
108 0 : }
109 :
110 0 : sal_Int32 SAL_CALL ScVbaToggleButton::getBackColor() throw (uno::RuntimeException, std::exception)
111 : {
112 0 : return ScVbaControl::getBackColor();
113 : }
114 :
115 0 : void SAL_CALL ScVbaToggleButton::setBackColor( sal_Int32 nBackColor ) throw (uno::RuntimeException, std::exception)
116 : {
117 0 : ScVbaControl::setBackColor( nBackColor );
118 0 : }
119 :
120 0 : sal_Int32 SAL_CALL ScVbaToggleButton::getForeColor() throw (uno::RuntimeException)
121 : {
122 : // #STUB
123 0 : return 0;
124 : }
125 :
126 0 : void SAL_CALL ScVbaToggleButton::setForeColor( sal_Int32 /*nForeColor*/ ) throw (uno::RuntimeException)
127 : {
128 : // #STUB
129 0 : }
130 :
131 0 : uno::Reference< msforms::XNewFont > SAL_CALL ScVbaToggleButton::getFont() throw (uno::RuntimeException, std::exception)
132 : {
133 0 : return new VbaNewFont( m_xProps );
134 : }
135 :
136 0 : sal_Bool SAL_CALL ScVbaToggleButton::getLocked() throw (uno::RuntimeException, std::exception)
137 : {
138 0 : return ScVbaControl::getLocked();
139 : }
140 :
141 0 : void SAL_CALL ScVbaToggleButton::setLocked( sal_Bool bLocked ) throw (uno::RuntimeException, std::exception)
142 : {
143 0 : ScVbaControl::setLocked( bLocked );
144 0 : }
145 :
146 : OUString
147 0 : ScVbaToggleButton::getServiceImplName()
148 : {
149 0 : return OUString( "ScVbaToggleButton" );
150 : }
151 :
152 : uno::Sequence< OUString >
153 0 : ScVbaToggleButton::getServiceNames()
154 : {
155 0 : static uno::Sequence< OUString > aServiceNames;
156 0 : if ( aServiceNames.getLength() == 0 )
157 : {
158 0 : aServiceNames.realloc( 1 );
159 0 : aServiceNames[ 0 ] = "ooo.vba.msforms.ToggleButton";
160 : }
161 0 : return aServiceNames;
162 6 : }
163 :
164 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|