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 31 #include <toolkit/controls/unocontrolcontainermodel.hxx> 32 #include <toolkit/helper/property.hxx> 33 #include <toolkit/helper/servicenames.hxx> 34 #include <toolkit/helper/unopropertyarrayhelper.hxx> 35 36 // ---------------------------------------------------- 37 // class UnoControlContainerModel 38 // ---------------------------------------------------- 39 UnoControlContainerModel::UnoControlContainerModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ) 40 :UnoControlModel( i_factory ) 41 { 42 ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); 43 ImplRegisterProperty( BASEPROPERTY_BORDER ); 44 ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR ); 45 ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); 46 ImplRegisterProperty( BASEPROPERTY_ENABLED ); 47 ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); 48 ImplRegisterProperty( BASEPROPERTY_HELPURL ); 49 ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); 50 ImplRegisterProperty( BASEPROPERTY_TEXT ); 51 } 52 53 ::rtl::OUString UnoControlContainerModel::getServiceName() throw(::com::sun::star::uno::RuntimeException) 54 { 55 return ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainerModel ); 56 } 57 58 ::com::sun::star::uno::Any UnoControlContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const 59 { 60 ::com::sun::star::uno::Any aDefault; 61 if ( nPropId == BASEPROPERTY_BORDER ) 62 aDefault <<= (sal_Int16) 0; 63 else 64 aDefault <<= UnoControlModel::ImplGetDefaultValue( nPropId ); 65 return aDefault; 66 } 67 68 69 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlContainerModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) 70 { 71 static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); 72 return xInfo; 73 } 74 75 ::cppu::IPropertyArrayHelper& UnoControlContainerModel::getInfoHelper() 76 { 77 ::osl::Guard< ::osl::Mutex > aGuard( ((UnoControlContainerModel*)this)->GetMutex() ); 78 79 static UnoPropertyArrayHelper* pHelper = NULL; 80 if ( !pHelper ) 81 { 82 ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); 83 pHelper = new UnoPropertyArrayHelper( aIDs ); 84 } 85 return *pHelper; 86 } 87 88 89 90 91