Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/vcl/svapp.hxx
Line
Count
Source
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
20
#ifndef INCLUDED_VCL_SVAPP_HXX
21
#define INCLUDED_VCL_SVAPP_HXX
22
23
#include <sal/config.h>
24
#include <sal/types.h>
25
26
#include <cassert>
27
#include <vector>
28
29
#include <comphelper/solarmutex.hxx>
30
#include <LibreOfficeKit/LibreOfficeKitTypes.h>
31
#include <osl/mutex.hxx>
32
#include <rtl/ustring.hxx>
33
#include <osl/thread.h>
34
#include <tools/link.hxx>
35
#include <tools/long.hxx>
36
#include <vcl/dllapi.h>
37
#include <vcl/IDialogRenderable.hxx>
38
#include <vcl/Platform.hxx>
39
#include <vcl/Toolkit.hxx>
40
#include <vcl/inputtypes.hxx>
41
#include <i18nlangtag/lang.h>
42
#include <o3tl/typed_flags_set.hxx>
43
44
class AbsoluteScreenPixelRectangle;
45
class Bitmap;
46
namespace tools { class JsonWriter; }
47
namespace weld
48
{
49
    class Builder;
50
    class MessageDialog;
51
    class Widget;
52
    class Window;
53
}
54
class LocaleDataWrapper;
55
class AllSettings;
56
class DataChangedEvent;
57
class Accelerator;
58
class Help;
59
class OutputDevice;
60
namespace vcl {
61
    class KeyCode;
62
    class Window;
63
}
64
65
class NotifyEvent;
66
class KeyEvent;
67
class MouseEvent;
68
class GestureEventPan;
69
class VclSimpleEvent;
70
class VclWindowEvent;
71
struct ImplSVEvent;
72
struct ConvertData;
73
namespace basegfx { class SystemDependentDataManager; }
74
namespace rtl { template <class reference_type> class Reference; }
75
76
enum class DesktopType;
77
enum class ExceptionCategory;
78
enum class VclButtonsType;
79
enum class VclEventId;
80
enum class VclMessageType;
81
82
namespace com::sun::star::uno {
83
    template <class interface_type> class Reference;
84
    class XComponentContext;
85
}
86
namespace com::sun::star::ui::dialogs {
87
    class XFilePicker2;
88
    class XFolderPicker2;
89
}
90
namespace com::sun::star::awt {
91
    class XToolkit;
92
    class XWindow;
93
}
94
95
VCL_DLLPUBLIC OUString LocalizeDigitsInString( const OUString&, LanguageType,
96
                                               sal_Int32 nStart, sal_Int32& nLen );
97
inline OUString LocalizeDigitsInString( const OUString& sStr, LanguageType eTextLanguage )
98
0
{
99
0
    sal_Int32 nLen = sStr.getLength();
100
0
    return LocalizeDigitsInString(sStr, eTextLanguage, 0, nLen);
101
0
}
102
103
enum class SystemWindowFlags {
104
    NOAUTOMODE    = 0x0001,
105
    DIALOG        = 0x0002
106
};
107
namespace o3tl
108
{
109
    template<> struct typed_flags<SystemWindowFlags> : is_typed_flags<SystemWindowFlags, 0x03> {};
110
}
111
112
typedef long (*VCLEventHookProc)( NotifyEvent& rEvt, void* pData );
113
114
/** An application can be notified of a number of different events:
115
    - Type::Accept       - listen for connection to the application (a connection
116
                          string is passed via the event)
117
    - Type::Unaccept     - stops listening for a connection to the app (determined by
118
                          a connection string passed via the event)
119
    - Type::Appear       - brings the app to the front (i.e. makes it "appear")
120
    - Type::Version      - display the app version
121
    - Type::Help         - opens a help topic (help topic passed as string)
122
    - Type::OpenHELP_URL - opens a help URL (URL passed as a string)
123
    - Type::ShowDialog   - shows a dialog (dialog passed as a string)
124
    - Type::Open         - opens a document or group of documents (documents passed
125
                          as an array of strings)
126
    - Type::Print        - print a document or group of documents (documents passed
127
                          as an array of strings
128
    - Type::PrivateDoShutdown - shutdown the app
129
*/
130
131
class VCL_DLLPUBLIC ApplicationEvent
132
{
133
public:
134
    enum class Type {
135
        Accept,                ///< Listen for connections
136
        Appear,                ///< Make application appear
137
        Open,                  ///< Open a document
138
        OpenHelpUrl,           ///< Open a help URL
139
        Print,                 ///< Print document
140
        PrivateDoShutdown,    ///< Shutdown application
141
        QuickStart,            ///< Start QuickStart
142
        ShowDialog,            ///< Show a dialog
143
        Unaccept               ///< Stop listening for connections
144
    };
145
146
    /** Explicit constructor for ApplicationEvent.
147
148
     @attention Type::Appear, Type::PrivateDoShutdown and
149
        Type::QuickStart are the \em only events that don't need to include
150
        a data string with the event. No other events should use this
151
        constructor!
152
    */
153
    explicit ApplicationEvent(Type type): aEvent(type)
154
0
    {
155
0
        assert(type == Type::Appear || type == Type::PrivateDoShutdown || type == Type::QuickStart);
156
0
    }
157
158
    /** Constructor for ApplicationEvent, accepts a string for the data
159
     associated with the event.
160
161
     @attention Type::Accept, Type::OpenHelpUrl, Type::ShowDialog
162
        and Type::Unaccept are the \em only events that accept a single
163
        string as event data. No other events should use this constructor!
164
    */
165
    ApplicationEvent(Type type, OUString const & data): aEvent(type)
166
0
    {
167
0
        assert(
168
0
            type == Type::Accept || type == Type::OpenHelpUrl
169
0
            || type == Type::ShowDialog || type == Type::Unaccept);
170
0
        aData.push_back(data);
171
0
    }
172
173
    /** Constructor for ApplicationEvent, accepts an array of strings for
174
     the data associated with the event.
175
176
     @attention Type::Open and Type::Print can apply to multiple documents,
177
        and are the \em only events that accept an array of strings. No other
178
        events should use this constructor.
179
    */
180
    ApplicationEvent(Type type, std::vector<OUString>&& data):
181
        aEvent(type), aData(std::move(data))
182
0
    {
183
0
        assert(type == Type::Open || type == Type::Print);
184
0
    }
185
186
    /** Get the type of event.
187
188
     @returns The type of event.
189
    */
190
    Type GetEvent() const
191
0
    {
192
0
        return aEvent;
193
0
    }
194
195
    /** Gets the application event's data string.
196
197
     @attention The \em only events that need a single string Type::Accept,
198
        Type::OpenHelpUrl, Type::ShowDialog and Type::Unaccept
199
200
     @returns The event's data string.
201
    */
202
    OUString const & GetStringData() const
203
0
    {
204
0
        assert(
205
0
            aEvent == Type::Accept
206
0
            || aEvent == Type::OpenHelpUrl || aEvent == Type::ShowDialog
207
0
            || aEvent == Type::Unaccept);
208
0
        assert(aData.size() == 1);
209
0
        return aData[0];
210
0
    }
211
212
    /** Gets the event's array of strings.
213
214
     @attention The \em only events that need an array of strings
215
        are Type::Open and Type::Print.
216
    */
217
    std::vector<OUString> const & GetStringsData() const
218
0
    {
219
0
        assert(aEvent == Type::Open || aEvent == Type::Print);
220
0
        return aData;
221
0
    }
222
223
private:
224
    Type aEvent;
225
    std::vector<OUString> aData;
226
};
227
228
enum class DialogCancelMode {
229
    Off,      ///< do not automatically cancel dialogs
230
    Silent,   ///< silently cancel any dialogs
231
    LOKSilent, ///< silently cancel any dialogs (LOK case)
232
    Fatal     ///< cancel any dialogs by std::abort
233
};
234
235
/**
236
 @brief Base class used mainly for the LibreOffice Desktop class.
237
238
 The Application class is a base class mainly used by the Desktop
239
 class. It is really meant to be subclassed, and the Main() function
240
 should be overridden. Many of the ImplSVData members should be
241
 moved to this class.
242
243
 The reason Application exists is because the VCL used to be a
244
 standalone framework, long since abandoned by anything other than
245
 our application.
246
247
 @see   Desktop, ImplSVData
248
 */
249
class VCL_DLLPUBLIC Application : public vcl::ILibreOfficeKitNotifier
250
{
251
public:
252
    /** @name Initialization
253
        The following functions perform initialization and deinitialization
254
        of the application.
255
    */
256
    ///@{
257
258
    /** Default constructor for Application class.
259
260
    Initializes the LibreOffice global instance data structure if needed,
261
    and then sets itself to be the Application class. Also initializes any
262
    platform specific data structures.
263
264
    @attention The initialization of the application itself is done in Init()
265
    */
266
                                Application();
267
268
    /** Virtual destructor for Application class.
269
270
     Deinitializes the LibreOffice global instance data structure, then
271
     deinitializes any platform specific data structures.
272
    */
273
    virtual                     ~Application();
274
275
    /** Initialize the application itself.
276
277
     @attention Note that the global data structures and platform specific
278
        initialization is done in the constructor.
279
280
     @see InitFinished, DeInit
281
    */
282
    virtual void                Init();
283
284
    /** Finish initialization of the application.
285
286
     @see Init, DeInit
287
    */
288
    virtual void                InitFinished();
289
290
    /** Deinitialized the application itself.
291
292
     @attention Note that the global data structures and platform specific
293
         deinitialization is done in the destructor.
294
295
     @see Init, InitFinished
296
    */
297
    virtual void                DeInit();
298
299
    ///@}
300
301
    /** @brief Pure virtual entrypoint to the application.
302
303
     Main() is the pure virtual entrypoint to your application. You
304
     inherit your class from Application and subclass this function to
305
     implement an application.
306
307
     The Main() function does not pass in command line parameters,
308
     you must use the functions GetCommandLineParamCount() and
309
     GetCommandLineParam() to get these values as these are platform
310
     independent ways of getting the command line (use GetAppFileName()
311
     to get the invoked executable filename).
312
313
     Once in this function, you create windows, etc. then call on
314
     Execute() to start the application's main event loop.
315
316
     An example code snippet follows (it won't compile, this just gives the
317
     general flavour of the framework and is adapted from an old HelloWorld
318
     example program that Star Division used to provide as part of their
319
     library).
320
321
     \code{.cpp}
322
        class TheApplication : public Application
323
        {
324
            public:
325
                virtual void Main();
326
        };
327
328
        class TheWindow : public WorkWindow
329
        {
330
            public:
331
                TheWindow(vcl::Window *parent, WinBits windowStyle) :
332
                        WorkWindow(parent, windowStyle) {}
333
334
                virtual void Paint(const Rectangle &);
335
        };
336
337
        void TheWindow::Paint(const Rectangle&)
338
        {
339
                DrawText(Point(100,100), String("Hello World!"));
340
        }
341
342
        void TheApplication::Main()
343
        {
344
                TheWindow aWindow(NULL, WB_APP | WB_STDWORK);
345
                    aWindow.Show();
346
                        Execute();
347
        }
348
349
        TheApplication anApplication;
350
    \endcode
351
352
    Some examples in the source tree can be found here:
353
354
    vcl/workben/svdem.cxx
355
356
    This is an example of how to use the Application and WorkWindow. Unfortunately, it
357
    no longer compiles.
358
359
    vcl/fpicker/test/svdem.cxx
360
    */
361
    SAL_DLLPRIVATE virtual int  Main();
362
363
    /** Exit from the application
364
365
     @returns true if exited successfully, false if not able to fully exit
366
    */
367
    virtual bool                QueryExit();
368
369
    virtual void                Shutdown();
370
371
    /** @name Change Notification Functions
372
373
        Functions that notify when changes occur in the application.
374
    */
375
    ///@{
376
377
    /** Notify all windows that the application has changed data.
378
379
     @param rDCEvt     Reference to a DataChangedEvent object
380
381
     @see DataChanged
382
    */
383
    static void                 NotifyAllWindows( DataChangedEvent& rDCEvt );
384
385
    ///@}
386
387
    /** @name Command Line Processing
388
389
        Command line processing is done via the following functions. They
390
        give the number of parameters, the parameters themselves and a way
391
        to get the name of the invoking application.
392
    */
393
394
    ///@{
395
396
    /** Gets the number of command line parameters passed to the application
397
398
     @return sal_uInt16 - the number of parameters
399
400
     @see GetCommandLineParam, GetAppFileName
401
    */
402
    static sal_uInt16           GetCommandLineParamCount();
403
404
    /** Gets a particular command line parameter
405
406
     @param  nParam      The index of the parameter to return.
407
408
     @return The command line parameter as an OUString
409
410
     @see GetCommandLineParamCount, GetAppFileName
411
    */
412
    static OUString             GetCommandLineParam( sal_uInt16 nParam );
413
414
    /** Get the name of the file used to start the application
415
416
     @return The filename as an OUString
417
418
     @see GetCommandLineParamCount, GetCommandLineParam
419
    */
420
    static OUString             GetAppFileName();
421
422
    ///@}
423
424
    /** @name Error Handling
425
426
        \em Very rudimentary error handling is done by these
427
        functions.
428
429
        @{
430
    */
431
432
    /** Handles an error.
433
434
     @param nCategory    The error category, see include/vcl/exceptiontypes.hxx
435
436
     @see Abort
437
    */
438
    virtual void          Exception( ExceptionCategory nCategory );
439
440
    /** Ends the program prematurely with an error message.
441
442
     If the \code --norestore \endcode command line argument is given (assuming
443
     this process is run by developers who are interested in cores,
444
     vs. end users who are not) then it does a coredump.
445
446
     @param rErrorText  The error message to report.
447
448
     @see Exception
449
    */
450
    static void                 Abort( const OUString& rErrorText );
451
452
    ///@}
453
454
    /** @name Event Loop Functions
455
456
        Functions that handle the LibreOffice main event loop are here,
457
        including a global lock called the Solar Mutex.
458
    */
459
    ///@{
460
461
    /** Run the main event processing loop until it is quit by Quit().
462
463
     @see Quit, Reschedule, Yield, EndYield, GetSolarMutex,
464
          IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
465
    */
466
    static void                 Execute();
467
468
    /** Quit the program
469
470
     @see Execute, Reschedule, Yield, EndYield, GetSolarMutex,
471
          IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
472
    */
473
    static void                 Quit();
474
475
    /** Has Quit() been called?
476
    */
477
    static bool                 IsQuit();
478
479
    /** Attempt to process current pending event(s)
480
481
     It doesn't sleep if no events are available for processing.
482
     This doesn't process any events generated after invoking the function.
483
     So in contrast to Scheduler::ProcessEventsToIdle, this cannot become
484
     busy-locked by an event-generating event in the event queue.
485
486
     @param bHandleAllCurrentEvents  If set to true, then try to process all
487
        the current events. If set to false, then only process one event.
488
        Defaults to false.
489
490
     @returns true if any event was processed.
491
492
     @see Yield, Scheduler::ProcessEventsToIdle
493
     */
494
    static bool                 Reschedule( bool bHandleAllCurrentEvents = false );
495
496
    /** Process the next event.
497
498
     It sleeps if no event is available for processing and just returns
499
     if an event was processed.
500
501
     @see Execute, Quit, Reschedule, EndYield, GetSolarMutex,
502
          IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
503
    */
504
    static void                 Yield();
505
506
    /**
507
508
     @see Execute, Quit, Reschedule, Yield, GetSolarMutex,
509
          IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
510
    */
511
    static void                 EndYield();
512
513
    /** @brief Get the Solar Mutex for this thread.
514
515
     Get the Solar Mutex that prevents other threads from accessing VCL
516
     concurrently.
517
518
     @returns SolarMutex reference
519
520
     @see Execute, Quit, Reschedule, Yield, EndYield,
521
          IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
522
    */
523
    static comphelper::SolarMutex& GetSolarMutex();
524
525
    /** Queries whether we are in main thread.
526
527
     @returns true if we are in main thread, false if not
528
529
     @see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
530
          ReleaseSolarMutex, AcquireSolarMutex,
531
    */
532
    static bool                 IsMainThread();
533
534
    /** @brief Release Solar Mutex(es) for this thread
535
536
     Release the Solar Mutex(es) that prevents other threads from accessing
537
     VCL concurrently.
538
539
     @returns The number of mutexes that were acquired by this thread.
540
541
     @see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
542
          IsMainThread, AcquireSolarMutex,
543
    */
544
    static sal_uInt32           ReleaseSolarMutex();
545
546
    /** @brief Acquire Solar Mutex(es) for this thread.
547
548
     Acquire the Solar Mutex(es) that prevents other threads from accessing
549
     VCL concurrently.
550
551
     @see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
552
          IsMainThread, ReleaseSolarMutex,
553
    */
554
    static void                 AcquireSolarMutex( sal_uInt32 nCount );
555
556
    /** Queries whether the application is in "main", i.e. not yet in
557
        the event loop
558
559
     @returns   true if in main, false if not in main
560
561
     @see IsInExecute, IsInModalMode
562
    */
563
    static bool                 IsInMain();
564
565
    /** Queries whether the application is in the event loop
566
567
     @returns   true if in the event loop, false if not
568
569
     @see IsInMain, IsInModalMode
570
    */
571
    static bool                 IsInExecute();
572
573
    /** Queries whether application has a modal dialog active.
574
575
     @returns   true if a modal dialog is active, false if not
576
577
     @see IsInMain, IsInExecute
578
    */
579
    static bool                 IsInModalMode();
580
581
    /** Return how many events are being dispatched.
582
583
     @returns   the number of events currently being dispatched
584
    */
585
    static sal_uInt16           GetDispatchLevel();
586
587
    /** Determine if there are any pending input events.
588
589
     @param     nType   input identifier, defined in include/vcl/inputtypes.hxx
590
                        The default is VCL_INPUT_ANY.
591
592
     @returns   true if there are pending events, false if not.
593
594
     @see GetLastInputInterval
595
    */
596
    static bool                 AnyInput( VclInputFlags nType = VCL_INPUT_ANY );
597
598
    /** The interval from the last time that input was received.
599
600
     @returns   system ticks - last input time
601
602
     @see AnyInput
603
    */
604
    static sal_uInt64           GetLastInputInterval();
605
606
    ///@}
607
608
    /* Determines if the UI is captured.
609
610
     The UI is considered captured if a system dialog is open (e.g. printer setup),
611
     a floating window, menu or toolbox dropdown is open, or a window has been
612
     captured by the mouse.
613
614
     @returns   true if UI is captured, false if not
615
     */
616
    static bool                 IsUICaptured();
617
618
    /** @name Settings
619
620
        The following functions set system settings (e.g. tab color, etc.). There are functions
621
        that set settings objects, and functions that set and get the actual system settings for
622
        the application.
623
    */
624
    ///@{
625
626
    /** Sets user settings in settings object to override system settings
627
628
     The system settings that can be overridden are:
629
        - window dragging options (on or off, including live scrolling!)
630
        - style settings (e.g. checkbox color, border color, 3D colors,
631
          button rollover colors, etc.)
632
        - mouse settings
633
        - menu options, including the mouse follows the menu and whether menu
634
          icons are used
635
636
     @param      rSettings      Reference to the settings object to change.
637
638
     @see MergeSystemSettings, SetSettings, GetSettings
639
    */
640
    virtual void                OverrideSystemSettings( AllSettings& rSettings );
641
642
    /** Set the settings object to the platform/desktop environment system
643
     settings.
644
645
     @param     rSettings       Reference to the settings object to change.
646
647
     @see OverrideSystemSettings, SetSettings, GetSettings
648
    */
649
    static void                 MergeSystemSettings( AllSettings& rSettings );
650
651
    /** Sets the application's settings and notifies all windows of the
652
     change.
653
654
     @param     rSettings       const reference to settings object used to
655
                                change the application's settings.
656
657
     @param     bTemporary      this is a temporary change (used in GraphicExporter::filter),
658
                                do not notify change listeners
659
660
     @see OverrideSystemSettings, MergeSystemSettings, GetSettings
661
    */
662
    static void                 SetSettings( const AllSettings& rSettings, bool bTemporary = false );
663
664
    /** Gets the application's settings. If the application hasn't initialized
665
     it's settings, then it does so (lazy initialization).
666
667
     @returns AllSettings instance that contains the current settings of the
668
        application.
669
670
     @see OverrideSystemSettings, MergeSystemSettings, SetSettings
671
    */
672
    static const AllSettings&   GetSettings();
673
674
    /** Get the application's locale data wrapper.
675
676
     @returns reference to a LocaleDataWrapper object
677
    */
678
    SAL_DLLPRIVATE static const LocaleDataWrapper& GetAppLocaleDataWrapper();
679
680
    ///@}
681
682
    /** @name Event Listeners/Handlers
683
684
        A set of event listeners and callers. Note that in this code there is
685
        platform specific functions - namely for zoom and scroll events.
686
    */
687
    ///@{
688
689
690
    /** Add a VCL event listener to the application. If no event listener exists,
691
     then initialize the application's event listener with a new one, then add
692
     the event listener.
693
694
     @param     rEventListener  Const reference to the event listener to add.
695
696
     @see RemoveEventListener, AddKeyListener, RemoveKeyListener
697
    */
698
    static void                 AddEventListener( const Link<VclSimpleEvent&,void>& rEventListener );
699
700
    /** Remove a VCL event listener from the application.
701
702
     @param     rEventListener  Const reference to the event listener to be removed
703
704
     @see AddEventListener, AddKeyListener, RemoveKeyListener
705
    */
706
    static void                 RemoveEventListener( const Link<VclSimpleEvent&,void>& rEventListener );
707
708
    /** Add a keypress listener to the application. If keypress listener exists,
709
     then initialize the application's keypress event listener with a new one, then
710
     add the keypress listener.
711
712
     @param     rKeyListener    Const reference to the keypress event listener to add
713
714
     @see AddEventListener, RemoveEventListener, RemoveKeyListener
715
    */
716
    static void                 AddKeyListener( const Link<VclWindowEvent&,bool>& rKeyListener );
717
718
    /** Remove a keypress listener from the application.
719
720
     @param     rKeyListener    Const reference to the keypress event listener to be removed
721
722
     @see AddEventListener, RemoveEventListener, AddKeyListener
723
    */
724
    static void                 RemoveKeyListener( const Link<VclWindowEvent&,bool>& rKeyListener );
725
726
    /** Send event to all VCL application event listeners
727
728
     @param     pWin            Pointer to window to send event
729
     @param     pData           Pointer to data to send with event
730
731
     @see ImplCallEventListeners(VclSimpleEvent* pEvent)
732
    */
733
    SAL_DLLPRIVATE static void  ImplCallEventListenersApplicationDataChanged( void* pData );
734
735
    /** Send event to all VCL application event listeners
736
737
     @param     rEvent          Reference to VclSimpleEvent
738
739
     @see ImplCallEventListeners(sal_uLong nEvent, Windows* pWin, void* pData);
740
    */
741
    SAL_DLLPRIVATE static void  ImplCallEventListeners( VclSimpleEvent& rEvent );
742
743
    /** Handle keypress event
744
745
     @param     nEvent          Event ID for keypress
746
     @param     pWin            Pointer to window that receives the event
747
     @param     pKeyEvent       Received key event
748
749
     @see PostKeyEvent
750
    */
751
    SAL_DLLPRIVATE static bool HandleKey( VclEventId nEvent, vcl::Window *pWin, KeyEvent* pKeyEvent );
752
753
    /** Send keypress event
754
755
     @param     nEvent          Event ID for keypress
756
     @param     pWin            Pointer to window to which the event is sent
757
     @param     pKeyEvent       Key event to send
758
759
     @see HandleKey
760
    */
761
    static ImplSVEvent *        PostKeyEvent( VclEventId nEvent, vcl::Window *pWin, KeyEvent const * pKeyEvent );
762
763
764
    static bool                 LOKHandleMouseEvent( VclEventId nEvent, vcl::Window *pWin, const MouseEvent* pEvent );
765
766
    /** Send mouse event
767
768
     @param     nEvent          Event ID for mouse event
769
     @param     pWin            Pointer to window to which the event is sent
770
     @param     pMouseEvent     Mouse event to send
771
    */
772
    static ImplSVEvent *        PostMouseEvent( VclEventId nEvent, vcl::Window *pWin, MouseEvent const * pMouseEvent );
773
774
    static ImplSVEvent* PostGestureEvent(VclEventId nEvent, vcl::Window* pWin,
775
                                         GestureEventPan const * pGestureEvent);
776
777
    /** Remove mouse and keypress events from a window... any also zoom and scroll events
778
     if the platform supports it.
779
780
     @param     pWin            Window to remove events from
781
782
     @see HandleKey, PostKeyEvent, PostMouseEvent
783
    */
784
    static void                 RemoveMouseAndKeyEvents( vcl::Window *pWin );
785
786
    /** Post a user event to the default window.
787
788
     User events allow for the deferral of work to later in the main-loop - at idle.
789
790
     Execution of the deferred work is thread-safe which means all the tasks are executed
791
     serially, so no thread-safety locks between tasks are necessary.
792
793
     @param     rLink           Link to event callback function
794
     @param     pCaller         Pointer to data sent to the event by the caller. Optional.
795
     @param     bReferenceLink  If true - hold a VclPtr<> reference on the Link's instance.
796
                                Taking the reference is guarded by a SolarMutexGuard.
797
798
     @return the event ID used to post the event.
799
    */
800
    static ImplSVEvent * PostUserEvent( const Link<void*,void>& rLink, void* pCaller = nullptr,
801
                                        bool bReferenceLink = false );
802
803
    /** Remove user event based on event ID
804
805
     @param     nUserEvent      User event to remove
806
    */
807
    static void                 RemoveUserEvent( ImplSVEvent * nUserEvent );
808
809
    /** @deprecated AppEvent is used only in the Desktop class now. However, it is
810
     intended to notify the application that an event has occurred. It was in oldsv.cxx,
811
     but is still needed by a number of functions.
812
813
     @param     rAppEvent       const reference to ApplicationEvent event
814
    */
815
    virtual void                AppEvent( const ApplicationEvent& rAppEvent );
816
817
    ///@}
818
819
    /** @name Application Window Functions
820
821
        Functions that deal with the application's windows
822
    */
823
    ///@{
824
825
    /** Get the currently focused window.
826
827
     @returns Pointer to focused window.
828
829
     @see GetDefaultDevice
830
    */
831
    static vcl::Window*              GetFocusWindow();
832
833
    /** Get the default "device" (in this case the default window).
834
835
     @returns Pointer to an OutputDevice. However, it is a Window object -
836
             Window class subclasses OutputDevice.
837
838
     @see GetFocusWindow
839
    */
840
    static OutputDevice*        GetDefaultDevice();
841
842
    /** access the DataManager for buffering system-dependent data
843
844
     @returns the global instance of the SystemDependentDataManager
845
    */
846
    static basegfx::SystemDependentDataManager& GetSystemDependentDataManager();
847
848
    /** Get the first top-level window of the application.
849
850
     @returns Pointer to top-level window (a Window object)
851
852
     @see GetNextTopLevelWindow, GetTopWindowCount, GetTopWindow,
853
          GetActiveTopWindow
854
    */
855
    static vcl::Window*              GetFirstTopLevelWindow();
856
857
    /** Get the next top level window.
858
859
     @param     pWindow     Pointer to Window object you wish to get the next
860
                            window from.
861
862
     @returns Pointer to next top window.
863
    */
864
    static vcl::Window*              GetNextTopLevelWindow( vcl::Window const * pWindow );
865
866
    /** Return the number of top-level windows being used by the application
867
868
     @returns the number of top-level windows
869
870
     @see GetFirstTopLevelWindow, GetNextTopLevelWindow, GetTopWindow,
871
          GetActiveTopWindow
872
873
    */
874
    static tools::Long                 GetTopWindowCount();
875
876
    /** Get the nth top window.
877
878
     @remark Top windows are actually implemented in a one-way linked list.
879
         This iterates through top level windows n times.
880
881
     @param    nIndex      The index of the top-level window
882
883
     @returns The nth top-level window of the application
884
885
     @see GetFirstTopLevelWindow, GetNextTopLevelWindow, GetTopWindowCount,
886
          GetActiveTopWindow
887
    */
888
    static vcl::Window*              GetTopWindow( tools::Long nIndex );
889
890
    /** Get the "active" top window.
891
892
     An "active" top window is one that has a child window that has the
893
     application's focus.
894
895
     @returns the active top window
896
897
     @see GetFirstTopLevelWindow, GetNextTopLevelWindow, GetTopWindowCount,
898
          GetTopWindow
899
    */
900
    static vcl::Window*              GetActiveTopWindow();
901
902
    ///@}
903
904
    /** Set the application's name.
905
906
     @param     rUniqueName     What to set the application name to
907
908
     @see       GetAppName
909
    */
910
    static void                 SetAppName( const OUString& rUniqueName );
911
912
913
    /** @name Application Name, Branding
914
    */
915
    ///@{
916
917
    /** Get the application's name.
918
919
     @returns The application name.
920
    */
921
    static const OUString &     GetAppName();
922
923
    /**
924
     * Get the OS version based on the OS specific implementation.
925
     *
926
     * @return OUString version string or "-" in case of problems
927
     */
928
    static OUString             GetOSVersion();
929
930
    /** Get useful OS, Hardware and configuration information,
931
     * cf. Help->About, and User-Agent
932
     * bSelection = 0 to return all info, 1 for environment only,
933
     *   and 2 for VCL/render related infos
934
     */
935
    static OUString             GetHWOSConfInfo(const int bSelection = 0, bool bLocalize = true);
936
937
    /** Load a localized branding PNG file as a bitmap.
938
939
     @param     pName           Name of the bitmap to load.
940
     @param     rBitmap         Reference to Bitmap object to load PNG into
941
942
     @returns true if the PNG could be loaded, otherwise returns false.
943
    */
944
    static bool                 LoadBrandBitmap (std::u16string_view pName, Bitmap& rBitmap);
945
946
    ///@}
947
948
    /** @name Display and Screen
949
    */
950
    ///@{
951
952
    /** Set the default name of the application for message dialogs and printing.
953
954
     @param     rDisplayName    const reference to string to set the Display name to.
955
956
     @see GetDisplayName
957
    */
958
    static void                 SetDisplayName( const OUString& rDisplayName );
959
960
    /** Get the default name of the application for message dialogs and printing.
961
962
     @returns The display name of the application.
963
    */
964
    static OUString             GetDisplayName();
965
966
    /** Get the platform. */
967
    static Platform GetPlatform();
968
969
    /** Get the toolkit. */
970
    static Toolkit GetToolkit();
971
972
    /** Get the toolkit's name. e.g. gtk3
973
974
     @returns The toolkit name.
975
    */
976
    static OUString GetToolkitName();
977
978
    /** Get the number of screens available for the display.
979
980
     @returns The number of screens available.
981
982
     @see GetScreenPosSizePixel
983
    */
984
    static unsigned int         GetScreenCount();
985
986
    /** Get a screen's rectangular area.
987
988
     @param     nScreen         The number of the screen requested.
989
990
     @returns The area of the screen in a Rectangle object.
991
992
     @see GetScreenCount
993
    */
994
    static AbsoluteScreenPixelRectangle GetScreenPosSizePixel( unsigned int nScreen );
995
996
    /** Get the "best" screen.
997
998
     @returns the return value will be nearest screen of the target rectangle.
999
    */
1000
    SAL_DLLPRIVATE static unsigned int GetBestScreen( const AbsoluteScreenPixelRectangle& );
1001
1002
    /** Get the built-in screen.
1003
1004
     @return
1005
       This returns the LCD screen number for a laptop, or the primary
1006
       external VGA display for a desktop machine - it is where a presenter
1007
       console should be rendered if there are other (non-built-in) screens
1008
       present.
1009
1010
     @see IsUnifiedDisplay, GetBestScreen
1011
    */
1012
    static unsigned int         GetDisplayBuiltInScreen();
1013
1014
    /** Get the display's external screen.
1015
1016
     Practically, this means - Get the screen we should run a presentation on.
1017
1018
     @returns 0 or 1 currently, will fallback to the first available screen if
1019
        there are more than one external screens. May be changed in the future.
1020
    */
1021
    static unsigned int         GetDisplayExternalScreen();
1022
1023
    ///@}
1024
1025
    /** @name Accelerators and Mnemonics
1026
1027
     Accelerators allow a user to hold down Ctrl+key (or CMD+key on macOS)
1028
     combination to gain quick access to functionality.
1029
1030
     Mnemonics are underline letters in things like menus and dialog boxes
1031
     that allow a user to type in the letter to activate the menu or option.
1032
    */
1033
    ///@{
1034
1035
    /** Insert accelerator
1036
1037
     @param     pAccel          Pointer to an Accelerator object to insert
1038
1039
     @returns true if successful, false if otherwise
1040
1041
     @see RemoveAccel
1042
    */
1043
    SAL_DLLPRIVATE static bool  InsertAccel( Accelerator* pAccel );
1044
1045
    /** Remove accelerator
1046
1047
     @param     pAccel          Pointer to Accelerator object to remove
1048
1049
     @see InsertAccel
1050
    */
1051
    SAL_DLLPRIVATE static void  RemoveAccel( Accelerator const * pAccel );
1052
1053
    /** Get the number of reserved key codes used by the application.
1054
1055
     @returns number of reserved key codes
1056
1057
     @see GetReservedKeyCode
1058
    */
1059
    static size_t               GetReservedKeyCodeCount();
1060
1061
    /** Get the reserved key code.
1062
1063
     @param     i               The keycode number to retrieve
1064
1065
     @returns Const pointer to a KeyCode object
1066
1067
     @see GetReservedKeyCodeCount
1068
    */
1069
    static const vcl::KeyCode*  GetReservedKeyCode( size_t i );
1070
1071
    ///@}
1072
1073
    /** @name Application Help
1074
1075
     Deals with the help system, and "auto-help", where a user hovers a mouse above
1076
     a UI element and a tooltip with an explanation pops up.
1077
    */
1078
    ///@{
1079
1080
    /** Sets up help
1081
1082
     @param     pHelp           Pointer to a Help object (optional, can by NULL)
1083
1084
     @see GetHelp
1085
    */
1086
    static void                 SetHelp( Help* pHelp = nullptr );
1087
1088
    /** Gets the application's help
1089
1090
     @returns Pointer to application's help object. Note that the application may
1091
        not have a help object, so it might return NULL.
1092
1093
     @see SetHelp
1094
    */
1095
    static Help*                GetHelp();
1096
1097
    ///@}
1098
1099
    /** @name Dialogs
1100
1101
        @remark "Dialog cancel mode" tells a headless install whether to
1102
                cancel dialogs when they appear. See the DialogCancelMode
1103
                enumerator.
1104
    */
1105
    ///@{
1106
1107
    /** Get the default parent window for dialog boxes.
1108
1109
     @remark This is almost always a terrible method to use to get a parent
1110
             for a dialog, try hard to instead pass a specific parent window
1111
             to dialogs.
1112
1113
             GetDefDialogParent does all sorts of things to try and find a useful
1114
             parent window for dialogs. It first uses the topmost parent of the
1115
             active window to avoid using floating windows or other dialog boxes.
1116
             If there are no active windows, then it will take a random stab and
1117
             choose the first visible top window. Otherwise, it defaults to
1118
             the desktop.
1119
1120
     @returns Pointer to the default window.
1121
    */
1122
    static weld::Window*        GetDefDialogParent();
1123
1124
1125
    /** Gets the dialog cancel mode for headless environments.
1126
1127
     @return DialogCancelMode value
1128
1129
     @see SetDialogCancelMode, IsDialogCancelEnabled
1130
    */
1131
    static DialogCancelMode     GetDialogCancelMode();
1132
1133
    /** Sets the dialog cancel mode for headless environments.
1134
1135
     This should be private, but XFrameImpl needs to access it and current
1136
     baseline gcc doesn't support forward definition of anonymous classes.
1137
     You probably should use EnableHeadlessMode instead.
1138
1139
     @param     mode            DialogCancel mode value
1140
1141
     @see GetDialogCancelMode, IsDialogCancelEnabled, EnableHeadlessMode
1142
    */
1143
    static void                 SetDialogCancelMode( DialogCancelMode mode );
1144
1145
    /** Determines if dialog cancel mode is enabled.
1146
1147
     @returns True if dialog cancel mode is enabled, false if disabled.
1148
1149
     @see GetDialogCancelMode, SetDialogCancelMode
1150
    */
1151
    static bool                 IsDialogCancelEnabled();
1152
1153
1154
    /** Make a dialog box a system window or not.
1155
1156
     @param     nMode           Can be either: SystemWindowFlags::NOAUTOMODE (0x0001) or
1157
                                SystemWindowFlags::DIALOG (0x0002)
1158
1159
     @see GetSystemWindowMode
1160
    */
1161
    static void                 SetSystemWindowMode( SystemWindowFlags nMode );
1162
1163
    /** Get the system window mode of dialogs.
1164
1165
     @returns SystemWindowFlags::NOAUTOMODE (0x0001) or SystemWindowFlags::DIALOG (0x0002)
1166
1167
     @see SetSystemWindowMode
1168
    */
1169
    static SystemWindowFlags    GetSystemWindowMode();
1170
1171
    ///@}
1172
1173
    /** @name VCL Toolkit and UNO Wrapper
1174
1175
      The VCL Toolkit implements the UNO XToolkit interface, which specifies a
1176
      factory interface for the window toolkit. It is similar to the abstract window
1177
      toolkit (AWT) in Java.
1178
1179
    */
1180
    ///@{
1181
1182
    /** Gets the VCL toolkit.
1183
1184
     @attention The global service manager has to be created before getting the toolkit!
1185
1186
     @returns UNO reference to VCL toolkit
1187
    */
1188
    static css::uno::Reference< css::awt::XToolkit > GetVCLToolkit();
1189
1190
    ///@}
1191
1192
1193
    /*** @name Graphic Filters
1194
    */
1195
    ///@{
1196
1197
    /** Setup a new graphics filter
1198
1199
     @param     rLink           Const reference to a Link object, which the filter calls upon.
1200
1201
     @see GetFilterHdl
1202
    */
1203
    static void                 SetFilterHdl( const Link<ConvertData&,bool>& rLink );
1204
1205
    ///@}
1206
1207
    /** @name Headless Mode
1208
    */
1209
1210
    /** Enables headless mode.
1211
1212
     @param dialogsAreFatal     Set to true if a dialog ends the session, false if not.
1213
    */
1214
    static void                 EnableHeadlessMode( bool dialogsAreFatal );
1215
1216
    /** Determines if headless mode is enabled
1217
1218
     @return True if headless mode is enabled, false if not.
1219
    */
1220
    static bool                 IsHeadlessModeEnabled();
1221
1222
    /** Enable Console Only mode
1223
1224
     Convenience function to enable headless and bitmap rendering.
1225
    */
1226
    static void                 EnableConsoleOnly();
1227
1228
    /** Enable software-only bitmap rendering
1229
     */
1230
    SAL_DLLPRIVATE static void EnableBitmapRendering();
1231
1232
    /** Determines if bitmap rendering is enabled
1233
1234
      @return True if bitmap rendering is enabled.
1235
     */
1236
    static bool                 IsBitmapRendering();
1237
1238
    ///@}
1239
1240
    /** Set safe mode to enabled */
1241
    static void                 EnableSafeMode();
1242
1243
    /** Determines if safe mode is enabled */
1244
    static bool                 IsSafeModeEnabled();
1245
1246
    /** Collect what .ui files are used*/
1247
    static void                 EnableUICoverage(bool bEnable);
1248
1249
    /** Report on what .ui files were used*/
1250
    static void UICoverageReport(tools::JsonWriter& rJson,
1251
            /*LibreOfficeKitDocumentType*/ int eDocType,
1252
            bool linguisticDataAvailable);
1253
1254
    ///@}
1255
1256
    /** Get the desktop environment the process is currently running in
1257
1258
     @returns The desktop environment
1259
    */
1260
    static DesktopType GetDesktopEnvironment();
1261
1262
    /*** @name Platform Functionality
1263
    */
1264
    ///@{
1265
1266
    /** Add a file to the system shells recent document list if there is any.
1267
     This function may have no effect under Unix because there is no standard
1268
     API among the different desktop managers.
1269
1270
     @param     rFileUrl        The file url of the document.
1271
1272
     @param     rMimeType       The mime content type of the document specified by aFileUrl.
1273
                                If an empty string will be provided "application/octet-stream"
1274
                                will be used.
1275
1276
     @param     rDocumentService The app (or "document service") you will be adding the file to
1277
                                e.g. com.sun.star.text.TextDocument
1278
    */
1279
    static void                 AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService);
