Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef FRAMEWORK_TABWINDOW_HXX
29 : : #define FRAMEWORK_TABWINDOW_HXX
30 : :
31 : : #include <general.h>
32 : :
33 : : #include <vector>
34 : :
35 : : #include <com/sun/star/uno/Reference.h>
36 : : #include <vcl/tabctrl.hxx>
37 : : #include <vcl/tabdlg.hxx>
38 : : #include <vcl/tabpage.hxx>
39 : : #include <vcl/button.hxx>
40 : :
41 : : namespace com { namespace sun { namespace star {
42 : : namespace awt {
43 : : class XWindow;
44 : : class XContainerWindowProvider;
45 : : class XContainerWindowEventHandler; }
46 : : namespace beans {
47 : : struct NamedValue; }
48 : : } } }
49 : :
50 : : namespace framework
51 : : {
52 : :
53 [ # # ]: 0 : class FwkTabControl : public TabControl
54 : : {
55 : : public:
56 : : FwkTabControl( Window* pParent, const ResId& rResId );
57 : :
58 : : void BroadcastEvent( sal_uLong nEvent );
59 : : };
60 : :
61 : : class FwkTabPage : public TabPage
62 : : {
63 : : private:
64 : : rtl::OUString m_sPageURL;
65 : : rtl::OUString m_sEventHdl;
66 : : css::uno::Reference< css::awt::XWindow > m_xPage;
67 : : css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl;
68 : : css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider;
69 : :
70 : : void CreateDialog();
71 : : sal_Bool CallMethod( const rtl::OUString& rMethod );
72 : :
73 : : public:
74 : : FwkTabPage(
75 : : Window* pParent,
76 : : const rtl::OUString& rPageURL,
77 : : const css::uno::Reference< css::awt::XContainerWindowEventHandler >& rEventHdl,
78 : : const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider );
79 : :
80 : : virtual ~FwkTabPage();
81 : :
82 : : virtual void ActivatePage();
83 : : virtual void DeactivatePage();
84 : : virtual void Resize();
85 : : };
86 : :
87 : : struct TabEntry
88 : : {
89 : : sal_Int32 m_nIndex;
90 : : FwkTabPage* m_pPage;
91 : : ::rtl::OUString m_sPageURL;
92 : : css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl;
93 : :
94 : : TabEntry() :
95 : : m_nIndex( -1 ), m_pPage( NULL ) {}
96 : :
97 : 0 : TabEntry( sal_Int32 nIndex, ::rtl::OUString sURL, const css::uno::Reference< css::awt::XContainerWindowEventHandler > & rEventHdl ) :
98 : 0 : m_nIndex( nIndex ), m_pPage( NULL ), m_sPageURL( sURL ), m_xEventHdl( rEventHdl ) {}
99 : :
100 [ # # ][ # # ]: 0 : ~TabEntry() { delete m_pPage; }
101 : : };
102 : :
103 : : typedef std::vector< TabEntry* > TabEntryList;
104 : :
105 : : class FwkTabWindow : public Window
106 : : {
107 : : private:
108 : : FwkTabControl m_aTabCtrl;
109 : : TabEntryList m_TabList;
110 : :
111 : : css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider;
112 : :
113 : : void ClearEntryList();
114 : : TabEntry* FindEntry( sal_Int32 nIndex ) const;
115 : : bool RemoveEntry( sal_Int32 nIndex );
116 : :
117 : : DECL_DLLPRIVATE_LINK(ActivatePageHdl, void *);
118 : : DECL_DLLPRIVATE_LINK(DeactivatePageHdl, void *);
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 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|