1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
40 #include "dbdocfun.hxx"
42 #include "globstr.hrc"
43 #include "scerrors.hxx"
45 #include "markdata.hxx"
46 #include "undodat.hxx"
47 #include "progress.hxx"
48 #include "patattr.hxx"
49 #include "docpool.hxx"
51 #include "dbdocutl.hxx"
52 #include "editable.hxx"
54 #include "miscuno.hxx"
55 #include "chgtrack.hxx"
56 #include <refupdatecontext.hxx>
58 using namespace com::sun::star
;
60 #define SC_SERVICE_ROWSET "com.sun.star.sdb.RowSet"
62 //! move to a header file?
63 #define SC_DBPROP_DATASOURCENAME "DataSourceName"
64 #define SC_DBPROP_COMMAND "Command"
65 #define SC_DBPROP_COMMANDTYPE "CommandType"
67 void ScDBDocFunc::ShowInBeamer( const ScImportParam
& rParam
, SfxViewFrame
* pFrame
)
69 // called after opening the database beamer
71 if ( !pFrame
|| !rParam
.bImport
)
74 uno::Reference
<frame::XFrame
> xFrame
= pFrame
->GetFrame().GetFrameInterface();
75 uno::Reference
<frame::XDispatchProvider
> xDP(xFrame
, uno::UNO_QUERY
);
77 uno::Reference
<frame::XFrame
> xBeamerFrame
= xFrame
->findFrame(
79 frame::FrameSearchFlag::CHILDREN
);
80 if (xBeamerFrame
.is())
82 uno::Reference
<frame::XController
> xController
= xBeamerFrame
->getController();
83 uno::Reference
<view::XSelectionSupplier
> xControllerSelection(xController
, uno::UNO_QUERY
);
84 if (xControllerSelection
.is())
86 sal_Int32 nType
= rParam
.bSql
? sdb::CommandType::COMMAND
:
87 ( (rParam
.nType
== ScDbQuery
) ? sdb::CommandType::QUERY
:
88 sdb::CommandType::TABLE
);
90 ::svx::ODataAccessDescriptor aSelection
;
91 aSelection
.setDataSource(rParam
.aDBName
);
92 aSelection
[svx::daCommand
] <<= rParam
.aStatement
;
93 aSelection
[svx::daCommandType
] <<= nType
;
95 xControllerSelection
->select(uno::makeAny(aSelection
.createPropertyValueSequence()));
99 OSL_FAIL("no selection supplier in the beamer!");
104 bool ScDBDocFunc::DoImportUno( const ScAddress
& rPos
,
105 const uno::Sequence
<beans::PropertyValue
>& aArgs
)
107 svx::ODataAccessDescriptor
aDesc( aArgs
); // includes selection and result set
109 // create database range
110 ScDBData
* pDBData
= rDocShell
.GetDBData( ScRange(rPos
), SC_DB_IMPORT
, SC_DBSEL_KEEP
);
111 DBG_ASSERT(pDBData
, "can't create DB data");
112 OUString sTarget
= pDBData
->GetName();
114 UpdateImport( sTarget
, aDesc
);
119 bool ScDBDocFunc::DoImport( SCTAB nTab
, const ScImportParam
& rParam
,
120 const svx::ODataAccessDescriptor
* pDescriptor
, bool bRecord
, bool bAddrInsert
)
122 ScDocument
* pDoc
= rDocShell
.GetDocument();
123 ScChangeTrack
*pChangeTrack
= NULL
;
124 ScRange aChangedRange
;
126 if (bRecord
&& !pDoc
->IsUndoEnabled())
129 ScDBData
* pDBData
= NULL
;
132 pDBData
= pDoc
->GetDBAtArea( nTab
, rParam
.nCol1
, rParam
.nRow1
,
133 rParam
.nCol2
, rParam
.nRow2
);
136 OSL_FAIL( "DoImport: no DBData" );
141 Window
* pWaitWin
= rDocShell
.GetActiveDialogParent();
143 pWaitWin
->EnterWait();
144 ScDocShellModificator
aModificator( rDocShell
);
146 bool bSuccess
= false;
147 bool bApi
= false; //! pass as argument
148 bool bTruncated
= false; // for warning
149 sal_uInt16 nErrStringId
= 0;
150 OUString aErrorMessage
;
152 SCCOL nCol
= rParam
.nCol1
;
153 SCROW nRow
= rParam
.nRow1
;
154 SCCOL nEndCol
= nCol
; // end of resulting database area
155 SCROW nEndRow
= nRow
;
158 bool bDoSelection
= false;
159 bool bRealSelection
= false; // sal_True if not everything is selected
160 bool bBookmarkSelection
= false;
161 sal_Int32 nListPos
= 0;
162 sal_Int32 nRowsRead
= 0;
163 sal_Int32 nListCount
= 0;
165 uno::Sequence
<uno::Any
> aSelection
;
166 if ( pDescriptor
&& pDescriptor
->has(svx::daSelection
) )
168 (*pDescriptor
)[svx::daSelection
] >>= aSelection
;
169 nListCount
= aSelection
.getLength();
170 if ( nListCount
> 0 )
173 if ( pDescriptor
->has(svx::daBookmarkSelection
) )
174 bBookmarkSelection
= ScUnoHelpFunctions::GetBoolFromAny( (*pDescriptor
)[svx::daBookmarkSelection
] );
175 if ( bBookmarkSelection
)
177 // From bookmarks, there's no way to detect if all records are selected.
178 // Rely on base to pass no selection in that case.
179 bRealSelection
= true;
184 uno::Reference
<sdbc::XResultSet
> xResultSet
;
185 if ( pDescriptor
&& pDescriptor
->has(svx::daCursor
) )
186 xResultSet
.set((*pDescriptor
)[svx::daCursor
], uno::UNO_QUERY
);
188 // ImportDoc - also used for Redo
189 ScDocument
* pImportDoc
= new ScDocument( SCDOCMODE_UNDO
);
190 pImportDoc
->InitUndo( pDoc
, nTab
, nTab
);
193 // get data from database into import document
199 // only text (title is still needed, for the cancel button)
200 ScProgress
aProgress( &rDocShell
, ScGlobal::GetRscString(STR_UNDO_IMPORTDATA
), 0 );
202 uno::Reference
<sdbc::XRowSet
> xRowSet
= uno::Reference
<sdbc::XRowSet
>(
203 xResultSet
, uno::UNO_QUERY
);
204 bool bDispose
= false;
208 xRowSet
= uno::Reference
<sdbc::XRowSet
>(
209 comphelper::getProcessServiceFactory()->createInstance(
210 OUString( SC_SERVICE_ROWSET
) ),
212 uno::Reference
<beans::XPropertySet
> xRowProp( xRowSet
, uno::UNO_QUERY
);
213 OSL_ENSURE( xRowProp
.is(), "can't get RowSet" );
217 // set source parameters
220 sal_Int32 nType
= rParam
.bSql
? sdb::CommandType::COMMAND
:
221 ( (rParam
.nType
== ScDbQuery
) ? sdb::CommandType::QUERY
:
222 sdb::CommandType::TABLE
);
225 aAny
<<= rParam
.aDBName
;
226 xRowProp
->setPropertyValue(
227 OUString(SC_DBPROP_DATASOURCENAME
), aAny
);
229 aAny
<<= rParam
.aStatement
;
230 xRowProp
->setPropertyValue(
231 OUString(SC_DBPROP_COMMAND
), aAny
);
234 xRowProp
->setPropertyValue(
235 OUString(SC_DBPROP_COMMANDTYPE
), aAny
);
237 uno::Reference
<sdb::XCompletedExecution
> xExecute( xRowSet
, uno::UNO_QUERY
);
240 uno::Reference
<task::XInteractionHandler
> xHandler(
241 task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), 0),
242 uno::UNO_QUERY_THROW
);
243 xExecute
->executeWithCompletion( xHandler
);
252 // get column descriptions
256 uno::Reference
<sdbc::XResultSetMetaData
> xMeta
;
257 uno::Reference
<sdbc::XResultSetMetaDataSupplier
> xMetaSupp( xRowSet
, uno::UNO_QUERY
);
258 if ( xMetaSupp
.is() )
259 xMeta
= xMetaSupp
->getMetaData();
261 nColCount
= xMeta
->getColumnCount(); // this is the number of real columns
263 if ( rParam
.nCol1
+ nColCount
- 1 > MAXCOL
)
269 uno::Reference
<sdbcx::XRowLocate
> xLocate
;
270 if ( bBookmarkSelection
)
272 xLocate
.set( xRowSet
, uno::UNO_QUERY
);
275 SAL_WARN( "sc.ui","can't get XRowLocate");
276 bDoSelection
= bRealSelection
= bBookmarkSelection
= false;
280 uno::Reference
<sdbc::XRow
> xRow( xRowSet
, uno::UNO_QUERY
);
281 if ( nColCount
> 0 && xRow
.is() )
283 nEndCol
= (SCCOL
)( rParam
.nCol1
+ nColCount
- 1 );
285 uno::Sequence
<sal_Int32
> aColTypes( nColCount
); // column types
286 uno::Sequence
<sal_Bool
> aColCurr( nColCount
); // currency flag is not in types
287 sal_Int32
* pTypeArr
= aColTypes
.getArray();
288 sal_Bool
* pCurrArr
= aColCurr
.getArray();
289 for (i
=0; i
<nColCount
; i
++)
291 pTypeArr
[i
] = xMeta
->getColumnType( i
+1 );
292 pCurrArr
[i
] = xMeta
->isCurrency( i
+1 );
295 if ( !bAddrInsert
) // read column names
298 for (i
=0; i
<nColCount
; i
++)
300 pImportDoc
->SetString( nCol
, nRow
, nTab
,
301 xMeta
->getColumnLabel( i
+1 ) );
309 xRowSet
->beforeFirst();
310 sal_uInt16 nInserted
= 0;
313 // skip rows that are not selected
316 if ( !(bEnd
= !xRowSet
->next()) )
321 if (nListPos
< nListCount
)
323 if ( bBookmarkSelection
)
325 bEnd
= !xLocate
->moveToBookmark(aSelection
[nListPos
]);
327 else // use record numbers
329 sal_Int32 nNextRow
= 0;
330 aSelection
[nListPos
] >>= nNextRow
;
331 if ( nRowsRead
+1 < nNextRow
)
332 bRealSelection
= true;
333 bEnd
= !xRowSet
->absolute(nRowsRead
= nNextRow
);
339 if ( !bBookmarkSelection
&& xRowSet
->next() )
340 bRealSelection
= true; // more data available but not used
347 if ( ValidRow(nRow
) )
350 for (i
=0; i
<nColCount
; i
++)
352 ScDatabaseDocUtil::PutData( pImportDoc
, nCol
, nRow
, nTab
,
353 xRow
, i
+1, pTypeArr
[i
], pCurrArr
[i
] );
362 if (!(nInserted
& 15))
364 OUString aPict
= ScGlobal::GetRscString( STR_PROGRESS_IMPORT
);
365 OUString aText
= aPict
.getToken(0,'#');
366 aText
+= OUString::number( nInserted
);
367 aText
+= aPict
.getToken(1,'#');
369 if (!aProgress
.SetStateText( 0, aText
)) // stopped by user?
373 nErrStringId
= STR_DATABASE_ABORTED
;
377 else // past the end of the spreadsheet
379 bEnd
= true; // don't continue
380 bTruncated
= true; // warning flag
389 ::comphelper::disposeComponent( xRowSet
);
392 catch ( const sdbc::SQLException
& rError
)
394 aErrorMessage
= rError
.Message
;
396 catch ( uno::Exception
& )
398 OSL_FAIL("Unexpected exception in database");
402 // test for cell protection
405 bool bKeepFormat
= !bAddrInsert
&& pDBData
->IsKeepFmt();
406 bool bMoveCells
= !bAddrInsert
&& pDBData
->IsDoSize();
407 SCCOL nFormulaCols
= 0; // columns to be filled with formulas
408 if (bMoveCells
&& nEndCol
== rParam
.nCol2
)
410 // if column count changes, formulas would become invalid anyway
411 // -> only set nFormulaCols for unchanged column count
413 SCCOL nTestCol
= rParam
.nCol2
+ 1; // right of the data
414 SCROW nTestRow
= rParam
.nRow1
+ 1; // below the title row
415 while ( nTestCol
<= MAXCOL
&&
416 pDoc
->GetCellType(ScAddress( nTestCol
, nTestRow
, nTab
)) == CELLTYPE_FORMULA
)
417 ++nTestCol
, ++nFormulaCols
;
422 // old and new range editable?
423 ScEditableTester aTester
;
424 aTester
.TestBlock( pDoc
, nTab
, rParam
.nCol1
,rParam
.nRow1
,rParam
.nCol2
,rParam
.nRow2
);
425 aTester
.TestBlock( pDoc
, nTab
, rParam
.nCol1
,rParam
.nRow1
,nEndCol
,nEndRow
);
426 if ( !aTester
.IsEditable() )
428 nErrStringId
= aTester
.GetMessageId();
431 else if ( (pChangeTrack
= pDoc
->GetChangeTrack()) != NULL
)
432 aChangedRange
= ScRange(rParam
.nCol1
, rParam
.nRow1
, nTab
,
433 nEndCol
+nFormulaCols
, nEndRow
, nTab
);
436 if ( bSuccess
&& bMoveCells
)
438 ScRange
aOld( rParam
.nCol1
, rParam
.nRow1
, nTab
,
439 rParam
.nCol2
+nFormulaCols
, rParam
.nRow2
, nTab
);
440 ScRange
aNew( rParam
.nCol1
, rParam
.nRow1
, nTab
,
441 nEndCol
+nFormulaCols
, nEndRow
, nTab
);
442 if (!pDoc
->CanFitBlock( aOld
, aNew
))
444 nErrStringId
= STR_MSSG_DOSUBTOTALS_2
; // can't insert cells
450 // copy data from import doc into real document
457 // keep formatting of title and first data row from the document
458 // CopyToDocument also copies styles, Apply... needs separate calls
460 SCCOL nMinEndCol
= std::min( rParam
.nCol2
, nEndCol
); // not too much
461 nMinEndCol
= sal::static_int_cast
<SCCOL
>( nMinEndCol
+ nFormulaCols
); // only if column count unchanged
462 pImportDoc
->DeleteAreaTab( 0,0, MAXCOL
,MAXROW
, nTab
, IDF_ATTRIB
);
463 pDoc
->CopyToDocument( rParam
.nCol1
, rParam
.nRow1
, nTab
,
464 nMinEndCol
, rParam
.nRow1
, nTab
,
465 IDF_ATTRIB
, false, pImportDoc
);
467 SCROW nDataStartRow
= rParam
.nRow1
+1;
468 for (SCCOL nCopyCol
=rParam
.nCol1
; nCopyCol
<=nMinEndCol
; nCopyCol
++)
470 const ScPatternAttr
* pSrcPattern
= pDoc
->GetPattern(
471 nCopyCol
, nDataStartRow
, nTab
);
472 pImportDoc
->ApplyPatternAreaTab( nCopyCol
, nDataStartRow
, nCopyCol
, nEndRow
,
473 nTab
, *pSrcPattern
);
474 const ScStyleSheet
* pStyle
= pSrcPattern
->GetStyleSheet();
476 pImportDoc
->ApplyStyleAreaTab( nCopyCol
, nDataStartRow
, nCopyCol
, nEndRow
,
481 // don't set cell protection attribute if table is protected
482 if (pDoc
->IsTabProtected(nTab
))
484 ScPatternAttr
aPattern(pImportDoc
->GetPool());
485 aPattern
.GetItemSet().Put( ScProtectionAttr( false,false,false,false ) );
486 pImportDoc
->ApplyPatternAreaTab( 0,0,MAXCOL
,MAXROW
, nTab
, aPattern
);
490 // copy old data for undo
493 SCCOL nUndoEndCol
= std::max( nEndCol
, rParam
.nCol2
); // rParam = old end
494 SCROW nUndoEndRow
= std::max( nEndRow
, rParam
.nRow2
);
496 ScDocument
* pUndoDoc
= NULL
;
497 ScDBData
* pUndoDBData
= NULL
;
500 pUndoDoc
= new ScDocument( SCDOCMODE_UNDO
);
501 pUndoDoc
->InitUndo( pDoc
, nTab
, nTab
);
504 pUndoDBData
= new ScDBData( *pDBData
);
508 aNewMark
.SelectOneTable( nTab
);
512 // do not touch notes (ScUndoImportData does not support drawing undo)
513 sal_uInt16 nCopyFlags
= IDF_ALL
& ~IDF_NOTE
;
515 // nFormulaCols is set only if column count is unchanged
516 pDoc
->CopyToDocument( rParam
.nCol1
, rParam
.nRow1
, nTab
,
517 nEndCol
+nFormulaCols
, nEndRow
, nTab
,
518 nCopyFlags
, false, pUndoDoc
);
519 if ( rParam
.nCol2
> nEndCol
)
520 pDoc
->CopyToDocument( nEndCol
+1, rParam
.nRow1
, nTab
,
521 nUndoEndCol
, nUndoEndRow
, nTab
,
522 nCopyFlags
, false, pUndoDoc
);
523 if ( rParam
.nRow2
> nEndRow
)
524 pDoc
->CopyToDocument( rParam
.nCol1
, nEndRow
+1, nTab
,
525 nUndoEndCol
+nFormulaCols
, nUndoEndRow
, nTab
,
526 nCopyFlags
, false, pUndoDoc
);
535 // clear only the range without the formulas,
536 // so the formula title and first row are preserved
538 ScRange
aDelRange( rParam
.nCol1
, rParam
.nRow1
, nTab
,
539 rParam
.nCol2
, rParam
.nRow2
, nTab
);
540 pDoc
->DeleteAreaTab( aDelRange
, IDF_ALL
& ~IDF_NOTE
); // ohne die Formeln
542 ScRange
aOld( rParam
.nCol1
, rParam
.nRow1
, nTab
,
543 rParam
.nCol2
+nFormulaCols
, rParam
.nRow2
, nTab
);
544 ScRange
aNew( rParam
.nCol1
, rParam
.nRow1
, nTab
,
545 nEndCol
+nFormulaCols
, nEndRow
, nTab
);
546 pDoc
->FitBlock( aOld
, aNew
, false ); // Formeln nicht loeschen
548 else if ( nEndCol
< rParam
.nCol2
) // DeleteArea calls PutInOrder
549 pDoc
->DeleteArea( nEndCol
+1, rParam
.nRow1
, rParam
.nCol2
, rParam
.nRow2
,
550 aNewMark
, IDF_CONTENTS
& ~IDF_NOTE
);
552 // CopyToDocument doesn't remove contents
553 pDoc
->DeleteAreaTab( rParam
.nCol1
, rParam
.nRow1
, nEndCol
, nEndRow
, nTab
, IDF_CONTENTS
& ~IDF_NOTE
);
555 // remove each column from ImportDoc after copying to reduce memory usage
556 bool bOldAutoCalc
= pDoc
->GetAutoCalc();
557 pDoc
->SetAutoCalc( false ); // outside of the loop
558 for (SCCOL nCopyCol
= rParam
.nCol1
; nCopyCol
<= nEndCol
; nCopyCol
++)
560 pImportDoc
->CopyToDocument( nCopyCol
, rParam
.nRow1
, nTab
, nCopyCol
, nEndRow
, nTab
,
561 IDF_ALL
, false, pDoc
);
562 pImportDoc
->DeleteAreaTab( nCopyCol
, rParam
.nRow1
, nCopyCol
, nEndRow
, nTab
, IDF_CONTENTS
);
564 pDoc
->SetAutoCalc( bOldAutoCalc
);
566 if (nFormulaCols
> 0) // copy formulas
568 if (bKeepFormat
) // formats for formulas
569 pImportDoc
->CopyToDocument( nEndCol
+1, rParam
.nRow1
, nTab
,
570 nEndCol
+nFormulaCols
, nEndRow
, nTab
,
571 IDF_ATTRIB
, false, pDoc
);
574 aMark
.SelectOneTable(nTab
);
576 sal_uLong nProgCount
= nFormulaCols
;
577 nProgCount
*= nEndRow
-rParam
.nRow1
-1;
578 ScProgress
aProgress( pDoc
->GetDocumentShell(),
579 ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS
), nProgCount
);
581 pDoc
->Fill( nEndCol
+1, rParam
.nRow1
+1, nEndCol
+nFormulaCols
, rParam
.nRow1
+1,
582 &aProgress
, aMark
, nEndRow
-rParam
.nRow1
-1, FILL_TO_BOTTOM
, FILL_SIMPLE
);
585 // if new range is smaller, clear old contents
587 if (!bMoveCells
) // move has happened above
589 if ( rParam
.nCol2
> nEndCol
)
590 pDoc
->DeleteArea( nEndCol
+1, rParam
.nRow1
, rParam
.nCol2
, rParam
.nRow2
,
591 aNewMark
, IDF_CONTENTS
);
592 if ( rParam
.nRow2
> nEndRow
)
593 pDoc
->DeleteArea( rParam
.nCol1
, nEndRow
+1, rParam
.nCol2
, rParam
.nRow2
,
594 aNewMark
, IDF_CONTENTS
);
597 if( !bAddrInsert
) // update database range
599 pDBData
->SetImportParam( rParam
);
600 pDBData
->SetHeader( true );
601 pDBData
->SetByRow( true );
602 pDBData
->SetArea( nTab
, rParam
.nCol1
,rParam
.nRow1
, nEndCol
,nEndRow
);
603 pDBData
->SetImportSelection( bRealSelection
);
604 pDoc
->CompileDBFormula();
609 ScDocument
* pRedoDoc
= pImportDoc
;
612 if (nFormulaCols
> 0) // include filled formulas for redo
613 pDoc
->CopyToDocument( rParam
.nCol1
, rParam
.nRow1
, nTab
,
614 nEndCol
+nFormulaCols
, nEndRow
, nTab
,
615 IDF_ALL
& ~IDF_NOTE
, false, pRedoDoc
);
617 ScDBData
* pRedoDBData
= pDBData
? new ScDBData( *pDBData
) : NULL
;
619 rDocShell
.GetUndoManager()->AddUndoAction(
620 new ScUndoImportData( &rDocShell
, nTab
,
621 rParam
, nUndoEndCol
, nUndoEndRow
,
623 pUndoDoc
, pRedoDoc
, pUndoDBData
, pRedoDBData
) );
626 sc::SetFormulaDirtyContext aCxt
;
627 pDoc
->SetAllFormulasDirty(aCxt
);
628 rDocShell
.PostPaint(ScRange(0, 0, nTab
, MAXCOL
, MAXROW
, nTab
), PAINT_GRID
);
629 aModificator
.SetDocumentModified();
631 ScDBRangeRefreshedHint
aHint( rParam
);
632 pDoc
->BroadcastUno( aHint
);
635 pWaitWin
->LeaveWait();
637 if ( bTruncated
&& !bApi
) // show warning
638 ErrorHandler::HandleError(SCWARN_IMPORT_RANGE_OVERFLOW
);
643 pWaitWin
->LeaveWait();
645 if (aErrorMessage
.isEmpty())
648 nErrStringId
= STR_MSSG_IMPORTDATA_0
;
649 aErrorMessage
= ScGlobal::GetRscString( nErrStringId
);
651 InfoBox
aInfoBox( rDocShell
.GetActiveDialogParent(), aErrorMessage
);
657 if (bSuccess
&& pChangeTrack
)
658 pChangeTrack
->AppendInsert ( aChangedRange
);
664 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */