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 <controls/roadmapentry.hxx>
21 #include <rtl/ustring.hxx>
22 #include <com/sun/star/beans/PropertyAttribute.hpp>
23 #include <cppuhelper/supportsservice.hxx>
26 ORoadmapEntry::ORoadmapEntry() : OPropertyContainer( GetBroadcastHelper() )
28 // registerProperty or registerMayBeVoidProperty or registerPropertyNoMember
30 registerProperty( u
"Label"_ustr
, RM_PROPERTY_ID_LABEL
,
31 css::beans::PropertyAttribute::BOUND
|
32 css::beans::PropertyAttribute::CONSTRAINED
,
33 & m_sLabel
, cppu::UnoType
<decltype(m_sLabel
)>::get() );
35 registerProperty( u
"ID"_ustr
, RM_PROPERTY_ID_ID
,
36 css::beans::PropertyAttribute::BOUND
|
37 css::beans::PropertyAttribute::CONSTRAINED
,
38 & m_nID
, cppu::UnoType
<decltype(m_nID
)>::get() );
40 registerProperty( u
"Enabled"_ustr
, RM_PROPERTY_ID_ENABLED
,
41 css::beans::PropertyAttribute::BOUND
|
42 css::beans::PropertyAttribute::MAYBEDEFAULT
,
43 & m_bEnabled
, cppu::UnoType
<decltype(m_bEnabled
)>::get() );
45 registerProperty( u
"Interactive"_ustr
, RM_PROPERTY_ID_INTERACTIVE
,
46 css::beans::PropertyAttribute::BOUND
|
47 css::beans::PropertyAttribute::MAYBEDEFAULT
,
48 & m_bInteractive
, cppu::UnoType
<decltype(m_bInteractive
)>::get() );
51 // Note that the list of registered properties has to be fixed: Different
52 // instances of this class have to register the same set of properties with
53 // the same attributes.
55 // This is because all instances of the class share the same PropertySetInfo
56 // which has been built from the registered property of _one_ instance.
60 IMPLEMENT_FORWARD_XINTERFACE2( ORoadmapEntry
, ORoadmapEntry_Base
, ::comphelper::OPropertyContainer
);
61 IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORoadmapEntry
, ORoadmapEntry_Base
, ::comphelper::OPropertyContainer
);
63 // the first is the class name
64 // the second is the class which implements the ref-counting
65 // the third up to n-th (when using IMPLEMENT_FORWARD_*3 and so on) are other base classes
66 // whose XInterface and XTypeProvider implementations should be merged
69 css::uno::Reference
< css:: beans::XPropertySetInfo
> SAL_CALL
70 ORoadmapEntry::getPropertySetInfo()
72 return createPropertySetInfo( getInfoHelper() );
75 OUString SAL_CALL
ORoadmapEntry::getImplementationName( )
77 return u
"com.sun.star.comp.toolkit.RoadmapItem"_ustr
;
80 sal_Bool SAL_CALL
ORoadmapEntry::supportsService( const OUString
& ServiceName
)
82 return cppu::supportsService(this, ServiceName
);
85 css::uno::Sequence
< OUString
> SAL_CALL
ORoadmapEntry::getSupportedServiceNames( )
87 return { u
"com.sun.star.awt.RoadmapItem"_ustr
};
90 ::cppu::IPropertyArrayHelper
& ORoadmapEntry::getInfoHelper()
92 return *getArrayHelper();
96 ::cppu::IPropertyArrayHelper
* ORoadmapEntry::createArrayHelper() const
98 css::uno::Sequence
< css::beans::Property
> aProps
;
99 // describes all properties which have been registered in the ctor
100 describeProperties( aProps
);
102 return new ::cppu::OPropertyArrayHelper( aProps
);
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */