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 :
22 : #include <rtl/ustring.hxx>
23 :
24 : #include <com/sun/star/beans/PropertyAttribute.hpp>
25 :
26 :
27 0 : ORoadmapEntry::ORoadmapEntry() : ORoadmapEntry_Base( )
28 0 : ,OPropertyContainer( GetBroadcastHelper() )
29 : {
30 : // registerProperty or registerMayBeVoidProperty or registerPropertyNoMember
31 :
32 : registerProperty( ::rtl::OUString("Label"), RM_PROPERTY_ID_LABEL,
33 : ::com::sun::star::beans::PropertyAttribute::BOUND |
34 : ::com::sun::star::beans::PropertyAttribute::CONSTRAINED,
35 0 : & m_sLabel, ::getCppuType( &m_sLabel ) );
36 0 : m_nID = -1;
37 : registerProperty( ::rtl::OUString("ID"), RM_PROPERTY_ID_ID,
38 : ::com::sun::star::beans::PropertyAttribute::BOUND |
39 : ::com::sun::star::beans::PropertyAttribute::CONSTRAINED,
40 0 : & m_nID, ::getCppuType( &m_nID ) );
41 0 : m_bEnabled = sal_True;
42 : registerProperty( ::rtl::OUString("Enabled"), RM_PROPERTY_ID_ENABLED,
43 : ::com::sun::star::beans::PropertyAttribute::BOUND |
44 : ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT,
45 0 : & m_bEnabled, ::getCppuType( &m_bEnabled ) );
46 :
47 : registerProperty( ::rtl::OUString("Interactive"), RM_PROPERTY_ID_INTERACTIVE,
48 : ::com::sun::star::beans::PropertyAttribute::BOUND |
49 : ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT,
50 0 : & m_bInteractive, ::getCppuType( &m_bInteractive ) );
51 :
52 :
53 : // ...
54 :
55 : // Note that the list of registered properties has to be fixed: Different
56 : // instances of this class have to register the same set of properties with
57 : // the same attributes.
58 : //
59 : // This is because all instances of the class share the same PropertySetInfo
60 : // which has been built from the registered property of _one_ instance.
61 0 : }
62 :
63 : //--------------------------------------------------------------------------
64 0 : IMPLEMENT_FORWARD_XINTERFACE2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer );
65 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer );
66 : // order matters:
67 : // the first is the class name
68 : // the second is the class which implements the ref-counting
69 : // the third up to n-th (when using IMPLEMENT_FORWARD_*3 and so on) are other base classes
70 : // whose XInterface and XTypeProvider implementations should be merged
71 :
72 : //--------------------------------------------------------------------------
73 : ::com::sun::star::uno::Reference< ::com::sun::star:: beans::XPropertySetInfo > SAL_CALL
74 0 : ORoadmapEntry::getPropertySetInfo()
75 : throw(::com::sun::star::uno::RuntimeException)
76 : {
77 : return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >(
78 0 : createPropertySetInfo( getInfoHelper() ) );
79 : }
80 :
81 0 : ::rtl::OUString SAL_CALL ORoadmapEntry::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
82 : {
83 0 : ::rtl::OUString aStr("com.sun.star.comp.toolkit.RoadmapItem");
84 0 : return aStr;
85 : }
86 :
87 0 : sal_Bool SAL_CALL ORoadmapEntry::supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException)
88 : {
89 0 : return ServiceName == "com.sun.star.awt.RoadmapItem";
90 : }
91 :
92 0 : ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ORoadmapEntry::getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
93 : {
94 0 : ::com::sun::star::uno::Sequence< ::rtl::OUString > aRet(1);
95 0 : ::rtl::OUString* pArray = aRet.getArray();
96 0 : pArray[0] = ::rtl::OUString("com.sun.star.awt.RoadmapItem");
97 0 : return aRet;
98 : }
99 : //--------------------------------------------------------------------------
100 0 : ::cppu::IPropertyArrayHelper& ORoadmapEntry::getInfoHelper()
101 : {
102 0 : return *getArrayHelper();
103 : }
104 :
105 : //--------------------------------------------------------------------------
106 0 : ::cppu::IPropertyArrayHelper* ORoadmapEntry::createArrayHelper() const
107 : {
108 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps;
109 : // describes all properties which have been registered in the ctor
110 0 : describeProperties( aProps );
111 :
112 0 : return new ::cppu::OPropertyArrayHelper( aProps );
113 : }
114 :
115 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|