update dev300-m57
[ooovba.git] / framework / inc / classes / fwktabwindow.hxx
blob166c9377ef234178c6b0a0694a07d68636ad3837
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: backingwindow.hxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef FRAMEWORK_TABWINDOW_HXX
31 #define FRAMEWORK_TABWINDOW_HXX
33 #include <general.h>
35 #include <vector>
37 #include <com/sun/star/uno/Reference.h>
38 #include <vcl/tabctrl.hxx>
39 #include <vcl/tabdlg.hxx>
40 #include <vcl/tabpage.hxx>
41 #include <vcl/button.hxx>
43 namespace com { namespace sun { namespace star {
44 namespace awt {
45 class XWindow;
46 class XContainerWindowProvider;
47 class XContainerWindowEventHandler; }
48 namespace beans {
49 struct NamedValue; }
50 } } }
52 namespace framework
55 class FwkTabControl : public TabControl
57 public:
58 FwkTabControl( Window* pParent, const ResId& rResId );
60 void BroadcastEvent( ULONG nEvent );
63 class FwkTabPage : public TabPage
65 private:
66 rtl::OUString m_sPageURL;
67 rtl::OUString m_sEventHdl;
68 css::uno::Reference< css::awt::XWindow > m_xPage;
69 css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl;
70 css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider;
72 void CreateDialog();
73 sal_Bool CallMethod( const rtl::OUString& rMethod );
75 public:
76 FwkTabPage(
77 Window* pParent,
78 const rtl::OUString& rPageURL,
79 const css::uno::Reference< css::awt::XContainerWindowEventHandler >& rEventHdl,
80 const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider );
82 virtual ~FwkTabPage();
84 virtual void ActivatePage();
85 virtual void DeactivatePage();
86 virtual void Resize();
88 void Reset();
89 void Save();
92 struct TabEntry
94 sal_Int32 m_nIndex;
95 FwkTabPage* m_pPage;
96 ::rtl::OUString m_sPageURL;
97 css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl;
99 TabEntry() :
100 m_nIndex( -1 ), m_pPage( NULL ) {}
102 TabEntry( sal_Int32 nIndex, ::rtl::OUString sURL, const css::uno::Reference< css::awt::XContainerWindowEventHandler > & rEventHdl ) :
103 m_nIndex( nIndex ), m_pPage( NULL ), m_sPageURL( sURL ), m_xEventHdl( rEventHdl ) {}
105 ~TabEntry() { delete m_pPage; }
108 typedef std::vector< TabEntry* > TabEntryList;
110 class FwkTabWindow : public Window
112 private:
113 FwkTabControl m_aTabCtrl;
114 TabEntryList m_TabList;
116 css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider;
118 void ClearEntryList();
119 TabEntry* FindEntry( sal_Int32 nIndex ) const;
120 bool RemoveEntry( sal_Int32 nIndex );
122 DECL_DLLPRIVATE_LINK( ActivatePageHdl, TabControl * );
123 DECL_DLLPRIVATE_LINK( DeactivatePageHdl, TabControl * );
124 DECL_DLLPRIVATE_LINK( CloseHdl, PushButton * );
126 public:
127 FwkTabWindow( Window* pParent );
128 ~FwkTabWindow();
130 void AddEventListener( const Link& rEventListener );
131 FwkTabPage* AddTabPage( sal_Int32 nIndex, const css::uno::Sequence< css::beans::NamedValue >& rProperties );
132 void ActivatePage( sal_Int32 nIndex );
133 void RemovePage( sal_Int32 nIndex );
134 sal_Int32 GetActivePageId() const;
135 virtual void Resize();
138 } // namespace framework
140 #endif