1 Index: sfx2/source/toolbox/tbxcust.cxx
2 ===================================================================
3 RCS file: /cvs/framework/sfx2/source/toolbox/tbxcust.cxx,v
4 retrieving revision 1.27
5 diff -u -p -u -r1.27 tbxcust.cxx
6 --- sfx2/source/toolbox/tbxcust.cxx 15 May 2003 10:54:28 -0000 1.27
7 +++ sfx2/source/toolbox/tbxcust.cxx 1 Oct 2003 16:18:43 -0000
8 @@ -1026,14 +1026,12 @@ SfxUserBitmapDialog_Impl::SfxUserBitmapD
11 bNoDefaultImage (FALSE),
13 - nBmpColorConversion(BMP_CONVERSION_4BIT_COLORS),
17 // file name prefixes for standard images
18 - const sal_Int32 nPrefixLength = 2;
19 - const char aSmallImagePrefix[] = "s_";
20 - const char aBigImagePrefix[] = "l_";
21 + const sal_Int32 nPrefixLength = 1;
22 + const char aSmallImagePrefix[] = "s";
23 + const char aBigImagePrefix[] = "l";
25 Color aColor( pImageMgr->GetMaskColor() );
27 @@ -1046,52 +1044,10 @@ SfxUserBitmapDialog_Impl::SfxUserBitmapD
29 Size aSize = pImageMgr->GetImageSize();
32 - // Get reference bitmap to determine the current color depth. Due to restriction
33 - // of the ImageList and toolbar implementation we can only use one color depth
34 - // for all bitmaps in an ImageList. Reference color depth is defined by the bitmaps
35 - // in our resources.
36 - Image aRefImage = pImageMgr->GetImage( SID_OPENDOC, BOOL(FALSE), 0 );
39 - Bitmap aRefBitmap = aRefImage.GetBitmap();
40 - USHORT nColorDepth = aRefBitmap.GetBitCount();
41 - if ( nColorDepth == 1 )
43 - nBmpColorConversion = BMP_CONVERSION_1BIT_THRESHOLD;
46 - else if ( nColorDepth <= 4 )
48 - nBmpColorConversion = BMP_CONVERSION_4BIT_COLORS;
51 - else if ( nColorDepth <= 8 )
53 - nBmpColorConversion = BMP_CONVERSION_8BIT_COLORS;
58 - nBmpColorConversion = BMP_CONVERSION_24BIT;
59 - nBmpColorDepth = 24;
63 // Search the given directory for bitmaps:
64 Sequence< rtl::OUString > aUrls(
65 SfxContentHelper::GetFolderContents( aDirName, false ));
67 - ImageList aImages(128, 128); // large growth factor, expecting many entries
69 - Image aDefaultImage = GetDefaultImage( nFuncId );
71 - // Initially add default image to the front
72 - aBitmapUrls.push_back( aEmptyStr );
73 - aSymbolTb.InsertItem( nId, aEmptyStr );
74 - aImages.AddImage( nId, aDefaultImage );
78 // Insert the default image on the first position
79 for (sal_Int32 i = 0; i < aUrls.getLength(); ++i)
80 @@ -1103,27 +1059,21 @@ SfxUserBitmapDialog_Impl::SfxUserBitmapD
82 rtl::OUString aFileName = aUrlObj.getName();
84 - // Ignore "s_*" files if we show big images and "l_*" files if we show small images!
85 - sal_Bool bIgnoreFile = bBigImages ? aFileName.matchIgnoreAsciiCaseAsciiL( aSmallImagePrefix, nPrefixLength, 0 ) :
86 - aFileName.matchIgnoreAsciiCaseAsciiL( aBigImagePrefix, nPrefixLength, 0 );
87 + // Ignore "s*" files if we show big images and "l*" files if we show small images!
88 + sal_Bool bIgnoreFile = bBigImages ? !aFileName.matchIgnoreAsciiCaseAsciiL( aBigImagePrefix, nPrefixLength, 0 ) :
89 + !aFileName.matchIgnoreAsciiCaseAsciiL( aSmallImagePrefix, nPrefixLength, 0 );
92 Bitmap aBitmap( createBitmap( rUrl ));
94 - // Check if we have a valid bitmap otherwise it can be possible that we can crash!!
97 - if ( aBitmap.GetSizePixel() != aSize )
98 - aBitmap.Scale( aSize, BMP_SCALE_FAST );
100 - // Add image to the image list which will be used to initialize toolbox
101 - aBitmapUrls.push_back( rUrl );
102 - aImages.AddImage( nId, Image( aBitmap, aColor ) );
103 - aSymbolTb.InsertItem( nId, aUrlObj.getName() );
109 + if ( aBitmap.GetSizePixel() != aSize )
112 + // Add image to the image list which will be used to initialize toolbox
113 + aBitmapUrls.push_back( rUrl );
114 + aSymbolTb.InsertItem( nId, aUrlObj.getName() );
115 + aSymbolTb.SetItemImage( nId, Image( BitmapEx( aBitmap, aColor ) ) );
120 @@ -1135,24 +1085,13 @@ SfxUserBitmapDialog_Impl::SfxUserBitmapD
121 for ( sal_Int32 i = 0; i < pOfficeImageList->GetImageCount(); i++ )
123 USHORT nImageId = pOfficeImageList->GetImageId(i);
124 - aSymbolTb.InsertItem( nImageId, aEmptyStr );
126 - aImages.AddImage( nImageId, pOfficeImageList->GetImage( nImageId ));
130 + aSymbolTb.InsertItem( nImageId, aEmptyStr );
131 + aSymbolTb.SetItemImage( nImageId, pOfficeImageList->GetImage( nImageId ) );
135 - // Set imagelist to the toolbox
136 - aSymbolTb.SetImageList( aImages );
140 - // Einen Button f"ur reine Textbuttons einf"ugen
141 - aSymbolTb.InsertItem(nCount+1, "Text");
142 - aSymbolTb.SetItemImage(nCount+1, Image());
145 aOKButton.SetClickHdl( LINK(this,SfxUserBitmapDialog_Impl, OKHdl));
146 aSymbolTb.SetSelectHdl(LINK(this,SfxUserBitmapDialog_Impl, SelectHdl));
147 aDefaultBtn.SetClickHdl(LINK(this,SfxUserBitmapDialog_Impl, DefaultHdl));
148 @@ -1325,12 +1265,7 @@ Bitmap SfxUserBitmapDialog_Impl::createB
149 (*pStream) >> aBitmap;
153 - // Convert bitmap color depth to match our resource bitmap color depth. Otherwise
154 - // we will have display problems on the screen. #109421#
155 - if ( aBitmap.GetBitCount() != nBmpColorDepth )
156 - aBitmap.Convert( nBmpColorConversion );