Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_VCL_OUTDEV_HXX
21 : #define INCLUDED_VCL_OUTDEV_HXX
22 :
23 : #include <tools/gen.hxx>
24 : #include <tools/solar.h>
25 : #include <vcl/dllapi.h>
26 : #include <tools/rc.hxx>
27 : #include <tools/color.hxx>
28 : #include <vcl/font.hxx>
29 : #include <vcl/region.hxx>
30 : #include <vcl/mapmod.hxx>
31 : #include <vcl/wall.hxx>
32 : #include <vcl/metaact.hxx>
33 : #include <vcl/salnativewidgets.hxx>
34 : #include <tools/poly.hxx>
35 : #include <basegfx/vector/b2enums.hxx>
36 : #include <com/sun/star/uno/Reference.h>
37 : #include <unotools/fontdefs.hxx>
38 : #include <basegfx/polygon/b2dpolypolygon.hxx>
39 : #include <boost/scoped_ptr.hpp>
40 : #include <com/sun/star/drawing/LineCap.hpp>
41 :
42 : #include <vector>
43 :
44 : struct ImplOutDevData;
45 : class ImplFontEntry;
46 : struct ImplObjStack;
47 : struct SystemGraphicsData;
48 : struct SystemFontData;
49 : struct SystemTextLayoutData;
50 : class ImplFontCache;
51 : class PhysicalFontCollection;
52 : class ImplGetDevFontList;
53 : class ImplGetDevSizeList;
54 : class ImplMultiTextLineInfo;
55 : class SalGraphics;
56 : class Gradient;
57 : class Hatch;
58 : class AllSettings;
59 : class Bitmap;
60 : class BitmapReadAccess;
61 : class BitmapEx;
62 : class Image;
63 : class TextRectInfo;
64 : class FontInfo;
65 : class FontMetric;
66 : class GDIMetaFile;
67 : class GfxLink;
68 : class Line;
69 : class LineInfo;
70 : class AlphaMask;
71 : class FontCharMap;
72 : class SalLayout;
73 : class ImplLayoutArgs;
74 : class ImplFontAttributes;
75 : class VirtualDevice;
76 : class Window;
77 : struct SalTwoRect;
78 :
79 : namespace com {
80 : namespace sun {
81 : namespace star {
82 : namespace rendering {
83 : class XCanvas;
84 : }}}}
85 : namespace basegfx {
86 : class B2DHomMatrix;
87 : class B2DPolygon;
88 : class B2DPolyPolygon;
89 : }
90 :
91 : namespace com {
92 : namespace sun {
93 : namespace star {
94 : namespace awt {
95 : class XGraphics;
96 : } } } }
97 :
98 : typedef std::vector< Rectangle > MetricVector;
99 :
100 : namespace vcl
101 : {
102 : class PDFWriterImpl;
103 : class ExtOutDevData;
104 : class ITextLayout;
105 : struct FontCapabilities;
106 : }
107 :
108 : // OutputDevice-Data
109 :
110 : struct ImplMapRes
111 : {
112 : long mnMapOfsX; // Offset in X direction
113 : long mnMapOfsY; // Offset in Y direction
114 : long mnMapScNumX; // Scaling factor - numerator in X direction
115 : long mnMapScNumY; // Scaling factor - numerator in Y direction
116 : long mnMapScDenomX; // Scaling factor - denominator in X direction
117 : long mnMapScDenomY; // Scaling factor - denominator in Y direction
118 : };
119 :
120 : struct ImplThresholdRes
121 : {
122 : long mnThresLogToPixX; // Thresholds for calculation
123 : long mnThresLogToPixY; // with BigInts
124 : long mnThresPixToLogX; // ""
125 : long mnThresPixToLogY; // ""
126 : };
127 :
128 : // OutputDevice-Types
129 :
130 : // Flags for Push()
131 : #define PUSH_LINECOLOR ((sal_uInt16)0x0001)
132 : #define PUSH_FILLCOLOR ((sal_uInt16)0x0002)
133 : #define PUSH_FONT ((sal_uInt16)0x0004)
134 : #define PUSH_TEXTCOLOR ((sal_uInt16)0x0008)
135 : #define PUSH_MAPMODE ((sal_uInt16)0x0010)
136 : #define PUSH_CLIPREGION ((sal_uInt16)0x0020)
137 : #define PUSH_RASTEROP ((sal_uInt16)0x0040)
138 : #define PUSH_TEXTFILLCOLOR ((sal_uInt16)0x0080)
139 : #define PUSH_TEXTALIGN ((sal_uInt16)0x0100)
140 : #define PUSH_REFPOINT ((sal_uInt16)0x0200)
141 : #define PUSH_TEXTLINECOLOR ((sal_uInt16)0x0400)
142 : #define PUSH_TEXTLAYOUTMODE ((sal_uInt16)0x0800)
143 : #define PUSH_TEXTLANGUAGE ((sal_uInt16)0x1000)
144 : #define PUSH_OVERLINECOLOR ((sal_uInt16)0x2000)
145 : #define PUSH_ALLTEXT (PUSH_TEXTCOLOR | PUSH_TEXTFILLCOLOR | PUSH_TEXTLINECOLOR | PUSH_OVERLINECOLOR | PUSH_TEXTALIGN | PUSH_TEXTLAYOUTMODE | PUSH_TEXTLANGUAGE)
146 : #define PUSH_ALLFONT (PUSH_ALLTEXT | PUSH_FONT)
147 : #define PUSH_ALL ((sal_uInt16)0xFFFF)
148 :
149 : // Flags for DrawText()
150 : #define TEXT_DRAW_DISABLE ((sal_uInt16)0x0001)
151 : #define TEXT_DRAW_MNEMONIC ((sal_uInt16)0x0002)
152 : #define TEXT_DRAW_MONO ((sal_uInt16)0x0004)
153 : #define TEXT_DRAW_CLIP ((sal_uInt16)0x0008)
154 : #define TEXT_DRAW_LEFT ((sal_uInt16)0x0010)
155 : #define TEXT_DRAW_CENTER ((sal_uInt16)0x0020)
156 : #define TEXT_DRAW_RIGHT ((sal_uInt16)0x0040)
157 : #define TEXT_DRAW_TOP ((sal_uInt16)0x0080)
158 : #define TEXT_DRAW_VCENTER ((sal_uInt16)0x0100)
159 : #define TEXT_DRAW_BOTTOM ((sal_uInt16)0x0200)
160 : #define TEXT_DRAW_ENDELLIPSIS ((sal_uInt16)0x0400)
161 : #define TEXT_DRAW_PATHELLIPSIS ((sal_uInt16)0x0800)
162 : #define TEXT_DRAW_MULTILINE ((sal_uInt16)0x1000)
163 : #define TEXT_DRAW_WORDBREAK ((sal_uInt16)0x2000)
164 : #define TEXT_DRAW_NEWSELLIPSIS ((sal_uInt16)0x4000)
165 : // in the long run we should make text style flags longer
166 : // but at the moment we can get away with this 2 bit field for ellipsis style
167 : #define TEXT_DRAW_CENTERELLIPSIS (TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_PATHELLIPSIS)
168 :
169 : #define TEXT_DRAW_WORDBREAK_HYPHENATION (((sal_uInt16)0x8000) | TEXT_DRAW_WORDBREAK)
170 :
171 : // Flags for CopyArea()
172 : #define COPYAREA_WINDOWINVALIDATE ((sal_uInt16)0x0001)
173 :
174 : // Flags for DrawImage()
175 : #define IMAGE_DRAW_DISABLE ((sal_uInt16)0x0001)
176 : #define IMAGE_DRAW_HIGHLIGHT ((sal_uInt16)0x0002)
177 : #define IMAGE_DRAW_DEACTIVE ((sal_uInt16)0x0004)
178 : #define IMAGE_DRAW_COLORTRANSFORM ((sal_uInt16)0x0008)
179 : #define IMAGE_DRAW_SEMITRANSPARENT ((sal_uInt16)0x0010)
180 :
181 : // Grid
182 : #define GRID_DOTS ((sal_uLong)0x00000001)
183 : #define GRID_HORZLINES ((sal_uLong)0x00000002)
184 : #define GRID_VERTLINES ((sal_uLong)0x00000004)
185 : #define GRID_LINES (GRID_HORZLINES | GRID_VERTLINES)
186 :
187 : // LayoutModes for Complex Text Layout
188 : #define TEXT_LAYOUT_DEFAULT ((sal_uLong)0x00000000)
189 : #define TEXT_LAYOUT_BIDI_LTR ((sal_uLong)0x00000000)
190 : #define TEXT_LAYOUT_BIDI_RTL ((sal_uLong)0x00000001)
191 : #define TEXT_LAYOUT_BIDI_STRONG ((sal_uLong)0x00000002)
192 : #define TEXT_LAYOUT_TEXTORIGIN_LEFT ((sal_uLong)0x00000004)
193 : #define TEXT_LAYOUT_TEXTORIGIN_RIGHT ((sal_uLong)0x00000008)
194 : #define TEXT_LAYOUT_COMPLEX_DISABLED ((sal_uLong)0x00000100)
195 : #define TEXT_LAYOUT_ENABLE_LIGATURES ((sal_uLong)0x00000200)
196 : #define TEXT_LAYOUT_SUBSTITUTE_DIGITS ((sal_uLong)0x00000400)
197 :
198 : // DrawModes
199 : #define DRAWMODE_DEFAULT ((sal_uLong)0x00000000)
200 : #define DRAWMODE_BLACKLINE ((sal_uLong)0x00000001)
201 : #define DRAWMODE_BLACKFILL ((sal_uLong)0x00000002)
202 : #define DRAWMODE_BLACKTEXT ((sal_uLong)0x00000004)
203 : #define DRAWMODE_BLACKBITMAP ((sal_uLong)0x00000008)
204 : #define DRAWMODE_BLACKGRADIENT ((sal_uLong)0x00000010)
205 : #define DRAWMODE_GRAYLINE ((sal_uLong)0x00000020)
206 : #define DRAWMODE_GRAYFILL ((sal_uLong)0x00000040)
207 : #define DRAWMODE_GRAYTEXT ((sal_uLong)0x00000080)
208 : #define DRAWMODE_GRAYBITMAP ((sal_uLong)0x00000100)
209 : #define DRAWMODE_GRAYGRADIENT ((sal_uLong)0x00000200)
210 : #define DRAWMODE_NOFILL ((sal_uLong)0x00000400)
211 : #define DRAWMODE_NOBITMAP ((sal_uLong)0x00000800)
212 : #define DRAWMODE_NOGRADIENT ((sal_uLong)0x00001000)
213 : #define DRAWMODE_GHOSTEDLINE ((sal_uLong)0x00002000)
214 : #define DRAWMODE_GHOSTEDFILL ((sal_uLong)0x00004000)
215 : #define DRAWMODE_GHOSTEDTEXT ((sal_uLong)0x00008000)
216 : #define DRAWMODE_GHOSTEDBITMAP ((sal_uLong)0x00010000)
217 : #define DRAWMODE_GHOSTEDGRADIENT ((sal_uLong)0x00020000)
218 : #define DRAWMODE_WHITELINE ((sal_uLong)0x00100000)
219 : #define DRAWMODE_WHITEFILL ((sal_uLong)0x00200000)
220 : #define DRAWMODE_WHITETEXT ((sal_uLong)0x00400000)
221 : #define DRAWMODE_WHITEBITMAP ((sal_uLong)0x00800000)
222 : #define DRAWMODE_WHITEGRADIENT ((sal_uLong)0x01000000)
223 : #define DRAWMODE_SETTINGSLINE ((sal_uLong)0x02000000)
224 : #define DRAWMODE_SETTINGSFILL ((sal_uLong)0x04000000)
225 : #define DRAWMODE_SETTINGSTEXT ((sal_uLong)0x08000000)
226 : #define DRAWMODE_SETTINGSGRADIENT ((sal_uLong)0x10000000)
227 : #define DRAWMODE_NOTRANSPARENCY ((sal_uLong)0x80000000)
228 :
229 : // Antialiasing
230 : #define ANTIALIASING_DISABLE_TEXT ((sal_uInt16)0x0001)
231 : #define ANTIALIASING_ENABLE_B2DDRAW ((sal_uInt16)0x0002)
232 : #define ANTIALIASING_PIXELSNAPHAIRLINE ((sal_uInt16)0x0004)
233 :
234 : // AddFontSubstitute
235 : #define FONT_SUBSTITUTE_ALWAYS ((sal_uInt16)0x0001)
236 : #define FONT_SUBSTITUTE_SCREENONLY ((sal_uInt16)0x0002)
237 :
238 : #define DEFAULTFONT_FLAGS_ONLYONE ((sal_uLong)0x00000001)
239 :
240 : enum OutDevType { OUTDEV_DONTKNOW, OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV };
241 :
242 : enum OutDevViewType { OUTDEV_VIEWTYPE_DONTKNOW, OUTDEV_VIEWTYPE_PRINTPREVIEW, OUTDEV_VIEWTYPE_SLIDESHOW };
243 :
244 : // OutputDevice
245 :
246 : class VirtualDevice;
247 : class Printer;
248 : class FontSelectPattern;
249 : class ImplFontMetricData;
250 : class VCLXGraphics;
251 :
252 : typedef ::std::vector< VCLXGraphics* > VCLXGraphicsList_impl;
253 :
254 : const char* ImplDbgCheckOutputDevice( const void* pObj );
255 :
256 : class VCL_DLLPUBLIC OutputDevice
257 : {
258 : friend class Application;
259 : friend class Bitmap;
260 : friend class ImplImageBmp;
261 : friend class Printer;
262 : friend class System;
263 : friend class VirtualDevice;
264 : friend class Window;
265 : friend class WorkWindow;
266 : friend class vcl::PDFWriterImpl;
267 : friend const char* ImplDbgCheckOutputDevice( const void* pObj );
268 : friend void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight );
269 :
270 : private:
271 : mutable SalGraphics* mpGraphics; ///< Graphics context to draw on
272 : mutable OutputDevice* mpPrevGraphics; ///< Previous output device in list
273 : mutable OutputDevice* mpNextGraphics; ///< Next output device in list
274 : GDIMetaFile* mpMetaFile;
275 : mutable ImplFontEntry* mpFontEntry;
276 : mutable ImplFontCache* mpFontCache;
277 : mutable PhysicalFontCollection* mpFontCollection;
278 : mutable ImplGetDevFontList* mpGetDevFontList;
279 : mutable ImplGetDevSizeList* mpGetDevSizeList;
280 : ImplObjStack* mpObjStack;
281 : ImplOutDevData* mpOutDevData;
282 : VCLXGraphicsList_impl* mpUnoGraphicsList;
283 : vcl::PDFWriterImpl* mpPDFWriter;
284 : vcl::ExtOutDevData* mpExtOutDevData;
285 :
286 : // TEMP TEMP TEMP
287 : VirtualDevice* mpAlphaVDev;
288 :
289 : /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
290 : long mnOutOffOrigX;
291 : /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
292 : long mnOutOffLogicX;
293 : /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
294 : long mnOutOffOrigY;
295 : /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
296 : long mnOutOffLogicY;
297 : /// Output offset for device output in pixel (pseudo window offset within window system's frames)
298 : long mnOutOffX;
299 : /// Output offset for device output in pixel (pseudo window offset within window system's frames)
300 : long mnOutOffY;
301 : long mnOutWidth;
302 : long mnOutHeight;
303 : sal_Int32 mnDPIX;
304 : sal_Int32 mnDPIY;
305 : sal_Int32 mnDPIScaleFactor; ///< For Hi-DPI displays, we want to draw everything mnDPIScaleFactor-times larger
306 : /// font specific text alignment offsets in pixel units
307 : mutable long mnTextOffX;
308 : mutable long mnTextOffY;
309 : mutable long mnEmphasisAscent;
310 : mutable long mnEmphasisDescent;
311 : sal_uLong mnDrawMode;
312 : sal_uLong mnTextLayoutMode;
313 : ImplMapRes maMapRes;
314 : ImplThresholdRes maThresRes;
315 : OutDevType meOutDevType;
316 : OutDevViewType meOutDevViewType;
317 : Region maRegion; // contains the clip region, see SetClipRegion(...)
318 : Color maLineColor;
319 : Color maFillColor;
320 : Font maFont;
321 : Color maTextColor;
322 : Color maTextLineColor;
323 : Color maOverlineColor;
324 : TextAlign meTextAlign;
325 : RasterOp meRasterOp;
326 : Wallpaper maBackground;
327 : boost::scoped_ptr<AllSettings> mxSettings;
328 : MapMode maMapMode;
329 : Point maRefPoint;
330 : sal_uInt16 mnAntialiasing;
331 : LanguageType meTextLanguage;
332 :
333 : /// bitfield
334 : mutable bool mbMap : 1;
335 : mutable bool mbMapIsDefault : 1;
336 : mutable bool mbClipRegion : 1;
337 : mutable bool mbBackground : 1;
338 : mutable bool mbOutput : 1;
339 : mutable bool mbDevOutput : 1;
340 : mutable bool mbOutputClipped : 1;
341 : mutable bool mbLineColor : 1;
342 : mutable bool mbFillColor : 1;
343 : mutable bool mbInitLineColor : 1;
344 : mutable bool mbInitFillColor : 1;
345 : mutable bool mbInitFont : 1;
346 : mutable bool mbInitTextColor : 1;
347 : mutable bool mbInitClipRegion : 1;
348 : mutable bool mbClipRegionSet : 1;
349 : mutable bool mbKerning : 1;
350 : mutable bool mbNewFont : 1;
351 : mutable bool mbTextLines : 1;
352 : mutable bool mbTextSpecial : 1;
353 : mutable bool mbRefPoint : 1;
354 : mutable bool mbEnableRTL : 1;
355 :
356 :
357 : protected:
358 : virtual void ImplReleaseFonts();
359 :
360 : public:
361 : /** @name Initialization and accessor functions
362 : */
363 : ///@{
364 :
365 : /** Get the graphic context that the output device uses to draw on.
366 :
367 : If no graphics device exists, then initialize it.
368 :
369 : @returns SalGraphics instance.
370 : */
371 : SAL_DLLPRIVATE SalGraphics const *ImplGetGraphics() const;
372 : SAL_DLLPRIVATE SalGraphics* ImplGetGraphics();
373 :
374 : /** Initialize the graphics device that the output device uses to draw on.
375 :
376 : There is an LRU of OutputDevices that is used to get the graphics. The
377 : actual creation of a SalGraphics instance is done via the SalFrame
378 : implementation.
379 :
380 : However, the SalFrame instance will only return a valid SalGraphics
381 : instance if it is not in use or there wasn't one in the first place. When
382 : this happens, ImplInitGraphics finds the least recently used OutputDevice
383 : in a different frame and "steals" it (releases it then starts using it).
384 :
385 : If there are no frames to steal an OutputDevice's SalGraphics instance from
386 : then it blocks until the graphics is released.
387 :
388 : Once it has acquired a graphics instance, then we add the OutputDevice to
389 : the LRU.
390 :
391 : @returns true if was able to initialize the graphics device, false otherwise.
392 : */
393 : virtual bool ImplInitGraphics() const = 0;
394 :
395 : /** Release the graphics device, and remove it from the graphics device
396 : list.
397 :
398 : @param bRelease Determines whether to release the fonts of the
399 : physically released graphics device.
400 : */
401 : virtual void ImplReleaseGraphics( bool bRelease = true ) = 0;
402 :
403 : /** Initialize the graphics device's data structures.
404 : */
405 : SAL_DLLPRIVATE void ImplInitOutDevData();
406 :
407 : /** De-initialize the graphics device's data structures.
408 : */
409 : SAL_DLLPRIVATE void ImplDeInitOutDevData();
410 : ///@}
411 :
412 :
413 : /** @name Helper functions
414 : */
415 : ///@{
416 :
417 : /** Get the output device's DPI x-axis value.
418 :
419 : @returns x-axis DPI value
420 : */
421 0 : SAL_DLLPRIVATE sal_Int32 ImplGetDPIX() const { return mnDPIX; }
422 :
423 : /** Get the output device's DPI y-axis value.
424 :
425 : @returns y-axis DPI value
426 : */
427 0 : SAL_DLLPRIVATE sal_Int32 ImplGetDPIY() const { return mnDPIY; }
428 :
429 : /** Convert a logical X coordinate to a device pixel's X coordinate.
430 :
431 : To get the device's X coordinate, it must calculate the mapping offset
432 : coordinate X position (if there is one - if not then it just adds
433 : the pseudo-window offset to the logical X coordinate), the X-DPI of
434 : the device and the mapping's X scaling factor.
435 :
436 : @param nX Logical X coordinate
437 :
438 : @returns Device's X pixel coordinate
439 : */
440 : SAL_DLLPRIVATE long ImplLogicXToDevicePixel( long nX ) const;
441 :
442 : /** Convert a logical Y coordinate to a device pixel's Y coordinate.
443 :
444 : To get the device's Y coordinate, it must calculate the mapping offset
445 : coordinate Y position (if there is one - if not then it just adds
446 : the pseudo-window offset to the logical Y coordinate), the Y-DPI of
447 : the device and the mapping's Y scaling factor.
448 :
449 : @param nY Logical Y coordinate
450 :
451 : @returns Device's Y pixel coordinate
452 : */
453 : SAL_DLLPRIVATE long ImplLogicYToDevicePixel( long nY ) const;
454 :
455 : /** Convert a logical width to a width in units of device pixels.
456 :
457 : To get the number of device pixels, it must calculate the X-DPI of the device and
458 : the map scaling factor. If there is no mapping, then it just returns the
459 : width as nothing more needs to be done.
460 :
461 : @param nWidth Logical width
462 :
463 : @returns Width in units of device pixels.
464 : */
465 : SAL_DLLPRIVATE long ImplLogicWidthToDevicePixel( long nWidth ) const;
466 :
467 : /** Convert a logical height to a height in units of device pixels.
468 :
469 : To get the number of device pixels, it must calculate the Y-DPI of the device and
470 : the map scaling factor. If there is no mapping, then it just returns the
471 : height as nothing more needs to be done.
472 :
473 : @param nHeight Logical height
474 :
475 : @returns Height in units of device pixels.
476 : */
477 : SAL_DLLPRIVATE long ImplLogicHeightToDevicePixel( long nHeight ) const;
478 :
479 : /** Convert device pixels to a width in logical units.
480 :
481 : To get the logical width, it must calculate the X-DPI of the device and the
482 : map scaling factor.
483 :
484 : @param nWidth Width in device pixels
485 :
486 : @returns Width in logical units.
487 : */
488 : SAL_DLLPRIVATE long ImplDevicePixelToLogicWidth( long nWidth ) const;
489 :
490 : /** Convert device pixels to a height in logical units.
491 :
492 : To get the logical height, it must calculate the Y-DPI of the device and the
493 : map scaling factor.
494 :
495 : @param nHeight Height in device pixels
496 :
497 : @returns Height in logical units.
498 : */
499 : SAL_DLLPRIVATE long ImplDevicePixelToLogicHeight( long nHeight ) const;
500 :
501 : /** Convert logical height to device pixels, with exact sub-pixel value.
502 :
503 : To get the \em exact pixel height, it must calculate the Y-DPI of the device and the
504 : map scaling factor.
505 :
506 : @param nHeight Exact height in logical units.
507 :
508 : @returns Exact height in pixels - returns as a float to provide for subpixel value.
509 : */
510 : SAL_DLLPRIVATE float ImplFloatLogicHeightToDevicePixel( float ) const;
511 :
512 : /** Convert a logical point to a physical point on the device.
513 :
514 : @param rLogicPt Const reference to a point in logical units.
515 :
516 : @returns Physical point on the device.
517 : */
518 : SAL_DLLPRIVATE Point ImplLogicToDevicePixel( const Point& rLogicPt ) const;
519 :
520 : /** Convert a logical size to the size on the physical device.
521 :
522 : @param rLogicSize Const reference to a size in logical units
523 :
524 : @returns Physical size on the device.
525 : */
526 : SAL_DLLPRIVATE Size ImplLogicToDevicePixel( const Size& rLogicSize ) const;
527 :
528 : /** Convert a logical rectangle to a rectangle in physical device pixel units.
529 :
530 : @param rLogicSize Const reference to a rectangle in logical units
531 :
532 : @returns Rectangle based on physical device pixel coordinates and units.
533 : */
534 : SAL_DLLPRIVATE Rectangle ImplLogicToDevicePixel( const Rectangle& rLogicRect ) const;
535 :
536 : /** Convert a rectangle in physical pixel units to a rectangle in physical pixel units and coords.
537 :
538 : @param rPixelRect Const reference to rectangle in logical units and coords.
539 :
540 : @returns Rectangle based on logical coordinates and units.
541 : */
542 : SAL_DLLPRIVATE Rectangle ImplDevicePixelToLogic( const Rectangle& rPixelRect ) const;
543 :
544 : /** Convert a logical B2DPolygon to a B2DPolygon in physical device pixel units.
545 :
546 : @param rLogicSize Const reference to a B2DPolygon in logical units
547 :
548 : @returns B2DPolyPolygon based on physical device pixel coordinates and units.
549 : */
550 : SAL_DLLPRIVATE ::basegfx::B2DPolygon ImplLogicToDevicePixel( const ::basegfx::B2DPolygon& rLogicPoly ) const;
551 :
552 : /** Convert a logical B2DPolyPolygon to a B2DPolyPolygon in physical device pixel units.
553 :
554 : @param rLogicPolyPoly Const reference to a B2DPolyPolygon in logical units
555 :
556 : @returns B2DPolyPolygon based on physical device pixel coordinates and units.
557 : */
558 : SAL_DLLPRIVATE ::basegfx::B2DPolyPolygon ImplLogicToDevicePixel( const ::basegfx::B2DPolyPolygon& rLogicPolyPoly ) const;
559 :
560 : /** Convert a logical polygon to a polygon in physical device pixel units.
561 :
562 : @param rLogicPoly Const reference to a polygon in logical units
563 :
564 : @returns Polygon based on physical device pixel coordinates and units.
565 : */
566 : SAL_DLLPRIVATE Polygon ImplLogicToDevicePixel( const Polygon& rLogicPoly ) const;
567 :
568 : /** Convert a logical polypolygon to a polypolygon in physical device pixel units.
569 :
570 : @param rLogicPolyPoly Const reference to a polypolygon in logical units
571 :
572 : @returns Polypolygon based on physical device pixel coordinates and units.
573 : */
574 : SAL_DLLPRIVATE PolyPolygon ImplLogicToDevicePixel( const PolyPolygon& rLogicPolyPoly ) const;
575 :
576 : /** Convert a line in logical units to a line in physical device pixel units.
577 :
578 : @param rLineInfo Const refernece to a line in logical units
579 :
580 : @returns Line based on physical device pixel coordinates and units.
581 : */
582 : SAL_DLLPRIVATE LineInfo ImplLogicToDevicePixel( const LineInfo& rLineInfo ) const;
583 :
584 : /** Convert a region in pixel units to a region in device pixel units and coords.
585 :
586 : @param rPixelRect Const reference to region.
587 :
588 : @returns Region based on device pixel coordinates and units.
589 : */
590 : SAL_DLLPRIVATE Region ImplPixelToDevicePixel( const Region& rRegion ) const;
591 :
592 : /** Invalidate the view transformation.
593 :
594 : @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212)
595 : */
596 : SAL_DLLPRIVATE void ImplInvalidateViewTransform();
597 :
598 : /** Get device transformation.
599 :
600 : @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212)
601 : */
602 : SAL_DLLPRIVATE basegfx::B2DHomMatrix ImplGetDeviceTransformation() const;
603 : ///@}
604 :
605 : /** @name Clipping functions
606 : */
607 : ///@{
608 :
609 : SAL_DLLPRIVATE void ImplInitClipRegion();
610 : SAL_DLLPRIVATE bool ImplSelectClipRegion( const Region&, SalGraphics* pGraphics = NULL );
611 : SAL_DLLPRIVATE void ImplSetClipRegion( const Region* pRegion );
612 :
613 : ///@}
614 :
615 : /** @name Text and font functions
616 : */
617 : ///@{
618 : SAL_DLLPRIVATE bool ImplNewFont() const;
619 : SAL_DLLPRIVATE void ImplInitFont() const;
620 : SAL_DLLPRIVATE void ImplInitTextColor();
621 :
622 : static
623 : SAL_DLLPRIVATE void ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect,
624 : const OUString& rOrigStr, sal_uInt16 nStyle,
625 : MetricVector* pVector, OUString* pDisplayText, ::vcl::ITextLayout& _rLayout );
626 : SAL_DLLPRIVATE void ImplDrawTextBackground( const SalLayout& );
627 : SAL_DLLPRIVATE void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, bool bWordLine, bool bUnderlineAbove );
628 : SAL_DLLPRIVATE bool ImplDrawRotateText( SalLayout& );
629 : SAL_DLLPRIVATE bool ImplDrawTextDirect( SalLayout&, bool bTextLines, sal_uInt32 flags = 0 );
630 : SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout& );
631 : SAL_DLLPRIVATE void ImplDrawText( SalLayout& );
632 : SAL_DLLPRIVATE Rectangle ImplGetTextBoundRect( const SalLayout& );
633 : SAL_DLLPRIVATE void ImplDrawEmphasisMarks( SalLayout& );
634 : static
635 : SAL_DLLPRIVATE OUString ImplGetEllipsisString( const OutputDevice& rTargetDevice, const OUString& rStr,
636 : long nMaxWidth, sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout );
637 :
638 : SAL_DLLPRIVATE void ImplDrawTextRect( long nBaseX, long nBaseY, long nX, long nY, long nWidth, long nHeight );
639 :
640 : SAL_DLLPRIVATE void ImplInitTextLineSize();
641 : SAL_DLLPRIVATE void ImplInitAboveTextLineSize();
642 : SAL_DLLPRIVATE void ImplDrawWaveLine( long nBaseX, long nBaseY, long nStartX, long nStartY, long nWidth, long nHeight, long nLineWidth, short nOrientation, const Color& rColor );
643 : SAL_DLLPRIVATE void ImplDrawWaveTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove );
644 : SAL_DLLPRIVATE void ImplDrawStraightTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove );
645 : SAL_DLLPRIVATE void ImplDrawStrikeoutLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
646 : SAL_DLLPRIVATE void ImplDrawStrikeoutChar( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
647 : SAL_DLLPRIVATE void ImplDrawTextLine( long nBaseX, long nX, long nY, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, bool bUnderlineAbove );
648 : SAL_DLLPRIVATE void ImplDrawMnemonicLine( long nX, long nY, long nWidth );
649 : SAL_DLLPRIVATE static bool ImplIsUnderlineAbove( const Font& );
650 :
651 : SAL_DLLPRIVATE static FontEmphasisMark ImplGetEmphasisMarkStyle( const Font& rFont );
652 : SAL_DLLPRIVATE void ImplGetEmphasisMark( PolyPolygon& rPolyPoly, bool& rPolyLine, Rectangle& rRect1, Rectangle& rRect2, long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short nOrient );
653 : SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const PolyPolygon& rPolyPoly, bool bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 );
654 : static
655 : SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const OUString& rStr, sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout );
656 : SAL_DLLPRIVATE void ImplInitFontList() const;
657 : SAL_DLLPRIVATE void ImplUpdateFontData( bool bNewFontLists );
658 : SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists );
659 : ///@}
660 :
661 : /** @name Line functions
662 : */
663 : ///@{
664 : SAL_DLLPRIVATE void ImplInitLineColor();
665 : SAL_DLLPRIVATE void ImplInitFillColor();
666 :
667 : // #i101491#
668 : // Helper which holds the old line geometry creation and is extended to use AA when
669 : // switched on. Advantage is that line geometry is only temporarily used for paint
670 : SAL_DLLPRIVATE void ImplDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineInfo& rLineInfo);
671 :
672 : // #i101491#
673 : // Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool. Contains no AA check.
674 : SAL_DLLPRIVATE bool ImplTryDrawPolyLineDirect(
675 : const basegfx::B2DPolygon& rB2DPolygon,
676 : double fLineWidth = 0.0,
677 : double fTransparency = 0.0,
678 : basegfx::B2DLineJoin eLineJoin = basegfx::B2DLINEJOIN_NONE,
679 : css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT);
680 :
681 : // Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area)
682 : void ImplPaintLineGeometryWithEvtlExpand(const LineInfo& rInfo, basegfx::B2DPolyPolygon aLinePolyPolygon);
683 : ///@}
684 :
685 : /** @name Polygon functions
686 : */
687 : ///@{
688 : SAL_DLLPRIVATE void ImplDrawPolygon( const Polygon& rPoly, const PolyPolygon* pClipPolyPoly = NULL );
689 : SAL_DLLPRIVATE void ImplDrawPolyPolygon( const PolyPolygon& rPolyPoly, const PolyPolygon* pClipPolyPoly = NULL );
690 : SAL_DLLPRIVATE void ImplDrawPolyPolygon( sal_uInt16 nPoly, const PolyPolygon& rPolyPoly );
691 : // #i101491#
692 : // Helper who implements the DrawPolyPolygon functionality for basegfx::B2DPolyPolygon
693 : // without MetaFile processing
694 : SAL_DLLPRIVATE void ImplDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPolygon& rB2DPolyPoly);
695 :
696 :
697 : ///@}
698 :
699 : /** @name Gradient functions
700 : */
701 : ///@{
702 : SAL_DLLPRIVATE void ImplDrawLinearGradient( const Rectangle& rRect, const Gradient& rGradient, bool bMtf, const PolyPolygon* pClipPolyPoly );
703 : SAL_DLLPRIVATE void ImplDrawComplexGradient( const Rectangle& rRect, const Gradient& rGradient, bool bMtf, const PolyPolygon* pClipPolyPoly );
704 : ///@}
705 :
706 : /** @name Hatch functions
707 : */
708 : ///@{
709 : SAL_DLLPRIVATE void ImplDrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch, bool bMtf );
710 : SAL_DLLPRIVATE void ImplCalcHatchValues( const Rectangle& rRect, long nDist, sal_uInt16 nAngle10, Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 );
711 : SAL_DLLPRIVATE void ImplDrawHatchLine( const Line& rLine, const PolyPolygon& rPolyPoly, Point* pPtBuffer, bool bMtf );
712 : ///@}
713 :
714 : /** @name Wallpaper functions
715 : */
716 : ///@{
717 : SAL_DLLPRIVATE void ImplDrawWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
718 : SAL_DLLPRIVATE void ImplDrawColorWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
719 : SAL_DLLPRIVATE void ImplDrawBitmapWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
720 : SAL_DLLPRIVATE void ImplDrawGradientWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
721 : ///@}
722 :
723 : /** @name Bitmap functions
724 : */
725 : ///@{
726 : SAL_DLLPRIVATE void ImplDrawOutDevDirect ( const OutputDevice* pSrcDev, SalTwoRect& rPosAry );
727 : SAL_DLLPRIVATE void ImplDrawBitmap ( const Point& rDestPt, const Size& rDestSize,
728 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
729 : const Bitmap& rBitmap, const sal_uLong nAction );
730 : SAL_DLLPRIVATE void ImplDrawBitmapEx ( const Point& rDestPt, const Size& rDestSize,
731 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
732 : const BitmapEx& rBitmapEx, const sal_uLong nAction );
733 : SAL_DLLPRIVATE void ImplDrawAlpha ( const Bitmap& rBmp, const AlphaMask& rAlpha,
734 : const Point& rDestPt, const Size& rDestSize,
735 : const Point& rSrcPtPixel, const Size& rSrcSizePixel );
736 : virtual void ClipToPaintRegion ( Rectangle& rDstRect );
737 : SAL_DLLPRIVATE Bitmap ImplBlend ( Bitmap aBmp,
738 : BitmapReadAccess* pP,
739 : BitmapReadAccess* pA,
740 : const sal_Int32 nOffY,
741 : const sal_Int32 nDstHeight,
742 : const sal_Int32 nOffX,
743 : const sal_Int32 nDstWidth,
744 : const Rectangle& aBmpRect,
745 : const Size& aOutSz,
746 : const bool bHMirr,
747 : const bool bVMirr,
748 : const long* pMapX,
749 : const long* pMapY );
750 : SAL_DLLPRIVATE Bitmap ImplBlendWithAlpha ( Bitmap aBmp,
751 : BitmapReadAccess* pP,
752 : BitmapReadAccess* pA,
753 : const Rectangle& aDstRect,
754 : const sal_Int32 nOffY,
755 : const sal_Int32 nDstHeight,
756 : const sal_Int32 nOffX,
757 : const sal_Int32 nDstWidth,
758 : const long* pMapX,
759 : const long* pMapY );
760 : SAL_DLLPRIVATE void ImplPrintTransparent ( const Bitmap& rBmp, const Bitmap& rMask,
761 : const Point& rDestPt, const Size& rDestSize,
762 : const Point& rSrcPtPixel, const Size& rSrcSizePixel );
763 : SAL_DLLPRIVATE Color ImplDrawModeToColor ( const Color& rColor ) const;
764 : ///@}
765 :
766 : /** @name Frame functions
767 : */
768 : ///@{
769 : SAL_DLLPRIVATE void ImplGetFrameDev ( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
770 : OutputDevice& rOutDev );
771 : SAL_DLLPRIVATE void ImplDrawFrameDev ( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
772 : const OutputDevice& rOutDev, const Region& rRegion );
773 : ///@}
774 :
775 : /** @name Layout functions
776 : */
777 : ///@{
778 : SAL_DLLPRIVATE bool ImplIsRecordLayout() const;
779 : virtual bool HasMirroredGraphics() const;
780 : SAL_DLLPRIVATE void ReMirror( Point &rPoint ) const;
781 : SAL_DLLPRIVATE void ReMirror( Rectangle &rRect ) const;
782 : SAL_DLLPRIVATE void ReMirror( Region &rRegion ) const;
783 : SAL_DLLPRIVATE SalLayout* ImplLayout( const OUString&, sal_Int32 nIndex, sal_Int32 nLen,
784 : const Point& rLogicPos = Point(0,0), long nLogicWidth=0,
785 : const sal_Int32* pLogicDXArray=NULL ) const;
786 : SAL_DLLPRIVATE ImplLayoutArgs ImplPrepareLayoutArgs( OUString&, const sal_Int32 nIndex, const sal_Int32 nLen,
787 : long nPixelWidth, const sal_Int32* pPixelDXArray ) const;
788 : SAL_DLLPRIVATE SalLayout* ImplGlyphFallbackLayout( SalLayout*, ImplLayoutArgs& ) const;
789 : // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI
790 : SAL_DLLPRIVATE bool ImplIsAntiparallel() const ;
791 : SAL_DLLPRIVATE SalLayout* getFallbackFont(ImplFontEntry &rFallbackFont,
792 : FontSelectPattern &rFontSelData, int nFallbackLevel,
793 : ImplLayoutArgs& rLayoutArgs) const;
794 :
795 : ///@}
796 :
797 : protected:
798 : OutputDevice();
799 :
800 : virtual void ImplPrintMask ( const Bitmap& rMask, const Color& rMaskColor,
801 : const Point& rDestPt, const Size& rDestSize,
802 : const Point& rSrcPtPixel, const Size& rSrcSizePixel );
803 :
804 : virtual long ImplGetGradientStepCount( long nMinRect );
805 : virtual bool UsePolyPolygonForComplexGradient() = 0;
806 :
807 : /** Transform and draw a bitmap directly
808 :
809 : @param aFullTransform The B2DHomMatrix used for the transformation
810 : @param rBitmapEx Reference to the bitmap to be transformed and drawn
811 :
812 : @return true if it was able to draw the bitmap, false if not
813 : */
814 : virtual bool DrawTransformBitmapExDirect(
815 : const basegfx::B2DHomMatrix& aFullTransform,
816 : const BitmapEx& rBitmapEx);
817 :
818 : /** Reduce the area that needs to be drawn of the bitmap and return the new
819 : visible range and the maximum area.
820 :
821 :
822 : @param aFullTransform B2DHomMatrix used for transformation
823 : @param aVisibleRange The new visible area of the bitmap
824 : @param fMaximumArea The maximum area of the bitmap
825 :
826 : @returns true if there is an area to be drawn, otherwise nothing is left to be drawn
827 : so return false
828 : */
829 : virtual bool TransformReduceBitmapExTargetRange(
830 : const basegfx::B2DHomMatrix& aFullTransform,
831 : basegfx::B2DRange &aVisibleRange,
832 : double &fMaximumArea);
833 :
834 : virtual void ScaleBitmap ( Bitmap &rBmp, SalTwoRect &rPosAry );
835 :
836 : virtual void DrawDeviceBitmap(
837 : const Point& rDestPt, const Size& rDestSize,
838 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
839 : BitmapEx& rBitmapEx );
840 :
841 : virtual void EmulateDrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
842 : void DrawInvisiblePolygon( const PolyPolygon& rPolyPoly );
843 :
844 : void ClipAndDrawGradient( Gradient &rGradient, const PolyPolygon &rPolyPoly );
845 : virtual void ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly );
846 :
847 : private:
848 : typedef void ( OutputDevice::* FontUpdateHandler_t )( bool );
849 :
850 : SAL_DLLPRIVATE OutputDevice( const OutputDevice& rOutDev );
851 : SAL_DLLPRIVATE OutputDevice& operator =( const OutputDevice& rOutDev );
852 :
853 : SAL_DLLPRIVATE void ImplClearFontData( bool bNewFontLists );
854 : SAL_DLLPRIVATE void ImplRefreshFontData( bool bNewFontLists );
855 : SAL_DLLPRIVATE static void ImplUpdateFontDataForAllFrames( FontUpdateHandler_t pHdl, bool bNewFontLists );
856 : SAL_DLLPRIVATE long ImplGetGradientSteps( const Gradient& rGradient, const Rectangle& rRect, bool bMtf, bool bComplex=false );
857 :
858 : // not implemented; to detect misuses of DrawOutDev(...OutputDevice&);
859 : void DrawOutDev( const Point&, const Size&, const Point&, const Size&, const Printer&);
860 :
861 : bool DrawTransparentNatively( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
862 :
863 : Color GetSingleColorGradientFill();
864 : void SetGrayscaleColors( Gradient &rGradient );
865 :
866 : public:
867 : virtual ~OutputDevice();
868 :
869 0 : OutDevType GetOutDevType() const { return meOutDevType; }
870 :
871 : /** query an <code>OutputDevice</code> to see whether it supports a specific operation
872 :
873 : @return
874 : true if operation supported, else false
875 : */
876 : bool supportsOperation( OutDevSupportType ) const;
877 :
878 0 : sal_Int32 GetDPIScaleFactor() const { return mnDPIScaleFactor; }
879 :
880 0 : vcl::PDFWriterImpl* GetPDFWriter() const { return mpPDFWriter; }
881 :
882 0 : void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; }
883 0 : vcl::ExtOutDevData* GetExtOutDevData() const { return mpExtOutDevData; }
884 :
885 : void DrawTextLine( const Point& rPos, long nWidth,
886 : FontStrikeout eStrikeout,
887 : FontUnderline eUnderline,
888 : FontUnderline eOverline,
889 : bool bUnderlineAbove = false );
890 :
891 : void DrawText( const Point& rStartPt, const OUString& rStr,
892 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
893 : MetricVector* pVector = NULL, OUString* pDisplayText = NULL );
894 : long GetTextWidth( const OUString& rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
895 : /// Height where any character of the current font fits; in logic coordinates.
896 : long GetTextHeight() const;
897 : float approximate_char_width() const;
898 : void DrawTextArray( const Point& rStartPt, const OUString& rStr,
899 : const sal_Int32* pDXAry = NULL,
900 : sal_Int32 nIndex = 0,
901 : sal_Int32 nLen = -1 );
902 : long GetTextArray( const OUString& rStr, sal_Int32* pDXAry = NULL,
903 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
904 : bool GetCaretPositions( const OUString&, sal_Int32* pCaretXArray,
905 : sal_Int32 nIndex, sal_Int32 nLen,
906 : sal_Int32* pDXAry = NULL, long nWidth = 0,
907 : bool bCellBreaking = true ) const;
908 : void DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
909 : const OUString& rStr,
910 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1 );
911 : sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth,
912 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
913 : long nCharExtra = 0 ) const;
914 : sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth,
915 : sal_Unicode nExtraChar, sal_Int32& rExtraCharPos,
916 : sal_Int32 nIndex, sal_Int32 nLen,
917 : long nCharExtra = 0 ) const;
918 : /** Generate MetaTextActions for the text rect
919 :
920 : This method splits up the text rect into multiple
921 : MetaTextActions, one for each line of text. This is comparable
922 : to AddGradientActions(), which splits up a gradient into its
923 : constituent polygons. Parameter semantics fully compatible to
924 : DrawText().
925 : */
926 : void AddTextRectActions( const Rectangle& rRect,
927 : const OUString& rOrigStr,
928 : sal_uInt16 nStyle,
929 : GDIMetaFile& rMtf );
930 : void DrawText( const Rectangle& rRect,
931 : const OUString& rStr, sal_uInt16 nStyle = 0,
932 : MetricVector* pVector = NULL, OUString* pDisplayText = NULL,
933 : ::vcl::ITextLayout* _pTextLayout = NULL );
934 : Rectangle GetTextRect( const Rectangle& rRect,
935 : const OUString& rStr, sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK,
936 : TextRectInfo* pInfo = NULL,
937 : const ::vcl::ITextLayout* _pTextLayout = NULL ) const;
938 : OUString GetEllipsisString( const OUString& rStr, long nMaxWidth,
939 : sal_uInt16 nStyle = TEXT_DRAW_ENDELLIPSIS ) const;
940 : void DrawCtrlText( const Point& rPos, const OUString& rStr,
941 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
942 : sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC, MetricVector* pVector = NULL, OUString* pDisplayText = NULL );
943 : long GetCtrlTextWidth( const OUString& rStr, sal_Int32 nIndex = 0,
944 : sal_Int32 nLen = -1,
945 : sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC ) const;
946 : static OUString GetNonMnemonicString( const OUString& rStr, sal_Int32& rMnemonicPos );
947 0 : static OUString GetNonMnemonicString( const OUString& rStr )
948 0 : { sal_Int32 nDummy; return GetNonMnemonicString( rStr, nDummy ); }
949 :
950 : bool GetTextBoundRect( Rectangle& rRect,
951 : const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
952 : sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
953 :
954 : bool GetTextOutline( PolyPolygon&,
955 : const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0,
956 : sal_Int32 nLen = -1, bool bOptimize = true,
957 : sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
958 :
959 : bool GetTextOutlines( PolyPolyVector&,
960 : const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0,
961 : sal_Int32 nLen = -1, bool bOptimize = true,
962 : sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
963 :
964 : bool GetTextOutlines( ::basegfx::B2DPolyPolygonVector &rVector,
965 : const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0,
966 : sal_Int32 nLen = -1, bool bOptimize = true,
967 : sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
968 :
969 : bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex,
970 : int nLen, int nBase, MetricVector& rVector );
971 :
972 : void DrawPixel( const Point& rPt );
973 : void DrawPixel( const Point& rPt, const Color& rColor );
974 : void DrawPixel( const Polygon& rPts, const Color* pColors = NULL );
975 : void DrawPixel( const Polygon& rPts, const Color& rColor );
976 :
977 : void DrawLine( const Point& rStartPt, const Point& rEndPt );
978 : void DrawLine( const Point& rStartPt, const Point& rEndPt,
979 : const LineInfo& rLineInfo );
980 :
981 : /** Render the given polygon as a line stroke
982 :
983 : The given polygon is stroked with the current LineColor, start
984 : and end point are not automatically connected
985 :
986 : @see DrawPolygon
987 : @see DrawPolyPolygon
988 : */
989 : void DrawPolyLine( const Polygon& rPoly );
990 : void DrawPolyLine(
991 : const basegfx::B2DPolygon&,
992 : double fLineWidth = 0.0,
993 : basegfx::B2DLineJoin = basegfx::B2DLINEJOIN_ROUND,
994 : css::drawing::LineCap = css::drawing::LineCap_BUTT);
995 : bool TryDrawPolyLineDirect(
996 : const basegfx::B2DPolygon& rB2DPolygon,
997 : double fLineWidth = 0.0,
998 : double fTransparency = 0.0,
999 : basegfx::B2DLineJoin eLineJoin = basegfx::B2DLINEJOIN_NONE,
1000 : css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT);
1001 :
1002 : /** Render the given polygon as a line stroke
1003 :
1004 : The given polygon is stroked with the current LineColor, start
1005 : and end point are not automatically connected. The line is
1006 : rendered according to the specified LineInfo, e.g. supplying a
1007 : dash pattern, or a line thickness.
1008 :
1009 : @see DrawPolygon
1010 : @see DrawPolyPolygon
1011 : */
1012 : void DrawPolyLine( const Polygon& rPoly,
1013 : const LineInfo& rLineInfo );
1014 :
1015 : /** Render the given polygon
1016 :
1017 : The given polygon is stroked with the current LineColor, and
1018 : filled with the current FillColor. If one of these colors are
1019 : transparent, the corresponding stroke or fill stays
1020 : invisible. Start and end point of the polygon are
1021 : automatically connected.
1022 :
1023 : @see DrawPolyLine
1024 : */
1025 : void DrawPolygon( const Polygon& rPoly );
1026 : void DrawPolygon( const basegfx::B2DPolygon& );
1027 :
1028 : /** Render the given poly-polygon
1029 :
1030 : The given poly-polygon is stroked with the current LineColor,
1031 : and filled with the current FillColor. If one of these colors
1032 : are transparent, the corresponding stroke or fill stays
1033 : invisible. Start and end points of the contained polygons are
1034 : automatically connected.
1035 :
1036 : @see DrawPolyLine
1037 : */
1038 : void DrawPolyPolygon( const PolyPolygon& rPolyPoly );
1039 : void DrawPolyPolygon( const basegfx::B2DPolyPolygon& );
1040 :
1041 : void DrawRect( const Rectangle& rRect );
1042 : void DrawRect( const Rectangle& rRect,
1043 : sal_uLong nHorzRount, sal_uLong nVertRound );
1044 : void DrawEllipse( const Rectangle& rRect );
1045 : void DrawArc( const Rectangle& rRect,
1046 : const Point& rStartPt, const Point& rEndPt );
1047 : void DrawPie( const Rectangle& rRect,
1048 : const Point& rStartPt, const Point& rEndPt );
1049 : void DrawChord( const Rectangle& rRect,
1050 : const Point& rStartPt, const Point& rEndPt );
1051 :
1052 : virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
1053 : const Point& rSrcPt, const Size& rSrcSize );
1054 : virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
1055 : const Point& rSrcPt, const Size& rSrcSize,
1056 : const OutputDevice& rOutDev );
1057 : virtual void CopyArea( const Point& rDestPt,
1058 : const Point& rSrcPt, const Size& rSrcSize,
1059 : sal_uInt16 nFlags = 0 );
1060 : protected:
1061 : virtual void CopyAreaFinal( SalTwoRect& aPosAry, sal_uInt32 nFlags);
1062 :
1063 : public:
1064 : void DrawBitmap( const Point& rDestPt,
1065 : const Bitmap& rBitmap );
1066 : void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
1067 : const Bitmap& rBitmap );
1068 : void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
1069 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
1070 : const Bitmap& rBitmap );
1071 :
1072 : void DrawBitmapEx( const Point& rDestPt,
1073 : const BitmapEx& rBitmapEx );
1074 : void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
1075 : const BitmapEx& rBitmapEx );
1076 : void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
1077 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
1078 : const BitmapEx& rBitmapEx );
1079 :
1080 : /** Draw BitampEx transformed
1081 :
1082 : @param rTransformation
1083 : The transformation describing the target positioning of the given bitmap. Transforming
1084 : the unit object coordinates (0, 0, 1, 1) with this matrix is the transformation to
1085 : discrete coordinates
1086 :
1087 : @param rBitmapEx
1088 : The BitmapEx to be painted
1089 : */
1090 : void DrawTransformedBitmapEx(
1091 : const basegfx::B2DHomMatrix& rTransformation,
1092 : const BitmapEx& rBitmapEx);
1093 :
1094 : void DrawMask( const Point& rDestPt,
1095 : const Bitmap& rBitmap, const Color& rMaskColor );
1096 : void DrawMask( const Point& rDestPt, const Size& rDestSize,
1097 : const Bitmap& rBitmap, const Color& rMaskColor );
1098 : void DrawMask( const Point& rDestPt, const Size& rDestSize,
1099 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
1100 : const Bitmap& rBitmap, const Color& rMaskColor,
1101 : sal_uLong nAction );
1102 :
1103 : void DrawImage( const Point& rPos,
1104 : const Image& rImage, sal_uInt16 nStyle = 0 );
1105 : void DrawImage( const Point& rPos, const Size& rSize,
1106 : const Image& rImage, sal_uInt16 nStyle = 0 );
1107 :
1108 : void DrawGradient( const Rectangle& rRect, const Gradient& rGradient );
1109 : void DrawGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient );
1110 : void AddGradientActions( const Rectangle& rRect,
1111 : const Gradient& rGradient,
1112 : GDIMetaFile& rMtf );
1113 :
1114 : #ifdef _MSC_VER
1115 : void DrawHatch( const PolyPolygon& rPolyPoly, const ::Hatch& rHatch );
1116 : void AddHatchActions( const PolyPolygon& rPolyPoly,
1117 : const ::Hatch& rHatch,
1118 : GDIMetaFile& rMtf );
1119 : #else
1120 : void DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch );
1121 : void AddHatchActions( const PolyPolygon& rPolyPoly,
1122 : const Hatch& rHatch,
1123 : GDIMetaFile& rMtf );
1124 : #endif
1125 :
1126 : void DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper );
1127 : void DrawWaveLine( const Point& rStartPos, const Point& rEndPos );
1128 : void DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags );
1129 :
1130 : void DrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
1131 : void DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency);
1132 : void DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize,
1133 : const Gradient& rTransparenceGradient );
1134 :
1135 : /** Added return value to see if EPS could be painted directly.
1136 : Theoreticaly, handing over a matrix would be needed to handle
1137 : painting rotated EPS files (e.g. contained in Metafiles). This
1138 : would then need to be supported for Mac and PS printers, but
1139 : that's too much for now, wrote \#i107046# for this */
1140 : bool DrawEPS( const Point& rPt, const Size& rSz,
1141 : const GfxLink& rGfxLink, GDIMetaFile* pSubst = NULL );
1142 :
1143 : /// Fill the given rectangle with checkered rectangles of size nLen x nLen using the colors aStart and aEnd
1144 : void DrawCheckered(
1145 : const Point& rPos,
1146 : const Size& rSize,
1147 : sal_uInt32 nLen = 8,
1148 : Color aStart = Color(COL_WHITE),
1149 : Color aEnd = Color(COL_BLACK));
1150 :
1151 : Color GetPixel( const Point& rPt ) const;
1152 :
1153 : Bitmap GetBitmap( const Point& rSrcPt, const Size& rSize ) const;
1154 :
1155 : /** Query extended bitmap (with alpha channel, if available).
1156 : */
1157 : BitmapEx GetBitmapEx( const Point& rSrcPt, const Size& rSize ) const;
1158 :
1159 : void EnableMapMode( bool bEnable = true );
1160 0 : bool IsMapModeEnabled() const { return mbMap; }
1161 :
1162 : // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphisLayout
1163 : virtual void EnableRTL( bool bEnable = true);
1164 0 : bool IsRTLEnabled() const { return mbEnableRTL; }
1165 :
1166 : void SetConnectMetaFile( GDIMetaFile* pMtf );
1167 0 : GDIMetaFile* GetConnectMetaFile() const { return mpMetaFile; }
1168 :
1169 : void EnableOutput( bool bEnable = true );
1170 0 : bool IsOutputEnabled() const { return mbOutput; }
1171 : bool IsDeviceOutput() const { return mbDevOutput; }
1172 0 : bool IsDeviceOutputNecessary() const { return (mbOutput && mbDevOutput); }
1173 : bool IsOutputNecessary() const { return ((mbOutput && mbDevOutput) || (mpMetaFile != NULL)); }
1174 :
1175 : void SetClipRegion();
1176 : void SetClipRegion( const Region& rRegion );
1177 : Region GetClipRegion() const;
1178 0 : bool IsClipRegion() const { return mbClipRegion; }
1179 : Region GetActiveClipRegion() const;
1180 :
1181 : void MoveClipRegion( long nHorzMove, long nVertMove );
1182 : void IntersectClipRegion( const Rectangle& rRect );
1183 : void IntersectClipRegion( const Region& rRegion );
1184 :
1185 : void SetAntialiasing( sal_uInt16 nMode = 0 );
1186 0 : sal_uInt16 GetAntialiasing() const { return mnAntialiasing; }
1187 :
1188 : void SetDrawMode( sal_uLong nDrawMode );
1189 0 : sal_uLong GetDrawMode() const { return mnDrawMode; }
1190 :
1191 : void SetLayoutMode( sal_uLong nTextLayoutMode );
1192 0 : sal_uLong GetLayoutMode() const { return mnTextLayoutMode; }
1193 :
1194 : void SetDigitLanguage( LanguageType );
1195 0 : LanguageType GetDigitLanguage() const { return meTextLanguage; }
1196 :
1197 : void SetRasterOp( RasterOp eRasterOp );
1198 0 : RasterOp GetRasterOp() const { return meRasterOp; }
1199 :
1200 : /**
1201 : If this OutputDevice is used for displaying a Print Preview
1202 : the OutDevViewType should be set to 'OUTDEV_VIEWTYPE_PRINTPREVIEW'.
1203 :
1204 : A View can then make painting decisions dependent on this OutDevViewType.
1205 : E.g. text colors need to be handled differently, dependent on whether it's a PrintPreview or not. (see #106611# for more)
1206 : */
1207 0 : void SetOutDevViewType( OutDevViewType eOutDevViewType ) { meOutDevViewType=eOutDevViewType; }
1208 0 : OutDevViewType GetOutDevViewType() const { return meOutDevViewType; }
1209 :
1210 : void SetLineColor();
1211 : void SetLineColor( const Color& rColor );
1212 0 : const Color& GetLineColor() const { return maLineColor; }
1213 0 : bool IsLineColor() const { return mbLineColor; }
1214 :
1215 : void SetFillColor();
1216 : void SetFillColor( const Color& rColor );
1217 0 : const Color& GetFillColor() const { return maFillColor; }
1218 0 : bool IsFillColor() const { return mbFillColor; }
1219 :
1220 : void SetBackground();
1221 : void SetBackground( const Wallpaper& rBackground );
1222 :
1223 0 : const Wallpaper& GetBackground() const { return maBackground; }
1224 0 : bool IsBackground() const { return mbBackground; }
1225 :
1226 : void SetFont( const Font& rNewFont );
1227 0 : const Font& GetFont() const { return maFont; }
1228 :
1229 : SystemFontData GetSysFontData( int nFallbacklevel ) const;
1230 : SystemTextLayoutData GetSysTextLayoutData( const Point& rStartPt, const OUString& rStr,
1231 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
1232 : const sal_Int32* pDXAry = NULL ) const;
1233 :
1234 : void SetTextColor( const Color& rColor );
1235 0 : const Color& GetTextColor() const { return maTextColor; }
1236 : void SetTextFillColor();
1237 : void SetTextFillColor( const Color& rColor );
1238 :
1239 : Color GetTextFillColor() const;
1240 0 : bool IsTextFillColor() const { return !maFont.IsTransparent(); }
1241 : void SetTextLineColor();
1242 : void SetTextLineColor( const Color& rColor );
1243 0 : const Color& GetTextLineColor() const { return maTextLineColor; }
1244 0 : bool IsTextLineColor() const { return (maTextLineColor.GetTransparency() == 0); }
1245 : void SetOverlineColor();
1246 : void SetOverlineColor( const Color& rColor );
1247 0 : const Color& GetOverlineColor() const { return maOverlineColor; }
1248 0 : bool IsOverlineColor() const { return (maOverlineColor.GetTransparency() == 0); }
1249 : void SetTextAlign( TextAlign eAlign );
1250 0 : TextAlign GetTextAlign() const { return maFont.GetAlign(); }
1251 :
1252 : virtual void SetSettings( const AllSettings& rSettings );
1253 0 : const AllSettings& GetSettings() const { return *mxSettings; }
1254 :
1255 : SystemGraphicsData GetSystemGfxData() const;
1256 : css::uno::Any GetSystemGfxDataAny() const;
1257 :
1258 : virtual void SetMapMode();
1259 : virtual void SetMapMode( const MapMode& rNewMapMode );
1260 : virtual void SetRelativeMapMode( const MapMode& rNewMapMode );
1261 0 : const MapMode& GetMapMode() const { return maMapMode; }
1262 0 : bool IsMapMode() const { return mbMap; }
1263 :
1264 : void SetRefPoint();
1265 : void SetRefPoint( const Point& rRefPoint );
1266 0 : const Point& GetRefPoint() const { return maRefPoint; }
1267 0 : bool IsRefPoint() const { return mbRefPoint; }
1268 :
1269 : // #i75163#
1270 : basegfx::B2DHomMatrix GetViewTransformation() const;
1271 : basegfx::B2DHomMatrix GetInverseViewTransformation() const;
1272 :
1273 : basegfx::B2DHomMatrix GetViewTransformation( const MapMode& rMapMode ) const;
1274 : basegfx::B2DHomMatrix GetInverseViewTransformation( const MapMode& rMapMode ) const;
1275 :
1276 :
1277 : /** Set an offset in pixel
1278 :
1279 : This method offsets every drawing operation that converts its
1280 : coordinates to pixel by the given value. Normally, the effect
1281 : can be achieved by setting a MapMode with a different
1282 : origin. Unfortunately, this origin is in logical coordinates
1283 : and can lead to rounding errors (see #102532# for details).
1284 :
1285 : @attention This offset is only applied when converting to
1286 : pixel, i.e. some output modes such as metafile recordings
1287 : might be completely unaffected by this method! Use with
1288 : care. Furthermore, if the OutputDevice's MapMode is the
1289 : default (that's MAP_PIXEL), then any pixel offset set is
1290 : ignored also. This might be unintuitive for cases, but would
1291 : have been far more fragile to implement. What's more, the
1292 : reason why the pixel offset was introduced (avoiding rounding
1293 : errors) does not apply for MAP_PIXEL, because one can always
1294 : use the MapMode origin then.
1295 :
1296 : @param rOffset
1297 : The offset in pixel
1298 : */
1299 : void SetPixelOffset( const Size& rOffset );
1300 :
1301 : /** Get the offset in pixel
1302 :
1303 : @see OutputDevice::SetPixelOffset for details
1304 :
1305 : @return the current offset in pixel
1306 : */
1307 : Size GetPixelOffset() const;
1308 :
1309 : Point LogicToPixel( const Point& rLogicPt ) const;
1310 : Size LogicToPixel( const Size& rLogicSize ) const;
1311 : Rectangle LogicToPixel( const Rectangle& rLogicRect ) const;
1312 : Polygon LogicToPixel( const Polygon& rLogicPoly ) const;
1313 : PolyPolygon LogicToPixel( const PolyPolygon& rLogicPolyPoly ) const;
1314 : basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly ) const;
1315 : Region LogicToPixel( const Region& rLogicRegion )const;
1316 : Point LogicToPixel( const Point& rLogicPt,
1317 : const MapMode& rMapMode ) const;
1318 : Size LogicToPixel( const Size& rLogicSize,
1319 : const MapMode& rMapMode ) const;
1320 : Rectangle LogicToPixel( const Rectangle& rLogicRect,
1321 : const MapMode& rMapMode ) const;
1322 : Polygon LogicToPixel( const Polygon& rLogicPoly,
1323 : const MapMode& rMapMode ) const;
1324 : basegfx::B2DPolygon LogicToPixel( const basegfx::B2DPolygon& rLogicPoly,
1325 : const MapMode& rMapMode ) const;
1326 : PolyPolygon LogicToPixel( const PolyPolygon& rLogicPolyPoly,
1327 : const MapMode& rMapMode ) const;
1328 : basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly,
1329 : const MapMode& rMapMode ) const;
1330 : Region LogicToPixel( const Region& rLogicRegion,
1331 : const MapMode& rMapMode ) const;
1332 : Point PixelToLogic( const Point& rDevicePt ) const;
1333 : Size PixelToLogic( const Size& rDeviceSize ) const;
1334 : Rectangle PixelToLogic( const Rectangle& rDeviceRect ) const;
1335 : Polygon PixelToLogic( const Polygon& rDevicePoly ) const;
1336 : basegfx::B2DPolygon LogicToPixel( const basegfx::B2DPolygon& rLogicPoly ) const;
1337 : PolyPolygon PixelToLogic( const PolyPolygon& rDevicePolyPoly ) const;
1338 : basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly ) const;
1339 : Region PixelToLogic( const Region& rDeviceRegion ) const;
1340 : Point PixelToLogic( const Point& rDevicePt,
1341 : const MapMode& rMapMode ) const;
1342 : Size PixelToLogic( const Size& rDeviceSize,
1343 : const MapMode& rMapMode ) const;
1344 : Rectangle PixelToLogic( const Rectangle& rDeviceRect,
1345 : const MapMode& rMapMode ) const;
1346 : Polygon PixelToLogic( const Polygon& rDevicePoly,
1347 : const MapMode& rMapMode ) const;
1348 : basegfx::B2DPolygon PixelToLogic( const basegfx::B2DPolygon& rDevicePoly,
1349 : const MapMode& rMapMode ) const;
1350 : PolyPolygon PixelToLogic( const PolyPolygon& rDevicePolyPoly,
1351 : const MapMode& rMapMode ) const;
1352 : basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly,
1353 : const MapMode& rMapMode ) const;
1354 : Region PixelToLogic( const Region& rDeviceRegion,
1355 : const MapMode& rMapMode ) const;
1356 : Point LogicToLogic( const Point& rPtSource,
1357 : const MapMode* pMapModeSource,
1358 : const MapMode* pMapModeDest ) const;
1359 : Size LogicToLogic( const Size& rSzSource,
1360 : const MapMode* pMapModeSource,
1361 : const MapMode* pMapModeDest ) const;
1362 : Rectangle LogicToLogic( const Rectangle& rRectSource,
1363 : const MapMode* pMapModeSource,
1364 : const MapMode* pMapModeDest ) const;
1365 : static Point LogicToLogic( const Point& rPtSource,
1366 : const MapMode& rMapModeSource,
1367 : const MapMode& rMapModeDest );
1368 : static Size LogicToLogic( const Size& rSzSource,
1369 : const MapMode& rMapModeSource,
1370 : const MapMode& rMapModeDest );
1371 : static Rectangle LogicToLogic( const Rectangle& rRectSource,
1372 : const MapMode& rMapModeSource,
1373 : const MapMode& rMapModeDest );
1374 : static long LogicToLogic( long nLongSource,
1375 : MapUnit eUnitSource,
1376 : MapUnit eUnitDest );
1377 :
1378 : static basegfx::B2DPolygon LogicToLogic( const basegfx::B2DPolygon& rPoly,
1379 : const MapMode& rMapModeSource,
1380 : const MapMode& rMapModeDest );
1381 : static basegfx::B2DPolyPolygon LogicToLogic( const basegfx::B2DPolyPolygon& rPolyPoly,
1382 : const MapMode& rMapModeSource,
1383 : const MapMode& rMapModeDest );
1384 :
1385 : // create a mapping transformation from rMapModeSource to rMapModeDest (the above methods
1386 : // for B2DPoly/Polygons use this internally anyway to transform the B2DPolygon)
1387 : static basegfx::B2DHomMatrix LogicToLogic(const MapMode& rMapModeSource, const MapMode& rMapModeDest);
1388 :
1389 0 : Size GetOutputSizePixel() const
1390 0 : { return Size( mnOutWidth, mnOutHeight ); }
1391 0 : long GetOutputWidthPixel() const { return mnOutWidth; }
1392 0 : long GetOutputHeightPixel() const { return mnOutHeight; }
1393 0 : long GetOutOffXPixel() const { return mnOutOffX; }
1394 0 : long GetOutOffYPixel() const { return mnOutOffY; }
1395 :
1396 0 : Size GetOutputSize() const
1397 0 : { return PixelToLogic( GetOutputSizePixel() ); }
1398 :
1399 : void Erase();
1400 0 : void Erase( const Rectangle& rRect ) { DrawWallpaper( rRect, GetBackground() ); }
1401 :
1402 : bool AddTempDevFont( const OUString& rFileURL, const OUString& rFontName );
1403 : int GetDevFontCount() const;
1404 : FontInfo GetDevFont( int nDevFontIndex ) const;
1405 : int GetDevFontSizeCount( const Font& ) const;
1406 : Size GetDevFontSize( const Font& rFont, int nSizeIndex ) const;
1407 : bool IsFontAvailable( const OUString& rFontName ) const;
1408 :
1409 : FontMetric GetFontMetric() const;
1410 : FontMetric GetFontMetric( const Font& rFont ) const;
1411 : bool GetFontCharMap( FontCharMap& rFontCharMap ) const;
1412 : bool GetFontCapabilities( vcl::FontCapabilities& rFontCapabilities ) const;
1413 :
1414 : sal_Int32 HasGlyphs( const Font& rFont, const OUString& rStr,
1415 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
1416 :
1417 : long GetMinKashida() const;
1418 :
1419 : // i60594
1420 : // validate kashida positions against the current font
1421 : // returns count of invalid kashida positions
1422 : sal_Int32 ValidateKashidas( const OUString& rTxt, sal_Int32 nIdx, sal_Int32 nLen,
1423 : sal_Int32 nKashCount, // number of suggested kashida positions (in)
1424 : const sal_Int32* pKashidaPos, // suggested kashida positions (in)
1425 : sal_Int32* pKashidaPosDropped // invalid kashida positions (out)
1426 : ) const;
1427 :
1428 : virtual sal_uInt16 GetBitCount() const;
1429 :
1430 : bool GetTextIsRTL( const OUString&, sal_Int32 nIndex, sal_Int32 nLen ) const;
1431 :
1432 : /** Query the existence and depth of the alpha channel
1433 :
1434 : @return 0, if no alpha channel available, and the bit depth of
1435 : the alpha channel otherwise.
1436 : */
1437 : virtual sal_uInt16 GetAlphaBitCount() const;
1438 : sal_uLong GetColorCount() const;
1439 :
1440 : void Push( sal_uInt16 nFlags = PUSH_ALL );
1441 : void Pop();
1442 : // returns the current stack depth; that is the number of Push() calls minus the number of Pop() calls
1443 : // this should not normally be used since Push and Pop must always be used symmetrically
1444 : // however this may be e.g. a help when debugging code in which this somehow is not the case
1445 : sal_uInt32 GetGCStackDepth() const;
1446 :
1447 : /** Query availability of alpha channel
1448 :
1449 : @return sal_True, if this device has an alpha channel.
1450 : */
1451 : bool HasAlpha();
1452 :
1453 : /// request XCanvas render interface for this OutputDevice
1454 : css::uno::Reference< css::rendering::XCanvas >
1455 : GetCanvas() const;
1456 :
1457 : css::uno::Reference< css::awt::XGraphics >
1458 : CreateUnoGraphics();
1459 0 : VCLXGraphicsList_impl* GetUnoGraphicsList() const { return mpUnoGraphicsList; }
1460 0 : VCLXGraphicsList_impl* CreateUnoGraphicsList()
1461 : {
1462 0 : mpUnoGraphicsList = new VCLXGraphicsList_impl();
1463 0 : return mpUnoGraphicsList;
1464 : }
1465 :
1466 : static void BeginFontSubstitution();
1467 : static void EndFontSubstitution();
1468 : static void AddFontSubstitute( const OUString& rFontName,
1469 : const OUString& rReplaceFontName,
1470 : sal_uInt16 nFlags = 0 );
1471 : static void RemoveFontSubstitute( sal_uInt16 n );
1472 : static sal_uInt16 GetFontSubstituteCount();
1473 :
1474 : static Font GetDefaultFont( sal_uInt16 nType,
1475 : LanguageType eLang,
1476 : sal_uLong nFlags,
1477 : const OutputDevice* pOutDev = NULL );
1478 :
1479 : /** helper method removing transparencies from a metafile (e.g. for printing)
1480 :
1481 : @returns
1482 : true: transparencies were removed
1483 : false: output metafile is unchanged input metafile
1484 :
1485 : @attention this is a member method, so current state can influence the result !
1486 : @attention the output metafile is prepared in pixel mode for the currentOutputDevice
1487 : state. It can not be moved or rotated reliably anymore.
1488 : */
1489 : bool RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
1490 : long nMaxBmpDPIX, long nMaxBmpDPIY,
1491 : bool bReduceTransparency,
1492 : bool bTransparencyAutoMode,
1493 : bool bDownsampleBitmaps,
1494 : const Color& rBackground = Color( COL_TRANSPARENT )
1495 : );
1496 : /** Retrieve downsampled and cropped bitmap
1497 :
1498 : @attention This method ignores negative rDstSz values, thus
1499 : mirroring must happen outside this method (e.g. in DrawBitmap)
1500 : */
1501 : Bitmap GetDownsampledBitmap( const Size& rDstSz,
1502 : const Point& rSrcPt, const Size& rSrcSz,
1503 : const Bitmap& rBmp, long nMaxBmpDPIX, long nMaxBmpDPIY );
1504 :
1505 : // Native Widget Rendering functions
1506 :
1507 : // These all just call through to the private mpGraphics functions of the same name.
1508 :
1509 : // Query the platform layer for control support
1510 : bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) const;
1511 :
1512 : // Query the native control to determine if it was acted upon
1513 : bool HitTestNativeControl( ControlType nType,
1514 : ControlPart nPart,
1515 : const Rectangle& rControlRegion,
1516 : const Point& aPos,
1517 : bool& rIsInside ) const;
1518 :
1519 : // Request rendering of a particular control and/or part
1520 : bool DrawNativeControl( ControlType nType,
1521 : ControlPart nPart,
1522 : const Rectangle& rControlRegion,
1523 : ControlState nState,
1524 : const ImplControlValue& aValue,
1525 : const OUString& aCaption );
1526 :
1527 : // Query the native control's actual drawing region (including adornment)
1528 : bool GetNativeControlRegion( ControlType nType,
1529 : ControlPart nPart,
1530 : const Rectangle& rControlRegion,
1531 : ControlState nState,
1532 : const ImplControlValue& aValue,
1533 : const OUString& aCaption,
1534 : Rectangle &rNativeBoundingRegion,
1535 : Rectangle &rNativeContentRegion ) const;
1536 :
1537 : };
1538 :
1539 : #endif // INCLUDED_VCL_OUTDEV_HXX
1540 :
1541 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|