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>
21 #include <rtl/ustring.hxx>
22 #include <com/sun/star/beans/PropertyAttribute.hpp>
23 #include <cppuhelper/supportsservice.hxx>
26 ORoadmapEntry::ORoadmapEntry() : ORoadmapEntry_Base( )
27 ,OPropertyContainer( GetBroadcastHelper() )
29 // registerProperty or registerMayBeVoidProperty or registerPropertyNoMember
31 registerProperty( OUString("Label"), RM_PROPERTY_ID_LABEL
,
32 ::com::sun::star::beans::PropertyAttribute::BOUND
|
33 ::com::sun::star::beans::PropertyAttribute::CONSTRAINED
,
34 & m_sLabel
, cppu::UnoType
<decltype(m_sLabel
)>::get() );
36 registerProperty( OUString("ID"), RM_PROPERTY_ID_ID
,
37 ::com::sun::star::beans::PropertyAttribute::BOUND
|
38 ::com::sun::star::beans::PropertyAttribute::CONSTRAINED
,
39 & m_nID
, cppu::UnoType
<decltype(m_nID
)>::get() );
41 registerProperty( OUString("Enabled"), RM_PROPERTY_ID_ENABLED
,
42 ::com::sun::star::beans::PropertyAttribute::BOUND
|
43 ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT
,
44 & m_bEnabled
, cppu::UnoType
<decltype(m_bEnabled
)>::get() );
46 registerProperty( OUString("Interactive"), RM_PROPERTY_ID_INTERACTIVE
,
47 ::com::sun::star::beans::PropertyAttribute::BOUND
|
48 ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT
,
49 & m_bInteractive
, cppu::UnoType
<decltype(m_bInteractive
)>::get() );
54 // Note that the list of registered properties has to be fixed: Different
55 // instances of this class have to register the same set of properties with
56 // the same attributes.
58 // This is because all instances of the class share the same PropertySetInfo
59 // which has been built from the registered property of _one_ instance.
63 IMPLEMENT_FORWARD_XINTERFACE2( ORoadmapEntry
, ORoadmapEntry_Base
, ::comphelper::OPropertyContainer
);
64 IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORoadmapEntry
, ORoadmapEntry_Base
, ::comphelper::OPropertyContainer
);
66 // the first is the class name
67 // the second is the class which implements the ref-counting
68 // the third up to n-th (when using IMPLEMENT_FORWARD_*3 and so on) are other base classes
69 // whose XInterface and XTypeProvider implementations should be merged
72 ::com::sun::star::uno::Reference
< ::com::sun::star:: beans::XPropertySetInfo
> SAL_CALL
73 ORoadmapEntry::getPropertySetInfo()
74 throw(::com::sun::star::uno::RuntimeException
, std::exception
)
76 return ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>(
77 createPropertySetInfo( getInfoHelper() ) );
80 OUString SAL_CALL
ORoadmapEntry::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
82 OUString
aStr("com.sun.star.comp.toolkit.RoadmapItem");
86 sal_Bool SAL_CALL
ORoadmapEntry::supportsService( const OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
88 return cppu::supportsService(this, ServiceName
);
91 ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
ORoadmapEntry::getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
93 ::com::sun::star::uno::Sequence
< OUString
> aRet(1);
94 OUString
* pArray
= aRet
.getArray();
95 pArray
[0] = "com.sun.star.awt.RoadmapItem";
99 ::cppu::IPropertyArrayHelper
& ORoadmapEntry::getInfoHelper()
101 return *getArrayHelper();
105 ::cppu::IPropertyArrayHelper
* ORoadmapEntry::createArrayHelper() const
107 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> aProps
;
108 // describes all properties which have been registered in the ctor
109 describeProperties( aProps
);
111 return new ::cppu::OPropertyArrayHelper( aProps
);
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */