View | Details | Raw Unified | Return to issue 3687
Collapse All | Expand All

(-)officecfg/registry/schema/org/openoffice/Office/Calc.xcs (+53 lines)
Lines 1041-1046 Link Here
1041
				<value>NULL</value>
1041
				<value>NULL</value>
1042
			</prop>
1042
			</prop>
1043
		</group>
1043
		</group>
1044
		<group oor:name="CSVImport">
1045
			<info>
1046
				<desc>Contains setting for Text CSV Import</desc>
1047
			</info>
1048
			<prop oor:name="MergeDelimiters" oor:type="xs:boolean">
1049
				<info>
1050
					<author>muthusuba</author>
1051
					<desc>Merge Delimiter check box status</desc>
1052
					<label>MergeDelimiters</label>
1053
				</info>
1054
				<value>false</value>
1055
			</prop>
1056
			<prop oor:name="Separators" oor:type="xs:string">
1057
				<info>
1058
					<author>muthusuba</author>
1059
					<desc>List of Separators - as a String</desc>
1060
					<label>Separators</label>
1061
				</info>
1062
				<value>;	</value>
1063
			</prop>
1064
			<prop oor:name="TextSeparators" oor:type="xs:string">
1065
				<info>
1066
					<author>muthusuba</author>
1067
					<desc>Text Separators</desc>
1068
					<label>TextSeparators</label>
1069
				</info>
1070
				<value>"</value>
1071
			</prop>
1072
			<prop oor:name="FixedWidth" oor:type="xs:boolean">
1073
				<info>
1074
					<author>muthusuba</author>
1075
					<desc>Fixed width</desc>
1076
					<label>FixedWidth</label>
1077
				</info>
1078
				<value>false</value>
1079
			</prop>
1080
			<prop oor:name="FromRow" oor:type="xs:int">
1081
				<info>
1082
					<author>muthusuba</author>
1083
					<desc>From Row</desc>
1084
					<label>FromRow</label>
1085
				</info>
1086
				<value>1</value>
1087
			</prop>
1088
			<prop oor:name="CharSet" oor:type="xs:int">
1089
				<info>
1090
					<author>muthusuba</author>
1091
					<desc>Char Set</desc>
1092
					<label>CharSet</label>
1093
				</info>
1094
				<value>-1</value>
1095
			</prop>
1096
		</group>
1044
		<group oor:name="Calculate">
1097
		<group oor:name="Calculate">
1045
			<info>
1098
			<info>
1046
				<desc>Contains settings that affect cell calculation.</desc>
1099
				<desc>Contains settings that affect cell calculation.</desc>
(-)sc/source/ui/dbgui/scuiasciiopt.cxx (-8 / +124 lines)
Lines 79-84 Link Here
79
// ause
79
// ause
80
#include "editutil.hxx"
80
#include "editutil.hxx"
81
81
82
#include <optutil.hxx>
83
#include <com/sun/star/uno/Any.hxx>
84
#include <com/sun/star/uno/Sequence.hxx>
85
#include "miscuno.hxx"
86
87
82
//! TODO make dynamic
88
//! TODO make dynamic
83
#ifdef WIN
89
#ifdef WIN
84
const SCSIZE ASCIIDLG_MAXROWS                = 10000;
90
const SCSIZE ASCIIDLG_MAXROWS                = 10000;
Lines 86-91 const SCSIZE ASCIIDLG_MAXROWS Link Here
86
const SCSIZE ASCIIDLG_MAXROWS                = MAXROWCOUNT;
92
const SCSIZE ASCIIDLG_MAXROWS                = MAXROWCOUNT;
87
#endif
93
#endif
88
94
95
96
using namespace rtl;
97
using namespace com::sun::star::uno;
98
99
// Defines - CSV Import Preserve Options
100
#define FIXED_WIDTH			"FixedWidth"
101
#define FROM_ROW			"FromRow"
102
#define CHAR_SET			"CharSet"
103
#define SEPARATORS			"Separators"
104
#define TEXT_SEPARATORS		"TextSeparators"
105
#define MERGE_DELIMITERS	"MergeDelimiters"
106
#define SEP_PATH			"Office.Calc/CSVImport"
107
108
89
// ============================================================================
109
// ============================================================================
90
110
91
void lcl_FillCombo( ComboBox& rCombo, const String& rList, sal_Unicode cSelect )
111
void lcl_FillCombo( ComboBox& rCombo, const String& rList, sal_Unicode cSelect )
Lines 133-138 sal_Unicode lcl_CharFromCombo( ComboBox& Link Here
133
	return c;
153
	return c;
134
}
154
}
135
155
156
static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparators, 
157
							 bool &bMergeDelimiters, bool &bFixedWidth, sal_Int32 &nFromRow, sal_Int32 &nCharSet )
158
{
159
	Sequence<Any>aValues;
160
	const Any *pProperties;
161
	Sequence<OUString> aNames(6);
162
	OUString* pNames = aNames.getArray();
163
	ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
164
165
	pNames[0] = OUString::createFromAscii( MERGE_DELIMITERS );
166
	pNames[1] = OUString::createFromAscii( SEPARATORS );
167
	pNames[2] = OUString::createFromAscii( TEXT_SEPARATORS );
168
	pNames[3] = OUString::createFromAscii( FIXED_WIDTH );
169
	pNames[4] = OUString::createFromAscii( FROM_ROW );
170
	pNames[5] = OUString::createFromAscii( CHAR_SET );
171
	aValues = aItem.GetProperties( aNames );
172
	pProperties = aValues.getConstArray();
173
	if( pProperties[1].hasValue() )
174
		pProperties[1] >>= sFieldSeparators;
175
176
	if( pProperties[2].hasValue() )
177
		pProperties[2] >>= sTextSeparators;
178
179
	if( pProperties[0].hasValue() )
180
		bMergeDelimiters = ScUnoHelpFunctions::GetBoolFromAny( pProperties[0] );
181
182
	if( pProperties[3].hasValue() )
183
		bFixedWidth = ScUnoHelpFunctions::GetBoolFromAny( pProperties[3] );
184
185
	if( pProperties[4].hasValue() )
186
		pProperties[4] >>= nFromRow;
187
188
	if( pProperties[5].hasValue() )
189
		pProperties[5] >>= nCharSet;
190
}
191
192
static void save_Separators( String maSeparators, String maTxtSep, bool bMergeDelimiters, 
193
							 bool bFixedWidth, sal_Int32 nFromRow, sal_Int32 nCharSet )
194
{
195
	OUString sFieldSeparators = OUString( maSeparators );
196
	OUString sTextSeparators = OUString( maTxtSep );
197
	Sequence<Any> aValues;
198
	Any *pProperties;
199
	Sequence<OUString> aNames(6);
200
	OUString* pNames = aNames.getArray();
201
	ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
202
203
	pNames[0] = OUString::createFromAscii( MERGE_DELIMITERS );
204
	pNames[1] = OUString::createFromAscii( SEPARATORS );
205
	pNames[2] = OUString::createFromAscii( TEXT_SEPARATORS );
206
	pNames[3] = OUString::createFromAscii( FIXED_WIDTH );
207
	pNames[4] = OUString::createFromAscii( FROM_ROW );
208
	pNames[5] = OUString::createFromAscii( CHAR_SET );
209
	aValues = aItem.GetProperties( aNames );
210
	pProperties = aValues.getArray();
211
	pProperties[1] <<= sFieldSeparators;
212
	pProperties[2] <<= sTextSeparators;
213
	ScUnoHelpFunctions::SetBoolInAny( pProperties[0], bMergeDelimiters );
214
	ScUnoHelpFunctions::SetBoolInAny( pProperties[3], bFixedWidth );
215
	pProperties[4] <<= nFromRow;
216
	pProperties[5] <<= nCharSet;
217
218
	aItem.PutProperties(aNames, aValues);
219
}
136
220
137
// ----------------------------------------------------------------------------
221
// ----------------------------------------------------------------------------
138
222
Lines 190-205 ScImportAsciiDlg::ScImportAsciiDlg( Wind Link Here
190
	aName += ']';
274
	aName += ']';
191
	SetText( aName );
275
	SetText( aName );
192
276
193
	switch(cSep)
277
278
	OUString sFieldSeparators;
279
	OUString sTextSeparators;
280
	bool bMergeDelimiters = false;
281
	bool bFixedWidth = false;
282
	sal_Int32 nFromRow = 1;
283
	sal_Int32 nCharSet = -1;
284
	load_Separators (sFieldSeparators, sTextSeparators, bMergeDelimiters, bFixedWidth, nFromRow, nCharSet);
285
	maFieldSeparators = String(sFieldSeparators);
286
287
	if( bMergeDelimiters )
288
		aCkbAsOnce.Check();
289
	if( bFixedWidth )
290
		aRbFixed.Check();
291
	if( nFromRow != 1 )
292
		aNfRow.SetValue( nFromRow );
293
294
	ByteString bString(maFieldSeparators,RTL_TEXTENCODING_MS_1252);
295
	const sal_Char *aSep = bString.GetBuffer();
296
	int i = 0;
297
	int len = maFieldSeparators.Len();
298
	for(i=0;i<len;i++)
194
	{
299
	{
195
        case '\t':  aCkbTab.Check();        break;
300
		switch( aSep[i] )
196
        case ';':   aCkbSemicolon.Check();  break;
301
		{
197
        case ',':   aCkbComma.Check();      break;
302
			case '\t':  aCkbTab.Check();        break;
198
        case ' ':   aCkbSpace.Check();      break;
303
	        case ';':   aCkbSemicolon.Check();  break;
199
        default:
304
    	    case ',':   aCkbComma.Check();      break;
200
            aCkbOther.Check();
305
        	case ' ':   aCkbSpace.Check();      break;
201
            aEdOther.SetText( cSep );
306
	        default:
307
    	        aCkbOther.Check();
308
        	    aEdOther.SetText( aEdOther.GetText() + OUString( aSep[i] ) );
309
		}
202
	}
310
	}
311
	
312
	// Get Separators from the dialog
203
    maFieldSeparators = GetSeparators();
313
    maFieldSeparators = GetSeparators();
204
314
205
	BOOL bPreselectUnicode = FALSE;
315
	BOOL bPreselectUnicode = FALSE;
Lines 238-243 ScImportAsciiDlg::ScImportAsciiDlg( Wind Link Here
238
348
239
    // *** Separator characters ***
349
    // *** Separator characters ***
240
    lcl_FillCombo( aCbTextSep, aTextSepList, mcTextSep );
350
    lcl_FillCombo( aCbTextSep, aTextSepList, mcTextSep );
351
	aCbTextSep.SetText( sTextSeparators );
241
352
242
    Link aSeparatorHdl =LINK( this, ScImportAsciiDlg, SeparatorHdl );
353
    Link aSeparatorHdl =LINK( this, ScImportAsciiDlg, SeparatorHdl );
243
    aCbTextSep.SetSelectHdl( aSeparatorHdl );
354
    aCbTextSep.SetSelectHdl( aSeparatorHdl );
Lines 261-266 ScImportAsciiDlg::ScImportAsciiDlg( Wind Link Here
261
    SetSelectedCharSet();
372
    SetSelectedCharSet();
262
	aLbCharSet.SetSelectHdl( LINK( this, ScImportAsciiDlg, CharSetHdl ) );
373
	aLbCharSet.SetSelectHdl( LINK( this, ScImportAsciiDlg, CharSetHdl ) );
263
374
375
	if( nCharSet >= 0 )
376
		aLbCharSet.SelectEntryPos( nCharSet );
377
264
    // *** column type ListBox ***
378
    // *** column type ListBox ***
265
	xub_StrLen nCount = aColumnUser.GetTokenCount();
379
	xub_StrLen nCount = aColumnUser.GetTokenCount();
266
	for (xub_StrLen i=0; i<nCount; i++)
380
	for (xub_StrLen i=0; i<nCount; i++)
Lines 289-294 ScImportAsciiDlg::ScImportAsciiDlg( Wind Link Here
289
403
290
ScImportAsciiDlg::~ScImportAsciiDlg()
404
ScImportAsciiDlg::~ScImportAsciiDlg()
291
{
405
{
406
	save_Separators( maFieldSeparators, aCbTextSep.GetText(), aCkbAsOnce.IsChecked(), 
407
					 aRbFixed.IsChecked(), aNfRow.GetValue(), aLbCharSet.GetSelectEntryPos());
292
	delete[] mpRowPosArray;
408
	delete[] mpRowPosArray;
293
}
409
}
294
410

Return to issue 3687