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 #ifndef __FILTER_CONFIG_CONFIGFLUSH_HXX_
24 #define __FILTER_CONFIG_CONFIGFLUSH_HXX_
25 
26 //_______________________________________________
27 // includes
28 
29 #include "cacheitem.hxx"
30 #include <com/sun/star/util/XRefreshable.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <cppuhelper/interfacecontainer.h>
33 #include <cppuhelper/implbase1.hxx>
34 
35 //_______________________________________________
36 // namespace
37 
38 namespace filter{
39     namespace config{
40 
41 //_______________________________________________
42 // definitions
43 
44 //_______________________________________________
45 
46 /** @short      supports registration of XRefreshListener
47                 on the global filter configuration.
48 
49     @descr      Such refresh listener will be called in case the
50                 type/filter configuration will be changed at runtime.
51  */
52 class ConfigFlush : public BaseLock
53                   , public ::cppu::WeakImplHelper1< css::util::XRefreshable >
54 {
55     //-------------------------------------------
56     // member
57 
58     protected:
59 
60         /** @short  reference to an uno service manager, which can be used
61                     to create own needed services. */
62         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
63 
64         /** @short  holds all listener, which are registered at this instance. */
65         ::cppu::OMultiTypeInterfaceContainerHelper m_lListener;
66 
67     //-------------------------------------------
68     // native interface
69 
70     public:
71 
72         //---------------------------------------
73         // ctor/dtor
74 
75         /** @short  standard ctor.
76          */
77         ConfigFlush(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
78 
79         //---------------------------------------
80 
81         /** @short  standard dtor.
82          */
83         virtual ~ConfigFlush();
84 
85     //-------------------------------------------
86     // uno interface
87 
88     public:
89 
90         //---------------------------------------
91         // XServiceInfo
92 
93         virtual ::rtl::OUString SAL_CALL getImplementationName()
94             throw (css::uno::RuntimeException);
95 
96         virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& sServiceName)
97             throw (css::uno::RuntimeException);
98 
99         virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
100             throw (css::uno::RuntimeException);
101 
102         //---------------------------------------
103         // XRefreshable
104 
105         virtual void SAL_CALL refresh()
106             throw(css::uno::RuntimeException);
107 
108         virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener >& xListener)
109             throw(css::uno::RuntimeException);
110 
111         virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener >& xListener)
112             throw(css::uno::RuntimeException);
113 
114         //---------------------------------------
115         // interface to register/create this instance as an UNO service
116         static ::rtl::OUString impl_getImplementationName();
117         static css::uno::Sequence< ::rtl::OUString > impl_getSupportedServiceNames();
118         static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
119 };
120 
121     } // namespace config
122 } // namespace filter
123 
124 #endif // __FILTER_CONFIG_CONFIGFLUSH_HXX_
125