1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include <com/sun/star/awt/XControlContainer.hpp>
#include <com/sun/star/awt/XUnoControlContainer.hpp>
#include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/container/XIdentifierContainer.hpp>
#include <toolkit/controls/unocontrolbase.hxx>
#include <cppuhelper/implbase4.hxx>
#include <memory>
class UnoControlHolderList;
typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase
, css::awt::XUnoControlContainer
, css::awt::XControlContainer
, css::container::XContainer
, css::container::XIdentifierContainer
> UnoControlContainer_Base;
class UnoControlContainer : public UnoControlContainer_Base
{
private:
std::unique_ptr<UnoControlHolderList> mpControls;
css::uno::Sequence< css::uno::Reference< css::awt::XTabController > > maTabControllers;
ContainerListenerMultiplexer maCListeners;
protected:
void ImplActivateTabControllers();
public:
UnoControlContainer();
UnoControlContainer( const css::uno::Reference< css::awt::XWindowPeer >& xPeer );
virtual ~UnoControlContainer() override;
// css::lang::XComponent
void SAL_CALL dispose() override;
// css::lang::XEventListener
void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
// css::container::XContainer
void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
// css::container::XIdentifierContainer
virtual ::sal_Int32 SAL_CALL insert( const css::uno::Any& aElement ) override;
// css::container::XIdentifierReplace
virtual void SAL_CALL removeByIdentifier( ::sal_Int32 Identifier ) override;
virtual void SAL_CALL replaceByIdentifer( ::sal_Int32 Identifier, const css::uno::Any& aElement ) override;
// css::container::XIdentifierAccess
virtual css::uno::Any SAL_CALL getByIdentifier( ::sal_Int32 Identifierr ) override;
virtual css::uno::Sequence< ::sal_Int32 > SAL_CALL getIdentifiers( ) override;
// css::container::XElementAccess
virtual css::uno::Type SAL_CALL getElementType( ) override;
virtual sal_Bool SAL_CALL hasElements( ) override;
// css::awt::XControlContainer
void SAL_CALL setStatusText( const OUString& StatusText ) override;
css::uno::Sequence< css::uno::Reference< css::awt::XControl > > SAL_CALL getControls( ) override;
css::uno::Reference< css::awt::XControl > SAL_CALL getControl( const OUString& aName ) override;
void SAL_CALL addControl( const OUString& Name, const css::uno::Reference< css::awt::XControl >& Control ) override;
void SAL_CALL removeControl( const css::uno::Reference< css::awt::XControl >& Control ) override;
// css::awt::XUnoControlContainer
void SAL_CALL setTabControllers( const css::uno::Sequence< css::uno::Reference< css::awt::XTabController > >& TabControllers ) override;
css::uno::Sequence< css::uno::Reference< css::awt::XTabController > > SAL_CALL getTabControllers( ) override;
void SAL_CALL addTabController( const css::uno::Reference< css::awt::XTabController >& TabController ) override;
void SAL_CALL removeTabController( const css::uno::Reference< css::awt::XTabController >& TabController ) override;
// css::awt::XControl
void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override;
// css::awt::XWindow
void SAL_CALL setVisible( sal_Bool Visible ) override;
OUString SAL_CALL getImplementationName() override;
css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
protected:
virtual void PrepareWindowDescriptor( css::awt::WindowDescriptor& rDesc ) override;
virtual void removingControl( const css::uno::Reference< css::awt::XControl >& _rxControl );
virtual void addingControl( const css::uno::Reference< css::awt::XControl >& _rxControl );
/** ensures that the given control has a peer, if necessary and possible
@param _rxControl
an ->XControl which has just been inserted into the container. Must not be <NULL/>.
@precond
our mutex is locked
*/
virtual void impl_createControlPeerIfNecessary(
const css::uno::Reference< css::awt::XControl >& _rxControl
);
private:
/** adds the control to the container, does necessary notifications, and the like
@param _rxControl
the control to add. Must not be <NULL/>
@param _pName
Pointer to a name for the control. Might be <NULL/>, in this case an automatic name is generated
@return
the ID of the newly added control
*/
sal_Int32 impl_addControl(
const css::uno::Reference< css::awt::XControl >& _rxControl,
const OUString* _pName = nullptr
);
/** removes the given control from the container, including necessary notifications and the like
@param _nId
the ID of the control to remove
@param _rxControl
the control itself. Must be the one which is stored under the given ID. This parameter could also be
obtained inside the method, but callers usually have obtained it, anyway.
*/
void impl_removeControl(
sal_Int32 _nId,
const css::uno::Reference< css::awt::XControl >& _rxControl
);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|