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: 174 SvxExtFixedText_Impl(Window* pParent, const ResId& rResId) : 175 FixedText(pParent, rResId), m_nGroupHeight(0) {} 176 177 inline long GetGroupHeight() { return m_nGroupHeight; } 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 354 inline const SvtModuleOptions& GetModuleOptions() const { return m_aModuleOptions; } 355 }; 356 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 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 ---------------------------------------------------------------------------*/ 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 XColorTable aColorTable( 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 958 for( sal_Int32 i = 1; i < nCount; i++ ) 959 { 960 if(aColorBoxes[i]) 961 { 962 aColorBoxes[i]->CopyEntries( *aColorBoxes[0] ); 963 if( i < sal_Int32(sizeof(aColorLBHids)/sizeof(aColorLBHids[0])) ) 964 aColorBoxes[i]->SetHelpId( aColorLBHids[i] ); 965 } 966 } 967 } 968 /* -----------------------------27.03.2002 11:04------------------------------ 969 970 ---------------------------------------------------------------------------*/ 971 ColorConfigWindow_Impl::~ColorConfigWindow_Impl() 972 { 973 aChapters.clear(); 974 ::std::vector< SvxExtFixedText_Impl*>().swap(aChapters); 975 976 977 sal_Int32 nCount = aFixedTexts.size(); 978 for (sal_Int32 i = ColorConfigEntryCount; i < nCount; ++i) 979 { 980 delete aFixedTexts[i]; 981 delete aCheckBoxes[i]; 982 delete aColorBoxes[i]; 983 delete aWindows[i]; 984 } 985 for (sal_uInt32 i = GROUP_COUNT; i < aChapterWins.size(); ++i) 986 delete aChapterWins[i]; 987 aChapterWins.clear(); 988 ::std::vector< Window*>().swap(aChapterWins); 989 } 990 /* -----------------------------2002/06/20 12:48------------------------------ 991 992 ---------------------------------------------------------------------------*/ 993 void ColorConfigWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt ) 994 { 995 Window::DataChanged( rDCEvt ); 996 if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 997 (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 998 { 999 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 1000 sal_Bool bHighContrast = rStyleSettings.GetHighContrastMode(); 1001 Color aBackColor( bHighContrast ? COL_TRANSPARENT : COL_LIGHTGRAY); 1002 ::std::vector< Window* >::iterator aIter = aChapterWins.begin(); 1003 ::std::vector< Window* >::iterator aEnd = aChapterWins.end(); 1004 for(;aIter != aEnd; ++aIter ) 1005 (*aIter)->SetBackground(Wallpaper(aBackColor)); 1006 SetBackground(Wallpaper(rStyleSettings.GetWindowColor())); 1007 } 1008 } 1009 /* -----------------------------2002/06/26 10:49------------------------------ 1010 1011 ---------------------------------------------------------------------------*/ 1012 void SvxExtFixedText_Impl::DataChanged(const DataChangedEvent& rDCEvt) 1013 { 1014 FixedText::DataChanged(rDCEvt); 1015 Color TempColor(COL_TRANSPARENT); 1016 Wallpaper aTransparentWall(TempColor); 1017 if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 1018 (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 1019 { 1020 Font aFont = GetFont(); 1021 aFont.SetWeight(WEIGHT_BOLD); 1022 SetFont(aFont); 1023 SetBackground(aTransparentWall); 1024 } 1025 } 1026 1027 void ColorConfigWindow_Impl::SetNewPosition( sal_Int32 _nFeature, Window* _pWin ) 1028 { 1029 DBG_ASSERT( _pWin, "ColorConfigWindow_Impl::SetNewPosition(): no window" ); 1030 1031 // calculate the overall height of the invisible groups 1032 long nDelta = 0; 1033 sal_Int16 nGroup = lcl_getGroup( _nFeature ) - 1; 1034 while ( nGroup > 0 ) // GROUP_GENERAL (0) is always visible 1035 { 1036 if ( !lcl_isGroupVisible( nGroup, m_aModuleOptions ) ) 1037 nDelta += aChapters[nGroup]->GetGroupHeight(); 1038 nGroup--; 1039 } 1040 1041 // move this window to its new position 1042 if ( nDelta > 0 ) 1043 { 1044 Point aPos = _pWin->GetPosPixel(); 1045 aPos.Y() -= nDelta; 1046 _pWin->SetPosPixel( aPos ); 1047 } 1048 } 1049 1050 /* -----------------------------08.04.2002 17:10------------------------------ 1051 1052 ---------------------------------------------------------------------------*/ 1053 void ColorConfigWindow_Impl::Command( const CommandEvent& rCEvt ) 1054 { 1055 GetParent()->Command(rCEvt); 1056 } 1057 /* -----------------------------25.03.2002 10:44------------------------------ 1058 1059 ---------------------------------------------------------------------------*/ 1060 class ColorConfigCtrl_Impl : public Control 1061 { 1062 HeaderBar aHeaderHB; 1063 ScrollBar aVScroll; 1064 1065 String sOn; 1066 String sUIElem; 1067 String sColSetting; 1068 String sPreview; 1069 ColorConfigWindow_Impl aScrollWindow; 1070 1071 EditableColorConfig* pColorConfig; 1072 EditableExtendedColorConfig* pExtColorConfig; 1073 1074 long nScrollPos; 1075 1076 DECL_LINK(ScrollHdl, ScrollBar*); 1077 DECL_LINK(ClickHdl, CheckBox*); 1078 DECL_LINK(ColorHdl, ColorListBox*); 1079 DECL_LINK(ControlFocusHdl, Control*); 1080 1081 virtual long PreNotify( NotifyEvent& rNEvt ); 1082 virtual void Command( const CommandEvent& rCEvt ); 1083 virtual void DataChanged( const DataChangedEvent& rDCEvt ); 1084 public: 1085 ColorConfigCtrl_Impl(Window* pParent, const ResId& rResId ); 1086 ~ColorConfigCtrl_Impl(); 1087 1088 void SetConfig(EditableColorConfig& rConfig) {pColorConfig = &rConfig;} 1089 void SetExtendedConfig(EditableExtendedColorConfig& rConfig) {pExtColorConfig = &rConfig;} 1090 void Update(); 1091 sal_Int32 GetScrollPosition() {return aVScroll.GetThumbPos();} 1092 void SetScrollPosition(sal_Int32 nSet) 1093 { 1094 aVScroll.SetThumbPos(nSet); 1095 ScrollHdl(&aVScroll); 1096 } 1097 }; 1098 /* -----------------------------25.03.2002 17:09------------------------------ 1099 1100 ---------------------------------------------------------------------------*/ 1101 ColorConfigCtrl_Impl::ColorConfigCtrl_Impl( 1102 Window* pParent, const ResId& rResId) : 1103 Control(pParent, rResId), 1104 1105 1106 aHeaderHB(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER), 1107 aVScroll(this, ResId(VB_VSCROLL, *rResId.GetResMgr())), 1108 sOn( ResId(ST_ON, *rResId.GetResMgr())), 1109 sUIElem( ResId(ST_UIELEM, *rResId.GetResMgr())), 1110 sColSetting( ResId(ST_COLSET, *rResId.GetResMgr())), 1111 sPreview( ResId(ST_PREVIEW, *rResId.GetResMgr())), 1112 aScrollWindow(this, ResId(WN_SCROLL, *rResId.GetResMgr())), 1113 1114 pColorConfig(0), 1115 pExtColorConfig(0), 1116 nScrollPos(0) 1117 { 1118 FreeResource(); 1119 1120 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 1121 aScrollWindow.SetBackground(Wallpaper(rStyleSettings.GetFieldColor())); 1122 aScrollWindow.SetHelpId( HID_OPTIONS_COLORCONFIG_COLORLIST_WIN ); 1123 aVScroll.EnableDrag(); 1124 aVScroll.Show(); 1125 aHeaderHB.SetPosSizePixel( 1126 Point(0,0), 1127 Size(GetOutputSizePixel().Width(), aVScroll.GetPosPixel().Y())); 1128 sal_Int32 nFirstWidth = aScrollWindow.aGeneralFT.GetPosPixel().X(); 1129 sal_Int32 nSecondWidth = aScrollWindow.aColorBoxes[0]->GetPosPixel().X() - nFirstWidth; 1130 sal_Int32 nThirdWidth = aScrollWindow.aWindows[0]->GetPosPixel().X() - nFirstWidth - nSecondWidth; 1131 1132 const WinBits nHeadBits = HIB_VCENTER | HIB_FIXED| HIB_FIXEDPOS; 1133 aHeaderHB.InsertItem( 1, sOn, nFirstWidth, (sal_uInt16)nHeadBits|HIB_CENTER); 1134 aHeaderHB.InsertItem( 2, sUIElem, nSecondWidth, (sal_uInt16)nHeadBits|HIB_LEFT); 1135 aHeaderHB.InsertItem( 3, sColSetting, nThirdWidth, (sal_uInt16)nHeadBits|HIB_LEFT); 1136 aHeaderHB.InsertItem( 4, sPreview, 1137 aHeaderHB.GetSizePixel().Width() - nFirstWidth - nSecondWidth - nThirdWidth, (sal_uInt16)nHeadBits|HIB_LEFT); 1138 aHeaderHB.Show(); 1139 1140 aVScroll.SetRangeMin(0); 1141 sal_Int32 nScrollOffset = aScrollWindow.aColorBoxes[1]->GetPosPixel().Y() - aScrollWindow.aColorBoxes[0]->GetPosPixel().Y(); 1142 sal_Int32 nVisibleEntries = aScrollWindow.GetSizePixel().Height() / nScrollOffset; 1143 1144 aVScroll.SetRangeMax(aScrollWindow.aCheckBoxes.size() + aScrollWindow.aChapters.size() ); 1145 // static: minus three for ANCHOR, DRAWFILL and DRAWDRAWING 1146 aVScroll.SetRangeMax( aVScroll.GetRangeMax() - 3 ); 1147 // dynamic: calculate the hidden lines 1148 long nInvisibleLines = 0; 1149 sal_Int16 nGroup = GROUP_UNKNOWN; 1150 sal_Int32 nCount = aScrollWindow.aCheckBoxes.size(); 1151 for ( sal_Int32 i = 0; i < nCount; i++ ) 1152 { 1153 if ( ANCHOR == i || DRAWFILL == i || DRAWDRAWING == i ) // not used at the moment 1154 continue; 1155 sal_Int16 nNewGroup = lcl_getGroup(i); 1156 sal_Bool bVisible = lcl_isGroupVisible( nNewGroup, aScrollWindow.GetModuleOptions() ); 1157 if ( !bVisible ) 1158 nInvisibleLines++; 1159 if ( nNewGroup > nGroup ) 1160 { 1161 nGroup = nNewGroup; 1162 if ( !bVisible ) 1163 nInvisibleLines++; 1164 } 1165 } 1166 aVScroll.SetRangeMax( aVScroll.GetRangeMax() - nInvisibleLines ); 1167 1168 aVScroll.SetPageSize( nVisibleEntries - 1 ); 1169 aVScroll.SetVisibleSize(nVisibleEntries); 1170 Link aScrollLink = LINK(this, ColorConfigCtrl_Impl, ScrollHdl); 1171 aVScroll.SetScrollHdl(aScrollLink); 1172 aVScroll.SetEndScrollHdl(aScrollLink); 1173 1174 Link aCheckLink = LINK(this, ColorConfigCtrl_Impl, ClickHdl); 1175 Link aColorLink = LINK(this, ColorConfigCtrl_Impl, ColorHdl); 1176 Link aGetFocusLink = LINK(this, ColorConfigCtrl_Impl, ControlFocusHdl); 1177 for( sal_Int16 i = 0; i < nCount; i++ ) 1178 { 1179 if(aScrollWindow.aColorBoxes[i]) 1180 { 1181 aScrollWindow.aColorBoxes[i]->SetSelectHdl(aColorLink); 1182 aScrollWindow.aColorBoxes[i]->SetGetFocusHdl(aGetFocusLink); 1183 } 1184 if(aScrollWindow.aCheckBoxes[i]) 1185 { 1186 aScrollWindow.aCheckBoxes[i]->SetClickHdl(aCheckLink); 1187 aScrollWindow.aCheckBoxes[i]->SetGetFocusHdl(aGetFocusLink); 1188 } 1189 } 1190 } 1191 /* -----------------------------27.03.2002 10:46------------------------------ 1192 1193 ---------------------------------------------------------------------------*/ 1194 ColorConfigCtrl_Impl::~ColorConfigCtrl_Impl() 1195 { 1196 } 1197 /* -----------------------------25.03.2002 17:19------------------------------ 1198 1199 ---------------------------------------------------------------------------*/ 1200 void ColorConfigCtrl_Impl::Update() 1201 { 1202 DBG_ASSERT(pColorConfig, "Configuration not set" ); 1203 sal_Int32 i; 1204 for( i = 0; i < ColorConfigEntryCount; i++ ) 1205 { 1206 if(ANCHOR == i) 1207 continue; 1208 const ColorConfigValue& rColorEntry = pColorConfig->GetColorValue(ColorConfigEntry(i)); 1209 if(COL_AUTO == (sal_uInt32)rColorEntry.nColor) 1210 { 1211 if(aScrollWindow.aColorBoxes[i]) 1212 aScrollWindow.aColorBoxes[i]->SelectEntryPos(0); 1213 if(aScrollWindow.aWindows[i]) 1214 aScrollWindow.aWindows[i]->SetBackground( 1215 Wallpaper(ColorConfig::GetDefaultColor((ColorConfigEntry) i))); 1216 } 1217 else 1218 { 1219 Color aColor(rColorEntry.nColor); 1220 if(aScrollWindow.aColorBoxes[i]) 1221 aScrollWindow.aColorBoxes[i]->SelectEntry( aColor ); 1222 if(aScrollWindow.aWindows[i]) 1223 aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor)); 1224 } 1225 if(aScrollWindow.aWindows[i]) 1226 aScrollWindow.aWindows[i]->Invalidate(); 1227 if(aScrollWindow.aCheckBoxes[i]) 1228 aScrollWindow.aCheckBoxes[i]->Check(rColorEntry.bIsVisible); 1229 } // for( i = 0; i < ColorConfigEntryCount; i++ ) 1230 1231 1232 sal_Int32 nExtCount = pExtColorConfig->GetComponentCount(); 1233 sal_Int32 nCount = aScrollWindow.aCheckBoxes.size(); 1234 sal_Int32 nPos = 0; 1235 i = ColorConfigEntryCount; 1236 for (sal_Int32 j = 0; j < nExtCount; ++j) 1237 { 1238 ::rtl::OUString sComponentName = pExtColorConfig->GetComponentName(j); 1239 sal_Int32 nColorCount = pExtColorConfig->GetComponentColorCount(sComponentName); 1240 1241 for( sal_Int32 k = 0; i < nCount && k < nColorCount; ++i ,++nPos,++k) 1242 { 1243 if(aScrollWindow.aColorBoxes[i]) 1244 { 1245 ExtendedColorConfigValue aColorEntry = pExtColorConfig->GetComponentColorConfigValue(sComponentName,k); 1246 Color aColor(aColorEntry.getColor()); 1247 if(aColorEntry.getDefaultColor() == aColorEntry.getColor() ) 1248 { 1249 aScrollWindow.aColorBoxes[i]->SelectEntryPos(0); 1250 } 1251 else 1252 { 1253 aScrollWindow.aColorBoxes[i]->SelectEntry( aColor ); 1254 } 1255 if(aScrollWindow.aWindows[i]) 1256 aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor)); 1257 1258 if(aScrollWindow.aWindows[i]) 1259 aScrollWindow.aWindows[i]->Invalidate(); 1260 } 1261 } 1262 } 1263 } 1264 /* -----------------------------26.03.2002 12:55------------------------------ 1265 1266 ---------------------------------------------------------------------------*/ 1267 sal_Bool lcl_MoveAndShow(Window* pWindow, long nOffset, long nMaxVisible, bool _bShow) 1268 { 1269 sal_Bool bHide = sal_True; 1270 if(pWindow) 1271 { 1272 Point aPos = pWindow->GetPosPixel(); 1273 aPos.Y() += nOffset; 1274 pWindow->SetPosPixel(aPos); 1275 if ( _bShow ) 1276 bHide = aPos.Y() > nMaxVisible || (aPos.Y() + pWindow->GetSizePixel().Height()) < 0; 1277 pWindow->Show(!bHide); 1278 } 1279 return !bHide; 1280 } 1281 IMPL_LINK(ColorConfigCtrl_Impl, ScrollHdl, ScrollBar*, pScrollBar) 1282 { 1283 aScrollWindow.SetUpdateMode(sal_True); 1284 sal_Int16 i; 1285 long nOffset = aScrollWindow.aColorBoxes[1]->GetPosPixel().Y() - aScrollWindow.aColorBoxes[0]->GetPosPixel().Y(); 1286 nOffset *= (nScrollPos - pScrollBar->GetThumbPos()); 1287 nScrollPos = pScrollBar->GetThumbPos(); 1288 const long nWindowHeight = aScrollWindow.GetSizePixel().Height(); 1289 sal_Int16 nFirstVisible = -1; 1290 sal_Int16 nLastVisible = -1; 1291 sal_Int32 nCount = aScrollWindow.aFixedTexts.size(); 1292 for( i = 0; i < nCount; i++ ) 1293 { 1294 if(ANCHOR == i) 1295 continue; 1296 Point aPos; 1297 //controls outside of the view need to be hidden to speed up accessibility tools 1298 bool bShowCtrl = ( lcl_isGroupVisible( 1299 lcl_getGroup(i), aScrollWindow.GetModuleOptions() ) != sal_False ); 1300 lcl_MoveAndShow(aScrollWindow.aCheckBoxes[i], nOffset, nWindowHeight, bShowCtrl); 1301 lcl_MoveAndShow(aScrollWindow.aFixedTexts[i], nOffset, nWindowHeight, bShowCtrl); 1302 lcl_MoveAndShow(aScrollWindow.aWindows[i] , nOffset, nWindowHeight, bShowCtrl); 1303 sal_Bool bShow = lcl_MoveAndShow(aScrollWindow.aColorBoxes[i], nOffset, nWindowHeight, bShowCtrl); 1304 if(bShow) 1305 { 1306 if(nFirstVisible == -1) 1307 nFirstVisible = i; 1308 else 1309 nLastVisible = i; 1310 } 1311 } 1312 //show the one prior to the first visible and the first after the last visble control 1313 //to enable KEY_TAB travelling 1314 1315 if(nFirstVisible) 1316 { 1317 //skip gaps where no controls exist for the related ColorConfigEntry 1318 do 1319 --nFirstVisible; 1320 while(!aScrollWindow.aCheckBoxes[nFirstVisible] && !aScrollWindow.aColorBoxes[nFirstVisible] && nFirstVisible >= 0); 1321 1322 if ( lcl_isGroupVisible( 1323 lcl_getGroup( nFirstVisible ), aScrollWindow.GetModuleOptions() ) != sal_False ) 1324 { 1325 if(aScrollWindow.aCheckBoxes[nFirstVisible]) 1326 aScrollWindow.aCheckBoxes[nFirstVisible]->Show(); 1327 if(aScrollWindow.aColorBoxes[nFirstVisible]) 1328 aScrollWindow.aColorBoxes[nFirstVisible]->Show(); 1329 } 1330 } 1331 1332 if(nLastVisible < nCount - 1) 1333 { 1334 nLastVisible++; 1335 //skip gaps where no controls exist for the related ColorConfigEntry 1336 while(!aScrollWindow.aCheckBoxes[nLastVisible] && !aScrollWindow.aColorBoxes[nLastVisible] && 1337 nLastVisible < nCount - 1 ) 1338 nLastVisible++; 1339 if ( nLastVisible < nCount ) 1340 { 1341 if ( lcl_isGroupVisible( 1342 lcl_getGroup( nLastVisible ), aScrollWindow.GetModuleOptions() ) != sal_False ) 1343 { 1344 if(aScrollWindow.aCheckBoxes[nLastVisible]) 1345 aScrollWindow.aCheckBoxes[nLastVisible]->Show(); 1346 if(aScrollWindow.aColorBoxes[nLastVisible]) 1347 aScrollWindow.aColorBoxes[nLastVisible]->Show(); 1348 } 1349 } 1350 } // if(nLastVisible < nCount - 1) 1351 sal_Int32 nChapterCount = aScrollWindow.aChapters.size(); 1352 for( i = 0; i < nChapterCount; i++ ) 1353 { 1354 Point aPos = aScrollWindow.aChapters[i]->GetPosPixel(); aPos.Y() += nOffset; aScrollWindow.aChapters[i]->SetPosPixel(aPos); 1355 aPos = aScrollWindow.aChapterWins[i]->GetPosPixel(); aPos.Y() += nOffset; aScrollWindow.aChapterWins[i]->SetPosPixel(aPos); 1356 } 1357 aScrollWindow.SetUpdateMode(sal_True); 1358 return 0; 1359 } 1360 /* -----------------------------29.04.2002 17:02------------------------------ 1361 1362 ---------------------------------------------------------------------------*/ 1363 long ColorConfigCtrl_Impl::PreNotify( NotifyEvent& rNEvt ) 1364 { 1365 if(rNEvt.GetType() == EVENT_COMMAND) 1366 { 1367 const CommandEvent* pCEvt = rNEvt.GetCommandEvent(); 1368 sal_uInt16 nCmd = pCEvt->GetCommand(); 1369 if( COMMAND_WHEEL == nCmd ) 1370 { 1371 Command(*pCEvt); 1372 return 1; 1373 } 1374 } 1375 return Control::PreNotify(rNEvt); 1376 } 1377 /* -----------------------------08.04.2002 16:37------------------------------ 1378 1379 ---------------------------------------------------------------------------*/ 1380 void ColorConfigCtrl_Impl::Command( const CommandEvent& rCEvt ) 1381 { 1382 switch ( rCEvt.GetCommand() ) 1383 { 1384 1385 case COMMAND_WHEEL: 1386 case COMMAND_STARTAUTOSCROLL: 1387 case COMMAND_AUTOSCROLL: 1388 { 1389 const CommandWheelData* pWheelData = rCEvt.GetWheelData(); 1390 if(pWheelData && !pWheelData->IsHorz() && COMMAND_WHEEL_ZOOM != pWheelData->GetMode()) 1391 { 1392 HandleScrollCommand( rCEvt, 0, &aVScroll ); 1393 } 1394 } 1395 break; 1396 default: 1397 Control::Command(rCEvt); 1398 } 1399 } 1400 1401 /* -----------------------------14.12.2005 12:37------------------------------ 1402 1403 ---------------------------------------------------------------------------*/ 1404 void ColorConfigCtrl_Impl::DataChanged( const DataChangedEvent& rDCEvt ) 1405 { 1406 Window::DataChanged( rDCEvt ); 1407 if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 1408 (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 1409 { 1410 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 1411 SetBackground(Wallpaper(rStyleSettings.GetFieldColor())); 1412 } 1413 } 1414 1415 1416 /* -----------------------------27.03.2002 11:43------------------------------ 1417 1418 ---------------------------------------------------------------------------*/ 1419 IMPL_LINK(ColorConfigCtrl_Impl, ClickHdl, CheckBox*, pBox) 1420 { 1421 DBG_ASSERT(pColorConfig, "Configuration not set" ); 1422 1423 for( sal_Int32 i = 0; i < ColorConfigEntryCount; i++ ) 1424 { 1425 if(ANCHOR == i) 1426 continue; 1427 if(aScrollWindow.aCheckBoxes[i] == pBox ) 1428 { 1429 ColorConfigValue aBoundCol = pColorConfig->GetColorValue(ColorConfigEntry(i)); 1430 aBoundCol.bIsVisible = pBox->IsChecked(); 1431 pColorConfig->SetColorValue(ColorConfigEntry(i), aBoundCol); 1432 break; 1433 } 1434 } // for( sal_Int32 i = 0; i < ColorConfigEntryCount; i++ ) 1435 return 0; 1436 } 1437 /* -----------------------------27.03.2002 11:43------------------------------ 1438 1439 ---------------------------------------------------------------------------*/ 1440 IMPL_LINK(ColorConfigCtrl_Impl, ColorHdl, ColorListBox*, pBox) 1441 { 1442 DBG_ASSERT(pColorConfig, "Configuration not set" ); 1443 sal_Int32 i = 0; 1444 for( ; i < ColorConfigEntryCount; i++ ) 1445 { 1446 if(pBox && aScrollWindow.aColorBoxes[i] == pBox) 1447 { 1448 ColorConfigValue aColorEntry = pColorConfig->GetColorValue(ColorConfigEntry(i)); 1449 if(!pBox->GetSelectEntryPos()) 1450 { 1451 aColorEntry.nColor = COL_AUTO; 1452 if(aScrollWindow.aWindows[i]) 1453 aScrollWindow.aWindows[i]->SetBackground( 1454 Wallpaper(ColorConfig::GetDefaultColor((ColorConfigEntry) i))); 1455 } 1456 else 1457 { 1458 Color aColor = pBox->GetSelectEntryColor(); // #i14869# no Color&, 'cause it's a ref to a temp object on the stack! 1459 aColorEntry.nColor = aColor.GetColor(); 1460 if(aScrollWindow.aWindows[i]) 1461 aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor)); 1462 } 1463 if(aScrollWindow.aWindows[i]) 1464 aScrollWindow.aWindows[i]->Invalidate(); 1465 pColorConfig->SetColorValue(ColorConfigEntry(i), aColorEntry); 1466 break; 1467 } 1468 } // for( sal_Int32 i = 0; i < ColorConfigEntryCount; i++ ) 1469 sal_Int32 nExtCount = pExtColorConfig->GetComponentCount(); 1470 sal_Int32 nCount = aScrollWindow.aCheckBoxes.size(); 1471 sal_Int32 nPos = 0; 1472 i = ColorConfigEntryCount; 1473 for (sal_Int32 j = 0; j < nExtCount; ++j) 1474 { 1475 ::rtl::OUString sComponentName = pExtColorConfig->GetComponentName(j); 1476 sal_Int32 nColorCount = pExtColorConfig->GetComponentColorCount(sComponentName); 1477 1478 for( sal_Int32 k = 0; i < nCount && k < nColorCount; ++i ,++nPos,++k) 1479 { 1480 if(pBox && aScrollWindow.aColorBoxes[i] == pBox) 1481 { 1482 ExtendedColorConfigValue aColorEntry = pExtColorConfig->GetComponentColorConfigValue(sComponentName,k); 1483 Color aColor = pBox->GetSelectEntryColor(); // #i14869# no Color&, 'cause it's a ref to a temp object on the stack! 1484 aColorEntry.setColor(aColor.GetColor()); 1485 if( !pBox->GetSelectEntryPos() ) // auto color 1486 { 1487 aColorEntry.setColor(aColorEntry.getDefaultColor()); 1488 aColor.SetColor(aColorEntry.getColor()); 1489 } 1490 if ( aScrollWindow.aWindows[i] ) 1491 { 1492 aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor)); 1493 aScrollWindow.aWindows[i]->Invalidate(); 1494 } 1495 pExtColorConfig->SetColorValue(sComponentName,aColorEntry); 1496 break; 1497 } 1498 } 1499 } 1500 return 0; 1501 } 1502 IMPL_LINK(ColorConfigCtrl_Impl, ControlFocusHdl, Control*, pCtrl) 1503 { 1504 //determine whether a control is completely visible 1505 //and make it visible 1506 Point aCtrlPos(pCtrl->GetPosPixel()); 1507 sal_Int32 nWinHeight = aScrollWindow.GetSizePixel().Height(); 1508 if(0 != (GETFOCUS_TAB & pCtrl->GetGetFocusFlags() && 1509 (aCtrlPos.Y() < 0 || 1510 nWinHeight < aCtrlPos.Y() + aScrollWindow.aColorBoxes[0]->GetSizePixel().Height()))) 1511 { 1512 long nThumbPos = aVScroll.GetThumbPos(); 1513 if(nWinHeight < aCtrlPos.Y() + aScrollWindow.aColorBoxes[0]->GetSizePixel().Height()) 1514 { 1515 //scroll down 1516 nThumbPos +=2; 1517 } 1518 else 1519 { 1520 //scroll up 1521 nThumbPos -= 2; 1522 if(nThumbPos < 0) 1523 nThumbPos = 0; 1524 } 1525 aVScroll.SetThumbPos(nThumbPos); 1526 ScrollHdl(&aVScroll); 1527 } 1528 return 0; 1529 }; 1530 /* -----------------------------25.03.2002 10:47------------------------------ 1531 1532 ---------------------------------------------------------------------------*/ 1533 SvxColorOptionsTabPage::SvxColorOptionsTabPage( 1534 Window* pParent, const SfxItemSet& rCoreSet) : 1535 SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_COLORCONFIG ), rCoreSet ), 1536 aColorSchemeFL( this, CUI_RES( FL_COLORSCHEME ) ), 1537 aColorSchemeFT( this, CUI_RES( FT_COLORSCHEME ) ), 1538 aColorSchemeLB( this, CUI_RES( LB_COLORSCHEME ) ), 1539 aSaveSchemePB( this, CUI_RES( PB_SAVESCHEME) ), 1540 aDeleteSchemePB( this, CUI_RES( PB_DELETESCHEME ) ), 1541 aCustomColorsFL( this, CUI_RES( FL_CUSTOMCOLORS ) ), 1542 bFillItemSetCalled(sal_False), 1543 pColorConfig(0), 1544 pExtColorConfig(0), 1545 pColorConfigCT( new ColorConfigCtrl_Impl(this, CUI_RES( CT_COLORCONFIG ) )) 1546 { 1547 FreeResource(); 1548 aColorSchemeLB.SetSelectHdl(LINK(this, SvxColorOptionsTabPage, SchemeChangedHdl_Impl)); 1549 Link aLk = LINK(this, SvxColorOptionsTabPage, SaveDeleteHdl_Impl ); 1550 aSaveSchemePB.SetClickHdl(aLk); 1551 aDeleteSchemePB.SetClickHdl(aLk); 1552 } 1553 /* -----------------------------25.03.2002 10:47------------------------------ 1554 1555 ---------------------------------------------------------------------------*/ 1556 SvxColorOptionsTabPage::~SvxColorOptionsTabPage() 1557 { 1558 //when the dialog is cancelled but the color scheme ListBox has been changed these 1559 //changes need to be undone 1560 if(!bFillItemSetCalled && aColorSchemeLB.GetSavedValue() != aColorSchemeLB.GetSelectEntryPos()) 1561 { 1562 rtl::OUString sOldScheme = aColorSchemeLB.GetEntry(aColorSchemeLB.GetSavedValue()); 1563 if(sOldScheme.getLength()) 1564 { 1565 pColorConfig->SetCurrentSchemeName(sOldScheme); 1566 pExtColorConfig->SetCurrentSchemeName(sOldScheme); 1567 } 1568 } 1569 delete pColorConfigCT; 1570 pColorConfig->ClearModified(); 1571 pColorConfig->EnableBroadcast(); 1572 delete pColorConfig; 1573 pExtColorConfig->ClearModified(); 1574 pExtColorConfig->EnableBroadcast(); 1575 delete pExtColorConfig; 1576 } 1577 /* -----------------------------25.03.2002 10:47------------------------------ 1578 1579 ---------------------------------------------------------------------------*/ 1580 SfxTabPage* SvxColorOptionsTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) 1581 { 1582 return ( new SvxColorOptionsTabPage( pParent, rAttrSet ) ); 1583 } 1584 /* -----------------------------25.03.2002 10:47------------------------------ 1585 1586 ---------------------------------------------------------------------------*/ 1587 sal_Bool SvxColorOptionsTabPage::FillItemSet( SfxItemSet& ) 1588 { 1589 bFillItemSetCalled = sal_True; 1590 if(aColorSchemeLB.GetSavedValue() != aColorSchemeLB.GetSelectEntryPos()) 1591 { 1592 pColorConfig->SetModified(); 1593 pExtColorConfig->SetModified(); 1594 } 1595 if(pColorConfig->IsModified()) 1596 pColorConfig->Commit(); 1597 if(pExtColorConfig->IsModified()) 1598 pExtColorConfig->Commit(); 1599 return sal_True; 1600 } 1601 /* -----------------------------25.03.2002 10:47------------------------------ 1602 1603 ---------------------------------------------------------------------------*/ 1604 void SvxColorOptionsTabPage::Reset( const SfxItemSet& ) 1605 { 1606 if(pColorConfig) 1607 { 1608 pColorConfig->ClearModified(); 1609 pColorConfig->DisableBroadcast(); 1610 delete pColorConfig; 1611 } 1612 pColorConfig = new EditableColorConfig; 1613 pColorConfigCT->SetConfig(*pColorConfig); 1614 1615 if(pExtColorConfig) 1616 { 1617 pExtColorConfig->ClearModified(); 1618 pExtColorConfig->DisableBroadcast(); 1619 delete pExtColorConfig; 1620 } 1621 pExtColorConfig = new EditableExtendedColorConfig; 1622 pColorConfigCT->SetExtendedConfig(*pExtColorConfig); 1623 1624 String sUser = GetUserData(); 1625 //has to be called always to speed up accessibility tools 1626 pColorConfigCT->SetScrollPosition(sUser.ToInt32()); 1627 aColorSchemeLB.Clear(); 1628 uno::Sequence< ::rtl::OUString > aSchemes = pColorConfig->GetSchemeNames(); 1629 const rtl::OUString* pSchemes = aSchemes.getConstArray(); 1630 for(sal_Int32 i = 0; i < aSchemes.getLength(); i++) 1631 aColorSchemeLB.InsertEntry(pSchemes[i]); 1632 aColorSchemeLB.SelectEntry(pColorConfig->GetCurrentSchemeName()); 1633 aColorSchemeLB.SaveValue(); 1634 aDeleteSchemePB.Enable( aSchemes.getLength() > 1 ); 1635 UpdateColorConfig(); 1636 } 1637 /* -----------------------------25.03.2002 10:47------------------------------ 1638 1639 ---------------------------------------------------------------------------*/ 1640 int SvxColorOptionsTabPage::DeactivatePage( SfxItemSet* _pSet ) 1641 { 1642 if ( _pSet ) 1643 FillItemSet( *_pSet ); 1644 return( LEAVE_PAGE ); 1645 } 1646 /* -----------------------------25.03.2002 15:32------------------------------ 1647 1648 ---------------------------------------------------------------------------*/ 1649 void SvxColorOptionsTabPage::UpdateColorConfig() 1650 { 1651 //update the color config control 1652 pColorConfigCT->Update(); 1653 } 1654 /* -----------------------------25.03.2002 15:30------------------------------ 1655 1656 ---------------------------------------------------------------------------*/ 1657 IMPL_LINK(SvxColorOptionsTabPage, SchemeChangedHdl_Impl, ListBox*, pBox) 1658 { 1659 pColorConfig->LoadScheme(pBox->GetSelectEntry()); 1660 pExtColorConfig->LoadScheme(pBox->GetSelectEntry()); 1661 UpdateColorConfig(); 1662 return 0; 1663 } 1664 /* -----------------------------09.04.2002 15:21------------------------------ 1665 1666 ---------------------------------------------------------------------------*/ 1667 IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, PushButton*, pButton ) 1668 { 1669 if(&aSaveSchemePB == pButton) 1670 { 1671 String sName; 1672 //CHINA001 SvxNameDialog aNameDlg(pButton, 1673 //CHINA001 sName, 1674 //CHINA001 String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_SAVE2))); 1675 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 1676 DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 1677 AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog( pButton, 1678 sName, String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_SAVE2)) ); 1679 DBG_ASSERT(aNameDlg, "Dialogdiet fail!");//CHINA001 1680 aNameDlg->SetCheckNameHdl( LINK(this, SvxColorOptionsTabPage, CheckNameHdl_Impl)); 1681 aNameDlg->SetText(String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_SAVE1))); 1682 aNameDlg->SetHelpId(HID_OPTIONS_COLORCONFIG_SAVE_SCHEME); 1683 aNameDlg->SetEditHelpId(HID_OPTIONS_COLORCONFIG_NAME_SCHEME); 1684 aNameDlg->SetCheckNameHdl( LINK(this, SvxColorOptionsTabPage, CheckNameHdl_Impl)); 1685 if(RET_OK == aNameDlg->Execute()) //CHINA001 if(RET_OK == aNameDlg.Execute()) 1686 { 1687 aNameDlg->GetName(sName); //CHINA001 aNameDlg.GetName(sName); 1688 pColorConfig->AddScheme(sName); 1689 pExtColorConfig->AddScheme(sName); 1690 aColorSchemeLB.InsertEntry(sName); 1691 aColorSchemeLB.SelectEntry(sName); 1692 aColorSchemeLB.GetSelectHdl().Call(&aColorSchemeLB); 1693 } 1694 delete aNameDlg; //add by CHINA001 1695 } 1696 else 1697 { 1698 DBG_ASSERT(aColorSchemeLB.GetEntryCount() > 1, "don't delete the last scheme"); 1699 QueryBox aQuery(pButton, CUI_RES(RID_SVXQB_DELETE_COLOR_CONFIG)); 1700 aQuery.SetText(String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_DELETE))); 1701 if(RET_YES == aQuery.Execute()) 1702 { 1703 rtl::OUString sDeleteScheme(aColorSchemeLB.GetSelectEntry()); 1704 aColorSchemeLB.RemoveEntry(aColorSchemeLB.GetSelectEntryPos()); 1705 aColorSchemeLB.SelectEntryPos(0); 1706 aColorSchemeLB.GetSelectHdl().Call(&aColorSchemeLB); 1707 //first select the new scheme and then delete the old one 1708 pColorConfig->DeleteScheme(sDeleteScheme); 1709 pExtColorConfig->DeleteScheme(sDeleteScheme); 1710 } 1711 } 1712 aDeleteSchemePB.Enable( aColorSchemeLB.GetEntryCount() > 1 ); 1713 return 0; 1714 } 1715 /* -----------------------------09.04.2002 15:47------------------------------ 1716 1717 ---------------------------------------------------------------------------*/ 1718 IMPL_LINK(SvxColorOptionsTabPage, CheckNameHdl_Impl, AbstractSvxNameDialog*, pDialog ) 1719 { 1720 String sName; 1721 pDialog->GetName(sName); 1722 return sName.Len() && LISTBOX_ENTRY_NOTFOUND == aColorSchemeLB.GetEntryPos( sName ); 1723 } 1724 /* -----------------------------25.04.2002 15:12------------------------------ 1725 1726 ---------------------------------------------------------------------------*/ 1727 void SvxColorOptionsTabPage::FillUserData() 1728 { 1729 SetUserData(String::CreateFromInt32(pColorConfigCT->GetScrollPosition())); 1730 } 1731 1732