/src/libreoffice/toolkit/source/controls/roadmapentry.cxx
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #include <controls/roadmapentry.hxx> |
21 | | #include <rtl/ustring.hxx> |
22 | | #include <com/sun/star/beans/PropertyAttribute.hpp> |
23 | | #include <cppuhelper/supportsservice.hxx> |
24 | | |
25 | | |
26 | 0 | ORoadmapEntry::ORoadmapEntry() : OPropertyContainer( GetBroadcastHelper() ) |
27 | 0 | { |
28 | | // registerProperty or registerMayBeVoidProperty or registerPropertyNoMember |
29 | |
|
30 | 0 | registerProperty( u"Label"_ustr, RM_PROPERTY_ID_LABEL, |
31 | 0 | css::beans::PropertyAttribute::BOUND | |
32 | 0 | css::beans::PropertyAttribute::CONSTRAINED, |
33 | 0 | & m_sLabel, cppu::UnoType<decltype(m_sLabel)>::get() ); |
34 | 0 | m_nID = -1; |
35 | 0 | registerProperty( u"ID"_ustr, RM_PROPERTY_ID_ID, |
36 | 0 | css::beans::PropertyAttribute::BOUND | |
37 | 0 | css::beans::PropertyAttribute::CONSTRAINED, |
38 | 0 | & m_nID, cppu::UnoType<decltype(m_nID)>::get() ); |
39 | 0 | m_bEnabled = true; |
40 | 0 | registerProperty( u"Enabled"_ustr, RM_PROPERTY_ID_ENABLED, |
41 | 0 | css::beans::PropertyAttribute::BOUND | |
42 | 0 | css::beans::PropertyAttribute::MAYBEDEFAULT, |
43 | 0 | & m_bEnabled, cppu::UnoType<decltype(m_bEnabled)>::get() ); |
44 | |
|
45 | 0 | registerProperty( u"Interactive"_ustr, RM_PROPERTY_ID_INTERACTIVE, |
46 | 0 | css::beans::PropertyAttribute::BOUND | |
47 | 0 | css::beans::PropertyAttribute::MAYBEDEFAULT, |
48 | 0 | & m_bInteractive, cppu::UnoType<decltype(m_bInteractive)>::get() ); |
49 | | |
50 | | |
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. |
54 | | |
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. |
57 | 0 | } |
58 | | |
59 | | |
60 | | IMPLEMENT_FORWARD_XINTERFACE2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer ); |
61 | | IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer ); |
62 | | // order matters: |
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 |
67 | | |
68 | | |
69 | | css::uno::Reference< css:: beans::XPropertySetInfo > SAL_CALL |
70 | | ORoadmapEntry::getPropertySetInfo() |
71 | 0 | { |
72 | 0 | return createPropertySetInfo( getInfoHelper() ); |
73 | 0 | } |
74 | | |
75 | | OUString SAL_CALL ORoadmapEntry::getImplementationName( ) |
76 | 0 | { |
77 | 0 | return u"com.sun.star.comp.toolkit.RoadmapItem"_ustr; |
78 | 0 | } |
79 | | |
80 | | sal_Bool SAL_CALL ORoadmapEntry::supportsService( const OUString& ServiceName ) |
81 | 0 | { |
82 | 0 | return cppu::supportsService(this, ServiceName); |
83 | 0 | } |
84 | | |
85 | | css::uno::Sequence< OUString > SAL_CALL ORoadmapEntry::getSupportedServiceNames( ) |
86 | 0 | { |
87 | 0 | return { u"com.sun.star.awt.RoadmapItem"_ustr }; |
88 | 0 | } |
89 | | |
90 | | ::cppu::IPropertyArrayHelper& ORoadmapEntry::getInfoHelper() |
91 | 0 | { |
92 | 0 | return *getArrayHelper(); |
93 | 0 | } |
94 | | |
95 | | |
96 | | ::cppu::IPropertyArrayHelper* ORoadmapEntry::createArrayHelper() const |
97 | 0 | { |
98 | 0 | css::uno::Sequence< css::beans::Property > aProps; |
99 | | // describes all properties which have been registered in the ctor |
100 | 0 | describeProperties( aProps ); |
101 | |
|
102 | 0 | return new ::cppu::OPropertyArrayHelper( aProps ); |
103 | 0 | } |
104 | | |
105 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |