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 <tools/rc.hxx>
26 : #include <tools/color.hxx>
27 : #include <tools/poly.hxx>
28 :
29 : #include <vcl/devicecoordinate.hxx>
30 : #include <vcl/dllapi.h>
31 : #include <vcl/font.hxx>
32 : #include <vcl/region.hxx>
33 : #include <vcl/mapmod.hxx>
34 : #include <vcl/wall.hxx>
35 : #include <vcl/metaact.hxx>
36 : #include <vcl/metaactiontypes.hxx>
37 : #include <vcl/salnativewidgets.hxx>
38 : #include <vcl/outdevstate.hxx>
39 : #include <vcl/outdevmap.hxx>
40 :
41 : #include <basegfx/vector/b2enums.hxx>
42 : #include <basegfx/polygon/b2dpolypolygon.hxx>
43 :
44 : #include <unotools/fontdefs.hxx>
45 :
46 : #include <boost/noncopyable.hpp>
47 : #include <boost/scoped_ptr.hpp>
48 : #ifdef check
49 : # //some problem with MacOSX and a check define
50 : # undef check
51 : #endif
52 : #include <boost/ptr_container/ptr_deque.hpp>
53 : #include <boost/intrusive_ptr.hpp>
54 :
55 : #include <com/sun/star/drawing/LineCap.hpp>
56 : #include <com/sun/star/uno/Reference.h>
57 :
58 : #include <vector>
59 : #include <stack>
60 :
61 : #if defined UNX
62 : #define GLYPH_FONT_HEIGHT 128
63 : #else
64 : #define GLYPH_FONT_HEIGHT 256
65 : #endif
66 :
67 : struct ImplOutDevData;
68 : class ImplFontEntry;
69 : class OutDevState;
70 : struct SystemGraphicsData;
71 : struct SystemFontData;
72 : struct SystemTextLayoutData;
73 : class ImplFontCache;
74 : class PhysicalFontCollection;
75 : class ImplGetDevFontList;
76 : class ImplGetDevSizeList;
77 : class ImplMultiTextLineInfo;
78 : class SalGraphics;
79 : class Gradient;
80 : class Hatch;
81 : class AllSettings;
82 : class Bitmap;
83 : class BitmapReadAccess;
84 : class BitmapEx;
85 : class Image;
86 : class TextRectInfo;
87 : class FontMetric;
88 : class GDIMetaFile;
89 : class GfxLink;
90 : class Line;
91 : class LineInfo;
92 : class AlphaMask;
93 : class FontCharMap;
94 : class SalLayout;
95 : class ImplLayoutArgs;
96 : class ImplFontAttributes;
97 : class VirtualDevice;
98 : namespace vcl { class Window; }
99 : struct SalTwoRect;
100 :
101 : // Layout options
102 : #define SAL_LAYOUT_BIDI_RTL (1<<0)
103 : #define SAL_LAYOUT_BIDI_STRONG (1<<1)
104 : #define SAL_LAYOUT_RIGHT_ALIGN (1<<2)
105 : #define SAL_LAYOUT_KERNING_PAIRS (1<<4)
106 : #define SAL_LAYOUT_KERNING_ASIAN (1<<5)
107 : #define SAL_LAYOUT_VERTICAL (1<<6)
108 : #define SAL_LAYOUT_COMPLEX_DISABLED (1<<8)
109 : #define SAL_LAYOUT_ENABLE_LIGATURES (1<<9)
110 : #define SAL_LAYOUT_SUBSTITUTE_DIGITS (1<<10)
111 : #define SAL_LAYOUT_KASHIDA_JUSTIFICATON (1<<11)
112 : #define SAL_LAYOUT_DISABLE_GLYPH_PROCESSING (1<<12)
113 : #define SAL_LAYOUT_FOR_FALLBACK (1<<13)
114 : #define SAL_LAYOUT_DRAW_BULLET (1<<14)
115 :
116 : namespace com {
117 : namespace sun {
118 : namespace star {
119 : namespace rendering {
120 : class XCanvas;
121 : }}}}
122 : namespace basegfx {
123 : class B2DHomMatrix;
124 : class B2DPolygon;
125 : class B2DPolyPolygon;
126 : }
127 :
128 : namespace com {
129 : namespace sun {
130 : namespace star {
131 : namespace awt {
132 : class XGraphics;
133 : } } } }
134 :
135 : typedef std::vector< Rectangle > MetricVector;
136 :
137 : namespace vcl
138 : {
139 : class PDFWriterImpl;
140 : class ExtOutDevData;
141 : class ITextLayout;
142 : struct FontCapabilities;
143 : }
144 :
145 : // OutputDevice-Types
146 :
147 : // Flags for DrawText()
148 : #define TEXT_DRAW_DISABLE ((sal_uInt16)0x0001)
149 : #define TEXT_DRAW_MNEMONIC ((sal_uInt16)0x0002)
150 : #define TEXT_DRAW_MONO ((sal_uInt16)0x0004)
151 : #define TEXT_DRAW_CLIP ((sal_uInt16)0x0008)
152 : #define TEXT_DRAW_LEFT ((sal_uInt16)0x0010)
153 : #define TEXT_DRAW_CENTER ((sal_uInt16)0x0020)
154 : #define TEXT_DRAW_RIGHT ((sal_uInt16)0x0040)
155 : #define TEXT_DRAW_TOP ((sal_uInt16)0x0080)
156 : #define TEXT_DRAW_VCENTER ((sal_uInt16)0x0100)
157 : #define TEXT_DRAW_BOTTOM ((sal_uInt16)0x0200)
158 : #define TEXT_DRAW_ENDELLIPSIS ((sal_uInt16)0x0400)
159 : #define TEXT_DRAW_PATHELLIPSIS ((sal_uInt16)0x0800)
160 : #define TEXT_DRAW_MULTILINE ((sal_uInt16)0x1000)
161 : #define TEXT_DRAW_WORDBREAK ((sal_uInt16)0x2000)
162 : #define TEXT_DRAW_NEWSELLIPSIS ((sal_uInt16)0x4000)
163 : // in the long run we should make text style flags longer
164 : // but at the moment we can get away with this 2 bit field for ellipsis style
165 : #define TEXT_DRAW_CENTERELLIPSIS (TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_PATHELLIPSIS)
166 :
167 : #define TEXT_DRAW_WORDBREAK_HYPHENATION (((sal_uInt16)0x8000) | TEXT_DRAW_WORDBREAK)
168 :
169 : // Flags for CopyArea()
170 : #define COPYAREA_WINDOWINVALIDATE ((sal_uInt16)0x0001)
171 :
172 : // Flags for DrawImage()
173 : #define IMAGE_DRAW_DISABLE ((sal_uInt16)0x0001)
174 : #define IMAGE_DRAW_HIGHLIGHT ((sal_uInt16)0x0002)
175 : #define IMAGE_DRAW_DEACTIVE ((sal_uInt16)0x0004)
176 : #define IMAGE_DRAW_COLORTRANSFORM ((sal_uInt16)0x0008)
177 : #define IMAGE_DRAW_SEMITRANSPARENT ((sal_uInt16)0x0010)
178 :
179 : // Grid
180 : #define GRID_DOTS ((sal_uLong)0x00000001)
181 : #define GRID_HORZLINES ((sal_uLong)0x00000002)
182 : #define GRID_VERTLINES ((sal_uLong)0x00000004)
183 : #define GRID_LINES (GRID_HORZLINES | GRID_VERTLINES)
184 :
185 : // DrawModes
186 : #define DRAWMODE_DEFAULT ((sal_uLong)0x00000000)
187 : #define DRAWMODE_BLACKLINE ((sal_uLong)0x00000001)
188 : #define DRAWMODE_BLACKFILL ((sal_uLong)0x00000002)
189 : #define DRAWMODE_BLACKTEXT ((sal_uLong)0x00000004)
190 : #define DRAWMODE_BLACKBITMAP ((sal_uLong)0x00000008)
191 : #define DRAWMODE_BLACKGRADIENT ((sal_uLong)0x00000010)
192 : #define DRAWMODE_GRAYLINE ((sal_uLong)0x00000020)
193 : #define DRAWMODE_GRAYFILL ((sal_uLong)0x00000040)
194 : #define DRAWMODE_GRAYTEXT ((sal_uLong)0x00000080)
195 : #define DRAWMODE_GRAYBITMAP ((sal_uLong)0x00000100)
196 : #define DRAWMODE_GRAYGRADIENT ((sal_uLong)0x00000200)
197 : #define DRAWMODE_NOFILL ((sal_uLong)0x00000400)
198 : #define DRAWMODE_NOBITMAP ((sal_uLong)0x00000800)
199 : #define DRAWMODE_NOGRADIENT ((sal_uLong)0x00001000)
200 : #define DRAWMODE_GHOSTEDLINE ((sal_uLong)0x00002000)
201 : #define DRAWMODE_GHOSTEDFILL ((sal_uLong)0x00004000)
202 : #define DRAWMODE_GHOSTEDTEXT ((sal_uLong)0x00008000)
203 : #define DRAWMODE_GHOSTEDBITMAP ((sal_uLong)0x00010000)
204 : #define DRAWMODE_GHOSTEDGRADIENT ((sal_uLong)0x00020000)
205 : #define DRAWMODE_WHITELINE ((sal_uLong)0x00100000)
206 : #define DRAWMODE_WHITEFILL ((sal_uLong)0x00200000)
207 : #define DRAWMODE_WHITETEXT ((sal_uLong)0x00400000)
208 : #define DRAWMODE_WHITEBITMAP ((sal_uLong)0x00800000)
209 : #define DRAWMODE_WHITEGRADIENT ((sal_uLong)0x01000000)
210 : #define DRAWMODE_SETTINGSLINE ((sal_uLong)0x02000000)
211 : #define DRAWMODE_SETTINGSFILL ((sal_uLong)0x04000000)
212 : #define DRAWMODE_SETTINGSTEXT ((sal_uLong)0x08000000)
213 : #define DRAWMODE_SETTINGSGRADIENT ((sal_uLong)0x10000000)
214 : #define DRAWMODE_NOTRANSPARENCY ((sal_uLong)0x80000000)
215 :
216 : // Antialiasing
217 : #define ANTIALIASING_DISABLE_TEXT ((sal_uInt16)0x0001)
218 : #define ANTIALIASING_ENABLE_B2DDRAW ((sal_uInt16)0x0002)
219 : #define ANTIALIASING_PIXELSNAPHAIRLINE ((sal_uInt16)0x0004)
220 :
221 : // AddFontSubstitute
222 : #define FONT_SUBSTITUTE_ALWAYS ((sal_uInt16)0x0001)
223 : #define FONT_SUBSTITUTE_SCREENONLY ((sal_uInt16)0x0002)
224 :
225 : #define DEFAULTFONT_FLAGS_ONLYONE ((sal_uLong)0x00000001)
226 :
227 : enum OutDevType { OUTDEV_DONTKNOW, OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV };
228 :
229 : enum OutDevViewType { OUTDEV_VIEWTYPE_DONTKNOW, OUTDEV_VIEWTYPE_PRINTPREVIEW, OUTDEV_VIEWTYPE_SLIDESHOW };
230 :
231 : // OutputDevice
232 :
233 : class VirtualDevice;
234 : class Printer;
235 : class FontSelectPattern;
236 : class ImplFontMetricData;
237 : class VCLXGraphics;
238 :
239 : typedef boost::intrusive_ptr< FontCharMap > FontCharMapPtr;
240 :
241 : namespace vcl {
242 : class FontInfo;
243 : }
244 :
245 : typedef ::std::vector< VCLXGraphics* > VCLXGraphicsList_impl;
246 :
247 : sal_uLong AdjustTwoRect( SalTwoRect& rTwoRect, const Size& rSizePix );
248 : void AdjustTwoRect( SalTwoRect& rTwoRect, const Rectangle& rValidSrcRect );
249 :
250 : extern const sal_uLong nVCLRLut[ 6 ];
251 : extern const sal_uLong nVCLGLut[ 6 ];
252 : extern const sal_uLong nVCLBLut[ 6 ];
253 : extern const sal_uLong nVCLDitherLut[ 256 ];
254 : extern const sal_uLong nVCLLut[ 256 ];
255 :
256 : class VCL_DLLPUBLIC OutputDevice: private boost::noncopyable
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 vcl::Window;
265 : friend class WorkWindow;
266 : friend class vcl::PDFWriterImpl;
267 : friend void ImplHandleResize( vcl::Window* pWindow, long nNewWidth, long nNewHeight );
268 :
269 : private:
270 : mutable SalGraphics* mpGraphics; ///< Graphics context to draw on
271 : mutable OutputDevice* mpPrevGraphics; ///< Previous output device in list
272 : mutable OutputDevice* mpNextGraphics; ///< Next output device in list
273 : GDIMetaFile* mpMetaFile;
274 : mutable ImplFontEntry* mpFontEntry;
275 : mutable ImplFontCache* mpFontCache;
276 : mutable PhysicalFontCollection* mpFontCollection;
277 : mutable ImplGetDevFontList* mpGetDevFontList;
278 : mutable ImplGetDevSizeList* mpGetDevSizeList;
279 : boost::ptr_deque<OutDevState>* mpOutDevStateStack;
280 : ImplOutDevData* mpOutDevData;
281 : VCLXGraphicsList_impl* mpUnoGraphicsList;
282 : vcl::PDFWriterImpl* mpPDFWriter;
283 : vcl::ExtOutDevData* mpExtOutDevData;
284 :
285 : // TEMP TEMP TEMP
286 : VirtualDevice* mpAlphaVDev;
287 :
288 : /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
289 : long mnOutOffOrigX;
290 : /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
291 : long mnOutOffLogicX;
292 : /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
293 : long mnOutOffOrigY;
294 : /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
295 : long mnOutOffLogicY;
296 : /// Output offset for device output in pixel (pseudo window offset within window system's frames)
297 : long mnOutOffX;
298 : /// Output offset for device output in pixel (pseudo window offset within window system's frames)
299 : long mnOutOffY;
300 : long mnOutWidth;
301 : long mnOutHeight;
302 : sal_Int32 mnDPIX;
303 : sal_Int32 mnDPIY;
304 : sal_Int32 mnDPIScaleFactor; ///< For Hi-DPI displays, we want to draw everything mnDPIScaleFactor-times larger
305 : /// font specific text alignment offsets in pixel units
306 : mutable long mnTextOffX;
307 : mutable long mnTextOffY;
308 : mutable long mnEmphasisAscent;
309 : mutable long mnEmphasisDescent;
310 : sal_uLong mnDrawMode;
311 : ComplexTextLayoutMode mnTextLayoutMode;
312 : ImplMapRes maMapRes;
313 : ImplThresholdRes maThresRes;
314 : OutDevType meOutDevType;
315 : OutDevViewType meOutDevViewType;
316 : vcl::Region maRegion; // contains the clip region, see SetClipRegion(...)
317 : Color maLineColor;
318 : Color maFillColor;
319 : vcl::Font maFont;
320 : Color maTextColor;
321 : Color maTextLineColor;
322 : Color maOverlineColor;
323 : TextAlign meTextAlign;
324 : RasterOp meRasterOp;
325 : Wallpaper maBackground;
326 : boost::scoped_ptr<AllSettings> mxSettings;
327 : MapMode maMapMode;
328 : Point maRefPoint;
329 : sal_uInt16 mnAntialiasing;
330 : LanguageType meTextLanguage;
331 :
332 : /// bitfield
333 : mutable bool mbMap : 1;
334 : mutable bool mbMapIsDefault : 1;
335 : mutable bool mbClipRegion : 1;
336 : mutable bool mbBackground : 1;
337 : mutable bool mbOutput : 1;
338 : mutable bool mbDevOutput : 1;
339 : mutable bool mbOutputClipped : 1;
340 : mutable bool mbLineColor : 1;
341 : mutable bool mbFillColor : 1;
342 : mutable bool mbInitLineColor : 1;
343 : mutable bool mbInitFillColor : 1;
344 : mutable bool mbInitFont : 1;
345 : mutable bool mbInitTextColor : 1;
346 : mutable bool mbInitClipRegion : 1;
347 : mutable bool mbClipRegionSet : 1;
348 : mutable bool mbKerning : 1;
349 : mutable bool mbNewFont : 1;
350 : mutable bool mbTextLines : 1;
351 : mutable bool mbTextBackground : 1;
352 : mutable bool mbTextSpecial : 1;
353 : mutable bool mbRefPoint : 1;
354 : mutable bool mbEnableRTL : 1;
355 :
356 : /** @name Initialization and accessor functions
357 : */
358 : ///@{
359 :
360 : protected:
361 : OutputDevice();
362 :
363 : public:
364 : virtual ~OutputDevice();
365 :
366 : public:
367 :
368 : /** Get the graphic context that the output device uses to draw on.
369 :
370 : If no graphics device exists, then initialize it.
371 :
372 : @returns SalGraphics instance.
373 : */
374 : SalGraphics const *GetGraphics() const;
375 : SalGraphics* GetGraphics();
376 :
377 : void SetConnectMetaFile( GDIMetaFile* pMtf );
378 263860 : GDIMetaFile* GetConnectMetaFile() const { return mpMetaFile; }
379 :
380 : virtual void SetSettings( const AllSettings& rSettings );
381 3293174 : const AllSettings& GetSettings() const { return *mxSettings; }
382 :
383 : SystemGraphicsData GetSystemGfxData() const;
384 : css::uno::Any GetSystemGfxDataAny() const;
385 :
386 : void SetRefPoint();
387 : void SetRefPoint( const Point& rRefPoint );
388 0 : const Point& GetRefPoint() const { return maRefPoint; }
389 6831 : bool IsRefPoint() const { return mbRefPoint; }
390 :
391 : virtual sal_uInt16 GetBitCount() const;
392 :
393 2169678 : Size GetOutputSizePixel() const
394 2169678 : { return Size( mnOutWidth, mnOutHeight ); }
395 105719 : long GetOutputWidthPixel() const { return mnOutWidth; }
396 82081 : long GetOutputHeightPixel() const { return mnOutHeight; }
397 3804 : long GetOutOffXPixel() const { return mnOutOffX; }
398 11080 : long GetOutOffYPixel() const { return mnOutOffY; }
399 :
400 306224 : Size GetOutputSize() const
401 306224 : { return PixelToLogic( GetOutputSizePixel() ); }
402 :
403 : sal_uLong GetColorCount() const;
404 :
405 :
406 : /// request XCanvas render interface for this OutputDevice
407 : css::uno::Reference< css::rendering::XCanvas >
408 : GetCanvas() const;
409 :
410 : css::uno::Reference< css::awt::XGraphics >
411 : CreateUnoGraphics();
412 674789 : VCLXGraphicsList_impl* GetUnoGraphicsList() const { return mpUnoGraphicsList; }
413 : VCLXGraphicsList_impl* CreateUnoGraphicsList();
414 :
415 : protected:
416 :
417 : /** Acquire a graphics device that the output device uses to draw on.
418 :
419 : There is an LRU of OutputDevices that is used to get the graphics. The
420 : actual creation of a SalGraphics instance is done via the SalFrame
421 : implementation.
422 :
423 : However, the SalFrame instance will only return a valid SalGraphics
424 : instance if it is not in use or there wasn't one in the first place. When
425 : this happens, AcquireGraphics finds the least recently used OutputDevice
426 : in a different frame and "steals" it (releases it then starts using it).
427 :
428 : If there are no frames to steal an OutputDevice's SalGraphics instance from
429 : then it blocks until the graphics is released.
430 :
431 : Once it has acquired a graphics instance, then we add the OutputDevice to
432 : the LRU.
433 :
434 : @returns true if was able to initialize the graphics device, false otherwise.
435 : */
436 : virtual bool AcquireGraphics() const = 0;
437 :
438 : /** Release the graphics device, and remove it from the graphics device
439 : list.
440 :
441 : @param bRelease Determines whether to release the fonts of the
442 : physically released graphics device.
443 : */
444 : virtual void ReleaseGraphics( bool bRelease = true ) = 0;
445 : ///@}
446 :
447 :
448 : /** @name Helper functions
449 : */
450 : ///@{
451 :
452 : public:
453 :
454 : /** Get the output device's DPI x-axis value.
455 :
456 : @returns x-axis DPI value
457 : */
458 15050 : SAL_DLLPRIVATE sal_Int32 GetDPIX() const { return mnDPIX; }
459 :
460 : /** Get the output device's DPI y-axis value.
461 :
462 : @returns y-axis DPI value
463 : */
464 37821 : SAL_DLLPRIVATE sal_Int32 GetDPIY() const { return mnDPIY; }
465 :
466 528990 : sal_Int32 GetDPIScaleFactor() const { return mnDPIScaleFactor; }
467 :
468 4952484 : OutDevType GetOutDevType() const { return meOutDevType; }
469 :
470 : /** Query an OutputDevice to see whether it supports a specific operation
471 :
472 : @returns true if operation supported, else false
473 : */
474 : bool SupportsOperation( OutDevSupportType ) const;
475 :
476 50303 : vcl::PDFWriterImpl* GetPDFWriter() const { return mpPDFWriter; }
477 :
478 0 : void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; }
479 329665 : vcl::ExtOutDevData* GetExtOutDevData() const { return mpExtOutDevData; }
480 :
481 : ///@}
482 :
483 :
484 : /** @name Frame functions
485 : */
486 : ///@{
487 :
488 : private:
489 :
490 : SAL_DLLPRIVATE void ImplGetFrameDev ( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
491 : OutputDevice& rOutDev );
492 : SAL_DLLPRIVATE void ImplDrawFrameDev ( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
493 : const OutputDevice& rOutDev, const vcl::Region& rRegion );
494 : ///@}
495 :
496 :
497 : /** @Name Direct OutputDevice drawing functions
498 : */
499 : ///@{
500 :
501 : public:
502 :
503 : virtual void DrawOutDev(
504 : const Point& rDestPt, const Size& rDestSize,
505 : const Point& rSrcPt, const Size& rSrcSize );
506 :
507 : virtual void DrawOutDev(
508 : const Point& rDestPt, const Size& rDestSize,
509 : const Point& rSrcPt, const Size& rSrcSize,
510 : const OutputDevice& rOutDev );
511 :
512 : virtual void CopyArea(
513 : const Point& rDestPt,
514 : const Point& rSrcPt, const Size& rSrcSize,
515 : sal_uInt16 nFlags = 0 );
516 :
517 : protected:
518 :
519 : virtual void CopyDeviceArea( SalTwoRect& aPosAry, sal_uInt32 nFlags);
520 :
521 : private:
522 :
523 : SAL_DLLPRIVATE void ImplDrawOutDevDirect ( const OutputDevice* pSrcDev, SalTwoRect& rPosAry );
524 :
525 : // not implemented; to detect misuses of DrawOutDev(...OutputDevice&);
526 : SAL_DLLPRIVATE void DrawOutDev( const Point&, const Size&, const Point&, const Size&, const Printer&) SAL_DELETED_FUNCTION;
527 : ///@}
528 :
529 :
530 : /** @name OutputDevice state functions
531 : */
532 : ///@{
533 :
534 : public:
535 :
536 : void Push( PushFlags nFlags = PushFlags::ALL );
537 : void Pop();
538 :
539 : // returns the current stack depth; that is the number of Push() calls minus the number of Pop() calls
540 : // this should not normally be used since Push and Pop must always be used symmetrically
541 : // however this may be e.g. a help when debugging code in which this somehow is not the case
542 : sal_uInt32 GetGCStackDepth() const;
543 :
544 : void EnableOutput( bool bEnable = true );
545 6695 : bool IsOutputEnabled() const { return mbOutput; }
546 : bool IsDeviceOutput() const { return mbDevOutput; }
547 9779633 : bool IsDeviceOutputNecessary() const { return (mbOutput && mbDevOutput); }
548 : bool IsOutputNecessary() const { return ((mbOutput && mbDevOutput) || (mpMetaFile != NULL)); }
549 :
550 : void SetAntialiasing( sal_uInt16 nMode = 0 );
551 385926 : sal_uInt16 GetAntialiasing() const { return mnAntialiasing; }
552 :
553 : void SetDrawMode( sal_uLong nDrawMode );
554 4007048 : sal_uLong GetDrawMode() const { return mnDrawMode; }
555 :
556 : void SetLayoutMode( ComplexTextLayoutMode nTextLayoutMode );
557 818252 : ComplexTextLayoutMode GetLayoutMode() const { return mnTextLayoutMode; }
558 :
559 : void SetDigitLanguage( LanguageType );
560 716447 : LanguageType GetDigitLanguage() const { return meTextLanguage; }
561 :
562 : void SetRasterOp( RasterOp eRasterOp );
563 559149 : RasterOp GetRasterOp() const { return meRasterOp; }
564 :
565 : /**
566 : If this OutputDevice is used for displaying a Print Preview
567 : the OutDevViewType should be set to 'OUTDEV_VIEWTYPE_PRINTPREVIEW'.
568 :
569 : A View can then make painting decisions dependent on this OutDevViewType.
570 : E.g. text colors need to be handled differently, dependent on whether it's a PrintPreview or not. (see #106611# for more)
571 : */
572 16 : void SetOutDevViewType( OutDevViewType eOutDevViewType ) { meOutDevViewType=eOutDevViewType; }
573 2524 : OutDevViewType GetOutDevViewType() const { return meOutDevViewType; }
574 :
575 : void SetLineColor();
576 : void SetLineColor( const Color& rColor );
577 1002077 : const Color& GetLineColor() const { return maLineColor; }
578 176721 : bool IsLineColor() const { return mbLineColor; }
579 :
580 : void SetFillColor();
581 : void SetFillColor( const Color& rColor );
582 907836 : const Color& GetFillColor() const { return maFillColor; }
583 42926 : bool IsFillColor() const { return mbFillColor; }
584 :
585 : void SetBackground();
586 : void SetBackground( const Wallpaper& rBackground );
587 :
588 1048297 : const Wallpaper& GetBackground() const { return maBackground; }
589 1198337 : bool IsBackground() const { return mbBackground; }
590 :
591 : void SetFont( const vcl::Font& rNewFont );
592 2697029 : const vcl::Font& GetFont() const { return maFont; }
593 :
594 : protected:
595 :
596 : virtual void ImplReleaseFonts();
597 :
598 : private:
599 :
600 : SAL_DLLPRIVATE void InitLineColor();
601 :
602 : SAL_DLLPRIVATE void InitFillColor();
603 :
604 : ///@}
605 :
606 :
607 : /** @name Clipping functions
608 : */
609 : ///@{
610 :
611 : public:
612 :
613 : vcl::Region GetClipRegion() const;
614 : void SetClipRegion();
615 : void SetClipRegion( const vcl::Region& rRegion );
616 : bool SelectClipRegion( const vcl::Region&, SalGraphics* pGraphics = NULL );
617 :
618 332093 : bool IsClipRegion() const { return mbClipRegion; }
619 :
620 : void MoveClipRegion( long nHorzMove, long nVertMove );
621 : void IntersectClipRegion( const Rectangle& rRect );
622 : void IntersectClipRegion( const vcl::Region& rRegion );
623 :
624 : virtual vcl::Region GetActiveClipRegion() const;
625 :
626 : protected:
627 :
628 : virtual void InitClipRegion();
629 : virtual void ClipToPaintRegion ( Rectangle& rDstRect );
630 :
631 : private:
632 :
633 : SAL_DLLPRIVATE void SetDeviceClipRegion( const vcl::Region* pRegion );
634 : ///@}
635 :
636 :
637 : /** @name Pixel functions
638 : */
639 : ///@{
640 :
641 : public:
642 :
643 : void DrawPixel( const Point& rPt );
644 : void DrawPixel( const Point& rPt, const Color& rColor );
645 : void DrawPixel( const Polygon& rPts, const Color* pColors = NULL );
646 : void DrawPixel( const Polygon& rPts, const Color& rColor );
647 :
648 : Color GetPixel( const Point& rPt ) const;
649 : ///@}
650 :
651 :
652 : /** @name Rectangle functions
653 : */
654 : ///@{
655 :
656 : public:
657 :
658 : void DrawRect( const Rectangle& rRect );
659 : void DrawRect( const Rectangle& rRect,
660 : sal_uLong nHorzRount, sal_uLong nVertRound );
661 :
662 : /// Fill the given rectangle with checkered rectangles of size nLen x nLen using the colors aStart and aEnd
663 : void DrawCheckered(
664 : const Point& rPos,
665 : const Size& rSize,
666 : sal_uInt32 nLen = 8,
667 : Color aStart = Color(COL_WHITE),
668 : Color aEnd = Color(COL_BLACK));
669 :
670 : void DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags );
671 :
672 : ///@}
673 :
674 :
675 : /** @name Line functions
676 : */
677 : ///@{
678 :
679 : public:
680 :
681 : void DrawLine( const Point& rStartPt, const Point& rEndPt );
682 :
683 : void DrawLine( const Point& rStartPt, const Point& rEndPt,
684 : const LineInfo& rLineInfo );
685 :
686 : private:
687 :
688 : /** Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area)
689 : */
690 : SAL_DLLPRIVATE void PaintLineGeometryWithEvtlExpand( const LineInfo& rInfo, basegfx::B2DPolyPolygon aLinePolyPolygon );
691 : ///@}
692 :
693 :
694 : /** @name Polyline functions
695 : */
696 : ///@{
697 :
698 : public:
699 :
700 : /** Render the given polygon as a line stroke
701 :
702 : The given polygon is stroked with the current LineColor, start
703 : and end point are not automatically connected
704 :
705 : @see DrawPolygon
706 : @see DrawPolyPolygon
707 : */
708 : void DrawPolyLine( const Polygon& rPoly );
709 :
710 : void DrawPolyLine(
711 : const basegfx::B2DPolygon&,
712 : double fLineWidth = 0.0,
713 : basegfx::B2DLineJoin eLineJoin = basegfx::B2DLINEJOIN_ROUND,
714 : css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT);
715 :
716 : /** Render the given polygon as a line stroke
717 :
718 : The given polygon is stroked with the current LineColor, start
719 : and end point are not automatically connected. The line is
720 : rendered according to the specified LineInfo, e.g. supplying a
721 : dash pattern, or a line thickness.
722 :
723 : @see DrawPolygon
724 : @see DrawPolyPolygon
725 : */
726 : void DrawPolyLine( const Polygon& rPoly,
727 : const LineInfo& rLineInfo );
728 :
729 : bool DrawPolyLineDirect(
730 : const basegfx::B2DPolygon& rB2DPolygon,
731 : double fLineWidth = 0.0,
732 : double fTransparency = 0.0,
733 : basegfx::B2DLineJoin eLineJoin = basegfx::B2DLINEJOIN_NONE,
734 : css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT);
735 : private:
736 :
737 : // #i101491#
738 : // Helper which holds the old line geometry creation and is extended to use AA when
739 : // switched on. Advantage is that line geometry is only temporarily used for paint
740 : SAL_DLLPRIVATE void drawPolyLine(const Polygon& rPoly, const LineInfo& rLineInfo);
741 :
742 :
743 : // #i101491#
744 : // Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool. Contains no AA check.
745 : SAL_DLLPRIVATE bool drawPolyLineDirectNoAACheck(
746 : const basegfx::B2DPolygon& rB2DPolygon,
747 : double fLineWidth = 0.0,
748 : double fTransparency = 0.0,
749 : basegfx::B2DLineJoin eLineJoin = basegfx::B2DLINEJOIN_NONE,
750 : css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT);
751 : ///@}
752 :
753 :
754 : /** @name Polygon functions
755 : */
756 : ///@{
757 :
758 : public:
759 :
760 : /** Render the given polygon
761 :
762 : The given polygon is stroked with the current LineColor, and
763 : filled with the current FillColor. If one of these colors are
764 : transparent, the corresponding stroke or fill stays
765 : invisible. Start and end point of the polygon are
766 : automatically connected.
767 :
768 : @see DrawPolyLine
769 : */
770 : void DrawPolygon( const Polygon& rPoly );
771 : void DrawPolygon( const basegfx::B2DPolygon& );
772 :
773 : /** Render the given poly-polygon
774 :
775 : The given poly-polygon is stroked with the current LineColor,
776 : and filled with the current FillColor. If one of these colors
777 : are transparent, the corresponding stroke or fill stays
778 : invisible. Start and end points of the contained polygons are
779 : automatically connected.
780 :
781 : @see DrawPolyLine
782 : */
783 : void DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly );
784 : void DrawPolyPolygon( const basegfx::B2DPolyPolygon& );
785 :
786 : private:
787 :
788 : SAL_DLLPRIVATE void ImplDrawPolygon( const Polygon& rPoly, const tools::PolyPolygon* pClipPolyPoly = NULL );
789 : SAL_DLLPRIVATE void ImplDrawPolyPolygon( const tools::PolyPolygon& rPolyPoly, const tools::PolyPolygon* pClipPolyPoly = NULL );
790 : SAL_DLLPRIVATE void ImplDrawPolyPolygon( sal_uInt16 nPoly, const tools::PolyPolygon& rPolyPoly );
791 : // #i101491#
792 : // Helper who implements the DrawPolyPolygon functionality for basegfx::B2DPolyPolygon
793 : // without MetaFile processing
794 : SAL_DLLPRIVATE void ImplDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPolygon& rB2DPolyPoly);
795 : ///@}
796 :
797 :
798 : /** @name Curved shape functions
799 : */
800 : ///@{
801 :
802 : public:
803 :
804 : void DrawEllipse( const Rectangle& rRect );
805 :
806 : void DrawArc(
807 : const Rectangle& rRect,
808 : const Point& rStartPt, const Point& rEndPt );
809 :
810 : void DrawPie(
811 : const Rectangle& rRect,
812 : const Point& rStartPt, const Point& rEndPt );
813 :
814 : void DrawChord(
815 : const Rectangle& rRect,
816 : const Point& rStartPt, const Point& rEndPt );
817 :
818 : ///@}
819 :
820 :
821 : /** @name Gradient functions
822 : */
823 : ///@{
824 :
825 : public:
826 : void DrawGradient( const Rectangle& rRect, const Gradient& rGradient );
827 : void DrawGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient );
828 :
829 : void AddGradientActions(
830 : const Rectangle& rRect,
831 : const Gradient& rGradient,
832 : GDIMetaFile& rMtf );
833 :
834 : protected:
835 :
836 : virtual bool UsePolyPolygonForComplexGradient() = 0;
837 :
838 : virtual long GetGradientStepCount( long nMinRect );
839 :
840 : private:
841 :
842 : SAL_DLLPRIVATE void DrawLinearGradient( const Rectangle& rRect, const Gradient& rGradient, bool bMtf, const tools::PolyPolygon* pClipPolyPoly );
843 : SAL_DLLPRIVATE void DrawComplexGradient( const Rectangle& rRect, const Gradient& rGradient, bool bMtf, const tools::PolyPolygon* pClipPolyPoly );
844 :
845 : SAL_DLLPRIVATE long GetGradientSteps( const Gradient& rGradient, const Rectangle& rRect, bool bMtf, bool bComplex=false );
846 :
847 : SAL_DLLPRIVATE Color GetSingleColorGradientFill();
848 : SAL_DLLPRIVATE void SetGrayscaleColors( Gradient &rGradient );
849 : ///@}
850 :
851 :
852 : /** @name Hatch functions
853 : */
854 : ///@{
855 :
856 : public:
857 :
858 : #ifdef _MSC_VER
859 : void DrawHatch( const tools::PolyPolygon& rPolyPoly, const ::Hatch& rHatch );
860 : void AddHatchActions( const tools::PolyPolygon& rPolyPoly,
861 : const ::Hatch& rHatch,
862 : GDIMetaFile& rMtf );
863 : #else
864 : void DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch );
865 : void AddHatchActions( const tools::PolyPolygon& rPolyPoly,
866 : const Hatch& rHatch,
867 : GDIMetaFile& rMtf );
868 : #endif
869 :
870 : void DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch, bool bMtf );
871 :
872 : private:
873 :
874 : SAL_DLLPRIVATE void CalcHatchValues( const Rectangle& rRect, long nDist, sal_uInt16 nAngle10, Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 );
875 : SAL_DLLPRIVATE void DrawHatchLine( const Line& rLine, const tools::PolyPolygon& rPolyPoly, Point* pPtBuffer, bool bMtf );
876 : ///@}
877 :
878 :
879 : /** @name Wallpaper functions
880 : */
881 : ///@{
882 :
883 : public:
884 : void DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper );
885 :
886 : virtual void Erase();
887 160249 : virtual void Erase( const Rectangle& rRect ) { DrawWallpaper( rRect, GetBackground() ); }
888 :
889 : protected:
890 : virtual void DrawGradientWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
891 :
892 : private:
893 : SAL_DLLPRIVATE void DrawWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
894 : SAL_DLLPRIVATE void DrawColorWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
895 : SAL_DLLPRIVATE void DrawBitmapWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
896 : ///@}
897 :
898 :
899 : /** @name Text functions
900 : */
901 : ///@{
902 :
903 : public:
904 :
905 : void DrawText( const Point& rStartPt, const OUString& rStr,
906 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
907 : MetricVector* pVector = NULL, OUString* pDisplayText = NULL );
908 :
909 : void DrawText( const Rectangle& rRect,
910 : const OUString& rStr, sal_uInt16 nStyle = 0,
911 : MetricVector* pVector = NULL, OUString* pDisplayText = NULL,
912 : ::vcl::ITextLayout* _pTextLayout = NULL );
913 :
914 : void ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect,
915 : const OUString& rOrigStr, sal_uInt16 nStyle,
916 : MetricVector* pVector, OUString* pDisplayText, ::vcl::ITextLayout& _rLayout );
917 :
918 : void ImplDrawText( SalLayout& );
919 :
920 : void ImplDrawTextBackground( const SalLayout& );
921 :
922 : void DrawCtrlText( const Point& rPos, const OUString& rStr,
923 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
924 : sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC, MetricVector* pVector = NULL, OUString* pDisplayText = NULL );
925 :
926 : void DrawTextLine( const Point& rPos, long nWidth,
927 : FontStrikeout eStrikeout,
928 : FontUnderline eUnderline,
929 : FontUnderline eOverline,
930 : bool bUnderlineAbove = false );
931 :
932 : void ImplDrawTextLine( long nBaseX, long nX, long nY, DeviceCoordinate nWidth,
933 : FontStrikeout eStrikeout, FontUnderline eUnderline,
934 : FontUnderline eOverline, bool bUnderlineAbove );
935 :
936 : void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontUnderline eUnderline,
937 : FontUnderline eOverline, bool bWordLine, bool bUnderlineAbove );
938 :
939 : void DrawWaveLine( const Point& rStartPos, const Point& rEndPos );
940 :
941 : bool ImplDrawRotateText( SalLayout& );
942 :
943 : Rectangle GetTextRect( const Rectangle& rRect,
944 : const OUString& rStr, sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK,
945 : TextRectInfo* pInfo = NULL,
946 : const ::vcl::ITextLayout* _pTextLayout = NULL ) const;
947 :
948 : /** Return the exact bounding rectangle of rStr.
949 :
950 : The text is then drawn exactly from rRect.TopLeft() to
951 : rRect.BottomRight(), don't assume that rRect.TopLeft() is [0, 0].
952 :
953 : Please note that you don't always want to use GetTextBoundRect(); in
954 : many cases you actually want to use GetTextHeight(), because
955 : GetTextBoundRect() gives you the exact bounding rectangle regardless
956 : what is the baseline of the text.
957 :
958 : Code snippet to get just exactly the text (no filling around that) as
959 : a bitmap via a VirtualDevice (regardless what is the baseline):
960 :
961 : <code>
962 : VirtualDevice aDevice;
963 : vcl::Font aFont = aDevice.GetFont();
964 : aFont.SetSize(Size(0, 96));
965 : aFont.SetColor(COL_BLACK);
966 : aDevice.SetFont(aFont);
967 : aDevice.Erase();
968 :
969 : ::Rectangle aRect;
970 : aDevice.GetTextBoundRect(aRect, aText);
971 : aDevice.SetOutputSize(Size(aRect.BottomRight().X() + 1, aRect.BottomRight().Y() + 1));
972 : aDevice.SetBackground(Wallpaper(COL_TRANSPARENT));
973 : aDevice.DrawText(Point(0,0), aText);
974 :
975 : // exactly only the text, regardless of the baseline
976 : Bitmap aBitmap(aDevice.GetBitmap(aRect.TopLeft(), aRect.GetSize()));
977 : </code>
978 :
979 : Code snippet to get the text as a bitmap via a Virtual device that
980 : contains even the filling so that the baseline is always preserved
981 : (ie. the text will not jump up and down according to whether it
982 : contains 'y' or not etc.)
983 :
984 : <code>
985 : VirtualDevice aDevice;
986 : // + the appropriate font / device setup, see above
987 :
988 : aDevice.SetOutputSize(Size(aDevice.GetTextWidth(aText), aDevice.GetTextHeight()));
989 : aDevice.SetBackground(Wallpaper(COL_TRANSPARENT));
990 : aDevice.DrawText(Point(0,0), aText);
991 :
992 : // bitmap that contains even the space around the text,
993 : // that means, preserves the baseline etc.
994 : Bitmap aBitmap(aDevice.GetBitmap(Point(0, 0), aDevice.GetOutputSize()));
995 : </code>
996 : */
997 : bool GetTextBoundRect( Rectangle& rRect,
998 : const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
999 : sal_uLong nLayoutWidth = 0, const long* pDXArray = NULL ) const;
1000 :
1001 : Rectangle ImplGetTextBoundRect( const SalLayout& );
1002 :
1003 : bool GetTextOutline( tools::PolyPolygon&,
1004 : const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0,
1005 : sal_Int32 nLen = -1, bool bOptimize = true,
1006 : sal_uLong nLayoutWidth = 0, const long* pDXArray = NULL ) const;
1007 :
1008 : bool GetTextOutlines( PolyPolyVector&,
1009 : const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0,
1010 : sal_Int32 nLen = -1, bool bOptimize = true,
1011 : sal_uLong nLayoutWidth = 0, const long* pDXArray = NULL ) const;
1012 :
1013 : bool GetTextOutlines( ::basegfx::B2DPolyPolygonVector &rVector,
1014 : const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0,
1015 : sal_Int32 nLen = -1, bool bOptimize = true,
1016 : sal_uLong nLayoutWidth = 0, const long* pDXArray = NULL ) const;
1017 :
1018 :
1019 : OUString GetEllipsisString( const OUString& rStr, long nMaxWidth,
1020 : sal_uInt16 nStyle = TEXT_DRAW_ENDELLIPSIS ) const;
1021 :
1022 : long GetCtrlTextWidth( const OUString& rStr, sal_Int32 nIndex = 0,
1023 : sal_Int32 nLen = -1,
1024 : sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC ) const;
1025 :
1026 : static OUString GetNonMnemonicString( const OUString& rStr, sal_Int32& rMnemonicPos );
1027 :
1028 36042 : static OUString GetNonMnemonicString( const OUString& rStr )
1029 36042 : { sal_Int32 nDummy; return GetNonMnemonicString( rStr, nDummy ); }
1030 :
1031 : /** Generate MetaTextActions for the text rect
1032 :
1033 : This method splits up the text rect into multiple
1034 : MetaTextActions, one for each line of text. This is comparable
1035 : to AddGradientActions(), which splits up a gradient into its
1036 : constituent polygons. Parameter semantics fully compatible to
1037 : DrawText().
1038 : */
1039 : void AddTextRectActions( const Rectangle& rRect,
1040 : const OUString& rOrigStr,
1041 : sal_uInt16 nStyle,
1042 : GDIMetaFile& rMtf );
1043 :
1044 : void SetTextColor( const Color& rColor );
1045 409345 : const Color& GetTextColor() const { return maTextColor; }
1046 :
1047 : void SetTextFillColor();
1048 : void SetTextFillColor( const Color& rColor );
1049 : Color GetTextFillColor() const;
1050 392654 : bool IsTextFillColor() const { return !maFont.IsTransparent(); }
1051 :
1052 : void SetTextLineColor();
1053 : void SetTextLineColor( const Color& rColor );
1054 762391 : const Color& GetTextLineColor() const { return maTextLineColor; }
1055 86735 : bool IsTextLineColor() const { return (maTextLineColor.GetTransparency() == 0); }
1056 :
1057 : void SetOverlineColor();
1058 : void SetOverlineColor( const Color& rColor );
1059 762307 : const Color& GetOverlineColor() const { return maOverlineColor; }
1060 86673 : bool IsOverlineColor() const { return (maOverlineColor.GetTransparency() == 0); }
1061 :
1062 : void SetTextAlign( TextAlign eAlign );
1063 96463 : TextAlign GetTextAlign() const { return maFont.GetAlign(); }
1064 :
1065 : /** Width of the text.
1066 :
1067 : See also GetTextBoundRect() for more explanation + code examples.
1068 : */
1069 : long GetTextWidth( const OUString& rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
1070 :
1071 : /** Height where any character of the current font fits; in logic coordinates.
1072 :
1073 : See also GetTextBoundRect() for more explanation + code examples.
1074 : */
1075 : long GetTextHeight() const;
1076 : float approximate_char_width() const;
1077 :
1078 : void DrawTextArray( const Point& rStartPt, const OUString& rStr,
1079 : const long* pDXAry = NULL,
1080 : sal_Int32 nIndex = 0,
1081 : sal_Int32 nLen = -1,
1082 : int flags = 0);
1083 : long GetTextArray( const OUString& rStr, long* pDXAry = NULL,
1084 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
1085 :
1086 : bool GetCaretPositions( const OUString&, long* pCaretXArray,
1087 : sal_Int32 nIndex, sal_Int32 nLen,
1088 : long* pDXAry = NULL, long nWidth = 0,
1089 : bool bCellBreaking = true ) const;
1090 : void DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
1091 : const OUString& rStr,
1092 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1);
1093 : sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth,
1094 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
1095 : long nCharExtra = 0 ) const;
1096 : sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth,
1097 : sal_Unicode nExtraChar, sal_Int32& rExtraCharPos,
1098 : sal_Int32 nIndex, sal_Int32 nLen,
1099 : long nCharExtra = 0 ) const;
1100 :
1101 : private:
1102 : SAL_DLLPRIVATE void ImplInitTextColor();
1103 :
1104 : SAL_DLLPRIVATE void ImplInitTextLineSize();
1105 : SAL_DLLPRIVATE void ImplInitAboveTextLineSize();
1106 :
1107 :
1108 : SAL_DLLPRIVATE bool ImplDrawTextDirect( SalLayout&, bool bTextLines, sal_uInt32 flags = 0 );
1109 : SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout& );
1110 : SAL_DLLPRIVATE void ImplDrawTextRect( long nBaseX, long nBaseY, long nX, long nY, long nWidth, long nHeight );
1111 :
1112 : SAL_DLLPRIVATE void ImplDrawWavePixel( long nOriginX, long nOriginY, long nCurX, long nCurY, short nOrientation, SalGraphics* pGraphics, OutputDevice* pOutDev,
1113 : bool bDrawPixAsRect, long nPixWidth, long nPixHeight );
1114 : SAL_DLLPRIVATE void ImplDrawWaveLine( long nBaseX, long nBaseY, long nStartX, long nStartY, long nWidth, long nHeight, long nLineWidth, short nOrientation, const Color& rColor );
1115 : SAL_DLLPRIVATE void ImplDrawWaveTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove );
1116 : SAL_DLLPRIVATE void ImplDrawStraightTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove );
1117 : SAL_DLLPRIVATE void ImplDrawStrikeoutLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
1118 : SAL_DLLPRIVATE void ImplDrawStrikeoutChar( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
1119 : SAL_DLLPRIVATE void ImplDrawMnemonicLine( long nX, long nY, long nWidth );
1120 :
1121 : SAL_DLLPRIVATE static bool ImplIsUnderlineAbove( const vcl::Font& );
1122 :
1123 : static
1124 : SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const OUString& rStr, sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout );
1125 : ///@}
1126 :
1127 :
1128 : /** @name Font functions
1129 : */
1130 : ///@{
1131 :
1132 : public:
1133 :
1134 : vcl::FontInfo GetDevFont( int nDevFontIndex ) const;
1135 : int GetDevFontCount() const;
1136 :
1137 : bool IsFontAvailable( const OUString& rFontName ) const;
1138 :
1139 : Size GetDevFontSize( const vcl::Font& rFont, int nSizeIndex ) const;
1140 : int GetDevFontSizeCount( const vcl::Font& ) const;
1141 :
1142 : bool AddTempDevFont( const OUString& rFileURL, const OUString& rFontName );
1143 :
1144 : FontMetric GetFontMetric() const;
1145 : FontMetric GetFontMetric( const vcl::Font& rFont ) const;
1146 :
1147 : bool GetFontCharMap( FontCharMapPtr& rFontCharMap ) const;
1148 : bool GetFontCapabilities( vcl::FontCapabilities& rFontCapabilities ) const;
1149 :
1150 : /** Retrieve detailed font information in platform independent structure
1151 :
1152 : @param nFallbacklevel Fallback font level (0 = best matching font)
1153 :
1154 : @return SystemFontData
1155 : */
1156 : SystemFontData GetSysFontData( int nFallbacklevel ) const;
1157 :
1158 : SAL_DLLPRIVATE void ImplGetEmphasisMark( tools::PolyPolygon& rPolyPoly, bool& rPolyLine, Rectangle& rRect1, Rectangle& rRect2,
1159 : long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short nOrient );
1160 : SAL_DLLPRIVATE static FontEmphasisMark
1161 : ImplGetEmphasisMarkStyle( const vcl::Font& rFont );
1162 :
1163 : bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex,
1164 : int nLen, int nBase, MetricVector& rVector );
1165 :
1166 : sal_Int32 HasGlyphs( const vcl::Font& rFont, const OUString& rStr,
1167 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
1168 :
1169 : long GetMinKashida() const;
1170 :
1171 : // i60594
1172 : // validate kashida positions against the current font
1173 : // returns count of invalid kashida positions
1174 : sal_Int32 ValidateKashidas( const OUString& rTxt, sal_Int32 nIdx, sal_Int32 nLen,
1175 : sal_Int32 nKashCount, // number of suggested kashida positions (in)
1176 : const sal_Int32* pKashidaPos, // suggested kashida positions (in)
1177 : sal_Int32* pKashidaPosDropped // invalid kashida positions (out)
1178 : ) const;
1179 :
1180 : static void BeginFontSubstitution();
1181 : static void EndFontSubstitution();
1182 : static void AddFontSubstitute( const OUString& rFontName,
1183 : const OUString& rReplaceFontName,
1184 : sal_uInt16 nFlags = 0 );
1185 : static void RemoveFontSubstitute( sal_uInt16 n );
1186 : static sal_uInt16 GetFontSubstituteCount();
1187 :
1188 : static vcl::Font GetDefaultFont( sal_uInt16 nType,
1189 : LanguageType eLang,
1190 : sal_uLong nFlags,
1191 : const OutputDevice* pOutDev = NULL );
1192 :
1193 : SAL_DLLPRIVATE void ImplInitFontList() const;
1194 : SAL_DLLPRIVATE void ImplUpdateFontData( bool bNewFontLists );
1195 : SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists );
1196 :
1197 : protected:
1198 :
1199 : virtual void InitFont() const;
1200 : virtual void SetFontOrientation( ImplFontEntry* const pFontEntry ) const;
1201 : virtual long GetFontExtLeading() const;
1202 :
1203 :
1204 : private:
1205 :
1206 : typedef void ( OutputDevice::* FontUpdateHandler_t )( bool );
1207 :
1208 : SAL_DLLPRIVATE bool ImplNewFont() const;
1209 :
1210 : SAL_DLLPRIVATE void ImplClearFontData( bool bNewFontLists );
1211 : SAL_DLLPRIVATE void ImplRefreshFontData( bool bNewFontLists );
1212 : SAL_DLLPRIVATE static void ImplUpdateFontDataForAllFrames( FontUpdateHandler_t pHdl, bool bNewFontLists );
1213 :
1214 : static
1215 : SAL_DLLPRIVATE OUString ImplGetEllipsisString( const OutputDevice& rTargetDevice, const OUString& rStr,
1216 : long nMaxWidth, sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout );
1217 :
1218 : SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const tools::PolyPolygon& rPolyPoly, bool bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 );
1219 : SAL_DLLPRIVATE void ImplDrawEmphasisMarks( SalLayout& );
1220 : ///@}
1221 :
1222 :
1223 : /** @name Layout functions
1224 : */
1225 : ///@{
1226 :
1227 : public:
1228 :
1229 : SystemTextLayoutData GetSysTextLayoutData( const Point& rStartPt, const OUString& rStr,
1230 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
1231 : const long* pDXAry = NULL ) const;
1232 :
1233 : SAL_DLLPRIVATE bool ImplIsAntiparallel() const ;
1234 : SAL_DLLPRIVATE void ReMirror( Point &rPoint ) const;
1235 : SAL_DLLPRIVATE void ReMirror( Rectangle &rRect ) const;
1236 : SAL_DLLPRIVATE void ReMirror( vcl::Region &rRegion ) const;
1237 : SAL_DLLPRIVATE bool ImplIsRecordLayout() const;
1238 : virtual bool HasMirroredGraphics() const;
1239 : SAL_DLLPRIVATE SalLayout* ImplLayout( const OUString&, sal_Int32 nIndex, sal_Int32 nLen,
1240 : const Point& rLogicPos = Point(0,0), long nLogicWidth=0,
1241 : const long* pLogicDXArray=NULL, int flags=0 ) const;
1242 : SAL_DLLPRIVATE ImplLayoutArgs ImplPrepareLayoutArgs( OUString&, const sal_Int32 nIndex, const sal_Int32 nLen,
1243 : DeviceCoordinate nPixelWidth, const DeviceCoordinate* pPixelDXArray, int flags = 0 ) const;
1244 : SAL_DLLPRIVATE SalLayout* ImplGlyphFallbackLayout( SalLayout*, ImplLayoutArgs& ) const;
1245 : // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI
1246 : SAL_DLLPRIVATE SalLayout* getFallbackFont(ImplFontEntry &rFallbackFont,
1247 : FontSelectPattern &rFontSelData, int nFallbackLevel,
1248 : ImplLayoutArgs& rLayoutArgs) const;
1249 :
1250 :
1251 : // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphisLayout
1252 : virtual void EnableRTL( bool bEnable = true);
1253 16233738 : bool IsRTLEnabled() const { return mbEnableRTL; }
1254 :
1255 : bool GetTextIsRTL( const OUString&, sal_Int32 nIndex, sal_Int32 nLen ) const;
1256 :
1257 : ///@}
1258 :
1259 :
1260 : /** @name Bitmap functions
1261 : */
1262 : ///@{
1263 :
1264 : public:
1265 :
1266 : /** @overload
1267 : void DrawBitmap(
1268 : const Point& rDestPt,
1269 : const Size& rDestSize,
1270 : const Point& rSrcPtPixel,
1271 : const Size& rSecSizePixel,
1272 : const Bitmap& rBitmap,
1273 : sal_uLong nAction = META_BMPSCALEPART_ACTION)
1274 : */
1275 : void DrawBitmap(
1276 : const Point& rDestPt,
1277 : const Bitmap& rBitmap );
1278 :
1279 : /** @overload
1280 : void DrawBitmap(
1281 : const Point& rDestPt,
1282 : const Size& rDestSize,
1283 : const Point& rSrcPtPixel,
1284 : const Size& rSecSizePixel,
1285 : const Bitmap& rBitmap,
1286 : sal_uLong nAction = META_BMPSCALEPART_ACTION)
1287 : */
1288 : void DrawBitmap(
1289 : const Point& rDestPt,
1290 : const Size& rDestSize,
1291 : const Bitmap& rBitmap );
1292 :
1293 : void DrawBitmap(
1294 : const Point& rDestPt,
1295 : const Size& rDestSize,
1296 : const Point& rSrcPtPixel,
1297 : const Size& rSrcSizePixel,
1298 : const Bitmap& rBitmap,
1299 : sal_uLong nAction = META_BMPSCALEPART_ACTION );
1300 :
1301 : /** @overload
1302 : void DrawBitmapEx(
1303 : const Point& rDestPt,
1304 : const Size& rDestSize,
1305 : const Point& rSrcPtPixel,
1306 : const Size& rSecSizePixel,
1307 : const BitmapEx& rBitmapEx,
1308 : sal_uLong nAction = META_BMPEXSCALEPART_ACTION)
1309 : */
1310 : void DrawBitmapEx(
1311 : const Point& rDestPt,
1312 : const BitmapEx& rBitmapEx );
1313 :
1314 :
1315 : /** @overload
1316 : void DrawBitmapEx(
1317 : const Point& rDestPt,
1318 : const Size& rDestSize,
1319 : const Point& rSrcPtPixel,
1320 : const Size& rSecSizePixel,
1321 : const BitmapEx& rBitmapEx,
1322 : sal_uLong nAction = META_BMPEXSCALEPART_ACTION)
1323 : */
1324 : void DrawBitmapEx(
1325 : const Point& rDestPt,
1326 : const Size& rDestSize,
1327 : const BitmapEx& rBitmapEx );
1328 :
1329 : void DrawBitmapEx(
1330 : const Point& rDestPt,
1331 : const Size& rDestSize,
1332 : const Point& rSrcPtPixel,
1333 : const Size& rSrcSizePixel,
1334 : const BitmapEx& rBitmapEx,
1335 : sal_uLong nAction = META_BMPEXSCALEPART_ACTION );
1336 :
1337 : /** @overload
1338 : virtual void DrawImage(
1339 : const Point& rPos,
1340 : const Size& rSize,
1341 : const Image& rImage,
1342 : sal_uInt16 nStyle = 0)
1343 : */
1344 : virtual void DrawImage(
1345 : const Point& rPos,
1346 : const Image& rImage,
1347 : sal_uInt16 nStyle = 0 );
1348 :
1349 : virtual void DrawImage(
1350 : const Point& rPos,
1351 : const Size& rSize,
1352 : const Image& rImage,
1353 : sal_uInt16 nStyle = 0 );
1354 :
1355 :
1356 : virtual Bitmap GetBitmap( const Point& rSrcPt, const Size& rSize ) const;
1357 :
1358 : /** Query extended bitmap (with alpha channel, if available).
1359 : */
1360 : BitmapEx GetBitmapEx( const Point& rSrcPt, const Size& rSize ) const;
1361 :
1362 :
1363 : /** Draw BitmapEx transformed
1364 :
1365 : @param rTransformation
1366 : The transformation describing the target positioning of the given bitmap. Transforming
1367 : the unit object coordinates (0, 0, 1, 1) with this matrix is the transformation to
1368 : discrete coordinates
1369 :
1370 : @param rBitmapEx
1371 : The BitmapEx to be painted
1372 : */
1373 : void DrawTransformedBitmapEx(
1374 : const basegfx::B2DHomMatrix& rTransformation,
1375 : const BitmapEx& rBitmapEx);
1376 :
1377 :
1378 : protected:
1379 :
1380 : virtual void DrawDeviceBitmap(
1381 : const Point& rDestPt, const Size& rDestSize,
1382 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
1383 : BitmapEx& rBitmapEx );
1384 :
1385 : virtual void ScaleBitmap ( Bitmap &rBmp, SalTwoRect &rPosAry );
1386 :
1387 : /** Transform and draw a bitmap directly
1388 :
1389 : @param aFullTransform The B2DHomMatrix used for the transformation
1390 : @param rBitmapEx Reference to the bitmap to be transformed and drawn
1391 :
1392 : @return true if it was able to draw the bitmap, false if not
1393 : */
1394 : virtual bool DrawTransformBitmapExDirect(
1395 : const basegfx::B2DHomMatrix& aFullTransform,
1396 : const BitmapEx& rBitmapEx);
1397 :
1398 : /** Transform and reduce the area that needs to be drawn of the bitmap and return the new
1399 : visible range and the maximum area.
1400 :
1401 :
1402 : @param aFullTransform B2DHomMatrix used for transformation
1403 : @param aVisibleRange The new visible area of the bitmap
1404 : @param fMaximumArea The maximum area of the bitmap
1405 :
1406 : @returns true if there is an area to be drawn, otherwise nothing is left to be drawn
1407 : so return false
1408 : */
1409 : virtual bool TransformAndReduceBitmapExToTargetRange(
1410 : const basegfx::B2DHomMatrix& aFullTransform,
1411 : basegfx::B2DRange &aVisibleRange,
1412 : double &fMaximumArea);
1413 :
1414 : private:
1415 :
1416 : SAL_DLLPRIVATE void DrawDeviceAlphaBitmap(
1417 : const Bitmap& rBmp,
1418 : const AlphaMask& rAlpha,
1419 : const Point& rDestPt,
1420 : const Size& rDestSize,
1421 : const Point& rSrcPtPixel,
1422 : const Size& rSrcSizePixel );
1423 :
1424 : SAL_DLLPRIVATE Bitmap BlendBitmap(
1425 : Bitmap& aBmp,
1426 : BitmapReadAccess* pP,
1427 : BitmapReadAccess* pA,
1428 : const sal_Int32 nOffY,
1429 : const sal_Int32 nDstHeight,
1430 : const sal_Int32 nOffX,
1431 : const sal_Int32 nDstWidth,
1432 : const Rectangle& aBmpRect,
1433 : const Size& aOutSz,
1434 : const bool bHMirr,
1435 : const bool bVMirr,
1436 : const long* pMapX,
1437 : const long* pMapY );
1438 :
1439 : SAL_DLLPRIVATE Bitmap BlendBitmapWithAlpha(
1440 : Bitmap& aBmp,
1441 : BitmapReadAccess* pP,
1442 : BitmapReadAccess* pA,
1443 : const Rectangle& aDstRect,
1444 : const sal_Int32 nOffY,
1445 : const sal_Int32 nDstHeight,
1446 : const sal_Int32 nOffX,
1447 : const sal_Int32 nDstWidth,
1448 : const long* pMapX,
1449 : const long* pMapY );
1450 :
1451 : /** Retrieve downsampled and cropped bitmap
1452 :
1453 : @attention This method ignores negative rDstSz values, thus
1454 : mirroring must happen outside this method (e.g. in DrawBitmap)
1455 : */
1456 : SAL_DLLPRIVATE Bitmap GetDownsampledBitmap(
1457 : const Size& rDstSz,
1458 : const Point& rSrcPt,
1459 : const Size& rSrcSz,
1460 : const Bitmap& rBmp,
1461 : long nMaxBmpDPIX,
1462 : long nMaxBmpDPIY );
1463 :
1464 : ///@}
1465 :
1466 :
1467 : /** @name Transparency functions
1468 : */
1469 : ///@{
1470 :
1471 : public:
1472 :
1473 : /** Query availability of alpha channel
1474 :
1475 : @return sal_True, if this device has an alpha channel.
1476 : */
1477 : bool HasAlpha();
1478 :
1479 :
1480 : /** helper method removing transparencies from a metafile (e.g. for printing)
1481 :
1482 : @returns
1483 : true: transparencies were removed
1484 : false: output metafile is unchanged input metafile
1485 :
1486 : @attention this is a member method, so current state can influence the result !
1487 : @attention the output metafile is prepared in pixel mode for the currentOutputDevice
1488 : state. It can not be moved or rotated reliably anymore.
1489 : */
1490 : bool RemoveTransparenciesFromMetaFile(
1491 : 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 : SAL_DLLPRIVATE void ImplPrintTransparent (
1499 : const Bitmap& rBmp, const Bitmap& rMask,
1500 : const Point& rDestPt, const Size& rDestSize,
1501 : const Point& rSrcPtPixel, const Size& rSrcSizePixel );
1502 :
1503 : SAL_DLLPRIVATE Color ImplDrawModeToColor ( const Color& rColor ) const;
1504 :
1505 :
1506 : /** Query the existence and depth of the alpha channel
1507 :
1508 : @return 0, if no alpha channel available, and the bit depth of
1509 : the alpha channel otherwise.
1510 : */
1511 : virtual sal_uInt16 GetAlphaBitCount() const;
1512 :
1513 :
1514 : void DrawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
1515 : void DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency);
1516 : void DrawTransparent(
1517 : const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize,
1518 : const Gradient& rTransparenceGradient );
1519 :
1520 : protected:
1521 :
1522 : virtual void EmulateDrawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
1523 : void DrawInvisiblePolygon( const tools::PolyPolygon& rPolyPoly );
1524 :
1525 : private:
1526 :
1527 : SAL_DLLPRIVATE bool DrawTransparentNatively( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
1528 : ///@}
1529 :
1530 :
1531 : /** @name Mask functions
1532 : */
1533 : ///@{
1534 :
1535 : public:
1536 :
1537 : void DrawMask( const Point& rDestPt,
1538 : const Bitmap& rBitmap, const Color& rMaskColor );
1539 :
1540 : void DrawMask( const Point& rDestPt, const Size& rDestSize,
1541 : const Bitmap& rBitmap, const Color& rMaskColor );
1542 :
1543 : void DrawMask( const Point& rDestPt, const Size& rDestSize,
1544 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
1545 : const Bitmap& rBitmap, const Color& rMaskColor,
1546 : sal_uLong nAction );
1547 :
1548 : protected:
1549 :
1550 : virtual void DrawDeviceMask (
1551 : const Bitmap& rMask, const Color& rMaskColor,
1552 : const Point& rDestPt, const Size& rDestSize,
1553 : const Point& rSrcPtPixel, const Size& rSrcSizePixel );
1554 : ///@}
1555 :
1556 :
1557 : /** @name Map functions
1558 : */
1559 : ///@{
1560 :
1561 : public:
1562 :
1563 : void EnableMapMode( bool bEnable = true );
1564 1125123 : bool IsMapModeEnabled() const { return mbMap; }
1565 :
1566 : virtual void SetMapMode();
1567 : virtual void SetMapMode( const MapMode& rNewMapMode );
1568 : virtual void SetRelativeMapMode( const MapMode& rNewMapMode );
1569 1146908 : const MapMode& GetMapMode() const { return maMapMode; }
1570 127377 : bool IsMapMode() const { return mbMap; }
1571 :
1572 : // #i75163#
1573 : basegfx::B2DHomMatrix GetViewTransformation() const;
1574 : basegfx::B2DHomMatrix GetInverseViewTransformation() const;
1575 :
1576 : basegfx::B2DHomMatrix GetViewTransformation( const MapMode& rMapMode ) const;
1577 : basegfx::B2DHomMatrix GetInverseViewTransformation( const MapMode& rMapMode ) const;
1578 :
1579 :
1580 : /** Set an offset in pixel
1581 :
1582 : This method offsets every drawing operation that converts its
1583 : coordinates to pixel by the given value. Normally, the effect
1584 : can be achieved by setting a MapMode with a different
1585 : origin. Unfortunately, this origin is in logical coordinates
1586 : and can lead to rounding errors (see #102532# for details).
1587 :
1588 : @attention This offset is only applied when converting to
1589 : pixel, i.e. some output modes such as metafile recordings
1590 : might be completely unaffected by this method! Use with
1591 : care. Furthermore, if the OutputDevice's MapMode is the
1592 : default (that's MAP_PIXEL), then any pixel offset set is
1593 : ignored also. This might be unintuitive for cases, but would
1594 : have been far more fragile to implement. What's more, the
1595 : reason why the pixel offset was introduced (avoiding rounding
1596 : errors) does not apply for MAP_PIXEL, because one can always
1597 : use the MapMode origin then.
1598 :
1599 : @param rOffset
1600 : The offset in pixel
1601 : */
1602 : void SetPixelOffset( const Size& rOffset );
1603 :
1604 : /** Get the offset in pixel
1605 :
1606 : @see OutputDevice::SetPixelOffset for details
1607 :
1608 : @return the current offset in pixel
1609 : */
1610 334 : Size GetPixelOffset() const { return Size(mnOutOffOrigX, mnOutOffOrigY);}
1611 :
1612 : Point LogicToPixel( const Point& rLogicPt ) const;
1613 : Size LogicToPixel( const Size& rLogicSize ) const;
1614 : Rectangle LogicToPixel( const Rectangle& rLogicRect ) const;
1615 : Polygon LogicToPixel( const Polygon& rLogicPoly ) const;
1616 : tools::PolyPolygon LogicToPixel( const tools::PolyPolygon& rLogicPolyPoly ) const;
1617 : basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly ) const;
1618 : vcl::Region LogicToPixel( const vcl::Region& rLogicRegion )const;
1619 : Point LogicToPixel( const Point& rLogicPt,
1620 : const MapMode& rMapMode ) const;
1621 : Size LogicToPixel( const Size& rLogicSize,
1622 : const MapMode& rMapMode ) const;
1623 : Rectangle LogicToPixel( const Rectangle& rLogicRect,
1624 : const MapMode& rMapMode ) const;
1625 : Polygon LogicToPixel( const Polygon& rLogicPoly,
1626 : const MapMode& rMapMode ) const;
1627 : basegfx::B2DPolygon LogicToPixel( const basegfx::B2DPolygon& rLogicPoly,
1628 : const MapMode& rMapMode ) const;
1629 : tools::PolyPolygon LogicToPixel( const tools::PolyPolygon& rLogicPolyPoly,
1630 : const MapMode& rMapMode ) const;
1631 : basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly,
1632 : const MapMode& rMapMode ) const;
1633 : vcl::Region LogicToPixel( const vcl::Region& rLogicRegion,
1634 : const MapMode& rMapMode ) const;
1635 : basegfx::B2DPolygon LogicToPixel( const basegfx::B2DPolygon& rLogicPoly ) const;
1636 :
1637 : Point PixelToLogic( const Point& rDevicePt ) const;
1638 : Size PixelToLogic( const Size& rDeviceSize ) const;
1639 : Rectangle PixelToLogic( const Rectangle& rDeviceRect ) const;
1640 : Polygon PixelToLogic( const Polygon& rDevicePoly ) const;
1641 : tools::PolyPolygon PixelToLogic( const tools::PolyPolygon& rDevicePolyPoly ) const;
1642 : basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly ) const;
1643 : vcl::Region PixelToLogic( const vcl::Region& rDeviceRegion ) const;
1644 : Point PixelToLogic( const Point& rDevicePt,
1645 : const MapMode& rMapMode ) const;
1646 : Size PixelToLogic( const Size& rDeviceSize,
1647 : const MapMode& rMapMode ) const;
1648 : Rectangle PixelToLogic( const Rectangle& rDeviceRect,
1649 : const MapMode& rMapMode ) const;
1650 : Polygon PixelToLogic( const Polygon& rDevicePoly,
1651 : const MapMode& rMapMode ) const;
1652 : basegfx::B2DPolygon PixelToLogic( const basegfx::B2DPolygon& rDevicePoly,
1653 : const MapMode& rMapMode ) const;
1654 : tools::PolyPolygon PixelToLogic( const tools::PolyPolygon& rDevicePolyPoly,
1655 : const MapMode& rMapMode ) const;
1656 : basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly,
1657 : const MapMode& rMapMode ) const;
1658 : vcl::Region PixelToLogic( const vcl::Region& rDeviceRegion,
1659 : const MapMode& rMapMode ) const;
1660 :
1661 : Point LogicToLogic( const Point& rPtSource,
1662 : const MapMode* pMapModeSource,
1663 : const MapMode* pMapModeDest ) const;
1664 : Size LogicToLogic( const Size& rSzSource,
1665 : const MapMode* pMapModeSource,
1666 : const MapMode* pMapModeDest ) const;
1667 : Rectangle LogicToLogic( const Rectangle& rRectSource,
1668 : const MapMode* pMapModeSource,
1669 : const MapMode* pMapModeDest ) const;
1670 : static Point LogicToLogic( const Point& rPtSource,
1671 : const MapMode& rMapModeSource,
1672 : const MapMode& rMapModeDest );
1673 : static Size LogicToLogic( const Size& rSzSource,
1674 : const MapMode& rMapModeSource,
1675 : const MapMode& rMapModeDest );
1676 : static Rectangle LogicToLogic( const Rectangle& rRectSource,
1677 : const MapMode& rMapModeSource,
1678 : const MapMode& rMapModeDest );
1679 : static long LogicToLogic( long nLongSource,
1680 : MapUnit eUnitSource,
1681 : MapUnit eUnitDest );
1682 :
1683 : static basegfx::B2DPolygon LogicToLogic( const basegfx::B2DPolygon& rPoly,
1684 : const MapMode& rMapModeSource,
1685 : const MapMode& rMapModeDest );
1686 : static basegfx::B2DPolyPolygon LogicToLogic( const basegfx::B2DPolyPolygon& rPolyPoly,
1687 : const MapMode& rMapModeSource,
1688 : const MapMode& rMapModeDest );
1689 :
1690 : // create a mapping transformation from rMapModeSource to rMapModeDest (the above methods
1691 : // for B2DPoly/Polygons use this internally anyway to transform the B2DPolygon)
1692 : static basegfx::B2DHomMatrix LogicToLogic(const MapMode& rMapModeSource, const MapMode& rMapModeDest);
1693 :
1694 : /** Convert a logical rectangle to a rectangle in physical device pixel units.
1695 :
1696 : @param rLogicSize Const reference to a rectangle in logical units
1697 :
1698 : @returns Rectangle based on physical device pixel coordinates and units.
1699 : */
1700 : SAL_DLLPRIVATE Rectangle ImplLogicToDevicePixel( const Rectangle& rLogicRect ) const;
1701 :
1702 : /** Convert a logical point to a physical point on the device.
1703 :
1704 : @param rLogicPt Const reference to a point in logical units.
1705 :
1706 : @returns Physical point on the device.
1707 : */
1708 : SAL_DLLPRIVATE Point ImplLogicToDevicePixel( const Point& rLogicPt ) const;
1709 :
1710 : /** Convert a logical width to a width in units of device pixels.
1711 :
1712 : To get the number of device pixels, it must calculate the X-DPI of the device and
1713 : the map scaling factor. If there is no mapping, then it just returns the
1714 : width as nothing more needs to be done.
1715 :
1716 : @param nWidth Logical width
1717 :
1718 : @returns Width in units of device pixels.
1719 : */
1720 : SAL_DLLPRIVATE long ImplLogicWidthToDevicePixel( long nWidth ) const;
1721 :
1722 : SAL_DLLPRIVATE DeviceCoordinate LogicWidthToDeviceCoordinate( long nWidth ) const;
1723 : SAL_DLLPRIVATE DeviceCoordinate LogicHeightToDeviceCoordinate( long nHeight ) const;
1724 :
1725 : private:
1726 :
1727 : /** Convert a logical X coordinate to a device pixel's X coordinate.
1728 :
1729 : To get the device's X coordinate, it must calculate the mapping offset
1730 : coordinate X position (if there is one - if not then it just adds
1731 : the pseudo-window offset to the logical X coordinate), the X-DPI of
1732 : the device and the mapping's X scaling factor.
1733 :
1734 : @param nX Logical X coordinate
1735 :
1736 : @returns Device's X pixel coordinate
1737 : */
1738 : SAL_DLLPRIVATE long ImplLogicXToDevicePixel( long nX ) const;
1739 :
1740 : /** Convert a logical Y coordinate to a device pixel's Y coordinate.
1741 :
1742 : To get the device's Y coordinate, it must calculate the mapping offset
1743 : coordinate Y position (if there is one - if not then it just adds
1744 : the pseudo-window offset to the logical Y coordinate), the Y-DPI of
1745 : the device and the mapping's Y scaling factor.
1746 :
1747 : @param nY Logical Y coordinate
1748 :
1749 : @returns Device's Y pixel coordinate
1750 : */
1751 : SAL_DLLPRIVATE long ImplLogicYToDevicePixel( long nY ) const;
1752 :
1753 : /** Convert a logical height to a height in units of device pixels.
1754 :
1755 : To get the number of device pixels, it must calculate the Y-DPI of the device and
1756 : the map scaling factor. If there is no mapping, then it just returns the
1757 : height as nothing more needs to be done.
1758 :
1759 : @param nHeight Logical height
1760 :
1761 : @returns Height in units of device pixels.
1762 : */
1763 : SAL_DLLPRIVATE long ImplLogicHeightToDevicePixel( long nHeight ) const;
1764 :
1765 : /** Convert device pixels to a width in logical units.
1766 :
1767 : To get the logical width, it must calculate the X-DPI of the device and the
1768 : map scaling factor.
1769 :
1770 : @param nWidth Width in device pixels
1771 :
1772 : @returns Width in logical units.
1773 : */
1774 : SAL_DLLPRIVATE long ImplDevicePixelToLogicWidth( long nWidth ) const;
1775 :
1776 : /** Convert device pixels to a height in logical units.
1777 :
1778 : To get the logical height, it must calculate the Y-DPI of the device and the
1779 : map scaling factor.
1780 :
1781 : @param nHeight Height in device pixels
1782 :
1783 : @returns Height in logical units.
1784 : */
1785 : SAL_DLLPRIVATE long ImplDevicePixelToLogicHeight( long nHeight ) const;
1786 :
1787 : /** Convert logical height to device pixels, with exact sub-pixel value.
1788 :
1789 : To get the \em exact pixel height, it must calculate the Y-DPI of the device and the
1790 : map scaling factor.
1791 :
1792 : @param nHeight Exact height in logical units.
1793 :
1794 : @returns Exact height in pixels - returns as a float to provide for subpixel value.
1795 : */
1796 : SAL_DLLPRIVATE float ImplFloatLogicHeightToDevicePixel( float ) const;
1797 :
1798 : /** Convert a logical size to the size on the physical device.
1799 :
1800 : @param rLogicSize Const reference to a size in logical units
1801 :
1802 : @returns Physical size on the device.
1803 : */
1804 : SAL_DLLPRIVATE Size ImplLogicToDevicePixel( const Size& rLogicSize ) const;
1805 :
1806 : /** Convert a rectangle in physical pixel units to a rectangle in physical pixel units and coords.
1807 :
1808 : @param rPixelRect Const reference to rectangle in logical units and coords.
1809 :
1810 : @returns Rectangle based on logical coordinates and units.
1811 : */
1812 : SAL_DLLPRIVATE Rectangle ImplDevicePixelToLogic( const Rectangle& rPixelRect ) const;
1813 :
1814 : /** Convert a logical B2DPolygon to a B2DPolygon in physical device pixel units.
1815 :
1816 : @param rLogicSize Const reference to a B2DPolygon in logical units
1817 :
1818 : @returns B2DPolyPolygon based on physical device pixel coordinates and units.
1819 : */
1820 : SAL_DLLPRIVATE ::basegfx::B2DPolygon ImplLogicToDevicePixel( const ::basegfx::B2DPolygon& rLogicPoly ) const;
1821 :
1822 : /** Convert a logical B2DPolyPolygon to a B2DPolyPolygon in physical device pixel units.
1823 :
1824 : @param rLogicPolyPoly Const reference to a B2DPolyPolygon in logical units
1825 :
1826 : @returns B2DPolyPolygon based on physical device pixel coordinates and units.
1827 : */
1828 : SAL_DLLPRIVATE ::basegfx::B2DPolyPolygon ImplLogicToDevicePixel( const ::basegfx::B2DPolyPolygon& rLogicPolyPoly ) const;
1829 :
1830 : /** Convert a logical polygon to a polygon in physical device pixel units.
1831 :
1832 : @param rLogicPoly Const reference to a polygon in logical units
1833 :
1834 : @returns Polygon based on physical device pixel coordinates and units.
1835 : */
1836 : SAL_DLLPRIVATE Polygon ImplLogicToDevicePixel( const Polygon& rLogicPoly ) const;
1837 :
1838 : /** Convert a logical polypolygon to a polypolygon in physical device pixel units.
1839 :
1840 : @param rLogicPolyPoly Const reference to a polypolygon in logical units
1841 :
1842 : @returns Polypolygon based on physical device pixel coordinates and units.
1843 : */
1844 : SAL_DLLPRIVATE tools::PolyPolygon ImplLogicToDevicePixel( const tools::PolyPolygon& rLogicPolyPoly ) const;
1845 :
1846 : /** Convert a line in logical units to a line in physical device pixel units.
1847 :
1848 : @param rLineInfo Const refernece to a line in logical units
1849 :
1850 : @returns Line based on physical device pixel coordinates and units.
1851 : */
1852 : SAL_DLLPRIVATE LineInfo ImplLogicToDevicePixel( const LineInfo& rLineInfo ) const;
1853 :
1854 : /** Convert a region in pixel units to a region in device pixel units and coords.
1855 :
1856 : @param rPixelRect Const reference to region.
1857 :
1858 : @returns vcl::Region based on device pixel coordinates and units.
1859 : */
1860 : SAL_DLLPRIVATE vcl::Region ImplPixelToDevicePixel( const vcl::Region& rRegion ) const;
1861 :
1862 : /** Invalidate the view transformation.
1863 :
1864 : @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212)
1865 : */
1866 : SAL_DLLPRIVATE void ImplInvalidateViewTransform();
1867 :
1868 : /** Get device transformation.
1869 :
1870 : @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212)
1871 : */
1872 : SAL_DLLPRIVATE basegfx::B2DHomMatrix ImplGetDeviceTransformation() const;
1873 : ///@}
1874 :
1875 :
1876 : /** @name Native Widget Rendering functions
1877 :
1878 : These all just call through to the private mpGraphics functions of the same name.
1879 : */
1880 : ///@{
1881 :
1882 : public:
1883 :
1884 : /** Query the platform layer for control support
1885 : */
1886 : bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) const;
1887 :
1888 : /** Query the native control to determine if it was acted upon
1889 : */
1890 : bool HitTestNativeControl(
1891 : ControlType nType,
1892 : ControlPart nPart,
1893 : const Rectangle& rControlRegion,
1894 : const Point& aPos,
1895 : bool& rIsInside ) const;
1896 :
1897 : /** Request rendering of a particular control and/or part
1898 : */
1899 : bool DrawNativeControl(
1900 : ControlType nType,
1901 : ControlPart nPart,
1902 : const Rectangle& rControlRegion,
1903 : ControlState nState,
1904 : const ImplControlValue& aValue,
1905 : const OUString& aCaption );
1906 :
1907 : /** Query the native control's actual drawing region (including adornment)
1908 : */
1909 : bool GetNativeControlRegion(
1910 : ControlType nType,
1911 : ControlPart nPart,
1912 : const Rectangle& rControlRegion,
1913 : ControlState nState,
1914 : const ImplControlValue& aValue,
1915 : const OUString& aCaption,
1916 : Rectangle &rNativeBoundingRegion,
1917 : Rectangle &rNativeContentRegion ) const;
1918 : ///@}
1919 :
1920 : /** @name EPS functions
1921 : */
1922 : ///@{
1923 :
1924 : public:
1925 :
1926 : /** @returns boolean value to see if EPS could be painted directly.
1927 : Theoreticaly, handing over a matrix would be needed to handle
1928 : painting rotated EPS files (e.g. contained in Metafiles). This
1929 : would then need to be supported for Mac and PS printers, but
1930 : that's too much for now, wrote \#i107046# for this */
1931 : bool DrawEPS(
1932 : const Point& rPt, const Size& rSz,
1933 : const GfxLink& rGfxLink, GDIMetaFile* pSubst = NULL );
1934 : ///@}
1935 :
1936 : };
1937 :
1938 : #endif // INCLUDED_VCL_OUTDEV_HXX
1939 :
1940 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|