1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SD_SOURCE_UI_INC_WINDOWUPDATER_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_WINDOWUPDATER_HXX
23 #include <svl/ctloptions.hxx>
24 #include <vcl/vclptr.hxx>
29 namespace vcl
{ class Window
; }
35 /** The purpose of the <type>WindowUpdater</type> is to update output
36 devices to take care of modified global values. These values are
37 monitored for changes. At the moment this is
38 the digit language that defines the glyphs to use to render digits.
39 Other values may be added in the future.
41 <p>The methods of this class have not been included into the
42 <type>ViewShell</type> class in order to not clutter its interface any
43 further. This class accesses some of <type>ViewShell</type> data
44 members directly and thus is declared as its friend.</p>
46 <p>Windows that are to be kept up-to-date have to be registered via the
47 <member>RegisterWindow()</member> method. When a document is given then
48 this document is reformatted when the monitored option changes.</p>
50 class SD_DLLPUBLIC WindowUpdater
51 : public utl::ConfigurationListener
54 explicit WindowUpdater();
55 virtual ~WindowUpdater() throw() override
;
57 /** Add the given device to the list of devices which will be updated
58 when one of the monitored values changes.
60 This device is added to the device list if it is not <null/> and
61 when it is not already a member of that list.
63 void RegisterWindow (vcl::Window
* pWindow
);
65 /** Remove the given device from the list of devices which will be updated
66 when one of the monitored values changes.
68 This device is removed from the device list when it is a member
71 void UnregisterWindow (vcl::Window
* pWindow
);
73 /** Set the document so that it is reformatted when one of the monitored
76 When <null/> is given document reformatting will not take
79 void SetDocument (SdDrawDocument
* pDocument
);
81 /** Update the given output device and update all text objects of the
82 view shell if not told otherwise.
84 The device to update. When the given pointer is NULL then
87 void Update (OutputDevice
* pDevice
) const;
89 /** Callback that waits for notifications of a
90 <type>SvtCTLOptions</type> object.
92 virtual void ConfigurationChanged ( utl::ConfigurationBroadcaster
*, ConfigurationHints nHint
) override
;
95 /// Options to monitor for changes.
96 SvtCTLOptions maCTLOptions
;
98 /// The document rendered in the output devices.
99 SdDrawDocument
* mpDocument
;
101 WindowUpdater (const WindowUpdater
& rUpdater
) = delete;
103 WindowUpdater
operator= (const WindowUpdater
& rUpdater
) = delete;
105 /** Type and data member for a list of devices that have to be kept
108 typedef ::std::vector
< VclPtr
<vcl::Window
> > tWindowList
;
109 tWindowList maWindowList
;
111 /** The central method of this class. Update the given output device.
112 It is the task of the caller to initiate a reformatting of the
113 document that is rendered on this device to reflect the changes.
115 The output device to update. When it is <null/> then the call
118 SAL_DLLPRIVATE
void UpdateWindow (OutputDevice
* pDevice
) const;
121 } // end of namespace sd
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */