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