merge the formfield patch from ooo-build
[ooovba.git] / toolkit / source / controls / unocontrolcontainermodel.cxx
blob87e5ab8c3057c0001153a73dc276829cc4c2eb5e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unocontrolcontainermodel.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_toolkit.hxx"
34 #include <toolkit/controls/unocontrolcontainermodel.hxx>
35 #include <toolkit/helper/property.hxx>
36 #include <toolkit/helper/servicenames.hxx>
37 #include <toolkit/helper/unopropertyarrayhelper.hxx>
39 // ----------------------------------------------------
40 // class UnoControlContainerModel
41 // ----------------------------------------------------
42 UnoControlContainerModel::UnoControlContainerModel()
44 ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
45 ImplRegisterProperty( BASEPROPERTY_BORDER );
46 ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
47 ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
48 ImplRegisterProperty( BASEPROPERTY_ENABLED );
49 ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
50 ImplRegisterProperty( BASEPROPERTY_HELPURL );
51 ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
52 ImplRegisterProperty( BASEPROPERTY_TEXT );
55 ::rtl::OUString UnoControlContainerModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
57 return ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainerModel );
60 ::com::sun::star::uno::Any UnoControlContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
62 ::com::sun::star::uno::Any aDefault;
63 if ( nPropId == BASEPROPERTY_BORDER )
64 aDefault <<= (sal_Int16) 0;
65 else
66 aDefault <<= UnoControlModel::ImplGetDefaultValue( nPropId );
67 return aDefault;
71 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlContainerModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
73 static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
74 return xInfo;
77 ::cppu::IPropertyArrayHelper& UnoControlContainerModel::getInfoHelper()
79 ::osl::Guard< ::osl::Mutex > aGuard( ((UnoControlContainerModel*)this)->GetMutex() );
81 static UnoPropertyArrayHelper* pHelper = NULL;
82 if ( !pHelper )
84 ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
85 pHelper = new UnoPropertyArrayHelper( aIDs );
87 return *pHelper;