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 "vbalabel.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") );
ScVbaLabel(const css::uno::Reference<XHelperInterface> & xParent,const uno::Reference<uno::XComponentContext> & xContext,const uno::Reference<uno::XInterface> & xControl,const uno::Reference<frame::XModel> & xModel,ov::AbstractGeometryAttributes * pGeomHelper)32 ScVbaLabel::ScVbaLabel(  const css::uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : LabelImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
33 {
34 }
35 
36 // Attributes
37 rtl::OUString SAL_CALL
getCaption()38 ScVbaLabel::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 ScVbaLabel::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
47 {
48     m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
49 }
50 uno::Any SAL_CALL
getValue()51 ScVbaLabel::getValue() throw (css::uno::RuntimeException)
52 {
53     return uno::makeAny( getCaption() );
54 }
55 
56 void SAL_CALL
setValue(const uno::Any & _value)57 ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
58 {
59     rtl::OUString sCaption;
60     _value >>= sCaption;
61     setCaption( sCaption );
62 }
63 
getFont()64 uno::Reference< msforms::XNewFont > SAL_CALL ScVbaLabel::getFont() throw (uno::RuntimeException)
65 {
66     return new VbaNewFont( this, mxContext, m_xProps );
67 }
68 
69 rtl::OUString&
getServiceImplName()70 ScVbaLabel::getServiceImplName()
71 {
72 	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLabel") );
73 	return sImplName;
74 }
75 
76 uno::Sequence< rtl::OUString >
getServiceNames()77 ScVbaLabel::getServiceNames()
78 {
79 	static uno::Sequence< rtl::OUString > aServiceNames;
80 	if ( aServiceNames.getLength() == 0 )
81 	{
82 		aServiceNames.realloc( 1 );
83 		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) );
84 	}
85 	return aServiceNames;
86 }
87