dbnamdlg.cxx (57b4fa3c) dbnamdlg.cxx (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

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

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 ) ),
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

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

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{

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

200 }
201}
202
203
204//----------------------------------------------------------------------------
205
206void ScDbNameDlg::Init()
207{
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{

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

199 }
200}
201
202
203//----------------------------------------------------------------------------
204
205void ScDbNameDlg::Init()
206{
208 aBtnHeader.Check( sal_True ); // Default: mit Spaltenkoepfen
207 aBtnHeader.Check( sal_True ); // Default: mit Spaltenkoepfen
209
210 aBtnMore.AddWindow( &aFlOptions );
208
209 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 );
210 aBtnMore.AddWindow( &aBtnHeader );
211 aBtnMore.AddWindow( &aBtnDoSize );
212 aBtnMore.AddWindow( &aBtnKeepFmt );
213 aBtnMore.AddWindow( &aBtnStripData );
214 aBtnMore.AddWindow( &aFTSource );
215 aBtnMore.AddWindow( &aFTOperations );
217
216
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;
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;
225
224
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();
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();
233
232
234 if ( pViewData && pDoc )
235 {
236 ScDBCollection* pDBColl = pDoc->GetDBCollection();
237 ScDBData* pDBData = NULL;
233 if ( pViewData && pDoc )
234 {
235 ScDBCollection* pDBColl = pDoc->GetDBCollection();
236 ScDBData* pDBData = NULL;
238
237
239 pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
240 nEndCol, nEndRow, nEndTab );
238 pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
239 nEndCol, nEndRow, nEndTab );
241
240
242 theCurArea = ScRange( ScAddress( nStartCol, nStartRow, nStartTab ),
243 ScAddress( nEndCol, nEndRow, nEndTab ) );
241 theCurArea = ScRange( ScAddress( nStartCol, nStartRow, nStartTab ),
242 ScAddress( nEndCol, nEndRow, nEndTab ) );
244
243
245 theCurArea.Format( theAreaStr, ABS_DREF3D, pDoc, aAddrDetails );
244 theCurArea.Format( theAreaStr, ABS_DREF3D, pDoc, aAddrDetails );
246
245
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;
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;
256 SCCOL nCol1;
257 SCCOL nCol2;
258 SCROW nRow1;
259 SCROW nRow2;
260 SCTAB nTab;
261
255 SCCOL nCol1;
256 SCCOL nCol2;
257 SCROW nRow1;
258 SCROW nRow2;
259 SCTAB nTab;
260
262 pDBData->GetArea( nTab, nCol1, nRow1, nCol2, nRow2 );
261 pDBData->GetArea( nTab, nCol1, nRow1, nCol2, nRow2 );
263
262
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 if ( !pDBData->IsBuildin() )
271 aEdName.SetText( theDbName );
272 else
273 aEdName.SetText( EMPTY_STRING );
274 aBtnHeader.Check( pDBData->HasHeader() );
275 aBtnDoSize.Check( pDBData->IsDoSize() );
276 aBtnKeepFmt.Check( pDBData->IsKeepFmt() );
277 aBtnStripData.Check( pDBData->IsStripData() );
278 SetInfoStrings( pDBData );
279 }
280 }
281 }
282 }
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 }
283
286
284 aEdAssign.SetText( theAreaStr );
285 aEdName.GrabFocus();
286 bSaved=sal_True;
287 pSaveObj->Save();
288 NameModifyHdl( 0 );
287 aEdAssign.SetText( theAreaStr );
288 aEdName.GrabFocus();
289 bSaved=sal_True;
290 pSaveObj->Save();
291 NameModifyHdl( 0 );
289}
290
291
292void ScDbNameDlg::SetInfoStrings( const ScDBData* pDBData )
293{
294 String aSource = aStrSource;
295 if (pDBData)
296 {

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

356
357 RefInputDone();
358}
359
360//------------------------------------------------------------------------
361
362void ScDbNameDlg::UpdateNames()
363{
292}
293
294
295void ScDbNameDlg::SetInfoStrings( const ScDBData* pDBData )
296{
297 String aSource = aStrSource;
298 if (pDBData)
299 {

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

359
360 RefInputDone();
361}
362
363//------------------------------------------------------------------------
364
365void ScDbNameDlg::UpdateNames()
366{
364 sal_uInt16 nNameCount = aLocalDbCol.GetCount();
367 sal_uInt16 nNameCount = aLocalDbCol.GetCount();
365
368
366 aEdName.SetUpdateMode( sal_False );
367 //-----------------------------------------------------------
368 aEdName.Clear();
369 aEdAssign.SetText( EMPTY_STRING );
369 aEdName.SetUpdateMode( sal_False );
370 //-----------------------------------------------------------
371 aEdName.Clear();
372 aEdAssign.SetText( EMPTY_STRING );
370
373
371 if ( nNameCount > 0 )
372 {
373 ScDBData* pDbData = NULL;
374 String aString;
374 if ( nNameCount > 0 )
375 {
376 ScDBData* pDbData = NULL;
377 String aString;
375
378
376 for ( sal_uInt16 i=0; i<nNameCount; i++ )
377 {
378 pDbData = (ScDBData*)(aLocalDbCol.At( i ));
379 if ( pDbData )
380 {
381 pDbData->GetName( aString );
382 //if ( aString != aStrNoName )
383 if ( !pDbData->IsBuildin() )
384 aEdName.InsertEntry( aString );
385 }
386 }
387 }
388 else
389 {
390 aBtnAdd.SetText( aStrAdd );
391 aBtnAdd.Disable();
392 aBtnRemove.Disable();
393 }
394 //-----------------------------------------------------------
395 aEdName.SetUpdateMode( sal_True );
396 aEdName.Invalidate();
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();
397}
398
399//------------------------------------------------------------------------
400
401void ScDbNameDlg::UpdateDBData( const String& rStrName )
402{
403 String theArea;
404 sal_uInt16 nAt;

--- 316 unchanged lines hidden ---
400}
401
402//------------------------------------------------------------------------
403
404void ScDbNameDlg::UpdateDBData( const String& rStrName )
405{
406 String theArea;
407 sal_uInt16 nAt;

--- 316 unchanged lines hidden ---