fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / docshell / dbdocimp.cxx
blobb7ea4ca7022ec5d261bee90231c9091af7f8f9e7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <comphelper/processfactory.hxx>
21 #include <comphelper/types.hxx>
22 #include <vcl/msgbox.hxx>
23 #include <svx/dataaccessdescriptor.hxx>
24 #include <sfx2/viewfrm.hxx>
26 #include <com/sun/star/sdb/CommandType.hpp>
27 #include <com/sun/star/sdb/XCompletedExecution.hpp>
28 #include <com/sun/star/sdbc/XRow.hpp>
29 #include <com/sun/star/sdbc/XRowSet.hpp>
30 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
31 #include <com/sun/star/sdbcx/XRowLocate.hpp>
32 #include <com/sun/star/task/InteractionHandler.hpp>
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include <com/sun/star/frame/XDispatchProvider.hpp>
36 #include <com/sun/star/frame/FrameSearchFlag.hpp>
37 #include <com/sun/star/view/XSelectionSupplier.hpp>
39 #include "dbdocfun.hxx"
40 #include "docsh.hxx"
41 #include "globstr.hrc"
42 #include "scerrors.hxx"
43 #include "dbdata.hxx"
44 #include "markdata.hxx"
45 #include "undodat.hxx"
46 #include "progress.hxx"
47 #include "patattr.hxx"
48 #include "docpool.hxx"
49 #include "attrib.hxx"
50 #include "dbdocutl.hxx"
51 #include "editable.hxx"
52 #include "hints.hxx"
53 #include "miscuno.hxx"
54 #include "chgtrack.hxx"
55 #include <refupdatecontext.hxx>
57 using namespace com::sun::star;
59 #define SC_SERVICE_ROWSET "com.sun.star.sdb.RowSet"
61 //! move to a header file?
62 #define SC_DBPROP_DATASOURCENAME "DataSourceName"
63 #define SC_DBPROP_COMMAND "Command"
64 #define SC_DBPROP_COMMANDTYPE "CommandType"
66 void ScDBDocFunc::ShowInBeamer( const ScImportParam& rParam, SfxViewFrame* pFrame )
68 // called after opening the database beamer
70 if ( !pFrame || !rParam.bImport )
71 return;
73 uno::Reference<frame::XFrame> xFrame = pFrame->GetFrame().GetFrameInterface();
74 uno::Reference<frame::XDispatchProvider> xDP(xFrame, uno::UNO_QUERY);
76 uno::Reference<frame::XFrame> xBeamerFrame = xFrame->findFrame(
77 OUString("_beamer"),
78 frame::FrameSearchFlag::CHILDREN);
79 if (xBeamerFrame.is())
81 uno::Reference<frame::XController> xController = xBeamerFrame->getController();
82 uno::Reference<view::XSelectionSupplier> xControllerSelection(xController, uno::UNO_QUERY);
83 if (xControllerSelection.is())
85 sal_Int32 nType = rParam.bSql ? sdb::CommandType::COMMAND :
86 ( (rParam.nType == ScDbQuery) ? sdb::CommandType::QUERY :
87 sdb::CommandType::TABLE );
89 svx::ODataAccessDescriptor aSelection;
90 aSelection.setDataSource(rParam.aDBName);
91 aSelection[svx::daCommand] <<= rParam.aStatement;
92 aSelection[svx::daCommandType] <<= nType;
94 xControllerSelection->select(uno::makeAny(aSelection.createPropertyValueSequence()));
96 else
98 OSL_FAIL("no selection supplier in the beamer!");
103 bool ScDBDocFunc::DoImportUno( const ScAddress& rPos,
104 const uno::Sequence<beans::PropertyValue>& aArgs )
106 svx::ODataAccessDescriptor aDesc( aArgs ); // includes selection and result set
108 // create database range
109 ScDBData* pDBData = rDocShell.GetDBData( ScRange(rPos), SC_DB_IMPORT, SC_DBSEL_KEEP );
110 DBG_ASSERT(pDBData, "can't create DB data");
111 OUString sTarget = pDBData->GetName();
113 UpdateImport( sTarget, aDesc );
115 return true;
118 bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
119 const svx::ODataAccessDescriptor* pDescriptor, bool bRecord, bool bAddrInsert )
121 ScDocument& rDoc = rDocShell.GetDocument();
122 ScChangeTrack *pChangeTrack = NULL;
123 ScRange aChangedRange;
125 if (bRecord && !rDoc.IsUndoEnabled())
126 bRecord = false;
128 ScDBData* pDBData = NULL;
129 if ( !bAddrInsert )
131 pDBData = rDoc.GetDBAtArea( nTab, rParam.nCol1, rParam.nRow1,
132 rParam.nCol2, rParam.nRow2 );
133 if (!pDBData)
135 OSL_FAIL( "DoImport: no DBData" );
136 return false;
140 vcl::Window* pWaitWin = ScDocShell::GetActiveDialogParent();
141 if (pWaitWin)
142 pWaitWin->EnterWait();
143 ScDocShellModificator aModificator( rDocShell );
145 bool bSuccess = false;
146 bool bApi = false; //! pass as argument
147 bool bTruncated = false; // for warning
148 sal_uInt16 nErrStringId = 0;
149 OUString aErrorMessage;
151 SCCOL nCol = rParam.nCol1;
152 SCROW nRow = rParam.nRow1;
153 SCCOL nEndCol = nCol; // end of resulting database area
154 SCROW nEndRow = nRow;
155 long i;
157 bool bDoSelection = false;
158 bool bRealSelection = false; // sal_True if not everything is selected
159 bool bBookmarkSelection = false;
160 sal_Int32 nListPos = 0;
161 sal_Int32 nRowsRead = 0;
162 sal_Int32 nListCount = 0;
164 uno::Sequence<uno::Any> aSelection;
165 if ( pDescriptor && pDescriptor->has(svx::daSelection) )
167 (*pDescriptor)[svx::daSelection] >>= aSelection;
168 nListCount = aSelection.getLength();
169 if ( nListCount > 0 )
171 bDoSelection = true;
172 if ( pDescriptor->has(svx::daBookmarkSelection) )
173 bBookmarkSelection = ScUnoHelpFunctions::GetBoolFromAny( (*pDescriptor)[svx::daBookmarkSelection] );
174 if ( bBookmarkSelection )
176 // From bookmarks, there's no way to detect if all records are selected.
177 // Rely on base to pass no selection in that case.
178 bRealSelection = true;
183 uno::Reference<sdbc::XResultSet> xResultSet;
184 if ( pDescriptor && pDescriptor->has(svx::daCursor) )
185 xResultSet.set((*pDescriptor)[svx::daCursor], uno::UNO_QUERY);
187 // ImportDoc - also used for Redo
188 ScDocument* pImportDoc = new ScDocument( SCDOCMODE_UNDO );
189 pImportDoc->InitUndo( &rDoc, nTab, nTab );
191 // get data from database into import document
195 // progress bar
196 // only text (title is still needed, for the cancel button)
197 ScProgress aProgress( &rDocShell, ScGlobal::GetRscString(STR_UNDO_IMPORTDATA), 0 );
199 uno::Reference<sdbc::XRowSet> xRowSet = uno::Reference<sdbc::XRowSet>(
200 xResultSet, uno::UNO_QUERY );
201 bool bDispose = false;
202 if ( !xRowSet.is() )
204 bDispose = true;
205 xRowSet = uno::Reference<sdbc::XRowSet>(
206 comphelper::getProcessServiceFactory()->createInstance(
207 OUString( SC_SERVICE_ROWSET ) ),
208 uno::UNO_QUERY);
209 uno::Reference<beans::XPropertySet> xRowProp( xRowSet, uno::UNO_QUERY );
210 OSL_ENSURE( xRowProp.is(), "can't get RowSet" );
211 if ( xRowProp.is() )
214 // set source parameters
216 sal_Int32 nType = rParam.bSql ? sdb::CommandType::COMMAND :
217 ( (rParam.nType == ScDbQuery) ? sdb::CommandType::QUERY :
218 sdb::CommandType::TABLE );
219 uno::Any aAny;
221 aAny <<= rParam.aDBName;
222 xRowProp->setPropertyValue(
223 OUString(SC_DBPROP_DATASOURCENAME), aAny );
225 aAny <<= rParam.aStatement;
226 xRowProp->setPropertyValue(
227 OUString(SC_DBPROP_COMMAND), aAny );
229 aAny <<= nType;
230 xRowProp->setPropertyValue(
231 OUString(SC_DBPROP_COMMANDTYPE), aAny );
233 uno::Reference<sdb::XCompletedExecution> xExecute( xRowSet, uno::UNO_QUERY );
234 if ( xExecute.is() )
236 uno::Reference<task::XInteractionHandler> xHandler(
237 task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), 0),
238 uno::UNO_QUERY_THROW);
239 xExecute->executeWithCompletion( xHandler );
241 else
242 xRowSet->execute();
245 if ( xRowSet.is() )
248 // get column descriptions
250 long nColCount = 0;
251 uno::Reference<sdbc::XResultSetMetaData> xMeta;
252 uno::Reference<sdbc::XResultSetMetaDataSupplier> xMetaSupp( xRowSet, uno::UNO_QUERY );
253 if ( xMetaSupp.is() )
254 xMeta = xMetaSupp->getMetaData();
255 if ( xMeta.is() )
256 nColCount = xMeta->getColumnCount(); // this is the number of real columns
258 if ( rParam.nCol1 + nColCount - 1 > MAXCOL )
260 nColCount = 0;
261 //! error message
264 uno::Reference<sdbcx::XRowLocate> xLocate;
265 if ( bBookmarkSelection )
267 xLocate.set( xRowSet, uno::UNO_QUERY );
268 if ( !xLocate.is() )
270 SAL_WARN( "sc.ui","can't get XRowLocate");
271 bDoSelection = bRealSelection = bBookmarkSelection = false;
275 uno::Reference<sdbc::XRow> xRow( xRowSet, uno::UNO_QUERY );
276 if ( nColCount > 0 && xRow.is() )
278 nEndCol = (SCCOL)( rParam.nCol1 + nColCount - 1 );
280 uno::Sequence<sal_Int32> aColTypes( nColCount ); // column types
281 uno::Sequence<sal_Bool> aColCurr( nColCount ); // currency flag is not in types
282 sal_Int32* pTypeArr = aColTypes.getArray();
283 sal_Bool* pCurrArr = aColCurr.getArray();
284 for (i=0; i<nColCount; i++)
286 pTypeArr[i] = xMeta->getColumnType( i+1 );
287 pCurrArr[i] = xMeta->isCurrency( i+1 );
290 if ( !bAddrInsert ) // read column names
292 nCol = rParam.nCol1;
293 for (i=0; i<nColCount; i++)
295 pImportDoc->SetString( nCol, nRow, nTab,
296 xMeta->getColumnLabel( i+1 ) );
297 ++nCol;
299 ++nRow;
302 bool bEnd = false;
303 if ( !bDoSelection )
304 xRowSet->beforeFirst();
305 sal_uInt16 nInserted = 0;
306 while ( !bEnd )
308 // skip rows that are not selected
309 if ( !bDoSelection )
311 if ( !(bEnd = !xRowSet->next()) )
312 ++nRowsRead;
314 else
316 if (nListPos < nListCount)
318 if ( bBookmarkSelection )
320 bEnd = !xLocate->moveToBookmark(aSelection[nListPos]);
322 else // use record numbers
324 sal_Int32 nNextRow = 0;
325 aSelection[nListPos] >>= nNextRow;
326 if ( nRowsRead+1 < nNextRow )
327 bRealSelection = true;
328 bEnd = !xRowSet->absolute(nRowsRead = nNextRow);
330 ++nListPos;
332 else
334 if ( !bBookmarkSelection && xRowSet->next() )
335 bRealSelection = true; // more data available but not used
336 bEnd = true;
340 if ( !bEnd )
342 if ( ValidRow(nRow) )
344 nCol = rParam.nCol1;
345 for (i=0; i<nColCount; i++)
347 ScDatabaseDocUtil::PutData( pImportDoc, nCol, nRow, nTab,
348 xRow, i+1, pTypeArr[i], pCurrArr[i] );
349 ++nCol;
351 nEndRow = nRow;
352 ++nRow;
354 // progress bar
356 ++nInserted;
357 if (!(nInserted & 15))
359 OUString aPict = ScGlobal::GetRscString( STR_PROGRESS_IMPORT );
360 OUString aText = aPict.getToken(0,'#');
361 aText += OUString::number( nInserted );
362 aText += aPict.getToken(1,'#');
364 if (!aProgress.SetStateText( 0, aText )) // stopped by user?
366 bEnd = true;
367 bSuccess = false;
368 nErrStringId = STR_DATABASE_ABORTED;
372 else // past the end of the spreadsheet
374 bEnd = true; // don't continue
375 bTruncated = true; // warning flag
380 bSuccess = true;
383 if ( bDispose )
384 ::comphelper::disposeComponent( xRowSet );
387 catch ( const sdbc::SQLException& rError )
389 aErrorMessage = rError.Message;
391 catch ( uno::Exception& )
393 OSL_FAIL("Unexpected exception in database");
396 // test for cell protection
398 bool bKeepFormat = !bAddrInsert && pDBData->IsKeepFmt();
399 bool bMoveCells = !bAddrInsert && pDBData->IsDoSize();
400 SCCOL nFormulaCols = 0; // columns to be filled with formulas
401 if (bMoveCells && nEndCol == rParam.nCol2)
403 // if column count changes, formulas would become invalid anyway
404 // -> only set nFormulaCols for unchanged column count
406 SCCOL nTestCol = rParam.nCol2 + 1; // right of the data
407 SCROW nTestRow = rParam.nRow1 + 1; // below the title row
408 while ( nTestCol <= MAXCOL &&
409 rDoc.GetCellType(ScAddress( nTestCol, nTestRow, nTab )) == CELLTYPE_FORMULA )
410 ++nTestCol, ++nFormulaCols;
413 if (bSuccess)
415 // old and new range editable?
416 ScEditableTester aTester;
417 aTester.TestBlock( &rDoc, nTab, rParam.nCol1,rParam.nRow1,rParam.nCol2,rParam.nRow2 );
418 aTester.TestBlock( &rDoc, nTab, rParam.nCol1,rParam.nRow1,nEndCol,nEndRow );
419 if ( !aTester.IsEditable() )
421 nErrStringId = aTester.GetMessageId();
422 bSuccess = false;
424 else if ( (pChangeTrack = rDoc.GetChangeTrack()) != NULL )
425 aChangedRange = ScRange(rParam.nCol1, rParam.nRow1, nTab,
426 nEndCol+nFormulaCols, nEndRow, nTab );
429 if ( bSuccess && bMoveCells )
431 ScRange aOld( rParam.nCol1, rParam.nRow1, nTab,
432 rParam.nCol2+nFormulaCols, rParam.nRow2, nTab );
433 ScRange aNew( rParam.nCol1, rParam.nRow1, nTab,
434 nEndCol+nFormulaCols, nEndRow, nTab );
435 if (!rDoc.CanFitBlock( aOld, aNew ))
437 nErrStringId = STR_MSSG_DOSUBTOTALS_2; // can't insert cells
438 bSuccess = false;
442 // copy data from import doc into real document
444 if ( bSuccess )
446 if (bKeepFormat)
448 // keep formatting of title and first data row from the document
449 // CopyToDocument also copies styles, Apply... needs separate calls
451 SCCOL nMinEndCol = std::min( rParam.nCol2, nEndCol ); // not too much
452 nMinEndCol = sal::static_int_cast<SCCOL>( nMinEndCol + nFormulaCols ); // only if column count unchanged
453 pImportDoc->DeleteAreaTab( 0,0, MAXCOL,MAXROW, nTab, IDF_ATTRIB );
454 rDoc.CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
455 nMinEndCol, rParam.nRow1, nTab,
456 IDF_ATTRIB, false, pImportDoc );
458 SCROW nDataStartRow = rParam.nRow1+1;
459 for (SCCOL nCopyCol=rParam.nCol1; nCopyCol<=nMinEndCol; nCopyCol++)
461 const ScPatternAttr* pSrcPattern = rDoc.GetPattern(
462 nCopyCol, nDataStartRow, nTab );
463 pImportDoc->ApplyPatternAreaTab( nCopyCol, nDataStartRow, nCopyCol, nEndRow,
464 nTab, *pSrcPattern );
465 const ScStyleSheet* pStyle = pSrcPattern->GetStyleSheet();
466 if (pStyle)
467 pImportDoc->ApplyStyleAreaTab( nCopyCol, nDataStartRow, nCopyCol, nEndRow,
468 nTab, *pStyle );
472 // don't set cell protection attribute if table is protected
473 if (rDoc.IsTabProtected(nTab))
475 ScPatternAttr aPattern(pImportDoc->GetPool());
476 aPattern.GetItemSet().Put( ScProtectionAttr( false,false,false,false ) );
477 pImportDoc->ApplyPatternAreaTab( 0,0,MAXCOL,MAXROW, nTab, aPattern );
480 // copy old data for undo
482 SCCOL nUndoEndCol = std::max( nEndCol, rParam.nCol2 ); // rParam = old end
483 SCROW nUndoEndRow = std::max( nEndRow, rParam.nRow2 );
485 ScDocument* pUndoDoc = NULL;
486 ScDBData* pUndoDBData = NULL;
487 if ( bRecord )
489 pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
490 pUndoDoc->InitUndo( &rDoc, nTab, nTab );
492 if ( !bAddrInsert )
493 pUndoDBData = new ScDBData( *pDBData );
496 ScMarkData aNewMark;
497 aNewMark.SelectOneTable( nTab );
499 if (bRecord)
501 // do not touch notes (ScUndoImportData does not support drawing undo)
502 InsertDeleteFlags nCopyFlags = IDF_ALL & ~IDF_NOTE;
504 // nFormulaCols is set only if column count is unchanged
505 rDoc.CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
506 nEndCol+nFormulaCols, nEndRow, nTab,
507 nCopyFlags, false, pUndoDoc );
508 if ( rParam.nCol2 > nEndCol )
509 rDoc.CopyToDocument( nEndCol+1, rParam.nRow1, nTab,
510 nUndoEndCol, nUndoEndRow, nTab,
511 nCopyFlags, false, pUndoDoc );
512 if ( rParam.nRow2 > nEndRow )
513 rDoc.CopyToDocument( rParam.nCol1, nEndRow+1, nTab,
514 nUndoEndCol+nFormulaCols, nUndoEndRow, nTab,
515 nCopyFlags, false, pUndoDoc );
518 // move new data
520 if (bMoveCells)
522 // clear only the range without the formulas,
523 // so the formula title and first row are preserved
525 ScRange aDelRange( rParam.nCol1, rParam.nRow1, nTab,
526 rParam.nCol2, rParam.nRow2, nTab );
527 rDoc.DeleteAreaTab( aDelRange, IDF_ALL & ~IDF_NOTE ); // ohne die Formeln
529 ScRange aOld( rParam.nCol1, rParam.nRow1, nTab,
530 rParam.nCol2+nFormulaCols, rParam.nRow2, nTab );
531 ScRange aNew( rParam.nCol1, rParam.nRow1, nTab,
532 nEndCol+nFormulaCols, nEndRow, nTab );
533 rDoc.FitBlock( aOld, aNew, false ); // Formeln nicht loeschen
535 else if ( nEndCol < rParam.nCol2 ) // DeleteArea calls PutInOrder
536 rDoc.DeleteArea( nEndCol+1, rParam.nRow1, rParam.nCol2, rParam.nRow2,
537 aNewMark, IDF_CONTENTS & ~IDF_NOTE );
539 // CopyToDocument doesn't remove contents
540 rDoc.DeleteAreaTab( rParam.nCol1, rParam.nRow1, nEndCol, nEndRow, nTab, IDF_CONTENTS & ~IDF_NOTE );
542 // remove each column from ImportDoc after copying to reduce memory usage
543 bool bOldAutoCalc = rDoc.GetAutoCalc();
544 rDoc.SetAutoCalc( false ); // outside of the loop
545 for (SCCOL nCopyCol = rParam.nCol1; nCopyCol <= nEndCol; nCopyCol++)
547 pImportDoc->CopyToDocument( nCopyCol, rParam.nRow1, nTab, nCopyCol, nEndRow, nTab,
548 IDF_ALL, false, &rDoc );
549 pImportDoc->DeleteAreaTab( nCopyCol, rParam.nRow1, nCopyCol, nEndRow, nTab, IDF_CONTENTS );
551 rDoc.SetAutoCalc( bOldAutoCalc );
553 if (nFormulaCols > 0) // copy formulas
555 if (bKeepFormat) // formats for formulas
556 pImportDoc->CopyToDocument( nEndCol+1, rParam.nRow1, nTab,
557 nEndCol+nFormulaCols, nEndRow, nTab,
558 IDF_ATTRIB, false, &rDoc );
559 // fill formulas
560 ScMarkData aMark;
561 aMark.SelectOneTable(nTab);
563 sal_uLong nProgCount = nFormulaCols;
564 nProgCount *= nEndRow-rParam.nRow1-1;
565 ScProgress aProgress( rDoc.GetDocumentShell(),
566 ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
568 rDoc.Fill( nEndCol+1, rParam.nRow1+1, nEndCol+nFormulaCols, rParam.nRow1+1,
569 &aProgress, aMark, nEndRow-rParam.nRow1-1, FILL_TO_BOTTOM, FILL_SIMPLE );
572 // if new range is smaller, clear old contents
574 if (!bMoveCells) // move has happened above
576 if ( rParam.nCol2 > nEndCol )
577 rDoc.DeleteArea( nEndCol+1, rParam.nRow1, rParam.nCol2, rParam.nRow2,
578 aNewMark, IDF_CONTENTS );
579 if ( rParam.nRow2 > nEndRow )
580 rDoc.DeleteArea( rParam.nCol1, nEndRow+1, rParam.nCol2, rParam.nRow2,
581 aNewMark, IDF_CONTENTS );
584 if( !bAddrInsert ) // update database range
586 pDBData->SetImportParam( rParam );
587 pDBData->SetHeader( true );
588 pDBData->SetByRow( true );
589 pDBData->SetArea( nTab, rParam.nCol1,rParam.nRow1, nEndCol,nEndRow );
590 pDBData->SetImportSelection( bRealSelection );
591 rDoc.CompileDBFormula();
594 if (bRecord)
596 ScDocument* pRedoDoc = pImportDoc;
597 pImportDoc = NULL;
599 if (nFormulaCols > 0) // include filled formulas for redo
600 rDoc.CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
601 nEndCol+nFormulaCols, nEndRow, nTab,
602 IDF_ALL & ~IDF_NOTE, false, pRedoDoc );
604 ScDBData* pRedoDBData = pDBData ? new ScDBData( *pDBData ) : NULL;
606 rDocShell.GetUndoManager()->AddUndoAction(
607 new ScUndoImportData( &rDocShell, nTab,
608 rParam, nUndoEndCol, nUndoEndRow,
609 nFormulaCols,
610 pUndoDoc, pRedoDoc, pUndoDBData, pRedoDBData ) );
613 sc::SetFormulaDirtyContext aCxt;
614 rDoc.SetAllFormulasDirty(aCxt);
615 rDocShell.PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
616 aModificator.SetDocumentModified();
618 ScDBRangeRefreshedHint aHint( rParam );
619 rDoc.BroadcastUno( aHint );
621 if (pWaitWin)
622 pWaitWin->LeaveWait();
624 if ( bTruncated && !bApi ) // show warning
625 ErrorHandler::HandleError(SCWARN_IMPORT_RANGE_OVERFLOW);
627 else if ( !bApi )
629 if (pWaitWin)
630 pWaitWin->LeaveWait();
632 if (aErrorMessage.isEmpty())
634 if (!nErrStringId)
635 nErrStringId = STR_MSSG_IMPORTDATA_0;
636 aErrorMessage = ScGlobal::GetRscString( nErrStringId );
638 ScopedVclPtrInstance< InfoBox > aInfoBox( ScDocShell::GetActiveDialogParent(), aErrorMessage );
639 aInfoBox->Execute();
642 delete pImportDoc;
644 if (bSuccess && pChangeTrack)
645 pChangeTrack->AppendInsert ( aChangedRange );
647 return bSuccess;
650 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */