merge the formfield patch from ooo-build
[ooovba.git] / framework / inc / classes / fwktabwindow.hxx
blobe9d7f0bd4b89fef9df2ab96fd9a04c4ac35df778
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();
89 struct TabEntry
91 sal_Int32 m_nIndex;
92 FwkTabPage* m_pPage;
93 ::rtl::OUString m_sPageURL;
94 css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl;
96 TabEntry() :
97 m_nIndex( -1 ), m_pPage( NULL ) {}
99 TabEntry( sal_Int32 nIndex, ::rtl::OUString sURL, const css::uno::Reference< css::awt::XContainerWindowEventHandler > & rEventHdl ) :
100 m_nIndex( nIndex ), m_pPage( NULL ), m_sPageURL( sURL ), m_xEventHdl( rEventHdl ) {}
102 ~TabEntry() { delete m_pPage; }
105 typedef std::vector< TabEntry* > TabEntryList;
107 class FwkTabWindow : public Window
109 private:
110 FwkTabControl m_aTabCtrl;
111 TabEntryList m_TabList;
113 css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider;
115 void ClearEntryList();
116 TabEntry* FindEntry( sal_Int32 nIndex ) const;
117 bool RemoveEntry( sal_Int32 nIndex );
119 DECL_DLLPRIVATE_LINK( ActivatePageHdl, TabControl * );
120 DECL_DLLPRIVATE_LINK( DeactivatePageHdl, TabControl * );
121 DECL_DLLPRIVATE_LINK( CloseHdl, PushButton * );
123 public:
124 FwkTabWindow( Window* pParent );
125 ~FwkTabWindow();
127 void AddEventListener( const Link& rEventListener );
128 FwkTabPage* AddTabPage( sal_Int32 nIndex, const css::uno::Sequence< css::beans::NamedValue >& rProperties );
129 void ActivatePage( sal_Int32 nIndex );
130 void RemovePage( sal_Int32 nIndex );
131 virtual void Resize();
134 } // namespace framework
136 #endif