bump product version to 4.1.6.2
[LibreOffice.git] / sd / source / ui / tools / AsynchronousCall.cxx
blob48e63363e70e211c463c0c8ac2b3e4c94da4e0a3
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 "tools/AsynchronousCall.hxx"
23 #include "DrawViewShell.hxx"
25 namespace sd { namespace tools {
27 AsynchronousCall::AsynchronousCall (void)
28 : maTimer(),
29 mpFunction()
31 Link aCallback (LINK(this,AsynchronousCall,TimerCallback));
32 maTimer.SetTimeoutHdl(aCallback);
38 AsynchronousCall::~AsynchronousCall (void)
40 mpFunction.reset();
41 maTimer.Stop();
47 void AsynchronousCall::Post (
48 const AsynchronousFunction& rFunction,
49 sal_uInt32 nTimeoutInMilliseconds)
51 mpFunction.reset(new AsynchronousFunction(rFunction));
52 maTimer.SetTimeout(nTimeoutInMilliseconds);
53 maTimer.Start();
59 IMPL_LINK(AsynchronousCall,TimerCallback,Timer*,pTimer)
61 if (pTimer == &maTimer)
63 SAL_WNODEPRECATED_DECLARATIONS_PUSH
64 ::std::auto_ptr<AsynchronousFunction> pFunction (mpFunction);
65 SAL_WNODEPRECATED_DECLARATIONS_POP
66 mpFunction.reset();
67 (*pFunction)();
69 return 0;
73 } } // end of namespace ::sd::tools
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */