merge the formfield patch from ooo-build
[ooovba.git] / basctl / source / basicide / basidectrlr.cxx
blob04fd607561cba384a9cb82aab45a6afff9428928
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: basidectrlr.cxx,v $
10 * $Revision: 1.4 $
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_basctl.hxx"
34 #ifndef _BASCTL_BASIDECTRLR_HXX_
35 #include <basidectrlr.hxx>
36 #endif
37 #include <cppuhelper/queryinterface.hxx>
38 #include <comphelper/sequence.hxx>
39 #include <com/sun/star/beans/PropertyAttribute.hpp>
41 #include <vcl/syswin.hxx>
43 #include <basidesh.hxx>
46 using namespace com::sun::star;
47 using namespace com::sun::star::uno;
48 using namespace com::sun::star::beans;
51 #define PROPERTY_ID_ICONID 1
52 #define PROPERTY_ICONID ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IconId" ) )
55 //----------------------------------------------------------------------------
57 BasicIDEController::BasicIDEController( BasicIDEShell* pViewShell )
58 :OPropertyContainer( m_aBHelper )
59 ,SfxBaseController( pViewShell )
60 ,m_nIconId( ICON_MACROLIBRARY )
62 registerProperty( PROPERTY_ICONID, PROPERTY_ID_ICONID, PropertyAttribute::READONLY, &m_nIconId, ::getCppuType( &m_nIconId ) );
65 //----------------------------------------------------------------------------
67 BasicIDEController::~BasicIDEController()
71 // XInterface
72 //----------------------------------------------------------------------------
74 Any SAL_CALL BasicIDEController::queryInterface( const Type & rType ) throw(RuntimeException)
76 Any aReturn = SfxBaseController::queryInterface( rType );
77 if ( !aReturn.hasValue() )
78 aReturn = OPropertyContainer::queryInterface( rType );
80 return aReturn;
83 //----------------------------------------------------------------------------
85 void SAL_CALL BasicIDEController::acquire() throw()
87 SfxBaseController::acquire();
90 //----------------------------------------------------------------------------
92 void SAL_CALL BasicIDEController::release() throw()
94 SfxBaseController::release();
98 // XTypeProvider ( ::SfxBaseController )
99 //----------------------------------------------------------------------------
101 Sequence< Type > SAL_CALL BasicIDEController::getTypes() throw(RuntimeException)
103 Sequence< Type > aTypes = ::comphelper::concatSequences(
104 SfxBaseController::getTypes(),
105 OPropertyContainer::getTypes()
108 return aTypes;
111 //----------------------------------------------------------------------------
113 Sequence< sal_Int8 > SAL_CALL BasicIDEController::getImplementationId() throw(RuntimeException)
115 static ::cppu::OImplementationId * pId = 0;
116 if ( !pId )
118 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
119 if ( !pId )
121 static ::cppu::OImplementationId aId;
122 pId = &aId;
125 return pId->getImplementationId();
128 // XPropertySet
129 //----------------------------------------------------------------------------
131 Reference< beans::XPropertySetInfo > SAL_CALL BasicIDEController::getPropertySetInfo() throw(RuntimeException)
133 Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
134 return xInfo;
137 // OPropertySetHelper
138 //----------------------------------------------------------------------------
140 ::cppu::IPropertyArrayHelper& BasicIDEController::getInfoHelper()
142 return *getArrayHelper();
145 // OPropertyArrayUsageHelper
146 //----------------------------------------------------------------------------
148 ::cppu::IPropertyArrayHelper* BasicIDEController::createArrayHelper( ) const
150 Sequence< Property > aProps;
151 describeProperties( aProps );
152 return new ::cppu::OPropertyArrayHelper( aProps );
155 //----------------------------------------------------------------------------