1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_ 25 #define __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_ 26 27 //_________________________________________________________________________________________________________________ 28 // my own includes 29 //_________________________________________________________________________________________________________________ 30 31 #include <threadhelp/threadhelpbase.hxx> 32 #include <macros/generic.hxx> 33 #include <macros/xinterface.hxx> 34 #include <macros/xtypeprovider.hxx> 35 36 //_________________________________________________________________________________________________________________ 37 // interface includes 38 //_________________________________________________________________________________________________________________ 39 #include <com/sun/star/ui/XUIElement.hpp> 40 #include <com/sun/star/lang/XInitialization.hpp> 41 #include <com/sun/star/lang/XComponent.hpp> 42 #include <com/sun/star/frame/XFrame.hpp> 43 #include <com/sun/star/util/XUpdatable.hpp> 44 45 //_________________________________________________________________________________________________________________ 46 // other includes 47 //_________________________________________________________________________________________________________________ 48 #include <rtl/ustring.hxx> 49 #include <cppuhelper/propshlp.hxx> 50 #include <cppuhelper/interfacecontainer.hxx> 51 #include <cppuhelper/weak.hxx> 52 53 namespace framework 54 { 55 56 class UIElementWrapperBase : public ::com::sun::star::lang::XTypeProvider , 57 public ::com::sun::star::ui::XUIElement , 58 public ::com::sun::star::lang::XInitialization , 59 public ::com::sun::star::lang::XComponent , 60 public ::com::sun::star::util::XUpdatable , 61 protected ThreadHelpBase , 62 public ::cppu::OBroadcastHelper , 63 public ::cppu::OPropertySetHelper , 64 public ::cppu::OWeakObject 65 { 66 //------------------------------------------------------------------------------------------------------------- 67 // public methods 68 //------------------------------------------------------------------------------------------------------------- 69 public: 70 UIElementWrapperBase( sal_Int16 nType ); 71 virtual ~UIElementWrapperBase(); 72 73 // XInterface 74 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw( ::com::sun::star::uno::RuntimeException ); 75 virtual void SAL_CALL acquire() throw(); 76 virtual void SAL_CALL release() throw(); 77 78 // XTypeProvider 79 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw( ::com::sun::star::uno::RuntimeException ); 80 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( ::com::sun::star::uno::RuntimeException ); 81 82 // XComponent 83 virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException) = 0; 84 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 85 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 86 87 // XInitialization 88 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); 89 90 // XUpdatable 91 virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); 92 93 // XUIElement 94 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException); 95 virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException); 96 virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException); 97 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException) = 0; 98 99 //------------------------------------------------------------------------------------------------------------- 100 // protected methods 101 //------------------------------------------------------------------------------------------------------------- 102 protected: 103 104 // OPropertySetHelper 105 virtual sal_Bool SAL_CALL convertFastPropertyValue ( com::sun::star::uno::Any& aConvertedValue , 106 com::sun::star::uno::Any& aOldValue , 107 sal_Int32 nHandle , 108 const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ); 109 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , 110 const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ); 111 using cppu::OPropertySetHelper::getFastPropertyValue; 112 virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue , 113 sal_Int32 nHandle ) const; 114 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 115 virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException); 116 117 static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); 118 119 ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener 120 rtl::OUString m_aResourceURL; 121 com::sun::star::uno::WeakReference< com::sun::star::frame::XFrame > m_xWeakFrame; 122 sal_Int16 m_nType; 123 sal_Bool m_bInitialized : 1, 124 m_bDisposed; 125 }; 126 127 } // namespace framework 128 129 #endif // __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_ 130