From 79e8a54893c4a95d732388326eecd1ad151017d9 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sun, 19 Nov 2023 13:26:03 +0100 Subject: Extended loplugin:ostr: svx Change-Id: I290b1c60c8030b5345a1c2fa3816e83e21967cf6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159671 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- svx/qa/unit/customshapes.cxx | 2 +- svx/qa/unit/sdr.cxx | 48 +++++------ svx/qa/unit/svdraw.cxx | 119 ++++++++++++++-------------- svx/qa/unit/table.cxx | 38 ++++----- svx/qa/unit/unodraw.cxx | 4 +- svx/source/dialog/ClassificationDialog.cxx | 2 +- svx/source/svdraw/svdmrkv.cxx | 10 +-- svx/source/table/tablecontroller.cxx | 8 +- svx/source/tbxctrls/StylesPreviewWindow.cxx | 2 +- svx/source/unodraw/UnoGraphicExporter.cxx | 4 +- 10 files changed, 119 insertions(+), 118 deletions(-) diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx index 523cf7342b7b..34a60fdbc3e4 100644 --- a/svx/qa/unit/customshapes.cxx +++ b/svx/qa/unit/customshapes.cxx @@ -1177,7 +1177,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf136176) saveAndReload("draw8"); // Expected values of point 4 of the shape polygon - const OString sTestCase[] = { "FlipH", "FlipV", "FlipHV" }; + const OString sTestCase[] = { "FlipH"_ostr, "FlipV"_ostr, "FlipHV"_ostr }; const double fX[] = { 14981.0, 3849.0, 15214.0 }; const double fY[] = { 9366.0, 16464.0, 23463.0 }; diff --git a/svx/qa/unit/sdr.cxx b/svx/qa/unit/sdr.cxx index 4d6c4226d11b..74885586a3b1 100644 --- a/svx/qa/unit/sdr.cxx +++ b/svx/qa/unit/sdr.cxx @@ -69,8 +69,8 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testShadowScaleOrigin) // Examine the created primitives. drawinglayer::Primitive2dXmlDump aDumper; xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence); - sal_Int32 fShadowX = getXPath(pDocument, "//shadow/transform", "xy13").toInt32(); - sal_Int32 fShadowY = getXPath(pDocument, "//shadow/transform", "xy23").toInt32(); + sal_Int32 fShadowX = getXPath(pDocument, "//shadow/transform"_ostr, "xy13"_ostr).toInt32(); + sal_Int32 fShadowY = getXPath(pDocument, "//shadow/transform"_ostr, "xy23"_ostr).toInt32(); // Without the accompanying fix in place, this test would have failed with: // - Expected: -705 // - Actual : -158 @@ -101,32 +101,32 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testShadowAlignment) // - Actual : 162 // - In <>, attribute 'xy13' of '(//shadow/transform)[1]' incorrect value. // i.e. shadow alignment was ignored while scaling the shadow. - assertXPath(pDocument, "(//shadow/transform)[1]", "xy13", "-567"); - assertXPath(pDocument, "(//shadow/transform)[1]", "xy23", "162"); + assertXPath(pDocument, "(//shadow/transform)[1]"_ostr, "xy13"_ostr, "-567"); + assertXPath(pDocument, "(//shadow/transform)[1]"_ostr, "xy23"_ostr, "162"); - assertXPath(pDocument, "(//shadow/transform)[2]", "xy13", "-1794"); - assertXPath(pDocument, "(//shadow/transform)[2]", "xy23", "162"); + assertXPath(pDocument, "(//shadow/transform)[2]"_ostr, "xy13"_ostr, "-1794"); + assertXPath(pDocument, "(//shadow/transform)[2]"_ostr, "xy23"_ostr, "162"); - assertXPath(pDocument, "(//shadow/transform)[3]", "xy13", "-3021"); - assertXPath(pDocument, "(//shadow/transform)[3]", "xy23", "161"); + assertXPath(pDocument, "(//shadow/transform)[3]"_ostr, "xy13"_ostr, "-3021"); + assertXPath(pDocument, "(//shadow/transform)[3]"_ostr, "xy23"_ostr, "161"); - assertXPath(pDocument, "(//shadow/transform)[4]", "xy13", "-567"); - assertXPath(pDocument, "(//shadow/transform)[4]", "xy23", "-749"); + assertXPath(pDocument, "(//shadow/transform)[4]"_ostr, "xy13"_ostr, "-567"); + assertXPath(pDocument, "(//shadow/transform)[4]"_ostr, "xy23"_ostr, "-749"); - assertXPath(pDocument, "(//shadow/transform)[5]", "xy13", "-3021"); - assertXPath(pDocument, "(//shadow/transform)[5]", "xy23", "-750"); + assertXPath(pDocument, "(//shadow/transform)[5]"_ostr, "xy13"_ostr, "-3021"); + assertXPath(pDocument, "(//shadow/transform)[5]"_ostr, "xy23"_ostr, "-750"); - assertXPath(pDocument, "(//shadow/transform)[6]", "xy13", "-566"); - assertXPath(pDocument, "(//shadow/transform)[6]", "xy23", "-1691"); + assertXPath(pDocument, "(//shadow/transform)[6]"_ostr, "xy13"_ostr, "-566"); + assertXPath(pDocument, "(//shadow/transform)[6]"_ostr, "xy23"_ostr, "-1691"); - assertXPath(pDocument, "(//shadow/transform)[7]", "xy13", "-1794"); - assertXPath(pDocument, "(//shadow/transform)[7]", "xy23", "-1693"); + assertXPath(pDocument, "(//shadow/transform)[7]"_ostr, "xy13"_ostr, "-1794"); + assertXPath(pDocument, "(//shadow/transform)[7]"_ostr, "xy23"_ostr, "-1693"); - assertXPath(pDocument, "(//shadow/transform)[8]", "xy13", "-3022"); - assertXPath(pDocument, "(//shadow/transform)[8]", "xy23", "-1691"); + assertXPath(pDocument, "(//shadow/transform)[8]"_ostr, "xy13"_ostr, "-3022"); + assertXPath(pDocument, "(//shadow/transform)[8]"_ostr, "xy23"_ostr, "-1691"); - assertXPath(pDocument, "(//shadow/transform)[9]", "xy13", "-1794"); - assertXPath(pDocument, "(//shadow/transform)[9]", "xy23", "-750"); + assertXPath(pDocument, "(//shadow/transform)[9]"_ostr, "xy13"_ostr, "-1794"); + assertXPath(pDocument, "(//shadow/transform)[9]"_ostr, "xy23"_ostr, "-750"); } { // Page 2 contains a table with shadow alignment center @@ -143,8 +143,8 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testShadowAlignment) // - Expected: -5196 // - Actual : 0 // - In<>, attribute 'xy13' of '//shadow/transform' incorrect value. - assertXPath(pDocument, "//shadow/transform", "xy13", "-5196"); - assertXPath(pDocument, "//shadow/transform", "xy23", "-2290"); + assertXPath(pDocument, "//shadow/transform"_ostr, "xy13"_ostr, "-5196"); + assertXPath(pDocument, "//shadow/transform"_ostr, "xy23"_ostr, "-2290"); } } @@ -165,7 +165,7 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testZeroWidthTextWrap) // - Expected: 1 // - Actual : 12 // i.e. the text on the only shape on the slide had 12 lines, not a single one. - assertXPath(pDocument, "//textsimpleportion", 1); + assertXPath(pDocument, "//textsimpleportion"_ostr, 1); } CPPUNIT_TEST_FIXTURE(SdrTest, testSlideBackground) @@ -187,7 +187,7 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testSlideBackground) // - Expected: 1 // - Actual : 0 // i.e. the rendering did not find the bitmap. - assertXPath(pDocument, "//bitmap", 1); + assertXPath(pDocument, "//bitmap"_ostr, 1); } } diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx index 1284fa6305bf..8a6a39892b9d 100644 --- a/svx/qa/unit/svdraw.cxx +++ b/svx/qa/unit/svdraw.cxx @@ -123,7 +123,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testSemiTransparentText) // - XPath '//unifiedtransparence' number of nodes is incorrect // i.e. the text was just plain red, not semi-transparent. sal_Int16 fTransparence - = getXPath(pDocument, "//unifiedtransparence", "transparence").toInt32(); + = getXPath(pDocument, "//unifiedtransparence"_ostr, "transparence"_ostr).toInt32(); CPPUNIT_ASSERT_EQUAL(nTransparence, fTransparence); } @@ -288,40 +288,40 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testRectangleObject) drawinglayer::Primitive2dXmlDump aDumper; xmlDocUniquePtr pXmlDoc = aDumper.dumpAndParse(xPrimitiveSequence); - assertXPath(pXmlDoc, "/primitive2D", 1); + assertXPath(pXmlDoc, "/primitive2D"_ostr, 1); - OString aBasePath("/primitive2D/sdrrectangle/polypolygoncolor"); - assertXPath(pXmlDoc, aBasePath, "color", "#729fcf"); + OString aBasePath("/primitive2D/sdrrectangle/polypolygoncolor"_ostr); + assertXPath(pXmlDoc, aBasePath, "color"_ostr, "#729fcf"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "height", + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "height"_ostr, "99"); // weird Rectangle is created with size 100 - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "width", "99"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "minx", "0"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "miny", "0"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "maxx", "99"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "maxy", "99"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "width"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "minx"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "miny"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "maxx"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "maxy"_ostr, "99"); aBasePath = "/primitive2D/sdrrectangle/polypolygoncolor/polypolygon/polygon"; assertXPath(pXmlDoc, aBasePath + "/point", 5); - assertXPath(pXmlDoc, aBasePath + "/point[1]", "x", "49.5"); // hmm, weird, why? - assertXPath(pXmlDoc, aBasePath + "/point[1]", "y", "99"); - assertXPath(pXmlDoc, aBasePath + "/point[2]", "x", "0"); - assertXPath(pXmlDoc, aBasePath + "/point[2]", "y", "99"); - assertXPath(pXmlDoc, aBasePath + "/point[3]", "x", "0"); - assertXPath(pXmlDoc, aBasePath + "/point[3]", "y", "0"); - assertXPath(pXmlDoc, aBasePath + "/point[4]", "x", "99"); - assertXPath(pXmlDoc, aBasePath + "/point[4]", "y", "0"); - assertXPath(pXmlDoc, aBasePath + "/point[5]", "x", "99"); - assertXPath(pXmlDoc, aBasePath + "/point[5]", "y", "99"); + assertXPath(pXmlDoc, aBasePath + "/point[1]", "x"_ostr, "49.5"); // hmm, weird, why? + assertXPath(pXmlDoc, aBasePath + "/point[1]", "y"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/point[2]", "x"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/point[2]", "y"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/point[3]", "x"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/point[3]", "y"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/point[4]", "x"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/point[4]", "y"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/point[5]", "x"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/point[5]", "y"_ostr, "99"); aBasePath = "/primitive2D/sdrrectangle/polygonstroke"; assertXPath(pXmlDoc, aBasePath, 1); - assertXPath(pXmlDoc, aBasePath + "/line", "color", "#3465a4"); - assertXPath(pXmlDoc, aBasePath + "/line", "width", "0"); - assertXPath(pXmlDoc, aBasePath + "/line", "linejoin", "Round"); - assertXPath(pXmlDoc, aBasePath + "/line", "linecap", "BUTT"); + assertXPath(pXmlDoc, aBasePath + "/line", "color"_ostr, "#3465a4"); + assertXPath(pXmlDoc, aBasePath + "/line", "width"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/line", "linejoin"_ostr, "Round"); + assertXPath(pXmlDoc, aBasePath + "/line", "linecap"_ostr, "BUTT"); assertXPathContent(pXmlDoc, aBasePath + "/polygon", "49.5,99 0,99 0,0 99,0 99,99"); @@ -373,14 +373,15 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testFontWorks) SdrPage* pSdrPage = pDrawPage->GetSdrPage(); xmlDocUniquePtr pXmlDoc = lcl_dumpAndParseFirstObjectWithAssert(pSdrPage); - assertXPath(pXmlDoc, "/primitive2D", 1); + assertXPath(pXmlDoc, "/primitive2D"_ostr, 1); - assertXPath(pXmlDoc, "//scene", "projectionMode", "Perspective"); - assertXPath(pXmlDoc, "//scene/extrude3D[1]/fill", "color", "#ff0000"); - assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material", "color", "#ff0000"); + assertXPath(pXmlDoc, "//scene"_ostr, "projectionMode"_ostr, "Perspective"); + assertXPath(pXmlDoc, "//scene/extrude3D[1]/fill"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material"_ostr, "color"_ostr, + "#ff0000"); // ODF default 50% is represented by Specular Intensity = 2^5. The relationship is not linear. - assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material", "specularIntensity", - "32"); + assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material"_ostr, + "specularIntensity"_ostr, "32"); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testTdf148000_EOLinCurvedText) @@ -399,13 +400,13 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testTdf148000_EOLinCurvedText) // this is a group shape, hence 2 nested objectinfo OString aBasePath = "/primitive2D/objectinfo[4]/objectinfo/unhandled/unhandled/" - "polypolygoncolor/polypolygon/"; + "polypolygoncolor/polypolygon/"_ostr; // The text is: "O" + eop + "O" + eol + "O" // It should be displayed as 3 line of text. (1 "O" letter in every line) - sal_Int32 nY1 = getXPath(pXmlDoc, aBasePath + "polygon[1]/point[1]", "y").toInt32(); - sal_Int32 nY2 = getXPath(pXmlDoc, aBasePath + "polygon[3]/point[1]", "y").toInt32(); - sal_Int32 nY3 = getXPath(pXmlDoc, aBasePath + "polygon[5]/point[1]", "y").toInt32(); + sal_Int32 nY1 = getXPath(pXmlDoc, aBasePath + "polygon[1]/point[1]", "y"_ostr).toInt32(); + sal_Int32 nY2 = getXPath(pXmlDoc, aBasePath + "polygon[3]/point[1]", "y"_ostr).toInt32(); + sal_Int32 nY3 = getXPath(pXmlDoc, aBasePath + "polygon[5]/point[1]", "y"_ostr).toInt32(); sal_Int32 nDiff21 = nY2 - nY1; sal_Int32 nDiff32 = nY3 - nY2; @@ -437,9 +438,9 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testSurfaceMetal) // ODF specifies for metal = true specular color as rgb(200,200,200) and adding 15 to specularity // Together with extrusion-first-light-level 67% and extrusion-specularity 80% factor is // 0.67*0.8 * 200/255 = 0.42 and color #6b6b6b - assertXPath(pXmlDoc, "(//material)[1]", "specular", "#6b6b6b"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specular"_ostr, "#6b6b6b"); // 3D specularIntensity = 2^(50/10) + 15 = 47, with default extrusion-shininess 50% - assertXPath(pXmlDoc, "(//material)[1]", "specularIntensity", "47"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specularIntensity"_ostr, "47"); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testExtrusionPhong) @@ -451,8 +452,8 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testExtrusionPhong) xmlDocUniquePtr pXmlDoc = lcl_dumpAndParseFirstObjectWithAssert(pSdrPage); // The rendering method and normals kind were always 'Flat' without the patch. - assertXPath(pXmlDoc, "//scene", "shadeMode", "Phong"); - assertXPath(pXmlDoc, "//object3Dattributes", "normalsKind", "Specific"); + assertXPath(pXmlDoc, "//scene"_ostr, "shadeMode"_ostr, "Phong"); + assertXPath(pXmlDoc, "//object3Dattributes"_ostr, "normalsKind"_ostr, "Specific"); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testSurfaceMattePPT) @@ -469,14 +470,14 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testSurfaceMattePPT) // to forth light, as only first light is specular. Because first and third lights are off, the // forth light is the second one in the dump. The gray color corresponding to // FirstLightLevel = 38000/2^16 is #949494. - assertXPath(pXmlDoc, "(//material)[1]", "specular", "#000000"); - assertXPath(pXmlDoc, "(//light)[2]", "color", "#949494"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specular"_ostr, "#000000"); + assertXPath(pXmlDoc, "(//light)[2]"_ostr, "color"_ostr, "#949494"); // To make the second light soft, part of its intensity is moved to lights 5,6,7 and 8. - assertXPath(pXmlDoc, "(//light)[1]", "color", "#1e1e1e"); - assertXPath(pXmlDoc, "(//light)[3]", "color", "#3b3b3b"); + assertXPath(pXmlDoc, "(//light)[1]"_ostr, "color"_ostr, "#1e1e1e"); + assertXPath(pXmlDoc, "(//light)[3]"_ostr, "color"_ostr, "#3b3b3b"); // The 3D property specularIntensity is not related to 'extrusion-specularity' but to // 'extrusion-shininess'. specularIntensity = 2^(shininess/10), here default 32. - assertXPath(pXmlDoc, "(//material)[1]", "specularIntensity", "32"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specularIntensity"_ostr, "32"); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testMaterialSpecular) @@ -492,13 +493,13 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testMaterialSpecular) // -level'. 3D specularIntensity is derived from property 'draw:extrusion-shininess'. Both are // object properties, not scene properties. Those were wrong in various forms before the patch. // Specularity = 77% * first-light-level 67% = 0.5159, which corresponds to gray color #848484. - assertXPath(pXmlDoc, "(//material)[1]", "specular", "#848484"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specular"_ostr, "#848484"); // extrusion-shininess 50% corresponds to 3D specularIntensity 32, use 2^(50/10). - assertXPath(pXmlDoc, "(//material)[1]", "specularIntensity", "32"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specularIntensity"_ostr, "32"); // extrusion-first-light-level 67% corresponds to gray color #ababab, use 255 * 0.67. - assertXPath(pXmlDoc, "(//light)[1]", "color", "#ababab"); + assertXPath(pXmlDoc, "(//light)[1]"_ostr, "color"_ostr, "#ababab"); // The first light is harsh, the second light soft. So the 3D scene should have 6 lights (1+1+4). - assertXPath(pXmlDoc, "//light", 6); + assertXPath(pXmlDoc, "//light"_ostr, 6); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testVideoSnapshot) @@ -692,27 +693,27 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testClipVerticalTextOverflow) // - In <>, XPath contents of child does not match // i.e. the vertically overflowing text wasn't clipped & overflowing text // was drawn anyways. - assertXPathContent(pDocument, "count((//sdrblocktext)[4]//textsimpleportion)", "6"); + assertXPathContent(pDocument, "count((//sdrblocktext)[4]//textsimpleportion)"_ostr, "6"); // make sure text is aligned correctly after the overflowing text is clipped - assertXPath(pDocument, "((//sdrblocktext)[4]//textsimpleportion)[1]", "y", "3749"); - assertXPath(pDocument, "((//sdrblocktext)[4]//textsimpleportion)[6]", "y", "7559"); + assertXPath(pDocument, "((//sdrblocktext)[4]//textsimpleportion)[1]"_ostr, "y"_ostr, "3749"); + assertXPath(pDocument, "((//sdrblocktext)[4]//textsimpleportion)[6]"_ostr, "y"_ostr, "7559"); // make sure the text that isn't overflowing is still aligned properly - assertXPathContent(pDocument, "count((//sdrblocktext)[5]//textsimpleportion)", "3"); - assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[1]", "y", "5073"); - assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[3]", "y", "6597"); + assertXPathContent(pDocument, "count((//sdrblocktext)[5]//textsimpleportion)"_ostr, "3"); + assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[1]"_ostr, "y"_ostr, "5073"); + assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[3]"_ostr, "y"_ostr, "6597"); // Test vertically overflowing text, with vertical text direction - assertXPathContent(pDocument, "count((//sdrblocktext)[6]//textsimpleportion)", "12"); + assertXPathContent(pDocument, "count((//sdrblocktext)[6]//textsimpleportion)"_ostr, "12"); // make sure text is aligned correctly after the overflowing text is clipped - assertXPath(pDocument, "((//sdrblocktext)[6]//textsimpleportion)[1]", "x", "13093"); - assertXPath(pDocument, "((//sdrblocktext)[6]//textsimpleportion)[12]", "x", "4711"); + assertXPath(pDocument, "((//sdrblocktext)[6]//textsimpleportion)[1]"_ostr, "x"_ostr, "13093"); + assertXPath(pDocument, "((//sdrblocktext)[6]//textsimpleportion)[12]"_ostr, "x"_ostr, "4711"); // make sure the text that isn't overflowing is still aligned properly - assertXPathContent(pDocument, "count((//sdrblocktext)[7]//textsimpleportion)", "3"); - assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[1]", "x", "25417"); - assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[3]", "x", "23893"); + assertXPathContent(pDocument, "count((//sdrblocktext)[7]//textsimpleportion)"_ostr, "3"); + assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[1]"_ostr, "x"_ostr, "25417"); + assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[3]"_ostr, "x"_ostr, "23893"); } } diff --git a/svx/qa/unit/table.cxx b/svx/qa/unit/table.cxx index cc0c46efa21c..32faa1f97286 100644 --- a/svx/qa/unit/table.cxx +++ b/svx/qa/unit/table.cxx @@ -81,25 +81,25 @@ CPPUNIT_TEST_FIXTURE(Test, testTableShadowBlur) //- Actual : 2 //- In <>, XPath contents of child does not match // i.e. the shadow's transparency was miscalculated. - assertXPathContent(pDocument, "count(//objectinfo/unifiedtransparence)", "0"); - - assertXPath(pDocument, "//objectinfo/shadow[1]", "color", "#ff0000"); - assertXPath(pDocument, "//objectinfo/shadow[1]", "blur", "141"); - assertXPath(pDocument, "//objectinfo/shadow[2]", "color", "#ff0000"); - assertXPath(pDocument, "//objectinfo/shadow[2]", "blur", "141"); - assertXPath(pDocument, "//objectinfo/shadow[3]", "color", "#ff0000"); - assertXPath(pDocument, "//objectinfo/shadow[3]", "blur", "141"); - assertXPath(pDocument, "//objectinfo/shadow[4]", "color", "#ff0000"); - assertXPath(pDocument, "//objectinfo/shadow[4]", "blur", "141"); - assertXPath(pDocument, "//objectinfo/shadow[5]", "color", "#ff0000"); - assertXPath(pDocument, "//objectinfo/shadow[5]", "blur", "141"); - - assertXPath(pDocument, "//objectinfo/group/sdrCell[1]/unifiedtransparence", 0); - assertXPath(pDocument, "//objectinfo/group/sdrCell[2]/unifiedtransparence", 0); - assertXPath(pDocument, "//objectinfo/group/sdrCell[3]/unifiedtransparence", "transparence", - "80"); - assertXPath(pDocument, "//objectinfo/group/sdrCell[4]/unifiedtransparence", "transparence", - "80"); + assertXPathContent(pDocument, "count(//objectinfo/unifiedtransparence)"_ostr, "0"); + + assertXPath(pDocument, "//objectinfo/shadow[1]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "//objectinfo/shadow[1]"_ostr, "blur"_ostr, "141"); + assertXPath(pDocument, "//objectinfo/shadow[2]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "//objectinfo/shadow[2]"_ostr, "blur"_ostr, "141"); + assertXPath(pDocument, "//objectinfo/shadow[3]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "//objectinfo/shadow[3]"_ostr, "blur"_ostr, "141"); + assertXPath(pDocument, "//objectinfo/shadow[4]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "//objectinfo/shadow[4]"_ostr, "blur"_ostr, "141"); + assertXPath(pDocument, "//objectinfo/shadow[5]"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pDocument, "//objectinfo/shadow[5]"_ostr, "blur"_ostr, "141"); + + assertXPath(pDocument, "//objectinfo/group/sdrCell[1]/unifiedtransparence"_ostr, 0); + assertXPath(pDocument, "//objectinfo/group/sdrCell[2]/unifiedtransparence"_ostr, 0); + assertXPath(pDocument, "//objectinfo/group/sdrCell[3]/unifiedtransparence"_ostr, + "transparence"_ostr, "80"); + assertXPath(pDocument, "//objectinfo/group/sdrCell[4]/unifiedtransparence"_ostr, + "transparence"_ostr, "80"); } CPPUNIT_TEST_FIXTURE(Test, testSvxTableControllerSetAttrToSelectedShape) diff --git a/svx/qa/unit/unodraw.cxx b/svx/qa/unit/unodraw.cxx index ff24012402d8..0f619784553f 100644 --- a/svx/qa/unit/unodraw.cxx +++ b/svx/qa/unit/unodraw.cxx @@ -147,14 +147,14 @@ CPPUNIT_TEST_FIXTURE(UnodrawTest, testTableShadowDirect) // Check the primitives. drawinglayer::Primitive2dXmlDump aDumper; xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence); - assertXPath(pDocument, "//shadow", /*nNumberOfNodes=*/1); + assertXPath(pDocument, "//shadow"_ostr, /*nNumberOfNodes=*/1); // Without the accompanying fix in place, this test would have failed with: // - Expected: 0 // - Actual : 1 // i.e. there was shadow for the cell text, while here PowerPoint-compatible output is expected, // which has no shadow for cell text (only for cell borders and cell background). - assertXPath(pDocument, "//shadow//sdrblocktext", /*nNumberOfNodes=*/0); + assertXPath(pDocument, "//shadow//sdrblocktext"_ostr, /*nNumberOfNodes=*/0); } CPPUNIT_TEST_FIXTURE(UnodrawTest, testTitleShapeBullets) diff --git a/svx/source/dialog/ClassificationDialog.cxx b/svx/source/dialog/ClassificationDialog.cxx index 78fc83bec15e..03f38bb2f389 100644 --- a/svx/source/dialog/ClassificationDialog.cxx +++ b/svx/source/dialog/ClassificationDialog.cxx @@ -335,7 +335,7 @@ void ClassificationDialog::readRecentlyUsed() // Convert string to classification type, but continue only if // conversion was successful. - if (stringToClassificationType(aWalker.attribute("type"), eType)) + if (stringToClassificationType(aWalker.attribute("type"_ostr), eType)) { aWalker.children(); diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 841cac87bb31..d13291726258 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -814,7 +814,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S } // hide the text selection too - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, ""); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, ""_ostr); } { @@ -889,7 +889,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S if (aSel >>= aValue) { OString aObjectCID(aValue.getStr(), aValue.getLength(), osl_getThreadTextEncoding()); - const std::vector aProps{"Draggable", "Resizable", "Rotatable"}; + const std::vector aProps{"Draggable"_ostr, "Resizable"_ostr, "Rotatable"_ostr}; for (const auto& rProp: aProps) { sal_Int32 nPos = aObjectCID.indexOf(rProp); @@ -963,7 +963,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow); Point aLogicOffset = pWin->PixelToLogic(aOffsetPx); - OString sPolygonElem("NotifyOtherViews(LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", OString()); + pViewShell->NotifyOtherViews(LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection"_ostr, OString()); } if (bTableSelection) @@ -1141,7 +1141,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S } else if (!getSdrModelFromSdrView().IsWriter()) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, "{}"); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, "{}"_ostr); } if (pOtherShell) diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 73c10be946c9..78363db198a4 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -2397,10 +2397,10 @@ void SvxTableController::destroySelectionOverlay() // Clear the LOK text selection so far provided by this table. if(SfxViewShell* pViewShell = SfxViewShell::Current()) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, "EMPTY"); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, "EMPTY"); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, "EMPTY"); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY"); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, "EMPTY"_ostr); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, "EMPTY"_ostr); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, "EMPTY"_ostr); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY"_ostr); } } } diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx index 27e992c92059..da560feb0e15 100644 --- a/svx/source/tbxctrls/StylesPreviewWindow.cxx +++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx @@ -564,7 +564,7 @@ static OString extractPngString(const BitmapEx& rBitmap) return aBuffer.makeStringAndClear(); } - return ""; + return ""_ostr; } // 0: json writer, 1: TreeIter, 2: property. returns true if supported diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index cf6cfe1d964d..c7bd99d93a0b 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -864,11 +864,11 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr pMtf->SetPrefMapMode( aLocalMapMode ); pMtf->AddAction( new MetaCommentAction( - "XTEXT_SCROLLRECT", 0, + "XTEXT_SCROLLRECT"_ostr, 0, reinterpret_cast(&aScrollRectangle), sizeof( tools::Rectangle ) ) ); pMtf->AddAction( new MetaCommentAction( - "XTEXT_PAINTRECT", 0, + "XTEXT_PAINTRECT"_ostr, 0, reinterpret_cast(&aPaintRectangle), sizeof( tools::Rectangle ) ) ); -- cgit