summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-09-10 09:07:02 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-09-10 09:23:44 +0200
commit09122a537318f7ada075820f3b1ef83a64e56751 (patch)
treee99fbf47aa0a86dc06d566469a955d86d4286e6c /sc/source
parent05a09030d1fbe449a619d380214e2601f94950b4 (diff)
tdf#112306: containsSemiMixedTypes is true for blanks-only
Also export containsNonDate Change-Id: I16283a272d51e6c305f8c381c359168c1e3848a8 Reviewed-on: https://gerrit.libreoffice.org/42130 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/filter/excel/xepivotxml.cxx27
1 files changed, 15 insertions, 12 deletions
diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx
index b72e24bf19c5..e416a2842a42 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -290,21 +290,20 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr
std::set<ScDPItemData::Type> aDPTypesWithoutBlank = aDPTypes;
aDPTypesWithoutBlank.erase(ScDPItemData::Empty);
- bool isContainsMoreThanOneType = aDPTypesWithoutBlank.size() > 1;
- // XML_containsMixedType possible values:
- // 1 - field contains more than one data type
- // 0 - (Default) only one data type. The field can still contain blank values (that's why we are using aDPTypesWithoutBlank)
- if (isContainsMoreThanOneType)
- pAttList->add(XML_containsMixedTypes, ToPsz10(true));
-
bool isContainsString = aDPTypesWithoutBlank.find(ScDPItemData::String) != aDPTypesWithoutBlank.end();
+ bool isContainsBlank = aDPTypes.find(ScDPItemData::Empty) != aDPTypeEnd;
+ bool isContainsNumber = !isContainsDate && aDPTypesWithoutBlank.find(ScDPItemData::Value) != aDPTypesWithoutBlank.end();
+ bool isContainsNonDate = !(isContainsDate && aDPTypesWithoutBlank.size() <= 1);
+
// XML_containsSemiMixedTypes possible values:
- // 1 - (Default) at least one text value, or can also contain a mix of other data types and blank values
+ // 1 - (Default) at least one text value, or can also contain a mix of other data types and blank values,
+ // or blank values only
// 0 - the field does not have a mix of text and other values
- if (!(isContainsString || (aDPTypes.size() > 1)))
+ if (!(isContainsString || (aDPTypes.size() > 1) || (isContainsBlank && aDPTypesWithoutBlank.size() == 0)))
pAttList->add(XML_containsSemiMixedTypes, ToPsz10(false));
- // OOXTODO: XML_containsNonDate
+ if (!isContainsNonDate)
+ pAttList->add(XML_containsNonDate, ToPsz10(false));
if (isContainsDate)
pAttList->add(XML_containsDate, ToPsz10(true));
@@ -313,16 +312,20 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr
if (!isContainsString)
pAttList->add(XML_containsString, ToPsz10(false));
- bool isContainsBlank = aDPTypes.find(ScDPItemData::Empty) != aDPTypeEnd;
if (isContainsBlank)
pAttList->add(XML_containsBlank, ToPsz10(true));
+ // XML_containsMixedType possible values:
+ // 1 - field contains more than one data type
+ // 0 - (Default) only one data type. The field can still contain blank values (that's why we are using aDPTypesWithoutBlank)
+ if (aDPTypesWithoutBlank.size() > 1)
+ pAttList->add(XML_containsMixedTypes, ToPsz10(true));
+
// If field contain mixed types (Date and Numbers), MS Excel is saving only "minDate" and "maxDate" and not "minValue" and "maxValue"
// Example how Excel is saving mixed Date and Numbers:
// <sharedItems containsSemiMixedTypes="0" containsDate="1" containsString="0" containsMixedTypes="1" minDate="1900-01-03T22:26:04" maxDate="1900-01-07T14:02:04" />
// Example how Excel is saving Dates only:
// <sharedItems containsSemiMixedTypes="0" containsNonDate="0" containsDate="1" containsString="0" minDate="1903-08-24T07:40:48" maxDate="2024-05-23T07:12:00"/>
- bool isContainsNumber = !isContainsDate && aDPTypesWithoutBlank.find(ScDPItemData::Value) != aDPTypesWithoutBlank.end();
if (isContainsNumber)
pAttList->add(XML_containsNumber, ToPsz10(true));