1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_FRAMEWORK_INC_CLASSES_FWKTABWINDOW_HXX
20 #define INCLUDED_FRAMEWORK_INC_CLASSES_FWKTABWINDOW_HXX
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>
32 namespace com
{ namespace sun
{ namespace star
{
35 class XContainerWindowProvider
;
36 class XContainerWindowEventHandler
; }
44 class FwkTabControl
: public TabControl
47 FwkTabControl(vcl::Window
* pParent
);
49 void BroadcastEvent( sal_uLong nEvent
);
52 class FwkTabPage
: public TabPage
56 css::uno::Reference
< css::awt::XWindow
> m_xPage
;
57 css::uno::Reference
< css::awt::XContainerWindowEventHandler
> m_xEventHdl
;
58 css::uno::Reference
< css::awt::XContainerWindowProvider
> m_xWinProvider
;
61 bool CallMethod( const OUString
& rMethod
);
66 const OUString
& rPageURL
,
67 const css::uno::Reference
< css::awt::XContainerWindowEventHandler
>& rEventHdl
,
68 const css::uno::Reference
< css::awt::XContainerWindowProvider
>& rProvider
);
70 virtual ~FwkTabPage();
71 virtual void dispose() SAL_OVERRIDE
;
73 virtual void ActivatePage() SAL_OVERRIDE
;
74 virtual void DeactivatePage() SAL_OVERRIDE
;
75 virtual void Resize() SAL_OVERRIDE
;
81 ScopedVclPtr
<FwkTabPage
> m_pPage
;
83 css::uno::Reference
< css::awt::XContainerWindowEventHandler
> m_xEventHdl
;
86 m_nIndex( -1 ), m_pPage( NULL
) {}
88 TabEntry( sal_Int32 nIndex
, const OUString
& sURL
, const css::uno::Reference
< css::awt::XContainerWindowEventHandler
> & rEventHdl
) :
89 m_nIndex( nIndex
), m_pPage( NULL
), m_sPageURL( sURL
), m_xEventHdl( rEventHdl
) {}
90 ~TabEntry() { m_pPage
.disposeAndClear(); }
93 typedef std::vector
< TabEntry
* > TabEntryList
;
95 class FwkTabWindow
: public vcl::Window
98 VclPtr
<FwkTabControl
> m_aTabCtrl
;
99 TabEntryList m_TabList
;
101 css::uno::Reference
< css::awt::XContainerWindowProvider
> m_xWinProvider
;
103 void ClearEntryList();
104 TabEntry
* FindEntry( sal_Int32 nIndex
) const;
105 bool RemoveEntry( sal_Int32 nIndex
);
107 DECL_DLLPRIVATE_LINK(ActivatePageHdl
, void *);
108 DECL_DLLPRIVATE_LINK_TYPED(DeactivatePageHdl
, TabControl
*, bool);
111 FwkTabWindow( vcl::Window
* pParent
);
112 virtual ~FwkTabWindow();
113 virtual void dispose() SAL_OVERRIDE
;
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() SAL_OVERRIDE
;
123 } // namespace framework
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */