fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / ui / view / WindowUpdater.cxx
blob869d53a3b485858e49b2bed7b0e55fe6811f9207
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 .
21 #include "WindowUpdater.hxx"
22 #include "ViewShell.hxx"
23 #include "Window.hxx"
24 #include "drawdoc.hxx"
25 #include "View.hxx"
27 #include <vcl/split.hxx>
28 #include <sfx2/childwin.hxx>
29 #include <sfx2/viewfrm.hxx>
30 #include <svl/smplhint.hxx>
32 #include <algorithm>
34 namespace sd {
36 WindowUpdater::WindowUpdater (void)
37 : mpViewShell (NULL),
38 mpDocument (NULL)
40 maCTLOptions.AddListener(this);
46 WindowUpdater::~WindowUpdater (void) throw ()
48 maCTLOptions.RemoveListener(this);
54 void WindowUpdater::RegisterWindow (::Window* pWindow)
56 if (pWindow != NULL)
58 tWindowList::iterator aWindowIterator (
59 ::std::find (
60 maWindowList.begin(), maWindowList.end(), pWindow));
61 if (aWindowIterator == maWindowList.end())
63 // Update the device once right now and add it to the list.
64 Update (pWindow);
65 maWindowList.push_back (pWindow);
73 void WindowUpdater::UnregisterWindow (::Window* pWindow)
75 tWindowList::iterator aWindowIterator (
76 ::std::find (
77 maWindowList.begin(), maWindowList.end(), pWindow));
78 if (aWindowIterator != maWindowList.end())
80 maWindowList.erase (aWindowIterator);
86 void WindowUpdater::SetViewShell (ViewShell& rViewShell)
88 mpViewShell = &rViewShell;
94 void WindowUpdater::SetDocument (SdDrawDocument* pDocument)
96 mpDocument = pDocument;
102 void WindowUpdater::Update (
103 OutputDevice* pDevice,
104 SdDrawDocument* pDocument) const
106 if (pDevice != NULL)
108 UpdateWindow (pDevice);
109 if (pDocument != NULL)
110 pDocument->ReformatAllTextObjects();
117 void WindowUpdater::UpdateWindow (OutputDevice* pDevice) const
119 if (pDevice != NULL)
121 SvtCTLOptions::TextNumerals aNumeralMode (maCTLOptions.GetCTLTextNumerals());
123 LanguageType aLanguage;
124 // Now this is a bit confusing. The numerals in arabic languages
125 // are Hindi numerals and what the western world generally uses are
126 // arabic numerals. The digits used in the Hindi language are not
127 // used at all.
128 switch (aNumeralMode)
130 case SvtCTLOptions::NUMERALS_HINDI:
131 aLanguage = LANGUAGE_ARABIC_SAUDI_ARABIA;
132 break;
134 case SvtCTLOptions::NUMERALS_SYSTEM:
135 aLanguage = LANGUAGE_SYSTEM;
136 break;
138 case SvtCTLOptions::NUMERALS_ARABIC:
139 default:
140 aLanguage = LANGUAGE_ENGLISH;
141 break;
144 pDevice->SetDigitLanguage (aLanguage);
151 void WindowUpdater::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 )
153 // Set the current state at all registered output devices.
154 tWindowList::iterator aWindowIterator (maWindowList.begin());
155 while (aWindowIterator != maWindowList.end())
156 Update (*aWindowIterator++);
158 // Reformat the document for the modified state to take effect.
159 if (mpDocument != NULL)
160 mpDocument->ReformatAllTextObjects();
162 // Invalidate the windows to make the modified state visible.
163 aWindowIterator = maWindowList.begin();
164 while (aWindowIterator != maWindowList.end())
165 (*aWindowIterator++)->Invalidate();
169 } // end of namespace sd
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */