1*b0724fc6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*b0724fc6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b0724fc6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b0724fc6SAndrew Rist  * distributed with this work for additional information
6*b0724fc6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b0724fc6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b0724fc6SAndrew Rist  * "License"); you may not use this file except in compliance
9*b0724fc6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*b0724fc6SAndrew Rist  *
11*b0724fc6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*b0724fc6SAndrew Rist  *
13*b0724fc6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b0724fc6SAndrew Rist  * software distributed under the License is distributed on an
15*b0724fc6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b0724fc6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b0724fc6SAndrew Rist  * specific language governing permissions and limitations
18*b0724fc6SAndrew Rist  * under the License.
19*b0724fc6SAndrew Rist  *
20*b0724fc6SAndrew Rist  *************************************************************/
21*b0724fc6SAndrew Rist 
22*b0724fc6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_toolkit.hxx"
26cdf0e10cSrcweir #include <toolkit/controls/roadmapentry.hxx>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #ifndef _RTL_USTRING_HXX_
29cdf0e10cSrcweir #include <rtl/OUString.hxx>
30cdf0e10cSrcweir #endif
31cdf0e10cSrcweir 
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir 
ORoadmapEntry()36cdf0e10cSrcweir ORoadmapEntry::ORoadmapEntry() : ORoadmapEntry_Base( )
37cdf0e10cSrcweir                                 ,OPropertyContainer( GetBroadcastHelper() )
38cdf0e10cSrcweir {
39cdf0e10cSrcweir     // registerProperty or registerMayBeVoidProperty or registerPropertyNoMember
40cdf0e10cSrcweir 
41cdf0e10cSrcweir     registerProperty( ::rtl::OUString::createFromAscii( "Label" ), RM_PROPERTY_ID_LABEL,
42cdf0e10cSrcweir                       ::com::sun::star::beans::PropertyAttribute::BOUND |
43cdf0e10cSrcweir                       ::com::sun::star::beans::PropertyAttribute::CONSTRAINED,
44cdf0e10cSrcweir                       & m_sLabel, ::getCppuType( &m_sLabel ) );
45cdf0e10cSrcweir     m_nID = -1;
46cdf0e10cSrcweir     registerProperty( ::rtl::OUString::createFromAscii( "ID" ), RM_PROPERTY_ID_ID,
47cdf0e10cSrcweir                       ::com::sun::star::beans::PropertyAttribute::BOUND |
48cdf0e10cSrcweir                       ::com::sun::star::beans::PropertyAttribute::CONSTRAINED,
49cdf0e10cSrcweir                       & m_nID, ::getCppuType( &m_nID ) );
50cdf0e10cSrcweir     m_bEnabled = sal_True;
51cdf0e10cSrcweir     registerProperty( ::rtl::OUString::createFromAscii( "Enabled" ), RM_PROPERTY_ID_ENABLED,
52cdf0e10cSrcweir                     ::com::sun::star::beans::PropertyAttribute::BOUND |
53cdf0e10cSrcweir                     ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT,
54cdf0e10cSrcweir                     & m_bEnabled, ::getCppuType( &m_bEnabled ) );
55cdf0e10cSrcweir 
56cdf0e10cSrcweir     registerProperty( ::rtl::OUString::createFromAscii( "Interactive" ), RM_PROPERTY_ID_INTERACTIVE,
57cdf0e10cSrcweir                     ::com::sun::star::beans::PropertyAttribute::BOUND |
58cdf0e10cSrcweir                     ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT,
59cdf0e10cSrcweir                     & m_bInteractive, ::getCppuType( &m_bInteractive ) );
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 
62cdf0e10cSrcweir     // ...
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     // Note that the list of registered properties has to be fixed: Different
65cdf0e10cSrcweir     // instances of this class have to register the same set of properties with
66cdf0e10cSrcweir     // the same attributes.
67cdf0e10cSrcweir     //
68cdf0e10cSrcweir     // This is because all instances of the class share the same PropertySetInfo
69cdf0e10cSrcweir     // which has been built from the registered property of _one_ instance.
70cdf0e10cSrcweir }
71cdf0e10cSrcweir 
72cdf0e10cSrcweir //--------------------------------------------------------------------------
73cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer );
74cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer );
75cdf0e10cSrcweir     // order matters:
76cdf0e10cSrcweir     //  the first is the class name
77cdf0e10cSrcweir     //  the second is the class which implements the ref-counting
78cdf0e10cSrcweir     //  the third up to n-th (when using IMPLEMENT_FORWARD_*3 and so on) are other base classes
79cdf0e10cSrcweir     //  whose XInterface and XTypeProvider implementations should be merged
80cdf0e10cSrcweir 
81cdf0e10cSrcweir //--------------------------------------------------------------------------
82cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star:: beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo()83cdf0e10cSrcweir     ORoadmapEntry::getPropertySetInfo()
84cdf0e10cSrcweir     throw(::com::sun::star::uno::RuntimeException)
85cdf0e10cSrcweir {
86cdf0e10cSrcweir     return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >(
87cdf0e10cSrcweir         createPropertySetInfo( getInfoHelper() ) );
88cdf0e10cSrcweir }
89cdf0e10cSrcweir 
getImplementationName()90cdf0e10cSrcweir ::rtl::OUString SAL_CALL ORoadmapEntry::getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException)
91cdf0e10cSrcweir {
92cdf0e10cSrcweir     ::rtl::OUString aStr = ::rtl::OUString::createFromAscii("com.sun.star.comp.toolkit.RoadmapItem");
93cdf0e10cSrcweir     return aStr;
94cdf0e10cSrcweir }
95cdf0e10cSrcweir 
supportsService(const::rtl::OUString & ServiceName)96cdf0e10cSrcweir sal_Bool SAL_CALL ORoadmapEntry::supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException)
97cdf0e10cSrcweir {
98cdf0e10cSrcweir     return ServiceName.equals( ::rtl::OUString::createFromAscii( "com.sun.star.awt.RoadmapItem" ) );
99cdf0e10cSrcweir }
100cdf0e10cSrcweir 
getSupportedServiceNames()101cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ORoadmapEntry::getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException)
102cdf0e10cSrcweir {
103cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::rtl::OUString > aRet(1);
104cdf0e10cSrcweir     ::rtl::OUString* pArray = aRet.getArray();
105cdf0e10cSrcweir     pArray[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.RoadmapItem" );
106cdf0e10cSrcweir     return aRet;
107cdf0e10cSrcweir }
108cdf0e10cSrcweir //--------------------------------------------------------------------------
getInfoHelper()109cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& ORoadmapEntry::getInfoHelper()
110cdf0e10cSrcweir {
111cdf0e10cSrcweir     return *getArrayHelper();
112cdf0e10cSrcweir }
113cdf0e10cSrcweir 
114cdf0e10cSrcweir //--------------------------------------------------------------------------
createArrayHelper() const115cdf0e10cSrcweir ::cppu::IPropertyArrayHelper* ORoadmapEntry::createArrayHelper() const
116cdf0e10cSrcweir {
117cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps;
118cdf0e10cSrcweir     // describes all properties which have been registered in the ctor
119cdf0e10cSrcweir     describeProperties( aProps );
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     return new ::cppu::OPropertyArrayHelper( aProps );
122cdf0e10cSrcweir }
123