LibreOffice Module vcl (master)  1
Public Member Functions | List of all members
UIPreviewApp Class Reference
Inheritance diagram for UIPreviewApp:
[legend]
Collaboration diagram for UIPreviewApp:
[legend]

Public Member Functions

virtual void Init () override
 Initialize the application itself. More...
 
virtual int Main () override
 Pure virtual entrypoint to the application. More...
 
- Public Member Functions inherited from Application
virtual bool QueryExit ()
 Exit from the application. More...
 
 Application ()
 Default constructor for Application class. More...
 
virtual ~Application ()
 Virtual destructor for Application class. More...
 
virtual void InitFinished ()
 Finish initialization of the application. More...
 
virtual void DeInit ()
 Deinitialized the application itself. More...
 
virtual void Exception (ExceptionCategory nCategory)
 Handles an error. More...
 
virtual void OverrideSystemSettings (AllSettings &rSettings)
 Sets user settings in settings object to override system settings. More...
 
virtual void AppEvent (const ApplicationEvent &rAppEvent)
 

Additional Inherited Members

- Static Public Member Functions inherited from Application
static bool IsUICaptured ()
 
static void SetAppName (const OUString &rUniqueName)
 Set the application's name. More...
 
static const OUString & GetDesktopEnvironment ()
 Get the desktop environment the process is currently running in. More...
 
static void LockFontUpdates (bool bLock)
 Lock font updates for all output devices. More...
 
static void setDeInitHook (Link< LinkParamNone *, void > const &hook)
 
static weld::BuilderCreateBuilder (weld::Widget *pParent, const OUString &rUIFile)
 
static weld::BuilderCreateInterimBuilder (vcl::Window *pParent, const OUString &rUIFile)
 
static weld::BuilderCreateInterimBuilder (weld::Widget *pParent, const OUString &rUIFile)
 
static weld::MessageDialogCreateMessageDialog (weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage)
 
static weld::WindowGetFrameWeld (const css::uno::Reference< css::awt::XWindow > &rWindow)
 
static void NotifyAllWindows (DataChangedEvent &rDCEvt)
 Notify all windows that the application has changed data. More...
 
static sal_uInt16 GetCommandLineParamCount ()
 Gets the number of command line parameters passed to the application. More...
 
static OUString GetCommandLineParam (sal_uInt16 nParam)
 Gets a particular command line parameter. More...
 
static OUString GetAppFileName ()
 Get the name of the file used to start the application. More...
 
static void Execute ()
 Run the main event processing loop until it is quit by Quit(). More...
 
static void Quit ()
 Quit the program. More...
 
static bool Reschedule (bool bHandleAllCurrentEvents=false)
 Attempt to process current pending event(s) More...
 
static void Yield ()
 Process the next event. More...
 
static void EndYield ()
 
static comphelper::SolarMutexGetSolarMutex ()
 Get the Solar Mutex for this thread. More...
 
static bool IsMainThread ()
 Queries whether we are in main thread. More...
 
static sal_uInt32 ReleaseSolarMutex ()
 Release Solar Mutex(es) for this thread. More...
 
static void AcquireSolarMutex (sal_uInt32 nCount)
 Acquire Solar Mutex(es) for this thread. More...
 
static bool IsInMain ()
 Queries whether the application is in "main", i.e. More...
 
static bool IsInExecute ()
 Queries whether the application is in the event loop. More...
 
static bool IsInModalMode ()
 Queries whether application has a modal dialog active. More...
 
static sal_uInt16 GetDispatchLevel ()
 Return how many events are being dispatched. More...
 
static bool AnyInput (VclInputFlags nType=VCL_INPUT_ANY)
 Determine if there are any pending input events. More...
 
static sal_uInt64 GetLastInputInterval ()
 The interval from the last time that input was received. More...
 
static WorkWindowGetAppWindow ()
 Get the main application window. More...
 
static vcl::WindowGetFocusWindow ()
 Get the currently focused window. More...
 
static OutputDeviceGetDefaultDevice ()
 Get the default "device" (in this case the default window). More...
 
static vcl::WindowGetFirstTopLevelWindow ()
 Get the first top-level window of the application. More...
 
static vcl::WindowGetNextTopLevelWindow (vcl::Window const *pWindow)
 Get the next top level window. More...
 
static long GetTopWindowCount ()
 Return the number of top-level windows being used by the application. More...
 
static vcl::WindowGetTopWindow (long nIndex)
 Get the nth top window. More...
 
static vcl::WindowGetActiveTopWindow ()
 Get the "active" top window. More...
 
static OUString GetAppName ()
 Get the application's name. More...
 
static OUString GetHWOSConfInfo ()
 Get useful OS, Hardware and configuration information, cf. More...
 
static bool LoadBrandBitmap (const char *pName, BitmapEx &rBitmap)
 Load a localized branding PNG file as a bitmap. More...
 
static void SetDisplayName (const OUString &rDisplayName)
 Set the default name of the application for message dialogs and printing. More...
 
static OUString GetDisplayName ()
 Get the default name of the application for message dialogs and printing. More...
 
static OUString GetToolkitName ()
 Get the toolkit's name. More...
 
static unsigned int GetScreenCount ()
 Get the number of screens available for the display. More...
 
static tools::Rectangle GetScreenPosSizePixel (unsigned int nScreen)
 Get a screen's rectangular area. More...
 
static bool IsUnifiedDisplay ()
 Determines if the screens that make up a display are separate or form one large display area. More...
 
static SAL_DLLPRIVATE unsigned int GetBestScreen (const tools::Rectangle &)
 Get the "best" screen. More...
 
static unsigned int GetDisplayBuiltInScreen ()
 Get the built-in screen. More...
 
static unsigned int GetDisplayExternalScreen ()
 Get the display's external screen. More...
 
static bool InsertAccel (Accelerator *pAccel)
 Insert accelerator. More...
 
static void RemoveAccel (Accelerator const *pAccel)
 Remove accelerator. More...
 
static sal_uLong GetReservedKeyCodeCount ()
 Get the number of reserved key codes used by the application. More...
 
static const vcl::KeyCodeGetReservedKeyCode (sal_uLong i)
 Get the reserved key code. More...
 
static void SetHelp (Help *pHelp=nullptr)
 Sets up help. More...
 
static HelpGetHelp ()
 Gets the application's help. More...
 
static vcl::WindowGetDefDialogParent ()
 Get the default parent window for dialog boxes. More...
 
static DialogCancelMode GetDialogCancelMode ()
 Gets the dialog cancel mode for headless environments. More...
 
static void SetDialogCancelMode (DialogCancelMode mode)
 Sets the dialog cancel mode for headless environments. More...
 
static bool IsDialogCancelEnabled ()
 Determines if dialog cancel mode is enabled. More...
 
static void SetSystemWindowMode (SystemWindowFlags nMode)
 Make a dialog box a system window or not. More...
 
static SystemWindowFlags GetSystemWindowMode ()
 Get the system window mode of dialogs. More...
 
static css::uno::Reference< css::awt::XToolkit > GetVCLToolkit ()
 Gets the VCL toolkit. More...
 
static void SetFilterHdl (const Link< ConvertData &, bool > &rLink)
 Setup a new graphics filter. More...
 
static void EnableHeadlessMode (bool dialogsAreFatal)
 Enables headless mode. More...
 
static bool IsHeadlessModeEnabled ()
 Determines if headless mode is enabled. More...
 
static void EnableConsoleOnly ()
 Enable Console Only mode. More...
 
static void EnableBitmapRendering ()
 Enable software-only bitmap rendering. More...
 
static bool IsBitmapRendering ()
 Determines if bitmap rendering is enabled. More...
 
static void EnableEventTestingMode ()
 Enables event testing mode. More...
 
static bool IsEventTestingModeEnabled ()
 Determines if event testing mode is enabled. More...
 
static void EnableSafeMode ()
 Set safe mode to enabled. More...
 
static bool IsSafeModeEnabled ()
 Determines if safe mode is enabled. More...
 
static bool CanToggleImeStatusWindow ()
 Determine application can toggle the IME status window on and off. More...
 
static void ShowImeStatusWindow (bool bShow)
 Toggle any IME status window on and off. More...
 
static bool GetShowImeStatusWindowDefault ()
 Determines if the IME status window should be turned of by default. More...
 
static void AddToRecentDocumentList (const OUString &rFileUrl, const OUString &rMimeType, const OUString &rDocumentService)
 Add a file to the system shells recent document list if there is any. More...
 
static void ShowNativeErrorBox (const OUString &sTitle, const OUString &sMessage)
 
static void UpdateMainThread ()
 Update main thread identifier. More...
 
static bool hasNativeFileSelection ()
 Do we have a native / system file selector available? More...
 
static css::uno::Reference< css::ui::dialogs::XFilePicker2 > createFilePicker (const css::uno::Reference< css::uno::XComponentContext > &rServiceManager)
 Create a platform specific file picker, if one is available, otherwise return an empty reference. More...
 
static css::uno::Reference< css::ui::dialogs::XFolderPicker2 > createFolderPicker (const css::uno::Reference< css::uno::XComponentContext > &rServiceManager)
 Create a platform specific folder picker, if one is available, otherwise return an empty reference. More...
 
static void EndAllDialogs ()
 Cancel all open dialogs. More...
 
static void EndAllPopups ()
 Cancel all open popups. More...
 
static void Abort (const OUString &rErrorText)
 Ends the program prematurely with an error message. More...
 
static void MergeSystemSettings (AllSettings &rSettings)
 Set the settings object to the platform/desktop environment system settings. More...
 
static void SetSettings (const AllSettings &rSettings)
 Sets the application's settings and notifies all windows of the change. More...
 
static const AllSettingsGetSettings ()
 Gets the application's settings. More...
 
static const LocaleDataWrapperGetAppLocaleDataWrapper ()
 Get the application's locale data wrapper. More...
 
static void AddEventListener (const Link< VclSimpleEvent &, void > &rEventListener)
 Add a VCL event listener to the application. More...
 
static void RemoveEventListener (const Link< VclSimpleEvent &, void > &rEventListener)
 Remove a VCL event listener from the application. More...
 
static void AddKeyListener (const Link< VclWindowEvent &, bool > &rKeyListener)
 Add a keypress listener to the application. More...
 
static void RemoveKeyListener (const Link< VclWindowEvent &, bool > &rKeyListener)
 Remove a keypress listener from the application. More...
 
static void ImplCallEventListenersApplicationDataChanged (void *pData)
 Send event to all VCL application event listeners. More...
 
static void ImplCallEventListeners (VclSimpleEvent &rEvent)
 Send event to all VCL application event listeners. More...
 
static bool HandleKey (VclEventId nEvent, vcl::Window *pWin, KeyEvent *pKeyEvent)
 Handle keypress event. More...
 
static ImplSVEventPostKeyEvent (VclEventId nEvent, vcl::Window *pWin, KeyEvent const *pKeyEvent)
 Send keypress event. More...
 
static ImplSVEventPostMouseEvent (VclEventId nEvent, vcl::Window *pWin, MouseEvent const *pMouseEvent)
 Send mouse event. More...
 
static ImplSVEventPostGestureEvent (VclEventId nEvent, vcl::Window *pWin, GestureEvent const *pGestureEvent)
 
static void RemoveMouseAndKeyEvents (vcl::Window *pWin)
 Remove mouse and keypress events from a window... More...
 
static ImplSVEventPostUserEvent (const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
 Post a user event to the default window. More...
 
static void RemoveUserEvent (ImplSVEvent *nUserEvent)
 Remove user event based on event ID. More...
 
static css::uno::Reference< css::awt::XDisplayConnection > GetDisplayConnection ()
 

Detailed Description

Definition at line 23 of file previewer.cxx.

Member Function Documentation

void UIPreviewApp::Init ( )
overridevirtual

Initialize the application itself.

Attention:
Note that the global data structures and platform specific initialization is done in the constructor.
See also
InitFinished, DeInit

Reimplemented from Application.

Definition at line 32 of file previewer.cxx.

References cppu::defaultBootstrap_InitialComponentContext(), comphelper::getProcessComponentContext(), and comphelper::setProcessServiceFactory().

int UIPreviewApp::Main ( )
overridevirtual

Pure virtual entrypoint to the application.

Main() is the pure virtual entrypoint to your application. You inherit your class from Application and subclass this function to implement an application.

The Main() function does not pass in command line parameters, you must use the functions GetCommandLineParamCount() and GetCommandLineParam() to get these values as these are platform independent ways of getting the command line (use GetAppFileName() to get the invoked executable filename).

Once in this function, you create windows, etc. then call on Execute() to start the application's main event loop.

An example code snippet follows (it won't compile, this just gives the general flavour of the framework and is adapted from an old HelloWorld example program that Star Division used to provide as part of their library).

class TheApplication : public Application
{
public:
virtual void Main();
};
class TheWindow : public WorkWindow
{
public:
TheWindow(vcl::Window *parent, WinBits windowStyle) :
WorkWindow(parent, windowStyle) {}
virtual void Paint(const Rectangle &);
};
void TheWindow::Paint(const Rectangle&)
{
DrawText(Point(100,100), String("Hello World!"));
}
void TheApplication::Main()
{
TheWindow aWindow(NULL, WB_APP | WB_STDWORK);
aWindow.Show();
}
TheApplication anApplication;

Some examples in the source tree can be found here:

vcl/workben/svdem.cxx

This is an example of how to use the Application and WorkWindow. Unfortunately, it no longer compiles.

vcl/fpicker/test/svdem.cxx

Reimplemented from Application.

Definition at line 47 of file previewer.cxx.

References VclPtr< reference_type >::disposeAndClear(), Help::EnableQuickHelp(), Dialog::Execute(), VclBuilder::get_widget_root(), vcl::Window::GetStyle(), vcl::Window::Hide(), i, Dialog::NoParent, OUStringToOString(), vcl::Window::SetStyle(), SystemWindow::SetText(), vcl::Window::Show(), WB_CLOSEABLE, WB_SIZEABLE, and WB_STDDIALOG.


The documentation for this class was generated from the following file: