diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-11-19 17:31:36 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-11-19 20:38:33 +0100 |
commit | 099be392bfc5ddba21370726fa887a2fd6c99cd5 (patch) | |
tree | ace736adc8e3cfbcf9e825bc71639fd383b3dafb /sc | |
parent | 09622587088ee8a3d35abc17aab24b165d2eabfd (diff) |
Extended loplugin:ostr: sc
Change-Id: I44536a13f4c31558671c1166d06b7f6216456641
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159680
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sc')
29 files changed, 1310 insertions, 1147 deletions
diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx index 6e28d791fbb3..774f75078a85 100644 --- a/sc/qa/extras/htmlexporttest.cxx +++ b/sc/qa/extras/htmlexporttest.cxx @@ -38,16 +38,16 @@ public: htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT (pDoc); - assertXPath(pDoc, "/html/body", 1); - assertXPath(pDoc, "/html/body/table/tr/td/img", 1); + assertXPath(pDoc, "/html/body"_ostr, 1); + assertXPath(pDoc, "/html/body/table/tr/td/img"_ostr, 1); setFilterOptions("SkipImages"); save("HTML (StarCalc)"); pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT (pDoc); - assertXPath(pDoc, "/html/body", 1); - assertXPath(pDoc, "/html/body/table/tr/td/img", 0); + assertXPath(pDoc, "/html/body"_ostr, 1); + assertXPath(pDoc, "/html/body/table/tr/td/img"_ostr, 0); } void testTdf155244() @@ -58,10 +58,10 @@ public: xmlDocUniquePtr pXmlDoc = parseXml(maTempFile); CPPUNIT_ASSERT(pXmlDoc); - assertXPath(pXmlDoc, "/xhtml:html", 1); + assertXPath(pXmlDoc, "/xhtml:html"_ostr, 1); // the problem was that there were 2 CSS styles named "Default" - assertXPath(pXmlDoc, "/xhtml:html/xhtml:body/xhtml:table/xhtml:tr/xhtml:td", "class", "cell-Default"); - OUString const styles = getXPathContent(pXmlDoc, "/xhtml:html/xhtml:head/xhtml:style"); + assertXPath(pXmlDoc, "/xhtml:html/xhtml:body/xhtml:table/xhtml:tr/xhtml:td"_ostr, "class"_ostr, "cell-Default"); + OUString const styles = getXPathContent(pXmlDoc, "/xhtml:html/xhtml:head/xhtml:style"_ostr); CPPUNIT_ASSERT(styles.indexOf(".graphic-Default{ background-color:#729fcf;") != -1); CPPUNIT_ASSERT(styles.indexOf(".cell-Default{ font-size:10pt; font-family:'Liberation Sans'; }") != -1); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), styles.indexOf(".Default")); diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index f1602465f7d2..c483a05c9300 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -167,13 +167,13 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testMacroButtonFormControlXlsxExport) // Without the fix in place, this test would have failed with: // - XPath '//x:controlPr' no attribute 'macro' exist // i.e. the macro was lost on export. - assertXPath(pSheetDoc, "//x:controlPr", "macro", "Module1.Button1_Click"); + assertXPath(pSheetDoc, "//x:controlPr"_ostr, "macro"_ostr, "Module1.Button1_Click"); // Then also make sure that there is no defined name for the macro, which is only needed for // XLS: xmlDocUniquePtr pWorkbookDoc = parseExport("xl/workbook.xml"); CPPUNIT_ASSERT(pWorkbookDoc); - assertXPath(pWorkbookDoc, "//x:workbook/definedNames", 0); + assertXPath(pWorkbookDoc, "//x:workbook/definedNames"_ostr, 0); } CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf104902) @@ -255,14 +255,14 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf89920) assertXPathContent(pContentXml, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" - "table:table-row[1]/table:table-cell[1]/text:p[1]", + "table:table-row[1]/table:table-cell[1]/text:p[1]"_ostr, "aa bb"); // Without the fix in place, this test would have failed here with // - Expression: xmlXPathNodeSetGetLength(pXmlNodes) > 0 assertXPathContent(pContentXml, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" - "table:table-row[1]/table:table-cell[1]/text:p[2]", + "table:table-row[1]/table:table-cell[1]/text:p[2]"_ostr, "cc dd"); } diff --git a/sc/qa/unit/SparklineImportExportTest.cxx b/sc/qa/unit/SparklineImportExportTest.cxx index 7b7d37b6f242..63f7867bc7fc 100644 --- a/sc/qa/unit/SparklineImportExportTest.cxx +++ b/sc/qa/unit/SparklineImportExportTest.cxx @@ -51,7 +51,7 @@ void checkSparklines(ScDocument& rDocument) { auto pSparkline = rDocument.GetSparkline(ScAddress(0, 1, 0)); // A2 CPPUNIT_ASSERT(pSparkline); - CPPUNIT_ASSERT_EQUAL(OString("{1C5C5DE0-3C09-4CB3-A3EC-9E763301EC82}"), + CPPUNIT_ASSERT_EQUAL("{1C5C5DE0-3C09-4CB3-A3EC-9E763301EC82}"_ostr, pSparkline->getSparklineGroup()->getID().getString()); auto& rAttributes = pSparkline->getSparklineGroup()->getAttributes(); @@ -170,42 +170,45 @@ void SparklineImportExportTest::testSparklinesExportODS() xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); // We have 3 sparkline groups = 3 tables that contain sparklines - assertXPath(pXmlDoc, "//table:table/calcext:sparkline-groups", 3); + assertXPath(pXmlDoc, "//table:table/calcext:sparkline-groups"_ostr, 3); // Check the number of sparkline groups in table[1] - assertXPath(pXmlDoc, "//table:table[1]/calcext:sparkline-groups/calcext:sparkline-group", 2); + assertXPath(pXmlDoc, "//table:table[1]/calcext:sparkline-groups/calcext:sparkline-group"_ostr, + 2); // Check the number of sparkline groups in table[2] - assertXPath(pXmlDoc, "//table:table[2]/calcext:sparkline-groups/calcext:sparkline-group", 2); + assertXPath(pXmlDoc, "//table:table[2]/calcext:sparkline-groups/calcext:sparkline-group"_ostr, + 2); // Check the number of sparkline groups in table[3] - assertXPath(pXmlDoc, "//table:table[3]/calcext:sparkline-groups/calcext:sparkline-group", 3); + assertXPath(pXmlDoc, "//table:table[3]/calcext:sparkline-groups/calcext:sparkline-group"_ostr, + 3); // Check table[1] - sparkline-group[1] OString aSparklineGroupPath - = "//table:table[1]/calcext:sparkline-groups/calcext:sparkline-group[1]"; - assertXPath(pXmlDoc, aSparklineGroupPath, "type", "line"); - assertXPath(pXmlDoc, aSparklineGroupPath, "line-width", "1pt"); - assertXPath(pXmlDoc, aSparklineGroupPath, "display-empty-cells-as", "gap"); - assertXPath(pXmlDoc, aSparklineGroupPath, "markers", "true"); - assertXPath(pXmlDoc, aSparklineGroupPath, "high", "true"); - assertXPath(pXmlDoc, aSparklineGroupPath, "low", "true"); - assertXPath(pXmlDoc, aSparklineGroupPath, "first", "true"); - assertXPath(pXmlDoc, aSparklineGroupPath, "last", "true"); - assertXPath(pXmlDoc, aSparklineGroupPath, "negative", "true"); - assertXPath(pXmlDoc, aSparklineGroupPath, "display-x-axis", "true"); - assertXPath(pXmlDoc, aSparklineGroupPath, "min-axis-type", "individual"); - assertXPath(pXmlDoc, aSparklineGroupPath, "max-axis-type", "individual"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-series", "#376092"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-negative", "#00b050"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-axis", "#000000"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-markers", "#000000"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-first", "#7030a0"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-last", "#ff0000"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-high", "#92d050"); - assertXPath(pXmlDoc, aSparklineGroupPath, "color-low", "#00b0f0"); + = "//table:table[1]/calcext:sparkline-groups/calcext:sparkline-group[1]"_ostr; + assertXPath(pXmlDoc, aSparklineGroupPath, "type"_ostr, "line"); + assertXPath(pXmlDoc, aSparklineGroupPath, "line-width"_ostr, "1pt"); + assertXPath(pXmlDoc, aSparklineGroupPath, "display-empty-cells-as"_ostr, "gap"); + assertXPath(pXmlDoc, aSparklineGroupPath, "markers"_ostr, "true"); + assertXPath(pXmlDoc, aSparklineGroupPath, "high"_ostr, "true"); + assertXPath(pXmlDoc, aSparklineGroupPath, "low"_ostr, "true"); + assertXPath(pXmlDoc, aSparklineGroupPath, "first"_ostr, "true"); + assertXPath(pXmlDoc, aSparklineGroupPath, "last"_ostr, "true"); + assertXPath(pXmlDoc, aSparklineGroupPath, "negative"_ostr, "true"); + assertXPath(pXmlDoc, aSparklineGroupPath, "display-x-axis"_ostr, "true"); + assertXPath(pXmlDoc, aSparklineGroupPath, "min-axis-type"_ostr, "individual"); + assertXPath(pXmlDoc, aSparklineGroupPath, "max-axis-type"_ostr, "individual"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-series"_ostr, "#376092"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-negative"_ostr, "#00b050"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-axis"_ostr, "#000000"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-markers"_ostr, "#000000"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-first"_ostr, "#7030a0"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-last"_ostr, "#ff0000"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-high"_ostr, "#92d050"); + assertXPath(pXmlDoc, aSparklineGroupPath, "color-low"_ostr, "#00b0f0"); assertXPath(pXmlDoc, aSparklineGroupPath + "/calcext:sparklines/calcext:sparkline", 1); assertXPath(pXmlDoc, aSparklineGroupPath + "/calcext:sparklines/calcext:sparkline[1]", - "cell-address", "Sheet1.A2"); + "cell-address"_ostr, "Sheet1.A2"); } void SparklineImportExportTest::testSparklinesRoundtripODS() @@ -236,10 +239,10 @@ void SparklineImportExportTest::testNoSparklinesInDocumentXLSX() xmlDocUniquePtr pXmlDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pXmlDoc); - assertXPath(pXmlDoc, "/x:worksheet", 1); - assertXPath(pXmlDoc, "/x:worksheet/x:extLst/x:ext/x14:sparklineGroups", 0); - assertXPath(pXmlDoc, "/x:worksheet/x:extLst/x:ext", 0); - assertXPath(pXmlDoc, "/x:worksheet/x:extLst", 0); + assertXPath(pXmlDoc, "/x:worksheet"_ostr, 1); + assertXPath(pXmlDoc, "/x:worksheet/x:extLst/x:ext/x14:sparklineGroups"_ostr, 0); + assertXPath(pXmlDoc, "/x:worksheet/x:extLst/x:ext"_ostr, 0); + assertXPath(pXmlDoc, "/x:worksheet/x:extLst"_ostr, 0); } namespace @@ -248,7 +251,7 @@ void checkSparklineThemeColors(ScDocument& rDocument) { auto pSparkline = rDocument.GetSparkline(ScAddress(0, 1, 0)); // A2 CPPUNIT_ASSERT(pSparkline); - CPPUNIT_ASSERT_EQUAL(OString("{1C5C5DE0-3C09-4CB3-A3EC-9E763301EC82}"), + CPPUNIT_ASSERT_EQUAL("{1C5C5DE0-3C09-4CB3-A3EC-9E763301EC82}"_ostr, pSparkline->getSparklineGroup()->getID().getString()); auto& rAttributes = pSparkline->getSparklineGroup()->getAttributes(); diff --git a/sc/qa/unit/ThemeImportExportTest.cxx b/sc/qa/unit/ThemeImportExportTest.cxx index ec33c2a1afe3..d8c7c468c368 100644 --- a/sc/qa/unit/ThemeImportExportTest.cxx +++ b/sc/qa/unit/ThemeImportExportTest.cxx @@ -86,12 +86,12 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testThemeExportAndImport) assertXPath(pXmlDoc, sThemeColorsPath + "[@loext:name='MyColorSet']"); const OString sThemeColorPath = sThemeColorsPath + "/loext:color"; assertXPath(pXmlDoc, sThemeColorPath, 12); - assertXPath(pXmlDoc, sThemeColorPath + "[3]", "name", "dark2"); - assertXPath(pXmlDoc, sThemeColorPath + "[3]", "color", "#333333"); - assertXPath(pXmlDoc, sThemeColorPath + "[9]", "name", "accent5"); - assertXPath(pXmlDoc, sThemeColorPath + "[9]", "color", "#999999"); - assertXPath(pXmlDoc, sThemeColorPath + "[12]", "name", "followed-hyperlink"); - assertXPath(pXmlDoc, sThemeColorPath + "[12]", "color", "#cccccc"); + assertXPath(pXmlDoc, sThemeColorPath + "[3]", "name"_ostr, "dark2"); + assertXPath(pXmlDoc, sThemeColorPath + "[3]", "color"_ostr, "#333333"); + assertXPath(pXmlDoc, sThemeColorPath + "[9]", "name"_ostr, "accent5"); + assertXPath(pXmlDoc, sThemeColorPath + "[9]", "color"_ostr, "#999999"); + assertXPath(pXmlDoc, sThemeColorPath + "[12]", "name"_ostr, "followed-hyperlink"); + assertXPath(pXmlDoc, sThemeColorPath + "[12]", "color"_ostr, "#cccccc"); } // Check the theme after import/export cycle @@ -119,42 +119,42 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testThemeExportOOXML) { xmlDocUniquePtr pXmlDoc = parseExport("xl/theme/theme1.xml"); - OString aClrScheme = "/a:theme/a:themeElements/a:clrScheme"; - assertXPath(pXmlDoc, aClrScheme, "name", "Office"); - assertXPath(pXmlDoc, aClrScheme + "/a:dk1/a:srgbClr", "val", "000000"); - assertXPath(pXmlDoc, aClrScheme + "/a:lt1/a:srgbClr", "val", "ffffff"); - assertXPath(pXmlDoc, aClrScheme + "/a:dk2/a:srgbClr", "val", "44546a"); - assertXPath(pXmlDoc, aClrScheme + "/a:lt2/a:srgbClr", "val", "e7e6e6"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent1/a:srgbClr", "val", "4472c4"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent2/a:srgbClr", "val", "ed7d31"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent3/a:srgbClr", "val", "a5a5a5"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent4/a:srgbClr", "val", "ffc000"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent5/a:srgbClr", "val", "5b9bd5"); - assertXPath(pXmlDoc, aClrScheme + "/a:accent6/a:srgbClr", "val", "70ad47"); - assertXPath(pXmlDoc, aClrScheme + "/a:hlink/a:srgbClr", "val", "0563c1"); - assertXPath(pXmlDoc, aClrScheme + "/a:folHlink/a:srgbClr", "val", "954f72"); + OString aClrScheme = "/a:theme/a:themeElements/a:clrScheme"_ostr; + assertXPath(pXmlDoc, aClrScheme, "name"_ostr, "Office"); + assertXPath(pXmlDoc, aClrScheme + "/a:dk1/a:srgbClr", "val"_ostr, "000000"); + assertXPath(pXmlDoc, aClrScheme + "/a:lt1/a:srgbClr", "val"_ostr, "ffffff"); + assertXPath(pXmlDoc, aClrScheme + "/a:dk2/a:srgbClr", "val"_ostr, "44546a"); + assertXPath(pXmlDoc, aClrScheme + "/a:lt2/a:srgbClr", "val"_ostr, "e7e6e6"); + assertXPath(pXmlDoc, aClrScheme + "/a:accent1/a:srgbClr", "val"_ostr, "4472c4"); + assertXPath(pXmlDoc, aClrScheme + "/a:accent2/a:srgbClr", "val"_ostr, "ed7d31"); + assertXPath(pXmlDoc, aClrScheme + "/a:accent3/a:srgbClr", "val"_ostr, "a5a5a5"); + assertXPath(pXmlDoc, aClrScheme + "/a:accent4/a:srgbClr", "val"_ostr, "ffc000"); + assertXPath(pXmlDoc, aClrScheme + "/a:accent5/a:srgbClr", "val"_ostr, "5b9bd5"); + assertXPath(pXmlDoc, aClrScheme + "/a:accent6/a:srgbClr", "val"_ostr, "70ad47"); + assertXPath(pXmlDoc, aClrScheme + "/a:hlink/a:srgbClr", "val"_ostr, "0563c1"); + assertXPath(pXmlDoc, aClrScheme + "/a:folHlink/a:srgbClr", "val"_ostr, "954f72"); } { xmlDocUniquePtr pXmlDoc = parseExport("xl/styles.xml"); - assertXPath(pXmlDoc, "/x:styleSheet", 1); + assertXPath(pXmlDoc, "/x:styleSheet"_ostr, 1); // Fonts - OString aFont = "/x:styleSheet/x:fonts/x:font"; + OString aFont = "/x:styleSheet/x:fonts/x:font"_ostr; assertXPath(pXmlDoc, aFont, 6); - assertXPath(pXmlDoc, aFont + "[5]/x:color", "theme", "7"); - assertXPath(pXmlDoc, aFont + "[6]/x:color", "rgb", "FF9C5700"); + assertXPath(pXmlDoc, aFont + "[5]/x:color", "theme"_ostr, "7"); + assertXPath(pXmlDoc, aFont + "[6]/x:color", "rgb"_ostr, "FF9C5700"); // Fills - OString aFill = "/x:styleSheet/x:fills/x:fill"; + OString aFill = "/x:styleSheet/x:fills/x:fill"_ostr; assertXPath(pXmlDoc, aFill, 4); - assertXPath(pXmlDoc, aFill + "[1]/x:patternFill", "patternType", "none"); - assertXPath(pXmlDoc, aFill + "[2]/x:patternFill", "patternType", "gray125"); - assertXPath(pXmlDoc, aFill + "[3]/x:patternFill", "patternType", "solid"); - assertXPath(pXmlDoc, aFill + "[3]/x:patternFill/x:fgColor", "rgb", "FFFFEB9C"); - assertXPath(pXmlDoc, aFill + "[4]/x:patternFill", "patternType", "solid"); - assertXPath(pXmlDoc, aFill + "[4]/x:patternFill/x:fgColor", "theme", "4"); + assertXPath(pXmlDoc, aFill + "[1]/x:patternFill", "patternType"_ostr, "none"); + assertXPath(pXmlDoc, aFill + "[2]/x:patternFill", "patternType"_ostr, "gray125"); + assertXPath(pXmlDoc, aFill + "[3]/x:patternFill", "patternType"_ostr, "solid"); + assertXPath(pXmlDoc, aFill + "[3]/x:patternFill/x:fgColor", "rgb"_ostr, "FFFFEB9C"); + assertXPath(pXmlDoc, aFill + "[4]/x:patternFill", "patternType"_ostr, "solid"); + assertXPath(pXmlDoc, aFill + "[4]/x:patternFill/x:fgColor", "theme"_ostr, "4"); } } diff --git a/sc/qa/unit/dataproviders_test.cxx b/sc/qa/unit/dataproviders_test.cxx index d4d0a9f8f60c..5b1aa76b95ed 100644 --- a/sc/qa/unit/dataproviders_test.cxx +++ b/sc/qa/unit/dataproviders_test.cxx @@ -158,9 +158,9 @@ void ScDataProvidersTest::testXMLImport() ScOrcusImportXMLParam::RangeLink aRangeLink; aRangeLink.maPos = ScAddress(0, 0, 0); - aRangeLink.maFieldPaths.push_back("/bookstore/book/title"); - aRangeLink.maFieldPaths.push_back("/bookstore/book/author"); - aRangeLink.maRowGroups.push_back("/bookstore/book"); + aRangeLink.maFieldPaths.push_back("/bookstore/book/title"_ostr); + aRangeLink.maFieldPaths.push_back("/bookstore/book/author"_ostr); + aRangeLink.maRowGroups.push_back("/bookstore/book"_ostr); aParam.maRangeLinks.push_back(aRangeLink); OUString aFileURL = createFileURL(u"xml/test1.xml"); diff --git a/sc/qa/unit/jumbosheets-test.cxx b/sc/qa/unit/jumbosheets-test.cxx index 468b479deb3d..e3bba0717a86 100644 --- a/sc/qa/unit/jumbosheets-test.cxx +++ b/sc/qa/unit/jumbosheets-test.cxx @@ -139,12 +139,12 @@ void ScJumboSheetsTest::testRoundtripColumnRangeOds() CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table/" - "table:table-row[1]/table:table-cell[1]", - "formula", "of:=SUM([.2:.2])"); + "table:table-row[1]/table:table-cell[1]"_ostr, + "formula"_ostr, "of:=SUM([.2:.2])"); assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table/" - "table:table-row[1]/table:table-cell[2]", - "formula", "of:=SUM([.C:.C])"); + "table:table-row[1]/table:table-cell[2]"_ostr, + "formula"_ostr, "of:=SUM([.C:.C])"); } } @@ -161,8 +161,10 @@ void ScJumboSheetsTest::testRoundtripColumnRangeXlsx() CPPUNIT_ASSERT_EQUAL(OUString("=SUM(C:C)"), pDoc->GetFormula(1, 0, 0)); xmlDocUniquePtr pXmlDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pXmlDoc); - assertXPathContent(pXmlDoc, "/x:worksheet/x:sheetData/x:row[1]/x:c[1]/x:f", "SUM(2:2)"); - assertXPathContent(pXmlDoc, "/x:worksheet/x:sheetData/x:row[1]/x:c[2]/x:f", "SUM(C:C)"); + assertXPathContent(pXmlDoc, "/x:worksheet/x:sheetData/x:row[1]/x:c[1]/x:f"_ostr, + "SUM(2:2)"); + assertXPathContent(pXmlDoc, "/x:worksheet/x:sheetData/x:row[1]/x:c[2]/x:f"_ostr, + "SUM(C:C)"); } } diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index c89380f1aebf..8d6b1ad5d39e 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -579,11 +579,13 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableExportXLSX) xmlDocUniquePtr pTable = parseExport("xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items", "count", - "4"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items/x:item", 4); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items/x:item[3]", - "h", "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items"_ostr, + "count"_ostr, "4"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items/x:item"_ostr, + 4); + assertXPath(pTable, + "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items/x:item[3]"_ostr, + "h"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableExportXLSXSingleDataField) @@ -594,15 +596,15 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableExportXLSXSingleData xmlDocUniquePtr pTable = parseExport("xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "ref", "A3:B6"); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstDataRow", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstDataCol", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields", "count", "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "ref"_ostr, "A3:B6"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstHeaderRow"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstDataRow"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstDataCol"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields"_ostr, "count"_ostr, "1"); // There should not be any colFields tag, before the fix there used to be a singleton with // <field x="-2"/> as child node. - assertXPath(pTable, "/x:pivotTableDefinition/x:colFields", 0); + assertXPath(pTable, "/x:pivotTableDefinition/x:colFields"_ostr, 0); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableExportXLSXMultipleDataFields) @@ -613,19 +615,19 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableExportXLSXMultipleDa xmlDocUniquePtr pTable = parseExport("xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "ref", "A1:C6"); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstDataRow", "2"); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstDataCol", "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "ref"_ostr, "A1:C6"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstHeaderRow"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstDataRow"_ostr, "2"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstDataCol"_ostr, "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields", "count", "2"); + assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields"_ostr, "count"_ostr, "2"); // There should be a single colFields tag with sole child node // <field x="-2"/>. - assertXPath(pTable, "/x:pivotTableDefinition/x:colFields", 1); - assertXPath(pTable, "/x:pivotTableDefinition/x:colFields", "count", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:colFields/x:field", 1); - assertXPath(pTable, "/x:pivotTableDefinition/x:colFields/x:field", "x", "-2"); + assertXPath(pTable, "/x:pivotTableDefinition/x:colFields"_ostr, 1); + assertXPath(pTable, "/x:pivotTableDefinition/x:colFields"_ostr, "count"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:colFields/x:field"_ostr, 1); + assertXPath(pTable, "/x:pivotTableDefinition/x:colFields/x:field"_ostr, "x"_ostr, "-2"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotCacheExportXLSX) @@ -643,235 +645,267 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotCacheExportXLSX) xmlDocUniquePtr pCacheDef = parseExport("xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pCacheDef); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField", 6); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField"_ostr, 6); // Four strings and one empty field - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]", "name", - "mixed strings and empty"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsBlank", "1"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsMixedTypes"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsSemiMixedTypes"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsNonDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsString"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "minDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "maxDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsNumber"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsInteger"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "minValue"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "maxValue"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "count", "5"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]"_ostr, + "name"_ostr, "mixed strings and empty"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsBlank"_ostr, "1"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsSemiMixedTypes"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsNonDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsString"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "minDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "maxDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsNumber"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsInteger"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "minValue"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "maxValue"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "count"_ostr, "5"); // Two integers and one empty field - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]", "name", - "mixed empty fields and integers"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsBlank", "1"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsMixedTypes"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsSemiMixedTypes"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsNonDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsDate"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsString", "0"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "minDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "maxDate"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsNumber", "1"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "containsInteger", "1"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "minValue", "111"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "maxValue", "222"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]"_ostr, + "name"_ostr, "mixed empty fields and integers"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsBlank"_ostr, "1"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsSemiMixedTypes"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsNonDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsDate"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsString"_ostr, "0"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "minDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "maxDate"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsNumber"_ostr, "1"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "containsInteger"_ostr, "1"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "minValue"_ostr, "111"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "maxValue"_ostr, "222"); // We list items on round-trip, Excel not, but Excel accepts that; We need list all items, because we are using it as reference in pivotCacheRecords1.xml - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "count", "3"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "count"_ostr, "3"); // Five integers - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]", "name", - "all fields are integers"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsBlank"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsMixedTypes"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsSemiMixedTypes", "0"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsNonDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsDate"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsString", "0"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "minDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "maxDate"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsNumber", "1"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "containsInteger", "1"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "minValue", "1111"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "maxValue", "5555"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]"_ostr, + "name"_ostr, "all fields are integers"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsBlank"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsSemiMixedTypes"_ostr, "0"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsNonDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsDate"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsString"_ostr, "0"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "minDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "maxDate"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsNumber"_ostr, "1"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "containsInteger"_ostr, "1"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "minValue"_ostr, "1111"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "maxValue"_ostr, "5555"); // We list items on round-trip, Excel not, but Excel accepts that; We need list all items, because we are using it as reference in pivotCacheRecords1.xml - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems", - "count", "5"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]/x:sharedItems"_ostr, + "count"_ostr, "5"); // Three integers and one string - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]", "name", - "mixed strings and integers"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsBlank"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsMixedTypes", "1"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsSemiMixedTypes"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsNonDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsString"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "minDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "maxDate"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsNumber", "1"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "containsInteger", "1"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "minValue", "1234"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "maxValue", "5678"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]"_ostr, + "name"_ostr, "mixed strings and integers"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsBlank"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr, "1"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsSemiMixedTypes"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsNonDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsString"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "minDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "maxDate"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsNumber"_ostr, "1"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "containsInteger"_ostr, "1"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "minValue"_ostr, "1234"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "maxValue"_ostr, "5678"); // We list items on round-trip, Excel not, but Excel accepts that; We need list all items, because we are using it as reference in pivotCacheRecords1.xml - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems", - "count", "4"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]/x:sharedItems"_ostr, + "count"_ostr, "4"); // Four dates without blanks - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]", "name", - "date and time with duplicated entries"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsBlank"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsMixedTypes"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsSemiMixedTypes", "0"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsNonDate", "0"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsDate", "1"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsString", "0"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "minDate", "1899-12-31T00:00:00"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "maxDate", "2009-07-06T10:53:02"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsNumber"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "containsInteger"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "minValue"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "maxValue"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]"_ostr, + "name"_ostr, "date and time with duplicated entries"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsBlank"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsSemiMixedTypes"_ostr, "0"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsNonDate"_ostr, "0"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsDate"_ostr, "1"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsString"_ostr, "0"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "minDate"_ostr, "1899-12-31T00:00:00"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "maxDate"_ostr, "2009-07-06T10:53:02"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsNumber"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "containsInteger"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "minValue"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "maxValue"_ostr); // We list items on round-trip, Excel not, but Excel accepts that; We need list all items, because we are using it as reference in pivotCacheRecords1.xml - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems", - "count", "4"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]/x:sharedItems"_ostr, + "count"_ostr, "4"); // Only blanks - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]", "name", - "blank"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "containsBlank", "1"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "containsMixedTypes"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]"_ostr, + "name"_ostr, "blank"); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "containsBlank"_ostr, "1"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr); // Despite what documentation says, in case there's only blank values in field (no strings), containsSemiMixedTypes is true (default - not written) - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "containsSemiMixedTypes"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "containsDate"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "containsString", "0"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "minDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "maxDate"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "containsNumber"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "containsInteger"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "minValue"); - assertXPathNoAttribute(pCacheDef, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "maxValue"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems", - "count", "1"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "containsSemiMixedTypes"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "containsDate"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "containsString"_ostr, "0"); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "minDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "maxDate"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "containsNumber"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "containsInteger"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "minValue"_ostr); + assertXPathNoAttribute( + pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "maxValue"_ostr); + assertXPath(pCacheDef, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]/x:sharedItems"_ostr, + "count"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableXLSX) @@ -1729,15 +1763,15 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableFirstHeaderRowXLSX) save("Calc Office Open XML"); xmlDocUniquePtr pTable = parseExport("xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstHeaderRow"_ostr, "1"); pTable = parseExport("xl/pivotTables/pivotTable2.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstHeaderRow"_ostr, "1"); pTable = parseExport("xl/pivotTables/pivotTable3.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:location"_ostr, "firstHeaderRow"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableDoubleFieldFilterXLSX) @@ -2160,11 +2194,12 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableOutlineModeXLSX) CPPUNIT_ASSERT(pTable); // Next to the outline flags, compact flags also should be set (true is the default) - assertXPath(pTable, "/x:pivotTableDefinition", "outline", "1"); - assertXPath(pTable, "/x:pivotTableDefinition", "outlineData", "1"); - assertXPath(pTable, "/x:pivotTableDefinition", "compact", "0"); - assertXPath(pTable, "/x:pivotTableDefinition", "compactData", "0"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]", "compact", "0"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "outline"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "outlineData"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "compact"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "compactData"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]"_ostr, + "compact"_ostr, "0"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableDuplicatedMemberFilterXLSX) @@ -2176,10 +2211,10 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableDuplicatedMemberFilt CPPUNIT_ASSERT(pTable); // Check whether page field has the right number of items - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[5]", "axis", + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[5]"_ostr, "axis"_ostr, "axisPage"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[5]/x:items", "count", - "21"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[5]/x:items"_ostr, + "count"_ostr, "21"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableTabularModeXLSX) @@ -2191,12 +2226,14 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableTabularModeXLSX) CPPUNIT_ASSERT(pTable); // In tabular mode both outline and compact flag should be false - assertXPath(pTable, "/x:pivotTableDefinition", "outline", "0"); - assertXPath(pTable, "/x:pivotTableDefinition", "outlineData", "0"); - assertXPath(pTable, "/x:pivotTableDefinition", "compact", "0"); - assertXPath(pTable, "/x:pivotTableDefinition", "compactData", "0"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]", "compact", "0"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]", "outline", "0"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "outline"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "outlineData"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "compact"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition"_ostr, "compactData"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]"_ostr, + "compact"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]"_ostr, + "outline"_ostr, "0"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableDuplicateFields) @@ -2207,17 +2244,19 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableDuplicateFields) xmlDocUniquePtr pCacheDef = parseExport("xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pCacheDef); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields", "count", "6"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]", "name", "ID"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]", "name", "Name"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]", "name", - "Score"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]", "name", - "Method"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]", "name", - "method2"); - assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]", "name", - "Method3"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields"_ostr, "count"_ostr, "6"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]"_ostr, + "name"_ostr, "ID"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]"_ostr, + "name"_ostr, "Name"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]"_ostr, + "name"_ostr, "Score"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]"_ostr, + "name"_ostr, "Method"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]"_ostr, + "name"_ostr, "method2"); + assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]"_ostr, + "name"_ostr, "Method3"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf112106) @@ -2255,8 +2294,9 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf123923) xmlDocUniquePtr pTable = parseExport("xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems/x:e", - "v", "#REF!"); + assertXPath(pTable, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems/x:e"_ostr, + "v"_ostr, "#REF!"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf123939) @@ -2269,17 +2309,17 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf123939) xmlDocUniquePtr pTable = parseExport("xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pTable); - assertXPathNoAttribute(pTable, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsMixedTypes"); + assertXPathNoAttribute( + pTable, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr); // But we must emit containsMixedTypes="1" for a mix of errors and non-string types! pTable = parseExport("xl/pivotCache/pivotCacheDefinition2.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", - "containsMixedTypes", "1"); + assertXPath(pTable, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems"_ostr, + "containsMixedTypes"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124651) @@ -2292,7 +2332,8 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124651) // We have to export name attribute, even though it's optional according to ECMA-376 standard, // because Excel (at least 2016) seems to require it. // tdf#124881: this shouldn't be an empty string - assertXPath(pDoc, "/x:pivotTableDefinition/x:dataFields/x:dataField", "name", "Sum - num"); + assertXPath(pDoc, "/x:pivotTableDefinition/x:dataFields/x:dataField"_ostr, "name"_ostr, + "Sum - num"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124736) @@ -2304,33 +2345,34 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124736) xmlDocUniquePtr pTable = parseExport("xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems", - "count", "45"); + assertXPath( + pTable, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems"_ostr, + "count"_ostr, "45"); // Group items must start with "<05/16/1958", then years sorted ascending, then ">06/11/2009" // They used to have years in the beginning, then "<05/16/1958", then ">06/11/2009". // The "<" and ">" date strings are locale-dependent, so test depends on en_US locale assertXPath( pTable, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[1]", - "v", "<05/16/1958"); + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[1]"_ostr, + "v"_ostr, "<05/16/1958"); for (int i = 2; i <= 44; ++i) assertXPath( pTable, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[" + OString::number(i) + "]", - "v", OUString::number(1963 + i)); + "v"_ostr, OUString::number(1963 + i)); assertXPath( pTable, - "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[45]", - "v", ">06/11/2009"); + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[45]"_ostr, + "v"_ostr, ">06/11/2009"); // Now check that table references these in correct order (document-dependent, so this is how // it should be in this specific testdoc which shows "<" and ">" values in the end) pTable = parseExport("xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items", "count", - "46"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items"_ostr, + "count"_ostr, "46"); const int vals[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 0, 44 }; @@ -2339,10 +2381,11 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124736) assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items/x:item[" + OString::number(i + 1) + "]", - "x", OUString::number(vals[i])); + "x"_ostr, OUString::number(vals[i])); } - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items/x:item[46]", - "t", "default"); + assertXPath(pTable, + "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items/x:item[46]"_ostr, + "t"_ostr, "default"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124772NumFmt) @@ -2355,15 +2398,15 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124772NumFmt) CPPUNIT_ASSERT(pTable); // This asserts that numFmtId attribute is present - const OUString sXclNumFmt - = getXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField", "numFmtId"); + const OUString sXclNumFmt = getXPath( + pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField"_ostr, "numFmtId"_ostr); pTable = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pTable); // Check that we refer to correct format assertXPath(pTable, "/x:styleSheet/x:numFmts/x:numFmt[@numFmtId='" + sXclNumFmt.toUtf8() + "']", - "formatCode", "\\$#,##0"); + "formatCode"_ostr, "\\$#,##0"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124810) @@ -2377,13 +2420,18 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124810) CPPUNIT_ASSERT(pTable); // All attributes must have been roundtripped correctly (testdoc uses some non-default values) - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "name", + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, "name"_ostr, "PivotStyleDark1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showRowHeaders", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showColHeaders", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showRowStripes", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showColStripes", "0"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showLastColumn", "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showRowHeaders"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showColHeaders"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showRowStripes"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showColStripes"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showLastColumn"_ostr, "0"); } { @@ -2397,13 +2445,18 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124810) CPPUNIT_ASSERT(pTable); // The default style for pivot tables in Excel 2007 through 2016 is PivotStyleLight16 - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "name", + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, "name"_ostr, "PivotStyleLight16"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showRowHeaders", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showColHeaders", "1"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showRowStripes", "0"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showColStripes", "0"); - assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", "showLastColumn", "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showRowHeaders"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showColHeaders"_ostr, "1"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showRowStripes"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showColStripes"_ostr, "0"); + assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo"_ostr, + "showLastColumn"_ostr, "1"); } } @@ -2416,9 +2469,9 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124883) CPPUNIT_ASSERT(pTable); // The field names must be kept just as they appear in original XLSX - assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField[1]", "name", + assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField[1]"_ostr, "name"_ostr, "Sum of Value"); - assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField[2]", "name", + assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField[2]"_ostr, "name"_ostr, "Count of Value2"); } @@ -2429,8 +2482,8 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf125046) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "longText", "1"); + assertXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "longText"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf125055) @@ -2446,26 +2499,32 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf125055) // "2017-07-10T09:11:02.99999..." into "2017-07-10T09:11:02", creating two identical strings // Only compare times here: see comment to ScPivotTableFiltersTest::testPivotCacheExportXLSX // "TODO Date generator in tests are one day higher, than during standard xlsx export" - OUString sISODateTime = getXPath( - pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "minDate"); + OUString sISODateTime + = getXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "minDate"_ostr); CPPUNIT_ASSERT_EQUAL(OUString("T09:11:02"), sISODateTime.copy(10)); - sISODateTime = getXPath( - pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "maxDate"); + sISODateTime + = getXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "maxDate"_ostr); CPPUNIT_ASSERT_EQUAL(OUString("T09:11:03"), sISODateTime.copy(10)); - assertXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", - "count", "3"); - assertXPathChildren(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", + assertXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, + "count"_ostr, "3"); + assertXPathChildren(pDoc, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, 3); // 2 different values + empty sISODateTime = getXPath( - pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems/x:d[1]", "v"); + pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems/x:d[1]"_ostr, + "v"_ostr); CPPUNIT_ASSERT_EQUAL(OUString("T09:11:02"), sISODateTime.copy(10)); sISODateTime = getXPath( - pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems/x:d[2]", "v"); + pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems/x:d[2]"_ostr, + "v"_ostr); CPPUNIT_ASSERT_EQUAL(OUString("T09:11:03"), sISODateTime.copy(10)); // Trailing empty CPPUNIT_ASSERT_EQUAL( - 2, getXPathPosition( - pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "m")); + 2, + getXPathPosition( + pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems"_ostr, "m")); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf125086) @@ -2475,9 +2534,11 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf125086) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[2]", "axis", "axisRow"); + assertXPath(pDoc, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[2]"_ostr, "axis"_ostr, + "axisRow"); // "dataField" attribute was not written for this "axisRow" field - assertXPath(pDoc, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[2]", "dataField", "1"); + assertXPath(pDoc, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[2]"_ostr, + "dataField"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf73845) diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index ee167117278a..19e93c95fce7 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -111,21 +111,21 @@ void ScScreenshotTest::initialize() void ScScreenshotTest::registerKnownDialogsByID(mapType& rKnownDialogs) { // fill map of known dialogs - rKnownDialogs["modules/scalc/ui/insertsheet.ui"] = 0; - rKnownDialogs["modules/scalc/ui/deletecells.ui"] = 1; - rKnownDialogs["modules/scalc/ui/pastespecial.ui"] = 2; - rKnownDialogs["modules/scalc/ui/changesourcedialog.ui"] = 3; - rKnownDialogs["modules/scalc/ui/selectdatasource.ui"] = 4; - rKnownDialogs["modules/scalc/ui/selectsource.ui"] = 5; - rKnownDialogs["modules/scalc/ui/deletecontents.ui"] = 6; - rKnownDialogs["modules/scalc/ui/createnamesdialog.ui"] = 7; - rKnownDialogs["modules/scalc/ui/inputstringdialog.ui"] = 8; - rKnownDialogs["modules/scalc/ui/tabcolordialog.ui"] = 9; - rKnownDialogs["modules/scalc/ui/textimportoptions.ui"] = 10; - rKnownDialogs["modules/scalc/ui/dataform.ui"] = 11; - rKnownDialogs["modules/scalc/ui/movecopysheet.ui"] = 12; - rKnownDialogs["modules/scalc/ui/textimportcsv.ui"] = 13; - rKnownDialogs["modules/scalc/ui/formatcellsdialog.ui"] = 14; + rKnownDialogs["modules/scalc/ui/insertsheet.ui"_ostr] = 0; + rKnownDialogs["modules/scalc/ui/deletecells.ui"_ostr] = 1; + rKnownDialogs["modules/scalc/ui/pastespecial.ui"_ostr] = 2; + rKnownDialogs["modules/scalc/ui/changesourcedialog.ui"_ostr] = 3; + rKnownDialogs["modules/scalc/ui/selectdatasource.ui"_ostr] = 4; + rKnownDialogs["modules/scalc/ui/selectsource.ui"_ostr] = 5; + rKnownDialogs["modules/scalc/ui/deletecontents.ui"_ostr] = 6; + rKnownDialogs["modules/scalc/ui/createnamesdialog.ui"_ostr] = 7; + rKnownDialogs["modules/scalc/ui/inputstringdialog.ui"_ostr] = 8; + rKnownDialogs["modules/scalc/ui/tabcolordialog.ui"_ostr] = 9; + rKnownDialogs["modules/scalc/ui/textimportoptions.ui"_ostr] = 10; + rKnownDialogs["modules/scalc/ui/dataform.ui"_ostr] = 11; + rKnownDialogs["modules/scalc/ui/movecopysheet.ui"_ostr] = 12; + rKnownDialogs["modules/scalc/ui/textimportcsv.ui"_ostr] = 13; + rKnownDialogs["modules/scalc/ui/formatcellsdialog.ui"_ostr] = 14; } VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID) diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index 035709a036ac..30600191d54a 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -100,8 +100,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf139167) xmlDocUniquePtr pDoc = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:styleSheet/x:cellStyles", "count", "6"); - assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:fill/x:patternFill/x:bgColor", "rgb", + assertXPath(pDoc, "/x:styleSheet/x:cellStyles"_ostr, "count"_ostr, "6"); + assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:fill/x:patternFill/x:bgColor"_ostr, "rgb"_ostr, "FFFFFF00"); } @@ -118,14 +118,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testFontColorWithMultipleAttributesDefined) xmlDocUniquePtr pDoc = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:styleSheet/x:fonts", "count", "6"); + assertXPath(pDoc, "/x:styleSheet/x:fonts"_ostr, "count"_ostr, "6"); // Expect "theme" attribute to be set correctly - assertXPath(pDoc, "/x:styleSheet/x:fonts/x:font[1]/x:color", "theme", "1"); + assertXPath(pDoc, "/x:styleSheet/x:fonts/x:font[1]/x:color"_ostr, "theme"_ostr, "1"); // We don't export "rgb" attribute - assertXPathNoAttribute(pDoc, "/x:styleSheet/x:fonts/x:font[1]/x:color", "rgb"); + assertXPathNoAttribute(pDoc, "/x:styleSheet/x:fonts/x:font[1]/x:color"_ostr, "rgb"_ostr); // Just making sure the checked font is the correct one - assertXPath(pDoc, "/x:styleSheet/x:fonts/x:font[1]/x:name", "val", "Calibri"); + assertXPath(pDoc, "/x:styleSheet/x:fonts/x:font[1]/x:name"_ostr, "val"_ostr, "Calibri"); } CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf139394) @@ -139,17 +139,17 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf139394) assertXPathContent( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[1]/" - "x14:cfRule/xm:f", + "x14:cfRule/xm:f"_ostr, "LEFT(A1,LEN(\"+\"))=\"+\""); assertXPathContent( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[2]/" - "x14:cfRule/xm:f", + "x14:cfRule/xm:f"_ostr, "RIGHT(A2,LEN(\"-\"))=\"-\""); assertXPathContent( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[3]/" - "x14:cfRule/xm:f", + "x14:cfRule/xm:f"_ostr, "LEFT(A3,LEN($B$3))=$B$3"); } @@ -164,32 +164,32 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testExtCondFormatXLSX) assertXPath( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[1]/" - "x14:cfRule", - "type", "containsText"); + "x14:cfRule"_ostr, + "type"_ostr, "containsText"); assertXPathContent( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[1]/" - "x14:cfRule/xm:f[1]", + "x14:cfRule/xm:f[1]"_ostr, "NOT(ISERROR(SEARCH($B$1,A1)))"); assertXPathContent( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[1]/" - "x14:cfRule/xm:f[2]", + "x14:cfRule/xm:f[2]"_ostr, "$B$1"); assertXPath( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[2]/" - "x14:cfRule", - "type", "notContainsText"); + "x14:cfRule"_ostr, + "type"_ostr, "notContainsText"); assertXPathContent( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[2]/" - "x14:cfRule/xm:f[1]", + "x14:cfRule/xm:f[1]"_ostr, "ISERROR(SEARCH($B$2,A2))"); assertXPathContent( pDoc, "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[2]/" - "x14:cfRule/xm:f[2]", + "x14:cfRule/xm:f[2]"_ostr, "$B$2"); } @@ -204,11 +204,11 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf90104) assertXPathContent(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation/mc:AlternateContent" - "/mc:Choice/x12ac:list", + "/mc:Choice/x12ac:list"_ostr, "1,\"2,3\",4,\"5,6\""); assertXPathContent(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation/mc:AlternateContent" - "/mc:Fallback/x:formula1", + "/mc:Fallback/x:formula1"_ostr, "\"1,2,3,4,5,6\""); } @@ -221,7 +221,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf111876) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/worksheets/_rels/sheet1.xml.rels"); CPPUNIT_ASSERT(pDoc); - OUString sTarget = getXPath(pDoc, "/rels:Relationships/rels:Relationship", "Target"); + OUString sTarget = getXPath(pDoc, "/rels:Relationships/rels:Relationship"_ostr, "Target"_ostr); // Document is saved to the temporary directory, relative path should be different than original one CPPUNIT_ASSERT(sTarget != "../xls/bug-fixes.xls"); @@ -357,14 +357,16 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF16LErtlSHA1) // round-trip the password as-is save("calc8"); xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); - assertXPath(pXmlDoc, - "//office:spreadsheet[@table:structure-protected='true' and " - "@table:protection-key='vbnhxyBKtPHCA1wB21zG1Oha8ZA=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"); - assertXPath(pXmlDoc, - "//table:table[@table:protected='true' and " - "@table:protection-key='vbnhxyBKtPHCA1wB21zG1Oha8ZA=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"); + assertXPath( + pXmlDoc, + "//office:spreadsheet[@table:structure-protected='true' and " + "@table:protection-key='vbnhxyBKtPHCA1wB21zG1Oha8ZA=' and " + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"_ostr); + assertXPath( + pXmlDoc, + "//table:table[@table:protected='true' and " + "@table:protection-key='vbnhxyBKtPHCA1wB21zG1Oha8ZA=' and " + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"_ostr); } CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA1) @@ -383,14 +385,16 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA1) // round-trip the password as-is save("calc8"); xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); - assertXPath(pXmlDoc, - "//office:spreadsheet[@table:structure-protected='true' and " - "@table:protection-key='nLHas0RIwepGDaH4c2hpyIUvIS8=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"); - assertXPath(pXmlDoc, - "//table:table[@table:protected='true' and " - "@table:protection-key='nLHas0RIwepGDaH4c2hpyIUvIS8=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"); + assertXPath( + pXmlDoc, + "//office:spreadsheet[@table:structure-protected='true' and " + "@table:protection-key='nLHas0RIwepGDaH4c2hpyIUvIS8=' and " + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"_ostr); + assertXPath( + pXmlDoc, + "//table:table[@table:protected='true' and " + "@table:protection-key='nLHas0RIwepGDaH4c2hpyIUvIS8=' and " + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"_ostr); } CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256ODF12) @@ -413,12 +417,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256ODF12) pXmlDoc, "//office:spreadsheet[@table:structure-protected='true' and " "@table:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"); + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"_ostr); assertXPath( pXmlDoc, "//table:table[@table:protected='true' and " "@table:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"); + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"_ostr); } CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256W3C) @@ -441,12 +445,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256W3C) pXmlDoc, "//office:spreadsheet[@table:structure-protected='true' and " "@table:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"); + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"_ostr); assertXPath( pXmlDoc, "//table:table[@table:protected='true' and " "@table:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=' and " - "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"); + "@table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"_ostr); } CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_XL_SHA1) @@ -471,14 +475,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_XL_SHA1) "@table:protection-key='OX3WkEe79fv1PE+FUmfOLdwVoqI=' and " "@table:protection-key-digest-algorithm='http://docs.oasis-open.org/office/ns/table/" "legacy-hash-excel' and " - "@loext:protection-key-digest-algorithm-2='http://www.w3.org/2000/09/xmldsig#sha1']"); + "@loext:protection-key-digest-algorithm-2='http://www.w3.org/2000/09/xmldsig#sha1']"_ostr); assertXPath( pXmlDoc, "//table:table[@table:protected='true' and " "@table:protection-key='OX3WkEe79fv1PE+FUmfOLdwVoqI=' and " "@table:protection-key-digest-algorithm='http://docs.oasis-open.org/office/ns/table/" "legacy-hash-excel' and " - "@loext:protection-key-digest-algorithm-2='http://www.w3.org/2000/09/xmldsig#sha1']"); + "@loext:protection-key-digest-algorithm-2='http://www.w3.org/2000/09/xmldsig#sha1']"_ostr); } CPPUNIT_TEST_FIXTURE(ScExportTest, testColorScaleExportODS) @@ -536,27 +540,27 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testCommentExportXLSX) xmlDocUniquePtr pComments = parseExport("xl/comments1.xml"); CPPUNIT_ASSERT(pComments); - assertXPathContent(pComments, "/x:comments/x:authors/x:author[1]", "BAKO"); - assertXPath(pComments, "/x:comments/x:authors/x:author", 1); + assertXPathContent(pComments, "/x:comments/x:authors/x:author[1]"_ostr, "BAKO"); + assertXPath(pComments, "/x:comments/x:authors/x:author"_ostr, 1); - assertXPathContent(pComments, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", + assertXPathContent(pComments, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t"_ostr, "Komentarz"); xmlDocUniquePtr pVmlDrawing = parseExport("xl/drawings/vmlDrawing1.vml"); CPPUNIT_ASSERT(pVmlDrawing); //assertXPath(pVmlDrawing, "/xml/v:shapetype", "coordsize", "21600,21600"); - assertXPath(pVmlDrawing, "/xml/v:shapetype", "spt", "202"); - assertXPath(pVmlDrawing, "/xml/v:shapetype/v:stroke", "joinstyle", "miter"); - const OUString sShapeTypeId = "#" + getXPath(pVmlDrawing, "/xml/v:shapetype", "id"); + assertXPath(pVmlDrawing, "/xml/v:shapetype"_ostr, "spt"_ostr, "202"); + assertXPath(pVmlDrawing, "/xml/v:shapetype/v:stroke"_ostr, "joinstyle"_ostr, "miter"); + const OUString sShapeTypeId = "#" + getXPath(pVmlDrawing, "/xml/v:shapetype"_ostr, "id"_ostr); - assertXPath(pVmlDrawing, "/xml/v:shape", "type", sShapeTypeId); - assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow", "color", "black"); - assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow", "obscured", "t"); + assertXPath(pVmlDrawing, "/xml/v:shape"_ostr, "type"_ostr, sShapeTypeId); + assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow"_ostr, "color"_ostr, "black"); + assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow"_ostr, "obscured"_ostr, "t"); //tdf#117274 fix MSO interoperability with the secret VML shape type id - assertXPath(pVmlDrawing, "/xml/v:shapetype", "id", "_x0000_t202"); - assertXPath(pVmlDrawing, "/xml/v:shape", "type", "#_x0000_t202"); + assertXPath(pVmlDrawing, "/xml/v:shapetype"_ostr, "id"_ostr, "_x0000_t202"); + assertXPath(pVmlDrawing, "/xml/v:shape"_ostr, "type"_ostr, "#_x0000_t202"); } CPPUNIT_TEST_FIXTURE(ScExportTest, testCommentExportXLSX_2_XLSX) @@ -577,13 +581,13 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testCommentExportXLSX_2_XLSX) xmlDocUniquePtr pComments = parseExport("xl/comments1.xml"); CPPUNIT_ASSERT(pComments); - assertXPathContent(pComments, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", + assertXPathContent(pComments, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t"_ostr, "visible comment"); xmlDocUniquePtr pVmlDrawing = parseExport("xl/drawings/vmlDrawing1.vml"); CPPUNIT_ASSERT(pVmlDrawing); - assertXPath(pVmlDrawing, "/xml/v:shape/x:ClientData/x:Visible", 0); + assertXPath(pVmlDrawing, "/xml/v:shape/x:ClientData/x:Visible"_ostr, 0); } #if HAVE_MORE_FONTS @@ -599,63 +603,63 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testCustomColumnWidthExportXLSX) // tdf#124741: check that we export default width, otherwise the skipped columns would have // wrong width. Previously defaultColWidth attribute was missing double nDefWidth - = getXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "defaultColWidth").toDouble(); + = getXPath(pSheet, "/x:worksheet/x:sheetFormatPr"_ostr, "defaultColWidth"_ostr).toDouble(); CPPUNIT_ASSERT_DOUBLES_EQUAL(11.53515625, nDefWidth, 0.01); // First column, has everything default (width in Calc: 1280), skipped // Second column, has custom width (width in Calc: 1225) - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "0"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "customWidth", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "2"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "2"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "outlineLevel"_ostr, "0"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "customWidth"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "min"_ostr, "2"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "max"_ostr, "2"); // Third column, has everything default (width in Calc: 1280), skipped // Fourth column has custom width. Columns from 4 to 7 are hidden - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "outlineLevel", "0"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "customWidth", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "min", "4"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "max", "4"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "outlineLevel"_ostr, "0"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "customWidth"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "min"_ostr, "4"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "max"_ostr, "4"); // 5th column has custom width. Columns from 4 to 7 are hidden - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "outlineLevel", "0"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "customWidth", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "min", "5"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "max", "5"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "outlineLevel"_ostr, "0"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "customWidth"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "min"_ostr, "5"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "max"_ostr, "5"); // 6th and 7th columns have default width and they are hidden - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "outlineLevel", "0"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "customWidth", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "min", "6"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "max", "7"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "outlineLevel"_ostr, "0"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "customWidth"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "min"_ostr, "6"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "max"_ostr, "7"); // 8th column has everything default - skipped // 9th column has custom width - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "outlineLevel", "0"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "customWidth", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "min", "9"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "max", "9"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "outlineLevel"_ostr, "0"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "customWidth"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "min"_ostr, "9"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "max"_ostr, "9"); // We expected that exactly 5 unique Nodes will be produced - assertXPath(pSheet, "/x:worksheet/x:cols/x:col", 5); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col"_ostr, 5); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "outlineLevel", "0"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "customFormat", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "customHeight", "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "outlineLevel"_ostr, "0"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "customFormat"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "customHeight"_ostr, "false"); } #endif @@ -669,17 +673,17 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testXfDefaultValuesXLSX) CPPUNIT_ASSERT(pSheet); // cellStyleXfs don't need xfId, so we need to make sure it is not saved - assertXPathNoAttribute(pSheet, "/x:styleSheet/x:cellStyleXfs/x:xf[1]", "xfId"); + assertXPathNoAttribute(pSheet, "/x:styleSheet/x:cellStyleXfs/x:xf[1]"_ostr, "xfId"_ostr); // Because numFmtId fontId fillId borderId xfId are not existing during import // it should be created during export, with values set to "0" - assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[1]", "xfId", "0"); - assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[2]", "xfId", "0"); - assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[3]", "xfId", "0"); - assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[4]", "xfId", "0"); + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[1]"_ostr, "xfId"_ostr, "0"); + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[2]"_ostr, "xfId"_ostr, "0"); + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[3]"_ostr, "xfId"_ostr, "0"); + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf[4]"_ostr, "xfId"_ostr, "0"); // We expected that exactly 15 cellXfs:xf Nodes will be produced - assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf", 14); + assertXPath(pSheet, "/x:styleSheet/x:cellXfs/x:xf"_ostr, 14); } static auto verifySpreadsheet13(char const* const pTestName, ScDocument& rDoc) -> void @@ -730,12 +734,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testODF13) // check XML xmlDocUniquePtr pContentXml = parseExport("content.xml"); assertXPath(pContentXml, "/office:document-content/office:automatic-styles/style:style/" - "style:table-properties[@table:tab-color='#ff3838']"); + "style:table-properties[@table:tab-color='#ff3838']"_ostr); xmlDocUniquePtr pStylesXml = parseExport("styles.xml"); assertXPath(pStylesXml, "/office:document-styles/office:automatic-styles/style:page-layout/" - "style:page-layout-properties[@style:scale-to-X='2']"); + "style:page-layout-properties[@style:scale-to-X='2']"_ostr); assertXPath(pStylesXml, "/office:document-styles/office:automatic-styles/style:page-layout/" - "style:page-layout-properties[@style:scale-to-Y='3']"); + "style:page-layout-properties[@style:scale-to-Y='3']"_ostr); // check model verifySpreadsheet13("1.3 reload", *pDoc); @@ -753,12 +757,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testODF13) // check XML xmlDocUniquePtr pContentXml = parseExport("content.xml"); assertXPath(pContentXml, "/office:document-content/office:automatic-styles/style:style/" - "style:table-properties[@tableooo:tab-color='#ff3838']"); + "style:table-properties[@tableooo:tab-color='#ff3838']"_ostr); xmlDocUniquePtr pStylesXml = parseExport("styles.xml"); assertXPath(pStylesXml, "/office:document-styles/office:automatic-styles/style:page-layout/" - "style:page-layout-properties[@loext:scale-to-X='2']"); + "style:page-layout-properties[@loext:scale-to-X='2']"_ostr); assertXPath(pStylesXml, "/office:document-styles/office:automatic-styles/style:page-layout/" - "style:page-layout-properties[@loext:scale-to-Y='3']"); + "style:page-layout-properties[@loext:scale-to-Y='3']"_ostr); // check model verifySpreadsheet13("1.2 Extended reload", *pDoc); @@ -776,17 +780,17 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testODF13) xmlDocUniquePtr pContentXml = parseExport("content.xml"); assertXPathNoAttribute( pContentXml, - "/office:document-content/office:automatic-styles/style:style/style:table-properties", - "tab-color"); + "/office:document-content/office:automatic-styles/style:style/style:table-properties"_ostr, + "tab-color"_ostr); xmlDocUniquePtr pStylesXml = parseExport("styles.xml"); assertXPathNoAttribute(pStylesXml, "/office:document-styles/office:automatic-styles/" - "style:page-layout[1]/style:page-layout-properties", - "scale-to-X"); + "style:page-layout[1]/style:page-layout-properties"_ostr, + "scale-to-X"_ostr); assertXPathNoAttribute(pStylesXml, "/office:document-styles/office:automatic-styles/" - "style:page-layout[1]/style:page-layout-properties", - "scale-to-Y"); + "style:page-layout[1]/style:page-layout-properties"_ostr, + "scale-to-Y"_ostr); // don't reload - no point } @@ -803,26 +807,26 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testColumnWidthResaveXLSX) CPPUNIT_ASSERT(pSheet); // In original Excel document the width is "24" - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "width", "24"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "customWidth", "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "width"_ostr, "24"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "customWidth"_ostr, "true"); // In original Excel document the width is "12" - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "width", "12"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "customWidth", "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "width"_ostr, "12"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "customWidth"_ostr, "true"); // In original Excel document the width is "6" - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "width", "6"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "customWidth", "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "width"_ostr, "6"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "customWidth"_ostr, "true"); // In original Excel document the width is "1" - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "width", "1"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "customWidth", "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "width"_ostr, "1"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "customWidth"_ostr, "true"); // In original Excel document the width is "250" - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "width", "250"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "customWidth", "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "width"_ostr, "250"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "customWidth"_ostr, "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col", 5); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col"_ostr, 5); } #if HAVE_MORE_FONTS @@ -902,139 +906,139 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testOutlineExportXLSX) CPPUNIT_ASSERT(pSheet); // Maximum Outline Row is 4 for this document - assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "outlineLevelRow", "4"); + assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr"_ostr, "outlineLevelRow"_ostr, "4"); // Maximum Outline Column is 4 for this document - assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "outlineLevelCol", "4"); + assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr"_ostr, "outlineLevelCol"_ostr, "4"); // First XML node, creates two columns (from min=1 to max=2) - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "1"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "1"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "2"); - - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "outlineLevel", "2"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "min", "3"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "max", "3"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "outlineLevel"_ostr, "1"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "min"_ostr, "1"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]"_ostr, "max"_ostr, "2"); + + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "outlineLevel"_ostr, "2"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "min"_ostr, "3"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]"_ostr, "max"_ostr, "3"); // Column 4 has custom width and it is hidden. We need to make sure that it is created - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "outlineLevel", "2"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "min", "4"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "max", "4"); - - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "outlineLevel", "3"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "min", "5"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "max", "6"); - - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "outlineLevel", "4"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "min", "7"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "max", "7"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "outlineLevel"_ostr, "2"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "min"_ostr, "4"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]"_ostr, "max"_ostr, "4"); + + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "outlineLevel"_ostr, "3"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "min"_ostr, "5"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]"_ostr, "max"_ostr, "6"); + + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "outlineLevel"_ostr, "4"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "min"_ostr, "7"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]"_ostr, "max"_ostr, "7"); // Column 8 has custom width and it is hidden. We need to make sure that it is created - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "outlineLevel", "4"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "min", "8"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "max", "8"); - - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "outlineLevel", "4"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "min", "9"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "max", "19"); - - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]", "outlineLevel", "3"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]", "collapsed", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]", "min", "20"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]", "max", "20"); - - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[9]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[9]", "outlineLevel", "3"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[9]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[9]", "min", "21"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[9]", "max", "21"); - - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[10]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[10]", "outlineLevel", "2"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[10]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[10]", "min", "22"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[10]", "max", "23"); - - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[11]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[11]", "outlineLevel", "1"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[11]", "collapsed", "true"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[11]", "min", "24"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[11]", "max", "24"); - - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[12]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[12]", "outlineLevel", "1"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[12]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[12]", "min", "25"); - assertXPath(pSheet, "/x:worksheet/x:cols/x:col[12]", "max", "26"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]"_ostr, "outlineLevel"_ostr, "4"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]"_ostr, "min"_ostr, "8"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]"_ostr, "max"_ostr, "8"); + + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]"_ostr, "outlineLevel"_ostr, "4"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]"_ostr, "min"_ostr, "9"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]"_ostr, "max"_ostr, "19"); + + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]"_ostr, "outlineLevel"_ostr, "3"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]"_ostr, "collapsed"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]"_ostr, "min"_ostr, "20"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]"_ostr, "max"_ostr, "20"); + + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[9]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[9]"_ostr, "outlineLevel"_ostr, "3"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[9]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[9]"_ostr, "min"_ostr, "21"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[9]"_ostr, "max"_ostr, "21"); + + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[10]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[10]"_ostr, "outlineLevel"_ostr, "2"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[10]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[10]"_ostr, "min"_ostr, "22"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[10]"_ostr, "max"_ostr, "23"); + + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[11]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[11]"_ostr, "outlineLevel"_ostr, "1"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[11]"_ostr, "collapsed"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[11]"_ostr, "min"_ostr, "24"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[11]"_ostr, "max"_ostr, "24"); + + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[12]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[12]"_ostr, "outlineLevel"_ostr, "1"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[12]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[12]"_ostr, "min"_ostr, "25"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[12]"_ostr, "max"_ostr, "26"); // We expected that exactly 12 unique Nodes will be produced - assertXPath(pSheet, "/x:worksheet/x:cols/x:col", 12); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col"_ostr, 12); // First row is empty and default so it is not written into XML file // so we need to save 29 rows, as it provides information about outLineLevel - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "r", "2"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "outlineLevel", "1"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "r", "3"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "outlineLevel", "2"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "r", "4"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "outlineLevel", "2"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "r", "5"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "outlineLevel", "3"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]", "r", "6"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]", "outlineLevel", "3"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[6]", "r", "7"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[6]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[6]", "outlineLevel", "4"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[6]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[7]", "r", "8"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[7]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[7]", "outlineLevel", "4"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[7]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[8]", "r", "9"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[8]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[8]", "outlineLevel", "4"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[8]", "collapsed", "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "r"_ostr, "2"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "outlineLevel"_ostr, "1"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]"_ostr, "r"_ostr, "3"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]"_ostr, "outlineLevel"_ostr, "2"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]"_ostr, "r"_ostr, "4"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]"_ostr, "outlineLevel"_ostr, "2"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]"_ostr, "r"_ostr, "5"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]"_ostr, "outlineLevel"_ostr, "3"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]"_ostr, "r"_ostr, "6"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]"_ostr, "outlineLevel"_ostr, "3"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[6]"_ostr, "r"_ostr, "7"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[6]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[6]"_ostr, "outlineLevel"_ostr, "4"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[6]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[7]"_ostr, "r"_ostr, "8"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[7]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[7]"_ostr, "outlineLevel"_ostr, "4"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[7]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[8]"_ostr, "r"_ostr, "9"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[8]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[8]"_ostr, "outlineLevel"_ostr, "4"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[8]"_ostr, "collapsed"_ostr, "false"); // Next rows are the same as the previous one but it needs to be preserved, // as they contain information about outlineLevel - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[20]", "r", "21"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[20]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[20]", "outlineLevel", "4"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[20]", "collapsed", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[21]", "r", "22"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[21]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[21]", "outlineLevel", "3"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[21]", "collapsed", "true"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[22]", "r", "23"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[22]", "hidden", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[22]", "outlineLevel", "3"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[22]", "collapsed", "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[20]"_ostr, "r"_ostr, "21"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[20]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[20]"_ostr, "outlineLevel"_ostr, "4"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[20]"_ostr, "collapsed"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[21]"_ostr, "r"_ostr, "22"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[21]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[21]"_ostr, "outlineLevel"_ostr, "3"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[21]"_ostr, "collapsed"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[22]"_ostr, "r"_ostr, "23"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[22]"_ostr, "hidden"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[22]"_ostr, "outlineLevel"_ostr, "3"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[22]"_ostr, "collapsed"_ostr, "false"); // We expected that exactly 29 Row Nodes will be produced - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 29); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row"_ostr, 29); } CPPUNIT_TEST_FIXTURE(ScExportTest, testAllRowsHiddenXLSX) @@ -1044,8 +1048,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testAllRowsHiddenXLSX) save("Calc Office Open XML"); xmlDocUniquePtr pSheet = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); - assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "zeroHeight", "true"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 0); + assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr"_ostr, "zeroHeight"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row"_ostr, 0); } CPPUNIT_TEST_FIXTURE(ScExportTest, testHiddenEmptyRowsXLSX) @@ -1057,11 +1061,11 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testHiddenEmptyRowsXLSX) xmlDocUniquePtr pSheet = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); - assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "zeroHeight", "false"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "hidden", "true"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "hidden", "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr"_ostr, "zeroHeight"_ostr, "false"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]"_ostr, "hidden"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]"_ostr, "hidden"_ostr, "false"); } CPPUNIT_TEST_FIXTURE(ScExportTest, testHiddenEmptyColsODS) @@ -1072,8 +1076,9 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testHiddenEmptyColsODS) save("calc8"); xmlDocUniquePtr pSheet = parseExport("content.xml"); CPPUNIT_ASSERT(pSheet); - assertXPath(pSheet, "//table:table/table:table-column[2]"); - assertXPath(pSheet, "//table:table/table:table-column[2]", "number-columns-repeated", "1017"); + assertXPath(pSheet, "//table:table/table:table-column[2]"_ostr); + assertXPath(pSheet, "//table:table/table:table-column[2]"_ostr, "number-columns-repeated"_ostr, + "1017"); } CPPUNIT_TEST_FIXTURE(ScExportTest, testLandscapeOrientationXLSX) @@ -1086,8 +1091,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testLandscapeOrientationXLSX) CPPUNIT_ASSERT(pSheet); // the usePrinterDefaults cannot be saved to allow opening sheets in Landscape mode via MS Excel - assertXPathNoAttribute(pSheet, "/x:worksheet/x:pageSetup", "usePrinterDefaults"); - assertXPath(pSheet, "/x:worksheet/x:pageSetup", "orientation", "landscape"); + assertXPathNoAttribute(pSheet, "/x:worksheet/x:pageSetup"_ostr, "usePrinterDefaults"_ostr); + assertXPath(pSheet, "/x:worksheet/x:pageSetup"_ostr, "orientation"_ostr, "landscape"); } CPPUNIT_TEST_FIXTURE(ScExportTest, testDataBarExportXLSX) @@ -1263,37 +1268,37 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testBuiltinRangesXLSX) //assert the existing OOXML built-in names are still there assertXPathContent(pDoc, "/x:workbook/x:definedNames/" - "x:definedName[@name='_xlnm._FilterDatabase'][@localSheetId='0']", + "x:definedName[@name='_xlnm._FilterDatabase'][@localSheetId='0']"_ostr, "'Sheet1 Test'!$A$1:$A$5"); assertXPathContent(pDoc, "/x:workbook/x:definedNames/" - "x:definedName[@name='_xlnm._FilterDatabase'][@localSheetId='1']", + "x:definedName[@name='_xlnm._FilterDatabase'][@localSheetId='1']"_ostr, "'Sheet2 Test'!$K$10:$K$14"); assertXPathContent( pDoc, - "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area'][@localSheetId='0']", + "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area'][@localSheetId='0']"_ostr, "'Sheet1 Test'!$A$1:$A$5"); assertXPathContent( pDoc, - "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area'][@localSheetId='1']", + "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area'][@localSheetId='1']"_ostr, "'Sheet2 Test'!$K$10:$M$18"); //...and that no extra ones are added (see tdf#112571) assertXPath(pDoc, "/x:workbook/x:definedNames/" - "x:definedName[@name='_xlnm._FilterDatabase_0'][@localSheetId='0']", + "x:definedName[@name='_xlnm._FilterDatabase_0'][@localSheetId='0']"_ostr, 0); assertXPath(pDoc, "/x:workbook/x:definedNames/" - "x:definedName[@name='_xlnm._FilterDatabase_0'][@localSheetId='1']", + "x:definedName[@name='_xlnm._FilterDatabase_0'][@localSheetId='1']"_ostr, 0); assertXPath( pDoc, - "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area_0'][@localSheetId='0']", + "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area_0'][@localSheetId='0']"_ostr, 0); assertXPath( pDoc, - "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area_0'][@localSheetId='1']", + "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area_0'][@localSheetId='1']"_ostr, 0); } @@ -1784,7 +1789,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testRichTextCellFormatXLSX) CPPUNIT_ASSERT(pSheet); // make sure the only cell in this doc is assigned some formatting record - OUString aCellFormat = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row/x:c", "s"); + OUString aCellFormat = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row/x:c"_ostr, "s"_ostr); CPPUNIT_ASSERT_MESSAGE("Cell format is missing", !aCellFormat.isEmpty()); xmlDocUniquePtr pStyles = parseExport("xl/styles.xml"); @@ -1793,16 +1798,16 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testRichTextCellFormatXLSX) OString nFormatIdx = OString::number(aCellFormat.toInt32() + 1); const OString aXPath1("/x:styleSheet/x:cellXfs/x:xf[" + nFormatIdx + "]/x:alignment"); // formatting record is set to wrap text - assertXPath(pStyles, aXPath1, "wrapText", "true"); + assertXPath(pStyles, aXPath1, "wrapText"_ostr, "true"); // see what font it references const OString aXPath2("/x:styleSheet/x:cellXfs/x:xf[" + nFormatIdx + "]"); - OUString aFontId = getXPath(pStyles, aXPath2, "fontId"); + OUString aFontId = getXPath(pStyles, aXPath2, "fontId"_ostr); OString nFontIdx = OString::number(aFontId.toInt32() + 1); // that font should be bold const OString aXPath3("/x:styleSheet/x:fonts/x:font[" + nFontIdx + "]/x:b"); - assertXPath(pStyles, aXPath3, "val", "true"); + assertXPath(pStyles, aXPath3, "val"_ostr, "true"); } CPPUNIT_TEST_FIXTURE(ScExportTest, testWrapText) @@ -1814,15 +1819,22 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testWrapText) xmlDocUniquePtr pStyles = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pStyles); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs", "count", "7"); + assertXPath(pStyles, "/x:styleSheet/x:cellXfs"_ostr, "count"_ostr, "7"); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment", "wrapText", "false"); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", "wrapText", "false"); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment", "wrapText", "false"); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[4]/x:alignment", "wrapText", "false"); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[5]/x:alignment", "wrapText", "true"); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[6]/x:alignment", "wrapText", "true"); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[7]/x:alignment", "wrapText", "true"); + assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment"_ostr, "wrapText"_ostr, + "false"); + assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment"_ostr, "wrapText"_ostr, + "false"); + assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment"_ostr, "wrapText"_ostr, + "false"); + assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[4]/x:alignment"_ostr, "wrapText"_ostr, + "false"); + assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[5]/x:alignment"_ostr, "wrapText"_ostr, + "true"); + assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[6]/x:alignment"_ostr, "wrapText"_ostr, + "true"); + assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[7]/x:alignment"_ostr, "wrapText"_ostr, + "true"); } CPPUNIT_TEST_FIXTURE(ScExportTest, testFormulaRefSheetNameODS) @@ -2041,8 +2053,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testEmbeddedChartODS) CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/office:document-content/office:body/office:spreadsheet/table:table[2]/" - "table:table-row[7]/table:table-cell[2]/draw:frame/draw:object", - "notify-on-update-of-ranges", + "table:table-row[7]/table:table-cell[2]/draw:frame/draw:object"_ostr, + "notify-on-update-of-ranges"_ostr, "Chart1.B3:Chart1.B5 Chart1.C2:Chart1.C2 Chart1.C3:Chart1.C5"); } @@ -2285,12 +2297,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf155368) xmlDocUniquePtr pStyles = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pStyles); - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment", "wrapText", "false"); + assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment"_ostr, "wrapText"_ostr, + "false"); // Without the fix in place, this test would have failed with // - Expected: false // - Actual : true - assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", "wrapText", "false"); + assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment"_ostr, "wrapText"_ostr, + "false"); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 90129e4bbf13..9f281928c732 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -47,7 +47,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testGroupShape) xmlDocUniquePtr pDoc = parseExport("xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:grpSp/xdr:grpSpPr"); + assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:grpSp/xdr:grpSpPr"_ostr); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testMatrixMultiplicationXLSX) @@ -59,12 +59,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testMatrixMultiplicationXLSX) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - OUString CellFormulaRange = getXPath(pDoc, "/x:worksheet/x:sheetData/x:row[4]/x:c/x:f", "ref"); + OUString CellFormulaRange + = getXPath(pDoc, "/x:worksheet/x:sheetData/x:row[4]/x:c/x:f"_ostr, "ref"_ostr); // make sure that the CellFormulaRange is G5:G6. CPPUNIT_ASSERT_EQUAL(OUString("G5:G6"), CellFormulaRange); - OUString CellFormulaType = getXPath(pDoc, "/x:worksheet/x:sheetData/x:row[4]/x:c/x:f", "t"); + OUString CellFormulaType + = getXPath(pDoc, "/x:worksheet/x:sheetData/x:row[4]/x:c/x:f"_ostr, "t"_ostr); // make sure that the CellFormulaType is array. CPPUNIT_ASSERT_EQUAL(OUString("array"), CellFormulaType); @@ -199,8 +201,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTextDirectionXLSX) xmlDocUniquePtr pDoc = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", "readingOrder", "1"); //LTR - assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment", "readingOrder", "2"); //RTL + assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment"_ostr, "readingOrder"_ostr, + "1"); //LTR + assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment"_ostr, "readingOrder"_ostr, + "2"); //RTL } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf121260) @@ -218,12 +222,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf121260) // Without the fix in place, this test would have failed with // - Expected: Sheet1!$A$1:$A$2 // - Actual : sheet1 $A$1:$A$2 - assertXPathContent(pChart1, - "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:val/c:numRef/c:f", - "Sheet1!$A$1:$A$2"); - assertXPathContent(pChart1, - "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[2]/c:val/c:numRef/c:f", - "Sheet1!$B$1:$B$2"); + assertXPathContent( + pChart1, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:val/c:numRef/c:f"_ostr, + "Sheet1!$A$1:$A$2"); + assertXPathContent( + pChart1, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[2]/c:val/c:numRef/c:f"_ostr, + "Sheet1!$B$1:$B$2"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf120168) @@ -237,8 +241,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf120168) // Without the fix in place, this test would have failed with // - Expected: left // - Actual : general - assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", "horizontal", "left"); - assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment", "horizontal", "right"); + assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment"_ostr, "horizontal"_ostr, + "left"); + assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment"_ostr, "horizontal"_ostr, + "right"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf117266) @@ -248,15 +254,15 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf117266) save("Calc MS Excel 2007 VBA XML"); xmlDocUniquePtr pVmlDrawing = parseExport("xl/drawings/vmlDrawing1.vml"); - OUString sName = getXPath(pVmlDrawing, "/xml/v:shape", "id"); + OUString sName = getXPath(pVmlDrawing, "/xml/v:shape"_ostr, "id"_ostr); CPPUNIT_ASSERT_EQUAL(OUString("Button 1001"), sName); - OUString sSpid = getXPath(pVmlDrawing, "/xml/v:shape", "spid"); + OUString sSpid = getXPath(pVmlDrawing, "/xml/v:shape"_ostr, "spid"_ostr); CPPUNIT_ASSERT(sSpid.startsWith("_x0000_s")); - assertXPathContent(pVmlDrawing, "/xml/v:shape/v:textbox/div/font", "Button 1 \"y\" z"); + assertXPathContent(pVmlDrawing, "/xml/v:shape/v:textbox/div/font"_ostr, "Button 1 \"y\" z"); // Why the xx:, I have no idea..., but it certainly doesn't work with just x:. - assertXPathContent(pVmlDrawing, "/xml/v:shape//xx:FmlaMacro", "Module1.Button1_Click"); + assertXPathContent(pVmlDrawing, "/xml/v:shape//xx:FmlaMacro"_ostr, "Module1.Button1_Click"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf66668) @@ -277,11 +283,11 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf130108) xmlDocUniquePtr pDoc = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:b", "val", "1"); - assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:i", "val", "0"); - assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:color", "rgb", "FFFFFFFF"); - assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:sz", "val", "10"); - assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:fill/x:patternFill/x:bgColor", "rgb", + assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:b"_ostr, "val"_ostr, "1"); + assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:i"_ostr, "val"_ostr, "0"); + assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:color"_ostr, "rgb"_ostr, "FFFFFFFF"); + assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:sz"_ostr, "val"_ostr, "10"); + assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:fill/x:patternFill/x:bgColor"_ostr, "rgb"_ostr, "FFCC0000"); } @@ -293,7 +299,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf76949) xmlDocUniquePtr pSheet = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); - assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row/x:c/x:f", "_xlfn.CHISQ.DIST(1,1,1)"); + assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row/x:c/x:f"_ostr, + "_xlfn.CHISQ.DIST(1,1,1)"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf107586) @@ -306,7 +313,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf107586) // Without the fix in place, this test would have failed with // XPath '/x:worksheet/x:sheetPr/x:tabColor' number of nodes is incorrect - assertXPath(pSheet, "/x:worksheet/x:sheetPr/x:tabColor", "rgb", "FF9BBB59"); + assertXPath(pSheet, "/x:worksheet/x:sheetPr/x:tabColor"_ostr, "rgb"_ostr, "FF9BBB59"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf55417) @@ -316,8 +323,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf55417) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment", 1); - assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", 1); + assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment"_ostr, 1); + assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment"_ostr, 1); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf129985) @@ -328,7 +335,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf129985) xmlDocUniquePtr pDoc = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "m/d/yyyy"); + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]"_ostr, "formatCode"_ostr, "m/d/yyyy"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf73063) @@ -339,7 +346,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf73063) xmlDocUniquePtr pDoc = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]"_ostr, "formatCode"_ostr, "[$-1C1A]dddd\", \"d\". \"mmmm\\ yyyy;@"); } @@ -351,12 +358,13 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf95640_ods_to_xlsx) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); - assertXPath(pDoc, "//x:worksheet/x:autoFilter", "ref", "A1:B4"); + assertXPath(pDoc, "//x:worksheet/x:autoFilter"_ostr, "ref"_ostr, "A1:B4"); - assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "ref", "A2:A4"); + assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition"_ostr, "ref"_ostr, + "A2:A4"); - assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "customList", - "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec"); + assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition"_ostr, + "customList"_ostr, "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf95640_ods_to_xlsx_with_standard_list) @@ -366,12 +374,13 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf95640_ods_to_xlsx_with_standard_list) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); - assertXPath(pDoc, "//x:worksheet/x:autoFilter", "ref", "A1:B4"); + assertXPath(pDoc, "//x:worksheet/x:autoFilter"_ostr, "ref"_ostr, "A1:B4"); - assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "ref", "A2:A4"); + assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition"_ostr, "ref"_ostr, + "A2:A4"); - assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "customList", - "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"); + assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition"_ostr, + "customList"_ostr, "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf95640_xlsx_to_xlsx) @@ -385,12 +394,13 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf95640_xlsx_to_xlsx) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); - assertXPath(pDoc, "//x:worksheet/x:autoFilter", "ref", "A1:B4"); + assertXPath(pDoc, "//x:worksheet/x:autoFilter"_ostr, "ref"_ostr, "A1:B4"); - assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "ref", "A2:A4"); + assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition"_ostr, "ref"_ostr, + "A2:A4"); - assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "customList", - "Low,Medium,High"); + assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition"_ostr, + "customList"_ostr, "Low,Medium,High"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testDateAutofilterXLSX) @@ -402,18 +412,24 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testDateAutofilterXLSX) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "//x:autoFilter", "ref", "A1:B4"); - assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "day", "02"); - assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "month", "03"); - assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "year", "2017"); - assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", - "dateTimeGrouping", "day"); - - assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]", "day", "01"); - assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]", "month", "10"); - assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]", "year", "2014"); - assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]", - "dateTimeGrouping", "day"); + assertXPath(pDoc, "//x:autoFilter"_ostr, "ref"_ostr, "A1:B4"); + assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]"_ostr, "day"_ostr, + "02"); + assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]"_ostr, + "month"_ostr, "03"); + assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]"_ostr, + "year"_ostr, "2017"); + assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]"_ostr, + "dateTimeGrouping"_ostr, "day"); + + assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]"_ostr, "day"_ostr, + "01"); + assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]"_ostr, + "month"_ostr, "10"); + assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]"_ostr, + "year"_ostr, "2014"); + assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]"_ostr, + "dateTimeGrouping"_ostr, "day"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testDateAutofilterODS) @@ -424,9 +440,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testDateAutofilterODS) xmlDocUniquePtr pDoc = parseExport("content.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[1]", "value", "Calc"); - assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[2]", "value", - "2021-05-04"); + assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[1]"_ostr, + "value"_ostr, "Calc"); + assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[2]"_ostr, + "value"_ostr, "2021-05-04"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testAutofilterColorsODF) @@ -439,32 +456,34 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testAutofilterColorsODF) assertXPath(pDoc, "//table:database-ranges/table:database-range[1]/table:filter/table:filter-and/" - "table:filter-condition[1]", - "value", "#e8f2a1"); + "table:filter-condition[1]"_ostr, + "value"_ostr, "#e8f2a1"); assertXPath(pDoc, "//table:database-ranges/table:database-range[1]/table:filter/table:filter-and/" - "table:filter-condition[1][@loext:data-type='background-color']"); + "table:filter-condition[1][@loext:data-type='background-color']"_ostr); assertXPath(pDoc, "//table:database-ranges/table:database-range[1]/table:filter/table:filter-and/" - "table:filter-condition[2]", - "value", "#3465a4"); - assertXPath(pDoc, "//table:database-ranges/table:database-range[1]/table:filter/" - "table:filter-and/table:filter-condition[2][@loext:data-type='text-color']"); + "table:filter-condition[2]"_ostr, + "value"_ostr, "#3465a4"); + assertXPath(pDoc, + "//table:database-ranges/table:database-range[1]/table:filter/" + "table:filter-and/table:filter-condition[2][@loext:data-type='text-color']"_ostr); // tdf#142965 Check "none" value when automatic text color / no fill was selected assertXPath(pDoc, "//table:database-ranges/table:database-range[2]/table:filter/" "table:filter-and/" - "table:filter-condition[1][@loext:data-type='background-color']"); + "table:filter-condition[1][@loext:data-type='background-color']"_ostr); assertXPath(pDoc, "//table:database-ranges/table:database-range[2]/table:filter/table:filter-and/" - "table:filter-condition[1]", - "value", "transparent"); - assertXPath(pDoc, "//table:database-ranges/table:database-range[3]/table:filter/" - "table:filter-and/table:filter-condition[1][@loext:data-type='text-color']"); + "table:filter-condition[1]"_ostr, + "value"_ostr, "transparent"); + assertXPath(pDoc, + "//table:database-ranges/table:database-range[3]/table:filter/" + "table:filter-and/table:filter-condition[1][@loext:data-type='text-color']"_ostr); assertXPath(pDoc, "//table:database-ranges/table:database-range[3]/table:filter/table:filter-and/" - "table:filter-condition[1]", - "value", "window-font-color"); + "table:filter-condition[1]"_ostr, + "value"_ostr, "window-font-color"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testAutofilterColorsOOXML) @@ -475,7 +494,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testAutofilterColorsOOXML) xmlDocUniquePtr pTable1 = parseExport("xl/tables/table1.xml"); CPPUNIT_ASSERT(pTable1); sal_Int32 nDxfId - = getXPath(pTable1, "/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId") + = getXPath(pTable1, "/x:table/x:autoFilter/x:filterColumn/x:colorFilter"_ostr, + "dxfId"_ostr) .toInt32() + 1; @@ -483,7 +503,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testAutofilterColorsOOXML) CPPUNIT_ASSERT(pStyles); OString sDxfXPath("/x:styleSheet/x:dxfs/x:dxf[" + OString::number(nDxfId) + "]/x:fill/x:patternFill/x:fgColor"); - assertXPath(pStyles, sDxfXPath, "rgb", "FFFFD7D7"); + assertXPath(pStyles, sDxfXPath, "rgb"_ostr, "FFFFD7D7"); } { @@ -492,7 +512,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testAutofilterColorsOOXML) xmlDocUniquePtr pTable1 = parseExport("xl/tables/table1.xml"); CPPUNIT_ASSERT(pTable1); sal_Int32 nDxfId - = getXPath(pTable1, "/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId") + = getXPath(pTable1, "/x:table/x:autoFilter/x:filterColumn/x:colorFilter"_ostr, + "dxfId"_ostr) .toInt32() + 1; @@ -500,7 +521,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testAutofilterColorsOOXML) CPPUNIT_ASSERT(pStyles); OString sDxfXPath("/x:styleSheet/x:dxfs/x:dxf[" + OString::number(nDxfId) + "]/x:fill/x:patternFill/x:fgColor"); - assertXPath(pStyles, sDxfXPath, "rgb", "FF3465A4"); + assertXPath(pStyles, sDxfXPath, "rgb"_ostr, "FF3465A4"); } } @@ -511,8 +532,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testAutofilterTop10XLSX) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "//x:autoFilter/x:filterColumn", "colId", "0"); - assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:top10", "val", "4"); + assertXPath(pDoc, "//x:autoFilter/x:filterColumn"_ostr, "colId"_ostr, "0"); + assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:top10"_ostr, "val"_ostr, "4"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf88657ODS) @@ -523,7 +544,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf88657ODS) xmlDocUniquePtr pDoc = parseExport("styles.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "//number:fraction", "min-denominator-digits", "3"); + assertXPath(pDoc, "//number:fraction"_ostr, "min-denominator-digits"_ostr, "3"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf41722) @@ -534,9 +555,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf41722) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "//x:conditionalFormatting/x:cfRule[1]", "operator", "containsText"); - assertXPath(pDoc, "//x:conditionalFormatting/x:cfRule[2]", "operator", "containsText"); - assertXPath(pDoc, "//x:conditionalFormatting/x:cfRule[3]", "operator", "containsText"); + assertXPath(pDoc, "//x:conditionalFormatting/x:cfRule[1]"_ostr, "operator"_ostr, + "containsText"); + assertXPath(pDoc, "//x:conditionalFormatting/x:cfRule[2]"_ostr, "operator"_ostr, + "containsText"); + assertXPath(pDoc, "//x:conditionalFormatting/x:cfRule[3]"_ostr, "operator"_ostr, + "containsText"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf113621) @@ -547,7 +571,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf113621) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "//x:conditionalFormatting", "sqref", "A1:A1048576"); + assertXPath(pDoc, "//x:conditionalFormatting"_ostr, "sqref"_ostr, "A1:A1048576"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testEscapeCharInNumberFormatXLSX) @@ -558,18 +582,20 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testEscapeCharInNumberFormatXLSX) xmlDocUniquePtr pDoc = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]"_ostr, "formatCode"_ostr, "00\\ 00\\ 00\\ 00\\ 00"); - assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[3]", "formatCode", + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[3]"_ostr, "formatCode"_ostr, "00\\.00\\.00\\.000\\.0"); // tdf#81939 // "_-* #,##0\ _€_-;\-* #,##0\ _€_-;_-* "- "_€_-;_-@_-" // tdf#81222 OUString rFormatStrExpected(u"_-* #,##0\\ _€_-;\\-* #,##0\\ _€_-;_-* \"- \"_€_-;_-@_-"_ustr); - assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[4]", "formatCode", rFormatStrExpected); + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[4]"_ostr, "formatCode"_ostr, + rFormatStrExpected); // "_-* #,##0" €"_-;\-* #,##0" €"_-;_-* "- €"_-;_-@_-"); rFormatStrExpected = u"_-* #,##0\" €\"_-;\\-* #,##0\" €\"_-;_-* \"- €\"_-;_-@_-"_ustr; - assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[5]", "formatCode", rFormatStrExpected); + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[5]"_ostr, "formatCode"_ostr, + rFormatStrExpected); // remove escape char in fraction - assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[6]", "formatCode", + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[6]"_ostr, "formatCode"_ostr, "# ?/?;[RED]\\-# #/#####"); } @@ -581,7 +607,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testNatNumInNumberFormatXLSX) xmlDocUniquePtr pDoc = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[3]", "formatCode", + assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[3]"_ostr, "formatCode"_ostr, "[DBNum2][$-804]General;[RED][DBNum2][$-804]General"); } @@ -609,19 +635,19 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testExtendedLCIDXLSX) xmlDocUniquePtr pDocXml = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pDocXml); // Check export - assertXPath(pDocXml, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", + assertXPath(pDocXml, "/x:styleSheet/x:numFmts/x:numFmt[2]"_ostr, "formatCode"_ostr, "[$-107041E]dd\\-mm\\-yyyy"); - assertXPath(pDocXml, "/x:styleSheet/x:numFmts/x:numFmt[3]", "formatCode", + assertXPath(pDocXml, "/x:styleSheet/x:numFmts/x:numFmt[3]"_ostr, "formatCode"_ostr, "[$-D07041E]dd\\-mm\\-yyyy"); - assertXPath(pDocXml, "/x:styleSheet/x:numFmts/x:numFmt[4]", "formatCode", + assertXPath(pDocXml, "/x:styleSheet/x:numFmts/x:numFmt[4]"_ostr, "formatCode"_ostr, "[$-1030411]dd\\-mm\\-ee"); - assertXPath(pDocXml, "/x:styleSheet/x:numFmts/x:numFmt[5]", "formatCode", + assertXPath(pDocXml, "/x:styleSheet/x:numFmts/x:numFmt[5]"_ostr, "formatCode"_ostr, "[$-1B030411]dd\\-mm\\-ee"); - assertXPath(pDocXml, "/x:styleSheet/x:numFmts/x:numFmt[6]", "formatCode", + assertXPath(pDocXml, "/x:styleSheet/x:numFmts/x:numFmt[6]"_ostr, "formatCode"_ostr, "[$-108040D]dd\\-mm\\-yyyy"); - assertXPath(pDocXml, "/x:styleSheet/x:numFmts/x:numFmt[7]", "formatCode", + assertXPath(pDocXml, "/x:styleSheet/x:numFmts/x:numFmt[7]"_ostr, "formatCode"_ostr, "[$-108040D]dd\\-mm\\-yyyy"); - assertXPath(pDocXml, "/x:styleSheet/x:numFmts/x:numFmt[8]", "formatCode", + assertXPath(pDocXml, "/x:styleSheet/x:numFmts/x:numFmt[8]"_ostr, "formatCode"_ostr, "[$-1060401]dd\\-mm\\-yyyy"); // Check import @@ -692,8 +718,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testHyperlinkTargetFrameODS) OUString aTargetFrameExport = getXPath(pDocXml, "/office:document-content/office:body/office:spreadsheet/table:table/" - "table:table-row[2]/table:table-cell[2]/text:p/text:a", - "target-frame-name"); + "table:table-row[2]/table:table-cell[2]/text:p/text:a"_ostr, + "target-frame-name"_ostr); CPPUNIT_ASSERT_EQUAL(OUString("_blank"), aTargetFrameExport); } @@ -721,7 +747,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testKeepSettingsOfBlankRows) CPPUNIT_ASSERT(pSheet); // saved blank row with not default setting in A2 - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 2); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row"_ostr, 2); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf133595) @@ -733,7 +759,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf133595) CPPUNIT_ASSERT(pSheet); // without the fix in place, mc:AlternateContent would have been added to sheet1 - assertXPath(pSheet, "/x:worksheet/mc:AlternateContent", 0); + assertXPath(pSheet, "/x:worksheet/mc:AlternateContent"_ostr, 0); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf134769) @@ -747,12 +773,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf134769) // without the fix in place, the legacyDrawing would have been exported after the checkbox // and Excel would have claimed the document is corrupted // Use their ids to check the order - assertXPath(pSheet, "/x:worksheet/x:drawing", "id", "rId2"); - assertXPath(pSheet, "/x:worksheet/x:legacyDrawing", "id", "rId3"); + assertXPath(pSheet, "/x:worksheet/x:drawing"_ostr, "id"_ostr, "rId2"); + assertXPath(pSheet, "/x:worksheet/x:legacyDrawing"_ostr, "id"_ostr, "rId3"); assertXPath(pSheet, "/x:worksheet/mc:AlternateContent/mc:Choice/x:controls/mc:AlternateContent/" - "mc:Choice/x:control", - "id", "rId4"); + "mc:Choice/x:control"_ostr, + "id"_ostr, "rId4"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf106181) @@ -765,32 +791,32 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf106181) assertXPath(pSheet, "/x:worksheet/mc:AlternateContent/mc:Choice/x:controls/mc:AlternateContent/" - "mc:Choice/x:control", - "name", "Check Box"); + "mc:Choice/x:control"_ostr, + "name"_ostr, "Check Box"); assertXPath(pSheet, "/x:worksheet/mc:AlternateContent/mc:Choice/x:controls/mc:AlternateContent/" - "mc:Choice/x:control/x:controlPr", - "altText", "Check Box 1"); + "mc:Choice/x:control/x:controlPr"_ostr, + "altText"_ostr, "Check Box 1"); xmlDocUniquePtr pDrawing = parseExport("xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing); assertXPath( pDrawing, - "/xdr:wsDr/mc:AlternateContent/mc:Choice/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr", - "name", "Check Box 1"); + "/xdr:wsDr/mc:AlternateContent/mc:Choice/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr"_ostr, + "name"_ostr, "Check Box 1"); assertXPath( pDrawing, - "/xdr:wsDr/mc:AlternateContent/mc:Choice/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr", - "descr", "Check Box"); + "/xdr:wsDr/mc:AlternateContent/mc:Choice/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr"_ostr, + "descr"_ostr, "Check Box"); assertXPath( pDrawing, - "/xdr:wsDr/mc:AlternateContent/mc:Choice/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr", - "hidden", "0"); + "/xdr:wsDr/mc:AlternateContent/mc:Choice/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr"_ostr, + "hidden"_ostr, "0"); xmlDocUniquePtr pVmlDrawing = parseExport("xl/drawings/vmlDrawing1.vml"); CPPUNIT_ASSERT(pVmlDrawing); - assertXPathContent(pVmlDrawing, "//xx:ClientData/xx:FmlaLink", "$D$9"); + assertXPathContent(pVmlDrawing, "//xx:ClientData/xx:FmlaLink"_ostr, "$D$9"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf145057) @@ -801,7 +827,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf145057) xmlDocUniquePtr pDoc = parseExport("xl/tables/table1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "//x:colorFilter", "dxfId", "1"); + assertXPath(pDoc, "//x:colorFilter"_ostr, "dxfId"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf105272) @@ -864,8 +890,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf112936) xmlDocUniquePtr pDoc = parseExport("xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "//x:pivotCacheDefinition", "recordCount", "4"); - assertXPath(pDoc, "//x:pivotCacheDefinition", "createdVersion", "3"); + assertXPath(pDoc, "//x:pivotCacheDefinition"_ostr, "recordCount"_ostr, "4"); + assertXPath(pDoc, "//x:pivotCacheDefinition"_ostr, "createdVersion"_ostr, "3"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testXltxExport) @@ -877,8 +903,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testXltxExport) save("Calc MS Excel 2007 XML Template"); xmlDocUniquePtr pDoc = parseExport("[Content_Types].xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/ContentType:Types/ContentType:Override[@PartName='/xl/workbook.xml']", - "ContentType", + assertXPath(pDoc, "/ContentType:Types/ContentType:Override[@PartName='/xl/workbook.xml']"_ostr, + "ContentType"_ostr, "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"); } @@ -915,8 +941,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf114969XLSX) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[1]", "location", "'1.1.1.1'!C1"); - assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[2]", "location", "'1.1.1.1'!C2"); + assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[1]"_ostr, "location"_ostr, + "'1.1.1.1'!C1"); + assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[2]"_ostr, "location"_ostr, + "'1.1.1.1'!C2"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf115192XLSX) @@ -926,10 +954,11 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf115192XLSX) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/drawings/_rels/drawing1.xml.rels"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']", "TargetMode", + assertXPath(pDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']"_ostr, "TargetMode"_ostr, "External"); - assertXPathNoAttribute(pDoc, "/rels:Relationships/rels:Relationship[@Id='rId2']", "TargetMode"); - assertXPath(pDoc, "/rels:Relationships/rels:Relationship[@Id='rId3']", "TargetMode", + assertXPathNoAttribute(pDoc, "/rels:Relationships/rels:Relationship[@Id='rId2']"_ostr, + "TargetMode"_ostr); + assertXPath(pDoc, "/rels:Relationships/rels:Relationship[@Id='rId3']"_ostr, "TargetMode"_ostr, "External"); } @@ -941,8 +970,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf142764) xmlDocUniquePtr pSheet = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); - assertXPath(pSheet, "/x:worksheet/x:headerFooter", "differentOddEven", "true"); - assertXPath(pSheet, "/x:worksheet/x:headerFooter", "differentFirst", "true"); + assertXPath(pSheet, "/x:worksheet/x:headerFooter"_ostr, "differentOddEven"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:headerFooter"_ostr, "differentFirst"_ostr, "true"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf91634XLSX) @@ -952,14 +981,15 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf91634XLSX) xmlDocUniquePtr pDoc = parseExport("xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:pic/xdr:nvPicPr/xdr:cNvPr/a:hlinkClick", 1); + assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:pic/xdr:nvPicPr/xdr:cNvPr/a:hlinkClick"_ostr, + 1); xmlDocUniquePtr pXmlRels = parseExport("xl/drawings/_rels/drawing1.xml.rels"); CPPUNIT_ASSERT(pXmlRels); - assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target", + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId1']"_ostr, "Target"_ostr, "https://www.google.com/"); - assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId1']", "TargetMode", - "External"); + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId1']"_ostr, + "TargetMode"_ostr, "External"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testValidationCopyPaste) @@ -989,7 +1019,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testValidationCopyPaste) // check validation xmlDocUniquePtr pDocXml = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDocXml); - assertXPathContent(pDocXml, "/x:worksheet/x:dataValidations/x:dataValidation/x:formula1", + assertXPathContent(pDocXml, "/x:worksheet/x:dataValidations/x:dataValidation/x:formula1"_ostr, "#REF!"); } @@ -1002,7 +1032,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf115159) CPPUNIT_ASSERT(pDoc); //assert the existing OOXML built-in name is not duplicated - assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName", 1); + assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName"_ostr, 1); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf112567) @@ -1024,7 +1054,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf112567) CPPUNIT_ASSERT(pDoc); //assert the existing OOXML built-in name is not duplicated - assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName", 1); + assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName"_ostr, 1); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf75702) @@ -1042,7 +1072,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf75702) save("calc8"); xmlDocUniquePtr pContent = parseExport("content.xml"); - assertXPath(pContent, "//table:table-row[1]/table:table-cell/text:p", 2); + assertXPath(pContent, "//table:table-row[1]/table:table-cell/text:p"_ostr, 2); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf103829) @@ -1098,25 +1128,25 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf142881) CPPUNIT_ASSERT(pDrawing1); // Verify that the shapes are rotated and positioned in the expected way - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:from/xdr:col", "11"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:from/xdr:row", "0"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:to/xdr:col", "12"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:to/xdr:row", "19"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:from/xdr:col"_ostr, "11"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:from/xdr:row"_ostr, "0"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:to/xdr:col"_ostr, "12"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:to/xdr:row"_ostr, "19"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:from/xdr:col", "2"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:from/xdr:row", "8"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:to/xdr:col", "7"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:to/xdr:row", "10"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:from/xdr:col"_ostr, "2"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:from/xdr:row"_ostr, "8"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:to/xdr:col"_ostr, "7"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:to/xdr:row"_ostr, "10"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:from/xdr:col", "10"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:from/xdr:row", "9"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:to/xdr:col", "11"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:to/xdr:row", "26"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:from/xdr:col"_ostr, "10"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:from/xdr:row"_ostr, "9"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:to/xdr:col"_ostr, "11"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:to/xdr:row"_ostr, "26"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[4]/xdr:from/xdr:col", "2"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[4]/xdr:from/xdr:row", "17"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[4]/xdr:to/xdr:col", "8"); - assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[4]/xdr:to/xdr:row", "19"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[4]/xdr:from/xdr:col"_ostr, "2"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[4]/xdr:from/xdr:row"_ostr, "17"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[4]/xdr:to/xdr:col"_ostr, "8"); + assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[4]/xdr:to/xdr:row"_ostr, "19"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf112567b) @@ -1138,10 +1168,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf112567b) CPPUNIT_ASSERT(pDoc); //assert the existing OOXML built-in name is not duplicated - assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName", 1); + assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName"_ostr, 1); //and it contains "," instead of ";" - assertXPathContent(pDoc, "/x:workbook/x:definedNames/x:definedName[1]", + assertXPathContent(pDoc, "/x:workbook/x:definedNames/x:definedName[1]"_ostr, "Sheet1!$A:$A,Sheet1!$1:$1"); } @@ -1154,30 +1184,30 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf123645XLSX) CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/" - "a:hlinkClick", + "a:hlinkClick"_ostr, 1); assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/" - "a:hlinkClick", + "a:hlinkClick"_ostr, 1); assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/" - "a:hlinkClick", + "a:hlinkClick"_ostr, 1); xmlDocUniquePtr pXmlRels = parseExport("xl/drawings/_rels/drawing1.xml.rels"); CPPUNIT_ASSERT(pXmlRels); - assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId1']", "TargetMode", - "External"); - assertXPathNoAttribute(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId3']", - "TargetMode"); - assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId5']", "TargetMode", - "External"); - assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target", + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId1']"_ostr, + "TargetMode"_ostr, "External"); + assertXPathNoAttribute(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId3']"_ostr, + "TargetMode"_ostr); + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId5']"_ostr, + "TargetMode"_ostr, "External"); + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId1']"_ostr, "Target"_ostr, "file:///C:/TEMP/test.xlsx"); - assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId3']", "Target", + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId3']"_ostr, "Target"_ostr, "#Sheet2!A1"); - assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId5']", "Target", + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId5']"_ostr, "Target"_ostr, "https://bugs.documentfoundation.org/show_bug.cgi?id=123645"); } @@ -1188,14 +1218,15 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf125173XLSX) xmlDocUniquePtr pDoc = parseExport("xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr/a:hlinkClick", 1); + assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr/a:hlinkClick"_ostr, + 1); xmlDocUniquePtr pXmlRels = parseExport("xl/drawings/_rels/drawing1.xml.rels"); CPPUNIT_ASSERT(pXmlRels); - assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target", + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId1']"_ostr, "Target"_ostr, "http://www.google.com/"); - assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId1']", "TargetMode", - "External"); + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId1']"_ostr, + "TargetMode"_ostr, "External"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf79972XLSX) @@ -1205,13 +1236,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf79972XLSX) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "ref", "A1"); + assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink"_ostr, "ref"_ostr, "A1"); xmlDocUniquePtr pXmlRels = parseExport("xl/worksheets/_rels/sheet1.xml.rels"); CPPUNIT_ASSERT(pXmlRels); - assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship", "Target", + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship"_ostr, "Target"_ostr, "https://bugs.documentfoundation.org/show_bug.cgi?id=79972"); - assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship", "TargetMode", "External"); + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship"_ostr, "TargetMode"_ostr, + "External"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf126024XLSX) @@ -1221,13 +1253,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf126024XLSX) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "ref", "A2"); + assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink"_ostr, "ref"_ostr, "A2"); xmlDocUniquePtr pXmlRels = parseExport("xl/worksheets/_rels/sheet1.xml.rels"); CPPUNIT_ASSERT(pXmlRels); - assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship", "Target", + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship"_ostr, "Target"_ostr, "https://bugs.documentfoundation.org/"); - assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship", "TargetMode", "External"); + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship"_ostr, "TargetMode"_ostr, + "External"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf91332) diff --git a/sc/qa/unit/subsequent_export_test3.cxx b/sc/qa/unit/subsequent_export_test3.cxx index 45e65cf8bed8..1c4f5760bf06 100644 --- a/sc/qa/unit/subsequent_export_test3.cxx +++ b/sc/qa/unit/subsequent_export_test3.cxx @@ -567,60 +567,60 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testTdf133487) // shape in background has lowest index assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" - "table:table-row[1]/table:table-cell[1]/draw:custom-shape", - "z-index", "0"); + "table:table-row[1]/table:table-cell[1]/draw:custom-shape"_ostr, + "z-index"_ostr, "0"); assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" "table:table-row[1]/table:table-cell[1]/draw:custom-shape" - "/attribute::table:table-background", + "/attribute::table:table-background"_ostr, 1); assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" - "table:table-row[1]/table:table-cell[1]/draw:custom-shape", - "table-background", "true"); + "table:table-row[1]/table:table-cell[1]/draw:custom-shape"_ostr, + "table-background"_ostr, "true"); // shape in foreground, previously index 1 assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" - "table:table-row[1]/table:table-cell[2]/draw:custom-shape", - "z-index", "2"); + "table:table-row[1]/table:table-cell[2]/draw:custom-shape"_ostr, + "z-index"_ostr, "2"); // attribute is only written for value "true" assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" "table:table-row[1]/table:table-cell[2]/draw:custom-shape" - "/attribute::table:table-background", + "/attribute::table:table-background"_ostr, 0); // shape in foreground, previously index 0 assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" - "table:table-row[3]/table:table-cell[1]/draw:custom-shape", - "z-index", "1"); + "table:table-row[3]/table:table-cell[1]/draw:custom-shape"_ostr, + "z-index"_ostr, "1"); // attribute is only written for value "true" assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" "table:table-row[3]/table:table-cell[1]/draw:custom-shape" - "/attribute::table:table-background", + "/attribute::table:table-background"_ostr, 0); // shape in foreground, previously index 4 assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" - "table:shapes/draw:custom-shape", - "z-index", "3"); + "table:shapes/draw:custom-shape"_ostr, + "z-index"_ostr, "3"); // attribute is only written for value "true" assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" "table:shapes/draw:custom-shape" - "/attribute::table:table-background", + "/attribute::table:table-background"_ostr, 0); // form control, previously index 3 assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" - "table:shapes/draw:control", - "z-index", "4"); + "table:shapes/draw:control"_ostr, + "z-index"_ostr, "4"); // attribute is only written for value "true" assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table[1]/" "table:shapes/draw:control" - "/attribute::table:table-background", + "/attribute::table:table-background"_ostr, 0); } @@ -921,7 +921,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testCeilingFloorODSToXLSX) CPPUNIT_ASSERT(pSheet); // there shouldn't be any defined names during export of FLOOR and CEILING functions to .xlsx - assertXPath(pSheet, "/x:workbook/x:definedNames", 0); + assertXPath(pSheet, "/x:workbook/x:definedNames"_ostr, 0); } CPPUNIT_TEST_FIXTURE(ScExportTest3, testCeilingFloorXLS) { testCeilingFloor("MS Excel 97"); } @@ -940,8 +940,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testCustomXml) CPPUNIT_ASSERT(pRelsDoc); // Check there is a relation to itemProps1.xml. - assertXPath(pRelsDoc, "/rels:Relationships/rels:Relationship", 1); - assertXPath(pRelsDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target", + assertXPath(pRelsDoc, "/rels:Relationships/rels:Relationship"_ostr, 1); + assertXPath(pRelsDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']"_ostr, "Target"_ostr, "itemProps1.xml"); std::unique_ptr<SvStream> pStream = parseExportStream(maTempFile.GetURL(), "ddp/ddpfile.xen"); @@ -968,8 +968,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testRelativePathsODS) CPPUNIT_ASSERT(pDoc); OUString aURL = getXPath(pDoc, "/office:document-content/office:body/office:spreadsheet/table:table/" - "table:table-row[2]/table:table-cell[2]/text:p/text:a", - "href"); + "table:table-row[2]/table:table-cell[2]/text:p/text:a"_ostr, + "href"_ostr); #ifdef _WIN32 // if the exported document is not on the same drive then the linked document, // there is no way to get a relative URL for the link, because ../X:/ is undefined. @@ -1312,7 +1312,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testSheetTextBoxHyperlinkXLSX) assertXPath( pDoc, - "/xdr:wsDr[1]/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:nvSpPr[1]/xdr:cNvPr[1]/a:hlinkClick[1]", + "/xdr:wsDr[1]/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:nvSpPr[1]/xdr:cNvPr[1]/a:hlinkClick[1]"_ostr, 1); } @@ -1324,7 +1324,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testFontSizeXLSX) xmlDocUniquePtr pDoc = parseExport("xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDoc); OUString fontSize = getXPath( - pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr", "sz"); + pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr"_ostr, + "sz"_ostr); // make sure that the font size is 18 CPPUNIT_ASSERT_EQUAL(OUString("1800"), fontSize); } @@ -1340,8 +1341,9 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testSheetCharacterKerningSpaceXLSX) CPPUNIT_ASSERT(pDoc); OUString CharKerningSpace = getXPath( - pDoc, "/xdr:wsDr[1]/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody[1]/a:p[1]/a:r[1]/a:rPr[1]", - "spc"); + pDoc, + "/xdr:wsDr[1]/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody[1]/a:p[1]/a:r[1]/a:rPr[1]"_ostr, + "spc"_ostr); // make sure that the CharKerning is 1997. CPPUNIT_ASSERT_EQUAL(OUString("1997"), CharKerningSpace); @@ -1356,8 +1358,9 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testSheetCondensedCharacterSpaceXLSX) CPPUNIT_ASSERT(pDoc); OUString CondensedCharSpace = getXPath( - pDoc, "/xdr:wsDr[1]/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody[1]/a:p[1]/a:r[1]/a:rPr[1]", - "spc"); + pDoc, + "/xdr:wsDr[1]/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody[1]/a:p[1]/a:r[1]/a:rPr[1]"_ostr, + "spc"_ostr); // make sure that the CondensedCharSpace is -1002. CPPUNIT_ASSERT_EQUAL(OUString("-1002"), CondensedCharSpace); @@ -1371,27 +1374,32 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testTextUnderlineColorXLSX) xmlDocUniquePtr pDoc = parseExport("xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDoc); // Make sure the underline type is double line - assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr", - "u", "dbl"); + assertXPath(pDoc, + "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr"_ostr, + "u"_ostr, "dbl"); - assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr", - "b", "1"); + assertXPath(pDoc, + "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr"_ostr, + "b"_ostr, "1"); // Make sure that the underline color is RED assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr/a:uFill/" - "a:solidFill/a:srgbClr", - "val", "ff0000"); + "a:solidFill/a:srgbClr"_ostr, + "val"_ostr, "ff0000"); // Make sure the underline type is drawn with heavy line - assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr", - "u", "heavy"); + assertXPath(pDoc, + "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr"_ostr, + "u"_ostr, "heavy"); // tdf#104219 Make sure that uFill is not existing and uFillTx is set. // It mean that color is automatic, should be the same color as the text. assertXPath( - pDoc, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr/a:uFill", 0); - assertXPath(pDoc, - "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr/a:uFillTx", - 1); + pDoc, + "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr/a:uFill"_ostr, 0); + assertXPath( + pDoc, + "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr/a:uFillTx"_ostr, + 1); } CPPUNIT_TEST_FIXTURE(ScExportTest3, testSheetRunParagraphPropertyXLSX) @@ -1402,7 +1410,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testSheetRunParagraphPropertyXLSX) xmlDocUniquePtr pDoc = parseExport("xl/sharedStrings.xml"); CPPUNIT_ASSERT(pDoc); - OUString aColor = getXPath(pDoc, "/x:sst/x:si/x:r[1]/x:rPr[1]/x:color", "rgb"); + OUString aColor = getXPath(pDoc, "/x:sst/x:si/x:r[1]/x:rPr[1]/x:color"_ostr, "rgb"_ostr); CPPUNIT_ASSERT_EQUAL(OUString("FFFF0000"), aColor); } @@ -1413,7 +1421,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testPreserveTextWhitespaceXLSX) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/sharedStrings.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:sst/x:si/x:t", "space", "preserve"); + assertXPath(pDoc, "/x:sst/x:si/x:t"_ostr, "space"_ostr, "preserve"); } CPPUNIT_TEST_FIXTURE(ScExportTest3, testPreserveTextWhitespace2XLSX) @@ -1423,8 +1431,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testPreserveTextWhitespace2XLSX) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/sharedStrings.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:sst/x:si[1]/x:t", "space", "preserve"); - assertXPath(pDoc, "/x:sst/x:si[2]/x:t", "space", "preserve"); + assertXPath(pDoc, "/x:sst/x:si[1]/x:t"_ostr, "space"_ostr, "preserve"); + assertXPath(pDoc, "/x:sst/x:si[2]/x:t"_ostr, "space"_ostr, "preserve"); } CPPUNIT_TEST_FIXTURE(ScExportTest3, testHiddenShapeXLS) @@ -1459,8 +1467,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testHiddenShapeXLSX) save("Calc Office Open XML"); xmlDocUniquePtr pDocXml = parseExport("xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDocXml); - assertXPath(pDocXml, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:nvSpPr/xdr:cNvPr", "hidden", - "1"); + assertXPath(pDocXml, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:nvSpPr/xdr:cNvPr"_ostr, + "hidden"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScExportTest3, testShapeAutofitXLSX) @@ -1472,9 +1480,11 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testShapeAutofitXLSX) CPPUNIT_ASSERT(pDoc); // TextAutoGrowHeight --> "Fit height to text" / "Resize shape to fit text" --> true - assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp/xdr:txBody/a:bodyPr/a:spAutoFit", 1); + assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp/xdr:txBody/a:bodyPr/a:spAutoFit"_ostr, + 1); // TextAutoGrowHeight --> "Fit height to text" / "Resize shape to fit text" --> false - assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:sp/xdr:txBody/a:bodyPr/a:noAutofit", 1); + assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:sp/xdr:txBody/a:bodyPr/a:noAutofit"_ostr, + 1); } CPPUNIT_TEST_FIXTURE(ScExportTest3, testHyperlinkXLSX) @@ -1484,7 +1494,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testHyperlinkXLSX) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/drawings/_rels/drawing1.xml.rels"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/rels:Relationships/rels:Relationship", "Target", "#Sheet2!A1"); + assertXPath(pDoc, "/rels:Relationships/rels:Relationship"_ostr, "Target"_ostr, "#Sheet2!A1"); } CPPUNIT_TEST_FIXTURE(ScExportTest3, testMoveCellAnchoredShapesODS) @@ -1663,7 +1673,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testConditionalFormatRangeListXLSX) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "//x:conditionalFormatting", "sqref", "F4 F10"); + assertXPath(pDoc, "//x:conditionalFormatting"_ostr, "sqref"_ostr, "F4 F10"); } CPPUNIT_TEST_FIXTURE(ScExportTest3, testConditionalFormatContainsTextXLSX) @@ -1672,7 +1682,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testConditionalFormatContainsTextXLSX) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPathContent(pDoc, "//x:conditionalFormatting/x:cfRule/x:formula", + assertXPathContent(pDoc, "//x:conditionalFormatting/x:cfRule/x:formula"_ostr, "NOT(ISERROR(SEARCH(\"test\",A1)))"); } @@ -1693,9 +1703,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testConditionalFormatPriorityCheckXLSX) for (size_t nIdx = 1; nIdx <= 2; ++nIdx) { OString aIdx = OString::number(nIdx); - OUString aCellAddr = getXPath(pDoc, "//x:conditionalFormatting[" + aIdx + "]", "sqref"); + OUString aCellAddr + = getXPath(pDoc, "//x:conditionalFormatting[" + aIdx + "]", "sqref"_ostr); OUString aPriority - = getXPath(pDoc, "//x:conditionalFormatting[" + aIdx + "]/x:cfRule", "priority"); + = getXPath(pDoc, "//x:conditionalFormatting[" + aIdx + "]/x:cfRule", "priority"_ostr); CPPUNIT_ASSERT_MESSAGE("conditionalFormatting sqref must be either A1 or A3", aCellAddr == "A1" || aCellAddr == "A3"); if (aCellAddr == "A1") @@ -1709,7 +1720,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testConditionalFormatPriorityCheckXLSX) = getXPath(pDoc, "//x:extLst/x:ext[1]/x14:conditionalFormattings/x14:conditionalFormatting[" + aIdx + "]/x14:cfRule", - "priority"); + "priority"_ostr); CPPUNIT_ASSERT_MESSAGE("x14:conditionalFormatting sqref must be either A1 or A3", aCellAddr == "A1" || aCellAddr == "A3"); if (aCellAddr == "A1") @@ -1730,7 +1741,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testConditionalFormatOriginXLSX) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); // tdf#124953 : The range-list is B3:C6 F1:G2, origin address in the formula should be B1, not B3. - OUString aFormula = getXPathContent(pDoc, "//x:conditionalFormatting/x:cfRule/x:formula"); + OUString aFormula = getXPathContent(pDoc, "//x:conditionalFormatting/x:cfRule/x:formula"_ostr); CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong origin address in formula", OUString("NOT(ISERROR(SEARCH(\"BAC\",B1)))"), aFormula); } @@ -1859,7 +1870,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testTdf113646) xmlDocUniquePtr pSheet = parseExport("xl/styles.xml"); CPPUNIT_ASSERT(pSheet); - assertXPath(pSheet, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:sz", "val", "36"); + assertXPath(pSheet, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:sz"_ostr, "val"_ostr, "36"); } CPPUNIT_TEST_FIXTURE(ScExportTest3, testDateStandardfilterXLSX) @@ -1871,12 +1882,15 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testDateStandardfilterXLSX) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "//x:autoFilter", "ref", "A1:B6"); - assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "day", "03"); - assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "month", "12"); - assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "year", "2011"); - assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", - "dateTimeGrouping", "day"); + assertXPath(pDoc, "//x:autoFilter"_ostr, "ref"_ostr, "A1:B6"); + assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]"_ostr, "day"_ostr, + "03"); + assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]"_ostr, + "month"_ostr, "12"); + assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]"_ostr, + "year"_ostr, "2011"); + assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]"_ostr, + "dateTimeGrouping"_ostr, "day"); } CPPUNIT_TEST_FIXTURE(ScExportTest3, testNumberFormatODS) diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 390783131733..95c7057aef2d 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -69,13 +69,15 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf126177XLSX) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "location", "Munka1!A5"); + assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink"_ostr, "location"_ostr, "Munka1!A5"); xmlDocUniquePtr pXmlRels = parseExport("xl/worksheets/_rels/sheet1.xml.rels"); CPPUNIT_ASSERT(pXmlRels); - OUString aTarget = getXPath(pXmlRels, "/rels:Relationships/rels:Relationship", "Target"); + OUString aTarget + = getXPath(pXmlRels, "/rels:Relationships/rels:Relationship"_ostr, "Target"_ostr); CPPUNIT_ASSERT(aTarget.endsWith("test.xlsx")); - assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship", "TargetMode", "External"); + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship"_ostr, "TargetMode"_ostr, + "External"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentTextVAlignment) @@ -88,7 +90,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentTextVAlignment) xmlDocUniquePtr pVmlDrawing = parseExport("xl/drawings/vmlDrawing1.vml"); CPPUNIT_ASSERT(pVmlDrawing); - assertXPathContent(pVmlDrawing, "/xml/v:shape/xx:ClientData/xx:TextVAlign", "Center"); + assertXPathContent(pVmlDrawing, "/xml/v:shape/xx:ClientData/xx:TextVAlign"_ostr, "Center"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentTextHAlignment) @@ -101,7 +103,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentTextHAlignment) xmlDocUniquePtr pVmlDrawing = parseExport("xl/drawings/vmlDrawing1.vml"); CPPUNIT_ASSERT(pVmlDrawing); - assertXPathContent(pVmlDrawing, "/xml/v:shape/xx:ClientData/xx:TextHAlign", "Center"); + assertXPathContent(pVmlDrawing, "/xml/v:shape/xx:ClientData/xx:TextHAlign"_ostr, "Center"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testRotatedImageODS) @@ -120,8 +122,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testRotatedImageODS) const OUString sTransform = getXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/" - "table:table/table:shapes/draw:frame", - "transform"); + "table:table/table:shapes/draw:frame"_ostr, + "transform"_ostr); // Attribute transform has the structure skew (...) rotate (...) translate (x y) // parts are separated by blank OUString sTranslate(sTransform.copy(sTransform.lastIndexOf('('))); @@ -147,20 +149,20 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf120177) // no attribute 'value' exist assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table/office:forms/" - "form:form/form:radio[1]", - "value", "1"); + "form:form/form:radio[1]"_ostr, + "value"_ostr, "1"); assertXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:table/office:forms/" - "form:form/form:radio[2]", - "value", "2"); + "form:form/form:radio[2]"_ostr, + "value"_ostr, "2"); const OUString sGroupName1 = getXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/" - "table:table/office:forms/form:form/form:radio[1]", - "group-name"); + "table:table/office:forms/form:form/form:radio[1]"_ostr, + "group-name"_ostr); const OUString sGroupName2 = getXPath(pXmlDoc, "/office:document-content/office:body/office:spreadsheet/" - "table:table/office:forms/form:form/form:radio[2]", - "group-name"); + "table:table/office:forms/form:form/form:radio[2]"_ostr, + "group-name"_ostr); CPPUNIT_ASSERT_EQUAL(sGroupName1, sGroupName2); } @@ -271,7 +273,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf120502) CPPUNIT_ASSERT(pSheet1); // This was 1025 when nMaxCol+1 was 1024 - assertXPath(pSheet1, "/x:worksheet/x:cols/x:col", "max", OUString::number(nMaxCol + 1)); + assertXPath(pSheet1, "/x:worksheet/x:cols/x:col"_ostr, "max"_ostr, + OUString::number(nMaxCol + 1)); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf131372) @@ -283,8 +286,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf131372) xmlDocUniquePtr pSheet = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); - assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row/x:c[1]/x:f", "NA()"); - assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row/x:c[2]/x:f", "#N/A"); + assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row/x:c[1]/x:f"_ostr, "NA()"); + assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row/x:c[2]/x:f"_ostr, "#N/A"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf81470) { @@ -297,12 +300,15 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf81470) xmlDocUniquePtr pHeaders = parseExport("xl/revisions/revisionHeaders.xml"); CPPUNIT_ASSERT(pHeaders); - assertXPath(pHeaders, "/x:headers/x:header[1]", "dateTime", "2014-07-11T13:46:00.000000000Z"); - assertXPath(pHeaders, "/x:headers/x:header[1]", "userName", "Kohei Yoshida"); - assertXPath(pHeaders, "/x:headers/x:header[2]", "dateTime", "2014-07-11T18:38:00.000000000Z"); - assertXPath(pHeaders, "/x:headers/x:header[2]", "userName", "Kohei Yoshida"); - assertXPath(pHeaders, "/x:headers/x:header[3]", "dateTime", "2014-07-11T18:43:00.000000000Z"); - assertXPath(pHeaders, "/x:headers/x:header[3]", "userName", "Kohei Yoshida"); + assertXPath(pHeaders, "/x:headers/x:header[1]"_ostr, "dateTime"_ostr, + "2014-07-11T13:46:00.000000000Z"); + assertXPath(pHeaders, "/x:headers/x:header[1]"_ostr, "userName"_ostr, "Kohei Yoshida"); + assertXPath(pHeaders, "/x:headers/x:header[2]"_ostr, "dateTime"_ostr, + "2014-07-11T18:38:00.000000000Z"); + assertXPath(pHeaders, "/x:headers/x:header[2]"_ostr, "userName"_ostr, "Kohei Yoshida"); + assertXPath(pHeaders, "/x:headers/x:header[3]"_ostr, "dateTime"_ostr, + "2014-07-11T18:43:00.000000000Z"); + assertXPath(pHeaders, "/x:headers/x:header[3]"_ostr, "userName"_ostr, "Kohei Yoshida"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf122331) @@ -314,9 +320,9 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf122331) xmlDocUniquePtr pSheet = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); - assertXPath(pSheet, "/x:worksheet/x:sheetPr", "filterMode", "true"); - assertXPath(pSheet, "/x:worksheet/x:autoFilter", "ref", "A1:B761"); - assertXPath(pSheet, "/x:worksheet/x:autoFilter/x:filterColumn", "colId", "1"); + assertXPath(pSheet, "/x:worksheet/x:sheetPr"_ostr, "filterMode"_ostr, "true"); + assertXPath(pSheet, "/x:worksheet/x:autoFilter"_ostr, "ref"_ostr, "A1:B761"); + assertXPath(pSheet, "/x:worksheet/x:autoFilter/x:filterColumn"_ostr, "colId"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf83779) @@ -329,8 +335,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf83779) xmlDocUniquePtr pVmlDrawing = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pVmlDrawing); - assertXPathContent(pVmlDrawing, "/x:worksheet/x:sheetData/x:row[1]/x:c/x:f", "FALSE()"); - assertXPathContent(pVmlDrawing, "/x:worksheet/x:sheetData/x:row[2]/x:c/x:f", "TRUE()"); + assertXPathContent(pVmlDrawing, "/x:worksheet/x:sheetData/x:row[1]/x:c/x:f"_ostr, "FALSE()"); + assertXPathContent(pVmlDrawing, "/x:worksheet/x:sheetData/x:row[2]/x:c/x:f"_ostr, "TRUE()"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf121715_FirstPageHeaderFooterXLSX) @@ -342,9 +348,11 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf121715_FirstPageHeaderFooterXLSX) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:worksheet/x:headerFooter", "differentFirst", "true"); - assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:firstHeader", "&CFirst Page Header"); - assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:firstFooter", "&CFirst Page Footer"); + assertXPath(pDoc, "/x:worksheet/x:headerFooter"_ostr, "differentFirst"_ostr, "true"); + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:firstHeader"_ostr, + "&CFirst Page Header"); + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:firstFooter"_ostr, + "&CFirst Page Footer"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf121716_ExportEvenHeaderFooterXLSX) @@ -359,22 +367,24 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf121716_ExportEvenHeaderFooterXLSX) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:worksheet/x:headerFooter", "differentOddEven", "true"); - assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", + assertXPath(pDoc, "/x:worksheet/x:headerFooter"_ostr, "differentOddEven"_ostr, "true"); + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader"_ostr, "&Lodd/right&Cpage&Rheader"); - assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", "&Lboth&C&12page&Rfooter"); - assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenHeader", + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter"_ostr, + "&Lboth&C&12page&Rfooter"); + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenHeader"_ostr, "&Lpage&Cheader&Reven/left"); - assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenFooter", "&Lboth&C&12page&Rfooter"); + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenFooter"_ostr, + "&Lboth&C&12page&Rfooter"); pDoc = parseExport("xl/worksheets/sheet2.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:worksheet/x:headerFooter", "differentOddEven", "true"); - assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", "&Coddh"); - assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", "&Coddf"); - assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenHeader", "&Cevenh"); - assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenFooter", "&Levenf"); + assertXPath(pDoc, "/x:worksheet/x:headerFooter"_ostr, "differentOddEven"_ostr, "true"); + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader"_ostr, "&Coddh"); + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter"_ostr, "&Coddf"); + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenHeader"_ostr, "&Cevenh"); + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenFooter"_ostr, "&Levenf"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf134459_HeaderFooterColorXLSX) @@ -386,9 +396,9 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf134459_HeaderFooterColorXLSX) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader"_ostr, "&L&Kc06040l&C&K4c3789c&Rr"); - assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter"_ostr, "&Ll&C&K64cf5fc&R&Kcd15aar"); } @@ -401,9 +411,9 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf134817_HeaderFooterTextWith2SectionXL xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader"_ostr, "&L&\"Abadi,Regular\"&11aaa&\"Bembo,Regular\"&20bbb"); - assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", + assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter"_ostr, "&R&\"Cambria,Regular\"&14camb&\"Dante,Regular\"&18dant"); } @@ -416,14 +426,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf121718_UseFirstPageNumberXLSX) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:worksheet/x:pageSetup", "useFirstPageNumber", "true"); - assertXPath(pDoc, "/x:worksheet/x:pageSetup", "firstPageNumber", "10"); + assertXPath(pDoc, "/x:worksheet/x:pageSetup"_ostr, "useFirstPageNumber"_ostr, "true"); + assertXPath(pDoc, "/x:worksheet/x:pageSetup"_ostr, "firstPageNumber"_ostr, "10"); pDoc = parseExport("xl/worksheets/sheet2.xml"); CPPUNIT_ASSERT(pDoc); - assertXPathNoAttribute(pDoc, "/x:worksheet/x:pageSetup", "useFirstPageNumber"); - assertXPathNoAttribute(pDoc, "/x:worksheet/x:pageSetup", "firstPageNumber"); + assertXPathNoAttribute(pDoc, "/x:worksheet/x:pageSetup"_ostr, "useFirstPageNumber"_ostr); + assertXPathNoAttribute(pDoc, "/x:worksheet/x:pageSetup"_ostr, "firstPageNumber"_ostr); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testHeaderFontStyleXLSX) @@ -492,16 +502,20 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf135828_Shape_Rect) CPPUNIT_ASSERT(pDrawing); double nXPosOfTopleft - = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:off", "x") + = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:off"_ostr, + "x"_ostr) .toDouble(); double nYPosOfTopleft - = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:off", "y") + = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:off"_ostr, + "y"_ostr) .toDouble(); double nWidth - = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx") + = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext"_ostr, + "cx"_ostr) .toDouble(); double nHeight - = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy") + = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext"_ostr, + "cy"_ostr) .toDouble(); CPPUNIT_ASSERT_DOUBLES_EQUAL(854640, nXPosOfTopleft, 10000); @@ -574,7 +588,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf123353) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:worksheet/x:autoFilter/x:filterColumn/x:filters", "blank", "1"); + assertXPath(pDoc, "/x:worksheet/x:autoFilter/x:filterColumn/x:filters"_ostr, "blank"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf140098) @@ -586,7 +600,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf140098) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:worksheet/x:autoFilter/x:filterColumn/x:filters", "blank", "1"); + assertXPath(pDoc, "/x:worksheet/x:autoFilter/x:filterColumn/x:filters"_ostr, "blank"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf133688_precedents) @@ -599,7 +613,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf133688_precedents) CPPUNIT_ASSERT(pDrawing); // We do not export any shapes. - assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor[1]", 0); + assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor[1]"_ostr, 0); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf91251_missingOverflowRoundtrip) @@ -613,10 +627,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf91251_missingOverflowRoundtrip) xmlDocUniquePtr pDrawing = parseExport("xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing); - assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr", "horzOverflow", - "clip"); - assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr", "horzOverflow", - "clip"); + assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr"_ostr, + "horzOverflow"_ostr, "clip"); + assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr"_ostr, + "horzOverflow"_ostr, "clip"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf137000_handle_upright) @@ -631,7 +645,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf137000_handle_upright) xmlDocUniquePtr pDrawing = parseExport("xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing); - assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr", "upright", "1"); + assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr"_ostr, + "upright"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf126305_DataValidatyErrorAlert) @@ -642,10 +657,11 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf126305_DataValidatyErrorAlert) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[1]", "errorStyle", "stop"); - assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[2]", "errorStyle", + assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[1]"_ostr, "errorStyle"_ostr, + "stop"); + assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[2]"_ostr, "errorStyle"_ostr, "warning"); - assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[3]", "errorStyle", + assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[3]"_ostr, "errorStyle"_ostr, "information"); } @@ -779,7 +795,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf138824_linkToParentDirectory) CPPUNIT_ASSERT(pDocXml); // test also the Linux specific bug tdf#121472 - assertXPath(pDocXml, "/rels:Relationships/rels:Relationship", "Target", + assertXPath(pDocXml, "/rels:Relationships/rels:Relationship"_ostr, "Target"_ostr, "../tdf138824_externalSource.ods"); } @@ -844,7 +860,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf136721_paper_size) xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/x:worksheet/x:pageSetup", "paperSize", "70"); + assertXPath(pDoc, "/x:worksheet/x:pageSetup"_ostr, "paperSize"_ostr, "70"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf139258_rotated_image) @@ -857,10 +873,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf139258_rotated_image) xmlDocUniquePtr pDrawing = parseExport("xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing); - assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:col", "1"); - assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:row", "12"); - assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:col", "6"); - assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:row", "25"); + assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:col"_ostr, "1"); + assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:row"_ostr, "12"); + assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:col"_ostr, "6"); + assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:row"_ostr, "25"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf144642_RowHeightRounding) @@ -906,11 +922,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf151755_stylesLostOnXLSXExport) CPPUNIT_ASSERT(pSheet); // Check if all the 3 empty cells with styles are saved, and have the same style id. - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c", 4); - OUString aCellStyleId = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[2]", "s"); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[2]", "s", aCellStyleId); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[3]", "s", aCellStyleId); - assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[4]", "s", aCellStyleId); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c"_ostr, 4); + OUString aCellStyleId + = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[2]"_ostr, "s"_ostr); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[2]"_ostr, "s"_ostr, aCellStyleId); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[3]"_ostr, "s"_ostr, aCellStyleId); + assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[4]"_ostr, "s"_ostr, aCellStyleId); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf152581_bordercolorNotExportedToXLSX) @@ -923,7 +940,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf152581_bordercolorNotExportedToXLSX) CPPUNIT_ASSERT(pStyles); // Check if conditional format border color is exported - assertXPath(pStyles, "/x:styleSheet/x:dxfs/x:dxf/x:border/x:left/x:color", "theme", "5"); + assertXPath(pStyles, "/x:styleSheet/x:dxfs/x:dxf/x:border/x:left/x:color"_ostr, "theme"_ostr, + "5"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf140431) @@ -953,7 +971,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testCheckboxFormControlXlsxExport) xmlDocUniquePtr pDoc = parseExport("xl/drawings/vmlDrawing1.vml"); // Without the fix in place, this test would have failed as there was no such stream. CPPUNIT_ASSERT(pDoc); - assertXPathContent(pDoc, "/xml/v:shape/xx:ClientData/xx:Anchor", "1, 22, 3, 3, 3, 30, 6, 1"); + assertXPathContent(pDoc, "/xml/v:shape/xx:ClientData/xx:Anchor"_ostr, + "1, 22, 3, 3, 3, 30, 6, 1"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testButtonFormControlXlsxExport) @@ -970,16 +989,16 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testButtonFormControlXlsxExport) // Without the fix in place, this test would have failed with: // - XPath '//x:anchor/x:from/xdr:col' not found // i.e. the control markup was missing, the button was lost on export. - assertXPathContent(pDoc, "//x:anchor/x:from/xdr:col", "1"); - assertXPathContent(pDoc, "//x:anchor/x:from/xdr:row", "3"); - assertXPathContent(pDoc, "//x:anchor/x:to/xdr:col", "3"); - assertXPathContent(pDoc, "//x:anchor/x:to/xdr:row", "7"); + assertXPathContent(pDoc, "//x:anchor/x:from/xdr:col"_ostr, "1"); + assertXPathContent(pDoc, "//x:anchor/x:from/xdr:row"_ostr, "3"); + assertXPathContent(pDoc, "//x:anchor/x:to/xdr:col"_ostr, "3"); + assertXPathContent(pDoc, "//x:anchor/x:to/xdr:row"_ostr, "7"); // Also make sure that an empty macro attribute is not written. // Without the fix in place, this test would have failed with: // - XPath '//x:controlPr' unexpected 'macro' attribute // i.e. macro in an xlsx file was not omitted, which is considered invalid by Excel. - assertXPathNoAttribute(pDoc, "//x:controlPr", "macro"); + assertXPathNoAttribute(pDoc, "//x:controlPr"_ostr, "macro"_ostr); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf142929_filterLessThanXLSX) @@ -990,8 +1009,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf142929_filterLessThanXLSX) save("Calc Office Open XML"); xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "//x:customFilters/x:customFilter", "val", "2"); - assertXPath(pDoc, "//x:customFilters/x:customFilter", "operator", "lessThan"); + assertXPath(pDoc, "//x:customFilters/x:customFilter"_ostr, "val"_ostr, "2"); + assertXPath(pDoc, "//x:customFilters/x:customFilter"_ostr, "operator"_ostr, "lessThan"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testInvalidNamedRange) @@ -1053,19 +1072,20 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testExternalDefinedNameXLSX) xmlDocUniquePtr pDocXml = parseExport("xl/externalLinks/externalLink1.xml"); CPPUNIT_ASSERT(pDocXml); - assertXPath(pDocXml, "/x:externalLink/x:externalBook/x:sheetNames/x:sheetName", "val", + assertXPath(pDocXml, "/x:externalLink/x:externalBook/x:sheetNames/x:sheetName"_ostr, "val"_ostr, "Munka1"); - assertXPath(pDocXml, "/x:externalLink/x:externalBook/x:definedNames/x:definedName", "name", - "MonthNames"); + assertXPath(pDocXml, "/x:externalLink/x:externalBook/x:definedNames/x:definedName"_ostr, + "name"_ostr, "MonthNames"); // TODO: no need for the [1] external document identifier - assertXPath(pDocXml, "/x:externalLink/x:externalBook/x:definedNames/x:definedName", "refersTo", - "[1]Munka1!$A$2:$A$13"); - assertXPath(pDocXml, "/x:externalLink/x:externalBook/x:sheetDataSet/x:sheetData", "sheetId", - "0"); - assertXPath(pDocXml, "/x:externalLink/x:externalBook/x:sheetDataSet/x:sheetData/x:row[2]", "r", - "3"); + assertXPath(pDocXml, "/x:externalLink/x:externalBook/x:definedNames/x:definedName"_ostr, + "refersTo"_ostr, "[1]Munka1!$A$2:$A$13"); + assertXPath(pDocXml, "/x:externalLink/x:externalBook/x:sheetDataSet/x:sheetData"_ostr, + "sheetId"_ostr, "0"); + assertXPath(pDocXml, "/x:externalLink/x:externalBook/x:sheetDataSet/x:sheetData/x:row[2]"_ostr, + "r"_ostr, "3"); assertXPathContent( - pDocXml, "/x:externalLink/x:externalBook/x:sheetDataSet/x:sheetData/x:row[2]/x:cell/x:v", + pDocXml, + "/x:externalLink/x:externalBook/x:sheetDataSet/x:sheetData/x:row[2]/x:cell/x:v"_ostr, "February"); } @@ -1078,11 +1098,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testHyperlinkLocationXLSX) CPPUNIT_ASSERT(pDoc); // tdf#143220 link to sheet not valid without cell reference - assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[@ref='A1']", "location", "Sheet2!A1"); + assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[@ref='A1']"_ostr, "location"_ostr, + "Sheet2!A1"); // tdf#145079 link with defined name target didn't work because Calc added "A1" at the end - assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[@ref='A2']", "location", "name"); - assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[@ref='A3']", "location", "db"); + assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[@ref='A2']"_ostr, "location"_ostr, + "name"); + assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[@ref='A3']"_ostr, "location"_ostr, + "db"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf142264ManyChartsToXLSX) @@ -1224,14 +1247,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf143929MultiColumnToODS) assertXPath( pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:family='graphic']/" - "style:graphic-properties/style:columns", - "column-count", "2"); + "style:graphic-properties/style:columns"_ostr, + "column-count"_ostr, "2"); // Only test that "column-gap" attribute exists, not its value that depends on locale (cm, in) getXPath( pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:family='graphic']/" - "style:graphic-properties/style:columns", - "column-gap"); + "style:graphic-properties/style:columns"_ostr, + "column-gap"_ostr); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf142578) @@ -1244,13 +1267,16 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf142578) // Get DxfId for color filter sal_Int32 nDxfIdColorFilter - = getXPath(pSheet, "/x:worksheet/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId") + = getXPath(pSheet, "/x:worksheet/x:autoFilter/x:filterColumn/x:colorFilter"_ostr, + "dxfId"_ostr) .toInt32() + 1; // Get DxfId for conditional formatting sal_Int32 nDxfIdCondFormat - = getXPath(pSheet, "/x:worksheet/x:conditionalFormatting/x:cfRule", "dxfId").toInt32() + 1; + = getXPath(pSheet, "/x:worksheet/x:conditionalFormatting/x:cfRule"_ostr, "dxfId"_ostr) + .toInt32() + + 1; // Ensure they are using different dxfs CPPUNIT_ASSERT_MESSAGE("dxfID's should be different!", nDxfIdColorFilter != nDxfIdCondFormat); @@ -1261,11 +1287,11 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf142578) OString sDxfColorFilterXPath("/x:styleSheet/x:dxfs/x:dxf[" + OString::number(nDxfIdColorFilter) + "]/x:fill/x:patternFill/x:fgColor"); - assertXPath(pStyles, sDxfColorFilterXPath, "rgb", "FF81D41A"); + assertXPath(pStyles, sDxfColorFilterXPath, "rgb"_ostr, "FF81D41A"); OString sDxfCondFormatXPath("/x:styleSheet/x:dxfs/x:dxf[" + OString::number(nDxfIdCondFormat) + "]/x:fill/x:patternFill/x:bgColor"); - assertXPath(pStyles, sDxfCondFormatXPath, "rgb", "FFFFCCCC"); + assertXPath(pStyles, sDxfCondFormatXPath, "rgb"_ostr, "FFFFCCCC"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf145059) @@ -1280,7 +1306,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf145059) CPPUNIT_ASSERT(pStyle); sal_Int32 nColorFilterDxdId - = getXPath(pSheet, "/x:worksheet/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId") + = getXPath(pSheet, "/x:worksheet/x:autoFilter/x:filterColumn/x:colorFilter"_ostr, + "dxfId"_ostr) .toInt32(); // Ensure that dxf id is not -1 @@ -1289,7 +1316,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf145059) // Find color by this dxfid OString sDxfIdPath = "/x:styleSheet/x:dxfs/x:dxf[" + OString::number(nColorFilterDxdId + 1) + "]/x:fill/x:patternFill/x:fgColor"; - assertXPath(pStyle, sDxfIdPath, "rgb", "FF4472C4"); + assertXPath(pStyle, sDxfIdPath, "rgb"_ostr, "FF4472C4"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf130104_XLSXIndent) @@ -1307,73 +1334,80 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf130104_XLSXIndent) // Get the style index number for cell A1 sal_Int32 nCellA1StyleIndex - = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]/x:c[1]", "s").toInt32() + 1; + = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]/x:c[1]"_ostr, "s"_ostr).toInt32() + 1; // The indent for cell A1 should be 0 OString sStyleA1XPath = "/x:styleSheet/x:cellXfs/x:xf[" + OString::number(nCellA1StyleIndex) + "]/x:alignment"; // (if this assertion fails, you should first check whether there is no style index set for this cell) - assertXPath(pStyle, sStyleA1XPath, "indent", "0"); + assertXPath(pStyle, sStyleA1XPath, "indent"_ostr, "0"); sal_Int32 nCellA3StyleIndex - = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]/x:c[1]", "s").toInt32() + 1; + = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]/x:c[1]"_ostr, "s"_ostr).toInt32() + 1; // The indent for cell A3 should be 1 OString sStyleA3XPath = "/x:styleSheet/x:cellXfs/x:xf[" + OString::number(nCellA3StyleIndex) + "]/x:alignment"; - assertXPath(pStyle, sStyleA3XPath, "indent", "1"); + assertXPath(pStyle, sStyleA3XPath, "indent"_ostr, "1"); sal_Int32 nCellA6StyleIndex - = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[6]/x:c[1]", "s").toInt32() + 1; + = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[6]/x:c[1]"_ostr, "s"_ostr).toInt32() + 1; OString sStyleA6XPath = "/x:styleSheet/x:cellXfs/x:xf[" + OString::number(nCellA6StyleIndex) + "]/x:alignment"; - assertXPath(pStyle, sStyleA6XPath, "indent", "2"); + assertXPath(pStyle, sStyleA6XPath, "indent"_ostr, "2"); sal_Int32 nCellA9StyleIndex - = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[9]/x:c[1]", "s").toInt32() + 1; + = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[9]/x:c[1]"_ostr, "s"_ostr).toInt32() + 1; OString sStyleA9XPath = "/x:styleSheet/x:cellXfs/x:xf[" + OString::number(nCellA9StyleIndex) + "]/x:alignment"; - assertXPath(pStyle, sStyleA9XPath, "indent", "3"); + assertXPath(pStyle, sStyleA9XPath, "indent"_ostr, "3"); sal_Int32 nCellA12StyleIndex - = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[12]/x:c[1]", "s").toInt32() + 1; + = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[12]/x:c[1]"_ostr, "s"_ostr).toInt32() + + 1; OString sStyleA12XPath = "/x:styleSheet/x:cellXfs/x:xf[" + OString::number(nCellA12StyleIndex) + "]/x:alignment"; - assertXPath(pStyle, sStyleA12XPath, "indent", "4"); + assertXPath(pStyle, sStyleA12XPath, "indent"_ostr, "4"); sal_Int32 nCellA15StyleIndex - = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[15]/x:c[1]", "s").toInt32() + 1; + = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[15]/x:c[1]"_ostr, "s"_ostr).toInt32() + + 1; OString sStyleA15XPath = "/x:styleSheet/x:cellXfs/x:xf[" + OString::number(nCellA15StyleIndex) + "]/x:alignment"; - assertXPath(pStyle, sStyleA15XPath, "indent", "5"); + assertXPath(pStyle, sStyleA15XPath, "indent"_ostr, "5"); sal_Int32 nCellA18StyleIndex - = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[18]/x:c[1]", "s").toInt32() + 1; + = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[18]/x:c[1]"_ostr, "s"_ostr).toInt32() + + 1; OString sStyleA18XPath = "/x:styleSheet/x:cellXfs/x:xf[" + OString::number(nCellA18StyleIndex) + "]/x:alignment"; - assertXPath(pStyle, sStyleA18XPath, "indent", "6"); + assertXPath(pStyle, sStyleA18XPath, "indent"_ostr, "6"); sal_Int32 nCellA21StyleIndex - = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[21]/x:c[1]", "s").toInt32() + 1; + = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[21]/x:c[1]"_ostr, "s"_ostr).toInt32() + + 1; OString sStyleA21XPath = "/x:styleSheet/x:cellXfs/x:xf[" + OString::number(nCellA21StyleIndex) + "]/x:alignment"; - assertXPath(pStyle, sStyleA21XPath, "indent", "7"); + assertXPath(pStyle, sStyleA21XPath, "indent"_ostr, "7"); sal_Int32 nCellA24StyleIndex - = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[24]/x:c[1]", "s").toInt32() + 1; + = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[24]/x:c[1]"_ostr, "s"_ostr).toInt32() + + 1; OString sStyleA24XPath = "/x:styleSheet/x:cellXfs/x:xf[" + OString::number(nCellA24StyleIndex) + "]/x:alignment"; - assertXPath(pStyle, sStyleA24XPath, "indent", "8"); + assertXPath(pStyle, sStyleA24XPath, "indent"_ostr, "8"); sal_Int32 nCellA27StyleIndex - = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[27]/x:c[1]", "s").toInt32() + 1; + = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[27]/x:c[1]"_ostr, "s"_ostr).toInt32() + + 1; OString sStyleA27XPath = "/x:styleSheet/x:cellXfs/x:xf[" + OString::number(nCellA27StyleIndex) + "]/x:alignment"; - assertXPath(pStyle, sStyleA27XPath, "indent", "9"); + assertXPath(pStyle, sStyleA27XPath, "indent"_ostr, "9"); sal_Int32 nCellA30StyleIndex - = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[30]/x:c[1]", "s").toInt32() + 1; + = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row[30]/x:c[1]"_ostr, "s"_ostr).toInt32() + + 1; OString sStyleA30XPath = "/x:styleSheet/x:cellXfs/x:xf[" + OString::number(nCellA30StyleIndex) + "]/x:alignment"; - assertXPath(pStyle, sStyleA30XPath, "indent", "10"); + assertXPath(pStyle, sStyleA30XPath, "indent"_ostr, "10"); } CPPUNIT_TEST_FIXTURE(ScExportTest4, testWholeRowBold) @@ -1439,10 +1473,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf148820) CPPUNIT_ASSERT(pSheet); sal_Int32 nDxfIdCondFormatFirst - = getXPath(pSheet, "/x:worksheet/x:conditionalFormatting[1]/x:cfRule", "dxfId").toInt32() + = getXPath(pSheet, "/x:worksheet/x:conditionalFormatting[1]/x:cfRule"_ostr, "dxfId"_ostr) + .toInt32() + 1; sal_Int32 nDxfIdCondFormatLast - = getXPath(pSheet, "/x:worksheet/x:conditionalFormatting[20]/x:cfRule", "dxfId").toInt32() + = getXPath(pSheet, "/x:worksheet/x:conditionalFormatting[20]/x:cfRule"_ostr, "dxfId"_ostr) + .toInt32() + 1; xmlDocUniquePtr pStyles = parseExport("xl/styles.xml"); @@ -1451,11 +1487,11 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf148820) OString sDxfCondFormatXPath("/x:styleSheet/x:dxfs/x:dxf[" + OString::number(nDxfIdCondFormatFirst) + "]/x:fill/x:patternFill/x:bgColor"); - assertXPath(pStyles, sDxfCondFormatXPath, "rgb", "FF53B5A9"); + assertXPath(pStyles, sDxfCondFormatXPath, "rgb"_ostr, "FF53B5A9"); sDxfCondFormatXPath = OString("/x:styleSheet/x:dxfs/x:dxf[" + OString::number(nDxfIdCondFormatLast) + "]/x:fill/x:patternFill/x:bgColor"); - assertXPath(pStyles, sDxfCondFormatXPath, "rgb", "FFA30000"); + assertXPath(pStyles, sDxfCondFormatXPath, "rgb"_ostr, "FFA30000"); } namespace @@ -1555,8 +1591,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTotalsRowFunction) { xmlDocUniquePtr pDocXml = parseExport("xl/tables/table1.xml"); CPPUNIT_ASSERT(pDocXml); - assertXPath(pDocXml, "/x:table/x:tableColumns/x:tableColumn[5]", "totalsRowFunction", - "sum"); + assertXPath(pDocXml, "/x:table/x:tableColumns/x:tableColumn[5]"_ostr, + "totalsRowFunction"_ostr, "sum"); } ScDocument* pDoc = getScDoc(); pDoc->InsertCol(ScRange(3, 0, 0, 3, pDoc->MaxRow(), 0)); // Insert col 4 @@ -1564,10 +1600,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTotalsRowFunction) { xmlDocUniquePtr pDocXml = parseExport("xl/tables/table1.xml"); CPPUNIT_ASSERT(pDocXml); - assertXPathNoAttribute(pDocXml, "/x:table/x:tableColumns/x:tableColumn[5]", - "totalsRowFunction"); - assertXPath(pDocXml, "/x:table/x:tableColumns/x:tableColumn[6]", "totalsRowFunction", - "sum"); + assertXPathNoAttribute(pDocXml, "/x:table/x:tableColumns/x:tableColumn[5]"_ostr, + "totalsRowFunction"_ostr); + assertXPath(pDocXml, "/x:table/x:tableColumns/x:tableColumn[6]"_ostr, + "totalsRowFunction"_ostr, "sum"); } } @@ -1581,7 +1617,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testAutofilterHiddenButton) { OString sPath = OString::Concat("/x:table/x:autoFilter/x:filterColumn[") + OString::number(i) + "]"; - assertXPath(pDocXml, sPath, "hiddenButton", "1"); + assertXPath(pDocXml, sPath, "hiddenButton"_ostr, "1"); } } diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index d1f7152793c6..b27664e5df41 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -162,8 +162,8 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testRowColumnSelections) dispatchCommand(mxComponent, ".uno:SelectRow", aArgs); // Check if it is selected - OString aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"); - OString aExpected("1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n"); + OString aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"_ostr); + OString aExpected("1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n"_ostr); CPPUNIT_ASSERT_EQUAL(aExpected, aResult); // Select the 10th row with shift modifier @@ -172,7 +172,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testRowColumnSelections) dispatchCommand(mxComponent, ".uno:SelectRow", aArgs); // Check if all the rows from 5th to 10th get selected - aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"); + aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"_ostr); aExpected = "1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\n3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\n4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\n5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\n6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\t26\n"; CPPUNIT_ASSERT_EQUAL(aExpected, aResult); @@ -183,7 +183,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testRowColumnSelections) // When we copy this, we don't get anything useful, but we must not crash // (used to happen) - aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"); + aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"_ostr); CPPUNIT_ASSERT_EQUAL(OString(), aResult); // TODO check that we really selected what we wanted here @@ -195,7 +195,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testRowColumnSelections) // When we copy this, we don't get anything useful, but we must not crash // (used to happen) - aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"); + aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"_ostr); CPPUNIT_ASSERT_EQUAL(OString(), aResult); // TODO check that we really selected what we wanted here @@ -217,7 +217,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testRowColumnSelections) dispatchCommand(mxComponent, ".uno:SelectRow", aArgs); // only row 5 should remain selected - aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"); + aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"_ostr); aExpected = "1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n"; CPPUNIT_ASSERT_EQUAL(aExpected, aResult); } @@ -277,7 +277,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testEmptyColumnSelection) dispatchCommand(mxComponent, ".uno:SelectColumn", aArgs); // should be an empty string - CPPUNIT_ASSERT_EQUAL(OString(), apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8")); + CPPUNIT_ASSERT_EQUAL(OString(), apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"_ostr)); } namespace @@ -1574,7 +1574,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testIMESupport) pView->SetCursor(0, 0); // sequence of chinese IME compositions when 'nihao' is typed in an IME - const std::vector<OString> aUtf8Inputs{ "年", "你", "你好", "你哈", "你好", "你好" }; + const std::vector<OString> aUtf8Inputs{ "年"_ostr, "你"_ostr, "你好"_ostr, "你哈"_ostr, "你好"_ostr, "你好"_ostr }; std::vector<OUString> aInputs; std::transform(aUtf8Inputs.begin(), aUtf8Inputs.end(), std::back_inserter(aInputs), [](OString aInput) { @@ -2024,9 +2024,9 @@ struct SheetDimData }; const SpanListWithKey aPairList[] = { - { "sizes", aSizes }, - { "hidden", aHidden }, - { "filtered", aFiltered } + { "sizes"_ostr, aSizes }, + { "hidden"_ostr, aHidden }, + { "filtered"_ostr, aFiltered } }; for (const auto& rEntry : aPairList) @@ -2082,7 +2082,7 @@ public: std::stringstream aStream((std::string(rJSON))); boost::property_tree::read_json(aStream, aTree); - CPPUNIT_ASSERT_EQUAL(OString(".uno:SheetGeometryData"), OString(aTree.get<std::string>("commandName"))); + CPPUNIT_ASSERT_EQUAL(".uno:SheetGeometryData"_ostr, OString(aTree.get<std::string>("commandName"))); aCols.testPropertyTree(aTree.get_child("columns"), true); aRows.testPropertyTree(aTree.get_child("rows"), false); @@ -2317,7 +2317,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testDeleteCellMultilineContent) Scheduler::ProcessEventsToIdle(); // check if the row header has been invalidated and if the involved row is of the expected height - CPPUNIT_ASSERT_EQUAL(OString("row"), aView1.m_sInvalidateHeader); + CPPUNIT_ASSERT_EQUAL("row"_ostr, aView1.m_sInvalidateHeader); sal_uInt16 nRow2Height = rDoc.GetRowHeight(static_cast<SCROW>(0), static_cast<SCTAB>(0), false); CPPUNIT_ASSERT_EQUAL(nRow1Height, nRow2Height); SfxViewShell::Current()->setLibreOfficeKitViewCallback(nullptr); @@ -2375,7 +2375,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testPasteIntoWrapTextCell) Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(sCopyContent, pDoc->GetString(0, 1, 0)); - CPPUNIT_ASSERT_EQUAL(OString("rows sizes"), aView.m_sInvalidateSheetGeometry); + CPPUNIT_ASSERT_EQUAL("rows sizes"_ostr, aView.m_sInvalidateSheetGeometry); // create new source text in A2 OUString sCopyContent2("Very long text to copy 2"); @@ -2405,7 +2405,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testPasteIntoWrapTextCell) // SG invalidations for all CPPUNIT_ASSERT_EQUAL(sCopyContent2, pDoc->GetString(0, 1, 0)); - CPPUNIT_ASSERT_EQUAL(OString("all"), aView.m_sInvalidateSheetGeometry); + CPPUNIT_ASSERT_EQUAL("all"_ostr, aView.m_sInvalidateSheetGeometry); SfxViewShell::Current()->setLibreOfficeKitViewCallback(nullptr); } @@ -2437,7 +2437,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testSortAscendingDescending) } Scheduler::ProcessEventsToIdle(); - CPPUNIT_ASSERT_EQUAL(OString("rows"), aView.m_sInvalidateSheetGeometry); + CPPUNIT_ASSERT_EQUAL("rows"_ostr, aView.m_sInvalidateSheetGeometry); aView.m_sInvalidateSheetGeometry = ""; // sort descending @@ -2455,7 +2455,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testSortAscendingDescending) CPPUNIT_ASSERT_EQUAL(double(2), pDoc->GetValue(ScAddress(1, 2, 0))); Scheduler::ProcessEventsToIdle(); - CPPUNIT_ASSERT_EQUAL(OString("rows"), aView.m_sInvalidateSheetGeometry); + CPPUNIT_ASSERT_EQUAL("rows"_ostr, aView.m_sInvalidateSheetGeometry); } namespace @@ -3071,11 +3071,11 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testGetViewRenderState) int nFirstViewId = SfxLokHelper::getView(); ViewCallback aView1; - CPPUNIT_ASSERT_EQUAL(OString(";Default"), pModelObj->getViewRenderState()); + CPPUNIT_ASSERT_EQUAL(";Default"_ostr, pModelObj->getViewRenderState()); // Create a second view SfxLokHelper::createView(); ViewCallback aView2; - CPPUNIT_ASSERT_EQUAL(OString(";Default"), pModelObj->getViewRenderState()); + CPPUNIT_ASSERT_EQUAL(";Default"_ostr, pModelObj->getViewRenderState()); // Set second view to dark scheme { uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence( @@ -3085,11 +3085,11 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testGetViewRenderState) ); dispatchCommand(mxComponent, ".uno:ChangeTheme", aPropertyValues); } - CPPUNIT_ASSERT_EQUAL(OString(";Dark"), pModelObj->getViewRenderState()); + CPPUNIT_ASSERT_EQUAL(";Dark"_ostr, pModelObj->getViewRenderState()); // Switch back to first view and make sure it's the same SfxLokHelper::setView(nFirstViewId); - CPPUNIT_ASSERT_EQUAL(OString(";Default"), pModelObj->getViewRenderState()); + CPPUNIT_ASSERT_EQUAL(";Default"_ostr, pModelObj->getViewRenderState()); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index 603238dbf1ae..bec9bb499b94 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -1885,7 +1885,7 @@ void TestCopyPaste::executeCopyPasteSpecial(const SCTAB srcSheet, const SCTAB de m_pDoc->CopyFromClip(aDestRange, aDestMark, aFlags, pPasteRefUndoDoc.get(), &aClipDoc, true, bAsLink, bIncludedFiltered, bSkipEmpty); - printValuesAndFormulasInRange(m_pDoc, aDestRange, "Dest sheet"); + printValuesAndFormulasInRange(m_pDoc, aDestRange, "Dest sheet"_ostr); } if (bCut) @@ -7484,11 +7484,11 @@ void TestCopyPaste::executeReferencedCutRangesRow(const bool bTransposed, const m_pDoc->CopyFromClip(aDestRange, aDestMark, aFlags, pPasteRefUndoDoc.get(), pTransClip.get(), true, false, true, false); printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 2, 21, nSrcTab), - "Relative references after copy"); + "Relative references after copy"_ostr); m_pDoc->UpdateTranspose(aDestRange.aStart, pOrigClipDoc, aDestMark, pPasteRefUndoDoc.get()); printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 2, 21, nSrcTab), - "Relative references after UpdateTranspose"); + "Relative references after UpdateTranspose"_ostr); pTransClip.reset(); } else @@ -8447,11 +8447,11 @@ void TestCopyPaste::executeReferencedCutRangesCol(const bool bTransposed, const m_pDoc->CopyFromClip(aDestRange, aDestMark, aFlags, pPasteRefUndoDoc.get(), pTransClip.get(), true, false, true, false); printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 2, 21, nSrcTab), - "Relative references after copy"); + "Relative references after copy"_ostr); m_pDoc->UpdateTranspose(aDestRange.aStart, pOrigClipDoc, aDestMark, pPasteRefUndoDoc.get()); printValuesAndFormulasInRange(m_pDoc, ScRange(0, 20, nSrcTab, 2, 21, nSrcTab), - "Relative references after UpdateTranspose"); + "Relative references after UpdateTranspose"_ostr); pTransClip.reset(); } else diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx index a0a097d7de84..acf0f27672b0 100644 --- a/sc/source/core/data/document10.cxx +++ b/sc/source/core/data/document10.cxx @@ -1045,7 +1045,7 @@ OString ScDocument::dumpSheetGeomData(SCTAB nTab, bool bColumns, SheetGeomType e { ScTable* pTab = FetchTable(nTab); if (!pTab) - return ""; + return ""_ostr; return pTab->dumpSheetGeomData(bColumns, eGeomType); } diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx index 9df2d08cbea5..f9e7a878c8e5 100644 --- a/sc/source/core/data/table7.cxx +++ b/sc/source/core/data/table7.cxx @@ -510,7 +510,7 @@ OString ScTable::dumpSheetGeomData(bool bColumns, SheetGeomType eGeomType) ; } - return ""; + return ""_ostr; } OString ScTable::dumpColumnRowSizes(bool bColumns) @@ -576,7 +576,7 @@ OString ScTable::dumpHiddenFiltered(bool bColumns, bool bHidden) OString ScTable::dumpColumnRowGroups(bool bColumns) const { if (!pOutlineTable) - return ""; + return ""_ostr; if (bColumns) return pOutlineTable->GetColArray().dumpAsString(); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index d8d21e360cd6..082845651d05 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -1026,7 +1026,7 @@ OString GetFixedFormula(ScConditionMode eMode, const ScAddress& rAddress, std::s break; } - return ""; + return ""_ostr; } } @@ -1214,25 +1214,25 @@ OString getColorScaleType( const ScColorScaleEntry& rEntry, bool bFirst ) switch(rEntry.GetType()) { case COLORSCALE_MIN: - return "min"; + return "min"_ostr; case COLORSCALE_MAX: - return "max"; + return "max"_ostr; case COLORSCALE_PERCENT: - return "percent"; + return "percent"_ostr; case COLORSCALE_FORMULA: - return "formula"; + return "formula"_ostr; case COLORSCALE_AUTO: if(bFirst) - return "min"; + return "min"_ostr; else - return "max"; + return "max"_ostr; case COLORSCALE_PERCENTILE: - return "percentile"; + return "percentile"_ostr; default: break; } - return "num"; + return "num"_ostr; } } diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 87ef6e9ff964..0ebf39f59cbf 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1207,7 +1207,7 @@ void XclExpTbxControlObj::SaveVml(XclExpXmlStream& rStrm) VmlFormControlExporter aFormControlExporter(rStrm.GetCurrentStream(), GetObjType(), aAreaFrom, aAreaTo, msCtrlName, sCellLink, msLabel, GetMacroName()); aFormControlExporter.SetSkipwzName(true); // use XML_id for legacyid, not XML_ID - aFormControlExporter.OverrideShapeIDGen(true, "_x0000_s"); + aFormControlExporter.OverrideShapeIDGen(true, "_x0000_s"_ostr); aFormControlExporter.AddSdrObject(*pObj, /*bIsFollowingTextFlow=*/false, /*eHOri=*/-1, /*eVOri=*/-1, /*eHRel=*/-1, /*eVRel=*/-1, /*pWrapAttrList=*/nullptr, /*bOOxmlExport=*/true, mnShapeId); diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx index c82e274d9bec..daff4bd07e8e 100644 --- a/sc/source/filter/excel/xeextlst.cxx +++ b/sc/source/filter/excel/xeextlst.cxx @@ -188,7 +188,7 @@ OString GetFixedFormula(ScConditionMode eMode, const ScAddress& rAddress, std::s break; } - return ""; + return ""_ostr; } } @@ -555,28 +555,28 @@ void XclExpExtConditionalFormatting::SaveXml( XclExpXmlStream& rStrm ) XclExpExtCalcPr::XclExpExtCalcPr( const XclExpRoot& rRoot, formula::FormulaGrammar::AddressConvention eConv ): XclExpExt( rRoot ) { - maURI = OString("{7626C862-2A13-11E5-B345-FEFF819CDC9F}"); + maURI = "{7626C862-2A13-11E5-B345-FEFF819CDC9F}"_ostr; switch (eConv) { case formula::FormulaGrammar::CONV_OOO: - maSyntax = OString("CalcA1"); + maSyntax = "CalcA1"_ostr; break; case formula::FormulaGrammar::CONV_XL_A1: - maSyntax = OString("ExcelA1"); + maSyntax = "ExcelA1"_ostr; break; case formula::FormulaGrammar::CONV_XL_R1C1: - maSyntax = OString("ExcelR1C1"); + maSyntax = "ExcelR1C1"_ostr; break; case formula::FormulaGrammar::CONV_A1_XL_A1: - maSyntax = OString("CalcA1ExcelA1"); + maSyntax = "CalcA1ExcelA1"_ostr; break; case formula::FormulaGrammar::CONV_UNSPECIFIED: case formula::FormulaGrammar::CONV_ODF: case formula::FormulaGrammar::CONV_XL_OOX: case formula::FormulaGrammar::CONV_LOTUS_A1: case formula::FormulaGrammar::CONV_LAST: - maSyntax = OString("Unspecified"); + maSyntax = "Unspecified"_ostr; break; } } @@ -596,7 +596,7 @@ void XclExpExtCalcPr::SaveXml( XclExpXmlStream& rStrm ) XclExpExtCondFormat::XclExpExtCondFormat( const XclExpRoot& rRoot ): XclExpExt( rRoot ) { - maURI = OString("{78C0D931-6437-407d-A8EE-F0AAD7539E65}"); + maURI = "{78C0D931-6437-407d-A8EE-F0AAD7539E65}"_ostr; } void XclExpExtCondFormat::SaveXml( XclExpXmlStream& rStrm ) diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 543a39243b93..f05174b1f1d7 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -673,20 +673,20 @@ OString GetSubtotalFuncName(ScGeneralFunction eFunc) { switch (eFunc) { - case ScGeneralFunction::SUM: return "sum"; - case ScGeneralFunction::COUNT: return "count"; - case ScGeneralFunction::AVERAGE: return "avg"; - case ScGeneralFunction::MAX: return "max"; - case ScGeneralFunction::MIN: return "min"; - case ScGeneralFunction::PRODUCT: return "product"; - case ScGeneralFunction::COUNTNUMS: return "countA"; - case ScGeneralFunction::STDEV: return "stdDev"; - case ScGeneralFunction::STDEVP: return "stdDevP"; - case ScGeneralFunction::VAR: return "var"; - case ScGeneralFunction::VARP: return "varP"; + case ScGeneralFunction::SUM: return "sum"_ostr; + case ScGeneralFunction::COUNT: return "count"_ostr; + case ScGeneralFunction::AVERAGE: return "avg"_ostr; + case ScGeneralFunction::MAX: return "max"_ostr; + case ScGeneralFunction::MIN: return "min"_ostr; + case ScGeneralFunction::PRODUCT: return "product"_ostr; + case ScGeneralFunction::COUNTNUMS: return "countA"_ostr; + case ScGeneralFunction::STDEV: return "stdDev"_ostr; + case ScGeneralFunction::STDEVP: return "stdDevP"_ostr; + case ScGeneralFunction::VAR: return "var"_ostr; + case ScGeneralFunction::VARP: return "varP"_ostr; default:; } - return "default"; + return "default"_ostr; } sal_Int32 GetSubtotalAttrToken(ScGeneralFunction eFunc) diff --git a/sc/source/filter/excel/xeview.cxx b/sc/source/filter/excel/xeview.cxx index d94a94407603..5db6de1c2fff 100644 --- a/sc/source/filter/excel/xeview.cxx +++ b/sc/source/filter/excel/xeview.cxx @@ -412,7 +412,7 @@ static OString lcl_GetZoom( sal_uInt16 nZoom ) { if( nZoom ) return OString::number( nZoom ); - return "100"; + return "100"_ostr; } void XclExpTabViewSettings::SaveXml( XclExpXmlStream& rStrm ) diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 8f06c93f5bbf..2a3cb6a4f8ae 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -1136,7 +1136,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC { //create the comment indicator OString aStr = OOO_STRING_SVTOOLS_HTML_anchor " " - OOO_STRING_SVTOOLS_HTML_O_class "=\"comment-indicator\""; + OOO_STRING_SVTOOLS_HTML_O_class "=\"comment-indicator\""_ostr; TAG_ON(aStr); TAG_OFF(OOO_STRING_SVTOOLS_HTML_anchor); OUT_LF(); diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 7f75604dc464..344651136876 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1848,9 +1848,9 @@ void ScTabViewShell::LOKSendFormulabarUpdate(EditView* pActiveView, void ScTabViewShell::SendFormulabarUpdate::Send() { std::unique_ptr<jsdialog::ActionDataMap> pData = std::make_unique<jsdialog::ActionDataMap>(); - (*pData)["action_type"] = "setText"; - (*pData)["text"] = m_aText; - (*pData)["selection"] = m_aSelection; + (*pData)["action_type"_ostr] = "setText"; + (*pData)["text"_ostr] = m_aText; + (*pData)["selection"_ostr] = m_aSelection; OUString sWindowId = OUString::number(m_nShellId) + "formulabar"; jsdialog::SendAction(sWindowId, "sc_input_window", std::move(pData)); } diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 3cab82d17de6..d15c891a2f62 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -116,7 +116,7 @@ void ScModule::InitInterface_Impl() } ScModule::ScModule( SfxObjectFactory* pFact ) : - SfxModule("sc", {pFact}), + SfxModule("sc"_ostr, {pFact}), m_aIdleTimer("sc ScModule IdleTimer"), m_pDragData(new ScDragData), m_pSelTransfer( nullptr ), diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 9c11774b1501..85c179373788 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -992,8 +992,8 @@ void ScModelObj::resetSelection() pViewShell->Unmark(); // and hide the cell and text selection - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, ""); - SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", ""); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, ""_ostr); + SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", ""_ostr); } void ScModelObj::setClipboard(const uno::Reference<datatransfer::clipboard::XClipboard>& xClipboard) @@ -1082,11 +1082,11 @@ OString ScModelObj::getSheetGeometryData(bool bColumns, bool bRows, bool bSizes, { ScViewData* pViewData = ScDocShell::GetViewData(); if (!pViewData) - return ""; + return ""_ostr; ScTabView* pTabView = pViewData->GetView(); if (!pTabView) - return ""; + return ""_ostr; return pTabView->getSheetGeometryData(bColumns, bRows, bSizes, bHidden, bFiltered, bGroups); } diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index 36e3777fed10..c1a48dc6df12 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -584,7 +584,7 @@ SdrEndTextEditKind ScDrawView::SdrEndTextEdit( bool bDontDeleteReally ) ScTabViewShell* pViewSh = pViewData->GetViewShell(); if (comphelper::LibreOfficeKit::isActive()) - SfxLokHelper::notifyOtherViews(pViewSh, LOK_CALLBACK_VIEW_LOCK, "rectangle", "EMPTY"); + SfxLokHelper::notifyOtherViews(pViewSh, LOK_CALLBACK_VIEW_LOCK, "rectangle", "EMPTY"_ostr); SfxFrame& rFrame = pViewSh->GetViewFrame().GetFrame(); uno::Reference< frame::XController > xController = rFrame.GetController(); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 557e78ea991a..67568e2ce21a 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5998,7 +5998,7 @@ OString ScGridWindow::getCellCursor() const // we can use that to determine whether we would want to be showing // one (client-side) for tiled rendering too. if (!mpOOCursors) - return "EMPTY"; + return "EMPTY"_ostr; if (comphelper::LibreOfficeKit::isCompatFlagSet( comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs)) @@ -6018,8 +6018,8 @@ void ScGridWindow::notifyKitCellCursor() const GetSelectionRects(aRects); if (aRects.empty() || !mrViewData.IsActive()) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, ""); - SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", "EMPTY"); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, ""_ostr); + SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", "EMPTY"_ostr); } } @@ -6030,7 +6030,7 @@ void ScGridWindow::notifyKitCellViewCursor(const SfxViewShell* pForShell) const if (pViewShell->GetDocId() != pForShell->GetDocId()) return; - OString aCursor("EMPTY"); + OString aCursor("EMPTY"_ostr); if (mpOOCursors) // cf. getCellCursor above { auto pForTabView = dynamic_cast<const ScTabViewShell *>(pForShell); @@ -6156,8 +6156,8 @@ void ScGridWindow::UpdateAllOverlays() void ScGridWindow::DeleteCursorOverlay() { ScTabViewShell* pViewShell = mrViewData.GetViewShell(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, "EMPTY"); - SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", "EMPTY"); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, "EMPTY"_ostr); + SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", "EMPTY"_ostr); mpOOCursors.reset(); } @@ -6301,7 +6301,7 @@ void ScGridWindow::UpdateKitSelection(const std::vector<tools::Rectangle>& rRect ScTabViewShell* pViewShell = mrViewData.GetViewShell(); pViewShell->UpdateInputHandler(); - OString sBoundingBoxString = "EMPTY"; + OString sBoundingBoxString = "EMPTY"_ostr; if (!aBoundingBox.IsEmpty()) sBoundingBoxString = aBoundingBox.toString(); OString aRectListString = rectanglesToString(rLogicRects); @@ -6371,7 +6371,7 @@ void ScGridWindow::updateOtherKitSelections() const if (it == pViewShell) { - OString sBoundingBoxString = "EMPTY"; + OString sBoundingBoxString = "EMPTY"_ostr; if (!aBoundingBox.IsEmpty()) sBoundingBoxString = aBoundingBox.toString(); @@ -6395,7 +6395,7 @@ void updateLibreOfficeKitAutoFill(const ScViewData& rViewData, tools::Rectangle double nPPTX = rViewData.GetPPTX(); double nPPTY = rViewData.GetPPTY(); - OString sRectangleString = "EMPTY"; + OString sRectangleString = "EMPTY"_ostr; if (!rRectangle.IsEmpty()) { // selection start handle @@ -6665,9 +6665,9 @@ void ScGridWindow::UpdateSelectionOverlay() else { ScTabViewShell* pViewShell = mrViewData.GetViewShell(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY"); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, "EMPTY"); - SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", "EMPTY"); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY"_ostr); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, "EMPTY"_ostr); + SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", "EMPTY"_ostr); ScInputHandler* pViewHdl = SC_MOD()->GetInputHdl(pViewShell); if (!pViewHdl || !pViewHdl->IsEditMode()) @@ -6987,7 +6987,7 @@ void ScGridWindow::UpdateDragRectOverlay() aRectsString = rectanglesToString(convertPixelToLogical(pViewShell->GetViewData(), aRectangles, aBoundingBox)); } - OString sBoundingBoxString = "EMPTY"; + OString sBoundingBoxString = "EMPTY"_ostr; if (!aBoundingBox.IsEmpty()) sBoundingBoxString = aBoundingBox.toString(); diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 4130d7829ca1..96209c1a123d 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -2141,7 +2141,7 @@ void ScTabView::OnLibreOfficeKitTabChanged() SfxLokHelper::forEachOtherView(pThisViewShell, lTabSwitch); - pThisViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_HEADER, "all"); + pThisViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_HEADER, "all"_ostr); if (pThisViewShell->GetInputHandler()) pThisViewShell->GetInputHandler()->UpdateLokReferenceMarks(); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index c5fe69007fcc..345a33534d1c 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1815,10 +1815,10 @@ ScTabViewShell::~ScTabViewShell() bInDispose = true; // Notify other LOK views that we are going away. - SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", "false"); - SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", ""); - SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY"); - SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", "EMPTY"); + SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", "false"_ostr); + SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", ""_ostr); + SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY"_ostr); + SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", "EMPTY"_ostr); // all to NULL, in case the TabView-dtor tries to access them //! (should not really! ??!?!) |