xref: /aoo41x/main/vcl/inc/aqua/saldata.hxx (revision dbfe0a54)
1ebfcd9afSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3ebfcd9afSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4ebfcd9afSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5ebfcd9afSAndrew Rist  * distributed with this work for additional information
6ebfcd9afSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7ebfcd9afSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8ebfcd9afSAndrew Rist  * "License"); you may not use this file except in compliance
9ebfcd9afSAndrew Rist  * with the License.  You may obtain a copy of the License at
10ebfcd9afSAndrew Rist  *
11ebfcd9afSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12ebfcd9afSAndrew Rist  *
13ebfcd9afSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14ebfcd9afSAndrew Rist  * software distributed under the License is distributed on an
15ebfcd9afSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ebfcd9afSAndrew Rist  * KIND, either express or implied.  See the License for the
17ebfcd9afSAndrew Rist  * specific language governing permissions and limitations
18ebfcd9afSAndrew Rist  * under the License.
19ebfcd9afSAndrew Rist  *
20ebfcd9afSAndrew Rist  *************************************************************/
21ebfcd9afSAndrew Rist 
22ebfcd9afSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SV_SALDATA_HXX
25cdf0e10cSrcweir #define _SV_SALDATA_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "premac.h"
28cdf0e10cSrcweir #include <Cocoa/Cocoa.h>
29cdf0e10cSrcweir #include "postmac.h"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include "com/sun/star/uno/Reference.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include "vcl/ptrstyle.hxx"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include "svdata.hxx"
36cdf0e10cSrcweir #include "salwtype.hxx"
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include <list>
39cdf0e10cSrcweir #include <vector>
40cdf0e10cSrcweir #include <map>
41cdf0e10cSrcweir #include <hash_set>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir #include <cstdio>
44cdf0e10cSrcweir #include <cstdarg>
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #include "apple_remote/RemoteMainController.h"
47cdf0e10cSrcweir 
48cdf0e10cSrcweir class AquaSalInstance;
49cdf0e10cSrcweir class SalObject;
50cdf0e10cSrcweir class SalFrame;
51cdf0e10cSrcweir class SalVirtualDevice;
52cdf0e10cSrcweir class SalPrinter;
53cdf0e10cSrcweir class SystemFontList;
54cdf0e10cSrcweir 
55cdf0e10cSrcweir // ------------------
56cdf0e10cSrcweir // - Some constants -
57cdf0e10cSrcweir // ------------------
58cdf0e10cSrcweir 
59cdf0e10cSrcweir #define SAL_CLIPRECT_COUNT 16
60cdf0e10cSrcweir 
61245318c3SHerbert Dürr #define OSX_VER_TIGER     0x1040
62245318c3SHerbert Dürr #define OSX_VER_LEOPARD   0x1050
63245318c3SHerbert Dürr #define OSX_VER_SNOW_LEO  0x1060
64245318c3SHerbert Dürr #define OSX_VER_LION      0x1070
65245318c3SHerbert Dürr #define OSX_VER_MOUNTLION 0x1080
66245318c3SHerbert Dürr #define OSX_VER_MAVERICKS 0x1070
67cdf0e10cSrcweir 
68cdf0e10cSrcweir // -----------
69cdf0e10cSrcweir // - SalData -
70cdf0e10cSrcweir // -----------
71cdf0e10cSrcweir 
72cdf0e10cSrcweir class AquaSalFrame;
73cdf0e10cSrcweir struct FrameHash : public std::hash<sal_IntPtr>
74cdf0e10cSrcweir {
operator ()FrameHash75cdf0e10cSrcweir     size_t operator()(const AquaSalFrame* frame) const
76cdf0e10cSrcweir     { return std::hash<sal_IntPtr>::operator()( reinterpret_cast<const sal_IntPtr>(frame) ); }
77cdf0e10cSrcweir };
78cdf0e10cSrcweir 
79cdf0e10cSrcweir #define INVALID_CURSOR_PTR (NSCursor*)0xdeadbeef
80cdf0e10cSrcweir 
81cdf0e10cSrcweir struct SalData
82cdf0e10cSrcweir {
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	SALTIMERPROC                                  mpTimerProc;		// timer callback proc
85cdf0e10cSrcweir 	AquaSalInstance                              *mpFirstInstance;	// pointer of first instance
86ff005604SEike Rathke 	std::list<AquaSalFrame*>                      maFrames;	        // list of all frames
87cdf0e10cSrcweir     std::hash_set<const AquaSalFrame*,FrameHash>  maFrameCheck;     // for fast check of frame existance
88ff005604SEike Rathke 	std::list<AquaSalFrame*>                      maPresentationFrames;  // list of frames in presentation mode
89cdf0e10cSrcweir 	SalObject                                    *mpFirstObject;	// pointer of first object window
90cdf0e10cSrcweir 	SalVirtualDevice                             *mpFirstVD;    	// first VirDev
91cdf0e10cSrcweir 	SalPrinter                                   *mpFirstPrinter; 	// first printing printer
92cdf0e10cSrcweir     SystemFontList                               *mpFontList;
93cdf0e10cSrcweir     NSStatusItem*                                 mpStatusItem;     // one status item that draws all our stati
94cdf0e10cSrcweir                                                                     // at the moment this is only one add menu button
95cdf0e10cSrcweir 
96cdf0e10cSrcweir     CGColorSpaceRef                               mxRGBSpace;
97cdf0e10cSrcweir     CGColorSpaceRef                               mxGraySpace;
98cdf0e10cSrcweir     CGColorSpaceRef                               mxP50Space;
99cdf0e10cSrcweir     CGPatternRef                                  mxP50Pattern;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     std::vector< NSCursor* >                      maCursors;
102cdf0e10cSrcweir     std::vector< NSMenuItem* >                    maFallbackMenu;
103cdf0e10cSrcweir     std::map< NSEvent*, bool >                    maKeyEventAnswer;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     static oslThreadKey                           s_aAutoReleaseKey;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     bool			                              mbIsScrollbarDoubleMax;	// TODO: support DoubleMin and DoubleBoth too
108cdf0e10cSrcweir     SInt32                                        mnSystemVersion;          // Store System Version
109*dbfe0a54SHerbert Dürr     AppleRemoteMainController*                    mpAppleRemoteMainController;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     NSObject*                                     mpDockIconClickHandler;
112cdf0e10cSrcweir     long                                          mnDPIX;           // #i100617# read DPI only once per office life
113cdf0e10cSrcweir     long                                          mnDPIY;           // #i100617# read DPI only once per office life
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
116cdf0e10cSrcweir                                                   mxClipboard;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     SalData();
119cdf0e10cSrcweir     ~SalData();
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     NSCursor* getCursor( PointerStyle i_eStyle );
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     static void ensureThreadAutoreleasePool();
124cdf0e10cSrcweir     static void drainThreadAutoreleasePool();
125cdf0e10cSrcweir 
126cdf0e10cSrcweir     static NSStatusItem* getStatusItem();
127cdf0e10cSrcweir };
128cdf0e10cSrcweir 
SetSalData(SalData * pData)129cdf0e10cSrcweir inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; }
GetSalData()130cdf0e10cSrcweir inline SalData *GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; }
GetAppSalData()131cdf0e10cSrcweir inline SalData *GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; }
132cdf0e10cSrcweir 
133cdf0e10cSrcweir // --- Prototypes ---
134cdf0e10cSrcweir 
135cdf0e10cSrcweir sal_Bool ImplSalYieldMutexTryToAcquire();
136cdf0e10cSrcweir void ImplSalYieldMutexAcquire();
137cdf0e10cSrcweir void ImplSalYieldMutexRelease();
138cdf0e10cSrcweir 
139cdf0e10cSrcweir #endif	// _SV_SALDATA_HXX
140