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