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