1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <toolkit/controls/roadmapentry.hxx>
22 #include <rtl/ustring.hxx>
24 #include <com/sun/star/beans/PropertyAttribute.hpp>
27 ORoadmapEntry::ORoadmapEntry() : ORoadmapEntry_Base( )
28 ,OPropertyContainer( GetBroadcastHelper() )
30 // registerProperty or registerMayBeVoidProperty or registerPropertyNoMember
32 registerProperty( ::rtl::OUString("Label"), RM_PROPERTY_ID_LABEL
,
33 ::com::sun::star::beans::PropertyAttribute::BOUND
|
34 ::com::sun::star::beans::PropertyAttribute::CONSTRAINED
,
35 & m_sLabel
, ::getCppuType( &m_sLabel
) );
37 registerProperty( ::rtl::OUString("ID"), RM_PROPERTY_ID_ID
,
38 ::com::sun::star::beans::PropertyAttribute::BOUND
|
39 ::com::sun::star::beans::PropertyAttribute::CONSTRAINED
,
40 & m_nID
, ::getCppuType( &m_nID
) );
41 m_bEnabled
= sal_True
;
42 registerProperty( ::rtl::OUString("Enabled"), RM_PROPERTY_ID_ENABLED
,
43 ::com::sun::star::beans::PropertyAttribute::BOUND
|
44 ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT
,
45 & m_bEnabled
, ::getCppuType( &m_bEnabled
) );
47 registerProperty( ::rtl::OUString("Interactive"), RM_PROPERTY_ID_INTERACTIVE
,
48 ::com::sun::star::beans::PropertyAttribute::BOUND
|
49 ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT
,
50 & m_bInteractive
, ::getCppuType( &m_bInteractive
) );
55 // Note that the list of registered properties has to be fixed: Different
56 // instances of this class have to register the same set of properties with
57 // the same attributes.
59 // This is because all instances of the class share the same PropertySetInfo
60 // which has been built from the registered property of _one_ instance.
63 //--------------------------------------------------------------------------
64 IMPLEMENT_FORWARD_XINTERFACE2( ORoadmapEntry
, ORoadmapEntry_Base
, ::comphelper::OPropertyContainer
);
65 IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORoadmapEntry
, ORoadmapEntry_Base
, ::comphelper::OPropertyContainer
);
67 // the first is the class name
68 // the second is the class which implements the ref-counting
69 // the third up to n-th (when using IMPLEMENT_FORWARD_*3 and so on) are other base classes
70 // whose XInterface and XTypeProvider implementations should be merged
72 //--------------------------------------------------------------------------
73 ::com::sun::star::uno::Reference
< ::com::sun::star:: beans::XPropertySetInfo
> SAL_CALL
74 ORoadmapEntry::getPropertySetInfo()
75 throw(::com::sun::star::uno::RuntimeException
)
77 return ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>(
78 createPropertySetInfo( getInfoHelper() ) );
81 ::rtl::OUString SAL_CALL
ORoadmapEntry::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
)
83 ::rtl::OUString
aStr("com.sun.star.comp.toolkit.RoadmapItem");
87 sal_Bool SAL_CALL
ORoadmapEntry::supportsService( const ::rtl::OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
)
89 return ServiceName
== "com.sun.star.awt.RoadmapItem";
92 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
ORoadmapEntry::getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
)
94 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aRet(1);
95 ::rtl::OUString
* pArray
= aRet
.getArray();
96 pArray
[0] = ::rtl::OUString("com.sun.star.awt.RoadmapItem");
99 //--------------------------------------------------------------------------
100 ::cppu::IPropertyArrayHelper
& ORoadmapEntry::getInfoHelper()
102 return *getArrayHelper();
105 //--------------------------------------------------------------------------
106 ::cppu::IPropertyArrayHelper
* ORoadmapEntry::createArrayHelper() const
108 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> aProps
;
109 // describes all properties which have been registered in the ctor
110 describeProperties( aProps
);
112 return new ::cppu::OPropertyArrayHelper( aProps
);
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */