bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / inc / WindowUpdater.hxx
blob626dda1bbe34835443e6b45ce9001c57598a4427
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/lstner.hxx>
24 #include <svl/ctloptions.hxx>
25 #include <vcl/vclptr.hxx>
26 #include "sddllapi.h"
28 #include <vector>
30 namespace vcl { class Window; }
31 class OutputDevice;
32 class SdDrawDocument;
34 namespace sd {
36 class ViewShell;
38 /** The purpose of the <type>WindowUpdater</type> is to update output
39 devices to take care of modified global values. These values are
40 monitored for changes. At the moment this is
41 the digit language that defines the glyphs to use to render digits.
42 Other values may be added in the future.
44 <p>The methods of this class have not been included into the
45 <type>ViewShell</type> class in order to not clutter its interface any
46 further. This class accesses some of <type>ViewShell</type> data
47 members directly and thus is declared as its friend.</p>
49 <p>Windows that are to be kept up-to-date have to be registered via the
50 <member>RegisterWindow()</member> method. When a document is given then
51 this document is reformatted when the monitored option changes.</p>
53 class SD_DLLPUBLIC WindowUpdater
54 : public utl::ConfigurationListener
56 public:
57 explicit WindowUpdater();
58 virtual ~WindowUpdater() throw();
60 /** Add the given device to the list of devices which will be updated
61 when one of the monitored values changes.
62 @param pWindow
63 This device is added to the device list if it is not <null/> and
64 when it is not already a member of that list.
66 void RegisterWindow (vcl::Window* pWindow);
68 /** Remove the given device from the list of devices which will be updated
69 when one of the monitored values changes.
70 @param pWindow
71 This device is removed from the device list when it is a member
72 of that list.
74 void UnregisterWindow (vcl::Window* pWindow);
76 /** Set the view shell whose output devices shall be kept up to date.
77 It is used to clear the master page cache so that a redraw affects
78 the master page content as well.
80 void SetViewShell (ViewShell& rViewShell);
82 /** Set the document so that it is reformatted when one of the monitored
83 values changes.
84 @param pDocument
85 When <null/> is given document reformatting will not take
86 place in the future.
88 void SetDocument (SdDrawDocument* pDocument);
90 /** Update the given output device and update all text objects of the
91 view shell if not told otherwise.
92 @param pWindow
93 The device to update. When the given pointer is NULL then
94 nothing is done.
95 @param pDocument
96 When given a pointer to a document then tell it to reformat all
97 text objects. This refromatting is necessary for the new values
98 to take effect.
100 void Update (OutputDevice* pDevice, SdDrawDocument* pDocument=0) const;
102 /** Callback that waits for notifications of a
103 <type>SvtCTLOptions</type> object.
105 virtual void ConfigurationChanged ( utl::ConfigurationBroadcaster*, sal_uInt32 nHint) SAL_OVERRIDE;
107 private:
108 /// Options to monitor for changes.
109 SvtCTLOptions maCTLOptions;
111 /// Keep the output devices of this view shell up to date.
112 ViewShell* mpViewShell;
114 /// The document rendered in the output devices.
115 SdDrawDocument* mpDocument;
117 WindowUpdater (const WindowUpdater& rUpdater) SAL_DELETED_FUNCTION;
119 WindowUpdater operator= (const WindowUpdater& rUpdater) SAL_DELETED_FUNCTION;
121 /** Type and data member for a list of devices that have to be kept
122 up-to-date.
124 typedef ::std::vector< VclPtr<vcl::Window> > tWindowList;
125 tWindowList maWindowList;
127 /** The central method of this class. Update the given output device.
128 It is the task of the caller to initiate a refrormatting of the
129 document that is rendered on this device to reflect the changes.
130 @param pWindow
131 The output device to update. When it is <null/> then the call
132 is ignored.
134 SAL_DLLPRIVATE void UpdateWindow (OutputDevice* pDevice) const;
137 } // end of namespace sd
139 #endif
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */