namedlg.cxx (b3f79822) namedlg.cxx (dffa72de)
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

--- 40 unchanged lines hidden (view full) ---

49
50#define ABS_SREF SCA_VALID \
51 | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE
52#define ABS_DREF ABS_SREF \
53 | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE | SCA_TAB2_ABSOLUTE
54#define ABS_SREF3D ABS_SREF | SCA_TAB_3D
55#define ABS_DREF3D ABS_DREF | SCA_TAB_3D
56
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

--- 40 unchanged lines hidden (view full) ---

49
50#define ABS_SREF SCA_VALID \
51 | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE
52#define ABS_DREF ABS_SREF \
53 | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE | SCA_TAB2_ABSOLUTE
54#define ABS_SREF3D ABS_SREF | SCA_TAB_3D
55#define ABS_DREF3D ABS_DREF | SCA_TAB_3D
56
57const sal_uInt16 SHEETNAMEPOS = 33;
57
58//============================================================================
59// Hilfsklasse: Merken der aktuellen Bereichsoptionen,
60// wenn ein Name in der ComboBox gefunden wird.
61
62struct SaveData
63{
64 SaveData()

--- 49 unchanged lines hidden (view full) ---

114ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
115 ScViewData* ptrViewData,
116 const ScAddress& aCursorPos )
117
118 : ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_NAMES ),
119 //
120 aFlName ( this, ScResId( FL_NAME ) ),
121 aEdName ( this, ScResId( ED_NAME ) ),
58
59//============================================================================
60// Hilfsklasse: Merken der aktuellen Bereichsoptionen,
61// wenn ein Name in der ComboBox gefunden wird.
62
63struct SaveData
64{
65 SaveData()

--- 49 unchanged lines hidden (view full) ---

115ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
116 ScViewData* ptrViewData,
117 const ScAddress& aCursorPos )
118
119 : ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_NAMES ),
120 //
121 aFlName ( this, ScResId( FL_NAME ) ),
122 aEdName ( this, ScResId( ED_NAME ) ),
123 aLBNames ( this, ScResId( LB_NAMES ) ),
122 //
123 aFlAssign ( this, ScResId( FL_ASSIGN ) ),
124 aEdAssign ( this, this, ScResId( ED_ASSIGN ) ),
125 aRbAssign ( this, ScResId( RB_ASSIGN ), &aEdAssign, this ),
126 //
127 aFlType ( this, ScResId( FL_TYPE ) ),
128 aBtnPrintArea ( this, ScResId( BTN_PRINTAREA ) ),
129 aBtnColHeader ( this, ScResId( BTN_COLHEADER ) ),

--- 10 unchanged lines hidden (view full) ---

140 bSaved (sal_False),
141 aStrAdd ( ScResId( STR_ADD ) ),
142 aStrModify ( ScResId( STR_MODIFY ) ),
143 errMsgInvalidSym( ScResId( STR_INVALIDSYMBOL ) ),
144 //
145 pViewData ( ptrViewData ),
146 pDoc ( ptrViewData->GetDocument() ),
147 aLocalRangeName ( *(pDoc->GetRangeName()) ),
124 //
125 aFlAssign ( this, ScResId( FL_ASSIGN ) ),
126 aEdAssign ( this, this, ScResId( ED_ASSIGN ) ),
127 aRbAssign ( this, ScResId( RB_ASSIGN ), &aEdAssign, this ),
128 //
129 aFlType ( this, ScResId( FL_TYPE ) ),
130 aBtnPrintArea ( this, ScResId( BTN_PRINTAREA ) ),
131 aBtnColHeader ( this, ScResId( BTN_COLHEADER ) ),

--- 10 unchanged lines hidden (view full) ---

142 bSaved (sal_False),
143 aStrAdd ( ScResId( STR_ADD ) ),
144 aStrModify ( ScResId( STR_MODIFY ) ),
145 errMsgInvalidSym( ScResId( STR_INVALIDSYMBOL ) ),
146 //
147 pViewData ( ptrViewData ),
148 pDoc ( ptrViewData->GetDocument() ),
149 aLocalRangeName ( *(pDoc->GetRangeName()) ),
148 theCursorPos ( aCursorPos ) // zum Berechnen der Referenzen
150 theCursorPos ( aCursorPos ), // zum Berechnen der Referenzen
151 aSelectedRangeScope(MAXTABCOUNT)
149{
150 pSaveObj = new SaveData;
151 Init();
152 FreeResource();
153
154 aRbAssign.SetAccessibleRelationMemberOf(&aFlAssign);
155}
156

--- 17 unchanged lines hidden (view full) ---

174
175 aBtnOk.SetClickHdl ( LINK( this, ScNameDlg, OkBtnHdl ) );
176 aBtnCancel.SetClickHdl ( LINK( this, ScNameDlg, CancelBtnHdl ) );
177 aBtnAdd.SetClickHdl ( LINK( this, ScNameDlg, AddBtnHdl ) );
178 aBtnRemove.SetClickHdl ( LINK( this, ScNameDlg, RemoveBtnHdl ) );
179 aEdAssign.SetGetFocusHdl( LINK( this, ScNameDlg, AssignGetFocusHdl ) );
180 aEdAssign.SetModifyHdl ( LINK( this, ScNameDlg, EdModifyHdl ) );
181 aEdName.SetModifyHdl ( LINK( this, ScNameDlg, EdModifyHdl ) );
152{
153 pSaveObj = new SaveData;
154 Init();
155 FreeResource();
156
157 aRbAssign.SetAccessibleRelationMemberOf(&aFlAssign);
158}
159

--- 17 unchanged lines hidden (view full) ---

177
178 aBtnOk.SetClickHdl ( LINK( this, ScNameDlg, OkBtnHdl ) );
179 aBtnCancel.SetClickHdl ( LINK( this, ScNameDlg, CancelBtnHdl ) );
180 aBtnAdd.SetClickHdl ( LINK( this, ScNameDlg, AddBtnHdl ) );
181 aBtnRemove.SetClickHdl ( LINK( this, ScNameDlg, RemoveBtnHdl ) );
182 aEdAssign.SetGetFocusHdl( LINK( this, ScNameDlg, AssignGetFocusHdl ) );
183 aEdAssign.SetModifyHdl ( LINK( this, ScNameDlg, EdModifyHdl ) );
184 aEdName.SetModifyHdl ( LINK( this, ScNameDlg, EdModifyHdl ) );
182 aEdName.SetSelectHdl ( LINK( this, ScNameDlg, NameSelectHdl ) );
185 aLBNames.SetSelectHdl ( LINK( this, ScNameDlg, NameSelectHdl ) );
183
184 aBtnCriteria .Hide();
185 aBtnPrintArea.Hide();
186 aBtnColHeader.Hide();
187 aBtnRowHeader.Hide();
188
189 aBtnMore.AddWindow( &aFlType );
190 aBtnMore.AddWindow( &aBtnCriteria );

--- 10 unchanged lines hidden (view full) ---

201 theCurSel = Selection( 0, SELECTION_MAX );
202 aEdAssign.GrabFocus();
203 aEdAssign.SetText( aAreaStr );
204 aEdAssign.SetSelection( theCurSel );
205 aEdName.GrabFocus();
206
207 aBtnAdd.Disable();
208 aBtnRemove.Disable();
186
187 aBtnCriteria .Hide();
188 aBtnPrintArea.Hide();
189 aBtnColHeader.Hide();
190 aBtnRowHeader.Hide();
191
192 aBtnMore.AddWindow( &aFlType );
193 aBtnMore.AddWindow( &aBtnCriteria );

--- 10 unchanged lines hidden (view full) ---

204 theCurSel = Selection( 0, SELECTION_MAX );
205 aEdAssign.GrabFocus();
206 aEdAssign.SetText( aAreaStr );
207 aEdAssign.SetSelection( theCurSel );
208 aEdName.GrabFocus();
209
210 aBtnAdd.Disable();
211 aBtnRemove.Disable();
209 if ( aEdName.GetEntryCount() > 0 )
212 //if ( aEdName.GetEntryCount() > 0 )
213 if ( aLBNames.GetEntryCount() > 0 )
210 aBtnAdd.SetText( aStrAdd );
211 UpdateChecks();
212 EdModifyHdl( 0 );
213
214 bSaved=sal_True;
215 SAVE_DATA()
216
217 //@BugID 54702

--- 47 unchanged lines hidden (view full) ---

265
266
267//----------------------------------------------------------------------------
268
269void __EXPORT ScNameDlg::UpdateChecks()
270{
271 sal_uInt16 nCurPos=0;
272
214 aBtnAdd.SetText( aStrAdd );
215 UpdateChecks();
216 EdModifyHdl( 0 );
217
218 bSaved=sal_True;
219 SAVE_DATA()
220
221 //@BugID 54702

--- 47 unchanged lines hidden (view full) ---

269
270
271//----------------------------------------------------------------------------
272
273void __EXPORT ScNameDlg::UpdateChecks()
274{
275 sal_uInt16 nCurPos=0;
276
273 if(aLocalRangeName.SearchName( aEdName.GetText(), nCurPos))
277 if(aLocalRangeName.SearchName( aEdName.GetText(), nCurPos, aSelectedRangeScope))
274 {
275 ScRangeData* pData=(ScRangeData*)(aLocalRangeName.At( nCurPos ));
276 aBtnCriteria .Check( pData->HasType( RT_CRITERIA ) );
277 aBtnPrintArea.Check( pData->HasType( RT_PRINTAREA ) );
278 aBtnColHeader.Check( pData->HasType( RT_COLHEADER ) );
279 aBtnRowHeader.Check( pData->HasType( RT_ROWHEADER ) );
280 }
281
282 // Falls Edit-Feld leer ist: Typ-CheckBoxen deaktivieren:
283
284 if ( aEdName.GetText().Len() != 0 )
285 {
286 if ( !aFlType.IsEnabled() )
287 {
278 {
279 ScRangeData* pData=(ScRangeData*)(aLocalRangeName.At( nCurPos ));
280 aBtnCriteria .Check( pData->HasType( RT_CRITERIA ) );
281 aBtnPrintArea.Check( pData->HasType( RT_PRINTAREA ) );
282 aBtnColHeader.Check( pData->HasType( RT_COLHEADER ) );
283 aBtnRowHeader.Check( pData->HasType( RT_ROWHEADER ) );
284 }
285
286 // Falls Edit-Feld leer ist: Typ-CheckBoxen deaktivieren:
287
288 if ( aEdName.GetText().Len() != 0 )
289 {
290 if ( !aFlType.IsEnabled() )
291 {
288 aFlType .Enable();
292 aFlType.Enable();
289 aBtnCriteria .Enable();
290 aBtnPrintArea.Enable();
291 aBtnColHeader.Enable();
292 aBtnRowHeader.Enable();
293 aBtnCriteria .Enable();
294 aBtnPrintArea.Enable();
295 aBtnColHeader.Enable();
296 aBtnRowHeader.Enable();
293 aFlAssign .Enable();
294 aEdAssign .Enable();
295 aRbAssign .Enable();
297 aFlAssign.Enable();
298 aEdAssign.Enable();
299 aRbAssign.Enable();
296 }
297 }
298 else if ( aFlType.IsEnabled() )
299 {
300 }
301 }
302 else if ( aFlType.IsEnabled() )
303 {
300 aFlType .Disable();
301 aBtnCriteria .Disable();
304 aFlType.Disable();
305 aBtnCriteria.Disable();
302 aBtnPrintArea.Disable();
303 aBtnColHeader.Disable();
304 aBtnRowHeader.Disable();
306 aBtnPrintArea.Disable();
307 aBtnColHeader.Disable();
308 aBtnRowHeader.Disable();
305 aFlAssign .Disable();
306 aEdAssign .Disable();
307 aRbAssign .Disable();
309 aFlAssign.Disable();
310 aEdAssign.Disable();
311 aRbAssign.Disable();
308 }
309}
310
311
312//----------------------------------------------------------------------------
313
314void __EXPORT ScNameDlg::UpdateNames()
315{
316 sal_uInt16 nRangeCount = aLocalRangeName.GetCount();
317
312 }
313}
314
315
316//----------------------------------------------------------------------------
317
318void __EXPORT ScNameDlg::UpdateNames()
319{
320 sal_uInt16 nRangeCount = aLocalRangeName.GetCount();
321
318 aEdName.SetUpdateMode( sal_False );
322 //aEdName.SetUpdateMode( FALSE );
323 aLBNames.SetUpdateMode( false );
319 //-----------------------------------------------------------
324 //-----------------------------------------------------------
320 sal_uInt16 nNamePos = aEdName.GetTopEntry();
321 aEdName.Clear();
325 //USHORT nNamePos = aEdName.GetTopEntry();
326 //aEdName.Clear();
327 sal_uInt16 nNamePos = aLBNames.GetTopEntry();
328 aLBNames.Clear();
322
323 aEdAssign.SetText( EMPTY_STRING );
324
325 if ( nRangeCount > 0 )
326 {
327 ScRangeData* pRangeData = NULL;
328 String aString;
329
330 aEdAssign.SetText( EMPTY_STRING );
331
332 if ( nRangeCount > 0 )
333 {
334 ScRangeData* pRangeData = NULL;
335 String aString;
336 SCTAB tabIndex = 0;
329
330 for ( sal_uInt16 i=0; i<nRangeCount; i++ )
331 {
332 pRangeData = (ScRangeData*)(aLocalRangeName.At( i ));
333 if ( pRangeData )
334 {
335 if ( !pRangeData->HasType( RT_DATABASE )
336 && !pRangeData->HasType( RT_SHARED ) )
337 {
338 pRangeData->GetName( aString );
337
338 for ( sal_uInt16 i=0; i<nRangeCount; i++ )
339 {
340 pRangeData = (ScRangeData*)(aLocalRangeName.At( i ));
341 if ( pRangeData )
342 {
343 if ( !pRangeData->HasType( RT_DATABASE )
344 && !pRangeData->HasType( RT_SHARED ) )
345 {
346 pRangeData->GetName( aString );
339 aEdName.InsertEntry( aString );
347 if ( (tabIndex = pRangeData->GetRangeScope() ) != MAXTABCOUNT)
348 {
349 String tabName;
350 pDoc->GetName(tabIndex,tabName);
351 if (aString.Len() < SHEETNAMEPOS)
352 aString.Expand(SHEETNAMEPOS);
353 else
354 aString.AppendAscii( " ");
355 aString.AppendAscii( "(");
356 aString += tabName;
357 aString.AppendAscii( ")");
358 }
359
360 //aEdName.InsertEntry( aString );
361 aLBNames.InsertEntry( aString );
340 }
341 }
342 }
343 }
344 else
345 {
346 aBtnAdd.SetText( aStrAdd );
347 aBtnAdd.Disable();
348 aBtnRemove.Disable();
349 }
350 //-----------------------------------------------------------
362 }
363 }
364 }
365 }
366 else
367 {
368 aBtnAdd.SetText( aStrAdd );
369 aBtnAdd.Disable();
370 aBtnRemove.Disable();
371 }
372 //-----------------------------------------------------------
351 aEdName.SetUpdateMode( sal_True );
352 aEdName.SetTopEntry(nNamePos);
353 aEdName.Invalidate();
373 //aEdName.SetUpdateMode( TRUE );
374 //aEdName.SetTopEntry(nNamePos);
375 //aEdName.Invalidate();
376 aLBNames.SetUpdateMode( true );
377 aLBNames.SetTopEntry(nNamePos);
378 aLBNames.Invalidate();
354}
355
356
357//----------------------------------------------------------------------------
358
359void __EXPORT ScNameDlg::CalcCurTableAssign( String& aAssign, sal_uInt16 nCurPos )
360{
361 ScRangeData* pRangeData = (ScRangeData*)(aLocalRangeName.At( nCurPos ));

--- 42 unchanged lines hidden (view full) ---

404
405
406//----------------------------------------------------------------------------
407
408IMPL_LINK( ScNameDlg, AddBtnHdl, void *, EMPTYARG )
409{
410 sal_Bool bAdded = sal_False;
411 String aNewEntry = aEdName.GetText();
379}
380
381
382//----------------------------------------------------------------------------
383
384void __EXPORT ScNameDlg::CalcCurTableAssign( String& aAssign, sal_uInt16 nCurPos )
385{
386 ScRangeData* pRangeData = (ScRangeData*)(aLocalRangeName.At( nCurPos ));

--- 42 unchanged lines hidden (view full) ---

429
430
431//----------------------------------------------------------------------------
432
433IMPL_LINK( ScNameDlg, AddBtnHdl, void *, EMPTYARG )
434{
435 sal_Bool bAdded = sal_False;
436 String aNewEntry = aEdName.GetText();
412 sal_uInt16 nNamePos = aEdName.GetTopEntry();
437 //USHORT nNamePos = aEdName.GetTopEntry();
438 sal_uInt16 nNamePos = aLBNames.GetTopEntry();
413 aNewEntry.EraseLeadingChars( ' ' );
414 aNewEntry.EraseTrailingChars( ' ' );
415
416 if ( aNewEntry.Len() > 0 )
417 {
418 if ( ScRangeData::IsNameValid( aNewEntry, pDoc ) )
419 {
420 if ( pDoc )

--- 5 unchanged lines hidden (view full) ---

426 String aStrPos;
427 String aStrArea;
428
429 pNewEntry = new ScRangeData( pDoc,
430 aNewEntry,
431 theSymbol,
432 theCursorPos,
433 nType );
439 aNewEntry.EraseLeadingChars( ' ' );
440 aNewEntry.EraseTrailingChars( ' ' );
441
442 if ( aNewEntry.Len() > 0 )
443 {
444 if ( ScRangeData::IsNameValid( aNewEntry, pDoc ) )
445 {
446 if ( pDoc )

--- 5 unchanged lines hidden (view full) ---

452 String aStrPos;
453 String aStrArea;
454
455 pNewEntry = new ScRangeData( pDoc,
456 aNewEntry,
457 theSymbol,
458 theCursorPos,
459 nType );
460 if (aBtnAdd.GetText() == aStrModify)
461 pNewEntry->SetRangeScope(aSelectedRangeScope);
462 else
463 aSelectedRangeScope = MAXTABCOUNT;
434 if (pNewEntry)
435 {
436 nType = nType
437 | (aBtnRowHeader .IsChecked() ? RT_ROWHEADER : RangeType(0))
438 | (aBtnColHeader .IsChecked() ? RT_COLHEADER : RangeType(0))
439 | (aBtnPrintArea .IsChecked() ? RT_PRINTAREA : RangeType(0))
440 | (aBtnCriteria .IsChecked() ? RT_CRITERIA : RangeType(0));
441 pNewEntry->AddType(nType);
442 }
443
444 // theSymbol gueltig?
445 // (= konnte theSymbol im ScRangeData-Ctor
446 // in ein Token-Array uebersetzt werden?)
447 if ( 0 == pNewEntry->GetErrCode() )
448 {
449 // Eintrag bereits vorhanden? Dann vorher entfernen (=Aendern)
464 if (pNewEntry)
465 {
466 nType = nType
467 | (aBtnRowHeader .IsChecked() ? RT_ROWHEADER : RangeType(0))
468 | (aBtnColHeader .IsChecked() ? RT_COLHEADER : RangeType(0))
469 | (aBtnPrintArea .IsChecked() ? RT_PRINTAREA : RangeType(0))
470 | (aBtnCriteria .IsChecked() ? RT_CRITERIA : RangeType(0));
471 pNewEntry->AddType(nType);
472 }
473
474 // theSymbol gueltig?
475 // (= konnte theSymbol im ScRangeData-Ctor
476 // in ein Token-Array uebersetzt werden?)
477 if ( 0 == pNewEntry->GetErrCode() )
478 {
479 // Eintrag bereits vorhanden? Dann vorher entfernen (=Aendern)
450 if ( aLocalRangeName.SearchName( aNewEntry, nFoundAt ) )
480 if ( aLocalRangeName.SearchName( aNewEntry, nFoundAt, aSelectedRangeScope ) )
451 { // alten Index uebernehmen
452 pNewEntry->SetIndex(
453 ((ScRangeData*)(aLocalRangeName.At(nFoundAt)))->GetIndex() );
454 aLocalRangeName.AtFree( nFoundAt );
455 }
456 else
457 pSaveObj->Clear();
458

--- 27 unchanged lines hidden (view full) ---

486 else
487 {
488 ERRORBOX( ScGlobal::GetRscString(STR_INVALIDNAME) );
489 aEdName.SetSelection( Selection( 0, SELECTION_MAX ) );
490 aEdName.GrabFocus();
491 }
492 }
493
481 { // alten Index uebernehmen
482 pNewEntry->SetIndex(
483 ((ScRangeData*)(aLocalRangeName.At(nFoundAt)))->GetIndex() );
484 aLocalRangeName.AtFree( nFoundAt );
485 }
486 else
487 pSaveObj->Clear();
488

--- 27 unchanged lines hidden (view full) ---

516 else
517 {
518 ERRORBOX( ScGlobal::GetRscString(STR_INVALIDNAME) );
519 aEdName.SetSelection( Selection( 0, SELECTION_MAX ) );
520 aEdName.GrabFocus();
521 }
522 }
523
494 aEdName.SetTopEntry(nNamePos);
524 //aEdName.SetTopEntry(nNamePos);
525 aLBNames.SetTopEntry(nNamePos);
495 return bAdded;
496}
497
498
499//----------------------------------------------------------------------------
500
501IMPL_LINK( ScNameDlg, RemoveBtnHdl, void *, EMPTYARG )
502{
503 sal_uInt16 nRemoveAt = 0;
504 const String aStrEntry = aEdName.GetText();
505
526 return bAdded;
527}
528
529
530//----------------------------------------------------------------------------
531
532IMPL_LINK( ScNameDlg, RemoveBtnHdl, void *, EMPTYARG )
533{
534 sal_uInt16 nRemoveAt = 0;
535 const String aStrEntry = aEdName.GetText();
536
506 if ( aLocalRangeName.SearchName( aStrEntry, nRemoveAt ) )
537 if ( aLocalRangeName.SearchName( aStrEntry, nRemoveAt, aSelectedRangeScope ) )
507 {
508 String aStrDelMsg = ScGlobal::GetRscString( STR_QUERY_DELENTRY );
509 String aMsg = aStrDelMsg.GetToken( 0, '#' );
510
511 aMsg += aStrEntry;
512 aMsg += aStrDelMsg.GetToken( 1, '#' );
513
514 if ( RET_YES ==
515 QueryBox( this, WinBits( WB_YES_NO | WB_DEF_YES ), aMsg ).Execute() )
516 {
517 aLocalRangeName.AtFree( nRemoveAt );
518 UpdateNames();
519 UpdateChecks();
520 bSaved=sal_False;
521 RESTORE_DATA()
522 theCurSel = Selection( 0, SELECTION_MAX );
538 {
539 String aStrDelMsg = ScGlobal::GetRscString( STR_QUERY_DELENTRY );
540 String aMsg = aStrDelMsg.GetToken( 0, '#' );
541
542 aMsg += aStrEntry;
543 aMsg += aStrDelMsg.GetToken( 1, '#' );
544
545 if ( RET_YES ==
546 QueryBox( this, WinBits( WB_YES_NO | WB_DEF_YES ), aMsg ).Execute() )
547 {
548 aLocalRangeName.AtFree( nRemoveAt );
549 UpdateNames();
550 UpdateChecks();
551 bSaved=sal_False;
552 RESTORE_DATA()
553 theCurSel = Selection( 0, SELECTION_MAX );
554 aEdName.SetText(EMPTY_STRING);
523 aBtnAdd.SetText( aStrAdd );
524 aBtnAdd.Disable();
525 aBtnRemove.Disable();
526 }
527 }
528 return 0;
529}
530
531
532//----------------------------------------------------------------------------
533
534IMPL_LINK( ScNameDlg, NameSelectHdl, void *, EMPTYARG )
535{
536 sal_uInt16 nAtPos;
555 aBtnAdd.SetText( aStrAdd );
556 aBtnAdd.Disable();
557 aBtnRemove.Disable();
558 }
559 }
560 return 0;
561}
562
563
564//----------------------------------------------------------------------------
565
566IMPL_LINK( ScNameDlg, NameSelectHdl, void *, EMPTYARG )
567{
568 sal_uInt16 nAtPos;
569 String rangeName = aLBNames.GetSelectEntry();
570 if ( ')' == rangeName.GetChar(rangeName.Len()-1) )
571 {
572 xub_StrLen sheetNamePos = rangeName.Search('(');
573 String sheetName(rangeName, sheetNamePos+1, rangeName.Len()-2-sheetNamePos);
574 pDoc->GetTable(sheetName,aSelectedRangeScope);
575 rangeName.Erase(sheetNamePos);
576 rangeName.EraseTrailingChars();
577
578 }
579 else
580 aSelectedRangeScope = MAXTABCOUNT;
537
581
538 if ( aLocalRangeName.SearchName( aEdName.GetText(), nAtPos ) )
582 //if ( aLocalRangeName.SearchName( aEdName.GetText(), nAtPos ) )
583 if ( aLocalRangeName.SearchName( rangeName, nAtPos, aSelectedRangeScope ) )
539 {
540 String aSymbol;
541 ScRangeData* pData = (ScRangeData*)(aLocalRangeName.At( nAtPos ));
542
543 if ( pData )
544 {
545 pData->GetSymbol( aSymbol );
546 CalcCurTableAssign( aSymbol, nAtPos );
584 {
585 String aSymbol;
586 ScRangeData* pData = (ScRangeData*)(aLocalRangeName.At( nAtPos ));
587
588 if ( pData )
589 {
590 pData->GetSymbol( aSymbol );
591 CalcCurTableAssign( aSymbol, nAtPos );
547 aEdAssign.SetText( aSymbol );
592 aEdAssign.SetText( aSymbol );
548 aBtnAdd.SetText( aStrModify );
593 aBtnAdd.SetText( aStrModify );
594 aEdName.SetText(rangeName);
549 theCurSel = Selection( 0, SELECTION_MAX );
595 theCurSel = Selection( 0, SELECTION_MAX );
596 aBtnAdd.SetText( aStrModify );
597 aBtnAdd.Enable();
598 aBtnRemove.Enable();
550 }
551 }
552 UpdateChecks();
553 return 0;
554}
555
556
557//----------------------------------------------------------------------------
558
559IMPL_LINK( ScNameDlg, EdModifyHdl, Edit *, pEd )
560{
561 String theName = aEdName.GetText();
562 String theSymbol = aEdAssign.GetText();
599 }
600 }
601 UpdateChecks();
602 return 0;
603}
604
605
606//----------------------------------------------------------------------------
607
608IMPL_LINK( ScNameDlg, EdModifyHdl, Edit *, pEd )
609{
610 String theName = aEdName.GetText();
611 String theSymbol = aEdAssign.GetText();
563 sal_Bool bNameFound = (COMBOBOX_ENTRY_NOTFOUND
564 != aEdName.GetEntryPos( theName ));
612 bool bNameFound = (LISTBOX_ENTRY_NOTFOUND
613 != aLBNames.GetEntryPos( theName ));
565
566 if ( pEd == &aEdName )
567 {
568 if ( theName.Len() == 0 )
569 {
570 if ( aBtnAdd.GetText() != aStrAdd )
571 aBtnAdd.SetText( aStrAdd );
572 aBtnAdd.Disable();
573 aBtnRemove.Disable();
574 aFlAssign.Disable();
575 aEdAssign.Disable();
576 aRbAssign.Disable();
577 //@BugID 54702 raus mit dem Sch.
578 //SFX_APPWINDOW->Disable(sal_False); //! allgemeine Methode im ScAnyRefDlg
579 }
580 else
581 {
614
615 if ( pEd == &aEdName )
616 {
617 if ( theName.Len() == 0 )
618 {
619 if ( aBtnAdd.GetText() != aStrAdd )
620 aBtnAdd.SetText( aStrAdd );
621 aBtnAdd.Disable();
622 aBtnRemove.Disable();
623 aFlAssign.Disable();
624 aEdAssign.Disable();
625 aRbAssign.Disable();
626 //@BugID 54702 raus mit dem Sch.
627 //SFX_APPWINDOW->Disable(sal_False); //! allgemeine Methode im ScAnyRefDlg
628 }
629 else
630 {
631 /*
582 if ( bNameFound )
583 {
584 if ( aBtnAdd.GetText() != aStrModify )
585 aBtnAdd.SetText( aStrModify );
586
587 aBtnRemove.Enable();
588
589 if(!bSaved)
590 {
632 if ( bNameFound )
633 {
634 if ( aBtnAdd.GetText() != aStrModify )
635 aBtnAdd.SetText( aStrModify );
636
637 aBtnRemove.Enable();
638
639 if(!bSaved)
640 {
591 bSaved=sal_True;
641 bSaved=TRUE;
592 SAVE_DATA()
593 }
594 NameSelectHdl( 0 );
595 }
596 else
597 {
598 if ( aBtnAdd.GetText() != aStrAdd )
599 aBtnAdd.SetText( aStrAdd );
600 aBtnRemove.Disable();
601
642 SAVE_DATA()
643 }
644 NameSelectHdl( 0 );
645 }
646 else
647 {
648 if ( aBtnAdd.GetText() != aStrAdd )
649 aBtnAdd.SetText( aStrAdd );
650 aBtnRemove.Disable();
651
602 bSaved=sal_False;
652 bSaved=FALSE;
603 RESTORE_DATA()
604 }
653 RESTORE_DATA()
654 }
655 */
656
657 if ( aBtnAdd.GetText() != aStrAdd )
658 aBtnAdd.SetText( aStrAdd );
605 theSymbol = aEdAssign.GetText();
606
607 if ( theSymbol.Len() > 0 )
608 aBtnAdd.Enable();
609 else
610 aBtnAdd.Disable();
611
612 aFlAssign.Enable();
613 aEdAssign.Enable();
614 aRbAssign.Enable();
659 theSymbol = aEdAssign.GetText();
660
661 if ( theSymbol.Len() > 0 )
662 aBtnAdd.Enable();
663 else
664 aBtnAdd.Disable();
665
666 aFlAssign.Enable();
667 aEdAssign.Enable();
668 aRbAssign.Enable();
669 aBtnRemove.Disable();
615 //@BugID 54702 raus mit dem Sch.
616 //SFX_APPWINDOW->Enable();
617 }
618 UpdateChecks();
619 theCurSel = Selection( 0, SELECTION_MAX );
620 }
621 else if ( pEd == &aEdAssign )
622 {

--- 25 unchanged lines hidden ---
670 //@BugID 54702 raus mit dem Sch.
671 //SFX_APPWINDOW->Enable();
672 }
673 UpdateChecks();
674 theCurSel = Selection( 0, SELECTION_MAX );
675 }
676 else if ( pEd == &aEdAssign )
677 {

--- 25 unchanged lines hidden ---