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