[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sc/qa sc/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 19 10:40:21 UTC 2019


 sc/qa/unit/data/xlsx/pivottable_long_text.xlsx |binary
 sc/qa/unit/pivottable_filters_test.cxx         |   14 ++++++++++++++
 sc/source/filter/excel/xepivotxml.cxx          |   11 +++++++++++
 3 files changed, 25 insertions(+)

New commits:
commit 7f0813c2c352529bfafd544edb260048e8828f03
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue Apr 30 16:45:54 2019 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Jun 19 12:39:47 2019 +0200

    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 at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/74349
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>

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
Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_long_text.xlsx differ
diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx
index 5e886036aecb..5570d9b1fc52 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();
 
@@ -2621,6 +2623,18 @@ void ScPivotTableFiltersTest::testTdf124883()
                 "Count of Value2");
 }
 
+void ScPivotTableFiltersTest::testTdf125046()
+{
+    ScDocShellRef xDocSh = loadDoc("pivottable_long_text.", FORMAT_XLSX);
+    CPPUNIT_ASSERT(xDocSh.is());
+
+    xmlDocPtr pDoc = XPathHelper::parseExport2(
+        *this, *xDocSh, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml", FORMAT_XLSX);
+    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 e3b39e0dafe9..147658d8fafc 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;
         for (; it != itEnd; ++it)
         {
             ScDPItemData::Type eType = it->GetType();
@@ -382,6 +383,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();
@@ -459,6 +464,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);


More information about the Libreoffice-commits mailing list