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 16580 : 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 25015 : 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 : virtual void ClipAndDrawGradientToBounds( Gradient &rGradient, const PolyPolygon &rPolyPoly );
845 : void ClipAndDrawGradient( Gradient &rGradient, const PolyPolygon &rPolyPoly );
846 :
847 : virtual void ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly );
848 :
849 : private:
850 : typedef void ( OutputDevice::* FontUpdateHandler_t )( bool );
851 :
852 : SAL_DLLPRIVATE OutputDevice( const OutputDevice& rOutDev );
853 : SAL_DLLPRIVATE OutputDevice& operator =( const OutputDevice& rOutDev );
854 :
855 : SAL_DLLPRIVATE void ImplClearFontData( bool bNewFontLists );
856 : SAL_DLLPRIVATE void ImplRefreshFontData( bool bNewFontLists );
857 : SAL_DLLPRIVATE static void ImplUpdateFontDataForAllFrames( FontUpdateHandler_t pHdl, bool bNewFontLists );
858 : SAL_DLLPRIVATE long ImplGetGradientSteps( const Gradient& rGradient, const Rectangle& rRect, bool bMtf, bool bComplex=false );
859 :
860 : // not implemented; to detect misuses of DrawOutDev(...OutputDevice&);
861 : void DrawOutDev( const Point&, const Size&, const Point&, const Size&, const Printer&);
862 :
863 : bool DrawTransparentNatively( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
864 :
865 : Color GetSingleColorGradientFill();
866 : void SetGrayscaleColors( Gradient &rGradient );
867 :
868 : public:
869 : virtual ~OutputDevice();
870 :
871 2890044 : OutDevType GetOutDevType() const { return meOutDevType; }
872 :
873 : /** query an <code>OutputDevice</code> to see whether it supports a specific operation
874 :
875 : @return
876 : true if operation supported, else false
877 : */
878 : bool supportsOperation( OutDevSupportType ) const;
879 :
880 113258 : sal_Int32 GetDPIScaleFactor() const { return mnDPIScaleFactor; }
881 :
882 39333 : vcl::PDFWriterImpl* GetPDFWriter() const { return mpPDFWriter; }
883 :
884 0 : void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; }
885 144404 : vcl::ExtOutDevData* GetExtOutDevData() const { return mpExtOutDevData; }
886 :
887 : void DrawTextLine( const Point& rPos, long nWidth,
888 : FontStrikeout eStrikeout,
889 : FontUnderline eUnderline,
890 : FontUnderline eOverline,
891 : bool bUnderlineAbove = false );
892 :
893 : void DrawText( const Point& rStartPt, const OUString& rStr,
894 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
895 : MetricVector* pVector = NULL, OUString* pDisplayText = NULL );
896 : long GetTextWidth( const OUString& rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
897 : /// Height where any character of the current font fits; in logic coordinates.
898 : long GetTextHeight() const;
899 : float approximate_char_width() const;
900 : void DrawTextArray( const Point& rStartPt, const OUString& rStr,
901 : const sal_Int32* pDXAry = NULL,
902 : sal_Int32 nIndex = 0,
903 : sal_Int32 nLen = -1 );
904 : long GetTextArray( const OUString& rStr, sal_Int32* pDXAry = NULL,
905 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
906 : bool GetCaretPositions( const OUString&, sal_Int32* pCaretXArray,
907 : sal_Int32 nIndex, sal_Int32 nLen,
908 : sal_Int32* pDXAry = NULL, long nWidth = 0,
909 : bool bCellBreaking = true ) const;
910 : void DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
911 : const OUString& rStr,
912 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1 );
913 : sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth,
914 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
915 : long nCharExtra = 0 ) const;
916 : sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth,
917 : sal_Unicode nExtraChar, sal_Int32& rExtraCharPos,
918 : sal_Int32 nIndex, sal_Int32 nLen,
919 : long nCharExtra = 0 ) const;
920 : /** Generate MetaTextActions for the text rect
921 :
922 : This method splits up the text rect into multiple
923 : MetaTextActions, one for each line of text. This is comparable
924 : to AddGradientActions(), which splits up a gradient into its
925 : constituent polygons. Parameter semantics fully compatible to
926 : DrawText().
927 : */
928 : void AddTextRectActions( const Rectangle& rRect,
929 : const OUString& rOrigStr,
930 : sal_uInt16 nStyle,
931 : GDIMetaFile& rMtf );
932 : void DrawText( const Rectangle& rRect,
933 : const OUString& rStr, sal_uInt16 nStyle = 0,
934 : MetricVector* pVector = NULL, OUString* pDisplayText = NULL,
935 : ::vcl::ITextLayout* _pTextLayout = NULL );
936 : Rectangle GetTextRect( const Rectangle& rRect,
937 : const OUString& rStr, sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK,
938 : TextRectInfo* pInfo = NULL,
939 : const ::vcl::ITextLayout* _pTextLayout = NULL ) const;
940 : OUString GetEllipsisString( const OUString& rStr, long nMaxWidth,
941 : sal_uInt16 nStyle = TEXT_DRAW_ENDELLIPSIS ) const;
942 : void DrawCtrlText( const Point& rPos, const OUString& rStr,
943 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
944 : sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC, MetricVector* pVector = NULL, OUString* pDisplayText = NULL );
945 : long GetCtrlTextWidth( const OUString& rStr, sal_Int32 nIndex = 0,
946 : sal_Int32 nLen = -1,
947 : sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC ) const;
948 : static OUString GetNonMnemonicString( const OUString& rStr, sal_Int32& rMnemonicPos );
949 9758 : static OUString GetNonMnemonicString( const OUString& rStr )
950 9758 : { sal_Int32 nDummy; return GetNonMnemonicString( rStr, nDummy ); }
951 :
952 : bool GetTextBoundRect( Rectangle& rRect,
953 : const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
954 : sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
955 :
956 : bool GetTextOutline( PolyPolygon&,
957 : const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0,
958 : sal_Int32 nLen = -1, bool bOptimize = true,
959 : sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
960 :
961 : bool GetTextOutlines( PolyPolyVector&,
962 : const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0,
963 : sal_Int32 nLen = -1, bool bOptimize = true,
964 : sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
965 :
966 : bool GetTextOutlines( ::basegfx::B2DPolyPolygonVector &rVector,
967 : const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0,
968 : sal_Int32 nLen = -1, bool bOptimize = true,
969 : sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
970 :
971 : bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex,
972 : int nLen, int nBase, MetricVector& rVector );
973 :
974 : void DrawPixel( const Point& rPt );
975 : void DrawPixel( const Point& rPt, const Color& rColor );
976 : void DrawPixel( const Polygon& rPts, const Color* pColors = NULL );
977 : void DrawPixel( const Polygon& rPts, const Color& rColor );
978 :
979 : void DrawLine( const Point& rStartPt, const Point& rEndPt );
980 : void DrawLine( const Point& rStartPt, const Point& rEndPt,
981 : const LineInfo& rLineInfo );
982 :
983 : /** Render the given polygon as a line stroke
984 :
985 : The given polygon is stroked with the current LineColor, start
986 : and end point are not automatically connected
987 :
988 : @see DrawPolygon
989 : @see DrawPolyPolygon
990 : */
991 : void DrawPolyLine( const Polygon& rPoly );
992 : void DrawPolyLine(
993 : const basegfx::B2DPolygon&,
994 : double fLineWidth = 0.0,
995 : basegfx::B2DLineJoin = basegfx::B2DLINEJOIN_ROUND,
996 : css::drawing::LineCap = css::drawing::LineCap_BUTT);
997 : bool TryDrawPolyLineDirect(
998 : const basegfx::B2DPolygon& rB2DPolygon,
999 : double fLineWidth = 0.0,
1000 : double fTransparency = 0.0,
1001 : basegfx::B2DLineJoin eLineJoin = basegfx::B2DLINEJOIN_NONE,
1002 : css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT);
1003 :
1004 : /** Render the given polygon as a line stroke
1005 :
1006 : The given polygon is stroked with the current LineColor, start
1007 : and end point are not automatically connected. The line is
1008 : rendered according to the specified LineInfo, e.g. supplying a
1009 : dash pattern, or a line thickness.
1010 :
1011 : @see DrawPolygon
1012 : @see DrawPolyPolygon
1013 : */
1014 : void DrawPolyLine( const Polygon& rPoly,
1015 : const LineInfo& rLineInfo );
1016 :
1017 : /** Render the given polygon
1018 :
1019 : The given polygon is stroked with the current LineColor, and
1020 : filled with the current FillColor. If one of these colors are
1021 : transparent, the corresponding stroke or fill stays
1022 : invisible. Start and end point of the polygon are
1023 : automatically connected.
1024 :
1025 : @see DrawPolyLine
1026 : */
1027 : void DrawPolygon( const Polygon& rPoly );
1028 : void DrawPolygon( const basegfx::B2DPolygon& );
1029 :
1030 : /** Render the given poly-polygon
1031 :
1032 : The given poly-polygon is stroked with the current LineColor,
1033 : and filled with the current FillColor. If one of these colors
1034 : are transparent, the corresponding stroke or fill stays
1035 : invisible. Start and end points of the contained polygons are
1036 : automatically connected.
1037 :
1038 : @see DrawPolyLine
1039 : */
1040 : void DrawPolyPolygon( const PolyPolygon& rPolyPoly );
1041 : void DrawPolyPolygon( const basegfx::B2DPolyPolygon& );
1042 :
1043 : void DrawRect( const Rectangle& rRect );
1044 : void DrawRect( const Rectangle& rRect,
1045 : sal_uLong nHorzRount, sal_uLong nVertRound );
1046 : void DrawEllipse( const Rectangle& rRect );
1047 : void DrawArc( const Rectangle& rRect,
1048 : const Point& rStartPt, const Point& rEndPt );
1049 : void DrawPie( const Rectangle& rRect,
1050 : const Point& rStartPt, const Point& rEndPt );
1051 : void DrawChord( const Rectangle& rRect,
1052 : const Point& rStartPt, const Point& rEndPt );
1053 :
1054 : virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
1055 : const Point& rSrcPt, const Size& rSrcSize );
1056 : virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
1057 : const Point& rSrcPt, const Size& rSrcSize,
1058 : const OutputDevice& rOutDev );
1059 : virtual void CopyArea( const Point& rDestPt,
1060 : const Point& rSrcPt, const Size& rSrcSize,
1061 : sal_uInt16 nFlags = 0 );
1062 : protected:
1063 : virtual void CopyAreaFinal( SalTwoRect& aPosAry, sal_uInt32 nFlags);
1064 :
1065 : public:
1066 : void DrawBitmap( const Point& rDestPt,
1067 : const Bitmap& rBitmap );
1068 : void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
1069 : const Bitmap& rBitmap );
1070 : void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
1071 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
1072 : const Bitmap& rBitmap );
1073 :
1074 : void DrawBitmapEx( const Point& rDestPt,
1075 : const BitmapEx& rBitmapEx );
1076 : void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
1077 : const BitmapEx& rBitmapEx );
1078 : void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
1079 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
1080 : const BitmapEx& rBitmapEx );
1081 :
1082 : /** Draw BitampEx transformed
1083 :
1084 : @param rTransformation
1085 : The transformation describing the target positioning of the given bitmap. Transforming
1086 : the unit object coordinates (0, 0, 1, 1) with this matrix is the transformation to
1087 : discrete coordinates
1088 :
1089 : @param rBitmapEx
1090 : The BitmapEx to be painted
1091 : */
1092 : void DrawTransformedBitmapEx(
1093 : const basegfx::B2DHomMatrix& rTransformation,
1094 : const BitmapEx& rBitmapEx);
1095 :
1096 : void DrawMask( const Point& rDestPt,
1097 : const Bitmap& rBitmap, const Color& rMaskColor );
1098 : void DrawMask( const Point& rDestPt, const Size& rDestSize,
1099 : const Bitmap& rBitmap, const Color& rMaskColor );
1100 : void DrawMask( const Point& rDestPt, const Size& rDestSize,
1101 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
1102 : const Bitmap& rBitmap, const Color& rMaskColor,
1103 : sal_uLong nAction );
1104 :
1105 : void DrawImage( const Point& rPos,
1106 : const Image& rImage, sal_uInt16 nStyle = 0 );
1107 : void DrawImage( const Point& rPos, const Size& rSize,
1108 : const Image& rImage, sal_uInt16 nStyle = 0 );
1109 :
1110 : void DrawGradient( const Rectangle& rRect, const Gradient& rGradient );
1111 : void DrawGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient );
1112 : void AddGradientActions( const Rectangle& rRect,
1113 : const Gradient& rGradient,
1114 : GDIMetaFile& rMtf );
1115 :
1116 : #ifdef _MSC_VER
1117 : void DrawHatch( const PolyPolygon& rPolyPoly, const ::Hatch& rHatch );
1118 : void AddHatchActions( const PolyPolygon& rPolyPoly,
1119 : const ::Hatch& rHatch,
1120 : GDIMetaFile& rMtf );
1121 : #else
1122 : void DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch );
1123 : void AddHatchActions( const PolyPolygon& rPolyPoly,
1124 : const Hatch& rHatch,
1125 : GDIMetaFile& rMtf );
1126 : #endif
1127 :
1128 : void DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper );
1129 : void DrawWaveLine( const Point& rStartPos, const Point& rEndPos );
1130 : void DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags );
1131 :
1132 : void DrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
1133 : void DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency);
1134 : void DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize,
1135 : const Gradient& rTransparenceGradient );
1136 :
1137 : /** Added return value to see if EPS could be painted directly.
1138 : Theoreticaly, handing over a matrix would be needed to handle
1139 : painting rotated EPS files (e.g. contained in Metafiles). This
1140 : would then need to be supported for Mac and PS printers, but
1141 : that's too much for now, wrote \#i107046# for this */
1142 : bool DrawEPS( const Point& rPt, const Size& rSz,
1143 : const GfxLink& rGfxLink, GDIMetaFile* pSubst = NULL );
1144 :
1145 : /// Fill the given rectangle with checkered rectangles of size nLen x nLen using the colors aStart and aEnd
1146 : void DrawCheckered(
1147 : const Point& rPos,
1148 : const Size& rSize,
1149 : sal_uInt32 nLen = 8,
1150 : Color aStart = Color(COL_WHITE),
1151 : Color aEnd = Color(COL_BLACK));
1152 :
1153 : Color GetPixel( const Point& rPt ) const;
1154 :
1155 : Bitmap GetBitmap( const Point& rSrcPt, const Size& rSize ) const;
1156 :
1157 : /** Query extended bitmap (with alpha channel, if available).
1158 : */
1159 : BitmapEx GetBitmapEx( const Point& rSrcPt, const Size& rSize ) const;
1160 :
1161 : void EnableMapMode( bool bEnable = true );
1162 353677 : bool IsMapModeEnabled() const { return mbMap; }
1163 :
1164 : // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphisLayout
1165 : virtual void EnableRTL( bool bEnable = true);
1166 6765195 : bool IsRTLEnabled() const { return mbEnableRTL; }
1167 :
1168 : void SetConnectMetaFile( GDIMetaFile* pMtf );
1169 130543 : GDIMetaFile* GetConnectMetaFile() const { return mpMetaFile; }
1170 :
1171 : void EnableOutput( bool bEnable = true );
1172 7671 : bool IsOutputEnabled() const { return mbOutput; }
1173 : bool IsDeviceOutput() const { return mbDevOutput; }
1174 3798685 : bool IsDeviceOutputNecessary() const { return (mbOutput && mbDevOutput); }
1175 : bool IsOutputNecessary() const { return ((mbOutput && mbDevOutput) || (mpMetaFile != NULL)); }
1176 :
1177 : void SetClipRegion();
1178 : void SetClipRegion( const Region& rRegion );
1179 : Region GetClipRegion() const;
1180 90198 : bool IsClipRegion() const { return mbClipRegion; }
1181 : Region GetActiveClipRegion() const;
1182 :
1183 : void MoveClipRegion( long nHorzMove, long nVertMove );
1184 : void IntersectClipRegion( const Rectangle& rRect );
1185 : void IntersectClipRegion( const Region& rRegion );
1186 :
1187 : void SetAntialiasing( sal_uInt16 nMode = 0 );
1188 251428 : sal_uInt16 GetAntialiasing() const { return mnAntialiasing; }
1189 :
1190 : void SetDrawMode( sal_uLong nDrawMode );
1191 1556129 : sal_uLong GetDrawMode() const { return mnDrawMode; }
1192 :
1193 : void SetLayoutMode( sal_uLong nTextLayoutMode );
1194 653600 : sal_uLong GetLayoutMode() const { return mnTextLayoutMode; }
1195 :
1196 : void SetDigitLanguage( LanguageType );
1197 462229 : LanguageType GetDigitLanguage() const { return meTextLanguage; }
1198 :
1199 : void SetRasterOp( RasterOp eRasterOp );
1200 259049 : RasterOp GetRasterOp() const { return meRasterOp; }
1201 :
1202 : /**
1203 : If this OutputDevice is used for displaying a Print Preview
1204 : the OutDevViewType should be set to 'OUTDEV_VIEWTYPE_PRINTPREVIEW'.
1205 :
1206 : A View can then make painting decisions dependent on this OutDevViewType.
1207 : E.g. text colors need to be handled differently, dependent on whether it's a PrintPreview or not. (see #106611# for more)
1208 : */
1209 8 : void SetOutDevViewType( OutDevViewType eOutDevViewType ) { meOutDevViewType=eOutDevViewType; }
1210 2729 : OutDevViewType GetOutDevViewType() const { return meOutDevViewType; }
1211 :
1212 : void SetLineColor();
1213 : void SetLineColor( const Color& rColor );
1214 429717 : const Color& GetLineColor() const { return maLineColor; }
1215 104315 : bool IsLineColor() const { return mbLineColor; }
1216 :
1217 : void SetFillColor();
1218 : void SetFillColor( const Color& rColor );
1219 367804 : const Color& GetFillColor() const { return maFillColor; }
1220 21634 : bool IsFillColor() const { return mbFillColor; }
1221 :
1222 : void SetBackground();
1223 : void SetBackground( const Wallpaper& rBackground );
1224 :
1225 254334 : const Wallpaper& GetBackground() const { return maBackground; }
1226 392222 : bool IsBackground() const { return mbBackground; }
1227 :
1228 : void SetFont( const Font& rNewFont );
1229 1620655 : const Font& GetFont() const { return maFont; }
1230 :
1231 : SystemFontData GetSysFontData( int nFallbacklevel ) const;
1232 : SystemTextLayoutData GetSysTextLayoutData( const Point& rStartPt, const OUString& rStr,
1233 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
1234 : const sal_Int32* pDXAry = NULL ) const;
1235 :
1236 : void SetTextColor( const Color& rColor );
1237 239158 : const Color& GetTextColor() const { return maTextColor; }
1238 : void SetTextFillColor();
1239 : void SetTextFillColor( const Color& rColor );
1240 :
1241 : Color GetTextFillColor() const;
1242 193598 : bool IsTextFillColor() const { return !maFont.IsTransparent(); }
1243 : void SetTextLineColor();
1244 : void SetTextLineColor( const Color& rColor );
1245 312023 : const Color& GetTextLineColor() const { return maTextLineColor; }
1246 78062 : bool IsTextLineColor() const { return (maTextLineColor.GetTransparency() == 0); }
1247 : void SetOverlineColor();
1248 : void SetOverlineColor( const Color& rColor );
1249 311998 : const Color& GetOverlineColor() const { return maOverlineColor; }
1250 78031 : bool IsOverlineColor() const { return (maOverlineColor.GetTransparency() == 0); }
1251 : void SetTextAlign( TextAlign eAlign );
1252 65557 : TextAlign GetTextAlign() const { return maFont.GetAlign(); }
1253 :
1254 : virtual void SetSettings( const AllSettings& rSettings );
1255 1305899 : const AllSettings& GetSettings() const { return *mxSettings; }
1256 :
1257 : SystemGraphicsData GetSystemGfxData() const;
1258 : css::uno::Any GetSystemGfxDataAny() const;
1259 :
1260 : virtual void SetMapMode();
1261 : virtual void SetMapMode( const MapMode& rNewMapMode );
1262 : virtual void SetRelativeMapMode( const MapMode& rNewMapMode );
1263 801366 : const MapMode& GetMapMode() const { return maMapMode; }
1264 52561 : bool IsMapMode() const { return mbMap; }
1265 :
1266 : void SetRefPoint();
1267 : void SetRefPoint( const Point& rRefPoint );
1268 0 : const Point& GetRefPoint() const { return maRefPoint; }
1269 7921 : bool IsRefPoint() const { return mbRefPoint; }
1270 :
1271 : // #i75163#
1272 : basegfx::B2DHomMatrix GetViewTransformation() const;
1273 : basegfx::B2DHomMatrix GetInverseViewTransformation() const;
1274 :
1275 : basegfx::B2DHomMatrix GetViewTransformation( const MapMode& rMapMode ) const;
1276 : basegfx::B2DHomMatrix GetInverseViewTransformation( const MapMode& rMapMode ) const;
1277 :
1278 :
1279 : /** Set an offset in pixel
1280 :
1281 : This method offsets every drawing operation that converts its
1282 : coordinates to pixel by the given value. Normally, the effect
1283 : can be achieved by setting a MapMode with a different
1284 : origin. Unfortunately, this origin is in logical coordinates
1285 : and can lead to rounding errors (see #102532# for details).
1286 :
1287 : @attention This offset is only applied when converting to
1288 : pixel, i.e. some output modes such as metafile recordings
1289 : might be completely unaffected by this method! Use with
1290 : care. Furthermore, if the OutputDevice's MapMode is the
1291 : default (that's MAP_PIXEL), then any pixel offset set is
1292 : ignored also. This might be unintuitive for cases, but would
1293 : have been far more fragile to implement. What's more, the
1294 : reason why the pixel offset was introduced (avoiding rounding
1295 : errors) does not apply for MAP_PIXEL, because one can always
1296 : use the MapMode origin then.
1297 :
1298 : @param rOffset
1299 : The offset in pixel
1300 : */
1301 : void SetPixelOffset( const Size& rOffset );
1302 :
1303 : /** Get the offset in pixel
1304 :
1305 : @see OutputDevice::SetPixelOffset for details
1306 :
1307 : @return the current offset in pixel
1308 : */
1309 : Size GetPixelOffset() const;
1310 :
1311 : Point LogicToPixel( const Point& rLogicPt ) const;
1312 : Size LogicToPixel( const Size& rLogicSize ) const;
1313 : Rectangle LogicToPixel( const Rectangle& rLogicRect ) const;
1314 : Polygon LogicToPixel( const Polygon& rLogicPoly ) const;
1315 : PolyPolygon LogicToPixel( const PolyPolygon& rLogicPolyPoly ) const;
1316 : basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly ) const;
1317 : Region LogicToPixel( const Region& rLogicRegion )const;
1318 : Point LogicToPixel( const Point& rLogicPt,
1319 : const MapMode& rMapMode ) const;
1320 : Size LogicToPixel( const Size& rLogicSize,
1321 : const MapMode& rMapMode ) const;
1322 : Rectangle LogicToPixel( const Rectangle& rLogicRect,
1323 : const MapMode& rMapMode ) const;
1324 : Polygon LogicToPixel( const Polygon& rLogicPoly,
1325 : const MapMode& rMapMode ) const;
1326 : basegfx::B2DPolygon LogicToPixel( const basegfx::B2DPolygon& rLogicPoly,
1327 : const MapMode& rMapMode ) const;
1328 : PolyPolygon LogicToPixel( const PolyPolygon& rLogicPolyPoly,
1329 : const MapMode& rMapMode ) const;
1330 : basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly,
1331 : const MapMode& rMapMode ) const;
1332 : Region LogicToPixel( const Region& rLogicRegion,
1333 : const MapMode& rMapMode ) const;
1334 : Point PixelToLogic( const Point& rDevicePt ) const;
1335 : Size PixelToLogic( const Size& rDeviceSize ) const;
1336 : Rectangle PixelToLogic( const Rectangle& rDeviceRect ) const;
1337 : Polygon PixelToLogic( const Polygon& rDevicePoly ) const;
1338 : basegfx::B2DPolygon LogicToPixel( const basegfx::B2DPolygon& rLogicPoly ) const;
1339 : PolyPolygon PixelToLogic( const PolyPolygon& rDevicePolyPoly ) const;
1340 : basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly ) const;
1341 : Region PixelToLogic( const Region& rDeviceRegion ) const;
1342 : Point PixelToLogic( const Point& rDevicePt,
1343 : const MapMode& rMapMode ) const;
1344 : Size PixelToLogic( const Size& rDeviceSize,
1345 : const MapMode& rMapMode ) const;
1346 : Rectangle PixelToLogic( const Rectangle& rDeviceRect,
1347 : const MapMode& rMapMode ) const;
1348 : Polygon PixelToLogic( const Polygon& rDevicePoly,
1349 : const MapMode& rMapMode ) const;
1350 : basegfx::B2DPolygon PixelToLogic( const basegfx::B2DPolygon& rDevicePoly,
1351 : const MapMode& rMapMode ) const;
1352 : PolyPolygon PixelToLogic( const PolyPolygon& rDevicePolyPoly,
1353 : const MapMode& rMapMode ) const;
1354 : basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly,
1355 : const MapMode& rMapMode ) const;
1356 : Region PixelToLogic( const Region& rDeviceRegion,
1357 : const MapMode& rMapMode ) const;
1358 : Point LogicToLogic( const Point& rPtSource,
1359 : const MapMode* pMapModeSource,
1360 : const MapMode* pMapModeDest ) const;
1361 : Size LogicToLogic( const Size& rSzSource,
1362 : const MapMode* pMapModeSource,
1363 : const MapMode* pMapModeDest ) const;
1364 : Rectangle LogicToLogic( const Rectangle& rRectSource,
1365 : const MapMode* pMapModeSource,
1366 : const MapMode* pMapModeDest ) const;
1367 : static Point LogicToLogic( const Point& rPtSource,
1368 : const MapMode& rMapModeSource,
1369 : const MapMode& rMapModeDest );
1370 : static Size LogicToLogic( const Size& rSzSource,
1371 : const MapMode& rMapModeSource,
1372 : const MapMode& rMapModeDest );
1373 : static Rectangle LogicToLogic( const Rectangle& rRectSource,
1374 : const MapMode& rMapModeSource,
1375 : const MapMode& rMapModeDest );
1376 : static long LogicToLogic( long nLongSource,
1377 : MapUnit eUnitSource,
1378 : MapUnit eUnitDest );
1379 :
1380 : static basegfx::B2DPolygon LogicToLogic( const basegfx::B2DPolygon& rPoly,
1381 : const MapMode& rMapModeSource,
1382 : const MapMode& rMapModeDest );
1383 : static basegfx::B2DPolyPolygon LogicToLogic( const basegfx::B2DPolyPolygon& rPolyPoly,
1384 : const MapMode& rMapModeSource,
1385 : const MapMode& rMapModeDest );
1386 :
1387 : // create a mapping transformation from rMapModeSource to rMapModeDest (the above methods
1388 : // for B2DPoly/Polygons use this internally anyway to transform the B2DPolygon)
1389 : static basegfx::B2DHomMatrix LogicToLogic(const MapMode& rMapModeSource, const MapMode& rMapModeDest);
1390 :
1391 873337 : Size GetOutputSizePixel() const
1392 873337 : { return Size( mnOutWidth, mnOutHeight ); }
1393 125238 : long GetOutputWidthPixel() const { return mnOutWidth; }
1394 93139 : long GetOutputHeightPixel() const { return mnOutHeight; }
1395 803 : long GetOutOffXPixel() const { return mnOutOffX; }
1396 9837 : long GetOutOffYPixel() const { return mnOutOffY; }
1397 :
1398 173152 : Size GetOutputSize() const
1399 173152 : { return PixelToLogic( GetOutputSizePixel() ); }
1400 :
1401 : void Erase();
1402 33011 : void Erase( const Rectangle& rRect ) { DrawWallpaper( rRect, GetBackground() ); }
1403 :
1404 : bool AddTempDevFont( const OUString& rFileURL, const OUString& rFontName );
1405 : int GetDevFontCount() const;
1406 : FontInfo GetDevFont( int nDevFontIndex ) const;
1407 : int GetDevFontSizeCount( const Font& ) const;
1408 : Size GetDevFontSize( const Font& rFont, int nSizeIndex ) const;
1409 : bool IsFontAvailable( const OUString& rFontName ) const;
1410 :
1411 : FontMetric GetFontMetric() const;
1412 : FontMetric GetFontMetric( const Font& rFont ) const;
1413 : bool GetFontCharMap( FontCharMap& rFontCharMap ) const;
1414 : bool GetFontCapabilities( vcl::FontCapabilities& rFontCapabilities ) const;
1415 :
1416 : sal_Int32 HasGlyphs( const Font& rFont, const OUString& rStr,
1417 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
1418 :
1419 : long GetMinKashida() const;
1420 :
1421 : // i60594
1422 : // validate kashida positions against the current font
1423 : // returns count of invalid kashida positions
1424 : sal_Int32 ValidateKashidas( const OUString& rTxt, sal_Int32 nIdx, sal_Int32 nLen,
1425 : sal_Int32 nKashCount, // number of suggested kashida positions (in)
1426 : const sal_Int32* pKashidaPos, // suggested kashida positions (in)
1427 : sal_Int32* pKashidaPosDropped // invalid kashida positions (out)
1428 : ) const;
1429 :
1430 : virtual sal_uInt16 GetBitCount() const;
1431 :
1432 : bool GetTextIsRTL( const OUString&, sal_Int32 nIndex, sal_Int32 nLen ) const;
1433 :
1434 : /** Query the existence and depth of the alpha channel
1435 :
1436 : @return 0, if no alpha channel available, and the bit depth of
1437 : the alpha channel otherwise.
1438 : */
1439 : virtual sal_uInt16 GetAlphaBitCount() const;
1440 : sal_uLong GetColorCount() const;
1441 :
1442 : void Push( sal_uInt16 nFlags = PUSH_ALL );
1443 : void Pop();
1444 : // returns the current stack depth; that is the number of Push() calls minus the number of Pop() calls
1445 : // this should not normally be used since Push and Pop must always be used symmetrically
1446 : // however this may be e.g. a help when debugging code in which this somehow is not the case
1447 : sal_uInt32 GetGCStackDepth() const;
1448 :
1449 : /** Query availability of alpha channel
1450 :
1451 : @return sal_True, if this device has an alpha channel.
1452 : */
1453 : bool HasAlpha();
1454 :
1455 : /// request XCanvas render interface for this OutputDevice
1456 : css::uno::Reference< css::rendering::XCanvas >
1457 : GetCanvas() const;
1458 :
1459 : css::uno::Reference< css::awt::XGraphics >
1460 : CreateUnoGraphics();
1461 246694 : VCLXGraphicsList_impl* GetUnoGraphicsList() const { return mpUnoGraphicsList; }
1462 1193 : VCLXGraphicsList_impl* CreateUnoGraphicsList()
1463 : {
1464 1193 : mpUnoGraphicsList = new VCLXGraphicsList_impl();
1465 1193 : return mpUnoGraphicsList;
1466 : }
1467 :
1468 : static void BeginFontSubstitution();
1469 : static void EndFontSubstitution();
1470 : static void AddFontSubstitute( const OUString& rFontName,
1471 : const OUString& rReplaceFontName,
1472 : sal_uInt16 nFlags = 0 );
1473 : static void RemoveFontSubstitute( sal_uInt16 n );
1474 : static sal_uInt16 GetFontSubstituteCount();
1475 :
1476 : static Font GetDefaultFont( sal_uInt16 nType,
1477 : LanguageType eLang,
1478 : sal_uLong nFlags,
1479 : const OutputDevice* pOutDev = NULL );
1480 :
1481 : /** helper method removing transparencies from a metafile (e.g. for printing)
1482 :
1483 : @returns
1484 : true: transparencies were removed
1485 : false: output metafile is unchanged input metafile
1486 :
1487 : @attention this is a member method, so current state can influence the result !
1488 : @attention the output metafile is prepared in pixel mode for the currentOutputDevice
1489 : state. It can not be moved or rotated reliably anymore.
1490 : */
1491 : bool RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
1492 : long nMaxBmpDPIX, long nMaxBmpDPIY,
1493 : bool bReduceTransparency,
1494 : bool bTransparencyAutoMode,
1495 : bool bDownsampleBitmaps,
1496 : const Color& rBackground = Color( COL_TRANSPARENT )
1497 : );
1498 : /** Retrieve downsampled and cropped bitmap
1499 :
1500 : @attention This method ignores negative rDstSz values, thus
1501 : mirroring must happen outside this method (e.g. in DrawBitmap)
1502 : */
1503 : Bitmap GetDownsampledBitmap( const Size& rDstSz,
1504 : const Point& rSrcPt, const Size& rSrcSz,
1505 : const Bitmap& rBmp, long nMaxBmpDPIX, long nMaxBmpDPIY );
1506 :
1507 : // Native Widget Rendering functions
1508 :
1509 : // These all just call through to the private mpGraphics functions of the same name.
1510 :
1511 : // Query the platform layer for control support
1512 : bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) const;
1513 :
1514 : // Query the native control to determine if it was acted upon
1515 : bool HitTestNativeControl( ControlType nType,
1516 : ControlPart nPart,
1517 : const Rectangle& rControlRegion,
1518 : const Point& aPos,
1519 : bool& rIsInside ) const;
1520 :
1521 : // Request rendering of a particular control and/or part
1522 : bool DrawNativeControl( ControlType nType,
1523 : ControlPart nPart,
1524 : const Rectangle& rControlRegion,
1525 : ControlState nState,
1526 : const ImplControlValue& aValue,
1527 : const OUString& aCaption );
1528 :
1529 : // Query the native control's actual drawing region (including adornment)
1530 : bool GetNativeControlRegion( ControlType nType,
1531 : ControlPart nPart,
1532 : const Rectangle& rControlRegion,
1533 : ControlState nState,
1534 : const ImplControlValue& aValue,
1535 : const OUString& aCaption,
1536 : Rectangle &rNativeBoundingRegion,
1537 : Rectangle &rNativeContentRegion ) const;
1538 :
1539 : };
1540 :
1541 : #endif // INCLUDED_VCL_OUTDEV_HXX
1542 :
1543 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|