xref: /AOO41X/main/vcl/inc/win/salgdi.h (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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 <sallayout.hxx>
32*cdf0e10cSrcweir #include <salgdi.hxx>
33*cdf0e10cSrcweir #include <outfont.hxx>
34*cdf0e10cSrcweir #include <impfont.hxx>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include "boost/scoped_ptr.hpp"
37*cdf0e10cSrcweir #include <hash_set>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir class ImplFontSelectData;
40*cdf0e10cSrcweir class ImplWinFontEntry;
41*cdf0e10cSrcweir class ImplFontAttrCache;
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir // -----------
44*cdf0e10cSrcweir // - Defines -
45*cdf0e10cSrcweir // -----------
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir #define RGB_TO_PALRGB(nRGB) 		((nRGB)|0x02000000)
48*cdf0e10cSrcweir #define PALRGB_TO_RGB(nPalRGB)		((nPalRGB)&0x00ffffff)
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir // win32 platform specific options. Move them to the PMK file?
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir #define GCP_KERN_HACK
53*cdf0e10cSrcweir #define GNG_VERT_HACK
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir // win32 specific physically available font face
56*cdf0e10cSrcweir class ImplWinFontData : public ImplFontData
57*cdf0e10cSrcweir {
58*cdf0e10cSrcweir public:
59*cdf0e10cSrcweir     explicit                ImplWinFontData( const ImplDevFontAttributes&,
60*cdf0e10cSrcweir                                 int nFontHeight, BYTE eWinCharSet,
61*cdf0e10cSrcweir                                 BYTE nPitchAndFamily  );
62*cdf0e10cSrcweir     virtual                 ~ImplWinFontData();
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir     virtual ImplFontData*   Clone() const;
65*cdf0e10cSrcweir     virtual ImplFontEntry*  CreateFontInstance( ImplFontSelectData& ) const;
66*cdf0e10cSrcweir     virtual sal_IntPtr      GetFontId() const;
67*cdf0e10cSrcweir     void                    SetFontId( sal_IntPtr nId ) { mnId = nId; }
68*cdf0e10cSrcweir     void                    UpdateFromHDC( HDC ) const;
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir     bool                    HasChar( sal_uInt32 cChar ) const;
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir     BYTE                GetCharSet() const          { return meWinCharSet; }
73*cdf0e10cSrcweir     BYTE                GetPitchAndFamily() const   { return mnPitchAndFamily; }
74*cdf0e10cSrcweir     bool                    IsGlyphApiDisabled() const  { return mbDisableGlyphApi; }
75*cdf0e10cSrcweir     bool                    SupportsKorean() const      { return mbHasKoreanRange; }
76*cdf0e10cSrcweir     bool                    SupportsCJK() const         { return mbHasCJKSupport; }
77*cdf0e10cSrcweir     bool                    SupportsArabic() const      { return mbHasArabicSupport; }
78*cdf0e10cSrcweir     bool                    AliasSymbolsHigh() const    { return mbAliasSymbolsHigh; }
79*cdf0e10cSrcweir     bool                    AliasSymbolsLow() const     { return mbAliasSymbolsLow; }
80*cdf0e10cSrcweir #ifdef ENABLE_GRAPHITE
81*cdf0e10cSrcweir 	bool                    SupportsGraphite() const    { return mbHasGraphiteSupport; }
82*cdf0e10cSrcweir #endif
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir     const ImplFontCharMap*  GetImplFontCharMap() const;
85*cdf0e10cSrcweir     const Ucs2SIntMap* GetEncodingVector() const { return mpEncodingVector; }
86*cdf0e10cSrcweir     void SetEncodingVector( const Ucs2SIntMap* pNewVec ) const
87*cdf0e10cSrcweir     {
88*cdf0e10cSrcweir         if( mpEncodingVector )
89*cdf0e10cSrcweir             delete mpEncodingVector;
90*cdf0e10cSrcweir         mpEncodingVector = pNewVec;
91*cdf0e10cSrcweir     }
92*cdf0e10cSrcweir private:
93*cdf0e10cSrcweir     sal_IntPtr              mnId;
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir     // some members that are initalized lazily when the font gets selected into a HDC
96*cdf0e10cSrcweir     mutable bool                    mbDisableGlyphApi;
97*cdf0e10cSrcweir     mutable bool                    mbHasKoreanRange;
98*cdf0e10cSrcweir     mutable bool                    mbHasCJKSupport;
99*cdf0e10cSrcweir #ifdef ENABLE_GRAPHITE
100*cdf0e10cSrcweir     mutable bool                    mbHasGraphiteSupport;
101*cdf0e10cSrcweir #endif
102*cdf0e10cSrcweir     mutable bool                    mbHasArabicSupport;
103*cdf0e10cSrcweir     mutable ImplFontCharMap*        mpUnicodeMap;
104*cdf0e10cSrcweir     mutable const Ucs2SIntMap*      mpEncodingVector;
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir     // TODO: get rid of the members below needed to work with the Win9x non-unicode API
107*cdf0e10cSrcweir     BYTE*                   mpFontCharSets;     // all Charsets for the current font (used on W98 for kerning)
108*cdf0e10cSrcweir     BYTE                    mnFontCharSetCount; // Number of Charsets of the current font; 0 - if not queried
109*cdf0e10cSrcweir     BYTE                meWinCharSet;
110*cdf0e10cSrcweir     BYTE                mnPitchAndFamily;
111*cdf0e10cSrcweir     bool                    mbAliasSymbolsHigh;
112*cdf0e10cSrcweir     bool                    mbAliasSymbolsLow;
113*cdf0e10cSrcweir private:
114*cdf0e10cSrcweir     void                    ReadCmapTable( HDC ) const;
115*cdf0e10cSrcweir     void                    ReadOs2Table( HDC ) const;
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir #ifdef GNG_VERT_HACK
118*cdf0e10cSrcweir     void                    ReadGsubTable( HDC ) const;
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir     typedef std::hash_set<sal_UCS4> UcsHashSet;
121*cdf0e10cSrcweir     mutable UcsHashSet      maGsubTable;
122*cdf0e10cSrcweir     mutable bool            mbGsubRead;
123*cdf0e10cSrcweir public:
124*cdf0e10cSrcweir     bool                    HasGSUBstitutions( HDC ) const;
125*cdf0e10cSrcweir     bool                    IsGSUBstituted( sal_UCS4 ) const;
126*cdf0e10cSrcweir #endif // GNG_VERT_HACK
127*cdf0e10cSrcweir };
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir // ------------------
130*cdf0e10cSrcweir // - WinSalGraphics -
131*cdf0e10cSrcweir // ------------------
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir class WinSalGraphics : public SalGraphics
134*cdf0e10cSrcweir {
135*cdf0e10cSrcweir public:
136*cdf0e10cSrcweir 	HDC 					mhDC;				// HDC
137*cdf0e10cSrcweir 	HWND					mhWnd;				// Window-Handle, when Window-Graphics
138*cdf0e10cSrcweir 	HFONT					mhFonts[ MAX_FALLBACK ];        // Font + Fallbacks
139*cdf0e10cSrcweir     const ImplWinFontData*  mpWinFontData[ MAX_FALLBACK ];  // pointer to the most recent font face
140*cdf0e10cSrcweir     ImplWinFontEntry*       mpWinFontEntry[ MAX_FALLBACK ]; // pointer to the most recent font instance
141*cdf0e10cSrcweir     float                   mfFontScale;        // allows metrics emulation of huge font sizes
142*cdf0e10cSrcweir 	HPEN					mhPen;				// Pen
143*cdf0e10cSrcweir 	HBRUSH					mhBrush;			// Brush
144*cdf0e10cSrcweir 	HRGN					mhRegion;			// Region Handle
145*cdf0e10cSrcweir 	HPEN					mhDefPen;			// DefaultPen
146*cdf0e10cSrcweir 	HBRUSH					mhDefBrush; 		// DefaultBrush
147*cdf0e10cSrcweir 	HFONT					mhDefFont;			// DefaultFont
148*cdf0e10cSrcweir 	HPALETTE				mhDefPal;			// DefaultPalette
149*cdf0e10cSrcweir 	COLORREF				mnPenColor; 		// PenColor
150*cdf0e10cSrcweir 	COLORREF				mnBrushColor;		// BrushColor
151*cdf0e10cSrcweir 	COLORREF				mnTextColor;		// TextColor
152*cdf0e10cSrcweir 	RGNDATA*				mpClipRgnData;		// ClipRegion-Data
153*cdf0e10cSrcweir 	RGNDATA*				mpStdClipRgnData;	// Cache Standard-ClipRegion-Data
154*cdf0e10cSrcweir 	LOGFONTA*				mpLogFont;			// LOG-Font which is currently selected (only W9x)
155*cdf0e10cSrcweir 	ImplFontAttrCache*		mpFontAttrCache;	// Cache font attributes from files in so/share/fonts
156*cdf0e10cSrcweir 	BYTE*					mpFontCharSets; 	// All Charsets for the current font
157*cdf0e10cSrcweir 	BYTE					mnFontCharSetCount; // Number of Charsets of the current font; 0 - if not queried
158*cdf0e10cSrcweir 	sal_Bool					mbFontKernInit; 	// FALSE: FontKerns must be queried
159*cdf0e10cSrcweir 	KERNINGPAIR*			mpFontKernPairs;	// Kerning Pairs of the current Font
160*cdf0e10cSrcweir 	sal_uIntPtr					mnFontKernPairCount;// Number of Kerning Pairs of the current Font
161*cdf0e10cSrcweir 	int 					mnPenWidth; 		// Linienbreite
162*cdf0e10cSrcweir 	sal_Bool					mbStockPen; 		// is Pen a stockpen
163*cdf0e10cSrcweir 	sal_Bool					mbStockBrush;		// is Brush a stcokbrush
164*cdf0e10cSrcweir 	sal_Bool					mbPen;				// is Pen (FALSE == NULL_PEN)
165*cdf0e10cSrcweir 	sal_Bool					mbBrush;			// is Brush (FALSE == NULL_BRUSH)
166*cdf0e10cSrcweir 	sal_Bool					mbPrinter;			// is Printer
167*cdf0e10cSrcweir 	sal_Bool					mbVirDev;			// is VirDev
168*cdf0e10cSrcweir 	sal_Bool					mbWindow;			// is Window
169*cdf0e10cSrcweir 	sal_Bool					mbScreen;			// is Screen compatible
170*cdf0e10cSrcweir 	bool					mbXORMode;			// _every_ output with RasterOp XOR
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir     // remember RGB values for SetLineColor/SetFillColor
173*cdf0e10cSrcweir     SalColor                maLineColor;
174*cdf0e10cSrcweir     SalColor                maFillColor;
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir     HFONT                   ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFontScale, HFONT& o_rOldFont );
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir public:
179*cdf0e10cSrcweir     explicit WinSalGraphics();
180*cdf0e10cSrcweir     virtual ~WinSalGraphics();
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir protected:
183*cdf0e10cSrcweir     virtual bool        setClipRegion( const Region& );
184*cdf0e10cSrcweir     // draw --> LineColor and FillColor and RasterOp and ClipRegion
185*cdf0e10cSrcweir     virtual void		drawPixel( long nX, long nY );
186*cdf0e10cSrcweir     virtual void		drawPixel( long nX, long nY, SalColor nSalColor );
187*cdf0e10cSrcweir     virtual void		drawLine( long nX1, long nY1, long nX2, long nY2 );
188*cdf0e10cSrcweir     virtual void		drawRect( long nX, long nY, long nWidth, long nHeight );
189*cdf0e10cSrcweir     virtual void		drawPolyLine( sal_uIntPtr nPoints, const SalPoint* pPtAry );
190*cdf0e10cSrcweir     virtual void		drawPolygon( sal_uIntPtr nPoints, const SalPoint* pPtAry );
191*cdf0e10cSrcweir     virtual void		drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry );
192*cdf0e10cSrcweir     virtual bool        drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
193*cdf0e10cSrcweir     virtual bool        drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin );
194*cdf0e10cSrcweir     virtual sal_Bool	drawPolyLineBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry );
195*cdf0e10cSrcweir     virtual sal_Bool	drawPolygonBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry );
196*cdf0e10cSrcweir     virtual sal_Bool	drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry );
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir     // CopyArea --> No RasterOp, but ClipRegion
199*cdf0e10cSrcweir     virtual void		copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth,
200*cdf0e10cSrcweir                                   long nSrcHeight, sal_uInt16 nFlags );
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir     // CopyBits and DrawBitmap --> RasterOp and ClipRegion
203*cdf0e10cSrcweir     // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
204*cdf0e10cSrcweir     virtual void		copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics );
205*cdf0e10cSrcweir     virtual void		drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap );
206*cdf0e10cSrcweir     virtual void		drawBitmap( const SalTwoRect* pPosAry,
207*cdf0e10cSrcweir                                     const SalBitmap& rSalBitmap,
208*cdf0e10cSrcweir                                     SalColor nTransparentColor );
209*cdf0e10cSrcweir     virtual void		drawBitmap( const SalTwoRect* pPosAry,
210*cdf0e10cSrcweir                                     const SalBitmap& rSalBitmap,
211*cdf0e10cSrcweir                                     const SalBitmap& rTransparentBitmap );
212*cdf0e10cSrcweir     virtual void		drawMask( const SalTwoRect* pPosAry,
213*cdf0e10cSrcweir                                   const SalBitmap& rSalBitmap,
214*cdf0e10cSrcweir                                   SalColor nMaskColor );
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir     virtual SalBitmap*	getBitmap( long nX, long nY, long nWidth, long nHeight );
217*cdf0e10cSrcweir     virtual SalColor	getPixel( long nX, long nY );
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir     // invert --> ClipRegion (only Windows or VirDevs)
220*cdf0e10cSrcweir     virtual void		invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags);
221*cdf0e10cSrcweir     virtual void		invert( sal_uIntPtr nPoints, const SalPoint* pPtAry, SalInvert nFlags );
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir     virtual sal_Bool		drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uIntPtr nSize );
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir     // native widget rendering methods that require mirroring
226*cdf0e10cSrcweir     virtual sal_Bool        hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
227*cdf0e10cSrcweir                                               const Point& aPos, sal_Bool& rIsInside );
228*cdf0e10cSrcweir     virtual sal_Bool        drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
229*cdf0e10cSrcweir                                            ControlState nState, const ImplControlValue& aValue,
230*cdf0e10cSrcweir                                            const rtl::OUString& aCaption );
231*cdf0e10cSrcweir     virtual sal_Bool        drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
232*cdf0e10cSrcweir                                                ControlState nState, const ImplControlValue& aValue,
233*cdf0e10cSrcweir                                                const rtl::OUString& aCaption );
234*cdf0e10cSrcweir     virtual sal_Bool        getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState,
235*cdf0e10cSrcweir                                                 const ImplControlValue& aValue, const rtl::OUString& aCaption,
236*cdf0e10cSrcweir                                                 Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion );
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir     virtual bool		drawAlphaBitmap( const SalTwoRect&,
239*cdf0e10cSrcweir                                          const SalBitmap& rSourceBitmap,
240*cdf0e10cSrcweir                                          const SalBitmap& rAlphaBitmap );
241*cdf0e10cSrcweir     virtual bool		drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency );
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir public:
244*cdf0e10cSrcweir     // public SalGraphics methods, the interface to teh independent vcl part
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir     // get device resolution
247*cdf0e10cSrcweir     virtual void			GetResolution( long& rDPIX, long& rDPIY );
248*cdf0e10cSrcweir     // get the depth of the device
249*cdf0e10cSrcweir     virtual sal_uInt16			GetBitCount();
250*cdf0e10cSrcweir     // get the width of the device
251*cdf0e10cSrcweir     virtual long			GetGraphicsWidth() const;
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir     // set the clip region to empty
254*cdf0e10cSrcweir     virtual void			ResetClipRegion();
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir     // set the line color to transparent (= don't draw lines)
257*cdf0e10cSrcweir     virtual void			SetLineColor();
258*cdf0e10cSrcweir     // set the line color to a specific color
259*cdf0e10cSrcweir     virtual void			SetLineColor( SalColor nSalColor );
260*cdf0e10cSrcweir     // set the fill color to transparent (= don't fill)
261*cdf0e10cSrcweir     virtual void			SetFillColor();
262*cdf0e10cSrcweir     // set the fill color to a specific color, shapes will be
263*cdf0e10cSrcweir     // filled accordingly
264*cdf0e10cSrcweir     virtual void          	SetFillColor( SalColor nSalColor );
265*cdf0e10cSrcweir     // enable/disable XOR drawing
266*cdf0e10cSrcweir     virtual void			SetXORMode( bool bSet, bool );
267*cdf0e10cSrcweir     // set line color for raster operations
268*cdf0e10cSrcweir     virtual void			SetROPLineColor( SalROPColor nROPColor );
269*cdf0e10cSrcweir     // set fill color for raster operations
270*cdf0e10cSrcweir     virtual void			SetROPFillColor( SalROPColor nROPColor );
271*cdf0e10cSrcweir     // set the text color to a specific color
272*cdf0e10cSrcweir     virtual void			SetTextColor( SalColor nSalColor );
273*cdf0e10cSrcweir     // set the font
274*cdf0e10cSrcweir     virtual sal_uInt16         SetFont( ImplFontSelectData*, int nFallbackLevel );
275*cdf0e10cSrcweir     // get the current font's etrics
276*cdf0e10cSrcweir     virtual void			GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
277*cdf0e10cSrcweir     // get kernign pairs of the current font
278*cdf0e10cSrcweir     // return only PairCount if (pKernPairs == NULL)
279*cdf0e10cSrcweir     virtual sal_uLong			GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs );
280*cdf0e10cSrcweir     // get the repertoire of the current font
281*cdf0e10cSrcweir     virtual const ImplFontCharMap* GetImplFontCharMap() const;
282*cdf0e10cSrcweir     // graphics must fill supplied font list
283*cdf0e10cSrcweir     virtual void			GetDevFontList( ImplDevFontList* );
284*cdf0e10cSrcweir     // graphics should call ImplAddDevFontSubstitute on supplied
285*cdf0e10cSrcweir     // OutputDevice for all its device specific preferred font substitutions
286*cdf0e10cSrcweir     virtual void			GetDevFontSubstList( OutputDevice* );
287*cdf0e10cSrcweir     virtual bool			AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName );
288*cdf0e10cSrcweir     // CreateFontSubset: a method to get a subset of glyhps of a font
289*cdf0e10cSrcweir     // inside a new valid font file
290*cdf0e10cSrcweir     // returns TRUE if creation of subset was successfull
291*cdf0e10cSrcweir     // parameters: rToFile: contains a osl file URL to write the subset to
292*cdf0e10cSrcweir     //             pFont: describes from which font to create a subset
293*cdf0e10cSrcweir     //             pGlyphIDs: the glyph ids to be extracted
294*cdf0e10cSrcweir     //             pEncoding: the character code corresponding to each glyph
295*cdf0e10cSrcweir     //             pWidths: the advance widths of the correspoding glyphs (in PS font units)
296*cdf0e10cSrcweir     //             nGlyphs: the number of glyphs
297*cdf0e10cSrcweir     //             rInfo: additional outgoing information
298*cdf0e10cSrcweir     // implementation note: encoding 0 with glyph id 0 should be added implicitly
299*cdf0e10cSrcweir     // as "undefined character"
300*cdf0e10cSrcweir     virtual sal_Bool			CreateFontSubset( const rtl::OUString& rToFile,
301*cdf0e10cSrcweir                                               const ImplFontData*,
302*cdf0e10cSrcweir                                               long* pGlyphIDs,
303*cdf0e10cSrcweir                                               sal_uInt8* pEncoding,
304*cdf0e10cSrcweir                                               sal_Int32* pWidths,
305*cdf0e10cSrcweir                                               int nGlyphs,
306*cdf0e10cSrcweir                                               FontSubsetInfo& rInfo // out parameter
307*cdf0e10cSrcweir                                               );
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir     // GetFontEncodingVector: a method to get the encoding map Unicode
310*cdf0e10cSrcweir 	// to font encoded character; this is only used for type1 fonts and
311*cdf0e10cSrcweir     // may return NULL in case of unknown encoding vector
312*cdf0e10cSrcweir     // if ppNonEncoded is set and non encoded characters (that is type1
313*cdf0e10cSrcweir     // glyphs with only a name) exist it is set to the corresponding
314*cdf0e10cSrcweir     // map for non encoded glyphs; the encoding vector contains -1
315*cdf0e10cSrcweir     // as encoding for these cases
316*cdf0e10cSrcweir     virtual const Ucs2SIntMap* GetFontEncodingVector( const ImplFontData*, const Ucs2OStrMap** ppNonEncoded );
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir     // GetEmbedFontData: gets the font data for a font marked
319*cdf0e10cSrcweir     // embeddable by GetDevFontList or NULL in case of error
320*cdf0e10cSrcweir     // parameters: pFont: describes the font in question
321*cdf0e10cSrcweir     //             pWidths: the widths of all glyphs from char code 0 to 255
322*cdf0e10cSrcweir     //                      pWidths MUST support at least 256 members;
323*cdf0e10cSrcweir     //             rInfo: additional outgoing information
324*cdf0e10cSrcweir     //             pDataLen: out parameter, contains the byte length of the returned buffer
325*cdf0e10cSrcweir     virtual const void*	GetEmbedFontData( const ImplFontData*,
326*cdf0e10cSrcweir                                           const sal_Ucs* pUnicodes,
327*cdf0e10cSrcweir                                           sal_Int32* pWidths,
328*cdf0e10cSrcweir                                           FontSubsetInfo& rInfo,
329*cdf0e10cSrcweir                                           long* pDataLen );
330*cdf0e10cSrcweir     // frees the font data again
331*cdf0e10cSrcweir     virtual void			FreeEmbedFontData( const void* pData, long nDataLen );
332*cdf0e10cSrcweir     virtual void            GetGlyphWidths( const ImplFontData*,
333*cdf0e10cSrcweir                                             bool bVertical,
334*cdf0e10cSrcweir                                             Int32Vector& rWidths,
335*cdf0e10cSrcweir                                             Ucs2UIntMap& rUnicodeEnc );
336*cdf0e10cSrcweir 	virtual int             GetMinKashidaWidth();
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir     virtual sal_Bool                    GetGlyphBoundRect( long nIndex, Rectangle& );
339*cdf0e10cSrcweir     virtual sal_Bool                    GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& );
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir     virtual SalLayout*              GetTextLayout( ImplLayoutArgs&, int nFallbackLevel );
342*cdf0e10cSrcweir     virtual void					 DrawServerFontLayout( const ServerFontLayout& );
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir     virtual bool            supportsOperation( OutDevSupportType ) const;
345*cdf0e10cSrcweir     // Query the platform layer for control support
346*cdf0e10cSrcweir     virtual sal_Bool IsNativeControlSupported( ControlType nType, ControlPart nPart );
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir     virtual SystemGraphicsData GetGraphicsData() const;
349*cdf0e10cSrcweir     virtual SystemFontData     GetSysFontData( int nFallbacklevel ) const;
350*cdf0e10cSrcweir };
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir // Init/Deinit Graphics
353*cdf0e10cSrcweir void	ImplSalInitGraphics( WinSalGraphics* );
354*cdf0e10cSrcweir void	ImplSalDeInitGraphics( WinSalGraphics* );
355*cdf0e10cSrcweir void	ImplUpdateSysColorEntries();
356*cdf0e10cSrcweir int 	ImplIsSysColorEntry( SalColor nSalColor );
357*cdf0e10cSrcweir void    ImplGetLogFontFromFontSelect( HDC, const ImplFontSelectData*,
358*cdf0e10cSrcweir             LOGFONTW&, bool bTestVerticalAvail );
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir // -----------
361*cdf0e10cSrcweir // - Defines -
362*cdf0e10cSrcweir // -----------
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir #define MAX_64KSALPOINTS	((((sal_uInt16)0xFFFF)-8)/sizeof(POINTS))
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir // -----------
367*cdf0e10cSrcweir // - Inlines -
368*cdf0e10cSrcweir // -----------
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir // #102411# Win's GCP mishandles kerning => we need to do it ourselves
371*cdf0e10cSrcweir // SalGraphicsData::mpFontKernPairs is sorted by
372*cdf0e10cSrcweir inline bool ImplCmpKernData( const KERNINGPAIR& a, const KERNINGPAIR& b )
373*cdf0e10cSrcweir {
374*cdf0e10cSrcweir     if( a.wFirst < b.wFirst )
375*cdf0e10cSrcweir         return true;
376*cdf0e10cSrcweir     if( a.wFirst > b.wFirst )
377*cdf0e10cSrcweir         return false;
378*cdf0e10cSrcweir     return (a.wSecond < b.wSecond);
379*cdf0e10cSrcweir }
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir // called extremely often from just one spot => inline
382*cdf0e10cSrcweir inline bool ImplWinFontData::HasChar( sal_uInt32 cChar ) const
383*cdf0e10cSrcweir {
384*cdf0e10cSrcweir     if( mpUnicodeMap->HasChar( cChar ) )
385*cdf0e10cSrcweir         return true;
386*cdf0e10cSrcweir     // second chance to allow symbol aliasing
387*cdf0e10cSrcweir     if( mbAliasSymbolsLow && ((cChar-0xF000) <= 0xFF) )
388*cdf0e10cSrcweir         cChar -= 0xF000;
389*cdf0e10cSrcweir     else if( mbAliasSymbolsHigh && (cChar <= 0xFF) )
390*cdf0e10cSrcweir         cChar += 0xF000;
391*cdf0e10cSrcweir     else
392*cdf0e10cSrcweir         return false;
393*cdf0e10cSrcweir     return mpUnicodeMap->HasChar( cChar );
394*cdf0e10cSrcweir }
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir #endif // _SV_SALGDI_H
397*cdf0e10cSrcweir 
398