LibreOffice Module vcl (master) 1
osx/salinst.h
Go to the documentation of this file.
1
2/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3/*
4 * This file is part of the LibreOffice project.
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 *
10 * This file incorporates work covered by the following license notice:
11 *
12 * Licensed to the Apache Software Foundation (ASF) under one or more
13 * contributor license agreements. See the NOTICE file distributed
14 * with this work for additional information regarding copyright
15 * ownership. The ASF licenses this file to you under the Apache
16 * License, Version 2.0 (the "License"); you may not use this file
17 * except in compliance with the License. You may obtain a copy of
18 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 */
20
21#pragma once
22
23#include <sal/config.h>
24
25#include <condition_variable>
26#include <list>
27#include <mutex>
28
30#include <osl/conditn.hxx>
31#include <osl/thread.hxx>
32#include <tools/long.hxx>
33
34#ifdef MACOSX
35#include <osx/osxvcltypes.h>
36#endif
37#include <salinst.hxx>
38
39#include <osx/runinmain.hxx>
40
41#include <salusereventlist.hxx>
42
43class AquaSalFrame;
44class SalFrame;
45class SalObject;
47class Image;
48enum class SalEvent;
49
50typedef void(^RuninmainBlock)(void);
51
53{
54public:
56
57protected:
58 virtual void doAcquire( sal_uInt32 nLockCount ) override;
59 virtual sal_uInt32 doRelease( bool bUnlockAll ) override;
60
61public:
63 virtual ~SalYieldMutex() override;
64
65 virtual bool IsCurrentThread() const override;
66};
67
69{
70 friend class AquaSalFrame;
71
72 bool RunInMainYield( bool bHandleAllCurrentEvents );
73
74 virtual void ProcessEvent( SalUserEvent aEvent ) override;
75
76public:
77 virtual void TriggerUserEventProcessing() override;
78
80 oslThreadIdentifier maMainThread;
83 osl::Condition maWaitingYieldCond;
87
88 static std::list<const ApplicationEvent*> aAppEventList;
89
91 virtual ~AquaSalInstance() override;
92
93 virtual void AfterAppInit() override;
94 virtual bool SVMainHook(int *) override;
95
96 virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override;
97 virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override;
98 virtual void DestroyFrame( SalFrame* pFrame ) override;
99 virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData,
100 bool bShow ) override;
101 virtual void DestroyObject( SalObject* pObject ) override;
102 virtual std::unique_ptr<SalVirtualDevice>
104 tools::Long &nDX, tools::Long &nDY,
105 DeviceFormat eFormat,
106 const SystemGraphicsData *pData = nullptr ) override;
108 ImplJobSetup* pSetupData ) override;
109 virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) override;
110 virtual std::unique_ptr<SalPrinter> CreatePrinter( SalInfoPrinter* pInfoPrinter ) override;
111 virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) override;
112 virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) override;
113 virtual OUString GetDefaultPrinter() override;
114 virtual SalTimer* CreateSalTimer() override;
115 virtual SalSystem* CreateSalSystem() override;
116 virtual std::shared_ptr<SalBitmap> CreateSalBitmap() override;
117 virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents) override;
118 virtual bool AnyInput( VclInputFlags nType ) override;
119 virtual std::unique_ptr<SalMenu> CreateMenu( bool bMenuBar, Menu* pVCLMenu ) override;
120 virtual std::unique_ptr<SalMenuItem> CreateMenuItem( const SalItemParams & rItemData ) override;
122 virtual OUString GetConnectionIdentifier() override;
123 virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType,
124 const OUString& rDocumentService) override;
125
126 virtual OUString getOSVersion() override;
127
128 // dtrans implementation
129 virtual css::uno::Reference< css::uno::XInterface > CreateClipboard(
130 const css::uno::Sequence< css::uno::Any >& i_rArguments ) override;
131 virtual css::uno::Reference<css::uno::XInterface> ImplCreateDragSource(const SystemEnvData*) override;
132 virtual css::uno::Reference<css::uno::XInterface> ImplCreateDropTarget(const SystemEnvData*) override;
133
134 static void handleAppDefinedEvent( NSEvent* pEvent );
135
136 // check whether a particular string is passed on the command line
137 // this is needed to avoid duplicate open events through a) command line and b) NSApp's openFile
138 static bool isOnCommandLine( const OUString& );
139
140 void delayedSettingsChanged( bool bInvalidate );
141
142 // Is this the NSAppThread?
143 virtual bool IsMainThread() const override;
144
147
148 // event subtypes for NSEventTypeApplicationDefined events
149 static const short AppExecuteSVMain = 1;
150 static const short AppStartTimerEvent = 10;
151 static const short YieldWakeupEvent = 20;
152 static const short DispatchTimerEvent = 30;
153
154 static NSMenu* GetDynamicDockMenu();
155};
156
157CGImageRef CreateCGImage( const Image& );
158NSImage* CreateNSImage( const Image& );
159
160
161/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
An application can be notified of a number of different events:
Definition: svapp.hxx:116
virtual css::uno::Reference< css::uno::XInterface > ImplCreateDragSource(const SystemEnvData *) override
virtual std::unique_ptr< SalVirtualDevice > CreateVirtualDevice(SalGraphics &rGraphics, tools::Long &nDX, tools::Long &nDY, DeviceFormat eFormat, const SystemGraphicsData *pData=nullptr) override
virtual css::uno::Reference< css::uno::XInterface > ImplCreateDropTarget(const SystemEnvData *) override
virtual void AfterAppInit() override
virtual void GetPrinterQueueState(SalPrinterQueueInfo *pInfo) override
virtual css::uno::Reference< css::uno::XInterface > CreateClipboard(const css::uno::Sequence< css::uno::Any > &i_rArguments) override
virtual void DestroyFrame(SalFrame *pFrame) override
virtual OUString GetDefaultPrinter() override
OUString maDefaultPrinter
Definition: osx/salinst.h:79
virtual bool SVMainHook(int *) override
virtual void GetPrinterQueueInfo(ImplPrnQueueList *pList) override
void endedPrintJob()
Definition: osx/salinst.h:146
virtual void ProcessEvent(SalUserEvent aEvent) override
virtual std::unique_ptr< SalMenu > CreateMenu(bool bMenuBar, Menu *pVCLMenu) override
virtual OpenGLContext * CreateOpenGLContext() override
bool mbTimerProcessed
Definition: osx/salinst.h:86
virtual SalInfoPrinter * CreateInfoPrinter(SalPrinterQueueInfo *pQueueInfo, ImplJobSetup *pSetupData) override
osl::Condition maWaitingYieldCond
Definition: osx/salinst.h:83
static const short AppExecuteSVMain
Definition: osx/salinst.h:149
void delayedSettingsChanged(bool bInvalidate)
virtual void AddToRecentDocumentList(const OUString &rFileUrl, const OUString &rMimeType, const OUString &rDocumentService) override
virtual SalFrame * CreateChildFrame(SystemParentData *pParent, SalFrameStyleFlags nStyle) override
virtual std::unique_ptr< SalPrinter > CreatePrinter(SalInfoPrinter *pInfoPrinter) override
static const short DispatchTimerEvent
Definition: osx/salinst.h:152
virtual bool IsMainThread() const override
virtual std::shared_ptr< SalBitmap > CreateSalBitmap() override
virtual std::unique_ptr< SalMenuItem > CreateMenuItem(const SalItemParams &rItemData) override
void startedPrintJob()
Definition: osx/salinst.h:145
virtual SalFrame * CreateFrame(SalFrame *pParent, SalFrameStyleFlags nStyle) override
virtual SalSystem * CreateSalSystem() override
static const short AppStartTimerEvent
Definition: osx/salinst.h:150
virtual void DestroyObject(SalObject *pObject) override
virtual void DestroyInfoPrinter(SalInfoPrinter *pPrinter) override
osl::Mutex maUserEventListMutex
Definition: osx/salinst.h:82
virtual ~AquaSalInstance() override
virtual SalObject * CreateObject(SalFrame *pParent, SystemWindowData *pWindowData, bool bShow) override
bool RunInMainYield(bool bHandleAllCurrentEvents)
static const short YieldWakeupEvent
Definition: osx/salinst.h:151
virtual OUString getOSVersion() override
get information about underlying versions
oslThreadIdentifier maMainThread
Definition: osx/salinst.h:80
virtual void TriggerUserEventProcessing() override
virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents) override
Wait for the next event (if bWait) and dispatch it, includes posted events, and timers.
virtual OUString GetConnectionIdentifier() override
static void handleAppDefinedEvent(NSEvent *pEvent)
virtual SalTimer * CreateSalTimer() override
virtual bool AnyInput(VclInputFlags nType) override
static NSMenu * GetDynamicDockMenu()
static std::list< const ApplicationEvent * > aAppEventList
Definition: osx/salinst.h:88
static bool isOnCommandLine(const OUString &)
Definition: image.hxx:40
Definition: menu.hxx:116
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:115
virtual bool IsCurrentThread() const override
virtual void doAcquire(sal_uInt32 nLockCount) override
virtual sal_uInt32 doRelease(bool bUnlockAll) override
virtual ~SalYieldMutex() override
VclInputFlags
Definition: inputtypes.hxx:25
long Long
void(^ RuninmainBlock)(void)
Definition: osx/salinst.h:50
NSImage * CreateNSImage(const Image &)
CGImageRef CreateCGImage(const Image &)
#define OSX_RUNINMAIN_MEMBERS
Definition: runinmain.hxx:60
SalFrameStyleFlags
Definition: salframe.hxx:65
DeviceFormat
Definition: salgtype.hxx:28
SalEvent
Definition: salwtype.hxx:44