LCOV - code coverage report
Current view: top level - sfx2/source/sidebar - AsynchronousCall.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 24 24 100.0 %
Date: 2015-06-13 12:38:46 Functions: 7 7 100.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             : #include <vcl/svapp.hxx>
      21             : 
      22             : namespace sfx2 { namespace sidebar {
      23             : 
      24        3155 : AsynchronousCall::AsynchronousCall()
      25             :     : maAction(),
      26        3155 :       mnCallId(0)
      27             : {
      28        3155 : }
      29             : 
      30        6310 : AsynchronousCall::AsynchronousCall (const Action& rAction)
      31             :     : maAction(rAction),
      32        6310 :       mnCallId(0)
      33             : {
      34        6310 : }
      35             : 
      36       16878 : AsynchronousCall::~AsynchronousCall()
      37             : {
      38        8439 :     CancelRequest();
      39        8439 : }
      40             : 
      41        4099 : void AsynchronousCall::RequestCall()
      42             : {
      43        4099 :     if (mnCallId == 0)
      44             :     {
      45        3214 :         Link<> aLink (LINK(this, AsynchronousCall, HandleUserCall));
      46        3214 :         mnCallId = Application::PostUserEvent(aLink);
      47             :     }
      48        4099 : }
      49             : 
      50       18848 : void AsynchronousCall::CancelRequest()
      51             : {
      52       18848 :     if (mnCallId != 0)
      53             :     {
      54        2602 :         Application::RemoveUserEvent(mnCallId);
      55        2602 :         mnCallId = 0;
      56             :     }
      57       18848 : }
      58             : 
      59        1224 : IMPL_LINK_NOARG(AsynchronousCall, HandleUserCall )
      60             : {
      61         612 :     mnCallId = 0;
      62         612 :     if (maAction)
      63         612 :         maAction();
      64             : 
      65         612 :     return sal_IntPtr(true);
      66             : }
      67             : 
      68             : } } // end of namespace sfx2::sidebar
      69             : 
      70             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11