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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_toolkit.hxx"
26 #include <toolkit/controls/roadmapentry.hxx>
27 
28 #ifndef _RTL_USTRING_HXX_
29 #include <rtl/OUString.hxx>
30 #endif
31 
32 
33 #include <com/sun/star/beans/PropertyAttribute.hpp>
34 
35 
ORoadmapEntry()36 ORoadmapEntry::ORoadmapEntry() : ORoadmapEntry_Base( )
37                                 ,OPropertyContainer( GetBroadcastHelper() )
38 {
39     // registerProperty or registerMayBeVoidProperty or registerPropertyNoMember
40 
41     registerProperty( ::rtl::OUString::createFromAscii( "Label" ), RM_PROPERTY_ID_LABEL,
42                       ::com::sun::star::beans::PropertyAttribute::BOUND |
43                       ::com::sun::star::beans::PropertyAttribute::CONSTRAINED,
44                       & m_sLabel, ::getCppuType( &m_sLabel ) );
45     m_nID = -1;
46     registerProperty( ::rtl::OUString::createFromAscii( "ID" ), RM_PROPERTY_ID_ID,
47                       ::com::sun::star::beans::PropertyAttribute::BOUND |
48                       ::com::sun::star::beans::PropertyAttribute::CONSTRAINED,
49                       & m_nID, ::getCppuType( &m_nID ) );
50     m_bEnabled = sal_True;
51     registerProperty( ::rtl::OUString::createFromAscii( "Enabled" ), RM_PROPERTY_ID_ENABLED,
52                     ::com::sun::star::beans::PropertyAttribute::BOUND |
53                     ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT,
54                     & m_bEnabled, ::getCppuType( &m_bEnabled ) );
55 
56     registerProperty( ::rtl::OUString::createFromAscii( "Interactive" ), RM_PROPERTY_ID_INTERACTIVE,
57                     ::com::sun::star::beans::PropertyAttribute::BOUND |
58                     ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT,
59                     & m_bInteractive, ::getCppuType( &m_bInteractive ) );
60 
61 
62     // ...
63 
64     // Note that the list of registered properties has to be fixed: Different
65     // instances of this class have to register the same set of properties with
66     // the same attributes.
67     //
68     // This is because all instances of the class share the same PropertySetInfo
69     // which has been built from the registered property of _one_ instance.
70 }
71 
72 //--------------------------------------------------------------------------
73 IMPLEMENT_FORWARD_XINTERFACE2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer );
74 IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer );
75     // order matters:
76     //  the first is the class name
77     //  the second is the class which implements the ref-counting
78     //  the third up to n-th (when using IMPLEMENT_FORWARD_*3 and so on) are other base classes
79     //  whose XInterface and XTypeProvider implementations should be merged
80 
81 //--------------------------------------------------------------------------
82 ::com::sun::star::uno::Reference< ::com::sun::star:: beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo()83     ORoadmapEntry::getPropertySetInfo()
84     throw(::com::sun::star::uno::RuntimeException)
85 {
86     return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >(
87         createPropertySetInfo( getInfoHelper() ) );
88 }
89 
getImplementationName()90 ::rtl::OUString SAL_CALL ORoadmapEntry::getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException)
91 {
92     ::rtl::OUString aStr = ::rtl::OUString::createFromAscii("com.sun.star.comp.toolkit.RoadmapItem");
93     return aStr;
94 }
95 
supportsService(const::rtl::OUString & ServiceName)96 sal_Bool SAL_CALL ORoadmapEntry::supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException)
97 {
98     return ServiceName.equals( ::rtl::OUString::createFromAscii( "com.sun.star.awt.RoadmapItem" ) );
99 }
100 
getSupportedServiceNames()101 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ORoadmapEntry::getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException)
102 {
103     ::com::sun::star::uno::Sequence< ::rtl::OUString > aRet(1);
104     ::rtl::OUString* pArray = aRet.getArray();
105     pArray[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.RoadmapItem" );
106     return aRet;
107 }
108 //--------------------------------------------------------------------------
getInfoHelper()109 ::cppu::IPropertyArrayHelper& ORoadmapEntry::getInfoHelper()
110 {
111     return *getArrayHelper();
112 }
113 
114 //--------------------------------------------------------------------------
createArrayHelper() const115 ::cppu::IPropertyArrayHelper* ORoadmapEntry::createArrayHelper() const
116 {
117     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps;
118     // describes all properties which have been registered in the ctor
119     describeProperties( aProps );
120 
121     return new ::cppu::OPropertyArrayHelper( aProps );
122 }
123