diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-06-05 10:47:35 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-06-05 12:53:41 +0200 |
commit | 2a3c206dfbba4677842b59d1ec22fd1ec957969a (patch) | |
tree | c21ede651d15477a2ae94c325564c1b2e2a308ca /sw | |
parent | a2c7244ae1ea65345ba11c1ce2501dba34b51362 (diff) |
Upcoming loplugin:elidestringvar: sw
Change-Id: I3805d7a0f8f0e93463a2285a1ce52f6a5daba27d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95578
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw')
36 files changed, 112 insertions, 201 deletions
diff --git a/sw/qa/core/test_ToxMiscTest.cxx b/sw/qa/core/test_ToxMiscTest.cxx index 67a6320cf81b..ac679250a09b 100644 --- a/sw/qa/core/test_ToxMiscTest.cxx +++ b/sw/qa/core/test_ToxMiscTest.cxx @@ -24,11 +24,8 @@ public: void ToxMiscTest::testTdf73162() { - //input token string - OUString tokenString = "<LS Index Link,65535,><E# ,65535,0,10><X ,65535,\001.\001><ET ,65535,><T ,65535,0,5,.,1><# ,65535,><LE ,65535,>"; - //create Tokens with the help of input string - SwFormTokensHelper tokensHelper(tokenString); + SwFormTokensHelper tokensHelper("<LS Index Link,65535,><E# ,65535,0,10><X ,65535,\001.\001><ET ,65535,><T ,65535,0,5,.,1><# ,65535,><LE ,65535,>"); //input token string SwFormTokens formTokens = tokensHelper.GetTokens(); //check the size of token vector / count of tokens diff --git a/sw/qa/core/test_ToxTextGenerator.cxx b/sw/qa/core/test_ToxTextGenerator.cxx index a2d347536a65..c0b667a27334 100644 --- a/sw/qa/core/test_ToxTextGenerator.cxx +++ b/sw/qa/core/test_ToxTextGenerator.cxx @@ -70,25 +70,22 @@ struct MockedSortTab : public SwTOXSortTabBase { void ToxTextGeneratorTest::EmptyStringIsReturnedForPageNumberPlaceholderOfZeroItems() { - OUString const expected(""); OUString actual = ToxTextGenerator::ConstructPageNumberPlaceholder(0); - CPPUNIT_ASSERT_EQUAL(expected, actual); + CPPUNIT_ASSERT_EQUAL(OUString(""), actual); } void ToxTextGeneratorTest::OneAtSignIsReturnedForPageNumberPlaceholderOfOneItem() { - OUString const expected("@~"); OUString actual = ToxTextGenerator::ConstructPageNumberPlaceholder(1); - CPPUNIT_ASSERT_EQUAL(expected, actual); + CPPUNIT_ASSERT_EQUAL(OUString("@~"), actual); } void ToxTextGeneratorTest::TwoAtSignsAreReturnedForPageNumberPlaceholderOfOneItem() { - OUString const expected("@, @~"); OUString actual = ToxTextGenerator::ConstructPageNumberPlaceholder(2); - CPPUNIT_ASSERT_EQUAL(expected, actual); + CPPUNIT_ASSERT_EQUAL(OUString("@, @~"), actual); } void @@ -97,9 +94,8 @@ ToxTextGeneratorTest::EmptyStringIsReturnedAsNumStringIfNoTextMarkIsSet() MockedSortTab sortTab; sortTab.pTextMark = nullptr; - OUString const expected(""); OUString actual = ToxTextGenerator::GetNumStringOfFirstNode(sortTab, false, 0, nullptr); - CPPUNIT_ASSERT_EQUAL(expected, actual); + CPPUNIT_ASSERT_EQUAL(OUString(""), actual); } void @@ -108,9 +104,8 @@ ToxTextGeneratorTest::EmptyStringIsReturnedAsNumStringIfToxSourcesIsEmpty() MockedSortTab sortTab; sortTab.pTextMark = reinterpret_cast<SwTextTOXMark*>(1); - OUString const expected(""); OUString actual = ToxTextGenerator::GetNumStringOfFirstNode(sortTab, false, 0, nullptr); - CPPUNIT_ASSERT_EQUAL(expected, actual); + CPPUNIT_ASSERT_EQUAL(OUString(""), actual); } namespace { diff --git a/sw/qa/core/test_ToxWhitespaceStripper.cxx b/sw/qa/core/test_ToxWhitespaceStripper.cxx index 430cc78b7686..e8303ab3da73 100644 --- a/sw/qa/core/test_ToxWhitespaceStripper.cxx +++ b/sw/qa/core/test_ToxWhitespaceStripper.cxx @@ -47,16 +47,14 @@ void ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks() { { - OUString const test("abc\n"); - ToxWhitespaceStripper sut(test); + ToxWhitespaceStripper sut("abc\n"); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(0)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), sut.GetPositionInStrippedString(1)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), sut.GetPositionInStrippedString(2)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), sut.GetPositionInStrippedString(3)); } { - OUString const test("abc\n\n"); - ToxWhitespaceStripper sut(test); + ToxWhitespaceStripper sut("abc\n\n"); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(0)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), sut.GetPositionInStrippedString(1)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), sut.GetPositionInStrippedString(2)); @@ -64,8 +62,7 @@ ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks() CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), sut.GetPositionInStrippedString(4)); } { - OUString const test("abc\ndef"); - ToxWhitespaceStripper sut(test); + ToxWhitespaceStripper sut("abc\ndef"); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(0)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), sut.GetPositionInStrippedString(1)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), sut.GetPositionInStrippedString(2)); @@ -76,10 +73,9 @@ ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks() } { // 012345 6789 - OUString const test(" abc \ndef"); // 01234567 // " abc def" - ToxWhitespaceStripper sut(test); + ToxWhitespaceStripper sut(" abc \ndef"); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(0)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(1)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), sut.GetPositionInStrippedString(2)); @@ -97,40 +93,28 @@ void ToxWhitespaceStripperTest::StrippingWhitespacesFromVariousStringsWorks() { { - OUString const test("abc\n"); - OUString const expected("abc"); - ToxWhitespaceStripper sut(test); - CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); + ToxWhitespaceStripper sut("abc\n"); + CPPUNIT_ASSERT_EQUAL(OUString("abc"), sut.GetStrippedString()); } { - OUString const test("abc\n\n"); - OUString const expected("abc"); - ToxWhitespaceStripper sut(test); - CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); + ToxWhitespaceStripper sut("abc\n\n"); + CPPUNIT_ASSERT_EQUAL(OUString("abc"), sut.GetStrippedString()); } { - OUString const test("abc\ndef"); - OUString const expected("abc def"); - ToxWhitespaceStripper sut(test); - CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); + ToxWhitespaceStripper sut("abc\ndef"); + CPPUNIT_ASSERT_EQUAL(OUString("abc def"), sut.GetStrippedString()); } { - OUString const test(" abc \ndef"); - OUString const expected(" abc def"); - ToxWhitespaceStripper sut(test); - CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); + ToxWhitespaceStripper sut(" abc \ndef"); + CPPUNIT_ASSERT_EQUAL(OUString(" abc def"), sut.GetStrippedString()); } { - OUString const test(" "); - OUString const expected(""); - ToxWhitespaceStripper sut(test); - CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); + ToxWhitespaceStripper sut(" "); + CPPUNIT_ASSERT_EQUAL(OUString(""), sut.GetStrippedString()); } { - OUString const test("d "); - OUString const expected("d"); - ToxWhitespaceStripper sut(test); - CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); + ToxWhitespaceStripper sut("d "); + CPPUNIT_ASSERT_EQUAL(OUString("d"), sut.GetStrippedString()); } } @@ -146,8 +130,7 @@ ToxWhitespaceStripperTest::PositionAfterStringCanBeRequested() void ToxWhitespaceStripperTest::InvalidPositionIsMappedToLastEntry() { - OUString const test("ab c"); - ToxWhitespaceStripper sut(test); + ToxWhitespaceStripper sut("ab c"); sal_Int32 const expected = 4; // the length of the string after merging the two whitespaces sal_Int32 result = sut.GetPositionInStrippedString(40); // a value past the original string length CPPUNIT_ASSERT_EQUAL(expected, result); diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 96c6edc51634..df50e7f9e253 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2870,13 +2870,11 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118672) if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString()))) return; - const OUString aLine1( - "He heard quiet steps behind him. That didn't bode well. Who could be fol*1 2 " - "3 4 5 6 7 8 9 10con-"); // This ended as "fol*1 2 3 4 5 6 7 8 9", i.e. "10con-" was moved to the next line. - assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak[1]", "Line", aLine1); - const OUString aLine2("setetur"); - assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak[2]", "Line", aLine2); + assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak[1]", "Line", + "He heard quiet steps behind him. That didn't bode well. Who could be fol*1 2 " + "3 4 5 6 7 8 9 10con-"); + assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak[2]", "Line", "setetur"); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117923) diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 43a9a2ab1286..728ed037a54c 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -116,13 +116,11 @@ DECLARE_ODFEXPORT_TEST(testMathObjectFlatExport, "2_MathType3.docx") static void testTdf43569_CheckIfFieldParse() { { - const OUString fieldDefinition("IF A B C"); - OUString paramCondition; OUString paramTrue; OUString paramFalse; - SwHiddenTextField::ParseIfFieldDefinition(fieldDefinition, paramCondition, paramTrue, paramFalse); + SwHiddenTextField::ParseIfFieldDefinition("IF A B C", paramCondition, paramTrue, paramFalse); CPPUNIT_ASSERT_EQUAL(OUString("A"), paramCondition); CPPUNIT_ASSERT_EQUAL(OUString("B"), paramTrue); @@ -130,13 +128,11 @@ static void testTdf43569_CheckIfFieldParse() } { - const OUString fieldDefinition(" IF AAA BBB CCC "); - OUString paramCondition; OUString paramTrue; OUString paramFalse; - SwHiddenTextField::ParseIfFieldDefinition(fieldDefinition, paramCondition, paramTrue, paramFalse); + SwHiddenTextField::ParseIfFieldDefinition(" IF AAA BBB CCC ", paramCondition, paramTrue, paramFalse); CPPUNIT_ASSERT_EQUAL(OUString("AAA"), paramCondition); CPPUNIT_ASSERT_EQUAL(OUString("BBB"), paramTrue); @@ -144,13 +140,11 @@ static void testTdf43569_CheckIfFieldParse() } { - const OUString fieldDefinition(" IF AAA \"BBB\" \"CCC\" "); - OUString paramCondition; OUString paramTrue; OUString paramFalse; - SwHiddenTextField::ParseIfFieldDefinition(fieldDefinition, paramCondition, paramTrue, paramFalse); + SwHiddenTextField::ParseIfFieldDefinition(" IF AAA \"BBB\" \"CCC\" ", paramCondition, paramTrue, paramFalse); CPPUNIT_ASSERT_EQUAL(OUString("AAA"), paramCondition); CPPUNIT_ASSERT_EQUAL(OUString("BBB"), paramTrue); @@ -159,13 +153,11 @@ static void testTdf43569_CheckIfFieldParse() // true-case and false-case have spaces inside { - const OUString fieldDefinition(" IF A A A \"B B B\" \"C C C\" "); - OUString paramCondition; OUString paramTrue; OUString paramFalse; - SwHiddenTextField::ParseIfFieldDefinition(fieldDefinition, paramCondition, paramTrue, paramFalse); + SwHiddenTextField::ParseIfFieldDefinition(" IF A A A \"B B B\" \"C C C\" ", paramCondition, paramTrue, paramFalse); CPPUNIT_ASSERT_EQUAL(OUString("A A A"), paramCondition); CPPUNIT_ASSERT_EQUAL(OUString("B B B"), paramTrue); @@ -174,13 +166,11 @@ static void testTdf43569_CheckIfFieldParse() // true-case and false-case have leading/trailing space { - const OUString fieldDefinition("IF A1 A2 A3 \"B1 B2 \" \" C1 C2\" "); - OUString paramCondition; OUString paramTrue; OUString paramFalse; - SwHiddenTextField::ParseIfFieldDefinition(fieldDefinition, paramCondition, paramTrue, paramFalse); + SwHiddenTextField::ParseIfFieldDefinition("IF A1 A2 A3 \"B1 B2 \" \" C1 C2\" ", paramCondition, paramTrue, paramFalse); CPPUNIT_ASSERT_EQUAL(OUString("A1 A2 A3"), paramCondition); CPPUNIT_ASSERT_EQUAL(OUString("B1 B2 "), paramTrue); @@ -189,13 +179,11 @@ static void testTdf43569_CheckIfFieldParse() // true-case and false-case are empty { - const OUString fieldDefinition("IF condition \"\" \"\" "); - OUString paramCondition; OUString paramTrue; OUString paramFalse; - SwHiddenTextField::ParseIfFieldDefinition(fieldDefinition, paramCondition, paramTrue, paramFalse); + SwHiddenTextField::ParseIfFieldDefinition("IF condition \"\" \"\" ", paramCondition, paramTrue, paramFalse); CPPUNIT_ASSERT_EQUAL(OUString("condition"), paramCondition); CPPUNIT_ASSERT_EQUAL(OUString(""), paramTrue); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 4dd7062c6e17..c1890a33c2cd 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -553,8 +553,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo74792, "fdo74792.docx") comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL()); //check that images are also saved - OUString const sImageFile( "word/media/OOXDiagramDataRels1_0.jpeg" ); //added anchor id to form a unique name - uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName( sImageFile ), uno::UNO_QUERY); + uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName( "word/media/OOXDiagramDataRels1_0.jpeg" /*added anchor id to form a unique name*/ ), uno::UNO_QUERY); CPPUNIT_ASSERT( xInputStream.is() ); } @@ -580,13 +579,11 @@ DECLARE_OOXMLEXPORT_TEST(testFdo77718, "fdo77718.docx") comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL()); //check that images are also saved - OUString const sImageFile1( "word/media/OOXDiagramDataRels1_0.jpeg" ); //added anchor id to form a unique name - uno::Reference<io::XInputStream> xInputStream1(xNameAccess->getByName( sImageFile1 ), uno::UNO_QUERY); + uno::Reference<io::XInputStream> xInputStream1(xNameAccess->getByName( "word/media/OOXDiagramDataRels1_0.jpeg" /*added anchor id to form a unique name*/ ), uno::UNO_QUERY); CPPUNIT_ASSERT( xInputStream1.is() ); //check that images are saved for other smart-arts as well. - OUString const sImageFile2( "word/media/OOXDiagramDataRels2_0.jpeg" ); //added anchor id to form a unique name - uno::Reference<io::XInputStream> xInputStream2(xNameAccess->getByName( sImageFile2 ), uno::UNO_QUERY); + uno::Reference<io::XInputStream> xInputStream2(xNameAccess->getByName( "word/media/OOXDiagramDataRels2_0.jpeg" /*added anchor id to form a unique name*/ ), uno::UNO_QUERY); CPPUNIT_ASSERT( xInputStream2.is() ); } @@ -1019,10 +1016,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf102466, "tdf102466.docx") uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); - const OUString aMustHaveText = "Requerimientos del Cliente"; const OUString aActualText = xCell->getString(); - CPPUNIT_ASSERT(aActualText.indexOf(aMustHaveText) > 0); + CPPUNIT_ASSERT(aActualText.indexOf("Requerimientos del Cliente") > 0); } } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 690309b6827f..092a17646002 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -575,8 +575,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123262_textFootnoteSeparators, "tdf123262_textFo uno::Reference<text::XText> xFootnoteText(xFootnotes->getByIndex(0), uno::UNO_QUERY); // The text in the separator footnote should not be added to the footnotes - OUString sText = " Microsoft Office."; - CPPUNIT_ASSERT_EQUAL(sText, xFootnoteText->getString()); + CPPUNIT_ASSERT_EQUAL(OUString(" Microsoft Office."), xFootnoteText->getString()); // Ensure that paragraph markers are not lost. xFootnoteText.set(xFootnotes->getByIndex(1), uno::UNO_QUERY); diff --git a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx index 1ad0df5fb514..8be5c38a92f7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx @@ -257,9 +257,8 @@ DECLARE_LINKS_EXPORT_TEST(testNon_ascii_link_export, "non_ascii_link.docx", USE_ if (!pXmlDoc) return; - OUString sTarget = "file:///C:/TEMP/%C3%A9kezet.docx"; assertXPath(pXmlDoc, "/rels:Relationships/rels:Relationship[@TargetMode='External']", "Target", - INetURLObject::decode( sTarget, INetURLObject::DecodeMechanism::ToIUri, + INetURLObject::decode( OUString("file:///C:/TEMP/%C3%A9kezet.docx"), INetURLObject::DecodeMechanism::ToIUri, RTL_TEXTENCODING_UTF8)); } diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 4fec96ab05d5..7bae2b0eab9f 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -200,28 +200,30 @@ DECLARE_RTFEXPORT_TEST(testCommentsNested, "comments-nested.odt") DECLARE_RTFEXPORT_TEST(testMathAccents, "math-accents.rtf") { OUString aActual = getFormula(getRun(getParagraph(1), 1)); - OUString const aExpected("acute {a} grave {a} check {a} breve {a} circle {a} widevec {a} " - "widetilde {a} widehat {a} dot {a} widevec {a} widevec {a} widetilde " - "{a} underline {a}"); - CPPUNIT_ASSERT_EQUAL(aExpected, aActual); + CPPUNIT_ASSERT_EQUAL( + OUString("acute {a} grave {a} check {a} breve {a} circle {a} widevec {a} " + "widetilde {a} widehat {a} dot {a} widevec {a} widevec {a} widetilde " + "{a} underline {a}"), + aActual); } DECLARE_RTFEXPORT_TEST(testMathEqarray, "math-eqarray.rtf") { OUString aActual = getFormula(getRun(getParagraph(1), 1)); - OUString const aExpected( - "y = left lbrace stack { 0 , x < 0 # 1 , x = 0 # {x} ^ {2} , x > 0 } right none"); - CPPUNIT_ASSERT_EQUAL(aExpected, aActual); + CPPUNIT_ASSERT_EQUAL( + OUString("y = left lbrace stack { 0 , x < 0 # 1 , x = 0 # {x} ^ {2} , x > 0 } right none"), + aActual); } DECLARE_RTFEXPORT_TEST(testMathD, "math-d.rtf") { OUString aActual = getFormula(getRun(getParagraph(1), 1)); - OUString const aExpected("left (x mline y mline z right ) left (1 right ) left [2 right ] left " - "ldbracket 3 right rdbracket left lline 4 right rline left ldline 5 " - "right rdline left langle 6 right rangle left langle a mline b right " - "rangle left ({x} over {y} right )"); - CPPUNIT_ASSERT_EQUAL(aExpected, aActual); + CPPUNIT_ASSERT_EQUAL( + OUString("left (x mline y mline z right ) left (1 right ) left [2 right ] left " + "ldbracket 3 right rdbracket left lline 4 right rline left ldline 5 " + "right rdline left langle 6 right rangle left langle a mline b right " + "rangle left ({x} over {y} right )"), + aActual); } DECLARE_RTFEXPORT_TEST(testMathEscaping, "math-escaping.rtf") @@ -241,15 +243,13 @@ DECLARE_RTFEXPORT_TEST(testMathLim, "math-lim.rtf") DECLARE_RTFEXPORT_TEST(testMathMatrix, "math-matrix.rtf") { OUString aActual = getFormula(getRun(getParagraph(1), 1)); - OUString const aExpected("left [matrix {1 # 2 ## 3 # 4} right ]"); - CPPUNIT_ASSERT_EQUAL(aExpected, aActual); + CPPUNIT_ASSERT_EQUAL(OUString("left [matrix {1 # 2 ## 3 # 4} right ]"), aActual); } DECLARE_RTFEXPORT_TEST(testMathBox, "math-mbox.rtf") { OUString aActual = getFormula(getRun(getParagraph(1), 1)); - OUString const aExpected("a"); - CPPUNIT_ASSERT_EQUAL(aExpected, aActual); + CPPUNIT_ASSERT_EQUAL(OUString("a"), aActual); } DECLARE_RTFEXPORT_TEST(testMathMso2007, "math-mso2007.rtf") @@ -301,8 +301,8 @@ DECLARE_RTFEXPORT_TEST(testMathMso2007, "math-mso2007.rtf") DECLARE_RTFEXPORT_TEST(testMathNary, "math-nary.rtf") { OUString aActual = getFormula(getRun(getParagraph(1), 1)); - OUString const aExpected("lllint from {1} to {2} {x + 1} prod from {a} {b} sum to {2} {x}"); - CPPUNIT_ASSERT_EQUAL(aExpected, aActual); + CPPUNIT_ASSERT_EQUAL( + OUString("lllint from {1} to {2} {x + 1} prod from {a} {b} sum to {2} {x}"), aActual); } DECLARE_RTFEXPORT_TEST(testMathLimupp, "math-limupp.rtf") @@ -341,10 +341,11 @@ DECLARE_RTFEXPORT_TEST(testMathSepchr, "math-sepchr.rtf") DECLARE_RTFEXPORT_TEST(testMathSubscripts, "math-subscripts.rtf") { OUString aActual = getFormula(getRun(getParagraph(1), 1)); - OUString const aExpected("{x} ^ {y} + {e} ^ {x} {x} ^ {b} {x} rsub {b} {a} rsub {c} rsup {b} " - "{x} lsub {2} lsup {1} {{x csup {6} csub {3}} lsub {4} lsup {5}} rsub " - "{2} rsup {1}"); - CPPUNIT_ASSERT_EQUAL(aExpected, aActual); + CPPUNIT_ASSERT_EQUAL( + OUString("{x} ^ {y} + {e} ^ {x} {x} ^ {b} {x} rsub {b} {a} rsub {c} rsup {b} " + "{x} lsub {2} lsup {1} {{x csup {6} csub {3}} lsub {4} lsup {5}} rsub " + "{2} rsup {1}"), + aActual); } DECLARE_RTFEXPORT_TEST(testMathVerticalstacks, "math-vertical-stacks.rtf") diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index 12023f321232..23f83a17149b 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -339,10 +339,9 @@ DECLARE_RTFEXPORT_TEST(testCp1000018, "cp1000018.rtf") uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); - OUString const aExpected = "Footnote first line." SAL_NEWLINE_STRING; OUString const aActual = xTextRange->getString(); - CPPUNIT_ASSERT_EQUAL(aExpected, aActual); + CPPUNIT_ASSERT_EQUAL(OUString("Footnote first line." SAL_NEWLINE_STRING), aActual); } DECLARE_RTFEXPORT_TEST(testFdo94835, "fdo94835.rtf") diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index cf9d5dd31309..1e960e443079 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -969,9 +969,8 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo82114) uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>( getStyles("PageStyles")->getByName("Converted1"), "HeaderText"); OUString aActual = xHeaderText->getString(); - OUString const aExpected("First page header, section 2"); // This was 'Right page header, section 1'. - CPPUNIT_ASSERT_EQUAL(aExpected, aActual); + CPPUNIT_ASSERT_EQUAL(OUString("First page header, section 2"), aActual); } CPPUNIT_TEST_FIXTURE(Test, testFdo44984) @@ -1442,11 +1441,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108947) //Document is very fragile, hence we need this guard. #if HAVE_MORE_FONTS - OUString aExpected = SAL_NEWLINE_STRING SAL_NEWLINE_STRING "Header Page 2 ?"; uno::Reference<text::XText> xHeaderTextLeft = getProperty<uno::Reference<text::XText>>( getStyles("PageStyles")->getByName("Default Page Style"), "HeaderTextLeft"); aActual = xHeaderTextLeft->getString(); - CPPUNIT_ASSERT_EQUAL(aExpected, aActual); + CPPUNIT_ASSERT_EQUAL(OUString(SAL_NEWLINE_STRING SAL_NEWLINE_STRING "Header Page 2 ?"), + aActual); #endif } diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 91e493af1960..d7b01b9bbb96 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1157,12 +1157,11 @@ void SwUiWriterTest::testWatermarkPosition() SwDoc* pDoc = createDoc("watermark-position.odt"); SwEditShell* pEditShell = pDoc->GetEditShell(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - const OUString rPageStyleName = "Default Page Style"; uno::Reference<frame::XModel> xModel = pDoc->GetDocShell()->GetBaseModel(); uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xModel, 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> xPageStyle(xStyleFamily->getByName(rPageStyleName), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPageStyle(xStyleFamily->getByName("Default Page Style"), uno::UNO_QUERY); // 1. Add additional page breaks for (int j = 0; j < aAdditionalPagesCount[i]; ++j) @@ -2736,13 +2735,12 @@ void SwUiWriterTest::testTdf73660() OUString aData2 = "Seco" + OUStringChar(CHAR_SOFTHYPHEN) + "nd"; OUString aData3 = OUStringChar(CHAR_SOFTHYPHEN) + "Third"; OUString aData4 = "Fourth" + OUStringChar(CHAR_SOFTHYPHEN); - OUString aData5 = "Fifth"; pWrtShell->Insert("We are inserting some text in the document to check the search feature "); pWrtShell->Insert(aData1 + " "); pWrtShell->Insert(aData2 + " "); pWrtShell->Insert(aData3 + " "); pWrtShell->Insert(aData4 + " "); - pWrtShell->Insert(aData5 + " "); + pWrtShell->Insert("Fifth "); pWrtShell->Insert("Now we have enough text let's test search for all the cases"); //searching for all 5 strings entered with soft-hyphen, search string contains no soft-hyphen i18nutil::SearchOptions2 searchOpt; diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index 691d385d6de7..f9040938ef56 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -555,11 +555,11 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSelectionInTableEnumEnd) CPPUNIT_ASSERT(xSelections.is()); uno::Reference<text::XTextRange> xSelection(xSelections->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT(xSelection.is()); - OUString aExpectedSelection - = "Before" SAL_NEWLINE_STRING "A1" SAL_NEWLINE_STRING "B1" SAL_NEWLINE_STRING - "C2" SAL_NEWLINE_STRING "A2" SAL_NEWLINE_STRING "B2" SAL_NEWLINE_STRING - "C2" SAL_NEWLINE_STRING; - CPPUNIT_ASSERT_EQUAL(aExpectedSelection, xSelection->getString()); + CPPUNIT_ASSERT_EQUAL(OUString("Before" SAL_NEWLINE_STRING "A1" SAL_NEWLINE_STRING + "B1" SAL_NEWLINE_STRING "C2" SAL_NEWLINE_STRING + "A2" SAL_NEWLINE_STRING "B2" SAL_NEWLINE_STRING + "C2" SAL_NEWLINE_STRING), + xSelection->getString()); // Enumerate paragraphs in the selection. uno::Reference<container::XEnumerationAccess> xCursor( diff --git a/sw/source/core/access/acchyperlink.cxx b/sw/source/core/access/acchyperlink.cxx index 74f9ac443eeb..1866b844f7c9 100644 --- a/sw/source/core/access/acchyperlink.cxx +++ b/sw/source/core/access/acchyperlink.cxx @@ -189,8 +189,7 @@ sal_Bool SAL_CALL SwAccessibleHyperlink::isValid( ) if (SwFormatINetFormat const*const pINetFormat = GetTextAttr()) { OUString const sText(pINetFormat->GetValue()); - OUString sToken = "#"; - sal_Int32 nPos = sText.indexOf(sToken); + sal_Int32 nPos = sText.indexOf("#"); if (nPos==0)//document link { uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); diff --git a/sw/source/core/crsr/DropDownFormFieldButton.cxx b/sw/source/core/crsr/DropDownFormFieldButton.cxx index a110ac3f064b..10664a027bba 100644 --- a/sw/source/core/crsr/DropDownFormFieldButton.cxx +++ b/sw/source/core/crsr/DropDownFormFieldButton.cxx @@ -72,9 +72,8 @@ SwFieldDialog::SwFieldDialog(SwEditWin* parent, sw::mark::IFieldmark* fieldBM, l { const sw::mark::IFieldmark::parameter_map_t* const pParameters = fieldBM->GetParameters(); - OUString sListKey = ODF_FORMDROPDOWN_LISTENTRY; sw::mark::IFieldmark::parameter_map_t::const_iterator pListEntries - = pParameters->find(sListKey); + = pParameters->find(ODF_FORMDROPDOWN_LISTENTRY); css::uno::Sequence<OUString> vListEntries; if (pListEntries != pParameters->end()) { @@ -89,9 +88,8 @@ SwFieldDialog::SwFieldDialog(SwEditWin* parent, sw::mark::IFieldmark* fieldBM, l } // Select the current one - OUString sResultKey = ODF_FORMDROPDOWN_RESULT; sw::mark::IFieldmark::parameter_map_t::const_iterator pResult - = pParameters->find(sResultKey); + = pParameters->find(ODF_FORMDROPDOWN_RESULT); if (pResult != pParameters->end()) { sal_Int32 nSelection = -1; @@ -138,8 +136,7 @@ IMPL_LINK(SwFieldDialog, MyListBoxHandler, weld::TreeView&, rBox, bool) sal_Int32 nSelection = rBox.get_selected_index(); if (nSelection >= 0) { - OUString sKey = ODF_FORMDROPDOWN_RESULT; - (*m_pFieldmark->GetParameters())[sKey] <<= nSelection; + (*m_pFieldmark->GetParameters())[ODF_FORMDROPDOWN_RESULT] <<= nSelection; m_pFieldmark->Invalidate(); SwView& rView = static_cast<SwEditWin*>(GetParent())->GetView(); rView.GetDocShell()->SetModified(); diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index bd7e5d48fd12..3e0755108cd6 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -752,8 +752,7 @@ namespace sw::mark sPayload.append("], "); // Selected item - OUString sResultKey = ODF_FORMDROPDOWN_RESULT; - auto pSelectedItemIter = pParameters->find(sResultKey); + auto pSelectedItemIter = pParameters->find(ODF_FORMDROPDOWN_RESULT); sal_Int32 nSelection = -1; if (pSelectedItemIter != pParameters->end()) { diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index d0154b4886ef..816c4cf727e1 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -1394,10 +1394,9 @@ SfxWatermarkItem SwEditShell::GetWatermark() const uno::Reference<text::XText> xHeaderText; xPageStyle->getPropertyValue(UNO_NAME_HEADER_TEXT) >>= xHeaderText; - OUString aShapeServiceName = "com.sun.star.drawing.CustomShape"; OUString sWatermark = ""; bool bSuccess = false; - uno::Reference<drawing::XShape> xWatermark = lcl_getWatermark(xHeaderText, aShapeServiceName, sWatermark, bSuccess); + uno::Reference<drawing::XShape> xWatermark = lcl_getWatermark(xHeaderText, "com.sun.star.drawing.CustomShape", sWatermark, bSuccess); if (xWatermark.is()) { diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx index c5b4df884b9e..ac1e2a4db165 100644 --- a/sw/source/core/inc/wrong.hxx +++ b/sw/source/core/inc/wrong.hxx @@ -93,8 +93,7 @@ private: { if (xPropertyBag.is()) { - const OUString colorKey("LineColor"); - css::uno::Any aLineColor = xPropertyBag->getValue(colorKey); + css::uno::Any aLineColor = xPropertyBag->getValue("LineColor"); css::util::Color lineColor = 0; if (aLineColor >>= lineColor) @@ -119,8 +118,7 @@ private: { if (xPropertyBag.is()) { - const OUString typeKey("LineType"); - css::uno::Any aLineType = xPropertyBag->getValue(typeKey); + css::uno::Any aLineType = xPropertyBag->getValue("LineType"); ::sal_Int16 lineType = 0; if (!(aLineType >>= lineType)) @@ -161,8 +159,7 @@ private: { if (xPropertyBag.is()) { - const OUString colorKey("LineColor"); - css::uno::Any aLineColor = xPropertyBag->getValue(colorKey); + css::uno::Any aLineColor = xPropertyBag->getValue("LineColor"); css::util::Color lineColor = 0; if (aLineColor >>= lineColor) @@ -187,8 +184,7 @@ private: { if (xPropertyBag.is()) { - const OUString typeKey("LineType"); - css::uno::Any aLineType = xPropertyBag->getValue(typeKey); + css::uno::Any aLineType = xPropertyBag->getValue("LineType"); ::sal_Int16 lineType = 0; if (!(aLineType >>= lineType)) diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx index f395efeaeb6d..0e6a19aadbbe 100644 --- a/sw/source/core/layout/dbg_lay.cxx +++ b/sw/source/core/layout/dbg_lay.cxx @@ -242,8 +242,7 @@ void SwProtocol::Record( const SwFrame* pFrame, PROT nFunction, DbgAction nAct, void SwProtocol::Init() { nRecord = PROT::FileInit; - OUString aName("dbg_lay.go"); - SvFileStream aStream( aName, StreamMode::READ ); + SvFileStream aStream( "dbg_lay.go", StreamMode::READ ); if( aStream.IsOpen() ) { pImpl = new SwImplProtocol(); @@ -275,9 +274,8 @@ SwImplProtocol::SwImplProtocol() bool SwImplProtocol::NewStream() { - OUString aName("dbg_lay.out"); nLineCount = 0; - pStream.reset( new SvFileStream( aName, StreamMode::WRITE | StreamMode::TRUNC ) ); + pStream.reset( new SvFileStream( "dbg_lay.out", StreamMode::WRITE | StreamMode::TRUNC ) ); if( pStream->GetError() ) { pStream.reset(); @@ -396,8 +394,7 @@ void SwImplProtocol::CheckLine( OString& rLine ) /// read the file "dbg_lay.ini" in the current directory and evaluate it. void SwImplProtocol::FileInit() { - OUString aName("dbg_lay.ini"); - SvFileStream aStream( aName, StreamMode::READ ); + SvFileStream aStream( "dbg_lay.ini", StreamMode::READ ); if( aStream.IsOpen() ) { OString aLine; diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 9995d3c1fde1..234f30ed7c07 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -423,7 +423,6 @@ void SwXMLTextBlocks::WriteInfo() comphelper::getProcessComponentContext(); uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext); - OUString sDocName( XMLN_BLOCKLIST ); /* if ( xBlkRoot->IsContained( sDocName) ) @@ -435,7 +434,7 @@ void SwXMLTextBlocks::WriteInfo() try { - uno::Reference < io::XStream > xDocStream = xBlkRoot->openStreamElement( sDocName, + uno::Reference < io::XStream > xDocStream = xBlkRoot->openStreamElement( XMLN_BLOCKLIST, embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE ); uno::Reference < beans::XPropertySet > xSet( xDocStream, uno::UNO_QUERY ); diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index d570a8015f52..b54877aedef6 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1916,8 +1916,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() // #i44368# Links in Header/Footer if ( bHeaderFooter ) { - const OUString aDummy; - MakeHeaderFooterLinks( *pPDFExtOutDevData, *pTNd, rLinkRect, nDestId, aDummy, true ); + MakeHeaderFooterLinks( *pPDFExtOutDevData, *pTNd, rLinkRect, nDestId, "", true ); } } } diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 9fd60520c325..5d5b93f1fa44 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -1470,8 +1470,7 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const SwTwips nSpace = 0; if( SwFillMode::Tab != rFill.Mode() ) { - const OUString aTmp(" "); - SwDrawTextInfo aDrawInf( pSh, *pOut, aTmp, 0, 2 ); + SwDrawTextInfo aDrawInf( pSh, *pOut, " ", 0, 2 ); nSpace = pFnt->GetTextSize_( aDrawInf ).Width()/2; } if( rFill.X() >= nRight ) diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 463e7668f4e7..ed52fbca1707 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -403,8 +403,7 @@ SwLinePortion *SwTextFormatter::NewExtraPortion( SwTextFormatInfo &rInf ) } if( !pRet ) { - const OUString aNothing; - pRet = new SwFieldPortion( aNothing ); + pRet = new SwFieldPortion( "" ); rInf.SetLen(TextFrameIndex(1)); } return pRet; diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 4a843d192d1d..dd4fea0b066e 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -956,9 +956,8 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, { fExtraTextRotation /= 100.0; SdrCustomShapeGeometryItem aGeometryItem( pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); - const OUString sTextRotateAngle( "TextRotateAngle" ); css::beans::PropertyValue aPropVal; - aPropVal.Name = sTextRotateAngle; + aPropVal.Name = "TextRotateAngle"; aPropVal.Value <<= fExtraTextRotation; aGeometryItem.SetPropertyValue( aPropVal ); pCustomShape->SetMergedItem( aGeometryItem ); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 25eb28a85c15..c93daeaeb1a1 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -2200,8 +2200,7 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, OUString& rStr ) sBookmarkName = sName; } OUString sURL = "#" + sBookmarkName; - const OUString sTarget; - SwFormatINetFormat aURL( sURL, sTarget ); + SwFormatINetFormat aURL( sURL, "" ); const OUString sLinkStyle("Index Link"); const sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sLinkStyle, SwGetPoolIdFromName::ChrFmt ); diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index 4a7d5f879524..3c1a468474ff 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -180,14 +180,13 @@ ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xS xInfoSet->setPropertyValue( "UsePrettyPrinting", makeAny(aSaveOpt.IsPrettyPrinting()) ); // save show redline mode ... - const OUString sShowChanges("ShowChanges"); RedlineFlags const nOrigRedlineFlags = m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags(); RedlineFlags nRedlineFlags(nOrigRedlineFlags); bool isShowChanges; // TODO: ideally this would be stored per-view... SwRootFrame const*const pLayout(m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); isShowChanges = pLayout == nullptr || !pLayout->IsHideRedlines(); - xInfoSet->setPropertyValue(sShowChanges, makeAny(isShowChanges)); + xInfoSet->setPropertyValue("ShowChanges", makeAny(isShowChanges)); // ... and hide redlines for export nRedlineFlags &= ~RedlineFlags::ShowMask; nRedlineFlags |= RedlineFlags::ShowInsert; diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx index bb6d9ed53952..b6fcc8126338 100644 --- a/sw/source/ui/fldui/changedb.cxx +++ b/sw/source/ui/fldui/changedb.cxx @@ -112,10 +112,8 @@ std::unique_ptr<weld::TreeIter> SwChangeDBDlg::Insert(const OUString& rDBName) OUString sUserData = rDBName.getToken(0, DB_DELIM, nIdx); sal_Int32 nCommandType = sUserData.toInt32(); - OUString aTableImg(RID_BMP_DBTABLE); OUString aDBImg(RID_BMP_DB); - OUString aQueryImg(RID_BMP_DBQUERY); - OUString& rToInsert = nCommandType ? aQueryImg : aTableImg; + OUString rToInsert = nCommandType ? OUStringLiteral(RID_BMP_DBQUERY) : OUStringLiteral(RID_BMP_DBTABLE); std::unique_ptr<weld::TreeIter> xIter(m_xUsedDBTLB->make_iterator()); if (m_xUsedDBTLB->get_iter_first(*xIter)) diff --git a/sw/source/ui/vba/vbaautotextentry.cxx b/sw/source/ui/vba/vbaautotextentry.cxx index 89165585c014..a45618c94ea9 100644 --- a/sw/source/ui/vba/vbaautotextentry.cxx +++ b/sw/source/ui/vba/vbaautotextentry.cxx @@ -62,8 +62,7 @@ uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::R uno::Reference< text::XTextViewCursor > xTVCursor = word::getXTextViewCursor( xModel ); uno::Reference< text::XTextRange > xCurrentRange( xTC->getEnd(), uno::UNO_SET_THROW ); xTVCursor->gotoRange( xCurrentRange, false ); - OUString url = ".uno:Delete"; - dispatchRequests( xModel,url ); + dispatchRequests( xModel,".uno:Delete" ); xTVCursor->gotoRange( xEndMarker->getEnd(), false ); } } diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx index 3e001d70e9ea..9d91960e55be 100644 --- a/sw/source/ui/vba/vbadocument.cxx +++ b/sw/source/ui/vba/vbadocument.cxx @@ -428,14 +428,12 @@ void SAL_CALL SwVbaDocument::PrintOut( const uno::Any& /*Background*/, const uno void SAL_CALL SwVbaDocument::PrintPreview( ) { - OUString url = ".uno:PrintPreview"; - dispatchRequests( mxModel,url ); + dispatchRequests( mxModel,".uno:PrintPreview" ); } void SAL_CALL SwVbaDocument::ClosePrintPreview( ) { - OUString url = ".uno:ClosePreview"; - dispatchRequests( mxModel,url ); + dispatchRequests( mxModel,".uno:ClosePreview" ); } uno::Any SAL_CALL diff --git a/sw/source/ui/vba/vbaheaderfooterhelper.cxx b/sw/source/ui/vba/vbaheaderfooterhelper.cxx index 3e9f937a1e67..987088b6a5ad 100644 --- a/sw/source/ui/vba/vbaheaderfooterhelper.cxx +++ b/sw/source/ui/vba/vbaheaderfooterhelper.cxx @@ -48,12 +48,11 @@ bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel if( !isHeaderFooter( xCurrentText ) ) return false; - OUString aPropIsShared = "HeaderIsShared"; OUString aPropText = "HeaderText"; uno::Reference< style::XStyle > xPageStyle = word::getCurrentPageStyle( xModel ); uno::Reference< beans::XPropertySet > xPageProps( xPageStyle, uno::UNO_QUERY_THROW ); bool isShared = true; - xPageProps->getPropertyValue( aPropIsShared ) >>= isShared; + xPageProps->getPropertyValue( "HeaderIsShared" ) >>= isShared; if( !isShared ) { uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); @@ -114,12 +113,11 @@ bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel if( !isHeaderFooter( xCurrentText ) ) return false; - OUString aPropIsShared = "FooterIsShared"; OUString aPropText = "FooterText"; uno::Reference< style::XStyle > xPageStyle = word::getCurrentPageStyle( xModel ); uno::Reference< beans::XPropertySet > xPageProps( xPageStyle, uno::UNO_QUERY_THROW ); bool isShared = true; - xPageProps->getPropertyValue( aPropIsShared ) >>= isShared; + xPageProps->getPropertyValue( "FooterIsShared" ) >>= isShared; if( !isShared ) { uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); diff --git a/sw/source/ui/vba/vbapane.cxx b/sw/source/ui/vba/vbapane.cxx index 3ced1a8441f3..f7f6fc54021d 100644 --- a/sw/source/ui/vba/vbapane.cxx +++ b/sw/source/ui/vba/vbapane.cxx @@ -42,8 +42,7 @@ SwVbaPane::View() void SAL_CALL SwVbaPane::Close( ) { - OUString url = ".uno:CloseWin"; - dispatchRequests( mxModel,url ); + dispatchRequests( mxModel,".uno:CloseWin" ); } OUString diff --git a/sw/source/ui/vba/vbaselection.cxx b/sw/source/ui/vba/vbaselection.cxx index a0c5a02f5aee..83f5d491bd27 100644 --- a/sw/source/ui/vba/vbaselection.cxx +++ b/sw/source/ui/vba/vbaselection.cxx @@ -215,8 +215,7 @@ SwVbaSelection::Delete( const uno::Any& _unit, const uno::Any& _count ) } } } - OUString url = ".uno:Delete"; - dispatchRequests( mxModel,url ); + dispatchRequests( mxModel,".uno:Delete" ); } void @@ -544,8 +543,7 @@ SwVbaSelection::getFont() void SAL_CALL SwVbaSelection::TypeBackspace() { - OUString url = ".uno:SwBackspace"; - dispatchRequests( mxModel,url ); + dispatchRequests( mxModel,".uno:SwBackspace" ); } uno::Reference< word::XRange > SAL_CALL SwVbaSelection::GoTo( const uno::Any& _what, const uno::Any& _which, const uno::Any& _count, const uno::Any& _name ) @@ -1026,8 +1024,7 @@ uno::Any SAL_CALL SwVbaSelection::Cells( const uno::Any& index ) void SAL_CALL SwVbaSelection::Copy( ) { - OUString url = ".uno:Copy"; - dispatchRequests( mxModel,url ); + dispatchRequests( mxModel,".uno:Copy" ); } void SAL_CALL SwVbaSelection::CopyAsPicture( ) @@ -1038,8 +1035,7 @@ void SAL_CALL SwVbaSelection::CopyAsPicture( ) void SAL_CALL SwVbaSelection::Paste( ) { - OUString url = ".uno:Paste"; - dispatchRequests( mxModel,url ); + dispatchRequests( mxModel,".uno:Paste" ); } void SAL_CALL SwVbaSelection::Collapse( const uno::Any& Direction ) @@ -1086,8 +1082,7 @@ void SAL_CALL SwVbaSelection::WholeStory( ) // insert an empty line uno::Reference< text::XTextRange > xFirstCellRange = word::getFirstObjectPosition( xText ); mxTextViewCursor->gotoRange( xFirstCellRange, false ); - OUString url = ".uno:InsertPara"; - dispatchRequests( mxModel,url ); + dispatchRequests( mxModel,".uno:InsertPara" ); } } uno::Reference< text::XTextRange > xStart = xText->getStart(); diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index e70129d99c6e..69f4accadfad 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1578,8 +1578,7 @@ ErrCode SwDocShell::LoadStylesFromFile(const OUString& rURL, SwgReaderOption& rO try { uno::Reference< beans::XPropertySet > xProps( xStorage, uno::UNO_QUERY_THROW ); - const OUString aMediaTypePropName( "MediaType" ); - xProps->getPropertyValue( aMediaTypePropName ); + xProps->getPropertyValue( "MediaType" ); bImport = true; } catch (const uno::Exception&) diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index b4e91dcec5f0..d33fc25d759e 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -782,8 +782,7 @@ bool SwTransferable::WriteObject( tools::SvRef<SotStorageStream>& xStream, case SWTRANSFER_OBJECTTYPE_HTML: { // LOK is interested in getting images embedded for copy/paste support. - const OUString aFilterOptions("EmbedImages"); - GetHTMLWriter( comphelper::LibreOfficeKit::isActive() ? aFilterOptions : OUString(), OUString(), xWrt ); + GetHTMLWriter( comphelper::LibreOfficeKit::isActive() ? OUString("EmbedImages") : OUString(), OUString(), xWrt ); break; } diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 9567067f13e7..6a5cd8b3f42a 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -410,8 +410,6 @@ void SwTextShell::Execute(SfxRequest &rReq) const OUString aSelectionLangPrefix("Current_"); const OUString aParagraphLangPrefix("Paragraph_"); const OUString aDocumentLangPrefix("Default_"); - const OUString aStrNone("LANGUAGE_NONE"); - const OUString aStrResetLangs("RESET_LANGUAGES"); SfxItemSet aCoreSet( GetPool(), svl::Items<RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, @@ -457,9 +455,9 @@ void SwTextShell::Execute(SfxRequest &rReq) } rWrtSh.StartUndo( ( !bForParagraph && !bForSelection ) ? SwUndoId::SETDEFTATTR : SwUndoId::EMPTY ); - if (aNewLangText == aStrNone) + if (aNewLangText == "LANGUAGE_NONE") SwLangHelper::SetLanguage_None( rWrtSh, bForSelection, aCoreSet ); - else if (aNewLangText == aStrResetLangs) + else if (aNewLangText == "RESET_LANGUAGES") SwLangHelper::ResetLanguages( rWrtSh ); else SwLangHelper::SetLanguage( rWrtSh, aNewLangText, bForSelection, aCoreSet ); @@ -1457,10 +1455,7 @@ void SwTextShell::Execute(SfxRequest &rReq) if (pItem2) sApplyText = pItem2->GetValue(); - const OUString sGrammarType("Grammar"); - const OUString sSpellingType("Spelling"); - - if(sApplyText == sGrammarType) + if(sApplyText == "Grammar") { linguistic2::ProofreadingResult aGrammarCheckRes; sal_Int32 nErrorInResult = -1; @@ -1488,7 +1483,7 @@ void SwTextShell::Execute(SfxRequest &rReq) } } } - else if (sApplyText == sSpellingType) + else if (sApplyText == "Spelling") { SwRect aToFill; uno::Reference< linguistic2::XSpellAlternatives > xSpellAlt( rWrtSh.GetCorrection(nullptr, aToFill) ); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 1fb4ce3713be..f92b42b5a28c 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3398,8 +3398,7 @@ void SwXTextDocument::executeFromFieldEvent(const StringMap& aArguments) { if (nSelection >= 0) { - OUString sKey = ODF_FORMDROPDOWN_RESULT; - (*pFieldBM->GetParameters())[sKey] <<= nSelection; + (*pFieldBM->GetParameters())[ODF_FORMDROPDOWN_RESULT] <<= nSelection; pFieldBM->Invalidate(); pDocShell->GetWrtShell()->SetModified(); pDocShell->GetView()->GetEditWin().LogicInvalidate(nullptr); |