xref: /aoo42x/main/cui/source/options/optcolor.cxx (revision 32698fcc)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_cui.hxx"
26 
27 // include ---------------------------------------------------------------
28 #include <svtools/colorcfg.hxx>
29 #include <svtools/extcolorcfg.hxx>
30 #include <svtools/headbar.hxx>
31 #include <svtools/ctrlbox.hxx>
32 #include <vcl/scrbar.hxx>
33 #include <svx/xtable.hxx>
34 #include <unotools/moduleoptions.hxx>
35 #include <unotools/pathoptions.hxx>
36 #include <vcl/msgbox.hxx>
37 #include <boost/shared_ptr.hpp>
38 #include <svx/svxdlg.hxx>
39 #include <helpid.hrc>
40 #include <dialmgr.hxx>
41 #include "optcolor.hxx"
42 #include <cuires.hrc>
43 #include "optcolor.hrc"
44 #include <svx/dlgutil.hxx>
45 
46 using namespace ::com::sun::star;
47 using namespace ::svtools;
48 
49 #define GROUP_COUNT     7
50 #define GROUP_UNKNOWN   -1
51 #define GROUP_GENERAL   0
52 #define GROUP_WRITER    1
53 #define GROUP_HTML      2
54 #define GROUP_CALC      3
55 #define GROUP_DRAW      4
56 #define GROUP_BASIC     5
57 #define GROUP_SQL		6
58 
59 const char* aColorLBHids[ColorConfigEntryCount] =
60 {
61      HID_COLORPAGE_DOCCOLOR_LB,
62      HID_COLORPAGE_DOCBOUNDARIES_LB,
63      HID_COLORPAGE_APPBACKGROUND_LB,
64      HID_COLORPAGE_OBJECTBOUNDARIES_LB,
65      HID_COLORPAGE_TABLEBOUNDARIES_LB,
66      HID_COLORPAGE_FONTCOLOR_LB,
67      HID_COLORPAGE_LINKS_LB,
68      HID_COLORPAGE_LINKSVISITED_LB,
69      HID_COLORPAGE_ANCHOR_LB,
70      HID_COLORPAGE_SPELL_LB,
71 	 HID_COLORPAGE_SMARTTAGS_LB,
72 	 HID_COLORPAGE_WRITERTEXTGRID_LB,
73      HID_COLORPAGE_WRITERFIELDSHADINGS_LB,
74      HID_COLORPAGE_WRITERIDXSHADINGS_LB,
75      HID_COLORPAGE_WRITERDIRECTCURSOR_LB,
76      HID_COLORPAGE_WRITERSCRIPTINDICATOR_LB,
77      HID_COLORPAGE_WRITERSECTIONBOUNDARIES_LB,
78      HID_COLORPAGE_WRITERPAGEBREAKS_LB,
79      HID_COLORPAGE_HTMLSGML_LB,
80      HID_COLORPAGE_HTMLCOMMENT_LB,
81      HID_COLORPAGE_HTMLKEYWORD_LB,
82      HID_COLORPAGE_HTMLUNKNOWN_LB,
83      HID_COLORPAGE_CALCGRID_LB,
84      HID_COLORPAGE_CALCPAGEBREAK_LB,
85      HID_COLORPAGE_CALCPAGEBREAKMANUAL_LB,
86      HID_COLORPAGE_CALCPAGEBREAKAUTOMATIC_LB,
87      HID_COLORPAGE_CALCDETECTIVE_LB,
88      HID_COLORPAGE_CALCDETECTIVEERROR_LB,
89      HID_COLORPAGE_CALCREFERENCE_LB,
90      HID_COLORPAGE_CALCNOTESBACKGROUND_LB,
91      HID_COLORPAGE_DRAWGRID_LB,
92      HID_COLORPAGE_DRAWDRAWING_LB,
93      HID_COLORPAGE_DRAWFILL_LB,
94      HID_COLORPAGE_BASICIDENTIFIER_LB,
95      HID_COLORPAGE_BASICCOMMENT_LB,
96      HID_COLORPAGE_BASICNUMBER_LB,
97      HID_COLORPAGE_BASICSTRING_LB,
98      HID_COLORPAGE_BASICOPERATOR_LB,
99      HID_COLORPAGE_BASICKEYWORD_LB,
100      HID_COLORPAGE_BASICERROR_LB
101      HID_COLORPAGE_SQLIDENTIFIER_LB,
102      HID_COLORPAGE_SQLNUMBER_LB,
103      HID_COLORPAGE_SQLSTRING_LB,
104      HID_COLORPAGE_SQLOPERATOR_LB,
105      HID_COLORPAGE_SQLKEYWORD_LB,
106      HID_COLORPAGE_SQLPARAMETER_LB,
107      HID_COLORPAGE_SQLCOMMENT_LB
108 };
109 
110 const char* aColorCBHids[ColorConfigEntryCount] =
111 {
112      HID_COLORPAGE_DOCCOLOR_CB,
113      HID_COLORPAGE_DOCBOUNDARIES_CB,
114      HID_COLORPAGE_APPBACKGROUND_CB,
115      HID_COLORPAGE_OBJECTBOUNDARIES_CB,
116      HID_COLORPAGE_TABLEBOUNDARIES_CB,
117      HID_COLORPAGE_FONTCOLOR_CB,
118      HID_COLORPAGE_LINKS_CB,
119      HID_COLORPAGE_LINKSVISITED_CB,
120      HID_COLORPAGE_ANCHOR_CB,
121      HID_COLORPAGE_SPELL_CB,
122 	 HID_COLORPAGE_SMARTTAGS_CB,
123      HID_COLORPAGE_WRITERTEXTGRID_CB,
124      HID_COLORPAGE_WRITERFIELDSHADINGS_CB,
125      HID_COLORPAGE_WRITERIDXSHADINGS_CB,
126      HID_COLORPAGE_WRITERDIRECTCURSOR_CB,
127      HID_COLORPAGE_WRITERSCRIPTINDICATOR_CB,
128      HID_COLORPAGE_WRITERSECTIONBOUNDARIES_CB,
129      HID_COLORPAGE_WRITERPAGEBREAKS_CB,
130      HID_COLORPAGE_HTMLSGML_CB,
131      HID_COLORPAGE_HTMLCOMMENT_CB,
132      HID_COLORPAGE_HTMLKEYWORD_CB,
133      HID_COLORPAGE_HTMLUNKNOWN_CB,
134      HID_COLORPAGE_CALCGRID_CB,
135      HID_COLORPAGE_CALCPAGEBREAK_CB,
136      HID_COLORPAGE_CALCPAGEBREAKMANUAL_CB,
137      HID_COLORPAGE_CALCPAGEBREAKAUTOMATIC_CB,
138      HID_COLORPAGE_CALCDETECTIVE_CB,
139      HID_COLORPAGE_CALCDETECTIVEERROR_CB,
140      HID_COLORPAGE_CALCREFERENCE_CB,
141      HID_COLORPAGE_CALCNOTESBACKGROUND_CB,
142      HID_COLORPAGE_DRAWGRID_CB,
143      HID_COLORPAGE_DRAWDRAWING_CB,
144      HID_COLORPAGE_DRAWFILL_CB,
145      HID_COLORPAGE_BASICIDENTIFIER_CB,
146      HID_COLORPAGE_BASICCOMMENT_CB,
147      HID_COLORPAGE_BASICNUMBER_CB,
148      HID_COLORPAGE_BASICSTRING_CB,
149      HID_COLORPAGE_BASICOPERATOR_CB,
150      HID_COLORPAGE_BASICKEYWORD_CB,
151      HID_COLORPAGE_BASICERROR_CB
152      HID_COLORPAGE_SQLIDENTIFIER_CB,
153      HID_COLORPAGE_SQLNUMBER_CB,
154      HID_COLORPAGE_SQLSTRING_CB,
155      HID_COLORPAGE_SQLOPERATOR_CB,
156      HID_COLORPAGE_SQLKEYWORD_CB,
157      HID_COLORPAGE_SQLPARAMETER_CB,
158      HID_COLORPAGE_SQLCOMMENT_CB
159 };
160 
161 /* -----------------------------2002/06/26 10:48------------------------------
162 
163  ---------------------------------------------------------------------------*/
164 
165 class SvxExtFixedText_Impl : public FixedText
166 {
167 private:
168     long            m_nGroupHeight;
169 
170 protected:
171     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
172 
173 public:
SvxExtFixedText_Impl(Window * pParent,const ResId & rResId)174     SvxExtFixedText_Impl(Window* pParent, const ResId& rResId) :
175         FixedText(pParent, rResId), m_nGroupHeight(0) {}
176 
GetGroupHeight()177     inline long     GetGroupHeight() { return m_nGroupHeight; }
SetGroupHeight(long _nHeight)178     inline void     SetGroupHeight( long _nHeight ) { m_nGroupHeight = _nHeight; }
179 };
180 
181 /* -----------------------------25.03.2002 15:48------------------------------
182 
183  ---------------------------------------------------------------------------*/
184 class ColorConfigCtrl_Impl;
185 class ColorConfigWindow_Impl : public Window
186 {
187     friend class ColorConfigCtrl_Impl;
188     Window          aGeneralBackWN;
189     SvxExtFixedText_Impl    aGeneralFT;
190     FixedText       aDocColorFT;
191     ColorListBox    aDocColorLB;
192     Window          aDocColorWN;
193     CheckBox        aDocBoundCB;
194     ColorListBox    aDocBoundLB;
195     Window          aDocBoundWN;
196     FixedText       aAppBackFT;
197     ColorListBox    aAppBackLB;
198     Window          aAppBackWN;
199     CheckBox        aObjBoundCB;
200     ColorListBox    aObjBoundLB;
201     Window          aObjBoundWN;
202     CheckBox        aTableBoundCB;
203     ColorListBox    aTableBoundLB;
204     Window          aTableBoundWN;
205     FixedText       aFontColorFT;
206     ColorListBox    aFontColorLB;
207     Window          aFontColorWN;
208     CheckBox        aLinksCB;
209     ColorListBox    aLinksLB;
210     Window          aLinksWN;
211     CheckBox        aLinksVisitedCB;
212     ColorListBox    aLinksVisitedLB;
213     Window          aLinksVisitedWN;
214     FixedText       aSpellFT;
215     ColorListBox    aSpellLB;
216     Window          aSpellWN;
217     FixedText       aSmarttagsFT;
218     ColorListBox    aSmarttagsLB;
219     Window          aSmarttagsWN;
220     Window          aWriterBackWN;
221     SvxExtFixedText_Impl    aWriterFT;
222     FixedText       aWrtTextGridFT;
223     ColorListBox    aWrtTextGridLB;
224     Window          aWrtTextGridWN;
225     CheckBox        aWrtFieldCB;
226     ColorListBox    aWrtFieldLB;
227     Window          aWrtFieldWN;
228     CheckBox        aWrtIdxShadingBackCB;
229     ColorListBox    aWrtIdxShadingBackLB;
230     Window          aWrtIdxShadingBackWN;
231     FixedText       aWrtScriptIndicatorFT;
232     ColorListBox    aWrtScriptIndicatorLB;
233     Window          aWrtScriptIndicatorWN;
234     CheckBox        aWrtSectionBoundCB;
235     ColorListBox    aWrtSectionBoundLB;
236     Window          aWrtSectionBoundWN;
237     FixedText       aWrtPageBreaksFT;
238     ColorListBox    aWrtPageBreaksLB;
239     Window          aWrtPageBreaksWN;
240     FixedText       aWrtDirectCrsrFT;
241     ColorListBox    aWrtDirectCrsrLB;
242     Window          aWrtDirectCrsrWN;
243     Window          aHTMLBackWN;
244     SvxExtFixedText_Impl    aHTMLFT;
245     FixedText       aHTMLSGMLFT;
246     ColorListBox    aHTMLSGMLLB;
247     Window          aHTMLSGMLWN;
248     FixedText       aHTMLCommentFT;
249     ColorListBox    aHTMLCommentLB;
250     Window          aHTMLCommentWN;
251     FixedText       aHTMLKeywdFT;
252     ColorListBox    aHTMLKeywdLB;
253     Window          aHTMLKeywdWN;
254     FixedText       aHTMLUnknownFT;
255     ColorListBox    aHTMLUnknownLB;
256     Window          aHTMLUnknownWN;
257     Window          aCalcBackWN;
258     SvxExtFixedText_Impl    aCalcFT;
259     FixedText       aCalcGridFT;
260     ColorListBox    aCalcGridLB;
261     Window          aCalcGridWN;
262     FixedText       aCalcPageBreakFT;
263     ColorListBox    aCalcPageBreakLB;
264     Window          aCalcPageBreakWN;
265     FixedText       aCalcPageBreakManualFT;
266     ColorListBox    aCalcPageBreakManualLB;
267     Window          aCalcPageBreakManualWN;
268     FixedText       aCalcPageBreakAutoFT;
269     ColorListBox    aCalcPageBreakAutoLB;
270     Window          aCalcPageBreakAutoWN;
271     FixedText       aCalcDetectiveFT;
272     ColorListBox    aCalcDetectiveLB;
273     Window          aCalcDetectiveWN;
274     FixedText       aCalcDetectiveErrorFT;
275     ColorListBox    aCalcDetectiveErrorLB;
276     Window          aCalcDetectiveErrorWN;
277     FixedText       aCalcReferenceFT;
278     ColorListBox    aCalcReferenceLB;
279     Window          aCalcReferenceWN;
280     FixedText       aCalcNotesBackFT;
281     ColorListBox    aCalcNotesBackLB;
282     Window          aCalcNotesBackWN;
283     Window          aDrawBackWN;
284     SvxExtFixedText_Impl    aDrawFT;
285     FixedText       aDrawGridFT;
286     ColorListBox    aDrawGridLB;
287     Window          aDrawGridWN;
288     Window          aBasicBackWN;
289     SvxExtFixedText_Impl    aBasicFT;
290     FixedText       aBasicIdentifierFT;
291     ColorListBox    aBasicIdentifierLB;
292     Window          aBasicIdentifierWN;
293     FixedText       aBasicCommentFT;
294     ColorListBox    aBasicCommentLB;
295     Window          aBasicCommentWN;
296     FixedText       aBasicNumberFT;
297     ColorListBox    aBasicNumberLB;
298     Window          aBasicNumberWN;
299     FixedText       aBasicStringFT;
300     ColorListBox    aBasicStringLB;
301     Window          aBasicStringWN;
302     FixedText       aBasicOperatorFT;
303     ColorListBox    aBasicOperatorLB;
304     Window          aBasicOperatorWN;
305     FixedText       aBasicKeywordFT;
306     ColorListBox    aBasicKeywordLB;
307     Window          aBasicKeywordWN;
308     FixedText       aBasicErrorFT;
309     ColorListBox    aBasicErrorLB;
310     Window          aBasicErrorWN;
311 	Window          aSQLBackWN;
312 	SvxExtFixedText_Impl    aSQLFT;
313 	FixedText       aSQLIdentifierFT;
314     ColorListBox    aSQLIdentifierLB;
315     Window          aSQLIdentifierWN;
316 	FixedText       aSQLNumberFT;
317     ColorListBox    aSQLNumberLB;
318     Window          aSQLNumberWN;
319 	FixedText       aSQLStringFT;
320     ColorListBox    aSQLStringLB;
321     Window          aSQLStringWN;
322 	FixedText       aSQLOperatorFT;
323     ColorListBox    aSQLOperatorLB;
324     Window          aSQLOperatorWN;
325 	FixedText       aSQLKeywordFT;
326     ColorListBox    aSQLKeywordLB;
327     Window          aSQLKeywordWN;
328 	FixedText       aSQLParameterFT;
329     ColorListBox    aSQLParameterLB;
330     Window          aSQLParameterWN;
331 	FixedText       aSQLCommentFT;
332     ColorListBox    aSQLCommentLB;
333     Window          aSQLCommentWN;
334 
335     ::std::vector< SvxExtFixedText_Impl*>	aChapters;
336 	::std::vector< Window* >				aChapterWins;
337 	::std::vector< FixedText* >				aFixedTexts;
338     ::std::vector< CheckBox* >				aCheckBoxes;
339     ::std::vector< ColorListBox* >			aColorBoxes;
340     ::std::vector< Window* >				aWindows; // [ColorConfigEntryCount]
341 	::std::vector< ::boost::shared_ptr<SvxExtFixedText_Impl> >	m_aExtensionTitles;
342 
343     SvtModuleOptions    m_aModuleOptions;
344 
345     void            SetNewPosition( sal_Int32 _nFeature, Window* _pWin );
346 
347     virtual void    Command( const CommandEvent& rCEvt );
348     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
349 
350 public:
351     ColorConfigWindow_Impl(Window* pParent, const ResId& rResId);
352     ~ColorConfigWindow_Impl();
353 
GetModuleOptions() const354     inline const SvtModuleOptions&  GetModuleOptions() const { return m_aModuleOptions; }
355 };
356 
lcl_isGroupVisible(sal_Int32 _nGroup,const SvtModuleOptions & _rModOptions)357 sal_Bool lcl_isGroupVisible( sal_Int32 _nGroup, const SvtModuleOptions& _rModOptions )
358 {
359     sal_Bool bRet = sal_True;
360 
361     switch ( _nGroup )
362     {
363         case GROUP_WRITER :
364         case GROUP_HTML :
365         {
366             bRet = _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SWRITER );
367             break;
368         }
369 
370         case GROUP_CALC :
371         {
372             bRet = _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SCALC );
373             break;
374         }
375 
376         case GROUP_DRAW :
377         {
378             bRet = ( _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) ||
379                      _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) );
380             break;
381         }
382 		case GROUP_SQL :
383 		{
384 			bRet = _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SDATABASE );
385 			break;
386 		}
387     }
388 
389     return bRet;
390 }
391 
lcl_getGroup(sal_Int32 _nFeature)392 sal_Int16 lcl_getGroup( sal_Int32 _nFeature )
393 {
394     if ( _nFeature >= ColorConfigEntryCount )
395         return GROUP_COUNT; // feature of an extension
396 
397     sal_Int16 nRet = GROUP_UNKNOWN;
398 
399     switch ( _nFeature )
400     {
401         case DOCCOLOR :
402         case DOCBOUNDARIES :
403         case APPBACKGROUND :
404         case OBJECTBOUNDARIES :
405         case TABLEBOUNDARIES :
406         case FONTCOLOR :
407         case LINKS :
408         case LINKSVISITED :
409         case ANCHOR :
410         case SPELL :
411         case SMARTTAGS :
412         {
413             nRet = GROUP_GENERAL;
414             break;
415         }
416 
417         case WRITERTEXTGRID :
418         case WRITERFIELDSHADINGS :
419         case WRITERIDXSHADINGS :
420         case WRITERDIRECTCURSOR :
421         case WRITERSCRIPTINDICATOR :
422         case WRITERSECTIONBOUNDARIES :
423         case WRITERPAGEBREAKS :
424         {
425             nRet = GROUP_WRITER;
426             break;
427         }
428 
429         case HTMLSGML :
430         case HTMLCOMMENT :
431         case HTMLKEYWORD :
432         case HTMLUNKNOWN :
433         {
434             nRet = GROUP_HTML;
435             break;
436         }
437 
438         case CALCGRID :
439         case CALCPAGEBREAK :
440         case CALCPAGEBREAKMANUAL :
441         case CALCPAGEBREAKAUTOMATIC :
442         case CALCDETECTIVE :
443         case CALCDETECTIVEERROR :
444         case CALCREFERENCE :
445         case CALCNOTESBACKGROUND :
446         {
447             nRet = GROUP_CALC;
448             break;
449         }
450 
451         case DRAWGRID :
452         case DRAWDRAWING :
453         case DRAWFILL :
454         {
455             nRet = GROUP_DRAW;
456             break;
457         }
458 
459         case BASICIDENTIFIER :
460         case BASICCOMMENT :
461         case BASICNUMBER :
462         case BASICSTRING :
463         case BASICOPERATOR :
464         case BASICKEYWORD :
465         case BASICERROR :
466         {
467             nRet = GROUP_BASIC;
468             break;
469         }
470 		case SQLIDENTIFIER :
471 		case SQLNUMBER:
472 		case SQLSTRING:
473 		case SQLOPERATOR:
474 		case SQLKEYWORD:
475 		case SQLPARAMETER:
476 		case SQLCOMMENT:
477 		{
478 			nRet = GROUP_SQL;
479             break;
480 		}
481     }
482     return nRet;
483 }
484 
485 /* -----------------------------25.03.2002 17:05------------------------------
486 
487  ---------------------------------------------------------------------------*/
ColorConfigWindow_Impl(Window * pParent,const ResId & rResId)488 ColorConfigWindow_Impl::ColorConfigWindow_Impl(Window* pParent, const ResId& rResId) :
489         Window(pParent, rResId),
490         aGeneralBackWN(this),
491         aGeneralFT(&aGeneralBackWN,  ResId( FT_GENERAL, *rResId.GetResMgr() )),
492         aDocColorFT(this, ResId(        FT_DOCCOLOR, *rResId.GetResMgr())),
493         aDocColorLB(this, ResId(        LB_DOCCOLOR, *rResId.GetResMgr())),
494         aDocColorWN(this, ResId(        WN_DOCCOLOR, *rResId.GetResMgr())),
495         aDocBoundCB(this, ResId(        CB_DOCBOUND, *rResId.GetResMgr())),
496         aDocBoundLB(this, ResId(        LB_DOCBOUND, *rResId.GetResMgr())),
497         aDocBoundWN(this, ResId(      WN_DOCBOUND, *rResId.GetResMgr())),
498         aAppBackFT(this, ResId(         FT_APPBACKGROUND, *rResId.GetResMgr())),
499         aAppBackLB(this, ResId(         LB_APPBACKGROUND, *rResId.GetResMgr())),
500         aAppBackWN(this, ResId(         WN_APPBACKGROUND, *rResId.GetResMgr())),
501         aObjBoundCB(this, ResId(        CB_OBJECTBOUNDARIES, *rResId.GetResMgr())),
502         aObjBoundLB(this, ResId(        LB_OBJECTBOUNDARIES, *rResId.GetResMgr())),
503         aObjBoundWN(this, ResId(        WN_OBJECTBOUNDARIES, *rResId.GetResMgr())),
504         aTableBoundCB(this, ResId(      CB_TABLEBOUNDARIES, *rResId.GetResMgr())),
505         aTableBoundLB(this, ResId(      LB_TABLEBOUNDARIES, *rResId.GetResMgr())),
506         aTableBoundWN(this, ResId(      WN_TABLEBOUNDARIES, *rResId.GetResMgr())),
507         aFontColorFT(this, ResId(       FT_FONTCOLOR, *rResId.GetResMgr())),
508         aFontColorLB(this, ResId(       LB_FONTCOLOR, *rResId.GetResMgr())),
509         aFontColorWN(this, ResId(       WN_FONTCOLOR, *rResId.GetResMgr())),
510         aLinksCB(this, ResId(           CB_LINKS, *rResId.GetResMgr())),
511         aLinksLB(this, ResId(           LB_LINKS, *rResId.GetResMgr())),
512         aLinksWN(this, ResId(           WN_LINKS, *rResId.GetResMgr())),
513         aLinksVisitedCB(this, ResId(    CB_LINKSVISITED, *rResId.GetResMgr())),
514         aLinksVisitedLB(this, ResId(    LB_LINKSVISITED, *rResId.GetResMgr())),
515         aLinksVisitedWN(this, ResId(    WN_LINKSVISITED, *rResId.GetResMgr())),
516         aSpellFT(this, ResId(        FT_SPELL, *rResId.GetResMgr())),
517         aSpellLB(this, ResId(        LB_SPELL, *rResId.GetResMgr())),
518         aSpellWN(this, ResId(        WN_SPELL, *rResId.GetResMgr())),
519         aSmarttagsFT(this, ResId(        FT_SMARTTAGS, *rResId.GetResMgr() )),
520         aSmarttagsLB(this, ResId(        LB_SMARTTAGS, *rResId.GetResMgr() )),
521         aSmarttagsWN(this, ResId(        WN_SMARTTAGS, *rResId.GetResMgr() )),
522         aWriterBackWN(this),
523         aWriterFT(this, ResId(FT_WRITER, *rResId.GetResMgr())),
524         aWrtTextGridFT(this, ResId(     FT_WRITERTEXTGRID, *rResId.GetResMgr())),
525         aWrtTextGridLB(this, ResId(     LB_WRITERTEXTGRID, *rResId.GetResMgr())),
526         aWrtTextGridWN(this, ResId(     WN_WRITERTEXTGRID, *rResId.GetResMgr())),
527         aWrtFieldCB(this, ResId(        CB_WRITERFIELDSHADINGS, *rResId.GetResMgr())),
528         aWrtFieldLB(this, ResId(        LB_WRITERFIELDSHADINGS, *rResId.GetResMgr())),
529         aWrtFieldWN(this, ResId(        WN_WRITERFIELDSHADINGS, *rResId.GetResMgr())),
530         aWrtIdxShadingBackCB(this, ResId(  CB_WRITERIDXSHADINGS, *rResId.GetResMgr())),
531         aWrtIdxShadingBackLB(this, ResId(  LB_WRITERIDXSHADINGS, *rResId.GetResMgr())),
532         aWrtIdxShadingBackWN(this, ResId(  WN_WRITERIDXSHADINGS, *rResId.GetResMgr())),
533         aWrtScriptIndicatorFT(this, ResId(      FT_WRITERSCRIPTINDICATOR, *rResId.GetResMgr())),
534         aWrtScriptIndicatorLB(this, ResId(      LB_WRITERSCRIPTINDICATOR, *rResId.GetResMgr())),
535         aWrtScriptIndicatorWN(this, ResId(      WN_WRITERSCRIPTINDICATOR, *rResId.GetResMgr())),
536         aWrtSectionBoundCB(this, ResId(      CB_WRITERSECTIONBOUNDARIES, *rResId.GetResMgr())),
537         aWrtSectionBoundLB(this, ResId(      LB_WRITERSECTIONBOUNDARIES, *rResId.GetResMgr())),
538         aWrtSectionBoundWN(this, ResId(      WN_WRITERSECTIONBOUNDARIES, *rResId.GetResMgr())),
539         aWrtPageBreaksFT(this, ResId(      FT_WRITERPAGEBREAKS, *rResId.GetResMgr())),
540         aWrtPageBreaksLB(this, ResId(      LB_WRITERPAGEBREAKS, *rResId.GetResMgr())),
541         aWrtPageBreaksWN(this, ResId(      WN_WRITERPAGEBREAKS, *rResId.GetResMgr())),
542         aWrtDirectCrsrFT(this, ResId(      FT_WRITERDIRECTCURSOR, *rResId.GetResMgr())),
543         aWrtDirectCrsrLB(this, ResId(      LB_WRITERDIRECTCURSOR, *rResId.GetResMgr())),
544         aWrtDirectCrsrWN(this, ResId(      WN_WRITERDIRECTCURSOR, *rResId.GetResMgr())),
545         aHTMLBackWN(this),
546         aHTMLFT(this, ResId(            FT_HTML, *rResId.GetResMgr())),
547         aHTMLSGMLFT(this, ResId(        FT_HTMLSGML, *rResId.GetResMgr())),
548         aHTMLSGMLLB(this, ResId(        LB_HTMLSGML, *rResId.GetResMgr())),
549         aHTMLSGMLWN(this, ResId(        WN_HTMLSGML, *rResId.GetResMgr())),
550         aHTMLCommentFT(this, ResId(     FT_HTMLCOMMENT, *rResId.GetResMgr())),
551         aHTMLCommentLB(this, ResId(     LB_HTMLCOMMENT, *rResId.GetResMgr())),
552         aHTMLCommentWN(this, ResId(     WN_HTMLCOMMENT, *rResId.GetResMgr())),
553         aHTMLKeywdFT(this, ResId(       FT_HTMLKEYWORD, *rResId.GetResMgr())),
554         aHTMLKeywdLB(this, ResId(       LB_HTMLKEYWORD, *rResId.GetResMgr())),
555         aHTMLKeywdWN(this, ResId(       WN_HTMLKEYWORD, *rResId.GetResMgr())),
556         aHTMLUnknownFT(this, ResId(     FT_HTMLUNKNOWN, *rResId.GetResMgr())),
557         aHTMLUnknownLB(this, ResId(     LB_HTMLUNKNOWN, *rResId.GetResMgr())),
558         aHTMLUnknownWN(this, ResId(     WN_HTMLUNKNOWN, *rResId.GetResMgr())),
559         aCalcBackWN(this),
560         aCalcFT(this, ResId(    FT_CALC, *rResId.GetResMgr())),
561         aCalcGridFT(this, ResId(        FT_CALCGRID, *rResId.GetResMgr())),
562         aCalcGridLB(this, ResId(        LB_CALCGRID, *rResId.GetResMgr())),
563         aCalcGridWN(this, ResId(        WN_CALCGRID, *rResId.GetResMgr())),
564         aCalcPageBreakFT(this, ResId(   FT_CALCPAGEBREAK, *rResId.GetResMgr())),
565         aCalcPageBreakLB(this, ResId(   LB_CALCPAGEBREAK, *rResId.GetResMgr())),
566         aCalcPageBreakWN(this, ResId(   WN_CALCPAGEBREAK, *rResId.GetResMgr())),
567         aCalcPageBreakManualFT(this, ResId(   FT_CALCPAGEBREAKMANUAL, *rResId.GetResMgr())),
568         aCalcPageBreakManualLB(this, ResId(   LB_CALCPAGEBREAKMANUAL, *rResId.GetResMgr())),
569         aCalcPageBreakManualWN(this, ResId(   WN_CALCPAGEBREAKMANUAL, *rResId.GetResMgr())),
570         aCalcPageBreakAutoFT(this, ResId(   FT_CALCPAGEBREAKAUTO, *rResId.GetResMgr())),
571         aCalcPageBreakAutoLB(this, ResId(   LB_CALCPAGEBREAKAUTO, *rResId.GetResMgr())),
572         aCalcPageBreakAutoWN(this, ResId(   WN_CALCPAGEBREAKAUTO, *rResId.GetResMgr())),
573         aCalcDetectiveFT(this, ResId(   FT_CALCDETECTIVE, *rResId.GetResMgr())),
574         aCalcDetectiveLB(this, ResId(   LB_CALCDETECTIVE, *rResId.GetResMgr())),
575         aCalcDetectiveWN(this, ResId(   WN_CALCDETECTIVE, *rResId.GetResMgr())),
576         aCalcDetectiveErrorFT(this, ResId(   FT_CALCDETECTIVEERROR, *rResId.GetResMgr())),
577         aCalcDetectiveErrorLB(this, ResId(   LB_CALCDETECTIVEERROR, *rResId.GetResMgr())),
578         aCalcDetectiveErrorWN(this, ResId(   WN_CALCDETECTIVEERROR, *rResId.GetResMgr())),
579         aCalcReferenceFT(this, ResId(   FT_CALCREFERENCE, *rResId.GetResMgr())),
580         aCalcReferenceLB(this, ResId(   LB_CALCREFERENCE, *rResId.GetResMgr())),
581         aCalcReferenceWN(this, ResId(   WN_CALCREFERENCE, *rResId.GetResMgr())),
582         aCalcNotesBackFT(this, ResId(   FT_CALCNOTESBACKGROUND, *rResId.GetResMgr())),
583         aCalcNotesBackLB(this, ResId(   LB_CALCNOTESBACKGROUND, *rResId.GetResMgr())),
584         aCalcNotesBackWN(this, ResId(   WN_CALCNOTESBACKGROUND, *rResId.GetResMgr())),
585         aDrawBackWN(this),
586         aDrawFT(this, ResId(            FT_DRAW, *rResId.GetResMgr())),
587         aDrawGridFT(this, ResId(        FT_DRAWGRID, *rResId.GetResMgr())),
588         aDrawGridLB(this, ResId(        LB_DRAWGRID, *rResId.GetResMgr())),
589         aDrawGridWN(this, ResId(        WN_DRAWGRID, *rResId.GetResMgr())),
590         aBasicBackWN(this),
591         aBasicFT(this, ResId(            FT_BASIC, *rResId.GetResMgr())),
592         aBasicIdentifierFT(this, ResId( FT_BASICIDENTIFIER, *rResId.GetResMgr())),
593         aBasicIdentifierLB(this, ResId( LB_BASICIDENTIFIER, *rResId.GetResMgr())),
594         aBasicIdentifierWN(this, ResId( WN_BASICIDENTIFIER, *rResId.GetResMgr())),
595         aBasicCommentFT(this, ResId( FT_BASICCOMMENT, *rResId.GetResMgr())),
596         aBasicCommentLB(this, ResId( LB_BASICCOMMENT, *rResId.GetResMgr())),
597         aBasicCommentWN(this, ResId( WN_BASICCOMMENT, *rResId.GetResMgr())),
598         aBasicNumberFT(this, ResId( FT_BASICNUMBER, *rResId.GetResMgr())),
599         aBasicNumberLB(this, ResId( LB_BASICNUMBER, *rResId.GetResMgr())),
600         aBasicNumberWN(this, ResId( WN_BASICNUMBER, *rResId.GetResMgr())),
601         aBasicStringFT(this, ResId( FT_BASICSTRING, *rResId.GetResMgr())),
602         aBasicStringLB(this, ResId( LB_BASICSTRING, *rResId.GetResMgr())),
603         aBasicStringWN(this, ResId( WN_BASICSTRING, *rResId.GetResMgr())),
604         aBasicOperatorFT(this, ResId( FT_BASICOPERATOR, *rResId.GetResMgr())),
605         aBasicOperatorLB(this, ResId( LB_BASICOPERATOR, *rResId.GetResMgr())),
606         aBasicOperatorWN(this, ResId( WN_BASICOPERATOR, *rResId.GetResMgr())),
607         aBasicKeywordFT(this, ResId( FT_BASICKEYWORD, *rResId.GetResMgr())),
608         aBasicKeywordLB(this, ResId( LB_BASICKEYWORD, *rResId.GetResMgr())),
609         aBasicKeywordWN(this, ResId( WN_BASICKEYWORD, *rResId.GetResMgr())),
610         aBasicErrorFT(this, ResId( FT_BASICERROR, *rResId.GetResMgr())),
611         aBasicErrorLB(this, ResId( LB_BASICERROR, *rResId.GetResMgr())),
612         aBasicErrorWN(this, ResId( WN_BASICERROR, *rResId.GetResMgr())),
613 
614 		aSQLBackWN(this),
615 		aSQLFT(this, ResId(            FT_SQL_COMMAND, *rResId.GetResMgr())),
616 		aSQLIdentifierFT(this, ResId( FT_SQLIDENTIFIER, *rResId.GetResMgr())),
617         aSQLIdentifierLB(this, ResId( LB_SQLIDENTIFIER, *rResId.GetResMgr())),
618         aSQLIdentifierWN(this, ResId( WN_SQLIDENTIFIER, *rResId.GetResMgr())),
619 
620 		aSQLNumberFT(this, ResId( FT_SQLNUMBER, *rResId.GetResMgr())),
621         aSQLNumberLB(this, ResId( LB_SQLNUMBER, *rResId.GetResMgr())),
622         aSQLNumberWN(this, ResId( WN_SQLNUMBER, *rResId.GetResMgr())),
623 
624 		aSQLStringFT(this, ResId( FT_SQLSTRING, *rResId.GetResMgr())),
625         aSQLStringLB(this, ResId( LB_SQLSTRING, *rResId.GetResMgr())),
626         aSQLStringWN(this, ResId( WN_SQLSTRING, *rResId.GetResMgr())),
627 
628 		aSQLOperatorFT(this, ResId( FT_SQLOPERATOR, *rResId.GetResMgr())),
629         aSQLOperatorLB(this, ResId( LB_SQLOPERATOR, *rResId.GetResMgr())),
630         aSQLOperatorWN(this, ResId( WN_SQLOPERATOR, *rResId.GetResMgr())),
631 
632 		aSQLKeywordFT(this, ResId( FT_SQLKEYWORD, *rResId.GetResMgr())),
633         aSQLKeywordLB(this, ResId( LB_SQLKEYWORD, *rResId.GetResMgr())),
634         aSQLKeywordWN(this, ResId( WN_SQLKEYWORD, *rResId.GetResMgr())),
635 
636 		aSQLParameterFT(this, ResId( FT_SQLPARAMETER, *rResId.GetResMgr())),
637         aSQLParameterLB(this, ResId( LB_SQLPARAMETER, *rResId.GetResMgr())),
638         aSQLParameterWN(this, ResId( WN_SQLPARAMETER, *rResId.GetResMgr())),
639 
640 		aSQLCommentFT(this, ResId( FT_SQLCOMMENT, *rResId.GetResMgr())),
641         aSQLCommentLB(this, ResId( LB_SQLCOMMENT, *rResId.GetResMgr())),
642         aSQLCommentWN(this, ResId( WN_SQLCOMMENT, *rResId.GetResMgr()))
643 {
644 	aFixedTexts.resize(ColorConfigEntryCount);
645 	aCheckBoxes.resize(ColorConfigEntryCount);
646 	aColorBoxes.resize(ColorConfigEntryCount);
647 	aWindows.resize(ColorConfigEntryCount);
648 
649     aFixedTexts[DOCCOLOR         ] = &aDocColorFT;
650     aCheckBoxes[DOCBOUNDARIES       ] = &aDocBoundCB             ;
651     aFixedTexts[APPBACKGROUND    ] = &aAppBackFT;
652     aCheckBoxes[OBJECTBOUNDARIES    ] = &aObjBoundCB             ;
653     aCheckBoxes[TABLEBOUNDARIES     ] = &aTableBoundCB           ;
654     aFixedTexts[FONTCOLOR           ] = &aFontColorFT            ;
655     aCheckBoxes[LINKS               ] = &aLinksCB                ;
656     aCheckBoxes[LINKSVISITED        ] = &aLinksVisitedCB         ;
657     aFixedTexts[SPELL            ]=& aSpellFT;
658     aFixedTexts[SMARTTAGS        ]=& aSmarttagsFT;
659     aFixedTexts[WRITERTEXTGRID   ]=& aWrtTextGridFT;
660     aCheckBoxes[WRITERFIELDSHADINGS ] = &aWrtFieldCB             ;
661     aCheckBoxes[WRITERIDXSHADINGS   ] = &aWrtIdxShadingBackCB       ;
662     aFixedTexts[WRITERDIRECTCURSOR  ]=& aWrtDirectCrsrFT;
663     aFixedTexts[WRITERSCRIPTINDICATOR   ]=& aWrtScriptIndicatorFT;
664     aCheckBoxes[WRITERSECTIONBOUNDARIES ]=& aWrtSectionBoundCB;
665     aFixedTexts[HTMLSGML         ]=& aHTMLSGMLFT;
666     aFixedTexts[HTMLCOMMENT      ]=& aHTMLCommentFT;
667     aFixedTexts[HTMLKEYWORD      ]=& aHTMLKeywdFT;
668     aFixedTexts[HTMLUNKNOWN      ]=& aHTMLUnknownFT;
669     aFixedTexts[CALCGRID            ] = &aCalcGridFT             ;
670     aFixedTexts[CALCPAGEBREAK    ] = &aCalcPageBreakFT;
671     aFixedTexts[CALCPAGEBREAKMANUAL    ] = &aCalcPageBreakManualFT;
672     aFixedTexts[CALCPAGEBREAKAUTOMATIC ] = &aCalcPageBreakAutoFT;
673     aFixedTexts[CALCDETECTIVE    ]=& aCalcDetectiveFT;
674     aFixedTexts[CALCDETECTIVEERROR    ]=& aCalcDetectiveErrorFT;
675     aFixedTexts[CALCREFERENCE    ]=& aCalcReferenceFT;
676     aFixedTexts[CALCNOTESBACKGROUND  ]=& aCalcNotesBackFT;
677     aFixedTexts[WRITERPAGEBREAKS] = &aWrtPageBreaksFT;
678     aFixedTexts[DRAWGRID            ] = &aDrawGridFT             ;
679     aFixedTexts[BASICIDENTIFIER ] = &aBasicIdentifierFT;
680     aFixedTexts[BASICCOMMENT    ] = &aBasicCommentFT;
681     aFixedTexts[BASICNUMBER     ] = &aBasicNumberFT;
682     aFixedTexts[BASICSTRING     ] = &aBasicStringFT;
683     aFixedTexts[BASICOPERATOR   ] = &aBasicOperatorFT;
684     aFixedTexts[BASICKEYWORD    ] = &aBasicKeywordFT;
685     aFixedTexts[BASICERROR		] = &aBasicErrorFT;
686 	aFixedTexts[SQLIDENTIFIER	] = &aSQLIdentifierFT;
687 	aFixedTexts[SQLNUMBER		] = &aSQLNumberFT;
688 	aFixedTexts[SQLSTRING		] = &aSQLStringFT;
689 	aFixedTexts[SQLOPERATOR		] = &aSQLOperatorFT;
690 	aFixedTexts[SQLKEYWORD		] = &aSQLKeywordFT;
691 	aFixedTexts[SQLPARAMETER	] = &aSQLParameterFT;
692 	aFixedTexts[SQLCOMMENT		] = &aSQLCommentFT;
693 
694 	aColorBoxes[DOCCOLOR            ] = &aDocColorLB             ;
695     aColorBoxes[DOCBOUNDARIES       ] = &aDocBoundLB             ;
696     aColorBoxes[APPBACKGROUND       ] = &aAppBackLB              ;
697     aColorBoxes[OBJECTBOUNDARIES    ] = &aObjBoundLB             ;
698     aColorBoxes[TABLEBOUNDARIES     ] = &aTableBoundLB           ;
699     aColorBoxes[FONTCOLOR           ] = &aFontColorLB            ;
700     aColorBoxes[LINKS               ] = &aLinksLB                ;
701     aColorBoxes[LINKSVISITED        ] = &aLinksVisitedLB         ;
702     aColorBoxes[SPELL               ] = &aSpellLB             ;
703     aColorBoxes[SMARTTAGS           ] = &aSmarttagsLB             ;
704     aColorBoxes[WRITERTEXTGRID      ] = &aWrtTextGridLB          ;
705     aColorBoxes[WRITERFIELDSHADINGS ] = &aWrtFieldLB             ;
706     aColorBoxes[WRITERIDXSHADINGS   ] = &aWrtIdxShadingBackLB       ;
707     aColorBoxes[WRITERDIRECTCURSOR  ] = &aWrtDirectCrsrLB           ;
708     aColorBoxes[WRITERSCRIPTINDICATOR    ] = &aWrtScriptIndicatorLB           ;
709     aColorBoxes[WRITERSECTIONBOUNDARIES  ] = &aWrtSectionBoundLB           ;
710     aColorBoxes[WRITERPAGEBREAKS] = &aWrtPageBreaksLB;
711     aColorBoxes[HTMLSGML            ] = &aHTMLSGMLLB             ;
712     aColorBoxes[HTMLCOMMENT         ] = &aHTMLCommentLB          ;
713     aColorBoxes[HTMLKEYWORD         ] = &aHTMLKeywdLB            ;
714     aColorBoxes[HTMLUNKNOWN         ] = &aHTMLUnknownLB          ;
715     aColorBoxes[CALCGRID            ] = &aCalcGridLB             ;
716     aColorBoxes[CALCPAGEBREAK       ] = &aCalcPageBreakLB       ;
717     aColorBoxes[CALCPAGEBREAKMANUAL ] = &aCalcPageBreakManualLB       ;
718     aColorBoxes[CALCPAGEBREAKAUTOMATIC]= &aCalcPageBreakAutoLB       ;
719     aColorBoxes[CALCDETECTIVE       ] = &aCalcDetectiveLB        ;
720     aColorBoxes[CALCDETECTIVEERROR  ] = &aCalcDetectiveErrorLB        ;
721     aColorBoxes[CALCREFERENCE       ] = &aCalcReferenceLB        ;
722     aColorBoxes[CALCNOTESBACKGROUND     ] = &aCalcNotesBackLB            ;
723     aColorBoxes[DRAWGRID            ] = &aDrawGridLB             ;
724     aColorBoxes[BASICIDENTIFIER		] = &aBasicIdentifierLB;
725     aColorBoxes[BASICCOMMENT		] = &aBasicCommentLB;
726     aColorBoxes[BASICNUMBER			] = &aBasicNumberLB;
727     aColorBoxes[BASICSTRING			] = &aBasicStringLB;
728     aColorBoxes[BASICOPERATOR		] = &aBasicOperatorLB;
729     aColorBoxes[BASICKEYWORD		] = &aBasicKeywordLB;
730     aColorBoxes[BASICERROR			] = &aBasicErrorLB;
731 	aColorBoxes[SQLIDENTIFIER		] = &aSQLIdentifierLB;
732 	aColorBoxes[SQLNUMBER			] = &aSQLNumberLB;
733 	aColorBoxes[SQLSTRING			] = &aSQLStringLB;
734 	aColorBoxes[SQLOPERATOR			] = &aSQLOperatorLB;
735 	aColorBoxes[SQLKEYWORD			] = &aSQLKeywordLB;
736 	aColorBoxes[SQLPARAMETER		] = &aSQLParameterLB;
737 	aColorBoxes[SQLCOMMENT			] = &aSQLCommentLB;
738 
739 	aWindows[DOCCOLOR            ] = &aDocColorWN             ;
740     aWindows[DOCBOUNDARIES       ] = &aDocBoundWN             ;
741     aWindows[APPBACKGROUND       ] = &aAppBackWN              ;
742     aWindows[OBJECTBOUNDARIES    ] = &aObjBoundWN             ;
743     aWindows[TABLEBOUNDARIES     ] = &aTableBoundWN           ;
744     aWindows[FONTCOLOR           ] = &aFontColorWN            ;
745     aWindows[LINKS               ] = &aLinksWN                ;
746     aWindows[LINKSVISITED        ] = &aLinksVisitedWN         ;
747     aWindows[SPELL               ] = &aSpellWN             ;
748     aWindows[SMARTTAGS           ] = &aSmarttagsWN             ;
749     aWindows[WRITERTEXTGRID      ] = &aWrtTextGridWN          ;
750     aWindows[WRITERFIELDSHADINGS ] = &aWrtFieldWN             ;
751     aWindows[WRITERIDXSHADINGS   ] = &aWrtIdxShadingBackWN       ;
752     aWindows[WRITERDIRECTCURSOR  ] = &aWrtDirectCrsrWN           ;
753     aWindows[WRITERSCRIPTINDICATOR    ] = &aWrtScriptIndicatorWN           ;
754     aWindows[WRITERSECTIONBOUNDARIES  ] = &aWrtSectionBoundWN           ;
755     aWindows[WRITERPAGEBREAKS] = &aWrtPageBreaksWN;
756     aWindows[HTMLSGML            ] = &aHTMLSGMLWN             ;
757     aWindows[HTMLCOMMENT         ] = &aHTMLCommentWN          ;
758     aWindows[HTMLKEYWORD         ] = &aHTMLKeywdWN            ;
759     aWindows[HTMLUNKNOWN         ] = &aHTMLUnknownWN          ;
760     aWindows[CALCGRID            ] = &aCalcGridWN             ;
761     aWindows[CALCPAGEBREAK       ] = &aCalcPageBreakWN        ;
762     aWindows[CALCPAGEBREAKMANUAL ] = &aCalcPageBreakManualWN        ;
763     aWindows[CALCPAGEBREAKAUTOMATIC] = &aCalcPageBreakAutoWN        ;
764     aWindows[CALCDETECTIVE       ] = &aCalcDetectiveWN        ;
765     aWindows[CALCDETECTIVEERROR  ] = &aCalcDetectiveErrorWN        ;
766     aWindows[CALCREFERENCE       ] = &aCalcReferenceWN        ;
767     aWindows[CALCNOTESBACKGROUND ] = &aCalcNotesBackWN            ;
768     aWindows[DRAWGRID            ] = &aDrawGridWN             ;
769     aWindows[BASICIDENTIFIER     ] = &aBasicIdentifierWN;
770     aWindows[BASICCOMMENT        ] = &aBasicCommentWN;
771     aWindows[BASICNUMBER         ] = &aBasicNumberWN;
772     aWindows[BASICSTRING         ] = &aBasicStringWN;
773     aWindows[BASICOPERATOR       ] = &aBasicOperatorWN;
774     aWindows[BASICKEYWORD        ] = &aBasicKeywordWN;
775     aWindows[BASICERROR          ] = &aBasicErrorWN;
776 	aWindows[SQLIDENTIFIER		 ] = &aSQLIdentifierWN;
777 	aWindows[SQLNUMBER			 ] = &aSQLNumberWN;
778 	aWindows[SQLSTRING			 ] = &aSQLStringWN;
779 	aWindows[SQLOPERATOR	     ] = &aSQLOperatorWN;
780 	aWindows[SQLKEYWORD		     ] = &aSQLKeywordWN;
781 	aWindows[SQLPARAMETER	     ] = &aSQLParameterWN;
782 	aWindows[SQLCOMMENT		     ] = &aSQLCommentWN;
783 
784 	aChapters.push_back(&aGeneralFT); aChapterWins.push_back(&aGeneralBackWN);
785     aChapters.push_back(&aWriterFT);  aChapterWins.push_back(&aWriterBackWN);
786     aChapters.push_back(&aHTMLFT);    aChapterWins.push_back(&aHTMLBackWN);
787     aChapters.push_back(&aCalcFT);    aChapterWins.push_back(&aCalcBackWN);
788     aChapters.push_back(&aDrawFT);    aChapterWins.push_back(&aDrawBackWN);
789     aChapters.push_back(&aBasicFT);   aChapterWins.push_back(&aBasicBackWN);
790 	aChapters.push_back(&aSQLFT);   aChapterWins.push_back(&aSQLBackWN);
791 
792     // calculate heights of groups which can be hidden
793     aChapters[GROUP_WRITER  ]->SetGroupHeight( aChapters[GROUP_HTML]->GetPosPixel().Y() -  aChapters[GROUP_WRITER]->GetPosPixel().Y() );
794     aChapters[GROUP_HTML    ]->SetGroupHeight( aChapters[GROUP_CALC]->GetPosPixel().Y() -  aChapters[GROUP_HTML]->GetPosPixel().Y() );
795     aChapters[GROUP_CALC    ]->SetGroupHeight( aChapters[GROUP_DRAW]->GetPosPixel().Y() -  aChapters[GROUP_CALC]->GetPosPixel().Y() );
796     aChapters[GROUP_DRAW    ]->SetGroupHeight( aChapters[GROUP_BASIC]->GetPosPixel().Y() - aChapters[GROUP_DRAW]->GetPosPixel().Y() );
797 	aChapters[GROUP_BASIC   ]->SetGroupHeight( aChapters[GROUP_SQL]->GetPosPixel().Y() - aChapters[GROUP_BASIC]->GetPosPixel().Y() );
798 
799     ExtendedColorConfig aExtConfig;
800 	sal_Int32 nExtCount = aExtConfig.GetComponentCount();
801 	if ( nExtCount )
802 	{
803         // calculate position behind last chapter
804         sal_Int32 nLastY = aSQLCommentWN.GetPosPixel().Y() + aSQLCommentWN.GetSizePixel().Height();
805         nLastY = nLastY + LogicToPixel( Size( 0, 3 ), MAP_APPFONT ).Height();
806         // to calculate the number of lines
807         sal_Int32 nHeight = LogicToPixel( Size( 0, _LINE_HEIGHT ), MAP_APPFONT ).Height();
808         sal_Int32 nLineNum = nLastY / nHeight;
809 
810         Point aFixedPos = LogicToPixel( Point( _FT_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT );
811 		Point aLBPos = LogicToPixel( Point( _LB_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT );
812 		Size aFixedSize = LogicToPixel( Size( _FT_WIDTH , _FT_HEIGHT ), MAP_APPFONT );
813 		Size aLBSize = LogicToPixel( Size( _LB_WIDTH , _LB_HEIGHT ), MAP_APPFONT );
814 		Size aWinSize = LogicToPixel( Size( _WN_WIDTH , _WN_HEIGHT ), MAP_APPFONT );
815 
816 		for (sal_Int32 j = 0; j < nExtCount; ++j)
817 		{
818 			::rtl::OUString sComponentName = aExtConfig.GetComponentName(j);
819 			aChapterWins.push_back(new Window(this));
820 			::boost::shared_ptr<SvxExtFixedText_Impl> pTitle(new SvxExtFixedText_Impl(this,ResId(FT_SQL_COMMAND, *rResId.GetResMgr())));
821 			m_aExtensionTitles.push_back(pTitle);
822 			pTitle->SetPosSizePixel(LogicToPixel( Point( _FT_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aFixedSize);
823 			pTitle->SetText(aExtConfig.GetComponentDisplayName(sComponentName));
824 			aChapters.push_back(pTitle.get());
825 			++nLineNum;
826 			sal_Int32 nColorCount = aExtConfig.GetComponentColorCount(sComponentName);
827 			for (sal_Int32 i = 0; i < nColorCount; ++i,++nLineNum)
828 			{
829 				ExtendedColorConfigValue aColorEntry = aExtConfig.GetComponentColorConfigValue(sComponentName,i);
830 				FixedText* pFixedText = new FixedText(this,ResId(FT_BASICERROR, *rResId.GetResMgr()));
831 				pFixedText->SetPosSizePixel(LogicToPixel( Point( _FT_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aFixedSize);
832 				pFixedText->SetText(aColorEntry.getDisplayName());
833 				aFixedTexts.push_back(pFixedText);
834 				aCheckBoxes.push_back(NULL); // no checkboxes
835 				ColorListBox* pColorBox = new ColorListBox(this,ResId(LB_BASICERROR, *rResId.GetResMgr()));
836 				pColorBox->SetPosSizePixel(LogicToPixel( Point( _LB_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aLBSize);
837 				aColorBoxes.push_back(pColorBox);
838 				Window* pWin = new Window(this,ResId(WN_BASICERROR, *rResId.GetResMgr()));
839 				pWin->SetPosSizePixel(LogicToPixel( Point( _WN_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aWinSize);
840 				aWindows.push_back(pWin);
841 			} // for (sal_Int32 i = 0; i < nExtCount; ++i,++nLineNum)
842 		}
843 	}
844 
845 	FreeResource();
846 
847     Color TempColor(COL_TRANSPARENT);
848     Wallpaper aTransparentWall(TempColor);
849     sal_Int32 nWinWidth = GetSizePixel().Width();
850     sal_Int32 nFTHeight = aChapters[0]->GetSizePixel().Height();
851 	Color aBackColor;
852     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
853     sal_Bool bHighContrast = rStyleSettings.GetHighContrastMode();
854     if ( bHighContrast )
855         aBackColor = rStyleSettings.GetShadowColor();
856 	else
857 		aBackColor = Color( COL_LIGHTGRAY);
858 	sal_Int32 nCount = aChapterWins.size();
859     for(sal_Int32 i = 0; i < nCount; ++i)
860     {
861         if ( lcl_isGroupVisible( i, m_aModuleOptions ) )
862         {
863             Font aFont = aChapters[i]->GetFont();
864             aFont.SetWeight(WEIGHT_BOLD);
865             aChapters[i]->SetFont(aFont);
866             aChapters[i]->SetBackground(aTransparentWall);
867             aChapterWins[i]->SetPosSizePixel( Point(0, aChapters[i]->GetPosPixel().Y()),
868                                 Size(nWinWidth, nFTHeight));
869             aChapterWins[i]->SetBackground(Wallpaper(aBackColor));
870             aChapterWins[i]->Show();
871         }
872         else
873         {
874             aChapters[i]->Hide();
875             aChapterWins[i]->Hide();
876         }
877     }
878     Color aTextColor;
879     sal_Bool bSetTextColor = sal_False;
880     //#104195# when the window color is the same as the text color it has to be changed
881     Color aWinCol = rStyleSettings.GetWindowColor();
882     Color aRCheckCol = rStyleSettings.GetRadioCheckTextColor();
883     if(aWinCol == aRCheckCol )
884     {
885         bSetTextColor = sal_True;
886         aRCheckCol.Invert();
887         //if inversion didn't work (gray) then it's set to black
888         if(aRCheckCol == aWinCol)
889             aRCheckCol = Color(COL_BLACK);
890     } // if(aWinCol == aRCheckCol )
891 	nCount = aFixedTexts.size();
892     sal_Int16 nGroup = GROUP_UNKNOWN;
893     for( sal_Int32 i = 0; i < nCount; i++ )
894     {
895         if(ANCHOR == i)
896             continue;
897         sal_Int16 nNewGroup = lcl_getGroup(i);
898         sal_Bool bShow = lcl_isGroupVisible( nNewGroup, m_aModuleOptions );
899 
900         if ( nNewGroup > nGroup )
901         {
902             nGroup = nNewGroup;
903             if ( bShow && nGroup >= GROUP_CALC )
904             {
905                 SetNewPosition( i, aChapters[nGroup] );
906                 SetNewPosition( i, aChapterWins[nGroup] );
907             }
908         }
909         if(aCheckBoxes[i])
910         {
911             if ( bShow )
912                 SetNewPosition( i, aCheckBoxes[i] );
913             else
914                 aCheckBoxes[i]->Hide();
915             aCheckBoxes[i]->SetBackground(aTransparentWall);
916             aCheckBoxes[i]->SetHelpId( aColorCBHids[i] );
917             if(bSetTextColor)
918                 aCheckBoxes[i]->SetTextColor(aRCheckCol);
919         }
920         if(aFixedTexts[i])
921         {
922             if ( bShow )
923                 SetNewPosition( i, aFixedTexts[i] );
924             else
925                 aFixedTexts[i]->Hide();
926             aFixedTexts[i]->SetBackground(aTransparentWall);
927             if(bSetTextColor)
928                 aFixedTexts[i]->SetTextColor(aRCheckCol);
929         }
930         if(aWindows[i])
931         {
932             if ( bShow )
933                 SetNewPosition( i, aWindows[i] );
934             else
935                 aWindows[i]->Hide();
936             aWindows[i]->SetBorderStyle(WINDOW_BORDER_MONO);
937         }
938 
939         if ( aColorBoxes[i] )
940         {
941             if ( bShow )
942                 SetNewPosition( i, aColorBoxes[i] );
943             else
944                 aColorBoxes[i]->Hide();
945         }
946     }
947 
948     XColorListSharedPtr aColorTable(XPropertyListFactory::CreateSharedXColorList(SvtPathOptions().GetPalettePath()));
949     aColorBoxes[0]->InsertAutomaticEntry();
950     for( sal_Int32 i = 0; i < aColorTable->Count(); i++ )
951 	{
952         XColorEntry* pEntry = aColorTable->GetColor(i);
953         aColorBoxes[0]->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
954 	}
955 
956     aColorBoxes[0]->SetHelpId( aColorLBHids[0] );
957     aColorBoxes[0]->SetDropDownLineCount( 10 );
958     const sal_Int32 nColorLBHids = sizeof( aColorLBHids )/ sizeof( aColorLBHids[0] );
959 
960     for( sal_Int32 i = 1; i < nCount; i++ )
961     {
962         if( !aColorBoxes[i] )
963             continue;
964 
965         aColorBoxes[i]->CopyEntries( *aColorBoxes[0] );
966         if( i < nColorLBHids )
967             aColorBoxes[i]->SetHelpId( aColorLBHids[i] );
968         aColorBoxes[i]->SetDropDownLineCount( 10 );
969     }
970 }
971 /* -----------------------------27.03.2002 11:04------------------------------
972 
973  ---------------------------------------------------------------------------*/
~ColorConfigWindow_Impl()974 ColorConfigWindow_Impl::~ColorConfigWindow_Impl()
975 {
976 	aChapters.clear();
977 	::std::vector< SvxExtFixedText_Impl*>().swap(aChapters);
978 
979 
980 	sal_Int32 nCount = aFixedTexts.size();
981 	for (sal_Int32 i = ColorConfigEntryCount; i < nCount; ++i)
982 	{
983 		delete aFixedTexts[i];
984 		delete aCheckBoxes[i];
985 		delete aColorBoxes[i];
986 		delete aWindows[i];
987 	}
988 	for (sal_uInt32 i = GROUP_COUNT; i < aChapterWins.size(); ++i)
989 		delete aChapterWins[i];
990 	aChapterWins.clear();
991 	::std::vector< Window*>().swap(aChapterWins);
992 }
993 /* -----------------------------2002/06/20 12:48------------------------------
994 
995  ---------------------------------------------------------------------------*/
DataChanged(const DataChangedEvent & rDCEvt)996 void ColorConfigWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
997 {
998     Window::DataChanged( rDCEvt );
999     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
1000          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
1001     {
1002         const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
1003         sal_Bool bHighContrast = rStyleSettings.GetHighContrastMode();
1004         Color aBackColor( bHighContrast ? COL_TRANSPARENT : COL_LIGHTGRAY);
1005 		::std::vector< Window* >::iterator aIter = aChapterWins.begin();
1006 		::std::vector< Window* >::iterator aEnd  = aChapterWins.end();
1007         for(;aIter != aEnd; ++aIter )
1008             (*aIter)->SetBackground(Wallpaper(aBackColor));
1009         SetBackground(Wallpaper(rStyleSettings.GetWindowColor()));
1010     }
1011 }
1012 /* -----------------------------2002/06/26 10:49------------------------------
1013 
1014  ---------------------------------------------------------------------------*/
DataChanged(const DataChangedEvent & rDCEvt)1015 void SvxExtFixedText_Impl::DataChanged(const DataChangedEvent& rDCEvt)
1016 {
1017     FixedText::DataChanged(rDCEvt);
1018     Color TempColor(COL_TRANSPARENT);
1019     Wallpaper aTransparentWall(TempColor);
1020     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
1021          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
1022     {
1023         Font aFont = GetFont();
1024         aFont.SetWeight(WEIGHT_BOLD);
1025         SetFont(aFont);
1026         SetBackground(aTransparentWall);
1027     }
1028 }
1029 
SetNewPosition(sal_Int32 _nFeature,Window * _pWin)1030 void ColorConfigWindow_Impl::SetNewPosition( sal_Int32 _nFeature, Window* _pWin )
1031 {
1032     DBG_ASSERT( _pWin, "ColorConfigWindow_Impl::SetNewPosition(): no window" );
1033 
1034     // calculate the overall height of the invisible groups
1035     long nDelta = 0;
1036     sal_Int16 nGroup = lcl_getGroup( _nFeature ) - 1;
1037     while ( nGroup > 0 ) // GROUP_GENERAL (0) is always visible
1038     {
1039         if ( !lcl_isGroupVisible( nGroup, m_aModuleOptions ) )
1040             nDelta += aChapters[nGroup]->GetGroupHeight();
1041         nGroup--;
1042     }
1043 
1044     // move this window to its new position
1045     if ( nDelta > 0 )
1046     {
1047         Point aPos = _pWin->GetPosPixel();
1048         aPos.Y() -= nDelta;
1049         _pWin->SetPosPixel( aPos );
1050     }
1051 }
1052 
1053 /* -----------------------------08.04.2002 17:10------------------------------
1054 
1055  ---------------------------------------------------------------------------*/
Command(const CommandEvent & rCEvt)1056 void ColorConfigWindow_Impl::Command( const CommandEvent& rCEvt )
1057 {
1058     GetParent()->Command(rCEvt);
1059 }
1060 /* -----------------------------25.03.2002 10:44------------------------------
1061 
1062  ---------------------------------------------------------------------------*/
1063 class ColorConfigCtrl_Impl : public Control
1064 {
1065     HeaderBar               aHeaderHB;
1066     ScrollBar               aVScroll;
1067 
1068     String                  sOn;
1069     String                  sUIElem;
1070     String                  sColSetting;
1071     String                  sPreview;
1072     ColorConfigWindow_Impl  aScrollWindow;
1073 
1074     EditableColorConfig*			pColorConfig;
1075 	EditableExtendedColorConfig*	pExtColorConfig;
1076 
1077     long            nScrollPos;
1078 
1079     DECL_LINK(ScrollHdl, ScrollBar*);
1080     DECL_LINK(ClickHdl, CheckBox*);
1081     DECL_LINK(ColorHdl, ColorListBox*);
1082     DECL_LINK(ControlFocusHdl, Control*);
1083 
1084     virtual long        PreNotify( NotifyEvent& rNEvt );
1085     virtual void        Command( const CommandEvent& rCEvt );
1086     virtual void        DataChanged( const DataChangedEvent& rDCEvt );
1087 public:
1088     ColorConfigCtrl_Impl(Window* pParent, const ResId& rResId );
1089     ~ColorConfigCtrl_Impl();
1090 
SetConfig(EditableColorConfig & rConfig)1091     void SetConfig(EditableColorConfig& rConfig) {pColorConfig = &rConfig;}
SetExtendedConfig(EditableExtendedColorConfig & rConfig)1092 	void SetExtendedConfig(EditableExtendedColorConfig& rConfig) {pExtColorConfig = &rConfig;}
1093     void Update();
GetScrollPosition()1094     sal_Int32   GetScrollPosition() {return aVScroll.GetThumbPos();}
SetScrollPosition(sal_Int32 nSet)1095     void        SetScrollPosition(sal_Int32 nSet)
1096                     {
1097                         aVScroll.SetThumbPos(nSet);
1098                         ScrollHdl(&aVScroll);
1099                     }
1100 };
1101 /* -----------------------------25.03.2002 17:09------------------------------
1102 
1103  ---------------------------------------------------------------------------*/
ColorConfigCtrl_Impl(Window * pParent,const ResId & rResId)1104 ColorConfigCtrl_Impl::ColorConfigCtrl_Impl(
1105         Window* pParent, const ResId& rResId) :
1106         Control(pParent, rResId),
1107 
1108 
1109         aHeaderHB(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER),
1110         aVScroll(this,      ResId(VB_VSCROLL, *rResId.GetResMgr())),
1111         sOn(                ResId(ST_ON, *rResId.GetResMgr())),
1112         sUIElem(            ResId(ST_UIELEM, *rResId.GetResMgr())),
1113         sColSetting(        ResId(ST_COLSET, *rResId.GetResMgr())),
1114         sPreview(           ResId(ST_PREVIEW, *rResId.GetResMgr())),
1115         aScrollWindow(this, ResId(WN_SCROLL, *rResId.GetResMgr())),
1116 
1117         pColorConfig(0),
1118 		pExtColorConfig(0),
1119         nScrollPos(0)
1120 {
1121     FreeResource();
1122 
1123     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
1124     aScrollWindow.SetBackground(Wallpaper(rStyleSettings.GetFieldColor()));
1125 	aScrollWindow.SetHelpId( HID_OPTIONS_COLORCONFIG_COLORLIST_WIN );
1126     aVScroll.EnableDrag();
1127     aVScroll.Show();
1128     aHeaderHB.SetPosSizePixel(
1129         Point(0,0),
1130         Size(GetOutputSizePixel().Width(), aVScroll.GetPosPixel().Y()));
1131     sal_Int32 nFirstWidth = aScrollWindow.aGeneralFT.GetPosPixel().X();
1132     sal_Int32 nSecondWidth = aScrollWindow.aColorBoxes[0]->GetPosPixel().X() - nFirstWidth;
1133     sal_Int32 nThirdWidth = aScrollWindow.aWindows[0]->GetPosPixel().X() - nFirstWidth - nSecondWidth;
1134 
1135     const WinBits nHeadBits = HIB_VCENTER | HIB_FIXED| HIB_FIXEDPOS;
1136     aHeaderHB.InsertItem( 1, sOn, nFirstWidth, (sal_uInt16)nHeadBits|HIB_CENTER);
1137     aHeaderHB.InsertItem( 2, sUIElem, nSecondWidth, (sal_uInt16)nHeadBits|HIB_LEFT);
1138     aHeaderHB.InsertItem( 3, sColSetting, nThirdWidth, (sal_uInt16)nHeadBits|HIB_LEFT);
1139     aHeaderHB.InsertItem( 4, sPreview,
1140             aHeaderHB.GetSizePixel().Width() - nFirstWidth - nSecondWidth - nThirdWidth, (sal_uInt16)nHeadBits|HIB_LEFT);
1141     aHeaderHB.Show();
1142 
1143     aVScroll.SetRangeMin(0);
1144     sal_Int32 nScrollOffset = aScrollWindow.aColorBoxes[1]->GetPosPixel().Y() - aScrollWindow.aColorBoxes[0]->GetPosPixel().Y();
1145     sal_Int32 nVisibleEntries = aScrollWindow.GetSizePixel().Height() / nScrollOffset;
1146 
1147     aVScroll.SetRangeMax(aScrollWindow.aCheckBoxes.size() + aScrollWindow.aChapters.size() );
1148     // static: minus three for ANCHOR, DRAWFILL and DRAWDRAWING
1149     aVScroll.SetRangeMax( aVScroll.GetRangeMax() - 3 );
1150     // dynamic: calculate the hidden lines
1151     long nInvisibleLines = 0;
1152     sal_Int16 nGroup = GROUP_UNKNOWN;
1153     sal_Int32 nCount = aScrollWindow.aCheckBoxes.size();
1154     for ( sal_Int32 i = 0; i < nCount; i++ )
1155     {
1156         if ( ANCHOR == i || DRAWFILL == i || DRAWDRAWING == i ) // not used at the moment
1157             continue;
1158         sal_Int16 nNewGroup = lcl_getGroup(i);
1159         sal_Bool bVisible = lcl_isGroupVisible( nNewGroup, aScrollWindow.GetModuleOptions() );
1160         if ( !bVisible )
1161             nInvisibleLines++;
1162         if ( nNewGroup > nGroup )
1163         {
1164             nGroup = nNewGroup;
1165             if ( !bVisible )
1166                 nInvisibleLines++;
1167         }
1168     }
1169     aVScroll.SetRangeMax( aVScroll.GetRangeMax() - nInvisibleLines );
1170 
1171     aVScroll.SetPageSize( nVisibleEntries - 1 );
1172 	aVScroll.SetVisibleSize(nVisibleEntries);
1173     Link aScrollLink = LINK(this, ColorConfigCtrl_Impl, ScrollHdl);
1174     aVScroll.SetScrollHdl(aScrollLink);
1175     aVScroll.SetEndScrollHdl(aScrollLink);
1176 
1177     Link aCheckLink = LINK(this, ColorConfigCtrl_Impl, ClickHdl);
1178     Link aColorLink = LINK(this, ColorConfigCtrl_Impl, ColorHdl);
1179     Link aGetFocusLink = LINK(this, ColorConfigCtrl_Impl, ControlFocusHdl);
1180     for( sal_Int16 i = 0; i < nCount; i++ )
1181     {
1182         if(aScrollWindow.aColorBoxes[i])
1183 		{
1184 			aScrollWindow.aColorBoxes[i]->SetSelectHdl(aColorLink);
1185 			aScrollWindow.aColorBoxes[i]->SetGetFocusHdl(aGetFocusLink);
1186 		}
1187         if(aScrollWindow.aCheckBoxes[i])
1188         {
1189             aScrollWindow.aCheckBoxes[i]->SetClickHdl(aCheckLink);
1190             aScrollWindow.aCheckBoxes[i]->SetGetFocusHdl(aGetFocusLink);
1191         }
1192     }
1193 }
1194 /* -----------------------------27.03.2002 10:46------------------------------
1195 
1196  ---------------------------------------------------------------------------*/
~ColorConfigCtrl_Impl()1197 ColorConfigCtrl_Impl::~ColorConfigCtrl_Impl()
1198 {
1199 }
1200 /* -----------------------------25.03.2002 17:19------------------------------
1201 
1202  ---------------------------------------------------------------------------*/
Update()1203 void ColorConfigCtrl_Impl::Update()
1204 {
1205     DBG_ASSERT(pColorConfig, "Configuration not set" );
1206     sal_Int32 i;
1207     for( i = 0; i < ColorConfigEntryCount; i++ )
1208     {
1209         if(ANCHOR == i)
1210             continue;
1211         const ColorConfigValue& rColorEntry = pColorConfig->GetColorValue(ColorConfigEntry(i));
1212         if(COL_AUTO == (sal_uInt32)rColorEntry.nColor)
1213         {
1214 			if(aScrollWindow.aColorBoxes[i])
1215 				aScrollWindow.aColorBoxes[i]->SelectEntryPos(0);
1216             if(aScrollWindow.aWindows[i])
1217 				aScrollWindow.aWindows[i]->SetBackground(
1218 					Wallpaper(ColorConfig::GetDefaultColor((ColorConfigEntry) i)));
1219         }
1220         else
1221         {
1222             Color aColor(rColorEntry.nColor);
1223 			if(aScrollWindow.aColorBoxes[i])
1224 				aScrollWindow.aColorBoxes[i]->SelectEntry( aColor );
1225             if(aScrollWindow.aWindows[i])
1226 				aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor));
1227         }
1228         if(aScrollWindow.aWindows[i])
1229 			aScrollWindow.aWindows[i]->Invalidate();
1230         if(aScrollWindow.aCheckBoxes[i])
1231             aScrollWindow.aCheckBoxes[i]->Check(rColorEntry.bIsVisible);
1232     } // for( i = 0; i < ColorConfigEntryCount; i++ )
1233 
1234 
1235 	sal_Int32 nExtCount = pExtColorConfig->GetComponentCount();
1236 	sal_Int32 nCount = aScrollWindow.aCheckBoxes.size();
1237 	sal_Int32 nPos = 0;
1238 	i = ColorConfigEntryCount;
1239 	for (sal_Int32 j = 0; j < nExtCount; ++j)
1240 	{
1241 		::rtl::OUString sComponentName = pExtColorConfig->GetComponentName(j);
1242 		sal_Int32 nColorCount = pExtColorConfig->GetComponentColorCount(sComponentName);
1243 
1244 		for( sal_Int32 k = 0; i < nCount && k < nColorCount; ++i ,++nPos,++k)
1245 		{
1246             if(aScrollWindow.aColorBoxes[i])
1247             {
1248 			    ExtendedColorConfigValue aColorEntry = pExtColorConfig->GetComponentColorConfigValue(sComponentName,k);
1249 			    Color aColor(aColorEntry.getColor());
1250 			    if(aColorEntry.getDefaultColor() == aColorEntry.getColor() )
1251 			    {
1252     			    aScrollWindow.aColorBoxes[i]->SelectEntryPos(0);
1253 			    }
1254 			    else
1255 			    {
1256     			    aScrollWindow.aColorBoxes[i]->SelectEntry( aColor );
1257 			    }
1258 			    if(aScrollWindow.aWindows[i])
1259 				    aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor));
1260 
1261 			    if(aScrollWindow.aWindows[i])
1262 				    aScrollWindow.aWindows[i]->Invalidate();
1263             }
1264 		}
1265 	}
1266 }
1267 /* -----------------------------26.03.2002 12:55------------------------------
1268 
1269  ---------------------------------------------------------------------------*/
lcl_MoveAndShow(Window * pWindow,long nOffset,long nMaxVisible,bool _bShow)1270 sal_Bool lcl_MoveAndShow(Window* pWindow, long nOffset, long nMaxVisible, bool _bShow)
1271 {
1272     sal_Bool bHide = sal_True;
1273     if(pWindow)
1274     {
1275         Point aPos = pWindow->GetPosPixel();
1276         aPos.Y() += nOffset;
1277         pWindow->SetPosPixel(aPos);
1278 		if ( _bShow )
1279 			bHide = aPos.Y() > nMaxVisible || (aPos.Y() + pWindow->GetSizePixel().Height()) < 0;
1280         pWindow->Show(!bHide);
1281     }
1282     return !bHide;
1283 }
IMPL_LINK(ColorConfigCtrl_Impl,ScrollHdl,ScrollBar *,pScrollBar)1284 IMPL_LINK(ColorConfigCtrl_Impl, ScrollHdl, ScrollBar*, pScrollBar)
1285 {
1286     aScrollWindow.SetUpdateMode(sal_True);
1287     sal_Int16 i;
1288     long nOffset = aScrollWindow.aColorBoxes[1]->GetPosPixel().Y() - aScrollWindow.aColorBoxes[0]->GetPosPixel().Y();
1289     nOffset *= (nScrollPos - pScrollBar->GetThumbPos());
1290     nScrollPos = pScrollBar->GetThumbPos();
1291     const long nWindowHeight = aScrollWindow.GetSizePixel().Height();
1292     sal_Int16 nFirstVisible = -1;
1293     sal_Int16 nLastVisible = -1;
1294 	sal_Int32 nCount = aScrollWindow.aFixedTexts.size();
1295     for( i = 0; i < nCount; i++ )
1296     {
1297         if(ANCHOR == i)
1298             continue;
1299         Point aPos;
1300         //controls outside of the view need to be hidden to speed up accessibility tools
1301         bool bShowCtrl = ( lcl_isGroupVisible(
1302             lcl_getGroup(i), aScrollWindow.GetModuleOptions() ) != sal_False );
1303         lcl_MoveAndShow(aScrollWindow.aCheckBoxes[i], nOffset, nWindowHeight, bShowCtrl);
1304         lcl_MoveAndShow(aScrollWindow.aFixedTexts[i], nOffset, nWindowHeight, bShowCtrl);
1305         lcl_MoveAndShow(aScrollWindow.aWindows[i]   , nOffset, nWindowHeight, bShowCtrl);
1306         sal_Bool bShow = lcl_MoveAndShow(aScrollWindow.aColorBoxes[i], nOffset, nWindowHeight, bShowCtrl);
1307         if(bShow)
1308         {
1309             if(nFirstVisible == -1)
1310                 nFirstVisible = i;
1311             else
1312                 nLastVisible = i;
1313         }
1314     }
1315     //show the one prior to the first visible and the first after the last visible control
1316     //to enable KEY_TAB travelling
1317 
1318     if(nFirstVisible)
1319     {
1320         //skip gaps where no controls exist for the related ColorConfigEntry
1321         do
1322             --nFirstVisible;
1323         while(!aScrollWindow.aCheckBoxes[nFirstVisible] && !aScrollWindow.aColorBoxes[nFirstVisible] && nFirstVisible >= 0);
1324 
1325         if ( lcl_isGroupVisible(
1326                 lcl_getGroup( nFirstVisible ), aScrollWindow.GetModuleOptions() ) != sal_False )
1327 		{
1328 			if(aScrollWindow.aCheckBoxes[nFirstVisible])
1329 				aScrollWindow.aCheckBoxes[nFirstVisible]->Show();
1330 			if(aScrollWindow.aColorBoxes[nFirstVisible])
1331 				aScrollWindow.aColorBoxes[nFirstVisible]->Show();
1332 		}
1333     }
1334 
1335     if(nLastVisible < nCount - 1)
1336     {
1337         nLastVisible++;
1338         //skip gaps where no controls exist for the related ColorConfigEntry
1339         while(!aScrollWindow.aCheckBoxes[nLastVisible] && !aScrollWindow.aColorBoxes[nLastVisible] &&
1340                 nLastVisible < nCount - 1 )
1341             nLastVisible++;
1342         if ( nLastVisible < nCount )
1343         {
1344             if ( lcl_isGroupVisible(
1345                     lcl_getGroup( nLastVisible ), aScrollWindow.GetModuleOptions() ) != sal_False )
1346 			{
1347 				if(aScrollWindow.aCheckBoxes[nLastVisible])
1348 					aScrollWindow.aCheckBoxes[nLastVisible]->Show();
1349 				if(aScrollWindow.aColorBoxes[nLastVisible])
1350 					aScrollWindow.aColorBoxes[nLastVisible]->Show();
1351 			}
1352         }
1353     } // if(nLastVisible < nCount - 1)
1354 	sal_Int32 nChapterCount = aScrollWindow.aChapters.size();
1355     for( i = 0; i < nChapterCount; i++ )
1356     {
1357         Point aPos = aScrollWindow.aChapters[i]->GetPosPixel(); aPos.Y() += nOffset; aScrollWindow.aChapters[i]->SetPosPixel(aPos);
1358         aPos = aScrollWindow.aChapterWins[i]->GetPosPixel(); aPos.Y() += nOffset; aScrollWindow.aChapterWins[i]->SetPosPixel(aPos);
1359     }
1360     aScrollWindow.SetUpdateMode(sal_True);
1361     return 0;
1362 }
1363 /* -----------------------------29.04.2002 17:02------------------------------
1364 
1365  ---------------------------------------------------------------------------*/
PreNotify(NotifyEvent & rNEvt)1366 long ColorConfigCtrl_Impl::PreNotify( NotifyEvent& rNEvt )
1367 {
1368     if(rNEvt.GetType() == EVENT_COMMAND)
1369     {
1370         const CommandEvent* pCEvt = rNEvt.GetCommandEvent();
1371         sal_uInt16 nCmd = pCEvt->GetCommand();
1372         if( COMMAND_WHEEL == nCmd )
1373         {
1374             Command(*pCEvt);
1375             return 1;
1376         }
1377     }
1378     return Control::PreNotify(rNEvt);
1379 }
1380 /* -----------------------------08.04.2002 16:37------------------------------
1381 
1382  ---------------------------------------------------------------------------*/
Command(const CommandEvent & rCEvt)1383 void ColorConfigCtrl_Impl::Command( const CommandEvent& rCEvt )
1384 {
1385     switch ( rCEvt.GetCommand() )
1386 	{
1387 
1388         case COMMAND_WHEEL:
1389 		case COMMAND_STARTAUTOSCROLL:
1390 		case COMMAND_AUTOSCROLL:
1391         {
1392             const CommandWheelData* pWheelData = rCEvt.GetWheelData();
1393             if(pWheelData && !pWheelData->IsHorz() && COMMAND_WHEEL_ZOOM != pWheelData->GetMode())
1394             {
1395                 HandleScrollCommand( rCEvt, 0, &aVScroll );
1396             }
1397         }
1398         break;
1399         default:
1400             Control::Command(rCEvt);
1401     }
1402 }
1403 
1404 /* -----------------------------14.12.2005 12:37------------------------------
1405 
1406  ---------------------------------------------------------------------------*/
DataChanged(const DataChangedEvent & rDCEvt)1407 void ColorConfigCtrl_Impl::DataChanged( const DataChangedEvent& rDCEvt )
1408 {
1409     Window::DataChanged( rDCEvt );
1410     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
1411          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
1412     {
1413         const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
1414         SetBackground(Wallpaper(rStyleSettings.GetFieldColor()));
1415     }
1416 }
1417 
1418 
1419 /* -----------------------------27.03.2002 11:43------------------------------
1420 
1421  ---------------------------------------------------------------------------*/
IMPL_LINK(ColorConfigCtrl_Impl,ClickHdl,CheckBox *,pBox)1422 IMPL_LINK(ColorConfigCtrl_Impl, ClickHdl, CheckBox*, pBox)
1423 {
1424     DBG_ASSERT(pColorConfig, "Configuration not set" );
1425 
1426     for( sal_Int32 i = 0; i < ColorConfigEntryCount; i++ )
1427     {
1428         if(ANCHOR == i)
1429             continue;
1430         if(aScrollWindow.aCheckBoxes[i] == pBox )
1431         {
1432             ColorConfigValue aBoundCol = pColorConfig->GetColorValue(ColorConfigEntry(i));
1433             aBoundCol.bIsVisible = pBox->IsChecked();
1434             pColorConfig->SetColorValue(ColorConfigEntry(i), aBoundCol);
1435             break;
1436         }
1437     } // for( sal_Int32 i = 0; i < ColorConfigEntryCount; i++ )
1438     return 0;
1439 }
1440 /* -----------------------------27.03.2002 11:43------------------------------
1441 
1442  ---------------------------------------------------------------------------*/
IMPL_LINK(ColorConfigCtrl_Impl,ColorHdl,ColorListBox *,pBox)1443 IMPL_LINK(ColorConfigCtrl_Impl, ColorHdl, ColorListBox*, pBox)
1444 {
1445     DBG_ASSERT(pColorConfig, "Configuration not set" );
1446 	sal_Int32 i = 0;
1447     for( ; i < ColorConfigEntryCount; i++ )
1448     {
1449         if(pBox && aScrollWindow.aColorBoxes[i] == pBox)
1450         {
1451             ColorConfigValue aColorEntry = pColorConfig->GetColorValue(ColorConfigEntry(i));
1452             if(!pBox->GetSelectEntryPos())
1453 			{
1454                 aColorEntry.nColor = COL_AUTO;
1455 				if(aScrollWindow.aWindows[i])
1456 					aScrollWindow.aWindows[i]->SetBackground(
1457 						Wallpaper(ColorConfig::GetDefaultColor((ColorConfigEntry) i)));
1458 			}
1459             else
1460             {
1461                 Color aColor = pBox->GetSelectEntryColor();		// #i14869# no Color&, 'cause it's a ref to a temp object on the stack!
1462                 aColorEntry.nColor = aColor.GetColor();
1463 				if(aScrollWindow.aWindows[i])
1464 					aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor));
1465             }
1466 			if(aScrollWindow.aWindows[i])
1467 				aScrollWindow.aWindows[i]->Invalidate();
1468             pColorConfig->SetColorValue(ColorConfigEntry(i), aColorEntry);
1469             break;
1470         }
1471     } // for( sal_Int32 i = 0; i < ColorConfigEntryCount; i++ )
1472 	sal_Int32 nExtCount = pExtColorConfig->GetComponentCount();
1473 	sal_Int32 nCount = aScrollWindow.aCheckBoxes.size();
1474 	sal_Int32 nPos = 0;
1475 	i = ColorConfigEntryCount;
1476 	for (sal_Int32 j = 0; j < nExtCount; ++j)
1477 	{
1478 		::rtl::OUString sComponentName = pExtColorConfig->GetComponentName(j);
1479 		sal_Int32 nColorCount = pExtColorConfig->GetComponentColorCount(sComponentName);
1480 
1481 		for( sal_Int32 k = 0; i < nCount && k < nColorCount; ++i ,++nPos,++k)
1482 		{
1483 			if(pBox && aScrollWindow.aColorBoxes[i] == pBox)
1484 			{
1485 				ExtendedColorConfigValue aColorEntry = pExtColorConfig->GetComponentColorConfigValue(sComponentName,k);
1486 				Color aColor = pBox->GetSelectEntryColor();		// #i14869# no Color&, 'cause it's a ref to a temp object on the stack!
1487 				aColorEntry.setColor(aColor.GetColor());
1488 				if( !pBox->GetSelectEntryPos() ) // auto color
1489                 {
1490 					aColorEntry.setColor(aColorEntry.getDefaultColor());
1491                     aColor.SetColor(aColorEntry.getColor());
1492                 }
1493 				if ( aScrollWindow.aWindows[i] )
1494                 {
1495 					aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor));
1496 					aScrollWindow.aWindows[i]->Invalidate();
1497                 }
1498 				pExtColorConfig->SetColorValue(sComponentName,aColorEntry);
1499 				break;
1500 			}
1501 		}
1502 	}
1503     return 0;
1504 }
IMPL_LINK(ColorConfigCtrl_Impl,ControlFocusHdl,Control *,pCtrl)1505 IMPL_LINK(ColorConfigCtrl_Impl, ControlFocusHdl, Control*, pCtrl)
1506 {
1507     //determine whether a control is completely visible
1508     //and make it visible
1509     Point aCtrlPos(pCtrl->GetPosPixel());
1510 	sal_Int32 nWinHeight = aScrollWindow.GetSizePixel().Height();
1511 	if(0 != (GETFOCUS_TAB & pCtrl->GetGetFocusFlags() &&
1512 		(aCtrlPos.Y() < 0 ||
1513 			nWinHeight < aCtrlPos.Y() + aScrollWindow.aColorBoxes[0]->GetSizePixel().Height())))
1514     {
1515         long nThumbPos = aVScroll.GetThumbPos();
1516         if(nWinHeight < aCtrlPos.Y() + aScrollWindow.aColorBoxes[0]->GetSizePixel().Height())
1517         {
1518             //scroll down
1519             nThumbPos +=2;
1520         }
1521         else
1522         {
1523             //scroll up
1524             nThumbPos -= 2;
1525             if(nThumbPos < 0)
1526                 nThumbPos = 0;
1527         }
1528         aVScroll.SetThumbPos(nThumbPos);
1529         ScrollHdl(&aVScroll);
1530     }
1531     return 0;
1532 };
1533 /* -----------------------------25.03.2002 10:47------------------------------
1534 
1535  ---------------------------------------------------------------------------*/
SvxColorOptionsTabPage(Window * pParent,const SfxItemSet & rCoreSet)1536 SvxColorOptionsTabPage::SvxColorOptionsTabPage(
1537     Window* pParent, const SfxItemSet& rCoreSet) :
1538     SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_COLORCONFIG ), rCoreSet ),
1539        aColorSchemeFL(  this, CUI_RES( FL_COLORSCHEME ) ),
1540        aColorSchemeFT(  this, CUI_RES( FT_COLORSCHEME ) ),
1541        aColorSchemeLB(  this, CUI_RES( LB_COLORSCHEME ) ),
1542        aSaveSchemePB(   this, CUI_RES( PB_SAVESCHEME) ),
1543        aDeleteSchemePB( this, CUI_RES( PB_DELETESCHEME ) ),
1544        aCustomColorsFL( this, CUI_RES( FL_CUSTOMCOLORS ) ),
1545        bFillItemSetCalled(sal_False),
1546        pColorConfig(0),
1547 	   pExtColorConfig(0),
1548        pColorConfigCT(  new ColorConfigCtrl_Impl(this, CUI_RES( CT_COLORCONFIG ) ))
1549 {
1550 	FreeResource();
1551     aColorSchemeLB.SetSelectHdl(LINK(this, SvxColorOptionsTabPage, SchemeChangedHdl_Impl));
1552     Link aLk = LINK(this, SvxColorOptionsTabPage, SaveDeleteHdl_Impl );
1553     aSaveSchemePB.SetClickHdl(aLk);
1554     aDeleteSchemePB.SetClickHdl(aLk);
1555 }
1556 /* -----------------------------25.03.2002 10:47------------------------------
1557 
1558  ---------------------------------------------------------------------------*/
~SvxColorOptionsTabPage()1559 SvxColorOptionsTabPage::~SvxColorOptionsTabPage()
1560 {
1561     //when the dialog is cancelled but the color scheme ListBox has been changed these
1562     //changes need to be undone
1563     if(!bFillItemSetCalled && aColorSchemeLB.GetSavedValue() != aColorSchemeLB.GetSelectEntryPos())
1564     {
1565         rtl::OUString sOldScheme =  aColorSchemeLB.GetEntry(aColorSchemeLB.GetSavedValue());
1566         if(sOldScheme.getLength())
1567 		{
1568             pColorConfig->SetCurrentSchemeName(sOldScheme);
1569 			pExtColorConfig->SetCurrentSchemeName(sOldScheme);
1570 		}
1571     }
1572     delete pColorConfigCT;
1573     pColorConfig->ClearModified();
1574 	pColorConfig->EnableBroadcast();
1575     delete pColorConfig;
1576 	pExtColorConfig->ClearModified();
1577 	pExtColorConfig->EnableBroadcast();
1578     delete pExtColorConfig;
1579 }
1580 /* -----------------------------25.03.2002 10:47------------------------------
1581 
1582  ---------------------------------------------------------------------------*/
Create(Window * pParent,const SfxItemSet & rAttrSet)1583 SfxTabPage* SvxColorOptionsTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
1584 {
1585     return ( new SvxColorOptionsTabPage( pParent, rAttrSet ) );
1586 }
1587 /* -----------------------------25.03.2002 10:47------------------------------
1588 
1589  ---------------------------------------------------------------------------*/
FillItemSet(SfxItemSet &)1590 sal_Bool SvxColorOptionsTabPage::FillItemSet( SfxItemSet&  )
1591 {
1592     bFillItemSetCalled = sal_True;
1593     if(aColorSchemeLB.GetSavedValue() != aColorSchemeLB.GetSelectEntryPos())
1594 	{
1595         pColorConfig->SetModified();
1596 		pExtColorConfig->SetModified();
1597 	}
1598     if(pColorConfig->IsModified())
1599         pColorConfig->Commit();
1600 	if(pExtColorConfig->IsModified())
1601         pExtColorConfig->Commit();
1602     return sal_True;
1603 }
1604 /* -----------------------------25.03.2002 10:47------------------------------
1605 
1606  ---------------------------------------------------------------------------*/
Reset(const SfxItemSet &)1607 void SvxColorOptionsTabPage::Reset( const SfxItemSet& )
1608 {
1609     if(pColorConfig)
1610     {
1611         pColorConfig->ClearModified();
1612 		pColorConfig->DisableBroadcast();
1613         delete pColorConfig;
1614     }
1615     pColorConfig = new EditableColorConfig;
1616     pColorConfigCT->SetConfig(*pColorConfig);
1617 
1618 	if(pExtColorConfig)
1619     {
1620         pExtColorConfig->ClearModified();
1621 		pExtColorConfig->DisableBroadcast();
1622         delete pExtColorConfig;
1623     }
1624     pExtColorConfig = new EditableExtendedColorConfig;
1625     pColorConfigCT->SetExtendedConfig(*pExtColorConfig);
1626 
1627     String sUser = GetUserData();
1628     //has to be called always to speed up accessibility tools
1629     pColorConfigCT->SetScrollPosition(sUser.ToInt32());
1630     aColorSchemeLB.Clear();
1631     uno::Sequence< ::rtl::OUString >  aSchemes = pColorConfig->GetSchemeNames();
1632     const rtl::OUString* pSchemes = aSchemes.getConstArray();
1633     for(sal_Int32 i = 0; i < aSchemes.getLength(); i++)
1634         aColorSchemeLB.InsertEntry(pSchemes[i]);
1635     aColorSchemeLB.SelectEntry(pColorConfig->GetCurrentSchemeName());
1636     aColorSchemeLB.SaveValue();
1637     aDeleteSchemePB.Enable( aSchemes.getLength() > 1 );
1638     UpdateColorConfig();
1639 }
1640 /* -----------------------------25.03.2002 10:47------------------------------
1641 
1642  ---------------------------------------------------------------------------*/
DeactivatePage(SfxItemSet * _pSet)1643 int SvxColorOptionsTabPage::DeactivatePage( SfxItemSet* _pSet )
1644 {
1645     if ( _pSet )
1646         FillItemSet( *_pSet );
1647 	return( LEAVE_PAGE );
1648 }
1649 /* -----------------------------25.03.2002 15:32------------------------------
1650 
1651  ---------------------------------------------------------------------------*/
UpdateColorConfig()1652 void SvxColorOptionsTabPage::UpdateColorConfig()
1653 {
1654     //update the color config control
1655     pColorConfigCT->Update();
1656 }
1657 /* -----------------------------25.03.2002 15:30------------------------------
1658 
1659  ---------------------------------------------------------------------------*/
IMPL_LINK(SvxColorOptionsTabPage,SchemeChangedHdl_Impl,ListBox *,pBox)1660 IMPL_LINK(SvxColorOptionsTabPage, SchemeChangedHdl_Impl, ListBox*, pBox)
1661 {
1662     pColorConfig->LoadScheme(pBox->GetSelectEntry());
1663 	pExtColorConfig->LoadScheme(pBox->GetSelectEntry());
1664     UpdateColorConfig();
1665     return 0;
1666 }
1667 /* -----------------------------09.04.2002 15:21------------------------------
1668 
1669  ---------------------------------------------------------------------------*/
IMPL_LINK(SvxColorOptionsTabPage,SaveDeleteHdl_Impl,PushButton *,pButton)1670 IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, PushButton*, pButton )
1671 {
1672     if(&aSaveSchemePB == pButton)
1673     {
1674         String sName;
1675         //CHINA001 SvxNameDialog aNameDlg(pButton,
1676         //CHINA001                     sName,
1677         //CHINA001                     String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_SAVE2)));
1678         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
1679 		DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
1680 		AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog( pButton,
1681                             sName, String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_SAVE2)) );
1682 		DBG_ASSERT(aNameDlg, "Dialogdiet fail!");//CHINA001
1683         aNameDlg->SetCheckNameHdl( LINK(this, SvxColorOptionsTabPage, CheckNameHdl_Impl));
1684 		aNameDlg->SetText(String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_SAVE1)));
1685         aNameDlg->SetHelpId(HID_OPTIONS_COLORCONFIG_SAVE_SCHEME);
1686         aNameDlg->SetEditHelpId(HID_OPTIONS_COLORCONFIG_NAME_SCHEME);
1687         aNameDlg->SetCheckNameHdl( LINK(this, SvxColorOptionsTabPage, CheckNameHdl_Impl));
1688         if(RET_OK == aNameDlg->Execute()) //CHINA001 if(RET_OK == aNameDlg.Execute())
1689         {
1690             aNameDlg->GetName(sName); //CHINA001 aNameDlg.GetName(sName);
1691 			pColorConfig->AddScheme(sName);
1692 			pExtColorConfig->AddScheme(sName);
1693             aColorSchemeLB.InsertEntry(sName);
1694             aColorSchemeLB.SelectEntry(sName);
1695             aColorSchemeLB.GetSelectHdl().Call(&aColorSchemeLB);
1696         }
1697 		delete aNameDlg; //add by CHINA001
1698     }
1699     else
1700     {
1701         DBG_ASSERT(aColorSchemeLB.GetEntryCount() > 1, "don't delete the last scheme");
1702         QueryBox aQuery(pButton, CUI_RES(RID_SVXQB_DELETE_COLOR_CONFIG));
1703         aQuery.SetText(String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_DELETE)));
1704         if(RET_YES == aQuery.Execute())
1705         {
1706             rtl::OUString sDeleteScheme(aColorSchemeLB.GetSelectEntry());
1707             aColorSchemeLB.RemoveEntry(aColorSchemeLB.GetSelectEntryPos());
1708             aColorSchemeLB.SelectEntryPos(0);
1709             aColorSchemeLB.GetSelectHdl().Call(&aColorSchemeLB);
1710             //first select the new scheme and then delete the old one
1711             pColorConfig->DeleteScheme(sDeleteScheme);
1712 			pExtColorConfig->DeleteScheme(sDeleteScheme);
1713         }
1714     }
1715     aDeleteSchemePB.Enable( aColorSchemeLB.GetEntryCount() > 1 );
1716     return 0;
1717 }
1718 /* -----------------------------09.04.2002 15:47------------------------------
1719 
1720  ---------------------------------------------------------------------------*/
IMPL_LINK(SvxColorOptionsTabPage,CheckNameHdl_Impl,AbstractSvxNameDialog *,pDialog)1721 IMPL_LINK(SvxColorOptionsTabPage, CheckNameHdl_Impl, AbstractSvxNameDialog*, pDialog )
1722 {
1723     String sName;
1724     pDialog->GetName(sName);
1725     return sName.Len() && LISTBOX_ENTRY_NOTFOUND == aColorSchemeLB.GetEntryPos( sName );
1726 }
1727 /* -----------------------------25.04.2002 15:12------------------------------
1728 
1729  ---------------------------------------------------------------------------*/
FillUserData()1730 void SvxColorOptionsTabPage::FillUserData()
1731 {
1732     SetUserData(String::CreateFromInt32(pColorConfigCT->GetScrollPosition()));
1733 }
1734 
1735