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 #ifndef __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_ 29 #define __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_ 30 31 //_________________________________________________________________________________________________________________ 32 // my own includes 33 //_________________________________________________________________________________________________________________ 34 35 #include <threadhelp/threadhelpbase.hxx> 36 #include <macros/generic.hxx> 37 #include <macros/xinterface.hxx> 38 #include <macros/xtypeprovider.hxx> 39 40 //_________________________________________________________________________________________________________________ 41 // interface includes 42 //_________________________________________________________________________________________________________________ 43 #include <com/sun/star/ui/XUIElement.hpp> 44 #include <com/sun/star/lang/XInitialization.hpp> 45 #include <com/sun/star/lang/XComponent.hpp> 46 #include <com/sun/star/frame/XFrame.hpp> 47 #include <com/sun/star/util/XUpdatable.hpp> 48 49 //_________________________________________________________________________________________________________________ 50 // other includes 51 //_________________________________________________________________________________________________________________ 52 #include <rtl/ustring.hxx> 53 #include <cppuhelper/propshlp.hxx> 54 #include <cppuhelper/interfacecontainer.hxx> 55 #include <cppuhelper/weak.hxx> 56 57 namespace framework 58 { 59 60 class UIElementWrapperBase : public ::com::sun::star::lang::XTypeProvider , 61 public ::com::sun::star::ui::XUIElement , 62 public ::com::sun::star::lang::XInitialization , 63 public ::com::sun::star::lang::XComponent , 64 public ::com::sun::star::util::XUpdatable , 65 protected ThreadHelpBase , 66 public ::cppu::OBroadcastHelper , 67 public ::cppu::OPropertySetHelper , 68 public ::cppu::OWeakObject 69 { 70 //------------------------------------------------------------------------------------------------------------- 71 // public methods 72 //------------------------------------------------------------------------------------------------------------- 73 public: 74 UIElementWrapperBase( sal_Int16 nType ); 75 virtual ~UIElementWrapperBase(); 76 77 // XInterface 78 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw( ::com::sun::star::uno::RuntimeException ); 79 virtual void SAL_CALL acquire() throw(); 80 virtual void SAL_CALL release() throw(); 81 82 // XTypeProvider 83 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw( ::com::sun::star::uno::RuntimeException ); 84 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( ::com::sun::star::uno::RuntimeException ); 85 86 // XComponent 87 virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException) = 0; 88 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 89 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 90 91 // XInitialization 92 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 93 94 // XUpdatable 95 virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); 96 97 // XUIElement 98 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException); 99 virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException); 100 virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException); 101 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException) = 0; 102 103 //------------------------------------------------------------------------------------------------------------- 104 // protected methods 105 //------------------------------------------------------------------------------------------------------------- 106 protected: 107 108 // OPropertySetHelper 109 virtual sal_Bool SAL_CALL convertFastPropertyValue ( com::sun::star::uno::Any& aConvertedValue , 110 com::sun::star::uno::Any& aOldValue , 111 sal_Int32 nHandle , 112 const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ); 113 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , 114 const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ); 115 using cppu::OPropertySetHelper::getFastPropertyValue; 116 virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue , 117 sal_Int32 nHandle ) const; 118 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 119 virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException); 120 121 static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); 122 123 ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener 124 rtl::OUString m_aResourceURL; 125 com::sun::star::uno::WeakReference< com::sun::star::frame::XFrame > m_xWeakFrame; 126 sal_Int16 m_nType; 127 sal_Bool m_bInitialized : 1, 128 m_bDisposed; 129 }; 130 131 } // namespace framework 132 133 #endif // __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_ 134