diff options
author | Eike Rathke <erack@redhat.com> | 2011-11-27 23:50:10 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2011-11-28 15:25:30 +0100 |
commit | f62028b2fa9906a14dff577255ebceb70829f092 (patch) | |
tree | 2b933b7ae1b547eee6e85a7e7b0fa57b7da0b803 /sc/source/ui | |
parent | 40f38c8c9813568dfbd91e9ea97be16b69cf702a (diff) |
dr78: #i115951# set ScColumn::bDoubleAlloc in DBaseImport
# HG changeset patch
# User Niklas Nebel <nn@openoffice.org>
# Date 1291736714 -3600
# Node ID c1cd4ae7c46490b2f199afd9c889f138ffa06a9e
# Parent d7e6b1b9f73647c4be281748bc9d68a8773d1056
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/docshell/docsh8.cxx | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index c1f69d285d17..5529579f297b 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -307,6 +307,7 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet sal_uLong nErr = eERR_OK; long i; + long nColCount = 0; try { @@ -318,14 +319,7 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet return nRet; ::utl::DisposableComponent aConnectionHelper(xConnection); - long nRowCount = 0; - if ( nRowCount < 0 ) - { - OSL_FAIL("can't get row count"); - nRowCount = 0; - } - - ScProgress aProgress( this, ScGlobal::GetRscString( STR_LOAD_DOC ), nRowCount ); + ScProgress aProgress( this, ScGlobal::GetRscString( STR_LOAD_DOC ), 0 ); uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory(); uno::Reference<sdbc::XRowSet> xRowSet( xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_SERVICE_ROWSET )) ), @@ -356,7 +350,6 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet xRowSet->execute(); - long nColCount = 0; uno::Reference<sdbc::XResultSetMetaData> xMeta; uno::Reference<sdbc::XResultSetMetaDataSupplier> xMetaSupp( xRowSet, uno::UNO_QUERY ); if ( xMetaSupp.is() ) @@ -370,10 +363,6 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet nErr = SCWARN_IMPORT_RANGE_OVERFLOW; // warning } - if ( nColCount > 0 ) - aDocument.DoColResize( 0, 0, static_cast<SCCOL>(nColCount) - 1, - static_cast<SCSIZE>(nRowCount) + 1 ); - uno::Reference<sdbc::XRow> xRow( xRowSet, uno::UNO_QUERY ); OSL_ENSURE( xRow.is(), "can't get Row" ); if (!xRow.is()) return SCERR_IMPORT_CONNECT; @@ -387,6 +376,9 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet // read column names //! add type descriptions + aProgress.SetState( 0 ); + ScColumn::bDoubleAlloc = true; // row count isn't readily available in advance + vector<long> aScales(nColCount, -1); for (i=0; i<nColCount; i++) { @@ -465,9 +457,6 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet bEnd = sal_True; // don't continue nErr = SCWARN_IMPORT_RANGE_OVERFLOW; // warning message } - - if ( nRowCount ) - aProgress.SetStateOnPercent( nRow ); } } catch ( sdbc::SQLException& ) @@ -480,6 +469,10 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet nErr = ERRCODE_IO_GENERAL; } + ScColumn::bDoubleAlloc = false; + if ( nColCount > 0 ) + aDocument.DoColResize( 0, 0, static_cast<SCCOL>(nColCount) - 1, 0 ); + return nErr; } |