summaryrefslogtreecommitdiff
path: root/sc/source/ui/dbgui/scuiasciiopt.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/dbgui/scuiasciiopt.cxx')
-rw-r--r--sc/source/ui/dbgui/scuiasciiopt.cxx67
1 files changed, 40 insertions, 27 deletions
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index abbda7b995e7..2cf981a15ff3 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -273,7 +273,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
OUString sTextSeparators;
bool bMergeDelimiters = false;
bool bFixedWidth = false;
- bool bQuotedFieldAsText = true;
+ bool bQuotedFieldAsText = false;
bool bDetectSpecialNum = false;
sal_Int32 nFromRow = 1;
sal_Int32 nCharSet = -1;
@@ -316,34 +316,45 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
maFieldSeparators = GetSeparators();
// Clipboard is always Unicode, else detect.
- bool bPreselectUnicode = !mbFileImport;
+ rtl_TextEncoding ePreselectUnicode = (mbFileImport ?
+ RTL_TEXTENCODING_DONTKNOW : RTL_TEXTENCODING_UNICODE);
// Sniff for Unicode / not
- if( !bPreselectUnicode && mpDatStream )
+ if( ePreselectUnicode == RTL_TEXTENCODING_DONTKNOW && mpDatStream )
{
Seek( 0 );
- mpDatStream->StartReadingUnicodeText();
+ mpDatStream->StartReadingUnicodeText( RTL_TEXTENCODING_DONTKNOW );
sal_uLong nUniPos = mpDatStream->Tell();
- if ( nUniPos > 0 )
- bPreselectUnicode = sal_True; // read 0xfeff/0xfffe
- else
+ switch (nUniPos)
{
- sal_uInt16 n;
- *mpDatStream >> n;
- // Assume that normal ASCII/ANSI/ISO/etc. text doesn't start with
- // control characters except CR,LF,TAB
- if ( (n & 0xff00) < 0x2000 )
- {
- switch ( n & 0xff00 )
+ case 2:
+ ePreselectUnicode = RTL_TEXTENCODING_UNICODE; // UTF-16
+ break;
+ case 3:
+ ePreselectUnicode = RTL_TEXTENCODING_UTF8; // UTF-8
+ break;
+ case 0:
{
- case 0x0900 :
- case 0x0a00 :
- case 0x0d00 :
- break;
- default:
- bPreselectUnicode = sal_True;
+ sal_uInt16 n;
+ *mpDatStream >> n;
+ // Assume that normal ASCII/ANSI/ISO/etc. text doesn't start with
+ // control characters except CR,LF,TAB
+ if ( (n & 0xff00) < 0x2000 )
+ {
+ switch ( n & 0xff00 )
+ {
+ case 0x0900 :
+ case 0x0a00 :
+ case 0x0d00 :
+ break;
+ default:
+ ePreselectUnicode = RTL_TEXTENCODING_UNICODE; // UTF-16
+ }
+ }
+ mpDatStream->Seek(0);
}
- }
- mpDatStream->Seek(0);
+ break;
+ default:
+ ; // nothing
}
mnStreamPos = mpDatStream->Tell();
}
@@ -373,10 +384,10 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
// Insert one "SYSTEM" entry for compatibility in AsciiOptions and system
// independent document linkage.
aLbCharSet.InsertTextEncoding( RTL_TEXTENCODING_DONTKNOW, aCharSetUser );
- aLbCharSet.SelectTextEncoding( bPreselectUnicode ?
- RTL_TEXTENCODING_UNICODE : gsl_getSystemTextEncoding() );
+ aLbCharSet.SelectTextEncoding( ePreselectUnicode == RTL_TEXTENCODING_DONTKNOW ?
+ gsl_getSystemTextEncoding() : ePreselectUnicode );
- if( nCharSet >= 0 )
+ if( nCharSet >= 0 && ePreselectUnicode == RTL_TEXTENCODING_DONTKNOW )
aLbCharSet.SelectEntryPos( static_cast<sal_uInt16>(nCharSet) );
SetSelectedCharSet();
@@ -410,6 +421,9 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
UpdateVertical();
maTableBox.Execute( CSVCMD_NEWCELLTEXTS );
+
+ aEdOther.SetAccessibleName(aCkbOther.GetText());
+ aEdOther.SetAccessibleRelationLabeledBy(&aCkbOther);
}
@@ -437,8 +451,7 @@ bool ScImportAsciiDlg::GetLine( sal_uLong nLine, String &rText )
memset( mpRowPosArray, 0, sizeof(mpRowPosArray[0]) * (ASCIIDLG_MAXROWS+2));
Seek(0);
- if ( mpDatStream->GetStreamCharSet() == RTL_TEXTENCODING_UNICODE )
- mpDatStream->StartReadingUnicodeText();
+ mpDatStream->StartReadingUnicodeText( mpDatStream->GetStreamCharSet() );
mnStreamPos = mpDatStream->Tell();
mpRowPosArray[mnRowPosCount] = mnStreamPos;