update ooo310-m15
[ooovba.git] / applied_patches / 0513-calc-html-import-custom-lang-sc.diff
blobb2a4733ad2cf49340c3a9b1234330c0a4e644e71
1 diff --git sc/inc/column.hxx sc/inc/column.hxx
2 index 7d297e1..babda9e 100644
3 --- sc/inc/column.hxx
4 +++ sc/inc/column.hxx
5 @@ -243,7 +243,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 528ef96..0da5a7a 100644
18 --- sc/inc/document.hxx
19 +++ sc/inc/document.hxx
20 @@ -736,7 +736,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 82a2b84..63c9ec6 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/sc.hrc sc/inc/sc.hrc
65 index 2c7ad7b..cf99a55 100644
66 --- sc/inc/sc.hrc
67 +++ sc/inc/sc.hrc
68 @@ -1673,6 +1673,9 @@
70 #define RID_SCDLG_TAB_BG_COLOR (SC_OOO_BUILD_START + 11)
72 +// Language chooser for text import filters.
73 +#define RID_SCDLG_LANG_CHOOSER (SC_OOO_BUILD_START + 12)
75 #endif
78 diff --git sc/inc/scabstdlg.hxx sc/inc/scabstdlg.hxx
79 index 637682d..1c9f587 100644
80 --- sc/inc/scabstdlg.hxx
81 +++ sc/inc/scabstdlg.hxx
82 @@ -41,6 +41,7 @@
83 #include "sc.hrc"
84 #include "global.hxx"
85 #include "pivot.hxx"
86 +#include "i18npool/lang.h"
88 #include <tabvwsh.hxx>
90 @@ -303,6 +304,14 @@ class AbstractScImportOptionsDlg : public VclAbstractDialog //add for ScImportO
91 public:
92 virtual void GetImportOptions( ScImportOptions& rOptions ) const = 0;
95 +class AbstractScLangChooserDlg : public VclAbstractDialog //add for ScLangChooserDlg
97 +public:
98 + virtual LanguageType GetLanguageType() const = 0;
99 + virtual bool IsDateConversionSet() const = 0;
102 //-------Scabstract fractory ---------------------------
103 class ScAbstractDialogFactory
105 @@ -313,6 +322,8 @@ public:
106 SvStream* pInStream, int nId,
107 sal_Unicode cSep = '\t') = 0;
109 + virtual AbstractScLangChooserDlg * CreateScLangChooserDlg( Window* pParent, int nId ) = 0;
111 virtual AbstractScAutoFormatDlg * CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg
112 ScAutoFormat* pAutoFormat,
113 const ScAutoFormatData* pSelFormatData,
114 diff --git sc/inc/stringutil.hxx sc/inc/stringutil.hxx
115 new file mode 100644
116 index 0000000..4ca8629
117 --- /dev/null
118 +++ sc/inc/stringutil.hxx
119 @@ -0,0 +1,56 @@
120 +/*************************************************************************
122 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
123 + *
124 + * Copyright 2008 by Sun Microsystems, Inc.
126 + * OpenOffice.org - a multi-platform office productivity suite
128 + * $RCSfile: table.hxx,v $
129 + * $Revision: 1.35 $
131 + * This file is part of OpenOffice.org.
133 + * OpenOffice.org is free software: you can redistribute it and/or modify
134 + * it under the terms of the GNU Lesser General Public License version 3
135 + * only, as published by the Free Software Foundation.
137 + * OpenOffice.org is distributed in the hope that it will be useful,
138 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
139 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
140 + * GNU Lesser General Public License version 3 for more details
141 + * (a copy is included in the LICENSE file that accompanied this code).
143 + * You should have received a copy of the GNU Lesser General Public License
144 + * version 3 along with OpenOffice.org. If not, see
145 + * <http://www.openoffice.org/license.html>
146 + * for a copy of the LGPLv3 License.
148 + ************************************************************************/
150 +#ifndef SC_STRINGUTIL_HXX
151 +#define SC_STRINGUTIL_HXX
153 +#include "rtl/ustring.hxx"
155 +class ScStringUtil
157 +public:
158 + /**
159 + * Check if a given string is a simple decimal number (e.g. 12.345). We
160 + * don't do any elaborate parsing here; we only check for the simplest
161 + * case of decimal number format.
163 + * @param rStr string to parse
164 + * @param dsep decimal separator
165 + * @param gsep group separator (aka thousands separator)
166 + * @param rVal value of successfully parsed number
167 + *
168 + * @return true if the string is a valid number, false otherwise.
169 + */
170 + static bool parseSimpleNumber(
171 + const ::rtl::OUString& rStr, sal_Unicode dsep, sal_Unicode gsep, double& rVal);
175 +#endif
176 diff --git sc/inc/table.hxx sc/inc/table.hxx
177 index b95c40c..ea24628 100644
178 --- sc/inc/table.hxx
179 +++ sc/inc/table.hxx
180 @@ -253,7 +253,8 @@ public:
181 void PutCell( SCCOL nCol, SCROW nRow, ScBaseCell* pCell );
182 void PutCell(SCCOL nCol, SCROW nRow, ULONG nFormatIndex, ScBaseCell* pCell);
183 // TRUE = Zahlformat gesetzt
184 - BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString );
185 + BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
186 + SvNumberFormatter* pFormatter = NULL, bool bDetectNumberFormat = true );
187 void SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
188 void SetError( SCCOL nCol, SCROW nRow, USHORT nError);
190 diff --git sc/source/core/data/column3.cxx sc/source/core/data/column3.cxx
191 index b1fac42..40f6370 100644
192 --- sc/source/core/data/column3.cxx
193 +++ sc/source/core/data/column3.cxx
194 @@ -54,6 +54,13 @@
195 #include "markdata.hxx"
196 #include "detfunc.hxx" // fuer Notizen bei DeleteRange
197 #include "postit.hxx"
198 +#include "stringutil.hxx"
200 +#include <com/sun/star/i18n/LocaleDataItem.hpp>
202 +using ::com::sun::star::i18n::LocaleDataItem;
203 +using ::rtl::OUString;
204 +using ::rtl::OUStringBuffer;
206 // Err527 Workaround
207 extern const ScFormulaCell* pLastFormulaTreeTop; // in cellform.cxx
208 @@ -1218,7 +1225,8 @@ void ScColumn::StartListeningInArea( SCROW nRow1, SCROW nRow2 )
210 // TRUE = Zahlformat gesetzt
211 BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
212 - formula::FormulaGrammar::AddressConvention eConv )
213 + formula::FormulaGrammar::AddressConvention eConv,
214 + SvNumberFormatter* pFormatter, bool bDetectNumberFormat )
216 BOOL bNumFmtSet = FALSE;
217 if (VALIDROW(nRow))
218 @@ -1230,7 +1238,8 @@ BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
219 double nVal;
220 sal_uInt32 nIndex, nOldIndex = 0;
221 sal_Unicode cFirstChar;
222 - SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
223 + if (!pFormatter)
224 + pFormatter = pDocument->GetFormatTable();
225 SfxObjectShell* pDocSh = pDocument->GetDocumentShell();
226 if ( pDocSh )
227 bIsLoading = pDocSh->IsLoading();
228 @@ -1297,48 +1306,80 @@ BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
229 if ( !bIsText )
230 nIndex = nOldIndex = pFormatter->GetStandardIndex();
232 - if ( !bIsText &&
233 - pFormatter->IsNumberFormat(rString, nIndex, nVal) )
234 - { // Zahl
235 - pNewCell = new ScValueCell( nVal );
236 - if ( nIndex != nOldIndex)
238 - // #i22345# New behavior: Apply the detected number format only if
239 - // the old one was the default number, date, time or boolean format.
240 - // Exception: If the new format is boolean, always apply it.
242 - BOOL bOverwrite = FALSE;
243 - const SvNumberformat* pOldFormat = pFormatter->GetEntry( nOldIndex );
244 - if ( pOldFormat )
245 + do
247 + if (bIsText)
248 + break;
250 + if (bDetectNumberFormat)
252 + if (!pFormatter->IsNumberFormat(rString, nIndex, nVal))
253 + break;
255 + pNewCell = new ScValueCell( nVal );
256 + if ( nIndex != nOldIndex)
258 - short nOldType = pOldFormat->GetType() & ~NUMBERFORMAT_DEFINED;
259 - if ( nOldType == NUMBERFORMAT_NUMBER || nOldType == NUMBERFORMAT_DATE ||
260 - nOldType == NUMBERFORMAT_TIME || nOldType == NUMBERFORMAT_LOGICAL )
261 + // #i22345# New behavior: Apply the detected number format only if
262 + // the old one was the default number, date, time or boolean format.
263 + // Exception: If the new format is boolean, always apply it.
265 + BOOL bOverwrite = FALSE;
266 + const SvNumberformat* pOldFormat = pFormatter->GetEntry( nOldIndex );
267 + if ( pOldFormat )
269 - if ( nOldIndex == pFormatter->GetStandardFormat(
270 - nOldType, pOldFormat->GetLanguage() ) )
271 + short nOldType = pOldFormat->GetType() & ~NUMBERFORMAT_DEFINED;
272 + if ( nOldType == NUMBERFORMAT_NUMBER || nOldType == NUMBERFORMAT_DATE ||
273 + nOldType == NUMBERFORMAT_TIME || nOldType == NUMBERFORMAT_LOGICAL )
275 - bOverwrite = TRUE; // default of these types can be overwritten
276 + if ( nOldIndex == pFormatter->GetStandardFormat(
277 + nOldType, pOldFormat->GetLanguage() ) )
279 + bOverwrite = TRUE; // default of these types can be overwritten
284 - if ( !bOverwrite && pFormatter->GetType( nIndex ) == NUMBERFORMAT_LOGICAL )
286 - bOverwrite = TRUE; // overwrite anything if boolean was detected
288 + if ( !bOverwrite && pFormatter->GetType( nIndex ) == NUMBERFORMAT_LOGICAL )
290 + bOverwrite = TRUE; // overwrite anything if boolean was detected
293 - if ( bOverwrite )
295 - ApplyAttr( nRow, SfxUInt32Item( ATTR_VALUE_FORMAT,
296 - (UINT32) nIndex) );
297 - bNumFmtSet = TRUE;
298 + if ( bOverwrite )
300 + ApplyAttr( nRow, SfxUInt32Item( ATTR_VALUE_FORMAT,
301 + (UINT32) nIndex) );
302 + bNumFmtSet = TRUE;
307 - else // Text
308 - pNewCell = new ScStringCell( rString );
312 + else
314 + // Only check if the string is a regular number.
315 + const LocaleDataWrapper* pLocale = pFormatter->GetLocaleData();
316 + if (!pLocale)
317 + break;
319 + LocaleDataItem aLocaleItem = pLocale->getLocaleItem();
320 + const OUString& rDecSep = aLocaleItem.decimalSeparator;
321 + const OUString& rGroupSep = aLocaleItem.thousandSeparator;
322 + if (rDecSep.getLength() != 1 || rGroupSep.getLength() != 1)
323 + break;
325 + sal_Unicode dsep = rDecSep.getStr()[0];
326 + sal_Unicode gsep = rGroupSep.getStr()[0];
328 + if (!ScStringUtil::parseSimpleNumber(rString, dsep, gsep, nVal))
329 + break;
331 + pNewCell = new ScValueCell(nVal);
334 + while (false);
336 + if (!pNewCell)
337 + pNewCell = new ScStringCell(rString);
341 if ( bIsLoading && (!nCount || nRow > pItems[nCount-1].nRow) )
342 { // Search einsparen und ohne Umweg ueber Insert, Listener aufbauen
343 diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
344 index 6c96215..a3b7e49 100644
345 --- sc/source/core/data/document.cxx
346 +++ sc/source/core/data/document.cxx
347 @@ -2451,10 +2451,11 @@ void ScDocument::PutCell( const ScAddress& rPos, ScBaseCell* pCell, BOOL bForceT
351 -BOOL ScDocument::SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString )
352 +BOOL ScDocument::SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
353 + SvNumberFormatter* pFormatter, bool bDetectNumberFormat )
355 if ( ValidTab(nTab) && pTab[nTab] )
356 - return pTab[nTab]->SetString( nCol, nRow, nTab, rString );
357 + return pTab[nTab]->SetString( nCol, nRow, nTab, rString, pFormatter, bDetectNumberFormat );
358 else
359 return FALSE;
361 diff --git sc/source/core/data/table2.cxx sc/source/core/data/table2.cxx
362 index d2f8710..8cb6f7a 100644
363 --- sc/source/core/data/table2.cxx
364 +++ sc/source/core/data/table2.cxx
365 @@ -841,10 +841,12 @@ void ScTable::PutCell( const ScAddress& rPos, ULONG nFormatIndex, ScBaseCell* pC
369 -BOOL ScTable::SetString( SCCOL nCol, SCROW nRow, SCTAB nTabP, const String& rString )
370 +BOOL ScTable::SetString( SCCOL nCol, SCROW nRow, SCTAB nTabP, const String& rString,
371 + SvNumberFormatter* pFormatter, bool bDetectNumberFormat )
373 if (ValidColRow(nCol,nRow))
374 - return aCol[nCol].SetString( nRow, nTabP, rString );
375 + return aCol[nCol].SetString(
376 + nRow, nTabP, rString, pDocument->GetAddressConvention(), pFormatter, bDetectNumberFormat );
377 else
378 return FALSE;
380 diff --git sc/source/core/tool/makefile.mk sc/source/core/tool/makefile.mk
381 index 1bf94ea..b54c041 100644
382 --- sc/source/core/tool/makefile.mk
383 +++ sc/source/core/tool/makefile.mk
384 @@ -107,6 +107,7 @@ SLOFILES = \
385 $(SLO)$/refupdat.obj \
386 $(SLO)$/scmatrix.obj \
387 $(SLO)$/sctictac.obj \
388 + $(SLO)$/stringutil.obj \
389 $(SLO)$/subtotal.obj \
390 $(SLO)$/token.obj \
391 $(SLO)$/unitconv.obj \
392 @@ -130,6 +131,7 @@ EXCEPTIONSFILES= \
393 $(SLO)$/lookupcache.obj \
394 $(SLO)$/prnsave.obj \
395 $(SLO)$/reftokenhelper.obj \
396 + $(SLO)$/stringutil.obj \
397 $(SLO)$/token.obj
399 # [kh] POWERPC compiler problem
400 diff --git sc/source/core/tool/stringutil.cxx sc/source/core/tool/stringutil.cxx
401 new file mode 100644
402 index 0000000..eaf756e
403 --- /dev/null
404 +++ sc/source/core/tool/stringutil.cxx
405 @@ -0,0 +1,101 @@
406 +/*************************************************************************
408 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
409 + *
410 + * Copyright 2008 by Sun Microsystems, Inc.
412 + * OpenOffice.org - a multi-platform office productivity suite
414 + * $RCSfile: table.hxx,v $
415 + * $Revision: 1.35 $
417 + * This file is part of OpenOffice.org.
419 + * OpenOffice.org is free software: you can redistribute it and/or modify
420 + * it under the terms of the GNU Lesser General Public License version 3
421 + * only, as published by the Free Software Foundation.
423 + * OpenOffice.org is distributed in the hope that it will be useful,
424 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
425 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
426 + * GNU Lesser General Public License version 3 for more details
427 + * (a copy is included in the LICENSE file that accompanied this code).
429 + * You should have received a copy of the GNU Lesser General Public License
430 + * version 3 along with OpenOffice.org. If not, see
431 + * <http://www.openoffice.org/license.html>
432 + * for a copy of the LGPLv3 License.
434 + ************************************************************************/
436 +// MARKER(update_precomp.py): autogen include statement, do not remove
437 +#include "precompiled_sc.hxx"
439 +// System - Includes -----------------------------------------------------
441 +#include "stringutil.hxx"
442 +#include "rtl/ustrbuf.hxx"
444 +using ::rtl::OUString;
445 +using ::rtl::OUStringBuffer;
447 +bool ScStringUtil::parseSimpleNumber(
448 + const OUString& rStr, sal_Unicode dsep, sal_Unicode gsep, double& rVal)
450 + OUStringBuffer aBuf;
451 + sal_Int32 n = rStr.getLength();
452 + const sal_Unicode* p = rStr.getStr();
453 + sal_Int32 nPosDSep = -1, nPosGSep = -1;
454 + for (sal_Int32 i = 0; i < n; ++i)
456 + sal_Unicode c = p[i];
457 + if (sal_Unicode('0') <= c && c <= sal_Unicode('9'))
459 + // this is a digit.
460 + aBuf.append(c);
462 + else if (c == dsep)
464 + // this is a decimal separator.
466 + if (nPosDSep >= 0)
467 + // a second decimal separator -> not a valid number.
468 + return false;
469 + if (nPosGSep >= 0 && i - nPosGSep != 4)
470 + // the number has a group separator and the decimal sep is not
471 + // positioned correctly.
472 + return false;
474 + nPosDSep = i;
475 + aBuf.append(c);
477 + else if (c == gsep)
479 + // this is a group (thousand) separator.
480 + if (i == 0)
481 + return false;
483 + if (nPosGSep >= 0 && i - nPosGSep != 4)
484 + {
485 + // this group separator is not positioned correctly relative
486 + // to the last group separator.
487 + return false;
490 + nPosGSep = i;
492 + else if (c == sal_Unicode('-') || c == sal_Unicode('+'))
494 + // A sign must be the first character if it's given.
495 + if (i == 0)
496 + aBuf.append(c);
497 + else
498 + return false;
500 + else
501 + return false;
504 + rVal = aBuf.makeStringAndClear().toDouble();
505 + return true;
507 diff --git sc/source/filter/html/htmlimp.cxx sc/source/filter/html/htmlimp.cxx
508 index 8c92f3d..8fbd9aa 100644
509 --- sc/source/filter/html/htmlimp.cxx
510 +++ sc/source/filter/html/htmlimp.cxx
511 @@ -63,13 +63,14 @@
512 //------------------------------------------------------------------------
514 FltError ScFormatFilterPluginImpl::ScImportHTML( SvStream &rStream, const String& rBaseURL, ScDocument *pDoc,
515 - ScRange& rRange, double nOutputFactor, BOOL bCalcWidthHeight )
516 + ScRange& rRange, double nOutputFactor, BOOL bCalcWidthHeight, SvNumberFormatter* pFormatter,
517 + bool bConvertDate )
519 ScHTMLImport aImp( pDoc, rBaseURL, rRange, bCalcWidthHeight );
520 FltError nErr = (FltError) aImp.Read( rStream, rBaseURL );
521 ScRange aR = aImp.GetRange();
522 rRange.aEnd = aR.aEnd;
523 - aImp.WriteToDocument( TRUE, nOutputFactor );
524 + aImp.WriteToDocument( TRUE, nOutputFactor, pFormatter, bConvertDate );
525 return nErr;
528 @@ -137,9 +138,10 @@ void ScHTMLImport::InsertRangeName( ScDocument* pDoc, const String& rName, const
529 delete pRangeData;
532 -void ScHTMLImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
533 +void ScHTMLImport::WriteToDocument(
534 + BOOL bSizeColsRows, double nOutputFactor, SvNumberFormatter* pFormatter, bool bConvertDate )
536 - ScEEImport::WriteToDocument( bSizeColsRows, nOutputFactor );
537 + ScEEImport::WriteToDocument( bSizeColsRows, nOutputFactor, pFormatter, bConvertDate );
539 const ScHTMLParser* pParser = GetParser();
540 const ScHTMLTable* pGlobTable = pParser->GetGlobalTable();
541 diff --git sc/source/filter/inc/eeimport.hxx sc/source/filter/inc/eeimport.hxx
542 index fef4486..32d7d0a 100644
543 --- sc/source/filter/inc/eeimport.hxx
544 +++ sc/source/filter/inc/eeimport.hxx
545 @@ -63,7 +63,9 @@ public:
546 virtual ULONG Read( SvStream& rStream, const String& rBaseURL );
547 virtual ScRange GetRange() { return maRange; }
548 virtual void WriteToDocument( BOOL bSizeColsRows = FALSE,
549 - double nOutputFactor = 1.0 );
550 + double nOutputFactor = 1.0,
551 + SvNumberFormatter* pFormatter = NULL,
552 + bool bConvertDate = true );
555 #endif
556 diff --git sc/source/filter/inc/ftools.hxx sc/source/filter/inc/ftools.hxx
557 index b670900..79c698e 100644
558 --- sc/source/filter/inc/ftools.hxx
559 +++ sc/source/filter/inc/ftools.hxx
560 @@ -522,7 +522,9 @@ class ScFormatFilterPluginImpl : public ScFormatFilterPlugin {
561 virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress& rInsPos,
562 const CharSet eSrc = RTL_TEXTENCODING_DONTKNOW, UINT32 nDifOption = SC_DIFOPT_EXCEL );
563 virtual FltError ScImportRTF( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange );
564 - virtual FltError ScImportHTML( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange, double nOutputFactor = 1.0, BOOL bCalcWidthHeight = TRUE );
565 + virtual FltError ScImportHTML( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange,
566 + double nOutputFactor = 1.0, BOOL bCalcWidthHeight = TRUE,
567 + SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true );
569 virtual ScEEAbsImport *CreateRTFImport( ScDocument* pDoc, const ScRange& rRange );
570 virtual ScEEAbsImport *CreateHTMLImport( ScDocument* pDocP, const String& rBaseURL, const ScRange& rRange, BOOL bCalcWidthHeight );
571 diff --git sc/source/filter/inc/htmlimp.hxx sc/source/filter/inc/htmlimp.hxx
572 index 96ce225..aafe91b 100644
573 --- sc/source/filter/inc/htmlimp.hxx
574 +++ sc/source/filter/inc/htmlimp.hxx
575 @@ -45,7 +45,8 @@ public:
576 virtual ~ScHTMLImport();
577 const ScHTMLParser* GetParser() const { return (ScHTMLParser*)mpParser; }
579 - virtual void WriteToDocument( BOOL bSizeColsRows = FALSE, double nOutputFactor = 1.0 );
580 + virtual void WriteToDocument( BOOL bSizeColsRows = FALSE, double nOutputFactor = 1.0,
581 + SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true );
583 static String GetHTMLRangeNameList( ScDocument* pDoc, const String& rOrigName );
585 diff --git sc/source/filter/rtf/eeimpars.cxx sc/source/filter/rtf/eeimpars.cxx
586 index 3f813a1..e4b28a7 100644
587 --- sc/source/filter/rtf/eeimpars.cxx
588 +++ sc/source/filter/rtf/eeimpars.cxx
589 @@ -129,7 +129,7 @@ ULONG ScEEImport::Read( SvStream& rStream, const String& rBaseURL )
593 -void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
594 +void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor, SvNumberFormatter* pFormatter, bool bConvertDate )
596 ScProgress* pProgress = new ScProgress( mpDoc->GetDocumentShell(),
597 ScGlobal::GetRscString( STR_LOAD_DOC ), mpParser->Count() );
598 @@ -150,7 +150,8 @@ void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
599 nLastMergedRow = SCROW_MAX;
600 BOOL bHasGraphics = FALSE;
601 ScEEParseEntry* pE;
602 - SvNumberFormatter* pFormatter = mpDoc->GetFormatTable();
603 + if (!pFormatter)
604 + pFormatter = mpDoc->GetFormatTable();
605 bool bNumbersEnglishUS = (pFormatter->GetLanguage() != LANGUAGE_ENGLISH_US);
606 if (bNumbersEnglishUS)
608 @@ -335,7 +336,7 @@ void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
609 else if ( !pE->aSel.HasRange() )
611 // maybe ALT text of IMG or similar
612 - mpDoc->SetString( nCol, nRow, nTab, pE->aAltText );
613 + mpDoc->SetString( nCol, nRow, nTab, pE->aAltText, pFormatter );
614 // wenn SelRange komplett leer kann nachfolgender Text im gleichen Absatz liegen!
616 else
617 @@ -380,7 +381,7 @@ void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
618 if (bNumbersEnglishUS && !bEnUsRecognized)
619 mpDoc->PutCell( nCol, nRow, nTab, new ScStringCell( aStr));
620 else
621 - mpDoc->SetString( nCol, nRow, nTab, aStr );
622 + mpDoc->SetString( nCol, nRow, nTab, aStr, pFormatter, bConvertDate );
625 else
626 diff --git sc/source/ui/attrdlg/scdlgfact.cxx sc/source/ui/attrdlg/scdlgfact.cxx
627 index fe6cf52..0d1330e 100644
628 --- sc/source/ui/attrdlg/scdlgfact.cxx
629 +++ sc/source/ui/attrdlg/scdlgfact.cxx
630 @@ -71,6 +71,7 @@
631 #include "validate.hxx" //add for ScValidationDlg
632 #include "validate.hrc" //add for ScValidationDlg
633 #include "sortdlg.hxx" //add for ScSortDlg
634 +#include "langchooser.hxx"
635 #include "opredlin.hxx" //add for ScRedlineOptionsTabPage
636 #include "tpcalc.hxx" //add for ScTpCalcOptions
637 #include "tpprint.hxx" //add for ScTpPrintOptions
638 @@ -117,6 +118,7 @@ IMPL_ABSTDLG_BASE(AbstractScShowTabDlg_Impl); //add for ScShowTabDlg
639 IMPL_ABSTDLG_BASE(AbstractScStringInputDlg_Impl); //add for ScStringInputDlg
640 IMPL_ABSTDLG_BASE(AbstractScTabBgColorDlg_Impl); //add for ScTabBgColorDlg
641 IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl); //add for ScImportOptionsDlg
642 +IMPL_ABSTDLG_BASE(AbstractScLangChooserDlg_Impl);
643 IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); //add for ScAttrDlg, ScHFEditDlg, ScStyleDlg, ScSubTotalDlg,ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg
646 @@ -594,6 +596,20 @@ void AbstractScImportOptionsDlg_Impl::GetImportOptions( ScImportOptions& rOption
647 pDlg->GetImportOptions(rOptions);
649 // add for AbstractScImportOptionsDlg_Impl end
651 +//add for AbstractScLangChooserDlg_Impl begin
652 +LanguageType AbstractScLangChooserDlg_Impl::GetLanguageType() const
654 + return pDlg->getLanguageType();
657 +bool AbstractScLangChooserDlg_Impl::IsDateConversionSet() const
659 + return pDlg->isDateConversionSet();
662 +//add for AbstractScLangChooserDlg_Impl end
664 // =========================Factories for createdialog ===================
666 //add for ScImportAsciiDlg begin
667 @@ -616,6 +632,21 @@ AbstractScImportAsciiDlg * ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg
669 // ScImportAsciiDlg end
671 +AbstractScLangChooserDlg * ScAbstractDialogFactory_Impl::CreateScLangChooserDlg( Window* pParent, int nId )
673 + ScLangChooserDlg* pDlg = NULL;
674 + switch (nId)
676 + case RID_SCDLG_LANG_CHOOSER:
677 + pDlg = new ScLangChooserDlg(pParent);
678 + break;
679 + default:
683 + return pDlg ? new AbstractScLangChooserDlg_Impl(pDlg) : NULL;
686 //add for ScAutoFormatDlg begin
688 AbstractScAutoFormatDlg * ScAbstractDialogFactory_Impl::CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg
689 diff --git sc/source/ui/attrdlg/scdlgfact.hxx sc/source/ui/attrdlg/scdlgfact.hxx
690 index 4391001..4724771 100644
691 --- sc/source/ui/attrdlg/scdlgfact.hxx
692 +++ sc/source/ui/attrdlg/scdlgfact.hxx
693 @@ -65,6 +65,7 @@ class ScStringInputDlg;
694 class ScTabBgColorDlg;
695 class ScImportOptionsDlg;
696 class SfxTabDialog;
697 +class ScLangChooserDlg;
699 #define DECL_ABSTDLG_BASE(Class,DialogClass) \
700 DialogClass* pDlg; \
701 @@ -356,6 +357,13 @@ class AbstractScImportOptionsDlg_Impl : public AbstractScImportOptionsDlg //add
702 virtual void GetImportOptions( ScImportOptions& rOptions ) const;
705 +class AbstractScLangChooserDlg_Impl : public AbstractScLangChooserDlg
707 + DECL_ABSTDLG_BASE( AbstractScLangChooserDlg_Impl, ScLangChooserDlg)
708 + virtual LanguageType GetLanguageType() const;
709 + virtual bool IsDateConversionSet() const;
712 //add for ScAttrDlg , ScHFEditDlg, ScStyleDlg, ScSubTotalDlg, ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg
713 class AbstractTabDialog_Impl : public SfxAbstractTabDialog
715 @@ -380,6 +388,8 @@ public:
716 SvStream* pInStream, int nId,
717 sal_Unicode cSep = '\t');
719 + virtual AbstractScLangChooserDlg * CreateScLangChooserDlg( Window* pParent, int nId );
721 virtual AbstractScAutoFormatDlg * CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg
722 ScAutoFormat* pAutoFormat,
723 const ScAutoFormatData* pSelFormatData,
724 diff --git sc/source/ui/dbgui/langchooser.cxx sc/source/ui/dbgui/langchooser.cxx
725 new file mode 100644
726 index 0000000..d5fd72b
727 --- /dev/null
728 +++ sc/source/ui/dbgui/langchooser.cxx
729 @@ -0,0 +1,120 @@
730 +/*************************************************************************
732 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
733 + *
734 + * Copyright 2008 by Sun Microsystems, Inc.
736 + * OpenOffice.org - a multi-platform office productivity suite
738 + * $RCSfile: langbox.hxx,v $
739 + * $Revision: 1.4.242.1 $
741 + * This file is part of OpenOffice.org.
743 + * OpenOffice.org is free software: you can redistribute it and/or modify
744 + * it under the terms of the GNU Lesser General Public License version 3
745 + * only, as published by the Free Software Foundation.
747 + * OpenOffice.org is distributed in the hope that it will be useful,
748 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
749 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
750 + * GNU Lesser General Public License version 3 for more details
751 + * (a copy is included in the LICENSE file that accompanied this code).
753 + * You should have received a copy of the GNU Lesser General Public License
754 + * version 3 along with OpenOffice.org. If not, see
755 + * <http://www.openoffice.org/license.html>
756 + * for a copy of the LGPLv3 License.
758 + ************************************************************************/
760 +// MARKER(update_precomp.py): autogen include statement, do not remove
761 +#include "precompiled_sc.hxx"
763 +#undef SC_DLLIMPLEMENTATION
765 +//------------------------------------------------------------------------
767 +#include "langchooser.hxx"
768 +#include "langchooser.hrc"
770 +#include "scresid.hxx"
771 +#include "vcl/window.hxx"
772 +#include "vcl/msgbox.hxx"
773 +#include "vcl/svapp.hxx"
775 +ScLangChooserDlg::ScLangChooserDlg(Window* pParent) :
776 + ModalDialog(pParent, ScResId(RID_SCDLG_LANG_CHOOSER)),
778 + maBtnOk(this, ScResId(BTN_OK)),
779 + maBtnCancel(this, ScResId(BTN_CANCEL)),
780 + maBtnHelp(this, ScResId(BTN_HELP)),
781 + maFlChooseLang(this, ScResId(FL_CHOOSE_LANG)),
782 + maRbAutomatic(this, ScResId(RB_AUTOMATIC)),
783 + maRbCustom(this, ScResId(RB_CUSTOM)),
784 + maLbCustomLang(this, ScResId(LB_CUSTOM_LANG)),
785 + maFlOption(this, ScResId(FL_OPTION)),
786 + maBtnConvertDate(this, ScResId(BTN_CONVERT_DATE))
788 + init();
791 +ScLangChooserDlg::~ScLangChooserDlg()
795 +short ScLangChooserDlg::Execute()
797 + return ModalDialog::Execute();
800 +LanguageType ScLangChooserDlg::getLanguageType() const
802 + if (maRbAutomatic.IsChecked())
803 + return LANGUAGE_SYSTEM;
805 + return maLbCustomLang.GetSelectLanguage();
808 +bool ScLangChooserDlg::isDateConversionSet() const
810 + return maBtnConvertDate.IsChecked();
813 +void ScLangChooserDlg::init()
815 + Link aLink = LINK( this, ScLangChooserDlg, OKHdl );
816 + maBtnOk.SetClickHdl(aLink);
817 + aLink = LINK( this, ScLangChooserDlg, RadioHdl );
818 + maRbAutomatic.SetClickHdl(aLink);
819 + maRbCustom.SetClickHdl(aLink);
821 + maRbAutomatic.Check(true);
823 + maLbCustomLang.SetLanguageList(
824 + LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, false, false);
826 + LanguageType eLang = Application::GetSettings().GetLanguage();
827 + maLbCustomLang.SelectLanguage(eLang);
828 + maLbCustomLang.Disable();
831 +IMPL_LINK( ScLangChooserDlg, OKHdl, OKButton*, EMPTYARG )
833 + EndDialog(RET_OK);
834 + return 0;
837 +IMPL_LINK( ScLangChooserDlg, RadioHdl, RadioButton*, pBtn )
839 + if (pBtn == &maRbAutomatic)
841 + maLbCustomLang.Disable();
843 + else if (pBtn == &maRbCustom)
845 + maLbCustomLang.Enable();
847 + return 0;
850 diff --git sc/source/ui/dbgui/langchooser.src sc/source/ui/dbgui/langchooser.src
851 new file mode 100644
852 index 0000000..1e121de
853 --- /dev/null
854 +++ sc/source/ui/dbgui/langchooser.src
855 @@ -0,0 +1,112 @@
856 +/*************************************************************************
858 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
859 + *
860 + * Copyright 2008 by Sun Microsystems, Inc.
862 + * OpenOffice.org - a multi-platform office productivity suite
864 + * $RCSfile: retypepassdlg.src,v $
865 + * $Revision: 1.1.2.3 $
867 + * This file is part of OpenOffice.org.
869 + * OpenOffice.org is free software: you can redistribute it and/or modify
870 + * it under the terms of the GNU Lesser General Public License version 3
871 + * only, as published by the Free Software Foundation.
873 + * OpenOffice.org is distributed in the hope that it will be useful,
874 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
875 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
876 + * GNU Lesser General Public License version 3 for more details
877 + * (a copy is included in the LICENSE file that accompanied this code).
879 + * You should have received a copy of the GNU Lesser General Public License
880 + * version 3 along with OpenOffice.org. If not, see
881 + * <http://www.openoffice.org/license.html>
882 + * for a copy of the LGPLv3 License.
884 + ************************************************************************/
886 +#include "langchooser.hrc"
888 +ModalDialog RID_SCDLG_LANG_CHOOSER
890 + Text [ en-US ] = "Select Language" ;
891 + Size = MAP_APPFONT ( 190 , 101 ) ;
892 + Moveable = TRUE ;
893 + Closeable = TRUE ;
894 + OutputSize = TRUE ;
896 + OKButton BTN_OK
898 + Pos = MAP_APPFONT ( 135, 6 ) ;
899 + Size = MAP_APPFONT ( 50, 14 ) ;
900 + DefButton = TRUE ;
901 + };
903 + CancelButton BTN_CANCEL
905 + Pos = MAP_APPFONT ( 135, 23 ) ;
906 + Size = MAP_APPFONT ( 50, 14 ) ;
907 + };
909 + HelpButton BTN_HELP
911 + Pos = MAP_APPFONT ( 135, 43 ) ;
912 + Size = MAP_APPFONT ( 50, 14 ) ;
913 + };
915 + FixedLine FL_CHOOSE_LANG
917 + Pos = MAP_APPFONT( 6, 3 ) ;
918 + Size = MAP_APPFONT( 125, 14 ) ;
920 + Text [ en-US ] = "Select the language to use for import" ;
921 + };
923 + RadioButton RB_AUTOMATIC
925 + Pos = MAP_APPFONT( 12, 20 ) ;
926 + Size = MAP_APPFONT( 50, 10 ) ;
927 + TabStop = TRUE ;
929 + Text [ en-US ] = "Automatic" ;
930 + };
932 + RadioButton RB_CUSTOM
934 + Pos = MAP_APPFONT( 12, 34 ) ;
935 + Size = MAP_APPFONT( 50, 10 ) ;
936 + TabStop = TRUE ;
938 + Text [ en-US ] = "Custom" ;
939 + };
941 + ListBox LB_CUSTOM_LANG
943 + Pos = MAP_APPFONT( 20, 50 ) ;
944 + Size = MAP_APPFONT( 100, 55 ) ;
945 + TabStop = TRUE ;
946 + DropDown = TRUE ;
947 + Sort = TRUE ;
948 + };
950 + FixedLine FL_OPTION
952 + Pos = MAP_APPFONT( 6, 70 );
953 + Size = MAP_APPFONT( 125, 14 );
955 + Text [ en-US ] = "Options" ;
956 + };
958 + CheckBox BTN_CONVERT_DATE
960 + Pos = MAP_APPFONT( 12, 86 );
961 + Size = MAP_APPFONT( 125, 10 );
962 + TabStop = TRUE ;
964 + Text [ en-US ] = "Detect special numbers (such as dates)." ;
965 + };
968 diff --git sc/source/ui/dbgui/makefile.mk sc/source/ui/dbgui/makefile.mk
969 index 0a95138..8df758d 100644
970 --- sc/source/ui/dbgui/makefile.mk
971 +++ sc/source/ui/dbgui/makefile.mk
972 @@ -53,6 +53,7 @@ SLOFILES = \
973 $(SLO)$/pfiltdlg.obj \
974 $(SLO)$/dbnamdlg.obj \
975 $(SLO)$/expftext.obj \
976 + $(SLO)$/langchooser.obj \
977 $(SLO)$/subtdlg.obj \
978 $(SLO)$/tpsubt.obj \
979 $(SLO)$/fieldwnd.obj \
980 @@ -85,6 +86,7 @@ EXCEPTIONSFILES= \
982 SRS1NAME=$(TARGET)
983 SRC1FILES = \
984 + langchooser.src \
985 pivot.src \
986 pvfundlg.src \
987 dpgroupdlg.src \
988 @@ -114,7 +116,8 @@ LIB1OBJFILES = \
989 $(SLO)$/csvruler.obj \
990 $(SLO)$/csvgrid.obj \
991 $(SLO)$/csvtablebox.obj \
992 - $(SLO)$/asciiopt.obj
993 + $(SLO)$/asciiopt.obj \
994 + $(SLO)$/langchooser.obj
996 # --- Tagets -------------------------------------------------------
998 diff --git sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
999 index 3dfbf19..66a91b8 100644
1000 --- sc/source/ui/docshell/docsh.cxx
1001 +++ sc/source/ui/docshell/docsh.cxx
1002 @@ -137,6 +137,8 @@ using namespace com::sun::star;
1003 using namespace com::sun::star::document::VbaEventId;
1005 using namespace com::sun::star;
1006 +using ::rtl::OUString;
1007 +using ::rtl::OUStringBuffer;
1009 // STATIC DATA -----------------------------------------------------------
1011 @@ -899,6 +901,34 @@ BOOL __EXPORT ScDocShell::LoadFrom( SfxMedium& rMedium )
1012 return bRet;
1015 +static void lcl_parseHtmlFilterOption(const OUString& rOption, LanguageType& rLang, bool& rDateConvert)
1017 + OUStringBuffer aBuf;
1018 + OUString aTokens[2];
1019 + sal_Int32 n = rOption.getLength();
1020 + const sal_Unicode* p = rOption.getStr();
1021 + sal_Int32 nTokenId = 0;
1022 + for (sal_Int32 i = 0; i < n; ++i)
1024 + const sal_Unicode c = p[i];
1025 + if (c == sal_Unicode(' '))
1027 + if (aBuf.getLength())
1028 + aTokens[nTokenId++] = aBuf.makeStringAndClear();
1030 + else
1031 + aBuf.append(c);
1033 + if (nTokenId >= 2)
1034 + break;
1037 + if (aBuf.getLength())
1038 + aTokens[nTokenId] = aBuf.makeStringAndClear();
1040 + rLang = static_cast<LanguageType>(aTokens[0].toInt32());
1041 + rDateConvert = static_cast<bool>(aTokens[1].toInt32());
1044 BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
1046 @@ -1273,12 +1303,24 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium )
1047 SvStream* pInStream = rMedium.GetInStream();
1048 if (pInStream)
1050 + LanguageType eLang = LANGUAGE_SYSTEM;
1051 + bool bDateConvert = false;
1052 + SfxItemSet* pSet = rMedium.GetItemSet();
1053 + const SfxPoolItem* pItem;
1054 + if ( pSet && SFX_ITEM_SET ==
1055 + pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) )
1057 + String aFilterOption = (static_cast<const SfxStringItem*>(pItem))->GetValue();
1058 + lcl_parseHtmlFilterOption(aFilterOption, eLang, bDateConvert);
1061 pInStream->Seek( 0 );
1062 ScRange aRange;
1063 // HTML macht eigenes ColWidth/RowHeight
1064 CalcOutputFactor();
1065 + SvNumberFormatter aNumFormatter(aDocument.GetServiceManager(), eLang);
1066 eError = ScFormatFilter::Get().ScImportHTML( *pInStream, rMedium.GetBaseURL(), &aDocument, aRange,
1067 - GetOutputFactor(), !bWebQuery );
1068 + GetOutputFactor(), !bWebQuery, &aNumFormatter, bDateConvert );
1069 if (eError != eERR_OK)
1071 if (!GetError())
1072 @@ -2266,6 +2308,11 @@ String ScDocShell::GetOwnFilterName() // static
1073 return String::CreateFromAscii(pFilterSc50);
1076 +String ScDocShell::GetHtmlFilterName()
1078 + return String::CreateFromAscii(pFilterHtml);
1081 String ScDocShell::GetWebQueryFilterName() // static
1083 return String::CreateFromAscii(pFilterHtmlWebQ);
1084 diff --git sc/source/ui/docshell/impex.cxx sc/source/ui/docshell/impex.cxx
1085 index cc51d67..e2ccdf5 100644
1086 --- sc/source/ui/docshell/impex.cxx
1087 +++ sc/source/ui/docshell/impex.cxx
1088 @@ -1943,7 +1943,7 @@ class ScFormatFilterMissing : public ScFormatFilterPlugin {
1089 virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress&,
1090 const CharSet, UINT32 ) RETURN_ERROR
1091 virtual FltError ScImportRTF( SvStream&, const String&, ScDocument*, ScRange& ) RETURN_ERROR
1092 - virtual FltError ScImportHTML( SvStream&, const String&, ScDocument*, ScRange&, double, BOOL ) RETURN_ERROR
1093 + virtual FltError ScImportHTML( SvStream&, const String&, ScDocument*, ScRange&, double, BOOL, SvNumberFormatter*, bool ) RETURN_ERROR
1095 virtual ScEEAbsImport *CreateRTFImport( ScDocument*, const ScRange& ) { return NULL; }
1096 virtual ScEEAbsImport *CreateHTMLImport( ScDocument*, const String&, const ScRange&, BOOL ) { return NULL; }
1097 diff --git sc/source/ui/inc/docsh.hxx sc/source/ui/inc/docsh.hxx
1098 index 1126a95..7620368 100644
1099 --- sc/source/ui/inc/docsh.hxx
1100 +++ sc/source/ui/inc/docsh.hxx
1101 @@ -409,6 +409,7 @@ public:
1103 static ScDocShell* GetShellByNum( USHORT nDocNo );
1104 static String GetOwnFilterName();
1105 + static String GetHtmlFilterName();
1106 static String GetWebQueryFilterName();
1107 static String GetAsciiFilterName();
1108 static String GetLotusFilterName();
1109 diff --git sc/source/ui/inc/langchooser.hrc sc/source/ui/inc/langchooser.hrc
1110 new file mode 100644
1111 index 0000000..eb981c1
1112 --- /dev/null
1113 +++ sc/source/ui/inc/langchooser.hrc
1114 @@ -0,0 +1,42 @@
1115 +/*************************************************************************
1117 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1118 + *
1119 + * Copyright 2008 by Sun Microsystems, Inc.
1121 + * OpenOffice.org - a multi-platform office productivity suite
1123 + * $RCSfile: retypepassdlg.src,v $
1124 + * $Revision: 1.1.2.3 $
1126 + * This file is part of OpenOffice.org.
1128 + * OpenOffice.org is free software: you can redistribute it and/or modify
1129 + * it under the terms of the GNU Lesser General Public License version 3
1130 + * only, as published by the Free Software Foundation.
1132 + * OpenOffice.org is distributed in the hope that it will be useful,
1133 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1134 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1135 + * GNU Lesser General Public License version 3 for more details
1136 + * (a copy is included in the LICENSE file that accompanied this code).
1138 + * You should have received a copy of the GNU Lesser General Public License
1139 + * version 3 along with OpenOffice.org. If not, see
1140 + * <http://www.openoffice.org/license.html>
1141 + * for a copy of the LGPLv3 License.
1143 + ************************************************************************/
1145 +#include <sc.hrc>
1147 +#define BTN_OK 1
1148 +#define BTN_CANCEL 2
1149 +#define BTN_HELP 3
1151 +#define FL_CHOOSE_LANG 4
1152 +#define RB_AUTOMATIC 5
1153 +#define RB_CUSTOM 6
1154 +#define LB_CUSTOM_LANG 7
1155 +#define FL_OPTION 8
1156 +#define BTN_CONVERT_DATE 9
1157 diff --git sc/source/ui/inc/langchooser.hxx sc/source/ui/inc/langchooser.hxx
1158 new file mode 100644
1159 index 0000000..7106ab2
1160 --- /dev/null
1161 +++ sc/source/ui/inc/langchooser.hxx
1162 @@ -0,0 +1,76 @@
1163 +/*************************************************************************
1165 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1166 + *
1167 + * Copyright 2008 by Sun Microsystems, Inc.
1169 + * OpenOffice.org - a multi-platform office productivity suite
1171 + * $RCSfile: langbox.hxx,v $
1172 + * $Revision: 1.4.242.1 $
1174 + * This file is part of OpenOffice.org.
1176 + * OpenOffice.org is free software: you can redistribute it and/or modify
1177 + * it under the terms of the GNU Lesser General Public License version 3
1178 + * only, as published by the Free Software Foundation.
1180 + * OpenOffice.org is distributed in the hope that it will be useful,
1181 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1182 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1183 + * GNU Lesser General Public License version 3 for more details
1184 + * (a copy is included in the LICENSE file that accompanied this code).
1186 + * You should have received a copy of the GNU Lesser General Public License
1187 + * version 3 along with OpenOffice.org. If not, see
1188 + * <http://www.openoffice.org/license.html>
1189 + * for a copy of the LGPLv3 License.
1191 + ************************************************************************/
1193 +#ifndef SC_UI_LANGCHOOSER_HXX
1194 +#define SC_UI_LANGCHOOSER_HXX
1196 +#include "vcl/dialog.hxx"
1197 +#include "vcl/button.hxx"
1198 +#include "vcl/fixed.hxx"
1199 +#include "i18npool/lang.h"
1200 +#include "svx/langbox.hxx"
1202 +class ScLangChooserDlg : public ModalDialog
1204 +public:
1205 + ScLangChooserDlg(Window* pParent);
1206 + virtual ~ScLangChooserDlg();
1208 + virtual short Execute();
1210 + LanguageType getLanguageType() const;
1211 + bool isDateConversionSet() const;
1213 +private:
1214 + void init();
1216 +private:
1217 + OKButton maBtnOk;
1218 + CancelButton maBtnCancel;
1219 + HelpButton maBtnHelp;
1221 + FixedLine maFlChooseLang;
1223 + RadioButton maRbAutomatic;
1224 + RadioButton maRbCustom;
1226 + SvxLanguageBox maLbCustomLang;
1228 + FixedLine maFlOption;
1230 + CheckBox maBtnConvertDate;
1232 + DECL_LINK( OKHdl, OKButton* );
1234 + DECL_LINK( RadioHdl, RadioButton* );
1238 +#endif
1239 diff --git sc/source/ui/unoobj/filtuno.cxx sc/source/ui/unoobj/filtuno.cxx
1240 index 81efc76..406255e 100644
1241 --- sc/source/ui/unoobj/filtuno.cxx
1242 +++ sc/source/ui/unoobj/filtuno.cxx
1243 @@ -51,7 +51,12 @@
1245 #include "sc.hrc" //CHINA001
1246 #include "scabstdlg.hxx" //CHINA001
1247 +#include "i18npool/lang.h"
1249 +#include <memory>
1251 using namespace ::com::sun::star;
1252 +using ::rtl::OUStringBuffer;
1254 //------------------------------------------------------------------------
1256 @@ -146,6 +151,10 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException)
1257 sal_Int16 nRet = ui::dialogs::ExecutableDialogResults::CANCEL;
1259 String aFilterString( aFilterName );
1261 + ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
1262 + DBG_ASSERT(pFact, "ScAbstractFactory create fail!");
1264 if ( !bExport && aFilterString == ScDocShell::GetAsciiFilterName() )
1266 // ascii import is special...
1267 @@ -164,8 +173,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException)
1268 pInStream = utl::UcbStreamHelper::CreateStream( xInputStream );
1270 //CHINA001 ScImportAsciiDlg* pDlg = new ScImportAsciiDlg( NULL, aPrivDatName, pInStream, cAsciiDel );
1271 - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
1272 - DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
1273 AbstractScImportAsciiDlg* pDlg = pFact->CreateScImportAsciiDlg( NULL, aPrivDatName, pInStream, RID_SCDLG_ASCII, cAsciiDel);
1274 DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
1275 if ( pDlg->Execute() == RET_OK )
1276 @@ -178,6 +185,24 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException)
1277 delete pDlg;
1278 delete pInStream;
1280 + else if ( aFilterString == ScDocShell::GetWebQueryFilterName() || aFilterString == ScDocShell::GetHtmlFilterName() )
1282 + // HTML import.
1283 + ::std::auto_ptr<AbstractScLangChooserDlg> pDlg(
1284 + pFact->CreateScLangChooserDlg(NULL, RID_SCDLG_LANG_CHOOSER));
1286 + if (pDlg->Execute() == RET_OK)
1288 + LanguageType eLang = pDlg->GetLanguageType();
1289 + OUStringBuffer aBuf;
1291 + aBuf.append(String::CreateFromInt32(static_cast<sal_Int32>(eLang)));
1292 + aBuf.append(sal_Unicode(' '));
1293 + aBuf.append(pDlg->IsDateConversionSet() ? sal_Unicode('1') : sal_Unicode('0'));
1294 + aFilterOptions = aBuf.makeStringAndClear();
1295 + nRet = ui::dialogs::ExecutableDialogResults::OK;
1298 else
1300 sal_Bool bMultiByte = sal_True;
1301 @@ -249,8 +274,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException)
1302 //CHINA001 &aOptions, &aTitle, bMultiByte, bDBEnc,
1303 //CHINA001 !bExport );
1304 //CHINA001
1305 - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
1306 - DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
1308 AbstractScImportOptionsDlg* pDlg = pFact->CreateScImportOptionsDlg( NULL, RID_SCDLG_IMPORTOPT,
1309 bAscii, &aOptions, &aTitle, bMultiByte, bDBEnc,
1310 diff --git sc/util/makefile.mk sc/util/makefile.mk
1311 index 855d560..0da917b 100644
1312 --- sc/util/makefile.mk
1313 +++ sc/util/makefile.mk
1314 @@ -281,6 +281,7 @@ LIB8OBJFILES = \
1315 $(SLO)$/dapidata.obj \
1316 $(SLO)$/crdlg.obj \
1317 $(SLO)$/scuiasciiopt.obj \
1318 + $(SLO)$/langchooser.obj \
1319 $(SLO)$/scuiautofmt.obj \
1320 $(SLO)$/dpgroupdlg.obj \
1321 $(SLO)$/editfield.obj