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