Kaydet (Commit) f62028b2 authored tarafından Eike Rathke's avatar Eike Rathke

dr78: #i115951# set ScColumn::bDoubleAlloc in DBaseImport

# HG changeset patch
# User Niklas Nebel <nn@openoffice.org>
# Date 1291736714 -3600
# Node ID c1cd4ae7c46490b2f199afd9c889f138ffa06a9e
# Parent  d7e6b1b9f73647c4be281748bc9d68a8773d1056
üst 40f38c8c
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment