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_DBACCESS_SOURCE_UI_APP_SUBCOMPONENTMANAGER_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_APP_SUBCOMPONENTMANAGER_HXX
23 #include "AppElementType.hxx"
25 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
26 #include <com/sun/star/frame/XController.hpp>
28 #include <comphelper/sharedmutex.hxx>
29 #include <cppuhelper/implbase1.hxx>
36 struct SubComponentManager_Data
;
37 class OApplicationController
;
39 // SubComponentManager
40 typedef ::cppu::WeakImplHelper1
< ::com::sun::star::beans::XPropertyChangeListener
41 > SubComponentManager_Base
;
42 class SubComponentManager
: public SubComponentManager_Base
45 SubComponentManager( OApplicationController
& _rController
, const ::comphelper::SharedMutex
& _rMutex
);
46 virtual ~SubComponentManager();
50 // XPropertyChangeListener
51 virtual void SAL_CALL
propertyChange( const ::com::sun::star::beans::PropertyChangeEvent
& evt
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
54 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
56 // XDatabaseDocumentUI helpers
57 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> >
58 getSubComponents() const;
59 bool closeSubComponents();
62 void onSubComponentOpened(
63 const OUString
& _rName
,
64 const sal_Int32 _nComponentType
,
65 const ElementOpenMode _eOpenMode
,
66 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>&
71 /** activates (i.e. brings to top) the frame in which the given component is loaded, if any
74 <TRUE/> if any only of such a frame was found, i.e. the component had already been loaded
77 bool activateSubFrame(
78 const OUString
& _rName
,
79 const sal_Int32 _nComponentType
,
80 const ElementOpenMode _eOpenMode
,
81 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>& o_rComponent
84 /** closes all frames of the given component
86 If a view for the component (given by name and type) has been loaded into one or more
87 frames (with potentially different OpenModes), then those frames are gracefully closed.
90 <TRUE/> if and only if closing those frames was successful, or frames for the given sub component
94 const OUString
& _rName
,
95 const sal_Int32 _nComponentType
98 /** searches for the given sub component
101 the sub component to look up
103 contains, upon successful return, the name of the sub component
104 @param o_nComponentType
105 contains, upon successful return, the type of the sub component
107 <TRUE/> if and only if the component was found
109 bool lookupSubComponent(
110 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>& i_rComponent
,
112 sal_Int32
& o_rComponentType
116 ::std::unique_ptr
< SubComponentManager_Data
> m_pData
;
121 #endif // INCLUDED_DBACCESS_SOURCE_UI_APP_SUBCOMPONENTMANAGER_HXX
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */