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