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 .
20 #ifndef INCLUDED_TOOLKIT_CONTROLS_TABPAGECONTAINER_HXX
21 #define INCLUDED_TOOLKIT_CONTROLS_TABPAGECONTAINER_HXX
23 #include <com/sun/star/awt/tab/XTabPageContainer.hpp>
24 #include <com/sun/star/awt/tab/XTabPageContainerModel.hpp>
25 #include <toolkit/controls/unocontrolbase.hxx>
26 #include <toolkit/controls/unocontrolmodel.hxx>
27 #include <cppuhelper/implbase1.hxx>
28 #include <toolkit/controls/controlmodelcontainerbase.hxx>
29 #include <toolkit/helper/listenermultiplexer.hxx>
32 namespace com
{ namespace sun
{ namespace star
{ namespace awt
{ namespace tab
{ class XTabPage
; } } } } }
33 namespace com
{ namespace sun
{ namespace star
{ namespace awt
{ namespace tab
{ class XTabPageContainerListener
; } } } } }
34 namespace com
{ namespace sun
{ namespace star
{ namespace awt
{ namespace tab
{ class XTabPageModel
; } } } } }
36 // class css::awt::tab::UnoControlTabPageContainerModel
38 typedef ::cppu::AggImplInheritanceHelper1
< UnoControlModel
39 , css::awt::tab::XTabPageContainerModel
40 > UnoControlTabPageContainerModel_Base
;
41 class UnoControlTabPageContainerModel final
: public UnoControlTabPageContainerModel_Base
44 std::vector
< css::uno::Reference
< css::awt::tab::XTabPageModel
> > m_aTabPageVector
;
45 ContainerListenerMultiplexer maContainerListeners
;
47 css::uno::Any
ImplGetDefaultValue( sal_uInt16 nPropId
) const override
;
48 ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
49 // css::beans::XMultiPropertySet
50 css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
53 UnoControlTabPageContainerModel( const css::uno::Reference
< css::uno::XComponentContext
>& i_factory
);
54 UnoControlTabPageContainerModel( const UnoControlTabPageContainerModel
& rModel
) : UnoControlTabPageContainerModel_Base( rModel
),maContainerListeners( *this ) {}
56 rtl::Reference
<UnoControlModel
> Clone() const override
{ return new UnoControlTabPageContainerModel( *this ); }
58 // css::io::XPersistObject
59 OUString SAL_CALL
getServiceName() override
;
61 // css::lang::XServiceInfo
62 DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainerModel
, UnoControlModel
, "com.sun.star.awt.tab.UnoControlTabPageContainerModel" )
64 // XTabPageContainerModel
65 virtual css::uno::Reference
< css::awt::tab::XTabPageModel
> SAL_CALL
createTabPage( ::sal_Int16 TabPageID
) override
;
66 virtual css::uno::Reference
< css::awt::tab::XTabPageModel
> SAL_CALL
loadTabPage( ::sal_Int16 TabPageID
, const OUString
& ResourceURL
) override
;
69 virtual void SAL_CALL
insertByIndex( sal_Int32 Index
, const css::uno::Any
& Element
) override
;
70 virtual void SAL_CALL
removeByIndex( sal_Int32 Index
) override
;
73 virtual void SAL_CALL
replaceByIndex( sal_Int32 Index
, const css::uno::Any
& Element
) override
;
76 virtual sal_Int32 SAL_CALL
getCount() override
;
78 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
81 virtual css::uno::Type SAL_CALL
getElementType() override
;
82 virtual sal_Bool SAL_CALL
hasElements() override
;
84 // css::container::XContainer
85 void SAL_CALL
addContainerListener( const css::uno::Reference
< css::container::XContainerListener
>& xListener
) override
;
86 void SAL_CALL
removeContainerListener( const css::uno::Reference
< css::container::XContainerListener
>& xListener
) override
;
89 // = UnoControlTabPageContainer
91 typedef ::cppu::AggImplInheritanceHelper1
< ControlContainerBase
92 , css::awt::tab::XTabPageContainer
93 > UnoControlTabPageContainer_Base
;
94 class UnoControlTabPageContainer final
: public UnoControlTabPageContainer_Base
97 UnoControlTabPageContainer( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
98 OUString
GetComponentServiceName() override
;
100 // css::lang::XComponent
101 void SAL_CALL
dispose( ) override
;
103 // css::awt::XControl
104 void SAL_CALL
createPeer( const css::uno::Reference
< css::awt::XToolkit
>& Toolkit
, const css::uno::Reference
< css::awt::XWindowPeer
>& Parent
) override
;
106 // css::awt::tab::XTabPageContainer
107 virtual ::sal_Int16 SAL_CALL
getActiveTabPageID() override
;
108 virtual void SAL_CALL
setActiveTabPageID( ::sal_Int16 _activetabpageid
) override
;
109 virtual ::sal_Int16 SAL_CALL
getTabPageCount( ) override
;
110 virtual sal_Bool SAL_CALL
isTabPageActive( ::sal_Int16 tabPageIndex
) override
;
111 virtual css::uno::Reference
< css::awt::tab::XTabPage
> SAL_CALL
getTabPage( ::sal_Int16 tabPageIndex
) override
;
112 virtual css::uno::Reference
< css::awt::tab::XTabPage
> SAL_CALL
getTabPageByID( ::sal_Int16 tabPageID
) override
;
113 virtual void SAL_CALL
addTabPageContainerListener( const css::uno::Reference
< css::awt::tab::XTabPageContainerListener
>& listener
) override
;
114 virtual void SAL_CALL
removeTabPageContainerListener( const css::uno::Reference
< css::awt::tab::XTabPageContainerListener
>& listener
) override
;
116 virtual void SAL_CALL
addControl( const OUString
& Name
, const css::uno::Reference
< css::awt::XControl
>& Control
) override
;
117 // css::lang::XServiceInfo
118 DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainer
, UnoControlBase
, "com.sun.star.awt.tab.UnoControlTabPageContainer" )
120 // using UnoControl::getPeer;
122 virtual void updateFromModel() override
;
123 TabPageListenerMultiplexer m_aTabPageListeners
;
126 #endif // _ INCLUDED_TOOLKIT_CONTROLS_TABPAGECONTAINER_HXX
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */