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_svx.hxx" 26 #include <vcl/wrkwin.hxx> 27 #include <tools/shl.hxx> 28 #include <vcl/metaact.hxx> 29 #include <svtools/valueset.hxx> 30 #include <svl/eitem.hxx> 31 #include <sfx2/dispatch.hxx> 32 #include <svtools/colrdlg.hxx> 33 34 #define BMPMASK_PRIVATE 35 36 #include <svx/dialmgr.hxx> 37 #include <svx/bmpmask.hxx> 38 #include <svx/dialogs.hrc> 39 #include <bmpmask.hrc> 40 #include <svx/svxids.hrc> 41 42 //------------------------------------------------------------------------- 43 44 #define BMP_RESID(nId) ResId(nId, DIALOG_MGR()) 45 #define TRANSP_STRING "Transparent" 46 #define TRANSP_COL (Color( 252, 252, 252 )) 47 #define OWN_CALLMODE SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD 48 49 //------------------------------------------------------------------------- 50 51 #define TEST_COLS() \ 52 { \ 53 nR = aCol.GetRed(); nG = aCol.GetGreen(); nB = aCol.GetBlue(); \ 54 for( i = 0; i < nCount; i++ ) \ 55 { \ 56 if ( ( pMinR[i] <= nR ) && ( pMaxR[i] >= nR ) && \ 57 ( pMinG[i] <= nG ) && ( pMaxG[i] >= nG ) && \ 58 ( pMinB[i] <= nB ) && ( pMaxB[i] >= nB ) ) \ 59 { \ 60 aCol = pDstCols[i]; bReplace = sal_True; break; \ 61 } \ 62 } \ 63 } 64 65 // ------------------------------------------------------------------------- 66 67 SFX_IMPL_DOCKINGWINDOW( SvxBmpMaskChildWindow, SID_BMPMASK ) 68 69 // ------------------------------------------------------------------------- 70 71 class ColorWindow : public Control 72 { 73 Color aColor; 74 75 76 public: 77 78 ColorWindow( Window* pParent, WinBits nWinStyle ) : 79 Control( pParent, nWinStyle ), 80 aColor( COL_WHITE ) {}; 81 82 ColorWindow( Window* pParent, const ResId& rId ) : 83 Control( pParent, rId ), 84 aColor( COL_WHITE ) {}; 85 86 void SetColor( const Color& rColor ) 87 { 88 aColor = rColor; 89 Invalidate(); 90 } 91 92 virtual void Paint( const Rectangle& rRect ); 93 }; 94 95 //------------------------------------------------------------------------- 96 97 class MaskSet : public ValueSet 98 { 99 SvxBmpMask* pSvxBmpMask; 100 101 102 public: 103 MaskSet( SvxBmpMask* pParent, WinBits nWinStyle ); 104 MaskSet( SvxBmpMask* pParent, const ResId& rId ); 105 106 virtual void Select(); 107 virtual void KeyInput( const KeyEvent& rKEvt ); 108 virtual void GetFocus(); 109 110 void onEditColor(); 111 }; 112 113 //------------------------------------------------------------------------- 114 115 MaskSet::MaskSet( SvxBmpMask* pParent, WinBits nWinStyle ) : 116 ValueSet ( pParent, nWinStyle ), 117 pSvxBmpMask ( pParent ) 118 { 119 } 120 121 //------------------------------------------------------------------------- 122 123 MaskSet::MaskSet( SvxBmpMask* pParent, const ResId& rId ) : 124 ValueSet ( pParent, rId ), 125 pSvxBmpMask ( pParent ) 126 { 127 } 128 129 //------------------------------------------------------------------------- 130 131 void MaskSet::Select() 132 { 133 ValueSet::Select(); 134 135 pSvxBmpMask->onSelect( this ); 136 } 137 138 void MaskSet::GetFocus() 139 { 140 SelectItem( 1 ); 141 pSvxBmpMask->onSelect( this ); 142 } 143 144 void MaskSet::KeyInput( const KeyEvent& rKEvt ) 145 { 146 KeyCode aCode = rKEvt.GetKeyCode(); 147 148 // if the key has a modifier we don't care 149 if( aCode.GetModifier() ) 150 { 151 ValueSet::KeyInput( rKEvt ); 152 } 153 else 154 { 155 // check for keys that interests us 156 switch ( aCode.GetCode() ) 157 { 158 case KEY_SPACE: 159 onEditColor(); 160 break; 161 default: 162 ValueSet::KeyInput( rKEvt ); 163 } 164 165 } 166 } 167 168 void MaskSet::onEditColor() 169 { 170 SvColorDialog* pColorDlg = new SvColorDialog( GetParent() ); 171 172 pColorDlg->SetColor(GetItemColor(1)); 173 174 if( pColorDlg->Execute() ) 175 SetItemColor( 1, pColorDlg->GetColor() ); 176 177 delete pColorDlg; 178 } 179 180 //------------------------------------------------------------------------- 181 182 class MaskData 183 { 184 SvxBmpMask* pMask; 185 sal_Bool bIsReady; 186 sal_Bool bExecState; 187 SfxBindings& rBindings; 188 189 public: 190 MaskData( SvxBmpMask* pBmpMask, SfxBindings& rBind ); 191 192 sal_Bool IsCbxReady() const { return bIsReady; } 193 void SetExecState( sal_Bool bState ) { bExecState = bState; } 194 sal_Bool IsExecReady() const { return bExecState; } 195 196 DECL_LINK( PipetteHdl, ToolBox* pTbx ); 197 DECL_LINK( CbxHdl, CheckBox* pCbx ); 198 DECL_LINK( CbxTransHdl, CheckBox* pCbx ); 199 DECL_LINK( FocusLbHdl, ColorLB* pLb ); 200 DECL_LINK( ExecHdl, PushButton* pBtn ); 201 }; 202 203 //------------------------------------------------------------------------- 204 205 MaskData::MaskData( SvxBmpMask* pBmpMask, SfxBindings& rBind ) : 206 207 pMask ( pBmpMask ), 208 bIsReady ( sal_False ), 209 bExecState ( sal_False ), 210 rBindings ( rBind ) 211 212 { 213 } 214 215 //------------------------------------------------------------------------- 216 217 IMPL_LINK( MaskData, PipetteHdl, ToolBox*, pTbx ) 218 { 219 SfxBoolItem aBItem( SID_BMPMASK_PIPETTE, 220 pTbx->IsItemChecked( TBI_PIPETTE ) ); 221 222 rBindings.GetDispatcher()->Execute( SID_BMPMASK_PIPETTE, OWN_CALLMODE, &aBItem, 0L ); 223 224 return 0; 225 } 226 227 //------------------------------------------------------------------------- 228 229 IMPL_LINK( MaskData, CbxHdl, CheckBox*, pCbx ) 230 { 231 bIsReady = pMask->aCbx1.IsChecked() || pMask->aCbx2.IsChecked() || 232 pMask->aCbx3.IsChecked() || pMask->aCbx4.IsChecked(); 233 234 if ( bIsReady && IsExecReady() ) 235 pMask->aBtnExec.Enable(); 236 else 237 pMask->aBtnExec.Disable(); 238 239 // Wenn eine Checkbox gecheckt wurde, wird die Pipette enabled 240 if ( pCbx->IsChecked() ) 241 { 242 MaskSet* pSet = NULL; 243 244 if ( pCbx == &( pMask->aCbx1 ) ) 245 pSet = pMask->pQSet1; 246 else if ( pCbx == &( pMask->aCbx2 ) ) 247 pSet = pMask->pQSet2; 248 else if ( pCbx == &( pMask->aCbx3 ) ) 249 pSet = pMask->pQSet3; 250 else // if ( pCbx == &( pMask->aCbx4 ) ) 251 pSet = pMask->pQSet4; 252 253 pSet->SelectItem( 1 ); 254 pSet->Select(); 255 256 pMask->aTbxPipette.CheckItem( TBI_PIPETTE, sal_True ); 257 PipetteHdl( &( pMask->aTbxPipette ) ); 258 } 259 260 return 0; 261 } 262 263 //------------------------------------------------------------------------- 264 265 IMPL_LINK( MaskData, CbxTransHdl, CheckBox*, pCbx ) 266 { 267 bIsReady = pCbx->IsChecked(); 268 if ( bIsReady ) 269 { 270 pMask->pQSet1->Disable(); 271 pMask->pQSet2->Disable(); 272 pMask->pQSet3->Disable(); 273 pMask->pQSet4->Disable(); 274 pMask->pCtlPipette->Disable(); 275 pMask->aCbx1.Disable(); 276 pMask->aSp1.Disable(); 277 pMask->aCbx2.Disable(); 278 pMask->aSp2.Disable(); 279 pMask->aCbx3.Disable(); 280 pMask->aSp3.Disable(); 281 pMask->aCbx4.Disable(); 282 pMask->aSp4.Disable(); 283 pMask->aTbxPipette.Disable(); 284 285 pMask->aLbColor1.Disable(); 286 pMask->aLbColor2.Disable(); 287 pMask->aLbColor3.Disable(); 288 pMask->aLbColor4.Disable(); 289 pMask->aLbColorTrans.Enable(); 290 } 291 else 292 { 293 pMask->pQSet1->Enable(); 294 pMask->pQSet2->Enable(); 295 pMask->pQSet3->Enable(); 296 pMask->pQSet4->Enable(); 297 pMask->pCtlPipette->Enable(); 298 pMask->aCbx1.Enable(); 299 pMask->aSp1.Enable(); 300 pMask->aCbx2.Enable(); 301 pMask->aSp2.Enable(); 302 pMask->aCbx3.Enable(); 303 pMask->aSp3.Enable(); 304 pMask->aCbx4.Enable(); 305 pMask->aSp4.Enable(); 306 pMask->aTbxPipette.Enable(); 307 308 pMask->aLbColor1.Enable(); 309 pMask->aLbColor2.Enable(); 310 pMask->aLbColor3.Enable(); 311 pMask->aLbColor4.Enable(); 312 pMask->aLbColorTrans.Disable(); 313 314 bIsReady = pMask->aCbx1.IsChecked() || pMask->aCbx2.IsChecked() || 315 pMask->aCbx3.IsChecked() || pMask->aCbx4.IsChecked(); 316 } 317 318 if ( bIsReady && IsExecReady() ) 319 pMask->aBtnExec.Enable(); 320 else 321 pMask->aBtnExec.Disable(); 322 323 return 0L; 324 } 325 326 //------------------------------------------------------------------------- 327 328 IMPL_LINK( MaskData, FocusLbHdl, ColorLB*, pLb ) 329 { 330 pMask->pQSet1->SelectItem( pLb == &( pMask->aLbColor1 ) ? 1 : 0 ); 331 pMask->pQSet2->SelectItem( pLb == &( pMask->aLbColor2 ) ? 1 : 0 ); 332 pMask->pQSet3->SelectItem( pLb == &( pMask->aLbColor3 ) ? 1 : 0 ); 333 pMask->pQSet4->SelectItem( pLb == &( pMask->aLbColor4 ) ? 1 : 0 ); 334 335 return 0; 336 } 337 338 //------------------------------------------------------------------------- 339 340 IMPL_LINK( MaskData, ExecHdl, PushButton*, EMPTYARG ) 341 { 342 SfxBoolItem aBItem( SID_BMPMASK_EXEC, sal_True ); 343 rBindings.GetDispatcher()->Execute( SID_BMPMASK_EXEC, OWN_CALLMODE, &aBItem, 0L ); 344 345 return 0L; 346 } 347 348 //------------------------------------------------------------------------- 349 350 void ColorWindow::Paint( const Rectangle &/*Rect*/ ) 351 { 352 const Color& rOldLineColor = GetLineColor(); 353 const Color& rOldFillColor = GetFillColor(); 354 355 SetLineColor( aColor ); 356 SetFillColor( aColor ); 357 358 DrawRect( Rectangle( Point(), GetSizePixel() ) ); 359 360 SetLineColor( rOldLineColor ); 361 SetFillColor( rOldFillColor ); 362 } 363 364 //------------------------------------------------------------------------- 365 366 SvxBmpMaskSelectItem::SvxBmpMaskSelectItem( sal_uInt16 nId_, SvxBmpMask& rMask, 367 SfxBindings& rBindings ) : 368 SfxControllerItem ( nId_, rBindings ), 369 rBmpMask ( rMask) 370 { 371 } 372 373 //------------------------------------------------------------------------- 374 375 void SvxBmpMaskSelectItem::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/, 376 const SfxPoolItem* pItem ) 377 { 378 if ( ( nSID == SID_BMPMASK_EXEC ) && pItem ) 379 { 380 const SfxBoolItem* pStateItem = PTR_CAST( SfxBoolItem, pItem ); 381 382 DBG_ASSERT( pStateItem || pItem == 0, "SfxBoolItem erwartet"); 383 384 rBmpMask.SetExecState( pStateItem->GetValue() ); 385 } 386 } 387 388 //------------------------------------------------------------------------- 389 390 SvxBmpMaskChildWindow::SvxBmpMaskChildWindow( Window* pParent_, sal_uInt16 nId, 391 SfxBindings* pBindings, 392 SfxChildWinInfo* pInfo ) : 393 SfxChildWindow( pParent_, nId ) 394 { 395 pWindow = new SvxBmpMask( pBindings, this, pParent_, 396 BMP_RESID( RID_SVXDLG_BMPMASK ) ); 397 SvxBmpMask* pDlg = (SvxBmpMask*) pWindow; 398 399 eChildAlignment = SFX_ALIGN_NOALIGNMENT; 400 401 pDlg->Initialize( pInfo ); 402 } 403 404 //------------------------------------------------------------------------- 405 406 SvxBmpMask::SvxBmpMask( SfxBindings *pBindinx, 407 SfxChildWindow *pCW, 408 Window* pParent, 409 const ResId& rResId ) : 410 SfxDockingWindow ( pBindinx, pCW, pParent, rResId ), 411 aTbxPipette ( this, BMP_RESID( TBX_PIPETTE ) ), 412 pCtlPipette ( new ColorWindow( this, BMP_RESID( WND_PIPETTE ) ) ), 413 aBtnExec ( this, BMP_RESID( BTN_EXEC ) ), 414 aGrpQ ( this, BMP_RESID( GRP_Q ) ), 415 416 aFt1 ( this, BMP_RESID ( FT_1 ) ), 417 aFt2 ( this, BMP_RESID ( FT_2 ) ), 418 aFt3 ( this, BMP_RESID ( FT_3 ) ), 419 420 aCbx1 ( this, BMP_RESID( CBX_1 ) ), 421 pQSet1 ( new MaskSet( this, BMP_RESID( QCOL_1 ) ) ), 422 aSp1 ( this, BMP_RESID( SP_1 ) ), 423 aLbColor1 ( this, BMP_RESID ( LB_1 ) ), 424 425 aCbx2 ( this, BMP_RESID( CBX_2 ) ), 426 pQSet2 ( new MaskSet( this, BMP_RESID( QCOL_2 ) ) ), 427 aSp2 ( this, BMP_RESID( SP_2 ) ), 428 aLbColor2 ( this, BMP_RESID ( LB_2 ) ), 429 430 aCbx3 ( this, BMP_RESID( CBX_3 ) ), 431 pQSet3 ( new MaskSet( this, BMP_RESID( QCOL_3 ) ) ), 432 aSp3 ( this, BMP_RESID( SP_3 ) ), 433 aLbColor3 ( this, BMP_RESID ( LB_3 ) ), 434 435 aCbx4 ( this, BMP_RESID( CBX_4 ) ), 436 pQSet4 ( new MaskSet( this, BMP_RESID( QCOL_4 ) ) ), 437 aSp4 ( this, BMP_RESID( SP_4 ) ), 438 aLbColor4 ( this, BMP_RESID ( LB_4 ) ), 439 440 pData ( new MaskData( this, *pBindinx ) ), 441 aCbxTrans ( this, BMP_RESID( CBX_TRANS ) ), 442 aLbColorTrans ( this, BMP_RESID ( LB_TRANS ) ), 443 pColTab ( NULL ), 444 aPipetteColor ( COL_WHITE ), 445 aSelItem ( SID_BMPMASK_EXEC, *this, *pBindinx ), 446 maImgPipette ( BMP_RESID ( IMG_PIPETTE ) ), 447 maImgPipetteH ( BMP_RESID ( IMG_PIPETTE_H ) ) 448 { 449 FreeResource(); 450 451 ApplyStyle(); 452 453 aTbxPipette.SetSizePixel( aTbxPipette.CalcWindowSizePixel() ); 454 aTbxPipette.SetSelectHdl( LINK( pData, MaskData, PipetteHdl ) ); 455 aBtnExec.SetClickHdl( LINK( pData, MaskData, ExecHdl ) ); 456 457 aCbx1.SetClickHdl( LINK( pData, MaskData, CbxHdl ) ); 458 aCbx2.SetClickHdl( LINK( pData, MaskData, CbxHdl ) ); 459 aCbx3.SetClickHdl( LINK( pData, MaskData, CbxHdl ) ); 460 aCbx4.SetClickHdl( LINK( pData, MaskData, CbxHdl ) ); 461 aCbxTrans.SetClickHdl( LINK( pData, MaskData, CbxTransHdl ) ); 462 463 SetAccessibleNames (); 464 465 aLbColor1.SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) ); 466 aLbColor2.SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) ); 467 aLbColor3.SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) ); 468 aLbColor4.SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) ); 469 aLbColorTrans.Disable(); 470 471 aSp1.SetValue( 10 ); 472 aSp2.SetValue( 10 ); 473 aSp3.SetValue( 10 ); 474 aSp4.SetValue( 10 ); 475 476 pQSet1->SetStyle( pQSet1->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER ); 477 pQSet1->SetColCount( 1 ); 478 pQSet1->SetLineCount( 1 ); 479 // pQSet1->SetExtraSpacing( 1 ); 480 pQSet1->InsertItem( 1, aPipetteColor ); 481 pQSet1->SelectItem( 1 ); 482 483 pQSet2->SetStyle( pQSet2->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER ); 484 pQSet2->SetColCount( 1 ); 485 pQSet2->SetLineCount( 1 ); 486 // pQSet2->SetExtraSpacing( 1 ); 487 pQSet2->InsertItem( 1, aPipetteColor ); 488 pQSet2->SelectItem( 0 ); 489 490 pQSet3->SetStyle( pQSet3->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER ); 491 pQSet3->SetColCount( 1 ); 492 pQSet3->SetLineCount( 1 ); 493 // pQSet3->SetExtraSpacing( 1 ); 494 pQSet3->InsertItem( 1, aPipetteColor ); 495 pQSet3->SelectItem( 0 ); 496 497 pQSet4->SetStyle( pQSet4->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER ); 498 pQSet4->SetColCount( 1 ); 499 pQSet4->SetLineCount( 1 ); 500 // pQSet4->SetExtraSpacing( 1 ); 501 pQSet4->InsertItem( 1, aPipetteColor ); 502 pQSet4->SelectItem( 0 ); 503 504 pQSet1->Show(); 505 pQSet2->Show(); 506 pQSet3->Show(); 507 pQSet4->Show(); 508 509 aCbx1.SetAccessibleRelationMemberOf( &aGrpQ ); 510 pQSet1->SetAccessibleRelationMemberOf( &aGrpQ ); 511 aSp1.SetAccessibleRelationMemberOf( &aGrpQ ); 512 aLbColor1.SetAccessibleRelationMemberOf( &aGrpQ ); 513 aCbx1.SetAccessibleRelationLabeledBy( &aFt1 ); 514 pQSet1->SetAccessibleRelationLabeledBy( &aFt1 ); 515 aSp1.SetAccessibleRelationLabeledBy( &aFt2 ); 516 aLbColor1.SetAccessibleRelationLabeledBy( &aFt3 ); 517 aCbx2.SetAccessibleRelationMemberOf( &aGrpQ ); 518 pQSet2->SetAccessibleRelationMemberOf( &aGrpQ ); 519 aSp2.SetAccessibleRelationMemberOf( &aGrpQ ); 520 aLbColor2.SetAccessibleRelationMemberOf( &aGrpQ ); 521 aCbx2.SetAccessibleRelationLabeledBy( &aFt1 ); 522 pQSet2->SetAccessibleRelationLabeledBy( &aFt1 ); 523 aSp2.SetAccessibleRelationLabeledBy( &aFt2 ); 524 aLbColor2.SetAccessibleRelationLabeledBy( &aFt3 ); 525 aCbx3.SetAccessibleRelationMemberOf( &aGrpQ ); 526 pQSet3->SetAccessibleRelationMemberOf( &aGrpQ ); 527 aSp3.SetAccessibleRelationMemberOf( &aGrpQ ); 528 aLbColor3.SetAccessibleRelationMemberOf( &aGrpQ ); 529 aCbx3.SetAccessibleRelationLabeledBy( &aFt1 ); 530 pQSet3->SetAccessibleRelationLabeledBy( &aFt1 ); 531 aSp3.SetAccessibleRelationLabeledBy( &aFt2 ); 532 aLbColor3.SetAccessibleRelationLabeledBy( &aFt3 ); 533 aCbx4.SetAccessibleRelationMemberOf( &aGrpQ ); 534 pQSet4->SetAccessibleRelationMemberOf( &aGrpQ ); 535 aSp4.SetAccessibleRelationMemberOf( &aGrpQ ); 536 aLbColor4.SetAccessibleRelationMemberOf( &aGrpQ ); 537 aCbx4.SetAccessibleRelationLabeledBy( &aFt1 ); 538 pQSet4->SetAccessibleRelationLabeledBy( &aFt1 ); 539 aSp4.SetAccessibleRelationLabeledBy( &aFt2 ); 540 aLbColor4.SetAccessibleRelationLabeledBy( &aFt3 ); 541 aLbColorTrans.SetAccessibleRelationLabeledBy( &aCbxTrans ); 542 aLbColorTrans.SetAccessibleRelationMemberOf( &aGrpQ ); 543 aCbxTrans.SetAccessibleRelationMemberOf( &aGrpQ ); 544 } 545 546 //------------------------------------------------------------------------- 547 548 SvxBmpMask::~SvxBmpMask() 549 { 550 delete pQSet1; 551 delete pQSet2; 552 delete pQSet3; 553 delete pQSet4; 554 delete pCtlPipette; 555 delete pData; 556 } 557 558 //------------------------------------------------------------------------- 559 560 /** is called by a MaskSet when it is selected */ 561 void SvxBmpMask::onSelect( MaskSet* pSet ) 562 { 563 // automaticaly set focus to the corresponding listbox 564 /* 565 if( pSet == pQSet1 ) 566 aLbColor1.GrabFocus(); 567 else if( pSet == pQSet2 ) 568 aLbColor2.GrabFocus(); 569 else if( pSet == pQSet2 ) 570 aLbColor3.GrabFocus(); 571 else if( pSet == pQSet2 ) 572 aLbColor4.GrabFocus(); 573 */ 574 575 // now deselect all other value sets 576 if( pSet != pQSet1 ) 577 pQSet1->SelectItem( 0 ); 578 579 if( pSet != pQSet2 ) 580 pQSet2->SelectItem( 0 ); 581 582 if( pSet != pQSet3 ) 583 pQSet3->SelectItem( 0 ); 584 585 if( pSet != pQSet4 ) 586 pQSet4->SelectItem( 0 ); 587 } 588 589 //------------------------------------------------------------------------- 590 591 sal_Bool SvxBmpMask::Close() 592 { 593 SfxBoolItem aItem2( SID_BMPMASK_PIPETTE, sal_False ); 594 GetBindings().GetDispatcher()->Execute( SID_BMPMASK_PIPETTE, OWN_CALLMODE, &aItem2, 0L ); 595 596 return SfxDockingWindow::Close(); 597 } 598 599 //------------------------------------------------------------------------- 600 601 sal_Bool SvxBmpMask::NeedsColorTable() const 602 { 603 return ( aLbColor1.GetEntryCount() == 0 ); 604 } 605 606 //------------------------------------------------------------------------- 607 608 void SvxBmpMask::SetColorTable( const XColorTable* pTable ) 609 { 610 if ( pTable && ( pTable != pColTab ) ) 611 { 612 const String aTransp( BMP_RESID( RID_SVXDLG_BMPMASK_STR_TRANSP ) ); 613 614 pColTab = pTable; 615 616 aLbColorTrans.Fill( pColTab ); 617 aLbColorTrans.SelectEntryPos( 0 ); 618 619 aLbColor1.Fill( pColTab ); 620 aLbColor1.InsertEntry( TRANSP_COL, aTransp, 0 ); 621 aLbColor1.SelectEntryPos( 0 ); 622 623 aLbColor2.Fill( pColTab ); 624 aLbColor2.InsertEntry( TRANSP_COL, aTransp, 0 ); 625 aLbColor2.SelectEntryPos( 0 ); 626 627 aLbColor3.Fill( pColTab ); 628 aLbColor3.InsertEntry( TRANSP_COL, aTransp, 0 ); 629 aLbColor3.SelectEntryPos( 0 ); 630 631 aLbColor4.Fill( pColTab ); 632 aLbColor4.InsertEntry( TRANSP_COL, aTransp, 0 ); 633 aLbColor4.SelectEntryPos( 0 ); 634 } 635 } 636 637 //------------------------------------------------------------------------- 638 639 void SvxBmpMask::SetColor( const Color& rColor ) 640 { 641 aPipetteColor = rColor; 642 pCtlPipette->SetColor( aPipetteColor ); 643 } 644 645 //------------------------------------------------------------------------- 646 647 void SvxBmpMask::PipetteClicked() 648 { 649 if( pQSet1->GetSelectItemId() == 1 ) 650 { 651 aCbx1.Check( sal_True ); 652 pData->CbxHdl( &aCbx1 ); 653 pQSet1->SetItemColor( 1, aPipetteColor ); 654 } 655 else if( pQSet2->GetSelectItemId() == 1 ) 656 { 657 aCbx2.Check( sal_True ); 658 pData->CbxHdl( &aCbx2 ); 659 pQSet2->SetItemColor( 1, aPipetteColor ); 660 } 661 else if( pQSet3->GetSelectItemId() == 1 ) 662 { 663 aCbx3.Check( sal_True ); 664 pData->CbxHdl( &aCbx3 ); 665 pQSet3->SetItemColor( 1, aPipetteColor ); 666 } 667 else if( pQSet4->GetSelectItemId() == 1 ) 668 { 669 aCbx4.Check( sal_True ); 670 pData->CbxHdl( &aCbx4 ); 671 pQSet4->SetItemColor( 1, aPipetteColor ); 672 } 673 674 aTbxPipette.CheckItem( TBI_PIPETTE, sal_False ); 675 pData->PipetteHdl( &aTbxPipette ); 676 } 677 678 //------------------------------------------------------------------------- 679 680 void SvxBmpMask::SetExecState( sal_Bool bEnable ) 681 { 682 pData->SetExecState( bEnable ); 683 684 if ( pData->IsExecReady() && pData->IsCbxReady() ) 685 aBtnExec.Enable(); 686 else 687 aBtnExec.Disable(); 688 } 689 690 //------------------------------------------------------------------------- 691 692 sal_uInt16 SvxBmpMask::InitColorArrays( Color* pSrcCols, Color* pDstCols, sal_uIntPtr* pTols ) 693 { 694 sal_uInt16 nCount = 0; 695 696 if ( aCbx1.IsChecked() ) 697 { 698 pSrcCols[nCount] = pQSet1->GetItemColor( 1 ); 699 pDstCols[nCount] = aLbColor1.GetSelectEntryColor(); 700 pTols[nCount++] = static_cast<sal_uIntPtr>(aSp1.GetValue()); 701 } 702 703 if ( aCbx2.IsChecked() ) 704 { 705 pSrcCols[nCount] = pQSet2->GetItemColor( 1 ); 706 pDstCols[nCount] = aLbColor2.GetSelectEntryColor(); 707 pTols[nCount++] = static_cast<sal_uIntPtr>(aSp2.GetValue()); 708 } 709 710 if ( aCbx3.IsChecked() ) 711 { 712 pSrcCols[nCount] = pQSet3->GetItemColor( 1 ); 713 pDstCols[nCount] = aLbColor3.GetSelectEntryColor(); 714 pTols[nCount++] = static_cast<sal_uIntPtr>(aSp3.GetValue()); 715 } 716 717 if ( aCbx4.IsChecked() ) 718 { 719 pSrcCols[nCount] = pQSet4->GetItemColor( 1 ); 720 pDstCols[nCount] = aLbColor4.GetSelectEntryColor(); 721 pTols[nCount++] = static_cast<sal_uIntPtr>(aSp4.GetValue()); 722 } 723 724 return nCount; 725 } 726 727 //------------------------------------------------------------------------- 728 729 Bitmap SvxBmpMask::ImpMask( const Bitmap& rBitmap ) 730 { 731 Bitmap aBitmap( rBitmap ); 732 Color pSrcCols[4]; 733 Color pDstCols[4]; 734 sal_uIntPtr pTols[4]; 735 const sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols ); 736 737 EnterWait(); 738 aBitmap.Replace( pSrcCols, pDstCols, nCount, pTols ); 739 LeaveWait(); 740 741 return aBitmap; 742 } 743 744 //------------------------------------------------------------------------- 745 746 BitmapEx SvxBmpMask::ImpMask( const BitmapEx& rBitmapEx ) 747 { 748 return BitmapEx( ImpMask( rBitmapEx.GetBitmap() ), rBitmapEx.GetMask() ); 749 } 750 751 //------------------------------------------------------------------------- 752 753 BitmapEx SvxBmpMask::ImpMaskTransparent( const BitmapEx& rBitmapEx, const Color& rColor, const long nTol ) 754 { 755 EnterWait(); 756 757 BitmapEx aBmpEx; 758 Bitmap aMask( rBitmapEx.GetBitmap().CreateMask( rColor, nTol ) ); 759 760 if( rBitmapEx.IsTransparent() ) 761 aMask.CombineSimple( rBitmapEx.GetMask(), BMP_COMBINE_OR ); 762 763 aBmpEx = BitmapEx( rBitmapEx.GetBitmap(), aMask ); 764 LeaveWait(); 765 766 return aBmpEx; 767 } 768 769 //------------------------------------------------------------------------- 770 771 Animation SvxBmpMask::ImpMask( const Animation& rAnimation ) 772 { 773 Animation aAnimation( rAnimation ); 774 Color pSrcCols[4]; 775 Color pDstCols[4]; 776 sal_uIntPtr pTols[4]; 777 InitColorArrays( pSrcCols, pDstCols, pTols ); 778 sal_uInt16 nAnimationCount = aAnimation.Count(); 779 780 for( sal_uInt16 i = 0; i < nAnimationCount; i++ ) 781 { 782 AnimationBitmap aAnimBmp( aAnimation.Get( i ) ); 783 aAnimBmp.aBmpEx = Mask( aAnimBmp.aBmpEx ).GetBitmapEx(); 784 aAnimation.Replace( aAnimBmp, i ); 785 } 786 787 return aAnimation; 788 } 789 790 //------------------------------------------------------------------------- 791 792 GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf ) 793 { 794 GDIMetaFile aMtf; 795 Color pSrcCols[4]; 796 Color pDstCols[4]; 797 sal_uIntPtr pTols[4]; 798 sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols ); 799 sal_Bool pTrans[4]; 800 801 // Falls keine Farben ausgewaehlt, kopieren wir nur das Mtf 802 if( !nCount ) 803 aMtf = rMtf; 804 else 805 { 806 Color aCol; 807 long nVal; 808 long nTol; 809 long nR; 810 long nG; 811 long nB; 812 long* pMinR = new long[nCount]; 813 long* pMaxR = new long[nCount]; 814 long* pMinG = new long[nCount]; 815 long* pMaxG = new long[nCount]; 816 long* pMinB = new long[nCount]; 817 long* pMaxB = new long[nCount]; 818 sal_uInt16 i; 819 sal_Bool bReplace; 820 821 aMtf.SetPrefSize( rMtf.GetPrefSize() ); 822 aMtf.SetPrefMapMode( rMtf.GetPrefMapMode() ); 823 824 // Farbvergleichsarrays vorbereiten 825 for( i = 0; i < nCount; i++ ) 826 { 827 nTol = ( pTols[i] * 255L ) / 100L; 828 829 nVal = ( (long) pSrcCols[i].GetRed() ); 830 pMinR[i] = Max( nVal - nTol, 0L ); 831 pMaxR[i] = Min( nVal + nTol, 255L ); 832 833 nVal = ( (long) pSrcCols[i].GetGreen() ); 834 pMinG[i] = Max( nVal - nTol, 0L ); 835 pMaxG[i] = Min( nVal + nTol, 255L ); 836 837 nVal = ( (long) pSrcCols[i].GetBlue() ); 838 pMinB[i] = Max( nVal - nTol, 0L ); 839 pMaxB[i] = Min( nVal + nTol, 255L ); 840 841 pTrans[ i ] = ( pDstCols[ i ] == TRANSP_COL ); 842 } 843 844 // Actions untersuchen und Farben ggf. ersetzen 845 for( sal_uIntPtr nAct = 0UL, nActCount = rMtf.GetActionCount(); nAct < nActCount; nAct++ ) 846 { 847 MetaAction* pAction = rMtf.GetAction( nAct ); 848 849 bReplace = sal_False; 850 851 switch( pAction->GetType() ) 852 { 853 case( META_PIXEL_ACTION ): 854 { 855 MetaPixelAction* pAct = (MetaPixelAction*) pAction; 856 857 aCol = pAct->GetColor(); 858 TEST_COLS(); 859 860 if( bReplace ) 861 pAct = new MetaPixelAction( pAct->GetPoint(), aCol ); 862 else 863 pAct->Duplicate(); 864 865 aMtf.AddAction( pAct ); 866 } 867 break; 868 869 case( META_LINECOLOR_ACTION ): 870 { 871 MetaLineColorAction* pAct = (MetaLineColorAction*) pAction; 872 873 aCol = pAct->GetColor(); 874 TEST_COLS(); 875 876 if( bReplace ) 877 pAct = new MetaLineColorAction( aCol, !pTrans[ i ] ); 878 else 879 pAct->Duplicate(); 880 881 aMtf.AddAction( pAct ); 882 } 883 break; 884 885 case( META_FILLCOLOR_ACTION ): 886 { 887 MetaFillColorAction* pAct = (MetaFillColorAction*) pAction; 888 889 aCol = pAct->GetColor(); 890 TEST_COLS(); 891 892 if( bReplace ) 893 pAct = new MetaFillColorAction( aCol, !pTrans[ i ] ); 894 else 895 pAct->Duplicate(); 896 897 aMtf.AddAction( pAct ); 898 } 899 break; 900 901 case( META_TEXTCOLOR_ACTION ): 902 { 903 MetaTextColorAction* pAct = (MetaTextColorAction*) pAction; 904 905 aCol = pAct->GetColor(); 906 TEST_COLS(); 907 908 if( bReplace ) 909 pAct = new MetaTextColorAction( aCol ); 910 else 911 pAct->Duplicate(); 912 913 aMtf.AddAction( pAct ); 914 } 915 break; 916 917 case( META_TEXTFILLCOLOR_ACTION ): 918 { 919 MetaTextFillColorAction* pAct = (MetaTextFillColorAction*) pAction; 920 921 aCol = pAct->GetColor(); 922 TEST_COLS(); 923 924 if( bReplace ) 925 pAct = new MetaTextFillColorAction( aCol, !pTrans[ i ] ); 926 else 927 pAct->Duplicate(); 928 929 aMtf.AddAction( pAct ); 930 } 931 break; 932 933 case( META_FONT_ACTION ): 934 { 935 MetaFontAction* pAct = (MetaFontAction*) pAction; 936 Font aFont( pAct->GetFont() ); 937 938 aCol = aFont.GetColor(); 939 TEST_COLS(); 940 941 if( bReplace ) 942 { 943 aFont.SetColor( aCol ); 944 pAct = new MetaFontAction( aFont ); 945 } 946 else 947 pAct->Duplicate(); 948 949 aMtf.AddAction( pAct ); 950 } 951 break; 952 953 case( META_WALLPAPER_ACTION ): 954 { 955 MetaWallpaperAction* pAct = (MetaWallpaperAction*) pAction; 956 Wallpaper aWall( pAct->GetWallpaper() ); 957 958 aCol = aWall.GetColor(); 959 TEST_COLS(); 960 961 if( bReplace ) 962 { 963 aWall.SetColor( aCol ); 964 pAct = new MetaWallpaperAction( pAct->GetRect(), aWall ); 965 } 966 else 967 pAct->Duplicate(); 968 969 aMtf.AddAction( pAct ); 970 } 971 break; 972 973 case( META_BMP_ACTION ): 974 { 975 MetaBmpAction* pAct = (MetaBmpAction*) pAction; 976 const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmap() ); 977 978 pAct = new MetaBmpAction( pAct->GetPoint(), aBmp ); 979 aMtf.AddAction( pAct ); 980 } 981 break; 982 983 case( META_BMPSCALE_ACTION ): 984 { 985 MetaBmpScaleAction* pAct = (MetaBmpScaleAction*) pAction; 986 const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmap() ); 987 988 pAct = new MetaBmpScaleAction( pAct->GetPoint(), pAct->GetSize(), aBmp ); 989 aMtf.AddAction( pAct ); 990 } 991 break; 992 993 case( META_BMPSCALEPART_ACTION ): 994 { 995 MetaBmpScalePartAction* pAct = (MetaBmpScalePartAction*) pAction; 996 const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmap() ); 997 998 pAct = new MetaBmpScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(), 999 pAct->GetSrcPoint(), pAct->GetSrcSize(), aBmp ); 1000 aMtf.AddAction( pAct ); 1001 } 1002 break; 1003 1004 case( META_BMPEX_ACTION ): 1005 { 1006 MetaBmpExAction* pAct = (MetaBmpExAction*) pAction; 1007 const BitmapEx aBmpEx( Mask( pAct->GetBitmapEx() ).GetBitmapEx() ); 1008 1009 pAct = new MetaBmpExAction( pAct->GetPoint(), aBmpEx ); 1010 aMtf.AddAction( pAct ); 1011 } 1012 break; 1013 1014 case( META_BMPEXSCALE_ACTION ): 1015 { 1016 MetaBmpExScaleAction* pAct = (MetaBmpExScaleAction*) pAction; 1017 const BitmapEx aBmpEx( Mask( pAct->GetBitmapEx() ).GetBitmapEx() ); 1018 1019 pAct = new MetaBmpExScaleAction( pAct->GetPoint(), pAct->GetSize(), aBmpEx ); 1020 aMtf.AddAction( pAct ); 1021 } 1022 break; 1023 1024 case( META_BMPEXSCALEPART_ACTION ): 1025 { 1026 MetaBmpExScalePartAction* pAct = (MetaBmpExScalePartAction*) pAction; 1027 const BitmapEx aBmpEx( Mask( pAct->GetBitmapEx() ).GetBitmapEx() ); 1028 1029 pAct = new MetaBmpExScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(), 1030 pAct->GetSrcPoint(), pAct->GetSrcSize(), aBmpEx ); 1031 aMtf.AddAction( pAct ); 1032 } 1033 break; 1034 1035 default: 1036 { 1037 pAction->Duplicate(); 1038 aMtf.AddAction( pAction ); 1039 } 1040 break; 1041 } 1042 } 1043 1044 delete[] pMinR; 1045 delete[] pMaxR; 1046 delete[] pMinG; 1047 delete[] pMaxG; 1048 delete[] pMinB; 1049 delete[] pMaxB; 1050 } 1051 1052 LeaveWait(); 1053 1054 return aMtf; 1055 } 1056 1057 //------------------------------------------------------------------------- 1058 1059 BitmapEx SvxBmpMask::ImpReplaceTransparency( const BitmapEx& rBmpEx, const Color& rColor ) 1060 { 1061 if( rBmpEx.IsTransparent() ) 1062 { 1063 Bitmap aBmp( rBmpEx.GetBitmap() ); 1064 aBmp.Replace( rBmpEx.GetMask(), rColor ); 1065 return aBmp; 1066 } 1067 else 1068 return rBmpEx; 1069 } 1070 1071 //------------------------------------------------------------------------- 1072 1073 Animation SvxBmpMask::ImpReplaceTransparency( const Animation& rAnim, const Color& rColor ) 1074 { 1075 Animation aAnimation( rAnim ); 1076 sal_uInt16 nAnimationCount = aAnimation.Count(); 1077 1078 for( sal_uInt16 i = 0; i < nAnimationCount; i++ ) 1079 { 1080 AnimationBitmap aAnimBmp( aAnimation.Get( i ) ); 1081 aAnimBmp.aBmpEx = ImpReplaceTransparency( aAnimBmp.aBmpEx, rColor ); 1082 aAnimation.Replace( aAnimBmp, i ); 1083 } 1084 1085 return aAnimation; 1086 } 1087 1088 //------------------------------------------------------------------------- 1089 1090 GDIMetaFile SvxBmpMask::ImpReplaceTransparency( const GDIMetaFile& rMtf, const Color& rColor ) 1091 { 1092 VirtualDevice aVDev; 1093 GDIMetaFile aMtf; 1094 const MapMode& rPrefMap = rMtf.GetPrefMapMode(); 1095 const Size& rPrefSize = rMtf.GetPrefSize(); 1096 const sal_uIntPtr nActionCount = rMtf.GetActionCount(); 1097 1098 aVDev.EnableOutput( sal_False ); 1099 aMtf.Record( &aVDev ); 1100 aMtf.SetPrefSize( rPrefSize ); 1101 aMtf.SetPrefMapMode( rPrefMap ); 1102 aVDev.SetLineColor( rColor ); 1103 aVDev.SetFillColor( rColor ); 1104 1105 // Actions nacheinander abspielen; zuerst 1106 // den gesamten Bereich auf die Ersatzfarbe setzen 1107 aVDev.DrawRect( Rectangle( rPrefMap.GetOrigin(), rPrefSize ) ); 1108 for ( sal_uIntPtr i = 0; i < nActionCount; i++ ) 1109 { 1110 MetaAction* pAct = rMtf.GetAction( i ); 1111 1112 pAct->Duplicate(); 1113 aMtf.AddAction( pAct ); 1114 } 1115 1116 aMtf.Stop(); 1117 aMtf.WindStart(); 1118 1119 return aMtf; 1120 } 1121 1122 //------------------------------------------------------------------------- 1123 1124 Graphic SvxBmpMask::Mask( const Graphic& rGraphic ) 1125 { 1126 Graphic aGraphic( rGraphic ); 1127 const Color aReplColor( aLbColorTrans.GetSelectEntryColor() ); 1128 1129 switch( rGraphic.GetType() ) 1130 { 1131 case( GRAPHIC_BITMAP ): 1132 { 1133 if( rGraphic.IsAnimated() ) 1134 { 1135 // Transparenz ersetzen? 1136 if ( aCbxTrans.IsChecked() ) 1137 aGraphic = ImpReplaceTransparency( rGraphic.GetAnimation(), aReplColor ); 1138 else 1139 aGraphic = ImpMask( rGraphic.GetAnimation() ); 1140 } 1141 else 1142 { 1143 // Transparenz ersetzen? 1144 if( aCbxTrans.IsChecked() ) 1145 { 1146 if( aGraphic.IsTransparent() ) 1147 { 1148 BitmapEx aBmpEx( ImpReplaceTransparency( aGraphic.GetBitmapEx(), aReplColor ) ); 1149 const Size aSize( aBmpEx.GetSizePixel() ); 1150 1151 if( aSize.Width() && aSize.Height() ) 1152 aGraphic = aBmpEx; 1153 } 1154 } 1155 else 1156 { 1157 Color pSrcCols[4]; 1158 Color pDstCols[4]; 1159 sal_uIntPtr pTols[4]; 1160 sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols ); 1161 1162 if( nCount ) 1163 { 1164 // erstmal alle Transparent-Farben setzen 1165 for( sal_uInt16 i = 0; i < nCount; i++ ) 1166 { 1167 // Haben wir eine Transparenzfarbe? 1168 if( pDstCols[i] == TRANSP_COL ) 1169 { 1170 BitmapEx aBmpEx( ImpMaskTransparent( aGraphic.GetBitmapEx(), 1171 pSrcCols[ i ], pTols[ i ] ) ); 1172 const Size aSize( aBmpEx.GetSizePixel() ); 1173 1174 if( aSize.Width() && aSize.Height() ) 1175 aGraphic = aBmpEx; 1176 } 1177 } 1178 1179 // jetzt noch einmal mit den normalen Farben ersetzen 1180 Bitmap aBitmap( ImpMask( aGraphic.GetBitmap() ) ); 1181 Size aSize( aBitmap.GetSizePixel() ); 1182 1183 if ( aSize.Width() && aSize.Height() ) 1184 { 1185 if ( aGraphic.IsTransparent() ) 1186 aGraphic = Graphic( BitmapEx( aBitmap, aGraphic.GetBitmapEx().GetMask() ) ); 1187 else 1188 aGraphic = aBitmap; 1189 } 1190 } 1191 } 1192 } 1193 } 1194 break; 1195 1196 case( GRAPHIC_GDIMETAFILE ): 1197 { 1198 GDIMetaFile aMtf( aGraphic.GetGDIMetaFile() ); 1199 1200 // Transparenz ersetzen? 1201 if( aCbxTrans.IsChecked() ) 1202 aMtf = ImpReplaceTransparency( aMtf, aReplColor ); 1203 else 1204 aMtf = ImpMask( aMtf ); 1205 1206 Size aSize( aMtf.GetPrefSize() ); 1207 if ( aSize.Width() && aSize.Height() ) 1208 aGraphic = Graphic( aMtf ); 1209 else 1210 aGraphic = rGraphic; 1211 } 1212 break; 1213 1214 default: 1215 aGraphic = rGraphic; 1216 break; 1217 } 1218 1219 if( aGraphic != rGraphic ) 1220 { 1221 aGraphic.SetPrefSize( rGraphic.GetPrefSize() ); 1222 aGraphic.SetPrefMapMode( rGraphic.GetPrefMapMode() ); 1223 } 1224 1225 return aGraphic; 1226 } 1227 1228 //------------------------------------------------------------------------- 1229 1230 sal_Bool SvxBmpMask::IsEyedropping() const 1231 { 1232 return aTbxPipette.IsItemChecked( TBI_PIPETTE ); 1233 } 1234 1235 void SvxBmpMask::DataChanged( const DataChangedEvent& rDCEvt ) 1236 { 1237 SfxDockingWindow::DataChanged( rDCEvt ); 1238 1239 if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 1240 ApplyStyle(); 1241 } 1242 1243 void SvxBmpMask::ApplyStyle() 1244 { 1245 bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); 1246 1247 aTbxPipette.SetItemImage( TBI_PIPETTE, bHighContrast ? maImgPipetteH : maImgPipette ); 1248 } 1249 1250 1251 /** Set an accessible name for the source color check boxes. Without this 1252 the lengthy description is read. 1253 */ 1254 void SvxBmpMask::SetAccessibleNames (void) 1255 { 1256 String sSourceColor (BMP_RESID( RID_SVXDLG_BMPMASK_STR_SOURCECOLOR)); 1257 String sSourceColorN; 1258 1259 sSourceColorN = sSourceColor; 1260 sSourceColorN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1")); 1261 aCbx1.SetAccessibleName (sSourceColorN); 1262 1263 sSourceColorN = sSourceColor; 1264 sSourceColorN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2")); 1265 aCbx2.SetAccessibleName (sSourceColorN); 1266 1267 sSourceColorN = sSourceColor; 1268 sSourceColorN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3")); 1269 aCbx3.SetAccessibleName (sSourceColorN); 1270 1271 sSourceColorN = sSourceColor; 1272 sSourceColorN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 4")); 1273 aCbx4.SetAccessibleName (sSourceColorN); 1274 } 1275