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 _SV_OUTDEV_HXX
21 : #define _SV_OUTDEV_HXX
22 :
23 : #include <tools/gen.hxx>
24 : #include <tools/string.hxx>
25 : #include <tools/solar.h>
26 : #include <vcl/dllapi.h>
27 : #include <tools/rc.hxx>
28 : #include <tools/color.hxx>
29 : #include <vcl/font.hxx>
30 : #include <vcl/region.hxx>
31 : #include <vcl/mapmod.hxx>
32 : #include <vcl/wall.hxx>
33 : #include <vcl/settings.hxx>
34 : #include <vcl/salnativewidgets.hxx>
35 : #include <tools/poly.hxx>
36 : #include <basegfx/vector/b2enums.hxx>
37 : #include <com/sun/star/uno/Reference.h>
38 : #include <unotools/fontdefs.hxx>
39 : #include <basegfx/polygon/b2dpolypolygon.hxx>
40 : #include <com/sun/star/drawing/LineCap.hpp>
41 : #include <vector>
42 :
43 : struct ImplOutDevData;
44 : class ImplFontEntry;
45 : struct ImplObjStack;
46 : struct ImplKernPairData;
47 : struct SystemGraphicsData;
48 : struct SystemFontData;
49 : struct SystemTextLayoutData;
50 : class ImplFontCache;
51 : class ImplDevFontList;
52 : class ImplGetDevFontList;
53 : class ImplGetDevSizeList;
54 : class ImplMultiTextLineInfo;
55 : class SalGraphics;
56 : class Gradient;
57 : class Hatch;
58 : class Bitmap;
59 : class BitmapReadAccess;
60 : class BitmapEx;
61 : class Image;
62 : class TextRectInfo;
63 : class FontInfo;
64 : class FontMetric;
65 : class GDIMetaFile;
66 : class GfxLink;
67 : class Line;
68 : class LineInfo;
69 : class AlphaMask;
70 : class FontCharMap;
71 : class SalLayout;
72 : class ImplLayoutArgs;
73 : class ImplFontAttributes;
74 : class VirtualDevice;
75 : struct SalTwoRect;
76 :
77 : namespace com {
78 : namespace sun {
79 : namespace star {
80 : namespace rendering {
81 : class XCanvas;
82 : }}}}
83 : namespace basegfx {
84 : class B2DHomMatrix;
85 : class B2DPolygon;
86 : class B2DPolyPolygon;
87 : }
88 :
89 : namespace com {
90 : namespace sun {
91 : namespace star {
92 : namespace awt {
93 : class XGraphics;
94 : } } } }
95 :
96 : typedef std::vector< Rectangle > MetricVector;
97 :
98 : namespace vcl
99 : {
100 : class PDFWriterImpl;
101 : class ExtOutDevData;
102 : class ITextLayout;
103 : struct FontCapabilities;
104 : }
105 :
106 : // ---------------------
107 : // - OutputDevice-Data -
108 : // ---------------------
109 :
110 : struct ImplMapRes
111 : {
112 : long mnMapOfsX; // Offset in X Richtung
113 : long mnMapOfsY; // Offset in Y Richtung
114 : long mnMapScNumX; // Skal.-faktor Zaehler X Richtung
115 : long mnMapScNumY; // Skal.-faktor Zaehler Y Richtung
116 : long mnMapScDenomX; // Skal.-faktor Nenner X Richtung
117 : long mnMapScDenomY; // Skal.-faktor Nenner Y Richtung
118 : };
119 :
120 : struct ImplThresholdRes
121 : {
122 : long mnThresLogToPixX; // Schwellenwerte fuer Berechnung
123 : long mnThresLogToPixY; // mit BigInts
124 : long mnThresPixToLogX; // ""
125 : long mnThresPixToLogY; // ""
126 : };
127 :
128 : // ----------------------
129 : // - OutputDevice-Types -
130 : // ----------------------
131 :
132 : // Flags for Push()
133 : #define PUSH_LINECOLOR ((sal_uInt16)0x0001)
134 : #define PUSH_FILLCOLOR ((sal_uInt16)0x0002)
135 : #define PUSH_FONT ((sal_uInt16)0x0004)
136 : #define PUSH_TEXTCOLOR ((sal_uInt16)0x0008)
137 : #define PUSH_MAPMODE ((sal_uInt16)0x0010)
138 : #define PUSH_CLIPREGION ((sal_uInt16)0x0020)
139 : #define PUSH_RASTEROP ((sal_uInt16)0x0040)
140 : #define PUSH_TEXTFILLCOLOR ((sal_uInt16)0x0080)
141 : #define PUSH_TEXTALIGN ((sal_uInt16)0x0100)
142 : #define PUSH_REFPOINT ((sal_uInt16)0x0200)
143 : #define PUSH_TEXTLINECOLOR ((sal_uInt16)0x0400)
144 : #define PUSH_TEXTLAYOUTMODE ((sal_uInt16)0x0800)
145 : #define PUSH_TEXTLANGUAGE ((sal_uInt16)0x1000)
146 : #define PUSH_OVERLINECOLOR ((sal_uInt16)0x2000)
147 : #define PUSH_ALLTEXT (PUSH_TEXTCOLOR | PUSH_TEXTFILLCOLOR | PUSH_TEXTLINECOLOR | PUSH_OVERLINECOLOR | PUSH_TEXTALIGN | PUSH_TEXTLAYOUTMODE | PUSH_TEXTLANGUAGE)
148 : #define PUSH_ALLFONT (PUSH_ALLTEXT | PUSH_FONT)
149 : #define PUSH_ALL ((sal_uInt16)0xFFFF)
150 :
151 : // Flags for DrawText()
152 : #define TEXT_DRAW_DISABLE ((sal_uInt16)0x0001)
153 : #define TEXT_DRAW_MNEMONIC ((sal_uInt16)0x0002)
154 : #define TEXT_DRAW_MONO ((sal_uInt16)0x0004)
155 : #define TEXT_DRAW_CLIP ((sal_uInt16)0x0008)
156 : #define TEXT_DRAW_LEFT ((sal_uInt16)0x0010)
157 : #define TEXT_DRAW_CENTER ((sal_uInt16)0x0020)
158 : #define TEXT_DRAW_RIGHT ((sal_uInt16)0x0040)
159 : #define TEXT_DRAW_TOP ((sal_uInt16)0x0080)
160 : #define TEXT_DRAW_VCENTER ((sal_uInt16)0x0100)
161 : #define TEXT_DRAW_BOTTOM ((sal_uInt16)0x0200)
162 : #define TEXT_DRAW_ENDELLIPSIS ((sal_uInt16)0x0400)
163 : #define TEXT_DRAW_PATHELLIPSIS ((sal_uInt16)0x0800)
164 : #define TEXT_DRAW_MULTILINE ((sal_uInt16)0x1000)
165 : #define TEXT_DRAW_WORDBREAK ((sal_uInt16)0x2000)
166 : #define TEXT_DRAW_NEWSELLIPSIS ((sal_uInt16)0x4000)
167 : // in the long run we should make text style flags longer
168 : // but at the moment we can get away with this 2 bit field for ellipsis style
169 : #define TEXT_DRAW_CENTERELLIPSIS (TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_PATHELLIPSIS)
170 :
171 : #define TEXT_DRAW_WORDBREAK_HYPHENATION (((sal_uInt16)0x8000) | TEXT_DRAW_WORDBREAK)
172 :
173 : // Flags for CopyArea()
174 : #define COPYAREA_WINDOWINVALIDATE ((sal_uInt16)0x0001)
175 :
176 : // Flags for DrawImage()
177 : #define IMAGE_DRAW_DISABLE ((sal_uInt16)0x0001)
178 : #define IMAGE_DRAW_HIGHLIGHT ((sal_uInt16)0x0002)
179 : #define IMAGE_DRAW_DEACTIVE ((sal_uInt16)0x0004)
180 : #define IMAGE_DRAW_COLORTRANSFORM ((sal_uInt16)0x0008)
181 : #define IMAGE_DRAW_SEMITRANSPARENT ((sal_uInt16)0x0010)
182 :
183 : // WaveLine
184 : #define WAVE_FLAT 1
185 : #define WAVE_SMALL 2
186 : #define WAVE_NORMAL 3
187 :
188 : // Grid
189 : #define GRID_DOTS ((sal_uLong)0x00000001)
190 : #define GRID_HORZLINES ((sal_uLong)0x00000002)
191 : #define GRID_VERTLINES ((sal_uLong)0x00000004)
192 : #define GRID_LINES (GRID_HORZLINES | GRID_VERTLINES)
193 :
194 : // LayoutModes for Complex Text Layout
195 : #define TEXT_LAYOUT_DEFAULT ((sal_uLong)0x00000000)
196 : #define TEXT_LAYOUT_BIDI_LTR ((sal_uLong)0x00000000)
197 : #define TEXT_LAYOUT_BIDI_RTL ((sal_uLong)0x00000001)
198 : #define TEXT_LAYOUT_BIDI_STRONG ((sal_uLong)0x00000002)
199 : #define TEXT_LAYOUT_TEXTORIGIN_LEFT ((sal_uLong)0x00000004)
200 : #define TEXT_LAYOUT_TEXTORIGIN_RIGHT ((sal_uLong)0x00000008)
201 : #define TEXT_LAYOUT_COMPLEX_DISABLED ((sal_uLong)0x00000100)
202 : #define TEXT_LAYOUT_ENABLE_LIGATURES ((sal_uLong)0x00000200)
203 : #define TEXT_LAYOUT_SUBSTITUTE_DIGITS ((sal_uLong)0x00000400)
204 :
205 : // DrawModes
206 : #define DRAWMODE_DEFAULT ((sal_uLong)0x00000000)
207 : #define DRAWMODE_BLACKLINE ((sal_uLong)0x00000001)
208 : #define DRAWMODE_BLACKFILL ((sal_uLong)0x00000002)
209 : #define DRAWMODE_BLACKTEXT ((sal_uLong)0x00000004)
210 : #define DRAWMODE_BLACKBITMAP ((sal_uLong)0x00000008)
211 : #define DRAWMODE_BLACKGRADIENT ((sal_uLong)0x00000010)
212 : #define DRAWMODE_GRAYLINE ((sal_uLong)0x00000020)
213 : #define DRAWMODE_GRAYFILL ((sal_uLong)0x00000040)
214 : #define DRAWMODE_GRAYTEXT ((sal_uLong)0x00000080)
215 : #define DRAWMODE_GRAYBITMAP ((sal_uLong)0x00000100)
216 : #define DRAWMODE_GRAYGRADIENT ((sal_uLong)0x00000200)
217 : #define DRAWMODE_NOFILL ((sal_uLong)0x00000400)
218 : #define DRAWMODE_NOBITMAP ((sal_uLong)0x00000800)
219 : #define DRAWMODE_NOGRADIENT ((sal_uLong)0x00001000)
220 : #define DRAWMODE_GHOSTEDLINE ((sal_uLong)0x00002000)
221 : #define DRAWMODE_GHOSTEDFILL ((sal_uLong)0x00004000)
222 : #define DRAWMODE_GHOSTEDTEXT ((sal_uLong)0x00008000)
223 : #define DRAWMODE_GHOSTEDBITMAP ((sal_uLong)0x00010000)
224 : #define DRAWMODE_GHOSTEDGRADIENT ((sal_uLong)0x00020000)
225 : #define DRAWMODE_WHITELINE ((sal_uLong)0x00100000)
226 : #define DRAWMODE_WHITEFILL ((sal_uLong)0x00200000)
227 : #define DRAWMODE_WHITETEXT ((sal_uLong)0x00400000)
228 : #define DRAWMODE_WHITEBITMAP ((sal_uLong)0x00800000)
229 : #define DRAWMODE_WHITEGRADIENT ((sal_uLong)0x01000000)
230 : #define DRAWMODE_SETTINGSLINE ((sal_uLong)0x02000000)
231 : #define DRAWMODE_SETTINGSFILL ((sal_uLong)0x04000000)
232 : #define DRAWMODE_SETTINGSTEXT ((sal_uLong)0x08000000)
233 : #define DRAWMODE_SETTINGSGRADIENT ((sal_uLong)0x10000000)
234 : #define DRAWMODE_NOTRANSPARENCY ((sal_uLong)0x80000000)
235 :
236 : // Antialiasing
237 : #define ANTIALIASING_DISABLE_TEXT ((sal_uInt16)0x0001)
238 : #define ANTIALIASING_ENABLE_B2DDRAW ((sal_uInt16)0x0002)
239 : #define ANTIALIASING_PIXELSNAPHAIRLINE ((sal_uInt16)0x0004)
240 :
241 : // AddFontSubstitute
242 : #define FONT_SUBSTITUTE_ALWAYS ((sal_uInt16)0x0001)
243 : #define FONT_SUBSTITUTE_SCREENONLY ((sal_uInt16)0x0002)
244 :
245 : #define DEFAULTFONT_FLAGS_ONLYONE ((sal_uLong)0x00000001)
246 :
247 : enum OutDevType { OUTDEV_DONTKNOW, OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV };
248 :
249 : enum OutDevViewType { OUTDEV_VIEWTYPE_DONTKNOW, OUTDEV_VIEWTYPE_PRINTPREVIEW, OUTDEV_VIEWTYPE_SLIDESHOW };
250 :
251 : // ----------------
252 : // - OutputDevice -
253 : // ----------------
254 :
255 : class VirtualDevice;
256 : class Printer;
257 : class FontSelectPattern;
258 : class ImplFontMetricData;
259 : class VCLXGraphics;
260 :
261 : typedef ::std::vector< VCLXGraphics* > VCLXGraphicsList_impl;
262 :
263 : const char* ImplDbgCheckOutputDevice( const void* pObj );
264 :
265 : class VCL_DLLPUBLIC OutputDevice : public Resource
266 : {
267 : friend class Application;
268 : friend class Bitmap;
269 : friend class ImplImageBmp;
270 : friend class Printer;
271 : friend class System;
272 : friend class VirtualDevice;
273 : friend class Window;
274 : friend class WorkWindow;
275 : friend class vcl::PDFWriterImpl;
276 : friend const char* ImplDbgCheckOutputDevice( const void* pObj );
277 : friend void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight );
278 :
279 : private:
280 : mutable SalGraphics* mpGraphics;
281 : mutable OutputDevice* mpPrevGraphics;
282 : mutable OutputDevice* mpNextGraphics;
283 : GDIMetaFile* mpMetaFile;
284 : mutable ImplFontEntry* mpFontEntry;
285 : mutable ImplFontCache* mpFontCache;
286 : mutable ImplDevFontList* mpFontList;
287 : mutable ImplGetDevFontList* mpGetDevFontList;
288 : mutable ImplGetDevSizeList* mpGetDevSizeList;
289 : ImplObjStack* mpObjStack;
290 : ImplOutDevData* mpOutDevData;
291 : VCLXGraphicsList_impl* mpUnoGraphicsList;
292 : vcl::PDFWriterImpl* mpPDFWriter;
293 : vcl::ExtOutDevData* mpExtOutDevData;
294 :
295 : // TEMP TEMP TEMP
296 : VirtualDevice* mpAlphaVDev;
297 :
298 : /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
299 : long mnOutOffOrigX;
300 : /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
301 : long mnOutOffLogicX;
302 : /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
303 : long mnOutOffOrigY;
304 : /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
305 : long mnOutOffLogicY;
306 : /// Output offset for device output in pixel (pseudo window offset within window system's frames)
307 : long mnOutOffX;
308 : /// Output offset for device output in pixel (pseudo window offset within window system's frames)
309 : long mnOutOffY;
310 : long mnOutWidth;
311 : long mnOutHeight;
312 : sal_Int32 mnDPIX;
313 : sal_Int32 mnDPIY;
314 : /// font specific text alignment offsets in pixel units
315 : mutable long mnTextOffX;
316 : mutable long mnTextOffY;
317 : mutable long mnEmphasisAscent;
318 : mutable long mnEmphasisDescent;
319 : sal_uLong mnDrawMode;
320 : sal_uLong mnTextLayoutMode;
321 : ImplMapRes maMapRes;
322 : ImplThresholdRes maThresRes;
323 : OutDevType meOutDevType;
324 : OutDevViewType meOutDevViewType;
325 : Region maRegion; // contains the clip region, see SetClipRegion(...)
326 : Color maLineColor;
327 : Color maFillColor;
328 : Font maFont;
329 : Color maTextColor;
330 : Color maTextLineColor;
331 : Color maOverlineColor;
332 : TextAlign meTextAlign;
333 : RasterOp meRasterOp;
334 : Wallpaper maBackground;
335 : AllSettings maSettings;
336 : MapMode maMapMode;
337 : Point maRefPoint;
338 : sal_uInt16 mnAntialiasing;
339 : LanguageType meTextLanguage;
340 :
341 : /// bitfield
342 : mutable bool mbMap : 1;
343 : mutable bool mbMapIsDefault : 1;
344 : mutable bool mbClipRegion : 1;
345 : mutable bool mbBackground : 1;
346 : mutable bool mbOutput : 1;
347 : mutable bool mbDevOutput : 1;
348 : mutable bool mbOutputClipped : 1;
349 : mutable bool mbLineColor : 1;
350 : mutable bool mbFillColor : 1;
351 : mutable bool mbInitLineColor : 1;
352 : mutable bool mbInitFillColor : 1;
353 : mutable bool mbInitFont : 1;
354 : mutable bool mbInitTextColor : 1;
355 : mutable bool mbInitClipRegion : 1;
356 : mutable bool mbClipRegionSet : 1;
357 : mutable bool mbKerning : 1;
358 : mutable bool mbNewFont : 1;
359 : mutable bool mbTextLines : 1;
360 : mutable bool mbTextSpecial : 1;
361 : mutable bool mbRefPoint : 1;
362 : mutable bool mbEnableRTL : 1;
363 :
364 : public:
365 11488 : SAL_DLLPRIVATE sal_Int32 ImplGetDPIX() const { return mnDPIX; }
366 15782 : SAL_DLLPRIVATE sal_Int32 ImplGetDPIY() const { return mnDPIY; }
367 : SAL_DLLPRIVATE SalGraphics* ImplGetGraphics() const;
368 : SAL_DLLPRIVATE void ImplReleaseGraphics( sal_Bool bRelease = sal_True );
369 : SAL_DLLPRIVATE sal_Bool ImplHasMirroredGraphics();
370 : SAL_DLLPRIVATE void ImplReMirror( Point &rPoint ) const;
371 : SAL_DLLPRIVATE void ImplReMirror( Rectangle &rRect ) const;
372 : SAL_DLLPRIVATE void ImplReMirror( Region &rRegion ) const;
373 : SAL_DLLPRIVATE void ImplInitOutDevData();
374 : SAL_DLLPRIVATE void ImplDeInitOutDevData();
375 : SAL_DLLPRIVATE void ImplInitLineColor();
376 : SAL_DLLPRIVATE void ImplInitFillColor();
377 : SAL_DLLPRIVATE bool ImplNewFont() const;
378 : SAL_DLLPRIVATE void ImplInitFont() const;
379 : SAL_DLLPRIVATE void ImplInitTextColor();
380 : SAL_DLLPRIVATE void ImplInitClipRegion();
381 : SAL_DLLPRIVATE bool ImplSelectClipRegion( const Region&, SalGraphics* pGraphics = NULL );
382 : SAL_DLLPRIVATE void ImplSetClipRegion( const Region* pRegion );
383 :
384 : SAL_DLLPRIVATE SalLayout* ImplLayout( const OUString&, sal_Int32 nIndex, sal_Int32 nLen,
385 : const Point& rLogicPos = Point(0,0), long nLogicWidth=0,
386 : const sal_Int32* pLogicDXArray=NULL, bool bFilter = false ) const;
387 : SAL_DLLPRIVATE ImplLayoutArgs ImplPrepareLayoutArgs( OUString&, const sal_Int32 nIndex, const sal_Int32 nLen,
388 : long nPixelWidth, const sal_Int32* pPixelDXArray ) const;
389 : SAL_DLLPRIVATE SalLayout* ImplGlyphFallbackLayout( SalLayout*, ImplLayoutArgs& ) const;
390 :
391 : static
392 : SAL_DLLPRIVATE OUString ImplGetEllipsisString( const OutputDevice& rTargetDevice, const OUString& rStr,
393 : long nMaxWidth, sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout );
394 : static
395 : SAL_DLLPRIVATE void ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect,
396 : const String& rOrigStr, sal_uInt16 nStyle,
397 : MetricVector* pVector, OUString* pDisplayText, ::vcl::ITextLayout& _rLayout );
398 : SAL_DLLPRIVATE void ImplDrawTextBackground( const SalLayout& );
399 : SAL_DLLPRIVATE void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, sal_Bool bWordLine, sal_Bool bUnderlineAbove );
400 : SAL_DLLPRIVATE bool ImplDrawRotateText( SalLayout& );
401 : SAL_DLLPRIVATE void ImplDrawTextDirect( SalLayout&, sal_Bool bTextLines );
402 : SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout& );
403 : SAL_DLLPRIVATE void ImplDrawText( SalLayout& );
404 : SAL_DLLPRIVATE Rectangle ImplGetTextBoundRect( const SalLayout& );
405 : SAL_DLLPRIVATE void ImplDrawEmphasisMarks( SalLayout& );
406 :
407 : SAL_DLLPRIVATE void ImplDrawTextRect( long nBaseX, long nBaseY, long nX, long nY, long nWidth, long nHeight );
408 :
409 : SAL_DLLPRIVATE void ImplInitTextLineSize();
410 : SAL_DLLPRIVATE void ImplInitAboveTextLineSize();
411 : SAL_DLLPRIVATE void ImplDrawWaveLine( long nBaseX, long nBaseY, long nStartX, long nStartY, long nWidth, long nHeight, long nLineWidth, short nOrientation, const Color& rColor );
412 : SAL_DLLPRIVATE void ImplDrawWaveTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontUnderline eTextLine, Color aColor, sal_Bool bIsAbove );
413 : SAL_DLLPRIVATE void ImplDrawStraightTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontUnderline eTextLine, Color aColor, sal_Bool bIsAbove );
414 : SAL_DLLPRIVATE void ImplDrawStrikeoutLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
415 : SAL_DLLPRIVATE void ImplDrawStrikeoutChar( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
416 : SAL_DLLPRIVATE void ImplDrawTextLine( long nBaseX, long nX, long nY, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, sal_Bool bUnderlineAbove );
417 : SAL_DLLPRIVATE void ImplDrawMnemonicLine( long nX, long nY, long nWidth );
418 : SAL_DLLPRIVATE void ImplGetEmphasisMark( PolyPolygon& rPolyPoly, sal_Bool& rPolyLine, Rectangle& rRect1, Rectangle& rRect2, long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short nOrient );
419 : SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const PolyPolygon& rPolyPoly, sal_Bool bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 );
420 : static
421 : SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const OUString& rStr, sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout );
422 : SAL_DLLPRIVATE void ImplInitFontList() const;
423 : SAL_DLLPRIVATE void ImplUpdateFontData( bool bNewFontLists );
424 : SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists );
425 :
426 : SAL_DLLPRIVATE long ImplLogicXToDevicePixel( long nX ) const;
427 : SAL_DLLPRIVATE long ImplLogicYToDevicePixel( long nY ) const;
428 : SAL_DLLPRIVATE long ImplLogicWidthToDevicePixel( long nWidth ) const;
429 : SAL_DLLPRIVATE long ImplLogicHeightToDevicePixel( long nHeight ) const;
430 : SAL_DLLPRIVATE long ImplDevicePixelToLogicWidth( long nWidth ) const;
431 : SAL_DLLPRIVATE long ImplDevicePixelToLogicHeight( long nHeight ) const;
432 : SAL_DLLPRIVATE float ImplFloatLogicHeightToDevicePixel( float ) const;
433 : SAL_DLLPRIVATE Point ImplLogicToDevicePixel( const Point& rLogicPt ) const;
434 : SAL_DLLPRIVATE Size ImplLogicToDevicePixel( const Size& rLogicSize ) const;
435 : SAL_DLLPRIVATE Rectangle ImplLogicToDevicePixel( const Rectangle& rLogicRect ) const;
436 : SAL_DLLPRIVATE ::basegfx::B2DPolygon ImplLogicToDevicePixel( const ::basegfx::B2DPolygon& ) const;
437 : SAL_DLLPRIVATE ::basegfx::B2DPolyPolygon ImplLogicToDevicePixel( const ::basegfx::B2DPolyPolygon& ) const;
438 : SAL_DLLPRIVATE Polygon ImplLogicToDevicePixel( const Polygon& rLogicPoly ) const;
439 : SAL_DLLPRIVATE PolyPolygon ImplLogicToDevicePixel( const PolyPolygon& rLogicPolyPoly ) const;
440 : SAL_DLLPRIVATE LineInfo ImplLogicToDevicePixel( const LineInfo& rLineInfo ) const;
441 : SAL_DLLPRIVATE Rectangle ImplDevicePixelToLogic( const Rectangle& rLogicRect ) const;
442 : SAL_DLLPRIVATE Region ImplPixelToDevicePixel( const Region& rRegion ) const;
443 : SAL_DLLPRIVATE void ImplInvalidateViewTransform();
444 : SAL_DLLPRIVATE basegfx::B2DHomMatrix ImplGetDeviceTransformation() const;
445 :
446 : SAL_DLLPRIVATE void ImplDrawPolygon( const Polygon& rPoly, const PolyPolygon* pClipPolyPoly = NULL );
447 : SAL_DLLPRIVATE void ImplDrawPolyPolygon( const PolyPolygon& rPolyPoly, const PolyPolygon* pClipPolyPoly = NULL );
448 : SAL_DLLPRIVATE void ImplDrawPolyPolygon( sal_uInt16 nPoly, const PolyPolygon& rPolyPoly );
449 : SAL_DLLPRIVATE void ImplDrawLinearGradient( const Rectangle& rRect, const Gradient& rGradient, sal_Bool bMtf, const PolyPolygon* pClipPolyPoly );
450 : SAL_DLLPRIVATE void ImplDrawComplexGradient( const Rectangle& rRect, const Gradient& rGradient, sal_Bool bMtf, const PolyPolygon* pClipPolyPoly );
451 :
452 : SAL_DLLPRIVATE void ImplDrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch, sal_Bool bMtf );
453 : SAL_DLLPRIVATE void ImplCalcHatchValues( const Rectangle& rRect, long nDist, sal_uInt16 nAngle10, Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 );
454 : SAL_DLLPRIVATE void ImplDrawHatchLine( const Line& rLine, const PolyPolygon& rPolyPoly, Point* pPtBuffer, sal_Bool bMtf );
455 :
456 : SAL_DLLPRIVATE void ImplDrawWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
457 : SAL_DLLPRIVATE void ImplDrawColorWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
458 : SAL_DLLPRIVATE void ImplDrawBitmapWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
459 : SAL_DLLPRIVATE void ImplDrawGradientWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
460 :
461 : SAL_DLLPRIVATE void ImplDrawOutDevDirect( const OutputDevice* pSrcDev, SalTwoRect& rPosAry );
462 : SAL_DLLPRIVATE void ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize,
463 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
464 : const Bitmap& rBitmap, const sal_uLong nAction );
465 : SAL_DLLPRIVATE void ImplDrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
466 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
467 : const BitmapEx& rBitmapEx, const sal_uLong nAction );
468 : SAL_DLLPRIVATE void ImplDrawMask( const Point& rDestPt, const Size& rDestSize,
469 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
470 : const Bitmap& rBitmap, const Color& rMaskColor,
471 : const sal_uLong nAction );
472 : SAL_DLLPRIVATE void ImplDrawAlpha( const Bitmap& rBmp, const AlphaMask& rAlpha,
473 : const Point& rDestPt, const Size& rDestSize,
474 : const Point& rSrcPtPixel, const Size& rSrcSizePixel );
475 : SAL_DLLPRIVATE Bitmap ImplBlend( Bitmap aBmp,
476 : BitmapReadAccess* pP,
477 : BitmapReadAccess* pA,
478 : const sal_Int32 nOffY,
479 : const sal_Int32 nDstHeight,
480 : const sal_Int32 nOffX,
481 : const sal_Int32 nDstWidth,
482 : const Rectangle& aBmpRect,
483 : const Size& aOutSz,
484 : const bool bHMirr,
485 : const bool bVMirr,
486 : const long* pMapX,
487 : const long* pMapY );
488 : SAL_DLLPRIVATE Bitmap ImplBlendWithAlpha( Bitmap aBmp,
489 : BitmapReadAccess* pP,
490 : BitmapReadAccess* pA,
491 : const Rectangle& aDstRect,
492 : const sal_Int32 nOffY,
493 : const sal_Int32 nDstHeight,
494 : const sal_Int32 nOffX,
495 : const sal_Int32 nDstWidth,
496 : const long* pMapX,
497 : const long* pMapY );
498 : SAL_DLLPRIVATE void ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask,
499 : const Point& rDestPt, const Size& rDestSize,
500 : const Point& rSrcPtPixel, const Size& rSrcSizePixel );
501 : SAL_DLLPRIVATE void ImplPrintMask( const Bitmap& rMask, const Color& rMaskColor,
502 : const Point& rDestPt, const Size& rDestSize,
503 : const Point& rSrcPtPixel, const Size& rSrcSizePixel );
504 : SAL_DLLPRIVATE void ImplDrawFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
505 : const OutputDevice& rOutDev, const Region& rRegion );
506 : SAL_DLLPRIVATE void ImplGetFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
507 : OutputDevice& rOutDev );
508 :
509 : SAL_DLLPRIVATE sal_Bool ImplIsRecordLayout() const;
510 :
511 : void ImplAddDevFontSubstitute( const OUString& rFontName,
512 : const OUString& rReplaceFontName,
513 : sal_uInt16 nFlags = 0 );
514 :
515 : SAL_DLLPRIVATE static FontEmphasisMark ImplGetEmphasisMarkStyle( const Font& rFont );
516 : SAL_DLLPRIVATE static sal_Bool ImplIsUnderlineAbove( const Font& );
517 :
518 : // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI
519 : SAL_DLLPRIVATE bool ImplIsAntiparallel() const ;
520 : SAL_DLLPRIVATE Color ImplDrawModeToColor( const Color& rColor ) const;
521 :
522 : // #i101491#
523 : // Helper which holds the old line geometry creation and is extended to use AA when
524 : // switched on. Advantage is that line geometry is only temporarily used for paint
525 : SAL_DLLPRIVATE void ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineInfo& rLineInfo);
526 :
527 : // #i101491#
528 : // Helper who implements the DrawPolyPolygon functionality for basegfx::B2DPolyPolygon
529 : // without MetaFile processing
530 : SAL_DLLPRIVATE void ImpDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPolygon& rB2DPolyPoly);
531 :
532 : // #i101491#
533 : // Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool. Contains no AA check.
534 : SAL_DLLPRIVATE bool ImpTryDrawPolyLineDirect(
535 : const basegfx::B2DPolygon& rB2DPolygon,
536 : double fLineWidth = 0.0,
537 : double fTransparency = 0.0,
538 : basegfx::B2DLineJoin eLineJoin = basegfx::B2DLINEJOIN_NONE,
539 : com::sun::star::drawing::LineCap eLineCap = com::sun::star::drawing::LineCap_BUTT);
540 :
541 : // Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area)
542 : void impPaintLineGeometryWithEvtlExpand(const LineInfo& rInfo, basegfx::B2DPolyPolygon aLinePolyPolygon);
543 :
544 : SAL_DLLPRIVATE SalLayout* getFallbackFont(ImplFontEntry &rFallbackFont,
545 : FontSelectPattern &rFontSelData, int nFallbackLevel,
546 : ImplLayoutArgs& rLayoutArgs) const;
547 : protected:
548 : OutputDevice();
549 :
550 : private:
551 : SAL_DLLPRIVATE OutputDevice( const OutputDevice& rOutDev );
552 : SAL_DLLPRIVATE OutputDevice& operator =( const OutputDevice& rOutDev );
553 :
554 : public:
555 : virtual ~OutputDevice();
556 :
557 2019612 : OutDevType GetOutDevType() const { return meOutDevType; }
558 :
559 : /** query an <code>OutputDevice</code> whether it spports a specific operation
560 :
561 : @return
562 : true if operation supported, else false
563 : */
564 : bool supportsOperation( OutDevSupportType ) const;
565 :
566 29272 : vcl::PDFWriterImpl* GetPDFWriter() const { return mpPDFWriter; }
567 :
568 0 : void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; }
569 103358 : vcl::ExtOutDevData* GetExtOutDevData() const { return mpExtOutDevData; }
570 :
571 : void DrawTextLine( const Point& rPos, long nWidth,
572 : FontStrikeout eStrikeout,
573 : FontUnderline eUnderline,
574 : FontUnderline eOverline,
575 : sal_Bool bUnderlineAbove = sal_False );
576 :
577 : void DrawText( const Point& rStartPt, const XubString& rStr,
578 : xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
579 : MetricVector* pVector = NULL, OUString* pDisplayText = NULL );
580 : long GetTextWidth( const OUString& rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
581 : /// Height where any character of the current font fits; in logic coordinates.
582 : long GetTextHeight() const;
583 : float approximate_char_width() const;
584 : void DrawTextArray( const Point& rStartPt, const XubString& rStr,
585 : const sal_Int32* pDXAry = NULL,
586 : xub_StrLen nIndex = 0,
587 : xub_StrLen nLen = STRING_LEN );
588 : long GetTextArray( const OUString& rStr, sal_Int32* pDXAry = NULL,
589 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
590 : bool GetCaretPositions( const OUString&, sal_Int32* pCaretXArray,
591 : sal_Int32 nIndex, sal_Int32 nLen,
592 : sal_Int32* pDXAry = NULL, long nWidth = 0,
593 : sal_Bool bCellBreaking = sal_True ) const;
594 : void DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
595 : const XubString& rStr,
596 : xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN );
597 : xub_StrLen GetTextBreak( const OUString& rStr, long nTextWidth,
598 : sal_Int32 nIndex = 0, sal_Int32 nLen = -1,
599 : long nCharExtra = 0, sal_Bool bCellBreaking = sal_True ) const;
600 : xub_StrLen GetTextBreak( const OUString& rStr, long nTextWidth,
601 : sal_Unicode nExtraChar, sal_Int32& rExtraCharPos,
602 : sal_Int32 nIndex, sal_Int32 nLen,
603 : long nCharExtra = 0 ) const;
604 : /** Generate MetaTextActions for the text rect
605 :
606 : This method splits up the text rect into multiple
607 : MetaTextActions, one for each line of text. This is comparable
608 : to AddGradientActions(), which splits up a gradient into its
609 : constituing polygons. Parameter semantics fully compatible to
610 : DrawText().
611 : */
612 : void AddTextRectActions( const Rectangle& rRect,
613 : const String& rOrigStr,
614 : sal_uInt16 nStyle,
615 : GDIMetaFile& rMtf );
616 : void DrawText( const Rectangle& rRect,
617 : const XubString& rStr, sal_uInt16 nStyle = 0,
618 : MetricVector* pVector = NULL, OUString* pDisplayText = NULL,
619 : ::vcl::ITextLayout* _pTextLayout = NULL );
620 : Rectangle GetTextRect( const Rectangle& rRect,
621 : const XubString& rStr, sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK,
622 : TextRectInfo* pInfo = NULL,
623 : const ::vcl::ITextLayout* _pTextLayout = NULL ) const;
624 : OUString GetEllipsisString( const OUString& rStr, long nMaxWidth,
625 : sal_uInt16 nStyle = TEXT_DRAW_ENDELLIPSIS ) const;
626 : void DrawCtrlText( const Point& rPos, const XubString& rStr,
627 : xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
628 : sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC, MetricVector* pVector = NULL, OUString* pDisplayText = NULL );
629 : long GetCtrlTextWidth( const XubString& rStr, xub_StrLen nIndex = 0,
630 : xub_StrLen nLen = STRING_LEN,
631 : sal_uInt16 nStyle = TEXT_DRAW_MNEMONIC ) const;
632 : static XubString GetNonMnemonicString( const XubString& rStr, xub_StrLen& rMnemonicPos );
633 5344 : static XubString GetNonMnemonicString( const XubString& rStr )
634 5344 : { xub_StrLen nDummy; return GetNonMnemonicString( rStr, nDummy ); }
635 :
636 : sal_Bool GetTextBoundRect( Rectangle& rRect,
637 : const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
638 : sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
639 : sal_Bool GetTextOutline( PolyPolygon&,
640 : const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0,
641 : xub_StrLen nLen = STRING_LEN, sal_Bool bOptimize = sal_True,
642 : sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
643 : sal_Bool GetTextOutlines( PolyPolyVector&,
644 : const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0,
645 : xub_StrLen nLen = STRING_LEN, sal_Bool bOptimize = sal_True,
646 : sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
647 : sal_Bool GetTextOutlines( ::basegfx::B2DPolyPolygonVector&,
648 : const String& rStr, xub_StrLen nBase = 0, xub_StrLen nIndex = 0,
649 : xub_StrLen nLen = STRING_LEN, sal_Bool bOptimize = sal_True,
650 : sal_uLong nLayoutWidth = 0, const sal_Int32* pDXArray = NULL ) const;
651 : sal_Bool GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex,
652 : int nLen, int nBase, MetricVector& rVector );
653 :
654 : void DrawPixel( const Point& rPt );
655 : void DrawPixel( const Point& rPt, const Color& rColor );
656 : void DrawPixel( const Polygon& rPts, const Color* pColors = NULL );
657 : void DrawPixel( const Polygon& rPts, const Color& rColor );
658 :
659 : void DrawLine( const Point& rStartPt, const Point& rEndPt );
660 : void DrawLine( const Point& rStartPt, const Point& rEndPt,
661 : const LineInfo& rLineInfo );
662 :
663 : /** Render the given polygon as a line stroke
664 :
665 : The given polygon is stroked with the current LineColor, start
666 : and end point are not automatically connected
667 :
668 : @see DrawPolygon
669 : @see DrawPolyPolygon
670 : */
671 : void DrawPolyLine( const Polygon& rPoly );
672 : void DrawPolyLine(
673 : const basegfx::B2DPolygon&,
674 : double fLineWidth = 0.0,
675 : basegfx::B2DLineJoin = basegfx::B2DLINEJOIN_ROUND,
676 : com::sun::star::drawing::LineCap = com::sun::star::drawing::LineCap_BUTT);
677 : bool TryDrawPolyLineDirect(
678 : const basegfx::B2DPolygon& rB2DPolygon,
679 : double fLineWidth = 0.0,
680 : double fTransparency = 0.0,
681 : basegfx::B2DLineJoin eLineJoin = basegfx::B2DLINEJOIN_NONE,
682 : com::sun::star::drawing::LineCap eLineCap = com::sun::star::drawing::LineCap_BUTT);
683 :
684 : /** Render the given polygon as a line stroke
685 :
686 : The given polygon is stroked with the current LineColor, start
687 : and end point are not automatically connected. The line is
688 : rendered according to the specified LineInfo, e.g. supplying a
689 : dash pattern, or a line thickness.
690 :
691 : @see DrawPolygon
692 : @see DrawPolyPolygon
693 : */
694 : void DrawPolyLine( const Polygon& rPoly,
695 : const LineInfo& rLineInfo );
696 :
697 : /** Render the given polygon
698 :
699 : The given polygon is stroked with the current LineColor, and
700 : filled with the current FillColor. If one of these colors are
701 : transparent, the corresponding stroke or fill stays
702 : invisible. Start and end point of the polygon are
703 : automatically connected.
704 :
705 : @see DrawPolyLine
706 : */
707 : void DrawPolygon( const Polygon& rPoly );
708 : void DrawPolygon( const basegfx::B2DPolygon& );
709 :
710 : /** Render the given poly-polygon
711 :
712 : The given poly-polygon is stroked with the current LineColor,
713 : and filled with the current FillColor. If one of these colors
714 : are transparent, the corresponding stroke or fill stays
715 : invisible. Start and end points of the contained polygons are
716 : automatically connected.
717 :
718 : @see DrawPolyLine
719 : */
720 : void DrawPolyPolygon( const PolyPolygon& rPolyPoly );
721 : void DrawPolyPolygon( const basegfx::B2DPolyPolygon& );
722 :
723 : void DrawRect( const Rectangle& rRect );
724 : void DrawRect( const Rectangle& rRect,
725 : sal_uLong nHorzRount, sal_uLong nVertRound );
726 : void DrawEllipse( const Rectangle& rRect );
727 : void DrawArc( const Rectangle& rRect,
728 : const Point& rStartPt, const Point& rEndPt );
729 : void DrawPie( const Rectangle& rRect,
730 : const Point& rStartPt, const Point& rEndPt );
731 : void DrawChord( const Rectangle& rRect,
732 : const Point& rStartPt, const Point& rEndPt );
733 :
734 : void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
735 : const Point& rSrcPt, const Size& rSrcSize );
736 : void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
737 : const Point& rSrcPt, const Size& rSrcSize,
738 : const OutputDevice& rOutDev );
739 : void CopyArea( const Point& rDestPt,
740 : const Point& rSrcPt, const Size& rSrcSize,
741 : sal_uInt16 nFlags = 0 );
742 :
743 : void DrawBitmap( const Point& rDestPt,
744 : const Bitmap& rBitmap );
745 : void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
746 : const Bitmap& rBitmap );
747 : void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
748 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
749 : const Bitmap& rBitmap );
750 :
751 : void DrawBitmapEx( const Point& rDestPt,
752 : const BitmapEx& rBitmapEx );
753 : void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
754 : const BitmapEx& rBitmapEx );
755 : void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
756 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
757 : const BitmapEx& rBitmapEx );
758 :
759 : /** Draw BitampEx transformed
760 :
761 : @param rTransformation
762 : The transformation describing the target positioning of the given bitmap. Transforming
763 : the unit object coordinates (0, 0, 1, 1) with this matrix is the transformation to
764 : discrete coordinates
765 :
766 : @param rBitmapEx
767 : The BitmapEx to be painted
768 : */
769 : void DrawTransformedBitmapEx(
770 : const basegfx::B2DHomMatrix& rTransformation,
771 : const BitmapEx& rBitmapEx);
772 :
773 : void DrawMask( const Point& rDestPt,
774 : const Bitmap& rBitmap, const Color& rMaskColor );
775 : void DrawMask( const Point& rDestPt, const Size& rDestSize,
776 : const Bitmap& rBitmap, const Color& rMaskColor );
777 : void DrawMask( const Point& rDestPt, const Size& rDestSize,
778 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
779 : const Bitmap& rBitmap, const Color& rMaskColor );
780 :
781 : void DrawImage( const Point& rPos,
782 : const Image& rImage, sal_uInt16 nStyle = 0 );
783 : void DrawImage( const Point& rPos, const Size& rSize,
784 : const Image& rImage, sal_uInt16 nStyle = 0 );
785 :
786 : void DrawGradient( const Rectangle& rRect, const Gradient& rGradient );
787 : void DrawGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient );
788 : void AddGradientActions( const Rectangle& rRect,
789 : const Gradient& rGradient,
790 : GDIMetaFile& rMtf );
791 :
792 : #ifdef _MSC_VER
793 : void DrawHatch( const PolyPolygon& rPolyPoly, const ::Hatch& rHatch );
794 : void AddHatchActions( const PolyPolygon& rPolyPoly,
795 : const ::Hatch& rHatch,
796 : GDIMetaFile& rMtf );
797 : #else
798 : void DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch );
799 : void AddHatchActions( const PolyPolygon& rPolyPoly,
800 : const Hatch& rHatch,
801 : GDIMetaFile& rMtf );
802 : #endif
803 :
804 : void DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper );
805 : void DrawWaveLine( const Point& rStartPos, const Point& rEndPos, sal_uInt16 nStyle );
806 : void DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags );
807 :
808 : void DrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
809 : void DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency);
810 : void DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize,
811 : const Gradient& rTransparenceGradient );
812 :
813 : /** Added return value to see if EPS could be painted directly.
814 : Theoreticaly, handing over a matrix would be needed to handle
815 : painting rotated EPS files (e.g. contained in Metafiles). This
816 : would then need to be supported for Mac and PS printers, but
817 : that's too much for now, wrote #i107046# for this */
818 : bool DrawEPS( const Point& rPt, const Size& rSz,
819 : const GfxLink& rGfxLink, GDIMetaFile* pSubst = NULL );
820 :
821 : /// Fill the given rectangle with checkered rectangles of size nLen x nLen using the colors aStart and aEnd
822 : void DrawCheckered(
823 : const Point& rPos,
824 : const Size& rSize,
825 : sal_uInt32 nLen = 8,
826 : Color aStart = Color(COL_WHITE),
827 : Color aEnd = Color(COL_BLACK));
828 :
829 : Color GetPixel( const Point& rPt ) const;
830 :
831 : Bitmap GetBitmap( const Point& rSrcPt, const Size& rSize ) const;
832 :
833 : /** Query extended bitmap (with alpha channel, if available).
834 : */
835 : BitmapEx GetBitmapEx( const Point& rSrcPt, const Size& rSize ) const;
836 :
837 : void EnableMapMode( sal_Bool bEnable = sal_True );
838 249902 : sal_Bool IsMapModeEnabled() const { return mbMap; }
839 :
840 : // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphisLayout
841 : void EnableRTL( sal_Bool bEnable = sal_True);
842 5035559 : sal_Bool IsRTLEnabled() const { return mbEnableRTL; }
843 :
844 : void SetConnectMetaFile( GDIMetaFile* pMtf );
845 99174 : GDIMetaFile* GetConnectMetaFile() const { return mpMetaFile; }
846 :
847 : void EnableOutput( sal_Bool bEnable = sal_True );
848 5327 : sal_Bool IsOutputEnabled() const { return mbOutput; }
849 : sal_Bool IsDeviceOutput() const { return mbDevOutput; }
850 2675437 : sal_Bool IsDeviceOutputNecessary() const { return (mbOutput && mbDevOutput); }
851 : sal_Bool IsOutputNecessary() const { return ((mbOutput && mbDevOutput) || (mpMetaFile != NULL)); }
852 :
853 : void SetClipRegion();
854 : void SetClipRegion( const Region& rRegion );
855 : Region GetClipRegion() const;
856 47827 : sal_Bool IsClipRegion() const { return mbClipRegion; }
857 : Region GetActiveClipRegion() const;
858 :
859 : void MoveClipRegion( long nHorzMove, long nVertMove );
860 : void IntersectClipRegion( const Rectangle& rRect );
861 : void IntersectClipRegion( const Region& rRegion );
862 :
863 : void SetAntialiasing( sal_uInt16 nMode = 0 );
864 250189 : sal_uInt16 GetAntialiasing() const { return mnAntialiasing; }
865 :
866 : void SetDrawMode( sal_uLong nDrawMode );
867 1110161 : sal_uLong GetDrawMode() const { return mnDrawMode; }
868 :
869 : void SetLayoutMode( sal_uLong nTextLayoutMode );
870 507914 : sal_uLong GetLayoutMode() const { return mnTextLayoutMode; }
871 :
872 : void SetDigitLanguage( LanguageType );
873 321604 : LanguageType GetDigitLanguage() const { return meTextLanguage; }
874 :
875 : void SetRasterOp( RasterOp eRasterOp );
876 168715 : RasterOp GetRasterOp() const { return meRasterOp; }
877 :
878 : /**
879 : If this OutputDevice is used for displaying a Print Preview
880 : the OutDevViewType should be set to 'OUTDEV_VIEWTYPE_PRINTPREVIEW'.
881 :
882 : A View than can make painting decisions dependent on this OutDevViewType.
883 : E.g. text colors need to be handled different, dependent on whether it's a PrintPreview or not. (see #106611# for more)
884 : */
885 8 : void SetOutDevViewType( OutDevViewType eOutDevViewType ) { meOutDevViewType=eOutDevViewType; }
886 1940 : OutDevViewType GetOutDevViewType() const { return meOutDevViewType; }
887 :
888 : void SetLineColor();
889 : void SetLineColor( const Color& rColor );
890 305652 : const Color& GetLineColor() const { return maLineColor; }
891 95509 : sal_Bool IsLineColor() const { return mbLineColor; }
892 :
893 : void SetFillColor();
894 : void SetFillColor( const Color& rColor );
895 246078 : const Color& GetFillColor() const { return maFillColor; }
896 19186 : sal_Bool IsFillColor() const { return mbFillColor; }
897 :
898 : void SetBackground();
899 : void SetBackground( const Wallpaper& rBackground );
900 :
901 161453 : const Wallpaper& GetBackground() const { return maBackground; }
902 331988 : sal_Bool IsBackground() const { return mbBackground; }
903 :
904 : void SetFont( const Font& rNewFont );
905 1488547 : const Font& GetFont() const { return maFont; }
906 :
907 : SystemFontData GetSysFontData( int nFallbacklevel ) const;
908 : SystemTextLayoutData GetSysTextLayoutData( const Point& rStartPt, const XubString& rStr,
909 : xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
910 : const sal_Int32* pDXAry = NULL ) const;
911 :
912 : void SetTextColor( const Color& rColor );
913 169705 : const Color& GetTextColor() const { return maTextColor; }
914 : void SetTextFillColor();
915 : void SetTextFillColor( const Color& rColor );
916 :
917 : Color GetTextFillColor() const;
918 125772 : sal_Bool IsTextFillColor() const { return !maFont.IsTransparent(); }
919 : void SetTextLineColor();
920 : void SetTextLineColor( const Color& rColor );
921 132586 : const Color& GetTextLineColor() const { return maTextLineColor; }
922 55764 : sal_Bool IsTextLineColor() const { return (maTextLineColor.GetTransparency() == 0); }
923 : void SetOverlineColor();
924 : void SetOverlineColor( const Color& rColor );
925 132553 : const Color& GetOverlineColor() const { return maOverlineColor; }
926 55733 : sal_Bool IsOverlineColor() const { return (maOverlineColor.GetTransparency() == 0); }
927 : void SetTextAlign( TextAlign eAlign );
928 45633 : TextAlign GetTextAlign() const { return maFont.GetAlign(); }
929 :
930 : virtual void SetSettings( const AllSettings& rSettings );
931 1065783 : const AllSettings& GetSettings() const { return maSettings; }
932 :
933 : SystemGraphicsData GetSystemGfxData() const;
934 : ::com::sun::star::uno::Any GetSystemGfxDataAny() const;
935 :
936 : virtual void SetMapMode();
937 : virtual void SetMapMode( const MapMode& rNewMapMode );
938 : virtual void SetRelativeMapMode( const MapMode& rNewMapMode );
939 831633 : const MapMode& GetMapMode() const { return maMapMode; }
940 37374 : sal_Bool IsMapMode() const { return mbMap; }
941 :
942 : void SetRefPoint();
943 : void SetRefPoint( const Point& rRefPoint );
944 0 : const Point& GetRefPoint() const { return maRefPoint; }
945 5531 : sal_Bool IsRefPoint() const { return mbRefPoint; }
946 :
947 : // #i75163#
948 : basegfx::B2DHomMatrix GetViewTransformation() const;
949 : basegfx::B2DHomMatrix GetInverseViewTransformation() const;
950 :
951 : basegfx::B2DHomMatrix GetViewTransformation( const MapMode& rMapMode ) const;
952 : basegfx::B2DHomMatrix GetInverseViewTransformation( const MapMode& rMapMode ) const;
953 :
954 :
955 : /** Set an offset in pixel
956 :
957 : This method offsets every drawing operation that converts its
958 : coordinates to pixel by the given value. Normally, the effect
959 : can be achieved by setting a MapMode with a different
960 : origin. Unfortunately, this origin is in logical coordinates
961 : and can lead to rounding errors (see #102532# for details).
962 :
963 : @attention This offset is only applied when converting to
964 : pixel, i.e. some output modes such as metafile recordings
965 : might be completely unaffected by this method! Use with
966 : care. Furthermore, if the OutputDevice's MapMode is the
967 : default (that's MAP_PIXEL), then, too, any pixel offset set is
968 : ignored. This might be unintuitive for cases, but would have
969 : been far more fragile to implement. What's more, the reason
970 : why the pixel offset was introduced (avoiding rounding errors)
971 : does not apply for MAP_PIXEL, because one can always use the
972 : MapMode origin then.
973 :
974 : @param rOffset
975 : The offset in pixel
976 : */
977 : void SetPixelOffset( const Size& rOffset );
978 :
979 : /** Get the offset in pixel
980 :
981 : @see OutputDevice::SetPixelOffset for details
982 :
983 : @return the current offset in pixel
984 : */
985 : Size GetPixelOffset() const;
986 :
987 : Point LogicToPixel( const Point& rLogicPt ) const;
988 : Size LogicToPixel( const Size& rLogicSize ) const;
989 : Rectangle LogicToPixel( const Rectangle& rLogicRect ) const;
990 : Polygon LogicToPixel( const Polygon& rLogicPoly ) const;
991 : PolyPolygon LogicToPixel( const PolyPolygon& rLogicPolyPoly ) const;
992 : basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly ) const;
993 : Region LogicToPixel( const Region& rLogicRegion )const;
994 : Point LogicToPixel( const Point& rLogicPt,
995 : const MapMode& rMapMode ) const;
996 : Size LogicToPixel( const Size& rLogicSize,
997 : const MapMode& rMapMode ) const;
998 : Rectangle LogicToPixel( const Rectangle& rLogicRect,
999 : const MapMode& rMapMode ) const;
1000 : Polygon LogicToPixel( const Polygon& rLogicPoly,
1001 : const MapMode& rMapMode ) const;
1002 : basegfx::B2DPolygon LogicToPixel( const basegfx::B2DPolygon& rLogicPoly,
1003 : const MapMode& rMapMode ) const;
1004 : PolyPolygon LogicToPixel( const PolyPolygon& rLogicPolyPoly,
1005 : const MapMode& rMapMode ) const;
1006 : basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly,
1007 : const MapMode& rMapMode ) const;
1008 : Region LogicToPixel( const Region& rLogicRegion,
1009 : const MapMode& rMapMode ) const;
1010 : Point PixelToLogic( const Point& rDevicePt ) const;
1011 : Size PixelToLogic( const Size& rDeviceSize ) const;
1012 : Rectangle PixelToLogic( const Rectangle& rDeviceRect ) const;
1013 : Polygon PixelToLogic( const Polygon& rDevicePoly ) const;
1014 : basegfx::B2DPolygon LogicToPixel( const basegfx::B2DPolygon& rLogicPoly ) const;
1015 : PolyPolygon PixelToLogic( const PolyPolygon& rDevicePolyPoly ) const;
1016 : basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly ) const;
1017 : Region PixelToLogic( const Region& rDeviceRegion ) const;
1018 : Point PixelToLogic( const Point& rDevicePt,
1019 : const MapMode& rMapMode ) const;
1020 : Size PixelToLogic( const Size& rDeviceSize,
1021 : const MapMode& rMapMode ) const;
1022 : Rectangle PixelToLogic( const Rectangle& rDeviceRect,
1023 : const MapMode& rMapMode ) const;
1024 : Polygon PixelToLogic( const Polygon& rDevicePoly,
1025 : const MapMode& rMapMode ) const;
1026 : basegfx::B2DPolygon PixelToLogic( const basegfx::B2DPolygon& rDevicePoly,
1027 : const MapMode& rMapMode ) const;
1028 : PolyPolygon PixelToLogic( const PolyPolygon& rDevicePolyPoly,
1029 : const MapMode& rMapMode ) const;
1030 : basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly,
1031 : const MapMode& rMapMode ) const;
1032 : Region PixelToLogic( const Region& rDeviceRegion,
1033 : const MapMode& rMapMode ) const;
1034 : Point LogicToLogic( const Point& rPtSource,
1035 : const MapMode* pMapModeSource,
1036 : const MapMode* pMapModeDest ) const;
1037 : Size LogicToLogic( const Size& rSzSource,
1038 : const MapMode* pMapModeSource,
1039 : const MapMode* pMapModeDest ) const;
1040 : Rectangle LogicToLogic( const Rectangle& rRectSource,
1041 : const MapMode* pMapModeSource,
1042 : const MapMode* pMapModeDest ) const;
1043 : static Point LogicToLogic( const Point& rPtSource,
1044 : const MapMode& rMapModeSource,
1045 : const MapMode& rMapModeDest );
1046 : static Size LogicToLogic( const Size& rSzSource,
1047 : const MapMode& rMapModeSource,
1048 : const MapMode& rMapModeDest );
1049 : static Rectangle LogicToLogic( const Rectangle& rRectSource,
1050 : const MapMode& rMapModeSource,
1051 : const MapMode& rMapModeDest );
1052 : static long LogicToLogic( long nLongSource,
1053 : MapUnit eUnitSource,
1054 : MapUnit eUnitDest );
1055 :
1056 : static basegfx::B2DPolygon LogicToLogic( const basegfx::B2DPolygon& rPoly,
1057 : const MapMode& rMapModeSource,
1058 : const MapMode& rMapModeDest );
1059 : static basegfx::B2DPolyPolygon LogicToLogic( const basegfx::B2DPolyPolygon& rPolyPoly,
1060 : const MapMode& rMapModeSource,
1061 : const MapMode& rMapModeDest );
1062 :
1063 : // create a mapping transformation from rMapModeSource to rMapModeDest (the above methods
1064 : // for B2DPoly/Polygons use this internally anyways to transform the B2DPolygon)
1065 : static basegfx::B2DHomMatrix LogicToLogic(const MapMode& rMapModeSource, const MapMode& rMapModeDest);
1066 :
1067 559675 : Size GetOutputSizePixel() const
1068 559675 : { return Size( mnOutWidth, mnOutHeight ); }
1069 81992 : long GetOutputWidthPixel() const { return mnOutWidth; }
1070 66679 : long GetOutputHeightPixel() const { return mnOutHeight; }
1071 706 : long GetOutOffXPixel() const { return mnOutOffX; }
1072 6776 : long GetOutOffYPixel() const { return mnOutOffY; }
1073 :
1074 19379 : Size GetOutputSize() const
1075 19379 : { return PixelToLogic( GetOutputSizePixel() ); }
1076 :
1077 : void Erase();
1078 21706 : void Erase( const Rectangle& rRect ) { DrawWallpaper( rRect, GetBackground() ); }
1079 :
1080 : sal_Bool AddTempDevFont( const String& rFileURL, const String& rFontName );
1081 : int GetDevFontCount() const;
1082 : FontInfo GetDevFont( int nDevFontIndex ) const;
1083 : int GetDevFontSizeCount( const Font& ) const;
1084 : Size GetDevFontSize( const Font& rFont, int nSizeIndex ) const;
1085 : sal_Bool IsFontAvailable( const String& rFontName ) const;
1086 :
1087 : FontMetric GetFontMetric() const;
1088 : FontMetric GetFontMetric( const Font& rFont ) const;
1089 : sal_Bool GetFontCharMap( FontCharMap& rFontCharMap ) const;
1090 : bool GetFontCapabilities( vcl::FontCapabilities& rFontCapabilities ) const;
1091 :
1092 : xub_StrLen HasGlyphs( const Font& rFont, const String& rStr,
1093 : xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN ) const;
1094 :
1095 : long GetMinKashida() const;
1096 :
1097 : // i60594
1098 : // validate kashida positions against the current font
1099 : // returns count of invalid kashida positions
1100 : xub_StrLen ValidateKashidas ( const String& rTxt,
1101 : xub_StrLen nIdx, xub_StrLen nLen,
1102 : xub_StrLen nKashCount, // number of suggested kashida positions (in)
1103 : const xub_StrLen* pKashidaPos, // suggested kashida positions (in)
1104 : xub_StrLen* pKashidaPosDropped // invalid kashida positions (out)
1105 : ) const;
1106 :
1107 : sal_uInt16 GetBitCount() const;
1108 :
1109 : sal_Bool GetTextIsRTL( const OUString&, sal_Int32 nIndex, sal_Int32 nLen ) const;
1110 :
1111 : /** Query the existence and depth of the alpha channel
1112 :
1113 : @return 0, if no alpha channel available, and the bit depth of
1114 : the alpha channel otherwise.
1115 : */
1116 : sal_uInt16 GetAlphaBitCount() const;
1117 : sal_uLong GetColorCount() const;
1118 :
1119 : void Push( sal_uInt16 nFlags = PUSH_ALL );
1120 : void Pop();
1121 : // returns the curren stack depth; that is the number of Push() calls minus the number of Pop() calls
1122 : // this should not normally be used since Push and Pop must always be used symmetrically
1123 : // however this may be e.g. a help when debugging code in which this somehow is not the case
1124 : sal_uInt32 GetGCStackDepth() const;
1125 :
1126 : /** Query availability of alpha channel
1127 :
1128 : @return sal_True, if this device has an alpha channel.
1129 : */
1130 : sal_Bool HasAlpha();
1131 :
1132 : /// request XCanvas render interface for this OutputDevice
1133 : ::com::sun::star::uno::Reference<
1134 : ::com::sun::star::rendering::XCanvas > GetCanvas() const;
1135 :
1136 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > CreateUnoGraphics();
1137 164906 : VCLXGraphicsList_impl* GetUnoGraphicsList() const { return mpUnoGraphicsList; }
1138 1149 : VCLXGraphicsList_impl* CreateUnoGraphicsList()
1139 : {
1140 1149 : mpUnoGraphicsList = new VCLXGraphicsList_impl();
1141 1149 : return mpUnoGraphicsList;
1142 : }
1143 :
1144 : static void BeginFontSubstitution();
1145 : static void EndFontSubstitution();
1146 : static void AddFontSubstitute( const OUString& rFontName,
1147 : const OUString& rReplaceFontName,
1148 : sal_uInt16 nFlags = 0 );
1149 : static void RemoveFontSubstitute( sal_uInt16 n );
1150 : static sal_uInt16 GetFontSubstituteCount();
1151 :
1152 : static Font GetDefaultFont( sal_uInt16 nType,
1153 : LanguageType eLang,
1154 : sal_uLong nFlags,
1155 : const OutputDevice* pOutDev = NULL );
1156 :
1157 : /** helper method removing transparencies from a metafile (e.g. for printing)
1158 :
1159 : @returns
1160 : true: transparencies were removed
1161 : false: output metafile is unchanged input metafile
1162 :
1163 : @attention this is a member method, so current state can influence the result !
1164 : @attention the output metafile is prepared in pixel mode for the currentOutputDevice
1165 : state. It can not be moved or rotated reliably anymore.
1166 : */
1167 : bool RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
1168 : long nMaxBmpDPIX, long nMaxBmpDPIY,
1169 : bool bReduceTransparency,
1170 : bool bTransparencyAutoMode,
1171 : bool bDownsampleBitmaps,
1172 : const Color& rBackground = Color( COL_TRANSPARENT )
1173 : );
1174 : /** Retrieve downsampled and cropped bitmap
1175 :
1176 : @attention This method ignores negative rDstSz values, thus
1177 : mirroring must happen outside this method (e.g. in DrawBitmap)
1178 : */
1179 : Bitmap GetDownsampledBitmap( const Size& rDstSz,
1180 : const Point& rSrcPt, const Size& rSrcSz,
1181 : const Bitmap& rBmp, long nMaxBmpDPIX, long nMaxBmpDPIY );
1182 :
1183 : //-------------------------------------
1184 : // Native Widget Rendering functions
1185 : //-------------------------------------
1186 :
1187 : // These all just call through to the private mpGraphics functions of the same name.
1188 :
1189 : // Query the platform layer for control support
1190 : sal_Bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) const;
1191 :
1192 : // Query the native control to determine if it was acted upon
1193 : sal_Bool HitTestNativeControl( ControlType nType,
1194 : ControlPart nPart,
1195 : const Rectangle& rControlRegion,
1196 : const Point& aPos,
1197 : sal_Bool& rIsInside ) const;
1198 :
1199 : // Request rendering of a particular control and/or part
1200 : sal_Bool DrawNativeControl( ControlType nType,
1201 : ControlPart nPart,
1202 : const Rectangle& rControlRegion,
1203 : ControlState nState,
1204 : const ImplControlValue& aValue,
1205 : OUString aCaption );
1206 :
1207 : // Query the native control's actual drawing region (including adornment)
1208 : sal_Bool GetNativeControlRegion( ControlType nType,
1209 : ControlPart nPart,
1210 : const Rectangle& rControlRegion,
1211 : ControlState nState,
1212 : const ImplControlValue& aValue,
1213 : OUString aCaption,
1214 : Rectangle &rNativeBoundingRegion,
1215 : Rectangle &rNativeContentRegion ) const;
1216 :
1217 : };
1218 :
1219 : #endif // _SV_OUTDEV_HXX
1220 :
1221 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|