1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #ifndef INCLUDED_SVTOOLS_FILECHANGEDCHECKER_HXX
11 #define INCLUDED_SVTOOLS_FILECHANGEDCHECKER_HXX
13 #include <svtools/svtdllapi.h>
15 #include <osl/file.hxx>
16 #include <vcl/timer.hxx>
17 #include <vcl/idle.hxx>
21 /** Periodically checks if a file has been modified
23 Instances of this class setup a vcl timer to occasionally wake up
24 check whether file modification time has changed.
26 class SVT_DLLPUBLIC FileChangedChecker
30 OUString
const mFileName
;
31 TimeValue mLastModTime
;
32 ::std::function
<void ()> const mpCallback
;
34 bool SVT_DLLPRIVATE
getCurrentModTime(TimeValue
& o_rValue
) const;
35 DECL_LINK(TimerHandler
, Timer
*, void);
39 bool hasFileChanged();
40 FileChangedChecker(const OUString
& rFilename
,
41 const ::std::function
<void ()>& rCallback
);