merge the formfield patch from ooo-build
[ooovba.git] / applied_patches / 0011-cws-koheicsvimport-sc.diff
blobe6e0bcf77f42a154c28b233c393a468f9ab40dcc
1 diff --git sc/inc/column.hxx sc/inc/column.hxx
2 index ec87323..9854109 100644
3 --- sc/inc/column.hxx
4 +++ sc/inc/column.hxx
5 @@ -239,7 +239,9 @@ public:
7 // TRUE = Zahlformat gesetzt
8 BOOL SetString( SCROW nRow, SCTAB nTab, const String& rString,
9 - formula::FormulaGrammar::AddressConvention conv = formula::FormulaGrammar::CONV_OOO );
10 + formula::FormulaGrammar::AddressConvention conv = formula::FormulaGrammar::CONV_OOO,
11 + SvNumberFormatter* pFormatter = NULL,
12 + bool bDetectNumberFormat = true );
13 void SetValue( SCROW nRow, const double& rVal);
14 void SetError( SCROW nRow, const USHORT nError);
16 diff --git sc/inc/document.hxx sc/inc/document.hxx
17 index 14d606e..e41d15c 100644
18 --- sc/inc/document.hxx
19 +++ sc/inc/document.hxx
20 @@ -716,7 +716,9 @@ public:
21 SC_DLLPUBLIC void PutCell(SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell,
22 ULONG nFormatIndex, BOOL bForceTab = FALSE);
23 // return TRUE = Zahlformat gesetzt
24 - SC_DLLPUBLIC BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString );
25 + SC_DLLPUBLIC BOOL SetString(
26 + SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
27 + SvNumberFormatter* pFormatter = NULL, bool bDetectNumberFormat = true );
28 SC_DLLPUBLIC void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal );
29 void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const USHORT nError);
31 diff --git sc/inc/filter.hxx sc/inc/filter.hxx
32 index 4e72620..bcb15f1 100644
33 --- sc/inc/filter.hxx
34 +++ sc/inc/filter.hxx
35 @@ -42,6 +42,7 @@ class SvStream;
36 class ScAddress;
37 class ScDocument;
38 class ScRange;
39 +class SvNumberFormatter;
41 // Return-Werte Im-/Exportfilter (ULONG)
43 @@ -92,7 +93,9 @@ class ScEEAbsImport {
44 virtual ~ScEEAbsImport() {}
45 virtual ULONG Read( SvStream& rStream, const String& rBaseURL ) = 0;
46 virtual ScRange GetRange() = 0;
47 - virtual void WriteToDocument( BOOL bSizeColsRows = FALSE, double nOutputFactor = 1.0 ) = 0;
48 + virtual void WriteToDocument(
49 + BOOL bSizeColsRows = FALSE, double nOutputFactor = 1.0,
50 + SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0;
53 class ScFormatFilterPlugin {
54 @@ -109,7 +112,8 @@ class ScFormatFilterPlugin {
55 virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress& rInsPos,
56 const CharSet eSrc = RTL_TEXTENCODING_DONTKNOW, UINT32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
57 virtual FltError ScImportRTF( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange ) = 0;
58 - virtual FltError ScImportHTML( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange, double nOutputFactor = 1.0, BOOL bCalcWidthHeight = TRUE ) = 0;
59 + virtual FltError ScImportHTML( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange, double nOutputFactor = 1.0,
60 + BOOL bCalcWidthHeight = TRUE, SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0;
62 // various import helpers
63 virtual ScEEAbsImport *CreateRTFImport( ScDocument* pDoc, const ScRange& rRange ) = 0;
64 diff --git sc/inc/optutil.hxx sc/inc/optutil.hxx
65 index ae7e8f5..73b29d6 100644
66 --- sc/inc/optutil.hxx
67 +++ sc/inc/optutil.hxx
68 @@ -33,6 +33,7 @@
70 #include <unotools/configitem.hxx>
71 #include <tools/link.hxx>
72 +#include "scdllapi.h"
75 class ScOptionsUtil
76 @@ -44,13 +45,13 @@ public:
78 // ConfigItem for classes that use items from several sub trees
80 -class ScLinkConfigItem : public utl::ConfigItem
81 +class SC_DLLPUBLIC ScLinkConfigItem : public utl::ConfigItem
83 Link aCommitLink;
85 public:
86 - ScLinkConfigItem( const rtl::OUString rSubTree );
87 - ScLinkConfigItem( const rtl::OUString rSubTree, sal_Int16 nMode );
88 + ScLinkConfigItem( const rtl::OUString& rSubTree );
89 + ScLinkConfigItem( const rtl::OUString& rSubTree, sal_Int16 nMode );
90 void SetCommitLink( const Link& rLink );
92 virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames );
93 diff --git sc/inc/sc.hrc sc/inc/sc.hrc
94 index 3e0a1f8..d67b625 100644
95 --- sc/inc/sc.hrc
96 +++ sc/inc/sc.hrc
97 @@ -1638,8 +1638,9 @@
98 #define RID_SCDLG_RETYPEPASS (SC_DIALOGS_START + 150)
99 #define RID_SCDLG_RETYPEPASS_INPUT (SC_DIALOGS_START + 151)
100 #define RID_POPUP_FILTER (SC_DIALOGS_START + 152)
101 +#define RID_SCDLG_TEXT_IMPORT_OPTIONS (SC_DIALOGS_START + 153)
103 -#define SC_DIALOGS_END (SC_DIALOGS_START + 153)
104 +#define SC_DIALOGS_END (SC_DIALOGS_START + 154)
106 #ifndef STD_MASKCOLOR
107 #define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
108 diff --git sc/inc/scabstdlg.hxx sc/inc/scabstdlg.hxx
109 index de99888..f5a40ee 100644
110 --- sc/inc/scabstdlg.hxx
111 +++ sc/inc/scabstdlg.hxx
112 @@ -41,6 +41,7 @@
113 #include "sc.hrc"
114 #include "global.hxx"
115 #include "pivot.hxx"
116 +#include "i18npool/lang.h"
118 #include <tabvwsh.hxx>
120 @@ -297,6 +298,14 @@ class AbstractScImportOptionsDlg : public VclAbstractDialog //add for ScImportO
121 public:
122 virtual void GetImportOptions( ScImportOptions& rOptions ) const = 0;
125 +class AbstractScTextImportOptionsDlg : public VclAbstractDialog //add for ScLangChooserDlg
127 +public:
128 + virtual LanguageType GetLanguageType() const = 0;
129 + virtual bool IsDateConversionSet() const = 0;
132 //-------Scabstract fractory ---------------------------
133 class ScAbstractDialogFactory
135 @@ -307,6 +316,8 @@ public:
136 SvStream* pInStream, int nId,
137 sal_Unicode cSep = '\t') = 0;
139 + virtual AbstractScTextImportOptionsDlg * CreateScTextImportOptionsDlg( Window* pParent, int nId ) = 0;
141 virtual AbstractScAutoFormatDlg * CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg
142 ScAutoFormat* pAutoFormat,
143 const ScAutoFormatData* pSelFormatData,
144 diff --git sc/inc/stringutil.hxx sc/inc/stringutil.hxx
145 new file mode 100644
146 index 0000000..4ca8629
147 --- /dev/null
148 +++ sc/inc/stringutil.hxx
149 @@ -0,0 +1,56 @@
150 +/*************************************************************************
152 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
153 + *
154 + * Copyright 2008 by Sun Microsystems, Inc.
156 + * OpenOffice.org - a multi-platform office productivity suite
158 + * $RCSfile: table.hxx,v $
159 + * $Revision: 1.35 $
161 + * This file is part of OpenOffice.org.
163 + * OpenOffice.org is free software: you can redistribute it and/or modify
164 + * it under the terms of the GNU Lesser General Public License version 3
165 + * only, as published by the Free Software Foundation.
167 + * OpenOffice.org is distributed in the hope that it will be useful,
168 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
169 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
170 + * GNU Lesser General Public License version 3 for more details
171 + * (a copy is included in the LICENSE file that accompanied this code).
173 + * You should have received a copy of the GNU Lesser General Public License
174 + * version 3 along with OpenOffice.org. If not, see
175 + * <http://www.openoffice.org/license.html>
176 + * for a copy of the LGPLv3 License.
178 + ************************************************************************/
180 +#ifndef SC_STRINGUTIL_HXX
181 +#define SC_STRINGUTIL_HXX
183 +#include "rtl/ustring.hxx"
185 +class ScStringUtil
187 +public:
188 + /**
189 + * Check if a given string is a simple decimal number (e.g. 12.345). We
190 + * don't do any elaborate parsing here; we only check for the simplest
191 + * case of decimal number format.
193 + * @param rStr string to parse
194 + * @param dsep decimal separator
195 + * @param gsep group separator (aka thousands separator)
196 + * @param rVal value of successfully parsed number
197 + *
198 + * @return true if the string is a valid number, false otherwise.
199 + */
200 + static bool parseSimpleNumber(
201 + const ::rtl::OUString& rStr, sal_Unicode dsep, sal_Unicode gsep, double& rVal);
205 +#endif
206 diff --git sc/inc/table.hxx sc/inc/table.hxx
207 index 715e119..f8d8609 100644
208 --- sc/inc/table.hxx
209 +++ sc/inc/table.hxx
210 @@ -260,7 +260,8 @@ public:
211 void PutCell( SCCOL nCol, SCROW nRow, ScBaseCell* pCell );
212 void PutCell(SCCOL nCol, SCROW nRow, ULONG nFormatIndex, ScBaseCell* pCell);
213 // TRUE = Zahlformat gesetzt
214 - BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString );
215 + BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
216 + SvNumberFormatter* pFormatter = NULL, bool bDetectNumberFormat = true );
217 void SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
218 void SetError( SCCOL nCol, SCROW nRow, USHORT nError);
220 diff --git sc/source/core/data/column3.cxx sc/source/core/data/column3.cxx
221 index b2c954a..242c5c0 100644
222 --- sc/source/core/data/column3.cxx
223 +++ sc/source/core/data/column3.cxx
224 @@ -54,6 +54,13 @@
225 #include "markdata.hxx"
226 #include "detfunc.hxx" // fuer Notizen bei DeleteRange
227 #include "postit.hxx"
228 +#include "stringutil.hxx"
230 +#include <com/sun/star/i18n/LocaleDataItem.hpp>
232 +using ::com::sun::star::i18n::LocaleDataItem;
233 +using ::rtl::OUString;
234 +using ::rtl::OUStringBuffer;
236 // Err527 Workaround
237 extern const ScFormulaCell* pLastFormulaTreeTop; // in cellform.cxx
238 @@ -1244,7 +1251,8 @@ void ScColumn::StartListeningInArea( SCROW nRow1, SCROW nRow2 )
240 // TRUE = Zahlformat gesetzt
241 BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
242 - formula::FormulaGrammar::AddressConvention eConv )
243 + formula::FormulaGrammar::AddressConvention eConv,
244 + SvNumberFormatter* pFormatter, bool bDetectNumberFormat )
246 BOOL bNumFmtSet = FALSE;
247 if (VALIDROW(nRow))
248 @@ -1256,7 +1264,8 @@ BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
249 double nVal;
250 sal_uInt32 nIndex, nOldIndex = 0;
251 sal_Unicode cFirstChar;
252 - SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
253 + if (!pFormatter)
254 + pFormatter = pDocument->GetFormatTable();
255 SfxObjectShell* pDocSh = pDocument->GetDocumentShell();
256 if ( pDocSh )
257 bIsLoading = pDocSh->IsLoading();
258 @@ -1323,46 +1332,78 @@ BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
259 if ( !bIsText )
260 nIndex = nOldIndex = pFormatter->GetStandardIndex();
262 - if ( !bIsText &&
263 - pFormatter->IsNumberFormat(rString, nIndex, nVal) )
264 - { // Zahl
265 - pNewCell = new ScValueCell( nVal );
266 - if ( nIndex != nOldIndex)
268 + do
270 + if (bIsText)
271 + break;
273 + if (bDetectNumberFormat)
275 - // #i22345# New behavior: Apply the detected number format only if
276 - // the old one was the default number, date, time or boolean format.
277 - // Exception: If the new format is boolean, always apply it.
278 + if (!pFormatter->IsNumberFormat(rString, nIndex, nVal))
279 + break;
281 - BOOL bOverwrite = FALSE;
282 - const SvNumberformat* pOldFormat = pFormatter->GetEntry( nOldIndex );
283 - if ( pOldFormat )
284 + pNewCell = new ScValueCell( nVal );
285 + if ( nIndex != nOldIndex)
287 - short nOldType = pOldFormat->GetType() & ~NUMBERFORMAT_DEFINED;
288 - if ( nOldType == NUMBERFORMAT_NUMBER || nOldType == NUMBERFORMAT_DATE ||
289 - nOldType == NUMBERFORMAT_TIME || nOldType == NUMBERFORMAT_LOGICAL )
290 + // #i22345# New behavior: Apply the detected number format only if
291 + // the old one was the default number, date, time or boolean format.
292 + // Exception: If the new format is boolean, always apply it.
294 + BOOL bOverwrite = FALSE;
295 + const SvNumberformat* pOldFormat = pFormatter->GetEntry( nOldIndex );
296 + if ( pOldFormat )
298 - if ( nOldIndex == pFormatter->GetStandardFormat(
299 - nOldType, pOldFormat->GetLanguage() ) )
300 + short nOldType = pOldFormat->GetType() & ~NUMBERFORMAT_DEFINED;
301 + if ( nOldType == NUMBERFORMAT_NUMBER || nOldType == NUMBERFORMAT_DATE ||
302 + nOldType == NUMBERFORMAT_TIME || nOldType == NUMBERFORMAT_LOGICAL )
304 - bOverwrite = TRUE; // default of these types can be overwritten
305 + if ( nOldIndex == pFormatter->GetStandardFormat(
306 + nOldType, pOldFormat->GetLanguage() ) )
308 + bOverwrite = TRUE; // default of these types can be overwritten
313 - if ( !bOverwrite && pFormatter->GetType( nIndex ) == NUMBERFORMAT_LOGICAL )
315 - bOverwrite = TRUE; // overwrite anything if boolean was detected
317 + if ( !bOverwrite && pFormatter->GetType( nIndex ) == NUMBERFORMAT_LOGICAL )
319 + bOverwrite = TRUE; // overwrite anything if boolean was detected
322 - if ( bOverwrite )
324 - ApplyAttr( nRow, SfxUInt32Item( ATTR_VALUE_FORMAT,
325 - (UINT32) nIndex) );
326 - bNumFmtSet = TRUE;
327 + if ( bOverwrite )
329 + ApplyAttr( nRow, SfxUInt32Item( ATTR_VALUE_FORMAT,
330 + (UINT32) nIndex) );
331 + bNumFmtSet = TRUE;
335 + else
337 + // Only check if the string is a regular number.
338 + const LocaleDataWrapper* pLocale = pFormatter->GetLocaleData();
339 + if (!pLocale)
340 + break;
342 + LocaleDataItem aLocaleItem = pLocale->getLocaleItem();
343 + const OUString& rDecSep = aLocaleItem.decimalSeparator;
344 + const OUString& rGroupSep = aLocaleItem.thousandSeparator;
345 + if (rDecSep.getLength() != 1 || rGroupSep.getLength() != 1)
346 + break;
348 + sal_Unicode dsep = rDecSep.getStr()[0];
349 + sal_Unicode gsep = rGroupSep.getStr()[0];
351 + if (!ScStringUtil::parseSimpleNumber(rString, dsep, gsep, nVal))
352 + break;
354 + pNewCell = new ScValueCell(nVal);
357 - else // Text
358 - pNewCell = new ScStringCell( rString );
359 + while (false);
361 + if (!pNewCell)
362 + pNewCell = new ScStringCell(rString);
366 diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
367 index efb9693..6d6b8d1 100644
368 --- sc/source/core/data/document.cxx
369 +++ sc/source/core/data/document.cxx
370 @@ -2359,10 +2359,11 @@ void ScDocument::PutCell( const ScAddress& rPos, ScBaseCell* pCell, BOOL bForceT
374 -BOOL ScDocument::SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString )
375 +BOOL ScDocument::SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
376 + SvNumberFormatter* pFormatter, bool bDetectNumberFormat )
378 - if ( ValidTab(nTab) && pTab[nTab] )
379 - return pTab[nTab]->SetString( nCol, nRow, nTab, rString );
380 + if ( ValidTab(nTab) && pTab[nTab] )
381 + return pTab[nTab]->SetString( nCol, nRow, nTab, rString, pFormatter, bDetectNumberFormat );
382 else
383 return FALSE;
385 diff --git sc/source/core/data/table2.cxx sc/source/core/data/table2.cxx
386 index eac760e..29412c2 100644
387 --- sc/source/core/data/table2.cxx
388 +++ sc/source/core/data/table2.cxx
389 @@ -846,10 +846,12 @@ void ScTable::PutCell( const ScAddress& rPos, ScBaseCell* pCell )
390 //UNUSED2009-05 }
393 -BOOL ScTable::SetString( SCCOL nCol, SCROW nRow, SCTAB nTabP, const String& rString )
394 +BOOL ScTable::SetString( SCCOL nCol, SCROW nRow, SCTAB nTabP, const String& rString,
395 + SvNumberFormatter* pFormatter, bool bDetectNumberFormat )
397 if (ValidColRow(nCol,nRow))
398 - return aCol[nCol].SetString( nRow, nTabP, rString );
399 + return aCol[nCol].SetString(
400 + nRow, nTabP, rString, pDocument->GetAddressConvention(), pFormatter, bDetectNumberFormat );
401 else
402 return FALSE;
404 diff --git sc/source/core/tool/makefile.mk sc/source/core/tool/makefile.mk
405 index ac0aa23..0128310 100644
406 --- sc/source/core/tool/makefile.mk
407 +++ sc/source/core/tool/makefile.mk
408 @@ -108,6 +108,7 @@ SLOFILES = \
409 $(SLO)$/refupdat.obj \
410 $(SLO)$/scmatrix.obj \
411 $(SLO)$/sctictac.obj \
412 + $(SLO)$/stringutil.obj \
413 $(SLO)$/subtotal.obj \
414 $(SLO)$/token.obj \
415 $(SLO)$/unitconv.obj \
416 @@ -132,6 +133,7 @@ EXCEPTIONSFILES= \
417 $(SLO)$/lookupcache.obj \
418 $(SLO)$/prnsave.obj \
419 $(SLO)$/reftokenhelper.obj \
420 + $(SLO)$/stringutil.obj \
421 $(SLO)$/token.obj
423 # [kh] POWERPC compiler problem
424 diff --git sc/source/core/tool/optutil.cxx sc/source/core/tool/optutil.cxx
425 index 69e720c..1ee7d04 100644
426 --- sc/source/core/tool/optutil.cxx
427 +++ sc/source/core/tool/optutil.cxx
428 @@ -54,12 +54,12 @@ BOOL ScOptionsUtil::IsMetricSystem()
430 //------------------------------------------------------------------
432 -ScLinkConfigItem::ScLinkConfigItem( const rtl::OUString rSubTree ) :
433 +ScLinkConfigItem::ScLinkConfigItem( const rtl::OUString& rSubTree ) :
434 ConfigItem( rSubTree )
438 -ScLinkConfigItem::ScLinkConfigItem( const rtl::OUString rSubTree, sal_Int16 nMode ) :
439 +ScLinkConfigItem::ScLinkConfigItem( const rtl::OUString& rSubTree, sal_Int16 nMode ) :
440 ConfigItem( rSubTree, nMode )
443 diff --git sc/source/core/tool/stringutil.cxx sc/source/core/tool/stringutil.cxx
444 new file mode 100644
445 index 0000000..ae6247f
446 --- /dev/null
447 +++ sc/source/core/tool/stringutil.cxx
448 @@ -0,0 +1,131 @@
449 +/*************************************************************************
451 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
452 + *
453 + * Copyright 2008 by Sun Microsystems, Inc.
455 + * OpenOffice.org - a multi-platform office productivity suite
457 + * $RCSfile: table.hxx,v $
458 + * $Revision: 1.35 $
460 + * This file is part of OpenOffice.org.
462 + * OpenOffice.org is free software: you can redistribute it and/or modify
463 + * it under the terms of the GNU Lesser General Public License version 3
464 + * only, as published by the Free Software Foundation.
466 + * OpenOffice.org is distributed in the hope that it will be useful,
467 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
468 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
469 + * GNU Lesser General Public License version 3 for more details
470 + * (a copy is included in the LICENSE file that accompanied this code).
472 + * You should have received a copy of the GNU Lesser General Public License
473 + * version 3 along with OpenOffice.org. If not, see
474 + * <http://www.openoffice.org/license.html>
475 + * for a copy of the LGPLv3 License.
477 + ************************************************************************/
479 +// MARKER(update_precomp.py): autogen include statement, do not remove
480 +#include "precompiled_sc.hxx"
482 +// System - Includes -----------------------------------------------------
484 +#include "stringutil.hxx"
485 +#include "rtl/ustrbuf.hxx"
486 +#include "rtl/math.hxx"
488 +using ::rtl::OUString;
489 +using ::rtl::OUStringBuffer;
491 +bool ScStringUtil::parseSimpleNumber(
492 + const OUString& rStr, sal_Unicode dsep, sal_Unicode gsep, double& rVal)
494 + if (gsep == 0x00A0)
495 + // unicode space to ascii space
496 + gsep = 0x0020;
498 + OUStringBuffer aBuf;
499 + sal_Int32 n = rStr.getLength();
500 + const sal_Unicode* p = rStr.getStr();
501 + sal_Int32 nPosDSep = -1, nPosGSep = -1;
502 + sal_uInt32 nDigitCount = 0;
504 + for (sal_Int32 i = 0; i < n; ++i)
506 + sal_Unicode c = p[i];
507 + if (c == 0x00A0)
508 + // unicode space to ascii space
509 + c = 0x0020;
511 + if (sal_Unicode('0') <= c && c <= sal_Unicode('9'))
513 + // this is a digit.
514 + aBuf.append(c);
515 + ++nDigitCount;
517 + else if (c == dsep)
519 + // this is a decimal separator.
521 + if (nPosDSep >= 0)
522 + // a second decimal separator -> not a valid number.
523 + return false;
525 + if (nPosGSep >= 0 && i - nPosGSep != 4)
526 + // the number has a group separator and the decimal sep is not
527 + // positioned correctly.
528 + return false;
530 + nPosDSep = i;
531 + nPosGSep = -1;
532 + aBuf.append(c);
533 + nDigitCount = 0;
535 + else if (c == gsep)
537 + // this is a group (thousand) separator.
539 + if (i == 0)
540 + // not allowed as the first character.
541 + return false;
543 + if (nPosDSep >= 0)
544 + // not allowed after the decimal separator.
545 + return false;
547 + if (nPosGSep >= 0 && nDigitCount != 3)
548 + // must be exactly 3 digits since the last group separator.
549 + return false;
551 + nPosGSep = i;
552 + nDigitCount = 0;
554 + else if (c == sal_Unicode('-') || c == sal_Unicode('+'))
556 + // A sign must be the first character if it's given.
557 + if (i == 0)
558 + aBuf.append(c);
559 + else
560 + return false;
562 + else
563 + return false;
566 + // finished parsing the number.
568 + if (nPosGSep >= 0 && nDigitCount != 3)
569 + // must be exactly 3 digits since the last group separator.
570 + return false;
572 + rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok;
573 + sal_Int32 nParseEnd = 0;
574 + rVal = ::rtl::math::stringToDouble(aBuf.makeStringAndClear(), dsep, gsep, &eStatus, &nParseEnd);
575 + if (eStatus != rtl_math_ConversionStatus_Ok)
576 + return false;
578 + return true;
580 diff --git sc/source/filter/html/htmlimp.cxx sc/source/filter/html/htmlimp.cxx
581 index 0ae9d9a..a0a0af1 100644
582 --- sc/source/filter/html/htmlimp.cxx
583 +++ sc/source/filter/html/htmlimp.cxx
584 @@ -63,13 +63,14 @@
585 //------------------------------------------------------------------------
587 FltError ScFormatFilterPluginImpl::ScImportHTML( SvStream &rStream, const String& rBaseURL, ScDocument *pDoc,
588 - ScRange& rRange, double nOutputFactor, BOOL bCalcWidthHeight )
589 + ScRange& rRange, double nOutputFactor, BOOL bCalcWidthHeight, SvNumberFormatter* pFormatter,
590 + bool bConvertDate )
592 ScHTMLImport aImp( pDoc, rBaseURL, rRange, bCalcWidthHeight );
593 FltError nErr = (FltError) aImp.Read( rStream, rBaseURL );
594 ScRange aR = aImp.GetRange();
595 rRange.aEnd = aR.aEnd;
596 - aImp.WriteToDocument( TRUE, nOutputFactor );
597 + aImp.WriteToDocument( TRUE, nOutputFactor, pFormatter, bConvertDate );
598 return nErr;
601 @@ -137,9 +138,10 @@ void ScHTMLImport::InsertRangeName( ScDocument* pDoc, const String& rName, const
602 delete pRangeData;
605 -void ScHTMLImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
606 +void ScHTMLImport::WriteToDocument(
607 + BOOL bSizeColsRows, double nOutputFactor, SvNumberFormatter* pFormatter, bool bConvertDate )
609 - ScEEImport::WriteToDocument( bSizeColsRows, nOutputFactor );
610 + ScEEImport::WriteToDocument( bSizeColsRows, nOutputFactor, pFormatter, bConvertDate );
612 const ScHTMLParser* pParser = GetParser();
613 const ScHTMLTable* pGlobTable = pParser->GetGlobalTable();
614 diff --git sc/source/filter/inc/eeimport.hxx sc/source/filter/inc/eeimport.hxx
615 index fef4486..32d7d0a 100644
616 --- sc/source/filter/inc/eeimport.hxx
617 +++ sc/source/filter/inc/eeimport.hxx
618 @@ -63,7 +63,9 @@ public:
619 virtual ULONG Read( SvStream& rStream, const String& rBaseURL );
620 virtual ScRange GetRange() { return maRange; }
621 virtual void WriteToDocument( BOOL bSizeColsRows = FALSE,
622 - double nOutputFactor = 1.0 );
623 + double nOutputFactor = 1.0,
624 + SvNumberFormatter* pFormatter = NULL,
625 + bool bConvertDate = true );
628 #endif
629 diff --git sc/source/filter/inc/ftools.hxx sc/source/filter/inc/ftools.hxx
630 index 7e71708..5c05b27 100644
631 --- sc/source/filter/inc/ftools.hxx
632 +++ sc/source/filter/inc/ftools.hxx
633 @@ -522,7 +522,9 @@ class ScFormatFilterPluginImpl : public ScFormatFilterPlugin {
634 virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress& rInsPos,
635 const CharSet eSrc = RTL_TEXTENCODING_DONTKNOW, UINT32 nDifOption = SC_DIFOPT_EXCEL );
636 virtual FltError ScImportRTF( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange );
637 - virtual FltError ScImportHTML( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange, double nOutputFactor = 1.0, BOOL bCalcWidthHeight = TRUE );
638 + virtual FltError ScImportHTML( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange,
639 + double nOutputFactor = 1.0, BOOL bCalcWidthHeight = TRUE,
640 + SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true );
642 virtual ScEEAbsImport *CreateRTFImport( ScDocument* pDoc, const ScRange& rRange );
643 virtual ScEEAbsImport *CreateHTMLImport( ScDocument* pDocP, const String& rBaseURL, const ScRange& rRange, BOOL bCalcWidthHeight );
644 diff --git sc/source/filter/inc/htmlimp.hxx sc/source/filter/inc/htmlimp.hxx
645 index 9314458..a20e044 100644
646 --- sc/source/filter/inc/htmlimp.hxx
647 +++ sc/source/filter/inc/htmlimp.hxx
648 @@ -45,7 +45,8 @@ public:
649 virtual ~ScHTMLImport();
650 const ScHTMLParser* GetParser() const { return (ScHTMLParser*)mpParser; }
652 - virtual void WriteToDocument( BOOL bSizeColsRows = FALSE, double nOutputFactor = 1.0 );
653 + virtual void WriteToDocument( BOOL bSizeColsRows = FALSE, double nOutputFactor = 1.0,
654 + SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true );
656 static String GetHTMLRangeNameList( ScDocument* pDoc, const String& rOrigName );
658 diff --git sc/source/filter/rtf/eeimpars.cxx sc/source/filter/rtf/eeimpars.cxx
659 index 872b0a5..e78e371 100644
660 --- sc/source/filter/rtf/eeimpars.cxx
661 +++ sc/source/filter/rtf/eeimpars.cxx
662 @@ -129,7 +129,7 @@ ULONG ScEEImport::Read( SvStream& rStream, const String& rBaseURL )
666 -void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
667 +void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor, SvNumberFormatter* pFormatter, bool bConvertDate )
669 ScProgress* pProgress = new ScProgress( mpDoc->GetDocumentShell(),
670 ScGlobal::GetRscString( STR_LOAD_DOC ), mpParser->Count() );
671 @@ -150,7 +150,8 @@ void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
672 nLastMergedRow = SCROW_MAX;
673 BOOL bHasGraphics = FALSE;
674 ScEEParseEntry* pE;
675 - SvNumberFormatter* pFormatter = mpDoc->GetFormatTable();
676 + if (!pFormatter)
677 + pFormatter = mpDoc->GetFormatTable();
678 bool bNumbersEnglishUS = (pFormatter->GetLanguage() != LANGUAGE_ENGLISH_US);
679 if (bNumbersEnglishUS)
681 @@ -335,7 +336,7 @@ void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
682 else if ( !pE->aSel.HasRange() )
684 // maybe ALT text of IMG or similar
685 - mpDoc->SetString( nCol, nRow, nTab, pE->aAltText );
686 + mpDoc->SetString( nCol, nRow, nTab, pE->aAltText, pFormatter );
687 // wenn SelRange komplett leer kann nachfolgender Text im gleichen Absatz liegen!
689 else
690 @@ -380,7 +381,7 @@ void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
691 if (bNumbersEnglishUS && !bEnUsRecognized)
692 mpDoc->PutCell( nCol, nRow, nTab, new ScStringCell( aStr));
693 else
694 - mpDoc->SetString( nCol, nRow, nTab, aStr );
695 + mpDoc->SetString( nCol, nRow, nTab, aStr, pFormatter, bConvertDate );
698 else
699 diff --git sc/source/ui/attrdlg/scdlgfact.cxx sc/source/ui/attrdlg/scdlgfact.cxx
700 index 219a657..e7a109b 100644
701 --- sc/source/ui/attrdlg/scdlgfact.cxx
702 +++ sc/source/ui/attrdlg/scdlgfact.cxx
703 @@ -74,6 +74,7 @@
704 #include "validate.hxx" //add for ScValidationDlg
705 #include "validate.hrc" //add for ScValidationDlg
706 #include "sortdlg.hxx" //add for ScSortDlg
707 +#include "textimportoptions.hxx"
708 #include "opredlin.hxx" //add for ScRedlineOptionsTabPage
709 #include "tpcalc.hxx" //add for ScTpCalcOptions
710 #include "tpprint.hxx" //add for ScTpPrintOptions
711 @@ -119,6 +120,7 @@ IMPL_ABSTDLG_BASE(AbstractScNewScenarioDlg_Impl); //add for ScNewScenarioDlg
712 IMPL_ABSTDLG_BASE(AbstractScShowTabDlg_Impl); //add for ScShowTabDlg
713 IMPL_ABSTDLG_BASE(AbstractScStringInputDlg_Impl); //add for ScStringInputDlg
714 IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl); //add for ScImportOptionsDlg
715 +IMPL_ABSTDLG_BASE(AbstractScTextImportOptionsDlg_Impl);
716 IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); //add for ScAttrDlg, ScHFEditDlg, ScStyleDlg, ScSubTotalDlg,ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg
718 // AbstractTabDialog_Impl begin
719 @@ -624,6 +626,20 @@ void AbstractScImportOptionsDlg_Impl::GetImportOptions( ScImportOptions& rOption
720 pDlg->GetImportOptions(rOptions);
722 // add for AbstractScImportOptionsDlg_Impl end
724 +//add for AbstractScLangChooserDlg_Impl begin
725 +LanguageType AbstractScTextImportOptionsDlg_Impl::GetLanguageType() const
727 + return pDlg->getLanguageType();
730 +bool AbstractScTextImportOptionsDlg_Impl::IsDateConversionSet() const
732 + return pDlg->isDateConversionSet();
735 +//add for AbstractScLangChooserDlg_Impl end
737 // =========================Factories for createdialog ===================
739 //add for ScImportAsciiDlg begin
740 @@ -646,6 +662,21 @@ AbstractScImportAsciiDlg * ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg
742 // ScImportAsciiDlg end
744 +AbstractScTextImportOptionsDlg * ScAbstractDialogFactory_Impl::CreateScTextImportOptionsDlg( Window* pParent, int nId )
746 + ScTextImportOptionsDlg* pDlg = NULL;
747 + switch (nId)
749 + case RID_SCDLG_TEXT_IMPORT_OPTIONS:
750 + pDlg = new ScTextImportOptionsDlg(pParent);
751 + break;
752 + default:
756 + return pDlg ? new AbstractScTextImportOptionsDlg_Impl(pDlg) : NULL;
759 //add for ScAutoFormatDlg begin
761 AbstractScAutoFormatDlg * ScAbstractDialogFactory_Impl::CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg
762 diff --git sc/source/ui/attrdlg/scdlgfact.hxx sc/source/ui/attrdlg/scdlgfact.hxx
763 index 6891530..933ae07 100644
764 --- sc/source/ui/attrdlg/scdlgfact.hxx
765 +++ sc/source/ui/attrdlg/scdlgfact.hxx
766 @@ -65,6 +65,7 @@ class ScStringInputDlg;
767 class ScImportOptionsDlg;
768 class SfxTabDialog;
769 class ScSortWarningDlg;
770 +class ScTextImportOptionsDlg;
772 #define DECL_ABSTDLG_BASE(Class,DialogClass) \
773 DialogClass* pDlg; \
774 @@ -350,6 +351,13 @@ class AbstractScImportOptionsDlg_Impl : public AbstractScImportOptionsDlg //add
775 virtual void GetImportOptions( ScImportOptions& rOptions ) const;
778 +class AbstractScTextImportOptionsDlg_Impl : public AbstractScTextImportOptionsDlg
780 + DECL_ABSTDLG_BASE( AbstractScTextImportOptionsDlg_Impl, ScTextImportOptionsDlg)
781 + virtual LanguageType GetLanguageType() const;
782 + virtual bool IsDateConversionSet() const;
785 //add for ScAttrDlg , ScHFEditDlg, ScStyleDlg, ScSubTotalDlg, ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg
786 class AbstractTabDialog_Impl : public SfxAbstractTabDialog
788 @@ -391,6 +399,8 @@ public:
789 SvStream* pInStream, int nId,
790 sal_Unicode cSep = '\t');
792 + virtual AbstractScTextImportOptionsDlg * CreateScTextImportOptionsDlg( Window* pParent, int nId );
794 virtual AbstractScAutoFormatDlg * CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg
795 ScAutoFormat* pAutoFormat,
796 const ScAutoFormatData* pSelFormatData,
797 diff --git sc/source/ui/dbgui/asciiopt.cxx sc/source/ui/dbgui/asciiopt.cxx
798 index 8b385c2..6b26dee 100644
799 --- sc/source/ui/dbgui/asciiopt.cxx
800 +++ sc/source/ui/dbgui/asciiopt.cxx
801 @@ -56,8 +56,11 @@ ScAsciiOptions::ScAsciiOptions() :
802 bFixedLen ( FALSE ),
803 aFieldSeps ( ';' ),
804 bMergeFieldSeps ( FALSE ),
805 + bQuotedFieldAsText(false),
806 + bDetectSpecialNumber(false),
807 cTextSep ( cDefaultTextSep ),
808 eCharSet ( gsl_getSystemTextEncoding() ),
809 + eLang ( LANGUAGE_SYSTEM ),
810 bCharSetSystem ( FALSE ),
811 nStartRow ( 1 ),
812 nInfoCount ( 0 ),
813 @@ -71,8 +74,11 @@ ScAsciiOptions::ScAsciiOptions(const ScAsciiOptions& rOpt) :
814 bFixedLen ( rOpt.bFixedLen ),
815 aFieldSeps ( rOpt.aFieldSeps ),
816 bMergeFieldSeps ( rOpt.bMergeFieldSeps ),
817 + bQuotedFieldAsText(rOpt.bQuotedFieldAsText),
818 + bDetectSpecialNumber(rOpt.bDetectSpecialNumber),
819 cTextSep ( rOpt.cTextSep ),
820 eCharSet ( rOpt.eCharSet ),
821 + eLang ( rOpt.eLang ),
822 bCharSetSystem ( rOpt.bCharSetSystem ),
823 nStartRow ( rOpt.nStartRow ),
824 nInfoCount ( rOpt.nInfoCount )
825 @@ -155,6 +161,7 @@ ScAsciiOptions& ScAsciiOptions::operator=( const ScAsciiOptions& rCpy )
826 bFixedLen = rCpy.bFixedLen;
827 aFieldSeps = rCpy.aFieldSeps;
828 bMergeFieldSeps = rCpy.bMergeFieldSeps;
829 + bQuotedFieldAsText = rCpy.bQuotedFieldAsText;
830 cTextSep = rCpy.cTextSep;
831 eCharSet = rCpy.eCharSet;
832 bCharSetSystem = rCpy.bCharSetSystem;
833 @@ -169,6 +176,7 @@ BOOL ScAsciiOptions::operator==( const ScAsciiOptions& rCmp ) const
834 if ( bFixedLen == rCmp.bFixedLen &&
835 aFieldSeps == rCmp.aFieldSeps &&
836 bMergeFieldSeps == rCmp.bMergeFieldSeps &&
837 + bQuotedFieldAsText == rCmp.bQuotedFieldAsText &&
838 cTextSep == rCmp.cTextSep &&
839 eCharSet == rCmp.eCharSet &&
840 bCharSetSystem == rCmp.bCharSetSystem &&
841 @@ -248,13 +256,20 @@ void ScAsciiOptions::ReadFromString( const String& rString )
842 eCharSet = ScGlobal::GetCharsetValue( aToken );
845 + // Language
846 + if (nCount >= 4)
847 + {
848 + aToken = rString.GetToken(3, ',');
849 + eLang = static_cast<LanguageType>(aToken.ToInt32());
853 // Startzeile
856 - if ( nCount >= 4 )
857 + if ( nCount >= 5 )
859 - aToken = rString.GetToken(3,',');
860 + aToken = rString.GetToken(4,',');
861 nStartRow = aToken.ToInt32();
864 @@ -262,12 +277,12 @@ void ScAsciiOptions::ReadFromString( const String& rString )
865 // Spalten-Infos
868 - if ( nCount >= 5 )
869 + if ( nCount >= 6 )
871 delete[] pColStart;
872 delete[] pColFormat;
874 - aToken = rString.GetToken(4,',');
875 + aToken = rString.GetToken(5,',');
876 nSub = aToken.GetTokenCount('/');
877 nInfoCount = nSub / 2;
878 if (nInfoCount)
879 @@ -286,6 +301,20 @@ void ScAsciiOptions::ReadFromString( const String& rString )
880 pColFormat = NULL;
884 + // Import quoted field as text.
885 + if (nCount >= 7)
887 + aToken = rString.GetToken(6, ',');
888 + bQuotedFieldAsText = aToken.EqualsAscii("true") ? true : false;
891 + // Detect special nubmers.
892 + if (nCount >= 8)
894 + aToken = rString.GetToken(7, ',');
895 + bDetectSpecialNumber = aToken.EqualsAscii("true") ? true : false;
900 @@ -336,6 +365,10 @@ String ScAsciiOptions::WriteToString() const
901 aOutStr += ScGlobal::GetCharsetString( eCharSet );
902 aOutStr += ','; // Token-Ende
904 + // Language
905 + aOutStr += String::CreateFromInt32(eLang);
906 + aOutStr += ',';
909 // Startzeile
911 @@ -357,6 +390,15 @@ String ScAsciiOptions::WriteToString() const
912 aOutStr += String::CreateFromInt32(pColFormat[nInfo]);
915 + aOutStr += ',';
917 + // Import quoted field as text.
918 + aOutStr += String::CreateFromAscii(bQuotedFieldAsText ? "true" : "false");
919 + aOutStr += ',';
921 + // Detect special nubmers.
922 + aOutStr += String::CreateFromAscii(bDetectSpecialNumber ? "true" : "false");
924 return aOutStr;
927 diff --git sc/source/ui/dbgui/asciiopt.hrc sc/source/ui/dbgui/asciiopt.hrc
928 index 2dcfe00..6fde4ee 100644
929 --- sc/source/ui/dbgui/asciiopt.hrc
930 +++ sc/source/ui/dbgui/asciiopt.hrc
931 @@ -29,31 +29,46 @@
932 ************************************************************************/
933 #include "sc.hrc"
934 //#define RID_SCDLG_ASCII 256
935 -#define RB_SEPARATED 1
936 -#define RB_FIXED 2
937 -#define FT_CHARSET 3
938 -#define LB_CHARSET 4
939 -#define FL_SEPOPT 5
940 -#define FT_FIELDSEP 6
941 -#define CB_FIELDSEP 7
942 -#define FT_TEXTSEP 8
943 -#define CB_TEXTSEP 9
944 -#define FL_FIELDOPT 10
945 -#define FT_TYPE 12
946 -#define FT_PREVIEW 13
947 -#define LB_TYPE1 23
948 -#define FL_WIDTH 30
949 -#define BTN_OK 31
950 -#define BTN_CANCEL 32
951 -#define BTN_HELP 33
952 -#define CTR_TABLEBOX 41
953 -#define CKB_TAB 51
954 -#define CKB_SPACE 52
955 -#define CKB_SEMICOLON 53
956 -#define CKB_COMMA 54
957 -#define CKB_OTHER 55
958 -#define ED_OTHER 56
959 -#define FT_AT_ROW 59
960 -#define NF_AT_ROW 60
961 -#define CB_ASONCE 90
962 -#define STR_TEXTTOCOLUMNS 100
963 +#define BTN_OK 1
964 +#define BTN_CANCEL 2
965 +#define BTN_HELP 3
967 +#define FL_FIELDOPT 4
968 +#define FT_CHARSET 5
969 +#define LB_CHARSET 6
970 +#define FT_CUSTOMLANG 7
971 +#define LB_CUSTOMLANG 8
972 +#define FT_AT_ROW 9
973 +#define NF_AT_ROW 10
975 +#define FL_SEPOPT 11
976 +#define RB_FIXED 12
977 +#define RB_SEPARATED 13
978 +#define CKB_TAB 14
979 +#define CKB_COMMA 15
980 +#define CKB_OTHER 16
981 +#define ED_OTHER 17
982 +#define CKB_SEMICOLON 18
983 +#define CKB_SPACE 19
984 +#define CB_ASONCE 20
985 +#define CB_TEXTSEP 21
986 +#define FT_TEXTSEP 22
988 +#define FL_OTHER_OPTIONS 23
989 +#define CB_QUOTED_AS_TEXT 24
990 +#define CB_DETECT_SPECIAL_NUMBER 25
992 +#define FL_WIDTH 26
993 +#define FT_TYPE 27
994 +#define LB_TYPE1 28
995 +#define CTR_TABLEBOX 29
996 +#define STR_TEXTTOCOLUMNS 30
1006 diff --git sc/source/ui/dbgui/asciiopt.src sc/source/ui/dbgui/asciiopt.src
1007 index a01e819..2d8a7f9 100644
1008 --- sc/source/ui/dbgui/asciiopt.src
1009 +++ sc/source/ui/dbgui/asciiopt.src
1010 @@ -34,55 +34,44 @@ ModalDialog RID_SCDLG_ASCII
1012 OutputSize = TRUE ;
1013 SVLook = TRUE ;
1014 - Size = MAP_APPFONT ( 320 , 247 ) ;
1015 + Size = MAP_APPFONT ( 320 , 305 ) ;
1016 Text [ en-US ] = "Text Import" ;
1017 Moveable = TRUE ;
1018 - FixedLine FL_WIDTH
1020 - Pos = MAP_APPFONT ( 6 , 132 ) ;
1021 - Size = MAP_APPFONT ( 252 , 8 ) ;
1022 - Text [ en-US ] = "Fields" ;
1023 - };
1024 - FixedText FT_TYPE
1026 + OKButton BTN_OK
1028 - Pos = MAP_APPFONT ( 12 , 145 ) ;
1029 - Size = MAP_APPFONT ( 60 , 8 ) ;
1030 - Text [ en-US ] = "Column t~ype";
1031 + Pos = MAP_APPFONT ( 264 , 6 ) ;
1032 + Size = MAP_APPFONT ( 50 , 14 ) ;
1033 + TabStop = TRUE ;
1034 + DefButton = TRUE ;
1036 - ListBox LB_TYPE1
1037 + CancelButton BTN_CANCEL
1039 - Pos = MAP_APPFONT ( 76 , 143 ) ;
1040 - Size = MAP_APPFONT ( 60 , 68 ) ;
1041 + Pos = MAP_APPFONT ( 264 , 23 ) ;
1042 + Size = MAP_APPFONT ( 50 , 14 ) ;
1043 TabStop = TRUE ;
1044 - DropDown = TRUE ;
1046 - FixedLine FL_SEPOPT
1048 - Pos = MAP_APPFONT ( 6 , 48 ) ;
1049 - Size = MAP_APPFONT ( 252 , 8 ) ;
1050 - Text [ en-US ] = "Separator options" ;
1051 - };
1052 - RadioButton RB_FIXED
1053 + HelpButton BTN_HELP
1055 - Pos = MAP_APPFONT ( 12 , 59 ) ;
1056 - Size = MAP_APPFONT ( 243 , 10 ) ;
1057 - Text [ en-US ] = "~Fixed width" ;
1058 + Pos = MAP_APPFONT ( 264 , 43 ) ;
1059 + Size = MAP_APPFONT ( 50 , 14 ) ;
1060 TabStop = TRUE ;
1062 - RadioButton RB_SEPARATED
1064 + FixedLine FL_FIELDOPT
1066 - Pos = MAP_APPFONT ( 12 , 73 ) ;
1067 - Size = MAP_APPFONT ( 243 , 10 ) ;
1068 - Text [ en-US ] = "~Separated by" ;
1069 - TabStop = TRUE ;
1070 - Check = TRUE ;
1071 + Pos = MAP_APPFONT ( 6 , 3 ) ;
1072 + Size = MAP_APPFONT ( 252 , 8 ) ;
1073 + Text [ en-US ] = "Import" ;
1076 FixedText FT_CHARSET
1078 Pos = MAP_APPFONT ( 12 , 16 ) ;
1079 Size = MAP_APPFONT ( 60 , 8 ) ;
1080 Text [ en-US ] = "Ch~aracter set" ;
1083 ListBox LB_CHARSET
1085 Pos = MAP_APPFONT ( 76 , 14 ) ;
1086 @@ -91,75 +80,81 @@ ModalDialog RID_SCDLG_ASCII
1087 DropDown = TRUE ;
1088 Sort = TRUE;
1090 - FixedLine FL_FIELDOPT
1092 - Pos = MAP_APPFONT ( 6 , 3 ) ;
1093 - Size = MAP_APPFONT ( 252 , 8 ) ;
1094 - Text [ en-US ] = "Import" ;
1095 - };
1096 - FixedText FT_TEXTSEP
1098 + FixedText FT_CUSTOMLANG
1100 - Pos = MAP_APPFONT ( 156 , 114 ) ;
1101 + Pos = MAP_APPFONT ( 12 , 32 ) ;
1102 Size = MAP_APPFONT ( 60 , 8 ) ;
1103 - Text [ en-US ] = "Te~xt delimiter" ;
1104 + Text [ en-US ] = "Language" ;
1106 - ComboBox CB_TEXTSEP
1108 + ListBox LB_CUSTOMLANG
1110 - Pos = MAP_APPFONT ( 218 , 112 ) ;
1111 - Size = MAP_APPFONT ( 37 , 94 ) ;
1112 + Pos = MAP_APPFONT ( 76 , 30 ) ;
1113 + Size = MAP_APPFONT ( 130 , 61 ) ;
1114 TabStop = TRUE ;
1115 DropDown = TRUE ;
1116 + Sort = TRUE;
1118 - OKButton BTN_OK
1120 + FixedText FT_AT_ROW
1122 - Pos = MAP_APPFONT ( 264 , 6 ) ;
1123 - Size = MAP_APPFONT ( 50 , 14 ) ;
1124 + Pos = MAP_APPFONT ( 12 , 48 ) ;
1125 + Size = MAP_APPFONT ( 60 , 8 ) ;
1126 + Text [ en-US ] = "From ro~w" ;
1127 + };
1129 + NumericField NF_AT_ROW
1131 + Border = TRUE ;
1132 + SVLook = TRUE ;
1133 + Pos = MAP_APPFONT ( 76 , 46 ) ;
1134 + Size = MAP_APPFONT ( 30 , 12 ) ;
1135 TabStop = TRUE ;
1136 - DefButton = TRUE ;
1137 + Spin = TRUE ;
1138 + Repeat = TRUE ;
1139 + Minimum = 1 ;
1141 - CancelButton BTN_CANCEL
1143 + FixedLine FL_SEPOPT
1145 - Pos = MAP_APPFONT ( 264 , 23 ) ;
1146 - Size = MAP_APPFONT ( 50 , 14 ) ;
1147 + Pos = MAP_APPFONT ( 6 , 63 ) ;
1148 + Size = MAP_APPFONT ( 252 , 8 ) ;
1149 + Text [ en-US ] = "Separator options" ;
1150 + };
1151 + RadioButton RB_FIXED
1153 + Pos = MAP_APPFONT ( 12 , 75 ) ;
1154 + Size = MAP_APPFONT ( 243 , 10 ) ;
1155 + Text [ en-US ] = "~Fixed width" ;
1156 TabStop = TRUE ;
1158 - HelpButton BTN_HELP
1159 + RadioButton RB_SEPARATED
1161 - Pos = MAP_APPFONT ( 264 , 43 ) ;
1162 - Size = MAP_APPFONT ( 50 , 14 ) ;
1163 + Pos = MAP_APPFONT ( 12 , 89 ) ;
1164 + Size = MAP_APPFONT ( 243 , 10 ) ;
1165 + Text [ en-US ] = "~Separated by" ;
1166 TabStop = TRUE ;
1167 + Check = TRUE ;
1170 CheckBox CKB_TAB
1172 - Pos = MAP_APPFONT ( 20 , 86 ) ;
1173 + Pos = MAP_APPFONT ( 20 , 102 ) ;
1174 Size = MAP_APPFONT ( 68 , 10 ) ;
1175 TabStop = TRUE ;
1176 Text [ en-US ] = "~Tab" ;
1178 - CheckBox CKB_SEMICOLON
1180 - Pos = MAP_APPFONT ( 20 , 99 ) ;
1181 - Size = MAP_APPFONT ( 68 , 10 ) ;
1182 - TabStop = TRUE ;
1183 - Text [ en-US ] = "S~emicolon" ;
1184 - };
1185 CheckBox CKB_COMMA
1187 - Pos = MAP_APPFONT ( 92 , 86 ) ;
1188 + Pos = MAP_APPFONT ( 92 , 102 ) ;
1189 Size = MAP_APPFONT ( 68 , 10 ) ;
1190 TabStop = TRUE ;
1191 Text [ en-US ] = "~Comma" ;
1193 - CheckBox CKB_SPACE
1195 - Pos = MAP_APPFONT ( 92 , 99 ) ;
1196 - Size = MAP_APPFONT ( 68 , 10 ) ;
1197 - TabStop = TRUE ;
1198 - Text [ en-US ] = "S~pace" ;
1199 - };
1200 CheckBox CKB_OTHER
1202 - Pos = MAP_APPFONT ( 164 , 86 ) ;
1203 + Pos = MAP_APPFONT ( 164 , 102 ) ;
1204 Size = MAP_APPFONT ( 50 , 10 ) ;
1205 TabStop = TRUE ;
1206 Text [ en-US ] = "~Other" ;
1207 @@ -167,43 +162,100 @@ ModalDialog RID_SCDLG_ASCII
1208 Edit ED_OTHER
1210 Border = TRUE ;
1211 - Pos = MAP_APPFONT ( 218 , 84 ) ;
1212 + Pos = MAP_APPFONT ( 218 , 100 ) ;
1213 Size = MAP_APPFONT ( 37 , 12 ) ;
1214 TabStop = TRUE ;
1215 MaxTextLength = 10 ;
1217 - FixedText FT_AT_ROW
1219 + CheckBox CKB_SEMICOLON
1221 - Pos = MAP_APPFONT ( 12 , 32 ) ;
1222 + Pos = MAP_APPFONT ( 20 , 115 ) ;
1223 + Size = MAP_APPFONT ( 68 , 10 ) ;
1224 + TabStop = TRUE ;
1225 + Text [ en-US ] = "S~emicolon" ;
1226 + };
1227 + CheckBox CKB_SPACE
1229 + Pos = MAP_APPFONT ( 92 , 115 ) ;
1230 + Size = MAP_APPFONT ( 68 , 10 ) ;
1231 + TabStop = TRUE ;
1232 + Text [ en-US ] = "S~pace" ;
1233 + };
1235 + CheckBox CB_ASONCE
1237 + Pos = MAP_APPFONT ( 20 , 130 ) ;
1238 + Size = MAP_APPFONT ( 130 , 10 ) ;
1239 + TabStop = TRUE ;
1240 + Text [ en-US ] = "Merge ~delimiters" ;
1241 + };
1243 + ComboBox CB_TEXTSEP
1245 + Pos = MAP_APPFONT ( 218 , 128 ) ;
1246 + Size = MAP_APPFONT ( 37 , 94 ) ;
1247 + TabStop = TRUE ;
1248 + DropDown = TRUE ;
1249 + };
1250 + FixedText FT_TEXTSEP
1252 + Pos = MAP_APPFONT ( 156 , 130 ) ;
1253 Size = MAP_APPFONT ( 60 , 8 ) ;
1254 - Text [ en-US ] = "From ro~w" ;
1255 + Text [ en-US ] = "Te~xt delimiter" ;
1257 - NumericField NF_AT_ROW
1259 + FixedLine FL_OTHER_OPTIONS
1261 - Border = TRUE ;
1262 - SVLook = TRUE ;
1263 - Pos = MAP_APPFONT ( 76 , 30 ) ;
1264 - Size = MAP_APPFONT ( 30 , 12 ) ;
1265 + Pos = MAP_APPFONT ( 6 , 146 ) ;
1266 + Size = MAP_APPFONT ( 252 , 8 ) ;
1267 + Text [ en-US ] = "Other options" ;
1268 + };
1270 + CheckBox CB_QUOTED_AS_TEXT
1272 + Pos = MAP_APPFONT ( 20 , 158 ) ;
1273 + Size = MAP_APPFONT ( 130 , 10 ) ;
1274 TabStop = TRUE ;
1275 - Spin = TRUE ;
1276 - Repeat = TRUE ;
1277 - Minimum = 1 ;
1278 + Text [ en-US ] = "~Quoted field as text" ;
1279 + };
1281 + CheckBox CB_DETECT_SPECIAL_NUMBER
1283 + Pos = MAP_APPFONT ( 20 , 171 ) ;
1284 + Size = MAP_APPFONT ( 130 , 10 ) ;
1285 + TabStop = TRUE ;
1286 + Text [ en-US ] = "Detect special numbers" ;
1287 + };
1289 + FixedLine FL_WIDTH
1291 + Pos = MAP_APPFONT ( 6 , 187 ) ;
1292 + Size = MAP_APPFONT ( 252 , 8 ) ;
1293 + Text [ en-US ] = "Fields" ;
1294 + };
1295 + FixedText FT_TYPE
1297 + Pos = MAP_APPFONT ( 12 , 200 ) ;
1298 + Size = MAP_APPFONT ( 60 , 8 ) ;
1299 + Text [ en-US ] = "Column t~ype";
1300 + };
1301 + ListBox LB_TYPE1
1303 + Pos = MAP_APPFONT ( 76 , 198 ) ;
1304 + Size = MAP_APPFONT ( 60 , 68 ) ;
1305 + TabStop = TRUE ;
1306 + DropDown = TRUE ;
1308 Control CTR_TABLEBOX
1310 HelpId = HID_SC_ASCII_TABCTR ;
1311 Border = TRUE ;
1312 DialogControl = TRUE ;
1313 - Pos = MAP_APPFONT ( 12 , 159 ) ;
1314 + Pos = MAP_APPFONT ( 12 , 216 ) ;
1315 Size = MAP_APPFONT ( 243 , 82 ) ;
1317 - CheckBox CB_ASONCE
1319 - Pos = MAP_APPFONT ( 20 , 114 ) ;
1320 - Size = MAP_APPFONT ( 130 , 10 ) ;
1321 - TabStop = TRUE ;
1322 - Text [ en-US ] = "Merge ~delimiters" ;
1323 - };
1325 String STR_TEXTTOCOLUMNS
1327 Text [ en-US ] = "Text to Columns" ;
1328 diff --git sc/source/ui/dbgui/csvgrid.cxx sc/source/ui/dbgui/csvgrid.cxx
1329 index ddbfb44..5725645 100644
1330 --- sc/source/ui/dbgui/csvgrid.cxx
1331 +++ sc/source/ui/dbgui/csvgrid.cxx
1332 @@ -737,7 +737,8 @@ void ScCsvGrid::ImplSetTextLineSep(
1333 while( *pChar && (nColIx < sal::static_int_cast<sal_uInt32>(CSV_MAXCOLCOUNT)) )
1335 // scan for next cell text
1336 - pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText, cTextSep, pSepChars, bMergeSep );
1337 + bool bIsQuoted = false;
1338 + pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText, cTextSep, pSepChars, bMergeSep, bIsQuoted );
1340 // update column width
1341 sal_Int32 nWidth = Max( CSV_MINCOLWIDTH, aCellText.Len() + sal_Int32( 1 ) );
1342 diff --git sc/source/ui/dbgui/csvruler.cxx sc/source/ui/dbgui/csvruler.cxx
1343 index 5437f9b..7cd060d 100644
1344 --- sc/source/ui/dbgui/csvruler.cxx
1345 +++ sc/source/ui/dbgui/csvruler.cxx
1346 @@ -37,8 +37,76 @@
1347 #include "AccessibleCsvControl.hxx"
1350 +#include <optutil.hxx>
1351 +#include <com/sun/star/uno/Any.hxx>
1352 +#include <com/sun/star/uno/Sequence.hxx>
1353 +#include "miscuno.hxx"
1355 +using namespace rtl;
1356 +using namespace com::sun::star::uno;
1360 +// ============================================================================
1361 +#define SEP_PATH "Office.Calc/Dialogs/CSVImport"
1362 +#define FIXED_WIDTH_LIST "FixedWidthList"
1365 // ============================================================================
1367 +static void load_FixedWidthList(ScCsvSplits &aSplits)
1369 + String sSplits;
1370 + OUString sFixedWidthLists;
1372 + Sequence<Any>aValues;
1373 + const Any *pProperties;
1374 + Sequence<OUString> aNames(1);
1375 + OUString* pNames = aNames.getArray();
1376 + ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
1378 + pNames[0] = OUString::createFromAscii( FIXED_WIDTH_LIST );
1379 + aValues = aItem.GetProperties( aNames );
1380 + pProperties = aValues.getConstArray();
1382 + if( pProperties[0].hasValue() )
1384 + aSplits.Clear();
1385 + pProperties[0] >>= sFixedWidthLists;
1387 + sSplits = String( sFixedWidthLists );
1389 + // String ends with a semi-colon so there is no 'int' after the last one.
1390 + for(int i=0;i<sSplits.GetTokenCount()-1;i++ )
1391 + aSplits.Insert( sSplits.GetToken(i).ToInt32() );
1394 +static void save_FixedWidthList(ScCsvSplits aSplits)
1396 + String sSplits;
1397 + // Create a semi-colon separated string to save the splits
1398 + sal_uInt32 n = aSplits.Count();
1399 + for (sal_uInt32 i = 0; i < n; ++i)
1401 + sSplits.Append( String::CreateFromInt32( aSplits[i] ) );
1402 + sSplits.Append((char)';');
1405 + OUString sFixedWidthLists = OUString( sSplits );
1406 + Sequence<Any> aValues;
1407 + Any *pProperties;
1408 + Sequence<OUString> aNames(1);
1409 + OUString* pNames = aNames.getArray();
1410 + ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
1412 + pNames[0] = OUString::createFromAscii( FIXED_WIDTH_LIST );
1413 + aValues = aItem.GetProperties( aNames );
1414 + pProperties = aValues.getArray();
1415 + pProperties[0] <<= sFixedWidthLists;
1417 + aItem.PutProperties(aNames, aValues);
1420 ScCsvRuler::ScCsvRuler( ScCsvControl& rParent ) :
1421 ScCsvControl( rParent ),
1422 mnPosCursorLast( 1 )
1423 @@ -48,6 +116,13 @@ ScCsvRuler::ScCsvRuler( ScCsvControl& rParent ) :
1424 InitSizeData();
1425 maBackgrDev.SetFont( GetFont() );
1426 maRulerDev.SetFont( GetFont() );
1428 + load_FixedWidthList( maSplits );
1431 +ScCsvRuler::~ScCsvRuler()
1433 + save_FixedWidthList( maSplits );
1437 diff --git sc/source/ui/dbgui/makefile.mk sc/source/ui/dbgui/makefile.mk
1438 index 5d71655..130e0a3 100644
1439 --- sc/source/ui/dbgui/makefile.mk
1440 +++ sc/source/ui/dbgui/makefile.mk
1441 @@ -53,6 +53,7 @@ SLOFILES = \
1442 $(SLO)$/pfiltdlg.obj \
1443 $(SLO)$/dbnamdlg.obj \
1444 $(SLO)$/expftext.obj \
1445 + $(SLO)$/textimportoptions.obj \
1446 $(SLO)$/subtdlg.obj \
1447 $(SLO)$/tpsubt.obj \
1448 $(SLO)$/fieldwnd.obj \
1449 @@ -85,6 +86,7 @@ EXCEPTIONSFILES= \
1451 SRS1NAME=$(TARGET)
1452 SRC1FILES = \
1453 + textimportoptions.src \
1454 pivot.src \
1455 pvfundlg.src \
1456 dpgroupdlg.src \
1457 @@ -114,7 +116,8 @@ LIB1OBJFILES = \
1458 $(SLO)$/csvruler.obj \
1459 $(SLO)$/csvgrid.obj \
1460 $(SLO)$/csvtablebox.obj \
1461 - $(SLO)$/asciiopt.obj
1462 + $(SLO)$/asciiopt.obj \
1463 + $(SLO)$/textimportoptions.obj
1465 # --- Tagets -------------------------------------------------------
1467 diff --git sc/source/ui/dbgui/scuiasciiopt.cxx sc/source/ui/dbgui/scuiasciiopt.cxx
1468 index dc4a05f..c2a75b2 100644
1469 --- sc/source/ui/dbgui/scuiasciiopt.cxx
1470 +++ sc/source/ui/dbgui/scuiasciiopt.cxx
1471 @@ -44,6 +44,12 @@
1472 // ause
1473 #include "editutil.hxx"
1475 +#include <optutil.hxx>
1476 +#include <com/sun/star/uno/Any.hxx>
1477 +#include <com/sun/star/uno/Sequence.hxx>
1478 +#include "miscuno.hxx"
1481 //! TODO make dynamic
1482 #ifdef WIN
1483 const SCSIZE ASCIIDLG_MAXROWS = 10000;
1484 @@ -51,6 +57,22 @@ const SCSIZE ASCIIDLG_MAXROWS = 10000;
1485 const SCSIZE ASCIIDLG_MAXROWS = MAXROWCOUNT;
1486 #endif
1489 +using namespace rtl;
1490 +using namespace com::sun::star::uno;
1492 +// Defines - CSV Import Preserve Options
1493 +#define FIXED_WIDTH "FixedWidth"
1494 +#define FROM_ROW "FromRow"
1495 +#define CHAR_SET "CharSet"
1496 +#define SEPARATORS "Separators"
1497 +#define TEXT_SEPARATORS "TextSeparators"
1498 +#define MERGE_DELIMITERS "MergeDelimiters"
1499 +#define QUOTED_AS_TEXT "QuotedFieldAsText"
1500 +#define DETECT_SPECIAL_NUM "DetectSpecialNumbers"
1501 +#define LANGUAGE "Language"
1502 +#define SEP_PATH "Office.Calc/Dialogs/CSVImport"
1504 // ============================================================================
1506 void lcl_FillCombo( ComboBox& rCombo, const String& rList, sal_Unicode cSelect )
1507 @@ -98,11 +120,96 @@ sal_Unicode lcl_CharFromCombo( ComboBox& rCombo, const String& rList )
1508 return c;
1511 +static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparators,
1512 + bool &bMergeDelimiters, bool& bQuotedAsText, bool& bDetectSpecialNum,
1513 + bool &bFixedWidth, sal_Int32 &nFromRow, sal_Int32 &nCharSet,
1514 + sal_Int32& nLanguage )
1516 + Sequence<Any>aValues;
1517 + const Any *pProperties;
1518 + Sequence<OUString> aNames(9);
1519 + OUString* pNames = aNames.getArray();
1520 + ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
1522 + pNames[0] = OUString::createFromAscii( MERGE_DELIMITERS );
1523 + pNames[1] = OUString::createFromAscii( SEPARATORS );
1524 + pNames[2] = OUString::createFromAscii( TEXT_SEPARATORS );
1525 + pNames[3] = OUString::createFromAscii( FIXED_WIDTH );
1526 + pNames[4] = OUString::createFromAscii( FROM_ROW );
1527 + pNames[5] = OUString::createFromAscii( CHAR_SET );
1528 + pNames[6] = OUString::createFromAscii( QUOTED_AS_TEXT );
1529 + pNames[7] = OUString::createFromAscii( DETECT_SPECIAL_NUM );
1530 + pNames[8] = OUString::createFromAscii( LANGUAGE );
1531 + aValues = aItem.GetProperties( aNames );
1532 + pProperties = aValues.getConstArray();
1533 + if( pProperties[1].hasValue() )
1534 + pProperties[1] >>= sFieldSeparators;
1536 + if( pProperties[2].hasValue() )
1537 + pProperties[2] >>= sTextSeparators;
1539 + if( pProperties[0].hasValue() )
1540 + bMergeDelimiters = ScUnoHelpFunctions::GetBoolFromAny( pProperties[0] );
1542 + if( pProperties[3].hasValue() )
1543 + bFixedWidth = ScUnoHelpFunctions::GetBoolFromAny( pProperties[3] );
1545 + if( pProperties[4].hasValue() )
1546 + pProperties[4] >>= nFromRow;
1548 + if( pProperties[5].hasValue() )
1549 + pProperties[5] >>= nCharSet;
1551 + if ( pProperties[6].hasValue() )
1552 + pProperties[6] >>= bQuotedAsText;
1554 + if ( pProperties[7].hasValue() )
1555 + pProperties[7] >>= bDetectSpecialNum;
1557 + if ( pProperties[8].hasValue() )
1558 + pProperties[8] >>= nLanguage;
1561 +static void save_Separators(
1562 + String maSeparators, String maTxtSep, bool bMergeDelimiters, bool bQuotedAsText,
1563 + bool bDetectSpecialNum, bool bFixedWidth, sal_Int32 nFromRow, sal_Int32 nCharSet, sal_Int32 nLanguage )
1565 + OUString sFieldSeparators = OUString( maSeparators );
1566 + OUString sTextSeparators = OUString( maTxtSep );
1567 + Sequence<Any> aValues;
1568 + Any *pProperties;
1569 + Sequence<OUString> aNames(9);
1570 + OUString* pNames = aNames.getArray();
1571 + ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
1573 + pNames[0] = OUString::createFromAscii( MERGE_DELIMITERS );
1574 + pNames[1] = OUString::createFromAscii( SEPARATORS );
1575 + pNames[2] = OUString::createFromAscii( TEXT_SEPARATORS );
1576 + pNames[3] = OUString::createFromAscii( FIXED_WIDTH );
1577 + pNames[4] = OUString::createFromAscii( FROM_ROW );
1578 + pNames[5] = OUString::createFromAscii( CHAR_SET );
1579 + pNames[6] = OUString::createFromAscii( QUOTED_AS_TEXT );
1580 + pNames[7] = OUString::createFromAscii( DETECT_SPECIAL_NUM );
1581 + pNames[8] = OUString::createFromAscii( LANGUAGE );
1582 + aValues = aItem.GetProperties( aNames );
1583 + pProperties = aValues.getArray();
1584 + pProperties[1] <<= sFieldSeparators;
1585 + pProperties[2] <<= sTextSeparators;
1586 + ScUnoHelpFunctions::SetBoolInAny( pProperties[0], bMergeDelimiters );
1587 + ScUnoHelpFunctions::SetBoolInAny( pProperties[3], bFixedWidth );
1588 + pProperties[4] <<= nFromRow;
1589 + pProperties[5] <<= nCharSet;
1590 + pProperties[6] <<= static_cast<sal_Bool>(bQuotedAsText);
1591 + pProperties[7] <<= static_cast<sal_Bool>(bDetectSpecialNum);
1592 + pProperties[8] <<= nLanguage;
1594 + aItem.PutProperties(aNames, aValues);
1597 // ----------------------------------------------------------------------------
1599 ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
1600 - SvStream* pInStream, sal_Unicode cSep ) :
1601 + SvStream* pInStream, sal_Unicode /*cSep*/ ) :
1602 ModalDialog ( pParent, ScResId( RID_SCDLG_ASCII ) ),
1603 mpDatStream ( pInStream ),
1604 mnStreamPos( pInStream ? pInStream->Tell() : 0 ),
1605 @@ -113,6 +220,8 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
1606 aFlFieldOpt ( this, ScResId( FL_FIELDOPT ) ),
1607 aFtCharSet ( this, ScResId( FT_CHARSET ) ),
1608 aLbCharSet ( this, ScResId( LB_CHARSET ) ),
1609 + aFtCustomLang( this, ScResId( FT_CUSTOMLANG ) ),
1610 + aLbCustomLang( this, ScResId( LB_CUSTOMLANG ) ),
1612 aFtRow ( this, ScResId( FT_AT_ROW ) ),
1613 aNfRow ( this, ScResId( NF_AT_ROW ) ),
1614 @@ -128,6 +237,10 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
1615 aCkbOther ( this, ScResId( CKB_OTHER ) ),
1616 aEdOther ( this, ScResId( ED_OTHER ) ),
1617 aCkbAsOnce ( this, ScResId( CB_ASONCE) ),
1618 + aFlOtherOpt ( this, ScResId( FL_OTHER_OPTIONS ) ),
1620 + aCkbQuotedAsText( this, ScResId(CB_QUOTED_AS_TEXT) ),
1621 + aCkbDetectNumber( this, ScResId(CB_DETECT_SPECIAL_NUMBER) ),
1622 aFtTextSep ( this, ScResId( FT_TEXTSEP ) ),
1623 aCbTextSep ( this, ScResId( CB_TEXTSEP ) ),
1625 @@ -146,14 +259,15 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
1626 aFldSepList ( ScResId( SCSTR_FIELDSEP ) ),
1627 aTextSepList( ScResId( SCSTR_TEXTSEP ) ),
1628 mcTextSep ( ScAsciiOptions::cDefaultTextSep ),
1629 - maStrTextToColumns( ScResId( STR_TEXTTOCOLUMNS ) )
1630 + maStrTextToColumns( ScResId( STR_TEXTTOCOLUMNS ) ),
1631 + mbFileImport(true)
1633 FreeResource();
1634 + mbFileImport = aDatName.Len() > 0;
1636 String aName = GetText();
1637 // aDatName is empty if invoked during paste from clipboard.
1638 - BOOL bClipboard = (aDatName.Len() == 0);
1639 - if (!bClipboard)
1640 + if (mbFileImport)
1642 aName.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" - ["));
1643 aName += aDatName;
1644 @@ -161,20 +275,55 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
1646 SetText( aName );
1648 - switch(cSep)
1650 + OUString sFieldSeparators;
1651 + OUString sTextSeparators;
1652 + bool bMergeDelimiters = false;
1653 + bool bFixedWidth = false;
1654 + bool bQuotedFieldAsText = true;
1655 + bool bDetectSpecialNum = false;
1656 + sal_Int32 nFromRow = 1;
1657 + sal_Int32 nCharSet = -1;
1658 + sal_Int32 nLanguage = 0;
1659 + if (mbFileImport)
1660 + // load separators only when importing csv files.
1661 + load_Separators (sFieldSeparators, sTextSeparators, bMergeDelimiters,
1662 + bQuotedFieldAsText, bDetectSpecialNum, bFixedWidth, nFromRow, nCharSet, nLanguage);
1663 + maFieldSeparators = String(sFieldSeparators);
1665 + if( bMergeDelimiters )
1666 + aCkbAsOnce.Check();
1667 + if (bQuotedFieldAsText)
1668 + aCkbQuotedAsText.Check();
1669 + if (bDetectSpecialNum)
1670 + aCkbDetectNumber.Check();
1671 + if( bFixedWidth )
1672 + aRbFixed.Check();
1673 + if( nFromRow != 1 )
1674 + aNfRow.SetValue( nFromRow );
1676 + ByteString bString(maFieldSeparators,RTL_TEXTENCODING_MS_1252);
1677 + const sal_Char *aSep = bString.GetBuffer();
1678 + int len = maFieldSeparators.Len();
1679 + for (int i = 0; i < len; ++i)
1681 - case '\t': aCkbTab.Check(); break;
1682 - case ';': aCkbSemicolon.Check(); break;
1683 - case ',': aCkbComma.Check(); break;
1684 - case ' ': aCkbSpace.Check(); break;
1685 - default:
1686 - aCkbOther.Check();
1687 - aEdOther.SetText( cSep );
1688 + switch( aSep[i] )
1690 + case '\t': aCkbTab.Check(); break;
1691 + case ';': aCkbSemicolon.Check(); break;
1692 + case ',': aCkbComma.Check(); break;
1693 + case ' ': aCkbSpace.Check(); break;
1694 + default:
1695 + aCkbOther.Check();
1696 + aEdOther.SetText( aEdOther.GetText() + OUString( aSep[i] ) );
1700 + // Get Separators from the dialog
1701 maFieldSeparators = GetSeparators();
1703 // Clipboard is always Unicode, else detect.
1704 - BOOL bPreselectUnicode = bClipboard;
1705 + bool bPreselectUnicode = !mbFileImport;
1706 // Sniff for Unicode / not
1707 if( !bPreselectUnicode && mpDatStream )
1709 @@ -210,6 +359,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
1711 // *** Separator characters ***
1712 lcl_FillCombo( aCbTextSep, aTextSepList, mcTextSep );
1713 + aCbTextSep.SetText( sTextSeparators );
1715 Link aSeparatorHdl =LINK( this, ScImportAsciiDlg, SeparatorHdl );
1716 aCbTextSep.SetSelectHdl( aSeparatorHdl );
1717 @@ -218,6 +368,8 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
1718 aCkbSemicolon.SetClickHdl( aSeparatorHdl );
1719 aCkbComma.SetClickHdl( aSeparatorHdl );
1720 aCkbAsOnce.SetClickHdl( aSeparatorHdl );
1721 + aCkbQuotedAsText.SetClickHdl( aSeparatorHdl );
1722 + aCkbDetectNumber.SetClickHdl( aSeparatorHdl );
1723 aCkbSpace.SetClickHdl( aSeparatorHdl );
1724 aCkbOther.SetClickHdl( aSeparatorHdl );
1725 aEdOther.SetModifyHdl( aSeparatorHdl );
1726 @@ -230,9 +382,18 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
1727 aLbCharSet.InsertTextEncoding( RTL_TEXTENCODING_DONTKNOW, aCharSetUser );
1728 aLbCharSet.SelectTextEncoding( bPreselectUnicode ?
1729 RTL_TEXTENCODING_UNICODE : gsl_getSystemTextEncoding() );
1731 + if( nCharSet >= 0 )
1732 + aLbCharSet.SelectEntryPos( nCharSet );
1734 SetSelectedCharSet();
1735 aLbCharSet.SetSelectHdl( LINK( this, ScImportAsciiDlg, CharSetHdl ) );
1737 + aLbCustomLang.SetLanguageList(
1738 + LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, false, false);
1739 + aLbCustomLang.InsertLanguage(LANGUAGE_SYSTEM);
1740 + aLbCustomLang.SelectLanguage(static_cast<LanguageType>(nLanguage), true);
1742 // *** column type ListBox ***
1743 xub_StrLen nCount = aColumnUser.GetTokenCount();
1744 for (xub_StrLen i=0; i<nCount; i++)
1745 @@ -261,6 +422,11 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
1747 ScImportAsciiDlg::~ScImportAsciiDlg()
1749 + if (mbFileImport)
1750 + save_Separators( maFieldSeparators, aCbTextSep.GetText(), aCkbAsOnce.IsChecked(),
1751 + aCkbQuotedAsText.IsChecked(), aCkbDetectNumber.IsChecked(),
1752 + aRbFixed.IsChecked(), aNfRow.GetValue(), aLbCharSet.GetSelectEntryPos(),
1753 + static_cast<sal_Int32>(aLbCustomLang.GetSelectLanguage()) );
1754 delete[] mpRowPosArray;
1757 @@ -339,6 +505,7 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt )
1759 rOpt.SetCharSet( meCharSet );
1760 rOpt.SetCharSetSystem( mbCharSetSystem );
1761 + rOpt.SetLanguage(aLbCustomLang.GetSelectLanguage());
1762 rOpt.SetFixedLen( aRbFixed.IsChecked() );
1763 rOpt.SetStartRow( (long)aNfRow.GetValue() );
1764 maTableBox.FillColumnData( rOpt );
1765 @@ -348,6 +515,9 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt )
1766 rOpt.SetMergeSeps( aCkbAsOnce.IsChecked() );
1767 rOpt.SetTextSep( lcl_CharFromCombo( aCbTextSep, aTextSepList ) );
1770 + rOpt.SetQuotedAsText(aCkbQuotedAsText.IsChecked());
1771 + rOpt.SetDetectSpecialNumber(aCkbDetectNumber.IsChecked());
1774 void ScImportAsciiDlg::SetTextToColumnsMode()
1775 @@ -355,8 +525,19 @@ void ScImportAsciiDlg::SetTextToColumnsMode()
1776 SetText( maStrTextToColumns );
1777 aFtCharSet.Disable();
1778 aLbCharSet.Disable();
1779 + aFtCustomLang.Disable();
1780 + aLbCustomLang.SelectLanguage(LANGUAGE_SYSTEM);
1781 + aLbCustomLang.Disable();
1782 aFtRow.Disable();
1783 aNfRow.Disable();
1785 + // Quoted field as text option is not used for text-to-columns mode.
1786 + aCkbQuotedAsText.Check(false);
1787 + aCkbQuotedAsText.Disable();
1789 + // Always detect special numbers for text-to-columns mode.
1790 + aCkbDetectNumber.Check();
1791 + aCkbDetectNumber.Disable();
1794 void ScImportAsciiDlg::SetSelectedCharSet()
1795 diff --git sc/source/ui/dbgui/textimportoptions.cxx sc/source/ui/dbgui/textimportoptions.cxx
1796 new file mode 100644
1797 index 0000000..a59b42a
1798 --- /dev/null
1799 +++ sc/source/ui/dbgui/textimportoptions.cxx
1800 @@ -0,0 +1,120 @@
1801 +/*************************************************************************
1803 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1804 + *
1805 + * Copyright 2008 by Sun Microsystems, Inc.
1807 + * OpenOffice.org - a multi-platform office productivity suite
1809 + * $RCSfile: langbox.hxx,v $
1810 + * $Revision: 1.4.242.1 $
1812 + * This file is part of OpenOffice.org.
1814 + * OpenOffice.org is free software: you can redistribute it and/or modify
1815 + * it under the terms of the GNU Lesser General Public License version 3
1816 + * only, as published by the Free Software Foundation.
1818 + * OpenOffice.org is distributed in the hope that it will be useful,
1819 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1820 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1821 + * GNU Lesser General Public License version 3 for more details
1822 + * (a copy is included in the LICENSE file that accompanied this code).
1824 + * You should have received a copy of the GNU Lesser General Public License
1825 + * version 3 along with OpenOffice.org. If not, see
1826 + * <http://www.openoffice.org/license.html>
1827 + * for a copy of the LGPLv3 License.
1829 + ************************************************************************/
1831 +// MARKER(update_precomp.py): autogen include statement, do not remove
1832 +#include "precompiled_sc.hxx"
1834 +#undef SC_DLLIMPLEMENTATION
1836 +//------------------------------------------------------------------------
1838 +#include "textimportoptions.hxx"
1839 +#include "textimportoptions.hrc"
1841 +#include "scresid.hxx"
1842 +#include "vcl/window.hxx"
1843 +#include "vcl/msgbox.hxx"
1844 +#include "vcl/svapp.hxx"
1846 +ScTextImportOptionsDlg::ScTextImportOptionsDlg(Window* pParent) :
1847 + ModalDialog(pParent, ScResId(RID_SCDLG_TEXT_IMPORT_OPTIONS)),
1849 + maBtnOk(this, ScResId(BTN_OK)),
1850 + maBtnCancel(this, ScResId(BTN_CANCEL)),
1851 + maBtnHelp(this, ScResId(BTN_HELP)),
1852 + maFlChooseLang(this, ScResId(FL_CHOOSE_LANG)),
1853 + maRbAutomatic(this, ScResId(RB_AUTOMATIC)),
1854 + maRbCustom(this, ScResId(RB_CUSTOM)),
1855 + maLbCustomLang(this, ScResId(LB_CUSTOM_LANG)),
1856 + maFlOption(this, ScResId(FL_OPTION)),
1857 + maBtnConvertDate(this, ScResId(BTN_CONVERT_DATE))
1859 + init();
1862 +ScTextImportOptionsDlg::~ScTextImportOptionsDlg()
1866 +short ScTextImportOptionsDlg::Execute()
1868 + return ModalDialog::Execute();
1871 +LanguageType ScTextImportOptionsDlg::getLanguageType() const
1873 + if (maRbAutomatic.IsChecked())
1874 + return LANGUAGE_SYSTEM;
1876 + return maLbCustomLang.GetSelectLanguage();
1879 +bool ScTextImportOptionsDlg::isDateConversionSet() const
1881 + return maBtnConvertDate.IsChecked();
1884 +void ScTextImportOptionsDlg::init()
1886 + Link aLink = LINK( this, ScTextImportOptionsDlg, OKHdl );
1887 + maBtnOk.SetClickHdl(aLink);
1888 + aLink = LINK( this, ScTextImportOptionsDlg, RadioHdl );
1889 + maRbAutomatic.SetClickHdl(aLink);
1890 + maRbCustom.SetClickHdl(aLink);
1892 + maRbAutomatic.Check(true);
1894 + maLbCustomLang.SetLanguageList(
1895 + LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, false, false);
1897 + LanguageType eLang = Application::GetSettings().GetLanguage();
1898 + maLbCustomLang.SelectLanguage(eLang);
1899 + maLbCustomLang.Disable();
1902 +IMPL_LINK( ScTextImportOptionsDlg, OKHdl, OKButton*, EMPTYARG )
1904 + EndDialog(RET_OK);
1905 + return 0;
1908 +IMPL_LINK( ScTextImportOptionsDlg, RadioHdl, RadioButton*, pBtn )
1910 + if (pBtn == &maRbAutomatic)
1912 + maLbCustomLang.Disable();
1914 + else if (pBtn == &maRbCustom)
1916 + maLbCustomLang.Enable();
1918 + return 0;
1921 diff --git sc/source/ui/dbgui/textimportoptions.src sc/source/ui/dbgui/textimportoptions.src
1922 new file mode 100644
1923 index 0000000..4a4d158
1924 --- /dev/null
1925 +++ sc/source/ui/dbgui/textimportoptions.src
1926 @@ -0,0 +1,112 @@
1927 +/*************************************************************************
1929 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1930 + *
1931 + * Copyright 2008 by Sun Microsystems, Inc.
1933 + * OpenOffice.org - a multi-platform office productivity suite
1935 + * $RCSfile: retypepassdlg.src,v $
1936 + * $Revision: 1.1.2.3 $
1938 + * This file is part of OpenOffice.org.
1940 + * OpenOffice.org is free software: you can redistribute it and/or modify
1941 + * it under the terms of the GNU Lesser General Public License version 3
1942 + * only, as published by the Free Software Foundation.
1944 + * OpenOffice.org is distributed in the hope that it will be useful,
1945 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1946 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1947 + * GNU Lesser General Public License version 3 for more details
1948 + * (a copy is included in the LICENSE file that accompanied this code).
1950 + * You should have received a copy of the GNU Lesser General Public License
1951 + * version 3 along with OpenOffice.org. If not, see
1952 + * <http://www.openoffice.org/license.html>
1953 + * for a copy of the LGPLv3 License.
1955 + ************************************************************************/
1957 +#include "textimportoptions.hrc"
1959 +ModalDialog RID_SCDLG_TEXT_IMPORT_OPTIONS
1961 + Text [ en-US ] = "Import Options" ;
1962 + Size = MAP_APPFONT ( 190 , 101 ) ;
1963 + Moveable = TRUE ;
1964 + Closeable = TRUE ;
1965 + OutputSize = TRUE ;
1967 + OKButton BTN_OK
1969 + Pos = MAP_APPFONT ( 135, 6 ) ;
1970 + Size = MAP_APPFONT ( 50, 14 ) ;
1971 + DefButton = TRUE ;
1972 + };
1974 + CancelButton BTN_CANCEL
1976 + Pos = MAP_APPFONT ( 135, 23 ) ;
1977 + Size = MAP_APPFONT ( 50, 14 ) ;
1978 + };
1980 + HelpButton BTN_HELP
1982 + Pos = MAP_APPFONT ( 135, 43 ) ;
1983 + Size = MAP_APPFONT ( 50, 14 ) ;
1984 + };
1986 + FixedLine FL_CHOOSE_LANG
1988 + Pos = MAP_APPFONT( 6, 3 ) ;
1989 + Size = MAP_APPFONT( 125, 14 ) ;
1991 + Text [ en-US ] = "Select the language to use for import" ;
1992 + };
1994 + RadioButton RB_AUTOMATIC
1996 + Pos = MAP_APPFONT( 12, 20 ) ;
1997 + Size = MAP_APPFONT( 50, 10 ) ;
1998 + TabStop = TRUE ;
2000 + Text [ en-US ] = "Automatic" ;
2001 + };
2003 + RadioButton RB_CUSTOM
2005 + Pos = MAP_APPFONT( 12, 34 ) ;
2006 + Size = MAP_APPFONT( 50, 10 ) ;
2007 + TabStop = TRUE ;
2009 + Text [ en-US ] = "Custom" ;
2010 + };
2012 + ListBox LB_CUSTOM_LANG
2014 + Pos = MAP_APPFONT( 20, 50 ) ;
2015 + Size = MAP_APPFONT( 100, 55 ) ;
2016 + TabStop = TRUE ;
2017 + DropDown = TRUE ;
2018 + Sort = TRUE ;
2019 + };
2021 + FixedLine FL_OPTION
2023 + Pos = MAP_APPFONT( 6, 70 );
2024 + Size = MAP_APPFONT( 125, 14 );
2026 + Text [ en-US ] = "Options" ;
2027 + };
2029 + CheckBox BTN_CONVERT_DATE
2031 + Pos = MAP_APPFONT( 12, 86 );
2032 + Size = MAP_APPFONT( 125, 10 );
2033 + TabStop = TRUE ;
2035 + Text [ en-US ] = "Detect special numbers (such as dates)." ;
2036 + };
2039 diff --git sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
2040 index 8cb9ad8..8335542 100644
2041 --- sc/source/ui/docshell/docsh.cxx
2042 +++ sc/source/ui/docshell/docsh.cxx
2043 @@ -129,6 +129,8 @@
2044 #include <comphelper/processfactory.hxx>
2046 using namespace com::sun::star;
2047 +using ::rtl::OUString;
2048 +using ::rtl::OUStringBuffer;
2050 // STATIC DATA -----------------------------------------------------------
2052 @@ -794,6 +796,34 @@ BOOL __EXPORT ScDocShell::LoadFrom( SfxMedium& rMedium )
2053 return bRet;
2056 +static void lcl_parseHtmlFilterOption(const OUString& rOption, LanguageType& rLang, bool& rDateConvert)
2058 + OUStringBuffer aBuf;
2059 + OUString aTokens[2];
2060 + sal_Int32 n = rOption.getLength();
2061 + const sal_Unicode* p = rOption.getStr();
2062 + sal_Int32 nTokenId = 0;
2063 + for (sal_Int32 i = 0; i < n; ++i)
2065 + const sal_Unicode c = p[i];
2066 + if (c == sal_Unicode(' '))
2068 + if (aBuf.getLength())
2069 + aTokens[nTokenId++] = aBuf.makeStringAndClear();
2071 + else
2072 + aBuf.append(c);
2074 + if (nTokenId >= 2)
2075 + break;
2078 + if (aBuf.getLength())
2079 + aTokens[nTokenId] = aBuf.makeStringAndClear();
2081 + rLang = static_cast<LanguageType>(aTokens[0].toInt32());
2082 + rDateConvert = static_cast<bool>(aTokens[1].toInt32());
2085 BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
2087 @@ -1167,12 +1197,24 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
2088 SvStream* pInStream = rMedium.GetInStream();
2089 if (pInStream)
2091 + LanguageType eLang = LANGUAGE_SYSTEM;
2092 + bool bDateConvert = false;
2093 + SfxItemSet* pSet = rMedium.GetItemSet();
2094 + const SfxPoolItem* pItem;
2095 + if ( pSet && SFX_ITEM_SET ==
2096 + pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) )
2098 + String aFilterOption = (static_cast<const SfxStringItem*>(pItem))->GetValue();
2099 + lcl_parseHtmlFilterOption(aFilterOption, eLang, bDateConvert);
2102 pInStream->Seek( 0 );
2103 ScRange aRange;
2104 // HTML macht eigenes ColWidth/RowHeight
2105 CalcOutputFactor();
2106 + SvNumberFormatter aNumFormatter(aDocument.GetServiceManager(), eLang);
2107 eError = ScFormatFilter::Get().ScImportHTML( *pInStream, rMedium.GetBaseURL(), &aDocument, aRange,
2108 - GetOutputFactor(), !bWebQuery );
2109 + GetOutputFactor(), !bWebQuery, &aNumFormatter, bDateConvert );
2110 if (eError != eERR_OK)
2112 if (!GetError())
2113 @@ -2149,6 +2191,11 @@ String ScDocShell::GetOwnFilterName() // static
2114 return String::CreateFromAscii(pFilterSc50);
2117 +String ScDocShell::GetHtmlFilterName()
2119 + return String::CreateFromAscii(pFilterHtml);
2122 String ScDocShell::GetWebQueryFilterName() // static
2124 return String::CreateFromAscii(pFilterHtmlWebQ);
2125 diff --git sc/source/ui/docshell/impex.cxx sc/source/ui/docshell/impex.cxx
2126 index 0590de5..08dfcfb 100644
2127 --- sc/source/ui/docshell/impex.cxx
2128 +++ sc/source/ui/docshell/impex.cxx
2129 @@ -905,12 +905,11 @@ BOOL ScImportExport::Text2Doc( SvStream& rStrm )
2133 -bool lcl_PutString( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
2134 - const String& rStr, BYTE nColFormat,
2135 - ::utl::TransliterationWrapper& rTransliteration,
2136 - CalendarWrapper& rCalendar,
2137 - ::utl::TransliterationWrapper* pSecondTransliteration,
2138 - CalendarWrapper* pSecondCalendar )
2139 +static bool lcl_PutString(
2140 + ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rStr, BYTE nColFormat,
2141 + SvNumberFormatter* pFormatter, bool bDetectNumFormat,
2142 + ::utl::TransliterationWrapper& rTransliteration, CalendarWrapper& rCalendar,
2143 + ::utl::TransliterationWrapper* pSecondTransliteration, CalendarWrapper* pSecondCalendar )
2145 bool bMultiLine = false;
2146 if ( nColFormat == SC_COL_SKIP || !rStr.Len() || !ValidCol(nCol) || !ValidRow(nRow) )
2147 @@ -926,10 +925,10 @@ bool lcl_PutString( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
2149 //! SetString mit Extra-Flag ???
2151 - SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
2152 - sal_uInt32 nEnglish = pFormatter->GetStandardIndex(LANGUAGE_ENGLISH_US);
2153 + SvNumberFormatter* pDocFormatter = pDoc->GetFormatTable();
2154 + sal_uInt32 nEnglish = pDocFormatter->GetStandardIndex(LANGUAGE_ENGLISH_US);
2155 double fVal;
2156 - if ( pFormatter->IsNumberFormat( rStr, nEnglish, fVal ) )
2157 + if ( pDocFormatter->IsNumberFormat( rStr, nEnglish, fVal ) )
2159 // Zahlformat wird nicht auf englisch gesetzt
2160 pDoc->SetValue( nCol, nRow, nTab, fVal );
2161 @@ -1065,9 +1064,9 @@ bool lcl_PutString( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
2165 - SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
2166 + SvNumberFormatter* pDocFormatter = pDoc->GetFormatTable();
2167 if ( nYear < 100 )
2168 - nYear = pFormatter->ExpandTwoDigitYear( nYear );
2169 + nYear = pDocFormatter->ExpandTwoDigitYear( nYear );
2171 CalendarWrapper* pCalendar = (bSecondCal ? pSecondCalendar : &rCalendar);
2172 sal_Int16 nNumMonths = pCalendar->getNumberOfMonthsInYear();
2173 @@ -1103,7 +1102,7 @@ bool lcl_PutString( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
2174 pCalendar->setValue( i18n::CalendarFieldIndex::MILLISECOND, nMilli );
2175 if ( pCalendar->isValid() )
2177 - double fDiff = DateTime(*pFormatter->GetNullDate()) -
2178 + double fDiff = DateTime(*pDocFormatter->GetNullDate()) -
2179 pCalendar->getEpochStart();
2180 // #i14974# must use getLocalDateTime to get the same
2181 // date values as set above
2182 @@ -1115,10 +1114,10 @@ bool lcl_PutString( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
2183 LanguageType eDocLang = eLatin; //! which language for date formats?
2185 short nType = (nFound > 3 ? NUMBERFORMAT_DATETIME : NUMBERFORMAT_DATE);
2186 - ULONG nFormat = pFormatter->GetStandardFormat( nType, eDocLang );
2187 + ULONG nFormat = pDocFormatter->GetStandardFormat( nType, eDocLang );
2188 // maybe there is a special format including seconds or milliseconds
2189 if (nFound > 5)
2190 - nFormat = pFormatter->GetStandardFormat( fDays, nFormat, nType, eDocLang);
2191 + nFormat = pDocFormatter->GetStandardFormat( fDays, nFormat, nType, eDocLang);
2193 pDoc->PutCell( nCol, nRow, nTab, new ScValueCell(fDays), nFormat, FALSE );
2195 @@ -1130,7 +1129,7 @@ bool lcl_PutString( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
2197 // Standard or date not determined -> SetString / EditCell
2198 if( rStr.Search( _LF ) == STRING_NOTFOUND )
2199 - pDoc->SetString( nCol, nRow, nTab, rStr );
2200 + pDoc->SetString( nCol, nRow, nTab, rStr, pFormatter, bDetectNumFormat );
2201 else
2203 bMultiLine = true;
2204 @@ -1140,7 +1139,7 @@ bool lcl_PutString( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
2208 -String lcl_GetFixed( const String& rLine, xub_StrLen nStart, xub_StrLen nNext )
2209 +String lcl_GetFixed( const String& rLine, xub_StrLen nStart, xub_StrLen nNext, bool& rbIsQuoted )
2211 xub_StrLen nLen = rLine.Len();
2212 if (nNext > nLen)
2213 @@ -1154,7 +1153,11 @@ String lcl_GetFixed( const String& rLine, xub_StrLen nStart, xub_StrLen nNext )
2214 while ( nSpace > nStart && pStr[nSpace-1] == ' ' )
2215 --nSpace;
2217 - return rLine.Copy( nStart, nSpace-nStart );
2218 + rbIsQuoted = (pStr[nStart] == sal_Unicode('"') && pStr[nSpace-1] == sal_Unicode('"'));
2219 + if (rbIsQuoted)
2220 + return rLine.Copy(nStart+1, nSpace-nStart-2);
2221 + else
2222 + return rLine.Copy(nStart, nSpace-nStart);
2225 BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
2226 @@ -1187,9 +1190,9 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
2227 const BYTE* pColFormat = pExtOptions->GetColFormat();
2228 long nSkipLines = pExtOptions->GetStartRow();
2230 - LanguageType eLatin, eCjk, eCtl;
2231 - pDoc->GetLanguage( eLatin, eCjk, eCtl );
2232 - LanguageType eDocLang = eLatin; //! which language for date formats?
2233 + LanguageType eDocLang = pExtOptions->GetLanguage();
2234 + SvNumberFormatter aNumFormatter(pDoc->GetServiceManager(), eDocLang);
2235 + bool bDetectNumFormat = pExtOptions->IsDetectSpecialNumber();
2237 // For date recognition
2238 ::utl::TransliterationWrapper aTransliteration(
2239 @@ -1231,6 +1234,8 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
2240 // survives the toggle of bDetermineRange down at the end of the do{} loop.
2241 bool bRangeIsDetermined = bDetermineRange;
2243 + bool bQuotedAsText = pExtOptions && pExtOptions->IsQuotedAsText();
2245 ULONG nOriginalStreamPos = rStrm.Tell();
2248 @@ -1252,7 +1257,8 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
2249 // SC_COL_SKIP.
2250 for ( i=0; i<nInfoCount && nCol <= MAXCOL+1; i++ )
2252 - if ( pColFormat[i] != SC_COL_SKIP ) // sonst auch nCol nicht hochzaehlen
2253 + BYTE nFmt = pColFormat[i];
2254 + if (nFmt != SC_COL_SKIP) // sonst auch nCol nicht hochzaehlen
2256 if (nCol > MAXCOL)
2257 bOverflow = TRUE; // display warning on import
2258 @@ -1260,11 +1266,15 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
2260 xub_StrLen nStart = pColStart[i];
2261 xub_StrLen nNext = ( i+1 < nInfoCount ) ? pColStart[i+1] : nLineLen;
2262 - aCell = lcl_GetFixed( aLine, nStart, nNext );
2263 - bMultiLine |= lcl_PutString( pDoc, nCol, nRow,
2264 - nTab, aCell, pColFormat[i],
2265 - aTransliteration, aCalendar,
2266 - pEnglishTransliteration, pEnglishCalendar);
2267 + bool bIsQuoted = false;
2268 + aCell = lcl_GetFixed( aLine, nStart, nNext, bIsQuoted );
2269 + if (bIsQuoted && bQuotedAsText)
2270 + nFmt = SC_COL_TEXT;
2272 + bMultiLine |= lcl_PutString(
2273 + pDoc, nCol, nRow, nTab, aCell, nFmt,
2274 + &aNumFormatter, bDetectNumFormat, aTransliteration, aCalendar,
2275 + pEnglishTransliteration, pEnglishCalendar);
2277 ++nCol;
2279 @@ -1281,7 +1291,8 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
2280 // SC_COL_SKIP.
2281 while (*p && nCol <= MAXCOL+1)
2283 - p = ScImportExport::ScanNextFieldFromString( p, aCell, cStr, pSeps, bMerge );
2284 + bool bIsQuoted = false;
2285 + p = ScImportExport::ScanNextFieldFromString( p, aCell, cStr, pSeps, bMerge, bIsQuoted );
2287 BYTE nFmt = SC_COL_STANDARD;
2288 for ( i=nInfoStart; i<nInfoCount; i++ )
2289 @@ -1298,10 +1309,15 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
2290 if (nCol > MAXCOL)
2291 bOverflow = TRUE; // display warning on import
2292 else if (!bDetermineRange)
2293 - bMultiLine |= lcl_PutString( pDoc, nCol, nRow,
2294 - nTab, aCell, nFmt, aTransliteration,
2295 - aCalendar, pEnglishTransliteration,
2296 - pEnglishCalendar);
2298 + if (bIsQuoted && bQuotedAsText)
2299 + nFmt = SC_COL_TEXT;
2301 + bMultiLine |= lcl_PutString(
2302 + pDoc, nCol, nRow, nTab, aCell, nFmt,
2303 + &aNumFormatter, bDetectNumFormat, aTransliteration,
2304 + aCalendar, pEnglishTransliteration, pEnglishCalendar);
2306 ++nCol;
2309 @@ -1375,11 +1391,13 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
2311 // static
2312 const sal_Unicode* ScImportExport::ScanNextFieldFromString( const sal_Unicode* p,
2313 - String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, BOOL bMergeSeps )
2314 + String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, bool bMergeSeps, bool& rbIsQuoted )
2316 + rbIsQuoted = false;
2317 rField.Erase();
2318 if ( *p == cStr ) // String in Anfuehrungszeichen
2320 + rbIsQuoted = true;
2321 const sal_Unicode* p1;
2322 p1 = p = lcl_ScanString( p, rField, cStr, DQM_ESCAPE );
2323 while ( *p && !ScGlobal::UnicodeStrChr( pSeps, *p ) )
2324 @@ -2038,7 +2056,7 @@ class ScFormatFilterMissing : public ScFormatFilterPlugin {
2325 virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress&,
2326 const CharSet, UINT32 ) RETURN_ERROR
2327 virtual FltError ScImportRTF( SvStream&, const String&, ScDocument*, ScRange& ) RETURN_ERROR
2328 - virtual FltError ScImportHTML( SvStream&, const String&, ScDocument*, ScRange&, double, BOOL ) RETURN_ERROR
2329 + virtual FltError ScImportHTML( SvStream&, const String&, ScDocument*, ScRange&, double, BOOL, SvNumberFormatter*, bool ) RETURN_ERROR
2331 virtual ScEEAbsImport *CreateRTFImport( ScDocument*, const ScRange& ) { return NULL; }
2332 virtual ScEEAbsImport *CreateHTMLImport( ScDocument*, const String&, const ScRange&, BOOL ) { return NULL; }
2333 diff --git sc/source/ui/inc/asciiopt.hxx sc/source/ui/inc/asciiopt.hxx
2334 index ec601a9..d3f9ba4 100644
2335 --- sc/source/ui/inc/asciiopt.hxx
2336 +++ sc/source/ui/inc/asciiopt.hxx
2337 @@ -55,7 +55,7 @@
2338 #include <tools/stream.hxx>
2339 #include <svx/txencbox.hxx>
2340 #include "csvtablebox.hxx"
2342 +#include "i18npool/lang.h"
2344 // ============================================================================
2346 @@ -65,8 +65,11 @@ private:
2347 BOOL bFixedLen;
2348 String aFieldSeps;
2349 BOOL bMergeFieldSeps;
2350 + bool bQuotedFieldAsText;
2351 + bool bDetectSpecialNumber;
2352 sal_Unicode cTextSep;
2353 CharSet eCharSet;
2354 + LanguageType eLang;
2355 BOOL bCharSetSystem;
2356 long nStartRow;
2357 USHORT nInfoCount;
2358 @@ -93,20 +96,26 @@ public:
2359 BOOL GetCharSetSystem() const { return bCharSetSystem; }
2360 const String& GetFieldSeps() const { return aFieldSeps; }
2361 BOOL IsMergeSeps() const { return bMergeFieldSeps; }
2362 + bool IsQuotedAsText() const { return bQuotedFieldAsText; }
2363 + bool IsDetectSpecialNumber() const { return bDetectSpecialNumber; }
2364 sal_Unicode GetTextSep() const { return cTextSep; }
2365 BOOL IsFixedLen() const { return bFixedLen; }
2366 USHORT GetInfoCount() const { return nInfoCount; }
2367 const xub_StrLen* GetColStart() const { return pColStart; }
2368 const BYTE* GetColFormat() const { return pColFormat; }
2369 long GetStartRow() const { return nStartRow; }
2370 + LanguageType GetLanguage() const { return eLang; }
2372 void SetCharSet( CharSet eNew ) { eCharSet = eNew; }
2373 void SetCharSetSystem( BOOL bSet ) { bCharSetSystem = bSet; }
2374 void SetFixedLen( BOOL bSet ) { bFixedLen = bSet; }
2375 void SetFieldSeps( const String& rStr ) { aFieldSeps = rStr; }
2376 void SetMergeSeps( BOOL bSet ) { bMergeFieldSeps = bSet; }
2377 + void SetQuotedAsText(bool bSet) { bQuotedFieldAsText = bSet; }
2378 + void SetDetectSpecialNumber(bool bSet) { bDetectSpecialNumber = bSet; }
2379 void SetTextSep( sal_Unicode c ) { cTextSep = c; }
2380 void SetStartRow( long nRow) { nStartRow= nRow; }
2381 + void SetLanguage(LanguageType e) { eLang = e; }
2383 void SetColInfo( USHORT nCount, const xub_StrLen* pStart, const BYTE* pFormat );
2384 void SetColumnInfo( const ScCsvExpDataVec& rDataVec );
2385 diff --git sc/source/ui/inc/csvruler.hxx sc/source/ui/inc/csvruler.hxx
2386 index c251831..cd67708 100644
2387 --- sc/source/ui/inc/csvruler.hxx
2388 +++ sc/source/ui/inc/csvruler.hxx
2389 @@ -71,6 +71,7 @@ private:
2390 // ------------------------------------------------------------------------
2391 public:
2392 explicit ScCsvRuler( ScCsvControl& rParent );
2393 + ~ScCsvRuler();
2395 // common ruler handling --------------------------------------------------
2396 public:
2397 diff --git sc/source/ui/inc/docsh.hxx sc/source/ui/inc/docsh.hxx
2398 index 8aa9efe..07d372b 100644
2399 --- sc/source/ui/inc/docsh.hxx
2400 +++ sc/source/ui/inc/docsh.hxx
2401 @@ -398,6 +398,7 @@ public:
2403 static ScDocShell* GetShellByNum( USHORT nDocNo );
2404 static String GetOwnFilterName();
2405 + static String GetHtmlFilterName();
2406 static String GetWebQueryFilterName();
2407 static String GetAsciiFilterName();
2408 static String GetLotusFilterName();
2409 diff --git sc/source/ui/inc/impex.hxx sc/source/ui/inc/impex.hxx
2410 index 3abab58..5ef0f1f 100644
2411 --- sc/source/ui/inc/impex.hxx
2412 +++ sc/source/ui/inc/impex.hxx
2413 @@ -110,7 +110,7 @@ public:
2415 static BOOL IsFormatSupported( ULONG nFormat );
2416 static const sal_Unicode* ScanNextFieldFromString( const sal_Unicode* p,
2417 - String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, BOOL bMergeSeps );
2418 + String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, bool bMergeSeps, bool& rbIsQuoted );
2419 static void WriteUnicodeOrByteString( SvStream& rStrm, const String& rString, BOOL bZero = FALSE );
2420 static void WriteUnicodeOrByteEndl( SvStream& rStrm );
2421 static inline BOOL IsEndianSwap( const SvStream& rStrm );
2422 diff --git sc/source/ui/inc/scuiasciiopt.hxx sc/source/ui/inc/scuiasciiopt.hxx
2423 index 643fb3b..4515a86 100644
2424 --- sc/source/ui/inc/scuiasciiopt.hxx
2425 +++ sc/source/ui/inc/scuiasciiopt.hxx
2426 @@ -35,6 +35,8 @@
2429 #include "asciiopt.hxx"
2430 +#include "svx/langbox.hxx"
2432 // ============================================================================
2434 class ScImportAsciiDlg : public ModalDialog
2435 @@ -49,6 +51,8 @@ class ScImportAsciiDlg : public ModalDialog
2436 FixedLine aFlFieldOpt;
2437 FixedText aFtCharSet;
2438 SvxTextEncodingBox aLbCharSet;
2439 + FixedText aFtCustomLang;
2440 + SvxLanguageBox aLbCustomLang;
2442 FixedText aFtRow;
2443 NumericField aNfRow;
2444 @@ -64,6 +68,12 @@ class ScImportAsciiDlg : public ModalDialog
2445 CheckBox aCkbOther;
2446 Edit aEdOther;
2447 CheckBox aCkbAsOnce;
2449 + FixedLine aFlOtherOpt;
2451 + CheckBox aCkbQuotedAsText;
2452 + CheckBox aCkbDetectNumber;
2454 FixedText aFtTextSep;
2455 ComboBox aCbTextSep;
2457 @@ -87,6 +97,7 @@ class ScImportAsciiDlg : public ModalDialog
2459 CharSet meCharSet; /// Selected char set.
2460 bool mbCharSetSystem; /// Is System char set selected?
2461 + bool mbFileImport; /// Is this dialog involked for csv file import ?
2463 public:
2464 ScImportAsciiDlg(
2465 diff --git sc/source/ui/inc/textimportoptions.hrc sc/source/ui/inc/textimportoptions.hrc
2466 new file mode 100644
2467 index 0000000..eb981c1
2468 --- /dev/null
2469 +++ sc/source/ui/inc/textimportoptions.hrc
2470 @@ -0,0 +1,42 @@
2471 +/*************************************************************************
2473 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2474 + *
2475 + * Copyright 2008 by Sun Microsystems, Inc.
2477 + * OpenOffice.org - a multi-platform office productivity suite
2479 + * $RCSfile: retypepassdlg.src,v $
2480 + * $Revision: 1.1.2.3 $
2482 + * This file is part of OpenOffice.org.
2484 + * OpenOffice.org is free software: you can redistribute it and/or modify
2485 + * it under the terms of the GNU Lesser General Public License version 3
2486 + * only, as published by the Free Software Foundation.
2488 + * OpenOffice.org is distributed in the hope that it will be useful,
2489 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2490 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2491 + * GNU Lesser General Public License version 3 for more details
2492 + * (a copy is included in the LICENSE file that accompanied this code).
2494 + * You should have received a copy of the GNU Lesser General Public License
2495 + * version 3 along with OpenOffice.org. If not, see
2496 + * <http://www.openoffice.org/license.html>
2497 + * for a copy of the LGPLv3 License.
2499 + ************************************************************************/
2501 +#include <sc.hrc>
2503 +#define BTN_OK 1
2504 +#define BTN_CANCEL 2
2505 +#define BTN_HELP 3
2507 +#define FL_CHOOSE_LANG 4
2508 +#define RB_AUTOMATIC 5
2509 +#define RB_CUSTOM 6
2510 +#define LB_CUSTOM_LANG 7
2511 +#define FL_OPTION 8
2512 +#define BTN_CONVERT_DATE 9
2513 diff --git sc/source/ui/inc/textimportoptions.hxx sc/source/ui/inc/textimportoptions.hxx
2514 new file mode 100644
2515 index 0000000..8ef489a
2516 --- /dev/null
2517 +++ sc/source/ui/inc/textimportoptions.hxx
2518 @@ -0,0 +1,76 @@
2519 +/*************************************************************************
2521 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2522 + *
2523 + * Copyright 2008 by Sun Microsystems, Inc.
2525 + * OpenOffice.org - a multi-platform office productivity suite
2527 + * $RCSfile: langbox.hxx,v $
2528 + * $Revision: 1.4.242.1 $
2530 + * This file is part of OpenOffice.org.
2532 + * OpenOffice.org is free software: you can redistribute it and/or modify
2533 + * it under the terms of the GNU Lesser General Public License version 3
2534 + * only, as published by the Free Software Foundation.
2536 + * OpenOffice.org is distributed in the hope that it will be useful,
2537 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2538 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2539 + * GNU Lesser General Public License version 3 for more details
2540 + * (a copy is included in the LICENSE file that accompanied this code).
2542 + * You should have received a copy of the GNU Lesser General Public License
2543 + * version 3 along with OpenOffice.org. If not, see
2544 + * <http://www.openoffice.org/license.html>
2545 + * for a copy of the LGPLv3 License.
2547 + ************************************************************************/
2549 +#ifndef SC_UI_IMPORTOPTIONS_HXX
2550 +#define SC_UI_IMPORTOPTIONS_HXX
2552 +#include "vcl/dialog.hxx"
2553 +#include "vcl/button.hxx"
2554 +#include "vcl/fixed.hxx"
2555 +#include "i18npool/lang.h"
2556 +#include "svx/langbox.hxx"
2558 +class ScTextImportOptionsDlg : public ModalDialog
2560 +public:
2561 + ScTextImportOptionsDlg(Window* pParent);
2562 + virtual ~ScTextImportOptionsDlg();
2564 + virtual short Execute();
2566 + LanguageType getLanguageType() const;
2567 + bool isDateConversionSet() const;
2569 +private:
2570 + void init();
2572 +private:
2573 + OKButton maBtnOk;
2574 + CancelButton maBtnCancel;
2575 + HelpButton maBtnHelp;
2577 + FixedLine maFlChooseLang;
2579 + RadioButton maRbAutomatic;
2580 + RadioButton maRbCustom;
2582 + SvxLanguageBox maLbCustomLang;
2584 + FixedLine maFlOption;
2586 + CheckBox maBtnConvertDate;
2588 + DECL_LINK( OKHdl, OKButton* );
2590 + DECL_LINK( RadioHdl, RadioButton* );
2594 +#endif
2595 diff --git sc/source/ui/unoobj/filtuno.cxx sc/source/ui/unoobj/filtuno.cxx
2596 index 8b93ff9..02d2f9d 100644
2597 --- sc/source/ui/unoobj/filtuno.cxx
2598 +++ sc/source/ui/unoobj/filtuno.cxx
2599 @@ -51,7 +51,12 @@
2601 #include "sc.hrc" //CHINA001
2602 #include "scabstdlg.hxx" //CHINA001
2603 +#include "i18npool/lang.h"
2605 +#include <memory>
2607 using namespace ::com::sun::star;
2608 +using ::rtl::OUStringBuffer;
2610 //------------------------------------------------------------------------
2612 @@ -146,6 +151,10 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException)
2613 sal_Int16 nRet = ui::dialogs::ExecutableDialogResults::CANCEL;
2615 String aFilterString( aFilterName );
2617 + ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
2618 + DBG_ASSERT(pFact, "ScAbstractFactory create fail!");
2620 if ( !bExport && aFilterString == ScDocShell::GetAsciiFilterName() )
2622 // ascii import is special...
2623 @@ -164,8 +173,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException)
2624 pInStream = utl::UcbStreamHelper::CreateStream( xInputStream );
2626 //CHINA001 ScImportAsciiDlg* pDlg = new ScImportAsciiDlg( NULL, aPrivDatName, pInStream, cAsciiDel );
2627 - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
2628 - DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
2629 AbstractScImportAsciiDlg* pDlg = pFact->CreateScImportAsciiDlg( NULL, aPrivDatName, pInStream, RID_SCDLG_ASCII, cAsciiDel);
2630 DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
2631 if ( pDlg->Execute() == RET_OK )
2632 @@ -178,6 +185,24 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException)
2633 delete pDlg;
2634 delete pInStream;
2636 + else if ( aFilterString == ScDocShell::GetWebQueryFilterName() || aFilterString == ScDocShell::GetHtmlFilterName() )
2638 + // HTML import.
2639 + ::std::auto_ptr<AbstractScTextImportOptionsDlg> pDlg(
2640 + pFact->CreateScTextImportOptionsDlg(NULL, RID_SCDLG_TEXT_IMPORT_OPTIONS));
2642 + if (pDlg->Execute() == RET_OK)
2644 + LanguageType eLang = pDlg->GetLanguageType();
2645 + OUStringBuffer aBuf;
2647 + aBuf.append(String::CreateFromInt32(static_cast<sal_Int32>(eLang)));
2648 + aBuf.append(sal_Unicode(' '));
2649 + aBuf.append(pDlg->IsDateConversionSet() ? sal_Unicode('1') : sal_Unicode('0'));
2650 + aFilterOptions = aBuf.makeStringAndClear();
2651 + nRet = ui::dialogs::ExecutableDialogResults::OK;
2654 else
2656 sal_Bool bMultiByte = sal_True;
2657 @@ -249,8 +274,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException)
2658 //CHINA001 &aOptions, &aTitle, bMultiByte, bDBEnc,
2659 //CHINA001 !bExport );
2660 //CHINA001
2661 - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
2662 - DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
2664 AbstractScImportOptionsDlg* pDlg = pFact->CreateScImportOptionsDlg( NULL, RID_SCDLG_IMPORTOPT,
2665 bAscii, &aOptions, &aTitle, bMultiByte, bDBEnc,
2666 diff --git sc/util/makefile.mk sc/util/makefile.mk
2667 index 2b56e37..214e210 100644
2668 --- sc/util/makefile.mk
2669 +++ sc/util/makefile.mk
2670 @@ -283,6 +283,7 @@ LIB8OBJFILES = \
2671 $(SLO)$/dapidata.obj \
2672 $(SLO)$/crdlg.obj \
2673 $(SLO)$/scuiasciiopt.obj \
2674 + $(SLO)$/textimportoptions.obj \
2675 $(SLO)$/scuiautofmt.obj \
2676 $(SLO)$/dpgroupdlg.obj \
2677 $(SLO)$/editfield.obj