LCOV - code coverage report
Current view: top level - sd/source/ui/presenter - CanvasUpdateRequester.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 33 0.0 %
Date: 2014-04-14 Functions: 0 9 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 "CanvasUpdateRequester.hxx"
      22             : #include <vcl/svapp.hxx>
      23             : #include <com/sun/star/lang/XComponent.hpp>
      24             : 
      25             : using namespace ::com::sun::star;
      26             : using namespace ::com::sun::star::uno;
      27             : 
      28             : namespace sd { namespace presenter {
      29             : 
      30             : //===== CanvasUpdateRequester::Deleter ========================================
      31             : 
      32             : class CanvasUpdateRequester::Deleter
      33             : {
      34             : public:
      35           0 :     void operator() (CanvasUpdateRequester* pObject) { delete pObject; }
      36             : };
      37             : 
      38             : 
      39             : 
      40             : 
      41             : //===== CanvasUpdateRequester =================================================
      42             : 
      43           0 : CanvasUpdateRequester::RequesterMap CanvasUpdateRequester::maRequesterMap;
      44             : 
      45           0 : ::boost::shared_ptr<CanvasUpdateRequester> CanvasUpdateRequester::Instance (
      46             :     const Reference<rendering::XSpriteCanvas>& rxSharedCanvas)
      47             : {
      48           0 :     RequesterMap::const_iterator iRequester;
      49           0 :     for (iRequester=maRequesterMap.begin(); iRequester!=maRequesterMap.end(); ++iRequester)
      50             :     {
      51           0 :         if (iRequester->first == rxSharedCanvas)
      52           0 :             return iRequester->second;
      53             :     }
      54             : 
      55             :     // No requester for the given canvas found.  Create a new one.
      56             :     ::boost::shared_ptr<CanvasUpdateRequester> pRequester (
      57           0 :         new CanvasUpdateRequester(rxSharedCanvas), Deleter());
      58           0 :     maRequesterMap.push_back(RequesterMap::value_type(rxSharedCanvas,pRequester));
      59           0 :     return pRequester;
      60             : }
      61             : 
      62             : 
      63             : 
      64             : 
      65           0 : CanvasUpdateRequester::CanvasUpdateRequester (
      66             :     const Reference<rendering::XSpriteCanvas>& rxCanvas)
      67             :     : mxCanvas(rxCanvas),
      68             :       mnUserEventId(0),
      69           0 :       mbUpdateFlag(sal_False)
      70             : {
      71           0 :     Reference<lang::XComponent> xComponent (mxCanvas, UNO_QUERY);
      72           0 :     if (xComponent.is())
      73             :     {
      74             :         //xComponent->addEventListener(this);
      75           0 :     }
      76           0 : }
      77             : 
      78             : 
      79             : 
      80             : 
      81           0 : CanvasUpdateRequester::~CanvasUpdateRequester (void)
      82             : {
      83           0 :     if (mnUserEventId != 0)
      84           0 :         Application::RemoveUserEvent(mnUserEventId);
      85           0 : }
      86             : 
      87             : 
      88             : 
      89             : 
      90           0 : void CanvasUpdateRequester::RequestUpdate (const sal_Bool bUpdateAll)
      91             : {
      92           0 :     if (mnUserEventId == 0)
      93             :     {
      94           0 :         mbUpdateFlag = bUpdateAll;
      95           0 :         mnUserEventId = Application::PostUserEvent(LINK(this, CanvasUpdateRequester, Callback));
      96             :     }
      97             :     else
      98             :     {
      99           0 :         mbUpdateFlag |= bUpdateAll;
     100             :     }
     101           0 : }
     102             : 
     103             : 
     104             : 
     105           0 : IMPL_LINK_NOARG(CanvasUpdateRequester, Callback)
     106             : {
     107           0 :     mnUserEventId = 0;
     108           0 :     if (mxCanvas.is())
     109             :     {
     110           0 :         mxCanvas->updateScreen(mbUpdateFlag);
     111           0 :         mbUpdateFlag = sal_False;
     112             :     }
     113           0 :     return 0;
     114             : }
     115             : 
     116             : 
     117           0 : } } // end of namespace ::sd::presenter
     118             : 
     119             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10