1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: roadmapentry.cxx,v $
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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_toolkit.hxx"
33 #include <toolkit/controls/roadmapentry.hxx>
35 #ifndef _RTL_USTRING_HXX_
36 #include <rtl/OUString.hxx>
40 #include <com/sun/star/beans/PropertyAttribute.hpp>
43 ORoadmapEntry::ORoadmapEntry() : ORoadmapEntry_Base( )
44 ,OPropertyContainer( GetBroadcastHelper() )
46 // registerProperty or registerMayBeVoidProperty or registerPropertyNoMember
48 registerProperty( ::rtl::OUString::createFromAscii( "Label" ), RM_PROPERTY_ID_LABEL
,
49 ::com::sun::star::beans::PropertyAttribute::BOUND
|
50 ::com::sun::star::beans::PropertyAttribute::CONSTRAINED
,
51 & m_sLabel
, ::getCppuType( &m_sLabel
) );
53 registerProperty( ::rtl::OUString::createFromAscii( "ID" ), RM_PROPERTY_ID_ID
,
54 ::com::sun::star::beans::PropertyAttribute::BOUND
|
55 ::com::sun::star::beans::PropertyAttribute::CONSTRAINED
,
56 & m_nID
, ::getCppuType( &m_nID
) );
57 m_bEnabled
= sal_True
;
58 registerProperty( ::rtl::OUString::createFromAscii( "Enabled" ), RM_PROPERTY_ID_ENABLED
,
59 ::com::sun::star::beans::PropertyAttribute::BOUND
|
60 ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT
,
61 & m_bEnabled
, ::getCppuType( &m_bEnabled
) );
63 registerProperty( ::rtl::OUString::createFromAscii( "Interactive" ), RM_PROPERTY_ID_INTERACTIVE
,
64 ::com::sun::star::beans::PropertyAttribute::BOUND
|
65 ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT
,
66 & m_bInteractive
, ::getCppuType( &m_bInteractive
) );
71 // Note that the list of registered properties has to be fixed: Different
72 // instances of this class have to register the same set of properties with
73 // the same attributes.
75 // This is because all instances of the class share the same PropertySetInfo
76 // which has been built from the registered property of _one_ instance.
79 //--------------------------------------------------------------------------
80 IMPLEMENT_FORWARD_XINTERFACE2( ORoadmapEntry
, ORoadmapEntry_Base
, ::comphelper::OPropertyContainer
);
81 IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORoadmapEntry
, ORoadmapEntry_Base
, ::comphelper::OPropertyContainer
);
83 // the first is the class name
84 // the second is the class which implements the ref-counting
85 // the third up to n-th (when using IMPLEMENT_FORWARD_*3 and so on) are other base classes
86 // whose XInterface and XTypeProvider implementations should be merged
88 //--------------------------------------------------------------------------
89 ::com::sun::star::uno::Reference
< ::com::sun::star:: beans::XPropertySetInfo
> SAL_CALL
90 ORoadmapEntry::getPropertySetInfo()
91 throw(::com::sun::star::uno::RuntimeException
)
93 return ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>(
94 createPropertySetInfo( getInfoHelper() ) );
97 ::rtl::OUString SAL_CALL
ORoadmapEntry::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
)
99 ::rtl::OUString aStr
= ::rtl::OUString::createFromAscii("com.sun.star.comp.toolkit.RoadmapItem");
103 sal_Bool SAL_CALL
ORoadmapEntry::supportsService( const ::rtl::OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
)
105 return ServiceName
.equals( ::rtl::OUString::createFromAscii( "com.sun.star.awt.RoadmapItem" ) );
108 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
ORoadmapEntry::getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
)
110 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aRet(1);
111 ::rtl::OUString
* pArray
= aRet
.getArray();
112 pArray
[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.RoadmapItem" );
115 //--------------------------------------------------------------------------
116 ::cppu::IPropertyArrayHelper
& ORoadmapEntry::getInfoHelper()
118 return *getArrayHelper();
121 //--------------------------------------------------------------------------
122 ::cppu::IPropertyArrayHelper
* ORoadmapEntry::createArrayHelper() const
124 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> aProps
;
125 // describes all properties which have been registered in the ctor
126 describeProperties( aProps
);
128 return new ::cppu::OPropertyArrayHelper( aProps
);