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