xref: /trunk/main/svx/source/xoutdev/xtabcolr.cxx (revision f6e50924346d0b8c0b07c91832a97665dd718b0c)
1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef SVX_LIGHT
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
30cdf0e10cSrcweir #include "svx/XPropertyTable.hxx"
31cdf0e10cSrcweir #include <unotools/ucbstreamhelper.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <unotools/pathoptions.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include "xmlxtexp.hxx"
36cdf0e10cSrcweir #include "xmlxtimp.hxx"
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #include <sfx2/docfile.hxx>
41cdf0e10cSrcweir #include <tools/urlobj.hxx>
42cdf0e10cSrcweir #include <svx/dialogs.hrc>
43cdf0e10cSrcweir #include <svx/dialmgr.hxx>
44cdf0e10cSrcweir #include <svx/xtable.hxx>
45cdf0e10cSrcweir #include <svx/xpool.hxx>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #define GLOBALOVERFLOW
48cdf0e10cSrcweir 
49cdf0e10cSrcweir using namespace com::sun::star;
50cdf0e10cSrcweir using namespace rtl;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir sal_Unicode const pszExtColor[]  = {'s','o','c'};
53cdf0e10cSrcweir 
54cdf0e10cSrcweir static char const aChckColor[]  = { 0x04, 0x00, 'S','O','C','L'};   // < 5.2
55cdf0e10cSrcweir static char const aChckColor0[] = { 0x04, 0x00, 'S','O','C','0'};   // = 5.2
56cdf0e10cSrcweir static char const aChckXML[]    = { '<', '?', 'x', 'm', 'l' };      // = 6.0
57cdf0e10cSrcweir 
58cdf0e10cSrcweir // ------------------
59cdf0e10cSrcweir // class XColorTable
60cdf0e10cSrcweir // ------------------
61cdf0e10cSrcweir 
62cdf0e10cSrcweir static XColorTable* pTable=0;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir /*************************************************************************
65cdf0e10cSrcweir |*
66cdf0e10cSrcweir |* XColorTable::XColorTable()
67cdf0e10cSrcweir |*
68cdf0e10cSrcweir *************************************************************************/
69cdf0e10cSrcweir 
70cdf0e10cSrcweir XColorTable::XColorTable( const String& rPath,
71cdf0e10cSrcweir                             XOutdevItemPool* pInPool,
72cdf0e10cSrcweir                             sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
73cdf0e10cSrcweir                 XPropertyTable( rPath, pInPool, nInitSize, nReSize)
74cdf0e10cSrcweir {
75cdf0e10cSrcweir     // ColorTable braucht keine eigene BmpTable
76cdf0e10cSrcweir     // pBmpTable = new Table( nInitSize, nReSize );
77cdf0e10cSrcweir }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir /************************************************************************/
80cdf0e10cSrcweir 
81cdf0e10cSrcweir XColorTable::~XColorTable()
82cdf0e10cSrcweir {
83cdf0e10cSrcweir }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir XColorTable* XColorTable::GetStdColorTable()
86cdf0e10cSrcweir {
87cdf0e10cSrcweir     if ( !pTable )
88cdf0e10cSrcweir         pTable = new XColorTable( SvtPathOptions().GetPalettePath() );
89cdf0e10cSrcweir     return pTable;
90cdf0e10cSrcweir }
91cdf0e10cSrcweir 
92cdf0e10cSrcweir /************************************************************************/
93cdf0e10cSrcweir 
94cdf0e10cSrcweir XColorEntry* XColorTable::Replace(long nIndex, XColorEntry* pEntry )
95cdf0e10cSrcweir {
96cdf0e10cSrcweir     return (XColorEntry*) XPropertyTable::Replace(nIndex, pEntry);
97cdf0e10cSrcweir }
98cdf0e10cSrcweir 
99cdf0e10cSrcweir /************************************************************************/
100cdf0e10cSrcweir 
101cdf0e10cSrcweir XColorEntry* XColorTable::Remove(long nIndex)
102cdf0e10cSrcweir {
103cdf0e10cSrcweir     return (XColorEntry*) XPropertyTable::Remove(nIndex, 0);
104cdf0e10cSrcweir }
105cdf0e10cSrcweir 
106cdf0e10cSrcweir /************************************************************************/
107cdf0e10cSrcweir 
108cdf0e10cSrcweir XColorEntry* XColorTable::GetColor(long nIndex) const
109cdf0e10cSrcweir {
110cdf0e10cSrcweir     return (XColorEntry*) XPropertyTable::Get(nIndex, 0);
111cdf0e10cSrcweir }
112cdf0e10cSrcweir 
113cdf0e10cSrcweir /************************************************************************/
114cdf0e10cSrcweir 
115cdf0e10cSrcweir sal_Bool XColorTable::Load()
116cdf0e10cSrcweir {
117cdf0e10cSrcweir     if( bTableDirty )
118cdf0e10cSrcweir     {
119cdf0e10cSrcweir         bTableDirty = sal_False;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir         INetURLObject aURL( aPath );
122cdf0e10cSrcweir 
123cdf0e10cSrcweir         if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
124cdf0e10cSrcweir         {
125cdf0e10cSrcweir             DBG_ASSERT( !aPath.Len(), "invalid URL" );
126cdf0e10cSrcweir             return sal_False;
127cdf0e10cSrcweir         }
128cdf0e10cSrcweir 
129cdf0e10cSrcweir         aURL.Append( aName );
130cdf0e10cSrcweir 
131cdf0e10cSrcweir         if( !aURL.getExtension().getLength() )
132cdf0e10cSrcweir             aURL.setExtension( rtl::OUString( pszExtColor, 3 ) );
133cdf0e10cSrcweir 
134cdf0e10cSrcweir         uno::Reference< container::XNameContainer > xTable( SvxUnoXColorTable_createInstance( this ), uno::UNO_QUERY );
135cdf0e10cSrcweir         return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
136cdf0e10cSrcweir     }
137cdf0e10cSrcweir     return( sal_False );
138cdf0e10cSrcweir }
139cdf0e10cSrcweir 
140cdf0e10cSrcweir /************************************************************************/
141cdf0e10cSrcweir 
142cdf0e10cSrcweir sal_Bool XColorTable::Save()
143cdf0e10cSrcweir {
144cdf0e10cSrcweir     INetURLObject aURL( aPath );
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
147cdf0e10cSrcweir     {
148cdf0e10cSrcweir         DBG_ASSERT( !aPath.Len(), "invalid URL" );
149cdf0e10cSrcweir         return sal_False;
150cdf0e10cSrcweir     }
151cdf0e10cSrcweir 
152cdf0e10cSrcweir     aURL.Append( aName );
153cdf0e10cSrcweir 
154cdf0e10cSrcweir     if( !aURL.getExtension().getLength() )
155cdf0e10cSrcweir         aURL.setExtension( rtl::OUString( pszExtColor, 3 ) );
156cdf0e10cSrcweir 
157cdf0e10cSrcweir     uno::Reference< container::XNameContainer > xTable( SvxUnoXColorTable_createInstance( this ), uno::UNO_QUERY );
158cdf0e10cSrcweir     return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
159cdf0e10cSrcweir }
160cdf0e10cSrcweir 
161cdf0e10cSrcweir /************************************************************************/
162cdf0e10cSrcweir 
163cdf0e10cSrcweir sal_Bool XColorTable::Create()
164cdf0e10cSrcweir {
165cdf0e10cSrcweir     XubString aStr;
166cdf0e10cSrcweir     xub_StrLen nLen;
167cdf0e10cSrcweir     ResMgr& rRes = DIALOG_MGR();
168cdf0e10cSrcweir 
169cdf0e10cSrcweir     static sal_uInt16 __READONLY_DATA aResId[] =
170cdf0e10cSrcweir     {
171cdf0e10cSrcweir         RID_SVXSTR_BLACK,
172cdf0e10cSrcweir         RID_SVXSTR_BLUE,
173cdf0e10cSrcweir         RID_SVXSTR_GREEN,
174cdf0e10cSrcweir         RID_SVXSTR_CYAN,
175cdf0e10cSrcweir         RID_SVXSTR_RED,
176cdf0e10cSrcweir         RID_SVXSTR_MAGENTA,
177cdf0e10cSrcweir         RID_SVXSTR_BROWN,
178cdf0e10cSrcweir         RID_SVXSTR_GREY,
179cdf0e10cSrcweir         RID_SVXSTR_LIGHTGREY,
180cdf0e10cSrcweir         RID_SVXSTR_LIGHTBLUE,
181cdf0e10cSrcweir         RID_SVXSTR_LIGHTGREEN,
182cdf0e10cSrcweir         RID_SVXSTR_LIGHTCYAN,
183cdf0e10cSrcweir         RID_SVXSTR_LIGHTRED,
184cdf0e10cSrcweir         RID_SVXSTR_LIGHTMAGENTA,
185cdf0e10cSrcweir         RID_SVXSTR_YELLOW,
186cdf0e10cSrcweir         RID_SVXSTR_WHITE
187cdf0e10cSrcweir     };
188cdf0e10cSrcweir 
189cdf0e10cSrcweir     // MT: COL_XXX ist in VCL kein enum mehr!!!
190cdf0e10cSrcweir     // COL_WHITE ist seeeehr gross! ( => Zugriff ueber das obige Array hinweg )
191cdf0e10cSrcweir     // Mit der unteren Schleife gibt es keinen Absturtz, aber es ist
192cdf0e10cSrcweir     // alles schwarz, weil alles kleine Werte.
193cdf0e10cSrcweir     // Ausserdem ist die ganze Vorgehensweise laut MM sehr unperformant
194cdf0e10cSrcweir     // => lieber gleich Stringlisten laden.
195cdf0e10cSrcweir 
196cdf0e10cSrcweir     // BM: ifndef VCL part removed (deprecated)
197cdf0e10cSrcweir 
198cdf0e10cSrcweir     static ColorData __READONLY_DATA aColTab[] =
199cdf0e10cSrcweir     {
200cdf0e10cSrcweir         COL_BLACK,
201cdf0e10cSrcweir         COL_BLUE,
202cdf0e10cSrcweir         COL_GREEN,
203cdf0e10cSrcweir         COL_CYAN,
204cdf0e10cSrcweir         COL_RED,
205cdf0e10cSrcweir         COL_MAGENTA,
206cdf0e10cSrcweir         COL_BROWN,
207cdf0e10cSrcweir         COL_GRAY,
208cdf0e10cSrcweir         COL_LIGHTGRAY,
209cdf0e10cSrcweir         COL_LIGHTBLUE,
210cdf0e10cSrcweir         COL_LIGHTGREEN,
211cdf0e10cSrcweir         COL_LIGHTCYAN,
212cdf0e10cSrcweir         COL_LIGHTRED,
213cdf0e10cSrcweir         COL_LIGHTMAGENTA,
214cdf0e10cSrcweir         COL_YELLOW,
215cdf0e10cSrcweir         COL_WHITE
216cdf0e10cSrcweir     };
217cdf0e10cSrcweir 
218cdf0e10cSrcweir     for( sal_uInt16 n = 0; n < 16; ++n )
219cdf0e10cSrcweir     {
220cdf0e10cSrcweir         Insert( n, new XColorEntry( Color( aColTab[n] ),
221cdf0e10cSrcweir                                     String( ResId( aResId[ n ], rRes )) ) );
222cdf0e10cSrcweir     }
223cdf0e10cSrcweir 
224cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_GREY );
225cdf0e10cSrcweir     aStr.AppendAscii(" 80%");
226cdf0e10cSrcweir     nLen = aStr.Len() - 3;
227cdf0e10cSrcweir     Insert(16, new XColorEntry( Color( 51, 51, 51 ), aStr ) );
228cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('7'));
229cdf0e10cSrcweir     Insert(17, new XColorEntry( Color( 76, 76, 76 ), aStr ) );
230cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('6'));
231cdf0e10cSrcweir     Insert(18, new XColorEntry( Color(102,102,102 ), aStr ) );
232cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('4'));
233cdf0e10cSrcweir     Insert(19, new XColorEntry( Color(153,153,153 ), aStr ) );
234cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('3'));
235cdf0e10cSrcweir     Insert(20, new XColorEntry( Color(179,179,179 ), aStr ) );
236cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('2'));
237cdf0e10cSrcweir     Insert(21, new XColorEntry( Color(204,204,204 ), aStr ) );
238cdf0e10cSrcweir     // BM: new 15%
239cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('1'));
240cdf0e10cSrcweir     aStr.SetChar(nLen + 1, sal_Unicode('5'));
241cdf0e10cSrcweir     Insert(22, new XColorEntry( Color(217,217,217 ), aStr ) );
242cdf0e10cSrcweir     aStr.SetChar(nLen + 1, sal_Unicode('0'));
243cdf0e10cSrcweir     Insert(23, new XColorEntry( Color(230,230,230 ), aStr ) );
244cdf0e10cSrcweir     Insert(24, new XColorEntry( Color(230,230,255 ), SVX_RESSTR( RID_SVXSTR_BLUEGREY ) ) );
245cdf0e10cSrcweir 
246cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_RED );
247cdf0e10cSrcweir     aStr.AppendAscii(" 1");
248cdf0e10cSrcweir     nLen = aStr.Len() - 1;
249cdf0e10cSrcweir     Insert(25, new XColorEntry( Color(255, 51,102 ), aStr ) );
250cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('2'));
251cdf0e10cSrcweir     Insert(26, new XColorEntry( Color(220, 35,  0 ), aStr ) );
252cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('3'));
253cdf0e10cSrcweir     Insert(27, new XColorEntry( Color(184, 71,  0 ), aStr ) );
254cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('4'));
255cdf0e10cSrcweir     Insert(28, new XColorEntry( Color(255, 51, 51 ), aStr ) );
256cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('5'));
257cdf0e10cSrcweir     Insert(29, new XColorEntry( Color(235, 97, 61 ), aStr ) );
258cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('6'));
259cdf0e10cSrcweir     Insert(30, new XColorEntry( Color(184, 71, 71 ), aStr ) );
260cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('7'));
261cdf0e10cSrcweir     Insert(31, new XColorEntry( Color(184,  0, 71 ), aStr ) );
262cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('8'));
263cdf0e10cSrcweir     Insert(32, new XColorEntry( Color(153, 40, 76 ), aStr ) );
264cdf0e10cSrcweir 
265cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_MAGENTA );
266cdf0e10cSrcweir     aStr.AppendAscii(" 1");
267cdf0e10cSrcweir     nLen = aStr.Len() - 1;
268cdf0e10cSrcweir     Insert(33, new XColorEntry( Color(148,  0,107 ), aStr ) );
269cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('2'));
270cdf0e10cSrcweir     Insert(34, new XColorEntry( Color(148, 71,107 ), aStr ) );
271cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('3'));
272cdf0e10cSrcweir     Insert(35, new XColorEntry( Color(148, 71,148 ), aStr ) );
273cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('4'));
274cdf0e10cSrcweir     Insert(36, new XColorEntry( Color(153,102,204 ), aStr ) );
275cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('5'));
276cdf0e10cSrcweir     Insert(37, new XColorEntry( Color(107, 71,148 ), aStr ) );
277cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('6'));
278cdf0e10cSrcweir     Insert(38, new XColorEntry( Color(107, 35,148 ), aStr ) );
279cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('7'));
280cdf0e10cSrcweir     Insert(39, new XColorEntry( Color(107,  0,148 ), aStr ) );
281cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('8'));
282cdf0e10cSrcweir     Insert(40, new XColorEntry( Color( 94, 17,166 ), aStr ) );
283cdf0e10cSrcweir 
284cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_BLUE );
285cdf0e10cSrcweir     aStr.AppendAscii(" 1");
286cdf0e10cSrcweir     nLen = aStr.Len() - 1;
287cdf0e10cSrcweir     Insert(41, new XColorEntry( Color( 40,  0,153 ), aStr ) );
288cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('2'));
289cdf0e10cSrcweir     Insert(42, new XColorEntry( Color( 71,  0,184 ), aStr ) );
290cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('3'));
291cdf0e10cSrcweir     Insert(43, new XColorEntry( Color( 35,  0,220 ), aStr ) );
292cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('4'));
293cdf0e10cSrcweir     Insert(44, new XColorEntry( Color( 35, 35,220 ), aStr ) );
294cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('5'));
295cdf0e10cSrcweir     Insert(45, new XColorEntry( Color(  0, 71,255 ), aStr ) );
296cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('6'));
297cdf0e10cSrcweir     Insert(46, new XColorEntry( Color(  0,153,255 ), aStr ) );
298cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('7'));
299cdf0e10cSrcweir     Insert(47, new XColorEntry( Color(  0,184,255 ), aStr ) );
300cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('8'));
301cdf0e10cSrcweir     Insert(48, new XColorEntry( Color(153,204,255 ), aStr ) );
302cdf0e10cSrcweir     //Insert(48, new XColorEntry( Color( 46,215,255 ), aStr ) );
303cdf0e10cSrcweir 
304cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_CYAN );
305cdf0e10cSrcweir     aStr.AppendAscii(" 1");
306cdf0e10cSrcweir     nLen = aStr.Len() - 1;
307cdf0e10cSrcweir     Insert(49, new XColorEntry( Color(  0,220,255 ), aStr ) );
308cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('2'));
309cdf0e10cSrcweir     Insert(50, new XColorEntry( Color(  0,204,204 ), aStr ) );
310cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('3'));
311cdf0e10cSrcweir     Insert(51, new XColorEntry( Color( 35,184,220 ), aStr ) );
312cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('4'));
313cdf0e10cSrcweir     Insert(52, new XColorEntry( Color( 71,184,184 ), aStr ) );
314cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('5'));
315cdf0e10cSrcweir     Insert(53, new XColorEntry( Color( 51,163,163 ), aStr ) );
316cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('6'));
317cdf0e10cSrcweir     Insert(54, new XColorEntry( Color( 25,138,138 ), aStr ) );
318cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('7'));
319cdf0e10cSrcweir     Insert(55, new XColorEntry( Color(  0,107,107 ), aStr ) );
320cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('8'));
321cdf0e10cSrcweir     Insert(56, new XColorEntry( Color(  0, 74, 74 ), aStr ) );
322cdf0e10cSrcweir 
323cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_GREEN );
324cdf0e10cSrcweir     aStr.AppendAscii(" 1");
325cdf0e10cSrcweir     nLen = aStr.Len() - 1;
326cdf0e10cSrcweir     Insert(57, new XColorEntry( Color( 53, 94,  0 ), aStr ) );
327cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('2'));
328cdf0e10cSrcweir     Insert(58, new XColorEntry( Color( 92,133, 38 ), aStr ) );
329cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('3'));
330cdf0e10cSrcweir     Insert(59, new XColorEntry( Color(125,166, 71 ), aStr ) );
331cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('4'));
332cdf0e10cSrcweir     Insert(60, new XColorEntry( Color(148,189, 94 ), aStr ) );
333cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('5'));
334cdf0e10cSrcweir     Insert(61, new XColorEntry( Color(  0,174,  0 ), aStr ) );
335cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('6'));
336cdf0e10cSrcweir     Insert(62, new XColorEntry( Color( 51,204,102 ), aStr ) );
337cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('7'));
338cdf0e10cSrcweir     Insert(63, new XColorEntry( Color( 61,235, 61 ), aStr ) );
339cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('8'));
340cdf0e10cSrcweir     Insert(64, new XColorEntry( Color( 35,255, 35 ), aStr ) );
341cdf0e10cSrcweir 
342cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_YELLOW );
343cdf0e10cSrcweir     aStr.AppendAscii(" 1");
344cdf0e10cSrcweir     nLen = aStr.Len() - 1;
345cdf0e10cSrcweir     Insert(65, new XColorEntry( Color(230,255,  0 ), aStr ) );
346cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('2'));
347cdf0e10cSrcweir     Insert(66, new XColorEntry( Color(255,255,153 ), aStr ) );
348cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('3'));
349cdf0e10cSrcweir     Insert(67, new XColorEntry( Color(255,255,102 ), aStr ) );
350cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('4'));
351cdf0e10cSrcweir     Insert(68, new XColorEntry( Color(230,230, 76 ), aStr ) );
352cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('5'));
353cdf0e10cSrcweir     Insert(69, new XColorEntry( Color(204,204,  0 ), aStr ) );
354cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('6'));
355cdf0e10cSrcweir     Insert(70, new XColorEntry( Color(179,179,  0 ), aStr ) );
356cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('7'));
357cdf0e10cSrcweir     Insert(71, new XColorEntry( Color(128,128, 25 ), aStr ) );
358cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('8'));
359cdf0e10cSrcweir     Insert(72, new XColorEntry( Color(102,102,  0 ), aStr ) );
360cdf0e10cSrcweir 
361cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_BROWN );
362cdf0e10cSrcweir     aStr.AppendAscii(" 1");
363cdf0e10cSrcweir     nLen = aStr.Len() - 1;
364cdf0e10cSrcweir     Insert(73, new XColorEntry( Color( 76, 25,  0 ), aStr ) );
365cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('2'));
366cdf0e10cSrcweir     Insert(74, new XColorEntry( Color(102, 51,  0 ), aStr ) );
367cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('3'));
368cdf0e10cSrcweir     Insert(75, new XColorEntry( Color(128, 76, 25 ), aStr ) );
369cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('4'));
370cdf0e10cSrcweir     Insert(76, new XColorEntry( Color(153,102, 51 ), aStr ) );
371cdf0e10cSrcweir 
372cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_ORANGE );
373cdf0e10cSrcweir     aStr.AppendAscii(" 1");
374cdf0e10cSrcweir     nLen = aStr.Len() - 1;
375cdf0e10cSrcweir     Insert(77, new XColorEntry( Color(204,102, 51 ), aStr ) );
376cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('2'));
377cdf0e10cSrcweir     Insert(78, new XColorEntry( Color(255,102, 51 ), aStr ) );
378cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('3'));
379cdf0e10cSrcweir     Insert(79, new XColorEntry( Color(255,153,102 ), aStr ) );
380cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('4'));
381cdf0e10cSrcweir     Insert(80, new XColorEntry( Color(255,204,153 ), aStr ) );
382cdf0e10cSrcweir 
383cdf0e10cSrcweir     // new chart colors
384cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_VIOLET );
385cdf0e10cSrcweir     Insert( 81, new XColorEntry( Color( 0x99, 0x99, 0xff ), aStr ) );
386cdf0e10cSrcweir 
387cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_BORDEAUX );
388cdf0e10cSrcweir     Insert( 82, new XColorEntry( Color( 0x99, 0x33, 0x66 ), aStr ) );
389cdf0e10cSrcweir 
390cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_PALE_YELLOW );
391cdf0e10cSrcweir     Insert( 83, new XColorEntry( Color( 0xff, 0xff, 0xcc ), aStr ) );
392cdf0e10cSrcweir 
393cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_PALE_GREEN );
394cdf0e10cSrcweir     Insert( 84, new XColorEntry( Color( 0xcc, 0xff, 0xff ), aStr ) );
395cdf0e10cSrcweir 
396cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_DKVIOLET );
397cdf0e10cSrcweir     Insert( 85, new XColorEntry( Color( 0x66, 0x00, 0x66 ), aStr ) );
398cdf0e10cSrcweir 
399cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_SALMON );
400cdf0e10cSrcweir     Insert( 86, new XColorEntry( Color( 0xff, 0x80, 0x80 ), aStr ) );
401cdf0e10cSrcweir 
402cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_SEABLUE );
403cdf0e10cSrcweir     Insert( 87, new XColorEntry( Color( 0x00, 0x66, 0xcc ), aStr ) );
404cdf0e10cSrcweir 
405cdf0e10cSrcweir     // Sun colors
406cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_COLOR_SUN );
407cdf0e10cSrcweir     aStr.AppendAscii(" 1");
408cdf0e10cSrcweir     nLen = aStr.Len() - 1;
409cdf0e10cSrcweir     Insert( 88, new XColorEntry( Color( 0x33, 0x33, 0x66 ), aStr ) );
410cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('2'));
411cdf0e10cSrcweir     Insert( 89, new XColorEntry( Color( 0x66, 0x66, 0x99 ), aStr ) );
412cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('3'));
413cdf0e10cSrcweir     Insert( 90, new XColorEntry( Color( 0x99, 0x99, 0xcc ), aStr ) );
414cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('4'));
415cdf0e10cSrcweir     Insert( 91, new XColorEntry( Color( 0xcc, 0xcc, 0xff ), aStr ) );
416cdf0e10cSrcweir 
417cdf0e10cSrcweir     // Chart default colors
418cdf0e10cSrcweir     aStr = SVX_RESSTR( RID_SVXSTR_COLOR_CHART );
419cdf0e10cSrcweir     aStr.AppendAscii(" 1");
420cdf0e10cSrcweir     nLen = aStr.Len() - 1;
421cdf0e10cSrcweir     Insert( 92, new XColorEntry( Color( 0x00, 0x45, 0x86 ), aStr ) );
422cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('2'));
423cdf0e10cSrcweir     Insert( 93, new XColorEntry( Color( 0xff, 0x42, 0x0e ), aStr ) );
424cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('3'));
425cdf0e10cSrcweir     Insert( 94, new XColorEntry( Color( 0xff, 0xd3, 0x20 ), aStr ) );
426cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('4'));
427cdf0e10cSrcweir     Insert( 95, new XColorEntry( Color( 0x57, 0x9d, 0x1c ), aStr ) );
428cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('5'));
429cdf0e10cSrcweir     Insert( 96, new XColorEntry( Color( 0x7e, 0x00, 0x21 ), aStr ) );
430cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('6'));
431cdf0e10cSrcweir     Insert( 97, new XColorEntry( Color( 0x83, 0xca, 0xff ), aStr ) );
432cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('7'));
433cdf0e10cSrcweir     Insert( 98, new XColorEntry( Color( 0x31, 0x40, 0x04 ), aStr ) );
434cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('8'));
435cdf0e10cSrcweir     Insert( 99, new XColorEntry( Color( 0xae, 0xcf, 0x00 ), aStr ) );
436cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('9'));
437cdf0e10cSrcweir     Insert( 100, new XColorEntry( Color( 0x4b, 0x1f, 0x6f ), aStr ) );
438cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('1'));
439cdf0e10cSrcweir     aStr.AppendAscii("0");
440cdf0e10cSrcweir     nLen = aStr.Len() - 1;
441cdf0e10cSrcweir     Insert( 101, new XColorEntry( Color( 0xff, 0x95, 0x0e ), aStr ) );
442cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('1'));
443cdf0e10cSrcweir     Insert( 102, new XColorEntry( Color( 0xc5, 0x00, 0x0b ), aStr ) );
444cdf0e10cSrcweir     aStr.SetChar(nLen, sal_Unicode('2'));
445cdf0e10cSrcweir     Insert( 103, new XColorEntry( Color( 0x00, 0x84, 0xd1 ), aStr ) );
446cdf0e10cSrcweir 
447cdf0e10cSrcweir     return( Count() == 104 );
448cdf0e10cSrcweir }
449cdf0e10cSrcweir 
450cdf0e10cSrcweir /************************************************************************/
451cdf0e10cSrcweir 
452cdf0e10cSrcweir sal_Bool XColorTable::CreateBitmapsForUI()
453cdf0e10cSrcweir {
454cdf0e10cSrcweir     return( sal_False );
455cdf0e10cSrcweir }
456cdf0e10cSrcweir 
457cdf0e10cSrcweir /************************************************************************/
458cdf0e10cSrcweir 
459cdf0e10cSrcweir Bitmap* XColorTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
460cdf0e10cSrcweir {
461cdf0e10cSrcweir     return( NULL );
462cdf0e10cSrcweir }
463cdf0e10cSrcweir 
464cdf0e10cSrcweir // --------------------
465cdf0e10cSrcweir // class XColorList
466cdf0e10cSrcweir // --------------------
467cdf0e10cSrcweir 
468cdf0e10cSrcweir /*************************************************************************
469cdf0e10cSrcweir |*
470cdf0e10cSrcweir |* XColorList::XColorList()
471cdf0e10cSrcweir |*
472cdf0e10cSrcweir *************************************************************************/
473cdf0e10cSrcweir 
474cdf0e10cSrcweir XColorList::XColorList( const String& rPath,
475cdf0e10cSrcweir                             XOutdevItemPool* pInPool,
476cdf0e10cSrcweir                             sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
477cdf0e10cSrcweir                 XPropertyList( rPath, pInPool, nInitSize, nReSize)
478cdf0e10cSrcweir {
479cdf0e10cSrcweir     // pBmpList = new List( nInitSize, nReSize );
480cdf0e10cSrcweir }
481cdf0e10cSrcweir 
482cdf0e10cSrcweir /************************************************************************/
483cdf0e10cSrcweir 
484cdf0e10cSrcweir XColorList::~XColorList()
485cdf0e10cSrcweir {
486cdf0e10cSrcweir }
487cdf0e10cSrcweir 
488cdf0e10cSrcweir /************************************************************************/
489cdf0e10cSrcweir 
490cdf0e10cSrcweir XColorEntry* XColorList::Replace(XColorEntry* pEntry, long nIndex )
491cdf0e10cSrcweir {
492cdf0e10cSrcweir     return (XColorEntry*) XPropertyList::Replace(pEntry, nIndex);
493cdf0e10cSrcweir }
494cdf0e10cSrcweir 
495cdf0e10cSrcweir /************************************************************************/
496cdf0e10cSrcweir 
497cdf0e10cSrcweir XColorEntry* XColorList::Remove(long nIndex)
498cdf0e10cSrcweir {
499cdf0e10cSrcweir     return (XColorEntry*) XPropertyList::Remove(nIndex, 0);
500cdf0e10cSrcweir }
501cdf0e10cSrcweir 
502cdf0e10cSrcweir /************************************************************************/
503cdf0e10cSrcweir 
504cdf0e10cSrcweir XColorEntry* XColorList::GetColor(long nIndex) const
505cdf0e10cSrcweir {
506cdf0e10cSrcweir     return (XColorEntry*) XPropertyList::Get(nIndex, 0);
507cdf0e10cSrcweir }
508cdf0e10cSrcweir 
509cdf0e10cSrcweir /************************************************************************/
510cdf0e10cSrcweir 
511cdf0e10cSrcweir sal_Bool XColorList::Load()
512cdf0e10cSrcweir {
513cdf0e10cSrcweir     return( sal_False );
514cdf0e10cSrcweir }
515cdf0e10cSrcweir 
516cdf0e10cSrcweir /************************************************************************/
517cdf0e10cSrcweir 
518cdf0e10cSrcweir sal_Bool XColorList::Save()
519cdf0e10cSrcweir {
520cdf0e10cSrcweir     return( sal_False );
521cdf0e10cSrcweir }
522cdf0e10cSrcweir 
523cdf0e10cSrcweir /************************************************************************/
524cdf0e10cSrcweir 
525cdf0e10cSrcweir sal_Bool XColorList::Create()
526cdf0e10cSrcweir {
527cdf0e10cSrcweir     return( sal_False );
528cdf0e10cSrcweir }
529cdf0e10cSrcweir 
530cdf0e10cSrcweir /************************************************************************/
531cdf0e10cSrcweir 
532cdf0e10cSrcweir sal_Bool XColorList::CreateBitmapsForUI()
533cdf0e10cSrcweir {
534cdf0e10cSrcweir     return( sal_False );
535cdf0e10cSrcweir }
536cdf0e10cSrcweir 
537cdf0e10cSrcweir /************************************************************************/
538cdf0e10cSrcweir 
539cdf0e10cSrcweir Bitmap* XColorList::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
540cdf0e10cSrcweir {
541cdf0e10cSrcweir     return( NULL );
542cdf0e10cSrcweir }
543cdf0e10cSrcweir 
544cdf0e10cSrcweir // eof
545