1280
1281
    /*** Show a native error messagebox
1282
1283
     @param     sTitle          Title of error messagebox
1284
1285
     @param     sMessage        Message displayed in messagebox
1286
    */
1287
    static void                 ShowNativeErrorBox(const OUString& sTitle  ,
1288
                                                   const OUString& sMessage);
1289
1290
    /** Update main thread identifier */
1291
    static void                 UpdateMainThread();
1292
1293
    /** Do we have a native/system color chooser dialog available?
1294
1295
     @returns True if native color chooser dialog is available, false otherwise.
1296
     */
1297
    static bool hasNativeColorChooserDialog();
1298
1299
    /** Do we have a native / system file selector available?
1300
1301
     @returns True if native file selector is available, false otherwise.
1302
     */
1303
    static bool                 hasNativeFileSelection();
1304
1305
    /** Create a platform specific file picker, if one is available, otherwise return an
1306
     empty reference.
1307
1308
     @param    rServiceManager Const reference to a UNO component context (service manager).
1309
1310
     @returns File picker if available, otherwise an empty reference.
1311
    */
1312
    static css::uno::Reference< css::ui::dialogs::XFilePicker2 >
1313
        createFilePicker( const css::uno::Reference< css::uno::XComponentContext >& rServiceManager );
1314
1315
    /** Create a platform specific folder picker, if one is available, otherwise return an
1316
     empty reference
1317
1318
     @param    rServiceManager Const reference to a UNO component context (service manager).
1319
1320
     @returns Folder picker if available, otherwise an empty reference.
1321
    */
1322
    static css::uno::Reference< css::ui::dialogs::XFolderPicker2 >
1323
        createFolderPicker( const css::uno::Reference< css::uno::XComponentContext >& rServiceManager );
1324
1325
    /** Returns true, if the VCL plugin should run on the system event loop.
1326
     *
1327
     *  AKA the VCL plugin can't handle nested event loops, like WASM or mobile.
1328
     */
1329
    static bool IsUseSystemEventLoop();
1330
1331
    ///@}
1332
1333
    // For vclbootstrapprotector:
1334
    static void setDeInitHook(Link<LinkParamNone*,void> const & hook);
1335
1336
    static std::unique_ptr<weld::Builder> CreateBuilder(weld::Widget* pParent, const OUString &rUIFile, bool bMobile = false, sal_uInt64 nLOKWindowId = 0);
1337
    // For the duration of vcl parent windows
1338
    static std::unique_ptr<weld::Builder> CreateInterimBuilder(vcl::Window* pParent, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId = 0);
1339
1340
    static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType,
1341
                                                    VclButtonsType eButtonType, const OUString& rPrimaryMessage,
1342
                                                    const ILibreOfficeKitNotifier* pNotifier = nullptr);
1343
1344
    static weld::Window* GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow);
1345
1346
    // ILibreOfficeKitNotifier
1347
    void* m_pCallbackData;
1348
    LibreOfficeKitCallback m_pCallback;
1349
1350
    virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId,
1351
                              const OUString& rAction,
1352
                              const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()) const override;
1353
    virtual void libreOfficeKitViewCallback(int nType, const OString& pPayload) const override;
1354
    virtual void notifyInvalidation(tools::Rectangle const* pRect) const override;
1355
    virtual void notifyCursorInvalidation(tools::Rectangle const* pRect, bool bControlEvent, int windowID) const override;
1356
    virtual OString dumpNotifyState() const override;
1357
1358
private:
1359
    DECL_DLLPRIVATE_STATIC_LINK( Application, PostEventHandler, void*, void );
1360
};
1361
1362
class SolarMutexGuard
1363
    : public osl::Guard<comphelper::SolarMutex>
1364
{
1365
public:
1366
    SolarMutexGuard()
1367
181M
        : osl::Guard<comphelper::SolarMutex>( Application::GetSolarMutex() ) {}
1368
};
1369
1370
class SolarMutexClearableGuard
1371
    : public osl::ClearableGuard<comphelper::SolarMutex>
1372
{
1373
public:
1374
    SolarMutexClearableGuard()
1375
59.4M
        : osl::ClearableGuard<comphelper::SolarMutex>( Application::GetSolarMutex() ) {}
1376
};
1377
1378
class SolarMutexResettableGuard
1379
    : public osl::ResettableGuard<comphelper::SolarMutex>
