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 				static bool bUseGraphicManager(true);
420 
421 				// decompose matrix to check for shear, rotate and mirroring
422 				basegfx::B2DVector aScale, aTranslate;
423 				double fRotate, fShearX;
424 				aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX);
425 
426                 // #121387# when mirrored and rotated, avoid the GraphicManager output which has low quality
427                 const bool bRotated(!basegfx::fTools::equalZero(fRotate));
428                 const bool bSheared(!basegfx::fTools::equalZero(fShearX));
429                 const bool bMirrored(aScale.getX() < 0.0 || aScale.getY() < 0.0);
430                 const bool bMirroredAndRotated(bRotated && bMirrored);
431 
432 				if(!bForceUseOfOwnTransformer && !bSheared && !bMirroredAndRotated)
433 				{
434 					if(!bUseGraphicManager && !bRotated)
435 					{
436 						RenderBitmapPrimitive2D_BitmapEx(*mpOutputDevice, aBitmapEx, aLocalTransform);
437 					}
438 					else
439 					{
440 						RenderBitmapPrimitive2D_GraphicManager(*mpOutputDevice, aBitmapEx, aLocalTransform);
441 					}
442 				}
443 				else
444 				{
445 					if(!aBitmapEx.IsTransparent() && (bSheared || bRotated))
446 					{
447 						// parts will be uncovered, extend aBitmapEx with a mask bitmap
448 						const Bitmap aContent(aBitmapEx.GetBitmap());
449 						aBitmapEx = BitmapEx(aContent, Bitmap(aContent.GetSizePixel(), 1));
450 					}
451 
452 					RenderBitmapPrimitive2D_self(*mpOutputDevice, aBitmapEx, aLocalTransform);
453 				}
454 			}
455 		}
456 
457 		void VclProcessor2D::RenderFillGraphicPrimitive2D(const primitive2d::FillGraphicPrimitive2D& rFillBitmapCandidate)
458 		{
459 			const attribute::FillGraphicAttribute& rFillGraphicAttribute(rFillBitmapCandidate.getFillGraphic());
460 			bool bPrimitiveAccepted(false);
461             static bool bTryTilingDirect = true;
462 
463             // #121194# when tiling is used and content is bitmap-based, do direct tiling in the
464             // renderer on pixel base to ensure tight fitting. Do not do this when
465             // the fill is rotated or sheared.
466 
467             // ovveride static bool (for debug) and tiling is active
468 			if(bTryTilingDirect && rFillGraphicAttribute.getTiling())
469 			{
470                 // content is bitmap(ex)
471                 //
472                 // for SVG support, force decomposition when SVG is present. This will lead to use
473                 // the primitive representation of the svg directly.
474                 //
475                 // when graphic is animated, force decomposition to use the correct graphic, else
476                 // fill style will not be animated
477                 if(GRAPHIC_BITMAP == rFillGraphicAttribute.getGraphic().GetType()
478                     && !rFillGraphicAttribute.getGraphic().getSvgData().get()
479                     && !rFillGraphicAttribute.getGraphic().IsAnimated())
480                 {
481 				    // decompose matrix to check for shear, rotate and mirroring
482 				    basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rFillBitmapCandidate.getTransformation());
483 				    basegfx::B2DVector aScale, aTranslate;
484 				    double fRotate, fShearX;
485 				    aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX);
486 
487                     // when nopt rotated/sheared
488 				    if(basegfx::fTools::equalZero(fRotate) && basegfx::fTools::equalZero(fShearX))
489 				    {
490 					    // no shear or rotate, draw direct in pixel coordinates
491 					    bPrimitiveAccepted = true;
492 
493                         // transform object range to device coordinates (pixels). Use
494                         // the device transformation for better accuracy
495                         basegfx::B2DRange aObjectRange(aTranslate, aTranslate + aScale);
496                         aObjectRange.transform(mpOutputDevice->GetViewTransformation());
497 
498                         // extract discrete size of object
499                         const sal_Int32 nOWidth(basegfx::fround(aObjectRange.getWidth()));
500                         const sal_Int32 nOHeight(basegfx::fround(aObjectRange.getHeight()));
501 
502                         // only do something when object has a size in discrete units
503 						if(nOWidth > 0 && nOHeight > 0)
504 						{
505                             // transform graphic range to device coordinates (pixels). Use
506                             // the device transformation for better accuracy
507                             basegfx::B2DRange aGraphicRange(rFillGraphicAttribute.getGraphicRange());
508                             aGraphicRange.transform(mpOutputDevice->GetViewTransformation() * aLocalTransform);
509 
510                             // extract discrete size of graphic
511                             const sal_Int32 nBWidth(basegfx::fround(aGraphicRange.getWidth()));
512                             const sal_Int32 nBHeight(basegfx::fround(aGraphicRange.getHeight()));
513 
514                             // only do something when bitmap fill has a size in discrete units
515 						    if(nBWidth > 0 && nBHeight > 0)
516 						    {
517 						        // nBWidth, nBHeight is the pixel size of the neede bitmap. To not need to scale it
518 						        // in vcl many times, create a size-optimized version
519 						        const Size aNeededBitmapSizePixel(nBWidth, nBHeight);
520                                 BitmapEx aBitmapEx(rFillGraphicAttribute.getGraphic().GetBitmapEx());
521                                 static bool bEnablePreScaling(true);
522                                 const bool bPreScaled(bEnablePreScaling && nBWidth * nBHeight < (250 * 250));
523 
524                                 if(bPreScaled)
525                                 {
526                                     // ... but only up to a maximum size, else it gets too expensive
527                                     aBitmapEx.Scale(aNeededBitmapSizePixel, BMP_SCALE_INTERPOLATE);
528                                 }
529 
530 					            bool bPainted(false);
531 
532 					            if(maBColorModifierStack.count())
533 					            {
534                                     // when color modifier, apply to bitmap
535 						            aBitmapEx = impModifyBitmapEx(maBColorModifierStack, aBitmapEx);
536 
537                                     // impModifyBitmapEx uses empty bitmap as sign to return that
538                                     // the content will be completely replaced to mono color, use shortcut
539 						            if(aBitmapEx.IsEmpty())
540 						            {
541 							            // color gets completely replaced, get it
542 							            const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor()));
543 							            basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon());
544 							            aPolygon.transform(aLocalTransform);
545 
546 							            mpOutputDevice->SetFillColor(Color(aModifiedColor));
547 							            mpOutputDevice->SetLineColor();
548 							            mpOutputDevice->DrawPolygon(aPolygon);
549 
550 							            bPainted = true;
551 						            }
552 					            }
553 
554 					            if(!bPainted)
555 					            {
556                                     sal_Int32 nBLeft(basegfx::fround(aGraphicRange.getMinX()));
557                                     sal_Int32 nBTop(basegfx::fround(aGraphicRange.getMinY()));
558                                     const sal_Int32 nOLeft(basegfx::fround(aObjectRange.getMinX()));
559                                     const sal_Int32 nOTop(basegfx::fround(aObjectRange.getMinY()));
560                                     sal_Int32 nPosX(0);
561                                     sal_Int32 nPosY(0);
562 
563 						            if(nBLeft > nOLeft)
564 						            {
565                                         const sal_Int32 nDiff((nBLeft / nBWidth) + 1);
566 
567                                         nPosX -= nDiff;
568 							            nBLeft -= nDiff * nBWidth;
569 						            }
570 
571 						            if(nBLeft + nBWidth <= nOLeft)
572 						            {
573                                         const sal_Int32 nDiff(-nBLeft / nBWidth);
574 
575                                         nPosX += nDiff;
576 							            nBLeft += nDiff * nBWidth;
577 						            }
578 
579 						            if(nBTop > nOTop)
580 						            {
581                                         const sal_Int32 nDiff((nBTop / nBHeight) + 1);
582 
583                                         nPosY -= nDiff;
584 							            nBTop -= nDiff * nBHeight;
585 						            }
586 
587 						            if(nBTop + nBHeight <= nOTop)
588 						            {
589                                         const sal_Int32 nDiff(-nBTop / nBHeight);
590 
591                                         nPosY += nDiff;
592 							            nBTop += nDiff * nBHeight;
593 						            }
594 
595 						            // prepare OutDev
596 						            const Point aEmptyPoint(0, 0);
597 						            const Rectangle aVisiblePixel(aEmptyPoint, mpOutputDevice->GetOutputSizePixel());
598 						            const bool bWasEnabled(mpOutputDevice->IsMapModeEnabled());
599 						            mpOutputDevice->EnableMapMode(false);
600 
601                                     // check if offset is used
602                                     const sal_Int32 nOffsetX(basegfx::fround(rFillGraphicAttribute.getOffsetX() * nBWidth));
603 
604                                     if(nOffsetX)
605                                     {
606                                         // offset in X, so iterate over Y first and draw lines
607                                         for(sal_Int32 nYPos(nBTop); nYPos < nOTop + nOHeight; nYPos += nBHeight, nPosY++)
608                                         {
609                                             for(sal_Int32 nXPos(nPosY % 2 ? nBLeft - nBWidth + nOffsetX : nBLeft);
610                                                 nXPos < nOLeft + nOWidth; nXPos += nBWidth)
611                                             {
612                                                 const Rectangle aOutRectPixel(Point(nXPos, nYPos), aNeededBitmapSizePixel);
613 
614                                                 if(aOutRectPixel.IsOver(aVisiblePixel))
615                                                 {
616                                                     if(bPreScaled)
617                                                     {
618                                                         mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aBitmapEx);
619                                                     }
620                                                     else
621                                                     {
622                                                         mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aNeededBitmapSizePixel, aBitmapEx);
623                                                     }
624                                                 }
625                                             }
626                                         }
627                                     }
628                                     else
629                                     {
630                                         // check if offset is used
631                                         const sal_Int32 nOffsetY(basegfx::fround(rFillGraphicAttribute.getOffsetY() * nBHeight));
632 
633                                         // possible offset in Y, so iterate over X first and draw columns
634                                         for(sal_Int32 nXPos(nBLeft); nXPos < nOLeft + nOWidth; nXPos += nBWidth, nPosX++)
635                                         {
636                                             for(sal_Int32 nYPos(nPosX % 2 ? nBTop - nBHeight + nOffsetY : nBTop);
637                                                 nYPos < nOTop + nOHeight; nYPos += nBHeight)
638                                             {
639                                                 const Rectangle aOutRectPixel(Point(nXPos, nYPos), aNeededBitmapSizePixel);
640 
641                                                 if(aOutRectPixel.IsOver(aVisiblePixel))
642                                                 {
643                                                     if(bPreScaled)
644                                                     {
645                                                         mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aBitmapEx);
646                                                     }
647                                                     else
648                                                     {
649                                                         mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aNeededBitmapSizePixel, aBitmapEx);
650                                                     }
651                                                 }
652                                             }
653                                         }
654                                     }
655 
656 						            // restore OutDev
657 						            mpOutputDevice->EnableMapMode(bWasEnabled);
658                                 }
659                             }
660                         }
661 				    }
662 			    }
663             }
664 
665 			if(!bPrimitiveAccepted)
666 			{
667 				// do not accept, use decomposition
668 				process(rFillBitmapCandidate.get2DDecomposition(getViewInformation2D()));
669 			}
670 		}
671 
672 		// direct draw of Graphic
673 		void VclProcessor2D::RenderPolyPolygonGraphicPrimitive2D(const primitive2d::PolyPolygonGraphicPrimitive2D& rPolygonCandidate)
674 		{
675             bool bDone(false);
676             const basegfx::B2DPolyPolygon& rPolyPolygon = rPolygonCandidate.getB2DPolyPolygon();
677 
678             // #121194# Todo: check if this works
679             if(!rPolyPolygon.count())
680             {
681                 // empty polyPolygon, done
682                 bDone = true;
683             }
684             else
685             {
686                 const attribute::FillGraphicAttribute& rFillGraphicAttribute = rPolygonCandidate.getFillGraphic();
687 
688                 // try to catch cases where the graphic will be color-modified to a single
689                 // color (e.g. shadow)
690                 switch(rFillGraphicAttribute.getGraphic().GetType())
691                 {
692                     case GRAPHIC_GDIMETAFILE:
693                     {
694                         // metafiles are potentially transparent, cannot optimize�, not done
695                         break;
696                     }
697                     case GRAPHIC_BITMAP:
698                     {
699                         if(!rFillGraphicAttribute.getGraphic().IsTransparent() && !rFillGraphicAttribute.getGraphic().IsAlpha())
700                         {
701                             // bitmap is not transparent and has no alpha
702                             const sal_uInt32 nBColorModifierStackCount(maBColorModifierStack.count());
703 
704                             if(nBColorModifierStackCount)
705                             {
706                                 const basegfx::BColorModifier& rTopmostModifier = maBColorModifierStack.getBColorModifier(nBColorModifierStackCount - 1);
707 
708                                 if(basegfx::BCOLORMODIFYMODE_REPLACE == rTopmostModifier.getMode())
709                                 {
710                                     // the bitmap fill is in unified color, so we can replace it with
711                                     // a single polygon fill. The form of the fill depends on tiling
712                                     if(rFillGraphicAttribute.getTiling())
713                                     {
714                                         // with tiling, fill the whole PolyPolygon with the modifier color
715                                         basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolyPolygon);
716 
717                                         aLocalPolyPolygon.transform(maCurrentTransformation);
718                                         mpOutputDevice->SetLineColor();
719                                         mpOutputDevice->SetFillColor(Color(rTopmostModifier.getBColor()));
720                                         mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon);
721                                     }
722                                     else
723                                     {
724                                         // without tiling, only the area common to the bitmap tile and the
725                                         // PolyPolygon is filled. Create the bitmap tile area in object
726                                         // coordinates. For this, the object transformation needs to be created
727                                         // from the already scaled PolyPolygon. The tile area in object
728                                         // coordinates wil always be non-rotated, so it's not necessary to
729                                         // work with a polygon here
730                                         basegfx::B2DRange aTileRange(rFillGraphicAttribute.getGraphicRange());
731                                         const basegfx::B2DRange aPolyPolygonRange(rPolyPolygon.getB2DRange());
732                                         const basegfx::B2DHomMatrix aNewObjectTransform(
733                                             basegfx::tools::createScaleTranslateB2DHomMatrix(
734                                                 aPolyPolygonRange.getRange(),
735                                                 aPolyPolygonRange.getMinimum()));
736 
737                                         aTileRange.transform(aNewObjectTransform);
738 
739                                         // now clip the object polyPolygon against the tile range
740                                         // to get the common area
741                                         basegfx::B2DPolyPolygon aTarget = basegfx::tools::clipPolyPolygonOnRange(
742                                             rPolyPolygon,
743                                             aTileRange,
744                                             true,
745                                             false);
746 
747                                         if(aTarget.count())
748                                         {
749                                             aTarget.transform(maCurrentTransformation);
750                                             mpOutputDevice->SetLineColor();
751                                             mpOutputDevice->SetFillColor(Color(rTopmostModifier.getBColor()));
752                                             mpOutputDevice->DrawPolyPolygon(aTarget);
753                                         }
754                                     }
755 
756                                     // simplified output executed, we are done
757                                     bDone = true;
758                                 }
759                             }
760                         }
761                         break;
762                     }
763                     default: //GRAPHIC_NONE, GRAPHIC_DEFAULT
764                     {
765                         // empty graphic, we are done
766                         bDone = true;
767                         break;
768                     }
769                 }
770             }
771 
772             if(!bDone)
773             {
774                 // use default decomposition
775                 process(rPolygonCandidate.get2DDecomposition(getViewInformation2D()));
776             }
777         }
778 
779 		// direct draw of PolyPolygon with color
780 		void VclProcessor2D::RenderPolyPolygonColorPrimitive2D(const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate)
781 		{
782 			const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(rPolygonCandidate.getBColor()));
783 			mpOutputDevice->SetFillColor(Color(aPolygonColor));
784 			mpOutputDevice->SetLineColor();
785 
786 			basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
787 			aLocalPolyPolygon.transform(maCurrentTransformation);
788 
789             static bool bCheckTrapezoidDecomposition(false);
790             static bool bShowOutlinesThere(false);
791             if(bCheckTrapezoidDecomposition)
792             {
793                 // clip against discrete ViewPort
794                 const basegfx::B2DRange& rDiscreteViewport = getViewInformation2D().getDiscreteViewport();
795                 aLocalPolyPolygon = basegfx::tools::clipPolyPolygonOnRange(
796                     aLocalPolyPolygon, rDiscreteViewport, true, false);
797 
798                 if(aLocalPolyPolygon.count())
799                 {
800                     // subdivide
801                     aLocalPolyPolygon = basegfx::tools::adaptiveSubdivideByDistance(
802                         aLocalPolyPolygon, 0.5);
803 
804                     // trapezoidize
805                     basegfx::B2DTrapezoidVector aB2DTrapezoidVector;
806                     basegfx::tools::trapezoidSubdivide(aB2DTrapezoidVector, aLocalPolyPolygon);
807 
808                     const sal_uInt32 nCount(aB2DTrapezoidVector.size());
809 
810                     if(nCount)
811                     {
812                         basegfx::BColor aInvPolygonColor(aPolygonColor);
813                         aInvPolygonColor.invert();
814 
815                         for(sal_uInt32 a(0); a < nCount; a++)
816                         {
817                             const basegfx::B2DPolygon aTempPolygon(aB2DTrapezoidVector[a].getB2DPolygon());
818 
819                             if(bShowOutlinesThere)
820                             {
821                                 mpOutputDevice->SetFillColor(Color(aPolygonColor));
822 			                    mpOutputDevice->SetLineColor();
823                             }
824 
825                             mpOutputDevice->DrawPolygon(aTempPolygon);
826 
827                             if(bShowOutlinesThere)
828                             {
829                                 mpOutputDevice->SetFillColor();
830         		                mpOutputDevice->SetLineColor(Color(aInvPolygonColor));
831     	    		            mpOutputDevice->DrawPolyLine(aTempPolygon, 0.0);
832                             }
833                         }
834                     }
835                 }
836             }
837             else
838             {
839 			    mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon);
840 
841                 if(mnPolygonStrokePrimitive2D
842                     && getOptionsDrawinglayer().IsAntiAliasing()
843                     && (mpOutputDevice->GetAntialiasing() & ANTIALIASING_ENABLE_B2DDRAW))
844                 {
845                     // when AA is on and this filled polygons are the result of stroked line geometry,
846                     // draw the geometry once extra as lines to avoid AA 'gaps' between partial polygons
847 			        mpOutputDevice->SetFillColor();
848 			        mpOutputDevice->SetLineColor(Color(aPolygonColor));
849                     const sal_uInt32 nCount(aLocalPolyPolygon.count());
850 
851                     for(sal_uInt32 a(0); a < nCount; a++)
852                     {
853                         mpOutputDevice->DrawPolyLine(aLocalPolyPolygon.getB2DPolygon(a), 0.0);
854                     }
855                 }
856             }
857 		}
858 
859 		// mask group. Force output to VDev and create mask from given mask
860 		void VclProcessor2D::RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate)
861 		{
862 			if(rMaskCandidate.getChildren().hasElements())
863 			{
864 				basegfx::B2DPolyPolygon aMask(rMaskCandidate.getMask());
865 
866 				if(aMask.count())
867 				{
868 					aMask.transform(maCurrentTransformation);
869 					const basegfx::B2DRange aRange(basegfx::tools::getRange(aMask));
870 					impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true);
871 
872 					if(aBufferDevice.isVisible())
873 					{
874 						// remember last OutDev and set to content
875 						OutputDevice* pLastOutputDevice = mpOutputDevice;
876 						mpOutputDevice = &aBufferDevice.getContent();
877 
878 						// paint to it
879 						process(rMaskCandidate.getChildren());
880 
881 						// back to old OutDev
882 						mpOutputDevice = pLastOutputDevice;
883 
884 					    // draw mask
885                         if(getOptionsDrawinglayer().IsAntiAliasing())
886                         {
887                             // with AA, use 8bit AlphaMask to get nice borders
888 						    VirtualDevice& rTransparence = aBufferDevice.getTransparence();
889 						    rTransparence.SetLineColor();
890 						    rTransparence.SetFillColor(COL_BLACK);
891 						    rTransparence.DrawPolyPolygon(aMask);
892 
893 						    // dump buffer to outdev
894 						    aBufferDevice.paint();
895                         }
896                         else
897                         {
898                             // No AA, use 1bit mask
899 						    VirtualDevice& rMask = aBufferDevice.getMask();
900 						    rMask.SetLineColor();
901 						    rMask.SetFillColor(COL_BLACK);
902 						    rMask.DrawPolyPolygon(aMask);
903 
904 						    // dump buffer to outdev
905 						    aBufferDevice.paint();
906                         }
907 					}
908 				}
909 			}
910 		}
911 
912 		// modified color group. Force output to unified color.
913 		void VclProcessor2D::RenderModifiedColorPrimitive2D(const primitive2d::ModifiedColorPrimitive2D& rModifiedCandidate)
914 		{
915 			if(rModifiedCandidate.getChildren().hasElements())
916 			{
917 				maBColorModifierStack.push(rModifiedCandidate.getColorModifier());
918 				process(rModifiedCandidate.getChildren());
919 				maBColorModifierStack.pop();
920 			}
921 		}
922 
923 		// unified sub-transparence. Draw to VDev first.
924 		void VclProcessor2D::RenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rTransCandidate)
925 		{
926             static bool bForceToDecomposition(false);
927 
928             if(rTransCandidate.getChildren().hasElements())
929             {
930                 if(bForceToDecomposition)
931                 {
932     			    // use decomposition
933 	    		    process(rTransCandidate.get2DDecomposition(getViewInformation2D()));
934                 }
935                 else
936                 {
937 			        if(0.0 == rTransCandidate.getTransparence())
938 			        {
939 				        // no transparence used, so just use the content
940     	    		    process(rTransCandidate.getChildren());
941 			        }
942 			        else if(rTransCandidate.getTransparence() > 0.0 && rTransCandidate.getTransparence() < 1.0)
943 			        {
944                         // transparence is in visible range
945 				        basegfx::B2DRange aRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rTransCandidate.getChildren(), getViewInformation2D()));
946 				        aRange.transform(maCurrentTransformation);
947 				        impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true);
948 
949 				        if(aBufferDevice.isVisible())
950 				        {
951 					        // remember last OutDev and set to content
952 					        OutputDevice* pLastOutputDevice = mpOutputDevice;
953 					        mpOutputDevice = &aBufferDevice.getContent();
954 
955 					        // paint content to it
956 					        process(rTransCandidate.getChildren());
957 
958 					        // back to old OutDev
959 					        mpOutputDevice = pLastOutputDevice;
960 
961 					        // dump buffer to outdev using given transparence
962 					        aBufferDevice.paint(rTransCandidate.getTransparence());
963 				        }
964 			        }
965                 }
966             }
967 		}
968 
969 		// sub-transparence group. Draw to VDev first.
970 		void VclProcessor2D::RenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransCandidate)
971 		{
972 			if(rTransCandidate.getChildren().hasElements())
973 			{
974 				basegfx::B2DRange aRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rTransCandidate.getChildren(), getViewInformation2D()));
975 				aRange.transform(maCurrentTransformation);
976 				impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true);
977 
978 				if(aBufferDevice.isVisible())
979 				{
980 					// remember last OutDev and set to content
981 					OutputDevice* pLastOutputDevice = mpOutputDevice;
982 					mpOutputDevice = &aBufferDevice.getContent();
983 
984 					// paint content to it
985 					process(rTransCandidate.getChildren());
986 
987 					// set to mask
988 					mpOutputDevice = &aBufferDevice.getTransparence();
989 
990 					// when painting transparence masks, reset the color stack
991 					basegfx::BColorModifierStack aLastBColorModifierStack(maBColorModifierStack);
992 					maBColorModifierStack = basegfx::BColorModifierStack();
993 
994 					// paint mask to it (always with transparence intensities, evtl. with AA)
995 					process(rTransCandidate.getTransparence());
996 
997 					// back to old color stack
998 					maBColorModifierStack = aLastBColorModifierStack;
999 
1000 					// back to old OutDev
1001 					mpOutputDevice = pLastOutputDevice;
1002 
1003 					// dump buffer to outdev
1004 					aBufferDevice.paint();
1005 				}
1006 			}
1007 		}
1008 
1009 		// transform group.
1010 		void VclProcessor2D::RenderTransformPrimitive2D(const primitive2d::TransformPrimitive2D& rTransformCandidate)
1011 		{
1012 			// remember current transformation and ViewInformation
1013 			const basegfx::B2DHomMatrix aLastCurrentTransformation(maCurrentTransformation);
1014             const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
1015 
1016 			// create new transformations for CurrentTransformation
1017             // and for local ViewInformation2D
1018 			maCurrentTransformation = maCurrentTransformation * rTransformCandidate.getTransformation();
1019             const geometry::ViewInformation2D aViewInformation2D(
1020                 getViewInformation2D().getObjectTransformation() * rTransformCandidate.getTransformation(),
1021                 getViewInformation2D().getViewTransformation(),
1022                 getViewInformation2D().getViewport(),
1023 				getViewInformation2D().getVisualizedPage(),
1024                 getViewInformation2D().getViewTime(),
1025 				getViewInformation2D().getExtendedInformationSequence());
1026 			updateViewInformation(aViewInformation2D);
1027 
1028 			// proccess content
1029 			process(rTransformCandidate.getChildren());
1030 
1031 			// restore transformations
1032 			maCurrentTransformation = aLastCurrentTransformation;
1033             updateViewInformation(aLastViewInformation2D);
1034 		}
1035 
1036 		// new XDrawPage for ViewInformation2D
1037 		void VclProcessor2D::RenderPagePreviewPrimitive2D(const primitive2d::PagePreviewPrimitive2D& rPagePreviewCandidate)
1038 		{
1039 			// remember current transformation and ViewInformation
1040             const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D());
1041 
1042 			// create new local ViewInformation2D
1043             const geometry::ViewInformation2D aViewInformation2D(
1044                 getViewInformation2D().getObjectTransformation(),
1045                 getViewInformation2D().getViewTransformation(),
1046                 getViewInformation2D().getViewport(),
1047 				rPagePreviewCandidate.getXDrawPage(),
1048                 getViewInformation2D().getViewTime(),
1049 				getViewInformation2D().getExtendedInformationSequence());
1050 			updateViewInformation(aViewInformation2D);
1051 
1052 			// proccess decomposed content
1053 			process(rPagePreviewCandidate.get2DDecomposition(getViewInformation2D()));
1054 
1055 			// restore transformations
1056             updateViewInformation(aLastViewInformation2D);
1057 		}
1058 
1059 		// marker
1060 		void VclProcessor2D::RenderMarkerArrayPrimitive2D(const primitive2d::MarkerArrayPrimitive2D& rMarkArrayCandidate)
1061 		{
1062             static bool bCheckCompleteMarkerDecompose(false);
1063             if(bCheckCompleteMarkerDecompose)
1064             {
1065 			    process(rMarkArrayCandidate.get2DDecomposition(getViewInformation2D()));
1066                 return;
1067             }
1068 
1069 			// get data
1070 	        const std::vector< basegfx::B2DPoint >& rPositions = rMarkArrayCandidate.getPositions();
1071 			const sal_uInt32 nCount(rPositions.size());
1072 
1073 			if(nCount && !rMarkArrayCandidate.getMarker().IsEmpty())
1074 			{
1075 				// get pixel size
1076 				const BitmapEx& rMarker(rMarkArrayCandidate.getMarker());
1077 				const Size aBitmapSize(rMarker.GetSizePixel());
1078 
1079 				if(aBitmapSize.Width() && aBitmapSize.Height())
1080 				{
1081 					// get discrete half size
1082 					const basegfx::B2DVector aDiscreteHalfSize(
1083                         (aBitmapSize.getWidth() - 1.0) * 0.5,
1084                         (aBitmapSize.getHeight() - 1.0) * 0.5);
1085 			        const bool bWasEnabled(mpOutputDevice->IsMapModeEnabled());
1086 
1087                     // do not forget evtl. moved origin in target device MapMode when
1088                     // switching it off; it would be missing and lead to wrong positions.
1089                     // All his could be done using logic sizes and coordinates, too, but
1090                     // we want a 1:1 bitmap rendering here, so it's more safe and faster
1091                     // to work with switching off MapMode usage completely.
1092                     const Point aOrigin(mpOutputDevice->GetMapMode().GetOrigin());
1093 
1094                     mpOutputDevice->EnableMapMode(false);
1095 
1096 					for(std::vector< basegfx::B2DPoint >::const_iterator aIter(rPositions.begin()); aIter != rPositions.end(); aIter++)
1097 				    {
1098 					    const basegfx::B2DPoint aDiscreteTopLeft((maCurrentTransformation * (*aIter)) - aDiscreteHalfSize);
1099                         const Point aDiscretePoint(basegfx::fround(aDiscreteTopLeft.getX()), basegfx::fround(aDiscreteTopLeft.getY()));
1100 
1101 						mpOutputDevice->DrawBitmapEx(aDiscretePoint + aOrigin, rMarker);
1102 					}
1103 
1104 			        mpOutputDevice->EnableMapMode(bWasEnabled);
1105 				}
1106 			}
1107 		}
1108 
1109 		// point
1110 		void VclProcessor2D::RenderPointArrayPrimitive2D(const primitive2d::PointArrayPrimitive2D& rPointArrayCandidate)
1111 		{
1112 			const std::vector< basegfx::B2DPoint >& rPositions = rPointArrayCandidate.getPositions();
1113 			const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(rPointArrayCandidate.getRGBColor()));
1114 			const Color aVCLColor(aRGBColor);
1115 
1116 			for(std::vector< basegfx::B2DPoint >::const_iterator aIter(rPositions.begin()); aIter != rPositions.end(); aIter++)
1117 			{
1118 				const basegfx::B2DPoint aViewPosition(maCurrentTransformation * (*aIter));
1119 				const Point aPos(basegfx::fround(aViewPosition.getX()), basegfx::fround(aViewPosition.getY()));
1120 
1121 				mpOutputDevice->DrawPixel(aPos, aVCLColor);
1122 			}
1123 		}
1124 
1125 		void VclProcessor2D::RenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokeCandidate)
1126 		{
1127             // #i101491# method restructured to clearly use the DrawPolyLine
1128             // calls starting from a deined line width
1129 			const attribute::LineAttribute& rLineAttribute = rPolygonStrokeCandidate.getLineAttribute();
1130 			const double fLineWidth(rLineAttribute.getWidth());
1131 			bool bDone(false);
1132 
1133 			if(basegfx::fTools::more(fLineWidth, 0.0))
1134 			{
1135 				const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation * basegfx::B2DVector(fLineWidth, 0.0));
1136 				const double fDiscreteLineWidth(aDiscreteUnit.getLength());
1137 				const attribute::StrokeAttribute& rStrokeAttribute = rPolygonStrokeCandidate.getStrokeAttribute();
1138 				const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLineAttribute.getColor()));
1139 				basegfx::B2DPolyPolygon aHairlinePolyPolygon;
1140 
1141 				mpOutputDevice->SetLineColor(Color(aHairlineColor));
1142 				mpOutputDevice->SetFillColor();
1143 
1144 				if(0.0 == rStrokeAttribute.getFullDotDashLen())
1145 				{
1146 					// no line dashing, just copy
1147 					aHairlinePolyPolygon.append(rPolygonStrokeCandidate.getB2DPolygon());
1148 				}
1149 				else
1150 				{
1151 					// else apply LineStyle
1152 					basegfx::tools::applyLineDashing(rPolygonStrokeCandidate.getB2DPolygon(),
1153 						rStrokeAttribute.getDotDashArray(),
1154 						&aHairlinePolyPolygon, 0, rStrokeAttribute.getFullDotDashLen());
1155 				}
1156 
1157 				const sal_uInt32 nCount(aHairlinePolyPolygon.count());
1158 
1159 				if(nCount)
1160 				{
1161                     const bool bAntiAliased(getOptionsDrawinglayer().IsAntiAliasing());
1162                     aHairlinePolyPolygon.transform(maCurrentTransformation);
1163 
1164                     if(bAntiAliased)
1165                     {
1166                         if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.0))
1167                         {
1168                             // line in range ]0.0 .. 1.0[
1169                             // paint as simple hairline
1170                             for(sal_uInt32 a(0); a < nCount; a++)
1171                             {
1172                                 mpOutputDevice->DrawPolyLine(aHairlinePolyPolygon.getB2DPolygon(a), 0.0);
1173                             }
1174 
1175                             bDone = true;
1176                         }
1177                         else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.0))
1178                         {
1179                             // line in range [1.0 .. 2.0[
1180                             // paint as 2x2 with dynamic line distance
1181                             basegfx::B2DHomMatrix aMat;
1182                             const double fDistance(fDiscreteLineWidth - 1.0);
1183                             const double fHalfDistance(fDistance * 0.5);
1184 
1185                             for(sal_uInt32 a(0); a < nCount; a++)
1186                             {
1187                                 basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
1188 
1189                                 aMat.set(0, 2, -fHalfDistance);
1190                                 aMat.set(1, 2, -fHalfDistance);
1191                                 aCandidate.transform(aMat);
1192                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1193 
1194                                 aMat.set(0, 2, fDistance);
1195                                 aMat.set(1, 2, 0.0);
1196                                 aCandidate.transform(aMat);
1197                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1198 
1199                                 aMat.set(0, 2, 0.0);
1200                                 aMat.set(1, 2, fDistance);
1201                                 aCandidate.transform(aMat);
1202                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1203 
1204                                 aMat.set(0, 2, -fDistance);
1205                                 aMat.set(1, 2, 0.0);
1206                                 aCandidate.transform(aMat);
1207                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1208                             }
1209 
1210                             bDone = true;
1211                         }
1212                         else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 3.0))
1213                         {
1214                             // line in range [2.0 .. 3.0]
1215                             // paint as cross in a 3x3  with dynamic line distance
1216                             basegfx::B2DHomMatrix aMat;
1217                             const double fDistance((fDiscreteLineWidth - 1.0) * 0.5);
1218 
1219                             for(sal_uInt32 a(0); a < nCount; a++)
1220                             {
1221                                 basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
1222 
1223                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1224 
1225                                 aMat.set(0, 2, -fDistance);
1226                                 aMat.set(1, 2, 0.0);
1227                                 aCandidate.transform(aMat);
1228                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1229 
1230                                 aMat.set(0, 2, fDistance);
1231                                 aMat.set(1, 2, -fDistance);
1232                                 aCandidate.transform(aMat);
1233                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1234 
1235                                 aMat.set(0, 2, fDistance);
1236                                 aMat.set(1, 2, fDistance);
1237                                 aCandidate.transform(aMat);
1238                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1239 
1240                                 aMat.set(0, 2, -fDistance);
1241                                 aMat.set(1, 2, fDistance);
1242                                 aCandidate.transform(aMat);
1243                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1244                             }
1245 
1246                             bDone = true;
1247                         }
1248                         else
1249                         {
1250                             // #i101491# line width above 3.0
1251                         }
1252                     }
1253                     else
1254                     {
1255                         if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.5))
1256                         {
1257                             // line width below 1.5, draw the basic hairline polygon
1258                             for(sal_uInt32 a(0); a < nCount; a++)
1259                             {
1260                                 mpOutputDevice->DrawPolyLine(aHairlinePolyPolygon.getB2DPolygon(a), 0.0);
1261                             }
1262 
1263                             bDone = true;
1264                         }
1265                         else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.5))
1266                         {
1267                             // line width is in range ]1.5 .. 2.5], use four hairlines
1268                             // drawn in a square
1269                             for(sal_uInt32 a(0); a < nCount; a++)
1270                             {
1271                                 basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
1272                                 basegfx::B2DHomMatrix aMat;
1273 
1274                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1275 
1276                                 aMat.set(0, 2, 1.0);
1277                                 aMat.set(1, 2, 0.0);
1278                                 aCandidate.transform(aMat);
1279 
1280                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1281 
1282                                 aMat.set(0, 2, 0.0);
1283                                 aMat.set(1, 2, 1.0);
1284                                 aCandidate.transform(aMat);
1285 
1286                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1287 
1288                                 aMat.set(0, 2, -1.0);
1289                                 aMat.set(1, 2, 0.0);
1290                                 aCandidate.transform(aMat);
1291 
1292                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
1293                             }
1294 
1295                             bDone = true;
1296                         }
1297                         else
1298                         {
1299                             // #i101491# line width is above 2.5
1300                         }
1301                     }
1302 
1303                     if(!bDone && rPolygonStrokeCandidate.getB2DPolygon().count() > 1000)
1304                     {
1305                         // #i101491# If the polygon complexity uses more than a given amount, do
1306                         // use OuputDevice::DrawPolyLine directly; this will avoid buffering all
1307                         // decompositions in primtives (memory) and fallback to old line painting
1308                         // for very complex polygons, too
1309                         for(sal_uInt32 a(0); a < nCount; a++)
1310                         {
1311                             mpOutputDevice->DrawPolyLine(
1312                                 aHairlinePolyPolygon.getB2DPolygon(a),
1313                                 fDiscreteLineWidth,
1314                                 rLineAttribute.getLineJoin(),
1315                                 rLineAttribute.getLineCap());
1316                         }
1317 
1318                         bDone = true;
1319                     }
1320                 }
1321             }
1322 
1323 			if(!bDone)
1324             {
1325                 // remeber that we enter a PolygonStrokePrimitive2D decomposition,
1326                 // used for AA thick line drawing
1327                 mnPolygonStrokePrimitive2D++;
1328 
1329                 // line width is big enough for standard filled polygon visualisation or zero
1330 				process(rPolygonStrokeCandidate.get2DDecomposition(getViewInformation2D()));
1331 
1332                 // leave PolygonStrokePrimitive2D
1333                 mnPolygonStrokePrimitive2D--;
1334             }
1335 		}
1336 
1337         void VclProcessor2D::RenderEpsPrimitive2D(const primitive2d::EpsPrimitive2D& rEpsPrimitive2D)
1338         {
1339             // The new decomposition of Metafiles made it necessary to add an Eps
1340             // primitive to handle embedded Eps data. On some devices, this can be
1341             // painted directly (mac, printer).
1342             // To be able to handle the replacement correctly, i need to handle it myself
1343             // since DrawEPS will not be able e.g. to rotate the replacement. To be able
1344             // to do that, i added a boolean return to OutputDevice::DrawEPS(..)
1345             // to know when EPS was handled directly already.
1346 			basegfx::B2DRange aRange(0.0, 0.0, 1.0, 1.0);
1347             aRange.transform(maCurrentTransformation * rEpsPrimitive2D.getEpsTransform());
1348 
1349             if(!aRange.isEmpty())
1350             {
1351                 const Rectangle aRectangle(
1352 				    (sal_Int32)floor(aRange.getMinX()), (sal_Int32)floor(aRange.getMinY()),
1353 				    (sal_Int32)ceil(aRange.getMaxX()), (sal_Int32)ceil(aRange.getMaxY()));
1354 
1355                 if(!aRectangle.IsEmpty())
1356                 {
1357                     // try to paint EPS directly without fallback visualisation
1358                     const bool bEPSPaintedDirectly(mpOutputDevice->DrawEPS(
1359                         aRectangle.TopLeft(),
1360                         aRectangle.GetSize(),
1361                         rEpsPrimitive2D.getGfxLink(),
1362                         0));
1363 
1364                     if(!bEPSPaintedDirectly)
1365                     {
1366                         // use the decomposition which will correctly handle the
1367                         // fallback visualisation using full transformation (e.g. rotation)
1368         				process(rEpsPrimitive2D.get2DDecomposition(getViewInformation2D()));
1369                     }
1370                 }
1371             }
1372         }
1373 
1374         void VclProcessor2D::RenderSvgLinearAtomPrimitive2D(const primitive2d::SvgLinearAtomPrimitive2D& rCandidate)
1375         {
1376             const double fDelta(rCandidate.getOffsetB() - rCandidate.getOffsetA());
1377 
1378             if(basegfx::fTools::more(fDelta, 0.0))
1379             {
1380                 const basegfx::BColor aColorA(maBColorModifierStack.getModifiedColor(rCandidate.getColorA()));
1381                 const basegfx::BColor aColorB(maBColorModifierStack.getModifiedColor(rCandidate.getColorB()));
1382                 const double fDiscreteUnit((getViewInformation2D().getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength());
1383 
1384                 // use color distance and discrete lengths to calculate step count
1385                 const sal_uInt32 nSteps(calculateStepsForSvgGradient(aColorA, aColorB, fDelta, fDiscreteUnit));
1386 
1387                 // switch off line painting
1388                 mpOutputDevice->SetLineColor();
1389 
1390                 // prepare polygon in needed width at start position (with discrete overlap)
1391                 const basegfx::B2DPolygon aPolygon(
1392                     basegfx::tools::createPolygonFromRect(
1393                         basegfx::B2DRange(
1394                             rCandidate.getOffsetA() - fDiscreteUnit,
1395                             0.0,
1396                             rCandidate.getOffsetA() + (fDelta / nSteps) + fDiscreteUnit,
1397                             1.0)));
1398 
1399 
1400                 // prepare loop ([0.0 .. 1.0[)
1401                 double fUnitScale(0.0);
1402                 const double fUnitStep(1.0 / nSteps);
1403 
1404                 // loop and paint
1405                 for(sal_uInt32 a(0); a < nSteps; a++, fUnitScale += fUnitStep)
1406                 {
1407                     basegfx::B2DPolygon aNew(aPolygon);
1408 
1409                     aNew.transform(maCurrentTransformation * basegfx::tools::createTranslateB2DHomMatrix(fDelta * fUnitScale, 0.0));
1410                     mpOutputDevice->SetFillColor(Color(basegfx::interpolate(aColorA, aColorB, fUnitScale)));
1411                     mpOutputDevice->DrawPolyPolygon(basegfx::B2DPolyPolygon(aNew));
1412                 }
1413             }
1414         }
1415 
1416         void VclProcessor2D::RenderSvgRadialAtomPrimitive2D(const primitive2d::SvgRadialAtomPrimitive2D& rCandidate)
1417         {
1418             const double fDeltaScale(rCandidate.getScaleB() - rCandidate.getScaleA());
1419 
1420             if(basegfx::fTools::more(fDeltaScale, 0.0))
1421             {
1422                 const basegfx::BColor aColorA(maBColorModifierStack.getModifiedColor(rCandidate.getColorA()));
1423                 const basegfx::BColor aColorB(maBColorModifierStack.getModifiedColor(rCandidate.getColorB()));
1424                 const double fDiscreteUnit((getViewInformation2D().getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength());
1425 
1426                 // use color distance and discrete lengths to calculate step count
1427                 const sal_uInt32 nSteps(calculateStepsForSvgGradient(aColorA, aColorB, fDeltaScale, fDiscreteUnit));
1428 
1429                 // switch off line painting
1430                 mpOutputDevice->SetLineColor();
1431 
1432                 // prepare loop ([0.0 .. 1.0[, full polygons, no polypolygons with holes)
1433                 double fUnitScale(0.0);
1434                 const double fUnitStep(1.0 / nSteps);
1435 
1436                 for(sal_uInt32 a(0); a < nSteps; a++, fUnitScale += fUnitStep)
1437                 {
1438                     basegfx::B2DHomMatrix aTransform;
1439                     const double fEndScale(rCandidate.getScaleB() - (fDeltaScale * fUnitScale));
1440 
1441                     if(rCandidate.isTranslateSet())
1442                     {
1443                         const basegfx::B2DVector aTranslate(
1444                             basegfx::interpolate(
1445                                 rCandidate.getTranslateB(),
1446                                 rCandidate.getTranslateA(),
1447                                 fUnitScale));
1448 
1449                         aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix(
1450                             fEndScale,
1451                             fEndScale,
1452                             aTranslate.getX(),
1453                             aTranslate.getY());
1454                     }
1455                     else
1456                     {
1457                         aTransform = basegfx::tools::createScaleB2DHomMatrix(
1458                             fEndScale,
1459                             fEndScale);
1460                     }
1461 
1462                     basegfx::B2DPolygon aNew(basegfx::tools::createPolygonFromUnitCircle());
1463 
1464                     aNew.transform(maCurrentTransformation * aTransform);
1465                     mpOutputDevice->SetFillColor(Color(basegfx::interpolate(aColorB, aColorA, fUnitScale)));
1466                     mpOutputDevice->DrawPolyPolygon(basegfx::B2DPolyPolygon(aNew));
1467                 }
1468             }
1469         }
1470 
1471 		void VclProcessor2D::adaptLineToFillDrawMode() const
1472 		{
1473 			const sal_uInt32 nOriginalDrawMode(mpOutputDevice->GetDrawMode());
1474 
1475 			if(nOriginalDrawMode & (DRAWMODE_BLACKLINE|DRAWMODE_GRAYLINE|DRAWMODE_GHOSTEDLINE|DRAWMODE_WHITELINE|DRAWMODE_SETTINGSLINE))
1476 			{
1477 				sal_uInt32 nAdaptedDrawMode(nOriginalDrawMode);
1478 
1479 				if(nOriginalDrawMode & DRAWMODE_BLACKLINE)
1480 				{
1481 					nAdaptedDrawMode |= DRAWMODE_BLACKFILL;
1482 				}
1483 				else
1484 				{
1485 					nAdaptedDrawMode &= ~DRAWMODE_BLACKFILL;
1486 				}
1487 
1488 				if(nOriginalDrawMode & DRAWMODE_GRAYLINE)
1489 				{
1490 					nAdaptedDrawMode |= DRAWMODE_GRAYFILL;
1491 				}
1492 				else
1493 				{
1494 					nAdaptedDrawMode &= ~DRAWMODE_GRAYFILL;
1495 				}
1496 
1497 				if(nOriginalDrawMode & DRAWMODE_GHOSTEDLINE)
1498 				{
1499 					nAdaptedDrawMode |= DRAWMODE_GHOSTEDFILL;
1500 				}
1501 				else
1502 				{
1503 					nAdaptedDrawMode &= ~DRAWMODE_GHOSTEDFILL;
1504 				}
1505 
1506 				if(nOriginalDrawMode & DRAWMODE_WHITELINE)
1507 				{
1508 					nAdaptedDrawMode |= DRAWMODE_WHITEFILL;
1509 				}
1510 				else
1511 				{
1512 					nAdaptedDrawMode &= ~DRAWMODE_WHITEFILL;
1513 				}
1514 
1515 				if(nOriginalDrawMode & DRAWMODE_SETTINGSLINE)
1516 				{
1517 					nAdaptedDrawMode |= DRAWMODE_SETTINGSFILL;
1518 				}
1519 				else
1520 				{
1521 					nAdaptedDrawMode &= ~DRAWMODE_SETTINGSFILL;
1522 				}
1523 
1524 				mpOutputDevice->SetDrawMode(nAdaptedDrawMode);
1525 			}
1526 		}
1527 
1528 		void VclProcessor2D::adaptTextToFillDrawMode() const
1529 		{
1530 			const sal_uInt32 nOriginalDrawMode(mpOutputDevice->GetDrawMode());
1531 			if(nOriginalDrawMode & (DRAWMODE_BLACKTEXT|DRAWMODE_GRAYTEXT|DRAWMODE_GHOSTEDTEXT|DRAWMODE_WHITETEXT|DRAWMODE_SETTINGSTEXT))
1532 			{
1533 				sal_uInt32 nAdaptedDrawMode(nOriginalDrawMode);
1534 
1535 				if(nOriginalDrawMode & DRAWMODE_BLACKTEXT)
1536 				{
1537 					nAdaptedDrawMode |= DRAWMODE_BLACKFILL;
1538 				}
1539 				else
1540 				{
1541 					nAdaptedDrawMode &= ~DRAWMODE_BLACKFILL;
1542 				}
1543 
1544 				if(nOriginalDrawMode & DRAWMODE_GRAYTEXT)
1545 				{
1546 					nAdaptedDrawMode |= DRAWMODE_GRAYFILL;
1547 				}
1548 				else
1549 				{
1550 					nAdaptedDrawMode &= ~DRAWMODE_GRAYFILL;
1551 				}
1552 
1553 				if(nOriginalDrawMode & DRAWMODE_GHOSTEDTEXT)
1554 				{
1555 					nAdaptedDrawMode |= DRAWMODE_GHOSTEDFILL;
1556 				}
1557 				else
1558 				{
1559 					nAdaptedDrawMode &= ~DRAWMODE_GHOSTEDFILL;
1560 				}
1561 
1562 				if(nOriginalDrawMode & DRAWMODE_WHITETEXT)
1563 				{
1564 					nAdaptedDrawMode |= DRAWMODE_WHITEFILL;
1565 				}
1566 				else
1567 				{
1568 					nAdaptedDrawMode &= ~DRAWMODE_WHITEFILL;
1569 				}
1570 
1571 				if(nOriginalDrawMode & DRAWMODE_SETTINGSTEXT)
1572 				{
1573 					nAdaptedDrawMode |= DRAWMODE_SETTINGSFILL;
1574 				}
1575 				else
1576 				{
1577 					nAdaptedDrawMode &= ~DRAWMODE_SETTINGSFILL;
1578 				}
1579 
1580 				mpOutputDevice->SetDrawMode(nAdaptedDrawMode);
1581 			}
1582 		}
1583 
1584 		//////////////////////////////////////////////////////////////////////////////
1585 		// process support
1586 
1587 		VclProcessor2D::VclProcessor2D(
1588 			const geometry::ViewInformation2D& rViewInformation,
1589 			OutputDevice& rOutDev)
1590 		:	BaseProcessor2D(rViewInformation),
1591 			mpOutputDevice(&rOutDev),
1592 			maBColorModifierStack(),
1593 			maCurrentTransformation(),
1594 			maDrawinglayerOpt(),
1595             mnPolygonStrokePrimitive2D(0)
1596 		{
1597             // set digit language, derived from SvtCTLOptions to have the correct
1598             // number display for arabic/hindi numerals
1599             const SvtCTLOptions aSvtCTLOptions;
1600             LanguageType eLang(LANGUAGE_SYSTEM);
1601 
1602             if(SvtCTLOptions::NUMERALS_HINDI == aSvtCTLOptions.GetCTLTextNumerals())
1603             {
1604                 eLang = LANGUAGE_ARABIC_SAUDI_ARABIA;
1605             }
1606             else if(SvtCTLOptions::NUMERALS_ARABIC == aSvtCTLOptions.GetCTLTextNumerals())
1607             {
1608                 eLang = LANGUAGE_ENGLISH;
1609             }
1610             else
1611             {
1612                 eLang = (LanguageType)Application::GetSettings().GetLanguage();
1613             }
1614 
1615             rOutDev.SetDigitLanguage(eLang);
1616 		}
1617 
1618 		VclProcessor2D::~VclProcessor2D()
1619 		{
1620 		}
1621 	} // end of namespace processor2d
1622 } // end of namespace drawinglayer
1623 
1624 //////////////////////////////////////////////////////////////////////////////
1625 // eof
1626