update dev300-m58
[ooovba.git] / vcl / aqua / inc / saldata.hxx
blob97eec879dc18779bce681c1a147a4b057b250165
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: saldata.hxx,v $
10 * $Revision: 1.22.64.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SV_SALDATA_HXX
32 #define _SV_SALDATA_HXX
34 #include "premac.h"
35 #include <Cocoa/Cocoa.h>
36 #include "postmac.h"
38 #include "vcl/sv.h"
39 #include "vcl/svdata.hxx"
40 #include "vcl/salwtype.hxx"
41 #include "vcl/ptrstyle.hxx"
43 #include <list>
44 #include <vector>
45 #include <map>
46 #include <hash_set>
48 #include <cstdio>
49 #include <cstdarg>
51 #include "apple_remote/RemoteMainController.h"
53 class AquaSalInstance;
54 class SalObject;
55 class SalFrame;
56 class SalVirtualDevice;
57 class SalPrinter;
58 class SystemFontList;
60 // ------------------
61 // - Some constants -
62 // ------------------
64 #define SAL_CLIPRECT_COUNT 16
66 #define VER_TIGER 0x1040
67 #define VER_LEOPARD 0x1050
69 // -----------
70 // - SalData -
71 // -----------
73 class AquaSalFrame;
74 struct FrameHash : public std::hash<sal_IntPtr>
76 size_t operator()(const AquaSalFrame* frame) const
77 { return std::hash<sal_IntPtr>::operator()( reinterpret_cast<const sal_IntPtr>(frame) ); }
80 #define INVALID_CURSOR_PTR (NSCursor*)0xdeadbeef
82 struct SalData
85 SALTIMERPROC mpTimerProc; // timer callback proc
86 AquaSalInstance *mpFirstInstance; // pointer of first instance
87 std::list<AquaSalFrame*> maFrames; // pointer of first frame
88 std::hash_set<const AquaSalFrame*,FrameHash> maFrameCheck; // for fast check of frame existance
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
96 CGColorSpaceRef mxRGBSpace;
97 CGColorSpaceRef mxGraySpace;
98 CGColorSpaceRef mxP50Space;
99 CGPatternRef mxP50Pattern;
101 std::vector< NSCursor* > maCursors;
102 std::vector< NSMenuItem* > maFallbackMenu;
103 std::map< NSEvent*, bool > maKeyEventAnswer;
105 static oslThreadKey s_aAutoReleaseKey;
107 bool mbIsScrollbarDoubleMax; // TODO: support DoubleMin and DoubleBoth too
108 SInt32 mnSystemVersion; // Store System Version
109 MainController* mpMainController; // Apple Remote
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
115 SalData();
116 ~SalData();
118 NSCursor* getCursor( PointerStyle i_eStyle );
120 static void ensureThreadAutoreleasePool();
121 static void drainThreadAutoreleasePool();
123 static NSStatusItem* getStatusItem();
126 inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; }
127 inline SalData *GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; }
128 inline SalData *GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; }
130 // --- Prototypes ---
132 BOOL ImplSalYieldMutexTryToAcquire();
133 void ImplSalYieldMutexAcquire();
134 void ImplSalYieldMutexRelease();
136 #endif // _SV_SALDATA_HXX