xref: /aoo42x/main/vcl/inc/aqua/salgdi.h (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _SV_SALGDI_H
29*cdf0e10cSrcweir #define _SV_SALGDI_H
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "basegfx/polygon/b2dpolypolygon.hxx"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include "premac.h"
34*cdf0e10cSrcweir #include <ApplicationServices/ApplicationServices.h>
35*cdf0e10cSrcweir #include "postmac.h"
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir #include "aqua/aquavcltypes.h"
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include "outfont.hxx"
40*cdf0e10cSrcweir #include "salgdi.hxx"
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #include <vector>
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir class AquaSalFrame;
45*cdf0e10cSrcweir class AquaSalBitmap;
46*cdf0e10cSrcweir class ImplDevFontAttributes;
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir class CGRect;
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir // mac specific physically available font face
51*cdf0e10cSrcweir class ImplMacFontData : public ImplFontData
52*cdf0e10cSrcweir {
53*cdf0e10cSrcweir public:
54*cdf0e10cSrcweir 	ImplMacFontData( const ImplDevFontAttributes&, ATSUFontID );
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir     virtual ~ImplMacFontData();
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir     virtual ImplFontData*   Clone() const;
59*cdf0e10cSrcweir     virtual ImplFontEntry*  CreateFontInstance( ImplFontSelectData& ) const;
60*cdf0e10cSrcweir 	virtual sal_IntPtr      GetFontId() const;
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir     const ImplFontCharMap*	GetImplFontCharMap() const;
63*cdf0e10cSrcweir 	bool					HasChar( sal_uInt32 cChar ) const;
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir 	void					ReadOs2Table() const;
66*cdf0e10cSrcweir 	void					ReadMacCmapEncoding() const;
67*cdf0e10cSrcweir 	bool					HasCJKSupport() const;
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir private:
70*cdf0e10cSrcweir     const ATSUFontID			mnFontId;
71*cdf0e10cSrcweir 	mutable const ImplFontCharMap*	mpCharMap;
72*cdf0e10cSrcweir 	mutable bool				mbOs2Read;		 // true if OS2-table related info is valid
73*cdf0e10cSrcweir 	mutable bool				mbHasOs2Table;
74*cdf0e10cSrcweir 	mutable bool				mbCmapEncodingRead; // true if cmap encoding of Mac font is read
75*cdf0e10cSrcweir 	mutable bool				mbHasCJKSupport; // #i78970# CJK fonts need extra leading
76*cdf0e10cSrcweir };
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir // abstracting quartz color instead of having to use an CGFloat[] array
79*cdf0e10cSrcweir class RGBAColor
80*cdf0e10cSrcweir {
81*cdf0e10cSrcweir public:
82*cdf0e10cSrcweir 	RGBAColor( SalColor );
83*cdf0e10cSrcweir 	RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ); //NOTUSEDYET
84*cdf0e10cSrcweir 	const float* AsArray() const	{ return &mfRed; }
85*cdf0e10cSrcweir 	bool IsVisible() const			{ return (mfAlpha > 0); }
86*cdf0e10cSrcweir 	void SetAlpha( float fAlpha )	{ mfAlpha = fAlpha; }
87*cdf0e10cSrcweir private:
88*cdf0e10cSrcweir 	float mfRed, mfGreen, mfBlue, mfAlpha;
89*cdf0e10cSrcweir };
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir // -------------------
92*cdf0e10cSrcweir // - AquaSalGraphics -
93*cdf0e10cSrcweir // -------------------
94*cdf0e10cSrcweir class AquaSalGraphics : public SalGraphics
95*cdf0e10cSrcweir {
96*cdf0e10cSrcweir     friend class ATSLayout;
97*cdf0e10cSrcweir protected:
98*cdf0e10cSrcweir     AquaSalFrame*                           mpFrame;
99*cdf0e10cSrcweir 	CGLayerRef								mxLayer;	// Quartz graphics layer
100*cdf0e10cSrcweir 	CGContextRef		                    mrContext;	// Quartz drawing context
101*cdf0e10cSrcweir 	class XorEmulation*						mpXorEmulation;
102*cdf0e10cSrcweir     int                                     mnXorMode; // 0: off 1: on 2: invert only
103*cdf0e10cSrcweir 	int										mnWidth;
104*cdf0e10cSrcweir 	int										mnHeight;
105*cdf0e10cSrcweir 	int										mnBitmapDepth;	// zero unless bitmap
106*cdf0e10cSrcweir     /// device resolution of this graphics
107*cdf0e10cSrcweir     long                                    mnRealDPIX;
108*cdf0e10cSrcweir 	long                                    mnRealDPIY;
109*cdf0e10cSrcweir 	/// some graphics implementations (e.g. AquaSalInfoPrinter) scale
110*cdf0e10cSrcweir 	/// everything down by a factor (see SetupPrinterGraphics for details)
111*cdf0e10cSrcweir 	/// so we have to compensate for it with the inverse factor
112*cdf0e10cSrcweir     double                                  mfFakeDPIScale;
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir     /// path representing current clip region
115*cdf0e10cSrcweir     CGMutablePathRef                        mxClipPath;
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir     /// Drawing colors
118*cdf0e10cSrcweir     /// pen color RGBA
119*cdf0e10cSrcweir     RGBAColor                               maLineColor;
120*cdf0e10cSrcweir     /// brush color RGBA
121*cdf0e10cSrcweir     RGBAColor                               maFillColor;
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     // Device Font settings
124*cdf0e10cSrcweir  	const ImplMacFontData*                  mpMacFontData;
125*cdf0e10cSrcweir     /// ATSU style object which carries all font attributes
126*cdf0e10cSrcweir     ATSUStyle			                    maATSUStyle;
127*cdf0e10cSrcweir     /// text rotation as ATSU angle
128*cdf0e10cSrcweir     Fixed                                   mnATSUIRotation;
129*cdf0e10cSrcweir     /// workaround to prevent ATSU overflows for huge font sizes
130*cdf0e10cSrcweir     float                                   mfFontScale;
131*cdf0e10cSrcweir     /// <1.0: font is squeezed, >1.0 font is stretched, else 1.0
132*cdf0e10cSrcweir     float                                   mfFontStretch;
133*cdf0e10cSrcweir     /// allows text to be rendered without antialiasing
134*cdf0e10cSrcweir     bool                                    mbNonAntialiasedText;
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir 	// Graphics types
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir     /// is this a printer graphics
139*cdf0e10cSrcweir 	bool                                    mbPrinter;
140*cdf0e10cSrcweir     /// is this a virtual device graphics
141*cdf0e10cSrcweir 	bool                                    mbVirDev;
142*cdf0e10cSrcweir     /// is this a window graphics
143*cdf0e10cSrcweir 	bool                                    mbWindow;
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir public:
146*cdf0e10cSrcweir     AquaSalGraphics();
147*cdf0e10cSrcweir     virtual ~AquaSalGraphics();
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir     bool                IsPenVisible() const	{ return maLineColor.IsVisible(); }
150*cdf0e10cSrcweir     bool                IsBrushVisible() const	{ return maFillColor.IsVisible(); }
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir     void                SetWindowGraphics( AquaSalFrame* pFrame );
153*cdf0e10cSrcweir     void                SetPrinterGraphics( CGContextRef, long nRealDPIX, long nRealDPIY, double fFakeScale );
154*cdf0e10cSrcweir     void                SetVirDevGraphics( CGLayerRef, CGContextRef, int nBitDepth = 0 );
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir     void                initResolution( NSWindow* );
157*cdf0e10cSrcweir     void                copyResolution( AquaSalGraphics& );
158*cdf0e10cSrcweir     void                updateResolution();
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir     bool                IsWindowGraphics()      const   { return mbWindow; }
161*cdf0e10cSrcweir     bool                IsPrinterGraphics()     const   { return mbPrinter; }
162*cdf0e10cSrcweir     bool                IsVirDevGraphics()      const   { return mbVirDev; }
163*cdf0e10cSrcweir     AquaSalFrame*       getGraphicsFrame() const { return mpFrame; }
164*cdf0e10cSrcweir     void                setGraphicsFrame( AquaSalFrame* pFrame ) { mpFrame = pFrame; }
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir     void                ImplDrawPixel( long nX, long nY, const RGBAColor& ); // helper to draw single pixels
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir     bool                CheckContext();
169*cdf0e10cSrcweir     void                UpdateWindow( NSRect& ); // delivered in NSView coordinates
170*cdf0e10cSrcweir 	void				RefreshRect( const CGRect& );
171*cdf0e10cSrcweir 	void				RefreshRect( const NSRect& );
172*cdf0e10cSrcweir 	void				RefreshRect(float lX, float lY, float lWidth, float lHeight);
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir     void                SetState();
175*cdf0e10cSrcweir     void                UnsetState();
176*cdf0e10cSrcweir     // InvalidateContext does an UnsetState and sets mrContext to 0
177*cdf0e10cSrcweir     void                InvalidateContext();
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir     virtual bool        setClipRegion( const Region& );
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir     // draw --> LineColor and FillColor and RasterOp and ClipRegion
182*cdf0e10cSrcweir     virtual void		drawPixel( long nX, long nY );
183*cdf0e10cSrcweir     virtual void		drawPixel( long nX, long nY, SalColor nSalColor );
184*cdf0e10cSrcweir     virtual void		drawLine( long nX1, long nY1, long nX2, long nY2 );
185*cdf0e10cSrcweir     virtual void		drawRect( long nX, long nY, long nWidth, long nHeight );
186*cdf0e10cSrcweir     virtual void		drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry );
187*cdf0e10cSrcweir     virtual void		drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry );
188*cdf0e10cSrcweir     virtual void		drawPolyPolygon( sal_uLong nPoly, const sal_uLong* pPoints, PCONSTSALPOINT* pPtAry );
189*cdf0e10cSrcweir     virtual bool        drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
190*cdf0e10cSrcweir     virtual sal_Bool	drawPolyLineBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry );
191*cdf0e10cSrcweir     virtual sal_Bool	drawPolygonBezier( sal_uLong nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry );
192*cdf0e10cSrcweir     virtual sal_Bool	drawPolyPolygonBezier( sal_uLong nPoly, const sal_uLong* pPoints, const SalPoint* const* pPtAry, const sal_uInt8* const* pFlgAry );
193*cdf0e10cSrcweir     virtual bool        drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin );
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir     // CopyArea --> No RasterOp, but ClipRegion
196*cdf0e10cSrcweir     virtual void		copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth,
197*cdf0e10cSrcweir                                   long nSrcHeight, sal_uInt16 nFlags );
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir     // CopyBits and DrawBitmap --> RasterOp and ClipRegion
200*cdf0e10cSrcweir     // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
201*cdf0e10cSrcweir     virtual void		copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics );
202*cdf0e10cSrcweir     virtual void		drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap );
203*cdf0e10cSrcweir     virtual void		drawBitmap( const SalTwoRect* pPosAry,
204*cdf0e10cSrcweir                                     const SalBitmap& rSalBitmap,
205*cdf0e10cSrcweir                                     SalColor nTransparentColor );
206*cdf0e10cSrcweir     virtual void		drawBitmap( const SalTwoRect* pPosAry,
207*cdf0e10cSrcweir                                     const SalBitmap& rSalBitmap,
208*cdf0e10cSrcweir                                     const SalBitmap& rTransparentBitmap );
209*cdf0e10cSrcweir     virtual void		drawMask( const SalTwoRect* pPosAry,
210*cdf0e10cSrcweir                                   const SalBitmap& rSalBitmap,
211*cdf0e10cSrcweir                                   SalColor nMaskColor );
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir     virtual SalBitmap*	getBitmap( long nX, long nY, long nWidth, long nHeight );
214*cdf0e10cSrcweir     virtual SalColor	getPixel( long nX, long nY );
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir     // invert --> ClipRegion (only Windows or VirDevs)
217*cdf0e10cSrcweir     virtual void		invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags);
218*cdf0e10cSrcweir     virtual void		invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nFlags );
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir     virtual sal_Bool		drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize );
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir     virtual bool 			drawAlphaBitmap( const SalTwoRect&,
223*cdf0e10cSrcweir                                              const SalBitmap& rSourceBitmap,
224*cdf0e10cSrcweir                                              const SalBitmap& rAlphaBitmap );
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir     virtual bool		    drawAlphaRect( long nX, long nY, long nWidth,
227*cdf0e10cSrcweir                                            long nHeight, sal_uInt8 nTransparency );
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir     CGPoint*                makeCGptArray(sal_uLong nPoints, const SalPoint*  pPtAry);
230*cdf0e10cSrcweir     // native widget rendering methods that require mirroring
231*cdf0e10cSrcweir     virtual sal_Bool        hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
232*cdf0e10cSrcweir                                               const Point& aPos, sal_Bool& rIsInside );
233*cdf0e10cSrcweir     virtual sal_Bool        drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
234*cdf0e10cSrcweir                                            ControlState nState, const ImplControlValue& aValue,
235*cdf0e10cSrcweir                                            const rtl::OUString& aCaption );
236*cdf0e10cSrcweir     virtual sal_Bool        drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
237*cdf0e10cSrcweir                                                ControlState nState, const ImplControlValue& aValue,
238*cdf0e10cSrcweir                                                const rtl::OUString& aCaption );
239*cdf0e10cSrcweir     virtual sal_Bool        getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState,
240*cdf0e10cSrcweir                                                 const ImplControlValue& aValue, const rtl::OUString& aCaption,
241*cdf0e10cSrcweir                                                 Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion );
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir     // get device resolution
244*cdf0e10cSrcweir     virtual void			GetResolution( long& rDPIX, long& rDPIY );
245*cdf0e10cSrcweir     // get the depth of the device
246*cdf0e10cSrcweir     virtual sal_uInt16			GetBitCount();
247*cdf0e10cSrcweir     // get the width of the device
248*cdf0e10cSrcweir     virtual long			GetGraphicsWidth() const;
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir     // set the clip region to empty
251*cdf0e10cSrcweir     virtual void			ResetClipRegion();
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir     // set the line color to transparent (= don't draw lines)
254*cdf0e10cSrcweir     virtual void			SetLineColor();
255*cdf0e10cSrcweir     // set the line color to a specific color
256*cdf0e10cSrcweir     virtual void			SetLineColor( SalColor nSalColor );
257*cdf0e10cSrcweir     // set the fill color to transparent (= don't fill)
258*cdf0e10cSrcweir     virtual void			SetFillColor();
259*cdf0e10cSrcweir     // set the fill color to a specific color, shapes will be
260*cdf0e10cSrcweir     // filled accordingly
261*cdf0e10cSrcweir     virtual void          	SetFillColor( SalColor nSalColor );
262*cdf0e10cSrcweir     // enable/disable XOR drawing
263*cdf0e10cSrcweir     virtual void			SetXORMode( bool bSet, bool bInvertOnly );
264*cdf0e10cSrcweir     // set line color for raster operations
265*cdf0e10cSrcweir     virtual void			SetROPLineColor( SalROPColor nROPColor );
266*cdf0e10cSrcweir     // set fill color for raster operations
267*cdf0e10cSrcweir     virtual void			SetROPFillColor( SalROPColor nROPColor );
268*cdf0e10cSrcweir     // set the text color to a specific color
269*cdf0e10cSrcweir     virtual void			SetTextColor( SalColor nSalColor );
270*cdf0e10cSrcweir     // set the font
271*cdf0e10cSrcweir     virtual sal_uInt16         SetFont( ImplFontSelectData*, int nFallbackLevel );
272*cdf0e10cSrcweir     // get the current font's etrics
273*cdf0e10cSrcweir     virtual void			GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
274*cdf0e10cSrcweir     // get kernign pairs of the current font
275*cdf0e10cSrcweir     // return only PairCount if (pKernPairs == NULL)
276*cdf0e10cSrcweir     virtual sal_uLong			GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs );
277*cdf0e10cSrcweir     // get the repertoire of the current font
278*cdf0e10cSrcweir     virtual const ImplFontCharMap* GetImplFontCharMap() const;
279*cdf0e10cSrcweir     // graphics must fill supplied font list
280*cdf0e10cSrcweir     virtual void			GetDevFontList( ImplDevFontList* );
281*cdf0e10cSrcweir     // graphics should call ImplAddDevFontSubstitute on supplied
282*cdf0e10cSrcweir     // OutputDevice for all its device specific preferred font substitutions
283*cdf0e10cSrcweir     virtual void			GetDevFontSubstList( OutputDevice* );
284*cdf0e10cSrcweir     virtual bool			AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName );
285*cdf0e10cSrcweir     // CreateFontSubset: a method to get a subset of glyhps of a font
286*cdf0e10cSrcweir     // inside a new valid font file
287*cdf0e10cSrcweir     // returns TRUE if creation of subset was successfull
288*cdf0e10cSrcweir     // parameters: rToFile: contains a osl file URL to write the subset to
289*cdf0e10cSrcweir     //             pFont: describes from which font to create a subset
290*cdf0e10cSrcweir     //             pGlyphIDs: the glyph ids to be extracted
291*cdf0e10cSrcweir     //             pEncoding: the character code corresponding to each glyph
292*cdf0e10cSrcweir     //             pWidths: the advance widths of the correspoding glyphs (in PS font units)
293*cdf0e10cSrcweir     //             nGlyphs: the number of glyphs
294*cdf0e10cSrcweir     //             rInfo: additional outgoing information
295*cdf0e10cSrcweir     // implementation note: encoding 0 with glyph id 0 should be added implicitly
296*cdf0e10cSrcweir     // as "undefined character"
297*cdf0e10cSrcweir     virtual sal_Bool			CreateFontSubset( const rtl::OUString& rToFile,
298*cdf0e10cSrcweir                                               const ImplFontData* pFont,
299*cdf0e10cSrcweir                                               long* pGlyphIDs,
300*cdf0e10cSrcweir                                               sal_uInt8* pEncoding,
301*cdf0e10cSrcweir                                               sal_Int32* pWidths,
302*cdf0e10cSrcweir                                               int nGlyphs,
303*cdf0e10cSrcweir                                               FontSubsetInfo& rInfo // out parameter
304*cdf0e10cSrcweir                                               );
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir     // GetFontEncodingVector: a method to get the encoding map Unicode
307*cdf0e10cSrcweir 	// to font encoded character; this is only used for type1 fonts and
308*cdf0e10cSrcweir     // may return NULL in case of unknown encoding vector
309*cdf0e10cSrcweir     // if ppNonEncoded is set and non encoded characters (that is type1
310*cdf0e10cSrcweir     // glyphs with only a name) exist it is set to the corresponding
311*cdf0e10cSrcweir     // map for non encoded glyphs; the encoding vector contains -1
312*cdf0e10cSrcweir     // as encoding for these cases
313*cdf0e10cSrcweir     virtual const Ucs2SIntMap* GetFontEncodingVector( const ImplFontData*, const Ucs2OStrMap** ppNonEncoded );
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir     // GetEmbedFontData: gets the font data for a font marked
316*cdf0e10cSrcweir     // embeddable by GetDevFontList or NULL in case of error
317*cdf0e10cSrcweir     // parameters: pFont: describes the font in question
318*cdf0e10cSrcweir     //             pWidths: the widths of all glyphs from char code 0 to 255
319*cdf0e10cSrcweir     //                      pWidths MUST support at least 256 members;
320*cdf0e10cSrcweir     //             rInfo: additional outgoing information
321*cdf0e10cSrcweir     //             pDataLen: out parameter, contains the byte length of the returned buffer
322*cdf0e10cSrcweir     virtual const void*	GetEmbedFontData( const ImplFontData*,
323*cdf0e10cSrcweir                                           const sal_Ucs* pUnicodes,
324*cdf0e10cSrcweir                                           sal_Int32* pWidths,
325*cdf0e10cSrcweir                                           FontSubsetInfo& rInfo,
326*cdf0e10cSrcweir                                           long* pDataLen );
327*cdf0e10cSrcweir     // frees the font data again
328*cdf0e10cSrcweir     virtual void			FreeEmbedFontData( const void* pData, long nDataLen );
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir     virtual void            GetGlyphWidths( const ImplFontData*,
331*cdf0e10cSrcweir                                             bool bVertical,
332*cdf0e10cSrcweir                                             Int32Vector& rWidths,
333*cdf0e10cSrcweir                                             Ucs2UIntMap& rUnicodeEnc );
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir     virtual sal_Bool                    GetGlyphBoundRect( long nIndex, Rectangle& );
336*cdf0e10cSrcweir     virtual sal_Bool                    GetGlyphOutline( long nIndex, basegfx::B2DPolyPolygon& );
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir     virtual SalLayout*              GetTextLayout( ImplLayoutArgs&, int nFallbackLevel );
339*cdf0e10cSrcweir     virtual void					 DrawServerFontLayout( const ServerFontLayout& );
340*cdf0e10cSrcweir     virtual bool                    supportsOperation( OutDevSupportType ) const;
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir     // Query the platform layer for control support
343*cdf0e10cSrcweir     virtual sal_Bool IsNativeControlSupported( ControlType nType, ControlPart nPart );
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir     virtual SystemGraphicsData    GetGraphicsData() const;
346*cdf0e10cSrcweir     virtual SystemFontData        GetSysFontData( int /* nFallbacklevel */ ) const;
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir private:
349*cdf0e10cSrcweir     // differences between VCL, Quartz and kHiThemeOrientation coordinate systems
350*cdf0e10cSrcweir     // make some graphics seem to be vertically-mirrored from a VCL perspective
351*cdf0e10cSrcweir     bool IsFlipped() const { return mbWindow; }
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir 	void ApplyXorContext();
354*cdf0e10cSrcweir     void Pattern50Fill();
355*cdf0e10cSrcweir     UInt32 getState( ControlState nState );
356*cdf0e10cSrcweir     UInt32 getTrackState( ControlState nState );
357*cdf0e10cSrcweir };
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir class XorEmulation
360*cdf0e10cSrcweir {
361*cdf0e10cSrcweir public:
362*cdf0e10cSrcweir 					XorEmulation();
363*cdf0e10cSrcweir 	/*final*/		~XorEmulation();
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir 	void			SetTarget( int nWidth, int nHeight, int nBitmapDepth, CGContextRef, CGLayerRef );
366*cdf0e10cSrcweir 	bool			UpdateTarget();
367*cdf0e10cSrcweir 	void			Enable()			{ mbIsEnabled = true; }
368*cdf0e10cSrcweir 	void			Disable()			{ mbIsEnabled = false; }
369*cdf0e10cSrcweir 	bool 			IsEnabled() const	{ return mbIsEnabled; }
370*cdf0e10cSrcweir 	CGContextRef	GetTargetContext() const { return mxTargetContext; }
371*cdf0e10cSrcweir 	CGContextRef	GetMaskContext() const { return (mbIsEnabled ? mxMaskContext : NULL); }
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir private:
374*cdf0e10cSrcweir 	CGLayerRef		mxTargetLayer;
375*cdf0e10cSrcweir 	CGContextRef	mxTargetContext;
376*cdf0e10cSrcweir 	CGContextRef	mxMaskContext;
377*cdf0e10cSrcweir 	CGContextRef	mxTempContext;
378*cdf0e10cSrcweir 	sal_uLong*			mpMaskBuffer;
379*cdf0e10cSrcweir 	sal_uLong*			mpTempBuffer;
380*cdf0e10cSrcweir 	int				mnBufferLongs;
381*cdf0e10cSrcweir 	bool			mbIsEnabled;
382*cdf0e10cSrcweir };
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir // --- some trivial inlines
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir inline void AquaSalGraphics::RefreshRect( const CGRect& rRect )
388*cdf0e10cSrcweir {
389*cdf0e10cSrcweir 	RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height );
390*cdf0e10cSrcweir }
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir inline void AquaSalGraphics::RefreshRect( const NSRect& rRect )
393*cdf0e10cSrcweir {
394*cdf0e10cSrcweir 	RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height );
395*cdf0e10cSrcweir }
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir inline RGBAColor::RGBAColor( SalColor nSalColor )
398*cdf0e10cSrcweir :	mfRed( SALCOLOR_RED(nSalColor) * (1.0/255))
399*cdf0e10cSrcweir ,	mfGreen( SALCOLOR_GREEN(nSalColor) * (1.0/255))
400*cdf0e10cSrcweir ,	mfBlue( SALCOLOR_BLUE(nSalColor) * (1.0/255))
401*cdf0e10cSrcweir ,	mfAlpha( 1.0 )	// opaque
402*cdf0e10cSrcweir {}
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir inline RGBAColor::RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha )
405*cdf0e10cSrcweir :	mfRed( fRed )
406*cdf0e10cSrcweir ,	mfGreen( fGreen )
407*cdf0e10cSrcweir ,	mfBlue( fBlue )
408*cdf0e10cSrcweir ,	mfAlpha( fAlpha )
409*cdf0e10cSrcweir {}
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir #endif // _SV_SALGDI_H
412