Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / toolkit / source / controls / roadmapentry.cxx
blob3238b6e5d5783256abefc68237675f33498baaa1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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( "Label", RM_PROPERTY_ID_LABEL,
32 css::beans::PropertyAttribute::BOUND |
33 css::beans::PropertyAttribute::CONSTRAINED,
34 & m_sLabel, cppu::UnoType<decltype(m_sLabel)>::get() );
35 m_nID = -1;
36 registerProperty( "ID", RM_PROPERTY_ID_ID,
37 css::beans::PropertyAttribute::BOUND |
38 css::beans::PropertyAttribute::CONSTRAINED,
39 & m_nID, cppu::UnoType<decltype(m_nID)>::get() );
40 m_bEnabled = true;
41 registerProperty( "Enabled", RM_PROPERTY_ID_ENABLED,
42 css::beans::PropertyAttribute::BOUND |
43 css::beans::PropertyAttribute::MAYBEDEFAULT,
44 & m_bEnabled, cppu::UnoType<decltype(m_bEnabled)>::get() );
46 registerProperty( "Interactive", RM_PROPERTY_ID_INTERACTIVE,
47 css::beans::PropertyAttribute::BOUND |
48 css::beans::PropertyAttribute::MAYBEDEFAULT,
49 & m_bInteractive, cppu::UnoType<decltype(m_bInteractive)>::get() );
52 // Note that the list of registered properties has to be fixed: Different
53 // instances of this class have to register the same set of properties with
54 // the same attributes.
56 // This is because all instances of the class share the same PropertySetInfo
57 // which has been built from the registered property of _one_ instance.
61 IMPLEMENT_FORWARD_XINTERFACE2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer );
62 IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer );
63 // order matters:
64 // the first is the class name
65 // the second is the class which implements the ref-counting
66 // the third up to n-th (when using IMPLEMENT_FORWARD_*3 and so on) are other base classes
67 // whose XInterface and XTypeProvider implementations should be merged
70 css::uno::Reference< css:: beans::XPropertySetInfo > SAL_CALL
71 ORoadmapEntry::getPropertySetInfo()
73 return css::uno::Reference< css::beans::XPropertySetInfo >(
74 createPropertySetInfo( getInfoHelper() ) );
77 OUString SAL_CALL ORoadmapEntry::getImplementationName( )
79 OUString aStr("com.sun.star.comp.toolkit.RoadmapItem");
80 return aStr;
83 sal_Bool SAL_CALL ORoadmapEntry::supportsService( const OUString& ServiceName )
85 return cppu::supportsService(this, ServiceName);
88 css::uno::Sequence< OUString > SAL_CALL ORoadmapEntry::getSupportedServiceNames( )
90 css::uno::Sequence<OUString> aRet { "com.sun.star.awt.RoadmapItem" };
91 return aRet;
94 ::cppu::IPropertyArrayHelper& ORoadmapEntry::getInfoHelper()
96 return *getArrayHelper();
100 ::cppu::IPropertyArrayHelper* ORoadmapEntry::createArrayHelper() const
102 css::uno::Sequence< css::beans::Property > aProps;
103 // describes all properties which have been registered in the ctor
104 describeProperties( aProps );
106 return new ::cppu::OPropertyArrayHelper( aProps );
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */