1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_toolkit.hxx" 30 #include <toolkit/controls/roadmapentry.hxx> 31 32 #ifndef _RTL_USTRING_HXX_ 33 #include <rtl/OUString.hxx> 34 #endif 35 36 37 #include <com/sun/star/beans/PropertyAttribute.hpp> 38 39 40 ORoadmapEntry::ORoadmapEntry() : ORoadmapEntry_Base( ) 41 ,OPropertyContainer( GetBroadcastHelper() ) 42 { 43 // registerProperty or registerMayBeVoidProperty or registerPropertyNoMember 44 45 registerProperty( ::rtl::OUString::createFromAscii( "Label" ), RM_PROPERTY_ID_LABEL, 46 ::com::sun::star::beans::PropertyAttribute::BOUND | 47 ::com::sun::star::beans::PropertyAttribute::CONSTRAINED, 48 & m_sLabel, ::getCppuType( &m_sLabel ) ); 49 m_nID = -1; 50 registerProperty( ::rtl::OUString::createFromAscii( "ID" ), RM_PROPERTY_ID_ID, 51 ::com::sun::star::beans::PropertyAttribute::BOUND | 52 ::com::sun::star::beans::PropertyAttribute::CONSTRAINED, 53 & m_nID, ::getCppuType( &m_nID ) ); 54 m_bEnabled = sal_True; 55 registerProperty( ::rtl::OUString::createFromAscii( "Enabled" ), RM_PROPERTY_ID_ENABLED, 56 ::com::sun::star::beans::PropertyAttribute::BOUND | 57 ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT, 58 & m_bEnabled, ::getCppuType( &m_bEnabled ) ); 59 60 registerProperty( ::rtl::OUString::createFromAscii( "Interactive" ), RM_PROPERTY_ID_INTERACTIVE, 61 ::com::sun::star::beans::PropertyAttribute::BOUND | 62 ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT, 63 & m_bInteractive, ::getCppuType( &m_bInteractive ) ); 64 65 66 // ... 67 68 // Note that the list of registered properties has to be fixed: Different 69 // instances of this class have to register the same set of properties with 70 // the same attributes. 71 // 72 // This is because all instances of the class share the same PropertySetInfo 73 // which has been built from the registered property of _one_ instance. 74 } 75 76 //-------------------------------------------------------------------------- 77 IMPLEMENT_FORWARD_XINTERFACE2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer ); 78 IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer ); 79 // order matters: 80 // the first is the class name 81 // the second is the class which implements the ref-counting 82 // the third up to n-th (when using IMPLEMENT_FORWARD_*3 and so on) are other base classes 83 // whose XInterface and XTypeProvider implementations should be merged 84 85 //-------------------------------------------------------------------------- 86 ::com::sun::star::uno::Reference< ::com::sun::star:: beans::XPropertySetInfo > SAL_CALL 87 ORoadmapEntry::getPropertySetInfo() 88 throw(::com::sun::star::uno::RuntimeException) 89 { 90 return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >( 91 createPropertySetInfo( getInfoHelper() ) ); 92 } 93 94 ::rtl::OUString SAL_CALL ORoadmapEntry::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) 95 { 96 ::rtl::OUString aStr = ::rtl::OUString::createFromAscii("com.sun.star.comp.toolkit.RoadmapItem"); 97 return aStr; 98 } 99 100 sal_Bool SAL_CALL ORoadmapEntry::supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException) 101 { 102 return ServiceName.equals( ::rtl::OUString::createFromAscii( "com.sun.star.awt.RoadmapItem" ) ); 103 } 104 105 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ORoadmapEntry::getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException) 106 { 107 ::com::sun::star::uno::Sequence< ::rtl::OUString > aRet(1); 108 ::rtl::OUString* pArray = aRet.getArray(); 109 pArray[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.RoadmapItem" ); 110 return aRet; 111 } 112 //-------------------------------------------------------------------------- 113 ::cppu::IPropertyArrayHelper& ORoadmapEntry::getInfoHelper() 114 { 115 return *getArrayHelper(); 116 } 117 118 //-------------------------------------------------------------------------- 119 ::cppu::IPropertyArrayHelper* ORoadmapEntry::createArrayHelper() const 120 { 121 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps; 122 // describes all properties which have been registered in the ctor 123 describeProperties( aProps ); 124 125 return new ::cppu::OPropertyArrayHelper( aProps ); 126 } 127