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"
36 #include <boost/functional/hash.hpp>
40 #include <unordered_set>
42 #include <o3tl/enumarray.hxx>
47 #include "apple_remote/RemoteMainController.h"
49 class AquaSalInstance
;
52 class SalVirtualDevice
;
56 #define SAL_CLIPRECT_COUNT 16
59 struct FrameHash
: public boost::hash
<sal_IntPtr
>
61 size_t operator()(const AquaSalFrame
* frame
) const
62 { return boost::hash
<sal_IntPtr
>::operator()( reinterpret_cast<const sal_IntPtr
>(frame
) ); }
65 #define INVALID_CURSOR_PTR reinterpret_cast<NSCursor*>(0xdeadbeef)
67 // Singleton, instantiated from Application::Application() in
68 // vcl/source/app/svapp.cxx through InitSalData().
73 SALTIMERPROC mpTimerProc
; // timer callback proc
74 AquaSalInstance
*mpFirstInstance
; // pointer of first instance
75 std::list
<AquaSalFrame
*> maFrames
; // list of all frames
76 std::unordered_set
<const AquaSalFrame
*,FrameHash
> maFrameCheck
;// for fast check of frame existence
77 std::list
<AquaSalFrame
*> maPresentationFrames
; // list of frames in presentation mode
78 SalObject
*mpFirstObject
; // pointer of first object window
79 SalVirtualDevice
*mpFirstVD
; // first VirDev
80 SalPrinter
*mpFirstPrinter
; // first printing printer
81 SystemFontList
*mpFontList
;
82 NSStatusItem
* mpStatusItem
; // one status item that draws all our statuses
83 // at the moment this is only one add menu button
84 CGColorSpaceRef mxRGBSpace
;
85 CGColorSpaceRef mxGraySpace
;
87 o3tl::enumarray
< PointerStyle
, NSCursor
* > maCursors
;
88 std::vector
< NSMenuItem
* > maFallbackMenu
;
89 std::map
< NSEvent
*, bool > maKeyEventAnswer
;
91 static oslThreadKey s_aAutoReleaseKey
;
93 bool mbIsScrollbarDoubleMax
; // TODO: support DoubleMin and DoubleBoth too
94 #if !HAVE_FEATURE_MACOSX_SANDBOX
95 AppleRemoteMainController
* mpAppleRemoteMainController
;
97 NSObject
* mpDockIconClickHandler
;
98 long mnDPIX
; // #i100617# read DPI only once per office life
99 long mnDPIY
; // #i100617# read DPI only once per office life
101 com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
>
107 NSCursor
* getCursor( PointerStyle i_eStyle
);
109 static void ensureThreadAutoreleasePool();
111 static NSStatusItem
* getStatusItem();
114 inline void SetSalData( SalData
* pData
) { ImplGetSVData()->mpSalData
= pData
; }
115 inline SalData
*GetSalData() { return ImplGetSVData()->mpSalData
; }
117 bool ImplSalYieldMutexTryToAcquire();
118 void ImplSalYieldMutexRelease();
120 #endif // INCLUDED_VCL_INC_OSX_SALDATA_HXX
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */