diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-06-13 15:08:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-06-13 19:56:40 +0200 |
commit | 902541d805c7de0c2f10b1c9ed5520a1e6ce5d12 (patch) | |
tree | f84ddb8bbc89d106b018f18ff8d5a4310260cd4b /sw/qa | |
parent | 12e48f91d488e6ce42cf1c361e782ab8a2737c4c (diff) |
loplugin:ostr in sw/qa
Change-Id: Ib67997a3f491afaec380ef65bc60588362d9cc3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168812
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/qa')
36 files changed, 798 insertions, 776 deletions
diff --git a/sw/qa/filter/html/html.cxx b/sw/qa/filter/html/html.cxx index 4923cd605468..377505da9b14 100644 --- a/sw/qa/filter/html/html.cxx +++ b/sw/qa/filter/html/html.cxx @@ -35,7 +35,7 @@ class Test : public SwModelTestBase, public HtmlTestTools { public: Test() - : SwModelTestBase("/sw/qa/filter/html/data/", "HTML (StarWriter)") + : SwModelTestBase(u"/sw/qa/filter/html/data/"_ustr, u"HTML (StarWriter)"_ustr) { } }; @@ -43,12 +43,12 @@ public: CPPUNIT_TEST_FIXTURE(Test, testEmptyParagraph) { // Given a document with 2 paragraphs, the second is empty: - setImportFilterOptions("xhtmlns=reqif-xhtml"); - setImportFilterName("HTML (StarWriter)"); + setImportFilterOptions(u"xhtmlns=reqif-xhtml"_ustr); + setImportFilterName(u"HTML (StarWriter)"_ustr); createSwDoc("empty-paragraph.xhtml"); // Then make sure that the resulting document has a 2nd empty paragraph: - getParagraph(1, "a"); + getParagraph(1, u"a"_ustr); // Without the accompanying fix in place, this test would have failed with: // An uncaught exception of type com.sun.star.container.NoSuchElementException // i.e. the 2nd paragraph was lost. @@ -58,8 +58,8 @@ CPPUNIT_TEST_FIXTURE(Test, testEmptyParagraph) CPPUNIT_TEST_FIXTURE(Test, testRelativeKeepAspect) { // Given a document with an OLE object, width set to 100%, height is not set: - setImportFilterOptions("xhtmlns=reqif-xhtml"); - setImportFilterName("HTML (StarWriter)"); + setImportFilterOptions(u"xhtmlns=reqif-xhtml"_ustr); + setImportFilterName(u"HTML (StarWriter)"_ustr); createSwDoc("relative-keep-aspect.xhtml"); // Then make sure that the aspect ratio of the image is kept: @@ -79,8 +79,8 @@ CPPUNIT_TEST_FIXTURE(Test, testRelativeKeepAspect) CPPUNIT_TEST_FIXTURE(Test, testRelativeKeepAspectImage) { // Given a document with an image, width set to 100%, height is not set: - setImportFilterOptions("xhtmlns=reqif-xhtml"); - setImportFilterName("HTML (StarWriter)"); + setImportFilterOptions(u"xhtmlns=reqif-xhtml"_ustr); + setImportFilterName(u"HTML (StarWriter)"_ustr); createSwDoc("relative-keep-aspect-image.xhtml"); // Then make sure that the aspect ratio of the image is kept: @@ -103,12 +103,12 @@ CPPUNIT_TEST_FIXTURE(Test, testSvmImageExport) createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xTextGraphic( - xFactory->createInstance("com.sun.star.text.TextGraphicObject"), uno::UNO_QUERY); - xTextGraphic->setPropertyValue("AnchorType", + xFactory->createInstance(u"com.sun.star.text.TextGraphicObject"_ustr), uno::UNO_QUERY); + xTextGraphic->setPropertyValue(u"AnchorType"_ustr, uno::Any(text::TextContentAnchorType_AS_CHARACTER)); GDIMetaFile aMetafile; Graphic aGraphic(aMetafile); - xTextGraphic->setPropertyValue("Graphic", uno::Any(aGraphic.GetXGraphic())); + xTextGraphic->setPropertyValue(u"Graphic"_ustr, uno::Any(aGraphic.GetXGraphic())); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xBodyText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor(xBodyText->createTextCursor()); @@ -116,8 +116,8 @@ CPPUNIT_TEST_FIXTURE(Test, testSvmImageExport) xBodyText->insertTextContent(xCursor, xTextContent, false); // When exporting to reqif: - setFilterOptions("xhtmlns=reqif-xhtml"); - save("HTML (StarWriter)"); + setFilterOptions(u"xhtmlns=reqif-xhtml"_ustr); + save(u"HTML (StarWriter)"_ustr); // Then make sure we only export PNG: xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); @@ -126,7 +126,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSvmImageExport) // - Actual : 2 // - XPath '//reqif-xhtml:object' number of nodes is incorrect // i.e. we wrote both GIF and PNG, not just PNG for SVM images. - assertXPath(pXmlDoc, "//reqif-xhtml:object"_ostr, "type"_ostr, "image/png"); + assertXPath(pXmlDoc, "//reqif-xhtml:object"_ostr, "type"_ostr, u"image/png"_ustr); } CPPUNIT_TEST_FIXTURE(Test, testTableCellFloatValueType) @@ -140,7 +140,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTableCellFloatValueType) pWrtShell->MoveTable(GotoPrevTable, fnTableStart); SwTableNode* pTableNode = pWrtShell->GetCursor()->GetPointNode().FindTableNode(); SwTable& rTable = pTableNode->GetTable(); - auto pBox = const_cast<SwTableBox*>(rTable.GetTableBox("A1")); + auto pBox = const_cast<SwTableBox*>(rTable.GetTableBox(u"A1"_ustr)); SwFrameFormat* pBoxFormat = pBox->ClaimFrameFormat(); SwAttrSet aSet(pBoxFormat->GetAttrSet()); SwTableBoxValue aBoxValue(42.0); @@ -148,8 +148,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTableCellFloatValueType) pBoxFormat->GetDoc()->SetAttr(aSet, *pBoxFormat); // When exporting to XHTML: - setFilterOptions("xhtmlns=reqif-xhtml"); - save("HTML (StarWriter)"); + setFilterOptions(u"xhtmlns=reqif-xhtml"_ustr); + save(u"HTML (StarWriter)"_ustr); // Then make sure that the sdval attribute is omitted, which is not in the XHTML spec: xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); @@ -171,17 +171,17 @@ CPPUNIT_TEST_FIXTURE(Test, testTableRowSpanInAllCells) pWrtShell->MoveTable(GotoPrevTable, fnTableStart); SwTableNode* pTableNode = pWrtShell->GetCursor()->GetPointNode().FindTableNode(); SwTable& rTable = pTableNode->GetTable(); - auto pBox = const_cast<SwTableBox*>(rTable.GetTableBox("A1")); + auto pBox = const_cast<SwTableBox*>(rTable.GetTableBox(u"A1"_ustr)); pBox->setRowSpan(2); - pBox = const_cast<SwTableBox*>(rTable.GetTableBox("B1")); + pBox = const_cast<SwTableBox*>(rTable.GetTableBox(u"B1"_ustr)); pBox->setRowSpan(2); - pBox = const_cast<SwTableBox*>(rTable.GetTableBox("A2")); + pBox = const_cast<SwTableBox*>(rTable.GetTableBox(u"A2"_ustr)); pBox->setRowSpan(-1); - pBox = const_cast<SwTableBox*>(rTable.GetTableBox("B2")); + pBox = const_cast<SwTableBox*>(rTable.GetTableBox(u"B2"_ustr)); pBox->setRowSpan(-1); // When exporting to HTML: - save("HTML (StarWriter)"); + save(u"HTML (StarWriter)"_ustr); // Then make sure that the output is simplified to valid HTML, by omitting the rowspan attribute // & the empty <tr> element: @@ -208,8 +208,8 @@ CPPUNIT_TEST_FIXTURE(Test, testCenteredTableCSSExport) pWrtShell->SetTableAttr(aSet); // When exporting to XHTML: - setFilterOptions("xhtmlns=reqif-xhtml"); - save("HTML (StarWriter)"); + setFilterOptions(u"xhtmlns=reqif-xhtml"_ustr); + save(u"HTML (StarWriter)"_ustr); // Then make sure that CSS is used to horizontally position the table: xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); @@ -219,14 +219,14 @@ CPPUNIT_TEST_FIXTURE(Test, testCenteredTableCSSExport) // i.e <center> was used to position the table, not CSS. assertXPath(pXmlDoc, "//reqif-xhtml:center"_ostr, 0); assertXPath(pXmlDoc, "//reqif-xhtml:table"_ostr, "style"_ostr, - "margin-left: auto; margin-right: auto"); + u"margin-left: auto; margin-right: auto"_ustr); } CPPUNIT_TEST_FIXTURE(Test, testCenteredTableCSSImport) { // Given an XHTML file with a centered (with inline CSS) table, when importing that document: - setImportFilterOptions("xhtmlns=reqif-xhtml"); - setImportFilterName("HTML (StarWriter)"); + setImportFilterOptions(u"xhtmlns=reqif-xhtml"_ustr); + setImportFilterName(u"HTML (StarWriter)"_ustr); createSwDoc("centered-table.xhtml"); // Then make sure that the table is centered: diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx index 070565345a2d..603d7c198b1a 100644 --- a/sw/qa/filter/ww8/ww8.cxx +++ b/sw/qa/filter/ww8/ww8.cxx @@ -49,7 +49,7 @@ class Test : public SwModelTestBase { public: Test() - : SwModelTestBase("/sw/qa/filter/ww8/data/") + : SwModelTestBase(u"/sw/qa/filter/ww8/data/"_ustr) { } }; @@ -62,18 +62,19 @@ CPPUNIT_TEST_FIXTURE(Test, testNegativePageBorderDocImport) // Then make sure we map that to a negative border distance (move border from the edge of body // frame towards the center of the page, not towards the edge of the page): - uno::Reference<container::XNameAccess> xStyleFamily = getStyles("PageStyles"); - uno::Reference<beans::XPropertySet> xStyle(xStyleFamily->getByName("Standard"), uno::UNO_QUERY); - auto nTopMargin = xStyle->getPropertyValue("TopMargin").get<sal_Int32>(); + uno::Reference<container::XNameAccess> xStyleFamily = getStyles(u"PageStyles"_ustr); + uno::Reference<beans::XPropertySet> xStyle(xStyleFamily->getByName(u"Standard"_ustr), + uno::UNO_QUERY); + auto nTopMargin = xStyle->getPropertyValue(u"TopMargin"_ustr).get<sal_Int32>(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 501 // - Actual : 342 // i.e. the border properties influenced the margin, which was 284 twips in the sprmSDyaTop // SPRM. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(501), nTopMargin); - auto aTopBorder = xStyle->getPropertyValue("TopBorder").get<table::BorderLine2>(); + auto aTopBorder = xStyle->getPropertyValue(u"TopBorder"_ustr).get<table::BorderLine2>(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(159), aTopBorder.LineWidth); - auto nTopBorderDistance = xStyle->getPropertyValue("TopBorderDistance").get<sal_Int32>(); + auto nTopBorderDistance = xStyle->getPropertyValue(u"TopBorderDistance"_ustr).get<sal_Int32>(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-646), nTopBorderDistance); } @@ -85,20 +86,20 @@ CPPUNIT_TEST_FIXTURE(Test, testPlainTextContentControlExport) 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("PlainText", uno::Any(true)); + xContentControlProps->setPropertyValue(u"PlainText"_ustr, uno::Any(true)); xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When exporting to DOCX: - save("Office Open XML Text"); + save(u"Office Open XML Text"_ustr); // Then make sure the expected markup is used: - xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 // - Actual : 0 @@ -116,10 +117,10 @@ CPPUNIT_TEST_FIXTURE(Test, testDocxComboBoxContentControlExport) pWrtShell->InsertContentControl(SwContentControlType::COMBO_BOX); // When exporting to DOCX: - save("Office Open XML Text"); + save(u"Office Open XML Text"_ustr); // Then make sure the expected markup is used: - xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 // - Actual : 0 @@ -136,26 +137,27 @@ CPPUNIT_TEST_FIXTURE(Test, testDocxHyperlinkShape) 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, "beforeafter", /*bAbsorb=*/false); + xText->insertString(xCursor, u"beforeafter"_ustr, /*bAbsorb=*/false); xCursor->gotoStart(/*bExpand=*/false); xCursor->goRight(/*nCount=*/6, /*bExpand=*/true); uno::Reference<beans::XPropertySet> xCursorProps(xCursor, uno::UNO_QUERY); - xCursorProps->setPropertyValue("HyperLinkURL", uno::Any(OUString("http://www.example.com/"))); + xCursorProps->setPropertyValue(u"HyperLinkURL"_ustr, uno::Any(u"http://www.example.com/"_ustr)); xCursor->gotoStart(/*bExpand=*/false); xCursor->goRight(/*nCount=*/6, /*bExpand=*/false); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( - xFactory->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.drawing.RectangleShape"_ustr), uno::UNO_QUERY); xShape->setSize(awt::Size(5000, 5000)); uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); - xShapeProps->setPropertyValue("AnchorType", uno::Any(text::TextContentAnchorType_AT_CHARACTER)); + xShapeProps->setPropertyValue(u"AnchorType"_ustr, + uno::Any(text::TextContentAnchorType_AT_CHARACTER)); uno::Reference<text::XTextContent> xShapeContent(xShape, uno::UNO_QUERY); xText->insertTextContent(xCursor, xShapeContent, /*bAbsorb=*/false); - xShapeProps->setPropertyValue("TextBox", uno::Any(true)); + xShapeProps->setPropertyValue(u"TextBox"_ustr, uno::Any(true)); // When saving this document to DOCX, then make sure we don't crash on export (due to an // assertion failure for not-well-formed XML output): - save("Office Open XML Text"); + save(u"Office Open XML Text"_ustr); } CPPUNIT_TEST_FIXTURE(Test, testDocxContentControlDropdownEmptyDisplayText) @@ -168,10 +170,10 @@ CPPUNIT_TEST_FIXTURE(Test, testDocxContentControlDropdownEmptyDisplayText) pWrtShell->InsertContentControl(SwContentControlType::DROP_DOWN_LIST); // When saving to DOCX: - save("Office Open XML Text"); + save(u"Office Open XML Text"_ustr); // Then make sure that no display text attribute is written: - xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // Without the accompanying fix in place, this test would have failed with: // - XPath '//w:sdt/w:sdtPr/w:dropDownList/w:listItem' unexpected 'displayText' attribute // i.e. we wrote an empty attribute instead of omitting it. @@ -182,7 +184,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDocxContentControlDropdownEmptyDisplayText) CPPUNIT_TEST_FIXTURE(Test, testDocxSymbolFontExport) { // Create document with symbol character and font Wingdings - mxComponent = loadFromDesktop("private:factory/swriter"); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); @@ -191,20 +193,20 @@ CPPUNIT_TEST_FIXTURE(Test, testDocxSymbolFontExport) uno::Reference<text::XTextRange> xRange = xCursor; uno::Reference<beans::XPropertySet> xTextProps(xRange, uno::UNO_QUERY); - xTextProps->setPropertyValue("CharFontName", uno::Any(OUString("Wingdings"))); - xTextProps->setPropertyValue("CharFontNameAsian", uno::Any(OUString("Wingdings"))); - xTextProps->setPropertyValue("CharFontNameComplex", uno::Any(OUString("Wingdings"))); - xTextProps->setPropertyValue("CharFontCharSet", uno::Any(awt::CharSet::SYMBOL)); + xTextProps->setPropertyValue(u"CharFontName"_ustr, uno::Any(u"Wingdings"_ustr)); + xTextProps->setPropertyValue(u"CharFontNameAsian"_ustr, uno::Any(u"Wingdings"_ustr)); + xTextProps->setPropertyValue(u"CharFontNameComplex"_ustr, uno::Any(u"Wingdings"_ustr)); + xTextProps->setPropertyValue(u"CharFontCharSet"_ustr, uno::Any(awt::CharSet::SYMBOL)); // When exporting to DOCX: - save("Office Open XML Text"); + save(u"Office Open XML Text"_ustr); // Then make sure the expected markup is used: - xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); assertXPath(pXmlDoc, "//w:p/w:r/w:sym"_ostr, 1); - assertXPath(pXmlDoc, "//w:p/w:r/w:sym[1]"_ostr, "font"_ostr, "Wingdings"); - assertXPath(pXmlDoc, "//w:p/w:r/w:sym[1]"_ostr, "char"_ostr, "f0e0"); + assertXPath(pXmlDoc, "//w:p/w:r/w:sym[1]"_ostr, "font"_ostr, u"Wingdings"_ustr); + assertXPath(pXmlDoc, "//w:p/w:r/w:sym[1]"_ostr, "char"_ostr, u"f0e0"_ustr); } CPPUNIT_TEST_FIXTURE(Test, testDocxFloatingTableExport) @@ -232,10 +234,10 @@ CPPUNIT_TEST_FIXTURE(Test, testDocxFloatingTableExport) pWrtShell->EndAllAction(); // When saving to docx: - save("Office Open XML Text"); + save(u"Office Open XML Text"_ustr); // Then make sure we write a floating table, not a textframe containing a table: - xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // Without the accompanying fix in place, this test would have failed with: // - XPath '//w:tbl/w:tblPr/w:tblpPr' number of nodes is incorrect // i.e. no floating table was exported. @@ -267,26 +269,28 @@ CPPUNIT_TEST_FIXTURE(Test, testWrapThroughLayoutInCell) createSwDoc(); uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( - xFactory->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.drawing.RectangleShape"_ustr), uno::UNO_QUERY); xShape->setSize(awt::Size(10000, 10000)); uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); - xShapeProps->setPropertyValue("AnchorType", uno::Any(text::TextContentAnchorType_AT_CHARACTER)); - xShapeProps->setPropertyValue("Surround", uno::Any(text::WrapTextMode_THROUGH)); - xShapeProps->setPropertyValue("HoriOrientRelation", uno::Any(text::RelOrientation::FRAME)); + xShapeProps->setPropertyValue(u"AnchorType"_ustr, + uno::Any(text::TextContentAnchorType_AT_CHARACTER)); + xShapeProps->setPropertyValue(u"Surround"_ustr, uno::Any(text::WrapTextMode_THROUGH)); + xShapeProps->setPropertyValue(u"HoriOrientRelation"_ustr, + uno::Any(text::RelOrientation::FRAME)); uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); xDrawPageSupplier->getDrawPage()->add(xShape); // When saving to docx: - save("Office Open XML Text"); + save(u"Office Open XML Text"_ustr); // Then make sure that layoutInCell is undoing the effect of the import-time tweak: - xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 // - Actual : 0 // - attribute 'layoutInCell' of '//wp:anchor' incorrect value. // i.e. layoutInCell was disabled, leading to bad layout in Word. - assertXPath(pXmlDoc, "//wp:anchor"_ostr, "layoutInCell"_ostr, "1"); + assertXPath(pXmlDoc, "//wp:anchor"_ostr, "layoutInCell"_ostr, u"1"_ustr); } CPPUNIT_TEST_FIXTURE(Test, test3Endnotes) @@ -327,10 +331,10 @@ CPPUNIT_TEST_FIXTURE(Test, testDoNotBreakWrappedTables) rIDSA.set(DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES, true); // When saving to docx: - save("Office Open XML Text"); + save(u"Office Open XML Text"_ustr); // Then make sure the compat flag is serialized: - xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"word/settings.xml"_ustr); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 // - Actual : 0 @@ -348,10 +352,10 @@ CPPUNIT_TEST_FIXTURE(Test, testAllowTextAfterFloatingTableBreak) rIDSA.set(DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK, true); // When saving to docx: - save("Office Open XML Text"); + save(u"Office Open XML Text"_ustr); // Then make sure the compat flag is serialized: - xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"word/settings.xml"_ustr); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 // - Actual : 0 @@ -360,7 +364,7 @@ CPPUNIT_TEST_FIXTURE(Test, testAllowTextAfterFloatingTableBreak) assertXPath( pXmlDoc, "/w:settings/w:compat/w:compatSetting[@w:name='allowTextAfterFloatingTableBreak']"_ostr, - "val"_ostr, "1"); + "val"_ostr, u"1"_ustr); } CPPUNIT_TEST_FIXTURE(Test, testDOCfDontBreakWrappedTables) @@ -451,7 +455,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableOverlapNeverDOCXExport) createSwDoc(); SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - pWrtShell->Insert2("before table"); + pWrtShell->Insert2(u"before table"_ustr); // Insert a table: SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0); pWrtShell->InsertTable(aTableOptions, /*nRows=*/1, /*nCols=*/1); @@ -477,16 +481,16 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableOverlapNeverDOCXExport) pWrtShell->EndAllAction(); // When saving to DOCX: - save("Office Open XML Text"); + save(u"Office Open XML Text"_ustr); // Then make sure that the overlap=never markup is written: - xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 // - Actual : 0 // - XPath '//w:tblPr/w:tblOverlap' number of nodes is incorrect // i.e. <w:tblOverlap> was not written. - assertXPath(pXmlDoc, "//w:tblPr/w:tblOverlap"_ostr, "val"_ostr, "never"); + assertXPath(pXmlDoc, "//w:tblPr/w:tblOverlap"_ostr, "val"_ostr, u"never"_ustr); } CPPUNIT_TEST_FIXTURE(Test, testFloattableOverlapNeverDOCImport) diff --git a/sw/qa/filter/xml/xml.cxx b/sw/qa/filter/xml/xml.cxx index a0a21f5f4335..39a651183947 100644 --- a/sw/qa/filter/xml/xml.cxx +++ b/sw/qa/filter/xml/xml.cxx @@ -28,7 +28,7 @@ class Test : public SwModelTestBase { public: Test() - : SwModelTestBase("/sw/qa/filter/xml/data/", "writer8") + : SwModelTestBase(u"/sw/qa/filter/xml/data/"_ustr, u"writer8"_ustr) { } }; @@ -42,7 +42,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCoveredCellBackground) SwDoc* pDoc = getSwDoc(); const SwTableFormat* pTableFormat = (*pDoc->GetTableFrameFormats())[0]; SwTable* pTable = SwTable::FindTable(pTableFormat); - SwTableBox* pBox = const_cast<SwTableBox*>(pTable->GetTableBox("A5")); + SwTableBox* pBox = const_cast<SwTableBox*>(pTable->GetTableBox(u"A5"_ustr)); SwFrameFormat* pCellFormat = pBox->GetFrameFormat(); const SvxBrushItem& rBackground = pCellFormat->GetAttrSet().GetBackground(); diff --git a/sw/qa/inc/bordertest.hxx b/sw/qa/inc/bordertest.hxx index 3137c85c9766..6a538169c741 100644 --- a/sw/qa/inc/bordertest.hxx +++ b/sw/qa/inc/bordertest.hxx @@ -43,105 +43,105 @@ public: // maps containing TopBorder widths for every cell // one map for each tables - there are 8 of them, counting from 0 BorderLineMap map0; - map0.insert(StringBorderPair(OUString("A1"), table::BorderLine(0, 53, 26, 26))); - map0.insert(StringBorderPair(OUString("B1"), table::BorderLine(0, 79, 26, 26))); - map0.insert(StringBorderPair(OUString("C1"), table::BorderLine(0, 106, 26, 26))); - map0.insert(StringBorderPair(OUString("D1"), table::BorderLine(0, 159, 26, 26))); - map0.insert(StringBorderPair(OUString("E1"), table::BorderLine(0, 212, 26, 26))); + map0.insert(StringBorderPair(u"A1"_ustr, table::BorderLine(0, 53, 26, 26))); + map0.insert(StringBorderPair(u"B1"_ustr, table::BorderLine(0, 79, 26, 26))); + map0.insert(StringBorderPair(u"C1"_ustr, table::BorderLine(0, 106, 26, 26))); + map0.insert(StringBorderPair(u"D1"_ustr, table::BorderLine(0, 159, 26, 26))); + map0.insert(StringBorderPair(u"E1"_ustr, table::BorderLine(0, 212, 26, 26))); BorderLineMap map1; - map1.insert(StringBorderPair(OUString("A1"), table::BorderLine(0, 9, 9, 9))); - map1.insert(StringBorderPair(OUString("B1"), table::BorderLine(0, 18, 18, 18))); - map1.insert(StringBorderPair(OUString("C1"), table::BorderLine(0, 26, 26, 26))); - map1.insert(StringBorderPair(OUString("D1"), table::BorderLine(0, 53, 53, 53))); - map1.insert(StringBorderPair(OUString("E1"), table::BorderLine(0, 79, 79, 79))); - map1.insert(StringBorderPair(OUString("F1"), table::BorderLine(0, 106, 106, 106))); + map1.insert(StringBorderPair(u"A1"_ustr, table::BorderLine(0, 9, 9, 9))); + map1.insert(StringBorderPair(u"B1"_ustr, table::BorderLine(0, 18, 18, 18))); + map1.insert(StringBorderPair(u"C1"_ustr, table::BorderLine(0, 26, 26, 26))); + map1.insert(StringBorderPair(u"D1"_ustr, table::BorderLine(0, 53, 53, 53))); + map1.insert(StringBorderPair(u"E1"_ustr, table::BorderLine(0, 79, 79, 79))); + map1.insert(StringBorderPair(u"F1"_ustr, table::BorderLine(0, 106, 106, 106))); BorderLineMap map2; - map2.insert(StringBorderPair(OUString("A1"), table::BorderLine(0, 9, 5, 5))); - map2.insert(StringBorderPair(OUString("B1"), table::BorderLine(0, 18, 9, 9))); - map2.insert(StringBorderPair(OUString("C1"), table::BorderLine(0, 26, 14, 14))); - map2.insert(StringBorderPair(OUString("D1"), table::BorderLine(0, 35, 18, 18))); - map2.insert(StringBorderPair(OUString("E1"), table::BorderLine(0, 53, 26, 26))); - map2.insert(StringBorderPair(OUString("F1"), table::BorderLine(0, 79, 41, 41))); - map2.insert(StringBorderPair(OUString("G1"), table::BorderLine(0, 106, 53, 53))); - map2.insert(StringBorderPair(OUString("H1"), table::BorderLine(0, 159, 79, 79))); - map2.insert(StringBorderPair(OUString("I1"), table::BorderLine(0, 212, 106, 106))); + map2.insert(StringBorderPair(u"A1"_ustr, table::BorderLine(0, 9, 5, 5))); + map2.insert(StringBorderPair(u"B1"_ustr, table::BorderLine(0, 18, 9, 9))); + map2.insert(StringBorderPair(u"C1"_ustr, table::BorderLine(0, 26, 14, 14))); + map2.insert(StringBorderPair(u"D1"_ustr, table::BorderLine(0, 35, 18, 18))); + map2.insert(StringBorderPair(u"E1"_ustr, table::BorderLine(0, 53, 26, 26))); + map2.insert(StringBorderPair(u"F1"_ustr, table::BorderLine(0, 79, 41, 41))); + map2.insert(StringBorderPair(u"G1"_ustr, table::BorderLine(0, 106, 53, 53))); + map2.insert(StringBorderPair(u"H1"_ustr, table::BorderLine(0, 159, 79, 79))); + map2.insert(StringBorderPair(u"I1"_ustr, table::BorderLine(0, 212, 106, 106))); BorderLineMap map3; - map3.insert(StringBorderPair(OUString("A1"), table::BorderLine(0, 53, 26, 9))); - map3.insert(StringBorderPair(OUString("B1"), table::BorderLine(0, 53, 26, 18))); - map3.insert(StringBorderPair(OUString("C1"), table::BorderLine(0, 53, 26, 26))); - map3.insert(StringBorderPair(OUString("D1"), table::BorderLine(0, 53, 26, 35))); - map3.insert(StringBorderPair(OUString("E1"), table::BorderLine(0, 53, 26, 53))); - map3.insert(StringBorderPair(OUString("F1"), table::BorderLine(0, 53, 26, 79))); - map3.insert(StringBorderPair(OUString("G1"), table::BorderLine(0, 53, 26, 106))); - map3.insert(StringBorderPair(OUString("H1"), table::BorderLine(0, 53, 26, 159))); - map3.insert(StringBorderPair(OUString("I1"), table::BorderLine(0, 53, 26, 212))); - map3.insert(StringBorderPair(OUString("A1"), table::BorderLine(0, 53, 26, 9))); + map3.insert(StringBorderPair(u"A1"_ustr, table::BorderLine(0, 53, 26, 9))); + map3.insert(StringBorderPair(u"B1"_ustr, table::BorderLine(0, 53, 26, 18))); + map3.insert(StringBorderPair(u"C1"_ustr, table::BorderLine(0, 53, 26, 26))); + map3.insert(StringBorderPair(u"D1"_ustr, table::BorderLine(0, 53, 26, 35))); + map3.insert(StringBorderPair(u"E1"_ustr, table::BorderLine(0, 53, 26, 53))); + map3.insert(StringBorderPair(u"F1"_ustr, table::BorderLine(0, 53, 26, 79))); + map3.insert(StringBorderPair(u"G1"_ustr, table::BorderLine(0, 53, 26, 106))); + map3.insert(StringBorderPair(u"H1"_ustr, table::BorderLine(0, 53, 26, 159))); + map3.insert(StringBorderPair(u"I1"_ustr, table::BorderLine(0, 53, 26, 212))); + map3.insert(StringBorderPair(u"A1"_ustr, table::BorderLine(0, 53, 26, 9))); // Binary-DOC importer changes 'inset' and 'outset' border styles to other styles // during import, so for now - leaving binary-doc results as they were. BorderLineMap map4; if (isBinaryDoc) { - map4.insert(StringBorderPair(OUString("B1"), table::BorderLine(0, 53, 26, 18))); - map4.insert(StringBorderPair(OUString("C1"), table::BorderLine(0, 53, 26, 26))); - map4.insert(StringBorderPair(OUString("D1"), table::BorderLine(0, 53, 26, 35))); - map4.insert(StringBorderPair(OUString("E1"), table::BorderLine(0, 53, 26, 35))); - map4.insert(StringBorderPair(OUString("F1"), table::BorderLine(0, 53, 26, 79))); - map4.insert(StringBorderPair(OUString("G1"), table::BorderLine(0, 53, 26, 106))); - map4.insert(StringBorderPair(OUString("H1"), table::BorderLine(0, 53, 26, 159))); - map4.insert(StringBorderPair(OUString("I1"), table::BorderLine(0, 53, 26, 212))); + map4.insert(StringBorderPair(u"B1"_ustr, table::BorderLine(0, 53, 26, 18))); + map4.insert(StringBorderPair(u"C1"_ustr, table::BorderLine(0, 53, 26, 26))); + map4.insert(StringBorderPair(u"D1"_ustr, table::BorderLine(0, 53, 26, 35))); + map4.insert(StringBorderPair(u"E1"_ustr, table::BorderLine(0, 53, 26, 35))); + map4.insert(StringBorderPair(u"F1"_ustr, table::BorderLine(0, 53, 26, 79))); + map4.insert(StringBorderPair(u"G1"_ustr, table::BorderLine(0, 53, 26, 106))); + map4.insert(StringBorderPair(u"H1"_ustr, table::BorderLine(0, 53, 26, 159))); + map4.insert(StringBorderPair(u"I1"_ustr, table::BorderLine(0, 53, 26, 212))); } else { - map4.insert(StringBorderPair(OUString("A1"), table::BorderLine(0, 0, 26, 4))); - map4.insert(StringBorderPair(OUString("B1"), table::BorderLine(0, 5, 26, 5))); - map4.insert(StringBorderPair(OUString("C1"), table::BorderLine(0, 14, 26, 14))); - map4.insert(StringBorderPair(OUString("D1"), table::BorderLine(0, 23, 26, 23))); - map4.insert(StringBorderPair(OUString("E1"), table::BorderLine(0, 41, 26, 41))); - map4.insert(StringBorderPair(OUString("F1"), table::BorderLine(0, 67, 26, 67))); - map4.insert(StringBorderPair(OUString("G1"), table::BorderLine(0, 93, 26, 93))); - map4.insert(StringBorderPair(OUString("H1"), table::BorderLine(0, 146, 26, 146))); - map4.insert(StringBorderPair(OUString("I1"), table::BorderLine(0, 199, 26, 199))); + map4.insert(StringBorderPair(u"A1"_ustr, table::BorderLine(0, 0, 26, 4))); + map4.insert(StringBorderPair(u"B1"_ustr, table::BorderLine(0, 5, 26, 5))); + map4.insert(StringBorderPair(u"C1"_ustr, table::BorderLine(0, 14, 26, 14))); + map4.insert(StringBorderPair(u"D1"_ustr, table::BorderLine(0, 23, 26, 23))); + map4.insert(StringBorderPair(u"E1"_ustr, table::BorderLine(0, 41, 26, 41))); + map4.insert(StringBorderPair(u"F1"_ustr, table::BorderLine(0, 67, 26, 67))); + map4.insert(StringBorderPair(u"G1"_ustr, table::BorderLine(0, 93, 26, 93))); + map4.insert(StringBorderPair(u"H1"_ustr, table::BorderLine(0, 146, 26, 146))); + map4.insert(StringBorderPair(u"I1"_ustr, table::BorderLine(0, 199, 26, 199))); } BorderLineMap map5; if (isBinaryDoc) { - map5.insert(StringBorderPair(OUString("A1"), table::BorderLine(0, 26, 53, 9))); - map5.insert(StringBorderPair(OUString("B1"), table::BorderLine(0, 26, 53, 18))); - map5.insert(StringBorderPair(OUString("C1"), table::BorderLine(0, 26, 53, 26))); - map5.insert(StringBorderPair(OUString("D1"), table::BorderLine(0, 26, 53, 35))); - map5.insert(StringBorderPair(OUString("E1"), table::BorderLine(0, 26, 53, 53))); - map5.insert(StringBorderPair(OUString("F1"), table::BorderLine(0, 26, 53, 79))); - map5.insert(StringBorderPair(OUString("G1"), table::BorderLine(0, 26, 53, 106))); - map5.insert(StringBorderPair(OUString("H1"), table::BorderLine(0, 26, 53, 159))); - map5.insert(StringBorderPair(OUString("I1"), table::BorderLine(0, 26, 53, 212))); + map5.insert(StringBorderPair(u"A1"_ustr, table::BorderLine(0, 26, 53, 9))); + map5.insert(StringBorderPair(u"B1"_ustr, table::BorderLine(0, 26, 53, 18))); + map5.insert(StringBorderPair(u"C1"_ustr, table::BorderLine(0, 26, 53, 26))); + map5.insert(StringBorderPair(u"D1"_ustr, table::BorderLine(0, 26, 53, 35))); + map5.insert(StringBorderPair(u"E1"_ustr, table::BorderLine(0, 26, 53, 53))); + map5.insert(StringBorderPair(u"F1"_ustr, table::BorderLine(0, 26, 53, 79))); + map5.insert(StringBorderPair(u"G1"_ustr, table::BorderLine(0, 26, 53, 106))); + map5.insert(StringBorderPair(u"H1"_ustr, table::BorderLine(0, 26, 53, 159))); + map5.insert(StringBorderPair(u"I1"_ustr, table::BorderLine(0, 26, 53, 212))); } else { - map5.insert(StringBorderPair(OUString("A1"), table::BorderLine(0, 26, 2, 4))); - map5.insert(StringBorderPair(OUString("B1"), table::BorderLine(0, 26, 5, 5))); - map5.insert(StringBorderPair(OUString("C1"), table::BorderLine(0, 26, 14, 14))); - map5.insert(StringBorderPair(OUString("D1"), table::BorderLine(0, 26, 23, 23))); - map5.insert(StringBorderPair(OUString("E1"), table::BorderLine(0, 26, 41, 41))); - map5.insert(StringBorderPair(OUString("F1"), table::BorderLine(0, 26, 67, 67))); - map5.insert(StringBorderPair(OUString("G1"), table::BorderLine(0, 26, 93, 93))); - map5.insert(StringBorderPair(OUString("H1"), table::BorderLine(0, 26, 146, 146))); - map5.insert(StringBorderPair(OUString("I1"), table::BorderLine(0, 26, 199, 199))); + map5.insert(StringBorderPair(u"A1"_ustr, table::BorderLine(0, 26, 2, 4))); + map5.insert(StringBorderPair(u"B1"_ustr, table::BorderLine(0, 26, 5, 5))); + map5.insert(StringBorderPair(u"C1"_ustr, table::BorderLine(0, 26, 14, 14))); + map5.insert(StringBorderPair(u"D1"_ustr, table::BorderLine(0, 26, 23, 23))); + map5.insert(StringBorderPair(u"E1"_ustr, table::BorderLine(0, 26, 41, 41))); + map5.insert(StringBorderPair(u"F1"_ustr, table::BorderLine(0, 26, 67, 67))); + map5.insert(StringBorderPair(u"G1"_ustr, table::BorderLine(0, 26, 93, 93))); + map5.insert(StringBorderPair(u"H1"_ustr, table::BorderLine(0, 26, 146, 146))); + map5.insert(StringBorderPair(u"I1"_ustr, table::BorderLine(0, 26, 199, 199))); } BorderLineMap map6; - map6.insert(StringBorderPair(OUString("A1"), table::BorderLine(0, 14, 14, 26))); - map6.insert(StringBorderPair(OUString("B1"), table::BorderLine(0, 26, 26, 53))); - map6.insert(StringBorderPair(OUString("C1"), table::BorderLine(0, 41, 41, 79))); - map6.insert(StringBorderPair(OUString("D1"), table::BorderLine(0, 53, 53, 106))); - map6.insert(StringBorderPair(OUString("E1"), table::BorderLine(0, 79, 79, 159))); - map6.insert(StringBorderPair(OUString("F1"), table::BorderLine(0, 106, 106, 212))); + map6.insert(StringBorderPair(u"A1"_ustr, table::BorderLine(0, 14, 14, 26))); + map6.insert(StringBorderPair(u"B1"_ustr, table::BorderLine(0, 26, 26, 53))); + map6.insert(StringBorderPair(u"C1"_ustr, table::BorderLine(0, 41, 41, 79))); + map6.insert(StringBorderPair(u"D1"_ustr, table::BorderLine(0, 53, 53, 106))); + map6.insert(StringBorderPair(u"E1"_ustr, table::BorderLine(0, 79, 79, 159))); + map6.insert(StringBorderPair(u"F1"_ustr, table::BorderLine(0, 106, 106, 212))); BorderLineMap map7; - map7.insert(StringBorderPair(OUString("A1"), table::BorderLine(0, 14, 14, 26))); - map7.insert(StringBorderPair(OUString("B1"), table::BorderLine(0, 26, 26, 53))); - map7.insert(StringBorderPair(OUString("C1"), table::BorderLine(0, 41, 41, 79))); - map7.insert(StringBorderPair(OUString("D1"), table::BorderLine(0, 53, 53, 106))); - map7.insert(StringBorderPair(OUString("E1"), table::BorderLine(0, 79, 79, 159))); - map7.insert(StringBorderPair(OUString("F1"), table::BorderLine(0, 106, 106, 212))); + map7.insert(StringBorderPair(u"A1"_ustr, table::BorderLine(0, 14, 14, 26))); + map7.insert(StringBorderPair(u"B1"_ustr, table::BorderLine(0, 26, 26, 53))); + map7.insert(StringBorderPair(u"C1"_ustr, table::BorderLine(0, 41, 41, 79))); + map7.insert(StringBorderPair(u"D1"_ustr, table::BorderLine(0, 53, 53, 106))); + map7.insert(StringBorderPair(u"E1"_ustr, table::BorderLine(0, 79, 79, 159))); + map7.insert(StringBorderPair(u"F1"_ustr, table::BorderLine(0, 106, 106, 212))); sal_Int32 currentTable = 0; //to know which map should we check with the current table BorderLineMap* tempMap; @@ -151,7 +151,7 @@ public: uno::Reference<lang::XServiceInfo> xServiceInfo; if (xParaEnum->nextElement() >>= xServiceInfo) { - if (xServiceInfo->supportsService("com.sun.star.text.TextTable")) + if (xServiceInfo->supportsService(u"com.sun.star.text.TextTable"_ustr)) { uno::Reference<text::XTextTable> const xTextTable(xServiceInfo, uno::UNO_QUERY_THROW); uno::Sequence<OUString> const cells = xTextTable->getCellNames(); @@ -177,7 +177,7 @@ public: { uno::Reference<table::XCell> xCell = xTextTable->getCellByName(rCell); uno::Reference< beans::XPropertySet > xPropSet(xCell, uno::UNO_QUERY_THROW); - uno::Any aAny = xPropSet->getPropertyValue("TopBorder"); + uno::Any aAny = xPropSet->getPropertyValue(u"TopBorder"_ustr); table::BorderLine aBorderLine; it = tempMap->find(rCell); if ((aAny >>= aBorderLine) && (it!=tempMap->end())) diff --git a/sw/qa/uibase/dialog/dialog.cxx b/sw/qa/uibase/dialog/dialog.cxx index b7c1f766c3f0..888f44614c4e 100644 --- a/sw/qa/uibase/dialog/dialog.cxx +++ b/sw/qa/uibase/dialog/dialog.cxx @@ -21,7 +21,7 @@ class Test : public SwModelTestBase { public: Test() - : SwModelTestBase("/sw/qa/uibase/dialog/data/") + : SwModelTestBase(u"/sw/qa/uibase/dialog/data/"_ustr) { } }; @@ -36,10 +36,10 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertSection) // When inserting a section with text: uno::Sequence<css::beans::PropertyValue> aArgs = { comphelper::makePropertyValue( - "RegionName", uno::Any(OUString("ZOTERO_BIBL {} CSL_BIBLIOGRAPHY RNDRfiit6mXBc"))), - comphelper::makePropertyValue("Content", uno::Any(OUString("<p>aaa</p><p>bbb</p>"))), + u"RegionName"_ustr, uno::Any(u"ZOTERO_BIBL {} CSL_BIBLIOGRAPHY RNDRfiit6mXBc"_ustr)), + comphelper::makePropertyValue(u"Content"_ustr, uno::Any(u"<p>aaa</p><p>bbb</p>"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertSection", aArgs); + dispatchCommand(mxComponent, u".uno:InsertSection"_ustr, aArgs); // Then make sure that we created a section that covers that text: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -51,7 +51,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertSection) // - Expected: aaa\nbbb // - Actual : // i.e. the value of the Content parameter was ignored. - CPPUNIT_ASSERT_EQUAL(OUString("aaa\nbbb"), aActualResult); + CPPUNIT_ASSERT_EQUAL(u"aaa\nbbb"_ustr, aActualResult); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/uibase/dochdl/dochdl.cxx b/sw/qa/uibase/dochdl/dochdl.cxx index 2c209a65d3d9..fa62ff01a95d 100644 --- a/sw/qa/uibase/dochdl/dochdl.cxx +++ b/sw/qa/uibase/dochdl/dochdl.cxx @@ -32,7 +32,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseDochdlTest, testSelectPasteFormat) SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); - pWrtShell->Insert2("x"); + pWrtShell->Insert2(u"x"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); rtl::Reference<SwTransferable> pTransfer = new SwTransferable(*pWrtShell); pTransfer->Cut(); @@ -59,7 +59,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseDochdlTest, testComplexSelection) SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); - pWrtShell->Insert2("abc"); + pWrtShell->Insert2(u"abc"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); SfxItemSet aSet(pWrtShell->GetView().GetPool(), diff --git a/sw/qa/uibase/docvw/docvw.cxx b/sw/qa/uibase/docvw/docvw.cxx index 280a0459109e..ddd2d064b6ea 100644 --- a/sw/qa/uibase/docvw/docvw.cxx +++ b/sw/qa/uibase/docvw/docvw.cxx @@ -39,10 +39,10 @@ CPPUNIT_TEST_FIXTURE(Test, testShiftClickOnImage) uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); uno::Reference<beans::XPropertySet> xTextGraphic( - xMSF->createInstance("com.sun.star.text.TextGraphicObject"), uno::UNO_QUERY); - xTextGraphic->setPropertyValue("AnchorType", + xMSF->createInstance(u"com.sun.star.text.TextGraphicObject"_ustr), uno::UNO_QUERY); + xTextGraphic->setPropertyValue(u"AnchorType"_ustr, uno::Any(text::TextContentAnchorType_AS_CHARACTER)); - xTextGraphic->setPropertyValue("Size", uno::Any(awt::Size(5000, 5000))); + xTextGraphic->setPropertyValue(u"Size"_ustr, uno::Any(awt::Size(5000, 5000))); uno::Reference<text::XTextContent> xTextContent(xTextGraphic, uno::UNO_QUERY); xText->insertTextContent(xCursor, xTextContent, false); pWrtShell->SttEndDoc(/*bStt=*/false); @@ -149,10 +149,10 @@ CPPUNIT_TEST_FIXTURE(Test, testShiftDoubleClickOnImage) uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); uno::Reference<beans::XPropertySet> xTextGraphic( - xMSF->createInstance("com.sun.star.text.TextGraphicObject"), uno::UNO_QUERY); - xTextGraphic->setPropertyValue("AnchorType", + xMSF->createInstance(u"com.sun.star.text.TextGraphicObject"_ustr), uno::UNO_QUERY); + xTextGraphic->setPropertyValue(u"AnchorType"_ustr, uno::Any(text::TextContentAnchorType_AS_CHARACTER)); - xTextGraphic->setPropertyValue("Size", uno::Any(awt::Size(5000, 5000))); + xTextGraphic->setPropertyValue(u"Size"_ustr, uno::Any(awt::Size(5000, 5000))); uno::Reference<text::XTextContent> xTextContent(xTextGraphic, uno::UNO_QUERY); xText->insertTextContent(xCursor, xTextContent, false); pWrtShell->SttEndDoc(/*bStt=*/false); diff --git a/sw/qa/uibase/fldui/fldui.cxx b/sw/qa/uibase/fldui/fldui.cxx index 0bf6bfa33fb6..230c77735b7a 100644 --- a/sw/qa/uibase/fldui/fldui.cxx +++ b/sw/qa/uibase/fldui/fldui.cxx @@ -37,30 +37,30 @@ CPPUNIT_TEST_FIXTURE(Test, testBiblioPageNumberUpdate) SwDoc* pDoc = getSwDoc(); 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(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), }; - 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(); uno::Reference<text::XTextContent> xContent(xField, uno::UNO_QUERY); xText->insertTextContent(xCursor, xContent, /*bAbsorb=*/false); - xField.set(xFactory->createInstance("com.sun.star.text.TextField.Bibliography"), + xField.set(xFactory->createInstance(u"com.sun.star.text.TextField.Bibliography"_ustr), uno::UNO_QUERY); 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=2")), + 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=2"_ustr), }; - xField->setPropertyValue("Fields", uno::Any(aFields)); + xField->setPropertyValue(u"Fields"_ustr, uno::Any(aFields)); xContent.set(xField, uno::UNO_QUERY); xText->insertTextContent(xCursor, xContent, /*bAbsorb=*/false); @@ -74,7 +74,7 @@ CPPUNIT_TEST_FIXTURE(Test, testBiblioPageNumberUpdate) aCoreFields[AUTH_FIELD_IDENTIFIER] = "AT"; aCoreFields[AUTH_FIELD_AUTHOR] = "Author"; aCoreFields[AUTH_FIELD_TITLE] = "Title"; - OUString aNewUrl = "http://www.example.com/test.pdf#page=42"; + OUString aNewUrl = u"http://www.example.com/test.pdf#page=42"_ustr; aCoreFields[AUTH_FIELD_URL] = aNewUrl; OUStringBuffer aFieldBuffer; for (const auto& rField : aCoreFields) @@ -102,12 +102,12 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertRefmark) // When inserting a refmark with text: uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("TypeName", uno::Any(OUString("SetRef"))), - comphelper::makePropertyValue( - "Name", uno::Any(OUString("ZOTERO_ITEM CSL_CITATION {} RNDpyJknp173F"))), - comphelper::makePropertyValue("Content", uno::Any(OUString("aaa<b>bbb</b>ccc"))), + comphelper::makePropertyValue(u"TypeName"_ustr, uno::Any(u"SetRef"_ustr)), + comphelper::makePropertyValue(u"Name"_ustr, + uno::Any(u"ZOTERO_ITEM CSL_CITATION {} RNDpyJknp173F"_ustr)), + comphelper::makePropertyValue(u"Content"_ustr, uno::Any(u"aaa<b>bbb</b>ccc"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertField", aArgs); + dispatchCommand(mxComponent, u".uno:InsertField"_ustr, aArgs); // Then make sure that we create a refmark that covers that text: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -118,7 +118,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertRefmark) // - Actual : 0 // i.e. no refmark was created, only the hard to read Type=12 created a refmark. CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aAttrs.size()); - CPPUNIT_ASSERT_EQUAL(OUString("aaabbbccc"), pTextNode->GetText()); + CPPUNIT_ASSERT_EQUAL(u"aaabbbccc"_ustr, pTextNode->GetText()); } CPPUNIT_TEST_FIXTURE(Test, testTdf68364InsertConditionalFieldWithTwoDots) @@ -130,15 +130,15 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf68364InsertConditionalFieldWithTwoDots) // Insert a conditional field containing exactly two dots for its condition SwFieldMgr aFieldMgr(pWrtShell); - SwInsertField_Data aFieldData(SwFieldTypesEnum::ConditionalText, 0, "true", "19.12.2023", 0); + SwInsertField_Data aFieldData(SwFieldTypesEnum::ConditionalText, 0, u"true"_ustr, + u"19.12.2023"_ustr, 0); CPPUNIT_ASSERT(aFieldMgr.InsertField(aFieldData)); pWrtShell->SttEndDoc(true); // Without the accompanying fix in place, this test would have failed with: // - Expected: 19.12.2023 // - Actual : - CPPUNIT_ASSERT_EQUAL(OUString("19.12.2023"), - pWrtShell->GetCurField()->ExpandField(true, nullptr)); + CPPUNIT_ASSERT_EQUAL(u"19.12.2023"_ustr, pWrtShell->GetCurField()->ExpandField(true, nullptr)); } CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkSelection) @@ -147,12 +147,13 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkSelection) createSwDoc(); SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - pWrtShell->Insert2("myword"); + pWrtShell->Insert2(u"myword"_ustr); pWrtShell->SelAll(); // When inserting a refmark: SwFieldMgr aMgr(pWrtShell); - SwInsertField_Data aData(SwFieldTypesEnum::SetRef, /*nSubType=*/0, "myname", "myword", + SwInsertField_Data aData(SwFieldTypesEnum::SetRef, /*nSubType=*/0, u"myname"_ustr, + u"myword"_ustr, /*nFormatId=*/0); aMgr.InsertField(aData); @@ -162,7 +163,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkSelection) // - Expected: myword // - Actual : mywordmyword // i.e. the content of the selection was duplicated. - CPPUNIT_ASSERT_EQUAL(OUString("myword"), pTextNode->GetText()); + CPPUNIT_ASSERT_EQUAL(u"myword"_ustr, pTextNode->GetText()); } } diff --git a/sw/qa/uibase/frmdlg/frmdlg.cxx b/sw/qa/uibase/frmdlg/frmdlg.cxx index 81a7746170c1..9642310d7182 100644 --- a/sw/qa/uibase/frmdlg/frmdlg.cxx +++ b/sw/qa/uibase/frmdlg/frmdlg.cxx @@ -23,7 +23,7 @@ class SwUibaseFrmdlgTest : public SwModelTestBase { public: SwUibaseFrmdlgTest() - : SwModelTestBase("/sw/qa/uibase/frmdlg/data/") + : SwModelTestBase(u"/sw/qa/uibase/frmdlg/data/"_ustr) { } }; @@ -39,25 +39,26 @@ CPPUNIT_TEST_FIXTURE(SwUibaseFrmdlgTest, testWrappedMathObject) // - Actual : 1 (AS_CHARACTER) // i.e. the object lost its wrapping, leading to an incorrect position. CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, - getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); + getProperty<text::TextContentAnchorType>(getShape(1), u"AnchorType"_ustr)); } CPPUNIT_TEST_FIXTURE(SwUibaseFrmdlgTest, testAnchorTypeFromStyle) { // Given a document with aGraphics style with anchor type set to as-character: createSwDoc(); - uno::Reference<beans::XPropertySet> xGraphics(getStyles("FrameStyles")->getByName("Graphics"), - uno::UNO_QUERY); - xGraphics->setPropertyValue("AnchorType", uno::Any(text::TextContentAnchorType_AS_CHARACTER)); + uno::Reference<beans::XPropertySet> xGraphics( + getStyles(u"FrameStyles"_ustr)->getByName(u"Graphics"_ustr), uno::UNO_QUERY); + xGraphics->setPropertyValue(u"AnchorType"_ustr, + uno::Any(text::TextContentAnchorType_AS_CHARACTER)); // When inserting an image: uno::Sequence<beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FileName", createFileURL(u"image.png")), + comphelper::makePropertyValue(u"FileName"_ustr, createFileURL(u"image.png")), }; - dispatchCommand(mxComponent, ".uno:InsertGraphic", aArgs); + dispatchCommand(mxComponent, u".uno:InsertGraphic"_ustr, aArgs); // Then make sure the image's anchor type is as-char: - auto eActual = getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"); + auto eActual = getProperty<text::TextContentAnchorType>(getShape(1), u"AnchorType"_ustr); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 (AS_CHARACTER) // - Actual : 4 (AT_CHARACTER) @@ -82,11 +83,11 @@ CPPUNIT_TEST_FIXTURE(SwUibaseFrmdlgTest, testInsertFrameWidth) pWrtShell->SetTableAttr(aSet); } pWrtShell->GoPrevCell(); - pWrtShell->Insert("A1"); + pWrtShell->Insert(u"A1"_ustr); SwFormatFrameSize aRowSize(SwFrameSize::Minimum); pWrtShell->SetRowHeight(aRowSize); pWrtShell->GoNextCell(); - pWrtShell->Insert("A2"); + pWrtShell->Insert(u"A2"_ustr); pWrtShell->SetRowHeight(aRowSize); // Select cell: pWrtShell->SelAll(); diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx index 9b27c79addb4..90c30f88038c 100644 --- a/sw/qa/uibase/shells/shells.cxx +++ b/sw/qa/uibase/shells/shells.cxx @@ -47,7 +47,7 @@ class SwUibaseShellsTest : public SwModelTestBase { public: SwUibaseShellsTest() - : SwModelTestBase("/sw/qa/uibase/shells/data/") + : SwModelTestBase(u"/sw/qa/uibase/shells/data/"_ustr) { } }; @@ -129,7 +129,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOleSavePreviewUpdate) createSwDoc("ole-save-preview-update.odt"); // Explicitly update OLE previews, etc. - dispatchCommand(mxComponent, ".uno:UpdateAll", {}); + dispatchCommand(mxComponent, u".uno:UpdateAll"_ustr, {}); // Save the document and see if we get the previews. uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -140,8 +140,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOleSavePreviewUpdate) // Without the accompanying fix in place, this test would have failed, because the object // replacements were not generated, even after UpdateAll. - CPPUNIT_ASSERT(xNameAccess->hasByName("ObjectReplacements/Object 1")); - CPPUNIT_ASSERT(xNameAccess->hasByName("ObjectReplacements/Object 2")); + CPPUNIT_ASSERT(xNameAccess->hasByName(u"ObjectReplacements/Object 1"_ustr)); + CPPUNIT_ASSERT(xNameAccess->hasByName(u"ObjectReplacements/Object 2"_ustr)); } CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOlePreviewUpdate) @@ -150,7 +150,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOlePreviewUpdate) createSwDoc("ole-preview-update.odt"); // When updating "all" (including OLE previews): - dispatchCommand(mxComponent, ".uno:UpdateAll", {}); + dispatchCommand(mxComponent, u".uno:UpdateAll"_ustr, {}); // Then make sure the preview is no longer a 0-sized stream: uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); @@ -159,7 +159,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testOlePreviewUpdate) = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL()); uno::Reference<io::XInputStream> xInputStream( - xNameAccess->getByName("ObjectReplacements/Object 1"), uno::UNO_QUERY); + xNameAccess->getByName(u"ObjectReplacements/Object 1"_ustr), uno::UNO_QUERY); std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); // Without the accompanying fix in place, this test would have failed, the stream was still // empty. @@ -173,15 +173,15 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyUrlContextMenu) SwDoc* pDoc = getSwDoc(); 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(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), }; - 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(); @@ -221,39 +221,39 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testProtectedFieldsCopyHyperlinkLocatio createSwDoc("protectedLinkCopy.fodt"); // Copy generic hyperlink - dispatchCommand(mxComponent, ".uno:CopyHyperlinkLocation", {}); - dispatchCommand(mxComponent, ".uno:GoDown", {}); - dispatchCommand(mxComponent, ".uno:Paste", {}); + dispatchCommand(mxComponent, u".uno:CopyHyperlinkLocation"_ustr, {}); + dispatchCommand(mxComponent, u".uno:GoDown"_ustr, {}); + dispatchCommand(mxComponent, u".uno:Paste"_ustr, {}); // Assert generic hyperlink was correctly copied and pasted - CPPUNIT_ASSERT_EQUAL(OUString("http://reset.url/1"), getParagraph(2)->getString()); + CPPUNIT_ASSERT_EQUAL(u"http://reset.url/1"_ustr, getParagraph(2)->getString()); - dispatchCommand(mxComponent, ".uno:GoDown", {}); - dispatchCommand(mxComponent, ".uno:GoLeft", {}); + dispatchCommand(mxComponent, u".uno:GoDown"_ustr, {}); + dispatchCommand(mxComponent, u".uno:GoLeft"_ustr, {}); // Copy bibliography mark hyperlink - dispatchCommand(mxComponent, ".uno:CopyHyperlinkLocation", {}); - dispatchCommand(mxComponent, ".uno:GoDown", {}); - dispatchCommand(mxComponent, ".uno:Paste", {}); + dispatchCommand(mxComponent, u".uno:CopyHyperlinkLocation"_ustr, {}); + dispatchCommand(mxComponent, u".uno:GoDown"_ustr, {}); + dispatchCommand(mxComponent, u".uno:Paste"_ustr, {}); // Assert bibliography mark hyperlink was correctly copied and pasted - CPPUNIT_ASSERT_EQUAL(OUString("https://test.url/1"), getParagraph(4)->getString()); + CPPUNIT_ASSERT_EQUAL(u"https://test.url/1"_ustr, getParagraph(4)->getString()); - dispatchCommand(mxComponent, ".uno:GoDown", {}); - dispatchCommand(mxComponent, ".uno:GoLeft", {}); + dispatchCommand(mxComponent, u".uno:GoDown"_ustr, {}); + dispatchCommand(mxComponent, u".uno:GoLeft"_ustr, {}); // Copy generic hyperlink - dispatchCommand(mxComponent, ".uno:CopyHyperlinkLocation", {}); - dispatchCommand(mxComponent, ".uno:GoDown", {}); - dispatchCommand(mxComponent, ".uno:Paste", {}); + dispatchCommand(mxComponent, u".uno:CopyHyperlinkLocation"_ustr, {}); + dispatchCommand(mxComponent, u".uno:GoDown"_ustr, {}); + dispatchCommand(mxComponent, u".uno:Paste"_ustr, {}); // Assert generic hyperlink was correctly copied and pasted - CPPUNIT_ASSERT_EQUAL(OUString("http://reset.url/2"), getParagraph(6)->getString()); + CPPUNIT_ASSERT_EQUAL(u"http://reset.url/2"_ustr, getParagraph(6)->getString()); - dispatchCommand(mxComponent, ".uno:GoDown", {}); - dispatchCommand(mxComponent, ".uno:GoDown", {}); - dispatchCommand(mxComponent, ".uno:GoLeft", {}); + dispatchCommand(mxComponent, u".uno:GoDown"_ustr, {}); + dispatchCommand(mxComponent, u".uno:GoDown"_ustr, {}); + dispatchCommand(mxComponent, u".uno:GoLeft"_ustr, {}); // Copy bibliography table hyperlink - dispatchCommand(mxComponent, ".uno:CopyHyperlinkLocation", {}); - dispatchCommand(mxComponent, ".uno:GoDown", {}); - dispatchCommand(mxComponent, ".uno:Paste", {}); + dispatchCommand(mxComponent, u".uno:CopyHyperlinkLocation"_ustr, {}); + dispatchCommand(mxComponent, u".uno:GoDown"_ustr, {}); + dispatchCommand(mxComponent, u".uno:Paste"_ustr, {}); // Assert bibliography table entry hyperlink was correctly copied and pasted - CPPUNIT_ASSERT_EQUAL(OUString("https://test.url/1"), getParagraph(9)->getString()); + CPPUNIT_ASSERT_EQUAL(u"https://test.url/1"_ustr, getParagraph(9)->getString()); } CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyLocalCopyContextMenu) @@ -263,16 +263,16 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testBibliographyLocalCopyContextMenu) SwDoc* pDoc = getSwDoc(); 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(); @@ -304,18 +304,18 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testContentControlPageBreak) 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); xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); // When trying to insert a page break: - dispatchCommand(mxComponent, ".uno:InsertPagebreak", {}); + dispatchCommand(mxComponent, u".uno:InsertPagebreak"_ustr, {}); // Then make sure that the document still has a single page: // Without the accompanying fix in place, this test would have failed with: @@ -333,13 +333,13 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testInsertTextFormField) SwDoc* pDoc = getSwDoc(); // When inserting an ODF_UNHANDLED fieldmark: - OUString aExpectedCommand("ADDIN ZOTERO_BIBL foo bar"); + OUString aExpectedCommand(u"ADDIN ZOTERO_BIBL foo bar"_ustr); uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommand", uno::Any(aExpectedCommand)), - comphelper::makePropertyValue("FieldResult", uno::Any(OUString("<p>aaa</p><p>bbb</p>"))), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommand"_ustr, uno::Any(aExpectedCommand)), + comphelper::makePropertyValue(u"FieldResult"_ustr, uno::Any(u"<p>aaa</p><p>bbb</p>"_ustr)), }; - dispatchCommand(mxComponent, ".uno:TextFormField", aArgs); + dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); // Then make sure that it's type/name is correct: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -367,7 +367,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testInsertTextFormField) aPam.GetPoint()->SetContent(aPam.GetPoint()->GetContentIndex() - 1); CPPUNIT_ASSERT(aPam.HasMark()); OUString aActualResult = aPam.GetText(); - CPPUNIT_ASSERT_EQUAL(OUString("aaa\nbbb"), aActualResult); + CPPUNIT_ASSERT_EQUAL(u"aaa\nbbb"_ustr, aActualResult); } CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateFieldmarks) @@ -376,44 +376,44 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateFieldmarks) createSwDoc(); { uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommand", - uno::Any(OUString("ADDIN ZOTERO_ITEM old command 1"))), - comphelper::makePropertyValue("FieldResult", uno::Any(OUString("old result 1"))), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommand"_ustr, + uno::Any(u"ADDIN ZOTERO_ITEM old command 1"_ustr)), + comphelper::makePropertyValue(u"FieldResult"_ustr, uno::Any(u"old result 1"_ustr)), }; - dispatchCommand(mxComponent, ".uno:TextFormField", aArgs); + dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); } { uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommand", - uno::Any(OUString("ADDIN ZOTERO_ITEM old command 2"))), - comphelper::makePropertyValue("FieldResult", uno::Any(OUString("old result 2"))), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommand"_ustr, + uno::Any(u"ADDIN ZOTERO_ITEM old command 2"_ustr)), + comphelper::makePropertyValue(u"FieldResult"_ustr, uno::Any(u"old result 2"_ustr)), }; - dispatchCommand(mxComponent, ".uno:TextFormField", aArgs); + dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); } // When updating those fieldmarks: uno::Sequence<css::beans::PropertyValue> aField1{ - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommand", - uno::Any(OUString("ADDIN ZOTERO_ITEM new command 1"))), - comphelper::makePropertyValue("FieldResult", uno::Any(OUString("new result 1"))), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommand"_ustr, + uno::Any(u"ADDIN ZOTERO_ITEM new command 1"_ustr)), + comphelper::makePropertyValue(u"FieldResult"_ustr, uno::Any(u"new result 1"_ustr)), }; uno::Sequence<css::beans::PropertyValue> aField2{ - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommand", - uno::Any(OUString("ADDIN ZOTERO_ITEM new command 2"))), - comphelper::makePropertyValue("FieldResult", uno::Any(OUString("new result 2"))), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommand"_ustr, + uno::Any(u"ADDIN ZOTERO_ITEM new command 2"_ustr)), + comphelper::makePropertyValue(u"FieldResult"_ustr, uno::Any(u"new result 2"_ustr)), }; uno::Sequence<uno::Sequence<css::beans::PropertyValue>> aFields = { aField1, aField2 }; uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommandPrefix", - uno::Any(OUString("ADDIN ZOTERO_ITEM"))), - comphelper::makePropertyValue("Fields", uno::Any(aFields)), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommandPrefix"_ustr, + uno::Any(u"ADDIN ZOTERO_ITEM"_ustr)), + comphelper::makePropertyValue(u"Fields"_ustr, uno::Any(aFields)), }; - dispatchCommand(mxComponent, ".uno:TextFormFields", aArgs); + dispatchCommand(mxComponent, u".uno:TextFormFields"_ustr, aArgs); // Then make sure that the document text contains the new field results: SwDoc* pDoc = getSwDoc(); @@ -428,7 +428,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateFieldmarks) // - Expected: new result 1new result 2 // - Actual : old result 1old result 2 // i.e. the fieldmarks were not updated. - CPPUNIT_ASSERT_EQUAL(OUString("new result 1new result 2"), aActual); + CPPUNIT_ASSERT_EQUAL(u"new result 1new result 2"_ustr, aActual); } CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testInsertBookmark) @@ -438,12 +438,12 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testInsertBookmark) SwDoc* pDoc = getSwDoc(); // When inserting a bookmark with text: - OUString aExpectedBookmarkName("ZOTERO_BREF_GiQ7DAWQYWLy"); + OUString aExpectedBookmarkName(u"ZOTERO_BREF_GiQ7DAWQYWLy"_ustr); uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("Bookmark", uno::Any(aExpectedBookmarkName)), - comphelper::makePropertyValue("BookmarkText", uno::Any(OUString("<p>aaa</p><p>bbb</p>"))), + comphelper::makePropertyValue(u"Bookmark"_ustr, uno::Any(aExpectedBookmarkName)), + comphelper::makePropertyValue(u"BookmarkText"_ustr, uno::Any(u"<p>aaa</p><p>bbb</p>"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertBookmark", aArgs); + dispatchCommand(mxComponent, u".uno:InsertBookmark"_ustr, aArgs); // Then make sure that we create a bookmark that covers that text: IDocumentMarkAccess& rIDMA = *pDoc->getIDocumentMarkAccess(); @@ -458,7 +458,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testInsertBookmark) // - Expected: aaa\nbbb // - Actual : // i.e. no text was inserted, the bookmark was collapsed. - CPPUNIT_ASSERT_EQUAL(OUString("aaa\nbbb"), aActualResult); + CPPUNIT_ASSERT_EQUAL(u"aaa\nbbb"_ustr, aActualResult); } } @@ -470,15 +470,15 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testGotoMark) SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->SplitNode(); pWrtShell->SttEndDoc(/*bStt=*/false); - pWrtShell->SetBookmark(vcl::KeyCode(), "mybookmark"); + pWrtShell->SetBookmark(vcl::KeyCode(), u"mybookmark"_ustr); SwNodeOffset nExpected = pWrtShell->GetCursor()->GetPointNode().GetIndex(); // When jumping to that mark from the doc start: pWrtShell->SttEndDoc(/*bStt=*/true); uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("GotoMark", uno::Any(OUString("mybookmark"))), + comphelper::makePropertyValue(u"GotoMark"_ustr, uno::Any(u"mybookmark"_ustr)), }; - dispatchCommand(mxComponent, ".uno:GotoMark", aArgs); + dispatchCommand(mxComponent, u".uno:GotoMark"_ustr, aArgs); // Then make sure that the final cursor position is at the bookmark: SwNodeOffset nActual = pWrtShell->GetCursor()->GetPointNode().GetIndex(); @@ -495,14 +495,14 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmarks) createSwDoc(); SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - pWrtShell->Insert("ABCDE"); + pWrtShell->Insert(u"ABCDE"_ustr); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); - pWrtShell->SetBookmark(vcl::KeyCode(), "ZOTERO_BREF_GiQ7DAWQYWLy"); + pWrtShell->SetBookmark(vcl::KeyCode(), u"ZOTERO_BREF_GiQ7DAWQYWLy"_ustr); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); - pWrtShell->SetBookmark(vcl::KeyCode(), "ZOTERO_BREF_PRxDGUb4SWXF"); + pWrtShell->SetBookmark(vcl::KeyCode(), u"ZOTERO_BREF_PRxDGUb4SWXF"_ustr); // When updating the content of bookmarks: pWrtShell->SttEndDoc(/*bStt=*/true); @@ -540,7 +540,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmarks) } )json"_ostr); uno::Sequence<beans::PropertyValue> aArgs = comphelper::containerToSequence(aArgsVec); - dispatchCommand(mxComponent, ".uno:UpdateBookmarks", aArgs); + dispatchCommand(mxComponent, u".uno:UpdateBookmarks"_ustr, aArgs); // Then make sure that the only paragraph is updated correctly: SwCursor* pCursor = pWrtShell->GetCursor(); @@ -549,11 +549,11 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmarks) // - Expected: Anew result 1Cnew result 2E // - Actual : ABCDE // i.e. the content was not updated. - CPPUNIT_ASSERT_EQUAL(OUString("Anew result 1Cnew result 2E"), aActual); + CPPUNIT_ASSERT_EQUAL(u"Anew result 1Cnew result 2E"_ustr, aActual); // Without the accompanying fix in place, this test would have failed, ZOTERO_BREF_GiQ7DAWQYWLy // was not renamed to ZOTERO_BREF_new1. - auto it = pDoc->getIDocumentMarkAccess()->findMark("ZOTERO_BREF_new1"); + auto it = pDoc->getIDocumentMarkAccess()->findMark(u"ZOTERO_BREF_new1"_ustr); CPPUNIT_ASSERT(it != pDoc->getIDocumentMarkAccess()->getAllMarksEnd()); } @@ -562,11 +562,11 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testInsertFieldmarkReadonly) // Given a document with a fieldmark, the cursor inside the fieldmark: createSwDoc(); uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommand", uno::Any(OUString("my command"))), - comphelper::makePropertyValue("FieldResult", uno::Any(OUString("my result"))), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommand"_ustr, uno::Any(u"my command"_ustr)), + comphelper::makePropertyValue(u"FieldResult"_ustr, uno::Any(u"my result"_ustr)), }; - dispatchCommand(mxComponent, ".uno:TextFormField", aArgs); + dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwCursor* pCursor = pWrtShell->GetCursor(); @@ -575,7 +575,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testInsertFieldmarkReadonly) // When trying to insert an inner fieldmark: // Without the accompanying fix in place, this test would have crashed. - dispatchCommand(mxComponent, ".uno:TextFormField", aArgs); + dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); // Then make sure the read-only content refuses to accept that inner fieldmark, so we still have // just one: @@ -594,22 +594,22 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateRefmarks) createSwDoc(); SwDoc* pDoc = getSwDoc(); uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("TypeName", uno::Any(OUString("SetRef"))), - comphelper::makePropertyValue("Name", uno::Any(OUString("some other old refmark"))), - comphelper::makePropertyValue("Content", uno::Any(OUString("some other old content"))), + comphelper::makePropertyValue(u"TypeName"_ustr, uno::Any(u"SetRef"_ustr)), + comphelper::makePropertyValue(u"Name"_ustr, uno::Any(u"some other old refmark"_ustr)), + comphelper::makePropertyValue(u"Content"_ustr, uno::Any(u"some other old content"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertField", aArgs); + dispatchCommand(mxComponent, u".uno:InsertField"_ustr, aArgs); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->SplitNode(); pWrtShell->SttEndDoc(/*bStt=*/false); aArgs = { - comphelper::makePropertyValue("TypeName", uno::Any(OUString("SetRef"))), - comphelper::makePropertyValue( - "Name", uno::Any(OUString("ZOTERO_ITEM CSL_CITATION {} old refmark"))), - comphelper::makePropertyValue("Content", uno::Any(OUString("old content"))), + comphelper::makePropertyValue(u"TypeName"_ustr, uno::Any(u"SetRef"_ustr)), + comphelper::makePropertyValue(u"Name"_ustr, + uno::Any(u"ZOTERO_ITEM CSL_CITATION {} old refmark"_ustr)), + comphelper::makePropertyValue(u"Content"_ustr, uno::Any(u"old content"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertField", aArgs); + dispatchCommand(mxComponent, u".uno:InsertField"_ustr, aArgs); // When updating that refmark: std::vector<beans::PropertyValue> aArgsVec = comphelper::JsonToPropertyValues(R"json( @@ -640,7 +640,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateRefmarks) } )json"_ostr); aArgs = comphelper::containerToSequence(aArgsVec); - dispatchCommand(mxComponent, ".uno:UpdateFields", aArgs); + dispatchCommand(mxComponent, u".uno:UpdateFields"_ustr, aArgs); // Then make sure that the document text features the new content: SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); @@ -648,7 +648,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateRefmarks) // - Expected: new content // - Actual : old content // i.e. the doc content was not updated. - CPPUNIT_ASSERT_EQUAL(OUString("new content"), pTextNode->GetText()); + CPPUNIT_ASSERT_EQUAL(u"new content"_ustr, pTextNode->GetText()); } CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateFieldmark) @@ -656,12 +656,12 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateFieldmark) // Given a document with a fieldmark: createSwDoc(); uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommand", - uno::Any(OUString("ADDIN ZOTERO_ITEM old command 1"))), - comphelper::makePropertyValue("FieldResult", uno::Any(OUString("old result 1"))), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommand"_ustr, + uno::Any(u"ADDIN ZOTERO_ITEM old command 1"_ustr)), + comphelper::makePropertyValue(u"FieldResult"_ustr, uno::Any(u"old result 1"_ustr)), }; - dispatchCommand(mxComponent, ".uno:TextFormField", aArgs); + dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); // When updating that fieldmark to have new field command & result: SwDoc* pDoc = getSwDoc(); @@ -698,7 +698,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateFieldmark) } )json"_ostr); aArgs = comphelper::containerToSequence(aArgsVec); - dispatchCommand(mxComponent, ".uno:UpdateTextFormField", aArgs); + dispatchCommand(mxComponent, u".uno:UpdateTextFormField"_ustr, aArgs); // Then make sure that the document text is updated accordingly: SwCursor* pCursor = pWrtShell->GetCursor(); @@ -710,7 +710,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateFieldmark) // - Expected: new result 1 // - Actual : old result 1 // i.e. the document text was not updated. - CPPUNIT_ASSERT_EQUAL(OUString("new result 1"), aActual); + CPPUNIT_ASSERT_EQUAL(u"new result 1"_ustr, aActual); } CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateSections) @@ -718,11 +718,11 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateSections) // Given a document with a section: createSwDoc(); uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("RegionName", - uno::Any(OUString("ZOTERO_BIBL {} CSL_BIBLIOGRAPHY RNDold"))), - comphelper::makePropertyValue("Content", uno::Any(OUString("old content"))), + comphelper::makePropertyValue(u"RegionName"_ustr, + uno::Any(u"ZOTERO_BIBL {} CSL_BIBLIOGRAPHY RNDold"_ustr)), + comphelper::makePropertyValue(u"Content"_ustr, uno::Any(u"old content"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertSection", aArgs); + dispatchCommand(mxComponent, u".uno:InsertSection"_ustr, aArgs); // When updating that section: std::vector<beans::PropertyValue> aArgsVec = comphelper::JsonToPropertyValues(R"json( @@ -749,7 +749,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateSections) } )json"_ostr); aArgs = comphelper::containerToSequence(aArgsVec); - dispatchCommand(mxComponent, ".uno:UpdateSections", aArgs); + dispatchCommand(mxComponent, u".uno:UpdateSections"_ustr, aArgs); // Then make sure that the section is updated: SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); @@ -761,7 +761,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateSections) // - Expected: new content // - Actual : old content // i.e. the content wasn't updated. - CPPUNIT_ASSERT_EQUAL(OUString("new content"), aActualResult); + CPPUNIT_ASSERT_EQUAL(u"new content"_ustr, aActualResult); } CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDeleteFieldmarks) @@ -770,29 +770,29 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDeleteFieldmarks) createSwDoc(); { uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommand", - uno::Any(OUString("ADDIN ZOTERO_ITEM old command 1"))), - comphelper::makePropertyValue("FieldResult", uno::Any(OUString("result 1"))), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommand"_ustr, + uno::Any(u"ADDIN ZOTERO_ITEM old command 1"_ustr)), + comphelper::makePropertyValue(u"FieldResult"_ustr, uno::Any(u"result 1"_ustr)), }; - dispatchCommand(mxComponent, ".uno:TextFormField", aArgs); + dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); } { uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommand", - uno::Any(OUString("ADDIN ZOTERO_ITEM old command 2"))), - comphelper::makePropertyValue("FieldResult", uno::Any(OUString("result 2"))), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommand"_ustr, + uno::Any(u"ADDIN ZOTERO_ITEM old command 2"_ustr)), + comphelper::makePropertyValue(u"FieldResult"_ustr, uno::Any(u"result 2"_ustr)), }; - dispatchCommand(mxComponent, ".uno:TextFormField", aArgs); + dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); } // When deleting those fieldmarks: uno::Sequence<css::beans::PropertyValue> aArgs - = { comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommandPrefix", - uno::Any(OUString("ADDIN ZOTERO_ITEM"))) }; - dispatchCommand(mxComponent, ".uno:DeleteTextFormFields", aArgs); + = { comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommandPrefix"_ustr, + uno::Any(u"ADDIN ZOTERO_ITEM"_ustr)) }; + dispatchCommand(mxComponent, u".uno:DeleteTextFormFields"_ustr, aArgs); // Then make sure that the document doesn't contain fields anymore: SwDoc* pDoc = getSwDoc(); @@ -806,7 +806,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDeleteFieldmarks) pWrtShell->SttEndDoc(/*bStt=*/true); SwCursor* pCursor = pWrtShell->GetCursor(); OUString aActual = pCursor->Start()->GetNode().GetTextNode()->GetText(); - CPPUNIT_ASSERT_EQUAL(OUString("result 1result 2"), aActual); + CPPUNIT_ASSERT_EQUAL(u"result 1result 2"_ustr, aActual); } CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmark) @@ -815,11 +815,11 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmark) createSwDoc(); SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - pWrtShell->Insert("ABCD"); + pWrtShell->Insert(u"ABCD"_ustr); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 2, /*bBasicCall=*/false); - pWrtShell->SetBookmark(vcl::KeyCode(), "ZOTERO_BREF_old"); + pWrtShell->SetBookmark(vcl::KeyCode(), u"ZOTERO_BREF_old"_ustr); // When updating the content of the bookmark under the cursor: pWrtShell->SttEndDoc(/*bStt=*/true); @@ -846,7 +846,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmark) } )json"_ostr); uno::Sequence<beans::PropertyValue> aArgs = comphelper::containerToSequence(aArgsVec); - dispatchCommand(mxComponent, ".uno:UpdateBookmark", aArgs); + dispatchCommand(mxComponent, u".uno:UpdateBookmark"_ustr, aArgs); // Then make sure that the only paragraph is updated correctly: SwCursor* pCursor = pWrtShell->GetCursor(); @@ -855,8 +855,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmark) // - Expected: Anew resultD // - Actual : ABCD // i.e. it was not possible to update just the bookmark under cursor. - CPPUNIT_ASSERT_EQUAL(OUString("Anew resultD"), aActual); - auto it = pDoc->getIDocumentMarkAccess()->findMark("ZOTERO_BREF_new"); + CPPUNIT_ASSERT_EQUAL(u"Anew resultD"_ustr, aActual); + auto it = pDoc->getIDocumentMarkAccess()->findMark(u"ZOTERO_BREF_new"_ustr); CPPUNIT_ASSERT(it != pDoc->getIDocumentMarkAccess()->getAllMarksEnd()); } @@ -866,12 +866,12 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateRefmark) createSwDoc(); SwDoc* pDoc = getSwDoc(); uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("TypeName", uno::Any(OUString("SetRef"))), - comphelper::makePropertyValue( - "Name", uno::Any(OUString("ZOTERO_ITEM CSL_CITATION {} old refmark"))), - comphelper::makePropertyValue("Content", uno::Any(OUString("old content"))), + comphelper::makePropertyValue(u"TypeName"_ustr, uno::Any(u"SetRef"_ustr)), + comphelper::makePropertyValue(u"Name"_ustr, + uno::Any(u"ZOTERO_ITEM CSL_CITATION {} old refmark"_ustr)), + comphelper::makePropertyValue(u"Content"_ustr, uno::Any(u"old content"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertField", aArgs); + dispatchCommand(mxComponent, u".uno:InsertField"_ustr, aArgs); // When updating that refmark: std::vector<beans::PropertyValue> aArgsVec = comphelper::JsonToPropertyValues(R"json( @@ -900,7 +900,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateRefmark) } )json"_ostr); aArgs = comphelper::containerToSequence(aArgsVec); - dispatchCommand(mxComponent, ".uno:UpdateField", aArgs); + dispatchCommand(mxComponent, u".uno:UpdateField"_ustr, aArgs); // Then make sure that the document text features the new content: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -909,7 +909,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateRefmark) // - Expected: new content // - Actual : old content // i.e. the content was not updated. - CPPUNIT_ASSERT_EQUAL(OUString("new content"), pTextNode->GetText()); + CPPUNIT_ASSERT_EQUAL(u"new content"_ustr, pTextNode->GetText()); } CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDeleteBookmarks) @@ -918,14 +918,14 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDeleteBookmarks) createSwDoc(); SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - pWrtShell->Insert("ABCDE"); + pWrtShell->Insert(u"ABCDE"_ustr); pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); - pWrtShell->SetBookmark(vcl::KeyCode(), "ZOTERO_BREF_GiQ7DAWQYWLy"); + pWrtShell->SetBookmark(vcl::KeyCode(), u"ZOTERO_BREF_GiQ7DAWQYWLy"_ustr); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); - pWrtShell->SetBookmark(vcl::KeyCode(), "other"); + pWrtShell->SetBookmark(vcl::KeyCode(), u"other"_ustr); // When deleting 1 matching bookmark: pWrtShell->SttEndDoc(/*bStt=*/true); @@ -938,14 +938,14 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDeleteBookmarks) } )json"_ostr); uno::Sequence<beans::PropertyValue> aArgs = comphelper::containerToSequence(aArgsVec); - dispatchCommand(mxComponent, ".uno:DeleteBookmarks", aArgs); + dispatchCommand(mxComponent, u".uno:DeleteBookmarks"_ustr, aArgs); // Then make sure that only the other bookmark is kept: - auto it = pDoc->getIDocumentMarkAccess()->findMark("ZOTERO_BREF_GiQ7DAWQYWLy"); + auto it = pDoc->getIDocumentMarkAccess()->findMark(u"ZOTERO_BREF_GiQ7DAWQYWLy"_ustr); // Without the accompanying fix in place, this test would have failed, the matching bookmark was // not removed. CPPUNIT_ASSERT(bool(it == pDoc->getIDocumentMarkAccess()->getAllMarksEnd())); - it = pDoc->getIDocumentMarkAccess()->findMark("other"); + it = pDoc->getIDocumentMarkAccess()->findMark(u"other"_ustr); CPPUNIT_ASSERT(it != pDoc->getIDocumentMarkAccess()->getAllMarksEnd()); } @@ -954,12 +954,12 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDeleteFields) // Given a document with a refmark: createSwDoc(); uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("TypeName", uno::Any(OUString("SetRef"))), - comphelper::makePropertyValue( - "Name", uno::Any(OUString("ZOTERO_ITEM CSL_CITATION {} RNDpyJknp173F"))), - comphelper::makePropertyValue("Content", uno::Any(OUString("aaa<b>bbb</b>ccc"))), + comphelper::makePropertyValue(u"TypeName"_ustr, uno::Any(u"SetRef"_ustr)), + comphelper::makePropertyValue(u"Name"_ustr, + uno::Any(u"ZOTERO_ITEM CSL_CITATION {} RNDpyJknp173F"_ustr)), + comphelper::makePropertyValue(u"Content"_ustr, uno::Any(u"aaa<b>bbb</b>ccc"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertField", aArgs); + dispatchCommand(mxComponent, u".uno:InsertField"_ustr, aArgs); // When deleting the refmarks: std::vector<beans::PropertyValue> aArgsVec = comphelper::JsonToPropertyValues(R"json( @@ -975,7 +975,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDeleteFields) } )json"_ostr); aArgs = comphelper::containerToSequence(aArgsVec); - dispatchCommand(mxComponent, ".uno:DeleteFields", aArgs); + dispatchCommand(mxComponent, u".uno:DeleteFields"_ustr, aArgs); // Then make sure that no refmark is kept: SwDoc* pDoc = getSwDoc(); @@ -994,13 +994,13 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testInsertTextFormFieldFootnote) // When inserting an ODF_UNHANDLED fieldmark inside a footnote: uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommand", - uno::Any(OUString("ADDIN ZOTERO_BIBL foo bar"))), - comphelper::makePropertyValue("FieldResult", uno::Any(OUString("result"))), - comphelper::makePropertyValue("Wrapper", uno::Any(OUString("Footnote"))), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommand"_ustr, + uno::Any(u"ADDIN ZOTERO_BIBL foo bar"_ustr)), + comphelper::makePropertyValue(u"FieldResult"_ustr, uno::Any(u"result"_ustr)), + comphelper::makePropertyValue(u"Wrapper"_ustr, uno::Any(u"Footnote"_ustr)), }; - dispatchCommand(mxComponent, ".uno:TextFormField", aArgs); + dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); // Then make sure that the footnote is created: SwFootnoteIdxs& rFootnotes = pDoc->GetFootnoteIdxs(); @@ -1019,13 +1019,13 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testInsertTextFormFieldEndnote) // When inserting an ODF_UNHANDLED fieldmark inside an endnote: uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommand", - uno::Any(OUString("ADDIN ZOTERO_BIBL foo bar"))), - comphelper::makePropertyValue("FieldResult", uno::Any(OUString("result"))), - comphelper::makePropertyValue("Wrapper", uno::Any(OUString("Endnote"))), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommand"_ustr, + uno::Any(u"ADDIN ZOTERO_BIBL foo bar"_ustr)), + comphelper::makePropertyValue(u"FieldResult"_ustr, uno::Any(u"result"_ustr)), + comphelper::makePropertyValue(u"Wrapper"_ustr, uno::Any(u"Endnote"_ustr)), }; - dispatchCommand(mxComponent, ".uno:TextFormField", aArgs); + dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); // Then make sure that the endnote is created: SwFootnoteIdxs& rFootnotes = pDoc->GetFootnoteIdxs(); @@ -1048,7 +1048,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testInsertTextFormFieldEndnote) = { CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDSEP, CH_TXT_ATR_FIELDEND, 0 }; aActual = comphelper::string::removeAny(aActual, aForbidden); // Then this was empty: the fieldmark was inserted before the note anchor, not in the note body. - CPPUNIT_ASSERT_EQUAL(OUString("result"), aActual); + CPPUNIT_ASSERT_EQUAL(u"result"_ustr, aActual); } CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateSelectedField) @@ -1062,7 +1062,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateSelectedField) SwPaM* pCursor = pShell->GetCursor(); // Insert a time field and select it: - dispatchCommand(mxComponent, ".uno:InsertTimeFieldVar", {}); + dispatchCommand(mxComponent, u".uno:InsertTimeFieldVar"_ustr, {}); pCursor->SetMark(); pCursor->Move(fnMoveBackward); @@ -1074,7 +1074,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateSelectedField) osl::Thread::wait(std::chrono::seconds(1)); // Update the field at cursor: - dispatchCommand(mxComponent, ".uno:UpdateSelectedField", {}); + dispatchCommand(mxComponent, u".uno:UpdateSelectedField"_ustr, {}); pWrtShell->GetSelectedText(aTimeFieldAfter); // Check that the selected field has changed: diff --git a/sw/qa/uibase/shells/textfld.cxx b/sw/qa/uibase/shells/textfld.cxx index 6f9fa0c1c2f6..81cb631cc9b3 100644 --- a/sw/qa/uibase/shells/textfld.cxx +++ b/sw/qa/uibase/shells/textfld.cxx @@ -23,7 +23,7 @@ class Test : public SwModelTestBase { public: Test() - : SwModelTestBase("/sw/qa/uibase/shells/data/") + : SwModelTestBase(u"/sw/qa/uibase/shells/data/"_ustr) { } }; @@ -36,12 +36,12 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkFootnote) // When inserting a refmark inside a footnote: uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("TypeName", uno::Any(OUString("SetRef"))), - comphelper::makePropertyValue("Name", uno::Any(OUString("myref"))), - comphelper::makePropertyValue("Content", uno::Any(OUString("content"))), - comphelper::makePropertyValue("Wrapper", uno::Any(OUString("Footnote"))), + comphelper::makePropertyValue(u"TypeName"_ustr, uno::Any(u"SetRef"_ustr)), + comphelper::makePropertyValue(u"Name"_ustr, uno::Any(u"myref"_ustr)), + comphelper::makePropertyValue(u"Content"_ustr, uno::Any(u"content"_ustr)), + comphelper::makePropertyValue(u"Wrapper"_ustr, uno::Any(u"Footnote"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertField", aArgs); + dispatchCommand(mxComponent, u".uno:InsertField"_ustr, aArgs); // Then make sure that the note body contains the refmark: SwDoc* pDoc = getSwDoc(); @@ -55,7 +55,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkFootnote) const SwFormatFootnote& rFormatNote = pNote->GetFootnote(); CPPUNIT_ASSERT(!rFormatNote.IsEndNote()); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - CPPUNIT_ASSERT_EQUAL(OUString("content"), rFormatNote.GetFootnoteText(*pWrtShell->GetLayout())); + CPPUNIT_ASSERT_EQUAL(u"content"_ustr, rFormatNote.GetFootnoteText(*pWrtShell->GetLayout())); } CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkEndnote) @@ -65,12 +65,12 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkEndnote) // When inserting a refmark inside an endnote: uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("TypeName", uno::Any(OUString("SetRef"))), - comphelper::makePropertyValue("Name", uno::Any(OUString("myref"))), - comphelper::makePropertyValue("Content", uno::Any(OUString("content"))), - comphelper::makePropertyValue("Wrapper", uno::Any(OUString("Endnote"))), + comphelper::makePropertyValue(u"TypeName"_ustr, uno::Any(u"SetRef"_ustr)), + comphelper::makePropertyValue(u"Name"_ustr, uno::Any(u"myref"_ustr)), + comphelper::makePropertyValue(u"Content"_ustr, uno::Any(u"content"_ustr)), + comphelper::makePropertyValue(u"Wrapper"_ustr, uno::Any(u"Endnote"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertField", aArgs); + dispatchCommand(mxComponent, u".uno:InsertField"_ustr, aArgs); // Then make sure that the note body contains the refmark: SwDoc* pDoc = getSwDoc(); @@ -84,7 +84,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkEndnote) const SwFormatFootnote& rNote = pNote->GetFootnote(); CPPUNIT_ASSERT(rNote.IsEndNote()); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - CPPUNIT_ASSERT_EQUAL(OUString("content"), rNote.GetFootnoteText(*pWrtShell->GetLayout())); + CPPUNIT_ASSERT_EQUAL(u"content"_ustr, rNote.GetFootnoteText(*pWrtShell->GetLayout())); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/uibase/shells/textsh.cxx b/sw/qa/uibase/shells/textsh.cxx index ca72a710df3f..265ac4c7dff1 100644 --- a/sw/qa/uibase/shells/textsh.cxx +++ b/sw/qa/uibase/shells/textsh.cxx @@ -30,7 +30,7 @@ class Test : public SwModelTestBase { public: Test() - : SwModelTestBase("/sw/qa/uibase/shells/data/") + : SwModelTestBase(u"/sw/qa/uibase/shells/data/"_ustr) { } }; @@ -41,11 +41,11 @@ CPPUNIT_TEST_FIXTURE(Test, testDeleteSections) createSwDoc(); SwDoc* pDoc = getSwDoc(); uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("RegionName", - uno::Any(OUString("ZOTERO_BIBL {} CSL_BIBLIOGRAPHY RND"))), - comphelper::makePropertyValue("Content", uno::Any(OUString("old content"))), + comphelper::makePropertyValue(u"RegionName"_ustr, + uno::Any(u"ZOTERO_BIBL {} CSL_BIBLIOGRAPHY RND"_ustr)), + comphelper::makePropertyValue(u"Content"_ustr, uno::Any(u"old content"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertSection", aArgs); + dispatchCommand(mxComponent, u".uno:InsertSection"_ustr, aArgs); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDoc->GetSections().size()); // When deleting sections: @@ -58,7 +58,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDeleteSections) } )json"_ostr); aArgs = comphelper::containerToSequence(aArgsVec); - dispatchCommand(mxComponent, ".uno:DeleteSections", aArgs); + dispatchCommand(mxComponent, u".uno:DeleteSections"_ustr, aArgs); // Then make sure that the section is deleted: // Without the accompanying fix in place, this test would have failed with: diff --git a/sw/qa/uibase/uiview/uiview.cxx b/sw/qa/uibase/uiview/uiview.cxx index ceae7d644c3f..229804a8c14b 100644 --- a/sw/qa/uibase/uiview/uiview.cxx +++ b/sw/qa/uibase/uiview/uiview.cxx @@ -34,7 +34,7 @@ class SwUibaseUiviewTest : public SwModelTestBase { public: SwUibaseUiviewTest() - : SwModelTestBase("/sw/qa/uibase/uiview/data/") + : SwModelTestBase(u"/sw/qa/uibase/uiview/data/"_ustr) { } }; @@ -63,20 +63,22 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testUpdateAllObjectReplacements) // Load the copy uno::Reference<uno::XInterface> xInterface - = xFactory->createInstance("com.sun.star.frame.Desktop"); + = xFactory->createInstance(u"com.sun.star.frame.Desktop"_ustr); uno::Reference<frame::XComponentLoader> xComponentLoader(xInterface, uno::UNO_QUERY); - uno::Sequence<beans::PropertyValue> aLoadArgs{ comphelper::makePropertyValue("Hidden", true) }; - mxComponent - = xComponentLoader->loadComponentFromURL(maTempFile.GetURL(), "_default", 0, aLoadArgs); + uno::Sequence<beans::PropertyValue> aLoadArgs{ comphelper::makePropertyValue(u"Hidden"_ustr, + true) }; + mxComponent = xComponentLoader->loadComponentFromURL(maTempFile.GetURL(), u"_default"_ustr, 0, + aLoadArgs); // Perform the .uno:UpdateAll call and save - xInterface = xFactory->createInstance("com.sun.star.frame.DispatchHelper"); + xInterface = xFactory->createInstance(u"com.sun.star.frame.DispatchHelper"_ustr); uno::Reference<frame::XDispatchHelper> xDispatchHelper(xInterface, uno::UNO_QUERY); uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); uno::Reference<frame::XDispatchProvider> xDispatchProvider( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aNoArgs; - xDispatchHelper->executeDispatch(xDispatchProvider, ".uno:UpdateAll", OUString(), 0, aNoArgs); + xDispatchHelper->executeDispatch(xDispatchProvider, u".uno:UpdateAll"_ustr, OUString(), 0, + aNoArgs); uno::Reference<frame::XStorable2> xStorable(mxComponent, uno::UNO_QUERY); xStorable->storeSelf(aNoArgs); @@ -85,8 +87,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testUpdateAllObjectReplacements) = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(xFactory), maTempFile.GetURL()); - CPPUNIT_ASSERT(xNameAccess->hasByName("ObjectReplacements/Components")); - CPPUNIT_ASSERT(xNameAccess->hasByName("ObjectReplacements/Components_1")); + CPPUNIT_ASSERT(xNameAccess->hasByName(u"ObjectReplacements/Components"_ustr)); + CPPUNIT_ASSERT(xNameAccess->hasByName(u"ObjectReplacements/Components_1"_ustr)); } CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testUpdateReplacementNosetting) @@ -94,11 +96,11 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testUpdateReplacementNosetting) // Load a copy of the document in hidden mode. OUString aSourceURL = createFileURL(u"update-replacement-nosetting.odt"); CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, osl::File::copy(aSourceURL, maTempFile.GetURL())); - mxComponent = loadFromDesktop(maTempFile.GetURL(), "com.sun.star.text.TextDocument", - { comphelper::makePropertyValue("Hidden", true) }); + mxComponent = loadFromDesktop(maTempFile.GetURL(), u"com.sun.star.text.TextDocument"_ustr, + { comphelper::makePropertyValue(u"Hidden"_ustr, true) }); // Update "everything" (including object replacements) and save it. - dispatchCommand(mxComponent, ".uno:UpdateAll", {}); + dispatchCommand(mxComponent, u".uno:UpdateAll"_ustr, {}); uno::Reference<frame::XStorable2> xStorable(mxComponent, uno::UNO_QUERY); xStorable->storeSelf({}); @@ -109,7 +111,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testUpdateReplacementNosetting) // Without the accompanying fix in place, this test would have failed, because the embedded // object replacement image was not generated. - CPPUNIT_ASSERT(xNameAccess->hasByName("ObjectReplacements/Components")); + CPPUNIT_ASSERT(xNameAccess->hasByName(u"ObjectReplacements/Components"_ustr)); } CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testKeepRatio) @@ -134,9 +136,10 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testKeepRatio) CPPUNIT_ASSERT(pViewOption->IsKeepRatio()); // Then export as well: - save("writer8"); - xmlDocUniquePtr pXmlDoc = parseExport("settings.xml"); - assertXPathContent(pXmlDoc, "//config:config-item[@config:name='KeepRatio']"_ostr, "true"); + save(u"writer8"_ustr); + xmlDocUniquePtr pXmlDoc = parseExport(u"settings.xml"_ustr); + assertXPathContent(pXmlDoc, "//config:config-item[@config:name='KeepRatio']"_ostr, + u"true"_ustr); } namespace @@ -243,10 +246,10 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testSwitchBetweenImages) for (int i = 0; i < 2; ++i) { uno::Reference<beans::XPropertySet> xTextGraphic( - xMSF->createInstance("com.sun.star.text.TextGraphicObject"), uno::UNO_QUERY); - xTextGraphic->setPropertyValue("AnchorType", + xMSF->createInstance(u"com.sun.star.text.TextGraphicObject"_ustr), uno::UNO_QUERY); + xTextGraphic->setPropertyValue(u"AnchorType"_ustr, uno::Any(text::TextContentAnchorType_AS_CHARACTER)); - xTextGraphic->setPropertyValue("Size", uno::Any(awt::Size(5000, 5000))); + xTextGraphic->setPropertyValue(u"Size"_ustr, uno::Any(awt::Size(5000, 5000))); uno::Reference<text::XTextContent> xTextContent(xTextGraphic, uno::UNO_QUERY); xText->insertTextContent(xCursor, xTextContent, false); } diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx index 3e6d9c93d51c..c9d49071a25b 100644 --- a/sw/qa/uibase/uno/uno.cxx +++ b/sw/qa/uibase/uno/uno.cxx @@ -39,7 +39,7 @@ class SwUibaseUnoTest : public SwModelTestBase { public: SwUibaseUnoTest() - : SwModelTestBase("/sw/qa/uibase/uno/data/") + : SwModelTestBase(u"/sw/qa/uibase/uno/data/"_ustr) { } }; @@ -68,7 +68,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCondFieldCachedValue) // - Expected: 1 // - Actual : // i.e. the conditional field lost its cached content. - getParagraph(2, "1"); + getParagraph(2, u"1"_ustr); } CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCreateTextRangeByPixelPosition) @@ -78,7 +78,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCreateTextRangeByPixelPosition) SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); - pWrtShell->Insert2("AZ"); + pWrtShell->Insert2(u"AZ"_ustr); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); Point aLogic = pWrtShell->GetCharRect().Center(); SwView* pView = pDocShell->GetView(); @@ -113,11 +113,11 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCreateTextRangeByPixelPositionGraphic) createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xTextGraphic( - xFactory->createInstance("com.sun.star.text.TextGraphicObject"), uno::UNO_QUERY); - xTextGraphic->setPropertyValue("AnchorType", + xFactory->createInstance(u"com.sun.star.text.TextGraphicObject"_ustr), uno::UNO_QUERY); + xTextGraphic->setPropertyValue(u"AnchorType"_ustr, uno::Any(text::TextContentAnchorType_AS_CHARACTER)); - xTextGraphic->setPropertyValue("Width", uno::Any(static_cast<sal_Int32>(10000))); - xTextGraphic->setPropertyValue("Height", uno::Any(static_cast<sal_Int32>(10000))); + xTextGraphic->setPropertyValue(u"Width"_ustr, uno::Any(static_cast<sal_Int32>(10000))); + xTextGraphic->setPropertyValue(u"Height"_ustr, uno::Any(static_cast<sal_Int32>(10000))); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xBodyText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor(xBodyText->createTextCursor()); @@ -164,11 +164,12 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testCreateTextRangeByPixelPositionAtPageGr createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xTextGraphic( - xFactory->createInstance("com.sun.star.text.TextGraphicObject"), uno::UNO_QUERY); - xTextGraphic->setPropertyValue("AnchorType", uno::Any(text::TextContentAnchorType_AT_PAGE)); - xTextGraphic->setPropertyValue("AnchorPageNo", uno::Any(static_cast<sal_Int16>(1))); - xTextGraphic->setPropertyValue("Width", uno::Any(static_cast<sal_Int32>(10000))); - xTextGraphic->setPropertyValue("Height", uno::Any(static_cast<sal_Int32>(10000))); + xFactory->createInstance(u"com.sun.star.text.TextGraphicObject"_ustr), uno::UNO_QUERY); + xTextGraphic->setPropertyValue(u"AnchorType"_ustr, + uno::Any(text::TextContentAnchorType_AT_PAGE)); + xTextGraphic->setPropertyValue(u"AnchorPageNo"_ustr, uno::Any(static_cast<sal_Int16>(1))); + xTextGraphic->setPropertyValue(u"Width"_ustr, uno::Any(static_cast<sal_Int32>(10000))); + xTextGraphic->setPropertyValue(u"Height"_ustr, uno::Any(static_cast<sal_Int32>(10000))); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xBodyText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor(xBodyText->createTextCursor()); @@ -208,22 +209,22 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetTextFormFields) for (int i = 0; i < 2; ++i) { uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommand", - uno::Any(OUString("ADDIN ZOTERO_ITEM foo bar"))), - comphelper::makePropertyValue("FieldResult", uno::Any(OUString("result"))), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommand"_ustr, + uno::Any(u"ADDIN ZOTERO_ITEM foo bar"_ustr)), + comphelper::makePropertyValue(u"FieldResult"_ustr, uno::Any(u"result"_ustr)), }; - dispatchCommand(mxComponent, ".uno:TextFormField", aArgs); + dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); } { uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommand", - uno::Any(OUString("ADDIN ZOTERO_BIBL foo bar"))), - comphelper::makePropertyValue("FieldResult", - uno::Any(OUString("<p>aaa</p><p>bbb</p>"))), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommand"_ustr, + uno::Any(u"ADDIN ZOTERO_BIBL foo bar"_ustr)), + comphelper::makePropertyValue(u"FieldResult"_ustr, + uno::Any(u"<p>aaa</p><p>bbb</p>"_ustr)), }; - dispatchCommand(mxComponent, ".uno:TextFormField", aArgs); + dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); } // When getting the zotero items: @@ -254,11 +255,11 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetDocumentProperties) uno::UNO_QUERY); uno::Reference<document::XDocumentProperties> xDP = xDPS->getDocumentProperties(); uno::Reference<beans::XPropertyContainer> xUDP = xDP->getUserDefinedProperties(); - xUDP->addProperty("ZOTERO_PREF_1", beans::PropertyAttribute::REMOVABLE, - uno::Any(OUString("foo"))); - xUDP->addProperty("ZOTERO_PREF_2", beans::PropertyAttribute::REMOVABLE, - uno::Any(OUString("bar"))); - xUDP->addProperty("OTHER", beans::PropertyAttribute::REMOVABLE, uno::Any(OUString("baz"))); + xUDP->addProperty(u"ZOTERO_PREF_1"_ustr, beans::PropertyAttribute::REMOVABLE, + uno::Any(u"foo"_ustr)); + xUDP->addProperty(u"ZOTERO_PREF_2"_ustr, beans::PropertyAttribute::REMOVABLE, + uno::Any(u"bar"_ustr)); + xUDP->addProperty(u"OTHER"_ustr, beans::PropertyAttribute::REMOVABLE, uno::Any(u"baz"_ustr)); // When getting the zotero properties: tools::JsonWriter aJsonWriter; @@ -284,21 +285,21 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetBookmarks) createSwDoc(); { uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("Bookmark", uno::Any(OUString("ZOTERO_BREF_1"))), + comphelper::makePropertyValue(u"Bookmark"_ustr, uno::Any(u"ZOTERO_BREF_1"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertBookmark", aArgs); + dispatchCommand(mxComponent, u".uno:InsertBookmark"_ustr, aArgs); } { uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("Bookmark", uno::Any(OUString("ZOTERO_BREF_2"))), + comphelper::makePropertyValue(u"Bookmark"_ustr, uno::Any(u"ZOTERO_BREF_2"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertBookmark", aArgs); + dispatchCommand(mxComponent, u".uno:InsertBookmark"_ustr, aArgs); } { uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("Bookmark", uno::Any(OUString("ZOTERO_BIBL"))), + comphelper::makePropertyValue(u"Bookmark"_ustr, uno::Any(u"ZOTERO_BIBL"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertBookmark", aArgs); + dispatchCommand(mxComponent, u".uno:InsertBookmark"_ustr, aArgs); } // When getting the reference bookmarks: @@ -324,15 +325,15 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetFields) createSwDoc(); SwDoc* pDoc = getSwDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - OUString aName("ZOTERO_ITEM CSL_CITATION {} "); + OUString aName(u"ZOTERO_ITEM CSL_CITATION {} "_ustr); for (int i = 0; i < 5; ++i) { uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("TypeName", uno::Any(OUString("SetRef"))), - comphelper::makePropertyValue("Name", uno::Any(aName + OUString::number(i + 1))), - comphelper::makePropertyValue("Content", uno::Any(OUString("mycontent"))), + comphelper::makePropertyValue(u"TypeName"_ustr, uno::Any(u"SetRef"_ustr)), + comphelper::makePropertyValue(u"Name"_ustr, uno::Any(aName + OUString::number(i + 1))), + comphelper::makePropertyValue(u"Content"_ustr, uno::Any(u"mycontent"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertField", aArgs); + dispatchCommand(mxComponent, u".uno:InsertField"_ustr, aArgs); pWrtShell->SttEndDoc(/*bStt=*/false); pWrtShell->SplitNode(); pWrtShell->SttEndDoc(/*bStt=*/false); @@ -380,12 +381,12 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetTextFormField) // Given a document with a fieldmark: createSwDoc(); uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FieldType", uno::Any(ODF_UNHANDLED)), - comphelper::makePropertyValue("FieldCommand", - uno::Any(OUString("ADDIN ZOTERO_ITEM foo bar"))), - comphelper::makePropertyValue("FieldResult", uno::Any(OUString("result"))), + comphelper::makePropertyValue(u"FieldType"_ustr, uno::Any(ODF_UNHANDLED)), + comphelper::makePropertyValue(u"FieldCommand"_ustr, + uno::Any(u"ADDIN ZOTERO_ITEM foo bar"_ustr)), + comphelper::makePropertyValue(u"FieldResult"_ustr, uno::Any(u"result"_ustr)), }; - dispatchCommand(mxComponent, ".uno:TextFormField", aArgs); + dispatchCommand(mxComponent, u".uno:TextFormField"_ustr, aArgs); // When stepping into the fieldmark with the cursor and getting the command value for // uno:TextFormField: @@ -420,10 +421,10 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetSections) createSwDoc(); uno::Sequence<css::beans::PropertyValue> aArgs = { comphelper::makePropertyValue( - "RegionName", uno::Any(OUString("ZOTERO_BIBL {} CSL_BIBLIOGRAPHY RNDRfiit6mXBc"))), - comphelper::makePropertyValue("Content", uno::Any(OUString("<p>aaa</p><p>bbb</p>"))), + u"RegionName"_ustr, uno::Any(u"ZOTERO_BIBL {} CSL_BIBLIOGRAPHY RNDRfiit6mXBc"_ustr)), + comphelper::makePropertyValue(u"Content"_ustr, uno::Any(u"<p>aaa</p><p>bbb</p>"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertSection", aArgs); + dispatchCommand(mxComponent, u".uno:InsertSection"_ustr, aArgs); // When asking for a list of section names: tools::JsonWriter aJsonWriter; @@ -447,10 +448,10 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetBookmark) // Given a document with a bookmark: createSwDoc(); uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("Bookmark", uno::Any(OUString("ZOTERO_BREF_1"))), - comphelper::makePropertyValue("BookmarkText", uno::Any(OUString("<p>aaa</p><p>bbb</p>"))), + comphelper::makePropertyValue(u"Bookmark"_ustr, uno::Any(u"ZOTERO_BREF_1"_ustr)), + comphelper::makePropertyValue(u"BookmarkText"_ustr, uno::Any(u"<p>aaa</p><p>bbb</p>"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertBookmark", aArgs); + dispatchCommand(mxComponent, u".uno:InsertBookmark"_ustr, aArgs); // When stepping into the bookmark with the cursor and getting the command value for // .uno:Bookmark: @@ -480,12 +481,12 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetField) // Given a document with a refmark: createSwDoc(); uno::Sequence<css::beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("TypeName", uno::Any(OUString("SetRef"))), - comphelper::makePropertyValue("Name", - uno::Any(OUString("ZOTERO_ITEM CSL_CITATION {} refmark"))), - comphelper::makePropertyValue("Content", uno::Any(OUString("content"))), + comphelper::makePropertyValue(u"TypeName"_ustr, uno::Any(u"SetRef"_ustr)), + comphelper::makePropertyValue(u"Name"_ustr, + uno::Any(u"ZOTERO_ITEM CSL_CITATION {} refmark"_ustr)), + comphelper::makePropertyValue(u"Content"_ustr, uno::Any(u"content"_ustr)), }; - dispatchCommand(mxComponent, ".uno:InsertField", aArgs); + dispatchCommand(mxComponent, u".uno:InsertField"_ustr, aArgs); // When in the refmark with the cursor and getting the command value for .uno:Field: SwDoc* pDoc = getSwDoc(); @@ -518,19 +519,19 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testDoNotBreakWrappedTables) // When checking the state of the DoNotBreakWrappedTables compat flag: uno::Reference<lang::XMultiServiceFactory> xDocument(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xSettings( - xDocument->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); + xDocument->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY); bool bDoNotBreakWrappedTables{}; // Without the accompanying fix in place, this test would have failed with: // An uncaught exception of type com.sun.star.beans.UnknownPropertyException // i.e. the compat flag was not recognized. - xSettings->getPropertyValue("DoNotBreakWrappedTables") >>= bDoNotBreakWrappedTables; + xSettings->getPropertyValue(u"DoNotBreakWrappedTables"_ustr) >>= bDoNotBreakWrappedTables; // Then make sure it's false by default: CPPUNIT_ASSERT(!bDoNotBreakWrappedTables); // And when setting DoNotBreakWrappedTables=true: - xSettings->setPropertyValue("DoNotBreakWrappedTables", uno::Any(true)); + xSettings->setPropertyValue(u"DoNotBreakWrappedTables"_ustr, uno::Any(true)); // Then make sure it gets enabled: - xSettings->getPropertyValue("DoNotBreakWrappedTables") >>= bDoNotBreakWrappedTables; + xSettings->getPropertyValue(u"DoNotBreakWrappedTables"_ustr) >>= bDoNotBreakWrappedTables; CPPUNIT_ASSERT(bDoNotBreakWrappedTables); } @@ -542,20 +543,20 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testAllowTextAfterFloatingTableBreak) // When checking the state of the AllowTextAfterFloatingTableBreak compat flag: uno::Reference<lang::XMultiServiceFactory> xDocument(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xSettings( - xDocument->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); + xDocument->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY); bool bAllowTextAfterFloatingTableBreak{}; // Without the accompanying fix in place, this test would have failed with: // An uncaught exception of type com.sun.star.beans.UnknownPropertyException // i.e. the compat flag was not recognized. - xSettings->getPropertyValue("AllowTextAfterFloatingTableBreak") + xSettings->getPropertyValue(u"AllowTextAfterFloatingTableBreak"_ustr) >>= bAllowTextAfterFloatingTableBreak; // Then make sure it's false by default: CPPUNIT_ASSERT(!bAllowTextAfterFloatingTableBreak); // And when setting AllowTextAfterFloatingTableBreak=true: - xSettings->setPropertyValue("AllowTextAfterFloatingTableBreak", uno::Any(true)); + xSettings->setPropertyValue(u"AllowTextAfterFloatingTableBreak"_ustr, uno::Any(true)); // Then make sure it gets enabled: - xSettings->getPropertyValue("AllowTextAfterFloatingTableBreak") + xSettings->getPropertyValue(u"AllowTextAfterFloatingTableBreak"_ustr) >>= bAllowTextAfterFloatingTableBreak; CPPUNIT_ASSERT(bAllowTextAfterFloatingTableBreak); } @@ -568,19 +569,19 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testDoNotMirrorRtlDrawObjs) // When checking the state of the DoNotMirrorRtlDrawObjs compat flag: uno::Reference<lang::XMultiServiceFactory> xDocument(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xSettings( - xDocument->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); + xDocument->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY); bool bDoNotMirrorRtlDrawObjs{}; // Without the accompanying fix in place, this test would have failed with: // An uncaught exception of type com.sun.star.beans.UnknownPropertyException // i.e. the compat flag was not recognized. - xSettings->getPropertyValue("DoNotMirrorRtlDrawObjs") >>= bDoNotMirrorRtlDrawObjs; + xSettings->getPropertyValue(u"DoNotMirrorRtlDrawObjs"_ustr) >>= bDoNotMirrorRtlDrawObjs; // Then make sure it's false by default: CPPUNIT_ASSERT(!bDoNotMirrorRtlDrawObjs); // And when setting DoNotMirrorRtlDrawObjs=true: - xSettings->setPropertyValue("DoNotMirrorRtlDrawObjs", uno::Any(true)); + xSettings->setPropertyValue(u"DoNotMirrorRtlDrawObjs"_ustr, uno::Any(true)); // Then make sure it gets enabled: - xSettings->getPropertyValue("DoNotMirrorRtlDrawObjs") >>= bDoNotMirrorRtlDrawObjs; + xSettings->getPropertyValue(u"DoNotMirrorRtlDrawObjs"_ustr) >>= bDoNotMirrorRtlDrawObjs; CPPUNIT_ASSERT(bDoNotMirrorRtlDrawObjs); } diff --git a/sw/qa/uibase/wrtsh/wrtsh.cxx b/sw/qa/uibase/wrtsh/wrtsh.cxx index 00b2d3a30ab1..9c19c4474b9d 100644 --- a/sw/qa/uibase/wrtsh/wrtsh.cxx +++ b/sw/qa/uibase/wrtsh/wrtsh.cxx @@ -49,14 +49,15 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertLineBreak) // Then make sure it's not just a plain linebreak: uno::Reference<css::text::XTextRange> xTextPortion = getRun(getParagraph(1), 1); - auto aPortionType = getProperty<OUString>(xTextPortion, "TextPortionType"); + auto aPortionType = getProperty<OUString>(xTextPortion, u"TextPortionType"_ustr); // Without the accompanying fix in place, this test would have failed with: // - Expected: LineBreak // - Actual : Text // i.e. the line break lost its "clear" property. - CPPUNIT_ASSERT_EQUAL(OUString("LineBreak"), aPortionType); - auto xLineBreak = getProperty<uno::Reference<text::XTextContent>>(xTextPortion, "LineBreak"); - auto eClear = getProperty<sal_Int16>(xLineBreak, "Clear"); + CPPUNIT_ASSERT_EQUAL(u"LineBreak"_ustr, aPortionType); + auto xLineBreak + = getProperty<uno::Reference<text::XTextContent>>(xTextPortion, u"LineBreak"_ustr); + auto eClear = getProperty<sal_Int16>(xLineBreak, u"Clear"_ustr); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(SwLineBreakClear::ALL), eClear); } @@ -69,13 +70,13 @@ CPPUNIT_TEST_FIXTURE(Test, testGotoContentControl) 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 going to that content control in placeholder mode: @@ -107,7 +108,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTickCheckboxContentControl) // The default Liberation Serif doesn't have a checkmark glyph, avoid font fallback. SwView& rView = pWrtShell->GetView(); SfxItemSetFixed<RES_CHRATR_BEGIN, RES_CHRATR_END> aSet(rView.GetPool()); - SvxFontItem aFont(FAMILY_DONTKNOW, "DejaVu Sans", OUString(), PITCH_DONTKNOW, + SvxFontItem aFont(FAMILY_DONTKNOW, u"DejaVu Sans"_ustr, OUString(), PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT); aSet.Put(aFont); pWrtShell->SetAttrSet(aSet); @@ -120,12 +121,12 @@ CPPUNIT_TEST_FIXTURE(Test, testTickCheckboxContentControl) 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 clicking on that content control: @@ -173,7 +174,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertCheckboxContentControl) // The default Liberation Serif doesn't have a checkmark glyph, avoid font fallback. SwView& rView = pWrtShell->GetView(); SfxItemSetFixed<RES_CHRATR_BEGIN, RES_CHRATR_END> aSet(rView.GetPool()); - SvxFontItem aFont(FAMILY_DONTKNOW, "DejaVu Sans", OUString(), PITCH_DONTKNOW, + SvxFontItem aFont(FAMILY_DONTKNOW, u"DejaVu Sans"_ustr, OUString(), PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT); aSet.Put(aFont); pWrtShell->SetAttrSet(aSet); @@ -201,28 +202,28 @@ CPPUNIT_TEST_FIXTURE(Test, testSelectDropdownContentControl) 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); { uno::Sequence<beans::PropertyValues> aListItems = { { - comphelper::makePropertyValue("DisplayText", uno::Any(OUString("red"))), - comphelper::makePropertyValue("Value", uno::Any(OUString("R"))), + comphelper::makePropertyValue(u"DisplayText"_ustr, uno::Any(u"red"_ustr)), + comphelper::makePropertyValue(u"Value"_ustr, uno::Any(u"R"_ustr)), }, { - comphelper::makePropertyValue("DisplayText", uno::Any(OUString("green"))), - comphelper::makePropertyValue("Value", uno::Any(OUString("G"))), + comphelper::makePropertyValue(u"DisplayText"_ustr, uno::Any(u"green"_ustr)), + comphelper::makePropertyValue(u"Value"_ustr, uno::Any(u"G"_ustr)), }, { - comphelper::makePropertyValue("DisplayText", uno::Any(OUString("blue"))), - comphelper::makePropertyValue("Value", uno::Any(OUString("B"))), + comphelper::makePropertyValue(u"DisplayText"_ustr, uno::Any(u"blue"_ustr)), + comphelper::makePropertyValue(u"Value"_ustr, uno::Any(u"B"_ustr)), }, }; - xContentControlProps->setPropertyValue("ListItems", uno::Any(aListItems)); + xContentControlProps->setPropertyValue(u"ListItems"_ustr, uno::Any(aListItems)); } xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); @@ -241,7 +242,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSelectDropdownContentControl) // - Expected: red // - Actual : choose an item // i.e. the document text was unchanged instead of display text of the first list item. - CPPUNIT_ASSERT_EQUAL(OUString("red"), pTextNode->GetExpandText(pWrtShell->GetLayout())); + CPPUNIT_ASSERT_EQUAL(u"red"_ustr, pTextNode->GetExpandText(pWrtShell->GetLayout())); } CPPUNIT_TEST_FIXTURE(Test, testInsertDropdownContentControl) @@ -278,18 +279,18 @@ CPPUNIT_TEST_FIXTURE(Test, testReplacePictureContentControl) uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); uno::Reference<beans::XPropertySet> xTextGraphic( - xMSF->createInstance("com.sun.star.text.TextGraphicObject"), uno::UNO_QUERY); - xTextGraphic->setPropertyValue("AnchorType", + xMSF->createInstance(u"com.sun.star.text.TextGraphicObject"_ustr), uno::UNO_QUERY); + xTextGraphic->setPropertyValue(u"AnchorType"_ustr, uno::Any(text::TextContentAnchorType_AS_CHARACTER)); uno::Reference<text::XTextContent> xTextContent(xTextGraphic, uno::UNO_QUERY); xText->insertTextContent(xCursor, xTextContent, 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("Picture", uno::Any(true)); + xContentControlProps->setPropertyValue(u"ShowingPlaceHolder"_ustr, uno::Any(true)); + xContentControlProps->setPropertyValue(u"Picture"_ustr, uno::Any(true)); xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When clicking on that content control: @@ -346,15 +347,15 @@ CPPUNIT_TEST_FIXTURE(Test, testSelectDateContentControl) 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("Date", uno::Any(true)); - xContentControlProps->setPropertyValue("DateFormat", uno::Any(OUString("YYYY-MM-DD"))); - xContentControlProps->setPropertyValue("DateLanguage", uno::Any(OUString("en-US"))); + xContentControlProps->setPropertyValue(u"Date"_ustr, uno::Any(true)); + xContentControlProps->setPropertyValue(u"DateFormat"_ustr, uno::Any(u"YYYY-MM-DD"_ustr)); + xContentControlProps->setPropertyValue(u"DateLanguage"_ustr, uno::Any(u"en-US"_ustr)); xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When clicking on that content control: @@ -372,8 +373,8 @@ CPPUNIT_TEST_FIXTURE(Test, testSelectDateContentControl) // - Expected: 2022-05-24 // - Actual : test // i.e. the content control was not updated. - CPPUNIT_ASSERT_EQUAL(OUString("2022-05-24"), pTextNode->GetExpandText(pWrtShell->GetLayout())); - CPPUNIT_ASSERT_EQUAL(OUString("2022-05-24T00:00:00Z"), + CPPUNIT_ASSERT_EQUAL(u"2022-05-24"_ustr, pTextNode->GetExpandText(pWrtShell->GetLayout())); + CPPUNIT_ASSERT_EQUAL(u"2022-05-24T00:00:00Z"_ustr, rFormatContentControl.GetContentControl()->GetCurrentDate()); } @@ -423,7 +424,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertPlainTextContentControl) CPPUNIT_ASSERT(pContentControl->GetShowingPlaceHolder()); pWrtShell->GotoContentControl(rFormatContentControl); CPPUNIT_ASSERT(pContentControl->GetShowingPlaceHolder()); - pWrtShell->Insert("Foo"); + pWrtShell->Insert(u"Foo"_ustr); // No longer showing placeholder text, as it has been changed CPPUNIT_ASSERT(!pContentControl->GetShowingPlaceHolder()); } @@ -435,7 +436,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInsertComboBoxContentControl) SwDoc* pDoc = getSwDoc(); // When inserting a combo box content control: - dispatchCommand(mxComponent, ".uno:InsertComboBoxContentControl", {}); + dispatchCommand(mxComponent, u".uno:InsertComboBoxContentControl"_ustr, {}); // Then make sure that the matching text attribute is added to the document model: SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx index 28445c64d409..e22fb0f43e6a 100644 --- a/sw/qa/unit/swmodeltestbase.cxx +++ b/sw/qa/unit/swmodeltestbase.cxx @@ -47,9 +47,10 @@ void SwModelTestBase::paste(std::u16string_view aFilename, OUString aInstance, m_directories.getURLFromSrc(u"/sw/qa/extras/") + aFilename, StreamMode::STD_READ); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, pStream->GetError()); uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(std::move(pStream))); - uno::Sequence aDescriptor{ comphelper::makePropertyValue("InputStream", xStream), - comphelper::makePropertyValue("InsertMode", true), - comphelper::makePropertyValue("TextInsertModeRange", xTextRange) }; + uno::Sequence aDescriptor{ comphelper::makePropertyValue(u"InputStream"_ustr, xStream), + comphelper::makePropertyValue(u"InsertMode"_ustr, true), + comphelper::makePropertyValue(u"TextInsertModeRange"_ustr, + xTextRange) }; CPPUNIT_ASSERT(xFilter->filter(aDescriptor)); } @@ -221,7 +222,7 @@ xml::AttributeData SwModelTestBase::getUserDefineAttribute(const uno::Any& obj, const OUString& rValue) const { uno::Reference<container::XNameContainer> attrsCnt( - getProperty<uno::Any>(obj, "UserDefinedAttributes"), uno::UNO_QUERY_THROW); + getProperty<uno::Any>(obj, u"UserDefinedAttributes"_ustr), uno::UNO_QUERY_THROW); xml::AttributeData aValue; attrsCnt->getByName(name) >>= aValue; @@ -290,13 +291,13 @@ sal_Int16 SwModelTestBase::getNumberingTypeOfParagraph(int nPara) uno::Reference<text::XTextRange> xPara(getParagraph(nPara)); uno::Reference<beans::XPropertySet> properties(xPara, uno::UNO_QUERY); bool isNumber = false; - properties->getPropertyValue("NumberingIsNumber") >>= isNumber; + properties->getPropertyValue(u"NumberingIsNumber"_ustr) >>= isNumber; if (isNumber) { uno::Reference<container::XIndexAccess> xLevels( - properties->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + properties->getPropertyValue(u"NumberingRules"_ustr), uno::UNO_QUERY); sal_Int16 nNumberingLevel = -1; - properties->getPropertyValue("NumberingLevel") >>= nNumberingLevel; + properties->getPropertyValue(u"NumberingLevel"_ustr) >>= nNumberingLevel; if (nNumberingLevel >= 0 && nNumberingLevel < xLevels->getCount()) { uno::Sequence<beans::PropertyValue> aPropertyValue; @@ -330,7 +331,7 @@ SwModelTestBase::getParagraphAnchoredObject(int const index, { uno::Reference<container::XContentEnumerationAccess> xContentEnumAccess(xPara, uno::UNO_QUERY); uno::Reference<container::XEnumeration> xContentEnum - = xContentEnumAccess->createContentEnumeration("com.sun.star.text.TextContent"); + = xContentEnumAccess->createContentEnumeration(u"com.sun.star.text.TextContent"_ustr); for (int i = 1; i < index; ++i) { xContentEnum->nextElement(); @@ -357,10 +358,10 @@ OUString SwModelTestBase::getFormula(uno::Reference<text::XTextRange> const& xRu { uno::Reference<container::XContentEnumerationAccess> xContentEnumAccess(xRun, uno::UNO_QUERY); uno::Reference<container::XEnumeration> xContentEnum - = xContentEnumAccess->createContentEnumeration(""); + = xContentEnumAccess->createContentEnumeration(u""_ustr); uno::Reference<beans::XPropertySet> xFormula(xContentEnum->nextElement(), uno::UNO_QUERY); return getProperty<OUString>( - getProperty<uno::Reference<beans::XPropertySet>>(xFormula, "Model"), "Formula"); + getProperty<uno::Reference<beans::XPropertySet>>(xFormula, u"Model"_ustr), u"Formula"_ustr); } uno::Reference<table::XCell> @@ -496,34 +497,34 @@ int SwModelTestBase::getShapes() const void SwModelTestBase::createSwDoc(const char* pName, const char* pPassword) { if (!pName) - loadURL("private:factory/swriter"); + loadURL(u"private:factory/swriter"_ustr); else loadURL(createFileURL(OUString::createFromAscii(pName)), pPassword); uno::Reference<lang::XServiceInfo> xServiceInfo(mxComponent, uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextDocument")); + CPPUNIT_ASSERT(xServiceInfo->supportsService(u"com.sun.star.text.TextDocument"_ustr)); } void SwModelTestBase::createSwWebDoc(const char* pName) { if (!pName) - loadURL("private:factory/swriter/web"); + loadURL(u"private:factory/swriter/web"_ustr); else loadURL(createFileURL(OUString::createFromAscii(pName))); uno::Reference<lang::XServiceInfo> xServiceInfo(mxComponent, uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.WebDocument")); + CPPUNIT_ASSERT(xServiceInfo->supportsService(u"com.sun.star.text.WebDocument"_ustr)); } void SwModelTestBase::createSwGlobalDoc(const char* pName) { if (!pName) - loadURL("private:factory/swriter/GlobalDocument"); + loadURL(u"private:factory/swriter/GlobalDocument"_ustr); else loadURL(createFileURL(OUString::createFromAscii(pName))); uno::Reference<lang::XServiceInfo> xServiceInfo(mxComponent, uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.GlobalDocument")); + CPPUNIT_ASSERT(xServiceInfo->supportsService(u"com.sun.star.text.GlobalDocument"_ustr)); } SwDoc* SwModelTestBase::getSwDoc() { return getSwDocShell()->GetDoc(); } diff --git a/sw/qa/writerfilter/dmapper/CellColorHandler.cxx b/sw/qa/writerfilter/dmapper/CellColorHandler.cxx index fcf7d53708d6..a724f063fc61 100644 --- a/sw/qa/writerfilter/dmapper/CellColorHandler.cxx +++ b/sw/qa/writerfilter/dmapper/CellColorHandler.cxx @@ -36,7 +36,7 @@ CPPUNIT_TEST_FIXTURE(Test, test129205) uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); uno::Reference<beans::XPropertySet> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); drawing::FillStyle eFillStyle = drawing::FillStyle::FillStyle_NONE; - xPara->getPropertyValue("FillStyle") >>= eFillStyle; + xPara->getPropertyValue(u"FillStyle"_ustr) >>= eFillStyle; // Without the accompanying fix in place, this test would have failed with: // - Expected: drawing::FillStyle_NONE // - Actual : FillStyle_SOLID diff --git a/sw/qa/writerfilter/dmapper/DomainMapper.cxx b/sw/qa/writerfilter/dmapper/DomainMapper.cxx index 851ab20412e8..3ee1ed2b0bce 100644 --- a/sw/qa/writerfilter/dmapper/DomainMapper.cxx +++ b/sw/qa/writerfilter/dmapper/DomainMapper.cxx @@ -45,7 +45,7 @@ CPPUNIT_TEST_FIXTURE(Test, testLargeParaTopMargin) // Then assert its top margin. sal_Int32 nParaTopMargin{}; - xPara->getPropertyValue("ParaTopMargin") >>= nParaTopMargin; + xPara->getPropertyValue(u"ParaTopMargin"_ustr) >>= nParaTopMargin; // <w:spacing w:before="37050"/> in the document. sal_Int32 nExpected = convertTwipToMm100(37050); // Without the accompanying fix in place, this test would have failed with: @@ -71,7 +71,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtRunInPara) // - Expected: first-second // - Actual : second // i.e. the block-SDT-only string was lost. - CPPUNIT_ASSERT_EQUAL(OUString("first-second"), xPara->getString()); + CPPUNIT_ASSERT_EQUAL(u"first-second"_ustr, xPara->getString()); } CPPUNIT_TEST_FIXTURE(Test, testSdtDropdownNoDisplayText) @@ -89,13 +89,13 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtDropdownNoDisplayText) 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); uno::Sequence<beans::PropertyValues> aListItems; - xContentControlProps->getPropertyValue("ListItems") >>= aListItems; + xContentControlProps->getPropertyValue(u"ListItems"_ustr) >>= aListItems; // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 // - Actual : 0 @@ -135,20 +135,20 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtBlockText) uno::Reference<container::XEnumeration> xPortionEnum = xPara->createEnumeration(); uno::Reference<beans::XPropertySet> xPortion(xPortionEnum->nextElement(), uno::UNO_QUERY); OUString aTextPortionType; - xPortion->getPropertyValue("TextPortionType") >>= aTextPortionType; + xPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aTextPortionType; // Without the accompanying fix in place, this test would have failed with: // - Expected: ContentControl // - Actual : TextField // i.e. the SDT was imported as a text field, not as a content control. - CPPUNIT_ASSERT_EQUAL(OUString("ContentControl"), aTextPortionType); + CPPUNIT_ASSERT_EQUAL(u"ContentControl"_ustr, aTextPortionType); // Make sure the properties are imported uno::Reference<text::XTextContent> xContentControl; - xPortion->getPropertyValue("ContentControl") >>= xContentControl; + xPortion->getPropertyValue(u"ContentControl"_ustr) >>= xContentControl; uno::Reference<beans::XPropertySet> xContentControlProps(xContentControl, uno::UNO_QUERY); OUString aAlias; - xContentControlProps->getPropertyValue("Alias") >>= aAlias; - CPPUNIT_ASSERT_EQUAL(OUString("myalias"), aAlias); + xContentControlProps->getPropertyValue(u"Alias"_ustr) >>= aAlias; + CPPUNIT_ASSERT_EQUAL(u"myalias"_ustr, aAlias); } CPPUNIT_TEST_FIXTURE(Test, testFdo78333) diff --git a/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx b/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx index 4ae51bfc0758..45a4691ac15a 100644 --- a/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx +++ b/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx @@ -41,9 +41,9 @@ CPPUNIT_TEST_FIXTURE(Test, test1cellInsidevRightborder) uno::Reference<text::XTextTablesSupplier> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTextDocument->getTextTables(), uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xCell(xTable->getCellByName(u"A1"_ustr), uno::UNO_QUERY); table::BorderLine2 aBorder; - xCell->getPropertyValue("RightBorder") >>= aBorder; + xCell->getPropertyValue(u"RightBorder"_ustr) >>= aBorder; // Without the accompanying fix in place, this test would have failed with: // - Expected: 0 // - Actual : 18 @@ -76,7 +76,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableBreakBefore) xParagraphs->nextElement(); uno::Reference<beans::XPropertySet> xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY); style::BreakType eBreakType{}; - xParagraph->getPropertyValue("BreakType") >>= eBreakType; + xParagraph->getPropertyValue(u"BreakType"_ustr) >>= eBreakType; // Without the accompanying fix in place, this test would have failed with: // - Expected: 4 (style::BreakType_PAGE_BEFORE) // - Actual : 0 (style::BreakType_NONE) @@ -131,7 +131,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDOCXFloatingTableHiddenAnchor) // Then make sure the anchor (and thus the table) is visible: bool bCharHidden{}; - CPPUNIT_ASSERT(xAnchor->getPropertyValue("CharHidden") >>= bCharHidden); + CPPUNIT_ASSERT(xAnchor->getPropertyValue(u"CharHidden"_ustr) >>= bCharHidden); // Without the accompanying fix in place, this test would have failed, the paragraph + table was // hidden. CPPUNIT_ASSERT(!bCharHidden); @@ -152,13 +152,13 @@ CPPUNIT_TEST_FIXTURE(Test, testDOCXFloatingTableNested) uno::Reference<beans::XPropertySet> xFrame1; xFrames->getByIndex(0) >>= xFrame1; bool bIsSplitAllowed = false; - xFrame1->getPropertyValue("IsSplitAllowed") >>= bIsSplitAllowed; + xFrame1->getPropertyValue(u"IsSplitAllowed"_ustr) >>= bIsSplitAllowed; CPPUNIT_ASSERT(bIsSplitAllowed); // Inner frame: uno::Reference<beans::XPropertySet> xFrame2; xFrames->getByIndex(1) >>= xFrame2; bIsSplitAllowed = false; - xFrame2->getPropertyValue("IsSplitAllowed") >>= bIsSplitAllowed; + xFrame2->getPropertyValue(u"IsSplitAllowed"_ustr) >>= bIsSplitAllowed; // Without the accompanying fix in place, this test would have failed, the inner frame could not // split. CPPUNIT_ASSERT(bIsSplitAllowed); @@ -209,7 +209,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDOCXFloatingTableHeaderBodyOverlap) // Then make sure the fly bottom is less than the top of the body text: uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); css::uno::Reference<qa::XDumper> xDumper(xModel->getCurrentController(), uno::UNO_QUERY); - OString aDump = xDumper->dump("layout").toUtf8(); + OString aDump = xDumper->dump(u"layout"_ustr).toUtf8(); auto pCharBuffer = reinterpret_cast<const xmlChar*>(aDump.getStr()); xmlDocUniquePtr pXmlDoc(xmlParseDoc(pCharBuffer)); sal_Int32 nFlyBottom = getXPath(pXmlDoc, "//fly/infos/bounds"_ostr, "bottom"_ostr).toInt32(); @@ -220,7 +220,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDOCXFloatingTableHeaderBodyOverlap) // Without the accompanying fix in place, this test would have failed, the first line was not a // fly portion but it was actual text, above the floating table. assertXPath(pXmlDoc, "//page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]/child::*"_ostr, - "type"_ostr, "PortionType::Fly"); + "type"_ostr, u"PortionType::Fly"_ustr); sal_Int32 nBodyFlyPortionHeight = getXPath(pXmlDoc, "//page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]"_ostr, "height"_ostr) diff --git a/sw/qa/writerfilter/dmapper/DomainMapperTableManager.cxx b/sw/qa/writerfilter/dmapper/DomainMapperTableManager.cxx index be746062e655..37cb5c7bd617 100644 --- a/sw/qa/writerfilter/dmapper/DomainMapperTableManager.cxx +++ b/sw/qa/writerfilter/dmapper/DomainMapperTableManager.cxx @@ -37,7 +37,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTblOverlap) uno::Reference<container::XIndexAccess> xFrames(xTextDocument->getTextFrames(), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xFrame(xFrames->getByIndex(1), uno::UNO_QUERY); bool bAllowOverlap{}; - CPPUNIT_ASSERT(xFrame->getPropertyValue("AllowOverlap") >>= bAllowOverlap); + CPPUNIT_ASSERT(xFrame->getPropertyValue(u"AllowOverlap"_ustr) >>= bAllowOverlap); // Without the accompanying fix in place, this test would have failed, the tables were marked as // "can overlap". CPPUNIT_ASSERT(!bAllowOverlap); diff --git a/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx index 963db22c4c28..a8cef1084e44 100644 --- a/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx +++ b/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx @@ -56,7 +56,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPageBreakFooterTable) xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); } style::BreakType eType = style::BreakType_NONE; - xPara->getPropertyValue("BreakType") >>= eType; + xPara->getPropertyValue(u"BreakType"_ustr) >>= eType; // Without the accompanying fix in place, this test would have failed with: // - Expected: 4 @@ -77,21 +77,21 @@ CPPUNIT_TEST_FIXTURE(Test, testNumberingRestartStyleParent) uno::Reference<beans::XPropertySet> xPara; static constexpr OUString aProp(u"ListLabelString"_ustr); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("A."), xPara->getPropertyValue(aProp).get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"A."_ustr, xPara->getPropertyValue(aProp).get<OUString>()); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("1."), xPara->getPropertyValue(aProp).get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"1."_ustr, xPara->getPropertyValue(aProp).get<OUString>()); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("2."), xPara->getPropertyValue(aProp).get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"2."_ustr, xPara->getPropertyValue(aProp).get<OUString>()); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("B."), xPara->getPropertyValue(aProp).get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"B."_ustr, xPara->getPropertyValue(aProp).get<OUString>()); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1. // - Actual : 3. // i.e. the numbering was not restarted after B. - CPPUNIT_ASSERT_EQUAL(OUString("1."), xPara->getPropertyValue(aProp).get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"1."_ustr, xPara->getPropertyValue(aProp).get<OUString>()); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("2."), xPara->getPropertyValue(aProp).get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"2."_ustr, xPara->getPropertyValue(aProp).get<OUString>()); } CPPUNIT_TEST_FIXTURE(Test, testFrameDirection) @@ -105,11 +105,11 @@ CPPUNIT_TEST_FIXTURE(Test, testFrameDirection) uno::Reference<beans::XPropertySet> xFrame2(xDrawPage->getByIndex(2), uno::UNO_QUERY); // Without the accompanying fix in place, all of the following values would be text::WritingMode2::CONTEXT CPPUNIT_ASSERT_EQUAL(text::WritingMode2::CONTEXT, - xFrame0->getPropertyValue("WritingMode").get<sal_Int16>()); + xFrame0->getPropertyValue(u"WritingMode"_ustr).get<sal_Int16>()); CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, - xFrame1->getPropertyValue("WritingMode").get<sal_Int16>()); + xFrame1->getPropertyValue(u"WritingMode"_ustr).get<sal_Int16>()); CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, - xFrame2->getPropertyValue("WritingMode").get<sal_Int16>()); + xFrame2->getPropertyValue(u"WritingMode"_ustr).get<sal_Int16>()); } CPPUNIT_TEST_FIXTURE(Test, testAltChunk) @@ -123,25 +123,25 @@ CPPUNIT_TEST_FIXTURE(Test, testAltChunk) uno::Reference<beans::XPropertySet> xParaProps; xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); xParaProps.set(xPara, uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("outer, before sect break"), xPara->getString()); - CPPUNIT_ASSERT_EQUAL(OUString("Standard"), - xParaProps->getPropertyValue("PageStyleName").get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"outer, before sect break"_ustr, xPara->getString()); + CPPUNIT_ASSERT_EQUAL(u"Standard"_ustr, + xParaProps->getPropertyValue(u"PageStyleName"_ustr).get<OUString>()); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); xParaProps.set(xPara, uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("outer, after sect break"), xPara->getString()); + CPPUNIT_ASSERT_EQUAL(u"outer, after sect break"_ustr, xPara->getString()); // Without the accompanying fix in place, this test would have failed with: // - Expected: Converted1 // - Actual : Standard // i.e. the page break between the first and the second paragraph was missing. - CPPUNIT_ASSERT_EQUAL(OUString("Converted1"), - xParaProps->getPropertyValue("PageStyleName").get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"Converted1"_ustr, + xParaProps->getPropertyValue(u"PageStyleName"_ustr).get<OUString>()); // Without the accompanying fix in place, this test would have failed with a // container.NoSuchElementException, as the document had only 2 paragraphs, all the "inner" // content was lost. xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("inner doc, first para"), xPara->getString()); + CPPUNIT_ASSERT_EQUAL(u"inner doc, first para"_ustr, xPara->getString()); } CPPUNIT_TEST_FIXTURE(Test, testFieldIfInsideIf) @@ -154,22 +154,22 @@ CPPUNIT_TEST_FIXTURE(Test, testFieldIfInsideIf) uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); // Get the result of the topmost field. - uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xCell(xTable->getCellByName(u"A1"_ustr), uno::UNO_QUERY); // Without the accompanying fix in place, this test would have failed with: // - Expected: 2 // - Actual : 0** Expression is faulty **2 // i.e. some of the inner fields escaped outside the outer field. - CPPUNIT_ASSERT_EQUAL(OUString("2"), xCell->getString()); + CPPUNIT_ASSERT_EQUAL(u"2"_ustr, xCell->getString()); // Test the second cell: it contains "IF ", not the usual " IF ". - xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY); + xCell.set(xTable->getCellByName(u"A2"_ustr), uno::UNO_QUERY); // Without the accompanying fix in place, this test would have failed with: // - Expected: 25 // - Actual : 025 // i.e. some of the inner fields escaped outside the outer field. - CPPUNIT_ASSERT_EQUAL(OUString("25"), xCell->getString()); + CPPUNIT_ASSERT_EQUAL(u"25"_ustr, xCell->getString()); } CPPUNIT_TEST_FIXTURE(Test, testCreateDatePreserve) @@ -189,7 +189,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCreateDatePreserve) // - Expected: 7/7/2020 10:11:00 AM // - Actual : 07/07/2020 // i.e. the formatting of the create date field was lost. - CPPUNIT_ASSERT_EQUAL(OUString("7/7/2020 10:11:00 AM"), xPortion->getString()); + CPPUNIT_ASSERT_EQUAL(u"7/7/2020 10:11:00 AM"_ustr, xPortion->getString()); } CPPUNIT_TEST_FIXTURE(Test, testChartZOrder) @@ -203,7 +203,7 @@ CPPUNIT_TEST_FIXTURE(Test, testChartZOrder) uno::Reference<lang::XServiceInfo> xChart(xDrawPage->getByIndex(0), uno::UNO_QUERY); // Without the accompanying fix in place, this test would have failed, as the chart was on top // of the shape. - CPPUNIT_ASSERT(xChart->supportsService("com.sun.star.text.TextEmbeddedObject")); + CPPUNIT_ASSERT(xChart->supportsService(u"com.sun.star.text.TextEmbeddedObject"_ustr)); } CPPUNIT_TEST_FIXTURE(Test, testPTab) @@ -216,22 +216,25 @@ CPPUNIT_TEST_FIXTURE(Test, testPTab) 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); - auto xFooter = xStyle->getPropertyValue("FooterText").get<uno::Reference<text::XTextRange>>(); + 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); + auto xFooter + = xStyle->getPropertyValue(u"FooterText"_ustr).get<uno::Reference<text::XTextRange>>(); // Without the accompanying fix in place, this test would have failed with: // - Expected: <space><newline>1\n // - Actual: <space><tab>1\n // i.e. the layout height of the footer text was incorrect, the page number field was not // visually inside the background shape. - CPPUNIT_ASSERT_EQUAL(OUString(" \n1" SAL_NEWLINE_STRING), xFooter->getString()); + CPPUNIT_ASSERT_EQUAL(u" \n1" SAL_NEWLINE_STRING ""_ustr, xFooter->getString()); } CPPUNIT_TEST_FIXTURE(Test, testPasteOle) { // Given an empty document: - mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); + mxComponent + = loadFromDesktop(u"private:factory/swriter"_ustr, u"com.sun.star.text.TextDocument"_ustr); // When pasting RTF into that document: uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); @@ -252,7 +255,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPasteOle) xParaEnum->nextElement(); CPPUNIT_ASSERT(xParaEnum->hasMoreElements()); uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("hello"), xPara->getString()); + CPPUNIT_ASSERT_EQUAL(u"hello"_ustr, xPara->getString()); } CPPUNIT_TEST_FIXTURE(Test, testClearingBreak) @@ -275,13 +278,13 @@ CPPUNIT_TEST_FIXTURE(Test, testClearingBreak) // i.e. the first para was just a fly + text portion, the clearing break was lost. uno::Reference<beans::XPropertySet> xPortion(xPortions->nextElement(), uno::UNO_QUERY); OUString aPortionType; - xPortion->getPropertyValue("TextPortionType") >>= aPortionType; - CPPUNIT_ASSERT_EQUAL(OUString("LineBreak"), aPortionType); + xPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aPortionType; + CPPUNIT_ASSERT_EQUAL(u"LineBreak"_ustr, aPortionType); uno::Reference<text::XTextContent> xLineBreak; - xPortion->getPropertyValue("LineBreak") >>= xLineBreak; + xPortion->getPropertyValue(u"LineBreak"_ustr) >>= xLineBreak; sal_Int16 eClear{}; uno::Reference<beans::XPropertySet> xLineBreakProps(xLineBreak, uno::UNO_QUERY); - xLineBreakProps->getPropertyValue("Clear") >>= eClear; + xLineBreakProps->getPropertyValue(u"Clear"_ustr) >>= eClear; // SwLineBreakClear::ALL CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(3), eClear); } @@ -302,7 +305,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlDateDataBinding) // - Expected: 4/26/2012 // - Actual : 4/26/2022 // i.e. the date was from document.xml, which is considered outdated. - CPPUNIT_ASSERT_EQUAL(OUString("4/26/2012"), xParagraph->getString()); + CPPUNIT_ASSERT_EQUAL(u"4/26/2012"_ustr, xParagraph->getString()); } CPPUNIT_TEST_FIXTURE(Test, testContentControlDataBindingColor) @@ -320,7 +323,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlDataBindingColor) xCursor->goLeft(/*nCount=*/1, /*bExpand=*/false); uno::Reference<beans::XPropertySet> xCursorProps(xCursor, uno::UNO_QUERY); Color nColor; - CPPUNIT_ASSERT(xCursorProps->getPropertyValue("CharColor") >>= nColor); + CPPUNIT_ASSERT(xCursorProps->getPropertyValue(u"CharColor"_ustr) >>= nColor); // Without the accompanying fix in place, this test would have failed with: // - Expected: rgba[ffffff00] // - Actual : rgba[ff0000ff] @@ -389,27 +392,27 @@ CPPUNIT_TEST_FIXTURE(Test, testRedlinedShapeThenSdt) // - Actual : ContentControl // i.e. the content control started at para start. CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, - xPortion->getPropertyValue("TextPortionType").get<OUString>()); + xPortion->getPropertyValue(u"TextPortionType"_ustr).get<OUString>()); xPortion.set(xPortionEnum->nextElement(), uno::UNO_QUERY); // Redline start+end pair, containing a pair of text portions with an anchored object in the // middle. CPPUNIT_ASSERT_EQUAL(u"Redline"_ustr, - xPortion->getPropertyValue("TextPortionType").get<OUString>()); + xPortion->getPropertyValue(u"TextPortionType"_ustr).get<OUString>()); xPortion.set(xPortionEnum->nextElement(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, - xPortion->getPropertyValue("TextPortionType").get<OUString>()); + xPortion->getPropertyValue(u"TextPortionType"_ustr).get<OUString>()); xPortion.set(xPortionEnum->nextElement(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(u"Frame"_ustr, - xPortion->getPropertyValue("TextPortionType").get<OUString>()); + xPortion->getPropertyValue(u"TextPortionType"_ustr).get<OUString>()); xPortion.set(xPortionEnum->nextElement(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, - xPortion->getPropertyValue("TextPortionType").get<OUString>()); + xPortion->getPropertyValue(u"TextPortionType"_ustr).get<OUString>()); xPortion.set(xPortionEnum->nextElement(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(u"Redline"_ustr, - xPortion->getPropertyValue("TextPortionType").get<OUString>()); + xPortion->getPropertyValue(u"TextPortionType"_ustr).get<OUString>()); xPortion.set(xPortionEnum->nextElement(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(u"ContentControl"_ustr, - xPortion->getPropertyValue("TextPortionType").get<OUString>()); + xPortion->getPropertyValue(u"TextPortionType"_ustr).get<OUString>()); } CPPUNIT_TEST_FIXTURE(Test, testClearingBreakSectEnd) diff --git a/sw/qa/writerfilter/dmapper/GraphicImport.cxx b/sw/qa/writerfilter/dmapper/GraphicImport.cxx index 35c1988c9b02..fc6b5f926305 100644 --- a/sw/qa/writerfilter/dmapper/GraphicImport.cxx +++ b/sw/qa/writerfilter/dmapper/GraphicImport.cxx @@ -46,11 +46,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143455SmartArtPosition) // Without fix in place the group, which represents the SmartArt, was placed at the initializing // position 0|0. sal_Int32 nHoriPosition = 0; - xShape->getPropertyValue("HoriOrientPosition") >>= nHoriPosition; + xShape->getPropertyValue(u"HoriOrientPosition"_ustr) >>= nHoriPosition; // The test would have failed with Expected: 2858, Actual: 0 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2858), nHoriPosition); sal_Int32 nVertPosition = 0; - xShape->getPropertyValue("VertOrientPosition") >>= nVertPosition; + xShape->getPropertyValue(u"VertOrientPosition"_ustr) >>= nVertPosition; // The test would have failed with Expected: 1588, Actual: 0 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1588), nVertPosition); } @@ -64,7 +64,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143208wrapTight) uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); bool bContourOutside = false; - xShape->getPropertyValue("ContourOutside") >>= bContourOutside; + xShape->getPropertyValue(u"ContourOutside"_ustr) >>= bContourOutside; CPPUNIT_ASSERT(bContourOutside); } @@ -78,14 +78,14 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf142305StrokeGlowMargin) uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); sal_Int32 nTopMargin = 0; - xShape->getPropertyValue("TopMargin") >>= nTopMargin; + xShape->getPropertyValue(u"TopMargin"_ustr) >>= nTopMargin; // Without fix in place top margin was 0, so that the text comes near to the shape. // The test would have failed with Expected: 838, Actual: 0 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(838), nTopMargin); sal_Int32 nBottomMargin = 0; // Without fix in place bottom margin was >0, so that the text was far from to the shape. // The test would have failed with Expected: 0, Actual: 637 - xShape->getPropertyValue("BottomMargin") >>= nBottomMargin; + xShape->getPropertyValue(u"BottomMargin"_ustr) >>= nBottomMargin; CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), nBottomMargin); } @@ -113,13 +113,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf142304GroupPosition) uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); sal_Int32 nVertPosition = 0; - xShape->getPropertyValue("VertOrientPosition") >>= nVertPosition; + xShape->getPropertyValue(u"VertOrientPosition"_ustr) >>= nVertPosition; // Without fix in place the group was shifted left and down // The test would have failed with Expected: 2178, Actual: 2521 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2178), nVertPosition); sal_Int32 nHoriPosition = 0; // The test would have failed with Expected: 4304, Actual: 3874 - xShape->getPropertyValue("HoriOrientPosition") >>= nHoriPosition; + xShape->getPropertyValue(u"HoriOrientPosition"_ustr) >>= nHoriPosition; CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4304), nHoriPosition); } @@ -131,7 +131,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf141540ChildRotation) uno::Reference<container::XIndexAccess> xGroup(xDrawPage->getByIndex(0), uno::UNO_QUERY_THROW); uno::Reference<beans::XPropertySet> xRotatedShape(xGroup->getByIndex(1), uno::UNO_QUERY); sal_Int32 nShearAngle = 9000; // initialize with invalid value - xRotatedShape->getPropertyValue("ShearAngle") >>= nShearAngle; + xRotatedShape->getPropertyValue(u"ShearAngle"_ustr) >>= nShearAngle; // Without fix in place, this test would have failed with: // - Expected: 0 // - Actual : 2494 @@ -146,7 +146,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf141540GroupRotation) uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); sal_Int32 nShearAngle = 9000; // init with invalid value - xShape->getPropertyValue("ShearAngle") >>= nShearAngle; + xShape->getPropertyValue(u"ShearAngle"_ustr) >>= nShearAngle; // Without fix in place, this test would have failed with: // - Expected: 0 // - Actual : -3190 @@ -190,7 +190,7 @@ CPPUNIT_TEST_FIXTURE(Test, testGroupShapeRotation) uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); sal_Int32 nVertPosition = 0; - xShape->getPropertyValue("VertOrientPosition") >>= nVertPosition; + xShape->getPropertyValue(u"VertOrientPosition"_ustr) >>= nVertPosition; // Without the accompanying fix in place, this test would have failed with: // - Expected: 1221 // - Actual : -2048 @@ -206,7 +206,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawShapeInlineEffect) uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); sal_Int32 nBottomMargin = 0; - xShape->getPropertyValue("BottomMargin") >>= nBottomMargin; + xShape->getPropertyValue(u"BottomMargin"_ustr) >>= nBottomMargin; // 273 in mm100 is 98425 EMUs from the file. // Without the accompanying fix in place, this test would have failed with: // - Expected: 273 @@ -227,7 +227,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineAnchoredZOrder) // - Expected: Oval 2 // - Actual : // i.e. the rectangle (with no name) was on top of the oval one, not the other way around. - CPPUNIT_ASSERT_EQUAL(OUString("Oval 2"), xOval->getName()); + CPPUNIT_ASSERT_EQUAL(u"Oval 2"_ustr, xOval->getName()); } CPPUNIT_TEST_FIXTURE(Test, testInlineInShapeAnchoredZOrder) @@ -242,7 +242,7 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineInShapeAnchoredZOrder) // - Expected: Picture 1 // - Actual : Text Box 2 // i.e. the image was behind the textbox that was hosting it. - CPPUNIT_ASSERT_EQUAL(OUString("Picture 1"), xOval->getName()); + CPPUNIT_ASSERT_EQUAL(u"Picture 1"_ustr, xOval->getName()); } CPPUNIT_TEST_FIXTURE(Test, testRelfromhInsidemargin) @@ -252,14 +252,14 @@ CPPUNIT_TEST_FIXTURE(Test, testRelfromhInsidemargin) uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); sal_Int16 nRelation = 0; - xShape->getPropertyValue("HoriOrientRelation") >>= nRelation; + xShape->getPropertyValue(u"HoriOrientRelation"_ustr) >>= nRelation; // Without the accompanying fix in place, this test would have failed with: // - Expected: 7 (PAGE_FRAME) // - Actual : 0 (FRAME) // i.e. the horizontal position was relative to the paragraph area, not to the entire page. CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, nRelation); bool bPageToggle = false; - xShape->getPropertyValue("PageToggle") >>= bPageToggle; + xShape->getPropertyValue(u"PageToggle"_ustr) >>= bPageToggle; CPPUNIT_ASSERT(bPageToggle); } @@ -270,7 +270,7 @@ CPPUNIT_TEST_FIXTURE(Test, testWrapPolyCrop) uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); drawing::PointSequenceSequence aContour; - xShape->getPropertyValue("ContourPolyPolygon") >>= aContour; + xShape->getPropertyValue(u"ContourPolyPolygon"_ustr) >>= aContour; auto aPolyPolygon = basegfx::utils::UnoPointSequenceSequenceToB2DPolyPolygon(aContour); CPPUNIT_ASSERT_EQUAL(sal_uInt32(1), aPolyPolygon.count()); auto aPolygon = aPolyPolygon.getB2DPolygon(0); @@ -299,9 +299,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTextboxTextline) uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); sal_Int16 nActualRelation{}; - CPPUNIT_ASSERT(xShape->getPropertyValue("VertOrientRelation") >>= nActualRelation); + CPPUNIT_ASSERT(xShape->getPropertyValue(u"VertOrientRelation"_ustr) >>= nActualRelation); sal_Int32 nActualPosition{}; - CPPUNIT_ASSERT(xShape->getPropertyValue("VertOrientPosition") >>= nActualPosition); + CPPUNIT_ASSERT(xShape->getPropertyValue(u"VertOrientPosition"_ustr) >>= nActualPosition); sal_Int16 nExpectedRelation = text::RelOrientation::TEXT_LINE; CPPUNIT_ASSERT_EQUAL(nExpectedRelation, nActualRelation); @@ -316,7 +316,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTextboxTextlineTop) uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); sal_Int16 nActualRelation{}; - CPPUNIT_ASSERT(xShape->getPropertyValue("VertOrientRelation") >>= nActualRelation); + CPPUNIT_ASSERT(xShape->getPropertyValue(u"VertOrientRelation"_ustr) >>= nActualRelation); sal_Int16 nExpectedRelation = text::RelOrientation::TEXT_LINE; // Without the accompanying fix in place, this test would have failed with: // - Expected: 9 (TEXT_LINE) @@ -325,7 +325,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTextboxTextlineTop) CPPUNIT_ASSERT_EQUAL(nExpectedRelation, nActualRelation); sal_Int16 nActualOrient{}; - CPPUNIT_ASSERT(xShape->getPropertyValue("VertOrient") >>= nActualOrient); + CPPUNIT_ASSERT(xShape->getPropertyValue(u"VertOrient"_ustr) >>= nActualOrient); sal_Int16 nExpectedOrient = text::VertOrientation::BOTTOM; CPPUNIT_ASSERT_EQUAL(nExpectedOrient, nActualOrient); } @@ -340,11 +340,11 @@ CPPUNIT_TEST_FIXTURE(Test, testLayoutInCellWrapnoneColumn) uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(1), uno::UNO_QUERY); uno::Reference<container::XNamed> xNamedShape(xShape, uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("Text Box 1"), xNamedShape->getName()); + CPPUNIT_ASSERT_EQUAL(u"Text Box 1"_ustr, xNamedShape->getName()); bool bFollowingTextFlow = true; // Without the accompanying fix in place, this test would have failed, the shape was not allowed // to leave the cell, leading to incorrect layout. - CPPUNIT_ASSERT(xShape->getPropertyValue("IsFollowingTextFlow") >>= bFollowingTextFlow); + CPPUNIT_ASSERT(xShape->getPropertyValue(u"IsFollowingTextFlow"_ustr) >>= bFollowingTextFlow); CPPUNIT_ASSERT(!bFollowingTextFlow); } @@ -358,7 +358,7 @@ CPPUNIT_TEST_FIXTURE(Test, testLayoutInCellOfHraphics) uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(1), uno::UNO_QUERY); bool bFollowingTextFlow = false; - CPPUNIT_ASSERT(xShape->getPropertyValue("IsFollowingTextFlow") >>= bFollowingTextFlow); + CPPUNIT_ASSERT(xShape->getPropertyValue(u"IsFollowingTextFlow"_ustr) >>= bFollowingTextFlow); CPPUNIT_ASSERT(bFollowingTextFlow); } diff --git a/sw/qa/writerfilter/dmapper/PropertyMap.cxx b/sw/qa/writerfilter/dmapper/PropertyMap.cxx index d0e8533e1acb..377ceb339985 100644 --- a/sw/qa/writerfilter/dmapper/PropertyMap.cxx +++ b/sw/qa/writerfilter/dmapper/PropertyMap.cxx @@ -62,10 +62,11 @@ CPPUNIT_TEST_FIXTURE(Test, testFollowPageTopMargin) 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); - auto nTopMargin = xStyle->getPropertyValue("TopMargin").get<sal_Int32>(); + 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); + auto nTopMargin = xStyle->getPropertyValue(u"TopMargin"_ustr).get<sal_Int32>(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 250 @@ -101,14 +102,15 @@ CPPUNIT_TEST_FIXTURE(Test, testNegativePageBorder) 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); - auto nTopMargin = xStyle->getPropertyValue("TopMargin").get<sal_Int32>(); + 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); + auto nTopMargin = xStyle->getPropertyValue(u"TopMargin"_ustr).get<sal_Int32>(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(501), nTopMargin); - auto aTopBorder = xStyle->getPropertyValue("TopBorder").get<table::BorderLine2>(); + auto aTopBorder = xStyle->getPropertyValue(u"TopBorder"_ustr).get<table::BorderLine2>(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(159), aTopBorder.LineWidth); - auto nTopBorderDistance = xStyle->getPropertyValue("TopBorderDistance").get<sal_Int32>(); + auto nTopBorderDistance = xStyle->getPropertyValue(u"TopBorderDistance"_ustr).get<sal_Int32>(); // Without the accompanying fix in place, this test would have failed with: // - Expected: -646 // - Actual : 0 @@ -127,14 +129,15 @@ CPPUNIT_TEST_FIXTURE(Test, testNegativePageBorderNoMargin) 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); - auto nTopMargin = xStyle->getPropertyValue("TopMargin").get<sal_Int32>(); + 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); + auto nTopMargin = xStyle->getPropertyValue(u"TopMargin"_ustr).get<sal_Int32>(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), nTopMargin); - auto aTopBorder = xStyle->getPropertyValue("TopBorder").get<table::BorderLine2>(); + auto aTopBorder = xStyle->getPropertyValue(u"TopBorder"_ustr).get<table::BorderLine2>(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(159), aTopBorder.LineWidth); - auto nTopBorderDistance = xStyle->getPropertyValue("TopBorderDistance").get<sal_Int32>(); + auto nTopBorderDistance = xStyle->getPropertyValue(u"TopBorderDistance"_ustr).get<sal_Int32>(); // Without the accompanying fix in place, this test would have failed with: // - Expected: -1147 // - Actual : 0 @@ -145,35 +148,38 @@ CPPUNIT_TEST_FIXTURE(Test, testNegativePageBorderNoMargin) CPPUNIT_TEST_FIXTURE(Test, testPasteHeaderDisable) { // Given an empty document with a turned on header: - mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); + mxComponent + = loadFromDesktop(u"private:factory/swriter"_ustr, u"com.sun.star.text.TextDocument"_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); - xStyle->setPropertyValue("HeaderIsOn", uno::Any(true)); + 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); + xStyle->setPropertyValue(u"HeaderIsOn"_ustr, uno::Any(true)); // When pasting RTF content: uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xBodyEnd = xText->getEnd(); uno::Reference<document::XFilter> xFilter( - m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY); + m_xSFactory->createInstance(u"com.sun.star.comp.Writer.RtfFilter"_ustr), uno::UNO_QUERY); uno::Reference<document::XImporter> xImporter(xFilter, uno::UNO_QUERY); xImporter->setTargetDocument(mxComponent); std::unique_ptr<SvStream> pStream(new SvMemoryStream); pStream->WriteOString("{\\rtf1 paste}"); pStream->Seek(0); uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(std::move(pStream))); - uno::Sequence aDescriptor{ comphelper::makePropertyValue("InputStream", xStream), - comphelper::makePropertyValue("InsertMode", true), - comphelper::makePropertyValue("TextInsertModeRange", xBodyEnd) }; + uno::Sequence aDescriptor{ comphelper::makePropertyValue(u"InputStream"_ustr, xStream), + comphelper::makePropertyValue(u"InsertMode"_ustr, true), + comphelper::makePropertyValue(u"TextInsertModeRange"_ustr, + xBodyEnd) }; CPPUNIT_ASSERT(xFilter->filter(aDescriptor)); // Then make sure the header stays on: - CPPUNIT_ASSERT(xStyle->getPropertyValue("HeaderIsOn").get<bool>()); + CPPUNIT_ASSERT(xStyle->getPropertyValue(u"HeaderIsOn"_ustr).get<bool>()); } } diff --git a/sw/qa/writerfilter/dmapper/SdtHelper.cxx b/sw/qa/writerfilter/dmapper/SdtHelper.cxx index 434b685790c0..f8b4d368ad1a 100644 --- a/sw/qa/writerfilter/dmapper/SdtHelper.cxx +++ b/sw/qa/writerfilter/dmapper/SdtHelper.cxx @@ -43,46 +43,46 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtRunRichText) uno::Reference<container::XEnumeration> xPortionEnum = xPara->createEnumeration(); uno::Reference<beans::XPropertySet> xPortion(xPortionEnum->nextElement(), uno::UNO_QUERY); OUString aTextPortionType; - xPortion->getPropertyValue("TextPortionType") >>= aTextPortionType; + xPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aTextPortionType; // Without the accompanying fix in place, this test would have failed with: // - Expected: ContentControl // - Actual : TextField // i.e. the SDT was imported as a text field, and the whole SDT had 12pt font size. - CPPUNIT_ASSERT_EQUAL(OUString("ContentControl"), aTextPortionType); + CPPUNIT_ASSERT_EQUAL(u"ContentControl"_ustr, aTextPortionType); uno::Reference<text::XTextContent> xContentControl; - xPortion->getPropertyValue("ContentControl") >>= xContentControl; + xPortion->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<beans::XPropertySet> xContent(xContentEnum->nextElement(), uno::UNO_QUERY); float fCharheight{}; - xContent->getPropertyValue("CharHeight") >>= fCharheight; + xContent->getPropertyValue(u"CharHeight"_ustr) >>= fCharheight; CPPUNIT_ASSERT_EQUAL(12.f, fCharheight); xContent.set(xContentEnum->nextElement(), uno::UNO_QUERY); - xContent->getPropertyValue("CharHeight") >>= fCharheight; + xContent->getPropertyValue(u"CharHeight"_ustr) >>= fCharheight; CPPUNIT_ASSERT_EQUAL(24.f, fCharheight); uno::Reference<beans::XPropertySet> xContentControlProps(xContentControl, uno::UNO_QUERY); OUString aAlias; - xContentControlProps->getPropertyValue("Alias") >>= aAlias; + xContentControlProps->getPropertyValue(u"Alias"_ustr) >>= aAlias; // This was empty. - CPPUNIT_ASSERT_EQUAL(OUString("myalias"), aAlias); + CPPUNIT_ASSERT_EQUAL(u"myalias"_ustr, aAlias); OUString aTag; - xContentControlProps->getPropertyValue("Tag") >>= aTag; + xContentControlProps->getPropertyValue(u"Tag"_ustr) >>= aTag; // This was empty. - CPPUNIT_ASSERT_EQUAL(OUString("mytag"), aTag); + CPPUNIT_ASSERT_EQUAL(u"mytag"_ustr, aTag); sal_Int32 nId = 0; - xContentControlProps->getPropertyValue("Id") >>= nId; + xContentControlProps->getPropertyValue(u"Id"_ustr) >>= nId; // This was 0. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2147483647), nId); sal_uInt32 nTabIndex = 0; - xContentControlProps->getPropertyValue("TabIndex") >>= nTabIndex; + xContentControlProps->getPropertyValue(u"TabIndex"_ustr) >>= nTabIndex; // This was 0 CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(4294967295), nTabIndex); OUString aLock; - xContentControlProps->getPropertyValue("Lock") >>= aLock; + xContentControlProps->getPropertyValue(u"Lock"_ustr) >>= aLock; // This was empty. - CPPUNIT_ASSERT_EQUAL(OUString("contentLocked"), aLock); + CPPUNIT_ASSERT_EQUAL(u"contentLocked"_ustr, aLock); } CPPUNIT_TEST_FIXTURE(Test, testSdtRunPlainText) @@ -99,16 +99,16 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtRunPlainText) uno::Reference<container::XEnumeration> xPortionEnum = xPara->createEnumeration(); uno::Reference<beans::XPropertySet> xPortion(xPortionEnum->nextElement(), uno::UNO_QUERY); OUString aTextPortionType; - xPortion->getPropertyValue("TextPortionType") >>= aTextPortionType; + xPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aTextPortionType; // Without the accompanying fix in place, this test would have failed with: // - Expected: ContentControl // - Actual : TextField // i.e. the SDT was imported as a text field, not as a content control. - CPPUNIT_ASSERT_EQUAL(OUString("ContentControl"), aTextPortionType); + CPPUNIT_ASSERT_EQUAL(u"ContentControl"_ustr, aTextPortionType); uno::Reference<beans::XPropertySet> xContentControl; - xPortion->getPropertyValue("ContentControl") >>= xContentControl; + xPortion->getPropertyValue(u"ContentControl"_ustr) >>= xContentControl; bool bPlainText{}; - xContentControl->getPropertyValue("PlainText") >>= bPlainText; + xContentControl->getPropertyValue(u"PlainText"_ustr) >>= bPlainText; CPPUNIT_ASSERT(bPlainText); } @@ -126,26 +126,26 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtRunCheckbox) uno::Reference<container::XEnumeration> xPortionEnum = xPara->createEnumeration(); uno::Reference<beans::XPropertySet> xPortion(xPortionEnum->nextElement(), uno::UNO_QUERY); OUString aTextPortionType; - xPortion->getPropertyValue("TextPortionType") >>= aTextPortionType; + xPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aTextPortionType; // Without the accompanying fix in place, this test would have failed with: // - Expected: ContentControl // - Actual : Text // i.e. the SDT was imported as plain text, making it hard to fill in checkboxes. - CPPUNIT_ASSERT_EQUAL(OUString("ContentControl"), aTextPortionType); + CPPUNIT_ASSERT_EQUAL(u"ContentControl"_ustr, aTextPortionType); uno::Reference<text::XTextContent> xContentControl; - xPortion->getPropertyValue("ContentControl") >>= xContentControl; + xPortion->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; 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(); @@ -170,34 +170,34 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtRunDropdown) 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 : TextField // i.e. the SDT was imported as a dropdown field, which does not support display-text + value // pairs. - 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<beans::XPropertySet> xContentControlProps(xContentControl, uno::UNO_QUERY); uno::Sequence<beans::PropertyValues> aListItems; - xContentControlProps->getPropertyValue("ListItems") >>= aListItems; + xContentControlProps->getPropertyValue(u"ListItems"_ustr) >>= aListItems; CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), aListItems.getLength()); comphelper::SequenceAsHashMap aMap0(aListItems[0]); - CPPUNIT_ASSERT_EQUAL(OUString("red"), aMap0["DisplayText"].get<OUString>()); - CPPUNIT_ASSERT_EQUAL(OUString("R"), aMap0["Value"].get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"red"_ustr, aMap0[u"DisplayText"_ustr].get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"R"_ustr, aMap0[u"Value"_ustr].get<OUString>()); comphelper::SequenceAsHashMap aMap1(aListItems[1]); - CPPUNIT_ASSERT_EQUAL(OUString("green"), aMap1["DisplayText"].get<OUString>()); - CPPUNIT_ASSERT_EQUAL(OUString("G"), aMap1["Value"].get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"green"_ustr, aMap1[u"DisplayText"_ustr].get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"G"_ustr, aMap1[u"Value"_ustr].get<OUString>()); comphelper::SequenceAsHashMap aMap2(aListItems[2]); - CPPUNIT_ASSERT_EQUAL(OUString("blue"), aMap2["DisplayText"].get<OUString>()); - CPPUNIT_ASSERT_EQUAL(OUString("B"), aMap2["Value"].get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"blue"_ustr, aMap2[u"DisplayText"_ustr].get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"B"_ustr, aMap2[u"Value"_ustr].get<OUString>()); 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("choose a color"), xContent->getString()); + CPPUNIT_ASSERT_EQUAL(u"choose a color"_ustr, xContent->getString()); } CPPUNIT_TEST_FIXTURE(Test, testSdtRunComboBox) @@ -215,13 +215,13 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtRunComboBox) 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 bComboBox{}; - xContentControlProps->getPropertyValue("ComboBox") >>= bComboBox; + xContentControlProps->getPropertyValue(u"ComboBox"_ustr) >>= bComboBox; // Without the accompanying fix in place, this failed as the content control was a drop-down, // not a combo box. CPPUNIT_ASSERT(bComboBox); @@ -242,18 +242,18 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtRunPicture) 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 : Frame // i.e. the SDT was imported as a plain image, not as a clickable placeholder in a content // control. - 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<beans::XPropertySet> xContentControlProps(xContentControl, uno::UNO_QUERY); bool bPicture{}; - xContentControlProps->getPropertyValue("Picture") >>= bPicture; + xContentControlProps->getPropertyValue(u"Picture"_ustr) >>= bPicture; CPPUNIT_ASSERT(bPicture); } } diff --git a/sw/qa/writerfilter/dmapper/SettingsTable.cxx b/sw/qa/writerfilter/dmapper/SettingsTable.cxx index ef94a60fc544..13938eca82c5 100644 --- a/sw/qa/writerfilter/dmapper/SettingsTable.cxx +++ b/sw/qa/writerfilter/dmapper/SettingsTable.cxx @@ -38,9 +38,9 @@ CPPUNIT_TEST_FIXTURE(Test, testDoNotBreakWrappedTables) // Then make sure that the matching compat flag is set: uno::Reference<lang::XMultiServiceFactory> xDocument(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xSettings( - xDocument->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); + xDocument->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY); bool bDoNotBreakWrappedTables{}; - xSettings->getPropertyValue("DoNotBreakWrappedTables") >>= bDoNotBreakWrappedTables; + xSettings->getPropertyValue(u"DoNotBreakWrappedTables"_ustr) >>= bDoNotBreakWrappedTables; // Without the accompanying fix in place, this test would have failed, the compat flag was not // set. CPPUNIT_ASSERT(bDoNotBreakWrappedTables); @@ -55,9 +55,9 @@ CPPUNIT_TEST_FIXTURE(Test, testAllowTextAfterFloatingTableBreak) // Then make sure that the matching compat flag is set: uno::Reference<lang::XMultiServiceFactory> xDocument(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xSettings( - xDocument->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); + xDocument->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY); bool bAllowTextAfterFloatingTableBreak{}; - xSettings->getPropertyValue("AllowTextAfterFloatingTableBreak") + xSettings->getPropertyValue(u"AllowTextAfterFloatingTableBreak"_ustr) >>= bAllowTextAfterFloatingTableBreak; // Without the accompanying fix in place, this test would have failed, the compat flag was not // set. @@ -73,7 +73,7 @@ CPPUNIT_TEST_FIXTURE(Test, testAddVerticalFrameOffsetsRTF) // Then make sure the floating and the inline tables don't overlap: uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); css::uno::Reference<qa::XDumper> xDumper(xModel->getCurrentController(), uno::UNO_QUERY); - OString aDump = xDumper->dump("layout").toUtf8(); + OString aDump = xDumper->dump(u"layout"_ustr).toUtf8(); auto pCharBuffer = reinterpret_cast<const xmlChar*>(aDump.getStr()); xmlDocUniquePtr pXmlDoc(xmlParseDoc(pCharBuffer)); sal_Int32 nFlyBottom = getXPath(pXmlDoc, "//fly/infos/bounds"_ostr, "bottom"_ostr).toInt32(); diff --git a/sw/qa/writerfilter/dmapper/TextEffectsHandler.cxx b/sw/qa/writerfilter/dmapper/TextEffectsHandler.cxx index 7bd4788ba0d5..9680511ee5cc 100644 --- a/sw/qa/writerfilter/dmapper/TextEffectsHandler.cxx +++ b/sw/qa/writerfilter/dmapper/TextEffectsHandler.cxx @@ -39,7 +39,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSemiTransparentText) xPortionEnum->nextElement(); uno::Reference<beans::XPropertySet> xPortion(xPortionEnum->nextElement(), uno::UNO_QUERY); sal_Int16 nCharTransparence = 0; - xPortion->getPropertyValue("CharTransparence") >>= nCharTransparence; + xPortion->getPropertyValue(u"CharTransparence"_ustr) >>= nCharTransparence; // Without the accompanying fix in place, this test would have failed with: // - Expected: 74 @@ -61,7 +61,7 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeColorTransparency) uno::Reference<container::XEnumeration> xPortionEnum = xPara->createEnumeration(); sal_Int16 nCharTransparence = 0; uno::Reference<beans::XPropertySet> xPortion(xPortionEnum->nextElement(), uno::UNO_QUERY); - xPortion->getPropertyValue("CharTransparence") >>= nCharTransparence; + xPortion->getPropertyValue(u"CharTransparence"_ustr) >>= nCharTransparence; // Without the fix this test would have failed with: Expected 74, Actual 0 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(74), nCharTransparence); } diff --git a/sw/qa/writerfilter/filter/WriterFilter.cxx b/sw/qa/writerfilter/filter/WriterFilter.cxx index 5a27887dc332..45b80e4093a5 100644 --- a/sw/qa/writerfilter/filter/WriterFilter.cxx +++ b/sw/qa/writerfilter/filter/WriterFilter.cxx @@ -38,7 +38,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDoNotMirrorRtlDrawObjs) // Then make sure the shape is on the right margin: uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); css::uno::Reference<qa::XDumper> xDumper(xModel->getCurrentController(), uno::UNO_QUERY); - OString aDump = xDumper->dump("layout").toUtf8(); + OString aDump = xDumper->dump(u"layout"_ustr).toUtf8(); auto pCharBuffer = reinterpret_cast<const xmlChar*>(aDump.getStr()); xmlDocUniquePtr pXmlDoc(xmlParseDoc(pCharBuffer)); sal_Int32 nBodyRight = getXPath(pXmlDoc, "//body/infos/bounds"_ostr, "right"_ostr).toInt32(); diff --git a/sw/qa/writerfilter/filters-test/filters-test.cxx b/sw/qa/writerfilter/filters-test/filters-test.cxx index 918fd73718c0..e32520fe2394 100644 --- a/sw/qa/writerfilter/filters-test/filters-test.cxx +++ b/sw/qa/writerfilter/filters-test/filters-test.cxx @@ -38,7 +38,7 @@ void RtfTest::setUp() { test::BootstrapFixture::setUp(); - m_xFilter.set(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), + m_xFilter.set(m_xSFactory->createInstance(u"com.sun.star.comp.Writer.RtfFilter"_ustr), uno::UNO_QUERY_THROW); } @@ -46,7 +46,7 @@ bool RtfTest::load(const OUString&, const OUString& rURL, const OUString&, SfxFi SotClipboardFormatId, unsigned int) { uno::Sequence<beans::PropertyValue> aDescriptor = { beans::PropertyValue( - "URL", sal_Int32(0), uno::Any(rURL), beans::PropertyState_DIRECT_VALUE) }; + u"URL"_ustr, sal_Int32(0), uno::Any(rURL), beans::PropertyState_DIRECT_VALUE) }; try { return m_xFilter->filter(aDescriptor); diff --git a/sw/qa/writerfilter/misc/misc.cxx b/sw/qa/writerfilter/misc/misc.cxx index 845e43b053e8..1063cfd7fadc 100644 --- a/sw/qa/writerfilter/misc/misc.cxx +++ b/sw/qa/writerfilter/misc/misc.cxx @@ -61,90 +61,90 @@ void WriterfilterMiscTest::testFieldParameters() std::tuple<OUString, std::vector<OUString>, std::vector<OUString>> result; result = splitFieldCommand(u"PAGEREF last_page"); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGEREF"_ustr, std::get<0>(result)); CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"last_page"_ustr, std::get<1>(result)[0]); CPPUNIT_ASSERT(std::get<2>(result).empty()); result = splitFieldCommand(u" PAGEREF last_page "); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGEREF"_ustr, std::get<0>(result)); CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"last_page"_ustr, std::get<1>(result)[0]); result = splitFieldCommand(u"pageref last_page"); CPPUNIT_ASSERT(std::get<2>(result).empty()); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGEREF"_ustr, std::get<0>(result)); CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"last_page"_ustr, std::get<1>(result)[0]); CPPUNIT_ASSERT(std::get<2>(result).empty()); result = splitFieldCommand(u"pageref \"last_page\""); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGEREF"_ustr, std::get<0>(result)); CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"last_page"_ustr, std::get<1>(result)[0]); CPPUNIT_ASSERT(std::get<2>(result).empty()); result = splitFieldCommand(u"\"PAGEREF\" \"last_page\" \"\" "); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGEREF"_ustr, std::get<0>(result)); CPPUNIT_ASSERT_EQUAL(size_t(2), std::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"last_page"_ustr, std::get<1>(result)[0]); CPPUNIT_ASSERT_EQUAL(OUString(), std::get<1>(result)[1]); CPPUNIT_ASSERT(std::get<2>(result).empty()); result = splitFieldCommand(u"\"PAGEREF\"\"last_page\" "); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGEREF"_ustr, std::get<0>(result)); CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"last_page"_ustr, std::get<1>(result)[0]); CPPUNIT_ASSERT(std::get<2>(result).empty()); result = splitFieldCommand(u"PAGEREF\"last_page\" "); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGEREF"_ustr, std::get<0>(result)); CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"last_page"_ustr, std::get<1>(result)[0]); CPPUNIT_ASSERT(std::get<2>(result).empty()); result = splitFieldCommand(u"\"PAGEREF\"last_page \"\""); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGEREF"_ustr, std::get<0>(result)); CPPUNIT_ASSERT_EQUAL(size_t(2), std::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"last_page"_ustr, std::get<1>(result)[0]); CPPUNIT_ASSERT_EQUAL(OUString(), std::get<1>(result)[1]); CPPUNIT_ASSERT(std::get<2>(result).empty()); result = splitFieldCommand(u"\"PAGEREF\"last_page \"\""); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGEREF"_ustr, std::get<0>(result)); CPPUNIT_ASSERT_EQUAL(size_t(2), std::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"last_page"_ustr, std::get<1>(result)[0]); CPPUNIT_ASSERT_EQUAL(OUString(), std::get<1>(result)[1]); CPPUNIT_ASSERT(std::get<2>(result).empty()); result = splitFieldCommand(u"pageref \"last\\\\pa\\\"ge\""); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGEREF"_ustr, std::get<0>(result)); CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last\\pa\"ge"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"last\\pa\"ge"_ustr, std::get<1>(result)[0]); CPPUNIT_ASSERT(std::get<2>(result).empty()); result = splitFieldCommand(u"PAGEREF\"last_page\"\\*"); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGEREF"_ustr, std::get<0>(result)); CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"last_page"_ustr, std::get<1>(result)[0]); CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<2>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("\\*"), std::get<2>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"\\*"_ustr, std::get<2>(result)[0]); result = splitFieldCommand(u"PAGEREF last_page \\b foobar "); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGEREF"_ustr, std::get<0>(result)); CPPUNIT_ASSERT_EQUAL(size_t(1), std::get<1>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("last_page"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"last_page"_ustr, std::get<1>(result)[0]); CPPUNIT_ASSERT_EQUAL(size_t(2), std::get<2>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("\\B"), std::get<2>(result)[0]); - CPPUNIT_ASSERT_EQUAL(OUString("foobar"), std::get<2>(result)[1]); + CPPUNIT_ASSERT_EQUAL(u"\\B"_ustr, std::get<2>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"foobar"_ustr, std::get<2>(result)[1]); result = splitFieldCommand(u"PAGEREF\\bfoobar\\A\"\""); - CPPUNIT_ASSERT_EQUAL(OUString("PAGEREF"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGEREF"_ustr, std::get<0>(result)); CPPUNIT_ASSERT(std::get<1>(result).empty()); CPPUNIT_ASSERT_EQUAL(size_t(4), std::get<2>(result).size()); - CPPUNIT_ASSERT_EQUAL(OUString("\\B"), std::get<2>(result)[0]); - CPPUNIT_ASSERT_EQUAL(OUString("foobar"), std::get<2>(result)[1]); - CPPUNIT_ASSERT_EQUAL(OUString("\\A"), std::get<2>(result)[2]); + CPPUNIT_ASSERT_EQUAL(u"\\B"_ustr, std::get<2>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"foobar"_ustr, std::get<2>(result)[1]); + CPPUNIT_ASSERT_EQUAL(u"\\A"_ustr, std::get<2>(result)[2]); CPPUNIT_ASSERT_EQUAL(OUString(), std::get<2>(result)[3]); for (auto prefix : { "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/", ":", @@ -155,16 +155,16 @@ void WriterfilterMiscTest::testFieldParameters() CPPUNIT_ASSERT_EQUAL(test, std::get<0>(result)); } result = splitFieldCommand(u"\\PAGE "); - CPPUNIT_ASSERT_EQUAL(OUString("PAGE"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGE"_ustr, std::get<0>(result)); result = splitFieldCommand(u"\\ PAGE "); - CPPUNIT_ASSERT_EQUAL(OUString("\\ "), std::get<0>(result)); - CPPUNIT_ASSERT_EQUAL(OUString("PAGE"), std::get<1>(result)[0]); + CPPUNIT_ASSERT_EQUAL(u"\\ "_ustr, std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGE"_ustr, std::get<1>(result)[0]); result = splitFieldCommand(u"\\\\PAGE "); - CPPUNIT_ASSERT_EQUAL(OUString("\\PAGE"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"\\PAGE"_ustr, std::get<0>(result)); result = splitFieldCommand(u"\"PAGE\" "); - CPPUNIT_ASSERT_EQUAL(OUString("PAGE"), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGE"_ustr, std::get<0>(result)); result = splitFieldCommand(u"\"PAGE "); - CPPUNIT_ASSERT_EQUAL(OUString("PAGE "), std::get<0>(result)); + CPPUNIT_ASSERT_EQUAL(u"PAGE "_ustr, std::get<0>(result)); } CPPUNIT_TEST_SUITE_REGISTRATION(WriterfilterMiscTest); diff --git a/sw/qa/writerfilter/ooxml/ooxml.cxx b/sw/qa/writerfilter/ooxml/ooxml.cxx index 1911c5666450..d174a5facdfc 100644 --- a/sw/qa/writerfilter/ooxml/ooxml.cxx +++ b/sw/qa/writerfilter/ooxml/ooxml.cxx @@ -57,9 +57,9 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableLeak) uno::Reference<lang::XServiceInfo> xTable(xParaEnum->nextElement(), uno::UNO_QUERY); // Without the accompanying fix in place, this test would have failed, the document started with // a paragraph instead of a table. - CPPUNIT_ASSERT(xTable->supportsService("com.sun.star.text.TextTable")); + CPPUNIT_ASSERT(xTable->supportsService(u"com.sun.star.text.TextTable"_ustr)); uno::Reference<lang::XServiceInfo> xParagraph(xParaEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT(xParagraph->supportsService("com.sun.star.text.Paragraph")); + CPPUNIT_ASSERT(xParagraph->supportsService(u"com.sun.star.text.Paragraph"_ustr)); CPPUNIT_ASSERT(!xParaEnum->hasMoreElements()); } diff --git a/sw/qa/writerfilter/rtftok/rtfdispatchflag.cxx b/sw/qa/writerfilter/rtftok/rtfdispatchflag.cxx index 62fb089e29d3..0b809a872986 100644 --- a/sw/qa/writerfilter/rtftok/rtfdispatchflag.cxx +++ b/sw/qa/writerfilter/rtftok/rtfdispatchflag.cxx @@ -42,28 +42,28 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTable) // i.e. the table was not floating / was not in a fly frame. uno::Reference<beans::XPropertySet> xFrame(xDrawPage->getByIndex(0), uno::UNO_QUERY); bool bIsSplitAllowed{}; - xFrame->getPropertyValue("IsSplitAllowed") >>= bIsSplitAllowed; + xFrame->getPropertyValue(u"IsSplitAllowed"_ustr) >>= bIsSplitAllowed; CPPUNIT_ASSERT(bIsSplitAllowed); sal_Int16 nVertOrientRelation{}; - xFrame->getPropertyValue("VertOrientRelation") >>= nVertOrientRelation; + xFrame->getPropertyValue(u"VertOrientRelation"_ustr) >>= nVertOrientRelation; CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, nVertOrientRelation); sal_Int16 nHoriOrientRelation{}; - xFrame->getPropertyValue("HoriOrientRelation") >>= nHoriOrientRelation; + xFrame->getPropertyValue(u"HoriOrientRelation"_ustr) >>= nHoriOrientRelation; CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, nHoriOrientRelation); sal_Int32 nVertOrientPosition{}; - xFrame->getPropertyValue("VertOrientPosition") >>= nVertOrientPosition; + xFrame->getPropertyValue(u"VertOrientPosition"_ustr) >>= nVertOrientPosition; sal_Int32 nExpected = o3tl::convert(10, o3tl::Length::twip, o3tl::Length::mm100); CPPUNIT_ASSERT_EQUAL(nExpected, nVertOrientPosition); sal_Int32 nHoriOrientPosition{}; - xFrame->getPropertyValue("HoriOrientPosition") >>= nHoriOrientPosition; + xFrame->getPropertyValue(u"HoriOrientPosition"_ustr) >>= nHoriOrientPosition; nExpected = o3tl::convert(20, o3tl::Length::twip, o3tl::Length::mm100); CPPUNIT_ASSERT_EQUAL(nExpected, nHoriOrientPosition); sal_Int32 nLeftMargin{}; - xFrame->getPropertyValue("LeftMargin") >>= nLeftMargin; + xFrame->getPropertyValue(u"LeftMargin"_ustr) >>= nLeftMargin; nExpected = o3tl::convert(30, o3tl::Length::twip, o3tl::Length::mm100); CPPUNIT_ASSERT_EQUAL(nExpected, nLeftMargin); sal_Int32 nRightMargin{}; - xFrame->getPropertyValue("RightMargin") >>= nRightMargin; + xFrame->getPropertyValue(u"RightMargin"_ustr) >>= nRightMargin; nExpected = o3tl::convert(40, o3tl::Length::twip, o3tl::Length::mm100); CPPUNIT_ASSERT_EQUAL(nExpected, nRightMargin); } @@ -77,9 +77,9 @@ CPPUNIT_TEST_FIXTURE(Test, testDoNotBreakWrappedTables) // Then make sure that the matching compat flag is set: uno::Reference<lang::XMultiServiceFactory> xDocument(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xSettings( - xDocument->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); + xDocument->createInstance(u"com.sun.star.document.Settings"_ustr), uno::UNO_QUERY); bool bDoNotBreakWrappedTables{}; - xSettings->getPropertyValue("DoNotBreakWrappedTables") >>= bDoNotBreakWrappedTables; + xSettings->getPropertyValue(u"DoNotBreakWrappedTables"_ustr) >>= bDoNotBreakWrappedTables; // Without the accompanying fix in place, this test would have failed, the compat flag was not // set. CPPUNIT_ASSERT(bDoNotBreakWrappedTables); @@ -96,7 +96,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTblOverlap) uno::Reference<container::XIndexAccess> xFrames(xTextDocument->getTextFrames(), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xFrame(xFrames->getByIndex(1), uno::UNO_QUERY); bool bAllowOverlap{}; - CPPUNIT_ASSERT(xFrame->getPropertyValue("AllowOverlap") >>= bAllowOverlap); + CPPUNIT_ASSERT(xFrame->getPropertyValue(u"AllowOverlap"_ustr) >>= bAllowOverlap); // Without the accompanying fix in place, this test would have failed, the tables were marked as // "can overlap". CPPUNIT_ASSERT(!bAllowOverlap); diff --git a/sw/qa/writerfilter/rtftok/rtfdispatchsymbol.cxx b/sw/qa/writerfilter/rtftok/rtfdispatchsymbol.cxx index 64a7a35ec327..40dccd9e8b4e 100644 --- a/sw/qa/writerfilter/rtftok/rtfdispatchsymbol.cxx +++ b/sw/qa/writerfilter/rtftok/rtfdispatchsymbol.cxx @@ -58,7 +58,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCenterAfterPage) xParagraphs->nextElement(); uno::Reference<beans::XPropertySet> xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY); sal_Int16 eActual{}; - CPPUNIT_ASSERT(xParagraph->getPropertyValue("ParaAdjust") >>= eActual); + CPPUNIT_ASSERT(xParagraph->getPropertyValue(u"ParaAdjust"_ustr) >>= eActual); // Without the accompanying fix in place, this test would have failed with: // - Expected: 3 (CENTER) // - Actual : 0 (LEFT) @@ -75,7 +75,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableThenSectBreak) // Then make sure that the floating table is on the first page: uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); css::uno::Reference<qa::XDumper> xDumper(xModel->getCurrentController(), uno::UNO_QUERY); - OString aDump = xDumper->dump("layout").toUtf8(); + OString aDump = xDumper->dump(u"layout"_ustr).toUtf8(); auto pCharBuffer = reinterpret_cast<const xmlChar*>(aDump.getStr()); xmlDocUniquePtr pXmlDoc(xmlParseDoc(pCharBuffer)); // Without the accompanying fix in place, this test would have failed with: diff --git a/sw/qa/writerfilter/rtftok/rtfdispatchvalue.cxx b/sw/qa/writerfilter/rtftok/rtfdispatchvalue.cxx index c2d0b06fbe45..057204663e5a 100644 --- a/sw/qa/writerfilter/rtftok/rtfdispatchvalue.cxx +++ b/sw/qa/writerfilter/rtftok/rtfdispatchvalue.cxx @@ -38,16 +38,16 @@ CPPUNIT_TEST_FIXTURE(Test, testFollowStyle) 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("Heading 1"), + xStyleFamilies->getByName(u"ParagraphStyles"_ustr), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xStyle(xStyleFamily->getByName(u"Heading 1"_ustr), uno::UNO_QUERY); OUString aFollowStyle; - xStyle->getPropertyValue("FollowStyle") >>= aFollowStyle; + xStyle->getPropertyValue(u"FollowStyle"_ustr) >>= aFollowStyle; // Without the accompanying fix in place, this test would have failed with: // - Expected: Standard // - Actual : Heading 1 // i.e. \snext was ignored. - CPPUNIT_ASSERT_EQUAL(OUString("Standard"), aFollowStyle); + CPPUNIT_ASSERT_EQUAL(u"Standard"_ustr, aFollowStyle); } CPPUNIT_TEST_FIXTURE(Test, testNegativePageBorder) @@ -61,14 +61,15 @@ CPPUNIT_TEST_FIXTURE(Test, testNegativePageBorder) 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); - auto nTopMargin = xStyle->getPropertyValue("TopMargin").get<sal_Int32>(); + 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); + auto nTopMargin = xStyle->getPropertyValue(u"TopMargin"_ustr).get<sal_Int32>(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(501), nTopMargin); - auto aTopBorder = xStyle->getPropertyValue("TopBorder").get<table::BorderLine2>(); + auto aTopBorder = xStyle->getPropertyValue(u"TopBorder"_ustr).get<table::BorderLine2>(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(159), aTopBorder.LineWidth); - auto nTopBorderDistance = xStyle->getPropertyValue("TopBorderDistance").get<sal_Int32>(); + auto nTopBorderDistance = xStyle->getPropertyValue(u"TopBorderDistance"_ustr).get<sal_Int32>(); // Without the accompanying fix in place, this test would have failed with: // - Expected: -646 // - Actual : 342 diff --git a/sw/qa/writerfilter/rtftok/rtfdocumentimpl.cxx b/sw/qa/writerfilter/rtftok/rtfdocumentimpl.cxx index 9ec85990c21d..1d4fbc639cbb 100644 --- a/sw/qa/writerfilter/rtftok/rtfdocumentimpl.cxx +++ b/sw/qa/writerfilter/rtftok/rtfdocumentimpl.cxx @@ -43,7 +43,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPicwPich) uno::Reference<drawing::XDrawPage> xDrawPage = xTextDocument->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); uno::Reference<graphic::XGraphic> xGraphic; - xShape->getPropertyValue("Graphic") >>= xGraphic; + xShape->getPropertyValue(u"Graphic"_ustr) >>= xGraphic; Graphic aGraphic(xGraphic); Size aPrefSize = aGraphic.GetPrefSize(); // Without the accompanying fix in place, this test would have failed with: @@ -62,7 +62,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCharHiddenInTable) uno::Reference<text::XTextTablesSupplier> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTextDocument->getTextTables(), uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xCell(xTable->getCellByName("B1"), + uno::Reference<container::XEnumerationAccess> xCell(xTable->getCellByName(u"B1"_ustr), uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParagraphs = xCell->createEnumeration(); uno::Reference<container::XEnumerationAccess> xParagraph(xParagraphs->nextElement(), @@ -70,7 +70,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCharHiddenInTable) uno::Reference<container::XEnumeration> xPortions = xParagraph->createEnumeration(); uno::Reference<beans::XPropertySet> xPortion(xPortions->nextElement(), uno::UNO_QUERY); bool bCharHidden{}; - xPortion->getPropertyValue("CharHidden") >>= bCharHidden; + xPortion->getPropertyValue(u"CharHidden"_ustr) >>= bCharHidden; // Without the accompanying fix in place, this test would have failed, the newline was not // hidden. CPPUNIT_ASSERT(bCharHidden); @@ -104,7 +104,7 @@ CPPUNIT_TEST_FIXTURE(Test, testOldParaNumLeftMargin) xParagraphs->nextElement(); uno::Reference<beans::XPropertySet> xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY); sal_Int32 nParaLeftMargin{}; - xParagraph->getPropertyValue("ParaLeftMargin") >>= nParaLeftMargin; + xParagraph->getPropertyValue(u"ParaLeftMargin"_ustr) >>= nParaLeftMargin; // Without the accompanying fix in place, this test would have failed with: // - Expected: 2101 // - Actual : 0 diff --git a/sw/qa/writerfilter/rtftok/rtfsdrimport.cxx b/sw/qa/writerfilter/rtftok/rtfsdrimport.cxx index f9afa22c3202..993bd23243f0 100644 --- a/sw/qa/writerfilter/rtftok/rtfsdrimport.cxx +++ b/sw/qa/writerfilter/rtftok/rtfsdrimport.cxx @@ -35,7 +35,7 @@ CPPUNIT_TEST_FIXTURE(Test, testPictureInTextframe) uno::Reference<drawing::XDrawPage> xDrawPage = xTextDocument->getDrawPage(); uno::Reference<beans::XPropertySet> xInnerShape(xDrawPage->getByIndex(1), uno::UNO_QUERY); text::TextContentAnchorType eAnchorType = text::TextContentAnchorType_AT_PARAGRAPH; - xInnerShape->getPropertyValue("AnchorType") >>= eAnchorType; + xInnerShape->getPropertyValue(u"AnchorType"_ustr) >>= eAnchorType; // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 // - Actual : 4 @@ -55,7 +55,7 @@ CPPUNIT_TEST_FIXTURE(Test, testWatermark) uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPagesSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); drawing::ColorMode eMode{}; - xShape->getPropertyValue("GraphicColorMode") >>= eMode; + xShape->getPropertyValue(u"GraphicColorMode"_ustr) >>= eMode; // Without the accompanying fix in place, this test would have failed with: // - Expected: 3 // - Actual : 0 diff --git a/sw/qa/writerfilter/rtftok/rtfsprm.cxx b/sw/qa/writerfilter/rtftok/rtfsprm.cxx index b187ada6e893..26b558ca03cb 100644 --- a/sw/qa/writerfilter/rtftok/rtfsprm.cxx +++ b/sw/qa/writerfilter/rtftok/rtfsprm.cxx @@ -35,16 +35,16 @@ CPPUNIT_TEST_FIXTURE(Test, testLeftMarginDedup) uno::Reference<container::XEnumeration> xParagraphs = xText->createEnumeration(); uno::Reference<beans::XPropertySet> xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY); sal_Int32 nLeftMargin = 0; - xParagraph->getPropertyValue("ParaLeftMargin") >>= nLeftMargin; + xParagraph->getPropertyValue(u"ParaLeftMargin"_ustr) >>= nLeftMargin; CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), nLeftMargin); uno::Reference<beans::XPropertyState> xParagraphState(xParagraph, uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, - xParagraphState->getPropertyState("ParaLeftMargin")); + xParagraphState->getPropertyState(u"ParaLeftMargin"_ustr)); xParagraph.set(xParagraphs->nextElement(), uno::UNO_QUERY); nLeftMargin = 0; - xParagraph->getPropertyValue("ParaLeftMargin") >>= nLeftMargin; + xParagraph->getPropertyValue(u"ParaLeftMargin"_ustr) >>= nLeftMargin; CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), nLeftMargin); xParagraphState.set(xParagraph, uno::UNO_QUERY); @@ -54,7 +54,7 @@ CPPUNIT_TEST_FIXTURE(Test, testLeftMarginDedup) // i.e. the left margin was not a direct formatting, which means left margin from the numbering // was used instead. CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, - xParagraphState->getPropertyState("ParaLeftMargin")); + xParagraphState->getPropertyState(u"ParaLeftMargin"_ustr)); } } |