summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-04-30 16:45:54 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-04-30 17:25:42 +0200
commitf669f332733bf80b0a32022e1351957089958ce2 (patch)
tree1d509ba4d5e564398fad03d37bcc069c967cfef1 /sc
parent8ed628cf8b7c6f1bc6dae9eb94c9b702aa93c21b (diff)
tdf#125046: export longText attribute for sharedItems element
Change-Id: Id727f10763bc5017eeb3e267b425d6013786d6a2 Reviewed-on: https://gerrit.libreoffice.org/71585 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/71590 Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/xlsx/pivottable_long_text.xlsxbin0 -> 13038 bytes
-rw-r--r--sc/qa/unit/pivottable_filters_test.cxx18
-rw-r--r--sc/source/filter/excel/xepivotxml.cxx11
3 files changed, 29 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/pivottable_long_text.xlsx b/sc/qa/unit/data/xlsx/pivottable_long_text.xlsx
new file mode 100644
index 000000000000..f56db722e915
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/pivottable_long_text.xlsx
Binary files differ
diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx
index 3684497ca39a..100a8143facb 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -94,6 +94,7 @@ public:
void tesTtdf124772NumFmt();
void testTdf124810();
void testTdf124883();
+ void testTdf125046();
CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest);
@@ -142,6 +143,7 @@ public:
CPPUNIT_TEST(tesTtdf124772NumFmt);
CPPUNIT_TEST(testTdf124810);
CPPUNIT_TEST(testTdf124883);
+ CPPUNIT_TEST(testTdf125046);
CPPUNIT_TEST_SUITE_END();
@@ -2636,6 +2638,22 @@ void ScPivotTableFiltersTest::testTdf124883()
"Count of Value2");
}
+void ScPivotTableFiltersTest::testTdf125046()
+{
+ ScDocShellRef xDocSh = loadDoc("pivottable_long_text.", FORMAT_XLSX);
+ CPPUNIT_ASSERT(xDocSh.is());
+
+ std::shared_ptr<utl::TempFile> pXPathFile
+ = ScBootstrapFixture::exportTo(xDocSh.get(), FORMAT_XLSX);
+ xDocSh->DoClose();
+
+ xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory,
+ "xl/pivotCache/pivotCacheDefinition1.xml");
+ CPPUNIT_ASSERT(pDoc);
+ assertXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems",
+ "longText", "1");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx
index 332c2ff2d8e3..fb174ef849f9 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -363,6 +363,7 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr
double fMin = std::numeric_limits<double>::infinity(), fMax = -std::numeric_limits<double>::infinity();
bool isValueInteger = true;
bool isContainsDate = rCache.IsDateDimension(i);
+ bool isLongText = false;
double intpart;
for (; it != itEnd; ++it)
{
@@ -383,6 +384,10 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr
isValueInteger = false;
}
}
+ else if (eType == ScDPItemData::String && !isLongText)
+ {
+ isLongText = it->GetString().getLength() > 255;
+ }
}
auto aDPTypeEnd = aDPTypes.cend();
@@ -460,6 +465,12 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr
{
pAttList->add(XML_count, OString::number(static_cast<long>(rFieldItems.size())));
}
+
+ if (isLongText)
+ {
+ pAttList->add(XML_longText, ToPsz10(true));
+ }
+
sax_fastparser::XFastAttributeListRef xAttributeList(pAttList);
pDefStrm->startElement(XML_sharedItems, xAttributeList);