LibreOffice Module sfx2 (master) 1
fltlst.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20
21#include "fltlst.hxx"
22
23#include <com/sun/star/document/FilterConfigRefresh.hpp>
25
26#include <sfx2/fcontnr.hxx>
27
28#include <vcl/svapp.hxx>
30
31
32// namespaces
33
34using namespace ::com::sun::star;
35
36namespace {
37
38class SfxRefreshListener : public ::cppu::WeakImplHelper<css::util::XRefreshListener>
39{
40 private:
42
43 public:
44 explicit SfxRefreshListener(SfxFilterListener *pOwner)
46 {
47 }
48
49 // util.XRefreshListener
50 virtual void SAL_CALL refreshed( const css::lang::EventObject& rEvent ) override
51 {
52 m_pOwner->refreshed(rEvent);
53 }
54
55 // lang.XEventListener
56 virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent) override
57 {
58 m_pOwner->disposing(rEvent);
59 }
60};
61
62}
63
64/*-************************************************************************************************************
65 @short ctor
66 @descr These initialize an instance of a SfxFilterListener class. Created object listen automatically
67 on right FilterFactory-Service for all changes and synchronize right SfxFilterContainer with
68 corresponding framework-cache.
69 We use given "sFactory" value to decide which query must be used to fill "pContainer" with new values.
70 Given "pContainer" hold us alive as uno reference and we use it to synchronize it with framework caches.
71 We will die, if he die! see dtor for further information.
72
73 @seealso dtor
74 @seealso class framework::FilterCache
75 @seealso service ::document::FilterFactory
76
77 @param "sFactory" , short name of module which contains filter container
78 @param "pContainer", pointer to filter container which will be informed
79 @onerror We show some assertions in non product version.
80 Otherwise we do nothing!
81 @threadsafe yes
82*//*-*************************************************************************************************************/
84 : m_xFilterCache(document::FilterConfigRefresh::create( comphelper::getProcessComponentContext() ) ),
85 m_xFilterCacheListener(new SfxRefreshListener(this))
86{
87 m_xFilterCache->addRefreshListener( m_xFilterCacheListener );
88}
89
91{
92}
93
94void SfxFilterListener::refreshed( const lang::EventObject& aSource )
95{
96 SolarMutexGuard aGuard;
97 uno::Reference< util::XRefreshable > xContainer( aSource.Source, uno::UNO_QUERY );
98 if(
99 (xContainer.is() ) &&
100 (xContainer==m_xFilterCache)
101 )
102 {
104 }
105}
106
107void SfxFilterListener::disposing( const lang::EventObject& aSource )
108{
109 SolarMutexGuard aGuard;
110 uno::Reference< util::XRefreshable > xNotifier( aSource.Source, uno::UNO_QUERY );
111 if (!xNotifier.is())
112 return;
113
114 if (xNotifier == m_xFilterCache)
115 m_xFilterCache.clear();
116}
117
118/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static SAL_DLLPRIVATE void ReadFilters_Impl(bool bUpdate=false)
Definition: fltfnc.cxx:1047
void refreshed(const css::lang::EventObject &aSource)
Definition: fltlst.cxx:94
css::uno::Reference< css::util::XRefreshable > m_xFilterCache
Definition: fltlst.hxx:31
css::uno::Reference< css::util::XRefreshListener > m_xFilterCacheListener
Definition: fltlst.hxx:32
void disposing(const css::lang::EventObject &aSource)
Definition: fltlst.cxx:107
SvLinkSource * pOwner
Definition: linksrc.cxx:41
Reference< XComponentContext > getProcessComponentContext()
css::uno::Reference< css::deployment::XPackageRegistry > create(css::uno::Reference< css::deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, css::uno::Reference< css::uno::XComponentContext > const &xComponentContext)
ContentProvider * m_pOwner