Version 24.2.2.2, tag libreoffice-24.2.2.2
[LibreOffice.git] / toolkit / inc / controls / tabpagecontainer.hxx
blobf9fe2df02d50fc22bc60ed9c2074b254cf1df3cb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <com/sun/star/awt/tab/XTabPageContainer.hpp>
23 #include <com/sun/star/awt/tab/XTabPageContainerModel.hpp>
24 #include <toolkit/controls/unocontrolbase.hxx>
25 #include <toolkit/controls/unocontrolmodel.hxx>
26 #include <cppuhelper/implbase1.hxx>
27 #include <controls/controlmodelcontainerbase.hxx>
28 #include <toolkit/helper/listenermultiplexer.hxx>
31 namespace com::sun::star::awt::tab { class XTabPage; }
32 namespace com::sun::star::awt::tab { class XTabPageContainerListener; }
33 namespace com::sun::star::awt::tab { class XTabPageModel; }
36 typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel
37 , css::awt::tab::XTabPageContainerModel
38 > UnoControlTabPageContainerModel_Base;
39 class UnoControlTabPageContainerModel final : public UnoControlTabPageContainerModel_Base
41 private:
42 std::vector< css::uno::Reference< css::awt::tab::XTabPageModel > > m_aTabPageVector;
43 ContainerListenerMultiplexer maContainerListeners;
45 css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override;
46 ::cppu::IPropertyArrayHelper& getInfoHelper() override;
47 // css::beans::XMultiPropertySet
48 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
50 public:
51 UnoControlTabPageContainerModel( const css::uno::Reference< css::uno::XComponentContext >& i_factory );
52 UnoControlTabPageContainerModel( const UnoControlTabPageContainerModel& rModel ) : UnoControlTabPageContainerModel_Base( rModel ),maContainerListeners( *this ) {}
54 rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlTabPageContainerModel( *this ); }
56 // css::io::XPersistObject
57 OUString SAL_CALL getServiceName() override;
59 // css::lang::XServiceInfo
60 DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainerModel, UnoControlModel, "com.sun.star.awt.tab.UnoControlTabPageContainerModel" )
62 // XTabPageContainerModel
63 virtual css::uno::Reference< css::awt::tab::XTabPageModel > SAL_CALL createTabPage( ::sal_Int16 TabPageID ) override;
64 virtual css::uno::Reference< css::awt::tab::XTabPageModel > SAL_CALL loadTabPage( ::sal_Int16 TabPageID, const OUString& ResourceURL ) override;
66 // XIndexContainer
67 virtual void SAL_CALL insertByIndex( sal_Int32 Index, const css::uno::Any& Element ) override;
68 virtual void SAL_CALL removeByIndex( sal_Int32 Index ) override;
70 // XIndexReplace
71 virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const css::uno::Any& Element ) override;
73 // XIndexAccess
74 virtual sal_Int32 SAL_CALL getCount() override;
76 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
78 // XElementAccess
79 virtual css::uno::Type SAL_CALL getElementType() override;
80 virtual sal_Bool SAL_CALL hasElements() override;
82 // css::container::XContainer
83 void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
84 void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
87 // = UnoControlTabPageContainer
89 typedef ::cppu::AggImplInheritanceHelper1 < ControlContainerBase
90 , css::awt::tab::XTabPageContainer
91 > UnoControlTabPageContainer_Base;
92 class UnoControlTabPageContainer final : public UnoControlTabPageContainer_Base
94 public:
95 UnoControlTabPageContainer( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
96 OUString GetComponentServiceName() const override;
98 // css::lang::XComponent
99 void SAL_CALL dispose( ) override;
101 // css::awt::XControl
102 void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
104 // css::awt::tab::XTabPageContainer
105 virtual ::sal_Int16 SAL_CALL getActiveTabPageID() override;
106 virtual void SAL_CALL setActiveTabPageID( ::sal_Int16 _activetabpageid ) override;
107 virtual ::sal_Int16 SAL_CALL getTabPageCount( ) override;
108 virtual sal_Bool SAL_CALL isTabPageActive( ::sal_Int16 tabPageIndex ) override;
109 virtual css::uno::Reference< css::awt::tab::XTabPage > SAL_CALL getTabPage( ::sal_Int16 tabPageIndex ) override;
110 virtual css::uno::Reference< css::awt::tab::XTabPage > SAL_CALL getTabPageByID( ::sal_Int16 tabPageID ) override;
111 virtual void SAL_CALL addTabPageContainerListener( const css::uno::Reference< css::awt::tab::XTabPageContainerListener >& listener ) override;
112 virtual void SAL_CALL removeTabPageContainerListener( const css::uno::Reference< css::awt::tab::XTabPageContainerListener >& listener ) override;
114 // css::beans::XPropertiesChangeListener
115 virtual void SAL_CALL propertiesChange( const ::css::uno::Sequence< ::css::beans::PropertyChangeEvent >& aEvent ) override;
117 virtual void SAL_CALL addControl( const OUString& Name, const css::uno::Reference< css::awt::XControl >& Control ) override;
118 // css::lang::XServiceInfo
119 DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainer, UnoControlBase, "com.sun.star.awt.tab.UnoControlTabPageContainer" )
121 // using UnoControl::getPeer;
122 private:
123 virtual void updateFromModel() override;
124 TabPageListenerMultiplexer m_aTabPageListeners;
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */