Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / svx / source / xoutdev / xtabcolr.cxx
blobc3ab8e6d97a2c188cca6a38a02e644ed2445ac71
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
30 #include "svx/XPropertyTable.hxx"
31 #include <unotools/pathoptions.hxx>
33 #include <svx/dialogs.hrc>
34 #include <svx/dialmgr.hxx>
35 #include <svx/xtable.hxx>
36 #include <svx/xpool.hxx>
38 using namespace com::sun::star;
41 XColorListRef XColorList::CreateStdColorList()
43 return XPropertyList::CreatePropertyList(
44 XCOLOR_LIST, SvtPathOptions().GetPalettePath() )->AsColorList();
47 XColorListRef XColorList::GetStdColorList()
49 static XColorListRef aTable( CreateStdColorList() );
50 return aTable;
53 XColorEntry* XColorList::Replace(long nIndex, XColorEntry* pEntry )
55 return (XColorEntry*)XPropertyList::Replace( pEntry, nIndex );
58 XColorEntry* XColorList::Remove(long nIndex)
60 return (XColorEntry*) XPropertyList::Remove(nIndex);
63 XColorEntry* XColorList::GetColor(long nIndex) const
65 return (XColorEntry*) XPropertyList::Get(nIndex, 0);
68 uno::Reference< container::XNameContainer > XColorList::createInstance()
70 return uno::Reference< container::XNameContainer >(
71 SvxUnoXColorTable_createInstance( this ),
72 uno::UNO_QUERY );
75 sal_Bool XColorList::Create()
77 XubString aStr;
78 xub_StrLen nLen;
79 ResMgr& rRes = DIALOG_MGR();
81 static sal_uInt16 aResId[] =
83 RID_SVXSTR_BLACK,
84 RID_SVXSTR_BLUE,
85 RID_SVXSTR_GREEN,
86 RID_SVXSTR_CYAN,
87 RID_SVXSTR_RED,
88 RID_SVXSTR_MAGENTA,
89 RID_SVXSTR_BROWN,
90 RID_SVXSTR_GREY,
91 RID_SVXSTR_LIGHTGREY,
92 RID_SVXSTR_LIGHTBLUE,
93 RID_SVXSTR_LIGHTGREEN,
94 RID_SVXSTR_LIGHTCYAN,
95 RID_SVXSTR_LIGHTRED,
96 RID_SVXSTR_LIGHTMAGENTA,
97 RID_SVXSTR_YELLOW,
98 RID_SVXSTR_WHITE
101 // MT: COL_XXX ist in VCL kein enum mehr!!!
102 // COL_WHITE ist seeeehr gross! ( => Zugriff ueber das obige Array hinweg )
103 // Mit der unteren Schleife gibt es keinen Absturtz, aber es ist
104 // alles schwarz, weil alles kleine Werte.
105 // Ausserdem ist die ganze Vorgehensweise laut MM sehr unperformant
106 // => lieber gleich Stringlisten laden.
108 // BM: ifndef VCL part removed (deprecated)
110 static ColorData const aColTab[] =
112 COL_BLACK,
113 COL_BLUE,
114 COL_GREEN,
115 COL_CYAN,
116 COL_RED,
117 COL_MAGENTA,
118 COL_BROWN,
119 COL_GRAY,
120 COL_LIGHTGRAY,
121 COL_LIGHTBLUE,
122 COL_LIGHTGREEN,
123 COL_LIGHTCYAN,
124 COL_LIGHTRED,
125 COL_LIGHTMAGENTA,
126 COL_YELLOW,
127 COL_WHITE
130 for( sal_uInt16 n = 0; n < 16; ++n )
132 Insert( new XColorEntry(
133 Color( aColTab[n] ),
134 String( ResId( aResId[ n ], rRes ) )
140 aStr = SVX_RESSTR( RID_SVXSTR_GREY );
141 aStr.AppendAscii(" 80%");
142 nLen = aStr.Len() - 3;
143 Insert( new XColorEntry( Color( 51, 51, 51 ), aStr ), 16 );
144 aStr.SetChar(nLen, sal_Unicode('7'));
145 Insert( new XColorEntry( Color( 76, 76, 76 ), aStr ), 17 );
146 aStr.SetChar(nLen, sal_Unicode('6'));
147 Insert( new XColorEntry( Color(102,102,102 ), aStr ), 18 );
148 aStr.SetChar(nLen, sal_Unicode('4'));
149 Insert( new XColorEntry( Color(153,153,153 ), aStr ), 19 );
150 aStr.SetChar(nLen, sal_Unicode('3'));
151 Insert( new XColorEntry( Color(179,179,179 ), aStr ), 20 );
152 aStr.SetChar(nLen, sal_Unicode('2'));
153 Insert( new XColorEntry( Color(204,204,204 ), aStr ), 21 );
154 // BM: new 15%
155 aStr.SetChar(nLen, sal_Unicode('1'));
156 aStr.SetChar(nLen + 1, sal_Unicode('5'));
157 Insert( new XColorEntry( Color(217,217,217 ), aStr ), 22 );
158 aStr.SetChar(nLen + 1, sal_Unicode('0'));
159 Insert( new XColorEntry( Color(230,230,230 ), aStr ), 23 );
160 Insert( new XColorEntry( Color(230,230,255 ), SVX_RESSTR( RID_SVXSTR_BLUEGREY ) ), 24 );
162 aStr = SVX_RESSTR( RID_SVXSTR_RED );
163 aStr.AppendAscii(" 1");
164 nLen = aStr.Len() - 1;
165 Insert( new XColorEntry( Color(255, 51,102 ), aStr ), 25 );
166 aStr.SetChar(nLen, sal_Unicode('2'));
167 Insert( new XColorEntry( Color(220, 35, 0 ), aStr ), 26 );
168 aStr.SetChar(nLen, sal_Unicode('3'));
169 Insert( new XColorEntry( Color(184, 71, 0 ), aStr ), 27 );
170 aStr.SetChar(nLen, sal_Unicode('4'));
171 Insert( new XColorEntry( Color(255, 51, 51 ), aStr ), 28 );
172 aStr.SetChar(nLen, sal_Unicode('5'));
173 Insert( new XColorEntry( Color(235, 97, 61 ), aStr ), 29 );
174 aStr.SetChar(nLen, sal_Unicode('6'));
175 Insert( new XColorEntry( Color(184, 71, 71 ), aStr ), 30 );
176 aStr.SetChar(nLen, sal_Unicode('7'));
177 Insert( new XColorEntry( Color(184, 0, 71 ), aStr ), 31 );
178 aStr.SetChar(nLen, sal_Unicode('8'));
179 Insert( new XColorEntry( Color(153, 40, 76 ), aStr ), 32 );
181 aStr = SVX_RESSTR( RID_SVXSTR_MAGENTA );
182 aStr.AppendAscii(" 1");
183 nLen = aStr.Len() - 1;
184 Insert( new XColorEntry( Color(148, 0,107 ), aStr ), 33 );
185 aStr.SetChar(nLen, sal_Unicode('2'));
186 Insert( new XColorEntry( Color(148, 71,107 ), aStr ), 34 );
187 aStr.SetChar(nLen, sal_Unicode('3'));
188 Insert( new XColorEntry( Color(148, 71,148 ), aStr ), 35 );
189 aStr.SetChar(nLen, sal_Unicode('4'));
190 Insert( new XColorEntry( Color(153,102,204 ), aStr ), 36 );
191 aStr.SetChar(nLen, sal_Unicode('5'));
192 Insert( new XColorEntry( Color(107, 71,148 ), aStr ), 37 );
193 aStr.SetChar(nLen, sal_Unicode('6'));
194 Insert( new XColorEntry( Color(107, 35,148 ), aStr ), 38 );
195 aStr.SetChar(nLen, sal_Unicode('7'));
196 Insert( new XColorEntry( Color(107, 0,148 ), aStr ), 39 );
197 aStr.SetChar(nLen, sal_Unicode('8'));
198 Insert( new XColorEntry( Color( 94, 17,166 ), aStr ), 40 );
200 aStr = SVX_RESSTR( RID_SVXSTR_BLUE );
201 aStr.AppendAscii(" 1");
202 nLen = aStr.Len() - 1;
203 Insert( new XColorEntry( Color( 40, 0,153 ), aStr ), 41 );
204 aStr.SetChar(nLen, sal_Unicode('2'));
205 Insert( new XColorEntry( Color( 71, 0,184 ), aStr ), 42 );
206 aStr.SetChar(nLen, sal_Unicode('3'));
207 Insert( new XColorEntry( Color( 35, 0,220 ), aStr ), 43 );
208 aStr.SetChar(nLen, sal_Unicode('4'));
209 Insert( new XColorEntry( Color( 35, 35,220 ), aStr ), 44 );
210 aStr.SetChar(nLen, sal_Unicode('5'));
211 Insert( new XColorEntry( Color( 0, 71,255 ), aStr ), 45 );
212 aStr.SetChar(nLen, sal_Unicode('6'));
213 Insert( new XColorEntry( Color( 0,153,255 ), aStr ), 46 );
214 aStr.SetChar(nLen, sal_Unicode('7'));
215 Insert( new XColorEntry( Color( 0,184,255 ), aStr ), 47 );
216 aStr.SetChar(nLen, sal_Unicode('8'));
217 Insert( new XColorEntry( Color(153,204,255 ), aStr ), 48 );
219 aStr = SVX_RESSTR( RID_SVXSTR_CYAN );
220 aStr.AppendAscii(" 1");
221 nLen = aStr.Len() - 1;
222 Insert( new XColorEntry( Color( 0,220,255 ), aStr ), 49 );
223 aStr.SetChar(nLen, sal_Unicode('2'));
224 Insert( new XColorEntry( Color( 0,204,204 ), aStr ), 50 );
225 aStr.SetChar(nLen, sal_Unicode('3'));
226 Insert( new XColorEntry( Color( 35,184,220 ), aStr ), 51 );
227 aStr.SetChar(nLen, sal_Unicode('4'));
228 Insert( new XColorEntry( Color( 71,184,184 ), aStr ), 52 );
229 aStr.SetChar(nLen, sal_Unicode('5'));
230 Insert( new XColorEntry( Color( 51,163,163 ), aStr ), 53 );
231 aStr.SetChar(nLen, sal_Unicode('6'));
232 Insert( new XColorEntry( Color( 25,138,138 ), aStr ), 54 );
233 aStr.SetChar(nLen, sal_Unicode('7'));
234 Insert( new XColorEntry( Color( 0,107,107 ), aStr ), 55 );
235 aStr.SetChar(nLen, sal_Unicode('8'));
236 Insert( new XColorEntry( Color( 0, 74, 74 ), aStr ), 56 );
238 aStr = SVX_RESSTR( RID_SVXSTR_GREEN );
239 aStr.AppendAscii(" 1");
240 nLen = aStr.Len() - 1;
241 Insert( new XColorEntry( Color( 53, 94, 0 ), aStr ), 57 );
242 aStr.SetChar(nLen, sal_Unicode('2'));
243 Insert( new XColorEntry( Color( 92,133, 38 ), aStr ), 58 );
244 aStr.SetChar(nLen, sal_Unicode('3'));
245 Insert( new XColorEntry( Color(125,166, 71 ), aStr ), 59 );
246 aStr.SetChar(nLen, sal_Unicode('4'));
247 Insert( new XColorEntry( Color(148,189, 94 ), aStr ), 60 );
248 aStr.SetChar(nLen, sal_Unicode('5'));
249 Insert( new XColorEntry( Color( 0,174, 0 ), aStr ), 61 );
250 aStr.SetChar(nLen, sal_Unicode('6'));
251 Insert( new XColorEntry( Color( 51,204,102 ), aStr ), 62 );
252 aStr.SetChar(nLen, sal_Unicode('7'));
253 Insert( new XColorEntry( Color( 61,235, 61 ), aStr ), 63 );
254 aStr.SetChar(nLen, sal_Unicode('8'));
255 Insert( new XColorEntry( Color( 35,255, 35 ), aStr ), 64 );
257 aStr = SVX_RESSTR( RID_SVXSTR_YELLOW );
258 aStr.AppendAscii(" 1");
259 nLen = aStr.Len() - 1;
260 Insert( new XColorEntry( Color(230,255, 0 ), aStr ), 65 );
261 aStr.SetChar(nLen, sal_Unicode('2'));
262 Insert( new XColorEntry( Color(255,255,153 ), aStr ), 66 );
263 aStr.SetChar(nLen, sal_Unicode('3'));
264 Insert( new XColorEntry( Color(255,255,102 ), aStr ), 67 );
265 aStr.SetChar(nLen, sal_Unicode('4'));
266 Insert( new XColorEntry( Color(230,230, 76 ), aStr ), 68 );
267 aStr.SetChar(nLen, sal_Unicode('5'));
268 Insert( new XColorEntry( Color(204,204, 0 ), aStr ), 69 );
269 aStr.SetChar(nLen, sal_Unicode('6'));
270 Insert( new XColorEntry( Color(179,179, 0 ), aStr ), 70 );
271 aStr.SetChar(nLen, sal_Unicode('7'));
272 Insert( new XColorEntry( Color(128,128, 25 ), aStr ), 71 );
273 aStr.SetChar(nLen, sal_Unicode('8'));
274 Insert( new XColorEntry( Color(102,102, 0 ), aStr ), 72 );
276 aStr = SVX_RESSTR( RID_SVXSTR_BROWN );
277 aStr.AppendAscii(" 1");
278 nLen = aStr.Len() - 1;
279 Insert( new XColorEntry( Color( 76, 25, 0 ), aStr ), 73 );
280 aStr.SetChar(nLen, sal_Unicode('2'));
281 Insert( new XColorEntry( Color(102, 51, 0 ), aStr ), 74 );
282 aStr.SetChar(nLen, sal_Unicode('3'));
283 Insert( new XColorEntry( Color(128, 76, 25 ), aStr ), 75 );
284 aStr.SetChar(nLen, sal_Unicode('4'));
285 Insert( new XColorEntry( Color(153,102, 51 ), aStr ), 76 );
287 aStr = SVX_RESSTR( RID_SVXSTR_ORANGE );
288 aStr.AppendAscii(" 1");
289 nLen = aStr.Len() - 1;
290 Insert( new XColorEntry( Color(204,102, 51 ), aStr ), 77 );
291 aStr.SetChar(nLen, sal_Unicode('2'));
292 Insert( new XColorEntry( Color(255,102, 51 ), aStr ), 78 );
293 aStr.SetChar(nLen, sal_Unicode('3'));
294 Insert( new XColorEntry( Color(255,153,102 ), aStr ), 79 );
295 aStr.SetChar(nLen, sal_Unicode('4'));
296 Insert( new XColorEntry( Color(255,204,153 ), aStr ), 80 );
298 // new chart colors
299 aStr = SVX_RESSTR( RID_SVXSTR_VIOLET );
300 Insert( new XColorEntry( Color( 0x99, 0x99, 0xff ), aStr ), 81 );
302 aStr = SVX_RESSTR( RID_SVXSTR_BORDEAUX );
303 Insert( new XColorEntry( Color( 0x99, 0x33, 0x66 ), aStr ), 82 );
305 aStr = SVX_RESSTR( RID_SVXSTR_PALE_YELLOW );
306 Insert( new XColorEntry( Color( 0xff, 0xff, 0xcc ), aStr ), 83 );
308 aStr = SVX_RESSTR( RID_SVXSTR_PALE_GREEN );
309 Insert( new XColorEntry( Color( 0xcc, 0xff, 0xff ), aStr ), 84 );
311 aStr = SVX_RESSTR( RID_SVXSTR_DKVIOLET );
312 Insert( new XColorEntry( Color( 0x66, 0x00, 0x66 ), aStr ), 85 );
314 aStr = SVX_RESSTR( RID_SVXSTR_SALMON );
315 Insert( new XColorEntry( Color( 0xff, 0x80, 0x80 ), aStr ), 86 );
317 aStr = SVX_RESSTR( RID_SVXSTR_SEABLUE );
318 Insert( new XColorEntry( Color( 0x00, 0x66, 0xcc ), aStr ), 87 );
320 // Sun colors
321 aStr = SVX_RESSTR( RID_SVXSTR_COLOR_SUN );
322 aStr.AppendAscii(" 1");
323 nLen = aStr.Len() - 1;
324 Insert( new XColorEntry( Color( 0x33, 0x33, 0x66 ), aStr ), 88 );
325 aStr.SetChar(nLen, sal_Unicode('2'));
326 Insert( new XColorEntry( Color( 0x66, 0x66, 0x99 ), aStr ), 89 );
327 aStr.SetChar(nLen, sal_Unicode('3'));
328 Insert( new XColorEntry( Color( 0x99, 0x99, 0xcc ), aStr ), 90 );
329 aStr.SetChar(nLen, sal_Unicode('4'));
330 Insert( new XColorEntry( Color( 0xcc, 0xcc, 0xff ), aStr ), 91 );
332 // Chart default colors
333 aStr = SVX_RESSTR( RID_SVXSTR_COLOR_CHART );
334 aStr.AppendAscii(" 1");
335 nLen = aStr.Len() - 1;
336 Insert( new XColorEntry( Color( 0x00, 0x45, 0x86 ), aStr ), 92 );
337 aStr.SetChar(nLen, sal_Unicode('2'));
338 Insert( new XColorEntry( Color( 0xff, 0x42, 0x0e ), aStr ), 93 );
339 aStr.SetChar(nLen, sal_Unicode('3'));
340 Insert( new XColorEntry( Color( 0xff, 0xd3, 0x20 ), aStr ), 94 );
341 aStr.SetChar(nLen, sal_Unicode('4'));
342 Insert( new XColorEntry( Color( 0x57, 0x9d, 0x1c ), aStr ), 95 );
343 aStr.SetChar(nLen, sal_Unicode('5'));
344 Insert( new XColorEntry( Color( 0x7e, 0x00, 0x21 ), aStr ), 96 );
345 aStr.SetChar(nLen, sal_Unicode('6'));
346 Insert( new XColorEntry( Color( 0x83, 0xca, 0xff ), aStr ), 97 );
347 aStr.SetChar(nLen, sal_Unicode('7'));
348 Insert( new XColorEntry( Color( 0x31, 0x40, 0x04 ), aStr ), 98 );
349 aStr.SetChar(nLen, sal_Unicode('8'));
350 Insert( new XColorEntry( Color( 0xae, 0xcf, 0x00 ), aStr ), 99 );
351 aStr.SetChar(nLen, sal_Unicode('9'));
352 Insert( new XColorEntry( Color( 0x4b, 0x1f, 0x6f ), aStr ), 100 );
353 aStr.SetChar(nLen, sal_Unicode('1'));
354 aStr.AppendAscii("0");
355 nLen = aStr.Len() - 1;
356 Insert( new XColorEntry( Color( 0xff, 0x95, 0x0e ), aStr ), 101 );
357 aStr.SetChar(nLen, sal_Unicode('1'));
358 Insert( new XColorEntry( Color( 0xc5, 0x00, 0x0b ), aStr ), 102 );
359 aStr.SetChar(nLen, sal_Unicode('2'));
360 Insert( new XColorEntry( Color( 0x00, 0x84, 0xd1 ), aStr ), 103 );
362 return Count() == 104;
365 sal_Bool XColorList::CreateBitmapsForUI()
367 return sal_False;
370 Bitmap* XColorList::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
372 return NULL;
375 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */