1*f8e07b45SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f8e07b45SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f8e07b45SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f8e07b45SAndrew Rist * distributed with this work for additional information 6*f8e07b45SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f8e07b45SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f8e07b45SAndrew Rist * "License"); you may not use this file except in compliance 9*f8e07b45SAndrew Rist * with the License. You may obtain a copy of the License at 10*f8e07b45SAndrew Rist * 11*f8e07b45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f8e07b45SAndrew Rist * 13*f8e07b45SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f8e07b45SAndrew Rist * software distributed under the License is distributed on an 15*f8e07b45SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f8e07b45SAndrew Rist * KIND, either express or implied. See the License for the 17*f8e07b45SAndrew Rist * specific language governing permissions and limitations 18*f8e07b45SAndrew Rist * under the License. 19*f8e07b45SAndrew Rist * 20*f8e07b45SAndrew Rist *************************************************************/ 21*f8e07b45SAndrew Rist 22*f8e07b45SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef __FRAMEWORK_TABWIN_TABWINDOW_HXX_ 25cdf0e10cSrcweir #define __FRAMEWORK_TABWIN_TABWINDOW_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 28cdf0e10cSrcweir // my own includes 29cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <stdtypes.h> 32cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx> 33cdf0e10cSrcweir #include <macros/generic.hxx> 34cdf0e10cSrcweir #include <macros/xinterface.hxx> 35cdf0e10cSrcweir #include <macros/xtypeprovider.hxx> 36cdf0e10cSrcweir #include <macros/xserviceinfo.hxx> 37cdf0e10cSrcweir #include <services.h> 38cdf0e10cSrcweir 39cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 40cdf0e10cSrcweir // interface includes 41cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 42cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 43cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp> 44cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 45cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 46cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 47cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XWINDOW_HPP_ 48cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp> 49cdf0e10cSrcweir #endif 50cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XTOPWINDOW_HPP_ 51cdf0e10cSrcweir #include <com/sun/star/awt/XTopWindow.hpp> 52cdf0e10cSrcweir #endif 53cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 54cdf0e10cSrcweir #include <com/sun/star/awt/XSimpleTabController.hpp> 55cdf0e10cSrcweir #include <com/sun/star/awt/XTabListener.hpp> 56cdf0e10cSrcweir 57cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 58cdf0e10cSrcweir // includes of other projects 59cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 60cdf0e10cSrcweir #include <cppuhelper/propshlp.hxx> 61cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> 62cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 63cdf0e10cSrcweir #include <rtl/ustring.hxx> 64cdf0e10cSrcweir #include <vcl/tabctrl.hxx> 65cdf0e10cSrcweir 66cdf0e10cSrcweir namespace framework 67cdf0e10cSrcweir { 68cdf0e10cSrcweir 69cdf0e10cSrcweir class TabWindow : public ::com::sun::star::lang::XTypeProvider , 70cdf0e10cSrcweir public ::com::sun::star::lang::XServiceInfo , 71cdf0e10cSrcweir public ::com::sun::star::lang::XInitialization , 72cdf0e10cSrcweir public ::com::sun::star::lang::XComponent , 73cdf0e10cSrcweir public ::com::sun::star::awt::XWindowListener , 74cdf0e10cSrcweir public ::com::sun::star::awt::XTopWindowListener , 75cdf0e10cSrcweir public ::com::sun::star::awt::XSimpleTabController , 76cdf0e10cSrcweir protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. 77cdf0e10cSrcweir public ::cppu::OBroadcastHelper , 78cdf0e10cSrcweir public ::cppu::OPropertySetHelper , // => XPropertySet / XFastPropertySet / XMultiPropertySet 79cdf0e10cSrcweir public ::cppu::OWeakObject 80cdf0e10cSrcweir { 81cdf0e10cSrcweir public: 82cdf0e10cSrcweir TabWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); 83cdf0e10cSrcweir virtual ~TabWindow(); 84cdf0e10cSrcweir 85cdf0e10cSrcweir // XInterface, XTypeProvider, XServiceInfo 86cdf0e10cSrcweir FWK_DECLARE_XINTERFACE 87cdf0e10cSrcweir DECLARE_XSERVICEINFO 88cdf0e10cSrcweir FWK_DECLARE_XTYPEPROVIDER 89cdf0e10cSrcweir 90cdf0e10cSrcweir using ::cppu::OPropertySetHelper::disposing; 91cdf0e10cSrcweir using ::cppu::OPropertySetHelper::getFastPropertyValue; 92cdf0e10cSrcweir 93cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 94cdf0e10cSrcweir // XInitialization 95cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 96cdf0e10cSrcweir 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); 97cdf0e10cSrcweir 98cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 99cdf0e10cSrcweir // XComponent 100cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 101cdf0e10cSrcweir virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); 102cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 103cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 104cdf0e10cSrcweir 105cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 106cdf0e10cSrcweir // XSimpleTabController 107cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 108cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException); 109cdf0e10cSrcweir virtual void SAL_CALL removeTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 110cdf0e10cSrcweir virtual void SAL_CALL setTabProps( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 111cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > SAL_CALL getTabProps( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 112cdf0e10cSrcweir virtual void SAL_CALL activateTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 113cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getActiveTabID( ) throw (::com::sun::star::uno::RuntimeException); 114cdf0e10cSrcweir virtual void SAL_CALL addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); 115cdf0e10cSrcweir virtual void SAL_CALL removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); 116cdf0e10cSrcweir 117cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 118cdf0e10cSrcweir // XEventListener 119cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 120cdf0e10cSrcweir virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); 121cdf0e10cSrcweir 122cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 123cdf0e10cSrcweir // XTopWindowListener 124cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 125cdf0e10cSrcweir virtual void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); 126cdf0e10cSrcweir virtual void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); 127cdf0e10cSrcweir virtual void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); 128cdf0e10cSrcweir virtual void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); 129cdf0e10cSrcweir virtual void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); 130cdf0e10cSrcweir virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); 131cdf0e10cSrcweir virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); 132cdf0e10cSrcweir 133cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 134cdf0e10cSrcweir // XWindowListener 135cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 136cdf0e10cSrcweir virtual void SAL_CALL windowResized( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException ); 137cdf0e10cSrcweir virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException ); 138cdf0e10cSrcweir virtual void SAL_CALL windowShown( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); 139cdf0e10cSrcweir virtual void SAL_CALL windowHidden( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); 140cdf0e10cSrcweir 141cdf0e10cSrcweir protected: 142cdf0e10cSrcweir DECL_LINK( Activate, TabControl* ); 143cdf0e10cSrcweir DECL_LINK( Deactivate, TabControl* ); 144cdf0e10cSrcweir 145cdf0e10cSrcweir private: 146cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 147cdf0e10cSrcweir // OPropertySetHelper 148cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 149cdf0e10cSrcweir virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& aConvertedValue , 150cdf0e10cSrcweir com::sun::star::uno::Any& aOldValue , 151cdf0e10cSrcweir sal_Int32 nHandle , 152cdf0e10cSrcweir const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ); 153cdf0e10cSrcweir virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , 154cdf0e10cSrcweir const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ); 155cdf0e10cSrcweir virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue , 156cdf0e10cSrcweir sal_Int32 nHandle ) const; 157cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 158cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException); 159cdf0e10cSrcweir 160cdf0e10cSrcweir static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); 161cdf0e10cSrcweir 162cdf0e10cSrcweir private: 163cdf0e10cSrcweir enum Notification 164cdf0e10cSrcweir { 165cdf0e10cSrcweir NOTIFY_INSERTED, 166cdf0e10cSrcweir NOTIFY_REMOVED, 167cdf0e10cSrcweir NOTIFY_CHANGED, 168cdf0e10cSrcweir NOTIFY_ACTIVATED, 169cdf0e10cSrcweir NOTIFY_DEACTIVATED 170cdf0e10cSrcweir }; 171cdf0e10cSrcweir 172cdf0e10cSrcweir sal_Int32 impl_GetPageIdFromIndex( ::sal_Int32 nIndex ) const; 173cdf0e10cSrcweir sal_Bool impl_CheckIndex( ::sal_Int32 nIndex ) const; 174cdf0e10cSrcweir void implts_LayoutWindows() const; 175cdf0e10cSrcweir void impl_SetTitle( const ::rtl::OUString& rTitle ); 176cdf0e10cSrcweir TabControl* impl_GetTabControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& xTabControlWindow ) const; 177cdf0e10cSrcweir void implts_SendNotification( Notification eNotify, sal_Int32 ID ) const; 178cdf0e10cSrcweir void implts_SendNotification( Notification eNotify, sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rSeq ) const; 179cdf0e10cSrcweir 180cdf0e10cSrcweir typedef std::vector< sal_uInt16 > PageIdVector; 181cdf0e10cSrcweir 182cdf0e10cSrcweir sal_Bool m_bInitialized : 1, 183cdf0e10cSrcweir m_bDisposed : 1; 184cdf0e10cSrcweir sal_Int32 m_nNextTabID; 185cdf0e10cSrcweir ::rtl::OUString m_aTitlePropName; 186cdf0e10cSrcweir ::rtl::OUString m_aPosPropName; 187cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; 188cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow > m_xTopWindow; 189cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xContainerWindow; 190cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xTabControlWindow; 191cdf0e10cSrcweir ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener 192cdf0e10cSrcweir }; 193cdf0e10cSrcweir 194cdf0e10cSrcweir } 195cdf0e10cSrcweir 196cdf0e10cSrcweir #endif // __FRAMEWORK_TABWIN_TABWINDOW_HXX_ 197