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
79 NSButtonCell* mpButtonCell;
80 NSButtonCell* mpCheckCell;
81 NSButtonCell* mpRadioCell;
82 NSTextFieldCell* mpTextFieldCell;
83 NSComboBoxCell* mpComboBoxCell;
84 NSPopUpButtonCell* mpPopUpButtonCell;
85 NSStepperCell* mpStepperCell;
86 NSButtonCell* mpListNodeCell;
88 oslThreadIdentifier maMainThread;
91 osl::Condition maWaitingYieldCond;
94
95 static std::list<const ApplicationEvent*> aAppEventList;
96
98 virtual ~AquaSalInstance() override;
99
100 virtual void AfterAppInit() override;
101 virtual bool SVMainHook(int *) override;
102
103 virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override;
104 virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override;
105 virtual void DestroyFrame( SalFrame* pFrame ) override;
106 virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData,
107 bool bShow ) override;
108 virtual void DestroyObject( SalObject* pObject ) override;
109 virtual std::unique_ptr<SalVirtualDevice>
111 tools::Long &nDX, tools::Long &nDY,
112 DeviceFormat eFormat,
113 const SystemGraphicsData *pData = nullptr ) override;
115 ImplJobSetup* pSetupData ) override;
116 virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) override;
117 virtual std::unique_ptr<SalPrinter> CreatePrinter( SalInfoPrinter* pInfoPrinter ) override;
118 virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) override;
119 virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) override;
120 virtual OUString GetDefaultPrinter() override;
121 virtual SalTimer* CreateSalTimer() override;
122 virtual SalSystem* CreateSalSystem() override;
123 virtual std::shared_ptr<SalBitmap> CreateSalBitmap() override;
124 virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents) override;
125 virtual bool AnyInput( VclInputFlags nType ) override;
126 virtual std::unique_ptr<SalMenu> CreateMenu( bool bMenuBar, Menu* pVCLMenu ) override;
127 virtual std::unique_ptr<SalMenuItem> CreateMenuItem( const SalItemParams & rItemData ) override;
129 virtual OUString GetConnectionIdentifier() override;
130 virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType,
131 const OUString& rDocumentService) override;
132
133 virtual OUString getOSVersion() override;
134
135 // dtrans implementation
136 virtual css::uno::Reference< css::uno::XInterface > CreateClipboard(
137 const css::uno::Sequence< css::uno::Any >& i_rArguments ) override;
138 virtual css::uno::Reference<css::uno::XInterface> ImplCreateDragSource(const SystemEnvData*) override;
139 virtual css::uno::Reference<css::uno::XInterface> ImplCreateDropTarget(const SystemEnvData*) override;
140
141 static void handleAppDefinedEvent( NSEvent* pEvent );
142
143 // check whether a particular string is passed on the command line
144 // this is needed to avoid duplicate open events through a) command line and b) NSApp's openFile
145 static bool isOnCommandLine( const OUString& );
146
147 void delayedSettingsChanged( bool bInvalidate );
148
149 // Is this the NSAppThread?
150 virtual bool IsMainThread() const override;
151
154
155 // event subtypes for NSEventTypeApplicationDefined events
156 static const short AppExecuteSVMain = 1;
157 static const short AppStartTimerEvent = 10;
158 static const short YieldWakeupEvent = 20;
159 static const short DispatchTimerEvent = 30;
160
161 static NSMenu* GetDynamicDockMenu();
162};
163
164CGImageRef CreateCGImage( const Image& );
165NSImage* CreateNSImage( const Image& );
166
167
168/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
An application can be notified of a number of different events:
Definition: svapp.hxx:115
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
NSButtonCell * mpCheckCell
Definition: osx/salinst.h:80
virtual void DestroyFrame(SalFrame *pFrame) override
NSTextFieldCell * mpTextFieldCell
Definition: osx/salinst.h:82
virtual OUString GetDefaultPrinter() override
OUString maDefaultPrinter
Definition: osx/salinst.h:87
virtual bool SVMainHook(int *) override
virtual void GetPrinterQueueInfo(ImplPrnQueueList *pList) override
void endedPrintJob()
Definition: osx/salinst.h:153
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:93
virtual SalInfoPrinter * CreateInfoPrinter(SalPrinterQueueInfo *pQueueInfo, ImplJobSetup *pSetupData) override
osl::Condition maWaitingYieldCond
Definition: osx/salinst.h:91
static const short AppExecuteSVMain
Definition: osx/salinst.h:156
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
NSButtonCell * mpRadioCell
Definition: osx/salinst.h:81
virtual std::unique_ptr< SalPrinter > CreatePrinter(SalInfoPrinter *pInfoPrinter) override
static const short DispatchTimerEvent
Definition: osx/salinst.h:159
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:152
virtual SalFrame * CreateFrame(SalFrame *pParent, SalFrameStyleFlags nStyle) override
virtual SalSystem * CreateSalSystem() override
static const short AppStartTimerEvent
Definition: osx/salinst.h:157
virtual void DestroyObject(SalObject *pObject) override
NSButtonCell * mpListNodeCell
Definition: osx/salinst.h:86
virtual void DestroyInfoPrinter(SalInfoPrinter *pPrinter) override
osl::Mutex maUserEventListMutex
Definition: osx/salinst.h:90
virtual ~AquaSalInstance() override
virtual SalObject * CreateObject(SalFrame *pParent, SystemWindowData *pWindowData, bool bShow) override
NSButtonCell * mpButtonCell
Definition: osx/salinst.h:79
NSStepperCell * mpStepperCell
Definition: osx/salinst.h:85
bool RunInMainYield(bool bHandleAllCurrentEvents)
static const short YieldWakeupEvent
Definition: osx/salinst.h:158
virtual OUString getOSVersion() override
get information about underlying versions
NSComboBoxCell * mpComboBoxCell
Definition: osx/salinst.h:83
oslThreadIdentifier maMainThread
Definition: osx/salinst.h:88
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
NSPopUpButtonCell * mpPopUpButtonCell
Definition: osx/salinst.h:84
virtual bool AnyInput(VclInputFlags nType) override
static NSMenu * GetDynamicDockMenu()
static std::list< const ApplicationEvent * > aAppEventList
Definition: osx/salinst.h:95
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:46