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 "descriptor.hxx"
31 : :
32 : : #include <osl/mutex.hxx>
33 : : #include <unotools/ucbstreamhelper.hxx>
34 : : #include <svtools/filter.hxx>
35 : : #include <svl/itemprop.hxx>
36 : : #include <comphelper/servicehelper.hxx>
37 : :
38 : : #include <com/sun/star/beans/PropertyState.hpp>
39 : : #include <com/sun/star/beans/PropertyAttribute.hpp>
40 : : #include <com/sun/star/awt/Size.hpp>
41 : : #include <com/sun/star/graphic/GraphicType.hpp>
42 : :
43 : : #include "vcl/graph.hxx"
44 : : #include "vcl/svapp.hxx"
45 : :
46 : : #define UNOGRAPHIC_GRAPHICTYPE 1
47 : : #define UNOGRAPHIC_MIMETYPE 2
48 : : #define UNOGRAPHIC_SIZEPIXEL 3
49 : : #define UNOGRAPHIC_SIZE100THMM 4
50 : : #define UNOGRAPHIC_BITSPERPIXEL 5
51 : : #define UNOGRAPHIC_TRANSPARENT 6
52 : : #define UNOGRAPHIC_ALPHA 7
53 : : #define UNOGRAPHIC_ANIMATED 8
54 : :
55 : : using namespace ::com::sun::star;
56 : :
57 : : namespace unographic {
58 : :
59 : : // ---------------------
60 : : // - GraphicDescriptor -
61 : : // ---------------------
62 : :
63 : 74707 : GraphicDescriptor::GraphicDescriptor() :
64 : : ::comphelper::PropertySetHelper( createPropertySetInfo(), SAL_NO_ACQUIRE ),
65 : : mpGraphic( NULL ),
66 : : meType( GRAPHIC_NONE ),
67 : : mnBitsPerPixel ( 0 ),
68 : : mbTransparent ( false ),
69 : : mbAlpha( false ),
70 [ + - ]: 74707 : mbAnimated( false )
71 : : {
72 : 74707 : }
73 : :
74 : : // ------------------------------------------------------------------------------
75 : :
76 : 74707 : GraphicDescriptor::~GraphicDescriptor()
77 : 74707 : throw()
78 : : {
79 [ - + ]: 74707 : }
80 : :
81 : : // ------------------------------------------------------------------------------
82 : :
83 : 74707 : void GraphicDescriptor::init( const ::Graphic& rGraphic )
84 : : throw()
85 : : {
86 : 74707 : mpGraphic = &rGraphic;
87 : 74707 : }
88 : :
89 : : // ------------------------------------------------------------------------------
90 : :
91 : 0 : void GraphicDescriptor::init( const ::rtl::OUString& rURL )
92 : : throw()
93 : : {
94 [ # # ]: 0 : SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( rURL, STREAM_READ );
95 : :
96 [ # # ]: 0 : if( pIStm )
97 : : {
98 : 0 : implCreate( *pIStm, &rURL );
99 [ # # ]: 0 : delete pIStm;
100 : : }
101 : 0 : }
102 : :
103 : : // ------------------------------------------------------------------------------
104 : :
105 : 0 : void GraphicDescriptor::init( const uno::Reference< io::XInputStream >& rxIStm, const ::rtl::OUString& rURL )
106 : : throw()
107 : : {
108 [ # # ]: 0 : SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( rxIStm );
109 : :
110 [ # # ]: 0 : if( pIStm )
111 : : {
112 : 0 : implCreate( *pIStm, &rURL );
113 [ # # ]: 0 : delete pIStm;
114 : : }
115 : 0 : }
116 : :
117 : : // ------------------------------------------------------------------------------
118 : :
119 : 0 : void GraphicDescriptor::implCreate( SvStream& rIStm, const ::rtl::OUString* pURL )
120 : : {
121 [ # # ]: 0 : String aURL;
122 [ # # ]: 0 : if( pURL )
123 [ # # ]: 0 : aURL = *pURL;
124 [ # # ]: 0 : ::GraphicDescriptor aDescriptor( rIStm, &aURL );
125 : :
126 : 0 : mpGraphic = NULL;
127 : 0 : maMimeType = ::rtl::OUString();
128 : 0 : meType = GRAPHIC_NONE;
129 : 0 : mnBitsPerPixel = 0;
130 : 0 : mbTransparent = false;
131 : :
132 [ # # ][ # # ]: 0 : if( aDescriptor.Detect( true ) && aDescriptor.GetFileFormat() != GFF_NOT )
[ # # ][ # # ]
133 : : {
134 : 0 : const char* pMimeType = NULL;
135 : 0 : sal_uInt8 cType = graphic::GraphicType::EMPTY;
136 : :
137 [ # # # # : 0 : switch( aDescriptor.GetFileFormat() )
# # # # #
# # # # #
# # # # #
# # # # #
# # ]
138 : : {
139 : 0 : case( GFF_BMP ): pMimeType = MIMETYPE_BMP; cType = graphic::GraphicType::PIXEL; break;
140 : 0 : case( GFF_GIF ): pMimeType = MIMETYPE_GIF; cType = graphic::GraphicType::PIXEL; break;
141 : 0 : case( GFF_JPG ): pMimeType = MIMETYPE_JPG; cType = graphic::GraphicType::PIXEL; break;
142 : 0 : case( GFF_PCD ): pMimeType = MIMETYPE_PCD; cType = graphic::GraphicType::PIXEL; break;
143 : 0 : case( GFF_PCX ): pMimeType = MIMETYPE_PCX; cType = graphic::GraphicType::PIXEL; break;
144 : 0 : case( GFF_PNG ): pMimeType = MIMETYPE_PNG; cType = graphic::GraphicType::PIXEL; break;
145 : 0 : case( GFF_TIF ): pMimeType = MIMETYPE_TIF; cType = graphic::GraphicType::PIXEL; break;
146 : 0 : case( GFF_XBM ): pMimeType = MIMETYPE_XBM; cType = graphic::GraphicType::PIXEL; break;
147 : 0 : case( GFF_XPM ): pMimeType = MIMETYPE_XPM; cType = graphic::GraphicType::PIXEL; break;
148 : 0 : case( GFF_PBM ): pMimeType = MIMETYPE_PBM; cType = graphic::GraphicType::PIXEL; break;
149 : 0 : case( GFF_PGM ): pMimeType = MIMETYPE_PGM; cType = graphic::GraphicType::PIXEL; break;
150 : 0 : case( GFF_PPM ): pMimeType = MIMETYPE_PPM; cType = graphic::GraphicType::PIXEL; break;
151 : 0 : case( GFF_RAS ): pMimeType = MIMETYPE_RAS; cType = graphic::GraphicType::PIXEL; break;
152 : 0 : case( GFF_TGA ): pMimeType = MIMETYPE_TGA; cType = graphic::GraphicType::PIXEL; break;
153 : 0 : case( GFF_PSD ): pMimeType = MIMETYPE_PSD; cType = graphic::GraphicType::PIXEL; break;
154 : :
155 : 0 : case( GFF_EPS ): pMimeType = MIMETYPE_EPS; cType = graphic::GraphicType::VECTOR; break;
156 : 0 : case( GFF_DXF ): pMimeType = MIMETYPE_DXF; cType = graphic::GraphicType::VECTOR; break;
157 : 0 : case( GFF_MET ): pMimeType = MIMETYPE_MET; cType = graphic::GraphicType::VECTOR; break;
158 : 0 : case( GFF_PCT ): pMimeType = MIMETYPE_PCT; cType = graphic::GraphicType::VECTOR; break;
159 : 0 : case( GFF_SGF ): pMimeType = MIMETYPE_SGF; cType = graphic::GraphicType::VECTOR; break;
160 : 0 : case( GFF_SVM ): pMimeType = MIMETYPE_SVM; cType = graphic::GraphicType::VECTOR; break;
161 : 0 : case( GFF_WMF ): pMimeType = MIMETYPE_WMF; cType = graphic::GraphicType::VECTOR; break;
162 : 0 : case( GFF_SGV ): pMimeType = MIMETYPE_SGV; cType = graphic::GraphicType::VECTOR; break;
163 : 0 : case( GFF_EMF ): pMimeType = MIMETYPE_EMF; cType = graphic::GraphicType::VECTOR; break;
164 : 0 : case( GFF_SVG ): pMimeType = MIMETYPE_SVG; cType = graphic::GraphicType::VECTOR; break;
165 : :
166 : : default:
167 : 0 : break;
168 : : }
169 : :
170 [ # # ]: 0 : if( graphic::GraphicType::EMPTY != cType )
171 : : {
172 [ # # ]: 0 : meType = ( ( graphic::GraphicType::PIXEL == cType ) ? GRAPHIC_BITMAP : GRAPHIC_GDIMETAFILE );
173 [ # # ][ # # ]: 0 : maMimeType = String( pMimeType, RTL_TEXTENCODING_ASCII_US );
[ # # ]
174 : 0 : maSizePixel = aDescriptor.GetSizePixel();
175 : 0 : maSize100thMM = aDescriptor.GetSize_100TH_MM();
176 : 0 : mnBitsPerPixel = aDescriptor.GetBitsPerPixel();
177 : 0 : mbTransparent = ( graphic::GraphicType::VECTOR == cType );
178 : 0 : mbAlpha = mbAnimated = false;
179 : : }
180 [ # # ][ # # ]: 0 : }
181 : 0 : }
182 : :
183 : : // ------------------------------------------------------------------------------
184 : :
185 : 0 : ::rtl::OUString GraphicDescriptor::getImplementationName_Static()
186 : : throw()
187 : : {
188 : 0 : return ::rtl::OUString( "com.sun.star.comp.graphic.GraphicDescriptor" );
189 : : }
190 : :
191 : : // ------------------------------------------------------------------------------
192 : :
193 : 0 : uno::Sequence< ::rtl::OUString > GraphicDescriptor::getSupportedServiceNames_Static()
194 : : throw( )
195 : : {
196 : 0 : uno::Sequence< ::rtl::OUString > aSeq( 1 );
197 : :
198 [ # # ]: 0 : aSeq.getArray()[ 0 ] = ::rtl::OUString( "com.sun.star.graphic.GraphicDescriptor" );
199 : :
200 : 0 : return aSeq;
201 : : }
202 : :
203 : : // ------------------------------------------------------------------------------
204 : :
205 : 46 : uno::Any SAL_CALL GraphicDescriptor::queryAggregation( const uno::Type & rType )
206 : : throw( uno::RuntimeException )
207 : : {
208 : 46 : uno::Any aAny;
209 : :
210 [ - + ][ + - ]: 46 : if( rType == ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0) )
211 [ # # ][ # # ]: 0 : aAny <<= uno::Reference< lang::XServiceInfo >(this);
212 [ + - ][ - + ]: 46 : else if( rType == ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0) )
213 [ # # ][ # # ]: 0 : aAny <<= uno::Reference< lang::XTypeProvider >(this);
214 [ + - ][ + + ]: 46 : else if( rType == ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) )
215 [ + - ][ + - ]: 30 : aAny <<= uno::Reference< beans::XPropertySet >(this);
216 [ + - ][ - + ]: 16 : else if( rType == ::getCppuType((const uno::Reference< beans::XPropertyState >*)0) )
217 [ # # ][ # # ]: 0 : aAny <<= uno::Reference< beans::XPropertyState >(this);
218 [ + - ][ + + ]: 16 : else if( rType == ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0) )
219 [ + - ][ + - ]: 12 : aAny <<= uno::Reference< beans::XMultiPropertySet >(this);
220 : : else
221 [ + - ][ + - ]: 4 : aAny <<= OWeakAggObject::queryAggregation( rType );
222 : :
223 : 46 : return aAny;
224 : : }
225 : :
226 : : // ------------------------------------------------------------------------------
227 : :
228 : 75073 : uno::Any SAL_CALL GraphicDescriptor::queryInterface( const uno::Type & rType )
229 : : throw( uno::RuntimeException )
230 : : {
231 : 75073 : return OWeakAggObject::queryInterface( rType );
232 : : }
233 : :
234 : : // ------------------------------------------------------------------------------
235 : :
236 : 453133 : void SAL_CALL GraphicDescriptor::acquire()
237 : : throw()
238 : : {
239 : 453133 : OWeakAggObject::acquire();
240 : 453133 : }
241 : :
242 : : // ------------------------------------------------------------------------------
243 : :
244 : 453133 : void SAL_CALL GraphicDescriptor::release()
245 : : throw()
246 : : {
247 : 453133 : OWeakAggObject::release();
248 : 453133 : }
249 : :
250 : : // ------------------------------------------------------------------------------
251 : :
252 : 0 : ::rtl::OUString SAL_CALL GraphicDescriptor::getImplementationName()
253 : : throw( uno::RuntimeException )
254 : : {
255 : 0 : return getImplementationName_Static();
256 : : }
257 : :
258 : : // ------------------------------------------------------------------------------
259 : :
260 : 0 : sal_Bool SAL_CALL GraphicDescriptor::supportsService( const rtl::OUString& ServiceName )
261 : : throw( uno::RuntimeException )
262 : : {
263 [ # # ]: 0 : uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() );
264 : 0 : const ::rtl::OUString* pArray = aSNL.getConstArray();
265 : :
266 [ # # ]: 0 : for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
267 [ # # ]: 0 : if( pArray[i] == ServiceName )
268 : 0 : return true;
269 : :
270 [ # # ]: 0 : return false;
271 : : }
272 : :
273 : : // ------------------------------------------------------------------------------
274 : :
275 : 0 : uno::Sequence< rtl::OUString > SAL_CALL GraphicDescriptor::getSupportedServiceNames()
276 : : throw( uno::RuntimeException )
277 : : {
278 : 0 : return getSupportedServiceNames_Static();
279 : : }
280 : :
281 : : // ------------------------------------------------------------------------------
282 : :
283 : 0 : uno::Sequence< uno::Type > SAL_CALL GraphicDescriptor::getTypes()
284 : : throw( uno::RuntimeException )
285 : : {
286 : 0 : uno::Sequence< uno::Type > aTypes( 6 );
287 [ # # ]: 0 : uno::Type* pTypes = aTypes.getArray();
288 : :
289 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< uno::XAggregation>*)0);
290 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo>*)0);
291 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0);
292 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet>*)0);
293 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState>*)0);
294 [ # # ]: 0 : *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet>*)0);
295 : :
296 : 0 : return aTypes;
297 : : }
298 : :
299 : : namespace
300 : : {
301 : : class theGraphicDescriptorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicDescriptorUnoTunnelId > {};
302 : : }
303 : :
304 : 0 : uno::Sequence< sal_Int8 > SAL_CALL GraphicDescriptor::getImplementationId()
305 : : throw( uno::RuntimeException )
306 : : {
307 : 0 : return theGraphicDescriptorUnoTunnelId::get().getSeq();
308 : : }
309 : :
310 : : // ------------------------------------------------------------------------------
311 : :
312 : 74707 : ::comphelper::PropertySetInfo* GraphicDescriptor::createPropertySetInfo()
313 : : {
314 [ + - ]: 74707 : SolarMutexGuard aGuard;
315 : 74707 : ::comphelper::PropertySetInfo* pRet = new ::comphelper::PropertySetInfo();
316 : :
317 : : static ::comphelper::PropertyMapEntry aEntries[] =
318 : : {
319 [ + - ]: 72 : { MAP_CHAR_LEN( "GraphicType" ), UNOGRAPHIC_GRAPHICTYPE, &::getCppuType( (const sal_Int8*)(0)), beans::PropertyAttribute::READONLY, 0 },
320 [ + - ]: 72 : { MAP_CHAR_LEN( "MimeType" ), UNOGRAPHIC_MIMETYPE, &::getCppuType( (const ::rtl::OUString*)(0)), beans::PropertyAttribute::READONLY, 0 },
321 [ + - ]: 72 : { MAP_CHAR_LEN( "SizePixel" ), UNOGRAPHIC_SIZEPIXEL, &::getCppuType( (const awt::Size*)(0)), beans::PropertyAttribute::READONLY, 0 },
322 [ + - ]: 72 : { MAP_CHAR_LEN( "Size100thMM" ), UNOGRAPHIC_SIZE100THMM, &::getCppuType( (const awt::Size*)(0)), beans::PropertyAttribute::READONLY, 0 },
323 [ + - ]: 72 : { MAP_CHAR_LEN( "BitsPerPixel" ), UNOGRAPHIC_BITSPERPIXEL, &::getCppuType( (const sal_uInt8*)(0)), beans::PropertyAttribute::READONLY, 0 },
324 [ + - ]: 72 : { MAP_CHAR_LEN( "Transparent" ), UNOGRAPHIC_TRANSPARENT, &::getCppuType( (const sal_Bool*)(0)), beans::PropertyAttribute::READONLY, 0 },
325 [ + - ]: 72 : { MAP_CHAR_LEN( "Alpha" ), UNOGRAPHIC_ALPHA, &::getCppuType( (const sal_Bool*)(0)), beans::PropertyAttribute::READONLY, 0 },
326 [ + - ]: 72 : { MAP_CHAR_LEN( "Animated" ), UNOGRAPHIC_ANIMATED, &::getCppuType( (const sal_Bool*)(0)), beans::PropertyAttribute::READONLY, 0 },
327 : :
328 : : { 0,0,0,0,0,0 }
329 [ + - ][ # # ]: 74779 : };
[ + + ]
330 : :
331 : 74707 : pRet->acquire();
332 : 74707 : pRet->add( aEntries );
333 : :
334 [ + - ]: 74707 : return pRet;
335 : : }
336 : :
337 : : // ------------------------------------------------------------------------------
338 : :
339 : 0 : void GraphicDescriptor::_setPropertyValues( const comphelper::PropertyMapEntry** /*ppEntries*/, const uno::Any* /*pValues*/ )
340 : : throw( beans::UnknownPropertyException,
341 : : beans::PropertyVetoException,
342 : : lang::IllegalArgumentException,
343 : : lang::WrappedTargetException )
344 : : {
345 : : // we only have readonly attributes
346 : 0 : }
347 : :
348 : : // ------------------------------------------------------------------------------
349 : :
350 : 45 : void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, uno::Any* pValues )
351 : : throw( beans::UnknownPropertyException, lang::WrappedTargetException )
352 : : {
353 [ + - ]: 45 : SolarMutexGuard aGuard;
354 : :
355 [ + + ]: 90 : while( *ppEntries )
356 : : {
357 [ + - + + : 45 : switch( (*ppEntries)->mnHandle )
- - - -
- ]
358 : : {
359 : : case( UNOGRAPHIC_GRAPHICTYPE ):
360 : : {
361 [ + - ][ + - ]: 3 : const GraphicType eType( mpGraphic ? mpGraphic->GetType() : meType );
362 : :
363 : : *pValues <<= ( ( eType == GRAPHIC_BITMAP ? graphic::GraphicType::PIXEL :
364 : : ( eType == GRAPHIC_GDIMETAFILE ? graphic::GraphicType::VECTOR :
365 [ - + ][ # # ]: 3 : graphic::GraphicType::EMPTY ) ) );
[ + - ]
366 : : }
367 : 3 : break;
368 : :
369 : : case( UNOGRAPHIC_MIMETYPE ):
370 : : {
371 : 0 : ::rtl::OUString aMimeType;
372 : :
373 [ # # ]: 0 : if( mpGraphic )
374 : : {
375 [ # # ][ # # ]: 0 : if( mpGraphic->IsLink() )
376 : : {
377 : : const char* pMimeType;
378 : :
379 [ # # ][ # # ]: 0 : switch( const_cast< Graphic* >( mpGraphic )->GetLink().GetType() )
[ # # ][ # #
# # # #
# ]
380 : : {
381 : 0 : case( GFX_LINK_TYPE_NATIVE_GIF ): pMimeType = MIMETYPE_GIF; break;
382 : 0 : case( GFX_LINK_TYPE_NATIVE_JPG ): pMimeType = MIMETYPE_JPG; break;
383 : 0 : case( GFX_LINK_TYPE_NATIVE_PNG ): pMimeType = MIMETYPE_PNG; break;
384 : 0 : case( GFX_LINK_TYPE_NATIVE_WMF ): pMimeType = MIMETYPE_WMF; break;
385 : 0 : case( GFX_LINK_TYPE_NATIVE_MET ): pMimeType = MIMETYPE_MET; break;
386 : 0 : case( GFX_LINK_TYPE_NATIVE_PCT ): pMimeType = MIMETYPE_PCT ; break;
387 : :
388 : : default:
389 : 0 : pMimeType = NULL;
390 : 0 : break;
391 : : }
392 : :
393 [ # # ]: 0 : if( pMimeType )
394 : 0 : aMimeType = ::rtl::OUString::createFromAscii( pMimeType );
395 : : }
396 : :
397 [ # # ][ # # ]: 0 : if( aMimeType.isEmpty() && ( mpGraphic->GetType() != GRAPHIC_NONE ) )
[ # # ][ # # ]
398 : 0 : aMimeType = ::rtl::OUString(MIMETYPE_VCLGRAPHIC );
399 : : }
400 : : else
401 : 0 : aMimeType = maMimeType;
402 : :
403 [ # # ]: 0 : *pValues <<= aMimeType;
404 : : }
405 : 0 : break;
406 : :
407 : : case( UNOGRAPHIC_SIZEPIXEL ):
408 : : {
409 : 15 : awt::Size aAWTSize( 0, 0 );
410 : :
411 [ + - ]: 15 : if( mpGraphic )
412 : : {
413 [ + - ][ + - ]: 15 : if( mpGraphic->GetType() == GRAPHIC_BITMAP )
414 : : {
415 [ + - ][ + - ]: 15 : const Size aSizePix( mpGraphic->GetBitmapEx().GetSizePixel() );
416 : 15 : aAWTSize = awt::Size( aSizePix.Width(), aSizePix.Height() );
417 : : }
418 : : }
419 : : else
420 : 0 : aAWTSize = awt::Size( maSizePixel.Width(), maSizePixel.Height() );
421 : :
422 [ + - ]: 15 : *pValues <<= aAWTSize;
423 : : }
424 : 15 : break;
425 : :
426 : : case( UNOGRAPHIC_SIZE100THMM ):
427 : : {
428 : 27 : awt::Size aAWTSize( 0, 0 );
429 : :
430 [ + - ]: 27 : if( mpGraphic )
431 : : {
432 [ + - ][ + - ]: 27 : if( mpGraphic->GetPrefMapMode().GetMapUnit() != MAP_PIXEL )
[ + + ]
433 : : {
434 [ + - ][ + - ]: 24 : const Size aSizeLog( OutputDevice::LogicToLogic( mpGraphic->GetPrefSize(), mpGraphic->GetPrefMapMode(), MAP_100TH_MM ) );
[ + - ][ + - ]
[ + - ][ + - ]
435 : 24 : aAWTSize = awt::Size( aSizeLog.Width(), aSizeLog.Height() );
436 : : }
437 : : }
438 : : else
439 : 0 : aAWTSize = awt::Size( maSize100thMM.Width(), maSize100thMM.Height() );
440 : :
441 [ + - ]: 27 : *pValues <<= aAWTSize;
442 : : }
443 : 27 : break;
444 : :
445 : : case( UNOGRAPHIC_BITSPERPIXEL ):
446 : : {
447 : 0 : sal_uInt16 nBitsPerPixel = 0;
448 : :
449 [ # # ]: 0 : if( mpGraphic )
450 : : {
451 [ # # ][ # # ]: 0 : if( mpGraphic->GetType() == GRAPHIC_BITMAP )
452 [ # # ][ # # ]: 0 : nBitsPerPixel = mpGraphic->GetBitmapEx().GetBitmap().GetBitCount();
[ # # ][ # # ]
[ # # ]
453 : : }
454 : : else
455 : 0 : nBitsPerPixel = mnBitsPerPixel;
456 : :
457 [ # # ]: 0 : *pValues <<= sal::static_int_cast< sal_Int8 >(nBitsPerPixel);
458 : : }
459 : 0 : break;
460 : :
461 : : case( UNOGRAPHIC_TRANSPARENT ):
462 : : {
463 [ # # ][ # # ]: 0 : *pValues <<= static_cast< sal_Bool >( mpGraphic ? mpGraphic->IsTransparent() : mbTransparent );
[ # # ]
464 : : }
465 : 0 : break;
466 : :
467 : : case( UNOGRAPHIC_ALPHA ):
468 : : {
469 [ # # ][ # # ]: 0 : *pValues <<= static_cast< sal_Bool >( mpGraphic ? mpGraphic->IsAlpha() : mbAlpha );
[ # # ]
470 : : }
471 : 0 : break;
472 : :
473 : : case( UNOGRAPHIC_ANIMATED ):
474 : : {
475 [ # # ][ # # ]: 0 : *pValues <<= static_cast< sal_Bool >( mpGraphic ? mpGraphic->IsAnimated() : mbAnimated );
[ # # ]
476 : : }
477 : 0 : break;
478 : : }
479 : :
480 : 45 : ++ppEntries;
481 : 45 : ++pValues;
482 [ + - ]: 45 : }
483 : 45 : }
484 : :
485 : : }
486 : :
487 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|