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 #pragma once
21 
22 #include <MutexOwner.hxx>
23 #include <com/sun/star/drawing/framework/XConfigurationChangeRequest.hpp>
24 #include <com/sun/star/container/XNamed.hpp>
25 #include <cppuhelper/compbase.hxx>
26 
27 namespace com::sun::star::drawing::framework { class XConfiguration; }
28 
29 namespace sd::framework {
30 
31 typedef ::cppu::WeakComponentImplHelper <
32       css::drawing::framework::XConfigurationChangeRequest,
33       css::container::XNamed
34     > UpdateRequestInterfaceBase;
35 
36 /** This update request is used to request configuration updates
37     asynchronous when no other requests are being processed.  When there are
38     other requests then we can simply wait until the last one is executed:
39     the configuration is updated when the request queue becomes empty.  This
40     is use by this implementation as well.  The execute() method does not
41     really do anything.  This request just triggers the update of the
42     configuration when it is removed as last request from the queue.
43 */
44 class UpdateRequest
45     : private MutexOwner,
46       public UpdateRequestInterfaceBase
47 {
48 public:
49     UpdateRequest() noexcept;
50     virtual ~UpdateRequest() noexcept override;
51 
52     // XConfigurationChangeOperation
53 
54     virtual void SAL_CALL execute (
55         const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration) override;
56 
57     // XNamed
58 
59     /** Return a human readable string representation.  This is used for
60         debugging purposes.
61     */
62     virtual OUString SAL_CALL getName() override;
63 
64     /** This call is ignored because the XNamed interface is (mis)used to
65         give access to a human readable name for debugging purposes.
66     */
67     virtual void SAL_CALL setName (const OUString& rName) override;
68 };
69 
70 } // end of namespace sd::framework
71 
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
73