LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/view - WindowUpdater.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 53 0.0 %
Date: 2012-12-27 Functions: 0 10 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      21             : #include "WindowUpdater.hxx"
      22             : #include "ViewShell.hxx"
      23             : #include "Window.hxx"
      24             : #include "drawdoc.hxx"
      25             : #include "View.hxx"
      26             : 
      27             : #include <vcl/split.hxx>
      28             : #include <sfx2/childwin.hxx>
      29             : #include <sfx2/viewfrm.hxx>
      30             : #include <svl/smplhint.hxx>
      31             : 
      32             : #include <algorithm>
      33             : 
      34             : namespace sd {
      35             : 
      36           0 : WindowUpdater::WindowUpdater (void)
      37             :     : mpViewShell (NULL),
      38           0 :       mpDocument (NULL)
      39             : {
      40           0 :     maCTLOptions.AddListener(this);
      41           0 : }
      42             : 
      43             : 
      44             : 
      45             : 
      46           0 : WindowUpdater::~WindowUpdater (void) throw ()
      47             : {
      48           0 :     maCTLOptions.RemoveListener(this);
      49           0 : }
      50             : 
      51             : 
      52             : 
      53             : 
      54           0 : void WindowUpdater::RegisterWindow (::Window* pWindow)
      55             : {
      56           0 :     if (pWindow != NULL)
      57             :     {
      58             :         tWindowList::iterator aWindowIterator (
      59             :             ::std::find (
      60           0 :                 maWindowList.begin(), maWindowList.end(), pWindow));
      61           0 :         if (aWindowIterator == maWindowList.end())
      62             :         {
      63             :             // Update the device once right now and add it to the list.
      64           0 :             Update (pWindow);
      65           0 :             maWindowList.push_back (pWindow);
      66             :         }
      67             :     }
      68           0 : }
      69             : 
      70             : 
      71             : 
      72             : 
      73           0 : void WindowUpdater::UnregisterWindow (::Window* pWindow)
      74             : {
      75             :     tWindowList::iterator aWindowIterator (
      76             :         ::std::find (
      77           0 :             maWindowList.begin(), maWindowList.end(), pWindow));
      78           0 :     if (aWindowIterator != maWindowList.end())
      79             :     {
      80           0 :         maWindowList.erase (aWindowIterator);
      81             :     }
      82           0 : }
      83             : 
      84             : 
      85             : 
      86           0 : void WindowUpdater::SetViewShell (ViewShell& rViewShell)
      87             : {
      88           0 :     mpViewShell = &rViewShell;
      89           0 : }
      90             : 
      91             : 
      92             : 
      93             : 
      94           0 : void WindowUpdater::SetDocument (SdDrawDocument* pDocument)
      95             : {
      96           0 :     mpDocument = pDocument;
      97           0 : }
      98             : 
      99             : 
     100             : 
     101             : 
     102           0 : void WindowUpdater::Update (
     103             :     OutputDevice* pDevice,
     104             :     SdDrawDocument* pDocument) const
     105             : {
     106           0 :     if (pDevice != NULL)
     107             :     {
     108           0 :         UpdateWindow (pDevice);
     109           0 :         if (pDocument != NULL)
     110           0 :             pDocument->ReformatAllTextObjects();
     111             :     }
     112           0 : }
     113             : 
     114             : 
     115             : 
     116             : 
     117           0 : void WindowUpdater::UpdateWindow (OutputDevice* pDevice) const
     118             : {
     119           0 :     if (pDevice != NULL)
     120             :     {
     121           0 :         SvtCTLOptions::TextNumerals aNumeralMode (maCTLOptions.GetCTLTextNumerals());
     122             : 
     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           0 :         switch (aNumeralMode)
     129             :         {
     130             :             case SvtCTLOptions::NUMERALS_HINDI:
     131           0 :                 aLanguage = LANGUAGE_ARABIC_SAUDI_ARABIA;
     132           0 :                 break;
     133             : 
     134             :             case SvtCTLOptions::NUMERALS_SYSTEM:
     135           0 :                 aLanguage = LANGUAGE_SYSTEM;
     136           0 :                 break;
     137             : 
     138             :             case SvtCTLOptions::NUMERALS_ARABIC:
     139             :             default:
     140           0 :                 aLanguage = LANGUAGE_ENGLISH;
     141           0 :                 break;
     142             :         }
     143             : 
     144           0 :         pDevice->SetDigitLanguage (aLanguage);
     145             :     }
     146           0 : }
     147             : 
     148             : 
     149             : 
     150             : 
     151           0 : void WindowUpdater::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 )
     152             : {
     153             :     // Set the current state at all registered output devices.
     154           0 :     tWindowList::iterator aWindowIterator (maWindowList.begin());
     155           0 :     while (aWindowIterator != maWindowList.end())
     156           0 :         Update (*aWindowIterator++);
     157             : 
     158             :     // Reformat the document for the modified state to take effect.
     159           0 :     if (mpDocument != NULL)
     160           0 :         mpDocument->ReformatAllTextObjects();
     161             : 
     162             :     // Invalidate the windows to make the modified state visible.
     163           0 :     aWindowIterator = maWindowList.begin();
     164           0 :     while (aWindowIterator != maWindowList.end())
     165           0 :         (*aWindowIterator++)->Invalidate();
     166           0 : }
     167             : 
     168             : 
     169             : } // end of namespace sd
     170             : 
     171             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10