1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <sal/config.h>
24 #include <o3tl/span.hxx>
25 #include <tools/gen.hxx>
26 #include <tools/ref.hxx>
27 #include <tools/solar.h>
28 #include <tools/color.hxx>
29 #include <tools/poly.hxx>
30 #include <vcl/bitmap.hxx>
31 #include <vcl/cairo.hxx>
32 #include <vcl/devicecoordinate.hxx>
33 #include <vcl/dllapi.h>
34 #include <vcl/font.hxx>
35 #include <vcl/kernarray.hxx>
36 #include <vcl/region.hxx>
37 #include <vcl/rendercontext/AddFontSubstituteFlags.hxx>
38 #include <vcl/rendercontext/AntialiasingFlags.hxx>
39 #include <vcl/rendercontext/SystemTextColorFlags.hxx>
40 #include <vcl/rendercontext/DrawGridFlags.hxx>
41 #include <vcl/rendercontext/DrawImageFlags.hxx>
42 #include <vcl/rendercontext/DrawModeFlags.hxx>
43 #include <vcl/rendercontext/DrawTextFlags.hxx>
44 #include <vcl/rendercontext/GetDefaultFontFlags.hxx>
45 #include <vcl/rendercontext/ImplMapRes.hxx>
46 #include <vcl/rendercontext/InvertFlags.hxx>
47 #include <vcl/rendercontext/RasterOp.hxx>
48 #include <vcl/rendercontext/SalLayoutFlags.hxx>
49 #include <vcl/rendercontext/State.hxx>
50 #include <vcl/mapmod.hxx>
51 #include <vcl/wall.hxx>
52 #include <vcl/metaactiontypes.hxx>
53 #include <vcl/salnativewidgets.hxx>
54 #include <vcl/settings.hxx>
55 #include <vcl/vclreferencebase.hxx>
57 #include <basegfx/numeric/ftools.hxx>
58 #include <basegfx/vector/b2enums.hxx>
59 #include <basegfx/polygon/b2dpolypolygon.hxx>
61 #include <unotools/fontdefs.hxx>
62 #include <cppuhelper/weakref.hxx>
64 #include <com/sun/star/drawing/LineCap.hpp>
65 #include <com/sun/star/uno/Reference.h>
66 #include <com/sun/star/awt/DeviceInfo.hpp>
70 #include <string_view>
73 struct ImplOutDevData
;
74 class LogicalFontInstance
;
75 struct SystemGraphicsData
;
77 class ImplMultiTextLineInfo
;
81 class BitmapReadAccess
;
99 class OutDevStateStack
;
100 class SalLayoutGlyphs
;
106 struct FontCapabilities
;
108 class WindowOutputDevice
;
111 class PhysicalFontCollection
;
112 class PhysicalFontFaceCollection
;
116 class ImplLayoutArgs
;
117 class TextLayoutCache
;
125 typedef B2IVector B2ISize
;
128 namespace com::sun::star::awt
{
132 namespace com::sun::star::rendering
{
136 namespace com::sun::star::linguistic2
{
139 namespace com::sun::star::i18n
{
140 class XBreakIterator
;
143 // OutputDevice-Types
145 enum OutDevType
{ OUTDEV_WINDOW
, OUTDEV_PRINTER
, OUTDEV_VIRDEV
, OUTDEV_PDF
};
147 enum class OutDevViewType
{ DontKnow
, PrintPreview
, SlideShow
};
151 typedef tools::SvRef
<FontCharMap
> FontCharMapRef
;
153 BmpMirrorFlags
AdjustTwoRect( SalTwoRect
& rTwoRect
, const Size
& rSizePix
);
154 void AdjustTwoRect( SalTwoRect
& rTwoRect
, const tools::Rectangle
& rValidSrcRect
);
159 typedef OutputDevice RenderContext
;
162 VCL_DLLPUBLIC
void InvertFocusRect(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
);
165 * Some things multiple-inherit from VclAbstractDialog and OutputDevice,
166 * so we need to use virtual inheritance to keep the referencing counting
169 class SAL_WARN_UNUSED VCL_DLLPUBLIC OutputDevice
: public virtual VclReferenceBase
171 friend class Printer
;
172 friend class VirtualDevice
;
173 friend class vcl::Window
;
174 friend class vcl::WindowOutputDevice
;
175 friend class WorkWindow
;
176 friend void ImplHandleResize( vcl::Window
* pWindow
, tools::Long nNewWidth
, tools::Long nNewHeight
);
179 OutputDevice(const OutputDevice
&) = delete;
180 OutputDevice
& operator=(const OutputDevice
&) = delete;
182 mutable SalGraphics
* mpGraphics
; ///< Graphics context to draw on
183 mutable VclPtr
<OutputDevice
> mpPrevGraphics
; ///< Previous output device in list
184 mutable VclPtr
<OutputDevice
> mpNextGraphics
; ///< Next output device in list
185 GDIMetaFile
* mpMetaFile
;
186 mutable rtl::Reference
<LogicalFontInstance
> mpFontInstance
;
187 mutable std::unique_ptr
<vcl::font::PhysicalFontFaceCollection
> mpFontFaceCollection
;
188 std::vector
<vcl::State
> maOutDevStateStack
;
189 std::unique_ptr
<ImplOutDevData
> mpOutDevData
;
190 std::vector
< VCLXGraphics
* >* mpUnoGraphicsList
;
191 vcl::ExtOutDevData
* mpExtOutDevData
;
192 // The canvas interface for this output device. Is persistent after the first GetCanvas() call
193 mutable css::uno::WeakReference
< css::rendering::XCanvas
> mxCanvas
;
196 VclPtr
<VirtualDevice
> mpAlphaVDev
;
198 /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
199 tools::Long mnOutOffOrigX
;
200 /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
201 tools::Long mnOutOffLogicX
;
202 /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
203 tools::Long mnOutOffOrigY
;
204 /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
205 tools::Long mnOutOffLogicY
;
206 /// Output offset for device output in pixel (pseudo window offset within window system's frames)
207 tools::Long mnOutOffX
;
208 /// Output offset for device output in pixel (pseudo window offset within window system's frames)
209 tools::Long mnOutOffY
;
210 tools::Long mnOutWidth
;
211 tools::Long mnOutHeight
;
214 sal_Int32 mnDPIScalePercentage
; ///< For HiDPI displays, we want to draw elements for a percentage larger
215 /// font specific text alignment offsets in pixel units
216 mutable tools::Long mnTextOffX
;
217 mutable tools::Long mnTextOffY
;
218 mutable tools::Long mnEmphasisAscent
;
219 mutable tools::Long mnEmphasisDescent
;
220 DrawModeFlags mnDrawMode
;
221 vcl::text::ComplexTextLayoutFlags mnTextLayoutMode
;
223 const OutDevType meOutDevType
;
224 OutDevViewType meOutDevViewType
;
225 vcl::Region maRegion
; // contains the clip region, see SetClipRegion(...)
230 Color maTextLineColor
;
231 Color maOverlineColor
;
233 Wallpaper maBackground
;
234 std::optional
<AllSettings
> moSettings
;
237 AntialiasingFlags mnAntialiasing
;
238 LanguageType meTextLanguage
;
240 mutable bool mbMap
: 1;
241 mutable bool mbClipRegion
: 1;
242 mutable bool mbBackground
: 1;
243 mutable bool mbOutput
: 1;
244 mutable bool mbDevOutput
: 1;
245 mutable bool mbOutputClipped
: 1;
246 mutable bool mbLineColor
: 1;
247 mutable bool mbFillColor
: 1;
248 mutable bool mbInitLineColor
: 1;
249 mutable bool mbInitFillColor
: 1;
250 mutable bool mbInitFont
: 1;
251 mutable bool mbInitTextColor
: 1;
252 mutable bool mbInitClipRegion
: 1;
253 mutable bool mbClipRegionSet
: 1;
254 mutable bool mbNewFont
: 1;
255 mutable bool mbTextLines
: 1;
256 mutable bool mbTextSpecial
: 1;
257 mutable bool mbRefPoint
: 1;
258 mutable bool mbEnableRTL
: 1;
261 mutable std::shared_ptr
<vcl::font::PhysicalFontCollection
> mxFontCollection
;
262 mutable std::shared_ptr
<ImplFontCache
> mxFontCache
;
264 /** @name Initialization and accessor functions
269 OutputDevice(OutDevType eOutDevType
);
270 virtual ~OutputDevice() override
;
271 virtual void dispose() override
;
275 /** Get the graphic context that the output device uses to draw on.
277 If no graphics device exists, then initialize it.
279 @returns SalGraphics instance.
281 SalGraphics
const *GetGraphics() const;
282 SalGraphics
* GetGraphics();
284 void SetConnectMetaFile( GDIMetaFile
* pMtf
);
285 GDIMetaFile
* GetConnectMetaFile() const { return mpMetaFile
; }
287 virtual void SetSettings( const AllSettings
& rSettings
);
288 const AllSettings
& GetSettings() const { return *moSettings
; }
290 SystemGraphicsData
GetSystemGfxData() const;
291 OUString
GetRenderBackendName() const;
293 // Used by the canvas module. Despite the name it does not always return true if Cairo is supported.
294 bool SupportsCairo() const;
295 /// Create Surface from given cairo surface
296 cairo::SurfaceSharedPtr
CreateSurface(const cairo::CairoSurfaceSharedPtr
& rSurface
) const;
297 /// Create surface with given dimensions
298 cairo::SurfaceSharedPtr
CreateSurface(int x
, int y
, int width
, int height
) const;
299 /// Create Surface for given bitmap data
300 cairo::SurfaceSharedPtr
CreateBitmapSurface(const BitmapSystemData
& rData
, const Size
& rSize
) const;
301 /// Return native handle for underlying surface
302 css::uno::Any
GetNativeSurfaceHandle(cairo::SurfaceSharedPtr
& rSurface
, const basegfx::B2ISize
& rSize
) const;
303 css::uno::Any
GetSystemGfxDataAny() const;
306 void SetRefPoint( const Point
& rRefPoint
);
307 const Point
& GetRefPoint() const { return maRefPoint
; }
308 bool IsRefPoint() const { return mbRefPoint
; }
310 virtual bool IsScreenComp() const { return true; }
312 virtual sal_uInt16
GetBitCount() const;
314 Size
GetOutputSizePixel() const
315 { return Size( mnOutWidth
, mnOutHeight
); }
316 tools::Long
GetOutputWidthPixel() const { return mnOutWidth
; }
317 tools::Long
GetOutputHeightPixel() const { return mnOutHeight
; }
318 tools::Long
GetOutOffXPixel() const { return mnOutOffX
; }
319 tools::Long
GetOutOffYPixel() const { return mnOutOffY
; }
320 void SetOutOffXPixel(tools::Long nOutOffX
);
321 void SetOutOffYPixel(tools::Long nOutOffY
);
322 Point
GetOutputOffPixel() const
323 { return Point( mnOutOffX
, mnOutOffY
); }
324 tools::Rectangle
GetOutputRectPixel() const
325 { return tools::Rectangle(GetOutputOffPixel(), GetOutputSizePixel() ); }
327 Size
GetOutputSize() const
328 { return PixelToLogic( GetOutputSizePixel() ); }
330 css::uno::Reference
< css::awt::XGraphics
>
332 std::vector
< VCLXGraphics
* > *GetUnoGraphicsList() const { return mpUnoGraphicsList
; }
333 std::vector
< VCLXGraphics
* > *CreateUnoGraphicsList();
335 virtual size_t GetSyncCount() const { return 0xffffffff; }
337 /// request XCanvas render interface
338 css::uno::Reference
< css::rendering::XCanvas
> GetCanvas() const;
339 /// request XSpriteCanvas render interface
340 css::uno::Reference
< css::rendering::XSpriteCanvas
> GetSpriteCanvas() const;
344 /** Acquire a graphics device that the output device uses to draw on.
346 There is an LRU of OutputDevices that is used to get the graphics. The
347 actual creation of a SalGraphics instance is done via the SalFrame
350 However, the SalFrame instance will only return a valid SalGraphics
351 instance if it is not in use or there wasn't one in the first place. When
352 this happens, AcquireGraphics finds the least recently used OutputDevice
353 in a different frame and "steals" it (releases it then starts using it).
355 If there are no frames to steal an OutputDevice's SalGraphics instance from
356 then it blocks until the graphics is released.
358 Once it has acquired a graphics instance, then we add the OutputDevice to
361 @returns true if was able to initialize the graphics device, false otherwise.
363 virtual bool AcquireGraphics() const = 0;
365 /** Release the graphics device, and remove it from the graphics device
368 @param bRelease Determines whether to release the fonts of the
369 physically released graphics device.
371 virtual void ReleaseGraphics( bool bRelease
= true ) = 0;
375 /** @name Helper functions
381 /** Get the output device's DPI x-axis value.
383 @returns x-axis DPI value
385 SAL_DLLPRIVATE sal_Int32
GetDPIX() const { return mnDPIX
; }
387 /** Get the output device's DPI y-axis value.
389 @returns y-axis DPI value
391 SAL_DLLPRIVATE sal_Int32
GetDPIY() const { return mnDPIY
; }
393 SAL_DLLPRIVATE
void SetDPIX( sal_Int32 nDPIX
) { mnDPIX
= nDPIX
; }
394 SAL_DLLPRIVATE
void SetDPIY( sal_Int32 nDPIY
) { mnDPIY
= nDPIY
; }
396 float GetDPIScaleFactor() const
398 return mnDPIScalePercentage
/ 100.0f
;
401 sal_Int32
GetDPIScalePercentage() const
403 return mnDPIScalePercentage
;
406 OutDevType
GetOutDevType() const { return meOutDevType
; }
407 virtual bool IsVirtual() const;
409 /** Query an OutputDevice to see whether it supports a specific operation
411 @returns true if operation supported, else false
413 bool SupportsOperation( OutDevSupportType
) const;
415 void SetExtOutDevData( vcl::ExtOutDevData
* pExtOutDevData
) { mpExtOutDevData
= pExtOutDevData
; }
416 vcl::ExtOutDevData
* GetExtOutDevData() const { return mpExtOutDevData
; }
421 virtual Size
GetButtonBorderSize() { return Size(1, 1); };
422 virtual Color
GetMonochromeButtonColor() { return COL_WHITE
; }
424 /** @name Direct OutputDevice drawing functions
429 virtual void Flush() {}
431 virtual void DrawOutDev(
432 const Point
& rDestPt
, const Size
& rDestSize
,
433 const Point
& rSrcPt
, const Size
& rSrcSize
);
435 virtual void DrawOutDev(
436 const Point
& rDestPt
, const Size
& rDestSize
,
437 const Point
& rSrcPt
, const Size
& rSrcSize
,
438 const OutputDevice
& rOutDev
);
440 virtual void CopyArea(
441 const Point
& rDestPt
,
442 const Point
& rSrcPt
, const Size
& rSrcSize
,
443 bool bWindowInvalidate
= false );
447 virtual void CopyDeviceArea( SalTwoRect
& aPosAry
, bool bWindowInvalidate
);
449 virtual tools::Rectangle
GetBackgroundComponentBounds() const;
451 virtual const OutputDevice
* DrawOutDevDirectCheck(const OutputDevice
& rSrcDev
) const;
453 virtual void DrawOutDevDirectProcess(const OutputDevice
& rSrcDev
, SalTwoRect
& rPosAry
, SalGraphics
* pSrcGraphics
);
455 SAL_DLLPRIVATE
void drawOutDevDirect(const OutputDevice
& rSrcDev
, SalTwoRect
& rPosAry
);
457 SAL_DLLPRIVATE
bool is_double_buffered_window() const;
459 virtual css::uno::Reference
< css::rendering::XCanvas
> ImplGetCanvas( bool bSpriteCanvas
) const;
460 SAL_DLLPRIVATE
void ImplDisposeCanvas();
464 // not implemented; to detect misuses of DrawOutDev(...OutputDevice&);
465 SAL_DLLPRIVATE
void DrawOutDev( const Point
&, const Size
&, const Point
&, const Size
&, const Printer
&) = delete;
469 /** @name OutputDevice state functions
475 void Push( vcl::PushFlags nFlags
= vcl::PushFlags::ALL
);
479 void EnableOutput( bool bEnable
= true );
480 bool IsOutputEnabled() const { return mbOutput
; }
481 bool IsDeviceOutputNecessary() const { return (mbOutput
&& mbDevOutput
); }
483 void SetAntialiasing( AntialiasingFlags nMode
);
484 AntialiasingFlags
GetAntialiasing() const { return mnAntialiasing
; }
486 void SetDrawMode( DrawModeFlags nDrawMode
);
487 DrawModeFlags
GetDrawMode() const { return mnDrawMode
; }
489 void SetLayoutMode( vcl::text::ComplexTextLayoutFlags nTextLayoutMode
);
490 vcl::text::ComplexTextLayoutFlags
GetLayoutMode() const { return mnTextLayoutMode
; }
492 void SetDigitLanguage( LanguageType
);
493 LanguageType
GetDigitLanguage() const { return meTextLanguage
; }
495 void SetRasterOp( RasterOp eRasterOp
);
496 RasterOp
GetRasterOp() const { return meRasterOp
; }
499 If this OutputDevice is used for displaying a Print Preview
500 the OutDevViewType should be set to 'OutDevViewType::PrintPreview'.
502 A View can then make painting decisions dependent on this OutDevViewType.
503 E.g. text colors need to be handled differently, dependent on whether it's a PrintPreview or not. (see #106611# for more)
505 void SetOutDevViewType( OutDevViewType eOutDevViewType
) { meOutDevViewType
=eOutDevViewType
; }
506 OutDevViewType
GetOutDevViewType() const { return meOutDevViewType
; }
509 void SetLineColor( const Color
& rColor
);
510 const Color
& GetLineColor() const { return maLineColor
; }
511 bool IsLineColor() const { return mbLineColor
; }
514 void SetFillColor( const Color
& rColor
);
515 const Color
& GetFillColor() const { return maFillColor
; }
516 bool IsFillColor() const { return mbFillColor
; }
518 void SetBackground();
519 void SetBackground( const Wallpaper
& rBackground
);
520 virtual void SaveBackground(VirtualDevice
& rSaveDevice
,
521 const Point
& rPos
, const Size
& rSize
, const Size
& rBackgroundSize
) const;
523 const Wallpaper
& GetBackground() const { return maBackground
; }
524 virtual Color
GetBackgroundColor() const;
525 virtual Color
GetReadableFontColor(const Color
& rFontColor
, const Color
& rBgColor
) const;
526 bool IsBackground() const { return mbBackground
; }
528 void SetFont( const vcl::Font
& rNewFont
);
529 const vcl::Font
& GetFont() const { return maFont
; }
533 virtual void ImplReleaseFonts();
537 SAL_DLLPRIVATE
void InitLineColor();
539 SAL_DLLPRIVATE
void InitFillColor();
544 /** @name Clipping functions
550 vcl::Region
GetClipRegion() const;
551 void SetClipRegion();
552 void SetClipRegion( const vcl::Region
& rRegion
);
553 bool SelectClipRegion( const vcl::Region
&, SalGraphics
* pGraphics
= nullptr );
555 bool IsClipRegion() const { return mbClipRegion
; }
557 void MoveClipRegion( tools::Long nHorzMove
, tools::Long nVertMove
);
558 void IntersectClipRegion( const tools::Rectangle
& rRect
);
559 void IntersectClipRegion( const vcl::Region
& rRegion
);
561 virtual vcl::Region
GetActiveClipRegion() const;
562 virtual vcl::Region
GetOutputBoundsClipRegion() const;
566 virtual void InitClipRegion();
568 /** Perform actual rect clip against outdev dimensions, to generate
569 empty clips whenever one of the values is completely off the device.
571 @param aRegion region to be clipped to the device dimensions
572 @returns region clipped to the device bounds
574 virtual vcl::Region
ClipToDeviceBounds(vcl::Region aRegion
) const;
575 virtual void ClipToPaintRegion ( tools::Rectangle
& rDstRect
);
579 SAL_DLLPRIVATE
void SetDeviceClipRegion( const vcl::Region
* pRegion
);
583 virtual void DrawBorder(tools::Rectangle aBorderRect
);
586 /** @name Pixel functions
592 void DrawPixel( const Point
& rPt
);
593 void DrawPixel( const Point
& rPt
, const Color
& rColor
);
595 Color
GetPixel( const Point
& rPt
) const;
599 /** @name Rectangle functions
605 void DrawRect( const tools::Rectangle
& rRect
);
606 void DrawRect( const tools::Rectangle
& rRect
,
607 sal_uLong nHorzRount
, sal_uLong nVertRound
);
609 /// Fill the given rectangle with checkered rectangles of size nLen x nLen using the colors aStart and aEnd
614 Color aStart
= COL_WHITE
,
615 Color aEnd
= COL_BLACK
);
617 void DrawGrid( const tools::Rectangle
& rRect
, const Size
& rDist
, DrawGridFlags nFlags
);
621 /** @name Invert functions
625 void Invert( const tools::Rectangle
& rRect
, InvertFlags nFlags
= InvertFlags::NONE
);
626 void Invert( const tools::Polygon
& rPoly
, InvertFlags nFlags
= InvertFlags::NONE
);
629 /** @name Line functions
635 void DrawLine( const Point
& rStartPt
, const Point
& rEndPt
);
637 void DrawLine( const Point
& rStartPt
, const Point
& rEndPt
,
638 const LineInfo
& rLineInfo
);
641 virtual void DrawHatchLine_DrawLine(const Point
& rStartPoint
, const Point
& rEndPoint
);
645 /** Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area)
647 SAL_DLLPRIVATE
void drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon
, const LineInfo
& rInfo
);
651 /** @name Polyline functions
657 /** Render the given polygon as a line stroke
659 The given polygon is stroked with the current LineColor, start
660 and end point are not automatically connected
665 void DrawPolyLine( const tools::Polygon
& rPoly
);
668 const basegfx::B2DPolygon
&,
669 double fLineWidth
= 0.0,
670 basegfx::B2DLineJoin eLineJoin
= basegfx::B2DLineJoin::Round
,
671 css::drawing::LineCap eLineCap
= css::drawing::LineCap_BUTT
,
672 double fMiterMinimumAngle
= basegfx::deg2rad(15.0));
674 /** Render the given polygon as a line stroke
676 The given polygon is stroked with the current LineColor, start
677 and end point are not automatically connected. The line is
678 rendered according to the specified LineInfo, e.g. supplying a
679 dash pattern, or a line thickness.
684 void DrawPolyLine( const tools::Polygon
& rPoly
,
685 const LineInfo
& rLineInfo
);
688 // Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool.
689 bool DrawPolyLineDirect(
690 const basegfx::B2DHomMatrix
& rObjectTransform
,
691 const basegfx::B2DPolygon
& rB2DPolygon
,
692 double fLineWidth
= 0.0,
693 double fTransparency
= 0.0,
694 const std::vector
< double >* = nullptr, // MM01
695 basegfx::B2DLineJoin eLineJoin
= basegfx::B2DLineJoin::NONE
,
696 css::drawing::LineCap eLineCap
= css::drawing::LineCap_BUTT
,
697 double fMiterMinimumAngle
= basegfx::deg2rad(15.0));
702 // Helper which holds the old line geometry creation and is extended to use AA when
703 // switched on. Advantage is that line geometry is only temporarily used for paint
704 SAL_DLLPRIVATE
void drawPolyLine(const tools::Polygon
& rPoly
, const LineInfo
& rLineInfo
);
708 bool DrawPolyLineDirectInternal(
709 const basegfx::B2DHomMatrix
& rObjectTransform
,
710 const basegfx::B2DPolygon
& rB2DPolygon
,
711 double fLineWidth
= 0.0,
712 double fTransparency
= 0.0,
713 const std::vector
< double >* = nullptr, // MM01
714 basegfx::B2DLineJoin eLineJoin
= basegfx::B2DLineJoin::NONE
,
715 css::drawing::LineCap eLineCap
= css::drawing::LineCap_BUTT
,
716 double fMiterMinimumAngle
= basegfx::deg2rad(15.0));
718 /** @name Polygon functions
724 /** Render the given polygon
726 The given polygon is stroked with the current LineColor, and
727 filled with the current FillColor. If one of these colors are
728 transparent, the corresponding stroke or fill stays
729 invisible. Start and end point of the polygon are
730 automatically connected.
734 void DrawPolygon( const tools::Polygon
& rPoly
);
735 void DrawPolygon( const basegfx::B2DPolygon
& );
737 /** Render the given poly-polygon
739 The given poly-polygon is stroked with the current LineColor,
740 and filled with the current FillColor. If one of these colors
741 are transparent, the corresponding stroke or fill stays
742 invisible. Start and end points of the contained polygons are
743 automatically connected.
747 void DrawPolyPolygon( const tools::PolyPolygon
& rPolyPoly
);
748 void DrawPolyPolygon( const basegfx::B2DPolyPolygon
& );
752 SAL_DLLPRIVATE
void ImplDrawPolygon( const tools::Polygon
& rPoly
, const tools::PolyPolygon
* pClipPolyPoly
= nullptr );
753 SAL_DLLPRIVATE
void ImplDrawPolyPolygon( const tools::PolyPolygon
& rPolyPoly
, const tools::PolyPolygon
* pClipPolyPoly
);
754 SAL_DLLPRIVATE
void ImplDrawPolyPolygon( sal_uInt16 nPoly
, const tools::PolyPolygon
& rPolyPoly
);
756 // Helper who implements the DrawPolyPolygon functionality for basegfx::B2DPolyPolygon
757 // without MetaFile processing
758 SAL_DLLPRIVATE
void ImplDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPolygon
& rB2DPolyPoly
);
761 SAL_DLLPRIVATE
void ImplDrawWaveLineBezier(tools::Long nStartX
, tools::Long nStartY
, tools::Long nEndX
, tools::Long nEndY
, tools::Long nWaveHeight
, double fOrientation
, tools::Long nLineWidth
);
764 /** @name Curved shape functions
770 void DrawEllipse( const tools::Rectangle
& rRect
);
773 const tools::Rectangle
& rRect
,
774 const Point
& rStartPt
, const Point
& rEndPt
);
777 const tools::Rectangle
& rRect
,
778 const Point
& rStartPt
, const Point
& rEndPt
);
781 const tools::Rectangle
& rRect
,
782 const Point
& rStartPt
, const Point
& rEndPt
);
787 /** @name Gradient functions
792 void DrawGradient( const tools::Rectangle
& rRect
, const Gradient
& rGradient
);
793 void DrawGradient( const tools::PolyPolygon
& rPolyPoly
, const Gradient
& rGradient
);
797 virtual bool UsePolyPolygonForComplexGradient() = 0;
799 virtual tools::Long
GetGradientStepCount( tools::Long nMinRect
);
803 SAL_DLLPRIVATE
void DrawLinearGradient( const tools::Rectangle
& rRect
, const Gradient
& rGradient
, const tools::PolyPolygon
* pClipPolyPoly
);
804 SAL_DLLPRIVATE
void DrawComplexGradient( const tools::Rectangle
& rRect
, const Gradient
& rGradient
, const tools::PolyPolygon
* pClipPolyPoly
);
805 SAL_DLLPRIVATE
void DrawGradientToMetafile( const tools::PolyPolygon
& rPolyPoly
, const Gradient
& rGradient
);
806 SAL_DLLPRIVATE
tools::Long
GetGradientSteps(Gradient
const& rGradient
, tools::Rectangle
const& rRect
);
807 SAL_DLLPRIVATE Color
GetSingleColorGradientFill();
811 /** @name Hatch functions
818 void DrawHatch( const tools::PolyPolygon
& rPolyPoly
, const ::Hatch
& rHatch
);
819 void AddHatchActions( const tools::PolyPolygon
& rPolyPoly
,
820 const ::Hatch
& rHatch
,
823 void DrawHatch( const tools::PolyPolygon
& rPolyPoly
, const Hatch
& rHatch
);
824 void AddHatchActions( const tools::PolyPolygon
& rPolyPoly
,
829 void DrawHatch( const tools::PolyPolygon
& rPolyPoly
, const Hatch
& rHatch
, bool bMtf
);
833 SAL_DLLPRIVATE
void CalcHatchValues( const tools::Rectangle
& rRect
, tools::Long nDist
, Degree10 nAngle10
, Point
& rPt1
, Point
& rPt2
, Size
& rInc
, Point
& rEndPt1
);
834 SAL_DLLPRIVATE
void DrawHatchLine( const tools::Line
& rLine
, const tools::PolyPolygon
& rPolyPoly
, Point
* pPtBuffer
, bool bMtf
);
838 /** @name Wallpaper functions
843 void DrawWallpaper( const tools::Rectangle
& rRect
, const Wallpaper
& rWallpaper
);
846 void Erase(const tools::Rectangle
& rRect
);
849 void DrawGradientWallpaper( tools::Long nX
, tools::Long nY
, tools::Long nWidth
, tools::Long nHeight
, const Wallpaper
& rWallpaper
);
852 SAL_DLLPRIVATE
void DrawWallpaper( tools::Long nX
, tools::Long nY
, tools::Long nWidth
, tools::Long nHeight
, const Wallpaper
& rWallpaper
);
853 SAL_DLLPRIVATE
void DrawColorWallpaper( tools::Long nX
, tools::Long nY
, tools::Long nWidth
, tools::Long nHeight
, const Wallpaper
& rWallpaper
);
854 SAL_DLLPRIVATE
void DrawBitmapWallpaper( tools::Long nX
, tools::Long nY
, tools::Long nWidth
, tools::Long nHeight
, const Wallpaper
& rWallpaper
);
858 /** @name Text functions
864 void DrawText( const Point
& rStartPt
, const OUString
& rStr
,
865 sal_Int32 nIndex
= 0, sal_Int32 nLen
= -1,
866 std::vector
< tools::Rectangle
>* pVector
= nullptr, OUString
* pDisplayText
= nullptr,
867 const SalLayoutGlyphs
* pLayoutCache
= nullptr );
869 void DrawText( const tools::Rectangle
& rRect
,
870 const OUString
& rStr
, DrawTextFlags nStyle
= DrawTextFlags::NONE
,
871 std::vector
< tools::Rectangle
>* pVector
= nullptr, OUString
* pDisplayText
= nullptr,
872 vcl::ITextLayout
* _pTextLayout
= nullptr );
874 static void ImplDrawText( OutputDevice
& rTargetDevice
, const tools::Rectangle
& rRect
,
875 const OUString
& rOrigStr
, DrawTextFlags nStyle
,
876 std::vector
< tools::Rectangle
>* pVector
, OUString
* pDisplayText
, vcl::ITextLayout
& _rLayout
);
878 void ImplDrawText( SalLayout
& );
880 void ImplDrawTextBackground( const SalLayout
& );
882 void DrawCtrlText( const Point
& rPos
, const OUString
& rStr
,
883 sal_Int32 nIndex
= 0, sal_Int32 nLen
= -1,
884 DrawTextFlags nStyle
= DrawTextFlags::Mnemonic
, std::vector
< tools::Rectangle
>* pVector
= nullptr, OUString
* pDisplayText
= nullptr,
885 const SalLayoutGlyphs
* pGlyphs
= nullptr);
887 void DrawTextLine( const Point
& rPos
, tools::Long nWidth
,
888 FontStrikeout eStrikeout
,
889 FontLineStyle eUnderline
,
890 FontLineStyle eOverline
,
891 bool bUnderlineAbove
= false );
893 void ImplDrawTextLine( tools::Long nBaseX
, tools::Long nX
, tools::Long nY
, DeviceCoordinate nWidth
,
894 FontStrikeout eStrikeout
, FontLineStyle eUnderline
,
895 FontLineStyle eOverline
, bool bUnderlineAbove
);
897 void ImplDrawTextLines( SalLayout
&, FontStrikeout eStrikeout
, FontLineStyle eUnderline
,
898 FontLineStyle eOverline
, bool bWordLine
, bool bUnderlineAbove
);
900 void DrawWaveLine( const Point
& rStartPos
, const Point
& rEndPos
, tools::Long nLineWidth
= 1, tools::Long nWaveHeight
= 3);
902 bool ImplDrawRotateText( SalLayout
& );
904 tools::Rectangle
GetTextRect( const tools::Rectangle
& rRect
,
905 const OUString
& rStr
, DrawTextFlags nStyle
= DrawTextFlags::WordBreak
,
906 TextRectInfo
* pInfo
= nullptr,
907 const vcl::ITextLayout
* _pTextLayout
= nullptr ) const;
909 /** Return the exact bounding rectangle of rStr.
911 The text is then drawn exactly from rRect.TopLeft() to
912 rRect.BottomRight(), don't assume that rRect.TopLeft() is [0, 0].
914 Please note that you don't always want to use GetTextBoundRect(); in
915 many cases you actually want to use GetTextHeight(), because
916 GetTextBoundRect() gives you the exact bounding rectangle regardless
917 what is the baseline of the text.
919 Code snippet to get just exactly the text (no filling around that) as
920 a bitmap via a VirtualDevice (regardless what is the baseline):
923 VirtualDevice aDevice;
924 vcl::Font aFont = aDevice.GetFont();
925 aFont.SetSize(Size(0, 96));
926 aFont.SetColor(COL_BLACK);
927 aDevice.SetFont(aFont);
930 tools::Rectangle aRect;
931 aDevice.GetTextBoundRect(aRect, aText);
932 aDevice.SetOutputSize(Size(aRect.Right() + 1, aRect.Bottom() + 1));
933 aDevice.SetBackground(Wallpaper(COL_TRANSPARENT));
934 aDevice.DrawText(Point(0,0), aText);
936 // exactly only the text, regardless of the baseline
937 Bitmap aBitmap(aDevice.GetBitmap(aRect.TopLeft(), aRect.GetSize()));
940 Code snippet to get the text as a bitmap via a Virtual device that
941 contains even the filling so that the baseline is always preserved
942 (ie. the text will not jump up and down according to whether it
943 contains 'y' or not etc.)
946 VirtualDevice aDevice;
947 // + the appropriate font / device setup, see above
949 aDevice.SetOutputSize(Size(aDevice.GetTextWidth(aText), aDevice.GetTextHeight()));
950 aDevice.SetBackground(Wallpaper(COL_TRANSPARENT));
951 aDevice.DrawText(Point(0,0), aText);
953 // bitmap that contains even the space around the text,
954 // that means, preserves the baseline etc.
955 Bitmap aBitmap(aDevice.GetBitmap(Point(0, 0), aDevice.GetOutputSize()));
958 bool GetTextBoundRect( tools::Rectangle
& rRect
,
959 const OUString
& rStr
, sal_Int32 nBase
= 0, sal_Int32 nIndex
= 0, sal_Int32 nLen
= -1,
960 sal_uLong nLayoutWidth
= 0, KernArraySpan aDXArray
= KernArraySpan(),
961 o3tl::span
<const sal_Bool
> pKashidaArray
= {},
962 const SalLayoutGlyphs
* pGlyphs
= nullptr ) const;
964 tools::Rectangle
ImplGetTextBoundRect( const SalLayout
& ) const;
966 bool GetTextOutline( tools::PolyPolygon
&,
967 const OUString
& rStr
) const;
969 bool GetTextOutlines( PolyPolyVector
&,
970 const OUString
& rStr
, sal_Int32 nBase
= 0, sal_Int32 nIndex
= 0,
972 sal_uLong nLayoutWidth
= 0, KernArraySpan aDXArray
= KernArraySpan(),
973 o3tl::span
<const sal_Bool
> pKashidaArray
= {} ) const;
975 bool GetTextOutlines( basegfx::B2DPolyPolygonVector
&rVector
,
976 const OUString
& rStr
, sal_Int32 nBase
, sal_Int32 nIndex
= 0,
978 sal_uLong nLayoutWidth
= 0, KernArraySpan aDXArray
= KernArraySpan(),
979 o3tl::span
<const sal_Bool
> pKashidaArray
= {} ) const;
982 OUString
GetEllipsisString( const OUString
& rStr
, tools::Long nMaxWidth
,
983 DrawTextFlags nStyle
= DrawTextFlags::EndEllipsis
) const;
985 tools::Long
GetCtrlTextWidth( const OUString
& rStr
,
986 const SalLayoutGlyphs
* pLayoutCache
= nullptr ) const;
988 /** Generate MetaTextActions for the text rect
990 This method splits up the text rect into multiple
991 MetaTextActions, one for each line of text. This is comparable
992 to AddGradientActions(), which splits up a gradient into its
993 constituent polygons. Parameter semantics fully compatible to
996 void AddTextRectActions( const tools::Rectangle
& rRect
,
997 const OUString
& rOrigStr
,
998 DrawTextFlags nStyle
,
1001 void SetTextColor( const Color
& rColor
);
1002 virtual void SetSystemTextColor(SystemTextColorFlags nFlags
, bool bEnabled
);
1003 const Color
& GetTextColor() const { return maTextColor
; }
1005 void SetTextFillColor();
1006 void SetTextFillColor( const Color
& rColor
);
1007 Color
GetTextFillColor() const;
1008 bool IsTextFillColor() const { return !maFont
.IsTransparent(); }
1010 void SetTextLineColor();
1011 void SetTextLineColor( const Color
& rColor
);
1012 const Color
& GetTextLineColor() const { return maTextLineColor
; }
1013 bool IsTextLineColor() const { return !maTextLineColor
.IsTransparent(); }
1015 void SetOverlineColor();
1016 void SetOverlineColor( const Color
& rColor
);
1017 const Color
& GetOverlineColor() const { return maOverlineColor
; }
1018 bool IsOverlineColor() const { return !maOverlineColor
.IsTransparent(); }
1020 void SetTextAlign( TextAlign eAlign
);
1021 TextAlign
GetTextAlign() const { return maFont
.GetAlignment(); }
1023 /** Width of the text.
1025 See also GetTextBoundRect() for more explanation + code examples.
1027 tools::Long
GetTextWidth( const OUString
& rStr
, sal_Int32 nIndex
= 0, sal_Int32 nLen
= -1,
1028 vcl::text::TextLayoutCache
const* = nullptr,
1029 SalLayoutGlyphs
const*const pLayoutCache
= nullptr) const;
1031 /** Height where any character of the current font fits; in logic coordinates.
1033 See also GetTextBoundRect() for more explanation + code examples.
1035 tools::Long
GetTextHeight() const;
1036 float approximate_digit_width() const;
1038 void DrawTextArray( const Point
& rStartPt
, const OUString
& rStr
,
1039 KernArraySpan aKernArray
,
1040 o3tl::span
<const sal_Bool
> pKashidaAry
,
1043 SalLayoutFlags flags
= SalLayoutFlags::NONE
,
1044 const SalLayoutGlyphs
* pLayoutCache
= nullptr);
1045 tools::Long
GetTextArray( const OUString
& rStr
, KernArray
* pDXAry
,
1046 sal_Int32 nIndex
= 0, sal_Int32 nLen
= -1, bool bCaret
= false,
1047 vcl::text::TextLayoutCache
const* = nullptr,
1048 SalLayoutGlyphs
const*const pLayoutCache
= nullptr) const;
1050 void GetCaretPositions( const OUString
&, sal_Int32
* pCaretXArray
,
1051 sal_Int32 nIndex
, sal_Int32 nLen
,
1052 const SalLayoutGlyphs
* pGlyphs
= nullptr ) const;
1053 void DrawStretchText( const Point
& rStartPt
, sal_Int32 nWidth
,
1054 const OUString
& rStr
,
1055 sal_Int32 nIndex
= 0, sal_Int32 nLen
= -1);
1056 sal_Int32
GetTextBreak( const OUString
& rStr
, tools::Long nTextWidth
,
1057 sal_Int32 nIndex
, sal_Int32 nLen
= -1,
1058 tools::Long nCharExtra
= 0,
1059 vcl::text::TextLayoutCache
const* = nullptr,
1060 const SalLayoutGlyphs
* pGlyphs
= nullptr) const;
1061 sal_Int32
GetTextBreak( const OUString
& rStr
, tools::Long nTextWidth
,
1062 sal_Unicode nExtraChar
, sal_Int32
& rExtraCharPos
,
1063 sal_Int32 nIndex
, sal_Int32 nLen
,
1064 tools::Long nCharExtra
,
1065 vcl::text::TextLayoutCache
const* = nullptr,
1066 const SalLayoutGlyphs
* pGlyphs
= nullptr) const;
1067 static std::shared_ptr
<const vcl::text::TextLayoutCache
> CreateTextLayoutCache(OUString
const&);
1069 SAL_DLLPRIVATE SalLayoutFlags
GetBiDiLayoutFlags( std::u16string_view rStr
,
1070 const sal_Int32 nMinIndex
,
1071 const sal_Int32 nEndIndex
) const;
1074 SAL_DLLPRIVATE
void ImplInitTextLineSize();
1075 SAL_DLLPRIVATE
void ImplInitAboveTextLineSize();
1077 SAL_DLLPRIVATE
tools::Long
ImplGetTextLines( const tools::Rectangle
& rRect
, tools::Long nTextHeight
, ImplMultiTextLineInfo
& rLineInfo
, tools::Long nWidth
, const OUString
& rStr
, DrawTextFlags nStyle
, const vcl::ITextLayout
& _rLayout
);
1079 SAL_DLLPRIVATE sal_Int32
ImplBreakLinesWithIterator(const tools::Long nWidth
, const OUString
& rStr
, const vcl::ITextLayout
& _rLayout
,
1080 const css::uno::Reference
<css::linguistic2::XHyphenator
>& xHyph
,
1081 const css::uno::Reference
<css::i18n::XBreakIterator
>& xBI
,
1082 const bool bHyphenate
,
1083 const sal_Int32 nPos
, sal_Int32 nBreakPos
);
1085 SAL_DLLPRIVATE sal_Int32
ImplBreakLinesSimple( const tools::Long nWidth
, const OUString
& rStr
,
1086 const vcl::ITextLayout
& _rLayout
, const sal_Int32 nPos
, sal_Int32 nBreakPos
, tools::Long
& nLineWidth
);
1087 SAL_DLLPRIVATE
float approximate_char_width() const;
1089 virtual bool shouldDrawWavePixelAsRect(tools::Long nLineWidth
) const;
1090 virtual void SetWaveLineColors(Color
const& rColor
, tools::Long nLineWidth
);
1091 virtual Size
GetWaveLineSize(tools::Long nLineWidth
) const;
1094 SAL_DLLPRIVATE
void ImplInitTextColor();
1096 SAL_DLLPRIVATE
void ImplDrawTextDirect( SalLayout
&, bool bTextLines
);
1097 SAL_DLLPRIVATE
void ImplDrawSpecialText( SalLayout
& );
1098 SAL_DLLPRIVATE
void ImplDrawTextRect( tools::Long nBaseX
, tools::Long nBaseY
, tools::Long nX
, tools::Long nY
, tools::Long nWidth
, tools::Long nHeight
);
1100 SAL_DLLPRIVATE
void ImplDrawWavePixel( tools::Long nOriginX
, tools::Long nOriginY
, tools::Long nCurX
, tools::Long nCurY
, tools::Long nWidth
, Degree10 nOrientation
, SalGraphics
* pGraphics
, const OutputDevice
& rOutDev
, tools::Long nPixWidth
, tools::Long nPixHeight
);
1102 SAL_DLLPRIVATE
void ImplDrawWaveLine( tools::Long nBaseX
, tools::Long nBaseY
, tools::Long nStartX
, tools::Long nStartY
, tools::Long nWidth
, tools::Long nHeight
, tools::Long nLineWidth
, Degree10 nOrientation
, const Color
& rColor
);
1103 SAL_DLLPRIVATE
void ImplDrawWaveTextLine( tools::Long nBaseX
, tools::Long nBaseY
, tools::Long nX
, tools::Long nY
, tools::Long nWidth
, FontLineStyle eTextLine
, Color aColor
, bool bIsAbove
);
1104 SAL_DLLPRIVATE
void ImplDrawStraightTextLine( tools::Long nBaseX
, tools::Long nBaseY
, tools::Long nX
, tools::Long nY
, tools::Long nWidth
, FontLineStyle eTextLine
, Color aColor
, bool bIsAbove
);
1105 SAL_DLLPRIVATE
void ImplDrawStrikeoutLine( tools::Long nBaseX
, tools::Long nBaseY
, tools::Long nX
, tools::Long nY
, tools::Long nWidth
, FontStrikeout eStrikeout
, Color aColor
);
1106 SAL_DLLPRIVATE
void ImplDrawStrikeoutChar( tools::Long nBaseX
, tools::Long nBaseY
, tools::Long nX
, tools::Long nY
, tools::Long nWidth
, FontStrikeout eStrikeout
, Color aColor
);
1107 SAL_DLLPRIVATE
void ImplDrawMnemonicLine( tools::Long nX
, tools::Long nY
, tools::Long nWidth
);
1109 SAL_DLLPRIVATE
bool AttemptOLEFontScaleFix(vcl::Font
& rFont
, tools::Long nHeight
) const;
1114 /** @name Font functions
1120 FontMetric
GetFontMetricFromCollection( int nDevFontIndex
) const;
1121 int GetFontFaceCollectionCount() const;
1123 bool IsFontAvailable( std::u16string_view rFontName
) const;
1125 bool AddTempDevFont( const OUString
& rFileURL
, const OUString
& rFontName
);
1126 void RefreshFontData( const bool bNewFontLists
);
1128 FontMetric
GetFontMetric() const;
1129 FontMetric
GetFontMetric( const vcl::Font
& rFont
) const;
1131 bool GetFontCharMap( FontCharMapRef
& rxFontCharMap
) const;
1132 bool GetFontCapabilities( vcl::FontCapabilities
& rFontCapabilities
) const;
1134 bool GetFontFeatures(std::vector
<vcl::font::Feature
>& rFontFeatures
) const;
1136 bool GetGlyphBoundRects( const Point
& rOrigin
, const OUString
& rStr
, int nIndex
,
1137 int nLen
, std::vector
< tools::Rectangle
>& rVector
) const;
1139 sal_Int32
HasGlyphs( const vcl::Font
& rFont
, std::u16string_view rStr
,
1140 sal_Int32 nIndex
= 0, sal_Int32 nLen
= -1 ) const;
1142 tools::Long
GetMinKashida() const;
1145 // validate kashida positions against the current font
1146 // returns count of invalid kashida positions
1147 sal_Int32
ValidateKashidas( const OUString
& rTxt
, sal_Int32 nIdx
, sal_Int32 nLen
,
1148 sal_Int32 nKashCount
, // number of suggested kashida positions (in)
1149 const sal_Int32
* pKashidaPos
, // suggested kashida positions (in)
1150 sal_Int32
* pKashidaPosDropped
// invalid kashida positions (out)
1153 static void BeginFontSubstitution();
1154 static void EndFontSubstitution();
1155 static void AddFontSubstitute( const OUString
& rFontName
,
1156 const OUString
& rReplaceFontName
,
1157 AddFontSubstituteFlags nFlags
);
1158 static void RemoveFontsSubstitute();
1160 static vcl::Font
GetDefaultFont( DefaultFontType nType
,
1162 GetDefaultFontFlags nFlags
,
1163 const OutputDevice
* pOutDev
= nullptr );
1165 SAL_DLLPRIVATE
void ImplInitFontList() const;
1166 SAL_DLLPRIVATE
void ImplUpdateFontData();
1168 //drop font data for all outputdevices.
1169 //If bNewFontLists is true then empty lists of system fonts
1170 static void ImplClearAllFontData( bool bNewFontLists
);
1171 //fetch font data for all outputdevices
1172 //If bNewFontLists is true then fetch lists of system fonts
1173 static void ImplRefreshAllFontData( bool bNewFontLists
);
1174 //drop and fetch font data for all outputdevices
1175 //If bNewFontLists is true then drop and refetch lists of system fonts
1176 SAL_DLLPRIVATE
static void ImplUpdateAllFontData( bool bNewFontLists
);
1178 LogicalFontInstance
const* GetFontInstance() const;
1181 SAL_DLLPRIVATE
tools::Long
GetEmphasisAscent() const { return mnEmphasisAscent
; }
1182 SAL_DLLPRIVATE
tools::Long
GetEmphasisDescent() const { return mnEmphasisDescent
; }
1184 SAL_DLLPRIVATE
bool InitFont() const;
1185 virtual void SetFontOrientation( LogicalFontInstance
* const pFontInstance
) const;
1186 virtual tools::Long
GetFontExtLeading() const;
1188 virtual void ImplClearFontData(bool bNewFontLists
);
1189 virtual void ImplRefreshFontData(bool bNewFontLists
);
1190 void ReleaseFontCache();
1191 void ReleaseFontCollection();
1192 void SetFontCollectionFromSVData();
1193 void ResetNewFontCache();
1195 virtual bool ImplNewFont() const;
1199 typedef void ( OutputDevice::* FontUpdateHandler_t
)( bool );
1201 SAL_DLLPRIVATE
static void ImplUpdateFontDataForAllFrames( FontUpdateHandler_t pHdl
, bool bNewFontLists
);
1204 SAL_DLLPRIVATE OUString
ImplGetEllipsisString( const OutputDevice
& rTargetDevice
, const OUString
& rStr
,
1205 tools::Long nMaxWidth
, DrawTextFlags nStyle
, const vcl::ITextLayout
& _rLayout
);
1207 SAL_DLLPRIVATE
void ImplDrawEmphasisMark( tools::Long nBaseX
, tools::Long nX
, tools::Long nY
, const tools::PolyPolygon
& rPolyPoly
, bool bPolyLine
, const tools::Rectangle
& rRect1
, const tools::Rectangle
& rRect2
);
1208 SAL_DLLPRIVATE
void ImplDrawEmphasisMarks( SalLayout
& );
1212 /** @name Layout functions
1218 // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI
1219 SAL_DLLPRIVATE
bool ImplIsAntiparallel() const ;
1220 SAL_DLLPRIVATE
void ReMirror( Point
&rPoint
) const;
1221 SAL_DLLPRIVATE
void ReMirror( tools::Rectangle
&rRect
) const;
1222 SAL_DLLPRIVATE
void ReMirror( vcl::Region
&rRegion
) const;
1223 SAL_DLLPRIVATE
bool ImplIsRecordLayout() const;
1224 virtual bool HasMirroredGraphics() const;
1225 std::unique_ptr
<SalLayout
>
1226 ImplLayout( const OUString
&, sal_Int32 nIndex
, sal_Int32 nLen
,
1227 const Point
& rLogicPos
= Point(0,0), tools::Long nLogicWidth
=0,
1228 KernArraySpan aKernArray
= KernArraySpan(),
1229 o3tl::span
<const sal_Bool
> pKashidaArray
={},
1230 SalLayoutFlags flags
= SalLayoutFlags::NONE
,
1231 vcl::text::TextLayoutCache
const* = nullptr,
1232 const SalLayoutGlyphs
* pGlyphs
= nullptr) const;
1234 SAL_DLLPRIVATE
vcl::text::ImplLayoutArgs
ImplPrepareLayoutArgs( OUString
&, const sal_Int32 nIndex
, const sal_Int32 nLen
,
1235 DeviceCoordinate nPixelWidth
,
1236 SalLayoutFlags flags
= SalLayoutFlags::NONE
,
1237 vcl::text::TextLayoutCache
const* = nullptr) const;
1238 SAL_DLLPRIVATE
std::unique_ptr
<SalLayout
>
1239 ImplGlyphFallbackLayout( std::unique_ptr
<SalLayout
>,
1240 vcl::text::ImplLayoutArgs
&,
1241 const SalLayoutGlyphs
* ) const;
1242 SAL_DLLPRIVATE
std::unique_ptr
<SalLayout
>
1244 LogicalFontInstance
* pLogicalFont
, int nFallbackLevel
,
1245 vcl::text::ImplLayoutArgs
& rLayoutArgs
, const SalLayoutGlyphs
* ) const;
1248 These functions allow collecting information on how fonts are mapped when used, such as what
1249 replacements are used when a requested font is missing or which fonts are used as fallbacks
1250 when a font doesn't provide all necessary glyphs.
1251 After StartTrackingFontMappingUse() is called, VCL starts collecting font usage for all
1252 text layout calls, FinishTrackingFontMappingUse() will stop collecting and providing
1253 the collected information.
1254 Each item is a mapping from a requested font to a list of actually used fonts and the number
1255 of times this mapping was done.
1257 struct FontMappingUseItem
1259 OUString mOriginalFont
;
1260 std::vector
<OUString
> mUsedFonts
;
1263 typedef std::vector
<FontMappingUseItem
> FontMappingUseData
;
1264 static void StartTrackingFontMappingUse();
1265 static FontMappingUseData
FinishTrackingFontMappingUse();
1267 // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphicsLayout
1268 virtual void EnableRTL( bool bEnable
= true);
1269 bool IsRTLEnabled() const { return mbEnableRTL
; }
1271 bool GetTextIsRTL( const OUString
&, sal_Int32 nIndex
, sal_Int32 nLen
) const;
1276 /** @name Bitmap functions
1282 const Point
& rDestPt
,
1283 const Bitmap
& rBitmap
);
1286 const Point
& rDestPt
,
1287 const Size
& rDestSize
,
1288 const Bitmap
& rBitmap
);
1291 const Point
& rDestPt
,
1292 const Size
& rDestSize
,
1293 const Point
& rSrcPtPixel
,
1294 const Size
& rSrcSizePixel
,
1295 const Bitmap
& rBitmap
);
1298 const Point
& rDestPt
,
1299 const Size
& rDestSize
,
1300 const Point
& rSrcPtPixel
,
1301 const Size
& rSrcSizePixel
,
1302 const Bitmap
& rBitmap
,
1303 MetaActionType nAction
);
1306 const Point
& rDestPt
,
1307 const BitmapEx
& rBitmapEx
);
1311 const Point
& rDestPt
,
1312 const Size
& rDestSize
,
1313 const BitmapEx
& rBitmapEx
);
1316 const Point
& rDestPt
,
1317 const Size
& rDestSize
,
1318 const Point
& rSrcPtPixel
,
1319 const Size
& rSrcSizePixel
,
1320 const BitmapEx
& rBitmapEx
);
1323 const Point
& rDestPt
,
1324 const Size
& rDestSize
,
1325 const Point
& rSrcPtPixel
,
1326 const Size
& rSrcSizePixel
,
1327 const BitmapEx
& rBitmapEx
,
1328 MetaActionType nAction
);
1331 virtual void DrawImage(
1334 const Image& rImage,
1335 sal_uInt16 nStyle = 0)
1339 const Image
& rImage
,
1340 DrawImageFlags nStyle
= DrawImageFlags::NONE
);
1345 const Image
& rImage
,
1346 DrawImageFlags nStyle
= DrawImageFlags::NONE
);
1349 virtual Bitmap
GetBitmap( const Point
& rSrcPt
, const Size
& rSize
) const;
1351 /** Query extended bitmap (with alpha channel, if available).
1353 BitmapEx
GetBitmapEx( const Point
& rSrcPt
, const Size
& rSize
) const;
1356 /** Draw BitmapEx transformed
1358 @param rTransformation
1359 The transformation describing the target positioning of the given bitmap. Transforming
1360 the unit object coordinates (0, 0, 1, 1) with this matrix is the transformation to
1361 discrete coordinates
1364 The BitmapEx to be painted
1367 Optional additional alpha to use for drawing (0 to 1, 1 being no change).
1369 void DrawTransformedBitmapEx(
1370 const basegfx::B2DHomMatrix
& rTransformation
,
1371 const BitmapEx
& rBitmapEx
,
1372 double fAlpha
= 1.0);
1374 /** Return true if DrawTransformedBitmapEx() is fast.
1378 bool HasFastDrawTransformedBitmap() const;
1382 virtual void DrawDeviceBitmapEx(
1383 const Point
& rDestPt
, const Size
& rDestSize
,
1384 const Point
& rSrcPtPixel
, const Size
& rSrcSizePixel
,
1385 BitmapEx
& rBitmapEx
);
1387 virtual bool CanSubsampleBitmap() const { return true; }
1389 /** Transform and draw a bitmap directly
1391 @param aFullTransform The B2DHomMatrix used for the transformation
1392 @param rBitmapEx Reference to the bitmap to be transformed and drawn
1394 @return true if it was able to draw the bitmap, false if not
1396 virtual bool DrawTransformBitmapExDirect(
1397 const basegfx::B2DHomMatrix
& aFullTransform
,
1398 const BitmapEx
& rBitmapEx
,
1399 double fAlpha
= 1.0);
1401 /** Transform and reduce the area that needs to be drawn of the bitmap and return the new
1402 visible range and the maximum area.
1405 @param aFullTransform B2DHomMatrix used for transformation
1406 @param aVisibleRange The new visible area of the bitmap
1407 @param fMaximumArea The maximum area of the bitmap
1409 @returns true if there is an area to be drawn, otherwise nothing is left to be drawn
1412 virtual bool TransformAndReduceBitmapExToTargetRange(
1413 const basegfx::B2DHomMatrix
& aFullTransform
,
1414 basegfx::B2DRange
&aVisibleRange
,
1415 double &fMaximumArea
);
1419 SAL_DLLPRIVATE
void DrawDeviceAlphaBitmap(
1421 const AlphaMask
& rAlpha
,
1422 const Point
& rDestPt
,
1423 const Size
& rDestSize
,
1424 const Point
& rSrcPtPixel
,
1425 const Size
& rSrcSizePixel
);
1427 SAL_DLLPRIVATE
void DrawDeviceAlphaBitmapSlowPath(
1428 const Bitmap
& rBitmap
, const AlphaMask
& rAlpha
,
1429 tools::Rectangle aDstRect
, tools::Rectangle aBmpRect
,
1430 Size
const & aOutSz
, Point
const & aOutPt
);
1433 SAL_DLLPRIVATE
void BlendBitmap(
1434 const SalTwoRect
& rPosAry
,
1435 const Bitmap
& rBmp
);
1437 SAL_DLLPRIVATE Bitmap
BlendBitmap(
1439 BitmapReadAccess
const * pP
,
1440 BitmapReadAccess
const * pA
,
1441 const sal_Int32 nOffY
,
1442 const sal_Int32 nDstHeight
,
1443 const sal_Int32 nOffX
,
1444 const sal_Int32 nDstWidth
,
1445 const tools::Rectangle
& aBmpRect
,
1449 const sal_Int32
* pMapX
,
1450 const sal_Int32
* pMapY
);
1452 SAL_DLLPRIVATE Bitmap
BlendBitmapWithAlpha(
1454 BitmapReadAccess
const * pP
,
1455 BitmapReadAccess
const * pA
,
1456 const tools::Rectangle
& aDstRect
,
1457 const sal_Int32 nOffY
,
1458 const sal_Int32 nDstHeight
,
1459 const sal_Int32 nOffX
,
1460 const sal_Int32 nDstWidth
,
1461 const sal_Int32
* pMapX
,
1462 const sal_Int32
* pMapY
);
1467 /** @name Transparency functions
1473 /** helper method removing transparencies from a metafile (e.g. for printing)
1476 true: transparencies were removed
1477 false: output metafile is unchanged input metafile
1479 @attention this is a member method, so current state can influence the result !
1480 @attention the output metafile is prepared in pixel mode for the currentOutputDevice
1481 state. It can not be moved or rotated reliably anymore.
1483 bool RemoveTransparenciesFromMetaFile(
1484 const GDIMetaFile
& rInMtf
, GDIMetaFile
& rOutMtf
,
1485 tools::Long nMaxBmpDPIX
, tools::Long nMaxBmpDPIY
,
1486 bool bReduceTransparency
,
1487 bool bTransparencyAutoMode
,
1488 bool bDownsampleBitmaps
,
1489 const Color
& rBackground
= COL_TRANSPARENT
);
1491 void DrawTransparent( const tools::PolyPolygon
& rPolyPoly
, sal_uInt16 nTransparencePercent
);
1493 void DrawTransparent(
1494 const basegfx::B2DHomMatrix
& rObjectTransform
,
1495 const basegfx::B2DPolyPolygon
& rB2DPolyPoly
,
1496 double fTransparency
);
1498 void DrawTransparent(
1499 const GDIMetaFile
& rMtf
, const Point
& rPos
, const Size
& rSize
,
1500 const Gradient
& rTransparenceGradient
);
1502 void DrawTransparent(
1503 const GDIMetaFile
& rMtf
, const Point
& rPos
, const Size
& rSize
,
1504 const Point
& rMtfPos
, const Size
& rMtfSize
,
1505 const Gradient
& rTransparenceGradient
);
1509 virtual void EmulateDrawTransparent( const tools::PolyPolygon
& rPolyPoly
, sal_uInt16 nTransparencePercent
);
1511 virtual void ClipAndDrawGradientMetafile ( const Gradient
&rGradient
, const tools::PolyPolygon
&rPolyPoly
);
1515 SAL_DLLPRIVATE
bool DrawTransparentNatively( const tools::PolyPolygon
& rPolyPoly
, sal_uInt16 nTransparencePercent
);
1519 /** @name Mask functions
1525 void DrawMask( const Point
& rDestPt
,
1526 const Bitmap
& rBitmap
, const Color
& rMaskColor
);
1528 void DrawMask( const Point
& rDestPt
, const Size
& rDestSize
,
1529 const Bitmap
& rBitmap
, const Color
& rMaskColor
);
1531 void DrawMask( const Point
& rDestPt
, const Size
& rDestSize
,
1532 const Point
& rSrcPtPixel
, const Size
& rSrcSizePixel
,
1533 const Bitmap
& rBitmap
, const Color
& rMaskColor
);
1535 void DrawMask( const Point
& rDestPt
, const Size
& rDestSize
,
1536 const Point
& rSrcPtPixel
, const Size
& rSrcSizePixel
,
1537 const Bitmap
& rBitmap
, const Color
& rMaskColor
,
1538 MetaActionType nAction
);
1542 virtual void DrawDeviceMask (
1543 const Bitmap
& rMask
, const Color
& rMaskColor
,
1544 const Point
& rDestPt
, const Size
& rDestSize
,
1545 const Point
& rSrcPtPixel
, const Size
& rSrcSizePixel
);
1549 /** @name Map functions
1555 void EnableMapMode( bool bEnable
= true );
1556 bool IsMapModeEnabled() const { return mbMap
; }
1559 void SetMapMode( const MapMode
& rNewMapMode
);
1560 void SetRelativeMapMode( const MapMode
& rNewMapMode
);
1561 virtual void SetMetafileMapMode(const MapMode
& rNewMapMode
, bool bIsRecord
);
1562 const MapMode
& GetMapMode() const { return maMapMode
; }
1565 virtual void ImplInitMapModeObjects();
1569 basegfx::B2DHomMatrix
GetViewTransformation() const;
1570 basegfx::B2DHomMatrix
GetInverseViewTransformation() const;
1572 basegfx::B2DHomMatrix
GetViewTransformation( const MapMode
& rMapMode
) const;
1573 basegfx::B2DHomMatrix
GetInverseViewTransformation( const MapMode
& rMapMode
) const;
1576 /** Set an offset in pixel
1578 This method offsets every drawing operation that converts its
1579 coordinates to pixel by the given value. Normally, the effect
1580 can be achieved by setting a MapMode with a different
1581 origin. Unfortunately, this origin is in logical coordinates
1582 and can lead to rounding errors (see #102532# for details).
1584 @attention This offset is only applied when converting to
1585 pixel, i.e. some output modes such as metafile recordings
1586 might be completely unaffected by this method! Use with
1587 care. Furthermore, if the OutputDevice's MapMode is the
1588 default (that's MapUnit::MapPixel), then any pixel offset set is
1589 ignored also. This might be unintuitive for cases, but would
1590 have been far more fragile to implement. What's more, the
1591 reason why the pixel offset was introduced (avoiding rounding
1592 errors) does not apply for MapUnit::MapPixel, because one can always
1593 use the MapMode origin then.
1598 void SetPixelOffset( const Size
& rOffset
);
1600 /** Get the offset in pixel
1602 @see OutputDevice::SetPixelOffset for details
1604 @return the current offset in pixel
1606 SAL_WARN_UNUSED_RESULT Size
GetPixelOffset() const { return Size(mnOutOffOrigX
, mnOutOffOrigY
);}
1608 SAL_WARN_UNUSED_RESULT Point
LogicToPixel(const Point
& rLogicPt
) const;
1609 SAL_WARN_UNUSED_RESULT Size
LogicToPixel(const Size
& rLogicSize
) const;
1610 SAL_WARN_UNUSED_RESULT
tools::Rectangle
LogicToPixel(const tools::Rectangle
& rLogicRect
) const;
1611 SAL_WARN_UNUSED_RESULT
tools::Polygon
LogicToPixel(const tools::Polygon
& rLogicPoly
) const;
1612 SAL_WARN_UNUSED_RESULT
tools::PolyPolygon
LogicToPixel(const tools::PolyPolygon
& rLogicPolyPoly
) const;
1613 SAL_WARN_UNUSED_RESULT
basegfx::B2DPolyPolygon
LogicToPixel(const basegfx::B2DPolyPolygon
& rLogicPolyPoly
) const;
1614 SAL_WARN_UNUSED_RESULT
vcl::Region
LogicToPixel(const vcl::Region
& rLogicRegion
)const;
1615 SAL_WARN_UNUSED_RESULT Point
LogicToPixel(const Point
& rLogicPt
, const MapMode
& rMapMode
) const;
1616 SAL_WARN_UNUSED_RESULT Size
LogicToPixel(const Size
& rLogicSize
, const MapMode
& rMapMode
) const;
1617 SAL_WARN_UNUSED_RESULT
tools::Rectangle
LogicToPixel(const tools::Rectangle
& rLogicRect
,
1618 const MapMode
& rMapMode
) const;
1619 SAL_WARN_UNUSED_RESULT
tools::Polygon
LogicToPixel(const tools::Polygon
& rLogicPoly
,
1620 const MapMode
& rMapMode
) const;
1621 SAL_WARN_UNUSED_RESULT
basegfx::B2DPolyPolygon
LogicToPixel(const basegfx::B2DPolyPolygon
& rLogicPolyPoly
,
1622 const MapMode
& rMapMode
) const;
1624 SAL_WARN_UNUSED_RESULT Point
PixelToLogic(const Point
& rDevicePt
) const;
1625 SAL_WARN_UNUSED_RESULT Size
PixelToLogic(const Size
& rDeviceSize
) const;
1626 SAL_WARN_UNUSED_RESULT
tools::Rectangle
PixelToLogic(const tools::Rectangle
& rDeviceRect
) const;
1627 SAL_WARN_UNUSED_RESULT
tools::Polygon
PixelToLogic(const tools::Polygon
& rDevicePoly
) const;
1628 SAL_WARN_UNUSED_RESULT
tools::PolyPolygon
PixelToLogic(const tools::PolyPolygon
& rDevicePolyPoly
) const;
1629 SAL_WARN_UNUSED_RESULT
basegfx::B2DPolyPolygon
PixelToLogic(const basegfx::B2DPolyPolygon
& rDevicePolyPoly
) const;
1630 SAL_WARN_UNUSED_RESULT
vcl::Region
PixelToLogic(const vcl::Region
& rDeviceRegion
) const;
1631 SAL_WARN_UNUSED_RESULT Point
PixelToLogic(const Point
& rDevicePt
, const MapMode
& rMapMode
) const;
1632 SAL_WARN_UNUSED_RESULT Size
PixelToLogic(const Size
& rDeviceSize
, const MapMode
& rMapMode
) const;
1633 SAL_WARN_UNUSED_RESULT
tools::Rectangle
PixelToLogic(const tools::Rectangle
& rDeviceRect
,
1634 const MapMode
& rMapMode
) const;
1635 SAL_WARN_UNUSED_RESULT
tools::Polygon
PixelToLogic(const tools::Polygon
& rDevicePoly
,
1636 const MapMode
& rMapMode
) const;
1637 SAL_WARN_UNUSED_RESULT
basegfx::B2DPolygon
PixelToLogic(const basegfx::B2DPolygon
& rDevicePoly
,
1638 const MapMode
& rMapMode
) const;
1639 SAL_WARN_UNUSED_RESULT
basegfx::B2DPolyPolygon
PixelToLogic(const basegfx::B2DPolyPolygon
& rDevicePolyPoly
,
1640 const MapMode
& rMapMode
) const;
1642 SAL_WARN_UNUSED_RESULT Point
LogicToLogic(const Point
& rPtSource
,
1643 const MapMode
* pMapModeSource
,
1644 const MapMode
* pMapModeDest
) const;
1645 SAL_WARN_UNUSED_RESULT Size
LogicToLogic(const Size
& rSzSource
,
1646 const MapMode
* pMapModeSource
,
1647 const MapMode
* pMapModeDest
) const;
1648 SAL_WARN_UNUSED_RESULT
tools::Rectangle
LogicToLogic(const tools::Rectangle
& rRectSource
,
1649 const MapMode
* pMapModeSource
,
1650 const MapMode
* pMapModeDest
) const;
1651 SAL_WARN_UNUSED_RESULT
static Point
LogicToLogic(const Point
& rPtSource
,
1652 const MapMode
& rMapModeSource
,
1653 const MapMode
& rMapModeDest
);
1654 SAL_WARN_UNUSED_RESULT
static Size
LogicToLogic(const Size
& rSzSource
,
1655 const MapMode
& rMapModeSource
,
1656 const MapMode
& rMapModeDest
);
1657 SAL_WARN_UNUSED_RESULT
static tools::Rectangle
LogicToLogic(const tools::Rectangle
& rRectSource
,
1658 const MapMode
& rMapModeSource
,
1659 const MapMode
& rMapModeDest
);
1660 SAL_WARN_UNUSED_RESULT
static tools::Long
LogicToLogic(tools::Long nLongSource
,
1661 MapUnit eUnitSource
,
1664 SAL_WARN_UNUSED_RESULT
static basegfx::B2DPolygon
LogicToLogic(const basegfx::B2DPolygon
& rPoly
,
1665 const MapMode
& rMapModeSource
,
1666 const MapMode
& rMapModeDest
);
1668 // create a mapping transformation from rMapModeSource to rMapModeDest (the above methods
1669 // for B2DPoly/Polygons use this internally anyway to transform the B2DPolygon)
1670 SAL_WARN_UNUSED_RESULT
static basegfx::B2DHomMatrix
LogicToLogic(const MapMode
& rMapModeSource
,
1671 const MapMode
& rMapModeDest
);
1673 /** Convert a logical rectangle to a rectangle in physical device pixel units.
1675 @param rLogicRect Const reference to a rectangle in logical units
1677 @returns Rectangle based on physical device pixel coordinates and units.
1679 SAL_DLLPRIVATE
tools::Rectangle
ImplLogicToDevicePixel( const tools::Rectangle
& rLogicRect
) const;
1681 /** Convert a logical point to a physical point on the device.
1683 @param rLogicPt Const reference to a point in logical units.
1685 @returns Physical point on the device.
1687 SAL_DLLPRIVATE Point
ImplLogicToDevicePixel( const Point
& rLogicPt
) const;
1688 SAL_DLLPRIVATE DevicePoint
ImplLogicToDeviceSubPixel(const Point
& rLogicPt
) const;
1690 /** Convert a logical width to a width in units of device pixels.
1692 To get the number of device pixels, it must calculate the X-DPI of the device and
1693 the map scaling factor. If there is no mapping, then it just returns the
1694 width as nothing more needs to be done.
1696 @param nWidth Logical width
1698 @returns Width in units of device pixels.
1700 SAL_DLLPRIVATE
tools::Long
ImplLogicWidthToDevicePixel( tools::Long nWidth
) const;
1701 SAL_DLLPRIVATE
double ImplLogicWidthToDeviceSubPixel(tools::Long nWidth
) const;
1703 /** Convert a logical height to a height in units of device pixels.
1705 To get the number of device pixels, it must calculate the Y-DPI of the device and
1706 the map scaling factor. If there is no mapping, then it just returns the
1707 height as nothing more needs to be done.
1709 @param nHeight Logical height
1711 @returns Height in units of device pixels.
1713 SAL_DLLPRIVATE
tools::Long
ImplLogicHeightToDevicePixel( tools::Long nHeight
) const;
1714 SAL_DLLPRIVATE
double ImplLogicHeightToDeviceSubPixel(tools::Long nHeight
) const;
1716 SAL_DLLPRIVATE Point
SubPixelToLogic(const DevicePoint
& rDevicePt
) const;
1718 /** Convert device pixels to a width in logical units.
1720 To get the logical width, it must calculate the X-DPI of the device and the
1723 @param nWidth Width in device pixels
1725 @returns Width in logical units.
1727 SAL_DLLPRIVATE
tools::Long
ImplDevicePixelToLogicWidth( tools::Long nWidth
) const;
1729 /** Convert device pixels to a height in logical units.
1731 To get the logical height, it must calculate the Y-DPI of the device and the
1734 @param nHeight Height in device pixels
1736 @returns Height in logical units.
1738 SAL_DLLPRIVATE
tools::Long
ImplDevicePixelToLogicHeight( tools::Long nHeight
) const;
1740 /** Convert a logical size to the size on the physical device.
1742 @param rLogicSize Const reference to a size in logical units
1744 @returns Physical size on the device.
1746 SAL_DLLPRIVATE Size
ImplLogicToDevicePixel( const Size
& rLogicSize
) const;
1748 /** Convert a rectangle in physical pixel units to a rectangle in physical pixel units and coords.
1750 @param rPixelRect Const reference to rectangle in logical units and coords.
1752 @returns Rectangle based on logical coordinates and units.
1754 SAL_DLLPRIVATE
tools::Rectangle
ImplDevicePixelToLogic( const tools::Rectangle
& rPixelRect
) const;
1756 /** Convert a logical polygon to a polygon in physical device pixel units.
1758 @param rLogicPoly Const reference to a polygon in logical units
1760 @returns Polygon based on physical device pixel coordinates and units.
1762 SAL_DLLPRIVATE
tools::Polygon
ImplLogicToDevicePixel( const tools::Polygon
& rLogicPoly
) const;
1764 /** Convert a logical B2DPolygon to a B2DPolygon in physical device pixel units.
1766 @param rLogicSize Const reference to a B2DPolygon in logical units
1768 @returns B2DPolyPolygon based on physical device pixel coordinates and units.
1770 SAL_DLLPRIVATE ::basegfx::B2DPolygon
ImplLogicToDevicePixel( const ::basegfx::B2DPolygon
& rLogicPoly
) const;
1772 /** Convert a logical polypolygon to a polypolygon in physical device pixel units.
1774 @param rLogicPolyPoly Const reference to a polypolygon in logical units
1776 @returns Polypolygon based on physical device pixel coordinates and units.
1778 SAL_DLLPRIVATE
tools::PolyPolygon
ImplLogicToDevicePixel( const tools::PolyPolygon
& rLogicPolyPoly
) const;
1780 /** Convert a line in logical units to a line in physical device pixel units.
1782 @param rLineInfo Const reference to a line in logical units
1784 @returns Line based on physical device pixel coordinates and units.
1786 SAL_DLLPRIVATE LineInfo
ImplLogicToDevicePixel( const LineInfo
& rLineInfo
) const;
1788 /** Convert a region in pixel units to a region in device pixel units and coords.
1790 @param rRegion Const reference to region.
1792 @returns vcl::Region based on device pixel coordinates and units.
1794 SAL_DLLPRIVATE
vcl::Region
ImplPixelToDevicePixel( const vcl::Region
& rRegion
) const;
1796 /** Invalidate the view transformation.
1798 @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212)
1800 SAL_DLLPRIVATE
void ImplInvalidateViewTransform();
1802 /** Get device transformation.
1804 @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212)
1806 SAL_DLLPRIVATE
basegfx::B2DHomMatrix
ImplGetDeviceTransformation() const;
1809 SAL_DLLPRIVATE DeviceCoordinate
LogicWidthToDeviceCoordinate( tools::Long nWidth
) const;
1811 /** Convert a logical X coordinate to a device pixel's X coordinate.
1813 To get the device's X coordinate, it must calculate the mapping offset
1814 coordinate X position (if there is one - if not then it just adds
1815 the pseudo-window offset to the logical X coordinate), the X-DPI of
1816 the device and the mapping's X scaling factor.
1818 @param nX Logical X coordinate
1820 @returns Device's X pixel coordinate
1822 SAL_DLLPRIVATE
tools::Long
ImplLogicXToDevicePixel( tools::Long nX
) const;
1824 /** Convert a logical Y coordinate to a device pixel's Y coordinate.
1826 To get the device's Y coordinate, it must calculate the mapping offset
1827 coordinate Y position (if there is one - if not then it just adds
1828 the pseudo-window offset to the logical Y coordinate), the Y-DPI of
1829 the device and the mapping's Y scaling factor.
1831 @param nY Logical Y coordinate
1833 @returns Device's Y pixel coordinate
1835 SAL_DLLPRIVATE
tools::Long
ImplLogicYToDevicePixel( tools::Long nY
) const;
1837 /** @name Native Widget Rendering functions
1839 These all just call through to the private mpGraphics functions of the same name.
1845 /** Determine if native widgets can be enabled
1847 virtual bool CanEnableNativeWidget() const { return false; }
1849 /** Query the platform layer for control support
1851 bool IsNativeControlSupported( ControlType nType
, ControlPart nPart
) const;
1853 /** Query the native control to determine if it was acted upon
1855 bool HitTestNativeScrollbar(
1857 const tools::Rectangle
& rControlRegion
,
1859 bool& rIsInside
) const;
1861 /** Request rendering of a particular control and/or part
1863 bool DrawNativeControl(
1866 const tools::Rectangle
& rControlRegion
,
1867 ControlState nState
,
1868 const ImplControlValue
& aValue
,
1869 const OUString
& aCaption
,
1870 const Color
& rBackgroundColor
= COL_AUTO
);
1872 /** Query the native control's actual drawing region (including adornment)
1874 bool GetNativeControlRegion(
1877 const tools::Rectangle
& rControlRegion
,
1878 ControlState nState
,
1879 const ImplControlValue
& aValue
,
1880 tools::Rectangle
&rNativeBoundingRegion
,
1881 tools::Rectangle
&rNativeContentRegion
) const;
1884 /** @name EPS functions
1890 /** @returns boolean value to see if EPS could be painted directly.
1891 Theoretically, handing over a matrix would be needed to handle
1892 painting rotated EPS files (e.g. contained in Metafiles). This
1893 would then need to be supported for Mac and PS printers, but
1894 that's too much for now, wrote \#i107046# for this */
1896 const Point
& rPt
, const Size
& rSz
,
1897 const GfxLink
& rGfxLink
, GDIMetaFile
* pSubst
= nullptr );
1901 virtual css::awt::DeviceInfo
GetDeviceInfo() const;
1903 /** Get the vcl::Window that this OutputDevice belongs to, if any */
1904 virtual vcl::Window
* GetOwnerWindow() const { return nullptr; }
1907 css::awt::DeviceInfo
GetCommonDeviceInfo(Size
const& aDevSize
) const;
1911 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */