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 .
22 #include <AppElementType.hxx>
24 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
25 #include <com/sun/star/lang/XComponent.hpp>
27 #include <comphelper/sharedmutex.hxx>
28 #include <cppuhelper/implbase.hxx>
35 struct SubComponentManager_Data
;
36 class OApplicationController
;
38 // SubComponentManager
39 typedef ::cppu::WeakImplHelper
< css::beans::XPropertyChangeListener
40 > SubComponentManager_Base
;
41 class SubComponentManager
: public SubComponentManager_Base
44 SubComponentManager( OApplicationController
& _rController
, const ::comphelper::SharedMutex
& _rMutex
);
45 virtual ~SubComponentManager() override
;
49 // XPropertyChangeListener
50 virtual void SAL_CALL
propertyChange( const css::beans::PropertyChangeEvent
& evt
) override
;
53 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
55 // XDatabaseDocumentUI helpers
56 css::uno::Sequence
< css::uno::Reference
< css::lang::XComponent
> >
57 getSubComponents() const;
58 bool closeSubComponents();
61 void onSubComponentOpened(
62 const OUString
& _rName
,
63 const sal_Int32 _nComponentType
,
64 const ElementOpenMode _eOpenMode
,
65 const css::uno::Reference
< css::lang::XComponent
>&
70 /** activates (i.e. brings to top) the frame in which the given component is loaded, if any
73 <TRUE/> if any only of such a frame was found, i.e. the component had already been loaded
76 bool activateSubFrame(
77 const OUString
& _rName
,
78 const sal_Int32 _nComponentType
,
79 const ElementOpenMode _eOpenMode
,
80 css::uno::Reference
< css::lang::XComponent
>& o_rComponent
83 /** closes all frames of the given component
85 If a view for the component (given by name and type) has been loaded into one or more
86 frames (with potentially different OpenModes), then those frames are gracefully closed.
89 <TRUE/> if and only if closing those frames was successful, or frames for the given sub component
93 std::u16string_view _rName
,
94 const sal_Int32 _nComponentType
97 /** searches for the given sub component
100 the sub component to look up
102 contains, upon successful return, the name of the sub component
103 @param o_nComponentType
104 contains, upon successful return, the type of the sub component
106 <TRUE/> if and only if the component was found
108 bool lookupSubComponent(
109 const css::uno::Reference
< css::lang::XComponent
>& i_rComponent
,
111 sal_Int32
& o_rComponentType
115 std::unique_ptr
< SubComponentManager_Data
> m_pData
;
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */