LCOV - code coverage report
Current view: top level - sfx2/source/sidebar - AsynchronousCall.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 29 0.0 %
Date: 2014-04-14 Functions: 0 8 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             : #include "AsynchronousCall.hxx"
      20             : 
      21             : #include <vcl/svapp.hxx>
      22             : 
      23             : 
      24             : namespace sfx2 { namespace sidebar {
      25             : 
      26           0 : AsynchronousCall::AsynchronousCall (void)
      27             :     : maAction(),
      28           0 :       mnCallId(0)
      29             : {
      30           0 : }
      31             : 
      32             : 
      33             : 
      34             : 
      35           0 : AsynchronousCall::AsynchronousCall (const Action& rAction)
      36             :     : maAction(rAction),
      37           0 :       mnCallId(0)
      38             : {
      39           0 : }
      40             : 
      41             : 
      42             : 
      43             : 
      44           0 : AsynchronousCall::~AsynchronousCall (void)
      45             : {
      46           0 :     CancelRequest();
      47           0 : }
      48             : 
      49             : 
      50             : 
      51             : 
      52           0 : void AsynchronousCall::RequestCall (const Action& rAction)
      53             : {
      54           0 :     CancelRequest();
      55           0 :     maAction = rAction;
      56           0 :     RequestCall();
      57           0 : }
      58             : 
      59             : 
      60             : 
      61             : 
      62           0 : void AsynchronousCall::RequestCall (void)
      63             : {
      64           0 :     if (mnCallId == 0)
      65             :     {
      66           0 :         Link aLink (LINK(this, AsynchronousCall, HandleUserCall));
      67           0 :         mnCallId = Application::PostUserEvent(aLink);
      68             :     }
      69           0 : }
      70             : 
      71             : 
      72             : 
      73             : 
      74           0 : void AsynchronousCall::CancelRequest (void)
      75             : {
      76           0 :     if (mnCallId != 0)
      77             :     {
      78           0 :         Application::RemoveUserEvent(mnCallId);
      79           0 :         mnCallId = 0;
      80             :     }
      81           0 : }
      82             : 
      83             : 
      84             : 
      85             : 
      86           0 : IMPL_LINK(AsynchronousCall, HandleUserCall, void*, EMPTYARG )
      87             : {
      88           0 :     mnCallId = 0;
      89           0 :     if (maAction)
      90           0 :         maAction();
      91             : 
      92           0 :     return sal_True;
      93             : }
      94             : 
      95             : 
      96             : } } // end of namespace sfx2::sidebar
      97             : 
      98             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10