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 :
76 : namespace com {
77 : namespace sun {
78 : namespace star {
79 : namespace rendering {
80 : class XCanvas;
81 : }}}}
82 : namespace basegfx {
83 : class B2DHomMatrix;
84 : class B2DPolygon;
85 : class B2DPolyPolygon;
86 : }
87 :
88 : namespace com {
89 : namespace sun {
90 : namespace star {
91 : namespace awt {
92 : class XGraphics;
93 : } } } }
94 :
95 : typedef std::vector< Rectangle > MetricVector;
96 :
97 : namespace vcl
98 : {
99 : class PDFWriterImpl;
100 : class ExtOutDevData;
101 : class ITextLayout;
102 : struct FontCapabilities;
103 : }
104 :
105 : // ---------------------
106 : // - OutputDevice-Data -
107 : // ---------------------
108 :
109 : struct ImplMapRes
110 : {
111 : long mnMapOfsX; // Offset in X Richtung
112 : long mnMapOfsY; // Offset in Y Richtung
113 : long mnMapScNumX; // Skal.-faktor Zaehler X Richtung
114 : long mnMapScNumY; // Skal.-faktor Zaehler Y Richtung
115 : long mnMapScDenomX; // Skal.-faktor Nenner X Richtung
116 : long mnMapScDenomY; // Skal.-faktor Nenner Y Richtung
117 : };
118 :
119 : struct ImplThresholdRes
120 : {
121 : long mnThresLogToPixX; // Schwellenwerte fuer Berechnung
122 : long mnThresLogToPixY; // mit BigInts
123 : long mnThresPixToLogX; // ""
124 : long mnThresPixToLogY; // ""
125 : };
126 :
127 : // ----------------------
128 : // - OutputDevice-Types -
129 : // ----------------------
130 :
131 : // Flags for Push()
132 : #define PUSH_LINECOLOR ((sal_uInt16)0x0001)
133 : #define PUSH_FILLCOLOR ((sal_uInt16)0x0002)
134 : #define PUSH_FONT ((sal_uInt16)0x0004)
135 : #define PUSH_TEXTCOLOR ((sal_uInt16)0x0008)
136 : #define PUSH_MAPMODE ((sal_uInt16)0x0010)
137 : #define PUSH_CLIPREGION ((sal_uInt16)0x0020)
138 : #define PUSH_RASTEROP ((sal_uInt16)0x0040)
139 : #define PUSH_TEXTFILLCOLOR ((sal_uInt16)0x0080)
140 : #define PUSH_TEXTALIGN ((sal_uInt16)0x0100)
141 : #define PUSH_REFPOINT ((sal_uInt16)0x0200)
142 : #define PUSH_TEXTLINECOLOR ((sal_uInt16)0x0400)
143 : #define PUSH_TEXTLAYOUTMODE ((sal_uInt16)0x0800)
144 : #define PUSH_TEXTLANGUAGE ((sal_uInt16)0x1000)
145 : #define PUSH_OVERLINECOLOR ((sal_uInt16)0x2000)
146 : #define PUSH_ALLTEXT (PUSH_TEXTCOLOR | PUSH_TEXTFILLCOLOR | PUSH_TEXTLINECOLOR | PUSH_OVERLINECOLOR | PUSH_TEXTALIGN | PUSH_TEXTLAYOUTMODE | PUSH_TEXTLANGUAGE)
147 : #define PUSH_ALLFONT (PUSH_ALLTEXT | PUSH_FONT)
148 : #define PUSH_ALL ((sal_uInt16)0xFFFF)
149 :
150 : // Flags for DrawText()
151 : #define TEXT_DRAW_DISABLE ((sal_uInt16)0x0001)
152 : #define TEXT_DRAW_MNEMONIC ((sal_uInt16)0x0002)
153 : #define TEXT_DRAW_MONO ((sal_uInt16)0x0004)
154 : #define TEXT_DRAW_CLIP ((sal_uInt16)0x0008)
155 : #define TEXT_DRAW_LEFT ((sal_uInt16)0x0010)
156 : #define TEXT_DRAW_CENTER ((sal_uInt16)0x0020)
157 : #define TEXT_DRAW_RIGHT ((sal_uInt16)0x0040)
158 : #define TEXT_DRAW_TOP ((sal_uInt16)0x0080)
159 : #define TEXT_DRAW_VCENTER ((sal_uInt16)0x0100)
160 : #define TEXT_DRAW_BOTTOM ((sal_uInt16)0x0200)
161 : #define TEXT_DRAW_ENDELLIPSIS ((sal_uInt16)0x0400)
162 : #define TEXT_DRAW_PATHELLIPSIS ((sal_uInt16)0x0800)
163 : #define TEXT_DRAW_MULTILINE ((sal_uInt16)0x1000)
164 : #define TEXT_DRAW_WORDBREAK ((sal_uInt16)0x2000)
165 : #define TEXT_DRAW_NEWSELLIPSIS ((sal_uInt16)0x4000)
166 : // in the long run we should make text style flags longer
167 : // but at the moment we can get away with this 2 bit field for ellipsis style
168 : #define TEXT_DRAW_CENTERELLIPSIS (TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_PATHELLIPSIS)
169 :
170 : #define TEXT_DRAW_WORDBREAK_HYPHENATION (((sal_uInt16)0x8000) | TEXT_DRAW_WORDBREAK)
171 :
172 : // Flags for CopyArea()
173 : #define COPYAREA_WINDOWINVALIDATE ((sal_uInt16)0x0001)
174 :
175 : // Flags for DrawImage()
176 : #define IMAGE_DRAW_DISABLE ((sal_uInt16)0x0001)
177 : #define IMAGE_DRAW_HIGHLIGHT ((sal_uInt16)0x0002)
178 : #define IMAGE_DRAW_DEACTIVE ((sal_uInt16)0x0004)
179 : #define IMAGE_DRAW_COLORTRANSFORM ((sal_uInt16)0x0008)
180 : #define IMAGE_DRAW_SEMITRANSPARENT ((sal_uInt16)0x0010)
181 :
182 : // WaveLine
183 : #define WAVE_FLAT 1
184 : #define WAVE_SMALL 2
185 : #define WAVE_NORMAL 3
186 :
187 : // Grid
188 : #define GRID_DOTS ((sal_uLong)0x00000001)
189 : #define GRID_HORZLINES ((sal_uLong)0x00000002)
190 : #define GRID_VERTLINES ((sal_uLong)0x00000004)
191 : #define GRID_LINES (GRID_HORZLINES | GRID_VERTLINES)
192 :
193 : // LayoutModes for Complex Text Layout
194 : #define TEXT_LAYOUT_DEFAULT ((sal_uLong)0x00000000)
195 : #define TEXT_LAYOUT_BIDI_LTR ((sal_uLong)0x00000000)
196 : #define TEXT_LAYOUT_BIDI_RTL ((sal_uLong)0x00000001)
197 : #define TEXT_LAYOUT_BIDI_STRONG ((sal_uLong)0x00000002)
198 : #define TEXT_LAYOUT_TEXTORIGIN_LEFT ((sal_uLong)0x00000004)
199 : #define TEXT_LAYOUT_TEXTORIGIN_RIGHT ((sal_uLong)0x00000008)
200 : #define TEXT_LAYOUT_COMPLEX_DISABLED ((sal_uLong)0x00000100)
201 : #define TEXT_LAYOUT_ENABLE_LIGATURES ((sal_uLong)0x00000200)
202 : #define TEXT_LAYOUT_SUBSTITUTE_DIGITS ((sal_uLong)0x00000400)
203 :
204 : // DrawModes
205 : #define DRAWMODE_DEFAULT ((sal_uLong)0x00000000)
206 : #define DRAWMODE_BLACKLINE ((sal_uLong)0x00000001)
207 : #define DRAWMODE_BLACKFILL ((sal_uLong)0x00000002)
208 : #define DRAWMODE_BLACKTEXT ((sal_uLong)0x00000004)
209 : #define DRAWMODE_BLACKBITMAP ((sal_uLong)0x00000008)
210 : #define DRAWMODE_BLACKGRADIENT ((sal_uLong)0x00000010)
211 : #define DRAWMODE_GRAYLINE ((sal_uLong)0x00000020)
212 : #define DRAWMODE_GRAYFILL ((sal_uLong)0x00000040)
213 : #define DRAWMODE_GRAYTEXT ((sal_uLong)0x00000080)
214 : #define DRAWMODE_GRAYBITMAP ((sal_uLong)0x00000100)
215 : #define DRAWMODE_GRAYGRADIENT ((sal_uLong)0x00000200)
216 : #define DRAWMODE_NOFILL ((sal_uLong)0x00000400)
217 : #define DRAWMODE_NOBITMAP ((sal_uLong)0x00000800)
218 : #define DRAWMODE_NOGRADIENT ((sal_uLong)0x00001000)
219 : #define DRAWMODE_GHOSTEDLINE ((sal_uLong)0x00002000)
220 : #define DRAWMODE_GHOSTEDFILL ((sal_uLong)0x00004000)
221 : #define DRAWMODE_GHOSTEDTEXT ((sal_uLong)0x00008000)
222 : #define DRAWMODE_GHOSTEDBITMAP ((sal_uLong)0x00010000)
223 : #define DRAWMODE_GHOSTEDGRADIENT ((sal_uLong)0x00020000)
224 : #define DRAWMODE_WHITELINE ((sal_uLong)0x00100000)
225 : #define DRAWMODE_WHITEFILL ((sal_uLong)0x00200000)
226 : #define DRAWMODE_WHITETEXT ((sal_uLong)0x00400000)
227 : #define DRAWMODE_WHITEBITMAP ((sal_uLong)0x00800000)
228 : #define DRAWMODE_WHITEGRADIENT ((sal_uLong)0x01000000)
229 : #define DRAWMODE_SETTINGSLINE ((sal_uLong)0x02000000)
230 : #define DRAWMODE_SETTINGSFILL ((sal_uLong)0x04000000)
231 : #define DRAWMODE_SETTINGSTEXT ((sal_uLong)0x08000000)
232 : #define DRAWMODE_SETTINGSGRADIENT ((sal_uLong)0x10000000)
233 : #define DRAWMODE_NOTRANSPARENCY ((sal_uLong)0x80000000)
234 :
235 : // Antialiasing
236 : #define ANTIALIASING_DISABLE_TEXT ((sal_uInt16)0x0001)
237 : #define ANTIALIASING_ENABLE_B2DDRAW ((sal_uInt16)0x0002)
238 : #define ANTIALIASING_PIXELSNAPHAIRLINE ((sal_uInt16)0x0004)
239 :
240 : // AddFontSubstitute
241 : #define FONT_SUBSTITUTE_ALWAYS ((sal_uInt16)0x0001)
242 : #define FONT_SUBSTITUTE_SCREENONLY ((sal_uInt16)0x0002)
243 :
244 : #define DEFAULTFONT_FLAGS_ONLYONE ((sal_uLong)0x00000001)
245 :
246 : enum OutDevType { OUTDEV_DONTKNOW, OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV };
247 :
248 : enum OutDevViewType { OUTDEV_VIEWTYPE_DONTKNOW, OUTDEV_VIEWTYPE_PRINTPREVIEW, OUTDEV_VIEWTYPE_SLIDESHOW };
249 :
250 : // ----------------
251 : // - OutputDevice -
252 : // ----------------
253 :
254 : class VirtualDevice;
255 : class Printer;
256 : class FontSelectPattern;
257 : class ImplFontMetricData;
258 : class VCLXGraphics;
259 :
260 : typedef ::std::vector< VCLXGraphics* > VCLXGraphicsList_impl;
261 :
262 : const char* ImplDbgCheckOutputDevice( const void* pObj );
263 :
264 : class VCL_DLLPUBLIC OutputDevice : public Resource
265 : {
266 : friend class Application;
267 : friend class Bitmap;
268 : friend class ImplImageBmp;
269 : friend class Printer;
270 : friend class System;
271 : friend class VirtualDevice;
272 : friend class Window;
273 : friend class WorkWindow;
274 : friend class vcl::PDFWriterImpl;
275 : friend const char* ImplDbgCheckOutputDevice( const void* pObj );
276 : friend void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight );
277 :
278 : private:
279 : mutable SalGraphics* mpGraphics;
280 : mutable OutputDevice* mpPrevGraphics;
281 : mutable OutputDevice* mpNextGraphics;
282 : GDIMetaFile* mpMetaFile;
283 : mutable ImplFontEntry* mpFontEntry;
284 : mutable ImplFontCache* mpFontCache;
285 : mutable ImplDevFontList* mpFontList;
286 : mutable ImplGetDevFontList* mpGetDevFontList;
287 : mutable ImplGetDevSizeList* mpGetDevSizeList;
288 : ImplObjStack* mpObjStack;
289 : ImplOutDevData* mpOutDevData;
290 : VCLXGraphicsList_impl* mpUnoGraphicsList;
291 : vcl::PDFWriterImpl* mpPDFWriter;
292 : vcl::ExtOutDevData* mpExtOutDevData;
293 :
294 : // TEMP TEMP TEMP
295 : VirtualDevice* mpAlphaVDev;
296 :
297 : /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
298 : long mnOutOffOrigX;
299 : /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
300 : long mnOutOffLogicX;
301 : /// Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
302 : long mnOutOffOrigY;
303 : /// Additional output offset in _logical_ coordinates, applied in PixelToLogic (used by SetPixelOffset/GetPixelOffset)
304 : long mnOutOffLogicY;
305 : /// Output offset for device output in pixel (pseudo window offset within window system's frames)
306 : long mnOutOffX;
307 : /// Output offset for device output in pixel (pseudo window offset within window system's frames)
308 : long mnOutOffY;
309 : long mnOutWidth;
310 : long mnOutHeight;
311 : sal_Int32 mnDPIX;
312 : sal_Int32 mnDPIY;
313 : /// font specific text alignment offsets in pixel units
314 : mutable long mnTextOffX;
315 : mutable long mnTextOffY;
316 : mutable long mnEmphasisAscent;
317 : mutable long mnEmphasisDescent;
318 : sal_uLong mnDrawMode;
319 : sal_uLong mnTextLayoutMode;
320 : ImplMapRes maMapRes;
321 : ImplThresholdRes maThresRes;
322 : OutDevType meOutDevType;
323 : OutDevViewType meOutDevViewType;
324 : Region maRegion; // contains the clip region, see SetClipRegion(...)
325 : Color maLineColor;
326 : Color maFillColor;
327 : Font maFont;
328 : Color maTextColor;
329 : Color maTextLineColor;
330 : Color maOverlineColor;
331 : TextAlign meTextAlign;
332 : RasterOp meRasterOp;
333 : Wallpaper maBackground;
334 : AllSettings maSettings;
335 : MapMode maMapMode;
336 : Point maRefPoint;
337 : sal_uInt16 mnAntialiasing;
338 : LanguageType meTextLanguage;
339 : mutable sal_Bool mbMap:1,
340 : mbMapIsDefault:1,
341 : mbClipRegion:1,
342 : mbBackground:1,
343 : mbOutput:1,
344 : mbDevOutput:1,
345 : mbOutputClipped:1,
346 : mbLineColor:1,
347 : mbFillColor:1,
348 : mbInitLineColor:1,
349 : mbInitFillColor:1,
350 : mbInitFont:1,
351 : mbInitTextColor:1,
352 : mbInitClipRegion:1,
353 : mbClipRegionSet:1,
354 : mbKerning:1,
355 : mbNewFont:1,
356 : mbTextLines:1,
357 : mbTextSpecial:1,
358 : mbRefPoint:1,
359 : mbEnableRTL:1;
360 :
361 : public:
362 30 : SAL_DLLPRIVATE sal_Int32 ImplGetDPIX() const { return mnDPIX; }
363 1486 : SAL_DLLPRIVATE sal_Int32 ImplGetDPIY() const { return mnDPIY; }
364 : SAL_DLLPRIVATE int ImplGetGraphics() const;
365 : SAL_DLLPRIVATE void ImplReleaseGraphics( sal_Bool bRelease = sal_True );
366 : SAL_DLLPRIVATE sal_Bool ImplHasMirroredGraphics();
367 : SAL_DLLPRIVATE void ImplReMirror( Point &rPoint ) const;
368 : SAL_DLLPRIVATE void ImplReMirror( Rectangle &rRect ) const;
369 : SAL_DLLPRIVATE void ImplReMirror( Region &rRegion ) const;
370 : SAL_DLLPRIVATE void ImplInitOutDevData();
371 : SAL_DLLPRIVATE void ImplDeInitOutDevData();
372 : SAL_DLLPRIVATE void ImplInitLineColor();
373 : SAL_DLLPRIVATE void ImplInitFillColor();
374 : SAL_DLLPRIVATE bool ImplNewFont() const;
375 : SAL_DLLPRIVATE void ImplInitFont() const;
376 : SAL_DLLPRIVATE void ImplInitTextColor();
377 : SAL_DLLPRIVATE void ImplInitClipRegion();
378 : SAL_DLLPRIVATE bool ImplSelectClipRegion( const Region&, SalGraphics* pGraphics = NULL );
379 : SAL_DLLPRIVATE void ImplSetClipRegion( const Region* pRegion );
380 :
381 : SAL_DLLPRIVATE SalLayout* ImplLayout( const String&, xub_StrLen nIndex,
382 : xub_StrLen nLen, const Point& rLogicPos = Point(0,0),
383 : long nLogicWidth=0, const sal_Int32* pLogicDXArray=NULL,
384 : bool bFilter = false ) const;
385 : SAL_DLLPRIVATE ImplLayoutArgs ImplPrepareLayoutArgs( String&,
386 : xub_StrLen nIndex, xub_StrLen nLen,
387 : long nPixelWidth,
388 : const sal_Int32* pPixelDXArray ) const;
389 : SAL_DLLPRIVATE SalLayout* ImplGlyphFallbackLayout( SalLayout*, ImplLayoutArgs& ) const;
390 :
391 : static
392 : SAL_DLLPRIVATE XubString ImplGetEllipsisString( const OutputDevice& rTargetDevice, const XubString& 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, String* 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 XubString& 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, void* pPosAry );
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 XubString& rFontName,
512 : const XubString& 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 : basegfx::B2DLineJoin eLineJoin = basegfx::B2DLINEJOIN_NONE,
538 : com::sun::star::drawing::LineCap eLineCap = com::sun::star::drawing::LineCap_BUTT);
539 :
540 : // Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area)
541 : void impPaintLineGeometryWithEvtlExpand(const LineInfo& rInfo, basegfx::B2DPolyPolygon aLinePolyPolygon);
542 :
543 : SAL_DLLPRIVATE SalLayout* getFallbackFontThatFits(ImplFontEntry &rFallbackFont,
544 : FontSelectPattern &rFontSelData, int nFallbackLevel,
545 : ImplLayoutArgs& rLayoutArgs, const ImplFontMetricData& rOrigMetric) const;
546 : protected:
547 : OutputDevice();
548 :
549 : private:
550 : SAL_DLLPRIVATE OutputDevice( const OutputDevice& rOutDev );
551 : SAL_DLLPRIVATE OutputDevice& operator =( const OutputDevice& rOutDev );
552 :
553 : public:
554 : virtual ~OutputDevice();
555 :
556 187931 : OutDevType GetOutDevType() const { return meOutDevType; }
557 :
558 : /** query an <code>OutputDevice</code> whether it spports a specific operation
559 :
560 : @return
561 : true if operation supported, else false
562 : */
563 : bool supportsOperation( OutDevSupportType ) const;
564 :
565 656 : vcl::PDFWriterImpl* GetPDFWriter() const { return mpPDFWriter; }
566 :
567 0 : void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; }
568 6577 : vcl::ExtOutDevData* GetExtOutDevData() const { return mpExtOutDevData; }
569 :
570 : void DrawTextLine( const Point& rPos, long nWidth,
571 : FontStrikeout eStrikeout,
572 : FontUnderline eUnderline,
573 : FontUnderline eOverline,
574 : sal_Bool bUnderlineAbove = sal_False );
575 :
576 : void DrawText( const Point& rStartPt, const XubString& rStr,
577 : xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
578 : MetricVector* pVector = NULL, String* pDisplayText = NULL );
579 : long GetTextWidth( const XubString& rStr, xub_StrLen nIndex = 0,
580 : xub_StrLen nLen = STRING_LEN ) const;
581 : /// Height where any character of the current font fits; in logic coordinates.
582 : long GetTextHeight() const;
583 : void DrawTextArray( const Point& rStartPt, const XubString& rStr,
584 : const sal_Int32* pDXAry = NULL,
585 : xub_StrLen nIndex = 0,
586 : xub_StrLen nLen = STRING_LEN );
587 : long GetTextArray( const XubString& rStr, sal_Int32* pDXAry = NULL,
588 : xub_StrLen nIndex = 0,
589 : xub_StrLen nLen = STRING_LEN ) const;
590 : bool GetCaretPositions( const XubString&, sal_Int32* pCaretXArray,
591 : xub_StrLen nIndex, xub_StrLen 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 XubString& rStr, long nTextWidth,
598 : xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
599 : long nCharExtra = 0, sal_Bool bCellBreaking = sal_True ) const;
600 : xub_StrLen GetTextBreak( const XubString& rStr, long nTextWidth,
601 : sal_uInt16 nExtraChar, xub_StrLen& rExtraCharPos,
602 : xub_StrLen nIndex, xub_StrLen 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, String* 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 XubString& 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, String* 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 0 : static XubString GetNonMnemonicString( const XubString& rStr )
634 0 : { 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 :
678 : /** Render the given polygon as a line stroke
679 :
680 : The given polygon is stroked with the current LineColor, start
681 : and end point are not automatically connected. The line is
682 : rendered according to the specified LineInfo, e.g. supplying a
683 : dash pattern, or a line thickness.
684 :
685 : @see DrawPolygon
686 : @see DrawPolyPolygon
687 : */
688 : void DrawPolyLine( const Polygon& rPoly,
689 : const LineInfo& rLineInfo );
690 :
691 : /** Render the given polygon
692 :
693 : The given polygon is stroked with the current LineColor, and
694 : filled with the current FillColor. If one of these colors are
695 : transparent, the corresponding stroke or fill stays
696 : invisible. Start and end point of the polygon are
697 : automatically connected.
698 :
699 : @see DrawPolyLine
700 : */
701 : void DrawPolygon( const Polygon& rPoly );
702 : void DrawPolygon( const basegfx::B2DPolygon& );
703 :
704 : /** Render the given poly-polygon
705 :
706 : The given poly-polygon is stroked with the current LineColor,
707 : and filled with the current FillColor. If one of these colors
708 : are transparent, the corresponding stroke or fill stays
709 : invisible. Start and end points of the contained polygons are
710 : automatically connected.
711 :
712 : @see DrawPolyLine
713 : */
714 : void DrawPolyPolygon( const PolyPolygon& rPolyPoly );
715 : void DrawPolyPolygon( const basegfx::B2DPolyPolygon& );
716 :
717 : void DrawRect( const Rectangle& rRect );
718 : void DrawRect( const Rectangle& rRect,
719 : sal_uLong nHorzRount, sal_uLong nVertRound );
720 : void DrawEllipse( const Rectangle& rRect );
721 : void DrawArc( const Rectangle& rRect,
722 : const Point& rStartPt, const Point& rEndPt );
723 : void DrawPie( const Rectangle& rRect,
724 : const Point& rStartPt, const Point& rEndPt );
725 : void DrawChord( const Rectangle& rRect,
726 : const Point& rStartPt, const Point& rEndPt );
727 :
728 : void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
729 : const Point& rSrcPt, const Size& rSrcSize );
730 : void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
731 : const Point& rSrcPt, const Size& rSrcSize,
732 : const OutputDevice& rOutDev );
733 : void CopyArea( const Point& rDestPt,
734 : const Point& rSrcPt, const Size& rSrcSize,
735 : sal_uInt16 nFlags = 0 );
736 :
737 : void DrawBitmap( const Point& rDestPt,
738 : const Bitmap& rBitmap );
739 : void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
740 : const Bitmap& rBitmap );
741 : void DrawBitmap( const Point& rDestPt, const Size& rDestSize,
742 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
743 : const Bitmap& rBitmap );
744 :
745 : void DrawBitmapEx( const Point& rDestPt,
746 : const BitmapEx& rBitmapEx );
747 : void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
748 : const BitmapEx& rBitmapEx );
749 : void DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
750 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
751 : const BitmapEx& rBitmapEx );
752 :
753 : void DrawMask( const Point& rDestPt,
754 : const Bitmap& rBitmap, const Color& rMaskColor );
755 : void DrawMask( const Point& rDestPt, const Size& rDestSize,
756 : const Bitmap& rBitmap, const Color& rMaskColor );
757 : void DrawMask( const Point& rDestPt, const Size& rDestSize,
758 : const Point& rSrcPtPixel, const Size& rSrcSizePixel,
759 : const Bitmap& rBitmap, const Color& rMaskColor );
760 :
761 : void DrawImage( const Point& rPos,
762 : const Image& rImage, sal_uInt16 nStyle = 0 );
763 : void DrawImage( const Point& rPos, const Size& rSize,
764 : const Image& rImage, sal_uInt16 nStyle = 0 );
765 :
766 : void DrawGradient( const Rectangle& rRect, const Gradient& rGradient );
767 : void DrawGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient );
768 : void AddGradientActions( const Rectangle& rRect,
769 : const Gradient& rGradient,
770 : GDIMetaFile& rMtf );
771 :
772 : #ifdef _MSC_VER
773 : void DrawHatch( const PolyPolygon& rPolyPoly, const ::Hatch& rHatch );
774 : void AddHatchActions( const PolyPolygon& rPolyPoly,
775 : const ::Hatch& rHatch,
776 : GDIMetaFile& rMtf );
777 : #else
778 : void DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch );
779 : void AddHatchActions( const PolyPolygon& rPolyPoly,
780 : const Hatch& rHatch,
781 : GDIMetaFile& rMtf );
782 : #endif
783 :
784 : void DrawWallpaper( const Rectangle& rRect, const Wallpaper& rWallpaper );
785 : void DrawWaveLine( const Point& rStartPos, const Point& rEndPos, sal_uInt16 nStyle );
786 : void DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags );
787 :
788 : void DrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
789 : void DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency);
790 : void DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize,
791 : const Gradient& rTransparenceGradient );
792 :
793 : /** Added return value to see if EPS could be painted directly.
794 : Theoreticaly, handing over a matrix would be needed to handle
795 : painting rotated EPS files (e.g. contained in Metafiles). This
796 : would then need to be supported for Mac and PS printers, but
797 : that's too much for now, wrote #i107046# for this */
798 : bool DrawEPS( const Point& rPt, const Size& rSz,
799 : const GfxLink& rGfxLink, GDIMetaFile* pSubst = NULL );
800 :
801 : Color GetPixel( const Point& rPt ) const;
802 :
803 : Bitmap GetBitmap( const Point& rSrcPt, const Size& rSize ) const;
804 :
805 : /** Query extended bitmap (with alpha channel, if available).
806 : */
807 : BitmapEx GetBitmapEx( const Point& rSrcPt, const Size& rSize ) const;
808 :
809 : void EnableMapMode( sal_Bool bEnable = sal_True );
810 23878 : sal_Bool IsMapModeEnabled() const { return mbMap; }
811 :
812 : // Enabling/disabling RTL only makes sense for OutputDevices that use a mirroring SalGraphisLayout
813 : void EnableRTL( sal_Bool bEnable = sal_True);
814 312082 : sal_Bool IsRTLEnabled() const { return mbEnableRTL; }
815 :
816 : void SetConnectMetaFile( GDIMetaFile* pMtf );
817 10491 : GDIMetaFile* GetConnectMetaFile() const { return mpMetaFile; }
818 :
819 : void EnableOutput( sal_Bool bEnable = sal_True );
820 8 : sal_Bool IsOutputEnabled() const { return mbOutput; }
821 : sal_Bool IsDeviceOutput() const { return mbDevOutput; }
822 224349 : sal_Bool IsDeviceOutputNecessary() const { return (mbOutput && mbDevOutput); }
823 : sal_Bool IsOutputNecessary() const { return ((mbOutput && mbDevOutput) || (mpMetaFile != NULL)); }
824 :
825 : void SetClipRegion();
826 : void SetClipRegion( const Region& rRegion );
827 : Region GetClipRegion() const;
828 9068 : sal_Bool IsClipRegion() const { return mbClipRegion; }
829 : Region GetActiveClipRegion() const;
830 :
831 : void MoveClipRegion( long nHorzMove, long nVertMove );
832 : void IntersectClipRegion( const Rectangle& rRect );
833 : void IntersectClipRegion( const Region& rRegion );
834 :
835 : void SetAntialiasing( sal_uInt16 nMode = 0 );
836 18421 : sal_uInt16 GetAntialiasing() const { return mnAntialiasing; }
837 :
838 : void SetDrawMode( sal_uLong nDrawMode );
839 103697 : sal_uLong GetDrawMode() const { return mnDrawMode; }
840 :
841 : void SetLayoutMode( sal_uLong nTextLayoutMode );
842 27699 : sal_uLong GetLayoutMode() const { return mnTextLayoutMode; }
843 :
844 : void SetDigitLanguage( LanguageType );
845 17949 : LanguageType GetDigitLanguage() const { return meTextLanguage; }
846 :
847 : void SetRasterOp( RasterOp eRasterOp );
848 14782 : RasterOp GetRasterOp() const { return meRasterOp; }
849 :
850 : /**
851 : If this OutputDevice is used for displaying a Print Preview
852 : the OutDevViewType should be set to 'OUTDEV_VIEWTYPE_PRINTPREVIEW'.
853 :
854 : A View than can make painting decisions dependent on this OutDevViewType.
855 : E.g. text colors need to be handled different, dependent on whether it's a PrintPreview or not. (see #106611# for more)
856 : */
857 0 : void SetOutDevViewType( OutDevViewType eOutDevViewType ) { meOutDevViewType=eOutDevViewType; }
858 0 : OutDevViewType GetOutDevViewType() const { return meOutDevViewType; }
859 :
860 : void SetLineColor();
861 : void SetLineColor( const Color& rColor );
862 19138 : const Color& GetLineColor() const { return maLineColor; }
863 641 : sal_Bool IsLineColor() const { return mbLineColor; }
864 :
865 : void SetFillColor();
866 : void SetFillColor( const Color& rColor );
867 20554 : const Color& GetFillColor() const { return maFillColor; }
868 38 : sal_Bool IsFillColor() const { return mbFillColor; }
869 :
870 : void SetBackground();
871 : void SetBackground( const Wallpaper& rBackground );
872 :
873 43112 : const Wallpaper& GetBackground() const { return maBackground; }
874 11711 : sal_Bool IsBackground() const { return mbBackground; }
875 :
876 : void SetFont( const Font& rNewFont );
877 96647 : const Font& GetFont() const { return maFont; }
878 :
879 : SystemFontData GetSysFontData( int nFallbacklevel ) const;
880 : SystemTextLayoutData GetSysTextLayoutData( const Point& rStartPt, const XubString& rStr,
881 : xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
882 : const sal_Int32* pDXAry = NULL ) const;
883 :
884 : void SetTextColor( const Color& rColor );
885 37135 : const Color& GetTextColor() const { return maTextColor; }
886 : void SetTextFillColor();
887 : void SetTextFillColor( const Color& rColor );
888 :
889 : Color GetTextFillColor() const;
890 10126 : sal_Bool IsTextFillColor() const { return !maFont.IsTransparent(); }
891 : void SetTextLineColor();
892 : void SetTextLineColor( const Color& rColor );
893 5056 : const Color& GetTextLineColor() const { return maTextLineColor; }
894 2831 : sal_Bool IsTextLineColor() const { return (maTextLineColor.GetTransparency() == 0); }
895 : void SetOverlineColor();
896 : void SetOverlineColor( const Color& rColor );
897 5056 : const Color& GetOverlineColor() const { return maOverlineColor; }
898 2831 : sal_Bool IsOverlineColor() const { return (maOverlineColor.GetTransparency() == 0); }
899 : void SetTextAlign( TextAlign eAlign );
900 3298 : TextAlign GetTextAlign() const { return maFont.GetAlign(); }
901 :
902 : virtual void SetSettings( const AllSettings& rSettings );
903 63513 : const AllSettings& GetSettings() const { return maSettings; }
904 :
905 : SystemGraphicsData GetSystemGfxData() const;
906 : ::com::sun::star::uno::Any GetSystemGfxDataAny() const;
907 :
908 : virtual void SetMapMode();
909 : virtual void SetMapMode( const MapMode& rNewMapMode );
910 : virtual void SetRelativeMapMode( const MapMode& rNewMapMode );
911 59374 : const MapMode& GetMapMode() const { return maMapMode; }
912 5614 : sal_Bool IsMapMode() const { return mbMap; }
913 :
914 : void SetRefPoint();
915 : void SetRefPoint( const Point& rRefPoint );
916 0 : const Point& GetRefPoint() const { return maRefPoint; }
917 0 : sal_Bool IsRefPoint() const { return mbRefPoint; }
918 :
919 : // #i75163#
920 : basegfx::B2DHomMatrix GetViewTransformation() const;
921 : basegfx::B2DHomMatrix GetInverseViewTransformation() const;
922 :
923 : basegfx::B2DHomMatrix GetViewTransformation( const MapMode& rMapMode ) const;
924 : basegfx::B2DHomMatrix GetInverseViewTransformation( const MapMode& rMapMode ) const;
925 :
926 :
927 : /** Set an offset in pixel
928 :
929 : This method offsets every drawing operation that converts its
930 : coordinates to pixel by the given value. Normally, the effect
931 : can be achieved by setting a MapMode with a different
932 : origin. Unfortunately, this origin is in logical coordinates
933 : and can lead to rounding errors (see #102532# for details).
934 :
935 : @attention This offset is only applied when converting to
936 : pixel, i.e. some output modes such as metafile recordings
937 : might be completely unaffected by this method! Use with
938 : care. Furthermore, if the OutputDevice's MapMode is the
939 : default (that's MAP_PIXEL), then, too, any pixel offset set is
940 : ignored. This might be unintuitive for cases, but would have
941 : been far more fragile to implement. What's more, the reason
942 : why the pixel offset was introduced (avoiding rounding errors)
943 : does not apply for MAP_PIXEL, because one can always use the
944 : MapMode origin then.
945 :
946 : @param rOffset
947 : The offset in pixel
948 : */
949 : void SetPixelOffset( const Size& rOffset );
950 :
951 : /** Get the offset in pixel
952 :
953 : @see OutputDevice::SetPixelOffset for details
954 :
955 : @return the current offset in pixel
956 : */
957 : Size GetPixelOffset() const;
958 :
959 : Point LogicToPixel( const Point& rLogicPt ) const;
960 : Size LogicToPixel( const Size& rLogicSize ) const;
961 : Rectangle LogicToPixel( const Rectangle& rLogicRect ) const;
962 : Polygon LogicToPixel( const Polygon& rLogicPoly ) const;
963 : PolyPolygon LogicToPixel( const PolyPolygon& rLogicPolyPoly ) const;
964 : Region LogicToPixel( const Region& rLogicRegion )const;
965 : Point LogicToPixel( const Point& rLogicPt,
966 : const MapMode& rMapMode ) const;
967 : Size LogicToPixel( const Size& rLogicSize,
968 : const MapMode& rMapMode ) const;
969 : Rectangle LogicToPixel( const Rectangle& rLogicRect,
970 : const MapMode& rMapMode ) const;
971 : Polygon LogicToPixel( const Polygon& rLogicPoly,
972 : const MapMode& rMapMode ) const;
973 : basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly,
974 : const MapMode& rMapMode ) const;
975 : Point PixelToLogic( const Point& rDevicePt ) const;
976 : Size PixelToLogic( const Size& rDeviceSize ) const;
977 : Rectangle PixelToLogic( const Rectangle& rDeviceRect ) const;
978 : Polygon PixelToLogic( const Polygon& rDevicePoly ) const;
979 : PolyPolygon PixelToLogic( const PolyPolygon& rDevicePolyPoly ) const;
980 : Region PixelToLogic( const Region& rDeviceRegion ) const;
981 : Point PixelToLogic( const Point& rDevicePt,
982 : const MapMode& rMapMode ) const;
983 : Size PixelToLogic( const Size& rDeviceSize,
984 : const MapMode& rMapMode ) const;
985 : Rectangle PixelToLogic( const Rectangle& rDeviceRect,
986 : const MapMode& rMapMode ) const;
987 : Polygon PixelToLogic( const Polygon& rDevicePoly,
988 : const MapMode& rMapMode ) const;
989 : basegfx::B2DPolygon PixelToLogic( const basegfx::B2DPolygon& rDevicePoly,
990 : const MapMode& rMapMode ) const;
991 : basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly,
992 : const MapMode& rMapMode ) const;
993 : Point LogicToLogic( const Point& rPtSource,
994 : const MapMode* pMapModeSource,
995 : const MapMode* pMapModeDest ) const;
996 : Size LogicToLogic( const Size& rSzSource,
997 : const MapMode* pMapModeSource,
998 : const MapMode* pMapModeDest ) const;
999 : Rectangle LogicToLogic( const Rectangle& rRectSource,
1000 : const MapMode* pMapModeSource,
1001 : const MapMode* pMapModeDest ) const;
1002 : static Point LogicToLogic( const Point& rPtSource,
1003 : const MapMode& rMapModeSource,
1004 : const MapMode& rMapModeDest );
1005 : static Size LogicToLogic( const Size& rSzSource,
1006 : const MapMode& rMapModeSource,
1007 : const MapMode& rMapModeDest );
1008 : static Rectangle LogicToLogic( const Rectangle& rRectSource,
1009 : const MapMode& rMapModeSource,
1010 : const MapMode& rMapModeDest );
1011 : static long LogicToLogic( long nLongSource,
1012 : MapUnit eUnitSource,
1013 : MapUnit eUnitDest );
1014 :
1015 : static basegfx::B2DPolygon LogicToLogic( const basegfx::B2DPolygon& rPoly,
1016 : const MapMode& rMapModeSource,
1017 : const MapMode& rMapModeDest );
1018 :
1019 25639 : Size GetOutputSizePixel() const
1020 25639 : { return Size( mnOutWidth, mnOutHeight ); }
1021 710 : long GetOutputWidthPixel() const { return mnOutWidth; }
1022 470 : long GetOutputHeightPixel() const { return mnOutHeight; }
1023 0 : long GetOutOffXPixel() const { return mnOutOffX; }
1024 0 : long GetOutOffYPixel() const { return mnOutOffY; }
1025 :
1026 1007 : Size GetOutputSize() const
1027 1007 : { return PixelToLogic( GetOutputSizePixel() ); }
1028 :
1029 : void Erase();
1030 964 : void Erase( const Rectangle& rRect ) { DrawWallpaper( rRect, GetBackground() ); }
1031 :
1032 : sal_Bool AddTempDevFont( const String& rFileURL, const String& rFontName );
1033 : int GetDevFontCount() const;
1034 : FontInfo GetDevFont( int nDevFontIndex ) const;
1035 : int GetDevFontSizeCount( const Font& ) const;
1036 : Size GetDevFontSize( const Font& rFont, int nSizeIndex ) const;
1037 : sal_Bool IsFontAvailable( const String& rFontName ) const;
1038 :
1039 : FontMetric GetFontMetric() const;
1040 : FontMetric GetFontMetric( const Font& rFont ) const;
1041 : sal_Bool GetFontCharMap( FontCharMap& rFontCharMap ) const;
1042 : bool GetFontCapabilities( vcl::FontCapabilities& rFontCapabilities ) const;
1043 :
1044 : xub_StrLen HasGlyphs( const Font& rFont, const String& rStr,
1045 : xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN ) const;
1046 :
1047 : long GetMinKashida() const;
1048 :
1049 : // i60594
1050 : // validate kashida positions against the current font
1051 : // returns count of invalid kashida positions
1052 : xub_StrLen ValidateKashidas ( const String& rTxt,
1053 : xub_StrLen nIdx, xub_StrLen nLen,
1054 : xub_StrLen nKashCount, // number of suggested kashida positions (in)
1055 : const xub_StrLen* pKashidaPos, // suggested kashida positions (in)
1056 : xub_StrLen* pKashidaPosDropped // invalid kashida positions (out)
1057 : ) const;
1058 :
1059 : sal_uInt16 GetBitCount() const;
1060 :
1061 : sal_Bool GetTextIsRTL( const String&, xub_StrLen nIndex,
1062 : xub_StrLen nLen ) const;
1063 :
1064 : /** Query the existence and depth of the alpha channel
1065 :
1066 : @return 0, if no alpha channel available, and the bit depth of
1067 : the alpha channel otherwise.
1068 : */
1069 : sal_uInt16 GetAlphaBitCount() const;
1070 : sal_uLong GetColorCount() const;
1071 :
1072 : void Push( sal_uInt16 nFlags = PUSH_ALL );
1073 : void Pop();
1074 : // returns the curren stack depth; that is the number of Push() calls minus the number of Pop() calls
1075 : // this should not normally be used since Push and Pop must always be used symmetrically
1076 : // however this may be e.g. a help when debugging code in which this somehow is not the case
1077 : sal_uInt32 GetGCStackDepth() const;
1078 :
1079 : /** Query availability of alpha channel
1080 :
1081 : @return sal_True, if this device has an alpha channel.
1082 : */
1083 : sal_Bool HasAlpha();
1084 :
1085 : /// request XCanvas render interface for this OutputDevice
1086 : ::com::sun::star::uno::Reference<
1087 : ::com::sun::star::rendering::XCanvas > GetCanvas() const;
1088 :
1089 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > CreateUnoGraphics();
1090 8869 : VCLXGraphicsList_impl* GetUnoGraphicsList() const { return mpUnoGraphicsList; }
1091 0 : VCLXGraphicsList_impl* CreateUnoGraphicsList()
1092 : {
1093 0 : mpUnoGraphicsList = new VCLXGraphicsList_impl();
1094 0 : return mpUnoGraphicsList;
1095 : }
1096 :
1097 : static void BeginFontSubstitution();
1098 : static void EndFontSubstitution();
1099 : static void AddFontSubstitute( const XubString& rFontName,
1100 : const XubString& rReplaceFontName,
1101 : sal_uInt16 nFlags = 0 );
1102 : static void RemoveFontSubstitute( sal_uInt16 n );
1103 : static sal_uInt16 GetFontSubstituteCount();
1104 :
1105 : static Font GetDefaultFont( sal_uInt16 nType,
1106 : LanguageType eLang,
1107 : sal_uLong nFlags,
1108 : const OutputDevice* pOutDev = NULL );
1109 :
1110 : /** helper method removing transparencies from a metafile (e.g. for printing)
1111 :
1112 : @returns
1113 : true: transparencies were removed
1114 : false: output metafile is unchanged input metafile
1115 :
1116 : @attention this is a member method, so current state can influence the result !
1117 : @attention the output metafile is prepared in pixel mode for the currentOutputDevice
1118 : state. It can not be moved or rotated reliably anymore.
1119 : */
1120 : bool RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
1121 : long nMaxBmpDPIX, long nMaxBmpDPIY,
1122 : bool bReduceTransparency,
1123 : bool bTransparencyAutoMode,
1124 : bool bDownsampleBitmaps,
1125 : const Color& rBackground = Color( COL_TRANSPARENT )
1126 : );
1127 : /** Retrieve downsampled and cropped bitmap
1128 :
1129 : @attention This method ignores negative rDstSz values, thus
1130 : mirroring must happen outside this method (e.g. in DrawBitmap)
1131 : */
1132 : Bitmap GetDownsampledBitmap( const Size& rDstSz,
1133 : const Point& rSrcPt, const Size& rSrcSz,
1134 : const Bitmap& rBmp, long nMaxBmpDPIX, long nMaxBmpDPIY );
1135 :
1136 : //-------------------------------------
1137 : // Native Widget Rendering functions
1138 : //-------------------------------------
1139 :
1140 : // These all just call through to the private mpGraphics functions of the same name.
1141 :
1142 : // Query the platform layer for control support
1143 : sal_Bool IsNativeControlSupported( ControlType nType, ControlPart nPart );
1144 :
1145 : // Query the native control to determine if it was acted upon
1146 : sal_Bool HitTestNativeControl( ControlType nType,
1147 : ControlPart nPart,
1148 : const Rectangle& rControlRegion,
1149 : const Point& aPos,
1150 : sal_Bool& rIsInside );
1151 :
1152 : // Request rendering of a particular control and/or part
1153 : sal_Bool DrawNativeControl( ControlType nType,
1154 : ControlPart nPart,
1155 : const Rectangle& rControlRegion,
1156 : ControlState nState,
1157 : const ImplControlValue& aValue,
1158 : ::rtl::OUString aCaption );
1159 :
1160 : // Query the native control's actual drawing region (including adornment)
1161 : sal_Bool GetNativeControlRegion( ControlType nType,
1162 : ControlPart nPart,
1163 : const Rectangle& rControlRegion,
1164 : ControlState nState,
1165 : const ImplControlValue& aValue,
1166 : ::rtl::OUString aCaption,
1167 : Rectangle &rNativeBoundingRegion,
1168 : Rectangle &rNativeContentRegion ) const;
1169 :
1170 : };
1171 :
1172 : #endif // _SV_OUTDEV_HXX
1173 :
1174 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|