xref: /aoo41x/main/sc/source/ui/dbgui/dbnamdlg.cxx (revision 22407013)
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 		aStrInvalid		( ScResId( STR_DB_INVALID ) ),
164 		//
165 		pViewData		( ptrViewData ),
166 		pDoc			( ptrViewData->GetDocument() ),
167 		bRefInputMode	( sal_False ),
168         aAddrDetails    ( pDoc->GetAddressConvention(), 0, 0 ),
169 		aLocalDbCol		( *(pDoc->GetDBCollection()) )
170 {
171 	// WB_NOLABEL can't be set in resource...
172 	aFTSource.SetStyle( aFTSource.GetStyle() | WB_NOLABEL );
173 	aFTOperations.SetStyle( aFTOperations.GetStyle() | WB_NOLABEL );
174 
175 	//	damit die Strings in der Resource bei den FixedTexten bleiben koennen:
176 	aStrSource		= aFTSource.GetText();
177 	aStrOperations	= aFTOperations.GetText();
178 
179 	pSaveObj = new DBSaveData( aEdAssign, aBtnHeader,
180 						aBtnDoSize, aBtnKeepFmt, aBtnStripData, theCurArea );
181 	Init();
182 	FreeResource();
183 	aRbAssign.SetAccessibleRelationMemberOf(&aFlAssign);
184 }
185 
186 
187 //----------------------------------------------------------------------------
188 
189 __EXPORT ScDbNameDlg::~ScDbNameDlg()
190 {
191 	DELETEZ( pSaveObj );
192 
193 	ScRange* pEntry = (ScRange*)aRemoveList.First();
194 	while ( pEntry )
195 	{
196         aRemoveList.Remove( pEntry );
197         delete pEntry;
198 		pEntry = (ScRange*)aRemoveList.Next();
199 	}
200 }
201 
202 
203 //----------------------------------------------------------------------------
204 
205 void ScDbNameDlg::Init()
206 {
207     aBtnHeader.Check( sal_True );		// Default: mit Spaltenkoepfen
208 
209     aBtnMore.AddWindow( &aFlOptions );
210     aBtnMore.AddWindow( &aBtnHeader );
211     aBtnMore.AddWindow( &aBtnDoSize );
212     aBtnMore.AddWindow( &aBtnKeepFmt );
213     aBtnMore.AddWindow( &aBtnStripData );
214     aBtnMore.AddWindow( &aFTSource );
215     aBtnMore.AddWindow( &aFTOperations );
216 
217     String	theAreaStr;
218     SCCOL	nStartCol 	= 0;
219     SCROW	nStartRow 	= 0;
220     SCTAB	nStartTab 	= 0;
221     SCCOL	nEndCol 	= 0;
222     SCROW	nEndRow		= 0;
223     SCTAB	nEndTab 	= 0;
224 
225     aBtnOk.SetClickHdl		( LINK( this, ScDbNameDlg, OkBtnHdl ) );
226     aBtnCancel.SetClickHdl	( LINK( this, ScDbNameDlg, CancelBtnHdl ) );
227     aBtnAdd.SetClickHdl		( LINK( this, ScDbNameDlg, AddBtnHdl ) );
228     aBtnRemove.SetClickHdl	( LINK( this, ScDbNameDlg, RemoveBtnHdl ) );
229     aEdName.SetModifyHdl	( LINK( this, ScDbNameDlg, NameModifyHdl ) );
230     aEdAssign.SetModifyHdl	( LINK( this, ScDbNameDlg, AssModifyHdl ) );
231     UpdateNames();
232 
233     if ( pViewData && pDoc )
234     {
235         ScDBCollection*	pDBColl	= pDoc->GetDBCollection();
236         ScDBData*		pDBData = NULL;
237 
238         pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
239             nEndCol,	 nEndRow,  nEndTab );
240 
241         theCurArea = ScRange( ScAddress( nStartCol, nStartRow, nStartTab ),
242             ScAddress( nEndCol,   nEndRow,   nEndTab ) );
243 
244         theCurArea.Format( theAreaStr, ABS_DREF3D, pDoc, aAddrDetails );
245 
246         if ( pDBColl )
247         {
248             // Feststellen, ob definierter DB-Bereich markiert wurde:
249             pDBData = pDBColl->GetDBAtCursor( nStartCol, nStartRow, nStartTab, sal_True );
250             if ( pDBData )
251             {
252                 String		theDbName;
253                 ScAddress&	rStart = theCurArea.aStart;
254                 ScAddress&	rEnd   = theCurArea.aEnd;
255                 SCCOL nCol1;
256                 SCCOL  nCol2;
257                 SCROW  nRow1;
258                 SCROW  nRow2;
259                 SCTAB  nTab;
260 
261                 pDBData->GetArea( nTab, nCol1, nRow1, nCol2, nRow2 );
262 
263                 if (   (rStart.Tab() == nTab)
264                     && (rStart.Col() == nCol1) && (rStart.Row() == nRow1)
265                     && (rEnd.Col()   == nCol2) && (rEnd.Row()   == nRow2 ) )
266                 {
267                     pDBData->GetName( theDbName );
268                     if ( !pDBData->IsInternalUnnamed()
269                          && !pDBData->IsInternalForAutoFilter() )
270                     {
271                         aEdName.SetText( theDbName );
272                     }
273                     else
274                     {
275                         aEdName.SetText( EMPTY_STRING );
276                     }
277                     aBtnHeader.Check( pDBData->HasHeader() );
278                     aBtnDoSize.Check( pDBData->IsDoSize() );
279                     aBtnKeepFmt.Check( pDBData->IsKeepFmt() );
280                     aBtnStripData.Check( pDBData->IsStripData() );
281                     SetInfoStrings( pDBData );
282                 }
283             }
284         }
285     }
286 
287     aEdAssign.SetText( theAreaStr );
288     aEdName.GrabFocus();
289     bSaved=sal_True;
290     pSaveObj->Save();
291     NameModifyHdl( 0 );
292 }
293 
294 
295 void ScDbNameDlg::SetInfoStrings( const ScDBData* pDBData )
296 {
297 	String aSource = aStrSource;
298 	if (pDBData)
299 	{
300 		aSource += ' ';
301 		aSource += pDBData->GetSourceString();
302 	}
303 	aFTSource.SetText( aSource );
304 
305 	String aOper = aStrOperations;
306 	if (pDBData)
307 	{
308 		aOper += ' ';
309 		aOper += pDBData->GetOperations();
310 	}
311 	aFTOperations.SetText( aOper );
312 }
313 
314 //----------------------------------------------------------------------------
315 // Uebergabe eines mit der Maus selektierten Tabellenbereiches, der dann als
316 //  neue Selektion im Referenz-Fenster angezeigt wird.
317 
318 void ScDbNameDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
319 {
320 	if ( aEdAssign.IsEnabled() )
321 	{
322 		if ( rRef.aStart != rRef.aEnd )
323 			RefInputStart( &aEdAssign );
324 
325 		theCurArea = rRef;
326 
327 		String aRefStr;
328         theCurArea.Format( aRefStr, ABS_DREF3D, pDocP, aAddrDetails );
329 		aEdAssign.SetRefString( aRefStr );
330 		aBtnHeader.Enable();
331 		aBtnDoSize.Enable();
332 		aBtnKeepFmt.Enable();
333 		aBtnStripData.Enable();
334 		aFTSource.Enable();
335 		aFTOperations.Enable();
336 		aBtnAdd.Enable();
337 		bSaved=sal_True;
338 		pSaveObj->Save();
339 	}
340 }
341 
342 
343 //----------------------------------------------------------------------------
344 
345 sal_Bool __EXPORT ScDbNameDlg::Close()
346 {
347 	return DoClose( ScDbNameDlgWrapper::GetChildWindowId() );
348 }
349 
350 //------------------------------------------------------------------------
351 
352 void ScDbNameDlg::SetActive()
353 {
354 	aEdAssign.GrabFocus();
355 
356 	//	kein NameModifyHdl, weil sonst Bereiche nicht geaendert werden koennen
357 	//	(nach dem Aufziehen der Referenz wuerde der alte Inhalt wieder angezeigt)
358 	//	(der ausgewaehlte DB-Name hat sich auch nicht veraendert)
359 
360 	RefInputDone();
361 }
362 
363 //------------------------------------------------------------------------
364 
365 void ScDbNameDlg::UpdateNames()
366 {
367     sal_uInt16	nNameCount = aLocalDbCol.GetCount();
368 
369     aEdName.SetUpdateMode( sal_False );
370     //-----------------------------------------------------------
371     aEdName.Clear();
372     aEdAssign.SetText( EMPTY_STRING );
373 
374     if ( nNameCount > 0 )
375     {
376         ScDBData*	pDbData = NULL;
377         String		aString;
378 
379         for ( sal_uInt16 i=0; i<nNameCount; i++ )
380         {
381             pDbData = (ScDBData*)(aLocalDbCol.At( i ));
382             if ( pDbData )
383             {
384                 pDbData->GetName( aString );
385                 if ( !pDbData->IsInternalUnnamed()
386                      && !pDbData->IsInternalForAutoFilter() )
387                     aEdName.InsertEntry( aString );
388             }
389         }
390     }
391     else
392     {
393         aBtnAdd.SetText( aStrAdd );
394         aBtnAdd.Disable();
395         aBtnRemove.Disable();
396     }
397     //-----------------------------------------------------------
398     aEdName.SetUpdateMode( sal_True );
399     aEdName.Invalidate();
400 }
401 
402 //------------------------------------------------------------------------
403 
404 void ScDbNameDlg::UpdateDBData( const String& rStrName )
405 {
406 	String		theArea;
407 	sal_uInt16 		nAt;
408 	ScDBData*	pData;
409 
410 	aLocalDbCol.SearchName( rStrName, nAt );
411 	pData = (ScDBData*)(aLocalDbCol.At( nAt ));
412 
413 	if ( pData )
414 	{
415 		SCCOL nColStart = 0;
416 		SCROW nRowStart = 0;
417 		SCCOL nColEnd	 = 0;
418 		SCROW nRowEnd	 = 0;
419 		SCTAB nTab		 = 0;
420 
421 		pData->GetArea( nTab, nColStart, nRowStart, nColEnd, nRowEnd );
422 		theCurArea = ScRange( ScAddress( nColStart, nRowStart, nTab ),
423 							  ScAddress( nColEnd,	nRowEnd,   nTab ) );
424 		theCurArea.Format( theArea, ABS_DREF3D, pDoc, aAddrDetails );
425 		aEdAssign.SetText( theArea );
426 		aBtnAdd.SetText( aStrModify );
427 		aBtnHeader.Check( pData->HasHeader() );
428 		aBtnDoSize.Check( pData->IsDoSize() );
429 		aBtnKeepFmt.Check( pData->IsKeepFmt() );
430 		aBtnStripData.Check( pData->IsStripData() );
431 		SetInfoStrings( pData );
432 	}
433 
434 	aBtnAdd.SetText( aStrModify );
435 	aBtnAdd.Enable();
436 	aBtnRemove.Enable();
437 	aBtnHeader.Enable();
438 	aBtnDoSize.Enable();
439 	aBtnKeepFmt.Enable();
440 	aBtnStripData.Enable();
441 	aFTSource.Enable();
442 	aFTOperations.Enable();
443 }
444 
445 //------------------------------------------------------------------------
446 
447 
448 sal_Bool ScDbNameDlg::IsRefInputMode() const
449 {
450 	return bRefInputMode;
451 }
452 
453 //------------------------------------------------------------------------
454 // Handler:
455 // ========
456 
457 IMPL_LINK( ScDbNameDlg, OkBtnHdl, void *, EMPTYARG )
458 {
459 	AddBtnHdl( 0 );
460 
461 	// Der View die Aenderungen und die Remove-Liste uebergeben:
462 	// beide werden nur als Referenz uebergeben, so dass an dieser
463 	// Stelle keine Speicherleichen entstehen koennen:
464 	if ( pViewData )
465 		pViewData->GetView()->
466 			NotifyCloseDbNameDlg( aLocalDbCol, aRemoveList );
467 
468 	Close();
469 	return 0;
470 }
471 
472 //------------------------------------------------------------------------
473 
474 IMPL_LINK_INLINE_START( ScDbNameDlg, CancelBtnHdl, void *, EMPTYARG )
475 {
476 	Close();
477 	return 0;
478 }
479 IMPL_LINK_INLINE_END( ScDbNameDlg, CancelBtnHdl, void *, EMPTYARG )
480 
481 //------------------------------------------------------------------------
482 
483 IMPL_LINK( ScDbNameDlg, AddBtnHdl, void *, EMPTYARG )
484 {
485 	String	aNewName = aEdName.GetText();
486 	String	aNewArea = aEdAssign.GetText();
487 
488 	aNewName.EraseLeadingChars( ' ' );
489 	aNewName.EraseTrailingChars( ' ' );
490 
491 	if ( aNewName.Len() > 0 && aNewArea.Len() > 0 )
492 	{
493 		if ( ScRangeData::IsNameValid( aNewName, pDoc ) )
494 		{
495 			//	weil jetzt editiert werden kann, muss erst geparst werden
496 			ScRange aTmpRange;
497 			String aText = aEdAssign.GetText();
498 			if ( aTmpRange.ParseAny( aText, pDoc, aAddrDetails ) & SCA_VALID )
499 			{
500 				theCurArea = aTmpRange;
501 				ScAddress aStart = theCurArea.aStart;
502 				ScAddress aEnd   = theCurArea.aEnd;
503 
504 				ScDBData* pOldEntry = NULL;
505 				sal_uInt16 nFoundAt = 0;
506 				if ( aLocalDbCol.SearchName( aNewName, nFoundAt ) )
507 					pOldEntry = aLocalDbCol[nFoundAt];
508 				if (pOldEntry)
509 				{
510 					//	Bereich veraendern
511 
512 					pOldEntry->MoveTo( aStart.Tab(), aStart.Col(), aStart.Row(),
513 														aEnd.Col(), aEnd.Row() );
514 					pOldEntry->SetByRow( sal_True );
515 					pOldEntry->SetHeader( aBtnHeader.IsChecked() );
516 					pOldEntry->SetDoSize( aBtnDoSize.IsChecked() );
517 					pOldEntry->SetKeepFmt( aBtnKeepFmt.IsChecked() );
518 					pOldEntry->SetStripData( aBtnStripData.IsChecked() );
519 				}
520 				else
521 				{
522 					//	neuen Bereich einfuegen
523 
524 					ScDBData* pNewEntry = new ScDBData( aNewName, aStart.Tab(),
525 														aStart.Col(), aStart.Row(),
526 														aEnd.Col(), aEnd.Row(),
527 														sal_True, aBtnHeader.IsChecked() );
528 					pNewEntry->SetDoSize( aBtnDoSize.IsChecked() );
529 					pNewEntry->SetKeepFmt( aBtnKeepFmt.IsChecked() );
530 					pNewEntry->SetStripData( aBtnStripData.IsChecked() );
531 
532 					if ( !aLocalDbCol.Insert( pNewEntry ) )
533 						delete pNewEntry;
534 				}
535 
536 				UpdateNames();
537 
538 				aEdName.SetText( EMPTY_STRING );
539 				aEdName.GrabFocus();
540 				aBtnAdd.SetText( aStrAdd );
541 				aBtnAdd.Disable();
542 				aBtnRemove.Disable();
543 				aEdAssign.SetText( EMPTY_STRING );
544 				aBtnHeader.Check( sal_True );		// Default: mit Spaltenkoepfen
545 				aBtnDoSize.Check( sal_False );
546 				aBtnKeepFmt.Check( sal_False );
547 				aBtnStripData.Check( sal_False );
548 				SetInfoStrings( NULL );		// leer
549 				theCurArea = ScRange();
550 				bSaved=sal_True;
551 				pSaveObj->Save();
552 				NameModifyHdl( 0 );
553 			}
554 			else
555 			{
556 				ERRORBOX( aStrInvalid );
557 				aEdAssign.SetSelection( Selection( 0, SELECTION_MAX ) );
558 				aEdAssign.GrabFocus();
559 			}
560 		}
561 		else
562 		{
563 			ERRORBOX( ScGlobal::GetRscString(STR_INVALIDNAME) );
564 			aEdName.SetSelection( Selection( 0, SELECTION_MAX ) );
565 			aEdName.GrabFocus();
566 		}
567 	}
568 	return 0;
569 }
570 
571 //------------------------------------------------------------------------
572 
573 IMPL_LINK( ScDbNameDlg, RemoveBtnHdl, void *, EMPTYARG )
574 {
575 	sal_uInt16		 nRemoveAt = 0;
576 	const String aStrEntry = aEdName.GetText();
577 
578 	if ( aLocalDbCol.SearchName( aStrEntry, nRemoveAt ) )
579 	{
580 		String aStrDelMsg = ScGlobal::GetRscString( STR_QUERY_DELENTRY );
581 		String aMsg		  = aStrDelMsg.GetToken( 0, '#' );
582 
583 		aMsg += aStrEntry;
584 		aMsg += aStrDelMsg.GetToken( 1, '#' );
585 
586 		if ( RET_YES == QUERYBOX(aMsg) )
587 		{
588 			ScDBData* pEntry = (ScDBData*)aLocalDbCol.At(nRemoveAt);
589 
590 			if ( pEntry )
591 			{
592                 SCTAB nTab;
593                 SCCOL nColStart, nColEnd;
594                 SCROW nRowStart, nRowEnd;
595                 pEntry->GetArea( nTab, nColStart, nRowStart, nColEnd, nRowEnd );
596 				aRemoveList.Insert(
597 					new ScRange( ScAddress( nColStart, nRowStart, nTab ),
598 								 ScAddress( nColEnd,   nRowEnd,   nTab ) ) );
599 			}
600 			aLocalDbCol.AtFree( nRemoveAt );
601 
602 			UpdateNames();
603 
604 			aEdName.SetText( EMPTY_STRING );
605 			aEdName.GrabFocus();
606 			aBtnAdd.SetText( aStrAdd );
607 			aBtnAdd.Disable();
608 			aBtnRemove.Disable();
609 			aEdAssign.SetText( EMPTY_STRING );
610 			theCurArea = ScRange();
611 			aBtnHeader.Check( sal_True );		// Default: mit Spaltenkoepfen
612 			aBtnDoSize.Check( sal_False );
613 			aBtnKeepFmt.Check( sal_False );
614 			aBtnStripData.Check( sal_False );
615 			SetInfoStrings( NULL );		// leer
616 			bSaved=sal_False;
617 			pSaveObj->Restore();
618 			NameModifyHdl( 0 );
619 		}
620 	}
621 	return 0;
622 }
623 
624 //------------------------------------------------------------------------
625 
626 IMPL_LINK( ScDbNameDlg, NameModifyHdl, void *, EMPTYARG )
627 {
628 	String	theName		= aEdName.GetText();
629 	sal_Bool	bNameFound  = (COMBOBOX_ENTRY_NOTFOUND
630 						   != aEdName.GetEntryPos( theName ));
631 
632 	if ( theName.Len() == 0 )
633 	{
634 		if ( aBtnAdd.GetText() != aStrAdd )
635 			aBtnAdd.SetText( aStrAdd );
636 		aBtnAdd		.Disable();
637 		aBtnRemove	.Disable();
638         aFlAssign   .Disable();
639 		aBtnHeader	.Disable();
640 		aBtnDoSize	.Disable();
641 		aBtnKeepFmt	.Disable();
642 		aBtnStripData.Disable();
643 		aFTSource	.Disable();
644 		aFTOperations.Disable();
645 		aEdAssign	.Disable();
646 		aRbAssign	.Disable();
647 		//bSaved=sal_False;
648 		//pSaveObj->Restore();
649 		//@BugID 54702 Enablen/Disablen nur noch in Basisklasse
650 		//SFX_APPWINDOW->Disable(sal_False);		//! allgemeine Methode im ScAnyRefDlg
651 		bRefInputMode = sal_False;
652 	}
653 	else
654 	{
655 		if ( bNameFound )
656 		{
657 			if ( aBtnAdd.GetText() != aStrModify )
658 				aBtnAdd.SetText( aStrModify );
659 
660 			if(!bSaved)
661 			{
662 				bSaved=sal_True;
663 				pSaveObj->Save();
664 			}
665 			UpdateDBData( theName );
666 		}
667 		else
668 		{
669 			if ( aBtnAdd.GetText() != aStrAdd )
670 				aBtnAdd.SetText( aStrAdd );
671 
672 			bSaved=sal_False;
673 			pSaveObj->Restore();
674 
675 			if ( aEdAssign.GetText().Len() > 0 )
676 			{
677 				aBtnAdd.Enable();
678 				aBtnHeader.Enable();
679 				aBtnDoSize.Enable();
680 				aBtnKeepFmt.Enable();
681 				aBtnStripData.Enable();
682 				aFTSource.Enable();
683 				aFTOperations.Enable();
684 			}
685 			else
686 			{
687 				aBtnAdd.Disable();
688 				aBtnHeader.Disable();
689 				aBtnDoSize.Disable();
690 				aBtnKeepFmt.Disable();
691 				aBtnStripData.Disable();
692 				aFTSource.Disable();
693 				aFTOperations.Disable();
694 			}
695 			aBtnRemove.Disable();
696 		}
697 
698         aFlAssign.Enable();
699 		aEdAssign.Enable();
700 		aRbAssign.Enable();
701 
702 		//@BugID 54702 Enablen/Disablen nur noch in Basisklasse
703 		//SFX_APPWINDOW->Enable();
704 		bRefInputMode = sal_True;
705 	}
706 	return 0;
707 }
708 
709 //------------------------------------------------------------------------
710 
711 IMPL_LINK( ScDbNameDlg, AssModifyHdl, void *, EMPTYARG )
712 {
713 	//	hier parsen fuer Save() etc.
714 
715 	ScRange aTmpRange;
716 	String aText = aEdAssign.GetText();
717 	if ( aTmpRange.ParseAny( aText, pDoc, aAddrDetails ) & SCA_VALID )
718 		theCurArea = aTmpRange;
719 
720 	return 0;
721 }
722 
723 
724