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 LAYOUT_AWT_VCLXTABCONTROLLER_HXX 29*cdf0e10cSrcweir #define LAYOUT_AWT_VCLXTABCONTROLLER_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <com/sun/star/awt/XSimpleTabController.hpp> 32*cdf0e10cSrcweir #include <comphelper/uno3.hxx> 33*cdf0e10cSrcweir #include <layout/core/box-base.hxx> 34*cdf0e10cSrcweir #include <map> 35*cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx> 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir class TabControl; 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir namespace layoutimpl 40*cdf0e10cSrcweir { 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XSimpleTabController 43*cdf0e10cSrcweir > VCLXTabControl_Base; 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir class VCLXTabControl :public VCLXWindow 46*cdf0e10cSrcweir ,public VCLXTabControl_Base 47*cdf0e10cSrcweir ,public Box_Base 48*cdf0e10cSrcweir { 49*cdf0e10cSrcweir int mTabId; 50*cdf0e10cSrcweir bool bRealized; 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir public: 53*cdf0e10cSrcweir VCLXTabControl(); 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir void AddChild (css::uno::Reference <css::awt::XLayoutConstrains> const &); 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir protected: 58*cdf0e10cSrcweir ~VCLXTabControl(); 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir // XInterface 61*cdf0e10cSrcweir DECLARE_XINTERFACE() 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir // XTypeProvider 64*cdf0e10cSrcweir DECLARE_XTYPEPROVIDER() 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir // XComponent 67*cdf0e10cSrcweir void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir virtual void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw (::com::sun::star::uno::RuntimeException); 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir // XSimpleTabController 72*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException); 73*cdf0e10cSrcweir virtual void SAL_CALL removeTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 74*cdf0e10cSrcweir 75*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); 76*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); 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir virtual void SAL_CALL activateTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 79*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getActiveTabID() throw (::com::sun::star::uno::RuntimeException); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir virtual void SAL_CALL addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); 82*cdf0e10cSrcweir virtual void SAL_CALL removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir // ::com::sun::star::awt::XLayoutContainer 85*cdf0e10cSrcweir virtual void SAL_CALL addChild( 86*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains >& Child ) 87*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::awt::MaxChildrenException); 88*cdf0e10cSrcweir virtual void SAL_CALL removeChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains >& Child ) 89*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir virtual void SAL_CALL allocateArea( const ::com::sun::star::awt::Rectangle &rArea ) 92*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize() 95*cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir // unimplemented: 98*cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasHeightForWidth() 99*cdf0e10cSrcweir throw(css::uno::RuntimeException) 100*cdf0e10cSrcweir { return false; } 101*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 /*nWidth*/ ) 102*cdf0e10cSrcweir throw(css::uno::RuntimeException) 103*cdf0e10cSrcweir { return maRequisition.Height; } 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir // VclWindowPeer 106*cdf0e10cSrcweir virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); 107*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir // VCLXWindow 110*cdf0e10cSrcweir void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir public: 113*cdf0e10cSrcweir // Maps page ids to child references 114*cdf0e10cSrcweir struct ChildData : public Box_Base::ChildData 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir rtl::OUString maTitle; 117*cdf0e10cSrcweir ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ); 118*cdf0e10cSrcweir }; 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir struct ChildProps : public Box_Base::ChildProps 121*cdf0e10cSrcweir { 122*cdf0e10cSrcweir ChildProps( VCLXTabControl::ChildData *pData ); 123*cdf0e10cSrcweir }; 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir protected: 126*cdf0e10cSrcweir ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ); 127*cdf0e10cSrcweir ChildProps *createChildProps( Box_Base::ChildData* pData ); 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir std::map< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains >, sal_Int32 > mIdMap; 131*cdf0e10cSrcweir // FIXME: we might want to use a Multiplexer 132*cdf0e10cSrcweir std::list< ::com::sun::star::uno::Reference 133*cdf0e10cSrcweir < ::com::sun::star::awt::XTabListener > > mxTabListeners; 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir inline TabControl *getTabControl() const throw (::com::sun::star::uno::RuntimeException); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir private: 138*cdf0e10cSrcweir VCLXTabControl( const VCLXTabControl& ); // never implemented 139*cdf0e10cSrcweir VCLXTabControl& operator=( const VCLXTabControl& ); // never implemented 140*cdf0e10cSrcweir }; 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir } // namespace layoutimpl 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir #endif /* LAYOUT_AWT_VCLXTABCONTROLLER_HXX */ 145