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 #ifndef FRAMEWORK_TABWINDOW_HXX 28 #define FRAMEWORK_TABWINDOW_HXX 29 30 #include <general.h> 31 32 #include <vector> 33 34 #include <com/sun/star/uno/Reference.h> 35 #include <vcl/tabctrl.hxx> 36 #include <vcl/tabdlg.hxx> 37 #include <vcl/tabpage.hxx> 38 #include <vcl/button.hxx> 39 40 namespace com { namespace sun { namespace star { 41 namespace awt { 42 class XWindow; 43 class XContainerWindowProvider; 44 class XContainerWindowEventHandler; } 45 namespace beans { 46 struct NamedValue; } 47 } } } 48 49 namespace framework 50 { 51 52 class FwkTabControl : public TabControl 53 { 54 public: 55 FwkTabControl( Window* pParent, const ResId& rResId ); 56 57 void BroadcastEvent( sal_uLong nEvent ); 58 }; 59 60 class FwkTabPage : public TabPage 61 { 62 private: 63 rtl::OUString m_sPageURL; 64 rtl::OUString m_sEventHdl; 65 css::uno::Reference< css::awt::XWindow > m_xPage; 66 css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl; 67 css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider; 68 69 void CreateDialog(); 70 sal_Bool CallMethod( const rtl::OUString& rMethod ); 71 72 public: 73 FwkTabPage( 74 Window* pParent, 75 const rtl::OUString& rPageURL, 76 const css::uno::Reference< css::awt::XContainerWindowEventHandler >& rEventHdl, 77 const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider ); 78 79 virtual ~FwkTabPage(); 80 81 virtual void ActivatePage(); 82 virtual void DeactivatePage(); 83 virtual void Resize(); 84 }; 85 86 struct TabEntry 87 { 88 sal_Int32 m_nIndex; 89 FwkTabPage* m_pPage; 90 ::rtl::OUString m_sPageURL; 91 css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl; 92 93 TabEntry() : 94 m_nIndex( -1 ), m_pPage( NULL ) {} 95 96 TabEntry( sal_Int32 nIndex, ::rtl::OUString sURL, const css::uno::Reference< css::awt::XContainerWindowEventHandler > & rEventHdl ) : 97 m_nIndex( nIndex ), m_pPage( NULL ), m_sPageURL( sURL ), m_xEventHdl( rEventHdl ) {} 98 99 ~TabEntry() { delete m_pPage; } 100 }; 101 102 typedef std::vector< TabEntry* > TabEntryList; 103 104 class FwkTabWindow : public Window 105 { 106 private: 107 FwkTabControl m_aTabCtrl; 108 TabEntryList m_TabList; 109 110 css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider; 111 112 void ClearEntryList(); 113 TabEntry* FindEntry( sal_Int32 nIndex ) const; 114 bool RemoveEntry( sal_Int32 nIndex ); 115 116 DECL_DLLPRIVATE_LINK( ActivatePageHdl, TabControl * ); 117 DECL_DLLPRIVATE_LINK( DeactivatePageHdl, TabControl * ); 118 DECL_DLLPRIVATE_LINK( CloseHdl, PushButton * ); 119 120 public: 121 FwkTabWindow( Window* pParent ); 122 ~FwkTabWindow(); 123 124 void AddEventListener( const Link& rEventListener ); 125 void RemoveEventListener( const Link& rEventListener ); 126 FwkTabPage* AddTabPage( sal_Int32 nIndex, const css::uno::Sequence< css::beans::NamedValue >& rProperties ); 127 void ActivatePage( sal_Int32 nIndex ); 128 void RemovePage( sal_Int32 nIndex ); 129 virtual void Resize(); 130 }; 131 132 } // namespace framework 133 134 #endif 135 136