diff options
author | Laurent Balland <laurent.balland@mailo.fr> | 2023-05-20 16:47:16 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2023-05-26 23:57:16 +0200 |
commit | 2b3b4026a5c6a1b92c0b29b94dd62a4c3c7b9fad (patch) | |
tree | 4365fbabe2ded26f94cc1456893b25587520ca11 /sc/source/ui/docshell | |
parent | 75cca3bdea8e929bdca590710dc3f44481a72ace (diff) |
tdf#154131 Add Detect scientific number option
Add a sub case of Detect special numbers for import CSV (SC_IMPORTFILE),
paste unformated text (SC_PASTETEXT) and text to columns
(SC_TEXTTOCOLUMNS). Following cases are treated:
- If "Detect special numbers" is true, then "Detect scientific numbers"
must be true and all special formats are treated (date, time,
scientific notation) in addition to basic decimal numbers.
- If "Detect special numbers" is false and "Detect scientific numbers" is
true only scientific notation is treated in addition to basic decimal
numbers.
- If "Detect special numbers" and "Detect scientific numbers" are both
false only basic decimal numbers are recognized as numbers. It is the
new case treated by this change
The new option bDetectScientificNumber is append to ASCII options
Change-Id: I73dff9f75d2c7b07ce155daa29dcc4ca9f288664
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152072
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 507508419a3d..c405fb2c45a3 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1067,7 +1067,7 @@ bool ScImportExport::Text2Doc( SvStream& rStrm ) static bool lcl_PutString( ScDocumentImport& rDocImport, bool bUseDocImport, SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rStr, sal_uInt8 nColFormat, - SvNumberFormatter* pFormatter, bool bDetectNumFormat, bool bEvaluateFormulas, bool bSkipEmptyCells, + SvNumberFormatter* pFormatter, bool bDetectNumFormat, bool bDetectSciNumFormat, bool bEvaluateFormulas, bool bSkipEmptyCells, const ::utl::TransliterationWrapper& rTransliteration, CalendarWrapper& rCalendar, const ::utl::TransliterationWrapper* pSecondTransliteration, CalendarWrapper* pSecondCalendar ) { @@ -1504,6 +1504,7 @@ static bool lcl_PutString( ScSetStringParam aParam; aParam.mpNumFormatter = pFormatter; aParam.mbDetectNumberFormat = bDetectNumFormat; + aParam.mbDetectScientificNumberFormat = bDetectSciNumFormat; aParam.meSetTextNumFormat = ScSetStringParam::SpecialNumberOnly; aParam.mbHandleApostrophe = false; aParam.mbCheckLinkFormula = true; @@ -1599,6 +1600,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) LanguageType eDocLang = pExtOptions->GetLanguage(); SvNumberFormatter aNumFormatter( comphelper::getProcessComponentContext(), eDocLang); bool bDetectNumFormat = pExtOptions->IsDetectSpecialNumber(); + bool bDetectSciNumFormat = pExtOptions->IsDetectScientificNumber(); bool bEvaluateFormulas = pExtOptions->IsEvaluateFormulas(); bool bSkipEmptyCells = pExtOptions->IsSkipEmptyCells(); @@ -1722,7 +1724,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) bMultiLine |= lcl_PutString( aDocImport, !mbOverwriting, nCol, nRow, nTab, aCell, nFmt, - &aNumFormatter, bDetectNumFormat, bEvaluateFormulas, bSkipEmptyCells, + &aNumFormatter, bDetectNumFormat, bDetectSciNumFormat, bEvaluateFormulas, bSkipEmptyCells, aTransliteration, aCalendar, pEnglishTransliteration.get(), pEnglishCalendar.get()); } @@ -1768,7 +1770,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) bMultiLine |= lcl_PutString( aDocImport, !mbOverwriting, nCol, nRow, nTab, aCell, nFmt, - &aNumFormatter, bDetectNumFormat, bEvaluateFormulas, bSkipEmptyCells, + &aNumFormatter, bDetectNumFormat, bDetectSciNumFormat, bEvaluateFormulas, bSkipEmptyCells, aTransliteration, aCalendar, pEnglishTransliteration.get(), pEnglishCalendar.get()); } |