Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / vcl / outdev.hxx
blobd6a7032f20dd49dc17da387abec073f03edbe1b8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_OUTDEV_HXX
21 #define INCLUDED_VCL_OUTDEV_HXX
23 #include <tools/gen.hxx>
24 #include <tools/solar.h>
25 #include <tools/color.hxx>
26 #include <tools/poly.hxx>
27 #include <o3tl/typed_flags_set.hxx>
29 #include <vcl/cairo.hxx>
30 #include <vcl/devicecoordinate.hxx>
31 #include <vcl/dllapi.h>
32 #include <vcl/font.hxx>
33 #include <vcl/region.hxx>
34 #include <vcl/mapmod.hxx>
35 #include <vcl/wall.hxx>
36 #include <vcl/metaact.hxx>
37 #include <vcl/metaactiontypes.hxx>
38 #include <vcl/salnativewidgets.hxx>
39 #include <vcl/outdevstate.hxx>
40 #include <vcl/outdevmap.hxx>
41 #include <vcl/vclreferencebase.hxx>
43 #include <basegfx/numeric/ftools.hxx>
44 #include <basegfx/vector/b2enums.hxx>
45 #include <basegfx/polygon/b2dpolypolygon.hxx>
47 #include <unotools/fontdefs.hxx>
49 #include <com/sun/star/drawing/LineCap.hpp>
50 #include <com/sun/star/uno/Reference.h>
52 #include <memory>
53 #include <vector>
55 struct ImplOutDevData;
56 class LogicalFontInstance;
57 class OutDevState;
58 struct SystemGraphicsData;
59 struct SystemFontData;
60 struct SystemTextLayoutData;
61 class ImplFontCache;
62 class PhysicalFontCollection;
63 class ImplDeviceFontList;
64 class ImplDeviceFontSizeList;
65 class ImplMultiTextLineInfo;
66 class SalGraphics;
67 class Gradient;
68 class Hatch;
69 class AllSettings;
70 class Bitmap;
71 class BitmapReadAccess;
72 class BitmapEx;
73 class Image;
74 class TextRectInfo;
75 class FontMetric;
76 class GDIMetaFile;
77 class GfxLink;
78 namespace tools {
79 class Line;
81 class LineInfo;
82 class AlphaMask;
83 class FontCharMap;
84 class SalLayout;
85 class ImplLayoutArgs;
86 class VirtualDevice;
87 struct SalTwoRect;
88 class VirtualDevice;
89 class Printer;
90 class FontSelectPattern;
91 class VCLXGraphics;
92 class OutDevStateStack;
93 struct BitmapSystemData;
95 namespace vcl
97 class PDFWriterImpl;
98 class ExtOutDevData;
99 class ITextLayout;
100 struct FontCapabilities;
101 class TextLayoutCache;
102 class Window;
103 class FontInfo;
106 namespace com { namespace sun { namespace star { namespace rendering {
107 class XCanvas;
108 }}}}
110 namespace basegfx {
111 class B2DHomMatrix;
112 class B2DPolygon;
113 class B2DPolyPolygon;
114 class B2IVector;
115 typedef B2IVector B2ISize;
118 namespace com { namespace sun { namespace star { namespace awt {
119 class XGraphics;
120 } } } }
122 #if defined UNX
123 #define GLYPH_FONT_HEIGHT 128
124 #else
125 #define GLYPH_FONT_HEIGHT 256
126 #endif
128 // Text Layout options
129 enum class SalLayoutFlags
131 NONE = 0x0000,
132 BiDiRtl = 0x0001,
133 BiDiStrong = 0x0002,
134 RightAlign = 0x0004,
135 DisableKerning = 0x0010,
136 KerningAsian = 0x0020,
137 Vertical = 0x0040,
138 EnableLigatures = 0x0200,
139 SubstituteDigits = 0x0400,
140 KashidaJustification = 0x0800,
141 ForFallback = 0x2000,
143 namespace o3tl
145 template<> struct typed_flags<SalLayoutFlags> : is_typed_flags<SalLayoutFlags, 0x2e77> {};
148 typedef std::vector< tools::Rectangle > MetricVector;
150 // OutputDevice-Types
152 // Flags for DrawText()
153 enum class DrawTextFlags
155 NONE = 0x00000000,
156 Disable = 0x00000001,
157 Mnemonic = 0x00000002,
158 Mono = 0x00000004,
159 Clip = 0x00000008,
160 Left = 0x00000010,
161 Center = 0x00000020,
162 Right = 0x00000040,
163 Top = 0x00000080,
164 VCenter = 0x00000100,
165 Bottom = 0x00000200,
166 EndEllipsis = 0x00000400,
167 PathEllipsis = 0x00000800,
168 MultiLine = 0x00001000,
169 WordBreak = 0x00002000,
170 NewsEllipsis = 0x00004000,
171 WordBreakHyphenation = 0x00008000 | WordBreak,
172 CenterEllipsis = 0x00010000,
173 HideMnemonic = 0x00020000,
175 namespace o3tl
177 template<> struct typed_flags<DrawTextFlags> : is_typed_flags<DrawTextFlags, 0x3ffff> {};
180 // Flags for DrawImage(), these must match the definitions in css::awt::ImageDrawMode
181 enum class DrawImageFlags
183 NONE = 0x0000,
184 Disable = 0x0001,
185 Highlight = 0x0002,
186 Deactive = 0x0004,
187 ColorTransform = 0x0008,
188 SemiTransparent = 0x0010,
190 namespace o3tl
192 template<> struct typed_flags<DrawImageFlags> : is_typed_flags<DrawImageFlags, 0x001f> {};
195 // Flags for DrawGrid()
196 enum class DrawGridFlags
198 NONE = 0x0000,
199 Dots = 0x0001,
200 HorzLines = 0x0002,
201 VertLines = 0x0004
203 namespace o3tl
205 template<> struct typed_flags<DrawGridFlags> : is_typed_flags<DrawGridFlags, 0x0007> {};
208 // DrawModes
209 enum class DrawModeFlags : sal_uLong
211 Default = 0x00000000,
212 BlackLine = 0x00000001,
213 BlackFill = 0x00000002,
214 BlackText = 0x00000004,
215 BlackBitmap = 0x00000008,
216 BlackGradient = 0x00000010,
217 GrayLine = 0x00000020,
218 GrayFill = 0x00000040,
219 GrayText = 0x00000080,
220 GrayBitmap = 0x00000100,
221 GrayGradient = 0x00000200,
222 NoFill = 0x00000400,
223 NoBitmap = 0x00000800,
224 NoGradient = 0x00001000,
225 GhostedLine = 0x00002000,
226 GhostedFill = 0x00004000,
227 GhostedText = 0x00008000,
228 GhostedBitmap = 0x00010000,
229 GhostedGradient = 0x00020000,
230 WhiteLine = 0x00100000,
231 WhiteFill = 0x00200000,
232 WhiteText = 0x00400000,
233 WhiteBitmap = 0x00800000,
234 WhiteGradient = 0x01000000,
235 SettingsLine = 0x02000000,
236 SettingsFill = 0x04000000,
237 SettingsText = 0x08000000,
238 SettingsGradient = 0x10000000,
239 NoTransparency = 0x80000000,
241 namespace o3tl
243 template<> struct typed_flags<DrawModeFlags> : is_typed_flags<DrawModeFlags, 0x9ff3ffff> {};
246 // Antialiasing
247 enum class AntialiasingFlags
249 NONE = 0x0000,
250 DisableText = 0x0001,
251 EnableB2dDraw = 0x0002,
252 PixelSnapHairline = 0x0004,
254 namespace o3tl
256 template<> struct typed_flags<AntialiasingFlags> : is_typed_flags<AntialiasingFlags, 0x07> {};
259 // AddFontSubstitute() flags
260 enum class AddFontSubstituteFlags
262 NONE = 0x00,
263 ALWAYS = 0x01,
264 ScreenOnly = 0x02,
266 namespace o3tl
268 template<> struct typed_flags<AddFontSubstituteFlags> : is_typed_flags<AddFontSubstituteFlags, 0x03> {};
271 // GetDefaultFont() flags
272 enum class GetDefaultFontFlags
274 NONE = 0x0000,
275 OnlyOne = 0x0001,
277 namespace o3tl
279 template<> struct typed_flags<GetDefaultFontFlags> : is_typed_flags<GetDefaultFontFlags, 0x01> {};
282 // Flags for Invert()
283 enum class InvertFlags
285 NONE = 0x0000,
286 Highlight = 0x0001,
287 N50 = 0x0002,
289 namespace o3tl
291 template<> struct typed_flags<InvertFlags> : is_typed_flags<InvertFlags, 0x0003> {};
294 enum OutDevType { OUTDEV_DONTKNOW, OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV };
296 enum class OutDevViewType { DontKnow, PrintPreview, SlideShow };
298 // OutputDevice
300 typedef tools::SvRef<FontCharMap> FontCharMapRef;
302 BmpMirrorFlags AdjustTwoRect( SalTwoRect& rTwoRect, const Size& rSizePix );
303 void AdjustTwoRect( SalTwoRect& rTwoRect, const tools::Rectangle& rValidSrcRect );
305 class OutputDevice;
307 namespace vcl {
308 typedef OutputDevice RenderContext;
312 * Some things multiple-inherit from VclAbstractDialog and OutputDevice,
313 * so we need to use virtual inheritance to keep the referencing counting
314 * OK.
316 class VCL_DLLPUBLIC OutputDevice : public virtual VclReferenceBase
318 friend class Printer;
319 friend class VirtualDevice;
320 friend class vcl::Window;
321 friend class WorkWindow;
322 friend class vcl::PDFWriterImpl;
323 friend void ImplHandleResize( vcl::Window* pWindow, long nNewWidth, long nNewHeight );
325 private:
326 OutputDevice(const OutputDevice&) = delete;
327 OutputDevice& operator=(const OutputDevice&) = delete;
329 mutable SalGraphics* mpGraphics; ///< Graphics context to draw on
330 mutable VclPtr<OutputDevice> mpPrevGraphics; ///< Previous output device in list
331 mutable VclPtr<OutputDevice> mpNextGraphics; ///< Next output device in list
332 GDIMetaFile* mpMetaFile;
333 mutable LogicalFontInstance* mpFontInstance;
334 mutable ImplFontCache* mpFontCache;
335 mutable PhysicalFontCollection* mpFontCollection;
336 mutable ImplDeviceFontList* mpDeviceFontList;
337 mutable ImplDeviceFontSizeList* mpDeviceFontSizeList;
338 OutDevStateStack* mpOutDevStateStack;
339 ImplOutDevData* mpOutDevData;
340 std::vector< VCLXGraphics* >* mpUnoGraphicsList;
341 vcl::PDFWriterImpl* mpPDFWriter;
342 vcl::ExtOutDevData* mpExtOutDevData;
344 // TEMP TEMP TEMP
345 VclPtr<VirtualDevice> mpAlphaVDev;
347 /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
348 long mnOutOffOrigX;
349 /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
350 long mnOutOffLogicX;
351 /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
352 long mnOutOffOrigY;
353 /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
354 long mnOutOffLogicY;
355 /// Output offset for device output in pixel (pseudo window offset within window system's frames)
356 long mnOutOffX;
357 /// Output offset for device output in pixel (pseudo window offset within window system's frames)
358 long mnOutOffY;
359 long mnOutWidth;
360 long mnOutHeight;
361 sal_Int32 mnDPIX;
362 sal_Int32 mnDPIY;
363 sal_Int32 mnDPIScalePercentage; ///< For Hi-DPI displays, we want to draw elements for a percentage larger
364 /// font specific text alignment offsets in pixel units
365 mutable long mnTextOffX;
366 mutable long mnTextOffY;
367 mutable long mnEmphasisAscent;
368 mutable long mnEmphasisDescent;
369 DrawModeFlags mnDrawMode;
370 ComplexTextLayoutFlags mnTextLayoutMode;
371 ImplMapRes maMapRes;
372 ImplThresholdRes maThresRes;
373 OutDevType meOutDevType;
374 OutDevViewType meOutDevViewType;
375 vcl::Region maRegion; // contains the clip region, see SetClipRegion(...)
376 Color maLineColor;
377 Color maFillColor;
378 vcl::Font maFont;
379 Color maTextColor;
380 Color maTextLineColor;
381 Color maOverlineColor;
382 TextAlign meTextAlign;
383 RasterOp meRasterOp;
384 Wallpaper maBackground;
385 std::unique_ptr<AllSettings> mxSettings;
386 MapMode maMapMode;
387 Point maRefPoint;
388 AntialiasingFlags mnAntialiasing;
389 LanguageType meTextLanguage;
391 mutable bool mbMap : 1;
392 mutable bool mbClipRegion : 1;
393 mutable bool mbBackground : 1;
394 mutable bool mbOutput : 1;
395 mutable bool mbDevOutput : 1;
396 mutable bool mbOutputClipped : 1;
397 mutable bool mbLineColor : 1;
398 mutable bool mbFillColor : 1;
399 mutable bool mbInitLineColor : 1;
400 mutable bool mbInitFillColor : 1;
401 mutable bool mbInitFont : 1;
402 mutable bool mbInitTextColor : 1;
403 mutable bool mbInitClipRegion : 1;
404 mutable bool mbClipRegionSet : 1;
405 mutable bool mbNewFont : 1;
406 mutable bool mbTextLines : 1;
407 mutable bool mbTextSpecial : 1;
408 mutable bool mbRefPoint : 1;
409 mutable bool mbEnableRTL : 1;
411 /** @name Initialization and accessor functions
413 ///@{
415 protected:
416 OutputDevice();
417 virtual ~OutputDevice() override;
418 virtual void dispose() override;
420 public:
422 /** Get the graphic context that the output device uses to draw on.
424 If no graphics device exists, then initialize it.
426 @returns SalGraphics instance.
428 SalGraphics const *GetGraphics() const;
429 SalGraphics* GetGraphics();
431 void SetConnectMetaFile( GDIMetaFile* pMtf );
432 GDIMetaFile* GetConnectMetaFile() const { return mpMetaFile; }
434 virtual void SetSettings( const AllSettings& rSettings );
435 const AllSettings& GetSettings() const { return *mxSettings; }
437 SystemGraphicsData GetSystemGfxData() const;
438 bool SupportsCairo() const;
439 /// Create Surface from given cairo surface
440 cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const;
441 /// Create surface with given dimensions
442 cairo::SurfaceSharedPtr CreateSurface(int x, int y, int width, int height) const;
443 /// Create Surface for given bitmap data
444 cairo::SurfaceSharedPtr CreateBitmapSurface(const BitmapSystemData& rData, const Size& rSize) const;
445 /// Return native handle for underlying surface
446 css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const;
447 css::uno::Any GetSystemGfxDataAny() const;
449 void SetRefPoint();
450 void SetRefPoint( const Point& rRefPoint );
451 const Point& GetRefPoint() const { return maRefPoint; }
452 bool IsRefPoint() const { return mbRefPoint; }
454 virtual sal_uInt16 GetBitCount() const;
456 Size GetOutputSizePixel() const
457 { return Size( mnOutWidth, mnOutHeight ); }
458 long GetOutputWidthPixel() const { return mnOutWidth; }
459 long GetOutputHeightPixel() const { return mnOutHeight; }
460 long GetOutOffXPixel() const { return mnOutOffX; }
461 long GetOutOffYPixel() const { return mnOutOffY; }
462 void SetOutOffXPixel(long nOutOffX);
463 void SetOutOffYPixel(long nOutOffY);
465 Size GetOutputSize() const
466 { return PixelToLogic( GetOutputSizePixel() ); }
468 sal_uLong GetColorCount() const;
471 css::uno::Reference< css::awt::XGraphics >
472 CreateUnoGraphics();
473 std::vector< VCLXGraphics* > *GetUnoGraphicsList() const { return mpUnoGraphicsList; }
474 std::vector< VCLXGraphics* > *CreateUnoGraphicsList();
476 protected:
478 /** Acquire a graphics device that the output device uses to draw on.
480 There is an LRU of OutputDevices that is used to get the graphics. The
481 actual creation of a SalGraphics instance is done via the SalFrame
482 implementation.
484 However, the SalFrame instance will only return a valid SalGraphics
485 instance if it is not in use or there wasn't one in the first place. When
486 this happens, AcquireGraphics finds the least recently used OutputDevice
487 in a different frame and "steals" it (releases it then starts using it).
489 If there are no frames to steal an OutputDevice's SalGraphics instance from
490 then it blocks until the graphics is released.
492 Once it has acquired a graphics instance, then we add the OutputDevice to
493 the LRU.
495 @returns true if was able to initialize the graphics device, false otherwise.
497 virtual bool AcquireGraphics() const = 0;
499 /** Release the graphics device, and remove it from the graphics device
500 list.
502 @param bRelease Determines whether to release the fonts of the
503 physically released graphics device.
505 virtual void ReleaseGraphics( bool bRelease = true ) = 0;
506 ///@}
509 /** @name Helper functions
511 ///@{
513 public:
515 /** Get the output device's DPI x-axis value.
517 @returns x-axis DPI value
519 SAL_DLLPRIVATE sal_Int32 GetDPIX() const { return mnDPIX; }
521 /** Get the output device's DPI y-axis value.
523 @returns y-axis DPI value
525 SAL_DLLPRIVATE sal_Int32 GetDPIY() const { return mnDPIY; }
527 SAL_DLLPRIVATE void SetDPIX( sal_Int32 nDPIX ) { mnDPIX = nDPIX; }
528 SAL_DLLPRIVATE void SetDPIY( sal_Int32 nDPIY ) { mnDPIY = nDPIY; }
530 float GetDPIScaleFactor() const
532 return mnDPIScalePercentage / 100.0f;
535 sal_Int32 GetDPIScalePercentage() const
537 return mnDPIScalePercentage;
540 OutDevType GetOutDevType() const { return meOutDevType; }
542 /** Query an OutputDevice to see whether it supports a specific operation
544 @returns true if operation supported, else false
546 bool SupportsOperation( OutDevSupportType ) const;
548 vcl::PDFWriterImpl* GetPDFWriter() const { return mpPDFWriter; }
550 void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; }
551 vcl::ExtOutDevData* GetExtOutDevData() const { return mpExtOutDevData; }
553 ///@}
556 /** @name Direct OutputDevice drawing functions
558 ///@{
560 public:
562 virtual void DrawOutDev(
563 const Point& rDestPt, const Size& rDestSize,
564 const Point& rSrcPt, const Size& rSrcSize );
566 virtual void DrawOutDev(
567 const Point& rDestPt, const Size& rDestSize,
568 const Point& rSrcPt, const Size& rSrcSize,
569 const OutputDevice& rOutDev );
571 virtual void CopyArea(
572 const Point& rDestPt,
573 const Point& rSrcPt, const Size& rSrcSize,
574 bool bWindowInvalidate = false );
576 protected:
578 virtual void CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate);
580 SAL_DLLPRIVATE void drawOutDevDirect ( const OutputDevice* pSrcDev, SalTwoRect& rPosAry );
582 SAL_DLLPRIVATE bool is_double_buffered_window() const;
584 private:
586 // not implemented; to detect misuses of DrawOutDev(...OutputDevice&);
587 SAL_DLLPRIVATE void DrawOutDev( const Point&, const Size&, const Point&, const Size&, const Printer&) = delete;
588 ///@}
591 /** @name OutputDevice state functions
593 ///@{
595 public:
597 void Push( PushFlags nFlags = PushFlags::ALL );
598 void Pop();
600 // returns the current stack depth; that is the number of Push() calls minus the number of Pop() calls
601 // this should not normally be used since Push and Pop must always be used symmetrically
602 // however this may be e.g. a help when debugging code in which this somehow is not the case
603 sal_uInt32 GetGCStackDepth() const;
605 void EnableOutput( bool bEnable = true );
606 bool IsOutputEnabled() const { return mbOutput; }
607 bool IsDeviceOutputNecessary() const { return (mbOutput && mbDevOutput); }
609 void SetAntialiasing( AntialiasingFlags nMode );
610 AntialiasingFlags GetAntialiasing() const { return mnAntialiasing; }
612 void SetDrawMode( DrawModeFlags nDrawMode );
613 DrawModeFlags GetDrawMode() const { return mnDrawMode; }
615 void SetLayoutMode( ComplexTextLayoutFlags nTextLayoutMode );
616 ComplexTextLayoutFlags GetLayoutMode() const { return mnTextLayoutMode; }
618 void SetDigitLanguage( LanguageType );
619 LanguageType GetDigitLanguage() const { return meTextLanguage; }
621 void SetRasterOp( RasterOp eRasterOp );
622 RasterOp GetRasterOp() const { return meRasterOp; }
625 If this OutputDevice is used for displaying a Print Preview
626 the OutDevViewType should be set to 'OutDevViewType::PrintPreview'.
628 A View can then make painting decisions dependent on this OutDevViewType.
629 E.g. text colors need to be handled differently, dependent on whether it's a PrintPreview or not. (see #106611# for more)
631 void SetOutDevViewType( OutDevViewType eOutDevViewType ) { meOutDevViewType=eOutDevViewType; }
632 OutDevViewType GetOutDevViewType() const { return meOutDevViewType; }
634 void SetLineColor();
635 void SetLineColor( const Color& rColor );
636 const Color& GetLineColor() const { return maLineColor; }
637 bool IsLineColor() const { return mbLineColor; }
639 void SetFillColor();
640 void SetFillColor( const Color& rColor );
641 const Color& GetFillColor() const { return maFillColor; }
642 bool IsFillColor() const { return mbFillColor; }
644 void SetBackground();
645 void SetBackground( const Wallpaper& rBackground );
647 const Wallpaper& GetBackground() const { return maBackground; }
648 bool IsBackground() const { return mbBackground; }
650 void SetFont( const vcl::Font& rNewFont );
651 const vcl::Font& GetFont() const { return maFont; }
653 protected:
655 virtual void ImplReleaseFonts();
657 private:
659 SAL_DLLPRIVATE void InitLineColor();
661 SAL_DLLPRIVATE void InitFillColor();
663 ///@}
666 /** @name Clipping functions
668 ///@{
670 public:
672 vcl::Region GetClipRegion() const;
673 void SetClipRegion();
674 void SetClipRegion( const vcl::Region& rRegion );
675 bool SelectClipRegion( const vcl::Region&, SalGraphics* pGraphics = nullptr );
677 bool IsClipRegion() const { return mbClipRegion; }
679 void MoveClipRegion( long nHorzMove, long nVertMove );
680 void IntersectClipRegion( const tools::Rectangle& rRect );
681 void IntersectClipRegion( const vcl::Region& rRegion );
683 virtual vcl::Region GetActiveClipRegion() const;
685 protected:
687 virtual void InitClipRegion();
688 virtual void ClipToPaintRegion ( tools::Rectangle& rDstRect );
690 private:
692 SAL_DLLPRIVATE void SetDeviceClipRegion( const vcl::Region* pRegion );
693 ///@}
696 /** @name Pixel functions
698 ///@{
700 public:
702 void DrawPixel( const Point& rPt );
703 void DrawPixel( const Point& rPt, const Color& rColor );
704 void DrawPixel( const tools::Polygon& rPts, const Color* pColors );
705 void DrawPixel( const tools::Polygon& rPts, const Color& rColor );
707 Color GetPixel( const Point& rPt ) const;
708 ///@}
711 /** @name Rectangle functions
713 ///@{
715 public:
717 void DrawRect( const tools::Rectangle& rRect );
718 void DrawRect( const tools::Rectangle& rRect,
719 sal_uLong nHorzRount, sal_uLong nVertRound );
721 /// Fill the given rectangle with checkered rectangles of size nLen x nLen using the colors aStart and aEnd
722 void DrawCheckered(
723 const Point& rPos,
724 const Size& rSize,
725 sal_uInt32 nLen = 8,
726 Color aStart = Color(COL_WHITE),
727 Color aEnd = Color(COL_BLACK));
729 void DrawGrid( const tools::Rectangle& rRect, const Size& rDist, DrawGridFlags nFlags );
731 ///@}
733 /** @name Invert functions
735 ///@{
736 public:
737 void Invert( const tools::Rectangle& rRect, InvertFlags nFlags = InvertFlags::NONE );
738 void Invert( const tools::Polygon& rPoly, InvertFlags nFlags = InvertFlags::NONE );
739 ///@}
741 /** @name Line functions
743 ///@{
745 public:
747 void DrawLine( const Point& rStartPt, const Point& rEndPt );
749 void DrawLine( const Point& rStartPt, const Point& rEndPt,
750 const LineInfo& rLineInfo );
752 private:
754 /** Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area)
756 SAL_DLLPRIVATE void drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const LineInfo& rInfo );
757 ///@}
760 /** @name Polyline functions
762 ///@{
764 public:
766 /** Render the given polygon as a line stroke
768 The given polygon is stroked with the current LineColor, start
769 and end point are not automatically connected
771 @see DrawPolygon
772 @see DrawPolyPolygon
774 void DrawPolyLine( const tools::Polygon& rPoly );
776 void DrawPolyLine(
777 const basegfx::B2DPolygon&,
778 double fLineWidth = 0.0,
779 basegfx::B2DLineJoin eLineJoin = basegfx::B2DLineJoin::Round,
780 css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT,
781 double fMiterMinimumAngle = 15.0 * F_PI180);
783 /** Render the given polygon as a line stroke
785 The given polygon is stroked with the current LineColor, start
786 and end point are not automatically connected. The line is
787 rendered according to the specified LineInfo, e.g. supplying a
788 dash pattern, or a line thickness.
790 @see DrawPolygon
791 @see DrawPolyPolygon
793 void DrawPolyLine( const tools::Polygon& rPoly,
794 const LineInfo& rLineInfo );
796 // #i101491#
797 // Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool.
798 bool DrawPolyLineDirect(
799 const basegfx::B2DPolygon& rB2DPolygon,
800 double fLineWidth = 0.0,
801 double fTransparency = 0.0,
802 basegfx::B2DLineJoin eLineJoin = basegfx::B2DLineJoin::NONE,
803 css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT,
804 double fMiterMinimumAngle = 15.0 * F_PI180,
805 bool bBypassAACheck = false);
807 private:
809 // #i101491#
810 // Helper which holds the old line geometry creation and is extended to use AA when
811 // switched on. Advantage is that line geometry is only temporarily used for paint
812 SAL_DLLPRIVATE void drawPolyLine(const tools::Polygon& rPoly, const LineInfo& rLineInfo);
814 ///@}
817 /** @name Polygon functions
819 ///@{
821 public:
823 /** Render the given polygon
825 The given polygon is stroked with the current LineColor, and
826 filled with the current FillColor. If one of these colors are
827 transparent, the corresponding stroke or fill stays
828 invisible. Start and end point of the polygon are
829 automatically connected.
831 @see DrawPolyLine
833 void DrawPolygon( const tools::Polygon& rPoly );
834 void DrawPolygon( const basegfx::B2DPolygon& );
836 /** Render the given poly-polygon
838 The given poly-polygon is stroked with the current LineColor,
839 and filled with the current FillColor. If one of these colors
840 are transparent, the corresponding stroke or fill stays
841 invisible. Start and end points of the contained polygons are
842 automatically connected.
844 @see DrawPolyLine
846 void DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly );
847 void DrawPolyPolygon( const basegfx::B2DPolyPolygon& );
849 private:
851 SAL_DLLPRIVATE void ImplDrawPolygon( const tools::Polygon& rPoly, const tools::PolyPolygon* pClipPolyPoly = nullptr );
852 SAL_DLLPRIVATE void ImplDrawPolyPolygon( const tools::PolyPolygon& rPolyPoly, const tools::PolyPolygon* pClipPolyPoly );
853 SAL_DLLPRIVATE void ImplDrawPolyPolygon( sal_uInt16 nPoly, const tools::PolyPolygon& rPolyPoly );
854 // #i101491#
855 // Helper who implements the DrawPolyPolygon functionality for basegfx::B2DPolyPolygon
856 // without MetaFile processing
857 SAL_DLLPRIVATE void ImplDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPolygon& rB2DPolyPoly);
858 ///@}
861 /** @name Curved shape functions
863 ///@{
865 public:
867 void DrawEllipse( const tools::Rectangle& rRect );
869 void DrawArc(
870 const tools::Rectangle& rRect,
871 const Point& rStartPt, const Point& rEndPt );
873 void DrawPie(
874 const tools::Rectangle& rRect,
875 const Point& rStartPt, const Point& rEndPt );
877 void DrawChord(
878 const tools::Rectangle& rRect,
879 const Point& rStartPt, const Point& rEndPt );
881 ///@}
884 /** @name Gradient functions
886 ///@{
888 public:
889 void DrawGradient( const tools::Rectangle& rRect, const Gradient& rGradient );
890 void DrawGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient );
892 void AddGradientActions(
893 const tools::Rectangle& rRect,
894 const Gradient& rGradient,
895 GDIMetaFile& rMtf );
897 protected:
899 virtual bool UsePolyPolygonForComplexGradient() = 0;
901 virtual long GetGradientStepCount( long nMinRect );
903 private:
905 SAL_DLLPRIVATE void DrawLinearGradient( const tools::Rectangle& rRect, const Gradient& rGradient, const tools::PolyPolygon* pClipPolyPoly );
906 SAL_DLLPRIVATE void DrawComplexGradient( const tools::Rectangle& rRect, const Gradient& rGradient, const tools::PolyPolygon* pClipPolyPoly );
908 SAL_DLLPRIVATE void DrawGradientToMetafile( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient );
909 SAL_DLLPRIVATE void DrawLinearGradientToMetafile( const tools::Rectangle& rRect, const Gradient& rGradient );
910 SAL_DLLPRIVATE void DrawComplexGradientToMetafile( const tools::Rectangle& rRect, const Gradient& rGradient );
912 SAL_DLLPRIVATE long GetGradientSteps( const Gradient& rGradient, const tools::Rectangle& rRect, bool bMtf, bool bComplex=false );
914 SAL_DLLPRIVATE Color GetSingleColorGradientFill();
915 SAL_DLLPRIVATE void SetGrayscaleColors( Gradient &rGradient );
916 ///@}
919 /** @name Hatch functions
921 ///@{
923 public:
925 #ifdef _MSC_VER
926 void DrawHatch( const tools::PolyPolygon& rPolyPoly, const ::Hatch& rHatch );
927 void AddHatchActions( const tools::PolyPolygon& rPolyPoly,
928 const ::Hatch& rHatch,
929 GDIMetaFile& rMtf );
930 #else
931 void DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch );
932 void AddHatchActions( const tools::PolyPolygon& rPolyPoly,
933 const Hatch& rHatch,
934 GDIMetaFile& rMtf );
935 #endif
937 void DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch& rHatch, bool bMtf );
939 private:
941 SAL_DLLPRIVATE void CalcHatchValues( const tools::Rectangle& rRect, long nDist, sal_uInt16 nAngle10, Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 );
942 SAL_DLLPRIVATE void DrawHatchLine( const tools::Line& rLine, const tools::PolyPolygon& rPolyPoly, Point* pPtBuffer, bool bMtf );
943 ///@}
946 /** @name Wallpaper functions
948 ///@{
950 public:
951 void DrawWallpaper( const tools::Rectangle& rRect, const Wallpaper& rWallpaper );
953 void Erase();
954 void Erase( const tools::Rectangle& rRect ) { DrawWallpaper( rRect, GetBackground() ); }
956 protected:
957 void DrawGradientWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
959 private:
960 SAL_DLLPRIVATE void DrawWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
961 SAL_DLLPRIVATE void DrawColorWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
962 SAL_DLLPRIVATE void DrawBitmapWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
963 ///@}
966 /** @name Text functions
968 ///@{
970 public:
972 void DrawText( const Point& rStartPt, const OUString& rStr,
973 sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
974 MetricVector* pVector = nullptr, OUString* pDisplayText = nullptr );
976 void DrawText( const tools::Rectangle& rRect,
977 const OUString& rStr, DrawTextFlags nStyle = DrawTextFlags::NONE,
978 MetricVector* pVector = nullptr, OUString* pDisplayText = nullptr,
979 vcl::ITextLayout* _pTextLayout = nullptr );
981 static void ImplDrawText( OutputDevice& rTargetDevice, const tools::Rectangle& rRect,
982 const OUString& rOrigStr, DrawTextFlags nStyle,
983 MetricVector* pVector, OUString* pDisplayText, vcl::ITextLayout& _rLayout );
985 void ImplDrawText( SalLayout& );
987 void ImplDrawTextBackground( const SalLayout& );
989 void DrawCtrlText( const Point& rPos, const OUString& rStr,
990 sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
991 DrawTextFlags nStyle = DrawTextFlags::Mnemonic, MetricVector* pVector = nullptr, OUString* pDisplayText = nullptr );
993 void DrawTextLine( const Point& rPos, long nWidth,
994 FontStrikeout eStrikeout,
995 FontLineStyle eUnderline,
996 FontLineStyle eOverline,
997 bool bUnderlineAbove = false );
999 void ImplDrawTextLine( long nBaseX, long nX, long nY, DeviceCoordinate nWidth,
1000 FontStrikeout eStrikeout, FontLineStyle eUnderline,
1001 FontLineStyle eOverline, bool bUnderlineAbove );
1003 void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontLineStyle eUnderline,
1004 FontLineStyle eOverline, bool bWordLine, bool bUnderlineAbove );
1006 void DrawWaveLine( const Point& rStartPos, const Point& rEndPos );
1008 bool ImplDrawRotateText( SalLayout& );
1010 tools::Rectangle GetTextRect( const tools::Rectangle& rRect,
1011 const OUString& rStr, DrawTextFlags nStyle = DrawTextFlags::WordBreak,
1012 TextRectInfo* pInfo = nullptr,
1013 const vcl::ITextLayout* _pTextLayout = nullptr ) const;
1015 /** Return the exact bounding rectangle of rStr.
1017 The text is then drawn exactly from rRect.TopLeft() to
1018 rRect.BottomRight(), don't assume that rRect.TopLeft() is [0, 0].
1020 Please note that you don't always want to use GetTextBoundRect(); in
1021 many cases you actually want to use GetTextHeight(), because
1022 GetTextBoundRect() gives you the exact bounding rectangle regardless
1023 what is the baseline of the text.
1025 Code snippet to get just exactly the text (no filling around that) as
1026 a bitmap via a VirtualDevice (regardless what is the baseline):
1028 <code>
1029 VirtualDevice aDevice;
1030 vcl::Font aFont = aDevice.GetFont();
1031 aFont.SetSize(Size(0, 96));
1032 aFont.SetColor(COL_BLACK);
1033 aDevice.SetFont(aFont);
1034 aDevice.Erase();
1036 tools::Rectangle aRect;
1037 aDevice.GetTextBoundRect(aRect, aText);
1038 aDevice.SetOutputSize(Size(aRect.BottomRight().X() + 1, aRect.BottomRight().Y() + 1));
1039 aDevice.SetBackground(Wallpaper(COL_TRANSPARENT));
1040 aDevice.DrawText(Point(0,0), aText);
1042 // exactly only the text, regardless of the baseline
1043 Bitmap aBitmap(aDevice.GetBitmap(aRect.TopLeft(), aRect.GetSize()));
1044 </code>
1046 Code snippet to get the text as a bitmap via a Virtual device that
1047 contains even the filling so that the baseline is always preserved
1048 (ie. the text will not jump up and down according to whether it
1049 contains 'y' or not etc.)
1051 <code>
1052 VirtualDevice aDevice;
1053 // + the appropriate font / device setup, see above
1055 aDevice.SetOutputSize(Size(aDevice.GetTextWidth(aText), aDevice.GetTextHeight()));
1056 aDevice.SetBackground(Wallpaper(COL_TRANSPARENT));
1057 aDevice.DrawText(Point(0,0), aText);
1059 // bitmap that contains even the space around the text,
1060 // that means, preserves the baseline etc.
1061 Bitmap aBitmap(aDevice.GetBitmap(Point(0, 0), aDevice.GetOutputSize()));
1062 </code>
1064 bool GetTextBoundRect( tools::Rectangle& rRect,
1065 const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
1066 sal_uLong nLayoutWidth = 0, const long* pDXArray = nullptr ) const;
1068 tools::Rectangle ImplGetTextBoundRect( const SalLayout& );
1070 bool GetTextOutline( tools::PolyPolygon&,
1071 const OUString& rStr,
1072 sal_Int32 nLen = -1,
1073 sal_uLong nLayoutWidth = 0, const long* pDXArray = nullptr ) const;
1075 bool GetTextOutlines( PolyPolyVector&,
1076 const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0,
1077 sal_Int32 nLen = -1,
1078 sal_uLong nLayoutWidth = 0, const long* pDXArray = nullptr ) const;
1080 bool GetTextOutlines( basegfx::B2DPolyPolygonVector &rVector,
1081 const OUString& rStr, sal_Int32 nBase, sal_Int32 nIndex = 0,
1082 sal_Int32 nLen = -1,
1083 sal_uLong nLayoutWidth = 0, const long* pDXArray = nullptr ) const;
1086 OUString GetEllipsisString( const OUString& rStr, long nMaxWidth,
1087 DrawTextFlags nStyle = DrawTextFlags::EndEllipsis ) const;
1089 long GetCtrlTextWidth( const OUString& rStr ) const;
1091 static OUString GetNonMnemonicString( const OUString& rStr, sal_Int32& rMnemonicPos );
1093 static OUString GetNonMnemonicString( const OUString& rStr )
1094 { sal_Int32 nDummy; return GetNonMnemonicString( rStr, nDummy ); }
1096 /** Generate MetaTextActions for the text rect
1098 This method splits up the text rect into multiple
1099 MetaTextActions, one for each line of text. This is comparable
1100 to AddGradientActions(), which splits up a gradient into its
1101 constituent polygons. Parameter semantics fully compatible to
1102 DrawText().
1104 void AddTextRectActions( const tools::Rectangle& rRect,
1105 const OUString& rOrigStr,
1106 DrawTextFlags nStyle,
1107 GDIMetaFile& rMtf );
1109 void SetTextColor( const Color& rColor );
1110 const Color& GetTextColor() const { return maTextColor; }
1112 void SetTextFillColor();
1113 void SetTextFillColor( const Color& rColor );
1114 Color GetTextFillColor() const;
1115 bool IsTextFillColor() const { return !maFont.IsTransparent(); }
1117 void SetTextLineColor();
1118 void SetTextLineColor( const Color& rColor );
1119 const Color& GetTextLineColor() const { return maTextLineColor; }
1120 bool IsTextLineColor() const { return (maTextLineColor.GetTransparency() == 0); }
1122 void SetOverlineColor();
1123 void SetOverlineColor( const Color& rColor );
1124 const Color& GetOverlineColor() const { return maOverlineColor; }
1125 bool IsOverlineColor() const { return (maOverlineColor.GetTransparency() == 0); }
1127 void SetTextAlign( TextAlign eAlign );
1128 TextAlign GetTextAlign() const { return maFont.GetAlignment(); }
1130 /** Width of the text.
1132 See also GetTextBoundRect() for more explanation + code examples.
1134 long GetTextWidth( const OUString& rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
1135 vcl::TextLayoutCache const* = nullptr) const;
1137 /** Height where any character of the current font fits; in logic coordinates.
1139 See also GetTextBoundRect() for more explanation + code examples.
1141 long GetTextHeight() const;
1142 float approximate_char_width() const;
1144 void DrawTextArray( const Point& rStartPt, const OUString& rStr,
1145 const long* pDXAry,
1146 sal_Int32 nIndex = 0,
1147 sal_Int32 nLen = -1,
1148 SalLayoutFlags flags = SalLayoutFlags::NONE);
1149 long GetTextArray( const OUString& rStr, long* pDXAry,
1150 sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
1151 vcl::TextLayoutCache const* = nullptr) const;
1153 bool GetCaretPositions( const OUString&, long* pCaretXArray,
1154 sal_Int32 nIndex, sal_Int32 nLen ) const;
1155 void DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
1156 const OUString& rStr,
1157 sal_Int32 nIndex = 0, sal_Int32 nLen = -1);
1158 sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth,
1159 sal_Int32 nIndex, sal_Int32 nLen = -1,
1160 long nCharExtra = 0,
1161 vcl::TextLayoutCache const* = nullptr) const;
1162 sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth,
1163 sal_Unicode nExtraChar, sal_Int32& rExtraCharPos,
1164 sal_Int32 nIndex, sal_Int32 nLen,
1165 long nCharExtra,
1166 vcl::TextLayoutCache const* = nullptr) const;
1167 std::shared_ptr<vcl::TextLayoutCache> CreateTextLayoutCache(OUString const&) const;
1169 private:
1170 SAL_DLLPRIVATE void ImplInitTextColor();
1172 SAL_DLLPRIVATE void ImplInitTextLineSize();
1173 SAL_DLLPRIVATE void ImplInitAboveTextLineSize();
1176 SAL_DLLPRIVATE void ImplDrawTextDirect( SalLayout&, bool bTextLines);
1177 SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout& );
1178 SAL_DLLPRIVATE void ImplDrawTextRect( long nBaseX, long nBaseY, long nX, long nY, long nWidth, long nHeight );
1180 SAL_DLLPRIVATE static void ImplDrawWavePixel( long nOriginX, long nOriginY, long nCurX, long nCurY, short nOrientation, SalGraphics* pGraphics, OutputDevice* pOutDev,
1181 bool bDrawPixAsRect, long nPixWidth, long nPixHeight );
1182 SAL_DLLPRIVATE void ImplDrawWaveLine( long nBaseX, long nBaseY, long nStartX, long nStartY, long nWidth, long nHeight, long nLineWidth, short nOrientation, const Color& rColor );
1183 SAL_DLLPRIVATE void ImplDrawWaveTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontLineStyle eTextLine, Color aColor, bool bIsAbove );
1184 SAL_DLLPRIVATE void ImplDrawStraightTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontLineStyle eTextLine, Color aColor, bool bIsAbove );
1185 SAL_DLLPRIVATE void ImplDrawStrikeoutLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
1186 SAL_DLLPRIVATE void ImplDrawStrikeoutChar( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
1187 SAL_DLLPRIVATE void ImplDrawMnemonicLine( long nX, long nY, long nWidth );
1189 SAL_DLLPRIVATE static bool ImplIsUnderlineAbove( const vcl::Font& );
1191 static
1192 SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const OUString& rStr, DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout );
1193 ///@}
1196 /** @name Font functions
1198 ///@{
1200 public:
1202 FontMetric GetDevFont( int nDevFontIndex ) const;
1203 int GetDevFontCount() const;
1205 bool IsFontAvailable( const OUString& rFontName ) const;
1207 Size GetDevFontSize( const vcl::Font& rFont, int nSizeIndex ) const;
1208 int GetDevFontSizeCount( const vcl::Font& ) const;
1210 bool AddTempDevFont( const OUString& rFileURL, const OUString& rFontName );
1211 void RefreshFontData( const bool bNewFontLists );
1213 FontMetric GetFontMetric() const;
1214 FontMetric GetFontMetric( const vcl::Font& rFont ) const;
1216 bool GetFontCharMap( FontCharMapRef& rxFontCharMap ) const;
1217 bool GetFontCapabilities( vcl::FontCapabilities& rFontCapabilities ) const;
1219 /** Retrieve detailed font information in platform independent structure
1221 @param nFallbacklevel Fallback font level (0 = best matching font)
1223 @return SystemFontData
1225 SystemFontData GetSysFontData( int nFallbacklevel ) const;
1227 SAL_DLLPRIVATE void ImplGetEmphasisMark( tools::PolyPolygon& rPolyPoly, bool& rPolyLine, tools::Rectangle& rRect1, tools::Rectangle& rRect2,
1228 long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight );
1229 SAL_DLLPRIVATE static FontEmphasisMark
1230 ImplGetEmphasisMarkStyle( const vcl::Font& rFont );
1232 bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex,
1233 int nLen, MetricVector& rVector );
1235 sal_Int32 HasGlyphs( const vcl::Font& rFont, const OUString& rStr,
1236 sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
1238 long GetMinKashida() const;
1240 // i60594
1241 // validate kashida positions against the current font
1242 // returns count of invalid kashida positions
1243 sal_Int32 ValidateKashidas( const OUString& rTxt, sal_Int32 nIdx, sal_Int32 nLen,
1244 sal_Int32 nKashCount, // number of suggested kashida positions (in)
1245 const sal_Int32* pKashidaPos, // suggested kashida positions (in)
1246 sal_Int32* pKashidaPosDropped // invalid kashida positions (out)
1247 ) const;
1249 static void BeginFontSubstitution();
1250 static void EndFontSubstitution();
1251 static void AddFontSubstitute( const OUString& rFontName,
1252 const OUString& rReplaceFontName,
1253 AddFontSubstituteFlags nFlags );
1254 static void RemoveFontSubstitute( sal_uInt16 n );
1255 static sal_uInt16 GetFontSubstituteCount();
1257 static vcl::Font GetDefaultFont( DefaultFontType nType,
1258 LanguageType eLang,
1259 GetDefaultFontFlags nFlags,
1260 const OutputDevice* pOutDev = nullptr );
1262 SAL_DLLPRIVATE void ImplInitFontList() const;
1263 SAL_DLLPRIVATE void ImplUpdateFontData();
1265 //drop font data for all outputdevices.
1266 //If bNewFontLists is true then empty lists of system fonts
1267 SAL_DLLPRIVATE static void ImplClearAllFontData( bool bNewFontLists );
1268 //fetch font data for all outputdevices
1269 //If bNewFontLists is true then fetch lists of system fonts
1270 SAL_DLLPRIVATE static void ImplRefreshAllFontData( bool bNewFontLists );
1271 //drop and fetch font data for all outputdevices
1272 //If bNewFontLists is true then drop and refetch lists of system fonts
1273 SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists );
1275 protected:
1277 virtual void InitFont() const;
1278 virtual void SetFontOrientation( LogicalFontInstance* const pFontInstance ) const;
1279 virtual long GetFontExtLeading() const;
1282 private:
1284 typedef void ( OutputDevice::* FontUpdateHandler_t )( bool );
1286 SAL_DLLPRIVATE bool ImplNewFont() const;
1288 SAL_DLLPRIVATE void ImplClearFontData( bool bNewFontLists );
1289 SAL_DLLPRIVATE void ImplRefreshFontData( bool bNewFontLists );
1290 SAL_DLLPRIVATE static void ImplUpdateFontDataForAllFrames( FontUpdateHandler_t pHdl, bool bNewFontLists );
1292 static
1293 SAL_DLLPRIVATE OUString ImplGetEllipsisString( const OutputDevice& rTargetDevice, const OUString& rStr,
1294 long nMaxWidth, DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout );
1296 SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const tools::PolyPolygon& rPolyPoly, bool bPolyLine, const tools::Rectangle& rRect1, const tools::Rectangle& rRect2 );
1297 SAL_DLLPRIVATE void ImplDrawEmphasisMarks( SalLayout& );
1298 ///@}
1301 /** @name Layout functions
1303 ///@{
1305 public:
1307 SystemTextLayoutData GetSysTextLayoutData( const Point& rStartPt, const OUString& rStr,
1308 sal_Int32 nIndex, sal_Int32 nLen,
1309 const long* pDXAry ) const;
1311 SAL_DLLPRIVATE bool ImplIsAntiparallel() const ;
1312 SAL_DLLPRIVATE void ReMirror( Point &rPoint ) const;
1313 SAL_DLLPRIVATE void ReMirror( tools::Rectangle &rRect ) const;
1314 SAL_DLLPRIVATE void ReMirror( vcl::Region &rRegion ) const;
1315 SAL_DLLPRIVATE bool ImplIsRecordLayout() const;
1316 virtual bool HasMirroredGraphics() const;
1317 SAL_DLLPRIVATE SalLayout* ImplLayout( const OUString&, sal_Int32 nIndex, sal_Int32 nLen,
1318 const Point& rLogicPos = Point(0,0), long nLogicWidth=0,
1319 const long* pLogicDXArray=nullptr, SalLayoutFlags flags = SalLayoutFlags::NONE,
1320 vcl::TextLayoutCache const* = nullptr) const;
1321 SAL_DLLPRIVATE ImplLayoutArgs ImplPrepareLayoutArgs( OUString&, const sal_Int32 nIndex, const sal_Int32 nLen,
1322 DeviceCoordinate nPixelWidth, const DeviceCoordinate* pPixelDXArray,
1323 SalLayoutFlags flags = SalLayoutFlags::NONE,
1324 vcl::TextLayoutCache const* = nullptr) const;
1325 SAL_DLLPRIVATE SalLayout* ImplGlyphFallbackLayout( SalLayout*, ImplLayoutArgs& ) const;
1326 // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI
1327 SAL_DLLPRIVATE SalLayout* getFallbackFont(
1328 FontSelectPattern &rFontSelData, int nFallbackLevel,
1329 ImplLayoutArgs& rLayoutArgs) const;
1332 // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphisLayout
1333 virtual void EnableRTL( bool bEnable = true);
1334 bool IsRTLEnabled() const { return mbEnableRTL; }
1336 bool GetTextIsRTL( const OUString&, sal_Int32 nIndex, sal_Int32 nLen ) const;
1338 ///@}
1341 /** @name Bitmap functions
1343 ///@{
1345 public:
1347 /** @overload
1348 void DrawBitmap(
1349 const Point& rDestPt,
1350 const Size& rDestSize,
1351 const Point& rSrcPtPixel,
1352 const Size& rSecSizePixel,
1353 const Bitmap& rBitmap,
1354 MetaActionType nAction = MetaActionType::BMPSCALEPART)
1356 void DrawBitmap(
1357 const Point& rDestPt,
1358 const Bitmap& rBitmap );
1360 /** @overload
1361 void DrawBitmap(
1362 const Point& rDestPt,
1363 const Size& rDestSize,
1364 const Point& rSrcPtPixel,
1365 const Size& rSecSizePixel,
1366 const Bitmap& rBitmap,
1367 MetaActionType nAction = MetaActionType::BMPSCALEPART)
1369 void DrawBitmap(
1370 const Point& rDestPt,
1371 const Size& rDestSize,
1372 const Bitmap& rBitmap );
1374 void DrawBitmap(
1375 const Point& rDestPt,
1376 const Size& rDestSize,
1377 const Point& rSrcPtPixel,
1378 const Size& rSrcSizePixel,
1379 const Bitmap& rBitmap,
1380 MetaActionType nAction = MetaActionType::BMPSCALEPART );
1382 /** @overload
1383 void DrawBitmapEx(
1384 const Point& rDestPt,
1385 const Size& rDestSize,
1386 const Point& rSrcPtPixel,
1387 const Size& rSecSizePixel,
1388 const BitmapEx& rBitmapEx,
1389 MetaActionType nAction = MetaActionType::BMPEXSCALEPART)
1391 void DrawBitmapEx(
1392 const Point& rDestPt,
1393 const BitmapEx& rBitmapEx );
1396 /** @overload
1397 void DrawBitmapEx(
1398 const Point& rDestPt,
1399 const Size& rDestSize,
1400 const Point& rSrcPtPixel,
1401 const Size& rSecSizePixel,
1402 const BitmapEx& rBitmapEx,
1403 MetaActionType nAction = MetaActionType::BMPEXSCALEPART)
1405 void DrawBitmapEx(
1406 const Point& rDestPt,
1407 const Size& rDestSize,
1408 const BitmapEx& rBitmapEx );
1410 void DrawBitmapEx(
1411 const Point& rDestPt,
1412 const Size& rDestSize,
1413 const Point& rSrcPtPixel,
1414 const Size& rSrcSizePixel,
1415 const BitmapEx& rBitmapEx,
1416 MetaActionType nAction = MetaActionType::BMPEXSCALEPART );
1418 /** @overload
1419 virtual void DrawImage(
1420 const Point& rPos,
1421 const Size& rSize,
1422 const Image& rImage,
1423 sal_uInt16 nStyle = 0)
1425 void DrawImage(
1426 const Point& rPos,
1427 const Image& rImage,
1428 DrawImageFlags nStyle = DrawImageFlags::NONE );
1430 void DrawImage(
1431 const Point& rPos,
1432 const Size& rSize,
1433 const Image& rImage,
1434 DrawImageFlags nStyle = DrawImageFlags::NONE );
1437 virtual Bitmap GetBitmap( const Point& rSrcPt, const Size& rSize ) const;
1439 /** Query extended bitmap (with alpha channel, if available).
1441 BitmapEx GetBitmapEx( const Point& rSrcPt, const Size& rSize ) const;
1444 /** Draw BitmapEx transformed
1446 @param rTransformation
1447 The transformation describing the target positioning of the given bitmap. Transforming
1448 the unit object coordinates (0, 0, 1, 1) with this matrix is the transformation to
1449 discrete coordinates
1451 @param rBitmapEx
1452 The BitmapEx to be painted
1454 void DrawTransformedBitmapEx(
1455 const basegfx::B2DHomMatrix& rTransformation,
1456 const BitmapEx& rBitmapEx);
1459 protected:
1461 virtual void DrawDeviceBitmap(
1462 const Point& rDestPt, const Size& rDestSize,
1463 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
1464 BitmapEx& rBitmapEx );
1466 virtual void ScaleBitmap ( Bitmap &rBmp, SalTwoRect &rPosAry );
1468 /** Transform and draw a bitmap directly
1470 @param aFullTransform The B2DHomMatrix used for the transformation
1471 @param rBitmapEx Reference to the bitmap to be transformed and drawn
1473 @return true if it was able to draw the bitmap, false if not
1475 virtual bool DrawTransformBitmapExDirect(
1476 const basegfx::B2DHomMatrix& aFullTransform,
1477 const BitmapEx& rBitmapEx);
1479 /** Transform and reduce the area that needs to be drawn of the bitmap and return the new
1480 visible range and the maximum area.
1483 @param aFullTransform B2DHomMatrix used for transformation
1484 @param aVisibleRange The new visible area of the bitmap
1485 @param fMaximumArea The maximum area of the bitmap
1487 @returns true if there is an area to be drawn, otherwise nothing is left to be drawn
1488 so return false
1490 virtual bool TransformAndReduceBitmapExToTargetRange(
1491 const basegfx::B2DHomMatrix& aFullTransform,
1492 basegfx::B2DRange &aVisibleRange,
1493 double &fMaximumArea);
1495 private:
1497 SAL_DLLPRIVATE void DrawDeviceAlphaBitmap(
1498 const Bitmap& rBmp,
1499 const AlphaMask& rAlpha,
1500 const Point& rDestPt,
1501 const Size& rDestSize,
1502 const Point& rSrcPtPixel,
1503 const Size& rSrcSizePixel );
1505 SAL_DLLPRIVATE void DrawDeviceAlphaBitmapSlowPath(
1506 const Bitmap& rBitmap, const AlphaMask& rAlpha,
1507 tools::Rectangle aDstRect, tools::Rectangle aBmpRect,
1508 Size& aOutSz, Point& aOutPt);
1511 SAL_DLLPRIVATE bool BlendBitmap(
1512 const SalTwoRect& rPosAry,
1513 const Bitmap& rBmp );
1515 SAL_DLLPRIVATE Bitmap BlendBitmap(
1516 Bitmap& aBmp,
1517 BitmapReadAccess* pP,
1518 BitmapReadAccess* pA,
1519 const sal_Int32 nOffY,
1520 const sal_Int32 nDstHeight,
1521 const sal_Int32 nOffX,
1522 const sal_Int32 nDstWidth,
1523 const tools::Rectangle& aBmpRect,
1524 const Size& aOutSz,
1525 const bool bHMirr,
1526 const bool bVMirr,
1527 const long* pMapX,
1528 const long* pMapY );
1530 SAL_DLLPRIVATE Bitmap BlendBitmapWithAlpha(
1531 Bitmap& aBmp,
1532 BitmapReadAccess* pP,
1533 BitmapReadAccess* pA,
1534 const tools::Rectangle& aDstRect,
1535 const sal_Int32 nOffY,
1536 const sal_Int32 nDstHeight,
1537 const sal_Int32 nOffX,
1538 const sal_Int32 nDstWidth,
1539 const long* pMapX,
1540 const long* pMapY );
1542 /** Retrieve downsampled and cropped bitmap
1544 @attention This method ignores negative rDstSz values, thus
1545 mirroring must happen outside this method (e.g. in DrawBitmap)
1547 SAL_DLLPRIVATE Bitmap GetDownsampledBitmap(
1548 const Size& rDstSz,
1549 const Point& rSrcPt,
1550 const Size& rSrcSz,
1551 const Bitmap& rBmp,
1552 long nMaxBmpDPIX,
1553 long nMaxBmpDPIY );
1555 ///@}
1558 /** @name Transparency functions
1560 ///@{
1562 public:
1564 /** helper method removing transparencies from a metafile (e.g. for printing)
1566 @returns
1567 true: transparencies were removed
1568 false: output metafile is unchanged input metafile
1570 @attention this is a member method, so current state can influence the result !
1571 @attention the output metafile is prepared in pixel mode for the currentOutputDevice
1572 state. It can not be moved or rotated reliably anymore.
1574 bool RemoveTransparenciesFromMetaFile(
1575 const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
1576 long nMaxBmpDPIX, long nMaxBmpDPIY,
1577 bool bReduceTransparency,
1578 bool bTransparencyAutoMode,
1579 bool bDownsampleBitmaps,
1580 const Color& rBackground = Color( COL_TRANSPARENT ) );
1582 SAL_DLLPRIVATE void ImplPrintTransparent (
1583 const Bitmap& rBmp, const Bitmap& rMask,
1584 const Point& rDestPt, const Size& rDestSize,
1585 const Point& rSrcPtPixel, const Size& rSrcSizePixel );
1587 SAL_DLLPRIVATE Color ImplDrawModeToColor ( const Color& rColor ) const;
1590 void DrawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
1591 void DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency);
1592 void DrawTransparent(
1593 const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize,
1594 const Gradient& rTransparenceGradient );
1596 protected:
1598 virtual void EmulateDrawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
1599 void DrawInvisiblePolygon( const tools::PolyPolygon& rPolyPoly );
1601 virtual void ClipAndDrawGradientMetafile ( const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly );
1603 private:
1605 SAL_DLLPRIVATE bool DrawTransparentNatively( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
1606 ///@}
1609 /** @name Mask functions
1611 ///@{
1613 public:
1615 void DrawMask( const Point& rDestPt,
1616 const Bitmap& rBitmap, const Color& rMaskColor );
1618 void DrawMask( const Point& rDestPt, const Size& rDestSize,
1619 const Bitmap& rBitmap, const Color& rMaskColor );
1621 void DrawMask( const Point& rDestPt, const Size& rDestSize,
1622 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
1623 const Bitmap& rBitmap, const Color& rMaskColor,
1624 MetaActionType nAction );
1626 protected:
1628 virtual void DrawDeviceMask (
1629 const Bitmap& rMask, const Color& rMaskColor,
1630 const Point& rDestPt, const Size& rDestSize,
1631 const Point& rSrcPtPixel, const Size& rSrcSizePixel );
1632 ///@}
1635 /** @name Map functions
1637 ///@{
1639 public:
1641 void EnableMapMode( bool bEnable = true );
1642 bool IsMapModeEnabled() const { return mbMap; }
1644 void SetMapMode();
1645 virtual void SetMapMode( const MapMode& rNewMapMode );
1646 void SetRelativeMapMode( const MapMode& rNewMapMode );
1647 const MapMode& GetMapMode() const { return maMapMode; }
1649 // #i75163#
1650 basegfx::B2DHomMatrix GetViewTransformation() const;
1651 basegfx::B2DHomMatrix GetInverseViewTransformation() const;
1653 basegfx::B2DHomMatrix GetViewTransformation( const MapMode& rMapMode ) const;
1654 basegfx::B2DHomMatrix GetInverseViewTransformation( const MapMode& rMapMode ) const;
1657 /** Set an offset in pixel
1659 This method offsets every drawing operation that converts its
1660 coordinates to pixel by the given value. Normally, the effect
1661 can be achieved by setting a MapMode with a different
1662 origin. Unfortunately, this origin is in logical coordinates
1663 and can lead to rounding errors (see #102532# for details).
1665 @attention This offset is only applied when converting to
1666 pixel, i.e. some output modes such as metafile recordings
1667 might be completely unaffected by this method! Use with
1668 care. Furthermore, if the OutputDevice's MapMode is the
1669 default (that's MapUnit::MapPixel), then any pixel offset set is
1670 ignored also. This might be unintuitive for cases, but would
1671 have been far more fragile to implement. What's more, the
1672 reason why the pixel offset was introduced (avoiding rounding
1673 errors) does not apply for MapUnit::MapPixel, because one can always
1674 use the MapMode origin then.
1676 @param rOffset
1677 The offset in pixel
1679 void SetPixelOffset( const Size& rOffset );
1681 /** Get the offset in pixel
1683 @see OutputDevice::SetPixelOffset for details
1685 @return the current offset in pixel
1687 Size GetPixelOffset() const { return Size(mnOutOffOrigX, mnOutOffOrigY);}
1689 Point LogicToPixel( const Point& rLogicPt ) const;
1690 Size LogicToPixel( const Size& rLogicSize ) const;
1691 tools::Rectangle LogicToPixel( const tools::Rectangle& rLogicRect ) const;
1692 tools::Polygon LogicToPixel( const tools::Polygon& rLogicPoly ) const;
1693 tools::PolyPolygon LogicToPixel( const tools::PolyPolygon& rLogicPolyPoly ) const;
1694 basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly ) const;
1695 vcl::Region LogicToPixel( const vcl::Region& rLogicRegion )const;
1696 Point LogicToPixel( const Point& rLogicPt,
1697 const MapMode& rMapMode ) const;
1698 Size LogicToPixel( const Size& rLogicSize,
1699 const MapMode& rMapMode ) const;
1700 tools::Rectangle LogicToPixel( const tools::Rectangle& rLogicRect,
1701 const MapMode& rMapMode ) const;
1702 tools::Polygon LogicToPixel( const tools::Polygon& rLogicPoly,
1703 const MapMode& rMapMode ) const;
1704 basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly,
1705 const MapMode& rMapMode ) const;
1707 Point PixelToLogic( const Point& rDevicePt ) const;
1708 Size PixelToLogic( const Size& rDeviceSize ) const;
1709 tools::Rectangle PixelToLogic( const tools::Rectangle& rDeviceRect ) const;
1710 tools::Polygon PixelToLogic( const tools::Polygon& rDevicePoly ) const;
1711 tools::PolyPolygon PixelToLogic( const tools::PolyPolygon& rDevicePolyPoly ) const;
1712 basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly ) const;
1713 vcl::Region PixelToLogic( const vcl::Region& rDeviceRegion ) const;
1714 Point PixelToLogic( const Point& rDevicePt,
1715 const MapMode& rMapMode ) const;
1716 Size PixelToLogic( const Size& rDeviceSize,
1717 const MapMode& rMapMode ) const;
1718 tools::Rectangle PixelToLogic( const tools::Rectangle& rDeviceRect,
1719 const MapMode& rMapMode ) const;
1720 tools::Polygon PixelToLogic( const tools::Polygon& rDevicePoly,
1721 const MapMode& rMapMode ) const;
1722 basegfx::B2DPolygon PixelToLogic( const basegfx::B2DPolygon& rDevicePoly,
1723 const MapMode& rMapMode ) const;
1724 basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly,
1725 const MapMode& rMapMode ) const;
1727 Point LogicToLogic( const Point& rPtSource,
1728 const MapMode* pMapModeSource,
1729 const MapMode* pMapModeDest ) const;
1730 Size LogicToLogic( const Size& rSzSource,
1731 const MapMode* pMapModeSource,
1732 const MapMode* pMapModeDest ) const;
1733 tools::Rectangle LogicToLogic( const tools::Rectangle& rRectSource,
1734 const MapMode* pMapModeSource,
1735 const MapMode* pMapModeDest ) const;
1736 static Point LogicToLogic( const Point& rPtSource,
1737 const MapMode& rMapModeSource,
1738 const MapMode& rMapModeDest );
1739 static Size LogicToLogic( const Size& rSzSource,
1740 const MapMode& rMapModeSource,
1741 const MapMode& rMapModeDest );
1742 static tools::Rectangle LogicToLogic( const tools::Rectangle& rRectSource,
1743 const MapMode& rMapModeSource,
1744 const MapMode& rMapModeDest );
1745 static long LogicToLogic( long nLongSource,
1746 MapUnit eUnitSource,
1747 MapUnit eUnitDest );
1749 static basegfx::B2DPolygon LogicToLogic( const basegfx::B2DPolygon& rPoly,
1750 const MapMode& rMapModeSource,
1751 const MapMode& rMapModeDest );
1753 // create a mapping transformation from rMapModeSource to rMapModeDest (the above methods
1754 // for B2DPoly/Polygons use this internally anyway to transform the B2DPolygon)
1755 static basegfx::B2DHomMatrix LogicToLogic(const MapMode& rMapModeSource, const MapMode& rMapModeDest);
1757 /** Convert a logical rectangle to a rectangle in physical device pixel units.
1759 @param rLogicRect Const reference to a rectangle in logical units
1761 @returns Rectangle based on physical device pixel coordinates and units.
1763 SAL_DLLPRIVATE tools::Rectangle ImplLogicToDevicePixel( const tools::Rectangle& rLogicRect ) const;
1765 /** Convert a logical point to a physical point on the device.
1767 @param rLogicPt Const reference to a point in logical units.
1769 @returns Physical point on the device.
1771 SAL_DLLPRIVATE Point ImplLogicToDevicePixel( const Point& rLogicPt ) const;
1773 /** Convert a logical width to a width in units of device pixels.
1775 To get the number of device pixels, it must calculate the X-DPI of the device and
1776 the map scaling factor. If there is no mapping, then it just returns the
1777 width as nothing more needs to be done.
1779 @param nWidth Logical width
1781 @returns Width in units of device pixels.
1783 SAL_DLLPRIVATE long ImplLogicWidthToDevicePixel( long nWidth ) const;
1785 SAL_DLLPRIVATE DeviceCoordinate LogicWidthToDeviceCoordinate( long nWidth ) const;
1787 protected:
1789 * Notification about some rectangle of the output device got invalidated.
1791 * @param pRectangle If 0, that means the whole area, otherwise the area in logic coordinates.
1793 virtual void LogicInvalidate(const tools::Rectangle* pRectangle) { (void)pRectangle; }
1795 private:
1797 /** Convert a logical X coordinate to a device pixel's X coordinate.
1799 To get the device's X coordinate, it must calculate the mapping offset
1800 coordinate X position (if there is one - if not then it just adds
1801 the pseudo-window offset to the logical X coordinate), the X-DPI of
1802 the device and the mapping's X scaling factor.
1804 @param nX Logical X coordinate
1806 @returns Device's X pixel coordinate
1808 SAL_DLLPRIVATE long ImplLogicXToDevicePixel( long nX ) const;
1810 /** Convert a logical Y coordinate to a device pixel's Y coordinate.
1812 To get the device's Y coordinate, it must calculate the mapping offset
1813 coordinate Y position (if there is one - if not then it just adds
1814 the pseudo-window offset to the logical Y coordinate), the Y-DPI of
1815 the device and the mapping's Y scaling factor.
1817 @param nY Logical Y coordinate
1819 @returns Device's Y pixel coordinate
1821 SAL_DLLPRIVATE long ImplLogicYToDevicePixel( long nY ) const;
1823 /** Convert a logical height to a height in units of device pixels.
1825 To get the number of device pixels, it must calculate the Y-DPI of the device and
1826 the map scaling factor. If there is no mapping, then it just returns the
1827 height as nothing more needs to be done.
1829 @param nHeight Logical height
1831 @returns Height in units of device pixels.
1833 SAL_DLLPRIVATE long ImplLogicHeightToDevicePixel( long nHeight ) const;
1835 /** Convert device pixels to a width in logical units.
1837 To get the logical width, it must calculate the X-DPI of the device and the
1838 map scaling factor.
1840 @param nWidth Width in device pixels
1842 @returns Width in logical units.
1844 SAL_DLLPRIVATE long ImplDevicePixelToLogicWidth( long nWidth ) const;
1846 /** Convert device pixels to a height in logical units.
1848 To get the logical height, it must calculate the Y-DPI of the device and the
1849 map scaling factor.
1851 @param nHeight Height in device pixels
1853 @returns Height in logical units.
1855 SAL_DLLPRIVATE long ImplDevicePixelToLogicHeight( long nHeight ) const;
1857 /** Convert logical height to device pixels, with exact sub-pixel value.
1859 To get the \em exact pixel height, it must calculate the Y-DPI of the device and the
1860 map scaling factor.
1862 @param fLogicHeight Exact height in logical units.
1864 @returns Exact height in pixels - returns as a float to provide for subpixel value.
1866 SAL_DLLPRIVATE float ImplFloatLogicHeightToDevicePixel( float fLogicHeight ) const;
1868 /** Convert a logical size to the size on the physical device.
1870 @param rLogicSize Const reference to a size in logical units
1872 @returns Physical size on the device.
1874 SAL_DLLPRIVATE Size ImplLogicToDevicePixel( const Size& rLogicSize ) const;
1876 /** Convert a rectangle in physical pixel units to a rectangle in physical pixel units and coords.
1878 @param rPixelRect Const reference to rectangle in logical units and coords.
1880 @returns Rectangle based on logical coordinates and units.
1882 SAL_DLLPRIVATE tools::Rectangle ImplDevicePixelToLogic( const tools::Rectangle& rPixelRect ) const;
1884 /** Convert a logical polygon to a polygon in physical device pixel units.
1886 @param rLogicPoly Const reference to a polygon in logical units
1888 @returns Polygon based on physical device pixel coordinates and units.
1890 SAL_DLLPRIVATE tools::Polygon ImplLogicToDevicePixel( const tools::Polygon& rLogicPoly ) const;
1892 /** Convert a logical polypolygon to a polypolygon in physical device pixel units.
1894 @param rLogicPolyPoly Const reference to a polypolygon in logical units
1896 @returns Polypolygon based on physical device pixel coordinates and units.
1898 SAL_DLLPRIVATE tools::PolyPolygon ImplLogicToDevicePixel( const tools::PolyPolygon& rLogicPolyPoly ) const;
1900 /** Convert a line in logical units to a line in physical device pixel units.
1902 @param rLineInfo Const refernece to a line in logical units
1904 @returns Line based on physical device pixel coordinates and units.
1906 SAL_DLLPRIVATE LineInfo ImplLogicToDevicePixel( const LineInfo& rLineInfo ) const;
1908 /** Convert a region in pixel units to a region in device pixel units and coords.
1910 @param rRegion Const reference to region.
1912 @returns vcl::Region based on device pixel coordinates and units.
1914 SAL_DLLPRIVATE vcl::Region ImplPixelToDevicePixel( const vcl::Region& rRegion ) const;
1916 /** Invalidate the view transformation.
1918 @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212)
1920 SAL_DLLPRIVATE void ImplInvalidateViewTransform();
1922 /** Get device transformation.
1924 @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212)
1926 SAL_DLLPRIVATE basegfx::B2DHomMatrix ImplGetDeviceTransformation() const;
1927 ///@}
1930 /** @name Native Widget Rendering functions
1932 These all just call through to the private mpGraphics functions of the same name.
1934 ///@{
1936 public:
1938 /** Query the platform layer for control support
1940 bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) const;
1942 /** Query the native control to determine if it was acted upon
1944 bool HitTestNativeScrollbar(
1945 ControlPart nPart,
1946 const tools::Rectangle& rControlRegion,
1947 const Point& aPos,
1948 bool& rIsInside ) const;
1950 /** Request rendering of a particular control and/or part
1952 bool DrawNativeControl(
1953 ControlType nType,
1954 ControlPart nPart,
1955 const tools::Rectangle& rControlRegion,
1956 ControlState nState,
1957 const ImplControlValue& aValue,
1958 const OUString& aCaption );
1960 /** Query the native control's actual drawing region (including adornment)
1962 bool GetNativeControlRegion(
1963 ControlType nType,
1964 ControlPart nPart,
1965 const tools::Rectangle& rControlRegion,
1966 ControlState nState,
1967 const ImplControlValue& aValue,
1968 tools::Rectangle &rNativeBoundingRegion,
1969 tools::Rectangle &rNativeContentRegion ) const;
1970 ///@}
1972 /** @name EPS functions
1974 ///@{
1976 public:
1978 /** @returns boolean value to see if EPS could be painted directly.
1979 Theoreticaly, handing over a matrix would be needed to handle
1980 painting rotated EPS files (e.g. contained in Metafiles). This
1981 would then need to be supported for Mac and PS printers, but
1982 that's too much for now, wrote \#i107046# for this */
1983 bool DrawEPS(
1984 const Point& rPt, const Size& rSz,
1985 const GfxLink& rGfxLink, GDIMetaFile* pSubst = nullptr );
1986 ///@}
1989 #endif // INCLUDED_VCL_OUTDEV_HXX
1991 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */