1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef DBACCESS_SUBCOMPONENTMANAGER_HXX 25 #define DBACCESS_SUBCOMPONENTMANAGER_HXX 26 27 #include "AppElementType.hxx" 28 29 /** === begin UNO includes === **/ 30 #include <com/sun/star/beans/XPropertyChangeListener.hpp> 31 #include <com/sun/star/frame/XController.hpp> 32 /** === end UNO includes === **/ 33 34 #include <comphelper/sharedmutex.hxx> 35 #include <cppuhelper/implbase1.hxx> 36 37 #include <memory> 38 39 //........................................................................ 40 namespace dbaui 41 { 42 //........................................................................ 43 44 struct SubComponentManager_Data; 45 class OApplicationController; 46 47 //==================================================================== 48 //= SubComponentManager 49 //==================================================================== 50 typedef ::cppu::WeakImplHelper1 < ::com::sun::star::beans::XPropertyChangeListener 51 > SubComponentManager_Base; 52 class SubComponentManager : public SubComponentManager_Base 53 { 54 public: 55 SubComponentManager( OApplicationController& _rController, const ::comphelper::SharedMutex& _rMutex ); 56 virtual ~SubComponentManager(); 57 58 void disposing(); 59 60 // XPropertyChangeListener 61 virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException); 62 63 // XEventListener 64 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); 65 66 // XDatabaseDocumentUI helpers 67 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> > 68 getSubComponents() const; 69 sal_Bool closeSubComponents(); 70 71 // container access 72 void onSubComponentOpened( 73 const ::rtl::OUString& _rName, 74 const sal_Int32 _nComponentType, 75 const ElementOpenMode _eOpenMode, 76 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& 77 _rxComponent 78 ); 79 bool empty() const; 80 81 /** activates (i.e. brings to top) the frame in which the given component is loaded, if any 82 83 @return 84 <TRUE/> if any only of such a frame was found, i.e. the component had already been loaded 85 previously 86 */ 87 bool activateSubFrame( 88 const ::rtl::OUString& _rName, 89 const sal_Int32 _nComponentType, 90 const ElementOpenMode _eOpenMode, 91 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_rComponent 92 ) const; 93 94 /** closes all frames of the given component 95 96 If a view for the component (given by name and type) has been loaded into one or more 97 frames (with potentially different OpenModes), then those frames are gracefully closed. 98 99 @return 100 <TRUE/> if and only if closing those frames was successful, or frames for the given sub component 101 exist. 102 */ 103 bool closeSubFrames( 104 const ::rtl::OUString& _rName, 105 const sal_Int32 _nComponentType 106 ); 107 108 /** searches for the given sub component 109 110 @param i_rComponent 111 the sub component to look up 112 @param o_rName 113 contains, upon successful return, the name of the sub component 114 @param o_nComponentType 115 contains, upon successful return, the type of the sub component 116 @return 117 <TRUE/> if and only if the component was found 118 */ 119 bool lookupSubComponent( 120 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& i_rComponent, 121 ::rtl::OUString& o_rName, 122 sal_Int32& o_rComponentType 123 ); 124 125 private: 126 ::std::auto_ptr< SubComponentManager_Data > m_pData; 127 }; 128 129 //........................................................................ 130 } // namespace dbaui 131 //........................................................................ 132 133 #endif // DBACCESS_SUBCOMPONENTMANAGER_HXX 134