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