]> git.pld-linux.org Git - packages/libreoffice.git/blame - openoffice-gui-tbxcust.patch
- up
[packages/libreoffice.git] / openoffice-gui-tbxcust.patch
CommitLineData
efef92ce 1Index: sfx2/source/toolbox/tbxcust.cxx
2===================================================================
3RCS file: /cvs/framework/sfx2/source/toolbox/tbxcust.cxx,v
4retrieving revision 1.27
5diff -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
9 pMgr (pTbxMgr),
10 pImageMgr (pImgMgr),
11 bNoDefaultImage (FALSE),
12- bBigImages (FALSE),
13- nBmpColorConversion(BMP_CONVERSION_4BIT_COLORS),
14- nBmpColorDepth(4)
15+ bBigImages (FALSE)
16 {
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";
24
25 Color aColor( pImageMgr->GetMaskColor() );
26 FreeResource();
27@@ -1046,52 +1044,10 @@ SfxUserBitmapDialog_Impl::SfxUserBitmapD
28 String aEmptyStr;
29 Size aSize = pImageMgr->GetImageSize();
30
31- // #109421#
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 );
37- if ( !!aRefImage )
38- {
39- Bitmap aRefBitmap = aRefImage.GetBitmap();
40- USHORT nColorDepth = aRefBitmap.GetBitCount();
41- if ( nColorDepth == 1 )
42- {
43- nBmpColorConversion = BMP_CONVERSION_1BIT_THRESHOLD;
44- nBmpColorDepth = 1;
45- }
46- else if ( nColorDepth <= 4 )
47- {
48- nBmpColorConversion = BMP_CONVERSION_4BIT_COLORS;
49- nBmpColorDepth = 4;
50- }
51- else if ( nColorDepth <= 8 )
52- {
53- nBmpColorConversion = BMP_CONVERSION_8BIT_COLORS;
54- nBmpColorDepth = 8;
55- }
56- else
57- {
58- nBmpColorConversion = BMP_CONVERSION_24BIT;
59- nBmpColorDepth = 24;
60- }
61- }
62-
63 // Search the given directory for bitmaps:
64 Sequence< rtl::OUString > aUrls(
65 SfxContentHelper::GetFolderContents( aDirName, false ));
66 USHORT nId = 1;
67- ImageList aImages(128, 128); // large growth factor, expecting many entries
68-
69- Image aDefaultImage = GetDefaultImage( nFuncId );
70-
71- // Initially add default image to the front
72- aBitmapUrls.push_back( aEmptyStr );
73- aSymbolTb.InsertItem( nId, aEmptyStr );
74- aImages.AddImage( nId, aDefaultImage );
75-
76- ++nId;
77
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
81 {
82 rtl::OUString aFileName = aUrlObj.getName();
83
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 );
90 if ( !bIgnoreFile )
91 {
92 Bitmap aBitmap( createBitmap( rUrl ));
93-
94- // Check if we have a valid bitmap otherwise it can be possible that we can crash!!
95- if ( !!aBitmap )
96- {
97- if ( aBitmap.GetSizePixel() != aSize )
98- aBitmap.Scale( aSize, BMP_SCALE_FAST );
99-
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() );
104-
105- if (++nId == 0)
106- break;
107- }
108+
109+ if ( aBitmap.GetSizePixel() != aSize )
110+ continue;
111+
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 ) ) );
116+ nId++;
117 }
118 }
119 }
120@@ -1135,24 +1085,13 @@ SfxUserBitmapDialog_Impl::SfxUserBitmapD
121 for ( sal_Int32 i = 0; i < pOfficeImageList->GetImageCount(); i++ )
122 {
123 USHORT nImageId = pOfficeImageList->GetImageId(i);
124- aSymbolTb.InsertItem( nImageId, aEmptyStr );
125-
126- aImages.AddImage( nImageId, pOfficeImageList->GetImage( nImageId ));
127-
128- if (++nId == 0)
129- break;
130+ aSymbolTb.InsertItem( nImageId, aEmptyStr );
131+ aSymbolTb.SetItemImage( nImageId, pOfficeImageList->GetImage( nImageId ) );
132 }
133 }
134
135- // Set imagelist to the toolbox
136- aSymbolTb.SetImageList( aImages );
137-
138 LeaveWait();
139-/*
140- // Einen Button f"ur reine Textbuttons einf"ugen
141- aSymbolTb.InsertItem(nCount+1, "Text");
142- aSymbolTb.SetItemImage(nCount+1, Image());
143-*/
144+
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;
150 delete pStream;
151 }
152-
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 );
157-
158+
159 return aBitmap;
160 }
161
This page took 0.055548 seconds and 4 git commands to generate.