1380
{
1381
public:
1382
    SolarMutexResettableGuard()
1383
57.1k
        : osl::ResettableGuard<comphelper::SolarMutex>( Application::GetSolarMutex() ) {}
1384
};
1385
1386
namespace vcl
1387
{
1388
1389
/** guard class that uses tryToAcquire() and has isAcquired() to check
1390
 */
1391
class SolarMutexTryAndBuyGuard
1392
{
1393
private:
1394
    bool m_isAcquired;
1395
#ifdef DBG_UTIL
1396
    bool m_isChecked;
1397
#endif
1398
    comphelper::SolarMutex& m_rSolarMutex;
1399
1400
    SolarMutexTryAndBuyGuard(const SolarMutexTryAndBuyGuard&) = delete;
1401
    SolarMutexTryAndBuyGuard& operator=(const SolarMutexTryAndBuyGuard&) = delete;
1402
1403
public:
1404
1405
    SolarMutexTryAndBuyGuard()
1406
0
        : m_isAcquired(false)
1407
#ifdef DBG_UTIL
1408
        , m_isChecked(false)
1409
#endif
1410
0
        , m_rSolarMutex(Application::GetSolarMutex())
1411
1412
0
    {
1413
0
        m_isAcquired = m_rSolarMutex.tryToAcquire();
1414
0
    }
1415
1416
    ~SolarMutexTryAndBuyGuard()
1417
0
    {
1418
#ifdef DBG_UTIL
1419
        assert(m_isChecked);
1420
#endif
1421
0
        if (m_isAcquired)
1422
0
            m_rSolarMutex.release();
1423
0
    }
1424
1425
    bool isAcquired()
1426
0
    {
1427
#ifdef DBG_UTIL
1428
        m_isChecked = true;
1429
#endif
1430
0
        return m_isAcquired;
1431
0
    }
1432
};
1433
1434
} // namespace vcl
1435
1436
/**
1437
 A helper class that calls Application::ReleaseSolarMutex() in its constructor
1438
 and restores the mutex in its destructor.
1439
*/
1440
class SolarMutexReleaser
1441
{
1442
    const sal_uInt32 mnReleased;
1443
public:
1444
    SolarMutexReleaser()
1445
        : mnReleased(
1446
44.0k
            Application::GetSolarMutex().IsCurrentThread() ? Application::ReleaseSolarMutex() : 0)
1447
44.0k
    {
1448
44.0k
    }
1449
    ~SolarMutexReleaser()
1450
44.0k
    {
1451
44.0k
        if (mnReleased)
1452
44.0k
            Application::AcquireSolarMutex(mnReleased);
1453
44.0k
    }
1454
};
1455
1456
VCL_DLLPUBLIC Application* GetpApp();
1457
1458
// returns true if vcl is already initialized
1459
VCL_DLLPUBLIC bool IsVCLInit();
1460
// returns true if vcl successfully initializes or was already initialized
1461
VCL_DLLPUBLIC bool InitVCL();
1462
VCL_DLLPUBLIC void DeInitVCL();
1463
1464
// only allowed to call, if no thread is running. You must call JoinMainLoopThread to free all memory.
1465
VCL_DLLPUBLIC void CreateMainLoopThread( oslWorkerFunction pWorker, void * pThreadData );
1466
VCL_DLLPUBLIC void JoinMainLoopThread();
1467
1468
/// The following are to manage per-view (frame) help data.
1469
struct ImplSVHelpData;
1470
VCL_DLLPUBLIC ImplSVHelpData* CreateSVHelpData();
1471
VCL_DLLPUBLIC void DestroySVHelpData(ImplSVHelpData*);
1472
VCL_DLLPUBLIC void SetSVHelpData(ImplSVHelpData*);
1473
1474
/// The following are to manage per-view (frame) window data.
1475
struct ImplSVWinData;
1476
VCL_DLLPUBLIC ImplSVWinData* CreateSVWinData();
1477
VCL_DLLPUBLIC void DestroySVWinData(ImplSVWinData*);
1478
VCL_DLLPUBLIC void SetSVWinData(ImplSVWinData*);
1479
1480
inline void Application::EndYield()
1481
3.92k
{
1482
3.92k
    PostUserEvent( Link<void*,void>() );
1483
3.92k
}
1484
1485
#endif // _APP_HXX
1486
1487
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */