merge the formfield patch from ooo-build
[ooovba.git] / vbahelper / source / msforms / vbalabel.cxx
bloba9869f7cddd2a6fd9ed205977486afe66d03457f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: vbalabel.cxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include "vbalabel.hxx"
31 #include <vector>
33 using namespace com::sun::star;
34 using namespace ooo::vba;
37 const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
38 const static rtl::OUString FORECOLOR( RTL_CONSTASCII_USTRINGPARAM("TextColor") ); //liuchen 2009-7-6
39 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 )
43 // Attributes
44 rtl::OUString SAL_CALL
45 ScVbaLabel::getCaption() throw (css::uno::RuntimeException)
47 rtl::OUString Label;
48 m_xProps->getPropertyValue( LABEL ) >>= Label;
49 return Label;
52 void SAL_CALL
53 ScVbaLabel::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
55 m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
57 uno::Any SAL_CALL
58 ScVbaLabel::getValue() throw (css::uno::RuntimeException)
60 return uno::makeAny( getCaption() );
63 void SAL_CALL
64 ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
66 rtl::OUString sCaption;
67 _value >>= sCaption;
68 setCaption( sCaption );
72 //liuchen 2009-7-6
73 ::sal_Int32 SAL_CALL ScVbaLabel::getForeColor() throw (::com::sun::star::uno::RuntimeException)
75 sal_Int32 nForeColor;
76 m_xProps->getPropertyValue( FORECOLOR ) >>= nForeColor;
77 return OORGBToXLRGB( nForeColor );
80 void SAL_CALL ScVbaLabel::setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException)
82 m_xProps->setPropertyValue( FORECOLOR, uno::makeAny( XLRGBToOORGB( _forecolor ) ) );
84 //liuchenn 2009-7-6
86 rtl::OUString&
87 ScVbaLabel::getServiceImplName()
89 static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLabel") );
90 return sImplName;
93 uno::Sequence< rtl::OUString >
94 ScVbaLabel::getServiceNames()
96 static uno::Sequence< rtl::OUString > aServiceNames;
97 if ( aServiceNames.getLength() == 0 )
99 aServiceNames.realloc( 1 );
100 aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.Label" ) );
102 return aServiceNames;