Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : :
21 : : #ifdef WNT
22 : :
23 : : #undef WB_LEFT
24 : : #undef WB_RIGHT
25 : :
26 : : #define UINT64 USE_WIN_UINT64
27 : : #define INT64 USE_WIN_INT64
28 : : #define UINT32 USE_WIN_UINT32
29 : : #define INT32 USE_WIN_INT32
30 : :
31 : : #include <tools/presys.h>
32 : : #if defined _MSC_VER
33 : : #pragma warning(push, 1)
34 : : #endif
35 : : #include <windows.h>
36 : : #if defined _MSC_VER
37 : : #pragma warning(pop)
38 : : #endif
39 : : #include <tools/postsys.h>
40 : :
41 : : #undef UINT64
42 : : #undef INT64
43 : : #undef UINT32
44 : : #undef INT32
45 : :
46 : : #endif
47 : : #include <com/sun/star/uno/Exception.hpp>
48 : : #include <com/sun/star/datatransfer/XTransferable.hpp>
49 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
50 : : #include <com/sun/star/graphic/GraphicProvider.hpp>
51 : : #include <com/sun/star/graphic/XGraphicProvider.hpp>
52 : : #include <com/sun/star/graphic/XGraphic.hpp>
53 : : #include <com/sun/star/io/XStream.hpp>
54 : :
55 : :
56 : : #include <osl/thread.h>
57 : : #include <vcl/gdimtf.hxx>
58 : : #include <vcl/graph.hxx>
59 : : #include <vcl/cvtgrf.hxx>
60 : : #include <vcl/outdev.hxx>
61 : : #include <vcl/virdev.hxx>
62 : : #include <vcl/bitmapex.hxx>
63 : :
64 : : #include <tools/stream.hxx>
65 : : #include <tools/helpers.hxx>
66 : : #include <unotools/tempfile.hxx>
67 : : #include <unotools/ucbstreamhelper.hxx>
68 : : #include <unotools/streamwrap.hxx>
69 : : #include <comphelper/processfactory.hxx>
70 : :
71 : :
72 : : #include "sfx2/sfxresid.hxx"
73 : : #include "graphhelp.hxx"
74 : : #include "doc.hrc"
75 : :
76 : : using namespace ::com::sun::star;
77 : :
78 : : #define THUMBNAIL_RESOLUTION 256
79 : :
80 : : //---------------------------------------------------------------
81 : : // static
82 : 0 : SvMemoryStream* GraphicHelper::getFormatStrFromGDI_Impl( const GDIMetaFile* pGDIMeta, sal_uInt32 nFormat )
83 : : {
84 : 0 : SvMemoryStream* pResult = NULL;
85 [ # # ]: 0 : if ( pGDIMeta )
86 : : {
87 [ # # ]: 0 : SvMemoryStream* pStream = new SvMemoryStream( 65535, 65535 );
88 [ # # ]: 0 : if ( pStream )
89 : : {
90 [ # # ]: 0 : Graphic aGraph( *pGDIMeta );
91 [ # # ][ # # ]: 0 : if ( GraphicConverter::Export( *pStream, aGraph, nFormat ) == 0 )
92 : 0 : pResult = pStream;
93 : : else
94 [ # # ][ # # ]: 0 : delete pStream;
[ # # ]
95 : : }
96 : : }
97 : :
98 : 0 : return pResult;
99 : : }
100 : :
101 : : //---------------------------------------------------------------
102 : : // static
103 : 0 : void* GraphicHelper::getEnhMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta )
104 : : {
105 : : (void)pGDIMeta; // unused
106 : 0 : void* pResult = NULL;
107 : :
108 : : #ifdef WNT
109 : : if ( pGDIMeta )
110 : : {
111 : : String aStr = ::rtl::OUString(".emf");
112 : : ::utl::TempFile aTempFile( ::rtl::OUString(),
113 : : &aStr,
114 : : NULL,
115 : : sal_False );
116 : :
117 : : ::rtl::OUString aMetaFile = aTempFile.GetFileName();
118 : : ::rtl::OUString aMetaURL = aTempFile.GetURL();
119 : : ::rtl::OString aWinFile = ::rtl::OUStringToOString( aMetaFile, osl_getThreadTextEncoding() );
120 : :
121 : : SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aMetaURL, STREAM_STD_READWRITE );
122 : : if ( pStream )
123 : : {
124 : : Graphic aGraph( *pGDIMeta );
125 : : sal_Bool bFailed = (sal_Bool)GraphicConverter::Export( *pStream, aGraph, CVT_EMF );
126 : : pStream->Flush();
127 : : delete pStream;
128 : :
129 : : if ( !bFailed )
130 : : pResult = GetEnhMetaFileA( aWinFile.getStr() );
131 : : }
132 : : }
133 : : #endif
134 : :
135 : 0 : return pResult;
136 : : }
137 : :
138 : : //---------------------------------------------------------------
139 : : // static
140 : 0 : void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, const Size& aMetaSize )
141 : : {
142 : : (void)pGDIMeta; // unused
143 : : (void)aMetaSize; // unused
144 : 0 : void* pResult = NULL;
145 : :
146 : : #ifdef WNT
147 : : if ( pGDIMeta )
148 : : {
149 : : SvMemoryStream* pStream = new SvMemoryStream( 65535, 65535 );
150 : : if ( pStream )
151 : : {
152 : : Graphic aGraph( *pGDIMeta );
153 : : sal_Bool bFailed = (sal_Bool)GraphicConverter::Export( *pStream, aGraph, CVT_WMF );
154 : : pStream->Flush();
155 : : if ( !bFailed )
156 : : {
157 : : sal_Int32 nLength = pStream->Seek( STREAM_SEEK_TO_END );
158 : : if ( nLength > 22 )
159 : : {
160 : : HMETAFILE hMeta = SetMetaFileBitsEx( nLength - 22,
161 : : ( reinterpret_cast< const sal_uChar*>( pStream->GetData() ) ) + 22 );
162 : :
163 : : if ( hMeta )
164 : : {
165 : : HGLOBAL hMemory = GlobalAlloc( GMEM_DDESHARE | GMEM_MOVEABLE, sizeof( METAFILEPICT ) );
166 : :
167 : : if ( hMemory )
168 : : {
169 : : METAFILEPICT* pMF = (METAFILEPICT*)GlobalLock( hMemory );
170 : :
171 : : pMF->hMF = hMeta;
172 : : pMF->mm = MM_ANISOTROPIC;
173 : :
174 : : MapMode aMetaMode = pGDIMeta->GetPrefMapMode();
175 : : MapMode aWinMode( MAP_100TH_MM );
176 : :
177 : : if ( aWinMode == pGDIMeta->GetPrefMapMode() )
178 : : {
179 : : pMF->xExt = aMetaSize.Width();
180 : : pMF->yExt = aMetaSize.Height();
181 : : }
182 : : else
183 : : {
184 : : Size aWinSize = OutputDevice::LogicToLogic( Size( aMetaSize.Width(), aMetaSize.Height() ),
185 : : pGDIMeta->GetPrefMapMode(),
186 : : aWinMode );
187 : : pMF->xExt = aWinSize.Width();
188 : : pMF->yExt = aWinSize.Height();
189 : : }
190 : :
191 : : GlobalUnlock( hMemory );
192 : : pResult = (void*)hMemory;
193 : : }
194 : : else
195 : : DeleteMetaFile( hMeta );
196 : : }
197 : : }
198 : : }
199 : :
200 : : delete pStream;
201 : : }
202 : : }
203 : :
204 : : #endif
205 : :
206 : :
207 : 0 : return pResult;
208 : : }
209 : :
210 : : //---------------------------------------------------------------
211 : : // static
212 : 0 : sal_Bool GraphicHelper::supportsMetaFileHandle_Impl()
213 : : {
214 : : #ifdef WNT
215 : : return sal_True;
216 : : #else
217 : 0 : return sal_False;
218 : : #endif
219 : : }
220 : :
221 : : //---------------------------------------------------------------
222 : : // static
223 : 0 : sal_Bool GraphicHelper::mergeBitmaps_Impl( const BitmapEx& rBmpEx, const BitmapEx& rOverlay,
224 : : const Rectangle& rOverlayRect, BitmapEx& rReturn )
225 : : {
226 : : // the implementation is provided by KA
227 : :
228 : 0 : Point aNullPt;
229 [ # # ]: 0 : Rectangle aBmpRect( aNullPt, rBmpEx.GetSizePixel() );
230 [ # # ]: 0 : VirtualDevice aVDev;
231 : :
232 [ # # ][ # # ]: 0 : if( !rReturn.IsEmpty() )
233 [ # # ]: 0 : rReturn.SetEmpty();
234 : :
235 [ # # ][ # # ]: 0 : if( !rBmpEx.IsEmpty() && aVDev.SetOutputSizePixel( aBmpRect.GetSize() ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # # ]
236 : : {
237 : 0 : Rectangle aOverlayRect( rOverlayRect );
238 : :
239 [ # # ]: 0 : aOverlayRect.Intersection( aBmpRect );
240 : :
241 [ # # ][ # # ]: 0 : if( rOverlay.IsEmpty() || rOverlayRect.IsEmpty() )
[ # # ][ # # ]
[ # # ]
242 [ # # ]: 0 : rReturn = rBmpEx;
243 : : else
244 : : {
245 [ # # ][ # # ]: 0 : aVDev.DrawBitmap( aNullPt, aVDev.GetOutputSizePixel(), rBmpEx.GetBitmap() );
[ # # ]
246 [ # # ][ # # ]: 0 : aVDev.DrawBitmapEx( aOverlayRect.TopLeft(), aOverlayRect.GetSize(), rOverlay );
247 : :
248 [ # # ]: 0 : Bitmap aBmp( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) );
249 [ # # ]: 0 : aBmp.Convert( BMP_CONVERSION_24BIT );
250 : :
251 [ # # ][ # # ]: 0 : if( !rBmpEx.IsTransparent() )
252 [ # # ][ # # ]: 0 : rReturn = aBmp;
[ # # ]
253 : : else
254 : : {
255 [ # # ][ # # ]: 0 : aVDev.DrawBitmap( aNullPt, aVDev.GetOutputSizePixel(), rBmpEx.GetMask() );
[ # # ]
256 [ # # ][ # # ]: 0 : Bitmap aOverlayMergeBmp( aVDev.GetBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize() ) );
257 : :
258 [ # # ][ # # ]: 0 : if( rOverlay.IsTransparent() )
259 [ # # ][ # # ]: 0 : aVDev.DrawBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize(), rOverlay.GetMask() );
[ # # ][ # # ]
260 : : else
261 : : {
262 [ # # ]: 0 : aVDev.SetLineColor( COL_BLACK );
263 [ # # ]: 0 : aVDev.SetFillColor( COL_BLACK );
264 [ # # ]: 0 : aVDev.DrawRect( aOverlayRect);
265 : : }
266 : :
267 [ # # ][ # # ]: 0 : aOverlayMergeBmp.CombineSimple( aVDev.GetBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize() ), BMP_COMBINE_AND );
[ # # ][ # # ]
268 [ # # ][ # # ]: 0 : aVDev.DrawBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize(), aOverlayMergeBmp );
269 [ # # ][ # # ]: 0 : rReturn = BitmapEx( aBmp, aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) );
[ # # ][ # # ]
[ # # ][ # # ]
270 [ # # ]: 0 : }
271 : : }
272 : : }
273 : :
274 [ # # ][ # # ]: 0 : return !rReturn.IsEmpty();
275 : : }
276 : :
277 : :
278 : : //---------------------------------------------------------------
279 : : // static
280 : 31 : sal_Bool GraphicHelper::createThumb_Impl( const GDIMetaFile& rMtf,
281 : : sal_uInt32 nMaximumExtent,
282 : : BitmapEx& rBmpEx,
283 : : const BitmapEx* pOverlay,
284 : : const Rectangle* pOverlayRect )
285 : : {
286 : : // the implementation is provided by KA
287 : :
288 : : // initialization seems to be complicated but is used to avoid rounding errors
289 [ + - ]: 31 : VirtualDevice aVDev;
290 : 31 : const Point aNullPt;
291 [ + - ]: 31 : const Point aTLPix( aVDev.LogicToPixel( aNullPt, rMtf.GetPrefMapMode() ) );
292 [ + - ]: 31 : const Point aBRPix( aVDev.LogicToPixel( Point( rMtf.GetPrefSize().Width() - 1, rMtf.GetPrefSize().Height() - 1 ), rMtf.GetPrefMapMode() ) );
293 [ + - ]: 31 : Size aDrawSize( aVDev.LogicToPixel( rMtf.GetPrefSize(), rMtf.GetPrefMapMode() ) );
294 : 31 : Size aSizePix( labs( aBRPix.X() - aTLPix.X() ) + 1, labs( aBRPix.Y() - aTLPix.Y() ) + 1 );
295 : 31 : Point aPosPix;
296 : :
297 [ - + ][ + - ]: 31 : if ( !rBmpEx.IsEmpty() )
298 [ # # ]: 0 : rBmpEx.SetEmpty();
299 : :
300 : : // determine size that has the same aspect ratio as image size and
301 : : // fits into the rectangle determined by nMaximumExtent
302 [ + - ][ + - : 62 : if ( aSizePix.Width() && aSizePix.Height() &&
- + # # ]
[ + - ]
303 : 31 : ( sal::static_int_cast<sal_uInt32>(aSizePix.Width()) > nMaximumExtent ||
304 : 0 : sal::static_int_cast<sal_uInt32>(aSizePix.Height()) > nMaximumExtent ) )
305 : : {
306 : 31 : const Size aOldSizePix( aSizePix );
307 : 31 : double fWH = static_cast< double >( aSizePix.Width() ) / aSizePix.Height();
308 : :
309 [ + + ]: 31 : if ( fWH <= 1.0 )
310 : : {
311 : 27 : aSizePix.Width() = FRound( nMaximumExtent * fWH );
312 : 27 : aSizePix.Height() = nMaximumExtent;
313 : : }
314 : : else
315 : : {
316 : 4 : aSizePix.Width() = nMaximumExtent;
317 : 4 : aSizePix.Height() = FRound( nMaximumExtent / fWH );
318 : : }
319 : :
320 : 31 : aDrawSize.Width() = FRound( ( static_cast< double >( aDrawSize.Width() ) * aSizePix.Width() ) / aOldSizePix.Width() );
321 : 31 : aDrawSize.Height() = FRound( ( static_cast< double >( aDrawSize.Height() ) * aSizePix.Height() ) / aOldSizePix.Height() );
322 : : }
323 : :
324 : 31 : Size aFullSize;
325 : 31 : Point aBackPosPix;
326 [ + - ]: 31 : Rectangle aOverlayRect;
327 : :
328 : : // calculate addigtional positions and sizes if an overlay image is used
329 [ - + ]: 31 : if ( pOverlay )
330 : : {
331 : 0 : aFullSize = Size( nMaximumExtent, nMaximumExtent );
332 [ # # ]: 0 : aOverlayRect = Rectangle( aNullPt, aFullSize );
333 : :
334 [ # # ][ # # ]: 0 : aOverlayRect.Intersection( pOverlayRect ? *pOverlayRect : Rectangle( aNullPt, pOverlay->GetSizePixel() ) );
[ # # ]
335 : :
336 [ # # ][ # # ]: 0 : if ( !aOverlayRect.IsEmpty() )
337 : 0 : aBackPosPix = Point( ( nMaximumExtent - aSizePix.Width() ) >> 1, ( nMaximumExtent - aSizePix.Height() ) >> 1 );
338 : : else
339 : 0 : pOverlay = NULL;
340 : : }
341 : : else
342 : : {
343 : 31 : aFullSize = aSizePix;
344 : 31 : pOverlay = NULL;
345 : : }
346 : :
347 : : // draw image(s) into VDev and get resulting image
348 [ + - ][ + - ]: 31 : if ( aVDev.SetOutputSizePixel( aFullSize ) )
349 : : {
350 : : // draw metafile into VDev
351 [ + - ]: 31 : const_cast< GDIMetaFile& >( rMtf ).WindStart();
352 [ + - ]: 31 : const_cast< GDIMetaFile& >( rMtf ).Play( &aVDev, aBackPosPix, aDrawSize );
353 : :
354 : : // draw overlay if neccessary
355 [ - + ]: 31 : if ( pOverlay )
356 [ # # ][ # # ]: 0 : aVDev.DrawBitmapEx( aOverlayRect.TopLeft(), aOverlayRect.GetSize(), *pOverlay );
357 : :
358 : : // get paint bitmap
359 [ + - ]: 31 : Bitmap aBmp( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) );
360 : :
361 : : // assure that we have a true color image
362 [ + - ][ - + ]: 31 : if ( aBmp.GetBitCount() != 24 )
363 [ # # ]: 0 : aBmp.Convert( BMP_CONVERSION_24BIT );
364 : :
365 [ + - ][ + - ]: 31 : rBmpEx = BitmapEx( aBmp );
[ + - ][ + - ]
366 : : }
367 : :
368 [ + - ][ + - ]: 31 : return !rBmpEx.IsEmpty();
369 : : }
370 : :
371 : : //---------------------------------------------------------------
372 : : // static
373 : 31 : sal_Bool GraphicHelper::getThumbnailFormatFromGDI_Impl( GDIMetaFile* pMetaFile,
374 : : sal_Bool bSigned,
375 : : const uno::Reference< io::XStream >& xStream )
376 : : {
377 : 31 : sal_Bool bResult = sal_False;
378 : 31 : SvStream* pStream = NULL;
379 : :
380 [ + - ]: 31 : if ( xStream.is() )
381 [ + - ]: 31 : pStream = ::utl::UcbStreamHelper::CreateStream( xStream );
382 : :
383 [ + - ][ + - ]: 31 : if ( pMetaFile && pStream && !pStream->GetError() )
[ + - ][ + - ]
384 : : {
385 [ + - ]: 31 : BitmapEx aResultBitmap;
386 : 31 : BitmapEx* pSignatureBitmap = NULL;
387 : :
388 [ - + ]: 31 : if ( bSigned )
389 [ # # ][ # # ]: 0 : pSignatureBitmap = new BitmapEx( SfxResId( BMP_SIGNATURE ) );
[ # # ]
390 : :
391 : : bResult = createThumb_Impl( *pMetaFile,
392 : : THUMBNAIL_RESOLUTION,
393 : : aResultBitmap,
394 [ + - ]: 31 : pSignatureBitmap );
395 [ + - ]: 31 : if ( bResult )
396 [ + - ]: 31 : bResult = ( !aResultBitmap.IsEmpty()
397 [ + - ][ + - ]: 62 : && GraphicConverter::Export( *pStream, aResultBitmap, CVT_PNG ) == 0
[ + - ][ + - ]
[ # # ]
398 [ + - ][ + - ]: 62 : && ( pStream->Flush(), !pStream->GetError() ) );
[ + - ][ + - ]
399 : :
400 [ - + ]: 31 : if ( pSignatureBitmap )
401 [ # # ][ # # ]: 0 : delete pSignatureBitmap;
402 : :
403 [ + - ][ + - ]: 31 : delete pStream;
[ + - ]
404 : : }
405 : :
406 : 31 : return bResult;
407 : : }
408 : :
409 : : //---------------------------------------------------------------
410 : : // static
411 : 0 : sal_Bool GraphicHelper::getSignedThumbnailFormatFromBitmap_Impl( const BitmapEx& aBitmap,
412 : : const uno::Reference< io::XStream >& xStream )
413 : : {
414 : 0 : sal_Bool bResult = sal_False;
415 : 0 : SvStream* pStream = NULL;
416 : :
417 [ # # ]: 0 : if ( xStream.is() )
418 [ # # ]: 0 : pStream = ::utl::UcbStreamHelper::CreateStream( xStream );
419 : :
420 [ # # ][ # # ]: 0 : if ( pStream && !pStream->GetError() )
[ # # ]
421 : : {
422 [ # # ]: 0 : BitmapEx aResultBitmap;
423 [ # # ][ # # ]: 0 : BitmapEx aSignatureBitmap( SfxResId( BMP_SIGNATURE ) );
424 : :
425 : : bResult = mergeBitmaps_Impl( aBitmap,
426 : : aSignatureBitmap,
427 : 0 : Rectangle( Point(), aBitmap.GetSizePixel() ),
428 [ # # ][ # # ]: 0 : aResultBitmap );
429 : :
430 [ # # ]: 0 : if ( bResult )
431 : : {
432 [ # # ]: 0 : bResult = ( !aResultBitmap.IsEmpty()
433 [ # # ][ # # ]: 0 : && GraphicConverter::Export( *pStream, aResultBitmap, CVT_PNG ) == 0
[ # # ][ # # ]
[ # # ]
434 [ # # ][ # # ]: 0 : && ( pStream->Flush(), !pStream->GetError() ) );
[ # # ][ # # ]
435 : : }
436 : :
437 [ # # ][ # # ]: 0 : delete pStream;
[ # # ][ # # ]
438 : : }
439 : :
440 : 0 : return bResult;
441 : : }
442 : :
443 : : //---------------------------------------------------------------
444 : : // static
445 : 0 : sal_Bool GraphicHelper::getThumbnailReplacement_Impl( sal_Int32 nResID, const uno::Reference< io::XStream >& xStream )
446 : : {
447 : 0 : sal_Bool bResult = sal_False;
448 [ # # ][ # # ]: 0 : if ( nResID && xStream.is() )
[ # # ]
449 : : {
450 [ # # ]: 0 : uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
451 : : try
452 : : {
453 [ # # ]: 0 : uno::Reference< graphic::XGraphicProvider > xGraphProvider(graphic::GraphicProvider::create(xContext));
454 : 0 : ::rtl::OUString aURL("private:resource/sfx/bitmapex/");
455 : 0 : aURL += ::rtl::OUString::valueOf( nResID );
456 : :
457 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
458 [ # # ]: 0 : aMediaProps[0].Name = "URL";
459 [ # # ][ # # ]: 0 : aMediaProps[0].Value <<= aURL;
460 : :
461 [ # # ][ # # ]: 0 : uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( aMediaProps );
462 [ # # ]: 0 : if ( xGraphic.is() )
463 : : {
464 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aStoreProps( 2 );
465 [ # # ]: 0 : aStoreProps[0].Name = "OutputStream";
466 [ # # ][ # # ]: 0 : aStoreProps[0].Value <<= xStream;
467 [ # # ]: 0 : aStoreProps[1].Name = "MimeType";
468 [ # # ][ # # ]: 0 : aStoreProps[1].Value <<= ::rtl::OUString("image/png");
469 : :
470 [ # # ][ # # ]: 0 : xGraphProvider->storeGraphic( xGraphic, aStoreProps );
471 [ # # ]: 0 : bResult = sal_True;
472 [ # # ][ # # ]: 0 : }
473 : : }
474 [ # # ]: 0 : catch(const uno::Exception&)
475 : : {
476 : 0 : }
477 : : }
478 : :
479 : 0 : return bResult;
480 : : }
481 : :
482 : : //---------------------------------------------------------------
483 : : // static
484 : 0 : sal_uInt16 GraphicHelper::getThumbnailReplacementIDByFactoryName_Impl( const ::rtl::OUString& aFactoryShortName, sal_Bool /*bIsTemplate*/ )
485 : : {
486 : 0 : sal_uInt16 nResult = 0;
487 : :
488 [ # # ]: 0 : if ( aFactoryShortName == "scalc" )
489 : : {
490 : 0 : nResult = BMP_128X128_CALC_DOC;
491 : : }
492 [ # # ]: 0 : else if ( aFactoryShortName == "sdraw" )
493 : : {
494 : 0 : nResult = BMP_128X128_DRAW_DOC;
495 : : }
496 [ # # ]: 0 : else if ( aFactoryShortName == "simpress" )
497 : : {
498 : 0 : nResult = BMP_128X128_IMPRESS_DOC;
499 : : }
500 [ # # ]: 0 : else if ( aFactoryShortName == "smath" )
501 : : {
502 : 0 : nResult = BMP_128X128_MATH_DOC;
503 : : }
504 [ # # ][ # # ]: 0 : else if ( aFactoryShortName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "swriter" ) ) || aFactoryShortName.compareToAscii( "swriter/", 8 ) == 0 )
[ # # ]
505 : : {
506 : 0 : nResult = BMP_128X128_WRITER_DOC;
507 : : }
508 : :
509 : 0 : return nResult;
510 : : }
511 : :
512 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|