1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "vbabutton.hxx"
25 #include "vbanewfont.hxx"
26 
27 using namespace com::sun::star;
28 using namespace ooo::vba;
29 
30 
31 const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
ScVbaButton(const uno::Reference<XHelperInterface> & xParent,const uno::Reference<uno::XComponentContext> & xContext,const uno::Reference<uno::XInterface> & xControl,const uno::Reference<frame::XModel> & xModel,AbstractGeometryAttributes * pGeomHelper)32 ScVbaButton::ScVbaButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
33 {
34 }
35 
36 // Attributes
37 rtl::OUString SAL_CALL
getCaption()38 ScVbaButton::getCaption() throw (css::uno::RuntimeException)
39 {
40     rtl::OUString Label;
41     m_xProps->getPropertyValue( LABEL ) >>= Label;
42     return Label;
43 }
44 
45 void SAL_CALL
setCaption(const rtl::OUString & _caption)46 ScVbaButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
47 {
48     m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
49 }
50 
getAutoSize()51 sal_Bool SAL_CALL ScVbaButton::getAutoSize() throw (uno::RuntimeException)
52 {
53     return sal_False;
54 }
55 
setAutoSize(sal_Bool)56 void SAL_CALL ScVbaButton::setAutoSize( sal_Bool /*bAutoSize*/ ) throw (uno::RuntimeException)
57 {
58 }
59 
getCancel()60 sal_Bool SAL_CALL ScVbaButton::getCancel() throw (uno::RuntimeException)
61 {
62     return sal_False;
63 }
64 
setCancel(sal_Bool)65 void SAL_CALL ScVbaButton::setCancel( sal_Bool /*bCancel*/ ) throw (uno::RuntimeException)
66 {
67 }
68 
getDefault()69 sal_Bool SAL_CALL ScVbaButton::getDefault() throw (uno::RuntimeException)
70 {
71     return sal_False;
72 }
73 
setDefault(sal_Bool)74 void SAL_CALL ScVbaButton::setDefault( sal_Bool /*bDefault*/ ) throw (uno::RuntimeException)
75 {
76 }
77 
getBackColor()78 sal_Int32 SAL_CALL ScVbaButton::getBackColor() throw (uno::RuntimeException)
79 {
80     return 0;
81 }
82 
setBackColor(sal_Int32)83 void SAL_CALL ScVbaButton::setBackColor( sal_Int32 /*nBackColor*/ ) throw (uno::RuntimeException)
84 {
85 }
86 
getForeColor()87 sal_Int32 SAL_CALL ScVbaButton::getForeColor() throw (uno::RuntimeException)
88 {
89     return 0;
90 }
91 
setForeColor(sal_Int32)92 void SAL_CALL ScVbaButton::setForeColor( sal_Int32 /*nForeColor*/ ) throw (uno::RuntimeException)
93 {
94 }
95 
getFont()96 uno::Reference< msforms::XNewFont > SAL_CALL ScVbaButton::getFont() throw (uno::RuntimeException)
97 {
98     return new VbaNewFont( this, mxContext, m_xProps );
99 }
100 
101 rtl::OUString&
getServiceImplName()102 ScVbaButton::getServiceImplName()
103 {
104 	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaButton") );
105 	return sImplName;
106 }
107 
108 uno::Sequence< rtl::OUString >
getServiceNames()109 ScVbaButton::getServiceNames()
110 {
111 	static uno::Sequence< rtl::OUString > aServiceNames;
112 	if ( aServiceNames.getLength() == 0 )
113 	{
114 		aServiceNames.realloc( 1 );
115 		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Button" ) );
116 	}
117 	return aServiceNames;
118 }
119