Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <toolkit/awt/vclxgraphics.hxx>
31 : : #include <toolkit/awt/vclxdevice.hxx>
32 : : #include <toolkit/helper/macros.hxx>
33 : : #include <toolkit/helper/vclunohelper.hxx>
34 : : #include <cppuhelper/typeprovider.hxx>
35 : : #include <rtl/memory.h>
36 : : #include <rtl/uuid.h>
37 : :
38 : : #include <vcl/svapp.hxx>
39 : : #include <vcl/outdev.hxx>
40 : : #include <vcl/gradient.hxx>
41 : : #include <tools/debug.hxx>
42 : :
43 : :
44 : : // ----------------------------------------------------
45 : : // class VCLXGraphics
46 : : // ----------------------------------------------------
47 : :
48 : : // ::com::sun::star::uno::XInterface
49 : 24594 : ::com::sun::star::uno::Any VCLXGraphics::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
50 : : {
51 : : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
52 : : (static_cast< ::com::sun::star::awt::XGraphics* >(this)),
53 : : (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)),
54 [ + - ]: 24594 : (static_cast< ::com::sun::star::lang::XUnoTunnel* >(this)) );
55 [ + + ][ + - ]: 24594 : return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
56 : : }
57 : :
58 : : // ::com::sun::star::lang::XUnoTunnel
59 [ + - ][ + + ]: 103041 : IMPL_XUNOTUNNEL( VCLXGraphics )
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
60 : :
61 : : // ::com::sun::star::lang::XTypeProvider
62 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_START( VCLXGraphics )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
63 [ # # ]: 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics>* ) NULL )
64 [ # # ][ # # ]: 0 : IMPL_XTYPEPROVIDER_END
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
65 : :
66 [ + - ]: 20511 : VCLXGraphics::VCLXGraphics()
67 : : {
68 : 20511 : mpOutputDevice = NULL;
69 : 20511 : mpClipRegion = NULL;
70 : 20511 : }
71 : :
72 [ + - ][ + - ]: 20511 : VCLXGraphics::~VCLXGraphics()
73 : : {
74 [ + + ]: 20511 : VCLXGraphicsList_impl* pLst = mpOutputDevice ? mpOutputDevice->GetUnoGraphicsList() : NULL;
75 [ + + ]: 20511 : if ( pLst )
76 : : {
77 [ + - ][ + - ]: 40966 : for( VCLXGraphicsList_impl::iterator it = pLst->begin(); it != pLst->end(); ++it )
78 : : {
79 [ + - ]: 20483 : if( *it == this ) {
80 [ + - ]: 20483 : pLst->erase( it );
81 : 20483 : break;
82 : : }
83 : : }
84 : : }
85 : :
86 [ - + ][ # # ]: 20511 : delete mpClipRegion;
87 [ - + ]: 41022 : }
88 : :
89 : 28 : void VCLXGraphics::SetOutputDevice( OutputDevice* pOutDev )
90 : : {
91 : 28 : mpOutputDevice = pOutDev;
92 : 28 : mxDevice = NULL;
93 : 28 : }
94 : :
95 : 20511 : void VCLXGraphics::Init( OutputDevice* pOutDev )
96 : : {
97 : : DBG_ASSERT( !mpOutputDevice, "VCLXGraphics::Init allready has pOutDev !" );
98 : 20511 : mpOutputDevice = pOutDev;
99 : :
100 : 20511 : maFont = mpOutputDevice->GetFont();
101 : 20511 : maTextColor = COL_BLACK;
102 : 20511 : maTextFillColor = COL_TRANSPARENT;
103 : 20511 : maLineColor = COL_BLACK;
104 : 20511 : maFillColor = COL_WHITE;
105 : 20511 : meRasterOp = ROP_OVERPAINT;
106 : 20511 : mpClipRegion = NULL;
107 : :
108 : : // Register at OutputDevice
109 : 20511 : VCLXGraphicsList_impl* pLst = mpOutputDevice->GetUnoGraphicsList();
110 [ + + ]: 20511 : if ( !pLst )
111 : 2204 : pLst = mpOutputDevice->CreateUnoGraphicsList();
112 [ + - ]: 20511 : pLst->push_back( this );
113 : 20511 : }
114 : :
115 : 0 : void VCLXGraphics::InitOutputDevice( sal_uInt16 nFlags )
116 : : {
117 [ # # ]: 0 : if(mpOutputDevice)
118 : : {
119 [ # # ]: 0 : SolarMutexGuard aVclGuard;
120 : :
121 [ # # ]: 0 : if ( nFlags & INITOUTDEV_FONT )
122 : : {
123 [ # # ]: 0 : mpOutputDevice->SetFont( maFont );
124 [ # # ]: 0 : mpOutputDevice->SetTextColor( maTextColor );
125 [ # # ]: 0 : mpOutputDevice->SetTextFillColor( maTextFillColor );
126 : : }
127 : :
128 [ # # ]: 0 : if ( nFlags & INITOUTDEV_COLORS )
129 : : {
130 [ # # ]: 0 : mpOutputDevice->SetLineColor( maLineColor );
131 [ # # ]: 0 : mpOutputDevice->SetFillColor( maFillColor );
132 : : }
133 : :
134 [ # # ]: 0 : if ( nFlags & INITOUTDEV_RASTEROP )
135 : : {
136 [ # # ]: 0 : mpOutputDevice->SetRasterOp( meRasterOp );
137 : : }
138 : :
139 [ # # ]: 0 : if ( nFlags & INITOUTDEV_CLIPREGION )
140 : : {
141 [ # # ]: 0 : if( mpClipRegion )
142 [ # # ]: 0 : mpOutputDevice->SetClipRegion( *mpClipRegion );
143 : : else
144 [ # # ]: 0 : mpOutputDevice->SetClipRegion();
145 [ # # ]: 0 : }
146 : : }
147 : 0 : }
148 : :
149 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXGraphics::getDevice() throw(::com::sun::star::uno::RuntimeException)
150 : : {
151 [ # # ]: 0 : SolarMutexGuard aGuard;
152 : :
153 [ # # ][ # # ]: 0 : if( !mxDevice.is() && mpOutputDevice )
[ # # ]
154 : : {
155 [ # # ]: 0 : VCLXDevice* pDev = new VCLXDevice;
156 : 0 : pDev->SetOutputDevice( mpOutputDevice );
157 [ # # ]: 0 : mxDevice = pDev;
158 : : }
159 [ # # ]: 0 : return mxDevice;
160 : : }
161 : :
162 : 0 : ::com::sun::star::awt::SimpleFontMetric VCLXGraphics::getFontMetric() throw(::com::sun::star::uno::RuntimeException)
163 : : {
164 [ # # ]: 0 : SolarMutexGuard aGuard;
165 : :
166 : 0 : ::com::sun::star::awt::SimpleFontMetric aM;
167 [ # # ]: 0 : if( mpOutputDevice )
168 : : {
169 [ # # ]: 0 : mpOutputDevice->SetFont( maFont );
170 [ # # ][ # # ]: 0 : aM = VCLUnoHelper::CreateFontMetric( mpOutputDevice->GetFontMetric() );
[ # # ]
171 : : }
172 [ # # ]: 0 : return aM;
173 : : }
174 : :
175 : 0 : void VCLXGraphics::setFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont ) throw(::com::sun::star::uno::RuntimeException)
176 : : {
177 [ # # ]: 0 : SolarMutexGuard aGuard;
178 : :
179 [ # # ][ # # ]: 0 : maFont = VCLUnoHelper::CreateFont( rxFont );
[ # # ][ # # ]
180 : 0 : }
181 : :
182 : 0 : void VCLXGraphics::selectFont( const ::com::sun::star::awt::FontDescriptor& rDescription ) throw(::com::sun::star::uno::RuntimeException)
183 : : {
184 [ # # ]: 0 : SolarMutexGuard aGuard;
185 : :
186 [ # # ][ # # ]: 0 : maFont = VCLUnoHelper::CreateFont( rDescription, Font() );
[ # # ][ # # ]
[ # # ][ # # ]
187 : 0 : }
188 : :
189 : 0 : void VCLXGraphics::setTextColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
190 : : {
191 [ # # ]: 0 : SolarMutexGuard aGuard;
192 : :
193 [ # # ]: 0 : maTextColor = Color( (sal_uInt32)nColor );
194 : 0 : }
195 : :
196 : 0 : void VCLXGraphics::setTextFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
197 : : {
198 [ # # ]: 0 : SolarMutexGuard aGuard;
199 : :
200 [ # # ]: 0 : maTextFillColor = Color( (sal_uInt32)nColor );
201 : 0 : }
202 : :
203 : 0 : void VCLXGraphics::setLineColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
204 : : {
205 [ # # ]: 0 : SolarMutexGuard aGuard;
206 : :
207 [ # # ]: 0 : maLineColor = Color( (sal_uInt32)nColor );
208 : 0 : }
209 : :
210 : 0 : void VCLXGraphics::setFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
211 : : {
212 [ # # ]: 0 : SolarMutexGuard aGuard;
213 : :
214 [ # # ]: 0 : maFillColor = Color( (sal_uInt32)nColor );
215 : 0 : }
216 : :
217 : 0 : void VCLXGraphics::setRasterOp( ::com::sun::star::awt::RasterOperation eROP ) throw(::com::sun::star::uno::RuntimeException)
218 : : {
219 [ # # ]: 0 : SolarMutexGuard aGuard;
220 : :
221 [ # # ]: 0 : meRasterOp = (RasterOp)eROP;
222 : 0 : }
223 : :
224 : 0 : void VCLXGraphics::setClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
225 : : {
226 [ # # ]: 0 : SolarMutexGuard aGuard;
227 : :
228 [ # # ][ # # ]: 0 : delete mpClipRegion;
229 [ # # ]: 0 : if ( rxRegion.is() )
230 [ # # ][ # # ]: 0 : mpClipRegion = new Region( VCLUnoHelper::GetRegion( rxRegion ) );
231 : : else
232 [ # # ]: 0 : mpClipRegion = NULL;
233 : 0 : }
234 : :
235 : 0 : void VCLXGraphics::intersectClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
236 : : {
237 [ # # ]: 0 : SolarMutexGuard aGuard;
238 : :
239 [ # # ]: 0 : if ( rxRegion.is() )
240 : : {
241 [ # # ]: 0 : Region aRegion( VCLUnoHelper::GetRegion( rxRegion ) );
242 [ # # ]: 0 : if ( !mpClipRegion )
243 [ # # ][ # # ]: 0 : mpClipRegion = new Region( aRegion );
244 : : else
245 [ # # ][ # # ]: 0 : mpClipRegion->Intersect( aRegion );
246 [ # # ]: 0 : }
247 : 0 : }
248 : :
249 : 0 : void VCLXGraphics::push( ) throw(::com::sun::star::uno::RuntimeException)
250 : : {
251 [ # # ]: 0 : SolarMutexGuard aGuard;
252 : :
253 : :
254 [ # # ]: 0 : if( mpOutputDevice )
255 [ # # ][ # # ]: 0 : mpOutputDevice->Push();
256 : 0 : }
257 : :
258 : 0 : void VCLXGraphics::pop( ) throw(::com::sun::star::uno::RuntimeException)
259 : : {
260 [ # # ]: 0 : SolarMutexGuard aGuard;
261 : :
262 : :
263 [ # # ]: 0 : if( mpOutputDevice )
264 [ # # ][ # # ]: 0 : mpOutputDevice->Pop();
265 : 0 : }
266 : :
267 : 0 : void VCLXGraphics::copy( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >& rxSource, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(::com::sun::star::uno::RuntimeException)
268 : : {
269 [ # # ]: 0 : SolarMutexGuard aGuard;
270 : :
271 [ # # ]: 0 : if ( mpOutputDevice )
272 : : {
273 : 0 : VCLXDevice* pFromDev = VCLXDevice::GetImplementation( rxSource );
274 : : DBG_ASSERT( pFromDev, "VCLXGraphics::copy - invalid device" );
275 [ # # ]: 0 : if ( pFromDev )
276 : : {
277 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP );
278 : : mpOutputDevice->DrawOutDev( Point( nDestX, nDestY ), Size( nDestWidth, nDestHeight ),
279 [ # # ]: 0 : Point( nSourceX, nSourceY ), Size( nSourceWidth, nSourceHeight ), *pFromDev->GetOutputDevice() );
280 : : }
281 [ # # ]: 0 : }
282 : 0 : }
283 : :
284 : 0 : void VCLXGraphics::draw( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap >& rxBitmapHandle, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(::com::sun::star::uno::RuntimeException)
285 : : {
286 [ # # ]: 0 : SolarMutexGuard aGuard;
287 : :
288 [ # # ]: 0 : if( mpOutputDevice )
289 : : {
290 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP);
291 [ # # ]: 0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBitmap( rxBitmapHandle, ::com::sun::star::uno::UNO_QUERY );
292 [ # # ]: 0 : BitmapEx aBmpEx = VCLUnoHelper::GetBitmap( xBitmap );
293 : :
294 : 0 : Point aPos(nDestX - nSourceX, nDestY - nSourceY);
295 : 0 : Size aSz = aBmpEx.GetSizePixel();
296 : :
297 [ # # ]: 0 : if(nDestWidth != nSourceWidth)
298 : : {
299 : 0 : float zoomX = (float)nDestWidth / (float)nSourceWidth;
300 : 0 : aSz.Width() = (long) ((float)aSz.Width() * zoomX);
301 : : }
302 : :
303 [ # # ]: 0 : if(nDestHeight != nSourceHeight)
304 : : {
305 : 0 : float zoomY = (float)nDestHeight / (float)nSourceHeight;
306 : 0 : aSz.Height() = (long) ((float)aSz.Height() * zoomY);
307 : : }
308 : :
309 [ # # ][ # # ]: 0 : if(nSourceX || nSourceY || aSz.Width() != nSourceWidth || aSz.Height() != nSourceHeight)
[ # # ][ # # ]
[ # # ]
310 [ # # ][ # # ]: 0 : mpOutputDevice->IntersectClipRegion(Region(Rectangle(nDestX, nDestY, nDestX + nDestWidth - 1, nDestY + nDestHeight - 1)));
[ # # ][ # # ]
311 : :
312 [ # # ][ # # ]: 0 : mpOutputDevice->DrawBitmapEx( aPos, aSz, aBmpEx );
313 [ # # ]: 0 : }
314 : 0 : }
315 : :
316 : 0 : void VCLXGraphics::drawPixel( sal_Int32 x, sal_Int32 y ) throw(::com::sun::star::uno::RuntimeException)
317 : : {
318 [ # # ]: 0 : SolarMutexGuard aGuard;
319 : :
320 [ # # ]: 0 : if( mpOutputDevice )
321 : : {
322 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
323 [ # # ]: 0 : mpOutputDevice->DrawPixel( Point( x, y ) );
324 [ # # ]: 0 : }
325 : 0 : }
326 : :
327 : 0 : void VCLXGraphics::drawLine( sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
328 : : {
329 [ # # ]: 0 : SolarMutexGuard aGuard;
330 : :
331 [ # # ]: 0 : if( mpOutputDevice )
332 : : {
333 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
334 [ # # ]: 0 : mpOutputDevice->DrawLine( Point( x1, y1 ), Point( x2, y2 ) );
335 [ # # ]: 0 : }
336 : 0 : }
337 : :
338 : 0 : void VCLXGraphics::drawRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(::com::sun::star::uno::RuntimeException)
339 : : {
340 [ # # ]: 0 : SolarMutexGuard aGuard;
341 : :
342 [ # # ]: 0 : if( mpOutputDevice )
343 : : {
344 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
345 [ # # ][ # # ]: 0 : mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ) );
346 [ # # ]: 0 : }
347 : 0 : }
348 : :
349 : 0 : void VCLXGraphics::drawRoundedRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 nHorzRound, sal_Int32 nVertRound ) throw(::com::sun::star::uno::RuntimeException)
350 : : {
351 [ # # ]: 0 : SolarMutexGuard aGuard;
352 : :
353 [ # # ]: 0 : if( mpOutputDevice )
354 : : {
355 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
356 [ # # ][ # # ]: 0 : mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ), nHorzRound, nVertRound );
357 [ # # ]: 0 : }
358 : 0 : }
359 : :
360 : 0 : void VCLXGraphics::drawPolyLine( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException)
361 : : {
362 [ # # ]: 0 : SolarMutexGuard aGuard;
363 : :
364 [ # # ]: 0 : if( mpOutputDevice )
365 : : {
366 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
367 [ # # ][ # # ]: 0 : mpOutputDevice->DrawPolyLine( VCLUnoHelper::CreatePolygon( DataX, DataY ) );
[ # # ]
368 [ # # ]: 0 : }
369 : 0 : }
370 : :
371 : 0 : void VCLXGraphics::drawPolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException)
372 : : {
373 [ # # ]: 0 : SolarMutexGuard aGuard;
374 : :
375 [ # # ]: 0 : if( mpOutputDevice )
376 : : {
377 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
378 [ # # ][ # # ]: 0 : mpOutputDevice->DrawPolygon( VCLUnoHelper::CreatePolygon( DataX, DataY ) );
[ # # ]
379 [ # # ]: 0 : }
380 : 0 : }
381 : :
382 : 0 : void VCLXGraphics::drawPolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataX, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataY ) throw(::com::sun::star::uno::RuntimeException)
383 : : {
384 [ # # ]: 0 : SolarMutexGuard aGuard;
385 : :
386 [ # # ]: 0 : if( mpOutputDevice )
387 : : {
388 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
389 : 0 : sal_uInt16 nPolys = (sal_uInt16) DataX.getLength();
390 [ # # ]: 0 : PolyPolygon aPolyPoly( nPolys );
391 [ # # ]: 0 : for ( sal_uInt16 n = 0; n < nPolys; n++ )
392 [ # # ][ # # ]: 0 : aPolyPoly[n] = VCLUnoHelper::CreatePolygon( DataX.getConstArray()[n], DataY.getConstArray()[n] );
[ # # ][ # # ]
393 : :
394 [ # # ][ # # ]: 0 : mpOutputDevice->DrawPolyPolygon( aPolyPoly );
395 [ # # ]: 0 : }
396 : 0 : }
397 : :
398 : 0 : void VCLXGraphics::drawEllipse( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(::com::sun::star::uno::RuntimeException)
399 : : {
400 [ # # ]: 0 : SolarMutexGuard aGuard;
401 : :
402 [ # # ]: 0 : if( mpOutputDevice )
403 : : {
404 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
405 [ # # ][ # # ]: 0 : mpOutputDevice->DrawEllipse( Rectangle( Point( x, y ), Size( width, height ) ) );
406 [ # # ]: 0 : }
407 : 0 : }
408 : :
409 : 0 : void VCLXGraphics::drawArc( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
410 : : {
411 [ # # ]: 0 : SolarMutexGuard aGuard;
412 : :
413 [ # # ]: 0 : if( mpOutputDevice )
414 : : {
415 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
416 [ # # ][ # # ]: 0 : mpOutputDevice->DrawArc( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
417 [ # # ]: 0 : }
418 : 0 : }
419 : :
420 : 0 : void VCLXGraphics::drawPie( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
421 : : {
422 [ # # ]: 0 : SolarMutexGuard aGuard;
423 : :
424 [ # # ]: 0 : if( mpOutputDevice )
425 : : {
426 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
427 [ # # ][ # # ]: 0 : mpOutputDevice->DrawPie( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
428 [ # # ]: 0 : }
429 : 0 : }
430 : :
431 : 0 : void VCLXGraphics::drawChord( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
432 : : {
433 [ # # ]: 0 : SolarMutexGuard aGuard;
434 : :
435 [ # # ]: 0 : if( mpOutputDevice )
436 : : {
437 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
438 [ # # ][ # # ]: 0 : mpOutputDevice->DrawChord( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
439 [ # # ]: 0 : }
440 : 0 : }
441 : :
442 : 0 : void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, const ::com::sun::star::awt::Gradient& rGradient ) throw(::com::sun::star::uno::RuntimeException)
443 : : {
444 [ # # ]: 0 : SolarMutexGuard aGuard;
445 : :
446 [ # # ]: 0 : if( mpOutputDevice )
447 : : {
448 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
449 [ # # ]: 0 : Gradient aGradient((GradientStyle)rGradient.Style, rGradient.StartColor, rGradient.EndColor);
450 [ # # ]: 0 : aGradient.SetAngle(rGradient.Angle);
451 [ # # ]: 0 : aGradient.SetBorder(rGradient.Border);
452 [ # # ]: 0 : aGradient.SetOfsX(rGradient.XOffset);
453 [ # # ]: 0 : aGradient.SetOfsY(rGradient.YOffset);
454 [ # # ]: 0 : aGradient.SetStartIntensity(rGradient.StartIntensity);
455 [ # # ]: 0 : aGradient.SetEndIntensity(rGradient.EndIntensity);
456 [ # # ]: 0 : aGradient.SetSteps(rGradient.StepCount);
457 [ # # ][ # # ]: 0 : mpOutputDevice->DrawGradient( Rectangle( Point( x, y ), Size( width, height ) ), aGradient );
[ # # ]
458 [ # # ]: 0 : }
459 : 0 : }
460 : :
461 : 0 : void VCLXGraphics::drawText( sal_Int32 x, sal_Int32 y, const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException)
462 : : {
463 [ # # ]: 0 : SolarMutexGuard aGuard;
464 : :
465 [ # # ]: 0 : if( mpOutputDevice )
466 : : {
467 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS |INITOUTDEV_FONT);
468 [ # # ][ # # ]: 0 : mpOutputDevice->DrawText( Point( x, y ), rText );
[ # # ]
469 [ # # ]: 0 : }
470 : 0 : }
471 : :
472 : 0 : void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const ::rtl::OUString& rText, const ::com::sun::star::uno::Sequence< sal_Int32 >& rLongs ) throw(::com::sun::star::uno::RuntimeException)
473 : : {
474 [ # # ]: 0 : SolarMutexGuard aGuard;
475 : :
476 [ # # ]: 0 : if( mpOutputDevice )
477 : : {
478 [ # # ]: 0 : InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS|INITOUTDEV_FONT );
479 [ # # ][ # # ]: 0 : mpOutputDevice->DrawTextArray( Point( x, y ), rText, rLongs.getConstArray() );
[ # # ]
480 [ # # ]: 0 : }
481 : 0 : }
482 : :
483 : :
484 : :
485 : :
486 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|