Kaydet (Commit) 6952a3ba authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#125046: export longText attribute for sharedItems element

Change-Id: Id727f10763bc5017eeb3e267b425d6013786d6a2
Reviewed-on: https://gerrit.libreoffice.org/71585
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 1ae5ca07
......@@ -91,6 +91,7 @@ public:
void tesTtdf124772NumFmt();
void testTdf124810();
void testTdf124883();
void testTdf125046();
CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest);
......@@ -139,6 +140,7 @@ public:
CPPUNIT_TEST(tesTtdf124772NumFmt);
CPPUNIT_TEST(testTdf124810);
CPPUNIT_TEST(testTdf124883);
CPPUNIT_TEST(testTdf125046);
CPPUNIT_TEST_SUITE_END();
......@@ -2632,6 +2634,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();
......
......@@ -350,6 +350,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 (const auto& rFieldItem : rFieldItems)
{
ScDPItemData::Type eType = rFieldItem.GetType();
......@@ -369,6 +370,10 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr
isValueInteger = false;
}
}
else if (eType == ScDPItemData::String && !isLongText)
{
isLongText = rFieldItem.GetString().getLength() > 255;
}
}
auto pAttList = sax_fastparser::FastSerializerHelper::createAttrList();
......@@ -444,6 +449,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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment