diff --git a/rsc/inc/rscrsc.hxx b/rsc/inc/rscrsc.hxx index d5a768e..9531320 100644 --- a/rsc/inc/rscrsc.hxx +++ b/rsc/inc/rscrsc.hxx @@ -40,11 +40,11 @@ class RscCmdLine public: - RscStrList aInputList; // Liste der Quelldateien - OString aPath; // Liste der Pfade + RscStrList aInputList; // List of source files + OString aPath; // List of paths RSCBYTEORDER_TYPE nByteOrder; - unsigned short nCommands; // Steuerbits - OString aOutputSrs; // Name der Srs-Ausgabedatei + unsigned short nCommands; // control bits + OString aOutputSrs; // Name of the Srs output file OString aILDir; struct OutputFile @@ -86,10 +86,10 @@ private: const OUString& rSrsOutPath ); public: - RscTypCont* pTC; // String und Id-Verwalter - RscCmdLine* pCL; // Kommandozeile - FILE * fListing; // Ausgabedatei fuer Listings - FILE * fExitFile; // bei Abbruch muss diese Datei geschlossen werden + RscTypCont* pTC; // String and Id manager + RscCmdLine* pCL; // Command line + FILE * fListing; // Output file for listings + FILE * fExitFile; // in case of abortion this file must be closed RscCompiler( RscCmdLine *, RscTypCont * ); ~RscCompiler(); diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx index f15472c..6dea25d 100644 --- a/rsc/source/prj/start.cxx +++ b/rsc/source/prj/start.cxx @@ -50,8 +50,8 @@ static sal_Bool CallPrePro( const OString& rInput, const OString& rOutput, RscPtrPtr * pCmdLine, sal_Bool bResponse ) { - RscPtrPtr aNewCmdL; // Kommandozeile - RscPtrPtr aRespCmdL; // Kommandozeile + RscPtrPtr aNewCmdL; // Command line + RscPtrPtr aRespCmdL; // Command line RscPtrPtr * pCmdL = &aNewCmdL; int i, nRet; FILE* fRspFile = NULL; @@ -216,7 +216,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) RscStrList aTmpList; char * pStr; char ** ppStr; - RscPtrPtr aCmdLine; // Kommandozeile + RscPtrPtr aCmdLine; // Command line sal_uInt32 i; OString* pString; @@ -260,7 +260,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) } else { - // Eingabedatei + // Input file aInputList.push_back( new OString(*ppStr) ); } ppStr++; diff --git a/rsc/source/rscpp/cpp3.c b/rsc/source/rscpp/cpp3.c index df5a2c7..baa6b98 100644 --- a/rsc/source/rscpp/cpp3.c +++ b/rsc/source/rscpp/cpp3.c @@ -29,7 +29,7 @@ #include #ifndef _NO_PROTO -int AddInclude( char *pIncStr ); /* BP, 11.09.91, Forward-Deklaration */ +int AddInclude( char *pIncStr ); /* BP, 11.09.91, Forward declaration */ #endif #if (OSL_DEBUG_LEVEL > 1) && (HOST == SYS_VMS || HOST == SYS_UNIX) @@ -146,15 +146,15 @@ void setincdirs() #if HOST == SYS_UNKNOWN /* - * Kontext: GenMake - * Unter DOS wird nun auch die Environment-Variable INCLUDE ausgewetet. - * Es kommt erschwerend hinzu, dass alle Eintraege, die mit ';' getrennt - * sind, mit in die Liste aufenommen werden muessen. - * Dies wird mit der Funktion strtok() realisiert. - * Vorsicht bei der Benutzung von malloc !!! - * In savestring wird naemlich getmem() verwendet. Vermutlich kommen sich - * die beiden Funktion in die Quere. Als ich malloc statt savestring - * verwendete knallte es in strcpy() ! + * Context: GenMake + * Under DOS the environment variable INCLUDE is now also analysed. + * To make things more complicated, all entries that are separated by ';', + * have to be added to the list. + * This is realised by function strtok(). + * Be careful when using malloc !!! + * In savestring is getmem() used. Probably these two functions get in + * the way of each other. When I used malloc instead of savestring it crashed + * in strcpy() ! */ #if !defined( WNT ) && ! defined UNX @@ -171,18 +171,17 @@ void setincdirs() } -/* Kontext: Erweiterung des INCLUDE-Services - * Bislang konnte der cpp keine Include-Angaben in der Kommandozeile - * vertragen, bei denen die directries mit ';' getrennt wurden. - * Dies ist auch verstaendlich, da dieses cpp fuer UNIX-Systeme - * massgeschneidert wurde und in UNI die ';' als Zeichen zum Abschluss - * von Kommandos gilt. - */ +/* + * Context: Enhancement of the INCLUDE service + * Up to now the cpp could not handle include parameters on the command line, + * where the directories were not separated by ';'. + * This is understandable, because that cpp was custom-made for UNIX systems + * and in UNI the ';' characters count as end of a command. int AddInclude( char* pIncStr ) { - char *pIncEnv = NULL; /* Kopie des INCLUDE */ - char *pIncPos; /* wandert zum naechsten */ + char *pIncEnv = NULL; /* Copy of the INCLUDE */ + char *pIncPos; /* goes to the next one */ pIncEnv = savestring( pIncStr ); pIncPos = strtok( pIncEnv, ";" ); diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx index 2a195ad..92ed469 100644 --- a/sc/source/ui/dbgui/asciiopt.cxx +++ b/sc/source/ui/dbgui/asciiopt.cxx @@ -179,10 +179,9 @@ sal_Bool ScAsciiOptions::operator==( const ScAsciiOptions& rCmp ) const return false; } -// -// Der Options-String darf kein Semikolon mehr enthalten (wegen Pickliste) -// darum ab Version 336 Komma stattdessen -// +/* The Options string must not contain a semicolon (due to the pick list). + * Therefor a comma instead from version 336 on. + */ void ScAsciiOptions::ReadFromString( const String& rString ) @@ -192,9 +191,9 @@ void ScAsciiOptions::ReadFromString( const String& rString ) xub_StrLen nSub; xub_StrLen i; - // - // Feld-Trenner - // + /* + * field separator + */ if ( nCount >= 1 ) { @@ -219,9 +218,9 @@ void ScAsciiOptions::ReadFromString( const String& rString ) } } - // - // Text-Trenner - // + /* + * text separator + */ if ( nCount >= 2 ) { @@ -230,9 +229,9 @@ void ScAsciiOptions::ReadFromString( const String& rString ) cTextSep = (sal_Unicode) nVal; } - // - // Zeichensatz - // + /* + * character set + */ if ( nCount >= 3 ) { @@ -240,9 +239,9 @@ void ScAsciiOptions::ReadFromString( const String& rString ) eCharSet = ScGlobal::GetCharsetValue( aToken ); } - // - // Startzeile - // + /* + * start line + */ if ( nCount >= 4 ) { @@ -250,9 +249,9 @@ void ScAsciiOptions::ReadFromString( const String& rString ) nStartRow = aToken.ToInt32(); } - // - // Spalten-Infos - // + /* + * column information + */ if ( nCount >= 5 ) { @@ -311,9 +310,9 @@ String ScAsciiOptions::WriteToString() const { OUString aOutStr; - // - // Feld-Trenner - // + /* + * field separator + */ if ( bFixedLen ) aOutStr += pStrFix; @@ -336,24 +335,24 @@ String ScAsciiOptions::WriteToString() const } aOutStr += "," + - // Text-Trenner + // text separator OUString::number(cTextSep) + ","; - // - // Zeichensatz - // + /* + * character set + */ if ( bCharSetSystem ) // force "SYSTEM" aOutStr += ScGlobal::GetCharsetString( RTL_TEXTENCODING_DONTKNOW ); else aOutStr += ScGlobal::GetCharsetString( eCharSet ); aOutStr += "," + - // Startzeile + // start line OUString::number(nStartRow) + ","; - // - // Spalten-Infos - // + /* + * column information + */ OSL_ENSURE( !nInfoCount || (pColStart && pColFormat), "0-Zeiger in ScAsciiOptions" ); for (sal_uInt16 nInfo=0; nInfo& _rDrvMgr,uno::Reference& _rConnection,String& _rTabName,const String& rFullFileName,rtl_TextEncoding eCharSet) + sal_uLong lcl_getDBaseConnection(uno::Reference& _rDrvMgr, + uno::Reference& _rConnection,String& _rTabName, + const String& rFullFileName, + rtl_TextEncoding eCharSet) { INetURLObject aURL; aURL.SetSmartProtocol( INET_PROT_FILE ); @@ -133,7 +136,8 @@ namespace } // if ( aIter == aMap.end() ) OUString aCharSetStr; if ( RTL_TEXTENCODING_DONTKNOW != *aIter ) - { // it's not the virtual "system charset" + { + // it's not the virtual "system charset" const char* pIanaName = rtl_getMimeCharsetFromTextEncoding( *aIter ); OSL_ENSURE( pIanaName, "invalid mime name!" ); if ( pIanaName ) @@ -254,13 +258,17 @@ static void lcl_setScalesToColumns(ScDocument& rDoc, const vector& rScales for (SCCOL i = 0; i < nColCount; ++i) { if (rScales[i] < 0) + { continue; + } sal_uInt32 nOldFormat; rDoc.GetNumberFormat(static_cast(i), 0, 0, nOldFormat); const SvNumberformat* pOldEntry = pFormatter->GetEntry(nOldFormat); if (!pOldEntry) + { continue; + } LanguageType eLang = pOldEntry->GetLanguage(); bool bThousand, bNegRed; @@ -269,7 +277,8 @@ static void lcl_setScalesToColumns(ScDocument& rDoc, const vector& rScales nPrecision = static_cast(rScales[i]); OUString aNewPicture = pFormatter->GenerateFormat(nOldFormat, eLang, - bThousand, bNegRed, nPrecision, nLeading); + bThousand, bNegRed, + nPrecision, nLeading); sal_uInt32 nNewFormat = pFormatter->GetEntryKey(aNewPicture, eLang); if (nNewFormat == NUMBERFORMAT_ENTRY_NOT_FOUND) @@ -280,20 +289,24 @@ static void lcl_setScalesToColumns(ScDocument& rDoc, const vector& rScales aNewPicture, nErrPos, nNewType, nNewFormat, eLang); if (!bOk) + { continue; + } } ScPatternAttr aNewAttrs( rDoc.GetPool() ); SfxItemSet& rSet = aNewAttrs.GetItemSet(); rSet.Put( SfxUInt32Item(ATTR_VALUE_FORMAT, nNewFormat) ); - rDoc.ApplyPatternAreaTab(static_cast(i), 0, static_cast(i), MAXROW, 0, aNewAttrs); + rDoc.ApplyPatternAreaTab(static_cast(i), 0, static_cast(i), + MAXROW, 0, aNewAttrs); } } #endif // !DISABLE_DBCONNECTIVITY sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet, - ScColWidthParam aColWidthParam[MAXCOLCOUNT], ScFlatBoolRowSegments& rRowHeightsRecalc ) + ScColWidthParam aColWidthParam[MAXCOLCOUNT], + ScFlatBoolRowSegments& rRowHeightsRecalc ) { #ifdef DISABLE_DBCONNECTIVITY (void) rFullFileName; @@ -317,9 +330,12 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet String aTabName; uno::Reference xDrvMan; uno::Reference xConnection; - sal_uLong nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName,rFullFileName,eCharSet); + sal_uLong nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName, + rFullFileName,eCharSet); if ( !xConnection.is() || !xDrvMan.is() ) + { return nRet; + } ::utl::DisposableComponent aConnectionHelper(xConnection); ScProgress aProgress( this, ScGlobal::GetRscString( STR_LOAD_DOC ), 0 ); @@ -524,8 +540,8 @@ void lcl_GetColumnTypes( sal_Int32 nDbType = sdbc::DataType::SQLNULL; String aFieldName, aString; - // Feldname[,Type[,Width[,Prec]]] - // Typ etc.: L; D; C[,W]; N[,W[,P]] + // field name[,Type[,Width[,Prec]]] + // type etc.: L; D; C[,W]; N[,W[,P]] if ( bHasFieldNames ) { aString = pDoc->GetString(nCol, nFirstRow, nTab); @@ -582,28 +598,39 @@ void lcl_GetColumnTypes( else aFieldName = aString; - // Feldnamen pruefen und ggbf. gueltigen Feldnamen erzeugen. - // Erstes Zeichen muss Buchstabe sein, - // weitere nur alphanumerisch und Unterstrich erlaubt, - // "_DBASELOCK" ist reserviert (obsolet weil erstes Zeichen kein Buchstabe), - // keine doppelten Namen. + /* + * Check field name and if necessary create valid field name. + * First sign has to be a character, + * further only alpha-numeric and underscore allowed, + * "_DBASELOCK" is reserved (obsoled, because first sign is no character), + * no double names. + */ if ( !IsAsciiAlpha( aFieldName.GetChar(0) ) ) + { aFieldName.Insert( 'N', 0 ); + } String aTmpStr; sal_Unicode c; for ( const sal_Unicode* p = aFieldName.GetBuffer(); ( c = *p ) != 0; p++ ) { if ( IsAsciiAlpha( c ) || IsAsciiDigit( c ) || c == '_' ) + { aTmpStr += c; + } else + { aTmpStr += '_'; + } } aFieldName = aTmpStr; if ( aFieldName.Len() > 10 ) + { aFieldName.Erase( 10 ); + } if (!aFieldNames.insert(aFieldName).second) - { // doppelter Feldname, numerisch erweitern + { + // double field name, enhance numeric sal_uInt16 nSub = 1; String aFixPart( aFieldName ); do @@ -611,7 +638,9 @@ void lcl_GetColumnTypes( ++nSub; String aVarPart = OUString::number( nSub ); if ( aFixPart.Len() + aVarPart.Len() > 10 ) + { aFixPart.Erase( 10 - aVarPart.Len() ); + } aFieldName = aFixPart; aFieldName += aVarPart; } while (!aFieldNames.insert(aFieldName).second); @@ -624,11 +653,14 @@ void lcl_GetColumnTypes( } if ( !bTypeDefined ) - { // Feldtyp + { + // field type ScRefCellValue aCell; aCell.assign(*pDoc, ScAddress(nCol, nFirstDataRow, nTab)); if (aCell.isEmpty() || aCell.hasString()) + { nDbType = sdbc::DataType::VARCHAR; + } else { sal_uInt32 nFormat; @@ -660,48 +692,71 @@ void lcl_GetColumnTypes( } bool bSdbLenAdjusted = false; bool bSdbLenBad = false; - // Feldlaenge + // field length if ( nDbType == sdbc::DataType::VARCHAR && !nFieldLen ) - { // maximale Feldbreite bestimmen + { + // determine maximum field width nFieldLen = pDoc->GetMaxStringLen( nTab, nCol, nFirstDataRow, nLastRow, eCharSet ); if ( nFieldLen == 0 ) nFieldLen = 1; } else if ( nDbType == sdbc::DataType::DECIMAL ) - { // maximale Feldbreite und Nachkommastellen bestimmen + { + // determine maximum field with and positions after decimal point. xub_StrLen nLen; sal_uInt16 nPrec; nLen = pDoc->GetMaxNumberStringLen( nPrec, nTab, nCol, nFirstDataRow, nLastRow ); - // dBaseIII Limit Nachkommastellen: 15 + // dBaseIII limit points after decimal point: 15 if ( nPrecision > 15 ) + { nPrecision = 15; + } if ( nPrec > 15 ) + { nPrec = 15; + } if ( bPrecDefined && nPrecision != nPrec ) - { // Laenge auf vorgegebene Nachkommastellen anpassen + { + // Adjust length to given positions after decimal point. if ( nPrecision ) + { nLen = sal::static_int_cast( nLen + ( nPrecision - nPrec ) ); + } else - nLen -= nPrec+1; // auch den . mit raus + { + nLen -= nPrec+1; // also remove the dot '.' + } } if ( nLen > nFieldLen && !bTypeDefined ) + { nFieldLen = nLen; + } if ( !bPrecDefined ) + { nPrecision = nPrec; + } if ( nFieldLen == 0 ) + { nFieldLen = 1; + } else if ( nFieldLen > 19 ) - nFieldLen = 19; // dBaseIII Limit Feldlaenge numerisch: 19 + { + nFieldLen = 19; // dBaseIII limit field length numeric: 19 + } if ( nPrecision && nFieldLen < nPrecision + 2 ) - nFieldLen = nPrecision + 2; // 0. muss mit reinpassen + { + nFieldLen = nPrecision + 2; // 0. has to fit in + } // 538 MUST: Sdb internal representation adds 2 to the field length! // To give the user what he wants we must substract it here. //! CAVEAT! There is no way to define a numeric field with a length //! of 1 and no decimals! if ( nFieldLen == 1 && nPrecision == 0 ) + { bSdbLenBad = sal_True; + } nFieldLen = SvDbaseConverter::ConvertPrecisionToOdbc( nFieldLen, nPrecision ); bSdbLenAdjusted = sal_True; } @@ -714,7 +769,9 @@ void lcl_GetColumnTypes( bHasMemo = sal_True; } else - nFieldLen = 254; // dumm gelaufen.. + { + nFieldLen = 254; // shit happens ... + } } pColNames[nField] = aFieldName; @@ -730,7 +787,7 @@ void lcl_GetColumnTypes( nFieldLen = 2; // THIS is reality } if ( bUpdateTitles ) - { // Angabe anpassen und ausgeben + { // Adjust declaration and display OUString aOutString = aFieldName; switch ( nDbType ) { @@ -765,7 +822,9 @@ inline void lcl_getLongVarCharEditString( OUString& rString, const ScRefCellValue& rCell, ScFieldEditEngine& rEditEngine ) { if (!rCell.mpEditText) + { return; + } rEditEngine.SetText(*rCell.mpEditText); rString = rEditEngine.GetText( LINEEND_CRLF ); @@ -806,16 +865,21 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS aDocument.GetDataStart( nTab, nFirstCol, nFirstRow ); aDocument.GetCellArea( nTab, nLastCol, nLastRow ); if ( nFirstCol > nLastCol ) + { nFirstCol = nLastCol; + } if ( nFirstRow > nLastRow ) + { nFirstRow = nLastRow; + } ScProgress aProgress( this, ScGlobal::GetRscString( STR_SAVE_DOC ), nLastRow - nFirstRow ); SvNumberFormatter* pNumFmt = aDocument.GetFormatTable(); sal_Bool bHasFieldNames = sal_True; for ( SCCOL nDocCol = nFirstCol; nDocCol <= nLastCol && bHasFieldNames; nDocCol++ ) - { // nur Strings in erster Zeile => sind Feldnamen + { + // Only strings in first line => these are fieldnames. if ( !aDocument.HasStringData( nDocCol, nFirstRow, nTab ) ) bHasFieldNames = false; } @@ -850,28 +914,45 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS uno::Reference< sdbc::XDriverAccess> xAccess(xDrvMan,uno::UNO_QUERY); uno::Reference< sdbcx::XDataDefinitionSupplier > xDDSup( xAccess->getDriverByURL( xConnection->getMetaData()->getURL() ), uno::UNO_QUERY ); if ( !xDDSup.is() ) + { return SCERR_EXPORT_CONNECT; + } // create table uno::Reference xTablesSupp =xDDSup->getDataDefinitionByConnection( xConnection ); OSL_ENSURE( xTablesSupp.is(), "can't get Data Definition" ); - if (!xTablesSupp.is()) return SCERR_EXPORT_CONNECT; + if (!xTablesSupp.is()) + { + return SCERR_EXPORT_CONNECT; + } uno::Reference xTables = xTablesSupp->getTables(); OSL_ENSURE( xTables.is(), "can't get Tables" ); - if (!xTables.is()) return SCERR_EXPORT_CONNECT; + if (!xTables.is()) + { + return SCERR_EXPORT_CONNECT; + } uno::Reference xTablesFact( xTables, uno::UNO_QUERY ); OSL_ENSURE( xTablesFact.is(), "can't get tables factory" ); - if (!xTablesFact.is()) return SCERR_EXPORT_CONNECT; + if (!xTablesFact.is()) + { + return SCERR_EXPORT_CONNECT; + } uno::Reference xTablesAppend( xTables, uno::UNO_QUERY ); OSL_ENSURE( xTablesAppend.is(), "can't get tables XAppend" ); - if (!xTablesAppend.is()) return SCERR_EXPORT_CONNECT; + if (!xTablesAppend.is()) + { + return SCERR_EXPORT_CONNECT; + } uno::Reference xTableDesc = xTablesFact->createDataDescriptor(); OSL_ENSURE( xTableDesc.is(), "can't get table descriptor" ); - if (!xTableDesc.is()) return SCERR_EXPORT_CONNECT; + if (!xTableDesc.is()) + { + return SCERR_EXPORT_CONNECT; + } aAny <<= OUString( aTabName ); xTableDesc->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM(SC_DBPROP_NAME)), aAny ); @@ -880,19 +961,31 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS uno::Reference xColumnsSupp( xTableDesc, uno::UNO_QUERY ); OSL_ENSURE( xColumnsSupp.is(), "can't get columns supplier" ); - if (!xColumnsSupp.is()) return SCERR_EXPORT_CONNECT; + if (!xColumnsSupp.is()) + { + return SCERR_EXPORT_CONNECT; + } uno::Reference xColumns = xColumnsSupp->getColumns(); OSL_ENSURE( xColumns.is(), "can't get columns" ); - if (!xColumns.is()) return SCERR_EXPORT_CONNECT; + if (!xColumns.is()) + { + return SCERR_EXPORT_CONNECT; + } uno::Reference xColumnsFact( xColumns, uno::UNO_QUERY ); OSL_ENSURE( xColumnsFact.is(), "can't get columns factory" ); - if (!xColumnsFact.is()) return SCERR_EXPORT_CONNECT; + if (!xColumnsFact.is()) + { + return SCERR_EXPORT_CONNECT; + } uno::Reference xColumnsAppend( xColumns, uno::UNO_QUERY ); OSL_ENSURE( xColumnsAppend.is(), "can't get columns XAppend" ); - if (!xColumnsAppend.is()) return SCERR_EXPORT_CONNECT; + if (!xColumnsAppend.is()) + { + return SCERR_EXPORT_CONNECT; + } const OUString* pColNames = aColNames.getConstArray(); const sal_Int32* pColTypes = aColTypes.getConstArray(); @@ -904,7 +997,10 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS { uno::Reference xColumnDesc = xColumnsFact->createDataDescriptor(); OSL_ENSURE( xColumnDesc.is(), "can't get column descriptor" ); - if (!xColumnDesc.is()) return SCERR_EXPORT_CONNECT; + if (!xColumnDesc.is()) + { + return SCERR_EXPORT_CONNECT; + } aAny <<= pColNames[nCol]; xColumnDesc->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM(SC_DBPROP_NAME)), aAny ); @@ -931,7 +1027,10 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS ::utl::DisposableComponent aRowSetHelper(xRowSet); uno::Reference xRowProp( xRowSet, uno::UNO_QUERY ); OSL_ENSURE( xRowProp.is(), "can't get RowSet" ); - if (!xRowProp.is()) return SCERR_EXPORT_CONNECT; + if (!xRowProp.is()) + { + return SCERR_EXPORT_CONNECT; + } aAny <<= xConnection; xRowProp->setPropertyValue( @@ -951,12 +1050,18 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS uno::Reference xResultUpdate( xRowSet, uno::UNO_QUERY ); OSL_ENSURE( xResultUpdate.is(), "can't get XResultSetUpdate" ); - if (!xResultUpdate.is()) return SCERR_EXPORT_CONNECT; + if (!xResultUpdate.is()) + { + return SCERR_EXPORT_CONNECT; + } uno::Reference xRowUpdate( xRowSet, uno::UNO_QUERY ); OSL_ENSURE( xRowUpdate.is(), "can't get XRowUpdate" ); - if (!xRowUpdate.is()) return SCERR_EXPORT_CONNECT; + if (!xRowUpdate.is()) + { + return SCERR_EXPORT_CONNECT; + } SCROW nFirstDataRow = ( bHasFieldNames ? nFirstRow + 1 : nFirstRow ); double fVal; @@ -977,7 +1082,7 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS if (!aCell.isEmpty()) { if (aCell.meType == CELLTYPE_EDIT) - { // Paragraphs erhalten + { // get paragraphs lcl_getLongVarCharEditString(aString, aCell, aEditEngine); } else @@ -988,7 +1093,9 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS xRowUpdate->updateString( nCol+1, aString ); } else + { xRowUpdate->updateNull( nCol+1 ); + } } break; @@ -996,22 +1103,30 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS aString = aDocument.GetString(nDocCol, nDocRow, nTab); xRowUpdate->updateString( nCol+1, aString ); if ( nErr == eERR_OK && pColLengths[nCol] < aString.getLength() ) + { nErr = SCWARN_EXPORT_DATALOST; + } break; case sdbc::DataType::DATE: { aDocument.GetValue( nDocCol, nDocRow, nTab, fVal ); - // zwischen 0 Wert und 0 kein Wert unterscheiden + // differ between 0 value and 0 no value sal_Bool bIsNull = (fVal == 0.0); if ( bIsNull ) - bIsNull = !aDocument.HasValueData( nDocCol, nDocRow, nTab ); + { + bIsNull = !aDocument.HasValueData( nDocCol, + nDocRow, nTab); + } if ( bIsNull ) { xRowUpdate->updateNull( nCol+1 ); if ( nErr == eERR_OK && - aDocument.HasStringData( nDocCol, nDocRow, nTab ) ) + aDocument.HasStringData( nDocCol, + nDocRow, nTab )) + { nErr = SCWARN_EXPORT_DATALOST; + } } else { @@ -1027,18 +1142,27 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS case sdbc::DataType::BIT: aDocument.GetValue( nDocCol, nDocRow, nTab, fVal ); if ( fVal == 0.0 && nErr == eERR_OK && - aDocument.HasStringData( nDocCol, nDocRow, nTab ) ) + aDocument.HasStringData( nDocCol, + nDocRow, nTab )) + { nErr = SCWARN_EXPORT_DATALOST; + } if ( pColTypes[nCol] == sdbc::DataType::BIT ) + { xRowUpdate->updateBoolean( nCol+1, ( fVal != 0.0 ) ); + } else + { xRowUpdate->updateDouble( nCol+1, fVal ); + } break; default: OSL_FAIL( "ScDocShell::DBaseExport: unknown FieldType" ); if ( nErr == eERR_OK ) + { nErr = SCWARN_EXPORT_DATALOST; + } aDocument.GetValue( nDocCol, nDocRow, nTab, fVal ); xRowUpdate->updateDouble( nCol+1, fVal ); } @@ -1050,7 +1174,8 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS //! ScDocShell::SbaSdbExport is still missing! if ( !aProgress.SetStateOnPercent( nDocRow - nFirstRow ) ) - { // UserBreak + { + // UserBreak nErr = SCERR_EXPORT_DATA; break; } @@ -1092,10 +1217,14 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS if (pCell->meType != CELLTYPE_NOTE) { if (pCell->meType == CELLTYPE_EDIT) + { lcl_getLongVarCharEditString(aString, *pCell, aEditEngine); + } else + { lcl_getLongVarCharString( aString, aDocument, nDocCol, nDocRow, nTab, *pNumFmt); + } } } break; @@ -1128,8 +1257,10 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS nLen = aOString.getLength(); #if OSL_DEBUG_LEVEL > 1 if (!bTest) + { fprintf( stderr, "ScDocShell::DBaseExport encoding error, string with default replacements: ``%s''\n", OUStringToOString( aOUString, eCharSet).getStr()); + } #endif } else @@ -1146,7 +1277,9 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS } } else + { bTest = true; + } } String sPosition( ScAddress( nDocCol, nDocRow, nTab).GetColRowString()); String sEncoding( SvxTextEncodingTable().GetTextString( eCharSet)); @@ -1155,9 +1288,13 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, CharSet eCharS ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR); } else if ( !aException.Message.isEmpty() ) + { nErr = *new StringErrorInfo( (SCERR_EXPORT_SQLEXCEPTION), aException.Message, ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR); + } else + { nErr = SCERR_EXPORT_DATA; + } } catch ( uno::Exception& ) { diff --git a/sc/source/ui/miscdlgs/mtrindlg.cxx b/sc/source/ui/miscdlgs/mtrindlg.cxx index 0829670..7ff8c68 100644 --- a/sc/source/ui/miscdlgs/mtrindlg.cxx +++ b/sc/source/ui/miscdlgs/mtrindlg.cxx @@ -85,7 +85,7 @@ ScMetricInputDlg::~ScMetricInputDlg() long ScMetricInputDlg::GetInputValue( FieldUnit eUnit ) const { /* - mit Nachkommastellen: + with positions after decimal point: double nVal = aEdValue.GetValue( eUnit ); sal_uInt16 nDecs = aEdValue.GetDecimalDigits(); @@ -101,7 +101,7 @@ long ScMetricInputDlg::GetInputValue( FieldUnit eUnit ) const return nVal / nFactor; */ - // erstmal Nachkommastellen abschneiden - nich so doll... + // at first cutting of the positions after the decimal point - not that good... return sal::static_int_cast( aEdValue.Denormalize( aEdValue.GetValue( eUnit ) ) ); }