diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-10-06 09:42:38 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-10-07 00:47:20 +0200 |
commit | e0c33ec15f53a01fa3ee07489871bbe09bb5c9c3 (patch) | |
tree | 1afe391a2b4bf9eda13de043658941060cb401c2 /sdext | |
parent | 9e3da252c361b3e2b04a2df7a3ae2a5177b37713 (diff) |
loplugin:ostr: automatic rewrite
Change-Id: I2d09b2b83e1b50493ec88d0b2c323a83c0c86395
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157647
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/qa/unit/pdfimport.cxx | 20 | ||||
-rw-r--r-- | sdext/source/pdfimport/inc/contentsink.hxx | 2 | ||||
-rw-r--r-- | sdext/source/pdfimport/tree/drawtreevisiting.cxx | 2 | ||||
-rw-r--r-- | sdext/source/pdfimport/tree/pdfiprocessor.cxx | 4 | ||||
-rw-r--r-- | sdext/source/pdfimport/tree/writertreevisiting.cxx | 2 | ||||
-rw-r--r-- | sdext/source/pdfimport/wrapper/wrapper.cxx | 52 |
6 files changed, 41 insertions, 41 deletions
diff --git a/sdext/qa/unit/pdfimport.cxx b/sdext/qa/unit/pdfimport.cxx index c344394ab1c3..2d7cee1295a4 100644 --- a/sdext/qa/unit/pdfimport.cxx +++ b/sdext/qa/unit/pdfimport.cxx @@ -567,10 +567,10 @@ namespace // This ensures that the imported text contains all of the characters OString xpath = "//draw:frame[@draw:z-index='3'][1]/draw:text-box/text:p/text:span[1]"; OUString sContent = getXPathContent(pXmlDoc, xpath).replaceAll("\n", ""); - CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"敏捷的狐狸跨过慵懒的"), sContent); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), u"敏捷的狐狸跨过慵懒的"_ustr, sContent); xpath = "//draw:frame[@draw:z-index='4'][1]/draw:text-box/text:p/text:span[1]"; sContent = getXPathContent(pXmlDoc, xpath).replaceAll("\n", ""); - CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"狗。"), sContent); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), u"狗。"_ustr, sContent); #endif } @@ -793,30 +793,30 @@ namespace // Test for امُ عَلَيْكَ OString xpath = "string(//draw:frame[@draw:transform='matrix(917.222222222222 0 0 917.222222222222 14821.9583333333 2159.23861112778)']/draw:text-box/text:p/text:span)"; OUString sContent = getXPathContent(pXmlDoc, xpath); - CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"امُ عَلَيَْك"), sContent.replaceAll("\n\n", " ").replaceAll("\n", "")); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), u"امُ عَلَيَْك"_ustr, sContent.replaceAll("\n\n", " ").replaceAll("\n", "")); // Test for ٱلسََّل . It appears in the 3rd frame, i.e. after the امُ عَلَيَْك which is in the 2nd frame (from left to right) // thus these two frames together appear as ٱلسََّل امُ عَلَيْكَ in Draw. // FIXME: Should be ٱلسَّلَامُ عَلَيْكَ (i.e. the two text frames should be merged into one so that the ل and the ا will show as لَا rather than ل ا) xpath = "string(//draw:frame[@draw:transform='matrix(917.222222222222 0 0 917.222222222222 17420.1666666667 2159.23861112778)']/draw:text-box/text:p/text:span)"; sContent = getXPathContent(pXmlDoc, xpath); - CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"ٱلسََّل"), sContent.replaceAll("\n\n", " ").replaceAll("\n", "")); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), u"ٱلسََّل"_ustr, sContent.replaceAll("\n\n", " ").replaceAll("\n", "")); // Test for "LibreOffice RTL" xpath = "string(//draw:frame[@draw:transform='matrix(917.222222222222 0 0 917.222222222222 12779.375 5121.79583335)']/draw:text-box/text:p/text:span)"; sContent = getXPathContent(pXmlDoc, xpath); - CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"LibreOffice RTL"), sContent.replaceAll("\n\n", " ").replaceAll("\n", "")); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), u"LibreOffice RTL"_ustr, sContent.replaceAll("\n\n", " ").replaceAll("\n", "")); // Test for "LibreOffice LTR (test)" xpath = "string(//draw:frame[last()-1]/draw:text-box/text:p/text:span[last()])"; sContent = getXPathContent(pXmlDoc, xpath); - CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"LibreOffice LTR (test)"), sContent.replaceAll("\n\n", " ").replaceAll("\n", "")); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), u"LibreOffice LTR (test)"_ustr, sContent.replaceAll("\n\n", " ").replaceAll("\n", "")); /* Test for Chinese characters */ // Use last() instead of matrix below, because the matrix may be different on different OS due to fallback of Chinese fonts. xpath = "string(//draw:frame[last()]/draw:text-box/text:p/text:span)"; sContent = getXPathContent(pXmlDoc, xpath); - CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"中文测试,中文"), sContent.replaceAll("\n\n", " ").replaceAll("\n", "")); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), u"中文测试,中文"_ustr, sContent.replaceAll("\n\n", " ").replaceAll("\n", "")); // Test pdf text run in the Writer PDF import filter xAdaptor->setTreeVisitorFactory(createWriterTreeVisitorFactory()); @@ -827,13 +827,13 @@ namespace xmlDocUniquePtr pXmlDoc2(xmlParseDoc(reinterpret_cast<xmlChar const *>(aOutput2.getStr()))); xpath = "string(//draw:frame[@draw:z-index='3'][1]/draw:text-box/text:p/text:span)"; sContent = getXPathContent(pXmlDoc2, xpath).replaceAll("\n\n", " ").replaceAll("\n", ""); - CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput2.getStr(), OUString(u"ٱلسََّل"), sContent); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput2.getStr(), u"ٱلسََّل"_ustr, sContent); xpath = "string(//draw:frame[@draw:z-index='2'][1]/draw:text-box/text:p/text:span)"; sContent = getXPathContent(pXmlDoc2, xpath).replaceAll("\n\n", " ").replaceAll("\n", ""); - CPPUNIT_ASSERT_EQUAL(OUString(u"امُ عَلَيَْك"), sContent); + CPPUNIT_ASSERT_EQUAL(u"امُ عَلَيَْك"_ustr, sContent); xpath = "string(//draw:frame[last()]/draw:text-box/text:p/text:span)"; sContent = getXPathContent(pXmlDoc2, xpath).replaceAll("\n\n", " ").replaceAll("\n", ""); - CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput2.getStr(), OUString(u"中文测试,中文"), sContent); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput2.getStr(), u"中文测试,中文"_ustr, sContent); #endif } diff --git a/sdext/source/pdfimport/inc/contentsink.hxx b/sdext/source/pdfimport/inc/contentsink.hxx index 5f1517e8c4c2..44f609c3caaa 100644 --- a/sdext/source/pdfimport/inc/contentsink.hxx +++ b/sdext/source/pdfimport/inc/contentsink.hxx @@ -65,7 +65,7 @@ namespace pdfi FontAttributes() : familyName(), - fontWeight(u"normal"), + fontWeight(u"normal"_ustr), isItalic(false), isUnderline(false), isOutline(false), diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx index c1fa22d19100..58a55451a379 100644 --- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx +++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx @@ -719,7 +719,7 @@ void DrawXmlOptimizer::optimizeTextElements(Element& rParent) { tempStr = ::comphelper::string::reverseCodePoints(tempStr); pCur->Text.append(tempStr); - tempStr = u""; + tempStr = u""_ustr; } bNeedReverse = false; } diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index 46a85a753854..7967a74a67cf 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -57,7 +57,7 @@ namespace pdfi { FontAttributes aDefFont; aDefFont.familyName = "Helvetica"; - aDefFont.fontWeight = u"normal"; + aDefFont.fontWeight = u"normal"_ustr; aDefFont.isItalic = false; aDefFont.size = 10*PDFI_OUTDEV_RESOLUTION/72; m_aIdToFont.insert({0, aDefFont}); @@ -151,7 +151,7 @@ void PDFIProcessor::setFont( const FontAttributes& i_rFont ) // Convert to bold instead if the stroke color is the same as the fill color, // otherwise it should be outline. if (getCurrentContext().LineColor == getCurrentContext().FillColor) - aChangedFont.fontWeight = u"bold"; + aChangedFont.fontWeight = u"bold"_ustr; else aChangedFont.isOutline = true; } diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx index a8331b87bfd2..98d2c9572b9b 100644 --- a/sdext/source/pdfimport/tree/writertreevisiting.cxx +++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx @@ -899,7 +899,7 @@ void WriterXmlOptimizer::optimizeTextElements(Element& rParent) { tempStr = ::comphelper::string::reverseCodePoints(tempStr); pCur->Text.append(tempStr); - tempStr = u""; + tempStr = u""_ustr; } bNeedReverse = false; } diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index f75821788d0f..ad25f85ebc09 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -481,39 +481,39 @@ void LineParser::parseFontFamilyName( FontAttributes& rResult ) SAL_INFO("sdext.pdfimport", rResult.familyName); if (fontAttributesSuffix == u"Heavy" || fontAttributesSuffix == u"Black") { - rResult.fontWeight = u"900"; + rResult.fontWeight = u"900"_ustr; } else if (fontAttributesSuffix == u"ExtraBold" || fontAttributesSuffix == u"UltraBold") { - rResult.fontWeight = u"800"; + rResult.fontWeight = u"800"_ustr; } else if (fontAttributesSuffix == u"Bold") { - rResult.fontWeight = u"bold"; + rResult.fontWeight = u"bold"_ustr; } else if (fontAttributesSuffix == u"Semibold") { - rResult.fontWeight = u"600"; + rResult.fontWeight = u"600"_ustr; } else if (fontAttributesSuffix == u"Medium") { - rResult.fontWeight = u"500"; + rResult.fontWeight = u"500"_ustr; } else if (fontAttributesSuffix == u"Normal" || fontAttributesSuffix == u"Regular" || fontAttributesSuffix == u"Book") { - rResult.fontWeight = u"400"; + rResult.fontWeight = u"400"_ustr; } else if (fontAttributesSuffix == u"Light") { - rResult.fontWeight = u"300"; + rResult.fontWeight = u"300"_ustr; } else if (fontAttributesSuffix == u"ExtraLight" || fontAttributesSuffix == u"UltraLight") { - rResult.fontWeight = u"200"; + rResult.fontWeight = u"200"_ustr; } else if (fontAttributesSuffix == u"Thin") { - rResult.fontWeight = u"100"; + rResult.fontWeight = u"100"_ustr; } if ( (fontAttributesSuffix == "Italic") or (fontAttributesSuffix == "Oblique") ) @@ -573,23 +573,23 @@ void LineParser::readFont() // The font is not yet in the map list - get info and add to map OUString sFontWeight; // font weight name per ODF specifications if (nFontWeight == 0 or nFontWeight == 4) // WeightNotDefined or W400, map to normal font - sFontWeight = u"normal"; + sFontWeight = u"normal"_ustr; else if (nFontWeight == 1) // W100, Thin - sFontWeight = u"100"; + sFontWeight = u"100"_ustr; else if (nFontWeight == 2) // W200, Extra-Light - sFontWeight = u"200"; + sFontWeight = u"200"_ustr; else if (nFontWeight == 3) // W300, Light - sFontWeight = u"300"; + sFontWeight = u"300"_ustr; else if (nFontWeight == 5) // W500, Medium. Is this supported by ODF? - sFontWeight = u"500"; + sFontWeight = u"500"_ustr; else if (nFontWeight == 6) // W600, Semi-Bold - sFontWeight = u"600"; + sFontWeight = u"600"_ustr; else if (nFontWeight == 7) // W700, Bold - sFontWeight = u"bold"; + sFontWeight = u"bold"_ustr; else if (nFontWeight == 8) // W800, Extra-Bold - sFontWeight = u"800"; + sFontWeight = u"800"_ustr; else if (nFontWeight == 9) // W900, Black - sFontWeight = u"900"; + sFontWeight = u"900"_ustr; SAL_INFO("sdext.pdfimport", "Font weight passed from xpdfimport is: " << sFontWeight); FontAttributes aResult( OStringToOUString( aFontName, RTL_TEXTENCODING_UTF8 ), @@ -637,22 +637,22 @@ void LineParser::readFont() // Font weight if (aFontReadResult.GetWeight() == WEIGHT_THIN) - aResult.fontWeight = u"100"; + aResult.fontWeight = u"100"_ustr; else if (aFontReadResult.GetWeight() == WEIGHT_ULTRALIGHT) - aResult.fontWeight = u"200"; + aResult.fontWeight = u"200"_ustr; else if (aFontReadResult.GetWeight() == WEIGHT_LIGHT) - aResult.fontWeight = u"300"; + aResult.fontWeight = u"300"_ustr; else if (aFontReadResult.GetWeight() == WEIGHT_SEMILIGHT) - aResult.fontWeight = u"350"; + aResult.fontWeight = u"350"_ustr; // no need to check "normal" here as this is default in nFontWeight above else if (aFontReadResult.GetWeight() == WEIGHT_SEMIBOLD) - aResult.fontWeight = u"600"; + aResult.fontWeight = u"600"_ustr; else if (aFontReadResult.GetWeight() == WEIGHT_BOLD) - aResult.fontWeight = u"bold"; + aResult.fontWeight = u"bold"_ustr; else if (aFontReadResult.GetWeight() == WEIGHT_ULTRABOLD) - aResult.fontWeight = u"800"; + aResult.fontWeight = u"800"_ustr; else if (aFontReadResult.GetWeight() == WEIGHT_BLACK) - aResult.fontWeight = u"900"; + aResult.fontWeight = u"900"_ustr; SAL_INFO("sdext.pdfimport", aResult.fontWeight); // Italic |