Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef FRAMEWORK_TABWINDOW_HXX
20 : #define FRAMEWORK_TABWINDOW_HXX
21 :
22 : #include <general.h>
23 :
24 : #include <vector>
25 :
26 : #include <com/sun/star/uno/Reference.h>
27 : #include <vcl/tabctrl.hxx>
28 : #include <vcl/tabdlg.hxx>
29 : #include <vcl/tabpage.hxx>
30 : #include <vcl/button.hxx>
31 :
32 : namespace com { namespace sun { namespace star {
33 : namespace awt {
34 : class XWindow;
35 : class XContainerWindowProvider;
36 : class XContainerWindowEventHandler; }
37 : namespace beans {
38 : struct NamedValue; }
39 : } } }
40 :
41 : namespace framework
42 : {
43 :
44 0 : class FwkTabControl : public TabControl
45 : {
46 : public:
47 : FwkTabControl( Window* pParent, const ResId& rResId );
48 :
49 : void BroadcastEvent( sal_uLong nEvent );
50 : };
51 :
52 : class FwkTabPage : public TabPage
53 : {
54 : private:
55 : rtl::OUString m_sPageURL;
56 : rtl::OUString m_sEventHdl;
57 : css::uno::Reference< css::awt::XWindow > m_xPage;
58 : css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl;
59 : css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider;
60 :
61 : void CreateDialog();
62 : sal_Bool CallMethod( const rtl::OUString& rMethod );
63 :
64 : public:
65 : FwkTabPage(
66 : Window* pParent,
67 : const rtl::OUString& rPageURL,
68 : const css::uno::Reference< css::awt::XContainerWindowEventHandler >& rEventHdl,
69 : const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider );
70 :
71 : virtual ~FwkTabPage();
72 :
73 : virtual void ActivatePage();
74 : virtual void DeactivatePage();
75 : virtual void Resize();
76 : };
77 :
78 : struct TabEntry
79 : {
80 : sal_Int32 m_nIndex;
81 : FwkTabPage* m_pPage;
82 : ::rtl::OUString m_sPageURL;
83 : css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl;
84 :
85 : TabEntry() :
86 : m_nIndex( -1 ), m_pPage( NULL ) {}
87 :
88 0 : TabEntry( sal_Int32 nIndex, ::rtl::OUString sURL, const css::uno::Reference< css::awt::XContainerWindowEventHandler > & rEventHdl ) :
89 0 : m_nIndex( nIndex ), m_pPage( NULL ), m_sPageURL( sURL ), m_xEventHdl( rEventHdl ) {}
90 :
91 0 : ~TabEntry() { delete m_pPage; }
92 : };
93 :
94 : typedef std::vector< TabEntry* > TabEntryList;
95 :
96 : class FwkTabWindow : public Window
97 : {
98 : private:
99 : FwkTabControl m_aTabCtrl;
100 : TabEntryList m_TabList;
101 :
102 : css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider;
103 :
104 : void ClearEntryList();
105 : TabEntry* FindEntry( sal_Int32 nIndex ) const;
106 : bool RemoveEntry( sal_Int32 nIndex );
107 :
108 : DECL_DLLPRIVATE_LINK(ActivatePageHdl, void *);
109 : DECL_DLLPRIVATE_LINK(DeactivatePageHdl, void *);
110 :
111 : public:
112 : FwkTabWindow( Window* pParent );
113 : ~FwkTabWindow();
114 :
115 : void AddEventListener( const Link& rEventListener );
116 : void RemoveEventListener( const Link& rEventListener );
117 : FwkTabPage* AddTabPage( sal_Int32 nIndex, const css::uno::Sequence< css::beans::NamedValue >& rProperties );
118 : void ActivatePage( sal_Int32 nIndex );
119 : void RemovePage( sal_Int32 nIndex );
120 : virtual void Resize();
121 : };
122 :
123 : } // namespace framework
124 :
125 : #endif
126 :
127 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|