LibreOffice Module filter (master) 1
configflush.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#include "configflush.hxx"
22#include <cppuhelper/weak.hxx>
23#include <com/sun/star/uno/XComponentContext.hpp>
24
25
26namespace filter::config{
27
29{
30}
31
33{
34}
35
37{
38 return "com.sun.star.comp.filter.config.ConfigFlush";
39 // <- SAFE
40}
41
42sal_Bool SAL_CALL ConfigFlush::supportsService(const OUString& sServiceName)
43{
45}
46
47css::uno::Sequence< OUString > SAL_CALL ConfigFlush::getSupportedServiceNames()
48{
49 return { "com.sun.star.document.FilterConfigRefresh" };
50}
51
52void SAL_CALL ConfigFlush::refresh()
53{
54 // notify listener outside the lock!
55 // The used listener helper lives if we live
56 // and is threadsafe by itself.
57 // Further it's not a good idea to hold the own lock
58 // if an outside object is called :-)
59 std::unique_lock g(m_aMutex);
61 return;
62 css::lang::EventObject aSource(static_cast< css::util::XRefreshable* >(this));
63 m_aRefreshListeners.notifyEach(g, &css::util::XRefreshListener::refreshed, aSource);
64}
65
66
67void SAL_CALL ConfigFlush::addRefreshListener(const css::uno::Reference< css::util::XRefreshListener >& xListener)
68{
69 std::unique_lock g(m_aMutex);
71}
72
73
74void SAL_CALL ConfigFlush::removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener >& xListener)
75{
76 std::unique_lock g(m_aMutex);
78}
79
80
81} // namespace filter::config
82
83extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
85 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
86{
87 return cppu::acquire(new filter::config::ConfigFlush());
88}
89
90/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr OUStringLiteral sServiceName
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
void notifyEach(std::unique_lock< std::mutex > &rGuard, void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event) const
sal_Int32 getLength(std::unique_lock< std::mutex > &rGuard) const
sal_Int32 removeInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
supports registration of XRefreshListener on the global filter configuration.
Definition: configflush.hxx:40
comphelper::OInterfaceContainerHelper4< css::util::XRefreshListener > m_aRefreshListeners
holds all listener, which are registered at this instance.
Definition: configflush.hxx:43
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: configflush.cxx:47
virtual void SAL_CALL refresh() override
Definition: configflush.cxx:52
virtual void SAL_CALL removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &xListener) override
Definition: configflush.cxx:74
virtual OUString SAL_CALL getImplementationName() override
Definition: configflush.cxx:36
ConfigFlush()
standard ctor.
Definition: configflush.cxx:28
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Definition: configflush.cxx:42
virtual ~ConfigFlush() override
standard dtor.
Definition: configflush.cxx:32
virtual void SAL_CALL addRefreshListener(const css::uno::Reference< css::util::XRefreshListener > &xListener) override
Definition: configflush.cxx:67
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * filter_ConfigFlush_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: configflush.cxx:84
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
unsigned char sal_Bool