--- officecfg/registry/schema/org/openoffice/Office/Calc.xcs 2010-03-26 23:20:58.000000000 +0530 +++ officecfg/registry/schema/org/openoffice/Office/Calc.xcs 2010-03-27 18:25:54.000000000 +0530 @@ -1023,6 +1023,32 @@ Contains the dialogs settings. + + + Contains settings for DBF Import dialog + + + + muthusuba + Charset/Language + + + -1 + + + + + Contains settings for DBF Export dialog + + + + muthusuba + Charset/Language + + + -1 + + Contains setting for Text CSV Import --- sc/source/ui/unoobj/filtuno.cxx 2010-03-27 16:39:55.000000000 +0530 +++ sc/source/ui/unoobj/filtuno.cxx 2010-03-27 18:27:08.000000000 +0530 @@ -55,8 +55,15 @@ #include +#include +#include +#include + + using namespace ::com::sun::star; using ::rtl::OUStringBuffer; +using namespace rtl; +using namespace com::sun::star::uno; //------------------------------------------------------------------------ @@ -70,8 +77,57 @@ SC_SIMPLE_SERVICE_INFO( ScFilterOptionsO #define SC_UNONAME_FILTEROPTIONS "FilterOptions" #define SC_UNONAME_INPUTSTREAM "InputStream" + +#define DBF_CHAR_SET "CharSet" +#define DBF_SEP_PATH_IMPORT "Office.Calc/Dialogs/DBFImport" +#define DBF_SEP_PATH_EXPORT "Office.Calc/Dialogs/DBFExport" + +//------------------------------------------------------------------------ + +static void load_CharSet( rtl_TextEncoding &nCharSet, bool bExport ) +{ + sal_Int32 nChar; + Sequence aValues; + const Any *pProperties; + Sequence aNames(1); + OUString* pNames = aNames.getArray(); + ScLinkConfigItem aItem( OUString::createFromAscii( + bExport?DBF_SEP_PATH_EXPORT:DBF_SEP_PATH_IMPORT ) ); + + pNames[0] = OUString::createFromAscii( DBF_CHAR_SET ); + aValues = aItem.GetProperties( aNames ); + pProperties = aValues.getConstArray(); + + // Default choice + nCharSet = RTL_TEXTENCODING_IBM_850; + + if( pProperties[0].hasValue() ) + { + pProperties[0] >>= nChar; + if( nChar >= 0) + nCharSet = (rtl_TextEncoding) nChar; + } +} + +static void save_CharSet( rtl_TextEncoding nCharSet, bool bExport ) +{ + Sequence aValues; + Any *pProperties; + Sequence aNames(1); + OUString* pNames = aNames.getArray(); + ScLinkConfigItem aItem( OUString::createFromAscii( + bExport?DBF_SEP_PATH_EXPORT:DBF_SEP_PATH_IMPORT ) ); + + pNames[0] = OUString::createFromAscii( DBF_CHAR_SET ); + aValues = aItem.GetProperties( aNames ); + pProperties = aValues.getArray(); + pProperties[0] <<= (sal_Int32) nCharSet; + + aItem.PutProperties(aNames, aValues); +} + //------------------------------------------------------------------------ ScFilterOptionsObj::ScFilterOptionsObj() : bExport( sal_False ) { @@ -251,7 +308,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::e aTitle = ScGlobal::GetRscString( STR_IMPORT_DBF ); } - // common for dBase import/export - eEncoding = RTL_TEXTENCODING_IBM_850; + load_CharSet( eEncoding, bExport ); bDBEnc = sal_True; } else if ( aFilterString == ScDocShell::GetDifFilterName() ) @@ -283,6 +340,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::e if ( pDlg->Execute() == RET_OK ) { pDlg->GetImportOptions( aOptions ); + save_CharSet( aOptions.eCharSet, bExport ); if ( bAscii ) aFilterOptions = aOptions.BuildString(); else