1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_INC_OSX_SALDATA_HXX
21 #define INCLUDED_VCL_INC_OSX_SALDATA_HXX
23 #include <config_features.h>
26 #include <Cocoa/Cocoa.h>
29 #include "com/sun/star/uno/Reference.hxx"
31 #include <vcl/ptrstyle.hxx>
34 #include "salwtype.hxx"
39 #include <unordered_set>
41 #include <o3tl/enumarray.hxx>
46 #include "apple_remote/RemoteMainController.h"
48 class AquaSalInstance
;
51 class SalVirtualDevice
;
55 #define SAL_CLIPRECT_COUNT 16
58 struct FrameHash
: public std::hash
<sal_IntPtr
>
60 size_t operator()(const AquaSalFrame
* frame
) const
61 { return std::hash
<sal_IntPtr
>::operator()( reinterpret_cast<const sal_IntPtr
>(frame
) ); }
64 #define INVALID_CURSOR_PTR reinterpret_cast<NSCursor*>(0xdeadbeef)
66 // Singleton, instantiated from Application::Application() in
67 // vcl/source/app/svapp.cxx through InitSalData().
72 SALTIMERPROC mpTimerProc
; // timer callback proc
73 AquaSalInstance
*mpFirstInstance
; // pointer of first instance
74 std::list
<AquaSalFrame
*> maFrames
; // list of all frames
75 std::unordered_set
<const AquaSalFrame
*,FrameHash
> maFrameCheck
;// for fast check of frame existence
76 std::list
<AquaSalFrame
*> maPresentationFrames
; // list of frames in presentation mode
77 SalObject
*mpFirstObject
; // pointer of first object window
78 SalVirtualDevice
*mpFirstVD
; // first VirDev
79 SalPrinter
*mpFirstPrinter
; // first printing printer
80 SystemFontList
*mpFontList
;
81 NSStatusItem
* mpStatusItem
; // one status item that draws all our statuses
82 // at the moment this is only one add menu button
83 CGColorSpaceRef mxRGBSpace
;
84 CGColorSpaceRef mxGraySpace
;
86 o3tl::enumarray
< PointerStyle
, NSCursor
* > maCursors
;
87 std::vector
< NSMenuItem
* > maFallbackMenu
;
88 std::map
< NSEvent
*, bool > maKeyEventAnswer
;
90 static oslThreadKey s_aAutoReleaseKey
;
92 bool mbIsScrollbarDoubleMax
; // TODO: support DoubleMin and DoubleBoth too
93 #if !HAVE_FEATURE_MACOSX_SANDBOX
94 AppleRemoteMainController
* mpAppleRemoteMainController
;
96 NSObject
* mpDockIconClickHandler
;
97 long mnDPIX
; // #i100617# read DPI only once per office life
98 long mnDPIY
; // #i100617# read DPI only once per office life
100 css::uno::Reference
< css::uno::XInterface
> mxClipboard
;
105 NSCursor
* getCursor( PointerStyle i_eStyle
);
107 static void ensureThreadAutoreleasePool();
109 static NSStatusItem
* getStatusItem();
112 inline void SetSalData( SalData
* pData
) { ImplGetSVData()->mpSalData
= pData
; }
113 inline SalData
*GetSalData() { return ImplGetSVData()->mpSalData
; }
115 bool ImplSalYieldMutexTryToAcquire();
116 void ImplSalYieldMutexRelease();
118 #endif // INCLUDED_VCL_INC_OSX_SALDATA_HXX
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */