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_sc.hxx" 26 27 // System - Includes --------------------------------------------------------- 28 29 30 31 // INCLUDE ------------------------------------------------------------------- 32 33 #include <vcl/msgbox.hxx> 34 35 #include "reffact.hxx" 36 #include "document.hxx" 37 #include "scresid.hxx" 38 #include "globstr.hrc" 39 #include "dbnamdlg.hrc" 40 #include "rangenam.hxx" // IsNameValid 41 42 #define _DBNAMDLG_CXX 43 #include "dbnamdlg.hxx" 44 #undef _DBNAMDLG_CXX 45 46 47 //============================================================================ 48 49 #define ABS_SREF SCA_VALID \ 50 | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE 51 #define ABS_DREF ABS_SREF \ 52 | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE | SCA_TAB2_ABSOLUTE 53 #define ABS_SREF3D ABS_SREF | SCA_TAB_3D 54 #define ABS_DREF3D ABS_DREF | SCA_TAB_3D 55 56 //---------------------------------------------------------------------------- 57 58 class DBSaveData; 59 60 static DBSaveData* pSaveObj = NULL; 61 62 #define ERRORBOX(s) ErrorBox(this,WinBits(WB_OK|WB_DEF_OK),s).Execute() 63 #define QUERYBOX(m) QueryBox(this,WinBits(WB_YES_NO|WB_DEF_YES),m).Execute() 64 65 //============================================================================ 66 // class DBSaveData 67 68 class DBSaveData 69 { 70 public: 71 DBSaveData( Edit& rEd, CheckBox& rHdr, CheckBox& rSize, CheckBox& rFmt, 72 CheckBox& rStrip, ScRange& rArea ) 73 : rEdAssign(rEd), 74 rBtnHeader(rHdr), rBtnSize(rSize), rBtnFormat(rFmt), rBtnStrip(rStrip), 75 rCurArea(rArea), 76 bHeader(sal_False), bSize(sal_False), bFormat(sal_False), bDirty(sal_False) {} 77 void Save(); 78 void Restore(); 79 80 private: 81 Edit& rEdAssign; 82 CheckBox& rBtnHeader; 83 CheckBox& rBtnSize; 84 CheckBox& rBtnFormat; 85 CheckBox& rBtnStrip; 86 ScRange& rCurArea; 87 String aStr; 88 ScRange aArea; 89 sal_Bool bHeader:1; 90 sal_Bool bSize:1; 91 sal_Bool bFormat:1; 92 sal_Bool bStrip:1; 93 sal_Bool bDirty:1; 94 }; 95 96 97 98 //---------------------------------------------------------------------------- 99 100 void DBSaveData::Save() 101 { 102 aArea = rCurArea; 103 aStr = rEdAssign.GetText(); 104 bHeader = rBtnHeader.IsChecked(); 105 bSize = rBtnSize.IsChecked(); 106 bFormat = rBtnFormat.IsChecked(); 107 bStrip = rBtnStrip.IsChecked(); 108 bDirty = sal_True; 109 } 110 111 112 //---------------------------------------------------------------------------- 113 114 void DBSaveData::Restore() 115 { 116 if ( bDirty ) 117 { 118 rCurArea = aArea; 119 rEdAssign.SetText( aStr ); 120 rBtnHeader.Check ( bHeader ); 121 rBtnSize.Check ( bSize ); 122 rBtnFormat.Check ( bFormat ); 123 rBtnStrip.Check ( bStrip ); 124 bDirty = sal_False; 125 } 126 } 127 128 129 //============================================================================ 130 // class ScDbNameDlg 131 132 //---------------------------------------------------------------------------- 133 134 ScDbNameDlg::ScDbNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, 135 ScViewData* ptrViewData ) 136 137 : ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_DBNAMES ), 138 // 139 aFlName ( this, ScResId( FL_NAME ) ), 140 aEdName ( this, ScResId( ED_NAME ) ), 141 142 aFlAssign ( this, ScResId( FL_ASSIGN ) ), 143 aEdAssign ( this, this, ScResId( ED_DBAREA ) ), 144 aRbAssign ( this, ScResId( RB_DBAREA ), &aEdAssign, this ), 145 146 aFlOptions ( this, ScResId( FL_OPTIONS ) ), 147 aBtnHeader ( this, ScResId( BTN_HEADER ) ), 148 aBtnDoSize ( this, ScResId( BTN_SIZE ) ), 149 aBtnKeepFmt ( this, ScResId( BTN_FORMAT ) ), 150 aBtnStripData ( this, ScResId( BTN_STRIPDATA ) ), 151 aFTSource ( this, ScResId( FT_SOURCE ) ), 152 aFTOperations ( this, ScResId( FT_OPERATIONS ) ), 153 154 aBtnOk ( this, ScResId( BTN_OK ) ), 155 aBtnCancel ( this, ScResId( BTN_CANCEL ) ), 156 aBtnHelp ( this, ScResId( BTN_HELP ) ), 157 aBtnAdd ( this, ScResId( BTN_ADD ) ), 158 aBtnRemove ( this, ScResId( BTN_REMOVE ) ), 159 aBtnMore ( this, ScResId( BTN_MORE ) ), 160 161 aStrAdd ( ScResId( STR_ADD ) ), 162 aStrModify ( ScResId( STR_MODIFY ) ), 163 aStrNoName ( ScGlobal::GetRscString(STR_DB_NONAME) ), 164 aStrInvalid ( ScResId( STR_DB_INVALID ) ), 165 // 166 pViewData ( ptrViewData ), 167 pDoc ( ptrViewData->GetDocument() ), 168 bRefInputMode ( sal_False ), 169 aAddrDetails ( pDoc->GetAddressConvention(), 0, 0 ), 170 aLocalDbCol ( *(pDoc->GetDBCollection()) ) 171 { 172 // WB_NOLABEL can't be set in resource... 173 aFTSource.SetStyle( aFTSource.GetStyle() | WB_NOLABEL ); 174 aFTOperations.SetStyle( aFTOperations.GetStyle() | WB_NOLABEL ); 175 176 // damit die Strings in der Resource bei den FixedTexten bleiben koennen: 177 aStrSource = aFTSource.GetText(); 178 aStrOperations = aFTOperations.GetText(); 179 180 pSaveObj = new DBSaveData( aEdAssign, aBtnHeader, 181 aBtnDoSize, aBtnKeepFmt, aBtnStripData, theCurArea ); 182 Init(); 183 FreeResource(); 184 //IAccessibility2 Implementation 2009----- 185 SynFocusTimer.SetTimeout(150); 186 SynFocusTimer.SetTimeoutHdl(LINK( this, ScDbNameDlg, FocusToComoboxHdl)); 187 SynFocusTimer.Start(); 188 //-----IAccessibility2 Implementation 2009 189 aRbAssign.SetAccessibleRelationMemberOf(&aFlAssign); 190 } 191 192 193 //---------------------------------------------------------------------------- 194 195 __EXPORT ScDbNameDlg::~ScDbNameDlg() 196 { 197 DELETEZ( pSaveObj ); 198 199 ScRange* pEntry = (ScRange*)aRemoveList.First(); 200 while ( pEntry ) 201 { 202 aRemoveList.Remove( pEntry ); 203 delete pEntry; 204 pEntry = (ScRange*)aRemoveList.Next(); 205 } 206 } 207 208 209 //---------------------------------------------------------------------------- 210 211 void ScDbNameDlg::Init() 212 { 213 aBtnHeader.Check( sal_True ); // Default: mit Spaltenkoepfen 214 215 aBtnMore.AddWindow( &aFlOptions ); 216 aBtnMore.AddWindow( &aBtnHeader ); 217 aBtnMore.AddWindow( &aBtnDoSize ); 218 aBtnMore.AddWindow( &aBtnKeepFmt ); 219 aBtnMore.AddWindow( &aBtnStripData ); 220 aBtnMore.AddWindow( &aFTSource ); 221 aBtnMore.AddWindow( &aFTOperations ); 222 223 String theAreaStr; 224 SCCOL nStartCol = 0; 225 SCROW nStartRow = 0; 226 SCTAB nStartTab = 0; 227 SCCOL nEndCol = 0; 228 SCROW nEndRow = 0; 229 SCTAB nEndTab = 0; 230 231 aBtnOk.SetClickHdl ( LINK( this, ScDbNameDlg, OkBtnHdl ) ); 232 aBtnCancel.SetClickHdl ( LINK( this, ScDbNameDlg, CancelBtnHdl ) ); 233 aBtnAdd.SetClickHdl ( LINK( this, ScDbNameDlg, AddBtnHdl ) ); 234 aBtnRemove.SetClickHdl ( LINK( this, ScDbNameDlg, RemoveBtnHdl ) ); 235 aEdName.SetModifyHdl ( LINK( this, ScDbNameDlg, NameModifyHdl ) ); 236 aEdAssign.SetModifyHdl ( LINK( this, ScDbNameDlg, AssModifyHdl ) ); 237 UpdateNames(); 238 239 if ( pViewData && pDoc ) 240 { 241 ScDBCollection* pDBColl = pDoc->GetDBCollection(); 242 ScDBData* pDBData = NULL; 243 244 pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab, 245 nEndCol, nEndRow, nEndTab ); 246 247 theCurArea = ScRange( ScAddress( nStartCol, nStartRow, nStartTab ), 248 ScAddress( nEndCol, nEndRow, nEndTab ) ); 249 250 theCurArea.Format( theAreaStr, ABS_DREF3D, pDoc, aAddrDetails ); 251 252 if ( pDBColl ) 253 { 254 // Feststellen, ob definierter DB-Bereich markiert wurde: 255 pDBData = pDBColl->GetDBAtCursor( nStartCol, nStartRow, nStartTab, sal_True ); 256 if ( pDBData ) 257 { 258 String theDbName; 259 ScAddress& rStart = theCurArea.aStart; 260 ScAddress& rEnd = theCurArea.aEnd; 261 SCCOL nCol1; 262 SCCOL nCol2; 263 SCROW nRow1; 264 SCROW nRow2; 265 SCTAB nTab; 266 267 pDBData->GetArea( nTab, nCol1, nRow1, nCol2, nRow2 ); 268 269 if ( (rStart.Tab() == nTab) 270 && (rStart.Col() == nCol1) && (rStart.Row() == nRow1) 271 && (rEnd.Col() == nCol2) && (rEnd.Row() == nRow2 ) ) 272 { 273 pDBData->GetName( theDbName ); 274 //if ( theDbName != aStrNoName ) 275 if ( !pDBData->IsBuildin() ) 276 aEdName.SetText( theDbName ); 277 else 278 aEdName.SetText( EMPTY_STRING ); 279 aBtnHeader.Check( pDBData->HasHeader() ); 280 aBtnDoSize.Check( pDBData->IsDoSize() ); 281 aBtnKeepFmt.Check( pDBData->IsKeepFmt() ); 282 aBtnStripData.Check( pDBData->IsStripData() ); 283 SetInfoStrings( pDBData ); 284 } 285 } 286 } 287 } 288 289 aEdAssign.SetText( theAreaStr ); 290 aEdName.GrabFocus(); 291 bSaved=sal_True; 292 pSaveObj->Save(); 293 NameModifyHdl( 0 ); 294 } 295 296 297 void ScDbNameDlg::SetInfoStrings( const ScDBData* pDBData ) 298 { 299 String aSource = aStrSource; 300 if (pDBData) 301 { 302 aSource += ' '; 303 aSource += pDBData->GetSourceString(); 304 } 305 aFTSource.SetText( aSource ); 306 307 String aOper = aStrOperations; 308 if (pDBData) 309 { 310 aOper += ' '; 311 aOper += pDBData->GetOperations(); 312 } 313 aFTOperations.SetText( aOper ); 314 } 315 316 //---------------------------------------------------------------------------- 317 // Uebergabe eines mit der Maus selektierten Tabellenbereiches, der dann als 318 // neue Selektion im Referenz-Fenster angezeigt wird. 319 320 void ScDbNameDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) 321 { 322 if ( aEdAssign.IsEnabled() ) 323 { 324 if ( rRef.aStart != rRef.aEnd ) 325 RefInputStart( &aEdAssign ); 326 327 theCurArea = rRef; 328 329 String aRefStr; 330 theCurArea.Format( aRefStr, ABS_DREF3D, pDocP, aAddrDetails ); 331 aEdAssign.SetRefString( aRefStr ); 332 aBtnHeader.Enable(); 333 aBtnDoSize.Enable(); 334 aBtnKeepFmt.Enable(); 335 aBtnStripData.Enable(); 336 aFTSource.Enable(); 337 aFTOperations.Enable(); 338 aBtnAdd.Enable(); 339 bSaved=sal_True; 340 pSaveObj->Save(); 341 } 342 } 343 344 345 //---------------------------------------------------------------------------- 346 347 sal_Bool __EXPORT ScDbNameDlg::Close() 348 { 349 return DoClose( ScDbNameDlgWrapper::GetChildWindowId() ); 350 } 351 352 //------------------------------------------------------------------------ 353 354 void ScDbNameDlg::SetActive() 355 { 356 aEdAssign.GrabFocus(); 357 358 // kein NameModifyHdl, weil sonst Bereiche nicht geaendert werden koennen 359 // (nach dem Aufziehen der Referenz wuerde der alte Inhalt wieder angezeigt) 360 // (der ausgewaehlte DB-Name hat sich auch nicht veraendert) 361 362 RefInputDone(); 363 } 364 365 //------------------------------------------------------------------------ 366 367 void ScDbNameDlg::UpdateNames() 368 { 369 sal_uInt16 nNameCount = aLocalDbCol.GetCount(); 370 371 aEdName.SetUpdateMode( sal_False ); 372 //----------------------------------------------------------- 373 aEdName.Clear(); 374 aEdAssign.SetText( EMPTY_STRING ); 375 376 if ( nNameCount > 0 ) 377 { 378 ScDBData* pDbData = NULL; 379 String aString; 380 381 for ( sal_uInt16 i=0; i<nNameCount; i++ ) 382 { 383 pDbData = (ScDBData*)(aLocalDbCol.At( i )); 384 if ( pDbData ) 385 { 386 pDbData->GetName( aString ); 387 //if ( aString != aStrNoName ) 388 if ( !pDbData->IsBuildin() ) 389 aEdName.InsertEntry( aString ); 390 } 391 } 392 } 393 else 394 { 395 aBtnAdd.SetText( aStrAdd ); 396 aBtnAdd.Disable(); 397 aBtnRemove.Disable(); 398 } 399 //----------------------------------------------------------- 400 aEdName.SetUpdateMode( sal_True ); 401 aEdName.Invalidate(); 402 } 403 404 //------------------------------------------------------------------------ 405 406 void ScDbNameDlg::UpdateDBData( const String& rStrName ) 407 { 408 String theArea; 409 sal_uInt16 nAt; 410 ScDBData* pData; 411 412 aLocalDbCol.SearchName( rStrName, nAt ); 413 pData = (ScDBData*)(aLocalDbCol.At( nAt )); 414 415 if ( pData ) 416 { 417 SCCOL nColStart = 0; 418 SCROW nRowStart = 0; 419 SCCOL nColEnd = 0; 420 SCROW nRowEnd = 0; 421 SCTAB nTab = 0; 422 423 pData->GetArea( nTab, nColStart, nRowStart, nColEnd, nRowEnd ); 424 theCurArea = ScRange( ScAddress( nColStart, nRowStart, nTab ), 425 ScAddress( nColEnd, nRowEnd, nTab ) ); 426 theCurArea.Format( theArea, ABS_DREF3D, pDoc, aAddrDetails ); 427 aEdAssign.SetText( theArea ); 428 aBtnAdd.SetText( aStrModify ); 429 aBtnHeader.Check( pData->HasHeader() ); 430 aBtnDoSize.Check( pData->IsDoSize() ); 431 aBtnKeepFmt.Check( pData->IsKeepFmt() ); 432 aBtnStripData.Check( pData->IsStripData() ); 433 SetInfoStrings( pData ); 434 } 435 436 aBtnAdd.SetText( aStrModify ); 437 aBtnAdd.Enable(); 438 aBtnRemove.Enable(); 439 aBtnHeader.Enable(); 440 aBtnDoSize.Enable(); 441 aBtnKeepFmt.Enable(); 442 aBtnStripData.Enable(); 443 aFTSource.Enable(); 444 aFTOperations.Enable(); 445 } 446 447 //------------------------------------------------------------------------ 448 449 450 sal_Bool ScDbNameDlg::IsRefInputMode() const 451 { 452 return bRefInputMode; 453 } 454 455 //------------------------------------------------------------------------ 456 // Handler: 457 // ======== 458 459 IMPL_LINK( ScDbNameDlg, OkBtnHdl, void *, EMPTYARG ) 460 { 461 AddBtnHdl( 0 ); 462 463 // Der View die Aenderungen und die Remove-Liste uebergeben: 464 // beide werden nur als Referenz uebergeben, so dass an dieser 465 // Stelle keine Speicherleichen entstehen koennen: 466 if ( pViewData ) 467 pViewData->GetView()-> 468 NotifyCloseDbNameDlg( aLocalDbCol, aRemoveList ); 469 470 Close(); 471 return 0; 472 } 473 474 //------------------------------------------------------------------------ 475 476 IMPL_LINK_INLINE_START( ScDbNameDlg, CancelBtnHdl, void *, EMPTYARG ) 477 { 478 Close(); 479 return 0; 480 } 481 IMPL_LINK_INLINE_END( ScDbNameDlg, CancelBtnHdl, void *, EMPTYARG ) 482 483 //------------------------------------------------------------------------ 484 485 IMPL_LINK( ScDbNameDlg, AddBtnHdl, void *, EMPTYARG ) 486 { 487 String aNewName = aEdName.GetText(); 488 String aNewArea = aEdAssign.GetText(); 489 490 aNewName.EraseLeadingChars( ' ' ); 491 aNewName.EraseTrailingChars( ' ' ); 492 493 if ( aNewName.Len() > 0 && aNewArea.Len() > 0 ) 494 { 495 if ( ScRangeData::IsNameValid( aNewName, pDoc ) ) 496 { 497 // weil jetzt editiert werden kann, muss erst geparst werden 498 ScRange aTmpRange; 499 String aText = aEdAssign.GetText(); 500 if ( aTmpRange.ParseAny( aText, pDoc, aAddrDetails ) & SCA_VALID ) 501 { 502 theCurArea = aTmpRange; 503 ScAddress aStart = theCurArea.aStart; 504 ScAddress aEnd = theCurArea.aEnd; 505 506 ScDBData* pOldEntry = NULL; 507 sal_uInt16 nFoundAt = 0; 508 if ( aLocalDbCol.SearchName( aNewName, nFoundAt ) ) 509 pOldEntry = aLocalDbCol[nFoundAt]; 510 if (pOldEntry) 511 { 512 // Bereich veraendern 513 514 pOldEntry->MoveTo( aStart.Tab(), aStart.Col(), aStart.Row(), 515 aEnd.Col(), aEnd.Row() ); 516 pOldEntry->SetByRow( sal_True ); 517 pOldEntry->SetHeader( aBtnHeader.IsChecked() ); 518 pOldEntry->SetDoSize( aBtnDoSize.IsChecked() ); 519 pOldEntry->SetKeepFmt( aBtnKeepFmt.IsChecked() ); 520 pOldEntry->SetStripData( aBtnStripData.IsChecked() ); 521 } 522 else 523 { 524 // neuen Bereich einfuegen 525 526 ScDBData* pNewEntry = new ScDBData( aNewName, aStart.Tab(), 527 aStart.Col(), aStart.Row(), 528 aEnd.Col(), aEnd.Row(), 529 sal_True, aBtnHeader.IsChecked() ); 530 pNewEntry->SetDoSize( aBtnDoSize.IsChecked() ); 531 pNewEntry->SetKeepFmt( aBtnKeepFmt.IsChecked() ); 532 pNewEntry->SetStripData( aBtnStripData.IsChecked() ); 533 534 if ( !aLocalDbCol.Insert( pNewEntry ) ) 535 delete pNewEntry; 536 } 537 538 UpdateNames(); 539 540 aEdName.SetText( EMPTY_STRING ); 541 aEdName.GrabFocus(); 542 aBtnAdd.SetText( aStrAdd ); 543 aBtnAdd.Disable(); 544 aBtnRemove.Disable(); 545 aEdAssign.SetText( EMPTY_STRING ); 546 aBtnHeader.Check( sal_True ); // Default: mit Spaltenkoepfen 547 aBtnDoSize.Check( sal_False ); 548 aBtnKeepFmt.Check( sal_False ); 549 aBtnStripData.Check( sal_False ); 550 SetInfoStrings( NULL ); // leer 551 theCurArea = ScRange(); 552 bSaved=sal_True; 553 pSaveObj->Save(); 554 NameModifyHdl( 0 ); 555 } 556 else 557 { 558 ERRORBOX( aStrInvalid ); 559 aEdAssign.SetSelection( Selection( 0, SELECTION_MAX ) ); 560 aEdAssign.GrabFocus(); 561 } 562 } 563 else 564 { 565 ERRORBOX( ScGlobal::GetRscString(STR_INVALIDNAME) ); 566 aEdName.SetSelection( Selection( 0, SELECTION_MAX ) ); 567 aEdName.GrabFocus(); 568 } 569 } 570 return 0; 571 } 572 573 //------------------------------------------------------------------------ 574 575 IMPL_LINK( ScDbNameDlg, RemoveBtnHdl, void *, EMPTYARG ) 576 { 577 sal_uInt16 nRemoveAt = 0; 578 const String aStrEntry = aEdName.GetText(); 579 580 if ( aLocalDbCol.SearchName( aStrEntry, nRemoveAt ) ) 581 { 582 String aStrDelMsg = ScGlobal::GetRscString( STR_QUERY_DELENTRY ); 583 String aMsg = aStrDelMsg.GetToken( 0, '#' ); 584 585 aMsg += aStrEntry; 586 aMsg += aStrDelMsg.GetToken( 1, '#' ); 587 588 if ( RET_YES == QUERYBOX(aMsg) ) 589 { 590 ScDBData* pEntry = (ScDBData*)aLocalDbCol.At(nRemoveAt); 591 592 if ( pEntry ) 593 { 594 SCTAB nTab; 595 SCCOL nColStart, nColEnd; 596 SCROW nRowStart, nRowEnd; 597 pEntry->GetArea( nTab, nColStart, nRowStart, nColEnd, nRowEnd ); 598 aRemoveList.Insert( 599 new ScRange( ScAddress( nColStart, nRowStart, nTab ), 600 ScAddress( nColEnd, nRowEnd, nTab ) ) ); 601 } 602 aLocalDbCol.AtFree( nRemoveAt ); 603 604 UpdateNames(); 605 606 aEdName.SetText( EMPTY_STRING ); 607 aEdName.GrabFocus(); 608 aBtnAdd.SetText( aStrAdd ); 609 aBtnAdd.Disable(); 610 aBtnRemove.Disable(); 611 aEdAssign.SetText( EMPTY_STRING ); 612 theCurArea = ScRange(); 613 aBtnHeader.Check( sal_True ); // Default: mit Spaltenkoepfen 614 aBtnDoSize.Check( sal_False ); 615 aBtnKeepFmt.Check( sal_False ); 616 aBtnStripData.Check( sal_False ); 617 SetInfoStrings( NULL ); // leer 618 bSaved=sal_False; 619 pSaveObj->Restore(); 620 NameModifyHdl( 0 ); 621 } 622 } 623 return 0; 624 } 625 626 //------------------------------------------------------------------------ 627 628 IMPL_LINK( ScDbNameDlg, NameModifyHdl, void *, EMPTYARG ) 629 { 630 String theName = aEdName.GetText(); 631 sal_Bool bNameFound = (COMBOBOX_ENTRY_NOTFOUND 632 != aEdName.GetEntryPos( theName )); 633 634 if ( theName.Len() == 0 ) 635 { 636 if ( aBtnAdd.GetText() != aStrAdd ) 637 aBtnAdd.SetText( aStrAdd ); 638 aBtnAdd .Disable(); 639 aBtnRemove .Disable(); 640 aFlAssign .Disable(); 641 aBtnHeader .Disable(); 642 aBtnDoSize .Disable(); 643 aBtnKeepFmt .Disable(); 644 aBtnStripData.Disable(); 645 aFTSource .Disable(); 646 aFTOperations.Disable(); 647 aEdAssign .Disable(); 648 aRbAssign .Disable(); 649 //bSaved=sal_False; 650 //pSaveObj->Restore(); 651 //@BugID 54702 Enablen/Disablen nur noch in Basisklasse 652 //SFX_APPWINDOW->Disable(sal_False); //! allgemeine Methode im ScAnyRefDlg 653 bRefInputMode = sal_False; 654 } 655 else 656 { 657 if ( bNameFound ) 658 { 659 if ( aBtnAdd.GetText() != aStrModify ) 660 aBtnAdd.SetText( aStrModify ); 661 662 if(!bSaved) 663 { 664 bSaved=sal_True; 665 pSaveObj->Save(); 666 } 667 UpdateDBData( theName ); 668 } 669 else 670 { 671 if ( aBtnAdd.GetText() != aStrAdd ) 672 aBtnAdd.SetText( aStrAdd ); 673 674 bSaved=sal_False; 675 pSaveObj->Restore(); 676 677 if ( aEdAssign.GetText().Len() > 0 ) 678 { 679 aBtnAdd.Enable(); 680 aBtnHeader.Enable(); 681 aBtnDoSize.Enable(); 682 aBtnKeepFmt.Enable(); 683 aBtnStripData.Enable(); 684 aFTSource.Enable(); 685 aFTOperations.Enable(); 686 } 687 else 688 { 689 aBtnAdd.Disable(); 690 aBtnHeader.Disable(); 691 aBtnDoSize.Disable(); 692 aBtnKeepFmt.Disable(); 693 aBtnStripData.Disable(); 694 aFTSource.Disable(); 695 aFTOperations.Disable(); 696 } 697 aBtnRemove.Disable(); 698 } 699 700 aFlAssign.Enable(); 701 aEdAssign.Enable(); 702 aRbAssign.Enable(); 703 704 //@BugID 54702 Enablen/Disablen nur noch in Basisklasse 705 //SFX_APPWINDOW->Enable(); 706 bRefInputMode = sal_True; 707 } 708 return 0; 709 } 710 711 //------------------------------------------------------------------------ 712 713 IMPL_LINK( ScDbNameDlg, AssModifyHdl, void *, EMPTYARG ) 714 { 715 // hier parsen fuer Save() etc. 716 717 ScRange aTmpRange; 718 String aText = aEdAssign.GetText(); 719 if ( aTmpRange.ParseAny( aText, pDoc, aAddrDetails ) & SCA_VALID ) 720 theCurArea = aTmpRange; 721 //IAccessibility2 Implementation 2009----- 722 if( aText.Len() > 0 && aEdName.GetText().Len() > 0 ) 723 { 724 aBtnAdd.Enable(); 725 aBtnHeader.Enable(); 726 aBtnDoSize.Enable(); 727 aBtnKeepFmt.Enable(); 728 aBtnStripData.Enable(); 729 aFTSource.Enable(); 730 aFTOperations.Enable(); 731 } 732 else 733 { 734 aBtnAdd.Disable(); 735 aBtnHeader.Disable(); 736 aBtnDoSize.Disable(); 737 aBtnKeepFmt.Disable(); 738 aBtnStripData.Disable(); 739 aFTSource.Disable(); 740 aFTOperations.Disable(); 741 } 742 //-----IAccessibility2 Implementation 2009 743 return 0; 744 } 745 746 //IAccessibility2 Implementation 2009----- 747 IMPL_LINK( ScDbNameDlg, FocusToComoboxHdl, Timer*, pTi) 748 { 749 (void)pTi; 750 // CallEventListeners is still protected - figure out if we need to make it public, or if the focus stuff can be handled better in VCL directly. First see what AT is expecting... 751 // aEdName.CallEventListeners( VCLEVENT_CONTROL_GETFOCUS ); 752 return 0; 753 } 754 //-----IAccessibility2 Implementation 2009 755