1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef __FRAMEWORK_TABWIN_TABWINDOW_HXX_ 29*cdf0e10cSrcweir #define __FRAMEWORK_TABWIN_TABWINDOW_HXX_ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 32*cdf0e10cSrcweir // my own includes 33*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <stdtypes.h> 36*cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx> 37*cdf0e10cSrcweir #include <macros/generic.hxx> 38*cdf0e10cSrcweir #include <macros/xinterface.hxx> 39*cdf0e10cSrcweir #include <macros/xtypeprovider.hxx> 40*cdf0e10cSrcweir #include <macros/xserviceinfo.hxx> 41*cdf0e10cSrcweir #include <services.h> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 44*cdf0e10cSrcweir // interface includes 45*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 46*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp> 48*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 50*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 51*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XWINDOW_HPP_ 52*cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp> 53*cdf0e10cSrcweir #endif 54*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XTOPWINDOW_HPP_ 55*cdf0e10cSrcweir #include <com/sun/star/awt/XTopWindow.hpp> 56*cdf0e10cSrcweir #endif 57*cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 58*cdf0e10cSrcweir #include <com/sun/star/awt/XSimpleTabController.hpp> 59*cdf0e10cSrcweir #include <com/sun/star/awt/XTabListener.hpp> 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 62*cdf0e10cSrcweir // includes of other projects 63*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 64*cdf0e10cSrcweir #include <cppuhelper/propshlp.hxx> 65*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> 66*cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 67*cdf0e10cSrcweir #include <rtl/ustring.hxx> 68*cdf0e10cSrcweir #include <vcl/tabctrl.hxx> 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir namespace framework 71*cdf0e10cSrcweir { 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir class TabWindow : public ::com::sun::star::lang::XTypeProvider , 74*cdf0e10cSrcweir public ::com::sun::star::lang::XServiceInfo , 75*cdf0e10cSrcweir public ::com::sun::star::lang::XInitialization , 76*cdf0e10cSrcweir public ::com::sun::star::lang::XComponent , 77*cdf0e10cSrcweir public ::com::sun::star::awt::XWindowListener , 78*cdf0e10cSrcweir public ::com::sun::star::awt::XTopWindowListener , 79*cdf0e10cSrcweir public ::com::sun::star::awt::XSimpleTabController , 80*cdf0e10cSrcweir protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. 81*cdf0e10cSrcweir public ::cppu::OBroadcastHelper , 82*cdf0e10cSrcweir public ::cppu::OPropertySetHelper , // => XPropertySet / XFastPropertySet / XMultiPropertySet 83*cdf0e10cSrcweir public ::cppu::OWeakObject 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir public: 86*cdf0e10cSrcweir TabWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); 87*cdf0e10cSrcweir virtual ~TabWindow(); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir // XInterface, XTypeProvider, XServiceInfo 90*cdf0e10cSrcweir FWK_DECLARE_XINTERFACE 91*cdf0e10cSrcweir DECLARE_XSERVICEINFO 92*cdf0e10cSrcweir FWK_DECLARE_XTYPEPROVIDER 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir using ::cppu::OPropertySetHelper::disposing; 95*cdf0e10cSrcweir using ::cppu::OPropertySetHelper::getFastPropertyValue; 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 98*cdf0e10cSrcweir // XInitialization 99*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 100*cdf0e10cSrcweir 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); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 103*cdf0e10cSrcweir // XComponent 104*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 105*cdf0e10cSrcweir virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); 106*cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 107*cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 110*cdf0e10cSrcweir // XSimpleTabController 111*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 112*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException); 113*cdf0e10cSrcweir virtual void SAL_CALL removeTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 114*cdf0e10cSrcweir 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); 115*cdf0e10cSrcweir 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); 116*cdf0e10cSrcweir virtual void SAL_CALL activateTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 117*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getActiveTabID( ) throw (::com::sun::star::uno::RuntimeException); 118*cdf0e10cSrcweir virtual void SAL_CALL addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); 119*cdf0e10cSrcweir virtual void SAL_CALL removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 122*cdf0e10cSrcweir // XEventListener 123*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 124*cdf0e10cSrcweir virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 127*cdf0e10cSrcweir // XTopWindowListener 128*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 129*cdf0e10cSrcweir virtual void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); 130*cdf0e10cSrcweir virtual void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); 131*cdf0e10cSrcweir virtual void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); 132*cdf0e10cSrcweir virtual void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); 133*cdf0e10cSrcweir virtual void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); 134*cdf0e10cSrcweir virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); 135*cdf0e10cSrcweir virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 138*cdf0e10cSrcweir // XWindowListener 139*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 140*cdf0e10cSrcweir virtual void SAL_CALL windowResized( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException ); 141*cdf0e10cSrcweir virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException ); 142*cdf0e10cSrcweir virtual void SAL_CALL windowShown( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); 143*cdf0e10cSrcweir virtual void SAL_CALL windowHidden( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir protected: 146*cdf0e10cSrcweir DECL_LINK( Activate, TabControl* ); 147*cdf0e10cSrcweir DECL_LINK( Deactivate, TabControl* ); 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir private: 150*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 151*cdf0e10cSrcweir // OPropertySetHelper 152*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 153*cdf0e10cSrcweir virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& aConvertedValue , 154*cdf0e10cSrcweir com::sun::star::uno::Any& aOldValue , 155*cdf0e10cSrcweir sal_Int32 nHandle , 156*cdf0e10cSrcweir const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ); 157*cdf0e10cSrcweir virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , 158*cdf0e10cSrcweir const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ); 159*cdf0e10cSrcweir virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue , 160*cdf0e10cSrcweir sal_Int32 nHandle ) const; 161*cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 162*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException); 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir private: 167*cdf0e10cSrcweir enum Notification 168*cdf0e10cSrcweir { 169*cdf0e10cSrcweir NOTIFY_INSERTED, 170*cdf0e10cSrcweir NOTIFY_REMOVED, 171*cdf0e10cSrcweir NOTIFY_CHANGED, 172*cdf0e10cSrcweir NOTIFY_ACTIVATED, 173*cdf0e10cSrcweir NOTIFY_DEACTIVATED 174*cdf0e10cSrcweir }; 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir sal_Int32 impl_GetPageIdFromIndex( ::sal_Int32 nIndex ) const; 177*cdf0e10cSrcweir sal_Bool impl_CheckIndex( ::sal_Int32 nIndex ) const; 178*cdf0e10cSrcweir void implts_LayoutWindows() const; 179*cdf0e10cSrcweir void impl_SetTitle( const ::rtl::OUString& rTitle ); 180*cdf0e10cSrcweir TabControl* impl_GetTabControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& xTabControlWindow ) const; 181*cdf0e10cSrcweir void implts_SendNotification( Notification eNotify, sal_Int32 ID ) const; 182*cdf0e10cSrcweir void implts_SendNotification( Notification eNotify, sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rSeq ) const; 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir typedef std::vector< sal_uInt16 > PageIdVector; 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir sal_Bool m_bInitialized : 1, 187*cdf0e10cSrcweir m_bDisposed : 1; 188*cdf0e10cSrcweir sal_Int32 m_nNextTabID; 189*cdf0e10cSrcweir ::rtl::OUString m_aTitlePropName; 190*cdf0e10cSrcweir ::rtl::OUString m_aPosPropName; 191*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; 192*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow > m_xTopWindow; 193*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xContainerWindow; 194*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xTabControlWindow; 195*cdf0e10cSrcweir ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener 196*cdf0e10cSrcweir }; 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir } 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir #endif // __FRAMEWORK_TABWIN_TABWINDOW_HXX_ 201