summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2021-08-31 16:04:51 +0200
committerEike Rathke <erack@redhat.com>2021-08-31 22:32:08 +0200
commitd5ade739771ddf06cc7ee6d4af15672bfcf09ed6 (patch)
treef73e83cafbcb4241e4312275cc012898dce28a9c /sc/source
parent4cfc303886bc9f863f755f8278561f9e57f9a5c5 (diff)
CSV/Paste: setting a text format is only necessary when using ScDocumentImport
For ScDocument::SetTextCell() it is forced anyway so was actually done twice, in the case of Paste and TextToColumns. Change-Id: I3144e2d316810c702c5ebd84698e8611674adace Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121381 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/docshell/impex.cxx32
1 files changed, 16 insertions, 16 deletions
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 577bcd1930c2..27221c581f4e 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1040,23 +1040,22 @@ static bool lcl_PutString(
const bool bForceFormulaText = (!bEvaluateFormulas && rStr[0] == '=');
if (nColFormat == SC_COL_TEXT || bForceFormulaText)
{
- double fDummy;
- sal_uInt32 nIndex = 0;
- if (bForceFormulaText || rDoc.GetFormatTable()->IsNumberFormat(rStr, nIndex, fDummy))
- {
- // Set the format of this cell to 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) );
- rDoc.ApplyPattern(nCol, nRow, nTab, aNewAttrs);
- }
if ( bUseDocImport )
{
- if(ScStringUtil::isMultiline(rStr))
+ double fDummy;
+ sal_uInt32 nIndex = 0;
+ if (bForceFormulaText || rDoc.GetFormatTable()->IsNumberFormat(rStr, nIndex, fDummy))
+ {
+ // Set the format of this cell to Text.
+ // This is only necessary for ScDocumentImport,
+ // ScDocument::SetTextCell() forces it by ScSetStringParam.
+ sal_uInt32 nFormat = rDoc.GetFormatTable()->GetStandardFormat(SvNumFormatType::TEXT);
+ ScPatternAttr aNewAttrs(rDoc.GetPool());
+ SfxItemSet& rSet = aNewAttrs.GetItemSet();
+ rSet.Put( SfxUInt32Item(ATTR_VALUE_FORMAT, nFormat) );
+ rDoc.ApplyPattern(nCol, nRow, nTab, aNewAttrs);
+ }
+ if (ScStringUtil::isMultiline(rStr))
{
ScFieldEditEngine& rEngine = rDoc.GetEditEngine();
rEngine.SetTextCurrentDefaults(rStr);
@@ -1068,7 +1067,8 @@ static bool lcl_PutString(
rDocImport.setStringCell(ScAddress(nCol, nRow, nTab), rStr);
return false;
}
- } else
+ }
+ else
{
rDoc.SetTextCell(ScAddress(nCol, nRow, nTab), rStr);
return bMultiLine;