xref: /aoo41x/main/vcl/inc/win/salgdi.h (revision 5f27b83c)
12123d757SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
32123d757SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
42123d757SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
52123d757SAndrew Rist  * distributed with this work for additional information
62123d757SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
72123d757SAndrew Rist  * to you under the Apache License, Version 2.0 (the
82123d757SAndrew Rist  * "License"); you may not use this file except in compliance
92123d757SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
112123d757SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
122123d757SAndrew Rist  *
132123d757SAndrew Rist  * Unless required by applicable law or agreed to in writing,
142123d757SAndrew Rist  * software distributed under the License is distributed on an
152123d757SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
162123d757SAndrew Rist  * KIND, either express or implied.  See the License for the
172123d757SAndrew Rist  * specific language governing permissions and limitations
182123d757SAndrew Rist  * under the License.
192123d757SAndrew Rist  *
202123d757SAndrew Rist  *************************************************************/
212123d757SAndrew Rist 
222123d757SAndrew 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 {
131*5f27b83cSArmin Le Grand private:
132*5f27b83cSArmin Le Grand 	HDC 					mhLocalDC;				// HDC
133*5f27b83cSArmin Le Grand 
134*5f27b83cSArmin Le Grand public:
135*5f27b83cSArmin Le Grand     HDC getHDC() { return mhLocalDC; }
136*5f27b83cSArmin Le Grand     void setHDC(HDC aNew) { mhLocalDC = aNew; }
137*5f27b83cSArmin Le Grand 
138cdf0e10cSrcweir public:
139cdf0e10cSrcweir 	HWND					mhWnd;				// Window-Handle, when Window-Graphics
140cdf0e10cSrcweir 	HFONT					mhFonts[ MAX_FALLBACK ];        // Font + Fallbacks
141cdf0e10cSrcweir     const ImplWinFontData*  mpWinFontData[ MAX_FALLBACK ];  // pointer to the most recent font face
142cdf0e10cSrcweir     ImplWinFontEntry*       mpWinFontEntry[ MAX_FALLBACK ]; // pointer to the most recent font instance
143cdf0e10cSrcweir     float                   mfFontScale;        // allows metrics emulation of huge font sizes
144cdf0e10cSrcweir 	HPEN					mhPen;				// Pen
145cdf0e10cSrcweir 	HBRUSH					mhBrush;			// Brush
146cdf0e10cSrcweir 	HRGN					mhRegion;			// Region Handle
147cdf0e10cSrcweir 	HPEN					mhDefPen;			// DefaultPen
148cdf0e10cSrcweir 	HBRUSH					mhDefBrush; 		// DefaultBrush
149cdf0e10cSrcweir 	HFONT					mhDefFont;			// DefaultFont
150cdf0e10cSrcweir 	HPALETTE				mhDefPal;			// DefaultPalette
151cdf0e10cSrcweir 	COLORREF				mnPenColor; 		// PenColor
152cdf0e10cSrcweir 	COLORREF				mnBrushColor;		// BrushColor
153cdf0e10cSrcweir 	COLORREF				mnTextColor;		// TextColor
154cdf0e10cSrcweir 	RGNDATA*				mpClipRgnData;		// ClipRegion-Data
155cdf0e10cSrcweir 	RGNDATA*				mpStdClipRgnData;	// Cache Standard-ClipRegion-Data
156cdf0e10cSrcweir 	LOGFONTA*				mpLogFont;			// LOG-Font which is currently selected (only W9x)
157cdf0e10cSrcweir 	ImplFontAttrCache*		mpFontAttrCache;	// Cache font attributes from files in so/share/fonts
158cdf0e10cSrcweir 	BYTE*					mpFontCharSets; 	// All Charsets for the current font
159cdf0e10cSrcweir 	BYTE					mnFontCharSetCount; // Number of Charsets of the current font; 0 - if not queried
160cdf0e10cSrcweir 	sal_Bool					mbFontKernInit; 	// FALSE: FontKerns must be queried
161cdf0e10cSrcweir 	KERNINGPAIR*			mpFontKernPairs;	// Kerning Pairs of the current Font
162cdf0e10cSrcweir 	sal_uIntPtr					mnFontKernPairCount;// Number of Kerning Pairs of the current Font
163cdf0e10cSrcweir 	int 					mnPenWidth; 		// Linienbreite
164*5f27b83cSArmin Le Grand 
165*5f27b83cSArmin Le Grand     /// bitfield
166*5f27b83cSArmin Le Grand     bool                    mbStockPen : 1; 		// is Pen a stockpen
167*5f27b83cSArmin Le Grand 	bool                    mbStockBrush : 1;		// is Brush a stcokbrush
168*5f27b83cSArmin Le Grand 	bool                    mbPen : 1;				// is Pen (FALSE == NULL_PEN)
169*5f27b83cSArmin Le Grand 	bool                    mbBrush : 1;			// is Brush (FALSE == NULL_BRUSH)
170*5f27b83cSArmin Le Grand 	bool                    mbPrinter : 1;			// is Printer
171*5f27b83cSArmin Le Grand 	bool                    mbVirDev : 1;			// is VirDev
172*5f27b83cSArmin Le Grand 	bool                    mbWindow : 1;			// is Window
173*5f27b83cSArmin Le Grand 	bool                    mbScreen : 1;			// is Screen compatible
174*5f27b83cSArmin Le Grand 	bool					mbXORMode : 1;			// _every_ output with RasterOp XOR
175cdf0e10cSrcweir 
176cdf0e10cSrcweir     // remember RGB values for SetLineColor/SetFillColor
177cdf0e10cSrcweir     SalColor                maLineColor;
178cdf0e10cSrcweir     SalColor                maFillColor;
179cdf0e10cSrcweir 
180cdf0e10cSrcweir     HFONT                   ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFontScale, HFONT& o_rOldFont );
181cdf0e10cSrcweir 
182cdf0e10cSrcweir public:
183cdf0e10cSrcweir     explicit WinSalGraphics();
184cdf0e10cSrcweir     virtual ~WinSalGraphics();
185cdf0e10cSrcweir 
186cdf0e10cSrcweir protected:
187cdf0e10cSrcweir     virtual bool        setClipRegion( const Region& );
188cdf0e10cSrcweir     // draw --> LineColor and FillColor and RasterOp and ClipRegion
189cdf0e10cSrcweir     virtual void		drawPixel( long nX, long nY );
190cdf0e10cSrcweir     virtual void		drawPixel( long nX, long nY, SalColor nSalColor );
191cdf0e10cSrcweir     virtual void		drawLine( long nX1, long nY1, long nX2, long nY2 );
192cdf0e10cSrcweir     virtual void		drawRect( long nX, long nY, long nWidth, long nHeight );
193cdf0e10cSrcweir     virtual void		drawPolyLine( sal_uIntPtr nPoints, const SalPoint* pPtAry );
194cdf0e10cSrcweir     virtual void		drawPolygon( sal_uIntPtr nPoints, const SalPoint* pPtAry );
195cdf0e10cSrcweir     virtual void		drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry );
196cdf0e10cSrcweir     virtual bool        drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
1975aaf853bSArmin Le Grand     virtual bool        drawPolyLine(
1985aaf853bSArmin Le Grand         const ::basegfx::B2DPolygon&,
1995aaf853bSArmin Le Grand         double fTransparency,
2005aaf853bSArmin Le Grand         const ::basegfx::B2DVector& rLineWidth,
2015aaf853bSArmin Le Grand         basegfx::B2DLineJoin,
2025aaf853bSArmin Le Grand         com::sun::star::drawing::LineCap);
203cdf0e10cSrcweir     virtual sal_Bool	drawPolyLineBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry );
204cdf0e10cSrcweir     virtual sal_Bool	drawPolygonBezier( sal_uIntPtr nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry );
205cdf0e10cSrcweir     virtual sal_Bool	drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry );
206cdf0e10cSrcweir 
207cdf0e10cSrcweir     // CopyArea --> No RasterOp, but ClipRegion
208cdf0e10cSrcweir     virtual void		copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth,
209cdf0e10cSrcweir                                   long nSrcHeight, sal_uInt16 nFlags );
210cdf0e10cSrcweir 
211cdf0e10cSrcweir     // CopyBits and DrawBitmap --> RasterOp and ClipRegion
212cdf0e10cSrcweir     // CopyBits() --> pSrcGraphics == NULL, then CopyBits on same Graphics
213*5f27b83cSArmin Le Grand     virtual void		copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics );
214*5f27b83cSArmin Le Grand     virtual void		drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap );
215*5f27b83cSArmin Le Grand     virtual void		drawBitmap( const SalTwoRect& rPosAry,
216cdf0e10cSrcweir                                     const SalBitmap& rSalBitmap,
217cdf0e10cSrcweir                                     SalColor nTransparentColor );
218*5f27b83cSArmin Le Grand     virtual void		drawBitmap( const SalTwoRect& rPosAry,
219cdf0e10cSrcweir                                     const SalBitmap& rSalBitmap,
220cdf0e10cSrcweir                                     const SalBitmap& rTransparentBitmap );
221*5f27b83cSArmin Le Grand     virtual void		drawMask( const SalTwoRect& rPosAry,
222cdf0e10cSrcweir                                   const SalBitmap& rSalBitmap,
223cdf0e10cSrcweir                                   SalColor nMaskColor );
224cdf0e10cSrcweir 
225cdf0e10cSrcweir     virtual SalBitmap*	getBitmap( long nX, long nY, long nWidth, long nHeight );
226cdf0e10cSrcweir     virtual SalColor	getPixel( long nX, long nY );
227cdf0e10cSrcweir 
228cdf0e10cSrcweir     // invert --> ClipRegion (only Windows or VirDevs)
229cdf0e10cSrcweir     virtual void		invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags);
230cdf0e10cSrcweir     virtual void		invert( sal_uIntPtr nPoints, const SalPoint* pPtAry, SalInvert nFlags );
231cdf0e10cSrcweir 
232cdf0e10cSrcweir     virtual sal_Bool		drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uIntPtr nSize );
233cdf0e10cSrcweir 
234cdf0e10cSrcweir     // native widget rendering methods that require mirroring
235cdf0e10cSrcweir     virtual sal_Bool        hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
236cdf0e10cSrcweir                                               const Point& aPos, sal_Bool& rIsInside );
237cdf0e10cSrcweir     virtual sal_Bool        drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
238cdf0e10cSrcweir                                            ControlState nState, const ImplControlValue& aValue,
239cdf0e10cSrcweir                                            const rtl::OUString& aCaption );
240cdf0e10cSrcweir     virtual sal_Bool        drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
241cdf0e10cSrcweir                                                ControlState nState, const ImplControlValue& aValue,
242cdf0e10cSrcweir                                                const rtl::OUString& aCaption );
243cdf0e10cSrcweir     virtual sal_Bool        getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState,
244cdf0e10cSrcweir                                                 const ImplControlValue& aValue, const rtl::OUString& aCaption,
245cdf0e10cSrcweir                                                 Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion );
246cdf0e10cSrcweir 
247cdf0e10cSrcweir     virtual bool		drawAlphaBitmap( const SalTwoRect&,
248cdf0e10cSrcweir                                          const SalBitmap& rSourceBitmap,
249cdf0e10cSrcweir                                          const SalBitmap& rAlphaBitmap );
250*5f27b83cSArmin Le Grand     virtual bool drawTransformedBitmap(
251*5f27b83cSArmin Le Grand         const basegfx::B2DPoint& rNull,
252*5f27b83cSArmin Le Grand         const basegfx::B2DPoint& rX,
253*5f27b83cSArmin Le Grand         const basegfx::B2DPoint& rY,
254*5f27b83cSArmin Le Grand         const SalBitmap& rSourceBitmap,
255*5f27b83cSArmin Le Grand         const SalBitmap* pAlphaBitmap);
256cdf0e10cSrcweir     virtual bool		drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency );
257cdf0e10cSrcweir 
258*5f27b83cSArmin Le Grand private:
259*5f27b83cSArmin Le Grand     // local helpers
260*5f27b83cSArmin Le Grand     bool tryDrawBitmapGdiPlus(const SalTwoRect& rTR, const SalBitmap& rSrcBitmap);
261*5f27b83cSArmin Le Grand 
262cdf0e10cSrcweir public:
263cdf0e10cSrcweir     // public SalGraphics methods, the interface to teh independent vcl part
264cdf0e10cSrcweir 
265cdf0e10cSrcweir     // get device resolution
266cdf0e10cSrcweir     virtual void			GetResolution( long& rDPIX, long& rDPIY );
267cdf0e10cSrcweir     // get the depth of the device
268cdf0e10cSrcweir     virtual sal_uInt16			GetBitCount();
269cdf0e10cSrcweir     // get the width of the device
270cdf0e10cSrcweir     virtual long			GetGraphicsWidth() const;
271cdf0e10cSrcweir 
272cdf0e10cSrcweir     // set the clip region to empty
273cdf0e10cSrcweir     virtual void			ResetClipRegion();
274cdf0e10cSrcweir 
275cdf0e10cSrcweir     // set the line color to transparent (= don't draw lines)
276cdf0e10cSrcweir     virtual void			SetLineColor();
277cdf0e10cSrcweir     // set the line color to a specific color
278cdf0e10cSrcweir     virtual void			SetLineColor( SalColor nSalColor );
279cdf0e10cSrcweir     // set the fill color to transparent (= don't fill)
280cdf0e10cSrcweir     virtual void			SetFillColor();
281cdf0e10cSrcweir     // set the fill color to a specific color, shapes will be
282cdf0e10cSrcweir     // filled accordingly
283cdf0e10cSrcweir     virtual void          	SetFillColor( SalColor nSalColor );
284cdf0e10cSrcweir     // enable/disable XOR drawing
285cdf0e10cSrcweir     virtual void			SetXORMode( bool bSet, bool );
286cdf0e10cSrcweir     // set line color for raster operations
287cdf0e10cSrcweir     virtual void			SetROPLineColor( SalROPColor nROPColor );
288cdf0e10cSrcweir     // set fill color for raster operations
289cdf0e10cSrcweir     virtual void			SetROPFillColor( SalROPColor nROPColor );
290cdf0e10cSrcweir     // set the text color to a specific color
291cdf0e10cSrcweir     virtual void			SetTextColor( SalColor nSalColor );
292cdf0e10cSrcweir     // set the font
293cdf0e10cSrcweir     virtual sal_uInt16         SetFont( ImplFontSelectData*, int nFallbackLevel );
294cdf0e10cSrcweir     // get the current font's etrics
295cdf0e10cSrcweir     virtual void			GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
296cdf0e10cSrcweir     // get kernign pairs of the current font
297cdf0e10cSrcweir     // return only PairCount if (pKernPairs == NULL)
298cdf0e10cSrcweir     virtual sal_uLong			GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs );
299cdf0e10cSrcweir     // get the repertoire of the current font
300cdf0e10cSrcweir     virtual const ImplFontCharMap* GetImplFontCharMap() const;
301cdf0e10cSrcweir     // graphics must fill supplied font list
302cdf0e10cSrcweir     virtual void			GetDevFontList( ImplDevFontList* );
303cdf0e10cSrcweir     // graphics should call ImplAddDevFontSubstitute on supplied
304cdf0e10cSrcweir     // OutputDevice for all its device specific preferred font substitutions
305cdf0e10cSrcweir     virtual void			GetDevFontSubstList( OutputDevice* );
306cdf0e10cSrcweir     virtual bool			AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName );
307cdf0e10cSrcweir     // CreateFontSubset: a method to get a subset of glyhps of a font
308cdf0e10cSrcweir     // inside a new valid font file
309cdf0e10cSrcweir     // returns TRUE if creation of subset was successfull
310cdf0e10cSrcweir     // parameters: rToFile: contains a osl file URL to write the subset to
311cdf0e10cSrcweir     //             pFont: describes from which font to create a subset
312cdf0e10cSrcweir     //             pGlyphIDs: the glyph ids to be extracted
313cdf0e10cSrcweir     //             pEncoding: the character code corresponding to each glyph
314cdf0e10cSrcweir     //             pWidths: the advance widths of the correspoding glyphs (in PS font units)
315cdf0e10cSrcweir     //             nGlyphs: the number of glyphs
316cdf0e10cSrcweir     //             rInfo: additional outgoing information
317cdf0e10cSrcweir     // implementation note: encoding 0 with glyph id 0 should be added implicitly
318cdf0e10cSrcweir     // as "undefined character"
319cdf0e10cSrcweir     virtual sal_Bool			CreateFontSubset( const rtl::OUString& rToFile,
320cdf0e10cSrcweir                                               const ImplFontData*,
321cdf0e10cSrcweir                                               long* pGlyphIDs,
322cdf0e10cSrcweir                                               sal_uInt8* pEncoding,
323cdf0e10cSrcweir                                               sal_Int32* pWidths,
324cdf0e10cSrcweir                                               int nGlyphs,
325cdf0e10cSrcweir                                               FontSubsetInfo& rInfo // out parameter
326cdf0e10cSrcweir                                               );
327cdf0e10cSrcweir 
328cdf0e10cSrcweir     // GetFontEncodingVector: a method to get the encoding map Unicode
329cdf0e10cSrcweir 	// to font encoded character; this is only used for type1 fonts and
330cdf0e10cSrcweir     // may return NULL in case of unknown encoding vector
331cdf0e10cSrcweir     // if ppNonEncoded is set and non encoded characters (that is type1
332cdf0e10cSrcweir     // glyphs with only a name) exist it is set to the corresponding
333cdf0e10cSrcweir     // map for non encoded glyphs; the encoding vector contains -1
334cdf0e10cSrcweir     // as encoding for these cases
335cdf0e10cSrcweir     virtual const Ucs2SIntMap* GetFontEncodingVector( const ImplFontData*, const Ucs2OStrMap** ppNonEncoded );
336cdf0e10cSrcweir 
337cdf0e10cSrcweir     // GetEmbedFontData: gets the font data for a font marked
338cdf0e10cSrcweir     // embeddable by GetDevFontList or NULL in case of error
339cdf0e10cSrcweir     // parameters: pFont: describes the font in question
340cdf0e10cSrcweir     //             pWidths: the widths of all glyphs from char code 0 to 255
341cdf0e10cSrcweir     //                      pWidths MUST support at least 256 members;
342cdf0e10cSrcweir     //             rInfo: additional outgoing information
343cdf0e10cSrcweir     //             pDataLen: out parameter, contains the byte length of the returned buffer
344cdf0e10cSrcweir     virtual const void*	GetEmbedFontData( const ImplFontData*,
345cdf0e10cSrcweir                                           const sal_Ucs* pUnicodes,
346cdf0e10cSrcweir                                           sal_Int32* pWidths,
347cdf0e10cSrcweir                                           FontSubsetInfo& rInfo,
348cdf0e10cSrcweir                                           long* pDataLen );
349cdf0e10cSrcweir     // frees the font data again
350cdf0e10cSrcweir     virtual void			FreeEmbedFontData( const void* pData, long nDataLen );
351cdf0e10cSrcweir     virtual void            GetGlyphWidths( const ImplFontData*,
352cdf0e10cSrcweir                                             bool bVertical,
353cdf0e10cSrcweir                                             Int32Vector& rWidths,
354cdf0e10cSrcweir                                             Ucs2UIntMap& rUnicodeEnc );
355cdf0e10cSrcweir 	virtual int             GetMinKashidaWidth();
356cdf0e10cSrcweir 
357cdf0e10cSrcweir     virtual sal_Bool                    GetGlyphBoundRect( long nIndex, Rectangle& );
358cdf0e10cSrcweir     virtual sal_Bool                    GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& );
359cdf0e10cSrcweir 
360cdf0e10cSrcweir     virtual SalLayout*              GetTextLayout( ImplLayoutArgs&, int nFallbackLevel );
361cdf0e10cSrcweir     virtual void					 DrawServerFontLayout( const ServerFontLayout& );
362cdf0e10cSrcweir 
363cdf0e10cSrcweir     virtual bool            supportsOperation( OutDevSupportType ) const;
364cdf0e10cSrcweir     // Query the platform layer for control support
365cdf0e10cSrcweir     virtual sal_Bool IsNativeControlSupported( ControlType nType, ControlPart nPart );
366cdf0e10cSrcweir 
367cdf0e10cSrcweir     virtual SystemGraphicsData GetGraphicsData() const;
368cdf0e10cSrcweir     virtual SystemFontData     GetSysFontData( int nFallbacklevel ) const;
369cdf0e10cSrcweir };
370cdf0e10cSrcweir 
371cdf0e10cSrcweir // Init/Deinit Graphics
372cdf0e10cSrcweir void	ImplSalInitGraphics( WinSalGraphics* );
373cdf0e10cSrcweir void	ImplSalDeInitGraphics( WinSalGraphics* );
374cdf0e10cSrcweir void	ImplUpdateSysColorEntries();
375cdf0e10cSrcweir int 	ImplIsSysColorEntry( SalColor nSalColor );
376cdf0e10cSrcweir void    ImplGetLogFontFromFontSelect( HDC, const ImplFontSelectData*,
377cdf0e10cSrcweir             LOGFONTW&, bool bTestVerticalAvail );
378cdf0e10cSrcweir 
379cdf0e10cSrcweir // -----------
380cdf0e10cSrcweir // - Defines -
381cdf0e10cSrcweir // -----------
382cdf0e10cSrcweir 
383cdf0e10cSrcweir #define MAX_64KSALPOINTS	((((sal_uInt16)0xFFFF)-8)/sizeof(POINTS))
384cdf0e10cSrcweir 
385cdf0e10cSrcweir // -----------
386cdf0e10cSrcweir // - Inlines -
387cdf0e10cSrcweir // -----------
388cdf0e10cSrcweir 
389cdf0e10cSrcweir // #102411# Win's GCP mishandles kerning => we need to do it ourselves
390cdf0e10cSrcweir // SalGraphicsData::mpFontKernPairs is sorted by
391cdf0e10cSrcweir inline bool ImplCmpKernData( const KERNINGPAIR& a, const KERNINGPAIR& b )
392cdf0e10cSrcweir {
393cdf0e10cSrcweir     if( a.wFirst < b.wFirst )
394cdf0e10cSrcweir         return true;
395cdf0e10cSrcweir     if( a.wFirst > b.wFirst )
396cdf0e10cSrcweir         return false;
397cdf0e10cSrcweir     return (a.wSecond < b.wSecond);
398cdf0e10cSrcweir }
399cdf0e10cSrcweir 
400cdf0e10cSrcweir // called extremely often from just one spot => inline
401cdf0e10cSrcweir inline bool ImplWinFontData::HasChar( sal_uInt32 cChar ) const
402cdf0e10cSrcweir {
403cdf0e10cSrcweir     if( mpUnicodeMap->HasChar( cChar ) )
404cdf0e10cSrcweir         return true;
405cdf0e10cSrcweir     // second chance to allow symbol aliasing
406cdf0e10cSrcweir     if( mbAliasSymbolsLow && ((cChar-0xF000) <= 0xFF) )
407cdf0e10cSrcweir         cChar -= 0xF000;
408cdf0e10cSrcweir     else if( mbAliasSymbolsHigh && (cChar <= 0xFF) )
409cdf0e10cSrcweir         cChar += 0xF000;
410cdf0e10cSrcweir     else
411cdf0e10cSrcweir         return false;
412cdf0e10cSrcweir     return mpUnicodeMap->HasChar( cChar );
413cdf0e10cSrcweir }
414cdf0e10cSrcweir 
415cdf0e10cSrcweir #endif // _SV_SALGDI_H
416cdf0e10cSrcweir 
417