xref: /trunk/main/drawinglayer/source/processor2d/vclprocessor2d.cxx (revision 6de8cae65ecb10f3206aa5e2283af92ef8b79ebc)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_drawinglayer.hxx"
26 
27 #include <drawinglayer/processor2d/vclprocessor2d.hxx>
28 #include <drawinglayer/primitive2d/textprimitive2d.hxx>
29 #include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx>
30 #include <tools/debug.hxx>
31 #include <vcl/outdev.hxx>
32 #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
33 #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
34 #include <vclhelperbitmaptransform.hxx>
35 #include <basegfx/polygon/b2dpolygontools.hxx>
36 #include <vclhelperbitmaprender.hxx>
37 #include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
38 #include <drawinglayer/primitive2d/fillgraphicprimitive2d.hxx>
39 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
40 #include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
41 #include <drawinglayer/primitive2d/maskprimitive2d.hxx>
42 #include <basegfx/polygon/b2dpolypolygontools.hxx>
43 #include <vclhelperbufferdevice.hxx>
44 #include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
45 #include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
46 #include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
47 #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
48 #include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx>
49 #include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx>
50 #include <drawinglayer/primitive2d/wrongspellprimitive2d.hxx>
51 #include <svl/ctloptions.hxx>
52 #include <vcl/svapp.hxx>
53 #include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
54 #include <tools/diagnose_ex.h>
55 #include <vcl/metric.hxx>
56 #include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
57 #include <drawinglayer/primitive2d/epsprimitive2d.hxx>
58 #include <drawinglayer/primitive2d/svggradientprimitive2d.hxx>
59 #include <basegfx/color/bcolor.hxx>
60 #include <basegfx/matrix/b2dhommatrixtools.hxx>
61 #include <vcl/graph.hxx>
62 
63 //////////////////////////////////////////////////////////////////////////////
64 // control support
65 
66 #include <com/sun/star/awt/XWindow2.hpp>
67 #include <com/sun/star/awt/PosSize.hpp>
68 #include <com/sun/star/awt/XView.hpp>
69 #include <drawinglayer/primitive2d/controlprimitive2d.hxx>
70 #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
71 
72 //////////////////////////////////////////////////////////////////////////////
73 // for test, can be removed again
74 
75 #include <basegfx/polygon/b2dpolygonclipper.hxx>
76 #include <basegfx/polygon/b2dtrapezoid.hxx>
77 
78 //////////////////////////////////////////////////////////////////////////////
79 
80 using namespace com::sun::star;
81 
82 //////////////////////////////////////////////////////////////////////////////
83 
84 namespace
85 {
86     sal_uInt32 calculateStepsForSvgGradient(const basegfx::BColor& rColorA, const basegfx::BColor& rColorB, double fDelta, double fDiscreteUnit)
87     {
88         // use color distance, assume to do every color step
89         sal_uInt32 nSteps(basegfx::fround(rColorA.getDistance(rColorB) * 255.0));
90 
91         if(nSteps)
92         {
93             // calc discrete length to change color each disctete unit (pixel)
94             const sal_uInt32 nDistSteps(basegfx::fround(fDelta / fDiscreteUnit));
95 
96             nSteps = std::min(nSteps, nDistSteps);
97         }
98 
99         // reduce quality to 3 discrete units or every 3rd color step for rendering
100         nSteps /= 2;
101 
102         // roughly cut when too big or too small (not full quality, reduce complexity)
103         nSteps = std::min(nSteps, sal_uInt32(255));
104         nSteps = std::max(nSteps, sal_uInt32(1));
105 
106         return nSteps;
107     }
108 } // end of anonymous namespace
109 
110 //////////////////////////////////////////////////////////////////////////////
111 
112 namespace drawinglayer
113 {
114     namespace processor2d
115     {
116         //////////////////////////////////////////////////////////////////////////////
117         // UNO class usages
118         using ::com::sun::star::uno::Reference;
119         using ::com::sun::star::uno::UNO_QUERY;
120         using ::com::sun::star::uno::UNO_QUERY_THROW;
121         using ::com::sun::star::uno::Exception;
122         using ::com::sun::star::awt::XView;
123         using ::com::sun::star::awt::XGraphics;
124         using ::com::sun::star::awt::XWindow;
125         using ::com::sun::star::awt::PosSize::POSSIZE;
126 
127         //////////////////////////////////////////////////////////////////////////////
128         // rendering support
129 
130         // directdraw of text simple portion or decorated portion primitive. When decorated, all the extra
131         // information is translated to VCL parameters and set at the font.
132         // Acceptance is restricted to no shearing and positive scaling in X and Y (no font mirroring
133         // for VCL)
134         void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate)
135         {
136             // decompose matrix to have position and size of text
137             basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rTextCandidate.getTextTransform());
138             basegfx::B2DVector aFontScaling, aTranslate;
139             double fRotate, fShearX;
140             aLocalTransform.decompose(aFontScaling, aTranslate, fRotate, fShearX);
141             bool bPrimitiveAccepted(false);
142 
143             if(basegfx::fTools::equalZero(fShearX))
144             {
145                 if(basegfx::fTools::less(aFontScaling.getX(), 0.0) && basegfx::fTools::less(aFontScaling.getY(), 0.0))
146                 {
147                     // handle special case: If scale is negative in (x,y) (3rd quadrant), it can
148                     // be expressed as rotation by PI. Use this since the Font rendering will not
149                     // apply the negative scales in any form
150                     aFontScaling = basegfx::absolute(aFontScaling);
151                     fRotate += F_PI;
152                 }
153 
154                 if(basegfx::fTools::more(aFontScaling.getX(), 0.0) && basegfx::fTools::more(aFontScaling.getY(), 0.0))
155                 {
156                     // Get the VCL font (use FontHeight as FontWidth)
157                     Font aFont(primitive2d::getVclFontFromFontAttribute(
158                         rTextCandidate.getFontAttribute(),
159                         aFontScaling.getX(),
160                         aFontScaling.getY(),
161                         fRotate,
162                         rTextCandidate.getLocale()));
163 
164                     // handle additional font attributes
165                     const primitive2d::TextDecoratedPortionPrimitive2D* pTCPP =
166                         dynamic_cast<const primitive2d::TextDecoratedPortionPrimitive2D*>( &rTextCandidate );
167 
168                     if( pTCPP != NULL )
169                     {
170 
171                         // set the color of text decorations
172                         const basegfx::BColor aTextlineColor = maBColorModifierStack.getModifiedColor(pTCPP->getTextlineColor());
173                         mpOutputDevice->SetTextLineColor( Color(aTextlineColor) );
174 
175                         // set Overline attribute
176                         const FontUnderline eFontOverline(primitive2d::mapTextLineToFontUnderline( pTCPP->getFontOverline() ));
177                         if( eFontOverline != UNDERLINE_NONE )
178                         {
179                             aFont.SetOverline( eFontOverline );
180                             const basegfx::BColor aOverlineColor = maBColorModifierStack.getModifiedColor(pTCPP->getOverlineColor());
181                             mpOutputDevice->SetOverlineColor( Color(aOverlineColor) );
182                             if( pTCPP->getWordLineMode() )
183                                 aFont.SetWordLineMode( true );
184                         }
185 
186                         // set Underline attribute
187                         const FontUnderline eFontUnderline(primitive2d::mapTextLineToFontUnderline( pTCPP->getFontUnderline() ));
188                         if( eFontUnderline != UNDERLINE_NONE )
189                         {
190                             aFont.SetUnderline( eFontUnderline );
191                             if( pTCPP->getWordLineMode() )
192                                 aFont.SetWordLineMode( true );
193 //TODO: ???                 if( pTCPP->getUnderlineAbove() )
194 //                              aFont.SetUnderlineAbove( true );
195                         }
196 
197                         // set Strikeout attribute
198                         const FontStrikeout eFontStrikeout(primitive2d::mapTextStrikeoutToFontStrikeout(pTCPP->getTextStrikeout()));
199 
200                         if( eFontStrikeout != STRIKEOUT_NONE )
201                             aFont.SetStrikeout( eFontStrikeout );
202 
203                         // set EmphasisMark attribute
204                         FontEmphasisMark eFontEmphasisMark = EMPHASISMARK_NONE;
205                         switch( pTCPP->getTextEmphasisMark() )
206                         {
207                             default:
208                                 DBG_WARNING1( "DrawingLayer: Unknown EmphasisMark style (%d)!", pTCPP->getTextEmphasisMark() );
209                                 // fall through
210                             case primitive2d::TEXT_EMPHASISMARK_NONE:   eFontEmphasisMark = EMPHASISMARK_NONE; break;
211                             case primitive2d::TEXT_EMPHASISMARK_DOT:    eFontEmphasisMark = EMPHASISMARK_DOT; break;
212                             case primitive2d::TEXT_EMPHASISMARK_CIRCLE: eFontEmphasisMark = EMPHASISMARK_CIRCLE; break;
213                             case primitive2d::TEXT_EMPHASISMARK_DISC:   eFontEmphasisMark = EMPHASISMARK_DISC; break;
214                             case primitive2d::TEXT_EMPHASISMARK_ACCENT: eFontEmphasisMark = EMPHASISMARK_ACCENT; break;
215                         }
216 
217                         if( eFontEmphasisMark != EMPHASISMARK_NONE )
218                         {
219                             DBG_ASSERT( (pTCPP->getEmphasisMarkAbove() != pTCPP->getEmphasisMarkBelow()),
220                                 "DrawingLayer: Bad EmphasisMark position!" );
221                             if( pTCPP->getEmphasisMarkAbove() )
222                                 eFontEmphasisMark |= EMPHASISMARK_POS_ABOVE;
223                             else
224                                 eFontEmphasisMark |= EMPHASISMARK_POS_BELOW;
225                             aFont.SetEmphasisMark( eFontEmphasisMark );
226                         }
227 
228                         // set Relief attribute
229                         FontRelief eFontRelief = RELIEF_NONE;
230                         switch( pTCPP->getTextRelief() )
231                         {
232                             default:
233                                 DBG_WARNING1( "DrawingLayer: Unknown Relief style (%d)!", pTCPP->getTextRelief() );
234                                 // fall through
235                             case primitive2d::TEXT_RELIEF_NONE:     eFontRelief = RELIEF_NONE; break;
236                             case primitive2d::TEXT_RELIEF_EMBOSSED: eFontRelief = RELIEF_EMBOSSED; break;
237                             case primitive2d::TEXT_RELIEF_ENGRAVED: eFontRelief = RELIEF_ENGRAVED; break;
238                         }
239 
240                         if( eFontRelief != RELIEF_NONE )
241                             aFont.SetRelief( eFontRelief );
242 
243                         // set Shadow attribute
244                         if( pTCPP->getShadow() )
245                             aFont.SetShadow( true );
246                     }
247 
248                     // create transformed integer DXArray in view coordinate system
249                     ::std::vector< sal_Int32 > aTransformedDXArray;
250 
251                     if(rTextCandidate.getDXArray().size())
252                     {
253                         aTransformedDXArray.reserve(rTextCandidate.getDXArray().size());
254                         const basegfx::B2DVector aPixelVector(maCurrentTransformation * basegfx::B2DVector(1.0, 0.0));
255                         const double fPixelVectorFactor(aPixelVector.getLength());
256 
257                         for(::std::vector< double >::const_iterator aStart(rTextCandidate.getDXArray().begin());
258                             aStart != rTextCandidate.getDXArray().end(); aStart++)
259                         {
260                             aTransformedDXArray.push_back(basegfx::fround((*aStart) * fPixelVectorFactor));
261                         }
262                     }
263 
264                     // set parameters and paint text snippet
265                     const basegfx::BColor aRGBFontColor(maBColorModifierStack.getModifiedColor(rTextCandidate.getFontColor()));
266                     const basegfx::B2DPoint aPoint(aLocalTransform * basegfx::B2DPoint(0.0, 0.0));
267                     const Point aStartPoint(basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()));
268                     const sal_uInt32 nOldLayoutMode(mpOutputDevice->GetLayoutMode());
269 
270                     if(rTextCandidate.getFontAttribute().getRTL())
271                     {
272                         sal_uInt32 nRTLLayoutMode(nOldLayoutMode & ~(TEXT_LAYOUT_COMPLEX_DISABLED|TEXT_LAYOUT_BIDI_STRONG));
273                         nRTLLayoutMode |= TEXT_LAYOUT_BIDI_RTL|TEXT_LAYOUT_TEXTORIGIN_LEFT;
274                         mpOutputDevice->SetLayoutMode(nRTLLayoutMode);
275                     }
276 
277                     mpOutputDevice->SetFont(aFont);
278                     mpOutputDevice->SetTextColor(Color(aRGBFontColor));
279 
280                     if(aTransformedDXArray.size())
281                     {
282                         mpOutputDevice->DrawTextArray(
283                             aStartPoint,
284                             rTextCandidate.getText(),
285                             &(aTransformedDXArray[0]),
286                             rTextCandidate.getTextPosition(),
287                             rTextCandidate.getTextLength());
288                     }
289                     else
290                     {
291                         mpOutputDevice->DrawText(
292                             aStartPoint,
293                             rTextCandidate.getText(),
294                             rTextCandidate.getTextPosition(),
295                             rTextCandidate.getTextLength());
296                     }
297 
298                     if(rTextCandidate.getFontAttribute().getRTL())
299                     {
300                         mpOutputDevice->SetLayoutMode(nOldLayoutMode);
301                     }
302 
303                     bPrimitiveAccepted = true;
304                 }
305             }
306 
307             if(!bPrimitiveAccepted)
308             {
309                 // let break down
310                 process(rTextCandidate.get2DDecomposition(getViewInformation2D()));
311             }
312         }
313 
314         // direct draw of hairline
315         void VclProcessor2D::RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate, bool bPixelBased)
316         {
317             const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rPolygonCandidate.getBColor()));
318             mpOutputDevice->SetLineColor(Color(aHairlineColor));
319             mpOutputDevice->SetFillColor();
320 
321             basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon());
322             aLocalPolygon.transform(maCurrentTransformation);
323 
324             static bool bCheckTrapezoidDecomposition(false);
325             static bool bShowOutlinesThere(false);
326             if(bCheckTrapezoidDecomposition)
327             {
328                 // clip against discrete ViewPort
329                 const basegfx::B2DRange& rDiscreteViewport = getViewInformation2D().getDiscreteViewport();
330                 basegfx::B2DPolyPolygon aLocalPolyPolygon(basegfx::tools::clipPolygonOnRange(
331                     aLocalPolygon, rDiscreteViewport, true, false));
332 
333                 if(aLocalPolyPolygon.count())
334                 {
335                     // subdivide
336                     aLocalPolyPolygon = basegfx::tools::adaptiveSubdivideByDistance(
337                         aLocalPolyPolygon, 0.5);
338 
339                     // trapezoidize
340                     static double fLineWidth(2.0);
341                     basegfx::B2DTrapezoidVector aB2DTrapezoidVector;
342                     basegfx::tools::createLineTrapezoidFromB2DPolyPolygon(aB2DTrapezoidVector, aLocalPolyPolygon, fLineWidth);
343 
344                     const sal_uInt32 nCount(aB2DTrapezoidVector.size());
345 
346                     if(nCount)
347                     {
348                         basegfx::BColor aInvPolygonColor(aHairlineColor);
349                         aInvPolygonColor.invert();
350 
351                         for(sal_uInt32 a(0); a < nCount; a++)
352                         {
353                             const basegfx::B2DPolygon aTempPolygon(aB2DTrapezoidVector[a].getB2DPolygon());
354 
355                             if(bShowOutlinesThere)
356                             {
357                                 mpOutputDevice->SetFillColor(Color(aHairlineColor));
358                                 mpOutputDevice->SetLineColor();
359                             }
360 
361                             mpOutputDevice->DrawPolygon(aTempPolygon);
362 
363                             if(bShowOutlinesThere)
364                             {
365                                 mpOutputDevice->SetFillColor();
366                                 mpOutputDevice->SetLineColor(Color(aInvPolygonColor));
367                                 mpOutputDevice->DrawPolyLine(aTempPolygon, 0.0);
368                             }
369                         }
370                     }
371                 }
372             }
373             else
374             {
375                 if(bPixelBased && getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete())
376                 {
377                     // #i98289#
378                     // when a Hairline is painted and AntiAliasing is on the option SnapHorVerLinesToDiscrete
379                     // allows to suppress AntiAliasing for pure horizontal or vertical lines. This is done since
380                     // not-AntiAliased such lines look more pleasing to the eye (e.g. 2D chart content). This
381                     // NEEDS to be done in discrete coordinates, so only useful for pixel based rendering.
382                     aLocalPolygon = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aLocalPolygon);
383                 }
384 
385                 mpOutputDevice->DrawPolyLine(aLocalPolygon, 0.0);
386             }
387         }
388 
389         // direct draw of transformed BitmapEx primitive
390         void VclProcessor2D::RenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate)
391         {
392             // create local transform
393             basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rBitmapCandidate.getTransform());
394             BitmapEx aBitmapEx(rBitmapCandidate.getBitmapEx());
395             bool bPainted(false);
396 
397             if(maBColorModifierStack.count())
398             {
399                 aBitmapEx = impModifyBitmapEx(maBColorModifierStack, aBitmapEx);
400 
401                 if(aBitmapEx.IsEmpty())
402                 {
403                     // color gets completely replaced, get it
404                     const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor()));
405                     basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon());
406                     aPolygon.transform(aLocalTransform);
407 
408                     mpOutputDevice->SetFillColor(Color(aModifiedColor));
409                     mpOutputDevice->SetLineColor();
410                     mpOutputDevice->DrawPolygon(aPolygon);
411 
412                     bPainted = true;
413                 }
414             }
415 
416             if(!bPainted)
417             {
418                 static bool bForceUseOfOwnTransformer(false);
419 
420                 // decompose matrix to check for shear, rotate and mirroring
421                 basegfx::B2DVector aScale, aTranslate;
422                 double fRotate, fShearX;
423                 aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX);
424 
425                 // #121387# when mirrored and rotated, avoid the GraphicManager output which has low quality
426                 const bool bRotated(!basegfx::fTools::equalZero(fRotate));
427                 const bool bSheared(!basegfx::fTools::equalZero(fShearX));
428                 //const bool bMirrored(aScale.getX() < 0.0 || aScale.getY() < 0.0);
429                 // const bool bMirroredAndRotated(bRotated && bMirrored);
430 
431                 if(!bForceUseOfOwnTransformer && !bRotated && !bSheared) // && !bMirrored)
432                 {
433                     RenderBitmapPrimitive2D_BitmapEx(*mpOutputDevice, aBitmapEx, aLocalTransform);
434                 }
435                 else
436                 {
437                     if(!aBitmapEx.IsTransparent() && (bSheared || bRotated))
438                     {
439                         // parts will be uncovered, extend aBitmapEx with a mask bitmap
440                         const Bitmap aContent(aBitmapEx.GetBitmap());
441                         aBitmapEx = BitmapEx(aContent, Bitmap(aContent.GetSizePixel(), 1));
442                     }
443 
444                     RenderBitmapPrimitive2D_self(*mpOutputDevice, aBitmapEx, aLocalTransform);
445                 }
446             }
447         }
448 
449         void VclProcessor2D::RenderFillGraphicPrimitive2D(const primitive2d::FillGraphicPrimitive2D& rFillBitmapCandidate)
450         {
451             const attribute::FillGraphicAttribute& rFillGraphicAttribute(rFillBitmapCandidate.getFillGraphic());
452             bool bPrimitiveAccepted(false);
453             static bool bTryTilingDirect = true;
454 
455             // #121194# when tiling is used and content is bitmap-based, do direct tiling in the
456             // renderer on pixel base to ensure tight fitting. Do not do this when
457             // the fill is rotated or sheared.
458 
459             // ovveride static bool (for debug) and tiling is active
460             if(bTryTilingDirect && rFillGraphicAttribute.getTiling())
461             {
462                 // content is bitmap(ex)
463                 //
464                 // for SVG support, force decomposition when SVG is present. This will lead to use
465                 // the primitive representation of the svg directly.
466                 //
467                 // when graphic is animated, force decomposition to use the correct graphic, else
468                 // fill style will not be animated
469                 if(GRAPHIC_BITMAP == rFillGraphicAttribute.getGraphic().GetType()
470                     && !rFillGraphicAttribute.getGraphic().getSvgData().get()
471                     && !rFillGraphicAttribute.getGraphic().IsAnimated())
472                 {
473                     // decompose matrix to check for shear, rotate and mirroring
474                     basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rFillBitmapCandidate.getTransformation());
475                     basegfx::B2DVector aScale, aTranslate;
476                     double fRotate, fShearX;
477                     aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX);
478 
479                     // when nopt rotated/sheared
480                     if(basegfx::fTools::equalZero(fRotate) && basegfx::fTools::equalZero(fShearX))
481                     {
482                         // no shear or rotate, draw direct in pixel coordinates
483                         bPrimitiveAccepted = true;
484 
485                         // transform object range to device coordinates (pixels). Use
486                         // the device transformation for better accuracy
487                         basegfx::B2DRange aObjectRange(aTranslate, aTranslate + aScale);
488                         aObjectRange.transform(mpOutputDevice->GetViewTransformation());
489 
490                         // extract discrete size of object
491                         const sal_Int32 nOWidth(basegfx::fround(aObjectRange.getWidth()));
492                         const sal_Int32 nOHeight(basegfx::fround(aObjectRange.getHeight()));
493 
494                         // only do something when object has a size in discrete units
495                         if(nOWidth > 0 && nOHeight > 0)
496                         {
497                             // transform graphic range to device coordinates (pixels). Use
498                             // the device transformation for better accuracy
499                             basegfx::B2DRange aGraphicRange(rFillGraphicAttribute.getGraphicRange());
500                             aGraphicRange.transform(mpOutputDevice->GetViewTransformation() * aLocalTransform);
501 
502                             // extract discrete size of graphic
503                             const sal_Int32 nBWidth(basegfx::fround(aGraphicRange.getWidth()));
504                             const sal_Int32 nBHeight(basegfx::fround(aGraphicRange.getHeight()));
505 
506                             // only do something when bitmap fill has a size in discrete units
507                             if(nBWidth > 0 && nBHeight > 0)
508                             {
509                                 // nBWidth, nBHeight is the pixel size of the neede bitmap. To not need to scale it
510                                 // in vcl many times, create a size-optimized version
511                                 const Size aNeededBitmapSizePixel(nBWidth, nBHeight);
512                                 BitmapEx aBitmapEx(rFillGraphicAttribute.getGraphic().GetBitmapEx());
513                                 static bool bEnablePreScaling(true);
514                                 const bool bPreScaled(bEnablePreScaling && nBWidth * nBHeight < (250 * 250));
515 
516                                 if(bPreScaled)
517                                 {
518                                     // ... but only up to a maximum size, else it gets too expensive
519                                     aBitmapEx.Scale(aNeededBitmapSizePixel, BMP_SCALE_INTERPOLATE);
520                                 }
521 
522                                 bool bPainted(false);
523 
524                                 if(maBColorModifierStack.count())
525                                 {
526                                     // when color modifier, apply to bitmap
527                                     aBitmapEx = impModifyBitmapEx(maBColorModifierStack, aBitmapEx);
528 
529                                     // impModifyBitmapEx uses empty bitmap as sign to return that
530                                     // the content will be completely replaced to mono color, use shortcut
531                                     if(aBitmapEx.IsEmpty())
532                                     {
533                                         // color gets completely replaced, get it
534                                         const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor()));
535                                         basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon());
536                                         aPolygon.transform(aLocalTransform);
537 
538                                         mpOutputDevice->SetFillColor(Color(aModifiedColor));
539                                         mpOutputDevice->SetLineColor();
540                                         mpOutputDevice->DrawPolygon(aPolygon);
541 
542                                         bPainted = true;
543                                     }
544                                 }
545 
546                                 if(!bPainted)
547                                 {
548                                     sal_Int32 nBLeft(basegfx::fround(aGraphicRange.getMinX()));
549                                     sal_Int32 nBTop(basegfx::fround(aGraphicRange.getMinY()));
550                                     const sal_Int32 nOLeft(basegfx::fround(aObjectRange.getMinX()));
551                                     const sal_Int32 nOTop(basegfx::fround(aObjectRange.getMinY()));
552                                     sal_Int32 nPosX(0);
553                                     sal_Int32 nPosY(0);
554 
555                                     if(nBLeft > nOLeft)
556                                     {
557                                         const sal_Int32 nDiff((nBLeft / nBWidth) + 1);
558 
559                                         nPosX -= nDiff;
560                                         nBLeft -= nDiff * nBWidth;
561                                     }
562 
563                                     if(nBLeft + nBWidth <= nOLeft)
564                                     {
565                                         const sal_Int32 nDiff(-nBLeft / nBWidth);
566 
567                                         nPosX += nDiff;
568                                         nBLeft += nDiff * nBWidth;
569                                     }
570 
571                                     if(nBTop > nOTop)
572                                     {
573                                         const sal_Int32 nDiff((nBTop / nBHeight) + 1);
574 
575                                         nPosY -= nDiff;
576                                         nBTop -= nDiff * nBHeight;
577                                     }
578 
579                                     if(nBTop + nBHeight <= nOTop)
580                                     {
581                                         const sal_Int32 nDiff(-nBTop / nBHeight);
582 
583                                         nPosY += nDiff;
584                                         nBTop += nDiff * nBHeight;
585                                     }
586 
587                                     // prepare OutDev
588                                     const Point aEmptyPoint(0, 0);
589                                     const Rectangle aVisiblePixel(aEmptyPoint, mpOutputDevice->GetOutputSizePixel());
590                                     const bool bWasEnabled(mpOutputDevice->IsMapModeEnabled());
591                                     mpOutputDevice->EnableMapMode(false);
592 
593                                     // check if offset is used
594                                     const sal_Int32 nOffsetX(basegfx::fround(rFillGraphicAttribute.getOffsetX() * nBWidth));
595 
596                                     if(nOffsetX)
597                                     {
598                                         // offset in X, so iterate over Y first and draw lines
599                                         for(sal_Int32 nYPos(nBTop); nYPos < nOTop + nOHeight; nYPos += nBHeight, nPosY++)
600                                         {
601                                             for(sal_Int32 nXPos(nPosY % 2 ? nBLeft - nBWidth + nOffsetX : nBLeft);
602                                                 nXPos < nOLeft + nOWidth; nXPos += nBWidth)
603                                             {
604                                                 const Rectangle aOutRectPixel(Point(nXPos, nYPos), aNeededBitmapSizePixel);
605 
606                                                 if(aOutRectPixel.IsOver(aVisiblePixel))
607                                                 {
608                                                     if(bPreScaled)
609                                                     {
610                                                         mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aBitmapEx);
611                                                     }
612                                                     else
613                                                     {
614                                                         mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aNeededBitmapSizePixel, aBitmapEx);
615                                                     }
616                                                 }
617                                             }
618                                         }
619                                     }
620                                     else
621                                     {
622                                         // check if offset is used
623                                         const sal_Int32 nOffsetY(basegfx::fround(rFillGraphicAttribute.getOffsetY() * nBHeight));
624 
625                                         // possible offset in Y, so iterate over X first and draw columns
626                                         for(sal_Int32 nXPos(nBLeft); nXPos < nOLeft + nOWidth; nXPos += nBWidth, nPosX++)
627                                         {
628                                             for(sal_Int32 nYPos(nPosX % 2 ? nBTop - nBHeight + nOffsetY : nBTop);
629                                                 nYPos < nOTop + nOHeight; nYPos += nBHeight)
630                                             {
631                                                 const Rectangle aOutRectPixel(Point(nXPos, nYPos), aNeededBitmapSizePixel);
632 
633                                                 if(aOutRectPixel.IsOver(aVisiblePixel))
634                                                 {
635                                                     if(bPreScaled)
636                                                     {
637                                                         mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aBitmapEx);
638                                                     }
639                                                     else
640                                                     {
641                                                         mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aNeededBitmapSizePixel, aBitmapEx);
642                                                     }
643                                                 }
644                                             }
645                                         }
646                                     }
647 
648                                     // restore OutDev
649                                     mpOutputDevice->EnableMapMode(bWasEnabled);
650                                 }
651                             }
652                         }
653                     }
654                 }
655             }
656 
657             if(!bPrimitiveAccepted)
658             {
659                 // do not accept, use decomposition
660                 process(rFillBitmapCandidate.get2DDecomposition(getViewInformation2D()));
661             }
662         }
663 
664         // direct draw of Graphic
665         void VclProcessor2D::RenderPolyPolygonGraphicPrimitive2D(const primitive2d::PolyPolygonGraphicPrimitive2D& rPolygonCandidate)
666         {
667             bool bDone(false);
668             const basegfx::B2DPolyPolygon& rPolyPolygon = rPolygonCandidate.getB2DPolyPolygon();
669 
670             // #121194# Todo: check if this works
671             if(!rPolyPolygon.count())
672             {
673                 // empty polyPolygon, done
674                 bDone = true;
675             }
676             else
677             {
678                 const attribute::FillGraphicAttribute& rFillGraphicAttribute = rPolygonCandidate.getFillGraphic();
679 
680                 // try to catch cases where the graphic will be color-modified to a single
681                 // color (e.g. shadow)
682                 switch(rFillGraphicAttribute.getGraphic().GetType())
683                 {
684                     case GRAPHIC_GDIMETAFILE:
685                     {
686                         // metafiles are potentially transparent, cannot optimize�, not done
687                         break;
688                     }
689                     case GRAPHIC_BITMAP:
690                     {
691                         if(!rFillGraphicAttribute.getGraphic().IsTransparent() && !rFillGraphicAttribute.getGraphic().IsAlpha())
692                         {
693                             // bitmap is not transparent and has no alpha
694                             const sal_uInt32 nBColorModifierStackCount(maBColorModifierStack.count());
695 
696                             if(nBColorModifierStackCount)
697                             {
698                                 const basegfx::BColorModifier& rTopmostModifier = maBColorModifierStack.getBColorModifier(nBColorModifierStackCount - 1);
699 
700                                 if(basegfx::BCOLORMODIFYMODE_REPLACE == rTopmostModifier.getMode())
701                                 {
702                                     // the bitmap fill is in unified color, so we can replace it with
703                                     // a single polygon fill. The form of the fill depends on tiling
704                                     if(rFillGraphicAttribute.getTiling())
705                                     {
706                                         // with tiling, fill the whole PolyPolygon with the modifier color
707                                         basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolyPolygon);
708 
709                                         aLocalPolyPolygon.transform(maCurrentTransformation);
710                                         mpOutputDevice->SetLineColor();
711                                         mpOutputDevice->SetFillColor(Color(rTopmostModifier.getBColor()));
712                                         mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon);
713                                     }
714                                     else
715                                     {
716                                         // without tiling, only the area common to the bitmap tile and the
717                                         // PolyPolygon is filled. Create the bitmap tile area in object
718                                         // coordinates. For this, the object transformation needs to be created
719                                         // from the already scaled PolyPolygon. The tile area in object
720                                         // coordinates wil always be non-rotated, so it's not necessary to
721                                         // work with a polygon here
722                                         basegfx::B2DRange aTileRange(rFillGraphicAttribute.getGraphicRange());
723                                         const basegfx::B2DRange aPolyPolygonRange(rPolyPolygon.getB2DRange());
724                                         const basegfx::B2DHomMatrix aNewObjectTransform(
725                                             basegfx::tools::createScaleTranslateB2DHomMatrix(
726                                                 aPolyPolygonRange.getRange(),
727                                                 aPolyPolygonRange.getMinimum()));
728 
729                                         aTileRange.transform(aNewObjectTransform);
730 
731                                         // now clip the object polyPolygon against the tile range
732                                         // to get the common area
733                                         basegfx::B2DPolyPolygon aTarget = basegfx::tools::clipPolyPolygonOnRange(
734                                             rPolyPolygon,
735                                             aTileRange,
736                                             true,
737                                             false);
738 
739                                         if(aTarget.count())
740                                         {
741                                             aTarget.transform(maCurrentTransformation);
742                                             mpOutputDevice->SetLineColor();
743                                             mpOutputDevice->SetFillColor(Color(rTopmostModifier.getBColor()));
744                                             mpOutputDevice->DrawPolyPolygon(aTarget);
745                                         }
746                                     }
747 
748                                     // simplified output executed, we are done
749                                     bDone = true;
750                                 }
751                             }
752                         }
753                         break;
754                     }
755                     default: //GRAPHIC_NONE, GRAPHIC_DEFAULT
756                     {
757                         // empty graphic, we are done
758                         bDone = true;
759                         break;
760                     }
761                 }
762             }
763 
764             if(!bDone)
765             {
766                 // use default decomposition
767                 process(rPolygonCandidate.get2DDecomposition(getViewInformation2D()));
768             }
769         }
770 
771         // direct draw of PolyPolygon with color
772         void VclProcessor2D::RenderPolyPolygonColorPrimitive2D(const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate)
773         {
774             const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(rPolygonCandidate.getBColor()));
775             mpOutputDevice->SetFillColor(Color(aPolygonColor));
776             mpOutputDevice->SetLineColor();
777 
778             basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
779             aLocalPolyPolygon.transform(maCurrentTransformation);
780 
781             static bool bCheckTrapezoidDecomposition(false);
782             static bool bShowOutlinesThere(false);
783             if(bCheckTrapezoidDecomposition)
784             {
785                 // clip against discrete ViewPort
786                 const basegfx::B2DRange& rDiscreteViewport = getViewInformation2D().getDiscreteViewport();
787                 aLocalPolyPolygon = basegfx::tools::clipPolyPolygonOnRange(
788                     aLocalPolyPolygon, rDiscreteViewport, true, false);
789 
790                 if(aLocalPolyPolygon.count())
791                 {
792                     // subdivide
793                     aLocalPolyPolygon = basegfx::tools::adaptiveSubdivideByDistance(
794                         aLocalPolyPolygon, 0.5);
795 
796                     // trapezoidize
797                     basegfx::B2DTrapezoidVector aB2DTrapezoidVector;
798                     basegfx::tools::trapezoidSubdivide(aB2DTrapezoidVector, aLocalPolyPolygon);
799 
800                     const sal_uInt32 nCount(aB2DTrapezoidVector.size());
801 
802                     if(nCount)
803                     {
804                         basegfx::BColor aInvPolygonColor(aPolygonColor);
805                         aInvPolygonColor.invert();
806 
807                         for(sal_uInt32 a(0); a < nCount; a++)
808                         {
809                             const basegfx::B2DPolygon aTempPolygon(aB2DTrapezoidVector[a].getB2DPolygon());
810 
811                             if(bShowOutlinesThere)
812                             {
813                                 mpOutputDevice->SetFillColor(Color(aPolygonColor));
814                                 mpOutputDevice->SetLineColor();
815                             }
816 
817                             mpOutputDevice->DrawPolygon(aTempPolygon);
818 
819                             if(bShowOutlinesThere)
820                             {
821                                 mpOutputDevice->SetFillColor();
822                                 mpOutputDevice->SetLineColor(Color(aInvPolygonColor));
823                                 mpOutputDevice->DrawPolyLine(aTempPolygon, 0.0);
824                             }
825                         }
826                     }
827                 }
828             }
829             else
830             {
831                 mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon);
832 
833                 if(mnPolygonStrokePrimitive2D
834                     && getOptionsDrawinglayer().IsAntiAliasing()
835                     && (mpOutputDevice->GetAntialiasing() & ANTIALIASING_ENABLE_B2DDRAW))
836                 {
837                     // when AA is on and this filled polygons are the result of stroked line geometry,
838                     // draw the geometry once extra as lines to avoid AA 'gaps' between partial polygons
839                     mpOutputDevice->SetFillColor();
840                     mpOutputDevice->SetLineColor(Color(aPolygonColor));
841                     const sal_uInt32 nCount(aLocalPolyPolygon.count());
842 
843                     for(sal_uInt32 a(0); a < nCount; a++)
844                     {
845                         mpOutputDevice->DrawPolyLine(aLocalPolyPolygon.getB2DPolygon(a), 0.0);
846                     }
847                 }
848             }
849         }
850 
851         // mask group. Force output to VDev and create mask from given mask
852         void VclProcessor2D::RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate)
853         {
854             if(rMaskCandidate.getChildren().hasElements())
855             {
856                 basegfx::B2DPolyPolygon aMask(rMaskCandidate.getMask());
857 
858                 if(aMask.count())
859                 {
860                     aMask.transform(maCurrentTransformation);
861                     const basegfx::B2DRange aRange(basegfx::tools::getRange(aMask));
862                     impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true);
863 
864                     if(aBufferDevice.isVisible())
865                     {
866                         // remember last OutDev and set to content
867                         OutputDevice* pLastOutputDevice = mpOutputDevice;
868                         mpOutputDevice = &aBufferDevice.getContent();
869 
870                         // paint to it
871                         process(rMaskCandidate.getChildren());
872 
873                         // back to old OutDev
874                         mpOutputDevice = pLastOutputDevice;
875 
876                         // draw mask
877                         if(getOptionsDrawinglayer().IsAntiAliasing())
878                         {
879                             // with AA, use 8bit AlphaMask to get nice borders
880                             VirtualDevice& rTransparence = aBufferDevice.getTransparence();
881                             rTransparence.SetLineColor();
882                             rTransparence.SetFillColor(COL_BLACK);
883                             rTransparence.DrawPolyPolygon(aMask);
884 
885                             // dump buffer to outdev
886                             aBufferDevice.paint();
887                         }
888                         else
889                         {
890                             // No AA, use 1bit mask
891                             VirtualDevice& rMask = aBufferDevice.getMask();
892                             rMask.SetLineColor();
893                             rMask.SetFillColor(COL_BLACK);
894                             rMask.DrawPolyPolygon(aMask);
895 
896                             // dump buffer to outdev
897                             aBufferDevice.paint();
898                         }
899                     }
900                 }
901             }
902         }
903 
904         // modified color group. Force output to unified color.
905         void VclProcessor2D::RenderModifiedColorPrimitive2D(const primitive2d::ModifiedColorPrimitive2D& rModifiedCandidate)
906         {
907             if(rModifiedCandidate.getChildren().hasElements())
908             {
909                 maBColorModifierStack.push(rModifiedCandidate.getColorModifier());
910                 process(rModifiedCandidate.getChildren());
911                 maBColorModifierStack.pop();
912             }
913         }
914 
915         // unified sub-transparence. Draw to VDev first.
916         void VclProcessor2D::RenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rTransCandidate)
917         {
918             static bool bForceToDecomposition(false);
919 
920             if(rTransCandidate.getChildren().hasElements())
921             {
922                 if(bForceToDecomposition)
923                 {
924                     // use decomposition
925                     process(rTransCandidate.get2DDecomposition(getViewInformation2D()));
926                 }
927                 else
928                 {
929                     if(0.0 == rTransCandidate.getTransparence())
930                     {
931                         // no transparence used, so just use the content
932                         process(rTransCandidate.getChildren());
933                     }
934                     else if(rTransCandidate.getTransparence() > 0.0 && rTransCandidate.getTransparence() < 1.0)
935                     {
936                         // transparence is in visible range
937                         basegfx::B2DRange aRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rTransCandidate.getChildren(), getViewInformation2D()));
938                         aRange.transform(maCurrentTransformation);
939                         impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true);
940 
941                         if(aBufferDevice.isVisible())
942                         {
943                             // remember last OutDev and set to content
944                             OutputDevice* pLastOutputDevice = mpOutputDevice;
945                             mpOutputDevice = &aBufferDevice.getContent();
946 
947                             // paint content to it
948                             process(rTransCandidate.getChildren());
949 
950                             // back to old OutDev
951                             mpOutputDevice = pLastOutputDevice;
952 
953                             // dump buffer to outdev using given transparence
954                             aBufferDevice.paint(rTransCandidate.getTransparence());
955                         }
956                     }
957                 }
958             }
959         }
960 
961         // sub-transparence group. Draw to VDev first.
962         void VclProcessor2D::RenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransCandidate)
963         {
964             if(rTransCandidate.getChildren().hasElements())
965             {
966                 basegfx::B2DRange aRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rTransCandidate.getChildren(), getViewInformation2D()));
967                 aRange.transform(maCurrentTransformation);
968                 impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true);
969 
970                 if(aBufferDevice.isVisible())
971                 {
972                     // remember last OutDev and set to content
973                     OutputDevice* pLastOutputDevice = mpOutputDevice;
974                     mpOutputDevice = &aBufferDevice.getContent();
975 
976                     // paint content to it
977                     process(rTransCandidate.getChildren());
978 
979                     // set to mask
980                     mpOutputDevice = &aBufferDevice.getTransparence();
981 
982                     // when painting transparence masks, reset the color stack
983                     basegfx::BColorModifierStack aLastBColorModifierStack(maBColorModifierStack);
984                     maBColorModifierStack = basegfx::BColorModifierStack();
985 
986                     // paint mask to it (always with transparence intensities, evtl. with AA)
987                     process(rTransCandidate.getTransparence());
988 
989                     // back to old color stack
990                     maBColorModifierStack = aLastBColorModifierStack;
991 
992                     // back to old OutDev
993                     mpOutputDevice = pLastOutputDevice;
994 
995                     // dump buffer to outdev
996                     aBufferDevice.paint();
997                 }
998             }
999         }
1000 
1001         // transform group.
1002         void VclProcessor2D::RenderTransformPrimitive2D(const primitive2d::TransformPrimitive2D& rTransformCandidate)
1003         {
1004             // remember current transformation and ViewInformation
1005             const basegfx::B2DHomMatrix aLastCurrentTransformation(maCurrentTransformation);
1006             const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
1007 
1008             // create new transformations for CurrentTransformation
1009             // and for local ViewInformation2D
1010             maCurrentTransformation = maCurrentTransformation * rTransformCandidate.getTransformation();
1011             const geometry::ViewInformation2D aViewInformation2D(
1012                 getViewInformation2D().getObjectTransformation() * rTransformCandidate.getTransformation(),
1013                 getViewInformation2D().getViewTransformation(),
1014                 getViewInformation2D().getViewport(),
1015                 getViewInformation2D().getVisualizedPage(),
1016                 getViewInformation2D().getViewTime(),
1017                 getViewInformation2D().getExtendedInformationSequence());
1018             updateViewInformation(aViewInformation2D);
1019 
1020             // proccess content
1021             process(rTransformCandidate.getChildren());
1022 
1023             // restore transformations
1024             maCurrentTransformation = aLastCurrentTransformation;
1025             updateViewInformation(aLastViewInformation2D);
1026         }
1027 
1028         // new XDrawPage for ViewInformation2D
1029         void VclProcessor2D::RenderPagePreviewPrimitive2D(const primitive2d::PagePreviewPrimitive2D& rPagePreviewCandidate)
1030         {
1031             // remember current transformation and ViewInformation
1032             const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
1033 
1034             // create new local ViewInformation2D
1035             const geometry::ViewInformation2D aViewInformation2D(
1036                 getViewInformation2D().getObjectTransformation(),
1037                 getViewInformation2D().getViewTransformation(),
1038                 getViewInformation2D().getViewport(),
1039                 rPagePreviewCandidate.getXDrawPage(),
1040                 getViewInformation2D().getViewTime(),
1041                 getViewInformation2D().getExtendedInformationSequence());
1042             updateViewInformation(aViewInformation2D);
1043 
1044             // proccess decomposed content
1045             process(rPagePreviewCandidate.get2DDecomposition(getViewInformation2D()));
1046 
1047             // restore transformations
1048             updateViewInformation(aLastViewInformation2D);
1049         }
1050 
1051         // marker
1052         void VclProcessor2D::RenderMarkerArrayPrimitive2D(const primitive2d::MarkerArrayPrimitive2D& rMarkArrayCandidate)
1053         {
1054             static bool bCheckCompleteMarkerDecompose(false);
1055             if(bCheckCompleteMarkerDecompose)
1056             {
1057                 process(rMarkArrayCandidate.get2DDecomposition(getViewInformation2D()));
1058                 return;
1059             }
1060 
1061             // get data
1062             const std::vector< basegfx::B2DPoint >& rPositions = rMarkArrayCandidate.getPositions();
1063             const sal_uInt32 nCount(rPositions.size());
1064 
1065             if(nCount && !rMarkArrayCandidate.getMarker().IsEmpty())
1066             {
1067                 // get pixel size
1068                 const BitmapEx& rMarker(rMarkArrayCandidate.getMarker());
1069                 const Size aBitmapSize(rMarker.GetSizePixel());
1070 
1071                 if(aBitmapSize.Width() && aBitmapSize.Height())
1072                 {
1073                     // get discrete half size
1074                     const basegfx::B2DVector aDiscreteHalfSize(
1075                         (aBitmapSize.getWidth() - 1.0) * 0.5,
1076                         (aBitmapSize.getHeight() - 1.0) * 0.5);
1077                     const bool bWasEnabled(mpOutputDevice->IsMapModeEnabled());
1078 
1079                     // do not forget evtl. moved origin in target device MapMode when
1080                     // switching it off; it would be missing and lead to wrong positions.
1081                     // All his could be done using logic sizes and coordinates, too, but
1082                     // we want a 1:1 bitmap rendering here, so it's more safe and faster
1083                     // to work with switching off MapMode usage completely.
1084                     const Point aOrigin(mpOutputDevice->GetMapMode().GetOrigin());
1085 
1086                     mpOutputDevice->EnableMapMode(false);
1087 
1088                     for(std::vector< basegfx::B2DPoint >::const_iterator aIter(rPositions.begin()); aIter != rPositions.end(); aIter++)
1089                     {
1090                         const basegfx::B2DPoint aDiscreteTopLeft((maCurrentTransformation * (*aIter)) - aDiscreteHalfSize);
1091                         const Point aDiscretePoint(basegfx::fround(aDiscreteTopLeft.getX()), basegfx::fround(aDiscreteTopLeft.getY()));
1092 
1093                         mpOutputDevice->DrawBitmapEx(aDiscretePoint + aOrigin, rMarker);
1094                     }
1095 
1096                     mpOutputDevice->EnableMapMode(bWasEnabled);
1097                 }
1098             }
1099         }
1100 
1101         // point
1102         void VclProcessor2D::RenderPointArrayPrimitive2D(const primitive2d::PointArrayPrimitive2D& rPointArrayCandidate)
1103         {
1104             const std::vector< basegfx::B2DPoint >& rPositions = rPointArrayCandidate.getPositions();
1105             const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(rPointArrayCandidate.getRGBColor()));
1106             const Color aVCLColor(aRGBColor);
1107 
1108             for(std::vector< basegfx::B2DPoint >::const_iterator aIter(rPositions.begin()); aIter != rPositions.end(); aIter++)
1109             {
1110                 const basegfx::B2DPoint aViewPosition(maCurrentTransformation * (*aIter));
1111                 const Point aPos(basegfx::fround(aViewPosition.getX()), basegfx::fround(aViewPosition.getY()));
1112 
1113                 mpOutputDevice->DrawPixel(aPos, aVCLColor);
1114             }
1115         }
1116 
1117         void VclProcessor2D::RenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokeCandidate)
1118         {
1119             // #i101491# method restructured to clearly use the DrawPolyLine
1120             // calls starting from a deined line width
1121             const attribute::LineAttribute& rLineAttribute = rPolygonStrokeCandidate.getLineAttribute();
1122             const double fLineWidth(rLineAttribute.getWidth());
1123             bool bDone(false);
1124 
1125             if(basegfx::fTools::more(fLineWidth, 0.0))
1126             {
1127                 const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation * basegfx::B2DVector(fLineWidth, 0.0));
1128                 const double fDiscreteLineWidth(aDiscreteUnit.getLength());
1129                 const attribute::StrokeAttribute& rStrokeAttribute = rPolygonStrokeCandidate.getStrokeAttribute();
1130                 const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLineAttribute.getColor()));
1131                 basegfx::B2DPolyPolygon aHairlinePolyPolygon;
1132 
1133                 mpOutputDevice->SetLineColor(Color(aHairlineColor));
1134                 mpOutputDevice->SetFillColor();
1135 
1136                 if(0.0 == rStrokeAttribute.getFullDotDashLen())
1137                 {
1138                     // no line dashing, just copy
1139                     aHairlinePolyPolygon.append(rPolygonStrokeCandidate.getB2DPolygon());
1140                 }
1141                 else
1142                 {
1143                     // else apply LineStyle
1144                     basegfx::tools::applyLineDashing(rPolygonStrokeCandidate.getB2DPolygon(),
1145                         rStrokeAttribute.getDotDashArray(),
1146                         &aHairlinePolyPolygon, 0, rStrokeAttribute.getFullDotDashLen());
1147                 }
1148 
1149                 const sal_uInt32 nCount(aHairlinePolyPolygon.count());
1150 
1151                 if(nCount)
1152                 {
1153                     const bool bAntiAliased(getOptionsDrawinglayer().IsAntiAliasing());
1154                     aHairlinePolyPolygon.transform(maCurrentTransformation);
1155 
1156                     if(bAntiAliased)
1157                     {
1158                         if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.0))
1159                         {
1160                             // line in range ]0.0 .. 1.0[
1161                             // paint as simple hairline
1162                             for(sal_uInt32 a(0); a < nCount; a++)
1163                             {
1164                                 mpOutputDevice->DrawPolyLine(aHairlinePolyPolygon.getB2DPolygon(a), 0.0);
1165                             }
1166 
1167                             bDone = true;
1168                         }
1169                         else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.0))
1170                         {
1171                             // line in range [1.0 .. 2.0[
1172                             // paint as 2x2 with dynamic line distance
1173                             basegfx::B2DHomMatrix aMat;
1174                             const double fDistance(fDiscreteLineWidth - 1.0);
1175                             const double fHalfDistance(fDistance * 0.5);
1176 
1177                             for(sal_uInt32 a(0); a < nCount; a++)
1178                             {
1179                                 basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
1180 
1181                                 aMat.set(0, 2, -fHalfDistance);
1182                                 aMat.set(1, 2, -fHalfDistance);
1183                                 aCandidate.transform(aMat);
1184                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1185 
1186                                 aMat.set(0, 2, fDistance);
1187                                 aMat.set(1, 2, 0.0);
1188                                 aCandidate.transform(aMat);
1189                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1190 
1191                                 aMat.set(0, 2, 0.0);
1192                                 aMat.set(1, 2, fDistance);
1193                                 aCandidate.transform(aMat);
1194                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1195 
1196                                 aMat.set(0, 2, -fDistance);
1197                                 aMat.set(1, 2, 0.0);
1198                                 aCandidate.transform(aMat);
1199                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1200                             }
1201 
1202                             bDone = true;
1203                         }
1204                         else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 3.0))
1205                         {
1206                             // line in range [2.0 .. 3.0]
1207                             // paint as cross in a 3x3  with dynamic line distance
1208                             basegfx::B2DHomMatrix aMat;
1209                             const double fDistance((fDiscreteLineWidth - 1.0) * 0.5);
1210 
1211                             for(sal_uInt32 a(0); a < nCount; a++)
1212                             {
1213                                 basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
1214 
1215                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1216 
1217                                 aMat.set(0, 2, -fDistance);
1218                                 aMat.set(1, 2, 0.0);
1219                                 aCandidate.transform(aMat);
1220                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1221 
1222                                 aMat.set(0, 2, fDistance);
1223                                 aMat.set(1, 2, -fDistance);
1224                                 aCandidate.transform(aMat);
1225                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1226 
1227                                 aMat.set(0, 2, fDistance);
1228                                 aMat.set(1, 2, fDistance);
1229                                 aCandidate.transform(aMat);
1230                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1231 
1232                                 aMat.set(0, 2, -fDistance);
1233                                 aMat.set(1, 2, fDistance);
1234                                 aCandidate.transform(aMat);
1235                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1236                             }
1237 
1238                             bDone = true;
1239                         }
1240                         else
1241                         {
1242                             // #i101491# line width above 3.0
1243                         }
1244                     }
1245                     else
1246                     {
1247                         if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.5))
1248                         {
1249                             // line width below 1.5, draw the basic hairline polygon
1250                             for(sal_uInt32 a(0); a < nCount; a++)
1251                             {
1252                                 mpOutputDevice->DrawPolyLine(aHairlinePolyPolygon.getB2DPolygon(a), 0.0);
1253                             }
1254 
1255                             bDone = true;
1256                         }
1257                         else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.5))
1258                         {
1259                             // line width is in range ]1.5 .. 2.5], use four hairlines
1260                             // drawn in a square
1261                             for(sal_uInt32 a(0); a < nCount; a++)
1262                             {
1263                                 basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
1264                                 basegfx::B2DHomMatrix aMat;
1265 
1266                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1267 
1268                                 aMat.set(0, 2, 1.0);
1269                                 aMat.set(1, 2, 0.0);
1270                                 aCandidate.transform(aMat);
1271 
1272                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1273 
1274                                 aMat.set(0, 2, 0.0);
1275                                 aMat.set(1, 2, 1.0);
1276                                 aCandidate.transform(aMat);
1277 
1278                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1279 
1280                                 aMat.set(0, 2, -1.0);
1281                                 aMat.set(1, 2, 0.0);
1282                                 aCandidate.transform(aMat);
1283 
1284                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1285                             }
1286 
1287                             bDone = true;
1288                         }
1289                         else
1290                         {
1291                             // #i101491# line width is above 2.5
1292                         }
1293                     }
1294 
1295                     if(!bDone && rPolygonStrokeCandidate.getB2DPolygon().count() > 1000)
1296                     {
1297                         // #i101491# If the polygon complexity uses more than a given amount, do
1298                         // use OuputDevice::DrawPolyLine directly; this will avoid buffering all
1299                         // decompositions in primtives (memory) and fallback to old line painting
1300                         // for very complex polygons, too
1301                         for(sal_uInt32 a(0); a < nCount; a++)
1302                         {
1303                             mpOutputDevice->DrawPolyLine(
1304                                 aHairlinePolyPolygon.getB2DPolygon(a),
1305                                 fDiscreteLineWidth,
1306                                 rLineAttribute.getLineJoin(),
1307                                 rLineAttribute.getLineCap());
1308                         }
1309 
1310                         bDone = true;
1311                     }
1312                 }
1313             }
1314 
1315             if(!bDone)
1316             {
1317                 // remeber that we enter a PolygonStrokePrimitive2D decomposition,
1318                 // used for AA thick line drawing
1319                 mnPolygonStrokePrimitive2D++;
1320 
1321                 // line width is big enough for standard filled polygon visualisation or zero
1322                 process(rPolygonStrokeCandidate.get2DDecomposition(getViewInformation2D()));
1323 
1324                 // leave PolygonStrokePrimitive2D
1325                 mnPolygonStrokePrimitive2D--;
1326             }
1327         }
1328 
1329         void VclProcessor2D::RenderEpsPrimitive2D(const primitive2d::EpsPrimitive2D& rEpsPrimitive2D)
1330         {
1331             // The new decomposition of Metafiles made it necessary to add an Eps
1332             // primitive to handle embedded Eps data. On some devices, this can be
1333             // painted directly (mac, printer).
1334             // To be able to handle the replacement correctly, i need to handle it myself
1335             // since DrawEPS will not be able e.g. to rotate the replacement. To be able
1336             // to do that, i added a boolean return to OutputDevice::DrawEPS(..)
1337             // to know when EPS was handled directly already.
1338             basegfx::B2DRange aRange(0.0, 0.0, 1.0, 1.0);
1339             aRange.transform(maCurrentTransformation * rEpsPrimitive2D.getEpsTransform());
1340 
1341             if(!aRange.isEmpty())
1342             {
1343                 const Rectangle aRectangle(
1344                     (sal_Int32)floor(aRange.getMinX()), (sal_Int32)floor(aRange.getMinY()),
1345                     (sal_Int32)ceil(aRange.getMaxX()), (sal_Int32)ceil(aRange.getMaxY()));
1346 
1347                 if(!aRectangle.IsEmpty())
1348                 {
1349                     // try to paint EPS directly without fallback visualisation
1350                     const bool bEPSPaintedDirectly(mpOutputDevice->DrawEPS(
1351                         aRectangle.TopLeft(),
1352                         aRectangle.GetSize(),
1353                         rEpsPrimitive2D.getGfxLink(),
1354                         0));
1355 
1356                     if(!bEPSPaintedDirectly)
1357                     {
1358                         // use the decomposition which will correctly handle the
1359                         // fallback visualisation using full transformation (e.g. rotation)
1360                         process(rEpsPrimitive2D.get2DDecomposition(getViewInformation2D()));
1361                     }
1362                 }
1363             }
1364         }
1365 
1366         void VclProcessor2D::RenderSvgLinearAtomPrimitive2D(const primitive2d::SvgLinearAtomPrimitive2D& rCandidate)
1367         {
1368             const double fDelta(rCandidate.getOffsetB() - rCandidate.getOffsetA());
1369 
1370             if(basegfx::fTools::more(fDelta, 0.0))
1371             {
1372                 const basegfx::BColor aColorA(maBColorModifierStack.getModifiedColor(rCandidate.getColorA()));
1373                 const basegfx::BColor aColorB(maBColorModifierStack.getModifiedColor(rCandidate.getColorB()));
1374                 const double fDiscreteUnit((getViewInformation2D().getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength());
1375 
1376                 // use color distance and discrete lengths to calculate step count
1377                 const sal_uInt32 nSteps(calculateStepsForSvgGradient(aColorA, aColorB, fDelta, fDiscreteUnit));
1378 
1379                 // switch off line painting
1380                 mpOutputDevice->SetLineColor();
1381 
1382                 // prepare polygon in needed width at start position (with discrete overlap)
1383                 const basegfx::B2DPolygon aPolygon(
1384                     basegfx::tools::createPolygonFromRect(
1385                         basegfx::B2DRange(
1386                             rCandidate.getOffsetA() - fDiscreteUnit,
1387                             0.0,
1388                             rCandidate.getOffsetA() + (fDelta / nSteps) + fDiscreteUnit,
1389                             1.0)));
1390 
1391 
1392                 // prepare loop ([0.0 .. 1.0[)
1393                 double fUnitScale(0.0);
1394                 const double fUnitStep(1.0 / nSteps);
1395 
1396                 // loop and paint
1397                 for(sal_uInt32 a(0); a < nSteps; a++, fUnitScale += fUnitStep)
1398                 {
1399                     basegfx::B2DPolygon aNew(aPolygon);
1400 
1401                     aNew.transform(maCurrentTransformation * basegfx::tools::createTranslateB2DHomMatrix(fDelta * fUnitScale, 0.0));
1402                     mpOutputDevice->SetFillColor(Color(basegfx::interpolate(aColorA, aColorB, fUnitScale)));
1403                     mpOutputDevice->DrawPolyPolygon(basegfx::B2DPolyPolygon(aNew));
1404                 }
1405             }
1406         }
1407 
1408         void VclProcessor2D::RenderSvgRadialAtomPrimitive2D(const primitive2d::SvgRadialAtomPrimitive2D& rCandidate)
1409         {
1410             const double fDeltaScale(rCandidate.getScaleB() - rCandidate.getScaleA());
1411 
1412             if(basegfx::fTools::more(fDeltaScale, 0.0))
1413             {
1414                 const basegfx::BColor aColorA(maBColorModifierStack.getModifiedColor(rCandidate.getColorA()));
1415                 const basegfx::BColor aColorB(maBColorModifierStack.getModifiedColor(rCandidate.getColorB()));
1416                 const double fDiscreteUnit((getViewInformation2D().getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength());
1417 
1418                 // use color distance and discrete lengths to calculate step count
1419                 const sal_uInt32 nSteps(calculateStepsForSvgGradient(aColorA, aColorB, fDeltaScale, fDiscreteUnit));
1420 
1421                 // switch off line painting
1422                 mpOutputDevice->SetLineColor();
1423 
1424                 // prepare loop ([0.0 .. 1.0[, full polygons, no polypolygons with holes)
1425                 double fUnitScale(0.0);
1426                 const double fUnitStep(1.0 / nSteps);
1427 
1428                 for(sal_uInt32 a(0); a < nSteps; a++, fUnitScale += fUnitStep)
1429                 {
1430                     basegfx::B2DHomMatrix aTransform;
1431                     const double fEndScale(rCandidate.getScaleB() - (fDeltaScale * fUnitScale));
1432 
1433                     if(rCandidate.isTranslateSet())
1434                     {
1435                         const basegfx::B2DVector aTranslate(
1436                             basegfx::interpolate(
1437                                 rCandidate.getTranslateB(),
1438                                 rCandidate.getTranslateA(),
1439                                 fUnitScale));
1440 
1441                         aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix(
1442                             fEndScale,
1443                             fEndScale,
1444                             aTranslate.getX(),
1445                             aTranslate.getY());
1446                     }
1447                     else
1448                     {
1449                         aTransform = basegfx::tools::createScaleB2DHomMatrix(
1450                             fEndScale,
1451                             fEndScale);
1452                     }
1453 
1454                     basegfx::B2DPolygon aNew(basegfx::tools::createPolygonFromUnitCircle());
1455 
1456                     aNew.transform(maCurrentTransformation * aTransform);
1457                     mpOutputDevice->SetFillColor(Color(basegfx::interpolate(aColorB, aColorA, fUnitScale)));
1458                     mpOutputDevice->DrawPolyPolygon(basegfx::B2DPolyPolygon(aNew));
1459                 }
1460             }
1461         }
1462 
1463         void VclProcessor2D::adaptLineToFillDrawMode() const
1464         {
1465             const sal_uInt32 nOriginalDrawMode(mpOutputDevice->GetDrawMode());
1466 
1467             if(nOriginalDrawMode & (DRAWMODE_BLACKLINE|DRAWMODE_GRAYLINE|DRAWMODE_GHOSTEDLINE|DRAWMODE_WHITELINE|DRAWMODE_SETTINGSLINE))
1468             {
1469                 sal_uInt32 nAdaptedDrawMode(nOriginalDrawMode);
1470 
1471                 if(nOriginalDrawMode & DRAWMODE_BLACKLINE)
1472                 {
1473                     nAdaptedDrawMode |= DRAWMODE_BLACKFILL;
1474                 }
1475                 else
1476                 {
1477                     nAdaptedDrawMode &= ~DRAWMODE_BLACKFILL;
1478                 }
1479 
1480                 if(nOriginalDrawMode & DRAWMODE_GRAYLINE)
1481                 {
1482                     nAdaptedDrawMode |= DRAWMODE_GRAYFILL;
1483                 }
1484                 else
1485                 {
1486                     nAdaptedDrawMode &= ~DRAWMODE_GRAYFILL;
1487                 }
1488 
1489                 if(nOriginalDrawMode & DRAWMODE_GHOSTEDLINE)
1490                 {
1491                     nAdaptedDrawMode |= DRAWMODE_GHOSTEDFILL;
1492                 }
1493                 else
1494                 {
1495                     nAdaptedDrawMode &= ~DRAWMODE_GHOSTEDFILL;
1496                 }
1497 
1498                 if(nOriginalDrawMode & DRAWMODE_WHITELINE)
1499                 {
1500                     nAdaptedDrawMode |= DRAWMODE_WHITEFILL;
1501                 }
1502                 else
1503                 {
1504                     nAdaptedDrawMode &= ~DRAWMODE_WHITEFILL;
1505                 }
1506 
1507                 if(nOriginalDrawMode & DRAWMODE_SETTINGSLINE)
1508                 {
1509                     nAdaptedDrawMode |= DRAWMODE_SETTINGSFILL;
1510                 }
1511                 else
1512                 {
1513                     nAdaptedDrawMode &= ~DRAWMODE_SETTINGSFILL;
1514                 }
1515 
1516                 mpOutputDevice->SetDrawMode(nAdaptedDrawMode);
1517             }
1518         }
1519 
1520         void VclProcessor2D::adaptTextToFillDrawMode() const
1521         {
1522             const sal_uInt32 nOriginalDrawMode(mpOutputDevice->GetDrawMode());
1523             if(nOriginalDrawMode & (DRAWMODE_BLACKTEXT|DRAWMODE_GRAYTEXT|DRAWMODE_GHOSTEDTEXT|DRAWMODE_WHITETEXT|DRAWMODE_SETTINGSTEXT))
1524             {
1525                 sal_uInt32 nAdaptedDrawMode(nOriginalDrawMode);
1526 
1527                 if(nOriginalDrawMode & DRAWMODE_BLACKTEXT)
1528                 {
1529                     nAdaptedDrawMode |= DRAWMODE_BLACKFILL;
1530                 }
1531                 else
1532                 {
1533                     nAdaptedDrawMode &= ~DRAWMODE_BLACKFILL;
1534                 }
1535 
1536                 if(nOriginalDrawMode & DRAWMODE_GRAYTEXT)
1537                 {
1538                     nAdaptedDrawMode |= DRAWMODE_GRAYFILL;
1539                 }
1540                 else
1541                 {
1542                     nAdaptedDrawMode &= ~DRAWMODE_GRAYFILL;
1543                 }
1544 
1545                 if(nOriginalDrawMode & DRAWMODE_GHOSTEDTEXT)
1546                 {
1547                     nAdaptedDrawMode |= DRAWMODE_GHOSTEDFILL;
1548                 }
1549                 else
1550                 {
1551                     nAdaptedDrawMode &= ~DRAWMODE_GHOSTEDFILL;
1552                 }
1553 
1554                 if(nOriginalDrawMode & DRAWMODE_WHITETEXT)
1555                 {
1556                     nAdaptedDrawMode |= DRAWMODE_WHITEFILL;
1557                 }
1558                 else
1559                 {
1560                     nAdaptedDrawMode &= ~DRAWMODE_WHITEFILL;
1561                 }
1562 
1563                 if(nOriginalDrawMode & DRAWMODE_SETTINGSTEXT)
1564                 {
1565                     nAdaptedDrawMode |= DRAWMODE_SETTINGSFILL;
1566                 }
1567                 else
1568                 {
1569                     nAdaptedDrawMode &= ~DRAWMODE_SETTINGSFILL;
1570                 }
1571 
1572                 mpOutputDevice->SetDrawMode(nAdaptedDrawMode);
1573             }
1574         }
1575 
1576         //////////////////////////////////////////////////////////////////////////////
1577         // process support
1578 
1579         VclProcessor2D::VclProcessor2D(
1580             const geometry::ViewInformation2D& rViewInformation,
1581             OutputDevice& rOutDev)
1582         :   BaseProcessor2D(rViewInformation),
1583             mpOutputDevice(&rOutDev),
1584             maBColorModifierStack(),
1585             maCurrentTransformation(),
1586             maDrawinglayerOpt(),
1587             mnPolygonStrokePrimitive2D(0)
1588         {
1589             // set digit language, derived from SvtCTLOptions to have the correct
1590             // number display for arabic/hindi numerals
1591             const SvtCTLOptions aSvtCTLOptions;
1592             LanguageType eLang(LANGUAGE_SYSTEM);
1593 
1594             if(SvtCTLOptions::NUMERALS_HINDI == aSvtCTLOptions.GetCTLTextNumerals())
1595             {
1596                 eLang = LANGUAGE_ARABIC_SAUDI_ARABIA;
1597             }
1598             else if(SvtCTLOptions::NUMERALS_ARABIC == aSvtCTLOptions.GetCTLTextNumerals())
1599             {
1600                 eLang = LANGUAGE_ENGLISH;
1601             }
1602             else
1603             {
1604                 eLang = (LanguageType)Application::GetSettings().GetLanguage();
1605             }
1606 
1607             rOutDev.SetDigitLanguage(eLang);
1608         }
1609 
1610         VclProcessor2D::~VclProcessor2D()
1611         {
1612         }
1613     } // end of namespace processor2d
1614 } // end of namespace drawinglayer
1615 
1616 //////////////////////////////////////////////////////////////////////////////
1617 // eof
1618