summaryrefslogtreecommitdiff
path: root/include/vcl/timer.hxx
blob: 89cc623a180e3685c65663d595dbcd272720e5d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#ifndef INCLUDED_VCL_TIMER_HXX
#define INCLUDED_VCL_TIMER_HXX

#include <tools/link.hxx>
#include <vcl/task.hxx>

class VCL_DLLPUBLIC Timer : public Task
{
    Link<Timer *, void> maInvokeHandler;   ///< Callback Link
    sal_uInt64          mnTimeout;
    const bool          mbAuto;

protected:
    virtual void SetDeletionFlags() override;
    virtual sal_uInt64 UpdateMinPeriod( sal_uInt64 nTimeNow ) const override;

    Timer( bool bAuto, const char *pDebugName );

public:
    Timer( const char *pDebugName );
    Timer( const Timer& rTimer );
    virtual ~Timer() override;
    Timer& operator=( const Timer& rTimer );

    /**
     * Calls the maInvokeHandler with the parameter this.
     */
    virtual void    Invoke() override;
    /**
     * Calls the maInvokeHandler with the parameter.
     *
     * Convenience Invoke function, mainly used to call with nullptr.
     *
     * @param arg parameter for the Link::Call function
     */
    void            Invoke( Timer *arg );
    void            SetInvokeHandler( const Link<Timer *, void>& rLink ) { maInvokeHandler = rLink; }
    void            ClearInvokeHandler() { SetInvokeHandler( Link<Timer *, void>() ); }

    void            SetTimeout( sal_uInt64 nTimeoutMs );
    sal_uInt64      GetTimeout() const { return mnTimeout; }
    virtual void Start(bool bStartTimer = true) override;
};

/// An auto-timer is a multi-shot timer re-emitting itself at
/// interval until destroyed or stopped.
class VCL_DLLPUBLIC AutoTimer : public Timer
{
public:
    AutoTimer( const char *pDebugName );
};

/// Value suitable as a timeout user input into an EditBox to an expensive update
#define EDIT_UPDATEDATA_TIMEOUT     350

#endif // INCLUDED_VCL_TIMER_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ested-by: Caolán McNamara <caolanm@redhat.com> 2018-09-10weld SvxBulletPickTabPageCaolán McNamara Change-Id: I0b3e48cc63984208c8e4a090d6630dd5325d776e Reviewed-on: https://gerrit.libreoffice.org/60257 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> 2018-04-01remove unused processfactory.hxx includesJochen Nitschke and fix fallout Change-Id: Id06bf31f2075111e426ba40c84c885ae70697bee Reviewed-on: https://gerrit.libreoffice.org/52206 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> 2018-02-28drop old tools/gen methods in reportdesign..xmloffNoel Grandin Change-Id: I398831c526ba51d861557fa6c13c0e2fb44dfbe0 Reviewed-on: https://gerrit.libreoffice.org/50447 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2018-02-27convert remaining WarningBox to weld::MessageDialogCaolán McNamara Change-Id: I7e3c156a6ad47ac232636ae274280c1cb7556d4a 2018-02-21loplugin:changetoolsgen in svxNoel Grandin and fix the regex in the plugin for matching += operator Change-Id: I26b3e3fac1d4ef3e756cc9431b983b5f27ee76d6 Reviewed-on: https://gerrit.libreoffice.org/50037 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2018-02-01tdf#42949 Remove unneeded helpids.h headers (2/3)Gabor Kelemen A side effect of the .ui migration is that we use a lot less HIDs in the code. A lot of files still contain helpids.h includes even if no actual HID is referenced. This cleans up directories r* - svx*. Found with: git grep helpids.h | cut -d : -f 1 | xargs grep -c HID_ | grep :0$ Change-Id: I81bdb80161b0207f5df651eb17c58caef44250d3 Reviewed-on: https://gerrit.libreoffice.org/46869 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> 2018-01-12More loplugin:cstylecast: svxStephan Bergmann auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I100e6c14cbf1d780f0e5ebca6b0c9e71ce1caaf7 2017-07-27loplugin:constparams in svxNoel Grandin and fix a bug in the plugin itself when calling operator's like the one on std::function<> Change-Id: I1617607107eeff06785c1841f69e13ad2926218e Reviewed-on: https://gerrit.libreoffice.org/40446 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2017-07-21de-hrc various thingsCaolán McNamara e.g. helpid[s].hrc -> helpids.h and insert include guards where missing move "ordinary" defines into .hxx files remove .hrc entries that are used as arguments to dialog factory when a dedicated method can be added instead Change-Id: I792fb8eb0adfaa63cf354e6e57401fc943e9196e 2017-07-21migrate to boost::gettextCaolán McNamara * all .ui files go from <interface> to <interface domain="MODULE"> e.g. vcl * all .src files go away and the english source strings folded into the .hrc as NC_("context", "source string") * ResMgr is dropped in favour of std::locale imbued by boost::locale::generator pointed at matching MODULE .mo files * UIConfig translations are folded into the module .mo, so e.g. UIConfig_cui goes from l10n target to normal one, so the res/lang.zips of UI files go away * translation via Translation::get(hrc-define-key, imbued-std::locale) * python can now be translated with its inbuilt gettext support (we keep the name strings.hrc there to keep finding the .hrc file uniform) so magic numbers can go away there * java and starbasic components can be translated via the pre-existing css.resource.StringResourceWithLocation mechanism * en-US res files go away, their strings are now the .hrc keys in the source code * remaining .res files are replaced by .mo files * in .res/.ui-lang-zip files, the old scheme missing translations of strings results in inserting the english original so something can be found, now the standard fallback of using the english original from the source key is used, so partial translations shrink dramatically in size * extract .hrc strings with hrcex which backs onto xgettext -C --add-comments --keyword=NC_:1c,2 --from-code=UTF-8 --no-wrap * extract .ui strings with uiex which backs onto xgettext --add-comments --no-wrap * qtz for gettext translations is generated at runtime as ascii-ified crc32 of content + "|" + msgid * [API CHANGE] remove deprecated binary .res resouce loader related uno apis com::sun::star::resource::OfficeResourceLoader com::sun::star::resource::XResourceBundleLoader com::sun::star::resource::XResourceBundle when translating strings via uno apis com.sun.star.resource.StringResourceWithLocation can continue to be used Change-Id: Ia2594a2672b7301d9c3421fdf31b6cfe7f3f8d0a 2017-05-19make string translation loading more uniformCaolán McNamara change various ResId classes that use conversion operator to OUString to functions that return a OUString drop various defines drop unnecessary toString calls Change-Id: Ibeccdf2b91a46a2ed5b4b74e6024e301a023bc92 Reviewed-on: https://gerrit.libreoffice.org/37817 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> 2017-03-31Resolves: tdf#106515 use OpenSymbol, not StarSymbol as the default bullet fontCaolán McNamara For choosing a bullet from a real font it matters while otherwise its a synonym. Of course we have this code duplicated three times. Change-Id: I2428b9a23d997925de3e731b8afe9fb8cf18ed54 2017-03-31tdf#82580 tools: rename Rectangle to tools::RectangleMiklos Vajna Mostly generated using make check COMPILER_EXTERNAL_TOOL=1 CCACHE_PREFIX=clang-rename-wrapper RENAME_ARGS="-qualified-name=Rectangle -new-name=tools::Rectangle" Except some modules have their own foo::tools namespace, so there have to use ::tools::Rectangle. This commit just moves the class from the global namespace, it does not update pre/postwin.h yet. Change-Id: I42b2de3c6f769fcf28cfe086f98eb31e42a305f2 Reviewed-on: https://gerrit.libreoffice.org/35923 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> 2017-01-23Change all Idle* LINKs to be Timer*Jan-Marek Glogowski Seem UBSAN doesn't like my forced reinterpret_cast to set the Idles Link in the Timer class. Now there are two possible solution: 1. convert all (DECL|IMPL).*_LINK call sites to use a Timer* or 2. split the inheritance of Idle from Timer again to maintain different Link<>s and move all common code into a TimerBase. While the 1st is more correct, the 2nd has a better indicator for Idles. This implements the first solution. And while at it, this also converts all call sites of SetTimeoutHdl and SetIdleHdl to SetInvokeHandler and gets rid of some local Link objects, which are just passed to the SetInvokeHandler call. It also introduces ClearInvokeHandler() and replaces the respective call sites of SetInvokeHandler( Link<Timer *, void>() ). Change-Id: I40c4167b1493997b7f136add4dad2f4ff5504b69 2017-01-17Refactor Scheduler to add Task classJan-Marek Glogowski Moves all the "task-specific" stuff into a Task class and just keeps the "real" static Scheduler functions in the original Scheduler class. Change-Id: I9eb02d46e2bcf1abb06af5bab1fa0ee734d1984c 2016-10-31loplugin:oncevar in svl..svxNoel Grandin Change-Id: I80b11a7b698de4b84d7a2f4c7dc62b2e4fd8bb01 Reviewed-on: https://gerrit.libreoffice.org/30438 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> 2016-10-05Remove _TYPED suffix from tools/link.hxx macrosStephan Bergmann ...which was introduced with 3ead3ad52f9bb2f9d1d6cf8dfc73a0a25e6778ed "Gradually typed Link" to distinguish the new, typed versions from the old, untyped ones, but is no longer necessary since 382eb1a23c390154619c385414bdbe6f6e461173 "remove untyped Link<>" removed the old versions. Change-Id: I494025df486a16a45861fcd8192dfe0275b1103c 2016-06-28loplugin:singlevalfields in svxNoel Grandin Change-Id: I7a2d11e1343f6382c3556c4536fc8ae40e210b74 Reviewed-on: https://gerrit.libreoffice.org/26710 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>