LCOV - code coverage report
Current view: top level - include/vcl - outdev.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 58 61 95.1 %
Date: 2015-06-13 12:38:46 Functions: 50 53 94.3 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11