Line data Source code
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 <toolkit/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() : ORoadmapEntry_Base( )
27 0 : ,OPropertyContainer( GetBroadcastHelper() )
28 : {
29 : // registerProperty or registerMayBeVoidProperty or registerPropertyNoMember
30 :
31 : registerProperty( OUString("Label"), RM_PROPERTY_ID_LABEL,
32 : ::com::sun::star::beans::PropertyAttribute::BOUND |
33 : ::com::sun::star::beans::PropertyAttribute::CONSTRAINED,
34 0 : & m_sLabel, ::getCppuType( &m_sLabel ) );
35 0 : m_nID = -1;
36 : registerProperty( OUString("ID"), RM_PROPERTY_ID_ID,
37 : ::com::sun::star::beans::PropertyAttribute::BOUND |
38 : ::com::sun::star::beans::PropertyAttribute::CONSTRAINED,
39 0 : & m_nID, ::getCppuType( &m_nID ) );
40 0 : m_bEnabled = true;
41 : registerProperty( OUString("Enabled"), RM_PROPERTY_ID_ENABLED,
42 : ::com::sun::star::beans::PropertyAttribute::BOUND |
43 : ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT,
44 0 : & m_bEnabled, ::getCppuType( &m_bEnabled ) );
45 :
46 : registerProperty( OUString("Interactive"), RM_PROPERTY_ID_INTERACTIVE,
47 : ::com::sun::star::beans::PropertyAttribute::BOUND |
48 : ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT,
49 0 : & m_bInteractive, ::getCppuType( &m_bInteractive ) );
50 :
51 :
52 :
53 :
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.
57 :
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.
60 0 : }
61 :
62 :
63 0 : IMPLEMENT_FORWARD_XINTERFACE2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer );
64 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer );
65 : // order matters:
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
70 :
71 :
72 : ::com::sun::star::uno::Reference< ::com::sun::star:: beans::XPropertySetInfo > SAL_CALL
73 0 : ORoadmapEntry::getPropertySetInfo()
74 : throw(::com::sun::star::uno::RuntimeException, std::exception)
75 : {
76 : return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >(
77 0 : createPropertySetInfo( getInfoHelper() ) );
78 : }
79 :
80 0 : OUString SAL_CALL ORoadmapEntry::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException, std::exception)
81 : {
82 0 : OUString aStr("com.sun.star.comp.toolkit.RoadmapItem");
83 0 : return aStr;
84 : }
85 :
86 0 : sal_Bool SAL_CALL ORoadmapEntry::supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception)
87 : {
88 0 : return cppu::supportsService(this, ServiceName);
89 : }
90 :
91 0 : ::com::sun::star::uno::Sequence< OUString > SAL_CALL ORoadmapEntry::getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException, std::exception)
92 : {
93 0 : ::com::sun::star::uno::Sequence< OUString > aRet(1);
94 0 : OUString* pArray = aRet.getArray();
95 0 : pArray[0] = "com.sun.star.awt.RoadmapItem";
96 0 : return aRet;
97 : }
98 :
99 0 : ::cppu::IPropertyArrayHelper& ORoadmapEntry::getInfoHelper()
100 : {
101 0 : return *getArrayHelper();
102 : }
103 :
104 :
105 0 : ::cppu::IPropertyArrayHelper* ORoadmapEntry::createArrayHelper() const
106 : {
107 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps;
108 : // describes all properties which have been registered in the ctor
109 0 : describeProperties( aProps );
110 :
111 0 : return new ::cppu::OPropertyArrayHelper( aProps );
112 : }
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|