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 __FILTER_CONFIG_LATEINITLISTENER_HXX_ 25 #define __FILTER_CONFIG_LATEINITLISTENER_HXX_ 26 27 //_______________________________________________ 28 // includes 29 30 #include "cacheitem.hxx" 31 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 32 #include <com/sun/star/lang/XEventListener.hpp> 33 #include <com/sun/star/document/XEventListener.hpp> 34 #include <com/sun/star/document/XEventBroadcaster.hpp> 35 #include <cppuhelper/implbase1.hxx> 36 37 //_______________________________________________ 38 // namespace 39 40 namespace filter{ 41 namespace config{ 42 43 //_______________________________________________ 44 // definitions 45 46 //_______________________________________________ 47 48 /** @short implements a listener, which will update the 49 global filter cache of an office, after zje office 50 startup was finished. 51 52 @descr To perform startup of an office, the filter cache starts 53 with a minimum set of properties only. After the first document 54 was loaded successfully a thread will be started to fill the 55 cache with all other proeprties, so it can work with the whole 56 filter configuration. 57 */ 58 class LateInitListener : public BaseLock // must be the first one to guarantee right initialized mutex member! 59 , public ::cppu::WeakImplHelper1< css::document::XEventListener > 60 { 61 //------------------------------------------- 62 // member 63 64 private: 65 66 /** @short reference to an uno service manager, which can be used 67 to create own needed services. */ 68 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; 69 70 /** @short reference to the global event broadcaster, which is usde to find 71 out, when the first office document was opened successfully. */ 72 css::uno::Reference< css::document::XEventBroadcaster > m_xBroadcaster; 73 74 //------------------------------------------- 75 // native interface 76 77 public: 78 79 //--------------------------------------- 80 // ctor/dtor 81 82 /** @short initialize new instance of this class. 83 84 @descr It set a reference to the global filter cache singleton, 85 which should be updated here. Further it starts listening 86 on the global event broadcaster to get the information, when 87 loading of the first document was finished. 88 89 @param xSMGR 90 reference to a service manager, which can be used to create 91 own needed uno services. 92 */ 93 LateInitListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); 94 95 //--------------------------------------- 96 97 /** @short standard dtor. 98 */ 99 virtual ~LateInitListener(); 100 101 //------------------------------------------- 102 // uno interface 103 104 public: 105 106 //--------------------------------------- 107 // document.XEventListener 108 109 virtual void SAL_CALL notifyEvent(const css::document::EventObject& aEvent) 110 throw(css::uno::RuntimeException); 111 112 //--------------------------------------- 113 // lang.XEventListener 114 virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) 115 throw(css::uno::RuntimeException); 116 }; 117 118 } // namespace config 119 } // namespace filter 120 121 #endif // __FILTER_CONFIG_LATEINITLISTENER_HXX_ 122