[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Sep 6 15:53:26 UTC 2018


 sc/source/filter/xml/xmlimprt.cxx |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

New commits:
commit 68817986a428bafc433528c49d99df5b58c7204d
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Wed Sep 5 12:41:39 2018 +0200
Commit:     Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Thu Sep 6 17:53:02 2018 +0200

    Resolves: tdf#118850 disentangle the twisted wrong cell type vs format type
    
    Change-Id: Idb5267c9bc50e8844654c2f2cd0d123fcbb7aa12
    Reviewed-on: https://gerrit.libreoffice.org/60026
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit ede27cf598ed2aef41b9552b2c787ef8331400fc)
    Reviewed-on: https://gerrit.libreoffice.org/60033
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 86434cd10c0c..ca24d77523b5 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -1293,12 +1293,18 @@ void ScXMLImport::SetType(const uno::Reference <beans::XPropertySet>& rPropertie
         sal_Int32 nCurrentCellType(
             GetNumberFormatAttributesExportHelper()->GetCellType(
                 rNumberFormat, sCurrentCurrency, bIsStandard) & ~util::NumberFormat::DEFINED);
-        if ((nCellType != nCurrentCellType) && !((nCellType == util::NumberFormat::NUMBER &&
-            ((nCurrentCellType == util::NumberFormat::SCIENTIFIC) ||
-            (nCurrentCellType == util::NumberFormat::FRACTION) ||
-            (nCurrentCellType == util::NumberFormat::LOGICAL) ||
-            (nCurrentCellType == 0))) || (nCurrentCellType == util::NumberFormat::TEXT)) && !((nCellType == util::NumberFormat::DATETIME) &&
-            (nCurrentCellType == util::NumberFormat::DATE)))
+        // If the (numeric) cell type (number, currency, date, time, boolean)
+        // is different from the format type then for some combinations we may
+        // have to apply a format, e.g. in case the generator deduced format
+        // from type and did not apply a format but we don't keep a dedicated
+        // type internally. Specifically this is necessary if the cell type is
+        // not number but the format type is (i.e. General). Currency cells
+        // need extra attention, see calls of ScXMLImport::IsCurrencySymbol()
+        // and description within there and ScXMLImport::SetCurrencySymbol().
+        if ((nCellType != nCurrentCellType) &&
+                (nCellType != util::NumberFormat::NUMBER) &&
+                (nCellType != util::NumberFormat::TEXT) &&
+                (bIsStandard || (nCellType == util::NumberFormat::CURRENCY)))
         {
             if (!xNumberFormats.is())
             {


More information about the Libreoffice-commits mailing list