incubator-ooo-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 120341] Rework SCSTR_FIELDSEP so that it is less error-prone
Date Mon, 23 Jul 2012 01:51:09 GMT
https://issues.apache.org/ooo/show_bug.cgi?id=120341

--- Comment #1 from Ariel Constenla-Haile <arielch@apache.org> ---
(In reply to comment #0)
> String SCSTR_FIELDSEP
>  {
>  	Text = ",\t44\t;\t59\t:\t58\t{$1}\t9\t{$2}\t32 " ;
> };
> 
> String SCSTR_FIELDSEP_TAB
>  {
>  	Text [ en-US ] = "Tab" ;
> };
> 
> String SCSTR_FIELDSEP_SPACE
>  {
>  	Text [ en-US ] = "space" ;
> };

Looking at it again, it looks less error prone the following:


String SCSTR_FIELDSEP
{
    Text = ",\t44\t;\t59\t:\t58\t{%TAB}\t9\t{%SPACE}\t32 " ;
};

%TAB and %SPACE as placeholders instead of %1 and %2 don't require to track the
placeholder position when replacing:

in ScImportOptionsDlg::ScImportOptionsDlg

String sFieldSep( ScResId( SCSTR_FIELDSEP ) );
sFieldSep.SearchAndReplaceAscii( "%TAB",   String(ScResId(SCSTR_FIELDSEP_TAB))
);
sFieldSep.SearchAndReplaceAscii( "%SPACE",
String(ScResId(SCSTR_FIELDSEP_SPACE)) );

// im Ctor-Initializer nicht moeglich (MSC kann das nicht):
pFieldSepTab = new ScDelimiterTable( sFieldSep );


SCSTR_FIELDSEP is also used in ScImportAsciiDlg, member variable aFldSepList,
which is unused, so I'll remove it.


[ariel@localhost sc]$ cd /build/aoo/src/clean/trunk/main/sc
[ariel@localhost sc]$ git grep SCSTR_FIELDSEP
inc/sc.hrc:#define SCSTR_FIELDSEP                       (STR_START + 61)
source/ui/dbgui/scuiasciiopt.cxx:               aFldSepList     ( ScResId(
SCSTR_FIELDSEP ) ),
source/ui/dbgui/scuiimoptdlg.cxx:       pFieldSepTab = new ScDelimiterTable(
String(ScResId(SCSTR_FIELDSEP)) );
source/ui/src/scstring.src:String SCSTR_FIELDSEP


[ariel@localhost sc]$ git grep aFldSepList
source/ui/dbgui/scuiasciiopt.cxx:               aFldSepList     ( ScResId(
SCSTR_FIELDSEP ) ),
source/ui/inc/asciiopt.hxx://CHINA001 String                      aFldSepList;
source/ui/inc/scuiasciiopt.hxx:    String                      aFldSepList;

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Mime
View raw message