bump product version to 4.2.0.1
[LibreOffice.git] / include / vcl / outdev.hxx
blob047a79d46789c9b080b31b386a7a527da1853597
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_OUTDEV_HXX
21 #define INCLUDED_VCL_OUTDEV_HXX
23 #include <tools/gen.hxx>
24 #include <tools/string.hxx>
25 #include <tools/solar.h>
26 #include <vcl/dllapi.h>
27 #include <tools/rc.hxx>
28 #include <tools/color.hxx>
29 #include <vcl/font.hxx>
30 #include <vcl/region.hxx>
31 #include <vcl/mapmod.hxx>
32 #include <vcl/wall.hxx>
33 #include <vcl/settings.hxx>
34 #include <vcl/salnativewidgets.hxx>
35 #include <tools/poly.hxx>
36 #include <basegfx/vector/b2enums.hxx>
37 #include <com/sun/star/uno/Reference.h>
38 #include <unotools/fontdefs.hxx>
39 #include <basegfx/polygon/b2dpolypolygon.hxx>
40 #include <com/sun/star/drawing/LineCap.hpp>
41 #include <vector>
43 struct ImplOutDevData;
44 class ImplFontEntry;
45 struct ImplObjStack;
46 struct SystemGraphicsData;
47 struct SystemFontData;
48 struct SystemTextLayoutData;
49 class ImplFontCache;
50 class ImplDevFontList;
51 class ImplGetDevFontList;
52 class ImplGetDevSizeList;
53 class ImplMultiTextLineInfo;
54 class SalGraphics;
55 class Gradient;
56 class Hatch;
57 class Bitmap;
58 class BitmapReadAccess;
59 class BitmapEx;
60 class Image;
61 class TextRectInfo;
62 class FontInfo;
63 class FontMetric;
64 class GDIMetaFile;
65 class GfxLink;
66 class Line;
67 class LineInfo;
68 class AlphaMask;
69 class FontCharMap;
70 class SalLayout;
71 class ImplLayoutArgs;
72 class ImplFontAttributes;
73 class VirtualDevice;
74 struct SalTwoRect;
76 namespace com {
77 namespace sun {
78 namespace star {
79 namespace rendering {
80 class XCanvas;
81 }}}}
82 namespace basegfx {
83 class B2DHomMatrix;
84 class B2DPolygon;
85 class B2DPolyPolygon;
88 namespace com {
89 namespace sun {
90 namespace star {
91 namespace awt {
92 class XGraphics;
93 } } } }
95 typedef std::vector< Rectangle > MetricVector;
97 namespace vcl
99 class PDFWriterImpl;
100 class ExtOutDevData;
101 class ITextLayout;
102 struct FontCapabilities;
105 // ---------------------
106 // - OutputDevice-Data -
107 // ---------------------
109 struct ImplMapRes
111 long mnMapOfsX; // Offset in X Richtung
112 long mnMapOfsY; // Offset in Y Richtung
113 long mnMapScNumX; // Skal.-faktor Zaehler X Richtung
114 long mnMapScNumY; // Skal.-faktor Zaehler Y Richtung
115 long mnMapScDenomX; // Skal.-faktor Nenner X Richtung
116 long mnMapScDenomY; // Skal.-faktor Nenner Y Richtung
119 struct ImplThresholdRes
121 long mnThresLogToPixX; // Schwellenwerte fuer Berechnung
122 long mnThresLogToPixY; // mit BigInts
123 long mnThresPixToLogX; // ""
124 long mnThresPixToLogY; // ""
127 // ----------------------
128 // - OutputDevice-Types -
129 // ----------------------
131 // Flags for Push()
132 #define PUSH_LINECOLOR ((sal_uInt16)0x0001)
133 #define PUSH_FILLCOLOR ((sal_uInt16)0x0002)
134 #define PUSH_FONT ((sal_uInt16)0x0004)
135 #define PUSH_TEXTCOLOR ((sal_uInt16)0x0008)
136 #define PUSH_MAPMODE ((sal_uInt16)0x0010)
137 #define PUSH_CLIPREGION ((sal_uInt16)0x0020)
138 #define PUSH_RASTEROP ((sal_uInt16)0x0040)
139 #define PUSH_TEXTFILLCOLOR ((sal_uInt16)0x0080)
140 #define PUSH_TEXTALIGN ((sal_uInt16)0x0100)
141 #define PUSH_REFPOINT ((sal_uInt16)0x0200)
142 #define PUSH_TEXTLINECOLOR ((sal_uInt16)0x0400)
143 #define PUSH_TEXTLAYOUTMODE ((sal_uInt16)0x0800)
144 #define PUSH_TEXTLANGUAGE ((sal_uInt16)0x1000)
145 #define PUSH_OVERLINECOLOR ((sal_uInt16)0x2000)
146 #define PUSH_ALLTEXT (PUSH_TEXTCOLOR | PUSH_TEXTFILLCOLOR | PUSH_TEXTLINECOLOR | PUSH_OVERLINECOLOR | PUSH_TEXTALIGN | PUSH_TEXTLAYOUTMODE | PUSH_TEXTLANGUAGE)
147 #define PUSH_ALLFONT (PUSH_ALLTEXT | PUSH_FONT)
148 #define PUSH_ALL ((sal_uInt16)0xFFFF)
150 // Flags for DrawText()
151 #define TEXT_DRAW_DISABLE ((sal_uInt16)0x0001)
152 #define TEXT_DRAW_MNEMONIC ((sal_uInt16)0x0002)
153 #define TEXT_DRAW_MONO ((sal_uInt16)0x0004)
154 #define TEXT_DRAW_CLIP ((sal_uInt16)0x0008)
155 #define TEXT_DRAW_LEFT ((sal_uInt16)0x0010)
156 #define TEXT_DRAW_CENTER ((sal_uInt16)0x0020)
157 #define TEXT_DRAW_RIGHT ((sal_uInt16)0x0040)
158 #define TEXT_DRAW_TOP ((sal_uInt16)0x0080)
159 #define TEXT_DRAW_VCENTER ((sal_uInt16)0x0100)
160 #define TEXT_DRAW_BOTTOM ((sal_uInt16)0x0200)
161 #define TEXT_DRAW_ENDELLIPSIS ((sal_uInt16)0x0400)
162 #define TEXT_DRAW_PATHELLIPSIS ((sal_uInt16)0x0800)
163 #define TEXT_DRAW_MULTILINE ((sal_uInt16)0x1000)
164 #define TEXT_DRAW_WORDBREAK ((sal_uInt16)0x2000)
165 #define TEXT_DRAW_NEWSELLIPSIS ((sal_uInt16)0x4000)
166 // in the long run we should make text style flags longer
167 // but at the moment we can get away with this 2 bit field for ellipsis style
168 #define TEXT_DRAW_CENTERELLIPSIS (TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_PATHELLIPSIS)
170 #define TEXT_DRAW_WORDBREAK_HYPHENATION (((sal_uInt16)0x8000) | TEXT_DRAW_WORDBREAK)
172 // Flags for CopyArea()
173 #define COPYAREA_WINDOWINVALIDATE ((sal_uInt16)0x0001)
175 // Flags for DrawImage()
176 #define IMAGE_DRAW_DISABLE ((sal_uInt16)0x0001)
177 #define IMAGE_DRAW_HIGHLIGHT ((sal_uInt16)0x0002)
178 #define IMAGE_DRAW_DEACTIVE ((sal_uInt16)0x0004)
179 #define IMAGE_DRAW_COLORTRANSFORM ((sal_uInt16)0x0008)
180 #define IMAGE_DRAW_SEMITRANSPARENT ((sal_uInt16)0x0010)
182 // WaveLine
183 #define WAVE_FLAT 1
184 #define WAVE_SMALL 2
185 #define WAVE_NORMAL 3
187 // Grid
188 #define GRID_DOTS ((sal_uLong)0x00000001)
189 #define GRID_HORZLINES ((sal_uLong)0x00000002)
190 #define GRID_VERTLINES ((sal_uLong)0x00000004)
191 #define GRID_LINES (GRID_HORZLINES | GRID_VERTLINES)
193 // LayoutModes for Complex Text Layout
194 #define TEXT_LAYOUT_DEFAULT ((sal_uLong)0x00000000)
195 #define TEXT_LAYOUT_BIDI_LTR ((sal_uLong)0x00000000)
196 #define TEXT_LAYOUT_BIDI_RTL ((sal_uLong)0x00000001)
197 #define TEXT_LAYOUT_BIDI_STRONG ((sal_uLong)0x00000002)
198 #define TEXT_LAYOUT_TEXTORIGIN_LEFT ((sal_uLong)0x00000004)
199 #define TEXT_LAYOUT_TEXTORIGIN_RIGHT ((sal_uLong)0x00000008)
200 #define TEXT_LAYOUT_COMPLEX_DISABLED ((sal_uLong)0x00000100)
201 #define TEXT_LAYOUT_ENABLE_LIGATURES ((sal_uLong)0x00000200)
202 #define TEXT_LAYOUT_SUBSTITUTE_DIGITS ((sal_uLong)0x00000400)
204 // DrawModes
205 #define DRAWMODE_DEFAULT ((sal_uLong)0x00000000)
206 #define DRAWMODE_BLACKLINE ((sal_uLong)0x00000001)
207 #define DRAWMODE_BLACKFILL ((sal_uLong)0x00000002)
208 #define DRAWMODE_BLACKTEXT ((sal_uLong)0x00000004)
209 #define DRAWMODE_BLACKBITMAP ((sal_uLong)0x00000008)
210 #define DRAWMODE_BLACKGRADIENT ((sal_uLong)0x00000010)
211 #define DRAWMODE_GRAYLINE ((sal_uLong)0x00000020)
212 #define DRAWMODE_GRAYFILL ((sal_uLong)0x00000040)
213 #define DRAWMODE_GRAYTEXT ((sal_uLong)0x00000080)
214 #define DRAWMODE_GRAYBITMAP ((sal_uLong)0x00000100)
215 #define DRAWMODE_GRAYGRADIENT ((sal_uLong)0x00000200)
216 #define DRAWMODE_NOFILL ((sal_uLong)0x00000400)
217 #define DRAWMODE_NOBITMAP ((sal_uLong)0x00000800)
218 #define DRAWMODE_NOGRADIENT ((sal_uLong)0x00001000)
219 #define DRAWMODE_GHOSTEDLINE ((sal_uLong)0x00002000)
220 #define DRAWMODE_GHOSTEDFILL ((sal_uLong)0x00004000)
221 #define DRAWMODE_GHOSTEDTEXT ((sal_uLong)0x00008000)
222 #define DRAWMODE_GHOSTEDBITMAP ((sal_uLong)0x00010000)
223 #define DRAWMODE_GHOSTEDGRADIENT ((sal_uLong)0x00020000)
224 #define DRAWMODE_WHITELINE ((sal_uLong)0x00100000)
225 #define DRAWMODE_WHITEFILL ((sal_uLong)0x00200000)
226 #define DRAWMODE_WHITETEXT ((sal_uLong)0x00400000)
227 #define DRAWMODE_WHITEBITMAP ((sal_uLong)0x00800000)
228 #define DRAWMODE_WHITEGRADIENT ((sal_uLong)0x01000000)
229 #define DRAWMODE_SETTINGSLINE ((sal_uLong)0x02000000)
230 #define DRAWMODE_SETTINGSFILL ((sal_uLong)0x04000000)
231 #define DRAWMODE_SETTINGSTEXT ((sal_uLong)0x08000000)
232 #define DRAWMODE_SETTINGSGRADIENT ((sal_uLong)0x10000000)
233 #define DRAWMODE_NOTRANSPARENCY ((sal_uLong)0x80000000)
235 // Antialiasing
236 #define ANTIALIASING_DISABLE_TEXT ((sal_uInt16)0x0001)
237 #define ANTIALIASING_ENABLE_B2DDRAW ((sal_uInt16)0x0002)
238 #define ANTIALIASING_PIXELSNAPHAIRLINE ((sal_uInt16)0x0004)
240 // AddFontSubstitute
241 #define FONT_SUBSTITUTE_ALWAYS ((sal_uInt16)0x0001)
242 #define FONT_SUBSTITUTE_SCREENONLY ((sal_uInt16)0x0002)
244 #define DEFAULTFONT_FLAGS_ONLYONE ((sal_uLong)0x00000001)
246 enum OutDevType { OUTDEV_DONTKNOW, OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV };
248 enum OutDevViewType { OUTDEV_VIEWTYPE_DONTKNOW, OUTDEV_VIEWTYPE_PRINTPREVIEW, OUTDEV_VIEWTYPE_SLIDESHOW };
250 // ----------------
251 // - OutputDevice -
252 // ----------------
254 class VirtualDevice;
255 class Printer;
256 class FontSelectPattern;
257 class ImplFontMetricData;
258 class VCLXGraphics;
260 typedef ::std::vector< VCLXGraphics* > VCLXGraphicsList_impl;
262 const char* ImplDbgCheckOutputDevice( const void* pObj );
264 class VCL_DLLPUBLIC OutputDevice : public Resource
266 friend class Application;
267 friend class Bitmap;
268 friend class ImplImageBmp;
269 friend class Printer;
270 friend class System;
271 friend class VirtualDevice;
272 friend class Window;
273 friend class WorkWindow;
274 friend class vcl::PDFWriterImpl;
275 friend const char* ImplDbgCheckOutputDevice( const void* pObj );
276 friend void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight );
278 private:
279 mutable SalGraphics* mpGraphics;
280 mutable OutputDevice* mpPrevGraphics;
281 mutable OutputDevice* mpNextGraphics;
282 GDIMetaFile* mpMetaFile;
283 mutable ImplFontEntry* mpFontEntry;
284 mutable ImplFontCache* mpFontCache;
285 mutable ImplDevFontList* mpFontList;
286 mutable ImplGetDevFontList* mpGetDevFontList;
287 mutable ImplGetDevSizeList* mpGetDevSizeList;
288 ImplObjStack* mpObjStack;
289 ImplOutDevData* mpOutDevData;
290 VCLXGraphicsList_impl* mpUnoGraphicsList;
291 vcl::PDFWriterImpl* mpPDFWriter;
292 vcl::ExtOutDevData* mpExtOutDevData;
294 // TEMP TEMP TEMP
295 VirtualDevice* mpAlphaVDev;
297 /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
298 long mnOutOffOrigX;
299 /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
300 long mnOutOffLogicX;
301 /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
302 long mnOutOffOrigY;
303 /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
304 long mnOutOffLogicY;
305 /// Output offset for device output in pixel (pseudo window offset within window system's frames)
306 long mnOutOffX;
307 /// Output offset for device output in pixel (pseudo window offset within window system's frames)
308 long mnOutOffY;
309 long mnOutWidth;
310 long mnOutHeight;
311 sal_Int32 mnDPIX;
312 sal_Int32 mnDPIY;
313 /// font specific text alignment offsets in pixel units
314 mutable long mnTextOffX;
315 mutable long mnTextOffY;
316 mutable long mnEmphasisAscent;
317 mutable long mnEmphasisDescent;
318 sal_uLong mnDrawMode;
319 sal_uLong mnTextLayoutMode;
320 ImplMapRes maMapRes;
321 ImplThresholdRes maThresRes;
322 OutDevType meOutDevType;
323 OutDevViewType meOutDevViewType;
324 Region maRegion; // contains the clip region, see SetClipRegion(...)
325 Color maLineColor;
326 Color maFillColor;
327 Font maFont;
328 Color maTextColor;
329 Color maTextLineColor;
330 Color maOverlineColor;
331 TextAlign meTextAlign;
332 RasterOp meRasterOp;
333 Wallpaper maBackground;
334 AllSettings maSettings;
335 MapMode maMapMode;
336 Point maRefPoint;
337 sal_uInt16 mnAntialiasing;
338 LanguageType meTextLanguage;
340 /// bitfield
341 mutable bool mbMap : 1;
342 mutable bool mbMapIsDefault : 1;
343 mutable bool mbClipRegion : 1;
344 mutable bool mbBackground : 1;
345 mutable bool mbOutput : 1;
346 mutable bool mbDevOutput : 1;
347 mutable bool mbOutputClipped : 1;
348 mutable bool mbLineColor : 1;
349 mutable bool mbFillColor : 1;
350 mutable bool mbInitLineColor : 1;
351 mutable bool mbInitFillColor : 1;
352 mutable bool mbInitFont : 1;
353 mutable bool mbInitTextColor : 1;
354 mutable bool mbInitClipRegion : 1;
355 mutable bool mbClipRegionSet : 1;
356 mutable bool mbKerning : 1;
357 mutable bool mbNewFont : 1;
358 mutable bool mbTextLines : 1;
359 mutable bool mbTextSpecial : 1;
360 mutable bool mbRefPoint : 1;
361 mutable bool mbEnableRTL : 1;
363 public:
364 SAL_DLLPRIVATE sal_Int32 ImplGetDPIX() const { return mnDPIX; }
365 SAL_DLLPRIVATE sal_Int32 ImplGetDPIY() const { return mnDPIY; }
366 SAL_DLLPRIVATE SalGraphics* ImplGetGraphics() const;
367 SAL_DLLPRIVATE void ImplReleaseGraphics( sal_Bool bRelease = sal_True );
368 SAL_DLLPRIVATE sal_Bool ImplHasMirroredGraphics();
369 SAL_DLLPRIVATE void ImplReMirror( Point &rPoint ) const;
370 SAL_DLLPRIVATE void ImplReMirror( Rectangle &rRect ) const;
371 SAL_DLLPRIVATE void ImplReMirror( Region &rRegion ) const;
372 SAL_DLLPRIVATE void ImplInitOutDevData();
373 SAL_DLLPRIVATE void ImplDeInitOutDevData();
374 SAL_DLLPRIVATE void ImplInitLineColor();
375 SAL_DLLPRIVATE void ImplInitFillColor();
376 SAL_DLLPRIVATE bool ImplNewFont() const;
377 SAL_DLLPRIVATE void ImplInitFont() const;
378 SAL_DLLPRIVATE void ImplInitTextColor();
379 SAL_DLLPRIVATE void ImplInitClipRegion();
380 SAL_DLLPRIVATE bool ImplSelectClipRegion( const Region&, SalGraphics* pGraphics = NULL );
381 SAL_DLLPRIVATE void ImplSetClipRegion( const Region* pRegion );
383 SAL_DLLPRIVATE SalLayout* ImplLayout( const OUString&, sal_Int32 nIndex, sal_Int32 nLen,
384 const Point& rLogicPos = Point(0,0), long nLogicWidth=0,
385 const sal_Int32* pLogicDXArray=NULL, bool bFilter = false ) const;
386 SAL_DLLPRIVATE ImplLayoutArgs ImplPrepareLayoutArgs( OUString&, const sal_Int32 nIndex, const sal_Int32 nLen,
387 long nPixelWidth, const sal_Int32* pPixelDXArray ) const;
388 SAL_DLLPRIVATE SalLayout* ImplGlyphFallbackLayout( SalLayout*, ImplLayoutArgs& ) const;
390 static
391 SAL_DLLPRIVATE OUString ImplGetEllipsisString( const OutputDevice& rTargetDevice, const OUString& rStr,
392 long nMaxWidth, sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout );
393 static
394 SAL_DLLPRIVATE void ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect,
395 const OUString& rOrigStr, sal_uInt16 nStyle,
396 MetricVector* pVector, OUString* pDisplayText, ::vcl::ITextLayout& _rLayout );
397 SAL_DLLPRIVATE void ImplDrawTextBackground( const SalLayout& );
398 SAL_DLLPRIVATE void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, sal_Bool bWordLine, sal_Bool bUnderlineAbove );
399 SAL_DLLPRIVATE bool ImplDrawRotateText( SalLayout& );
400 SAL_DLLPRIVATE void ImplDrawTextDirect( SalLayout&, sal_Bool bTextLines );
401 SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout& );
402 SAL_DLLPRIVATE void ImplDrawText( SalLayout& );
403 SAL_DLLPRIVATE Rectangle ImplGetTextBoundRect( const SalLayout& );
404 SAL_DLLPRIVATE void ImplDrawEmphasisMarks( SalLayout& );
406 SAL_DLLPRIVATE void ImplDrawTextRect( long nBaseX, long nBaseY, long nX, long nY, long nWidth, long nHeight );
408 SAL_DLLPRIVATE void ImplInitTextLineSize();
409 SAL_DLLPRIVATE void ImplInitAboveTextLineSize();
410 SAL_DLLPRIVATE void ImplDrawWaveLine( long nBaseX, long nBaseY, long nStartX, long nStartY, long nWidth, long nHeight, long nLineWidth, short nOrientation, const Color& rColor );
411 SAL_DLLPRIVATE void ImplDrawWaveTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontUnderline eTextLine, Color aColor, sal_Bool bIsAbove );
412 SAL_DLLPRIVATE void ImplDrawStraightTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontUnderline eTextLine, Color aColor, sal_Bool bIsAbove );
413 SAL_DLLPRIVATE void ImplDrawStrikeoutLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
414 SAL_DLLPRIVATE void ImplDrawStrikeoutChar( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
415 SAL_DLLPRIVATE void ImplDrawTextLine( long nBaseX, long nX, long nY, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, sal_Bool bUnderlineAbove );
416 SAL_DLLPRIVATE void ImplDrawMnemonicLine( long nX, long nY, long nWidth );
417 SAL_DLLPRIVATE void ImplGetEmphasisMark( PolyPolygon& rPolyPoly, sal_Bool& rPolyLine, Rectangle& rRect1, Rectangle& rRect2, long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short nOrient );
418 SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const PolyPolygon& rPolyPoly, sal_Bool bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 );
419 static
420 SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const OUString& rStr, sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout );
421 SAL_DLLPRIVATE void ImplInitFontList() const;
422 SAL_DLLPRIVATE void ImplUpdateFontData( bool bNewFontLists );
423 SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists );
425 SAL_DLLPRIVATE long ImplLogicXToDevicePixel( long nX ) const;
426 SAL_DLLPRIVATE long ImplLogicYToDevicePixel( long nY ) const;
427 SAL_DLLPRIVATE long ImplLogicWidthToDevicePixel( long nWidth ) const;
428 SAL_DLLPRIVATE long ImplLogicHeightToDevicePixel( long nHeight ) const;
429 SAL_DLLPRIVATE long ImplDevicePixelToLogicWidth( long nWidth ) const;
430 SAL_DLLPRIVATE long ImplDevicePixelToLogicHeight( long nHeight ) const;
431 SAL_DLLPRIVATE float ImplFloatLogicHeightToDevicePixel( float ) const;
432 SAL_DLLPRIVATE Point ImplLogicToDevicePixel( const Point& rLogicPt ) const;
433 SAL_DLLPRIVATE Size ImplLogicToDevicePixel( const Size& rLogicSize ) const;
434 SAL_DLLPRIVATE Rectangle ImplLogicToDevicePixel( const Rectangle& rLogicRect ) const;
435 SAL_DLLPRIVATE ::basegfx::B2DPolygon ImplLogicToDevicePixel( const ::basegfx::B2DPolygon& ) const;
436 SAL_DLLPRIVATE ::basegfx::B2DPolyPolygon ImplLogicToDevicePixel( const ::basegfx::B2DPolyPolygon& ) const;
437 SAL_DLLPRIVATE Polygon ImplLogicToDevicePixel( const Polygon& rLogicPoly ) const;
438 SAL_DLLPRIVATE PolyPolygon ImplLogicToDevicePixel( const PolyPolygon& rLogicPolyPoly ) const;
439 SAL_DLLPRIVATE LineInfo ImplLogicToDevicePixel( const LineInfo& rLineInfo ) const;
440 SAL_DLLPRIVATE Rectangle ImplDevicePixelToLogic( const Rectangle& rLogicRect ) const;
441 SAL_DLLPRIVATE Region ImplPixelToDevicePixel( const Region& rRegion ) const;
442 SAL_DLLPRIVATE void ImplInvalidateViewTransform();
443 SAL_DLLPRIVATE basegfx::B2DHomMatrix ImplGetDeviceTransformation() const;
445 SAL_DLLPRIVATE void ImplDrawPolygon( const Polygon& rPoly, const PolyPolygon* pClipPolyPoly = NULL );
446 SAL_DLLPRIVATE void ImplDrawPolyPolygon( const PolyPolygon& rPolyPoly, const PolyPolygon* pClipPolyPoly = NULL );
447 SAL_DLLPRIVATE void ImplDrawPolyPolygon( sal_uInt16 nPoly, const PolyPolygon& rPolyPoly );
448 SAL_DLLPRIVATE void ImplDrawLinearGradient( const Rectangle& rRect, const Gradient& rGradient, sal_Bool bMtf, const PolyPolygon* pClipPolyPoly );
449 SAL_DLLPRIVATE void ImplDrawComplexGradient( const Rectangle& rRect, const Gradient& rGradient, sal_Bool bMtf, const PolyPolygon* pClipPolyPoly );
451 SAL_DLLPRIVATE void ImplDrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch, sal_Bool bMtf );
452 SAL_DLLPRIVATE void ImplCalcHatchValues( const Rectangle& rRect, long nDist, sal_uInt16 nAngle10, Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 );
453 SAL_DLLPRIVATE void ImplDrawHatchLine( const Line& rLine, const PolyPolygon& rPolyPoly, Point* pPtBuffer, sal_Bool bMtf );
455 SAL_DLLPRIVATE void ImplDrawWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
456 SAL_DLLPRIVATE void ImplDrawColorWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
457 SAL_DLLPRIVATE void ImplDrawBitmapWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
458 SAL_DLLPRIVATE void ImplDrawGradientWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
460 SAL_DLLPRIVATE void ImplDrawOutDevDirect( const OutputDevice* pSrcDev, SalTwoRect& rPosAry );
461 SAL_DLLPRIVATE void ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize,
462 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
463 const Bitmap& rBitmap, const sal_uLong nAction );
464 SAL_DLLPRIVATE void ImplDrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
465 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
466 const BitmapEx& rBitmapEx, const sal_uLong nAction );
467 SAL_DLLPRIVATE void ImplDrawMask( const Point& rDestPt, const Size& rDestSize,
468 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
469 const Bitmap& rBitmap, const Color& rMaskColor,
470 const sal_uLong nAction );
471 SAL_DLLPRIVATE void ImplDrawAlpha( const Bitmap& rBmp, const AlphaMask& rAlpha,
472 const Point& rDestPt, const Size& rDestSize,
473 const Point& rSrcPtPixel, const Size& rSrcSizePixel );
474 SAL_DLLPRIVATE Bitmap ImplBlend( Bitmap aBmp,
475 BitmapReadAccess* pP,
476 BitmapReadAccess* pA,
477 const sal_Int32 nOffY,
478 const sal_Int32 nDstHeight,
479 const sal_Int32 nOffX,
480 const sal_Int32 nDstWidth,
481 const Rectangle& aBmpRect,
482 const Size& aOutSz,
483 const bool bHMirr,
484 const bool bVMirr,
485 const long* pMapX,
486 const long* pMapY );
487 SAL_DLLPRIVATE Bitmap ImplBlendWithAlpha( Bitmap aBmp,
488 BitmapReadAccess* pP,
489 BitmapReadAccess* pA,
490 const Rectangle& aDstRect,
491 const sal_Int32 nOffY,
492 const sal_Int32 nDstHeight,
493 const sal_Int32 nOffX,
494 const sal_Int32 nDstWidth,
495 const long* pMapX,
496 const long* pMapY );
497 SAL_DLLPRIVATE void ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask,
498 const Point& rDestPt, const Size& rDestSize,
499 const Point& rSrcPtPixel, const Size& rSrcSizePixel );
500 SAL_DLLPRIVATE void ImplPrintMask( const Bitmap& rMask, const Color& rMaskColor,
501 const Point& rDestPt, const Size& rDestSize,
502 const Point& rSrcPtPixel, const Size& rSrcSizePixel );
503 SAL_DLLPRIVATE void ImplDrawFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
504 const OutputDevice& rOutDev, const Region& rRegion );
505 SAL_DLLPRIVATE void ImplGetFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
506 OutputDevice& rOutDev );
508 SAL_DLLPRIVATE sal_Bool ImplIsRecordLayout() const;
510 void ImplAddDevFontSubstitute( const OUString& rFontName,
511 const OUString& rReplaceFontName,
512 sal_uInt16 nFlags = 0 );
514 SAL_DLLPRIVATE static FontEmphasisMark ImplGetEmphasisMarkStyle( const Font& rFont );
515 SAL_DLLPRIVATE static sal_Bool ImplIsUnderlineAbove( const Font& );
517 // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI
518 SAL_DLLPRIVATE bool ImplIsAntiparallel() const ;
519 SAL_DLLPRIVATE Color ImplDrawModeToColor( const Color& rColor ) const;
521 // #i101491#
522 // Helper which holds the old line geometry creation and is extended to use AA when
523 // switched on. Advantage is that line geometry is only temporarily used for paint
524 SAL_DLLPRIVATE void ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineInfo& rLineInfo);
526 // #i101491#
527 // Helper who implements the DrawPolyPolygon functionality for basegfx::B2DPolyPolygon
528 // without MetaFile processing
529 SAL_DLLPRIVATE void ImpDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPolygon& rB2DPolyPoly);
531 // #i101491#
532 // Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool. Contains no AA check.
533 SAL_DLLPRIVATE bool ImpTryDrawPolyLineDirect(
534 const basegfx::B2DPolygon& rB2DPolygon,
535 double fLineWidth = 0.0,
536 double fTransparency = 0.0,
537 basegfx::B2DLineJoin eLineJoin = basegfx::B2DLINEJOIN_NONE,
538 com::sun::star::drawing::LineCap eLineCap = com::sun::star::drawing::LineCap_BUTT);
540 // Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area)
541 void impPaintLineGeometryWithEvtlExpand(const LineInfo& rInfo, basegfx::B2DPolyPolygon aLinePolyPolygon);
543 SAL_DLLPRIVATE SalLayout* getFallbackFont(ImplFontEntry &rFallbackFont,
544 FontSelectPattern &rFontSelData, int nFallbackLevel,
545 ImplLayoutArgs& rLayoutArgs) const;
546 protected:
547 OutputDevice();
549 private:
550 SAL_DLLPRIVATE OutputDevice( const OutputDevice& rOutDev );
551 SAL_DLLPRIVATE OutputDevice& operator =( const OutputDevice& rOutDev );
553 public:
554 virtual ~OutputDevice();
556 OutDevType GetOutDevType() const { return meOutDevType; }
558 /** query an <code>OutputDevice</code> whether it spports a specific operation
560 @return
561 true if operation supported, else false
563 bool supportsOperation( OutDevSupportType ) const;
565 vcl::PDFWriterImpl* GetPDFWriter() const { return mpPDFWriter; }
567 void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; }
568 vcl::ExtOutDevData* GetExtOutDevData() const { return mpExtOutDevData; }
570 void DrawTextLine( const Point& rPos, long nWidth,
571 FontStrikeout eStrikeout,
572 FontUnderline eUnderline,
573 FontUnderline eOverline,
574 sal_Bool bUnderlineAbove = sal_False );
576 void DrawText( const Point& rStartPt, const OUString& rStr,
577 xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
578 MetricVector* pVector = NULL, OUString* pDisplayText = NULL );
579 long GetTextWidth( const OUString& rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
580 /// Height where any character of the current font fits; in logic coordinates.
581 long GetTextHeight() const;
582 float approximate_char_width() const;
583 void DrawTextArray( const Point& rStartPt, const OUString& rStr,
584 const sal_Int32* pDXAry = NULL,
585 xub_StrLen nIndex = 0,
586 xub_StrLen nLen = STRING_LEN );
587 long GetTextArray( const OUString& rStr, sal_Int32* pDXAry = NULL,
588 sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
589 bool GetCaretPositions( const OUString&, sal_Int32* pCaretXArray,
590 sal_Int32 nIndex, sal_Int32 nLen,
591 sal_Int32* pDXAry = NULL, long nWidth = 0,
592 sal_Bool bCellBreaking = sal_True ) const;
593 void DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
594 const OUString& rStr,
595 xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN );
596 xub_StrLen GetTextBreak( const OUString& rStr, long nTextWidth,
597 sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
598 long nCharExtra = 0, sal_Bool bCellBreaking = sal_True ) const;
599 xub_StrLen GetTextBreak( const OUString& rStr, long nTextWidth,
600 sal_Unicode nExtraChar, sal_Int32& rExtraCharPos,
601 sal_Int32 nIndex, sal_Int32 nLen,
602 long nCharExtra = 0 ) const;
603 /** Generate MetaTextActions for the text rect
605 This method splits up the text rect into multiple
606 MetaTextActions, one for each line of text. This is comparable
607 to AddGradientActions(), which splits up a gradient into its
608 constituing polygons. Parameter semantics fully compatible to
609 DrawText().
611 void AddTextRectActions( const Rectangle& rRect,
612 const OUString& rOrigStr,
613 sal_uInt16 nStyle,
614 GDIMetaFile& rMtf );
615 void DrawText( const Rectangle& rRect,
616 const OUString& rStr, sal_uInt16 nStyle = 0,
617 MetricVector* pVector = NULL, OUString* pDisplayText = NULL,
618 ::vcl::ITextLayout* _pTextLayout = NULL );
619 Rectangle GetTextRect( const Rectangle& rRect,
620 const OUString& rStr, sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK,
621 TextRectInfo* pInfo = NULL,
622 const ::vcl::ITextLayout* _pTextLayout = NULL ) const;
623 OUString GetEllipsisString( const OUString& rStr, long nMaxWidth,
624 sal_uInt16 nStyle = TEXT_DRAW_ENDELLIPSIS ) const;
625 void DrawCtrlText( const Point& rPos, const OUString& rStr,
626 xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
627 sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC, MetricVector* pVector = NULL, OUString* pDisplayText = NULL );
628 long GetCtrlTextWidth( const OUString& rStr, xub_StrLen nIndex = 0,
629 xub_StrLen nLen = STRING_LEN,
630 sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC ) const;
631 static OUString GetNonMnemonicString( const OUString& rStr, sal_Int32& rMnemonicPos );
632 static OUString GetNonMnemonicString( const OUString& rStr )
633 { sal_Int32 nDummy; return GetNonMnemonicString( rStr, nDummy ); }
635 sal_Bool GetTextBoundRect( Rectangle& rRect,
636 const OUString& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
637 sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
638 sal_Bool GetTextOutline( PolyPolygon&,
639 const OUString& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0,
640 xub_StrLen nLen = STRING_LEN, sal_Bool bOptimize = sal_True,
641 sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
642 sal_Bool GetTextOutlines( PolyPolyVector&,
643 const OUString& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0,
644 xub_StrLen nLen = STRING_LEN, sal_Bool bOptimize = sal_True,
645 sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
646 sal_Bool GetTextOutlines( ::basegfx::B2DPolyPolygonVector&,
647 const OUString& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0,
648 xub_StrLen nLen = STRING_LEN, sal_Bool bOptimize = sal_True,
649 sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
650 sal_Bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex,
651 int nLen, int nBase, MetricVector& rVector );
653 void DrawPixel( const Point& rPt );
654 void DrawPixel( const Point& rPt, const Color& rColor );
655 void DrawPixel( const Polygon& rPts, const Color* pColors = NULL );
656 void DrawPixel( const Polygon& rPts, const Color& rColor );
658 void DrawLine( const Point& rStartPt, const Point& rEndPt );
659 void DrawLine( const Point& rStartPt, const Point& rEndPt,
660 const LineInfo& rLineInfo );
662 /** Render the given polygon as a line stroke
664 The given polygon is stroked with the current LineColor, start
665 and end point are not automatically connected
667 @see DrawPolygon
668 @see DrawPolyPolygon
670 void DrawPolyLine( const Polygon& rPoly );
671 void DrawPolyLine(
672 const basegfx::B2DPolygon&,
673 double fLineWidth = 0.0,
674 basegfx::B2DLineJoin = basegfx::B2DLINEJOIN_ROUND,
675 com::sun::star::drawing::LineCap = com::sun::star::drawing::LineCap_BUTT);
676 bool TryDrawPolyLineDirect(
677 const basegfx::B2DPolygon& rB2DPolygon,
678 double fLineWidth = 0.0,
679 double fTransparency = 0.0,
680 basegfx::B2DLineJoin eLineJoin = basegfx::B2DLINEJOIN_NONE,
681 com::sun::star::drawing::LineCap eLineCap = com::sun::star::drawing::LineCap_BUTT);
683 /** Render the given polygon as a line stroke
685 The given polygon is stroked with the current LineColor, start
686 and end point are not automatically connected. The line is
687 rendered according to the specified LineInfo, e.g. supplying a
688 dash pattern, or a line thickness.
690 @see DrawPolygon
691 @see DrawPolyPolygon
693 void DrawPolyLine( const Polygon& rPoly,
694 const LineInfo& rLineInfo );
696 /** Render the given polygon
698 The given polygon is stroked with the current LineColor, and
699 filled with the current FillColor. If one of these colors are
700 transparent, the corresponding stroke or fill stays
701 invisible. Start and end point of the polygon are
702 automatically connected.
704 @see DrawPolyLine
706 void DrawPolygon( const Polygon& rPoly );
707 void DrawPolygon( const basegfx::B2DPolygon& );
709 /** Render the given poly-polygon
711 The given poly-polygon is stroked with the current LineColor,
712 and filled with the current FillColor. If one of these colors
713 are transparent, the corresponding stroke or fill stays
714 invisible. Start and end points of the contained polygons are
715 automatically connected.
717 @see DrawPolyLine
719 void DrawPolyPolygon( const PolyPolygon& rPolyPoly );
720 void DrawPolyPolygon( const basegfx::B2DPolyPolygon& );
722 void DrawRect( const Rectangle& rRect );
723 void DrawRect( const Rectangle& rRect,
724 sal_uLong nHorzRount, sal_uLong nVertRound );
725 void DrawEllipse( const Rectangle& rRect );
726 void DrawArc( const Rectangle& rRect,
727 const Point& rStartPt, const Point& rEndPt );
728 void DrawPie( const Rectangle& rRect,
729 const Point& rStartPt, const Point& rEndPt );
730 void DrawChord( const Rectangle& rRect,
731 const Point& rStartPt, const Point& rEndPt );
733 void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
734 const Point& rSrcPt, const Size& rSrcSize );
735 void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
736 const Point& rSrcPt, const Size& rSrcSize,
737 const OutputDevice& rOutDev );
738 void CopyArea( const Point& rDestPt,
739 const Point& rSrcPt, const Size& rSrcSize,
740 sal_uInt16 nFlags = 0 );
742 void DrawBitmap( const Point& rDestPt,
743 const Bitmap& rBitmap );
744 void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
745 const Bitmap& rBitmap );
746 void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
747 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
748 const Bitmap& rBitmap );
750 void DrawBitmapEx( const Point& rDestPt,
751 const BitmapEx& rBitmapEx );
752 void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
753 const BitmapEx& rBitmapEx );
754 void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
755 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
756 const BitmapEx& rBitmapEx );
758 /** Draw BitampEx transformed
760 @param rTransformation
761 The transformation describing the target positioning of the given bitmap. Transforming
762 the unit object coordinates (0, 0, 1, 1) with this matrix is the transformation to
763 discrete coordinates
765 @param rBitmapEx
766 The BitmapEx to be painted
768 void DrawTransformedBitmapEx(
769 const basegfx::B2DHomMatrix& rTransformation,
770 const BitmapEx& rBitmapEx);
772 void DrawMask( const Point& rDestPt,
773 const Bitmap& rBitmap, const Color& rMaskColor );
774 void DrawMask( const Point& rDestPt, const Size& rDestSize,
775 const Bitmap& rBitmap, const Color& rMaskColor );
776 void DrawMask( const Point& rDestPt, const Size& rDestSize,
777 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
778 const Bitmap& rBitmap, const Color& rMaskColor );
780 void DrawImage( const Point& rPos,
781 const Image& rImage, sal_uInt16 nStyle = 0 );
782 void DrawImage( const Point& rPos, const Size& rSize,
783 const Image& rImage, sal_uInt16 nStyle = 0 );
785 void DrawGradient( const Rectangle& rRect, const Gradient& rGradient );
786 void DrawGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient );
787 void AddGradientActions( const Rectangle& rRect,
788 const Gradient& rGradient,
789 GDIMetaFile& rMtf );
791 #ifdef _MSC_VER
792 void DrawHatch( const PolyPolygon& rPolyPoly, const ::Hatch& rHatch );
793 void AddHatchActions( const PolyPolygon& rPolyPoly,
794 const ::Hatch& rHatch,
795 GDIMetaFile& rMtf );
796 #else
797 void DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch );
798 void AddHatchActions( const PolyPolygon& rPolyPoly,
799 const Hatch& rHatch,
800 GDIMetaFile& rMtf );
801 #endif
803 void DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper );
804 void DrawWaveLine( const Point& rStartPos, const Point& rEndPos, sal_uInt16 nStyle );
805 void DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags );
807 void DrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
808 void DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency);
809 void DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize,
810 const Gradient& rTransparenceGradient );
812 /** Added return value to see if EPS could be painted directly.
813 Theoreticaly, handing over a matrix would be needed to handle
814 painting rotated EPS files (e.g. contained in Metafiles). This
815 would then need to be supported for Mac and PS printers, but
816 that's too much for now, wrote #i107046# for this */
817 bool DrawEPS( const Point& rPt, const Size& rSz,
818 const GfxLink& rGfxLink, GDIMetaFile* pSubst = NULL );
820 /// Fill the given rectangle with checkered rectangles of size nLen x nLen using the colors aStart and aEnd
821 void DrawCheckered(
822 const Point& rPos,
823 const Size& rSize,
824 sal_uInt32 nLen = 8,
825 Color aStart = Color(COL_WHITE),
826 Color aEnd = Color(COL_BLACK));
828 Color GetPixel( const Point& rPt ) const;
830 Bitmap GetBitmap( const Point& rSrcPt, const Size& rSize ) const;
832 /** Query extended bitmap (with alpha channel, if available).
834 BitmapEx GetBitmapEx( const Point& rSrcPt, const Size& rSize ) const;
836 void EnableMapMode( sal_Bool bEnable = sal_True );
837 sal_Bool IsMapModeEnabled() const { return mbMap; }
839 // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphisLayout
840 void EnableRTL( sal_Bool bEnable = sal_True);
841 sal_Bool IsRTLEnabled() const { return mbEnableRTL; }
843 void SetConnectMetaFile( GDIMetaFile* pMtf );
844 GDIMetaFile* GetConnectMetaFile() const { return mpMetaFile; }
846 void EnableOutput( sal_Bool bEnable = sal_True );
847 sal_Bool IsOutputEnabled() const { return mbOutput; }
848 sal_Bool IsDeviceOutput() const { return mbDevOutput; }
849 sal_Bool IsDeviceOutputNecessary() const { return (mbOutput && mbDevOutput); }
850 sal_Bool IsOutputNecessary() const { return ((mbOutput && mbDevOutput) || (mpMetaFile != NULL)); }
852 void SetClipRegion();
853 void SetClipRegion( const Region& rRegion );
854 Region GetClipRegion() const;
855 sal_Bool IsClipRegion() const { return mbClipRegion; }
856 Region GetActiveClipRegion() const;
858 void MoveClipRegion( long nHorzMove, long nVertMove );
859 void IntersectClipRegion( const Rectangle& rRect );
860 void IntersectClipRegion( const Region& rRegion );
862 void SetAntialiasing( sal_uInt16 nMode = 0 );
863 sal_uInt16 GetAntialiasing() const { return mnAntialiasing; }
865 void SetDrawMode( sal_uLong nDrawMode );
866 sal_uLong GetDrawMode() const { return mnDrawMode; }
868 void SetLayoutMode( sal_uLong nTextLayoutMode );
869 sal_uLong GetLayoutMode() const { return mnTextLayoutMode; }
871 void SetDigitLanguage( LanguageType );
872 LanguageType GetDigitLanguage() const { return meTextLanguage; }
874 void SetRasterOp( RasterOp eRasterOp );
875 RasterOp GetRasterOp() const { return meRasterOp; }
878 If this OutputDevice is used for displaying a Print Preview
879 the OutDevViewType should be set to 'OUTDEV_VIEWTYPE_PRINTPREVIEW'.
881 A View than can make painting decisions dependent on this OutDevViewType.
882 E.g. text colors need to be handled different, dependent on whether it's a PrintPreview or not. (see #106611# for more)
884 void SetOutDevViewType( OutDevViewType eOutDevViewType ) { meOutDevViewType=eOutDevViewType; }
885 OutDevViewType GetOutDevViewType() const { return meOutDevViewType; }
887 void SetLineColor();
888 void SetLineColor( const Color& rColor );
889 const Color& GetLineColor() const { return maLineColor; }
890 sal_Bool IsLineColor() const { return mbLineColor; }
892 void SetFillColor();
893 void SetFillColor( const Color& rColor );
894 const Color& GetFillColor() const { return maFillColor; }
895 sal_Bool IsFillColor() const { return mbFillColor; }
897 void SetBackground();
898 void SetBackground( const Wallpaper& rBackground );
900 const Wallpaper& GetBackground() const { return maBackground; }
901 sal_Bool IsBackground() const { return mbBackground; }
903 void SetFont( const Font& rNewFont );
904 const Font& GetFont() const { return maFont; }
906 SystemFontData GetSysFontData( int nFallbacklevel ) const;
907 SystemTextLayoutData GetSysTextLayoutData( const Point& rStartPt, const OUString& rStr,
908 xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
909 const sal_Int32* pDXAry = NULL ) const;
911 void SetTextColor( const Color& rColor );
912 const Color& GetTextColor() const { return maTextColor; }
913 void SetTextFillColor();
914 void SetTextFillColor( const Color& rColor );
916 Color GetTextFillColor() const;
917 sal_Bool IsTextFillColor() const { return !maFont.IsTransparent(); }
918 void SetTextLineColor();
919 void SetTextLineColor( const Color& rColor );
920 const Color& GetTextLineColor() const { return maTextLineColor; }
921 sal_Bool IsTextLineColor() const { return (maTextLineColor.GetTransparency() == 0); }
922 void SetOverlineColor();
923 void SetOverlineColor( const Color& rColor );
924 const Color& GetOverlineColor() const { return maOverlineColor; }
925 sal_Bool IsOverlineColor() const { return (maOverlineColor.GetTransparency() == 0); }
926 void SetTextAlign( TextAlign eAlign );
927 TextAlign GetTextAlign() const { return maFont.GetAlign(); }
929 virtual void SetSettings( const AllSettings& rSettings );
930 const AllSettings& GetSettings() const { return maSettings; }
932 SystemGraphicsData GetSystemGfxData() const;
933 ::com::sun::star::uno::Any GetSystemGfxDataAny() const;
935 virtual void SetMapMode();
936 virtual void SetMapMode( const MapMode& rNewMapMode );
937 virtual void SetRelativeMapMode( const MapMode& rNewMapMode );
938 const MapMode& GetMapMode() const { return maMapMode; }
939 sal_Bool IsMapMode() const { return mbMap; }
941 void SetRefPoint();
942 void SetRefPoint( const Point& rRefPoint );
943 const Point& GetRefPoint() const { return maRefPoint; }
944 sal_Bool IsRefPoint() const { return mbRefPoint; }
946 // #i75163#
947 basegfx::B2DHomMatrix GetViewTransformation() const;
948 basegfx::B2DHomMatrix GetInverseViewTransformation() const;
950 basegfx::B2DHomMatrix GetViewTransformation( const MapMode& rMapMode ) const;
951 basegfx::B2DHomMatrix GetInverseViewTransformation( const MapMode& rMapMode ) const;
954 /** Set an offset in pixel
956 This method offsets every drawing operation that converts its
957 coordinates to pixel by the given value. Normally, the effect
958 can be achieved by setting a MapMode with a different
959 origin. Unfortunately, this origin is in logical coordinates
960 and can lead to rounding errors (see #102532# for details).
962 @attention This offset is only applied when converting to
963 pixel, i.e. some output modes such as metafile recordings
964 might be completely unaffected by this method! Use with
965 care. Furthermore, if the OutputDevice's MapMode is the
966 default (that's MAP_PIXEL), then, too, any pixel offset set is
967 ignored. This might be unintuitive for cases, but would have
968 been far more fragile to implement. What's more, the reason
969 why the pixel offset was introduced (avoiding rounding errors)
970 does not apply for MAP_PIXEL, because one can always use the
971 MapMode origin then.
973 @param rOffset
974 The offset in pixel
976 void SetPixelOffset( const Size& rOffset );
978 /** Get the offset in pixel
980 @see OutputDevice::SetPixelOffset for details
982 @return the current offset in pixel
984 Size GetPixelOffset() const;
986 Point LogicToPixel( const Point& rLogicPt ) const;
987 Size LogicToPixel( const Size& rLogicSize ) const;
988 Rectangle LogicToPixel( const Rectangle& rLogicRect ) const;
989 Polygon LogicToPixel( const Polygon& rLogicPoly ) const;
990 PolyPolygon LogicToPixel( const PolyPolygon& rLogicPolyPoly ) const;
991 basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly ) const;
992 Region LogicToPixel( const Region& rLogicRegion )const;
993 Point LogicToPixel( const Point& rLogicPt,
994 const MapMode& rMapMode ) const;
995 Size LogicToPixel( const Size& rLogicSize,
996 const MapMode& rMapMode ) const;
997 Rectangle LogicToPixel( const Rectangle& rLogicRect,
998 const MapMode& rMapMode ) const;
999 Polygon LogicToPixel( const Polygon& rLogicPoly,
1000 const MapMode& rMapMode ) const;
1001 basegfx::B2DPolygon LogicToPixel( const basegfx::B2DPolygon& rLogicPoly,
1002 const MapMode& rMapMode ) const;
1003 PolyPolygon LogicToPixel( const PolyPolygon& rLogicPolyPoly,
1004 const MapMode& rMapMode ) const;
1005 basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly,
1006 const MapMode& rMapMode ) const;
1007 Region LogicToPixel( const Region& rLogicRegion,
1008 const MapMode& rMapMode ) const;
1009 Point PixelToLogic( const Point& rDevicePt ) const;
1010 Size PixelToLogic( const Size& rDeviceSize ) const;
1011 Rectangle PixelToLogic( const Rectangle& rDeviceRect ) const;
1012 Polygon PixelToLogic( const Polygon& rDevicePoly ) const;
1013 basegfx::B2DPolygon LogicToPixel( const basegfx::B2DPolygon& rLogicPoly ) const;
1014 PolyPolygon PixelToLogic( const PolyPolygon& rDevicePolyPoly ) const;
1015 basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly ) const;
1016 Region PixelToLogic( const Region& rDeviceRegion ) const;
1017 Point PixelToLogic( const Point& rDevicePt,
1018 const MapMode& rMapMode ) const;
1019 Size PixelToLogic( const Size& rDeviceSize,
1020 const MapMode& rMapMode ) const;
1021 Rectangle PixelToLogic( const Rectangle& rDeviceRect,
1022 const MapMode& rMapMode ) const;
1023 Polygon PixelToLogic( const Polygon& rDevicePoly,
1024 const MapMode& rMapMode ) const;
1025 basegfx::B2DPolygon PixelToLogic( const basegfx::B2DPolygon& rDevicePoly,
1026 const MapMode& rMapMode ) const;
1027 PolyPolygon PixelToLogic( const PolyPolygon& rDevicePolyPoly,
1028 const MapMode& rMapMode ) const;
1029 basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly,
1030 const MapMode& rMapMode ) const;
1031 Region PixelToLogic( const Region& rDeviceRegion,
1032 const MapMode& rMapMode ) const;
1033 Point LogicToLogic( const Point& rPtSource,
1034 const MapMode* pMapModeSource,
1035 const MapMode* pMapModeDest ) const;
1036 Size LogicToLogic( const Size& rSzSource,
1037 const MapMode* pMapModeSource,
1038 const MapMode* pMapModeDest ) const;
1039 Rectangle LogicToLogic( const Rectangle& rRectSource,
1040 const MapMode* pMapModeSource,
1041 const MapMode* pMapModeDest ) const;
1042 static Point LogicToLogic( const Point& rPtSource,
1043 const MapMode& rMapModeSource,
1044 const MapMode& rMapModeDest );
1045 static Size LogicToLogic( const Size& rSzSource,
1046 const MapMode& rMapModeSource,
1047 const MapMode& rMapModeDest );
1048 static Rectangle LogicToLogic( const Rectangle& rRectSource,
1049 const MapMode& rMapModeSource,
1050 const MapMode& rMapModeDest );
1051 static long LogicToLogic( long nLongSource,
1052 MapUnit eUnitSource,
1053 MapUnit eUnitDest );
1055 static basegfx::B2DPolygon LogicToLogic( const basegfx::B2DPolygon& rPoly,
1056 const MapMode& rMapModeSource,
1057 const MapMode& rMapModeDest );
1058 static basegfx::B2DPolyPolygon LogicToLogic( const basegfx::B2DPolyPolygon& rPolyPoly,
1059 const MapMode& rMapModeSource,
1060 const MapMode& rMapModeDest );
1062 // create a mapping transformation from rMapModeSource to rMapModeDest (the above methods
1063 // for B2DPoly/Polygons use this internally anyways to transform the B2DPolygon)
1064 static basegfx::B2DHomMatrix LogicToLogic(const MapMode& rMapModeSource, const MapMode& rMapModeDest);
1066 Size GetOutputSizePixel() const
1067 { return Size( mnOutWidth, mnOutHeight ); }
1068 long GetOutputWidthPixel() const { return mnOutWidth; }
1069 long GetOutputHeightPixel() const { return mnOutHeight; }
1070 long GetOutOffXPixel() const { return mnOutOffX; }
1071 long GetOutOffYPixel() const { return mnOutOffY; }
1073 Size GetOutputSize() const
1074 { return PixelToLogic( GetOutputSizePixel() ); }
1076 void Erase();
1077 void Erase( const Rectangle& rRect ) { DrawWallpaper( rRect, GetBackground() ); }
1079 sal_Bool AddTempDevFont( const OUString& rFileURL, const OUString& rFontName );
1080 int GetDevFontCount() const;
1081 FontInfo GetDevFont( int nDevFontIndex ) const;
1082 int GetDevFontSizeCount( const Font& ) const;
1083 Size GetDevFontSize( const Font& rFont, int nSizeIndex ) const;
1084 sal_Bool IsFontAvailable( const OUString& rFontName ) const;
1086 FontMetric GetFontMetric() const;
1087 FontMetric GetFontMetric( const Font& rFont ) const;
1088 sal_Bool GetFontCharMap( FontCharMap& rFontCharMap ) const;
1089 bool GetFontCapabilities( vcl::FontCapabilities& rFontCapabilities ) const;
1091 xub_StrLen HasGlyphs( const Font& rFont, const OUString& rStr,
1092 xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN ) const;
1094 long GetMinKashida() const;
1096 // i60594
1097 // validate kashida positions against the current font
1098 // returns count of invalid kashida positions
1099 xub_StrLen ValidateKashidas ( const OUString& rTxt,
1100 xub_StrLen nIdx, xub_StrLen nLen,
1101 xub_StrLen nKashCount, // number of suggested kashida positions (in)
1102 const xub_StrLen* pKashidaPos, // suggested kashida positions (in)
1103 xub_StrLen* pKashidaPosDropped // invalid kashida positions (out)
1104 ) const;
1106 sal_uInt16 GetBitCount() const;
1108 sal_Bool GetTextIsRTL( const OUString&, sal_Int32 nIndex, sal_Int32 nLen ) const;
1110 /** Query the existence and depth of the alpha channel
1112 @return 0, if no alpha channel available, and the bit depth of
1113 the alpha channel otherwise.
1115 sal_uInt16 GetAlphaBitCount() const;
1116 sal_uLong GetColorCount() const;
1118 void Push( sal_uInt16 nFlags = PUSH_ALL );
1119 void Pop();
1120 // returns the curren stack depth; that is the number of Push() calls minus the number of Pop() calls
1121 // this should not normally be used since Push and Pop must always be used symmetrically
1122 // however this may be e.g. a help when debugging code in which this somehow is not the case
1123 sal_uInt32 GetGCStackDepth() const;
1125 /** Query availability of alpha channel
1127 @return sal_True, if this device has an alpha channel.
1129 sal_Bool HasAlpha();
1131 /// request XCanvas render interface for this OutputDevice
1132 ::com::sun::star::uno::Reference<
1133 ::com::sun::star::rendering::XCanvas > GetCanvas() const;
1135 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > CreateUnoGraphics();
1136 VCLXGraphicsList_impl* GetUnoGraphicsList() const { return mpUnoGraphicsList; }
1137 VCLXGraphicsList_impl* CreateUnoGraphicsList()
1139 mpUnoGraphicsList = new VCLXGraphicsList_impl();
1140 return mpUnoGraphicsList;
1143 static void BeginFontSubstitution();
1144 static void EndFontSubstitution();
1145 static void AddFontSubstitute( const OUString& rFontName,
1146 const OUString& rReplaceFontName,
1147 sal_uInt16 nFlags = 0 );
1148 static void RemoveFontSubstitute( sal_uInt16 n );
1149 static sal_uInt16 GetFontSubstituteCount();
1151 static Font GetDefaultFont( sal_uInt16 nType,
1152 LanguageType eLang,
1153 sal_uLong nFlags,
1154 const OutputDevice* pOutDev = NULL );
1156 /** helper method removing transparencies from a metafile (e.g. for printing)
1158 @returns
1159 true: transparencies were removed
1160 false: output metafile is unchanged input metafile
1162 @attention this is a member method, so current state can influence the result !
1163 @attention the output metafile is prepared in pixel mode for the currentOutputDevice
1164 state. It can not be moved or rotated reliably anymore.
1166 bool RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
1167 long nMaxBmpDPIX, long nMaxBmpDPIY,
1168 bool bReduceTransparency,
1169 bool bTransparencyAutoMode,
1170 bool bDownsampleBitmaps,
1171 const Color& rBackground = Color( COL_TRANSPARENT )
1173 /** Retrieve downsampled and cropped bitmap
1175 @attention This method ignores negative rDstSz values, thus
1176 mirroring must happen outside this method (e.g. in DrawBitmap)
1178 Bitmap GetDownsampledBitmap( const Size& rDstSz,
1179 const Point& rSrcPt, const Size& rSrcSz,
1180 const Bitmap& rBmp, long nMaxBmpDPIX, long nMaxBmpDPIY );
1182 //-------------------------------------
1183 // Native Widget Rendering functions
1184 //-------------------------------------
1186 // These all just call through to the private mpGraphics functions of the same name.
1188 // Query the platform layer for control support
1189 sal_Bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) const;
1191 // Query the native control to determine if it was acted upon
1192 sal_Bool HitTestNativeControl( ControlType nType,
1193 ControlPart nPart,
1194 const Rectangle& rControlRegion,
1195 const Point& aPos,
1196 sal_Bool& rIsInside ) const;
1198 // Request rendering of a particular control and/or part
1199 sal_Bool DrawNativeControl( ControlType nType,
1200 ControlPart nPart,
1201 const Rectangle& rControlRegion,
1202 ControlState nState,
1203 const ImplControlValue& aValue,
1204 OUString aCaption );
1206 // Query the native control's actual drawing region (including adornment)
1207 sal_Bool GetNativeControlRegion( ControlType nType,
1208 ControlPart nPart,
1209 const Rectangle& rControlRegion,
1210 ControlState nState,
1211 const ImplControlValue& aValue,
1212 OUString aCaption,
1213 Rectangle &rNativeBoundingRegion,
1214 Rectangle &rNativeContentRegion ) const;
1218 #endif // INCLUDED_VCL_OUTDEV_HXX
1220 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */