1 /************************************************************************* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * Copyright 2000, 2010 Oracle and/or its affiliates. 5 * 6 * OpenOffice.org - a multi-platform office productivity suite 7 * 8 * This file is part of OpenOffice.org. 9 * 10 * OpenOffice.org is free software: you can redistribute it and/or modify 11 * it under the terms of the GNU Lesser General Public License version 3 12 * only, as published by the Free Software Foundation. 13 * 14 * OpenOffice.org is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU Lesser General Public License version 3 for more details 18 * (a copy is included in the LICENSE file that accompanied this code). 19 * 20 * You should have received a copy of the GNU Lesser General Public License 21 * version 3 along with OpenOffice.org. If not, see 22 * <http://www.openoffice.org/license.html> 23 * for a copy of the LGPLv3 License. 24 * 25 ************************************************************************/ 26 27 #ifndef DBACCESS_SUBCOMPONENTMANAGER_HXX 28 #define DBACCESS_SUBCOMPONENTMANAGER_HXX 29 30 #include "AppElementType.hxx" 31 32 /** === begin UNO includes === **/ 33 #include <com/sun/star/beans/XPropertyChangeListener.hpp> 34 #include <com/sun/star/frame/XController.hpp> 35 /** === end UNO includes === **/ 36 37 #include <comphelper/sharedmutex.hxx> 38 #include <cppuhelper/implbase1.hxx> 39 40 #include <memory> 41 42 //........................................................................ 43 namespace dbaui 44 { 45 //........................................................................ 46 47 struct SubComponentManager_Data; 48 class OApplicationController; 49 50 //==================================================================== 51 //= SubComponentManager 52 //==================================================================== 53 typedef ::cppu::WeakImplHelper1 < ::com::sun::star::beans::XPropertyChangeListener 54 > SubComponentManager_Base; 55 class SubComponentManager : public SubComponentManager_Base 56 { 57 public: 58 SubComponentManager( OApplicationController& _rController, const ::comphelper::SharedMutex& _rMutex ); 59 virtual ~SubComponentManager(); 60 61 void disposing(); 62 63 // XPropertyChangeListener 64 virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException); 65 66 // XEventListener 67 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); 68 69 // XDatabaseDocumentUI helpers 70 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> > 71 getSubComponents() const; 72 sal_Bool closeSubComponents(); 73 74 // container access 75 void onSubComponentOpened( 76 const ::rtl::OUString& _rName, 77 const sal_Int32 _nComponentType, 78 const ElementOpenMode _eOpenMode, 79 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& 80 _rxComponent 81 ); 82 bool empty() const; 83 84 /** activates (i.e. brings to top) the frame in which the given component is loaded, if any 85 86 @return 87 <TRUE/> if any only of such a frame was found, i.e. the component had already been loaded 88 previously 89 */ 90 bool activateSubFrame( 91 const ::rtl::OUString& _rName, 92 const sal_Int32 _nComponentType, 93 const ElementOpenMode _eOpenMode, 94 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_rComponent 95 ) const; 96 97 /** closes all frames of the given component 98 99 If a view for the component (given by name and type) has been loaded into one or more 100 frames (with potentially different OpenModes), then those frames are gracefully closed. 101 102 @return 103 <TRUE/> if and only if closing those frames was successful, or frames for the given sub component 104 exist. 105 */ 106 bool closeSubFrames( 107 const ::rtl::OUString& _rName, 108 const sal_Int32 _nComponentType 109 ); 110 111 /** searches for the given sub component 112 113 @param i_rComponent 114 the sub component to look up 115 @param o_rName 116 contains, upon successful return, the name of the sub component 117 @param o_nComponentType 118 contains, upon successful return, the type of the sub component 119 @return 120 <TRUE/> if and only if the component was found 121 */ 122 bool lookupSubComponent( 123 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& i_rComponent, 124 ::rtl::OUString& o_rName, 125 sal_Int32& o_rComponentType 126 ); 127 128 private: 129 ::std::auto_ptr< SubComponentManager_Data > m_pData; 130 }; 131 132 //........................................................................ 133 } // namespace dbaui 134 //........................................................................ 135 136 #endif // DBACCESS_SUBCOMPONENTMANAGER_HXX 137