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

(-)officecfg/registry/schema/org/openoffice/Office/Calc.xcs (+29 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
		</group>
1044
		<group oor:name="Calculate">
1073
		<group oor:name="Calculate">
1045
			<info>
1074
			<info>
1046
				<desc>Contains settings that affect cell calculation.</desc>
1075
				<desc>Contains settings that affect cell calculation.</desc>
(-)sc/source/ui/dbgui/scuiasciiopt.cxx (-8 / +91 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 SEPARATORS			"Separators"
101
#define TEXT_SEPARATORS		"TextSeparators"
102
#define MERGE_DELIMITERS	"MergeDelimiters"
103
#define SEP_PATH			"Office.Calc/CSVImport"
104
105
89
// ============================================================================
106
// ============================================================================
90
107
91
void lcl_FillCombo( ComboBox& rCombo, const String& rList, sal_Unicode cSelect )
108
void lcl_FillCombo( ComboBox& rCombo, const String& rList, sal_Unicode cSelect )
Lines 133-138 sal_Unicode lcl_CharFromCombo( ComboBox& Link Here
133
	return c;
150
	return c;
134
}
151
}
135
152
153
static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparators, 
154
							 bool &bMergeDelimiters )
155
{
156
	Sequence<Any>aValues;
157
	const Any *pProperties;
158
	Sequence<OUString> aNames(3);
159
	OUString* pNames = aNames.getArray();
160
	ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
161
162
	pNames[0] = OUString::createFromAscii( MERGE_DELIMITERS );
163
	pNames[1] = OUString::createFromAscii( SEPARATORS );
164
	pNames[2] = OUString::createFromAscii( TEXT_SEPARATORS );
165
	aValues = aItem.GetProperties( aNames );
166
	pProperties = aValues.getConstArray();
167
	if( pProperties[1].hasValue() )
168
		pProperties[1] >>= sFieldSeparators;
169
170
	if( pProperties[2].hasValue() )
171
		pProperties[2] >>= sTextSeparators;
172
173
	if( pProperties[0].hasValue() )
174
		bMergeDelimiters = ScUnoHelpFunctions::GetBoolFromAny( pProperties[0] );
175
}
176
177
static void save_Separators( String maSeparators, String maTxtSep, bool bMergeDelimiters )
178
{
179
	OUString sFieldSeparators = OUString( maSeparators );
180
	OUString sTextSeparators = OUString( maTxtSep );
181
	Sequence<Any> aValues;
182
	Any *pProperties;
183
	Sequence<OUString> aNames(3);
184
	OUString* pNames = aNames.getArray();
185
	ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
186
187
	pNames[0] = OUString::createFromAscii( MERGE_DELIMITERS );
188
	pNames[1] = OUString::createFromAscii( SEPARATORS );
189
	pNames[2] = OUString::createFromAscii( TEXT_SEPARATORS );
190
	aValues = aItem.GetProperties( aNames );
191
	pProperties = aValues.getArray();
192
	pProperties[1] <<= sFieldSeparators;
193
	pProperties[2] <<= sTextSeparators;
194
	ScUnoHelpFunctions::SetBoolInAny( pProperties[0], bMergeDelimiters );
195
	
196
	aItem.PutProperties(aNames, aValues);
197
}
136
198
137
// ----------------------------------------------------------------------------
199
// ----------------------------------------------------------------------------
138
200
Lines 190-205 ScImportAsciiDlg::ScImportAsciiDlg( Wind Link Here
190
	aName += ']';
252
	aName += ']';
191
	SetText( aName );
253
	SetText( aName );
192
254
193
	switch(cSep)
255
256
	OUString sFieldSeparators;
257
	OUString sTextSeparators;
258
	bool bMergeDelimiters = false;
259
	load_Separators (sFieldSeparators, sTextSeparators, bMergeDelimiters);
260
	maFieldSeparators = String(sFieldSeparators);
261
262
	if( bMergeDelimiters )
263
		aCkbAsOnce.Check();
264
265
	ByteString bString(maFieldSeparators,RTL_TEXTENCODING_MS_1252);
266
	const sal_Char *aSep = bString.GetBuffer();
267
	int i = 0;
268
	int len = maFieldSeparators.Len();
269
	for(i=0;i<len;i++)
194
	{
270
	{
195
        case '\t':  aCkbTab.Check();        break;
271
		switch( aSep[i] )
196
        case ';':   aCkbSemicolon.Check();  break;
272
		{
197
        case ',':   aCkbComma.Check();      break;
273
			case '\t':  aCkbTab.Check();        break;
198
        case ' ':   aCkbSpace.Check();      break;
274
	        case ';':   aCkbSemicolon.Check();  break;
199
        default:
275
    	    case ',':   aCkbComma.Check();      break;
200
            aCkbOther.Check();
276
        	case ' ':   aCkbSpace.Check();      break;
201
            aEdOther.SetText( cSep );
277
	        default:
278
    	        aCkbOther.Check();
279
        	    aEdOther.SetText( aEdOther.GetText() + OUString( aSep[i] ) );
280
		}
202
	}
281
	}
282
	
283
	// Get Separators from the dialog
203
    maFieldSeparators = GetSeparators();
284
    maFieldSeparators = GetSeparators();
204
285
205
	BOOL bPreselectUnicode = FALSE;
286
	BOOL bPreselectUnicode = FALSE;
Lines 238-243 ScImportAsciiDlg::ScImportAsciiDlg( Wind Link Here
238
319
239
    // *** Separator characters ***
320
    // *** Separator characters ***
240
    lcl_FillCombo( aCbTextSep, aTextSepList, mcTextSep );
321
    lcl_FillCombo( aCbTextSep, aTextSepList, mcTextSep );
322
	aCbTextSep.SetText( sTextSeparators );
241
323
242
    Link aSeparatorHdl =LINK( this, ScImportAsciiDlg, SeparatorHdl );
324
    Link aSeparatorHdl =LINK( this, ScImportAsciiDlg, SeparatorHdl );
243
    aCbTextSep.SetSelectHdl( aSeparatorHdl );
325
    aCbTextSep.SetSelectHdl( aSeparatorHdl );
Lines 289-294 ScImportAsciiDlg::ScImportAsciiDlg( Wind Link Here
289
371
290
ScImportAsciiDlg::~ScImportAsciiDlg()
372
ScImportAsciiDlg::~ScImportAsciiDlg()
291
{
373
{
374
	save_Separators( maFieldSeparators, aCbTextSep.GetText(), aCkbAsOnce.IsChecked() );
292
	delete[] mpRowPosArray;
375
	delete[] mpRowPosArray;
293
}
376
}
294
377

Return to issue 3687