xmloff/qa/unit/draw.cxx | 202 +-- xmloff/qa/unit/style.cxx | 198 +-- xmloff/qa/unit/text.cxx | 631 +++++------ xmloff/qa/unit/text/txtprmap.cxx | 32 xmloff/qa/unit/uxmloff.cxx | 20 xmloff/source/chart/PropertyMaps.cxx | 12 xmloff/source/chart/SchXMLAxisContext.cxx | 70 - xmloff/source/chart/SchXMLCalculationSettingsContext.cxx | 2 xmloff/source/chart/SchXMLChartContext.cxx | 54 xmloff/source/chart/SchXMLDataTableContext.cxx | 2 xmloff/source/chart/SchXMLExport.cxx | 196 +-- xmloff/source/chart/SchXMLImport.cxx | 10 xmloff/source/chart/SchXMLLegendContext.cxx | 10 xmloff/source/chart/SchXMLPlotAreaContext.cxx | 118 +- xmloff/source/chart/SchXMLPropertyMappingContext.cxx | 2 xmloff/source/chart/SchXMLRegressionCurveObjectContext.cxx | 6 xmloff/source/chart/SchXMLSeries2Context.cxx | 82 - xmloff/source/chart/SchXMLSeriesHelper.cxx | 4 xmloff/source/chart/SchXMLTableContext.cxx | 8 xmloff/source/chart/SchXMLTools.cxx | 10 xmloff/source/chart/XMLChartStyleContext.cxx | 4 xmloff/source/core/DocumentSettingsContext.cxx | 2 xmloff/source/core/RDFaExportHelper.cxx | 2 xmloff/source/core/SettingsExportHelper.cxx | 8 xmloff/source/core/unoatrcn.cxx | 4 xmloff/source/core/xmlerror.cxx | 2 xmloff/source/core/xmlexp.cxx | 46 xmloff/source/core/xmlimp.cxx | 120 +- xmloff/source/draw/QRCodeContext.cxx | 2 xmloff/source/draw/SignatureLineContext.cxx | 24 xmloff/source/draw/XMLGraphicsDefaultStyle.cxx | 14 xmloff/source/draw/XMLImageMapContext.cxx | 20 xmloff/source/draw/XMLReplacementImageContext.cxx | 4 xmloff/source/draw/XMLShapeStyleContext.cxx | 2 xmloff/source/draw/animationexport.cxx | 20 xmloff/source/draw/animationimport.cxx | 18 xmloff/source/draw/animexp.cxx | 4 xmloff/source/draw/descriptionimp.cxx | 4 xmloff/source/draw/eventimp.cxx | 6 xmloff/source/draw/layerexp.cxx | 8 xmloff/source/draw/layerimp.cxx | 18 xmloff/source/draw/sdpropls.cxx | 4 xmloff/source/draw/sdxmlexp.cxx | 124 +- xmloff/source/draw/sdxmlimp.cxx | 30 xmloff/source/draw/shapeexport.cxx | 276 ++-- xmloff/source/draw/shapeimport.cxx | 16 xmloff/source/draw/xexptran.cxx | 10 xmloff/source/draw/ximp3dobject.cxx | 20 xmloff/source/draw/ximp3dscene.cxx | 68 - xmloff/source/draw/ximpbody.cxx | 4 xmloff/source/draw/ximpcustomshape.cxx | 2 xmloff/source/draw/ximpgrp.cxx | 2 xmloff/source/draw/ximppage.cxx | 26 xmloff/source/draw/ximpshap.cxx | 276 ++-- xmloff/source/draw/ximpshow.cxx | 28 xmloff/source/draw/ximpstyl.cxx | 12 xmloff/source/forms/elementexport.cxx | 10 xmloff/source/forms/elementimport.cxx | 4 xmloff/source/forms/eventexport.cxx | 2 xmloff/source/forms/formattributes.cxx | 156 +- xmloff/source/forms/gridcolumnproptranslator.cxx | 2 xmloff/source/forms/layerexport.cxx | 6 xmloff/source/forms/propertyexport.cxx | 8 xmloff/source/meta/MetaExportComponent.cxx | 10 xmloff/source/meta/MetaImportComponent.cxx | 10 xmloff/source/meta/xmlmetai.cxx | 8 xmloff/source/meta/xmlversion.cxx | 12 xmloff/source/script/xmlbasicscript.cxx | 17 xmloff/source/style/PageMasterExportPropMapper.cxx | 16 xmloff/source/style/PageMasterImportContext.cxx | 18 xmloff/source/style/PageMasterImportPropMapper.cxx | 6 xmloff/source/style/XMLFontAutoStylePool.cxx | 20 xmloff/source/style/XMLPageExport.cxx | 14 xmloff/source/style/XMLThemeContext.cxx | 2 xmloff/source/style/impastpl.cxx | 8 xmloff/source/style/prstylei.cxx | 68 - xmloff/source/style/styleexp.cxx | 26 xmloff/source/style/xmlaustp.cxx | 2 xmloff/source/style/xmlnume.cxx | 14 xmloff/source/style/xmlnumfe.cxx | 6 xmloff/source/style/xmlnumfi.cxx | 2 xmloff/source/style/xmlnumi.cxx | 60 - xmloff/source/table/XMLTableExport.cxx | 46 xmloff/source/table/XMLTableImport.cxx | 4 xmloff/source/text/XMLAutoMarkFileContext.cxx | 2 xmloff/source/text/XMLAutoTextEventExport.cxx | 6 xmloff/source/text/XMLAutoTextEventImport.cxx | 2 xmloff/source/text/XMLCalculationSettingsContext.cxx | 2 xmloff/source/text/XMLComplexColorExport.cxx | 2 xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx | 4 xmloff/source/text/XMLFootnoteImportContext.cxx | 6 xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx | 22 xmloff/source/text/XMLIndexBibliographyEntryContext.cxx | 2 xmloff/source/text/XMLIndexChapterInfoEntryContext.cxx | 4 xmloff/source/text/XMLIndexObjectSourceContext.cxx | 10 xmloff/source/text/XMLIndexSourceBaseContext.cxx | 6 xmloff/source/text/XMLIndexSpanEntryContext.cxx | 2 xmloff/source/text/XMLIndexTOCContext.cxx | 8 xmloff/source/text/XMLIndexTOCSourceContext.cxx | 8 xmloff/source/text/XMLIndexTOCStylesContext.cxx | 2 xmloff/source/text/XMLIndexTabStopEntryContext.cxx | 2 xmloff/source/text/XMLIndexTableSourceContext.cxx | 6 xmloff/source/text/XMLIndexTemplateContext.cxx | 10 xmloff/source/text/XMLIndexTitleTemplateContext.cxx | 4 xmloff/source/text/XMLIndexUserSourceContext.cxx | 16 xmloff/source/text/XMLLineNumberingExport.cxx | 22 xmloff/source/text/XMLPropertyBackpatcher.cxx | 4 xmloff/source/text/XMLRedlineExport.cxx | 36 xmloff/source/text/XMLSectionExport.cxx | 142 +- xmloff/source/text/XMLSectionImportContext.cxx | 22 xmloff/source/text/XMLSectionSourceDDEImportContext.cxx | 4 xmloff/source/text/XMLSectionSourceImportContext.cxx | 4 xmloff/source/text/XMLTextColumnsContext.cxx | 2 xmloff/source/text/XMLTextFrameContext.cxx | 62 - xmloff/source/text/XMLTextHeaderFooterContext.cxx | 10 xmloff/source/text/XMLTextListAutoStylePool.cxx | 4 xmloff/source/text/XMLTextListItemContext.cxx | 2 xmloff/source/text/XMLTextMarkImportContext.cxx | 12 xmloff/source/text/XMLTextMasterPageContext.cxx | 16 xmloff/source/text/XMLTextNumRuleInfo.cxx | 36 xmloff/source/text/txtexppr.cxx | 8 xmloff/source/text/txtflde.cxx | 44 xmloff/source/text/txtfldi.cxx | 114 - xmloff/source/text/txtimp.cxx | 54 xmloff/source/text/txtlists.cxx | 4 xmloff/source/text/txtparae.cxx | 136 +- xmloff/source/text/txtparai.cxx | 58 - xmloff/source/text/txtstyle.cxx | 8 xmloff/source/text/txtstyli.cxx | 20 xmloff/source/text/txtvfldi.cxx | 44 xmloff/source/text/xmlcontentcontrolcontext.cxx | 44 xmloff/source/text/xmllinebreakcontext.cxx | 4 xmloff/source/transform/DocumentTContext.cxx | 2 xmloff/source/transform/EventOASISTContext.cxx | 4 xmloff/source/transform/OOo2Oasis.cxx | 112 - xmloff/source/transform/Oasis2OOo.cxx | 6 xmloff/source/transform/TransformerBase.cxx | 8 xmloff/source/xforms/XFormsBindContext.cxx | 18 xmloff/source/xforms/XFormsModelContext.cxx | 2 xmloff/source/xforms/XFormsSubmissionContext.cxx | 30 xmloff/source/xforms/xformsapi.cxx | 2 xmloff/source/xforms/xformsexport.cxx | 26 142 files changed, 2359 insertions(+), 2349 deletions(-)
New commits: commit 12008e10549aa3fe23063eb1af38fb3e86064d3e Author: Noel Grandin <[email protected]> AuthorDate: Wed May 15 13:12:19 2024 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Wed May 15 20:37:38 2024 +0200 loplugin:ostr in xmloff Change-Id: I24f5626e57e03217e4bcf77289c785e255b9f904 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167667 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx index 985af4f1ad5e..05d5a756d6e9 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -70,7 +70,7 @@ public: }; XmloffDrawTest::XmloffDrawTest() - : UnoApiXmlTest("/xmloff/qa/unit/data/") + : UnoApiXmlTest(u"/xmloff/qa/unit/data/"_ustr) { } @@ -89,14 +89,14 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextBoxLoss) { // Load a document that has a shape with a textbox in it. Save it to ODF and reload. loadFromFile(u"textbox-loss.docx"); - saveAndReload("impress8"); + saveAndReload(u"impress8"_ustr); // Make sure that the shape is still a textbox. uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(1), uno::UNO_QUERY); bool bTextBox = false; - xShape->getPropertyValue("TextBox") >>= bTextBox; + xShape->getPropertyValue(u"TextBox"_ustr) >>= bTextBox; // Without the accompanying fix in place, this test would have failed, as the shape only had // editeng text, losing the image part of the shape text. @@ -109,18 +109,18 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf141301_Extrusion_Angle) loadFromFile(u"tdf141301_Extrusion_Skew.odg"); // Prepare use of XPath - save("draw8"); - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + save(u"draw8"_ustr); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // Without fix draw:extrusion-skew="50 -135" was not written to file although "50 -135" is not // default in ODF, but only default inside LO. - assertXPath(pXmlDoc, "//draw:enhanced-geometry"_ostr, "extrusion-skew"_ostr, "50 -135"); + assertXPath(pXmlDoc, "//draw:enhanced-geometry"_ostr, "extrusion-skew"_ostr, u"50 -135"_ustr); } CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport) { // Create an Impress document which has a master page which has a theme associated with it. - mxComponent = loadFromDesktop("private:factory/simpress"); + mxComponent = loadFromDesktop(u"private:factory/simpress"_ustr); uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XMasterPageTarget> xDrawPage( xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY); @@ -143,13 +143,13 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport) pTheme->setColorSet(pColorSet); uno::Reference<util::XTheme> xTheme = model::theme::createXTheme(pTheme); - xMasterPage->setPropertyValue("Theme", uno::Any(xTheme)); + xMasterPage->setPropertyValue(u"Theme"_ustr, uno::Any(xTheme)); // Export to ODP: - save("impress8"); + save(u"impress8"_ustr); // Check if the 12 colors are written in the XML: - xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); // Without the accompanying fix in place, this test would have failed with: // - Expected: 12 // - Actual : 0 @@ -185,9 +185,9 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1356), rCrop.Right); // Execute ODP export: - save("impress8"); + save(u"impress8"_ustr); - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // Check that the preview was exported: // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 @@ -195,10 +195,10 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot) // - XPath '//draw:frame[@draw:style-name='gr1']/draw:image' number of nodes is incorrect // i.e. the preview wasn't exported to ODP. assertXPath(pXmlDoc, "//draw:frame[@draw:style-name='gr1']/draw:image"_ostr, "href"_ostr, - "Pictures/MediaPreview1.png"); + u"Pictures/MediaPreview1.png"_ustr); // Check that the crop was exported: assertXPath(pXmlDoc, "//style:style[@style:name='gr1']/style:graphic-properties"_ostr, - "clip"_ostr, "rect(0cm, 1.356cm, 0cm, 1.356cm)"); + "clip"_ostr, u"rect(0cm, 1.356cm, 0cm, 1.356cm)"_ustr); } CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeImport) @@ -213,7 +213,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeImport) uno::Reference<beans::XPropertySet> xMasterpage(xDrawPage->getMasterPage(), uno::UNO_QUERY); uno::Reference<util::XTheme> xTheme; - xMasterpage->getPropertyValue("Theme") >>= xTheme; + xMasterpage->getPropertyValue(u"Theme"_ustr) >>= xTheme; // We expect the theme to be set on the master page CPPUNIT_ASSERT(xTheme.is()); @@ -222,10 +222,10 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeImport) auto pTheme = pUnoTheme->getTheme(); CPPUNIT_ASSERT(pTheme); - CPPUNIT_ASSERT_EQUAL(OUString("Office Theme"), pTheme->GetName()); + CPPUNIT_ASSERT_EQUAL(u"Office Theme"_ustr, pTheme->GetName()); auto pColorSet = pTheme->getColorSet(); CPPUNIT_ASSERT(pColorSet); - CPPUNIT_ASSERT_EQUAL(OUString("Office"), pColorSet->getName()); + CPPUNIT_ASSERT_EQUAL(u"Office"_ustr, pColorSet->getName()); CPPUNIT_ASSERT_EQUAL(Color(0x954F72), pColorSet->getColor(model::ThemeColorType::FollowedHyperlink)); @@ -239,7 +239,7 @@ void checkFillAndLineComplexColors(uno::Reference<drawing::XShape> const& xShape uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY); { uno::Reference<util::XComplexColor> xComplexColor; - xShapeProperties->getPropertyValue("FillComplexColor") >>= xComplexColor; + xShapeProperties->getPropertyValue(u"FillComplexColor"_ustr) >>= xComplexColor; CPPUNIT_ASSERT(xComplexColor.is()); auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3, aComplexColor.getThemeColorType()); @@ -253,7 +253,7 @@ void checkFillAndLineComplexColors(uno::Reference<drawing::XShape> const& xShape } { uno::Reference<util::XComplexColor> xComplexColor; - xShapeProperties->getPropertyValue("LineComplexColor") >>= xComplexColor; + xShapeProperties->getPropertyValue(u"LineComplexColor"_ustr) >>= xComplexColor; CPPUNIT_ASSERT(xComplexColor.is()); auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3, aComplexColor.getThemeColorType()); @@ -275,7 +275,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testFillAndLineThemeColorExportImport) checkFillAndLineComplexColors(getShape(0)); - save("impress8"); + save(u"impress8"_ustr); load(maTempFile.GetURL()); @@ -286,62 +286,62 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextAndFillThemeColorExportImport) { // Given a document that refers to a theme color: loadFromFile(u"Reference-ThemeColors-TextAndFill.pptx"); - save("impress8"); + save(u"impress8"_ustr); // Make sure the export result has the theme reference: - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // Text color OString aStyle1( "//style:style[@style:name='T2']/style:text-properties/loext:char-complex-color"_ostr); - assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, "theme"); - assertXPath(pXmlDoc, aStyle1, "theme-type"_ostr, "accent3"); - assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[1]", "type"_ostr, "lummod"); - assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[1]", "value"_ostr, "2000"); - assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[2]", "type"_ostr, "lumoff"); - assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[2]", "value"_ostr, "8000"); + assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, u"theme"_ustr); + assertXPath(pXmlDoc, aStyle1, "theme-type"_ostr, u"accent3"_ustr); + assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[1]", "type"_ostr, u"lummod"_ustr); + assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[1]", "value"_ostr, u"2000"_ustr); + assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[2]", "type"_ostr, u"lumoff"_ustr); + assertXPath(pXmlDoc, aStyle1 + "/loext:transformation[2]", "value"_ostr, u"8000"_ustr); OString aStyle2( "//style:style[@style:name='T3']/style:text-properties/loext:char-complex-color"_ostr); - assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, "theme"); - assertXPath(pXmlDoc, aStyle2, "theme-type"_ostr, "accent3"); - assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[1]", "type"_ostr, "lummod"); - assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[1]", "value"_ostr, "6000"); - assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[2]", "type"_ostr, "lumoff"); - assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[2]", "value"_ostr, "4000"); + assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, u"theme"_ustr); + assertXPath(pXmlDoc, aStyle2, "theme-type"_ostr, u"accent3"_ustr); + assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[1]", "type"_ostr, u"lummod"_ustr); + assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[1]", "value"_ostr, u"6000"_ustr); + assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[2]", "type"_ostr, u"lumoff"_ustr); + assertXPath(pXmlDoc, aStyle2 + "/loext:transformation[2]", "value"_ostr, u"4000"_ustr); OString aStyle3( "//style:style[@style:name='T4']/style:text-properties/loext:char-complex-color"_ostr); - assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, "theme"); - assertXPath(pXmlDoc, aStyle3, "theme-type"_ostr, "accent3"); - assertXPath(pXmlDoc, aStyle3 + "/loext:transformation[1]", "type"_ostr, "lummod"); - assertXPath(pXmlDoc, aStyle3 + "/loext:transformation[1]", "value"_ostr, "5000"); + assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, u"theme"_ustr); + assertXPath(pXmlDoc, aStyle3, "theme-type"_ostr, u"accent3"_ustr); + assertXPath(pXmlDoc, aStyle3 + "/loext:transformation[1]", "type"_ostr, u"lummod"_ustr); + assertXPath(pXmlDoc, aStyle3 + "/loext:transformation[1]", "value"_ostr, u"5000"_ustr); // Shapes fill color OString aShape1("//style:style[@style:name='gr1']/style:graphic-properties/" "loext:fill-complex-color"_ostr); - assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, "theme"); - assertXPath(pXmlDoc, aShape1, "theme-type"_ostr, "accent2"); - assertXPath(pXmlDoc, aShape1 + "/loext:transformation[1]", "type"_ostr, "lummod"); - assertXPath(pXmlDoc, aShape1 + "/loext:transformation[1]", "value"_ostr, "2000"); - assertXPath(pXmlDoc, aShape1 + "/loext:transformation[2]", "type"_ostr, "lumoff"); - assertXPath(pXmlDoc, aShape1 + "/loext:transformation[2]", "value"_ostr, "8000"); + assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, u"theme"_ustr); + assertXPath(pXmlDoc, aShape1, "theme-type"_ostr, u"accent2"_ustr); + assertXPath(pXmlDoc, aShape1 + "/loext:transformation[1]", "type"_ostr, u"lummod"_ustr); + assertXPath(pXmlDoc, aShape1 + "/loext:transformation[1]", "value"_ostr, u"2000"_ustr); + assertXPath(pXmlDoc, aShape1 + "/loext:transformation[2]", "type"_ostr, u"lumoff"_ustr); + assertXPath(pXmlDoc, aShape1 + "/loext:transformation[2]", "value"_ostr, u"8000"_ustr); OString aShape2("//style:style[@style:name='gr2']/style:graphic-properties/" "loext:fill-complex-color"_ostr); - assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, "theme"); - assertXPath(pXmlDoc, aShape2, "theme-type"_ostr, "accent2"); - assertXPath(pXmlDoc, aShape2 + "/loext:transformation[1]", "type"_ostr, "lummod"); - assertXPath(pXmlDoc, aShape2 + "/loext:transformation[1]", "value"_ostr, "6000"); - assertXPath(pXmlDoc, aShape2 + "/loext:transformation[2]", "type"_ostr, "lumoff"); - assertXPath(pXmlDoc, aShape2 + "/loext:transformation[2]", "value"_ostr, "4000"); + assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, u"theme"_ustr); + assertXPath(pXmlDoc, aShape2, "theme-type"_ostr, u"accent2"_ustr); + assertXPath(pXmlDoc, aShape2 + "/loext:transformation[1]", "type"_ostr, u"lummod"_ustr); + assertXPath(pXmlDoc, aShape2 + "/loext:transformation[1]", "value"_ostr, u"6000"_ustr); + assertXPath(pXmlDoc, aShape2 + "/loext:transformation[2]", "type"_ostr, u"lumoff"_ustr); + assertXPath(pXmlDoc, aShape2 + "/loext:transformation[2]", "value"_ostr, u"4000"_ustr); OString aShape3("//style:style[@style:name='gr3']/style:graphic-properties/" "loext:fill-complex-color"_ostr); - assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, "theme"); - assertXPath(pXmlDoc, aShape3, "theme-type"_ostr, "accent2"); - assertXPath(pXmlDoc, aShape3 + "/loext:transformation[1]", "type"_ostr, "lummod"); - assertXPath(pXmlDoc, aShape3 + "/loext:transformation[1]", "value"_ostr, "5000"); + assertXPath(pXmlDoc, aStyle1, "color-type"_ostr, u"theme"_ustr); + assertXPath(pXmlDoc, aShape3, "theme-type"_ostr, u"accent2"_ustr); + assertXPath(pXmlDoc, aShape3 + "/loext:transformation[1]", "type"_ostr, u"lummod"_ustr); + assertXPath(pXmlDoc, aShape3 + "/loext:transformation[1]", "value"_ostr, u"5000"_ustr); // reload load(maTempFile.GetURL()); @@ -352,7 +352,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextAndFillThemeColorExportImport) CPPUNIT_ASSERT(xShape.is()); uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY); uno::Reference<util::XComplexColor> xComplexColor; - xShapeProperties->getPropertyValue("FillComplexColor") >>= xComplexColor; + xShapeProperties->getPropertyValue(u"FillComplexColor"_ustr) >>= xComplexColor; CPPUNIT_ASSERT(xComplexColor.is()); auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2, aComplexColor.getThemeColorType()); @@ -369,7 +369,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextAndFillThemeColorExportImport) CPPUNIT_ASSERT(xShape.is()); uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY); uno::Reference<util::XComplexColor> xComplexColor; - xShapeProperties->getPropertyValue("FillComplexColor") >>= xComplexColor; + xShapeProperties->getPropertyValue(u"FillComplexColor"_ustr) >>= xComplexColor; CPPUNIT_ASSERT(xComplexColor.is()); auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2, aComplexColor.getThemeColorType()); @@ -386,7 +386,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextAndFillThemeColorExportImport) CPPUNIT_ASSERT(xShape.is()); uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY); uno::Reference<util::XComplexColor> xComplexColor; - xShapeProperties->getPropertyValue("FillComplexColor") >>= xComplexColor; + xShapeProperties->getPropertyValue(u"FillComplexColor"_ustr) >>= xComplexColor; CPPUNIT_ASSERT(xComplexColor.is()); auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2, aComplexColor.getThemeColorType()); @@ -405,7 +405,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextAndFillThemeColorExportImport) uno::Reference<beans::XPropertySet> xPortion = getShapeTextPortion(0, xShape); CPPUNIT_ASSERT(xPortion.is()); uno::Reference<util::XComplexColor> xComplexColor; - xPortion->getPropertyValue("CharComplexColor") >>= xComplexColor; + xPortion->getPropertyValue(u"CharComplexColor"_ustr) >>= xComplexColor; CPPUNIT_ASSERT(xComplexColor.is()); auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3, aComplexColor.getThemeColorType()); @@ -426,7 +426,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextAndFillThemeColorExportImport) uno::Reference<beans::XPropertySet> xPortion = getShapeTextPortion(0, xShape); CPPUNIT_ASSERT(xPortion.is()); uno::Reference<util::XComplexColor> xComplexColor; - xPortion->getPropertyValue("CharComplexColor") >>= xComplexColor; + xPortion->getPropertyValue(u"CharComplexColor"_ustr) >>= xComplexColor; CPPUNIT_ASSERT(xComplexColor.is()); auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3, aComplexColor.getThemeColorType()); @@ -447,7 +447,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextAndFillThemeColorExportImport) uno::Reference<beans::XPropertySet> xPortion = getShapeTextPortion(0, xShape); CPPUNIT_ASSERT(xPortion.is()); uno::Reference<util::XComplexColor> xComplexColor; - xPortion->getPropertyValue("CharComplexColor") >>= xComplexColor; + xPortion->getPropertyValue(u"CharComplexColor"_ustr) >>= xComplexColor; CPPUNIT_ASSERT(xComplexColor.is()); auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3, aComplexColor.getThemeColorType()); @@ -461,7 +461,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextAndFillThemeColorExportImport) CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeColor_ShapeFill) { loadFromFile(u"ReferenceShapeFill.pptx"); - save("impress8"); + save(u"impress8"_ustr); // reload load(maTempFile.GetURL()); @@ -470,7 +470,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeColor_ShapeFill) CPPUNIT_ASSERT(xShape.is()); uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY); uno::Reference<util::XComplexColor> xComplexColor; - xShapeProperties->getPropertyValue("FillComplexColor") >>= xComplexColor; + xShapeProperties->getPropertyValue(u"FillComplexColor"_ustr) >>= xComplexColor; CPPUNIT_ASSERT(xComplexColor.is()); auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent6, aComplexColor.getThemeColorType()); @@ -495,8 +495,8 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTableInShape) uno::Reference<text::XTextTable> xTable(xEnum->nextElement(), uno::UNO_QUERY); // Without the accompanying fix in place, this test would have crashed, as xTable was an empty // reference, i.e. the table inside the shape was lost. - uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("A1"), xCell->getString()); + uno::Reference<text::XTextRange> xCell(xTable->getCellByName(u"A1"_ustr), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(u"A1"_ustr, xCell->getString()); } // Tests for save/load of new (LO 7.4) attribute loext:extrusion-metal-type @@ -506,19 +506,19 @@ void lcl_assertMetalProperties(std::string_view sInfo, uno::Reference<drawing::X { uno::Reference<beans::XPropertySet> xShapeProps(rxShape, uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aGeoPropSeq; - xShapeProps->getPropertyValue("CustomShapeGeometry") >>= aGeoPropSeq; + xShapeProps->getPropertyValue(u"CustomShapeGeometry"_ustr) >>= aGeoPropSeq; comphelper::SequenceAsHashMap aGeoPropMap(aGeoPropSeq); uno::Sequence<beans::PropertyValue> aExtrusionSeq; - aGeoPropMap.getValue("Extrusion") >>= aExtrusionSeq; + aGeoPropMap.getValue(u"Extrusion"_ustr) >>= aExtrusionSeq; comphelper::SequenceAsHashMap aExtrusionPropMap(aExtrusionSeq); bool bIsMetal(false); - aExtrusionPropMap.getValue("Metal") >>= bIsMetal; + aExtrusionPropMap.getValue(u"Metal"_ustr) >>= bIsMetal; OString sMsg = OString::Concat(sInfo) + " Metal"; CPPUNIT_ASSERT_MESSAGE(sMsg.getStr(), bIsMetal); sal_Int16 nMetalType(-1); - aExtrusionPropMap.getValue("MetalType") >>= nMetalType; + aExtrusionPropMap.getValue(u"MetalType"_ustr) >>= nMetalType; sMsg = OString::Concat(sInfo) + " MetalType"; CPPUNIT_ASSERT_EQUAL_MESSAGE( sMsg.getStr(), css::drawing::EnhancedCustomShapeMetalType::MetalMSCompatible, nMetalType); @@ -533,17 +533,17 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeExtended) lcl_assertMetalProperties("from doc", xShape); // Test, that new attribute is written with loext namespace. Adapt when attribute is added to ODF. - save("writer8"); + save(u"writer8"_ustr); // assert XML. - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); - assertXPath(pXmlDoc, "//draw:enhanced-geometry"_ostr, "extrusion-metal"_ostr, "true"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); + assertXPath(pXmlDoc, "//draw:enhanced-geometry"_ostr, "extrusion-metal"_ostr, u"true"_ustr); assertXPath( pXmlDoc, "//draw:enhanced-geometry[@loext:extrusion-metal-type='loext:MetalMSCompatible']"_ostr); // reload - mxComponent = loadFromDesktop(maTempFile.GetURL(), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(maTempFile.GetURL(), u"com.sun.star.text.TextDocument"_ustr); // verify properties uno::Reference<drawing::XShape> xShapeReload(getShape(0)); lcl_assertMetalProperties("from ODF 1.3 extended", xShapeReload); @@ -557,11 +557,11 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeStrict) // added to ODF. const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion()); SetODFDefaultVersion(SvtSaveOptions::ODFVER_013); - save("writer8"); + save(u"writer8"_ustr); // assert XML. - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); - assertXPath(pXmlDoc, "//draw:enhanced-geometry"_ostr, "extrusion-metal"_ostr, "true"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); + assertXPath(pXmlDoc, "//draw:enhanced-geometry"_ostr, "extrusion-metal"_ostr, u"true"_ustr); assertXPath(pXmlDoc, "//draw:enhanced-geometry[@loext:extrusion-metal-type]"_ostr, 0); SetODFDefaultVersion(nCurrentODFVersion); @@ -573,14 +573,14 @@ void lcl_assertSpecularityProperty(std::string_view sInfo, uno::Reference<drawin { uno::Reference<beans::XPropertySet> xShapeProps(rxShape, uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aGeoPropSeq; - xShapeProps->getPropertyValue("CustomShapeGeometry") >>= aGeoPropSeq; + xShapeProps->getPropertyValue(u"CustomShapeGeometry"_ustr) >>= aGeoPropSeq; comphelper::SequenceAsHashMap aGeoPropMap(aGeoPropSeq); uno::Sequence<beans::PropertyValue> aExtrusionSeq; - aGeoPropMap.getValue("Extrusion") >>= aExtrusionSeq; + aGeoPropMap.getValue(u"Extrusion"_ustr) >>= aExtrusionSeq; comphelper::SequenceAsHashMap aExtrusionPropMap(aExtrusionSeq); double fSpecularity(-1.0); - aExtrusionPropMap.getValue("Specularity") >>= fSpecularity; + aExtrusionPropMap.getValue(u"Specularity"_ustr) >>= fSpecularity; OString sMsg = OString::Concat(sInfo) + "Specularity"; CPPUNIT_ASSERT_EQUAL_MESSAGE(sMsg.getStr(), 122.0703125, fSpecularity); } @@ -595,16 +595,16 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularityExtended) // Test, that attribute is written in draw namespace with value 100% and in loext namespace with // value 122.0703125%. - save("writer8"); + save(u"writer8"_ustr); // assert XML. - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); assertXPath(pXmlDoc, "//draw:enhanced-geometry[@draw:extrusion-specularity='100%']"_ostr); assertXPath(pXmlDoc, "//draw:enhanced-geometry[@loext:extrusion-specularity-loext='122.0703125%']"_ostr); // reload and verify, that the loext value is used - mxComponent = loadFromDesktop(maTempFile.GetURL(), "com.sun.star.text.TextDocument"); + mxComponent = loadFromDesktop(maTempFile.GetURL(), u"com.sun.star.text.TextDocument"_ustr); // verify properties uno::Reference<drawing::XShape> xShapeReload(getShape(0)); lcl_assertSpecularityProperty("from ODF 1.3 extended", xShapeReload); @@ -618,7 +618,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularity) // Save to ODF 1.3 strict and make sure it does not produce a validation error. const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion()); SetODFDefaultVersion(SvtSaveOptions::ODFVER_013); - save("writer8"); + save(u"writer8"_ustr); SetODFDefaultVersion(nCurrentODFVersion); } @@ -629,7 +629,7 @@ bool lcl_getShapeSegments(uno::Sequence<drawing::EnhancedCustomShapeSegment>& rS const uno::Reference<drawing::XShape>& xShape) { uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY_THROW); - uno::Any anotherAny = xShapeProps->getPropertyValue("CustomShapeGeometry"); + uno::Any anotherAny = xShapeProps->getPropertyValue(u"CustomShapeGeometry"_ustr); uno::Sequence<beans::PropertyValue> aCustomShapeGeometry; if (!(anotherAny >>= aCustomShapeGeometry)) return false; @@ -707,18 +707,18 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextRotationPlusPre) uno::Reference<drawing::XShape> xShape(getShape(0)); uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aGeomSeq; - xShapeProps->getPropertyValue("CustomShapeGeometry") >>= aGeomSeq; + xShapeProps->getPropertyValue(u"CustomShapeGeometry"_ustr) >>= aGeomSeq; auto aGeomVec(comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>(aGeomSeq)); - aGeomVec.push_back(comphelper::makePropertyValue("TextRotateAngle", sal_Int32(45))); + aGeomVec.push_back(comphelper::makePropertyValue(u"TextRotateAngle"_ustr, sal_Int32(45))); aGeomSeq = comphelper::containerToSequence(aGeomVec); - xShapeProps->setPropertyValue("CustomShapeGeometry", uno::Any(aGeomSeq)); + xShapeProps->setPropertyValue(u"CustomShapeGeometry"_ustr, uno::Any(aGeomSeq)); // Save to ODF. Without the fix, a file format error was produced, because attribute // draw:text-rotate-angle was written twice, one from TextPreRotateAngle and the other from // TextRotateAngle. // This should already catch the format error, but does not, see tdf#149567 // But reload catches it. - saveAndReload("writer8"); + saveAndReload(u"writer8"_ustr); } CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf156975_ThemeExport) @@ -727,7 +727,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf156975_ThemeExport) // Without fix for tdf#156975 it was not written at all. // The test needs to be adapted, when themes are available in ODF. - mxComponent = loadFromDesktop("private:factory/sdraw"); + mxComponent = loadFromDesktop(u"private:factory/sdraw"_ustr); // generate a theme to be sure we have got one and know the values uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XMasterPageTarget> xDrawPage( @@ -752,13 +752,13 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf156975_ThemeExport) pTheme->setColorSet(pColorSet); uno::Reference<util::XTheme> xTheme = model::theme::createXTheme(pTheme); - xMasterPageProps->setPropertyValue("Theme", uno::Any(xTheme)); + xMasterPageProps->setPropertyValue(u"Theme"_ustr, uno::Any(xTheme)); // save as odg - save("draw8"); + save(u"draw8"_ustr); // and check the markup. - xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); static constexpr OString sThemePath = "//office:master-styles/style:master-page/loext:theme"_ostr; assertXPath(pXmlDoc, sThemePath, 1); @@ -770,12 +770,12 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf156975_ThemeExport) const OString sThemeColorPath = sThemeColorsPath + "/loext:color"; assertXPath(pXmlDoc, sThemeColorPath, 12); - assertXPath(pXmlDoc, sThemeColorPath + "[3]", "name"_ostr, "dark2"); - assertXPath(pXmlDoc, sThemeColorPath + "[3]", "color"_ostr, "#002200"); - assertXPath(pXmlDoc, sThemeColorPath + "[9]", "name"_ostr, "accent5"); - assertXPath(pXmlDoc, sThemeColorPath + "[9]", "color"_ostr, "#880088"); - assertXPath(pXmlDoc, sThemeColorPath + "[12]", "name"_ostr, "followed-hyperlink"); - assertXPath(pXmlDoc, sThemeColorPath + "[12]", "color"_ostr, "#b0b0b0"); + assertXPath(pXmlDoc, sThemeColorPath + "[3]", "name"_ostr, u"dark2"_ustr); + assertXPath(pXmlDoc, sThemeColorPath + "[3]", "color"_ostr, u"#002200"_ustr); + assertXPath(pXmlDoc, sThemeColorPath + "[9]", "name"_ostr, u"accent5"_ustr); + assertXPath(pXmlDoc, sThemeColorPath + "[9]", "color"_ostr, u"#880088"_ustr); + assertXPath(pXmlDoc, sThemeColorPath + "[12]", "name"_ostr, u"followed-hyperlink"_ustr); + assertXPath(pXmlDoc, sThemeColorPath + "[12]", "color"_ostr, u"#b0b0b0"_ustr); } CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf157018_ThemeImportDraw) @@ -791,7 +791,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf157018_ThemeImportDraw) uno::Reference<beans::XPropertySet> xMasterpage(xDrawPage->getMasterPage(), uno::UNO_QUERY); uno::Reference<util::XTheme> xTheme; - xMasterpage->getPropertyValue("Theme") >>= xTheme; + xMasterpage->getPropertyValue(u"Theme"_ustr) >>= xTheme; CPPUNIT_ASSERT(xTheme.is()); // Then make sure it is the custom color theme @@ -800,10 +800,10 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf157018_ThemeImportDraw) auto pTheme = pUnoTheme->getTheme(); CPPUNIT_ASSERT(pTheme); - CPPUNIT_ASSERT_EQUAL(OUString("Custom"), pTheme->GetName()); + CPPUNIT_ASSERT_EQUAL(u"Custom"_ustr, pTheme->GetName()); auto pColorSet = pTheme->getColorSet(); CPPUNIT_ASSERT(pColorSet); - CPPUNIT_ASSERT_EQUAL(OUString("My Colors"), pColorSet->getName()); + CPPUNIT_ASSERT_EQUAL(u"My Colors"_ustr, pColorSet->getName()); // and test some colors CPPUNIT_ASSERT_EQUAL(Color(0xFFFF11), pColorSet->getColor(model::ThemeColorType::Light1)); @@ -819,7 +819,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, test_scene3d_ooxml_light) loadFromFile(u"Scene3d_LightRig_threePt.pptx"); // Without fix this would have failed with validation error. - save("impress8"); + save(u"impress8"_ustr); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/xmloff/qa/unit/style.cxx b/xmloff/qa/unit/style.cxx index 5da0c51d73ea..e3ee10a5c1d3 100644 --- a/xmloff/qa/unit/style.cxx +++ b/xmloff/qa/unit/style.cxx @@ -35,7 +35,7 @@ public: }; XmloffStyleTest::XmloffStyleTest() - : UnoApiXmlTest("/xmloff/qa/unit/data/") + : UnoApiXmlTest(u"/xmloff/qa/unit/data/"_ustr) { } @@ -56,11 +56,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testFillImageBase64) loadFromFile(u"fill-image-base64.fodg"); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<container::XNameContainer> xBitmaps( - xFactory->createInstance("com.sun.star.drawing.BitmapTable"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.drawing.BitmapTable"_ustr), uno::UNO_QUERY); // Without the accompanying fix in place, this test would have failed, as the base64 stream was // not considered when parsing the fill-image style. - CPPUNIT_ASSERT(xBitmaps->hasByName("libreoffice_0")); + CPPUNIT_ASSERT(xBitmaps->hasByName(u"libreoffice_0"_ustr)); } namespace @@ -91,13 +91,13 @@ Color asColor(com::sun::star::rendering::RGBColor const& rRGBColor) CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testFontSorting) { // Given an empty document with default fonts (Liberation Sans, Lucida Sans, etc): - mxComponent = loadFromDesktop("private:factory/swriter"); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); // When saving that document to ODT: - save("writer8"); + save(u"writer8"_ustr); // Then make sure <style:font-face> elements are sorted (by style:name="..."): - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); xmlXPathObjectPtr pXPath = getXPathNode( pXmlDoc, "/office:document-content/office:font-face-decls/style:font-face"_ostr); xmlNodeSetPtr pXmlNodes = pXPath->nodesetval; @@ -158,12 +158,12 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testRtlGutter) uno::UNO_QUERY); uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies(); - uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), - uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xStandard(xStyleFamily->getByName("Standard"), + uno::Reference<container::XNameAccess> xStyleFamily( + xStyleFamilies->getByName(u"PageStyles"_ustr), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xStandard(xStyleFamily->getByName(u"Standard"_ustr), uno::UNO_QUERY); bool bRtlGutter{}; - xStandard->getPropertyValue("RtlGutter") >>= bRtlGutter; + xStandard->getPropertyValue(u"RtlGutter"_ustr) >>= bRtlGutter; // Without the accompanying fix in place, this test would have failed as // <style:page-layout-properties>'s style:writing-mode="..." did not affect RtlGutter. CPPUNIT_ASSERT(bRtlGutter); @@ -190,17 +190,17 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testWritingModeBTLR) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch); pBatch->commit(); - save("writer8"); + save(u"writer8"_ustr); // With applied fix for tdf150407 still loext:writing-mode="bt-lr" has to be written. - xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); assertXPath(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:name='FrameBTLR']/" "style:graphic-properties[@loext:writing-mode]"_ostr); assertXPath(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:name='FrameBTLR']/" "style:graphic-properties"_ostr, - "writing-mode"_ostr, "bt-lr"); + "writing-mode"_ostr, u"bt-lr"_ustr); } loadFromFile(u"tdf150407_WritingModeBTLR_style.odt"); @@ -210,11 +210,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testWritingModeBTLR) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); - save("writer8"); + save(u"writer8"_ustr); // Without the fix an faulty 'writing-mode="bt-lr"' attribute was written in productive build. // A debug build fails assertion in SvXMLNamespaceMap::GetQNameByKey(). - xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); assertXPathNoAttribute(pXmlDoc, "/office:document-styles/office:styles/" "style:style[@style:name='FrameBTLR']/style:graphic-properties"_ostr, @@ -243,11 +243,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch); pBatch->commit(); - save("writer8"); + save(u"writer8"_ustr); // With applied fix for tdf150407 still loext:vertical-rel="page-content-bottom" has to be // written. - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); assertXPath( pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name='gr1']/" @@ -256,7 +256,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin) pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name='gr1']/" "style:graphic-properties"_ostr, - "vertical-rel"_ostr, "page-content-bottom"); + "vertical-rel"_ostr, u"page-content-bottom"_ustr); } loadFromFile(u"tdf150407_PosRelBottomMargin.docx"); @@ -266,11 +266,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); - save("writer8"); + save(u"writer8"_ustr); // Without the fix an faulty 'vertical-rel="page-content-bottom"' attribute was written in // productive build. A debug build fails assertion in SvXMLNamespaceMap::GetQNameByKey(). - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); assertXPathNoAttribute(pXmlDoc, "/office:document-content/office:automatic-styles/" "style:style[@style:name='gr1']/style:graphic-properties"_ostr, @@ -299,11 +299,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch); pBatch->commit(); - save("writer8"); + save(u"writer8"_ustr); // With applied fix for tdf150407 still loext:vertical-rel="page-content-top has to be // written. - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); assertXPath( pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name='gr1']/" @@ -312,7 +312,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin) pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name='gr1']/" "style:graphic-properties"_ostr, - "vertical-rel"_ostr, "page-content-top"); + "vertical-rel"_ostr, u"page-content-top"_ustr); } loadFromFile(u"tdf150407_PosRelTopMargin.docx"); @@ -322,11 +322,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); - save("writer8"); + save(u"writer8"_ustr); // Without the fix an faulty 'vertical-rel="page-content-top"' attribute was written in // productive build. A debug build fails assertion in SvXMLNamespaceMap::GetQNameByKey(). - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); assertXPathNoAttribute(pXmlDoc, "/office:document-content/office:automatic-styles/" "style:style[@style:name='gr1']/style:graphic-properties"_ostr, @@ -341,24 +341,24 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_OldToNew) loadFromFile(u"MCGR_OldToNew.odg"); // saveAndReload includes validation and must not fail with the new elements and attributes. - saveAndReload("draw8"); + saveAndReload(u"draw8"_ustr); // Examine file markup // For compatibility the file should still have the old attributes 'start-color' and 'end-color' - xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); OString sPath = "/office:document-styles/office:styles/draw:gradient[@draw:name='red2yellow']"_ostr; - assertXPath(pXmlDoc, sPath, "start-color"_ostr, "#ff0000"); - assertXPath(pXmlDoc, sPath, "end-color"_ostr, "#ffff00"); + assertXPath(pXmlDoc, sPath, "start-color"_ostr, u"#ff0000"_ustr); + assertXPath(pXmlDoc, sPath, "end-color"_ostr, u"#ffff00"_ustr); // And it must have the new 'gradient-stop' elements. // The prefix 'loext' needs to be adapted, when the element is available in ODF strict. - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "offset"_ostr, "0"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-type"_ostr, "rgb"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-value"_ostr, "#ff0000"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "offset"_ostr, "1"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-type"_ostr, "rgb"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-value"_ostr, "#ffff00"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "offset"_ostr, u"0"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-type"_ostr, u"rgb"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-value"_ostr, u"#ff0000"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "offset"_ostr, u"1"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-type"_ostr, u"rgb"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-value"_ostr, u"#ffff00"_ustr); // Examine reloaded file uno::Reference<drawing::XShape> xShape(getShape(0)); @@ -367,10 +367,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_OldToNew) // The old properties need to be still available, as they might be used in macros. OUString sGradientName; - xShapeProperties->getPropertyValue("FillGradientName") >>= sGradientName; + xShapeProperties->getPropertyValue(u"FillGradientName"_ustr) >>= sGradientName; CPPUNIT_ASSERT_EQUAL(u"red2yellow"_ustr, sGradientName); awt::Gradient2 aGradient; - xShapeProperties->getPropertyValue("FillGradient") >>= aGradient; + xShapeProperties->getPropertyValue(u"FillGradient"_ustr) >>= aGradient; CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, Color(ColorTransparency, aGradient.StartColor)); CPPUNIT_ASSERT_EQUAL(COL_YELLOW, Color(ColorTransparency, aGradient.EndColor)); @@ -395,29 +395,29 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_OldToNew_opacity) loadFromFile(u"MCGR_OldToNew_opacity.odg"); // saveAndReload includes validation and must not fail with the new elements and attributes. - saveAndReload("draw8"); + saveAndReload(u"draw8"_ustr); // Examine file markup // For compatibility the file should still have the old attributes. - xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); OString sPath = "/office:document-styles/office:styles/draw:opacity"_ostr; - assertXPath(pXmlDoc, sPath, "start"_ostr, "10%"); // UI 90% transparency - assertXPath(pXmlDoc, sPath, "end"_ostr, "100%"); // UI 0% transparency - assertXPath(pXmlDoc, sPath, "border"_ostr, "20%"); - assertXPath(pXmlDoc, sPath, "cx"_ostr, "50%"); - assertXPath(pXmlDoc, sPath, "cy"_ostr, "50%"); - assertXPath(pXmlDoc, sPath, "style"_ostr, "radial"); + assertXPath(pXmlDoc, sPath, "start"_ostr, u"10%"_ustr); // UI 90% transparency + assertXPath(pXmlDoc, sPath, "end"_ostr, u"100%"_ustr); // UI 0% transparency + assertXPath(pXmlDoc, sPath, "border"_ostr, u"20%"_ustr); + assertXPath(pXmlDoc, sPath, "cx"_ostr, u"50%"_ustr); + assertXPath(pXmlDoc, sPath, "cy"_ostr, u"50%"_ustr); + assertXPath(pXmlDoc, sPath, "style"_ostr, u"radial"_ustr); // And it must have the new 'opacity-stop' elements. // The prefix 'loext' needs to be adapted, when the element is available in ODF strict. OString sFirstStop = sPath + "/loext:opacity-stop[1]"; - assertXPath(pXmlDoc, sFirstStop, "offset"_ostr, "0"); + assertXPath(pXmlDoc, sFirstStop, "offset"_ostr, u"0"_ustr); // Because of converting through color, the grade of opacity is not exact "0.1" double fOpacity = getXPathContent(pXmlDoc, sFirstStop + "/@svg:stop-opacity").toDouble(); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.1, fOpacity, 0.002); - assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "offset"_ostr, "1"); - assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "stop-opacity"_ostr, "1"); + assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "offset"_ostr, u"1"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "stop-opacity"_ostr, u"1"_ustr); // Examine reloaded file uno::Reference<drawing::XShape> xShape(getShape(0)); @@ -426,7 +426,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_OldToNew_opacity) // The old properties need to be still available, as they might be used in macros. awt::Gradient2 aGradient; - xShapeProperties->getPropertyValue("FillTransparenceGradient") >>= aGradient; + xShapeProperties->getPropertyValue(u"FillTransparenceGradient"_ustr) >>= aGradient; CPPUNIT_ASSERT_EQUAL(Color(0xE5E5E5), Color(ColorTransparency, aGradient.StartColor)); CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(ColorTransparency, aGradient.EndColor)); CPPUNIT_ASSERT_EQUAL(sal_Int16(20), aGradient.Border); @@ -455,32 +455,32 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_threeStops) loadFromFile(u"MCGR_threeStops.fodt"); // saveAndReload includes validation and must not fail with the new elements and attributes. - saveAndReload("draw8"); + saveAndReload(u"draw8"_ustr); // Examine file markup // For compatibility the file should still have the old attributes 'start-color' and 'end-color' - xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); OString sPath = "/office:document-styles/office:styles/draw:gradient[@draw:name='threeStops']"_ostr; - assertXPath(pXmlDoc, sPath, "start-color"_ostr, "#ff0000"); - assertXPath(pXmlDoc, sPath, "end-color"_ostr, "#ffff00"); - assertXPath(pXmlDoc, sPath, "style"_ostr, "square"); - assertXPath(pXmlDoc, sPath, "cx"_ostr, "0%"); - assertXPath(pXmlDoc, sPath, "cy"_ostr, "50%"); - assertXPath(pXmlDoc, sPath, "angle"_ostr, "45deg"); - assertXPath(pXmlDoc, sPath, "border"_ostr, "10%"); + assertXPath(pXmlDoc, sPath, "start-color"_ostr, u"#ff0000"_ustr); + assertXPath(pXmlDoc, sPath, "end-color"_ostr, u"#ffff00"_ustr); + assertXPath(pXmlDoc, sPath, "style"_ostr, u"square"_ustr); + assertXPath(pXmlDoc, sPath, "cx"_ostr, u"0%"_ustr); + assertXPath(pXmlDoc, sPath, "cy"_ostr, u"50%"_ustr); + assertXPath(pXmlDoc, sPath, "angle"_ostr, u"45deg"_ustr); + assertXPath(pXmlDoc, sPath, "border"_ostr, u"10%"_ustr); // And it must have the new 'gradient-stop' elements. // The prefix 'loext' needs to be adapted, when the element is available in ODF strict. - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "offset"_ostr, "0"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-type"_ostr, "rgb"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-value"_ostr, "#ff0000"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "offset"_ostr, "0.3"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-type"_ostr, "rgb"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-value"_ostr, "#0099bb"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[3]", "offset"_ostr, "1"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[3]", "color-type"_ostr, "rgb"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[3]", "color-value"_ostr, "#ffff00"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "offset"_ostr, u"0"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-type"_ostr, u"rgb"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-value"_ostr, u"#ff0000"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "offset"_ostr, u"0.3"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-type"_ostr, u"rgb"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-value"_ostr, u"#0099bb"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[3]", "offset"_ostr, u"1"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[3]", "color-type"_ostr, u"rgb"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[3]", "color-value"_ostr, u"#ffff00"_ustr); // Examine reloaded file uno::Reference<drawing::XShape> xShape(getShape(0)); @@ -489,10 +489,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_threeStops) // The old properties need to be still available, as they might be used in macros. OUString sGradientName; - xShapeProperties->getPropertyValue("FillGradientName") >>= sGradientName; + xShapeProperties->getPropertyValue(u"FillGradientName"_ustr) >>= sGradientName; CPPUNIT_ASSERT_EQUAL(u"threeStops"_ustr, sGradientName); awt::Gradient2 aGradient; - xShapeProperties->getPropertyValue("FillGradient") >>= aGradient; + xShapeProperties->getPropertyValue(u"FillGradient"_ustr) >>= aGradient; CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, Color(ColorTransparency, aGradient.StartColor)); CPPUNIT_ASSERT_EQUAL(COL_YELLOW, Color(ColorTransparency, aGradient.EndColor)); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_SQUARE, aGradient.Style); @@ -535,24 +535,24 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBorderRestoration) // Save to ODF_LATEST which is currently ODF 1.3 extended. Make sure gradient-stop elements have // offsets 0 and 1, and border is written as 50%. SetODFDefaultVersion(SvtSaveOptions::ODFDefaultVersion::ODFVER_LATEST); - save("impress8"); - xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); + save(u"impress8"_ustr); + xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); OString sPath = "/office:document-styles/office:styles/draw:gradient[@draw:name='Gradient_20_1']"_ostr; - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-value"_ostr, "#ff0000"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "offset"_ostr, "1"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-value"_ostr, "#ffff00"); - assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "offset"_ostr, "0"); - assertXPath(pXmlDoc, sPath, "border"_ostr, "50%"); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "color-value"_ostr, u"#ff0000"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[2]", "offset"_ostr, u"1"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "color-value"_ostr, u"#ffff00"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:gradient-stop[1]", "offset"_ostr, u"0"_ustr); + assertXPath(pXmlDoc, sPath, "border"_ostr, u"50%"_ustr); // Save to ODF 1.3 strict and make sure border, start-color and end-color are suitable set. SetODFDefaultVersion(SvtSaveOptions::ODFDefaultVersion::ODFVER_013); - save("impress8"); - pXmlDoc = parseExport("styles.xml"); + save(u"impress8"_ustr); + pXmlDoc = parseExport(u"styles.xml"_ustr); assertXPath(pXmlDoc, sPath + "/loext:gradient-stop", 0); - assertXPath(pXmlDoc, sPath, "start-color"_ostr, "#ffff00"); - assertXPath(pXmlDoc, sPath, "end-color"_ostr, "#ff0000"); - assertXPath(pXmlDoc, sPath, "border"_ostr, "50%"); + assertXPath(pXmlDoc, sPath, "start-color"_ostr, u"#ffff00"_ustr); + assertXPath(pXmlDoc, sPath, "end-color"_ostr, u"#ff0000"_ustr); + assertXPath(pXmlDoc, sPath, "border"_ostr, u"50%"_ustr); // Set back to original ODF default version. SetODFDefaultVersion(nCurrentODFVersion); @@ -573,23 +573,23 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testTransparencyBorderRestoration) // Save to ODF_LATEST which is currently ODF 1.3 extended. Make sure transparency gradient-stop //elements are written with offset 0 and 1, and border is written as 40%. SetODFDefaultVersion(SvtSaveOptions::ODFDefaultVersion::ODFVER_LATEST); - save("impress8"); - xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); + save(u"impress8"_ustr); + xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); OString sPath = "/office:document-styles/office:styles/draw:opacity[1]"_ostr; - assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "stop-opacity"_ostr, "0.9"); - assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "offset"_ostr, "1"); - assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[1]", "stop-opacity"_ostr, "0"); - assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[1]", "offset"_ostr, "0"); - assertXPath(pXmlDoc, sPath, "border"_ostr, "40%"); + assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "stop-opacity"_ostr, u"0.9"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "offset"_ostr, u"1"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[1]", "stop-opacity"_ostr, u"0"_ustr); + assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[1]", "offset"_ostr, u"0"_ustr); + assertXPath(pXmlDoc, sPath, "border"_ostr, u"40%"_ustr); // Save to ODF 1.3 strict and make sure border, start and end opacity are suitable set. SetODFDefaultVersion(SvtSaveOptions::ODFDefaultVersion::ODFVER_013); - save("impress8"); - pXmlDoc = parseExport("styles.xml"); + save(u"impress8"_ustr); + pXmlDoc = parseExport(u"styles.xml"_ustr); assertXPath(pXmlDoc, sPath + "/loext:opacity-stop", 0); - assertXPath(pXmlDoc, sPath, "start"_ostr, "0%"); - assertXPath(pXmlDoc, sPath, "end"_ostr, "90%"); - assertXPath(pXmlDoc, sPath, "border"_ostr, "40%"); + assertXPath(pXmlDoc, sPath, "start"_ostr, u"0%"_ustr); + assertXPath(pXmlDoc, sPath, "end"_ostr, u"90%"_ustr); + assertXPath(pXmlDoc, sPath, "border"_ostr, u"40%"_ustr); // Set back to original ODF default version. SetODFDefaultVersion(nCurrentODFVersion); @@ -609,8 +609,8 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testAxialGradientCompatible) //Round-trip through OOXML. // FixMe tdf#153183. Here "Attribute 'ID' is not allowed to appear in element 'v:rect'". skipValidation(); - saveAndReload("Office Open XML Text"); - saveAndReload("writer8"); + saveAndReload(u"Office Open XML Text"_ustr); + saveAndReload(u"writer8"_ustr); // Examine reloaded file uno::Reference<drawing::XShape> xShape(getShape(0)); @@ -619,7 +619,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testAxialGradientCompatible) // Without fix these would have failed with Style=0 (=LINEAR), StartColor=0xFFFF00 and Border=0. awt::Gradient2 aGradient; - xShapeProperties->getPropertyValue("FillGradient") >>= aGradient; + xShapeProperties->getPropertyValue(u"FillGradient"_ustr) >>= aGradient; CPPUNIT_ASSERT_EQUAL_MESSAGE("gradient style", awt::GradientStyle_AXIAL, aGradient.Style); CPPUNIT_ASSERT_EQUAL_MESSAGE("EndColor", sal_Int32(0xFFFF00), aGradient.EndColor); CPPUNIT_ASSERT_EQUAL_MESSAGE("StartColor", sal_Int32(0x1E90FF), aGradient.StartColor); @@ -641,8 +641,8 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testAxialTransparencyCompatible) //Round-trip through OOXML. // FixMe tdf#153183, and error in charSpace and in CharacterSet //skipValidation(); - saveAndReload("Office Open XML Text"); - saveAndReload("writer8"); + saveAndReload(u"Office Open XML Text"_ustr); + saveAndReload(u"writer8"_ustr); // Examine reloaded file uno::Reference<drawing::XShape> xShape(getShape(0)); @@ -651,7 +651,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testAxialTransparencyCompatible) // Without fix these would have failed with Style=LINEAR, StartColor=0xCCCCCC and wrong Border. awt::Gradient2 aTransGradient; - xShapeProperties->getPropertyValue("FillTransparenceGradient") >>= aTransGradient; + xShapeProperties->getPropertyValue(u"FillTransparenceGradient"_ustr) >>= aTransGradient; CPPUNIT_ASSERT_EQUAL_MESSAGE("gradient style", awt::GradientStyle_AXIAL, aTransGradient.Style); CPPUNIT_ASSERT_EQUAL_MESSAGE("EndColor", sal_Int32(0xCCCCCC), aTransGradient.EndColor); CPPUNIT_ASSERT_EQUAL_MESSAGE("StartColor", sal_Int32(0x191919), aTransGradient.StartColor); diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx index e6433b2b70f9..1679af04bc1f 100644 --- a/xmloff/qa/unit/text.cxx +++ b/xmloff/qa/unit/text.cxx @@ -39,7 +39,7 @@ public: }; XmloffStyleTest::XmloffStyleTest() - : UnoApiXmlTest("/xmloff/qa/unit/data/") + : UnoApiXmlTest(u"/xmloff/qa/unit/data/"_ustr) { } @@ -52,11 +52,11 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMailMergeInEditeng) CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCommentProperty) { - mxComponent = loadFromDesktop("private:factory/swriter"); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); uno::Sequence<beans::PropertyValue> aCommentProps = comphelper::InitPropertySequence({ - { "Text", uno::Any(OUString("comment")) }, + { "Text", uno::Any(u"comment"_ustr) }, }); - dispatchCommand(mxComponent, ".uno:InsertAnnotation", aCommentProps); + dispatchCommand(mxComponent, u".uno:InsertAnnotation"_ustr, aCommentProps); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); @@ -64,25 +64,25 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCommentProperty) uno::Reference<container::XEnumerationAccess> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); uno::Reference<container::XEnumeration> xPortionEnum = xPara->createEnumeration(); uno::Reference<beans::XPropertySet> xPortion(xPortionEnum->nextElement(), uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xField(xPortion->getPropertyValue("TextField"), + uno::Reference<beans::XPropertySet> xField(xPortion->getPropertyValue(u"TextField"_ustr), uno::UNO_QUERY); - xField->setPropertyValue("Resolved", uno::Any(true)); - xField->setPropertyValue("ParentName", uno::Any(OUString("parent_comment_name"))); + xField->setPropertyValue(u"Resolved"_ustr, uno::Any(true)); + xField->setPropertyValue(u"ParentName"_ustr, uno::Any(u"parent_comment_name"_ustr)); - saveAndReload("writer8"); + saveAndReload(u"writer8"_ustr); xTextDocument.set(mxComponent, uno::UNO_QUERY); xParaEnumAccess.set(xTextDocument->getText(), uno::UNO_QUERY); xParaEnum = xParaEnumAccess->createEnumeration(); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); xPortionEnum = xPara->createEnumeration(); xPortion.set(xPortionEnum->nextElement(), uno::UNO_QUERY); - xField.set(xPortion->getPropertyValue("TextField"), uno::UNO_QUERY); + xField.set(xPortion->getPropertyValue(u"TextField"_ustr), uno::UNO_QUERY); bool bResolved = false; - xField->getPropertyValue("Resolved") >>= bResolved; + xField->getPropertyValue(u"Resolved"_ustr) >>= bResolved; OUString parentName; - xField->getPropertyValue("ParentName") >>= parentName; + xField->getPropertyValue(u"ParentName"_ustr) >>= parentName; CPPUNIT_ASSERT_EQUAL( - OUString("parent_comment_name"), + u"parent_comment_name"_ustr, parentName); // Check if the parent comment name is written and read correctly. // Without the accompanying fix in place, this test would have failed, as the resolved state was // not saved for non-range comments. @@ -92,19 +92,19 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCommentProperty) CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBibliographyLocalUrl) { // Given a document with a biblio field, with non-empty LocalURL: - mxComponent = loadFromDesktop("private:factory/swriter"); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xField( - xFactory->createInstance("com.sun.star.text.TextField.Bibliography"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.text.TextField.Bibliography"_ustr), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aFields = { - comphelper::makePropertyValue("BibiliographicType", text::BibliographyDataType::WWW), - comphelper::makePropertyValue("Identifier", OUString("AT")), - comphelper::makePropertyValue("Author", OUString("Author")), - comphelper::makePropertyValue("Title", OUString("Title")), - comphelper::makePropertyValue("URL", OUString("http://www.example.com/test.pdf#page=1")), - comphelper::makePropertyValue("LocalURL", OUString("file:///home/me/test.pdf")), + comphelper::makePropertyValue(u"BibiliographicType"_ustr, text::BibliographyDataType::WWW), + comphelper::makePropertyValue(u"Identifier"_ustr, u"AT"_ustr), + comphelper::makePropertyValue(u"Author"_ustr, u"Author"_ustr), + comphelper::makePropertyValue(u"Title"_ustr, u"Title"_ustr), + comphelper::makePropertyValue(u"URL"_ustr, u"http://www.example.com/test.pdf#page=1"_ustr), + comphelper::makePropertyValue(u"LocalURL"_ustr, u"file:///home/me/test.pdf"_ustr), }; - xField->setPropertyValue("Fields", uno::Any(aFields)); + xField->setPropertyValue(u"Fields"_ustr, uno::Any(aFields)); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); @@ -112,7 +112,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBibliographyLocalUrl) xText->insertTextContent(xCursor, xContent, /*bAbsorb=*/false); // When invoking ODT export + import on it: - saveAndReload("writer8"); + saveAndReload(u"writer8"_ustr); // Without the accompanying fix in place, this test would have resulted in an assertion failure, // as LocalURL was mapped to XML_TOKEN_INVALID. @@ -124,27 +124,28 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBibliographyLocalUrl) uno::Reference<container::XEnumerationAccess> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); uno::Reference<container::XEnumeration> xPortionEnum = xPara->createEnumeration(); uno::Reference<beans::XPropertySet> xPortion(xPortionEnum->nextElement(), uno::UNO_QUERY); - xField.set(xPortion->getPropertyValue("TextField"), uno::UNO_QUERY); - comphelper::SequenceAsHashMap aMap(xField->getPropertyValue("Fields")); - CPPUNIT_ASSERT(aMap.contains("LocalURL")); - auto aActual = aMap["LocalURL"].get<OUString>(); - CPPUNIT_ASSERT_EQUAL(OUString("file:///home/me/test.pdf"), aActual); + xField.set(xPortion->getPropertyValue(u"TextField"_ustr), uno::UNO_QUERY); + comphelper::SequenceAsHashMap aMap(xField->getPropertyValue(u"Fields"_ustr)); + CPPUNIT_ASSERT(aMap.contains(u"LocalURL"_ustr)); + auto aActual = aMap[u"LocalURL"_ustr].get<OUString>(); + CPPUNIT_ASSERT_EQUAL(u"file:///home/me/test.pdf"_ustr, aActual); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBibliographyTargetURL1) { // Given a document with a biblio field, with non-empty LocalURL: - mxComponent = loadFromDesktop("private:factory/swriter"); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xField( - xFactory->createInstance("com.sun.star.text.TextField.Bibliography"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.text.TextField.Bibliography"_ustr), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aFields = { - comphelper::makePropertyValue("Identifier", OUString("AT")), - comphelper::makePropertyValue("URL", OUString("https://display.url/test1.pdf#page=1")), - comphelper::makePropertyValue("TargetType", OUString("1")), - comphelper::makePropertyValue("TargetURL", OUString("https://target.url/test2.pdf#page=2")), + comphelper::makePropertyValue(u"Identifier"_ustr, u"AT"_ustr), + comphelper::makePropertyValue(u"URL"_ustr, u"https://display.url/test1.pdf#page=1"_ustr), + comphelper::makePropertyValue(u"TargetType"_ustr, u"1"_ustr), + comphelper::makePropertyValue(u"TargetURL"_ustr, + u"https://target.url/test2.pdf#page=2"_ustr), }; - xField->setPropertyValue("Fields", uno::Any(aFields)); + xField->setPropertyValue(u"Fields"_ustr, uno::Any(aFields)); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); @@ -152,7 +153,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBibliographyTargetURL1) xText->insertTextContent(xCursor, xContent, /*bAbsorb=*/false); // When invoking ODT export + import on it: - saveAndReload("writer8"); + saveAndReload(u"writer8"_ustr); // Then make sure that URL, TargetURL and UseTargetURL are preserved and independent: xTextDocument.set(mxComponent, uno::UNO_QUERY); @@ -162,19 +163,19 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBibliographyTargetURL1) uno::Reference<container::XEnumerationAccess> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); uno::Reference<container::XEnumeration> xPortionEnum = xPara->createEnumeration(); uno::Reference<beans::XPropertySet> xPortion(xPortionEnum->nextElement(), uno::UNO_QUERY); - xField.set(xPortion->getPropertyValue("TextField"), uno::UNO_QUERY); - comphelper::SequenceAsHashMap aMap(xField->getPropertyValue("Fields")); + xField.set(xPortion->getPropertyValue(u"TextField"_ustr), uno::UNO_QUERY); + comphelper::SequenceAsHashMap aMap(xField->getPropertyValue(u"Fields"_ustr)); - CPPUNIT_ASSERT(aMap.contains("URL")); - CPPUNIT_ASSERT_EQUAL(OUString("https://display.url/test1.pdf#page=1"), - aMap["URL"].get<OUString>()); + CPPUNIT_ASSERT(aMap.contains(u"URL"_ustr)); + CPPUNIT_ASSERT_EQUAL(u"https://display.url/test1.pdf#page=1"_ustr, + aMap[u"URL"_ustr].get<OUString>()); - CPPUNIT_ASSERT(aMap.contains("TargetURL")); - CPPUNIT_ASSERT_EQUAL(OUString("https://target.url/test2.pdf#page=2"), - aMap["TargetURL"].get<OUString>()); + CPPUNIT_ASSERT(aMap.contains(u"TargetURL"_ustr)); + CPPUNIT_ASSERT_EQUAL(u"https://target.url/test2.pdf#page=2"_ustr, + aMap[u"TargetURL"_ustr].get<OUString>()); - CPPUNIT_ASSERT(aMap.contains("TargetType")); - CPPUNIT_ASSERT_EQUAL(OUString("1"), aMap["TargetType"].get<OUString>()); + CPPUNIT_ASSERT(aMap.contains(u"TargetType"_ustr)); + CPPUNIT_ASSERT_EQUAL(u"1"_ustr, aMap[u"TargetType"_ustr].get<OUString>()); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCommentTableBorder) @@ -195,23 +196,24 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testParaStyleListLevel) uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies(); uno::Reference<container::XNameAccess> xStyleFamily( - xStyleFamilies->getByName("ParagraphStyles"), uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xStyle(xStyleFamily->getByName("mystyle"), uno::UNO_QUERY); + xStyleFamilies->getByName(u"ParagraphStyles"_ustr), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xStyle(xStyleFamily->getByName(u"mystyle"_ustr), + uno::UNO_QUERY); sal_Int16 nNumberingLevel{}; - CPPUNIT_ASSERT(xStyle->getPropertyValue("NumberingLevel") >>= nNumberingLevel); + CPPUNIT_ASSERT(xStyle->getPropertyValue(u"NumberingLevel"_ustr) >>= nNumberingLevel); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), nNumberingLevel); // Test the export as well: - save("writer8"); + save(u"writer8"_ustr); // Then make sure we save the style's numbering level: - xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); // Without the accompanying fix in place, this failed with: // - XPath '/office:document-styles/office:styles/style:style[@style:name='mystyle']' no attribute 'list-level' exist // i.e. a custom NumberingLevel was lost on save. assertXPath(pXmlDoc, "/office:document-styles/office:styles/style:style[@style:name='mystyle']"_ostr, - "list-level"_ostr, "2"); + "list-level"_ostr, u"2"_ustr); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContinueNumberingWord) @@ -228,12 +230,12 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContinueNumberingWord) xParaEnum->nextElement(); xParaEnum->nextElement(); uno::Reference<beans::XPropertySet> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); - auto aActual = xPara->getPropertyValue("ListLabelString").get<OUString>(); + auto aActual = xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>(); // Without the accompanying fix in place, this failed with: // - Expected: 2. // - Actual : 1. // i.e. the numbering was not continued, like in Word. - CPPUNIT_ASSERT_EQUAL(OUString("2."), aActual); + CPPUNIT_ASSERT_EQUAL(u"2."_ustr, aActual); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListId) @@ -242,10 +244,10 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListId) loadFromFile(u"list-id.fodt"); // When storing that document as ODF: - save("writer8"); + save(u"writer8"_ustr); // Then make sure that unreferenced xml:id="..." attributes are not written: - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // Without the accompanying fix in place, this failed with: // - XPath '//text:list' unexpected 'id' attribute // i.e. xml:id="..." was written unconditionally, even when no other list needed it. @@ -262,55 +264,55 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListId2) auto xParaEnum(xParaEnumAccess->createEnumeration()); auto xPara(xParaEnum->nextElement().queryThrow<beans::XPropertySet>()); - auto aActual(xPara->getPropertyValue("ListLabelString").get<OUString>()); - CPPUNIT_ASSERT_EQUAL(OUString("1."), aActual); + auto aActual(xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"1."_ustr, aActual); xParaEnum->nextElement(); // Skip empty intermediate paragraph xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - aActual = xPara->getPropertyValue("ListLabelString").get<OUString>(); - CPPUNIT_ASSERT_EQUAL(OUString("2."), aActual); + aActual = xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>(); + CPPUNIT_ASSERT_EQUAL(u"2."_ustr, aActual); xParaEnum->nextElement(); // Skip empty intermediate paragraph xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - aActual = xPara->getPropertyValue("ListLabelString").get<OUString>(); - CPPUNIT_ASSERT_EQUAL(OUString("3."), aActual); + aActual = xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>(); + CPPUNIT_ASSERT_EQUAL(u"3."_ustr, aActual); xParaEnum->nextElement(); // Skip empty intermediate paragraph xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - aActual = xPara->getPropertyValue("ListLabelString").get<OUString>(); - CPPUNIT_ASSERT_EQUAL(OUString("4."), aActual); + aActual = xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>(); + CPPUNIT_ASSERT_EQUAL(u"4."_ustr, aActual); // When storing that document as ODF: // Without the fix in place, automatic validation would fail with: // Error: "list123456789012345" is referenced by an IDREF, but not defined. - saveAndReload("writer8"); + saveAndReload(u"writer8"_ustr); xTextDocument.set(mxComponent.queryThrow<css::text::XTextDocument>()); xParaEnumAccess.set(xTextDocument->getText().queryThrow<css::container::XEnumerationAccess>()); xParaEnum.set(xParaEnumAccess->createEnumeration()); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - aActual = xPara->getPropertyValue("ListLabelString").get<OUString>(); - CPPUNIT_ASSERT_EQUAL(OUString("1."), aActual); + aActual = xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>(); + CPPUNIT_ASSERT_EQUAL(u"1."_ustr, aActual); xParaEnum->nextElement(); // Skip empty intermediate paragraph xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - aActual = xPara->getPropertyValue("ListLabelString").get<OUString>(); - CPPUNIT_ASSERT_EQUAL(OUString("2."), aActual); + aActual = xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>(); + CPPUNIT_ASSERT_EQUAL(u"2."_ustr, aActual); xParaEnum->nextElement(); // Skip empty intermediate paragraph xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - aActual = xPara->getPropertyValue("ListLabelString").get<OUString>(); - CPPUNIT_ASSERT_EQUAL(OUString("3."), aActual); + aActual = xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>(); + CPPUNIT_ASSERT_EQUAL(u"3."_ustr, aActual); xParaEnum->nextElement(); // Skip empty intermediate paragraph // Check that the last item number is correct xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - aActual = xPara->getPropertyValue("ListLabelString").get<OUString>(); + aActual = xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>(); // Without the fix in place, this would fail with: // - Expected: 4. // - Actual : 1. // i.e. the numbering was not continued. - CPPUNIT_ASSERT_EQUAL(OUString("4."), aActual); + CPPUNIT_ASSERT_EQUAL(u"4."_ustr, aActual); // Then make sure that required xml:id="..." attributes is written when the style changes: - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); CPPUNIT_ASSERT(pXmlDoc); // Without the fix in place, this would fail, // i.e. xml:id="..." was omitted, even though it was needed for the next item. @@ -325,7 +327,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListIdState) { // tdf#149668: given a document with 3 paragraphs: an outer numbering on para 1 & 3, an inner // numbering on para 2: - mxComponent = loadFromDesktop("private:factory/swriter"); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); auto xTextDocument(mxComponent.queryThrow<text::XTextDocument>()); auto xText(xTextDocument->getText()); xText->insertControlCharacter(xText->getEnd(), css::text::ControlCharacter::PARAGRAPH_BREAK, @@ -336,15 +338,15 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListIdState) auto paraEnumAccess(xText.queryThrow<container::XEnumerationAccess>()); auto paraEnum(paraEnumAccess->createEnumeration()); auto xParaProps(paraEnum->nextElement().queryThrow<beans::XPropertySet>()); - xParaProps->setPropertyValue("NumberingStyleName", css::uno::Any(OUString("Numbering ABC"))); + xParaProps->setPropertyValue(u"NumberingStyleName"_ustr, css::uno::Any(u"Numbering ABC"_ustr)); xParaProps.set(paraEnum->nextElement().queryThrow<beans::XPropertySet>()); - xParaProps->setPropertyValue("NumberingStyleName", css::uno::Any(OUString("Numbering 123"))); + xParaProps->setPropertyValue(u"NumberingStyleName"_ustr, css::uno::Any(u"Numbering 123"_ustr)); xParaProps.set(paraEnum->nextElement().queryThrow<beans::XPropertySet>()); - xParaProps->setPropertyValue("NumberingStyleName", css::uno::Any(OUString("Numbering ABC"))); + xParaProps->setPropertyValue(u"NumberingStyleName"_ustr, css::uno::Any(u"Numbering ABC"_ustr)); // When storing that document as ODF: - save("writer8"); - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + save(u"writer8"_ustr); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // Make sure that xml:id="..." gets written for para 1, as it'll be continued in para 3. // Without the accompanying fix in place, this test would have failed, @@ -368,79 +370,79 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListIdOnRestart) auto xParaEnum(xParaEnumAccess->createEnumeration()); auto xPara(xParaEnum->nextElement().queryThrow<beans::XPropertySet>()); - auto aActual(xPara->getPropertyValue("ListLabelString").get<OUString>()); - CPPUNIT_ASSERT_EQUAL(OUString("1."), aActual); - OUString list_id = xPara->getPropertyValue("ListId").get<OUString>(); + auto aActual(xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"1."_ustr, aActual); + OUString list_id = xPara->getPropertyValue(u"ListId"_ustr).get<OUString>(); xParaEnum->nextElement(); // Skip empty intermediate paragraph xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY_THROW); - aActual = xPara->getPropertyValue("ListLabelString").get<OUString>(); - CPPUNIT_ASSERT_EQUAL(OUString("2."), aActual); - CPPUNIT_ASSERT_EQUAL(list_id, xPara->getPropertyValue("ListId").get<OUString>()); + aActual = xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>(); + CPPUNIT_ASSERT_EQUAL(u"2."_ustr, aActual); + CPPUNIT_ASSERT_EQUAL(list_id, xPara->getPropertyValue(u"ListId"_ustr).get<OUString>()); xParaEnum->nextElement(); // Skip empty intermediate paragraph xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - aActual = xPara->getPropertyValue("ListLabelString").get<OUString>(); + aActual = xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>(); // Check that restart was applied correctly, with simple 'text:continue-numbering="true"' - CPPUNIT_ASSERT_EQUAL(OUString("1."), aActual); - CPPUNIT_ASSERT_EQUAL(list_id, xPara->getPropertyValue("ListId").get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"1."_ustr, aActual); + CPPUNIT_ASSERT_EQUAL(list_id, xPara->getPropertyValue(u"ListId"_ustr).get<OUString>()); // When storing that document as ODF: - saveAndReload("writer8"); + saveAndReload(u"writer8"_ustr); xTextDocument.set(mxComponent, uno::UNO_QUERY_THROW); xParaEnumAccess.set(xTextDocument->getText(), uno::UNO_QUERY_THROW); xParaEnum.set(xParaEnumAccess->createEnumeration()); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY_THROW); - aActual = xPara->getPropertyValue("ListLabelString").get<OUString>(); - CPPUNIT_ASSERT_EQUAL(OUString("1."), aActual); - list_id = xPara->getPropertyValue("ListId").get<OUString>(); + aActual = xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>(); + CPPUNIT_ASSERT_EQUAL(u"1."_ustr, aActual); + list_id = xPara->getPropertyValue(u"ListId"_ustr).get<OUString>(); xParaEnum->nextElement(); // Skip empty intermediate paragraph xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY_THROW); - aActual = xPara->getPropertyValue("ListLabelString").get<OUString>(); - CPPUNIT_ASSERT_EQUAL(OUString("2."), aActual); - CPPUNIT_ASSERT_EQUAL(list_id, xPara->getPropertyValue("ListId").get<OUString>()); + aActual = xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>(); + CPPUNIT_ASSERT_EQUAL(u"2."_ustr, aActual); + CPPUNIT_ASSERT_EQUAL(list_id, xPara->getPropertyValue(u"ListId"_ustr).get<OUString>()); xParaEnum->nextElement(); // Skip empty intermediate paragraph xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY_THROW); - aActual = xPara->getPropertyValue("ListLabelString").get<OUString>(); - CPPUNIT_ASSERT_EQUAL(OUString("1."), aActual); - CPPUNIT_ASSERT_EQUAL(list_id, xPara->getPropertyValue("ListId").get<OUString>()); + aActual = xPara->getPropertyValue(u"ListLabelString"_ustr).get<OUString>(); + CPPUNIT_ASSERT_EQUAL(u"1."_ustr, aActual); + CPPUNIT_ASSERT_EQUAL(list_id, xPara->getPropertyValue(u"ListId"_ustr).get<OUString>()); // Then make sure that no xml:id="..." attribute is written, even in restarted case: - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "//text:list"_ostr, 3); assertXPathNoAttribute(pXmlDoc, "//text:list[1]"_ostr, "id"_ostr); assertXPathNoAttribute(pXmlDoc, "//text:list[2]"_ostr, "id"_ostr); assertXPathNoAttribute(pXmlDoc, "//text:list[3]"_ostr, "id"_ostr); assertXPathNoAttribute(pXmlDoc, "//text:list[3]"_ostr, "continue-list"_ostr); - assertXPath(pXmlDoc, "//text:list[3]"_ostr, "continue-numbering"_ostr, "true"); + assertXPath(pXmlDoc, "//text:list[3]"_ostr, "continue-numbering"_ostr, u"true"_ustr); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testClearingBreakExport) { // Given a document with a clearing break: - mxComponent = loadFromDesktop("private:factory/swriter"); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextContent> xLineBreak( - xMSF->createInstance("com.sun.star.text.LineBreak"), uno::UNO_QUERY); + xMSF->createInstance(u"com.sun.star.text.LineBreak"_ustr), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xLineBreakProps(xLineBreak, uno::UNO_QUERY); // SwLineBreakClear::ALL; sal_Int16 eClear = 3; - xLineBreakProps->setPropertyValue("Clear", uno::Any(eClear)); + xLineBreakProps->setPropertyValue(u"Clear"_ustr, uno::Any(eClear)); uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); xText->insertTextContent(xCursor, xLineBreak, /*bAbsorb=*/false); // When exporting to ODT: - save("writer8"); + save(u"writer8"_ustr); // Then make sure the expected markup is used: - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // Without the accompanying fix in place, this failed with: // - XPath '//text:line-break' number of nodes is incorrect // i.e. the clearing break was lost on export. - assertXPath(pXmlDoc, "//text:line-break"_ostr, "clear"_ostr, "all"); + assertXPath(pXmlDoc, "//text:line-break"_ostr, "clear"_ostr, u"all"_ustr); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testClearingBreakImport) @@ -466,108 +468,109 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testClearingBreakImport) // linebreak, text). uno::Reference<beans::XPropertySet> xPortion(xPortions->nextElement(), uno::UNO_QUERY); OUString aTextPortionType; - xPortion->getPropertyValue("TextPortionType") >>= aTextPortionType; - CPPUNIT_ASSERT_EQUAL(OUString("LineBreak"), aTextPortionType); + xPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aTextPortionType; + CPPUNIT_ASSERT_EQUAL(u"LineBreak"_ustr, aTextPortionType); uno::Reference<text::XTextContent> xLineBreak; - xPortion->getPropertyValue("LineBreak") >>= xLineBreak; + xPortion->getPropertyValue(u"LineBreak"_ustr) >>= xLineBreak; uno::Reference<beans::XPropertySet> xLineBreakProps(xLineBreak, uno::UNO_QUERY); sal_Int16 eClear{}; - xLineBreakProps->getPropertyValue("Clear") >>= eClear; + xLineBreakProps->getPropertyValue(u"Clear"_ustr) >>= eClear; CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(3), eClear); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testRelativeWidth) { // Given a document with an 50% wide text frame: - mxComponent = loadFromDesktop("private:factory/swriter"); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies(); - uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), - uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xStyle(xStyleFamily->getByName("Standard"), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamily( + xStyleFamilies->getByName(u"PageStyles"_ustr), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xStyle(xStyleFamily->getByName(u"Standard"_ustr), + uno::UNO_QUERY); // Body frame width is 6cm (2+2cm margin). - xStyle->setPropertyValue("Width", uno::Any(static_cast<sal_Int32>(10000))); + xStyle->setPropertyValue(u"Width"_ustr, uno::Any(static_cast<sal_Int32>(10000))); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextContent> xTextFrame( - xMSF->createInstance("com.sun.star.text.TextFrame"), uno::UNO_QUERY); + xMSF->createInstance(u"com.sun.star.text.TextFrame"_ustr), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xTextFrameProps(xTextFrame, uno::UNO_QUERY); - xTextFrameProps->setPropertyValue("RelativeWidth", uno::Any(static_cast<sal_Int16>(50))); + xTextFrameProps->setPropertyValue(u"RelativeWidth"_ustr, uno::Any(static_cast<sal_Int16>(50))); uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); xText->insertTextContent(xCursor, xTextFrame, /*bAbsorb=*/false); // Body frame width is 16cm. - xStyle->setPropertyValue("Width", uno::Any(static_cast<sal_Int32>(20000))); + xStyle->setPropertyValue(u"Width"_ustr, uno::Any(static_cast<sal_Int32>(20000))); - save("writer8"); + save(u"writer8"_ustr); - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // Without the accompanying fix in place, this failed with: // - Expected: 3.1492in (8cm) // - Actual : 0.0161in (0.04 cm) // i.e. the fallback width value wasn't the expected half of the body frame width, but a smaller // value. - assertXPath(pXmlDoc, "//draw:frame"_ostr, "width"_ostr, "3.1492in"); + assertXPath(pXmlDoc, "//draw:frame"_ostr, "width"_ostr, u"3.1492in"_ustr); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testScaleWidthAndHeight) { // Given a broken document where both IsSyncHeightToWidth and IsSyncWidthToHeight are set to // true: - mxComponent = loadFromDesktop("private:factory/swriter"); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextContent> xTextFrame( - xMSF->createInstance("com.sun.star.text.TextFrame"), uno::UNO_QUERY); + xMSF->createInstance(u"com.sun.star.text.TextFrame"_ustr), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xTextFrameProps(xTextFrame, uno::UNO_QUERY); - xTextFrameProps->setPropertyValue("Width", uno::Any(static_cast<sal_Int16>(2000))); - xTextFrameProps->setPropertyValue("Height", uno::Any(static_cast<sal_Int16>(1000))); - xTextFrameProps->setPropertyValue("IsSyncHeightToWidth", uno::Any(true)); - xTextFrameProps->setPropertyValue("IsSyncWidthToHeight", uno::Any(true)); + xTextFrameProps->setPropertyValue(u"Width"_ustr, uno::Any(static_cast<sal_Int16>(2000))); + xTextFrameProps->setPropertyValue(u"Height"_ustr, uno::Any(static_cast<sal_Int16>(1000))); + xTextFrameProps->setPropertyValue(u"IsSyncHeightToWidth"_ustr, uno::Any(true)); + xTextFrameProps->setPropertyValue(u"IsSyncWidthToHeight"_ustr, uno::Any(true)); uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); xText->insertTextContent(xCursor, xTextFrame, /*bAbsorb=*/false); // When exporting to ODT: - save("writer8"); + save(u"writer8"_ustr); // Then make sure that we still export a non-zero size: - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // Without the accompanying fix in place, this failed with: // - Expected: 0.7874in // - Actual : 0in // i.e. the exported size was 0, not 2000 mm100 in inches. - assertXPath(pXmlDoc, "//draw:frame"_ostr, "width"_ostr, "0.7874in"); + assertXPath(pXmlDoc, "//draw:frame"_ostr, "width"_ostr, u"0.7874in"_ustr); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContentControlExport) { // Given a document with a content control around one or more text portions: - mxComponent = loadFromDesktop("private:factory/swriter"); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); - xText->insertString(xCursor, "test", /*bAbsorb=*/false); + xText->insertString(xCursor, u"test"_ustr, /*bAbsorb=*/false); xCursor->gotoStart(/*bExpand=*/false); xCursor->gotoEnd(/*bExpand=*/true); uno::Reference<text::XTextContent> xContentControl( - xMSF->createInstance("com.sun.star.text.ContentControl"), uno::UNO_QUERY); + xMSF->createInstance(u"com.sun.star.text.ContentControl"_ustr), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xContentControlProps(xContentControl, uno::UNO_QUERY); - xContentControlProps->setPropertyValue("ShowingPlaceHolder", uno::Any(true)); + xContentControlProps->setPropertyValue(u"ShowingPlaceHolder"_ustr, uno::Any(true)); xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When exporting to ODT: - save("writer8"); + save(u"writer8"_ustr); // Then make sure the expected markup is used: - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // Without the accompanying fix in place, this failed with: // - XPath '//loext:content-control' number of nodes is incorrect // i.e. the content control was lost on export. - assertXPath(pXmlDoc, "//loext:content-control"_ostr, "showing-place-holder"_ostr, "true"); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "showing-place-holder"_ostr, u"true"_ustr); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContentControlImport) @@ -585,26 +588,26 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContentControlImport) uno::Reference<container::XEnumeration> xPortions = xParagraph->createEnumeration(); uno::Reference<beans::XPropertySet> xTextPortion(xPortions->nextElement(), uno::UNO_QUERY); OUString aPortionType; - xTextPortion->getPropertyValue("TextPortionType") >>= aPortionType; + xTextPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aPortionType; // Without the accompanying fix in place, this failed with: // - Expected: ContentControl // - Actual : Text // i.e. the content control was lost on import. - CPPUNIT_ASSERT_EQUAL(OUString("ContentControl"), aPortionType); + CPPUNIT_ASSERT_EQUAL(u"ContentControl"_ustr, aPortionType); uno::Reference<text::XTextContent> xContentControl; - xTextPortion->getPropertyValue("ContentControl") >>= xContentControl; + xTextPortion->getPropertyValue(u"ContentControl"_ustr) >>= xContentControl; uno::Reference<text::XTextRange> xContentControlRange(xContentControl, uno::UNO_QUERY); uno::Reference<text::XText> xText = xContentControlRange->getText(); uno::Reference<container::XEnumerationAccess> xContentEnumAccess(xText, uno::UNO_QUERY); uno::Reference<container::XEnumeration> xContentEnum = xContentEnumAccess->createEnumeration(); uno::Reference<text::XTextRange> xContent(xContentEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("test"), xContent->getString()); + CPPUNIT_ASSERT_EQUAL(u"test"_ustr, xContent->getString()); } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCheckboxContentControlExport) { // Given a document with a checkbox content control around a text portion: - mxComponent = loadFromDesktop("private:factory/swriter"); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); @@ -613,21 +616,21 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCheckboxContentControlExport) xCursor->gotoStart(/*bExpand=*/false); xCursor->gotoEnd(/*bExpand=*/true); uno::Reference<text::XTextContent> xContentControl( - xMSF->createInstance("com.sun.star.text.ContentControl"), uno::UNO_QUERY); + xMSF->createInstance(u"com.sun.star.text.ContentControl"_ustr), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xContentControlProps(xContentControl, uno::UNO_QUERY); - xContentControlProps->setPropertyValue("Checkbox", uno::Any(true)); - xContentControlProps->setPropertyValue("Checked", uno::Any(true)); - xContentControlProps->setPropertyValue("CheckedState", uno::Any(u"☒"_ustr)); - xContentControlProps->setPropertyValue("UncheckedState", uno::Any(u"☐"_ustr)); + xContentControlProps->setPropertyValue(u"Checkbox"_ustr, uno::Any(true)); + xContentControlProps->setPropertyValue(u"Checked"_ustr, uno::Any(true)); + xContentControlProps->setPropertyValue(u"CheckedState"_ustr, uno::Any(u"☒"_ustr)); + xContentControlProps->setPropertyValue(u"UncheckedState"_ustr, uno::Any(u"☐"_ustr)); xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When exporting to ODT: - save("writer8"); + save(u"writer8"_ustr); // Then make sure the expected markup is used: - xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); - assertXPath(pXmlDoc, "//loext:content-control"_ostr, "checkbox"_ostr, "true"); - assertXPath(pXmlDoc, "//loext:content-control"_ostr, "checked"_ostr, "true"); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "checkbox"_ostr, u"true"_ustr); + assertXPath(pXmlDoc, "//loext:content-control"_ostr, "checked"_ostr, u"true"_ustr); assertXPath(pXmlDoc, "//loext:content-control"_ostr, "checked-state"_ostr, u"☒"_ustr); assertXPath(pXmlDoc, "//loext:content-control"_ostr, "unchecked-state"_ostr, u"☐"_ustr); } @@ -647,24 +650,24 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCheckboxContentControlImport) uno::Reference<container::XEnumeration> xPortions = xParagraph->createEnumeration(); uno::Reference<beans::XPropertySet> xTextPortion(xPortions->nextElement(), uno::UNO_QUERY); OUString aPortionType; - xTextPortion->getPropertyValue("TextPortionType") >>= aPortionType; - CPPUNIT_ASSERT_EQUAL(OUString("ContentControl"), aPortionType); + xTextPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aPortionType; + CPPUNIT_ASSERT_EQUAL(u"ContentControl"_ustr, aPortionType); uno::Reference<text::XTextContent> xContentControl; - xTextPortion->getPropertyValue("ContentControl") >>= xContentControl; + xTextPortion->getPropertyValue(u"ContentControl"_ustr) >>= xContentControl; uno::Reference<beans::XPropertySet> xContentControlProps(xContentControl, uno::UNO_QUERY); bool bCheckbox{}; - xContentControlProps->getPropertyValue("Checkbox") >>= bCheckbox; + xContentControlProps->getPropertyValue(u"Checkbox"_ustr) >>= bCheckbox; // Without the accompanying fix in place, this failed, as the checkbox-related attributes were // ignored on import. CPPUNIT_ASSERT(bCheckbox); bool bChecked{}; - xContentControlProps->getPropertyValue("Checked") >>= bChecked; + xContentControlProps->getPropertyValue(u"Checked"_ustr) >>= bChecked; CPPUNIT_ASSERT(bChecked); OUString aCheckedState; - xContentControlProps->getPropertyValue("CheckedState") >>= aCheckedState; + xContentControlProps->getPropertyValue(u"CheckedState"_ustr) >>= aCheckedState; CPPUNIT_ASSERT_EQUAL(u"☒"_ustr, aCheckedState); OUString aUncheckedState; - xContentControlProps->getPropertyValue("UncheckedState") >>= aUncheckedState; + xContentControlProps->getPropertyValue(u"UncheckedState"_ustr) >>= aUncheckedState; CPPUNIT_ASSERT_EQUAL(u"☐"_ustr, aUncheckedState); uno::Reference<text::XTextRange> xContentControlRange(xContentControl, uno::UNO_QUERY); uno::Reference<text::XText> xText = xContentControlRange->getText(); @@ -677,57 +680,60 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCheckboxContentControlImport) CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDropdownContentControlExport) { // Given a document with a dropdown content control around a text portion: - mxComponent = loadFromDesktop("private:factory/swriter"); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); - xText->insertString(xCursor, "choose an item", /*bAbsorb=*/false); + xText->insertString(xCursor, u"choose an item"_ustr, /*bAbsorb=*/false); xCursor->gotoStart(/*bExpand=*/false); xCursor->gotoEnd(/*bExpand=*/true); uno::Reference<text::XTextContent> xContentControl( - xMSF->createInstance("com.sun.star.text.ContentControl"), uno::UNO_QUERY); + xMSF->createInstance(u"com.sun.star.text.ContentControl"_ustr), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xContentControlProps(xContentControl, uno::UNO_QUERY); { - xContentControlProps->setPropertyValue("DropDown", uno::Any(true)); + xContentControlProps->setPropertyValue(u"DropDown"_ustr, uno::Any(true)); -e ... etc. - the rest is truncated
