[Libreoffice-commits] core.git: sc/source
Eike Rathke (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 31 14:00:22 UTC 2021
sc/source/ui/docshell/impex.cxx | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 8a45eac81686ccc06b7f028594770ad18ae66057
Author: Eike Rathke <erack at redhat.com>
AuthorDate: Tue Aug 31 12:15:49 2021 +0200
Commit: Eike Rathke <erack at redhat.com>
CommitDate: Tue Aug 31 15:59:47 2021 +0200
CSV: use target doc's formatter to determine and set forced text
If text is to be forced check if the string is a number in the
target doc's locale which then needs to be forced to text format,
not in the input parsing locale. Also set the text format of the
document's default locale, not the input locale's text format
(which may or may not match the document locale).
Question remains if this isn't duplicated work anyway because
setting text at cells forces text format if necessary if
ScSetStringParam is setup correctly. To be investigated if all
paths taken actually do that.
Change-Id: I3db3907cfe81156ccd1b0b523372dd97ee8598a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121366
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Jenkins
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index c5102cf483b9..577bcd1930c2 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1042,10 +1042,13 @@ static bool lcl_PutString(
{
double fDummy;
sal_uInt32 nIndex = 0;
- if (bForceFormulaText || pFormatter->IsNumberFormat(rStr, nIndex, fDummy))
+ if (bForceFormulaText || rDoc.GetFormatTable()->IsNumberFormat(rStr, nIndex, fDummy))
{
// Set the format of this cell to Text.
- sal_uInt32 nFormat = pFormatter->GetStandardFormat(SvNumFormatType::TEXT);
+ /* TODO: is this even necessary as ScSetStringParam should take
+ * care of it and we're doing this twice? Investigate all paths
+ * taken below. */
+ sal_uInt32 nFormat = rDoc.GetFormatTable()->GetStandardFormat(SvNumFormatType::TEXT);
ScPatternAttr aNewAttrs(rDoc.GetPool());
SfxItemSet& rSet = aNewAttrs.GetItemSet();
rSet.Put( SfxUInt32Item(ATTR_VALUE_FORMAT, nFormat) );
More information about the Libreoffice-commits
mailing list