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