diff options
51 files changed, 356 insertions, 351 deletions
diff --git a/comphelper/qa/string/NaturalStringSortTest.cxx b/comphelper/qa/string/NaturalStringSortTest.cxx index bfdcaff6e13c..32519d7534e6 100644 --- a/comphelper/qa/string/NaturalStringSortTest.cxx +++ b/comphelper/qa/string/NaturalStringSortTest.cxx @@ -47,41 +47,46 @@ public: comphelper::string::NaturalStringSorter aSorter(comphelper::getProcessComponentContext(), aLocale); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+0), aSorter.compare("ABC", "ABC")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare("ABC", "abc")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare("abc", "ABC")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare("alongstring", "alongerstring")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare("alongerstring", "alongstring")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare("Heading 9", "Heading 10")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare("Heading 10", "Heading 9")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare("July, the 4th", "July, the 10th")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare("July, the 10th", "July, the 4th")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare("abc08", "abc010")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare("abc010", "abc08")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+0), aSorter.compare("apple10apple", "apple10apple")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+0), aSorter.compare(u"ABC"_ustr, u"ABC"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare(u"ABC"_ustr, u"abc"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare(u"abc"_ustr, u"ABC"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), + aSorter.compare(u"alongstring"_ustr, u"alongerstring"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), + aSorter.compare(u"alongerstring"_ustr, u"alongstring"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare(u"Heading 9"_ustr, u"Heading 10"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare(u"Heading 10"_ustr, u"Heading 9"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), + aSorter.compare(u"July, the 4th"_ustr, u"July, the 10th"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), + aSorter.compare(u"July, the 10th"_ustr, u"July, the 4th"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare(u"abc08"_ustr, u"abc010"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare(u"abc010"_ustr, u"abc08"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+0), + aSorter.compare(u"apple10apple"_ustr, u"apple10apple"_ustr)); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare("KA1", "KA0")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+0), aSorter.compare("KA1", "KA1")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare("KA1", "KA2")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare("KA50", "KA5")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare("KA50", "KA100")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare(u"KA1"_ustr, u"KA0"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+0), aSorter.compare(u"KA1"_ustr, u"KA1"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare(u"KA1"_ustr, u"KA2"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare(u"KA50"_ustr, u"KA5"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare(u"KA50"_ustr, u"KA100"_ustr)); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare("1", "0")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+0), aSorter.compare("1", "1")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare("1", "2")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare("11", "1")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare(u"1"_ustr, u"0"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+0), aSorter.compare(u"1"_ustr, u"1"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare(u"1"_ustr, u"2"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare(u"11"_ustr, u"1"_ustr)); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare("50", "100")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare("0", "100000")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare(u"50"_ustr, u"100"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare(u"0"_ustr, u"100000"_ustr)); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare("0", "A")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare("A", "0")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare("A", "99")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare(u"0"_ustr, u"A"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare(u"A"_ustr, u"0"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare(u"A"_ustr, u"99"_ustr)); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare("00ABC2", "00ABC1")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare("00ABC1", "00ABC2")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare("00ABC11", "00ABC2")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare("00ABC2", "00ABC11")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare(u"00ABC2"_ustr, u"00ABC1"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare(u"00ABC1"_ustr, u"00ABC2"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(+1), aSorter.compare(u"00ABC11"_ustr, u"00ABC2"_ustr)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aSorter.compare(u"00ABC2"_ustr, u"00ABC11"_ustr)); } CPPUNIT_TEST_SUITE(TestStringNaturalCompare); diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx index ac79148a4c48..93d2965941c9 100644 --- a/comphelper/qa/string/test_string.cxx +++ b/comphelper/qa/string/test_string.cxx @@ -68,7 +68,7 @@ public: void TestString::testDecimalStringToNumber() { - OUString s1("1234"); + OUString s1(u"1234"_ustr); CPPUNIT_ASSERT_EQUAL(sal_uInt32(1234), comphelper::string::decimalStringToNumber(s1)); s1 += u"\u07C6"; CPPUNIT_ASSERT_EQUAL(sal_uInt32(12346), comphelper::string::decimalStringToNumber(s1)); @@ -185,7 +185,7 @@ void TestString::testTokenCount() void TestString::testReverseString() { CPPUNIT_ASSERT_EQUAL(OUString(), comphelper::string::reverseString(u"")); - CPPUNIT_ASSERT_EQUAL(OUString("cba"), comphelper::string::reverseString(u"abc")); + CPPUNIT_ASSERT_EQUAL(u"cba"_ustr, comphelper::string::reverseString(u"abc")); static sal_Unicode const rev[] = {'w', 0xDFFF, 0xDBFF, 'v', 0xDC00, 0xD800, 'u'}; CPPUNIT_ASSERT_EQUAL( OUString(rev, std::size(rev)), @@ -198,7 +198,7 @@ void TestString::testReverseString() void TestString::testReverseCodePoints() { CPPUNIT_ASSERT_EQUAL(OUString(), comphelper::string::reverseCodePoints(u"")); - CPPUNIT_ASSERT_EQUAL(OUString("cba"), comphelper::string::reverseCodePoints(u"abc")); + CPPUNIT_ASSERT_EQUAL(u"cba"_ustr, comphelper::string::reverseCodePoints(u"abc")); CPPUNIT_ASSERT_EQUAL( u"w\U0010FFFFv\U00010000u"_ustr, comphelper::string::reverseCodePoints(u"u\U00010000v\U0010FFFFw")); @@ -212,25 +212,25 @@ void TestString::testSplit() { std::vector<OUString> aRet = ::comphelper::string::split(u"CTRL+ALT+F1", '+'); CPPUNIT_ASSERT_EQUAL(size_t(3), aRet.size()); - CPPUNIT_ASSERT_EQUAL(OUString("CTRL"), aRet[0]); - CPPUNIT_ASSERT_EQUAL(OUString("ALT"), aRet[1]); - CPPUNIT_ASSERT_EQUAL(OUString("F1"), aRet[2]); + CPPUNIT_ASSERT_EQUAL(u"CTRL"_ustr, aRet[0]); + CPPUNIT_ASSERT_EQUAL(u"ALT"_ustr, aRet[1]); + CPPUNIT_ASSERT_EQUAL(u"F1"_ustr, aRet[2]); } void TestString::testRemoveAny() { using namespace ::comphelper::string; - OUString in("abcAAAbbC"); + OUString in(u"abcAAAbbC"_ustr); sal_Unicode const test1 [] = { 'a', 0 }; - CPPUNIT_ASSERT_EQUAL(OUString("bcAAAbbC"), removeAny(in, test1)); + CPPUNIT_ASSERT_EQUAL(u"bcAAAbbC"_ustr, removeAny(in, test1)); sal_Unicode const test2 [] = { 0 }; CPPUNIT_ASSERT_EQUAL(in, removeAny(in, test2)); sal_Unicode const test3 [] = { 'A', 0 }; - CPPUNIT_ASSERT_EQUAL(OUString("abcbbC"), removeAny(in, test3)); + CPPUNIT_ASSERT_EQUAL(u"abcbbC"_ustr, removeAny(in, test3)); sal_Unicode const test4 [] = { 'A', 'a', 0 }; - CPPUNIT_ASSERT_EQUAL(OUString("bcbbC"), removeAny(in, test4)); + CPPUNIT_ASSERT_EQUAL(u"bcbbC"_ustr, removeAny(in, test4)); sal_Unicode const test5 [] = { 'C', 0 }; - CPPUNIT_ASSERT_EQUAL(OUString("abcAAAbb"), removeAny(in, test5)); + CPPUNIT_ASSERT_EQUAL(u"abcAAAbb"_ustr, removeAny(in, test5)); sal_Unicode const test6 [] = { 'X', 0 }; CPPUNIT_ASSERT_EQUAL(in, removeAny(in, test6)); sal_Unicode const test7 [] = { 'A', 'B', 'C', 'a', 'b', 'c', 0 }; diff --git a/comphelper/qa/unit/base64_test.cxx b/comphelper/qa/unit/base64_test.cxx index dc637f63f709..f589e1809dd0 100644 --- a/comphelper/qa/unit/base64_test.cxx +++ b/comphelper/qa/unit/base64_test.cxx @@ -53,17 +53,17 @@ void Base64Test::testBase64Encode() inputSequence = { 0, 0, 0, 0, 0, 1, 2, 3 }; comphelper::Base64::encode(aBuffer, inputSequence); - CPPUNIT_ASSERT_EQUAL(OUString("AAAAAAABAgM="), aBuffer.toString()); + CPPUNIT_ASSERT_EQUAL(u"AAAAAAABAgM="_ustr, aBuffer.toString()); aBuffer.setLength(0); inputSequence = { 5, 2, 3, 0, 0, 1, 2, 3 }; comphelper::Base64::encode(aBuffer, inputSequence); - CPPUNIT_ASSERT_EQUAL(OUString("BQIDAAABAgM="), aBuffer.toString()); + CPPUNIT_ASSERT_EQUAL(u"BQIDAAABAgM="_ustr, aBuffer.toString()); aBuffer.setLength(0); inputSequence = { sal_Int8(sal_uInt8(200)), 31, 77, 111, 0, 1, 2, 3 }; comphelper::Base64::encode(aBuffer, inputSequence); - CPPUNIT_ASSERT_EQUAL(OUString("yB9NbwABAgM="), aBuffer.makeStringAndClear()); + CPPUNIT_ASSERT_EQUAL(u"yB9NbwABAgM="_ustr, aBuffer.makeStringAndClear()); } void Base64Test::testBase64Decode() diff --git a/comphelper/qa/unit/propertyvalue.cxx b/comphelper/qa/unit/propertyvalue.cxx index 4470b28f503a..877a964478ac 100644 --- a/comphelper/qa/unit/propertyvalue.cxx +++ b/comphelper/qa/unit/propertyvalue.cxx @@ -34,14 +34,14 @@ class MakePropertyValueTest : public CppUnit::TestFixture void testLvalue() { sal_Int32 const i = 123; - auto const v = comphelper::makePropertyValue("test", i); + auto const v = comphelper::makePropertyValue(u"test"_ustr, i); CPPUNIT_ASSERT_EQUAL(cppu::UnoType<sal_Int32>::get(), v.Value.getValueType()); CPPUNIT_ASSERT_EQUAL(sal_Int32(123), *o3tl::doAccess<sal_Int32>(v.Value)); } void testRvalue() { - auto const v = comphelper::makePropertyValue("test", sal_Int32(456)); + auto const v = comphelper::makePropertyValue(u"test"_ustr, sal_Int32(456)); CPPUNIT_ASSERT_EQUAL(cppu::UnoType<sal_Int32>::get(), v.Value.getValueType()); CPPUNIT_ASSERT_EQUAL(sal_Int32(456), *o3tl::doAccess<sal_Int32>(v.Value)); } @@ -52,7 +52,7 @@ class MakePropertyValueTest : public CppUnit::TestFixture { bool b : 1; } s = { false }; - auto const v = comphelper::makePropertyValue("test", s.b); + auto const v = comphelper::makePropertyValue(u"test"_ustr, s.b); CPPUNIT_ASSERT_EQUAL(cppu::UnoType<bool>::get(), v.Value.getValueType()); CPPUNIT_ASSERT_EQUAL(false, *o3tl::doAccess<bool>(v.Value)); } @@ -106,21 +106,21 @@ class MakePropertyValueTest : public CppUnit::TestFixture )json"_ostr); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aRet.size()); beans::PropertyValue aFirst = aRet[0]; - CPPUNIT_ASSERT_EQUAL(OUString("FieldType"), aFirst.Name); - CPPUNIT_ASSERT_EQUAL(OUString("vnd.oasis.opendocument.field.UNHANDLED"), + CPPUNIT_ASSERT_EQUAL(u"FieldType"_ustr, aFirst.Name); + CPPUNIT_ASSERT_EQUAL(u"vnd.oasis.opendocument.field.UNHANDLED"_ustr, aFirst.Value.get<OUString>()); beans::PropertyValue aSecond = aRet[1]; - CPPUNIT_ASSERT_EQUAL(OUString("FieldCommandPrefix"), aSecond.Name); - CPPUNIT_ASSERT_EQUAL(OUString("ADDIN ZOTERO_ITEM"), aSecond.Value.get<OUString>()); + CPPUNIT_ASSERT_EQUAL(u"FieldCommandPrefix"_ustr, aSecond.Name); + CPPUNIT_ASSERT_EQUAL(u"ADDIN ZOTERO_ITEM"_ustr, aSecond.Value.get<OUString>()); beans::PropertyValue aThird = aRet[2]; - CPPUNIT_ASSERT_EQUAL(OUString("Fields"), aThird.Name); + CPPUNIT_ASSERT_EQUAL(u"Fields"_ustr, aThird.Name); uno::Sequence<uno::Sequence<beans::PropertyValue>> aSeqs; aThird.Value >>= aSeqs; CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), aSeqs.getLength()); uno::Sequence<beans::PropertyValue> aFirstSeq = aSeqs[0]; - CPPUNIT_ASSERT_EQUAL(OUString("FieldType"), aFirstSeq[0].Name); - CPPUNIT_ASSERT_EQUAL(OUString("FieldCommand"), aFirstSeq[1].Name); - CPPUNIT_ASSERT_EQUAL(OUString("ADDIN ZOTERO_ITEM new command 1"), + CPPUNIT_ASSERT_EQUAL(u"FieldType"_ustr, aFirstSeq[0].Name); + CPPUNIT_ASSERT_EQUAL(u"FieldCommand"_ustr, aFirstSeq[1].Name); + CPPUNIT_ASSERT_EQUAL(u"ADDIN ZOTERO_ITEM new command 1"_ustr, aFirstSeq[1].Value.get<OUString>()); } }; diff --git a/comphelper/qa/unit/syntaxhighlighttest.cxx b/comphelper/qa/unit/syntaxhighlighttest.cxx index eab382b85a65..e838c0c9886d 100644 --- a/comphelper/qa/unit/syntaxhighlighttest.cxx +++ b/comphelper/qa/unit/syntaxhighlighttest.cxx @@ -94,7 +94,7 @@ void SyntaxHighlightTest::testBasicEmptyCommentNewline() { void SyntaxHighlightTest::testBasic() { - OUString aBasicString(" if Mid(sText,iRun,1 )<> \" \" then Mid( sText ,iRun, 1, Chr( 1 + Asc( Mid(sText,iRun,1 )) ) '"); + OUString aBasicString(u" if Mid(sText,iRun,1 )<> \" \" then Mid( sText ,iRun, 1, Chr( 1 + Asc( Mid(sText,iRun,1 )) ) '"_ustr); std::vector<HighlightPortion> aPortions; SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions( diff --git a/comphelper/qa/unit/test_hash.cxx b/comphelper/qa/unit/test_hash.cxx index 64815ee56dc8..dc96a03318ef 100644 --- a/comphelper/qa/unit/test_hash.cxx +++ b/comphelper/qa/unit/test_hash.cxx @@ -120,9 +120,9 @@ void TestHash::testSHA512_NoSaltNoSpin() // tdf#104250 https://bugs.documentfoundation.org/attachment.cgi?id=129104 void TestHash::testSHA512_saltspin() { - const OUString aHash = comphelper::DocPasswordHelper::GetOoxHashAsBase64( "pwd", u"876MLoKTq42+/DLp415iZQ==", 100000, + const OUString aHash = comphelper::DocPasswordHelper::GetOoxHashAsBase64( u"pwd"_ustr, u"876MLoKTq42+/DLp415iZQ==", 100000, comphelper::Hash::IterCount::APPEND, u"SHA-512"); - CPPUNIT_ASSERT_EQUAL(OUString("5l3mgNHXpWiFaBPv5Yso1Xd/UifWvQWmlDnl/hsCYbFT2sJCzorjRmBCQ/3qeDu6Q/4+GIE8a1DsdaTwYh1q2g=="), aHash); + CPPUNIT_ASSERT_EQUAL(u"5l3mgNHXpWiFaBPv5Yso1Xd/UifWvQWmlDnl/hsCYbFT2sJCzorjRmBCQ/3qeDu6Q/4+GIE8a1DsdaTwYh1q2g=="_ustr, aHash); } CPPUNIT_TEST_SUITE_REGISTRATION(TestHash); diff --git a/comphelper/qa/unit/types_test.cxx b/comphelper/qa/unit/types_test.cxx index c69b07199127..d647748e06be 100644 --- a/comphelper/qa/unit/types_test.cxx +++ b/comphelper/qa/unit/types_test.cxx @@ -83,10 +83,10 @@ void TypesTest::testGetFloat() void TypesTest::testGetString() { - CPPUNIT_ASSERT_EQUAL(OUString("1337"), ::comphelper::getString(uno::Any(OUString("1337")))); + CPPUNIT_ASSERT_EQUAL(u"1337"_ustr, ::comphelper::getString(uno::Any(u"1337"_ustr))); uno::Any aValue; - CPPUNIT_ASSERT_EQUAL(OUString(""), ::comphelper::getString(aValue)); + CPPUNIT_ASSERT_EQUAL(u""_ustr, ::comphelper::getString(aValue)); } CPPUNIT_TEST_SUITE_REGISTRATION(TypesTest); diff --git a/comphelper/qa/unit/variadictemplates.cxx b/comphelper/qa/unit/variadictemplates.cxx index 6b62204f487c..48ed59faab78 100644 --- a/comphelper/qa/unit/variadictemplates.cxx +++ b/comphelper/qa/unit/variadictemplates.cxx @@ -40,7 +40,7 @@ void extract( { if (nArg >= seq.getLength()) { throw ::com::sun::star::lang::IllegalArgumentException( - "No such argument available!", + u"No such argument available!"_ustr, xErrorContext, static_cast<sal_Int16>(nArg) ); } if (! fromAny(seq[nArg], &v)) { @@ -87,7 +87,7 @@ void unwrapArgsBaseline( } void VariadicTemplatesTest::testUnwrapArgs() { - OUString tmp1 = "Test1"; + OUString tmp1 = u"Test1"_ustr; sal_Int32 tmp2 = 42; sal_uInt32 tmp3 = 42; ::com::sun::star::uno::Any tmp6( @@ -100,10 +100,10 @@ void VariadicTemplatesTest::testUnwrapArgs() { tmp3 ); ::com::sun::star::uno::Any tmp9( - OUString("Test2") + u"Test2"_ustr ); ::std::optional< ::com::sun::star::uno::Any > tmp10( - OUString("Test3") + u"Test3"_ustr ); ::std::optional< ::com::sun::star::uno::Any > tmp11( tmp1 @@ -147,11 +147,11 @@ void VariadicTemplatesTest::testUnwrapArgs() { CPPUNIT_ASSERT_EQUAL( static_cast< short >( 5 ), err.ArgumentPosition ); } - OUString test1( "Test2" ); - OUString test2( "Test2" ); - OUString test3( "Test3" ); - OUString test4( "Test4" ); - OUString test5( "Test5" ); + OUString test1( u"Test2"_ustr ); + OUString test2( u"Test2"_ustr ); + OUString test3( u"Test3"_ustr ); + OUString test4( u"Test4"_ustr ); + OUString test5( u"Test5"_ustr ); try { ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > seq( diff --git a/comphelper/source/compare/AnyCompareFactory.cxx b/comphelper/source/compare/AnyCompareFactory.cxx index 40e5f0806a95..785fc9005707 100644 --- a/comphelper/source/compare/AnyCompareFactory.cxx +++ b/comphelper/source/compare/AnyCompareFactory.cxx @@ -112,7 +112,7 @@ void SAL_CALL AnyCompareFactory::initialize( const Sequence< Any >& aArguments ) OUString SAL_CALL AnyCompareFactory::getImplementationName( ) { - return "AnyCompareFactory"; + return u"AnyCompareFactory"_ustr; } sal_Bool SAL_CALL AnyCompareFactory::supportsService( const OUString& ServiceName ) @@ -122,7 +122,7 @@ sal_Bool SAL_CALL AnyCompareFactory::supportsService( const OUString& ServiceNam Sequence< OUString > SAL_CALL AnyCompareFactory::getSupportedServiceNames( ) { - return { "com.sun.star.ucb.AnyCompareFactory" }; + return { u"com.sun.star.ucb.AnyCompareFactory"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * diff --git a/comphelper/source/container/IndexedPropertyValuesContainer.cxx b/comphelper/source/container/IndexedPropertyValuesContainer.cxx index f5b7358d64c4..9642b5098aa9 100644 --- a/comphelper/source/container/IndexedPropertyValuesContainer.cxx +++ b/comphelper/source/container/IndexedPropertyValuesContainer.cxx @@ -44,7 +44,7 @@ void SAL_CALL IndexedPropertyValuesContainer::insertByIndex( sal_Int32 nIndex, c uno::Sequence<beans::PropertyValue> aProps; if (!(aElement >>= aProps)) - throw lang::IllegalArgumentException("element is not beans::PropertyValue", static_cast<cppu::OWeakObject*>(this), 2); + throw lang::IllegalArgumentException(u"element is not beans::PropertyValue"_ustr, static_cast<cppu::OWeakObject*>(this), 2); if (nSize == nIndex) maProperties.push_back(aProps); else @@ -68,7 +68,7 @@ void SAL_CALL IndexedPropertyValuesContainer::replaceByIndex( sal_Int32 nIndex, uno::Sequence<beans::PropertyValue> aProps; if (!(aElement >>= aProps)) - throw lang::IllegalArgumentException("element is not beans::PropertyValue", static_cast<cppu::OWeakObject*>(this), 2); + throw lang::IllegalArgumentException(u"element is not beans::PropertyValue"_ustr, static_cast<cppu::OWeakObject*>(this), 2); maProperties[nIndex] = aProps; } @@ -101,7 +101,7 @@ sal_Bool SAL_CALL IndexedPropertyValuesContainer::hasElements( ) //XServiceInfo OUString SAL_CALL IndexedPropertyValuesContainer::getImplementationName( ) { - return "IndexedPropertyValuesContainer"; + return u"IndexedPropertyValuesContainer"_ustr; } sal_Bool SAL_CALL IndexedPropertyValuesContainer::supportsService( const OUString& ServiceName ) @@ -111,7 +111,7 @@ sal_Bool SAL_CALL IndexedPropertyValuesContainer::supportsService( const OUStrin css::uno::Sequence< OUString > SAL_CALL IndexedPropertyValuesContainer::getSupportedServiceNames( ) { - return { "com.sun.star.document.IndexedPropertyValues" }; + return { u"com.sun.star.document.IndexedPropertyValues"_ustr }; } } // namespace comphelper diff --git a/comphelper/source/container/NamedPropertyValuesContainer.cxx b/comphelper/source/container/NamedPropertyValuesContainer.cxx index a44837f11700..510931cf57dd 100644 --- a/comphelper/source/container/NamedPropertyValuesContainer.cxx +++ b/comphelper/source/container/NamedPropertyValuesContainer.cxx @@ -78,7 +78,7 @@ void SAL_CALL NamedPropertyValuesContainer::insertByName( const OUString& aName, uno::Sequence<beans::PropertyValue> aProps; if( !(aElement >>= aProps ) ) - throw lang::IllegalArgumentException("element is not beans::PropertyValue", static_cast<cppu::OWeakObject*>(this), 2); + throw lang::IllegalArgumentException(u"element is not beans::PropertyValue"_ustr, static_cast<cppu::OWeakObject*>(this), 2); maProperties.emplace( aName, aProps ); } @@ -101,7 +101,7 @@ void SAL_CALL NamedPropertyValuesContainer::replaceByName( const OUString& aName uno::Sequence<beans::PropertyValue> aProps; if( !(aElement >>= aProps) ) - throw lang::IllegalArgumentException("element is not beans::PropertyValue", static_cast<cppu::OWeakObject*>(this), 2); + throw lang::IllegalArgumentException(u"element is not beans::PropertyValue"_ustr, static_cast<cppu::OWeakObject*>(this), 2); (*aIter).second = aProps; } @@ -145,7 +145,7 @@ sal_Bool SAL_CALL NamedPropertyValuesContainer::hasElements( ) //XServiceInfo OUString SAL_CALL NamedPropertyValuesContainer::getImplementationName( ) { - return "NamedPropertyValuesContainer"; + return u"NamedPropertyValuesContainer"_ustr; } sal_Bool SAL_CALL NamedPropertyValuesContainer::supportsService( const OUString& ServiceName ) @@ -155,7 +155,7 @@ sal_Bool SAL_CALL NamedPropertyValuesContainer::supportsService( const OUString& css::uno::Sequence< OUString > SAL_CALL NamedPropertyValuesContainer::getSupportedServiceNames( ) { - return { "com.sun.star.document.NamedPropertyValues" }; + return { u"com.sun.star.document.NamedPropertyValues"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index 56b50c964823..1bbf7b847fe4 100644 --- a/comphelper/source/container/embeddedobjectcontainer.cxx +++ b/comphelper/source/container/embeddedobjectcontainer.cxx @@ -81,17 +81,17 @@ const uno::Reference < embed::XStorage >& EmbedImpl::GetReplacements() try { mxImageStorage = mxStorage->openStorageElement( - "ObjectReplacements", embed::ElementModes::READWRITE ); + u"ObjectReplacements"_ustr, embed::ElementModes::READWRITE ); } catch (const uno::Exception&) { mxImageStorage = mxStorage->openStorageElement( - "ObjectReplacements", embed::ElementModes::READ ); + u"ObjectReplacements"_ustr, embed::ElementModes::READ ); } } if ( !mxImageStorage.is() ) - throw io::IOException("No ObjectReplacements"); + throw io::IOException(u"No ObjectReplacements"_ustr); return mxImageStorage; } @@ -148,7 +148,7 @@ bool EmbeddedObjectContainer::CommitImageSubStorage() { // get the open mode from the parent storage sal_Int32 nMode = 0; - uno::Any aAny = xSet->getPropertyValue("OpenMode"); + uno::Any aAny = xSet->getPropertyValue(u"OpenMode"_ustr); if ( aAny >>= nMode ) bReadOnlyMode = !(nMode & embed::ElementModes::WRITE ); } // if ( xSet.is() ) @@ -314,7 +314,7 @@ uno::Reference<embed::XEmbeddedObject> EmbeddedObjectContainer::Get_Impl( { // get the open mode from the parent storage sal_Int32 nMode = 0; - uno::Any aAny = xSet->getPropertyValue("OpenMode"); + uno::Any aAny = xSet->getPropertyValue(u"OpenMode"_ustr); if ( aAny >>= nMode ) bReadOnlyMode = !(nMode & embed::ElementModes::WRITE ); } @@ -340,7 +340,7 @@ uno::Reference<embed::XEmbeddedObject> EmbeddedObjectContainer::Get_Impl( } uno::Sequence< beans::PropertyValue > aMediaDescr{ comphelper::makePropertyValue( - "ReadOnly", bReadOnlyMode) }; + u"ReadOnly"_ustr, bReadOnlyMode) }; xObj.set( xFactory->createInstanceInitFromEntry( pImpl->mxStorage, rName, aMediaDescr, aObjDescr ), uno::UNO_QUERY ); @@ -557,8 +557,8 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::InsertEmbedde // it is correct so for now, but what if somebody introduces a new stream based embedded object? // Probably introducing of such an object must be restricted ( a storage must be used! ). uno::Reference< beans::XPropertySet > xProps( xNewStream, uno::UNO_QUERY_THROW ); - xProps->setPropertyValue("MediaType", - uno::Any( OUString( "application/vnd.sun.star.oleobject" ) ) ); + xProps->setPropertyValue(u"MediaType"_ustr, + uno::Any( u"application/vnd.sun.star.oleobject"_ustr ) ); } catch (uno::Exception const& e) { @@ -631,7 +631,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::InsertEmbedde { uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create(::comphelper::getProcessComponentContext()); uno::Sequence< beans::PropertyValue > aObjDescr{ comphelper::makePropertyValue( - "Parent", pImpl->m_xModel.get()) }; + u"Parent"_ustr, pImpl->m_xModel.get()) }; xObj.set( xFactory->createInstanceLink( pImpl->mxStorage, rNewName, aMedium, aObjDescr ), uno::UNO_QUERY ); uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY ); @@ -717,9 +717,9 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() ); uno::Sequence< beans::PropertyValue > aMediaDescr{ comphelper::makePropertyValue( - "URL", aURL) }; + u"URL"_ustr, aURL) }; uno::Sequence< beans::PropertyValue > aObjDescr{ comphelper::makePropertyValue( - "Parent", pImpl->m_xModel.get()) }; + u"Parent"_ustr, pImpl->m_xModel.get()) }; xResult.set(xCreator->createInstanceLink( pImpl->mxStorage, rName, @@ -741,7 +741,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() ); uno::Sequence< beans::PropertyValue > aObjDescr{ comphelper::makePropertyValue( - "Parent", pImpl->m_xModel.get()) }; + u"Parent"_ustr, pImpl->m_xModel.get()) }; xResult.set(xCreator->createInstanceInitNew( xObj->getClassID(), xObj->getClassName(), @@ -1034,7 +1034,7 @@ uno::Reference < io::XInputStream > EmbeddedObjectContainer::GetGraphicStream( c uno::Reference < beans::XPropertySet > xSet( xStream, uno::UNO_QUERY ); if ( xSet.is() ) { - uno::Any aAny = xSet->getPropertyValue("MediaType"); + uno::Any aAny = xSet->getPropertyValue(u"MediaType"_ustr); aAny >>= *pMediaType; } } @@ -1071,11 +1071,11 @@ bool EmbeddedObjectContainer::InsertGraphicStream( const css::uno::Reference < c uno::Reference< beans::XPropertySet > xPropSet( xGraphicStream, uno::UNO_QUERY_THROW ); - xPropSet->setPropertyValue("UseCommonStoragePasswordEncryption", + xPropSet->setPropertyValue(u"UseCommonStoragePasswordEncryption"_ustr, uno::Any( true ) ); - xPropSet->setPropertyValue("MediaType", uno::Any(rMediaType) ); + xPropSet->setPropertyValue(u"MediaType"_ustr, uno::Any(rMediaType) ); - xPropSet->setPropertyValue("Compressed", + xPropSet->setPropertyValue(u"Compressed"_ustr, uno::Any( true ) ); } catch (const uno::Exception&) @@ -1095,9 +1095,9 @@ bool EmbeddedObjectContainer::InsertGraphicStreamDirectly( const css::uno::Refer // store it into the subfolder uno::Sequence< beans::PropertyValue > aProps{ - comphelper::makePropertyValue("MediaType", rMediaType), - comphelper::makePropertyValue("UseCommonStoragePasswordEncryption", true), - comphelper::makePropertyValue("Compressed", true) + comphelper::makePropertyValue(u"MediaType"_ustr, rMediaType), + comphelper::makePropertyValue(u"UseCommonStoragePasswordEncryption"_ustr, true), + comphelper::makePropertyValue(u"Compressed"_ustr, true) }; if ( xReplacement->hasByName( rObjectName ) ) @@ -1135,7 +1135,7 @@ namespace { try { uno::Reference< embed::XStorage > xPictures = xDocStor->openStorageElement( - "Pictures", + u"Pictures"_ustr, embed::ElementModes::READWRITE ); uno::Reference< io::XStream > xObjReplStr = xPictures->openStreamElement( aStreamName, @@ -1271,7 +1271,7 @@ bool EmbeddedObjectContainer::StoreAsChildren(bool _bOasisFormat,bool _bCreateEm try { // the substorage still can not be locked by the embedded object container - OUString aObjReplElement( "ObjectReplacements" ); + OUString aObjReplElement( u"ObjectReplacements"_ustr ); if ( _xStorage->hasByName( aObjReplElement ) && _xStorage->isStorageElement( aObjReplElement ) ) _xStorage->removeElement( aObjReplElement ); } @@ -1395,7 +1395,7 @@ bool EmbeddedObjectContainer::StoreChildren(bool _bOasisFormat,bool _bObjectsOnl try { ReleaseImageSubStorage(); - OUString aObjReplElement( "ObjectReplacements" ); + OUString aObjReplElement( u"ObjectReplacements"_ustr ); if ( !_bOasisFormat && pImpl->mxStorage->hasByName( aObjReplElement ) && pImpl->mxStorage->isStorageElement( aObjReplElement ) ) pImpl->mxStorage->removeElement( aObjReplElement ); } diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx index 031bd86c3aee..87192678fc20 100644 --- a/comphelper/source/container/enumerablemap.cxx +++ b/comphelper/source/container/enumerablemap.cxx @@ -326,31 +326,31 @@ namespace comphelper sal_Int32 nArgumentCount = _arguments.getLength(); if ( ( nArgumentCount != 2 ) && ( nArgumentCount != 3 ) ) - throw IllegalArgumentException("wrong number of args", static_cast<cppu::OWeakObject*>(this), 1); + throw IllegalArgumentException(u"wrong number of args"_ustr, static_cast<cppu::OWeakObject*>(this), 1); Type aKeyType, aValueType; if ( !( _arguments[0] >>= aKeyType ) ) - throw IllegalArgumentException("com.sun.star.uno.Type expected.", *this, 1 ); + throw IllegalArgumentException(u"com.sun.star.uno.Type expected."_ustr, *this, 1 ); if ( !( _arguments[1] >>= aValueType ) ) - throw IllegalArgumentException("com.sun.star.uno.Type expected.", *this, 2 ); + throw IllegalArgumentException(u"com.sun.star.uno.Type expected."_ustr, *this, 2 ); Sequence< Pair< Any, Any > > aInitialValues; bool bMutable = true; if ( nArgumentCount == 3 ) { if ( !( _arguments[2] >>= aInitialValues ) ) - throw IllegalArgumentException("[]com.sun.star.beans.Pair<any,any> expected.", *this, 2 ); + throw IllegalArgumentException(u"[]com.sun.star.beans.Pair<any,any> expected."_ustr, *this, 2 ); bMutable = false; } // for the value, anything is allowed, except VOID if ( ( aValueType.getTypeClass() == TypeClass_VOID ) || ( aValueType.getTypeClass() == TypeClass_UNKNOWN ) ) - throw IllegalTypeException("Unsupported value type.", *this ); + throw IllegalTypeException(u"Unsupported value type."_ustr, *this ); // create the comparator for the KeyType, and throw if the type is not supported std::unique_ptr< IKeyPredicateLess > pComparator( getStandardLessPredicate( aKeyType, nullptr ) ); if (!pComparator) - throw IllegalTypeException("Unsupported key type.", *this ); + throw IllegalTypeException(u"Unsupported key type."_ustr, *this ); // init members m_aData.m_aKeyType = aKeyType; @@ -465,7 +465,7 @@ namespace comphelper if ( _keyOrValue >>= nValue ) if ( std::isnan( nValue ) ) throw IllegalArgumentException( - "NaN (not-a-number) not supported by this implementation.", + u"NaN (not-a-number) not supported by this implementation."_ustr, *const_cast< EnumerableMap* >( this ), 0 ); // (note that the case of _key not containing a float/double value is handled in the // respective IKeyPredicateLess implementation, so there's no need to handle this here.) @@ -477,7 +477,7 @@ namespace comphelper { if ( !_key.hasValue() ) throw IllegalArgumentException( - "NULL keys not supported by this implementation.", + u"NULL keys not supported by this implementation."_ustr, *const_cast< EnumerableMap* >( this ), 0 ); impl_checkNaN_throw( _key, m_aData.m_aKeyType ); @@ -488,7 +488,7 @@ namespace comphelper { if ( !m_aData.m_bMutable ) throw NoSupportException( - "The map is immutable.", + u"The map is immutable."_ustr, *const_cast< EnumerableMap* >( this ) ); } @@ -637,7 +637,7 @@ namespace comphelper OUString SAL_CALL EnumerableMap::getImplementationName( ) { - return "org.openoffice.comp.comphelper.EnumerableMap"; + return u"org.openoffice.comp.comphelper.EnumerableMap"_ustr; } sal_Bool SAL_CALL EnumerableMap::supportsService( const OUString& _serviceName ) @@ -648,7 +648,7 @@ namespace comphelper Sequence< OUString > SAL_CALL EnumerableMap::getSupportedServiceNames( ) { - return { "com.sun.star.container.EnumerableMap" }; + return { u"com.sun.star.container.EnumerableMap"_ustr }; } bool MapEnumerator::hasMoreElements() @@ -664,7 +664,7 @@ namespace comphelper if ( m_disposed ) throw DisposedException( OUString(), m_rParent ); if ( m_mapPos == m_rMapData.m_pValues->end() ) - throw NoSuchElementException("No more elements.", m_rParent ); + throw NoSuchElementException(u"No more elements."_ustr, m_rParent ); Any aNextElement; switch ( m_eType ) diff --git a/comphelper/source/container/namecontainer.cxx b/comphelper/source/container/namecontainer.cxx index cfa958a0272b..7e70526ec053 100644 --- a/comphelper/source/container/namecontainer.cxx +++ b/comphelper/source/container/namecontainer.cxx @@ -85,7 +85,7 @@ void SAL_CALL NameContainer::insertByName( const OUString& aName, const Any& aEl throw ElementExistException(); if( aElement.getValueType() != maType ) - throw IllegalArgumentException("element is wrong type", static_cast<cppu::OWeakObject*>(this), 2); + throw IllegalArgumentException(u"element is wrong type"_ustr, static_cast<cppu::OWeakObject*>(this), 2); maProperties.emplace(aName,aElement); } @@ -112,7 +112,7 @@ void SAL_CALL NameContainer::replaceByName( const OUString& aName, const Any& aE throw NoSuchElementException(); if( aElement.getValueType() != maType ) - throw IllegalArgumentException("element is wrong type", static_cast<cppu::OWeakObject*>(this), 2); + throw IllegalArgumentException(u"element is wrong type"_ustr, static_cast<cppu::OWeakObject*>(this), 2); (*aIter).second = aElement; } diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx index af2c7bbc3edb..4cc4dcf19d58 100644 --- a/comphelper/source/eventattachermgr/eventattachermgr.cxx +++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx @@ -355,7 +355,7 @@ ImplEventAttacherManager::ImplEventAttacherManager( const Reference< XIntrospect if ( rContext.is() ) { Reference< XInterface > xIFace( rContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.script.EventAttacher", rContext) ); + u"com.sun.star.script.EventAttacher"_ustr, rContext) ); if ( xIFace.is() ) { xAttacher.set( xIFace, UNO_QUERY ); @@ -384,7 +384,7 @@ Reference< XIdlReflection > ImplEventAttacherManager::getReflection(std::unique_ std::deque< AttacherIndex_Impl >::iterator ImplEventAttacherManager::implCheckIndex( sal_Int32 _nIndex ) { if ( (_nIndex < 0) || (o3tl::make_unsigned(_nIndex) >= aIndex.size()) ) - throw IllegalArgumentException("wrong index", static_cast<cppu::OWeakObject*>(this), 1); + throw IllegalArgumentException(u"wrong index"_ustr, static_cast<cppu::OWeakObject*>(this), 1); std::deque<AttacherIndex_Impl>::iterator aIt = aIndex.begin() + _nIndex; return aIt; @@ -519,7 +519,7 @@ void SAL_CALL ImplEventAttacherManager::insertEntry(sal_Int32 nIndex) { std::unique_lock l(m_aMutex); if( nIndex < 0 ) - throw IllegalArgumentException("negative index", static_cast<cppu::OWeakObject*>(this), 1); + throw IllegalArgumentException(u"negative index"_ustr, static_cast<cppu::OWeakObject*>(this), 1); insertEntry(l, nIndex); } @@ -558,7 +558,7 @@ void SAL_CALL ImplEventAttacherManager::attach(sal_Int32 nIndex, const Reference { std::unique_lock l(m_aMutex); if( nIndex < 0 || !xObject.is() ) - throw IllegalArgumentException("negative index, or null object", static_cast<cppu::OWeakObject*>(this), -1); + throw IllegalArgumentException(u"negative index, or null object"_ustr, static_cast<cppu::OWeakObject*>(this), -1); attach(l, nIndex, xObject, Helper); } @@ -619,7 +619,7 @@ void SAL_CALL ImplEventAttacherManager::detach(sal_Int32 nIndex, const Reference std::unique_lock l(m_aMutex); //return; if( nIndex < 0 || o3tl::make_unsigned(nIndex) >= aIndex.size() || !xObject.is() ) - throw IllegalArgumentException("bad index or null object", static_cast<cppu::OWeakObject*>(this), 1); + throw IllegalArgumentException(u"bad index or null object"_ustr, static_cast<cppu::OWeakObject*>(this), 1); detach(l, nIndex, xObject); } @@ -666,7 +666,7 @@ void SAL_CALL ImplEventAttacherManager::removeScriptListener(const Reference< XS // Methods of XPersistObject OUString SAL_CALL ImplEventAttacherManager::getServiceName() { - return "com.sun.star.uno.script.EventAttacherManager"; + return u"com.sun.star.uno.script.EventAttacherManager"_ustr; } void SAL_CALL ImplEventAttacherManager::write(const Reference< XObjectOutputStream >& OutStream) diff --git a/comphelper/source/misc/anycompare.cxx b/comphelper/source/misc/anycompare.cxx index 8a23877239be..79d3864535c0 100644 --- a/comphelper/source/misc/anycompare.cxx +++ b/comphelper/source/misc/anycompare.cxx @@ -66,7 +66,7 @@ namespace comphelper if ( !( _lhs >>= lhs ) || !( _rhs >>= rhs ) ) - throw css::lang::IllegalArgumentException("bad ordering", css::uno::Reference<css::uno::XInterface>(), -1); + throw css::lang::IllegalArgumentException(u"bad ordering"_ustr, css::uno::Reference<css::uno::XInterface>(), -1); // FIXME Timezone? if ( lhs.Year < rhs.Year ) @@ -94,7 +94,7 @@ namespace comphelper if ( !( _lhs >>= lhs ) || !( _rhs >>= rhs ) ) - throw css::lang::IllegalArgumentException("bad ordering", css::uno::Reference<css::uno::XInterface>(), -1); + throw css::lang::IllegalArgumentException(u"bad ordering"_ustr, css::uno::Reference<css::uno::XInterface>(), -1); // FIXME Timezone? if ( lhs.Hours < rhs.Hours ) @@ -127,7 +127,7 @@ namespace comphelper if ( !( _lhs >>= lhs ) || !( _rhs >>= rhs ) ) - throw css::lang::IllegalArgumentException("bad ordering", css::uno::Reference<css::uno::XInterface>(), -1); + throw css::lang::IllegalArgumentException(u"bad ordering"_ustr, css::uno::Reference<css::uno::XInterface>(), -1); // FIXME Timezone? if ( lhs.Year < rhs.Year ) @@ -216,12 +216,12 @@ namespace comphelper if (!lhsTypeDescr.is()) lhsTypeDescr.makeComplete(); if (!lhsTypeDescr.is()) - throw css::lang::IllegalArgumentException("bad ordering", css::uno::Reference<css::uno::XInterface>(), -1); + throw css::lang::IllegalArgumentException(u"bad ordering"_ustr, css::uno::Reference<css::uno::XInterface>(), -1); TypeDescription rhsTypeDescr( rhsType ); if (!rhsTypeDescr.is()) rhsTypeDescr.makeComplete(); if (!rhsTypeDescr.is()) - throw css::lang::IllegalArgumentException("bad ordering", css::uno::Reference<css::uno::XInterface>(), -1); + throw css::lang::IllegalArgumentException(u"bad ordering"_ustr, css::uno::Reference<css::uno::XInterface>(), -1); int compare = compareTypes( lhsTypeDescr.get(), rhsTypeDescr.get()); if( compare != 0 ) return compare < 0; @@ -251,7 +251,7 @@ namespace comphelper { TypeDescriptionRef memberType( ppTypeRefs[ nPos ] ); if (!memberType.is()) - throw css::lang::IllegalArgumentException("bad ordering", css::uno::Reference<css::uno::XInterface>(), -1); + throw css::lang::IllegalArgumentException(u"bad ordering"_ustr, css::uno::Reference<css::uno::XInterface>(), -1); std::optional<bool> subLess = anyCompare( static_cast< char const * >( lhs ) + memberOffsets[ nPos ], @@ -273,10 +273,10 @@ namespace comphelper TypeDescriptionRef lhsTypeDescr( lhsType ); if (!lhsTypeDescr.is()) - throw css::lang::IllegalArgumentException("bad ordering", css::uno::Reference<css::uno::XInterface>(), -1); + throw css::lang::IllegalArgumentException(u"bad ordering"_ustr, css::uno::Reference<css::uno::XInterface>(), -1); TypeDescriptionRef rhsTypeDescr( rhsType ); if (!rhsTypeDescr.is()) - throw css::lang::IllegalArgumentException("bad ordering", css::uno::Reference<css::uno::XInterface>(), -1); + throw css::lang::IllegalArgumentException(u"bad ordering"_ustr, css::uno::Reference<css::uno::XInterface>(), -1); int compare = compareTypes( lhsTypeDescr.get(), rhsTypeDescr.get()); if( compare != 0 ) return compare < 0; @@ -285,7 +285,7 @@ namespace comphelper reinterpret_cast< typelib_IndirectTypeDescription * >(lhsTypeDescr.get())->pType; TypeDescriptionRef elementTypeDescr( elementTypeRef ); if (!elementTypeDescr.is()) - throw css::lang::IllegalArgumentException("bad ordering", css::uno::Reference<css::uno::XInterface>(), -1); + throw css::lang::IllegalArgumentException(u"bad ordering"_ustr, css::uno::Reference<css::uno::XInterface>(), -1); assert( elementTypeDescr.equals( TypeDescriptionRef( reinterpret_cast< typelib_IndirectTypeDescription * >(lhsTypeDescr.get())->pType ))); @@ -331,12 +331,12 @@ namespace comphelper if (!lhsTypeDescr.is()) lhsTypeDescr.makeComplete(); if (!lhsTypeDescr.is()) - throw css::lang::IllegalArgumentException("bad ordering", css::uno::Reference<css::uno::XInterface>(), -1); + throw css::lang::IllegalArgumentException(u"bad ordering"_ustr, css::uno::Reference<css::uno::XInterface>(), -1); TypeDescription rhsTypeDescr( rhsType ); if (!rhsTypeDescr.is()) rhsTypeDescr.makeComplete(); if (!rhsTypeDescr.is()) - throw css::lang::IllegalArgumentException("bad ordering", css::uno::Reference<css::uno::XInterface>(), -1); + throw css::lang::IllegalArgumentException(u"bad ordering"_ustr, css::uno::Reference<css::uno::XInterface>(), -1); int compare = compareTypes( lhsTypeDescr.get(), rhsTypeDescr.get()); if( compare != 0 ) return compare < 0; diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index 0649c9c13fa5..11fa4239d2e9 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -439,8 +439,8 @@ namespace if (aTagName == "extension") { - OUString aAttrUrl(rElement->getAttribute("url")); - const OUString aAttrRevoked(rElement->getAttribute("revoked")); + OUString aAttrUrl(rElement->getAttribute(u"url"_ustr)); + const OUString aAttrRevoked(rElement->getAttribute(u"revoked"_ustr)); if (!aAttrUrl.isEmpty()) { @@ -537,8 +537,8 @@ namespace if (aTagName == rTagToSearch) { - const OString aAttrUrl(OUStringToOString(rElement->getAttribute("url"), RTL_TEXTENCODING_ASCII_US)); - const OUString aAttrRevoked(rElement->getAttribute("revoked")); + const OString aAttrUrl(OUStringToOString(rElement->getAttribute(u"url"_ustr), RTL_TEXTENCODING_ASCII_US)); + const OUString aAttrRevoked(rElement->getAttribute(u"revoked"_ustr)); const bool bEnabled(aAttrRevoked.isEmpty() || !aAttrRevoked.toBoolean()); if (!aAttrUrl.isEmpty()) @@ -550,7 +550,7 @@ namespace if (!bEnabled) { // needs to be enabled - rElement->removeAttribute("revoked"); + rElement->removeAttribute(u"revoked"_ustr); bChanged = true; } } @@ -563,7 +563,7 @@ namespace if (bEnabled) { // needs to be disabled - rElement->setAttribute("revoked", "true"); + rElement->setAttribute(u"revoked"_ustr, u"true"_ustr); bChanged = true; } } @@ -669,7 +669,7 @@ namespace visitNodesXMLChangeOneCase( aUnoPackagReg, - "extension", + u"extension"_ustr, rToBeEnabled, rToBeDisabled); } @@ -680,7 +680,7 @@ namespace visitNodesXMLChangeOneCase( aUnoPackagReg, - "configuration", + u"configuration"_ustr, rToBeEnabled, rToBeDisabled); } @@ -691,7 +691,7 @@ namespace visitNodesXMLChangeOneCase( aUnoPackagReg, - "script", + u"script"_ustr, rToBeEnabled, rToBeDisabled); } @@ -1465,7 +1465,7 @@ namespace comphelper { // try to access user layer configuration file URL, the one that // points to registrymodifications.xcu - OUString conf("${CONFIGURATION_LAYERS}"); + OUString conf(u"${CONFIGURATION_LAYERS}"_ustr); rtl::Bootstrap::expandMacros(conf); static constexpr OUString aTokenUser(u"user:"_ustr); sal_Int32 nStart(conf.indexOf(aTokenUser)); @@ -1527,7 +1527,7 @@ namespace comphelper OUString sTokenOut; // read configuration item 'SecureUserConfig' -> bool on/off - if (rtl::Bootstrap::get("SecureUserConfig", sTokenOut)) + if (rtl::Bootstrap::get(u"SecureUserConfig"_ustr, sTokenOut)) { mbActive = sTokenOut.toBoolean(); } @@ -1541,7 +1541,7 @@ namespace comphelper mbActive = !maInitialBaseURL.isEmpty() && !maUserConfigBaseURL.isEmpty() && !maRegModName.isEmpty(); } - if (mbActive && rtl::Bootstrap::get("SecureUserConfigNumCopies", sTokenOut)) + if (mbActive && rtl::Bootstrap::get(u"SecureUserConfigNumCopies"_ustr, sTokenOut)) { const sal_uInt16 nConfigNumCopies(static_cast<sal_uInt16>(sTokenOut.toUInt32())); @@ -1549,7 +1549,7 @@ namespace comphelper mnNumBackups = std::clamp(mnNumBackups, nConfigNumCopies, mnMaxAllowedBackups); } - if (mbActive && rtl::Bootstrap::get("SecureUserConfigMode", sTokenOut)) + if (mbActive && rtl::Bootstrap::get(u"SecureUserConfigMode"_ustr, sTokenOut)) { const sal_uInt16 nMode(static_cast<sal_uInt16>(sTokenOut.toUInt32())); @@ -1557,12 +1557,12 @@ namespace comphelper mnMode = std::min(nMode, sal_uInt16(2)); } - if (mbActive && rtl::Bootstrap::get("SecureUserConfigExtensions", sTokenOut)) + if (mbActive && rtl::Bootstrap::get(u"SecureUserConfigExtensions"_ustr, sTokenOut)) { mbExtensions = sTokenOut.toBoolean(); } - if (mbActive && rtl::Bootstrap::get("SecureUserConfigCompress", sTokenOut)) + if (mbActive && rtl::Bootstrap::get(u"SecureUserConfigCompress"_ustr, sTokenOut)) { mbCompress = sTokenOut.toBoolean(); } @@ -1835,12 +1835,12 @@ namespace comphelper { static std::vector< OUString > aDirNames = { - "config", // UI config stuff - "registry", // most of the registry stuff - "psprint", // not really needed, can be abandoned - "store", // not really needed, can be abandoned - "temp", // not really needed, can be abandoned - "pack" // own backup dir + u"config"_ustr, // UI config stuff + u"registry"_ustr, // most of the registry stuff + u"psprint"_ustr, // not really needed, can be abandoned + u"store"_ustr, // not really needed, can be abandoned + u"temp"_ustr, // not really needed, can be abandoned + u"pack"_ustr // own backup dir }; return aDirNames; @@ -1850,7 +1850,7 @@ namespace comphelper { static std::vector< OUString > aFileNames = { - "registrymodifications.xcu" // personal registry stuff + u"registrymodifications.xcu"_ustr // personal registry stuff }; return aFileNames; @@ -1860,14 +1860,14 @@ namespace comphelper uno::Reference<XElement> lcl_getConfigElement(const uno::Reference<XDocument>& xDocument, const OUString& rPath, const OUString& rKey, const OUString& rValue) { - uno::Reference< XElement > itemElement = xDocument->createElement("item"); - itemElement->setAttribute("oor:path", rPath); + uno::Reference< XElement > itemElement = xDocument->createElement(u"item"_ustr); + itemElement->setAttribute(u"oor:path"_ustr, rPath); - uno::Reference< XElement > propElement = xDocument->createElement("prop"); - propElement->setAttribute("oor:name", rKey); - propElement->setAttribute("oor:op", "replace"); // Replace any other options + uno::Reference< XElement > propElement = xDocument->createElement(u"prop"_ustr); + propElement->setAttribute(u"oor:name"_ustr, rKey); + propElement->setAttribute(u"oor:op"_ustr, u"replace"_ustr); // Replace any other options - uno::Reference< XElement > valueElement = xDocument->createElement("value"); + uno::Reference< XElement > valueElement = xDocument->createElement(u"value"_ustr); uno::Reference< XText > textElement = xDocument->createTextNode(rValue); valueElement->appendChild(textElement); @@ -1889,15 +1889,15 @@ namespace comphelper uno::Reference< XDocument > xDocument = xBuilder->parseURI(aRegistryModifications); uno::Reference< XElement > xRootElement = xDocument->getDocumentElement(); - xRootElement->appendChild(lcl_getConfigElement(xDocument, "/org.openoffice.Office.Common/VCL", - "DisableOpenGL", "true")); - xRootElement->appendChild(lcl_getConfigElement(xDocument, "/org.openoffice.Office.Common/Misc", - "UseOpenCL", "false")); + xRootElement->appendChild(lcl_getConfigElement(xDocument, u"/org.openoffice.Office.Common/VCL"_ustr, + u"DisableOpenGL"_ustr, u"true"_ustr)); + xRootElement->appendChild(lcl_getConfigElement(xDocument, u"/org.openoffice.Office.Common/Misc"_ustr, + u"UseOpenCL"_ustr, u"false"_ustr)); // Do not disable Skia entirely, just force its CPU-based raster mode. - xRootElement->appendChild(lcl_getConfigElement(xDocument, "/org.openoffice.Office.Common/VCL", - "ForceSkia", "false")); - xRootElement->appendChild(lcl_getConfigElement(xDocument, "/org.openoffice.Office.Common/VCL", - "ForceSkiaRaster", "true")); + xRootElement->appendChild(lcl_getConfigElement(xDocument, u"/org.openoffice.Office.Common/VCL"_ustr, + u"ForceSkia"_ustr, u"false"_ustr)); + xRootElement->appendChild(lcl_getConfigElement(xDocument, u"/org.openoffice.Office.Common/VCL"_ustr, + u"ForceSkiaRaster"_ustr, u"true"_ustr)); OUString aTempURL; { @@ -2435,31 +2435,31 @@ namespace comphelper maFiles.insert(std::pair< OUString, OUString >(maRegModName, maExt)); // User-defined substitution table (Tools/AutoCorrect) - maDirs.insert("autocorr"); + maDirs.insert(u"autocorr"_ustr); // User-Defined AutoText (Edit/AutoText) - maDirs.insert("autotext"); + maDirs.insert(u"autotext"_ustr); // User-defined Macros - maDirs.insert("basic"); + maDirs.insert(u"basic"_ustr); // User-adapted toolbars for modules - maDirs.insert("config"); + maDirs.insert(u"config"_ustr); // Initial and User-defined Databases - maDirs.insert("database"); + maDirs.insert(u"database"_ustr); // most part of registry files - maDirs.insert("registry"); + maDirs.insert(u"registry"_ustr); // User-Defined Scripts - maDirs.insert("Scripts"); + maDirs.insert(u"Scripts"_ustr); // Template files - maDirs.insert("template"); + maDirs.insert(u"template"_ustr); // Custom Dictionaries - maDirs.insert("wordbook"); + maDirs.insert(u"wordbook"_ustr); // Questionable - where and how is Extension stuff held and how // does this interact with enabled/disabled states which are extra handled? @@ -2481,19 +2481,19 @@ namespace comphelper // should not exist, but for the case an error occurred and it got // copied somehow, avoid further recursive copying/saving - maDirs.erase("SafeMode"); + maDirs.erase(u"SafeMode"_ustr); // not really needed, can be abandoned - maDirs.erase("psprint"); + maDirs.erase(u"psprint"_ustr); // not really needed, can be abandoned - maDirs.erase("store"); + maDirs.erase(u"store"_ustr); // not really needed, can be abandoned - maDirs.erase("temp"); + maDirs.erase(u"temp"_ustr); // exclude own backup dir to avoid recursion - maDirs.erase("pack"); + maDirs.erase(u"pack"_ustr); break; } diff --git a/comphelper/source/misc/configuration.cxx b/comphelper/source/misc/configuration.cxx index b7d97bbb6533..88e6a7c6f658 100644 --- a/comphelper/source/misc/configuration.cxx +++ b/comphelper/source/misc/configuration.cxx @@ -111,7 +111,7 @@ comphelper::detail::ConfigurationWrapper::get( comphelper::detail::ConfigurationWrapper::ConfigurationWrapper( css::uno::Reference<css::uno::XComponentContext> const & context): context_(context.is() ? context : comphelper::getProcessComponentContext()), - access_(css::configuration::ReadWriteAccess::create(context_, "*")) + access_(css::configuration::ReadWriteAccess::create(context_, u"*"_ustr)) {} comphelper::detail::ConfigurationWrapper::~ConfigurationWrapper() {} diff --git a/comphelper/source/misc/configurationhelper.cxx b/comphelper/source/misc/configurationhelper.cxx index f3853baeff81..228885e2ec5a 100644 --- a/comphelper/source/misc/configurationhelper.cxx +++ b/comphelper/source/misc/configurationhelper.cxx @@ -51,7 +51,7 @@ css::uno::Reference< css::uno::XInterface > ConfigurationHelper::openConfig(cons if (eMode & EConfigurationModes::AllLocales) { aParam.Name = "locale"; - aParam.Value <<= OUString("*"); + aParam.Value <<= u"*"_ustr; lParams.emplace_back(aParam); } @@ -61,11 +61,11 @@ css::uno::Reference< css::uno::XInterface > ConfigurationHelper::openConfig(cons bool bReadOnly(eMode & EConfigurationModes::ReadOnly); if (bReadOnly) xCFG = xConfigProvider->createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationAccess", + u"com.sun.star.configuration.ConfigurationAccess"_ustr, comphelper::containerToSequence(lParams)); else xCFG = xConfigProvider->createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationUpdateAccess", + u"com.sun.star.configuration.ConfigurationUpdateAccess"_ustr, comphelper::containerToSequence(lParams)); return xCFG; diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index 76008b508c68..e4327acb8e40 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -95,10 +95,10 @@ uno::Sequence< beans::PropertyValue > DocPasswordHelper::GenerateNewModifyPasswo uno::Sequence< sal_Int8 > aNewHash = GeneratePBKDF2Hash(aPassword, aSalt, nPBKDF2IterationCount, 16); if ( aNewHash.hasElements() ) { - aResult = { comphelper::makePropertyValue("algorithm-name", OUString( "PBKDF2" )), - comphelper::makePropertyValue("salt", aSalt), - comphelper::makePropertyValue("iteration-count", nPBKDF2IterationCount), - comphelper::makePropertyValue("hash", aNewHash) }; + aResult = { comphelper::makePropertyValue(u"algorithm-name"_ustr, u"PBKDF2"_ustr), + comphelper::makePropertyValue(u"salt"_ustr, aSalt), + comphelper::makePropertyValue(u"iteration-count"_ustr, nPBKDF2IterationCount), + comphelper::makePropertyValue(u"hash"_ustr, aNewHash) }; } return aResult; @@ -118,17 +118,17 @@ DocPasswordHelper::GenerateNewModifyPasswordInfoOOXML(std::u16string_view aPassw OUString sSalt = aBuffer.makeStringAndClear(); sal_Int32 const nIterationCount = 100000; - OUString sAlgorithm("SHA-512"); + OUString sAlgorithm(u"SHA-512"_ustr); const OUString sHash(GetOoxHashAsBase64(OUString(aPassword), sSalt, nIterationCount, comphelper::Hash::IterCount::APPEND, sAlgorithm)); if (!sHash.isEmpty()) { - aResult = { comphelper::makePropertyValue("algorithm-name", sAlgorithm), - comphelper::makePropertyValue("salt", sSalt), - comphelper::makePropertyValue("iteration-count", nIterationCount), - comphelper::makePropertyValue("hash", sHash) }; + aResult = { comphelper::makePropertyValue(u"algorithm-name"_ustr, sAlgorithm), + comphelper::makePropertyValue(u"salt"_ustr, sSalt), + comphelper::makePropertyValue(u"iteration-count"_ustr, nIterationCount), + comphelper::makePropertyValue(u"hash"_ustr, sHash) }; } } @@ -183,10 +183,10 @@ uno::Sequence< beans::PropertyValue > DocPasswordHelper::ConvertPasswordInfo( co if ( !sCount.isEmpty() ) { sal_Int32 nCount = sCount.toInt32(); - aResult = { comphelper::makePropertyValue("algorithm-name", sAlgorithm), - comphelper::makePropertyValue("salt", sSalt), - comphelper::makePropertyValue("iteration-count", nCount), - comphelper::makePropertyValue("hash", sHash) }; + aResult = { comphelper::makePropertyValue(u"algorithm-name"_ustr, sAlgorithm), + comphelper::makePropertyValue(u"salt"_ustr, sSalt), + comphelper::makePropertyValue(u"iteration-count"_ustr, nCount), + comphelper::makePropertyValue(u"hash"_ustr, sHash) }; } return aResult; @@ -429,7 +429,7 @@ OUString DocPasswordHelper::GetOoxHashAsBase64( rtlRandomPool aRandomPool = rtl_random_createPool (); if (rtl_random_getBytes(aRandomPool, aResult.getArray(), nLength) != rtl_Random_E_None) { - throw uno::RuntimeException("rtl_random_getBytes failed"); + throw uno::RuntimeException(u"rtl_random_getBytes failed"_ustr); } rtl_random_destroyPool ( aRandomPool ); @@ -647,9 +647,9 @@ OUString DocPasswordHelper::GetOoxHashAsBase64( // 2. Add MS binary and OOXML encryption data to result aEncData = comphelper::concatSequences( aEncData, std::initializer_list<beans::NamedValue>{ - { "STD97EncryptionKey", css::uno::Any(aEnc97Key) }, - { "STD97UniqueID", css::uno::Any(aUniqueID) }, - { "OOXPassword", css::uno::Any(aPassword) }, + { u"STD97EncryptionKey"_ustr, css::uno::Any(aEnc97Key) }, + { u"STD97UniqueID"_ustr, css::uno::Any(aUniqueID) }, + { u"OOXPassword"_ustr, css::uno::Any(aPassword) }, }); } } @@ -670,11 +670,11 @@ OUString DocPasswordHelper::GetOoxHashAsBase64( GpgME::initializeLibrary(); GpgME::Error err = GpgME::checkEngine(GpgME::OpenPGP); if (err) - throw uno::RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw uno::RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); ctx.reset( GpgME::Context::createForProtocol(GpgME::OpenPGP) ); if (ctx == nullptr) - throw uno::RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw uno::RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); ctx->setArmor(false); for (auto& rSequence : rGpgProperties) @@ -713,7 +713,7 @@ OUString DocPasswordHelper::GetOoxHashAsBase64( result = plain.seek(0,SEEK_SET); assert(result == 0); if( plain.read(aKeyValue.getArray(), len) != len ) - throw uno::RuntimeException("The GpgME library failed to read the encrypted value."); + throw uno::RuntimeException(u"The GpgME library failed to read the encrypted value."_ustr); SAL_INFO("comphelper.crypto", "Extracted gpg session key of length: " << len); @@ -725,7 +725,7 @@ OUString DocPasswordHelper::GetOoxHashAsBase64( if ( aEncryptionData.hasElements() ) { uno::Sequence< beans::NamedValue > aContainer{ - { "GpgInfos", uno::Any(rGpgProperties) }, { "EncryptionKey", uno::Any(aEncryptionData) } + { u"GpgInfos"_ustr, uno::Any(rGpgProperties) }, { u"EncryptionKey"_ustr, uno::Any(aEncryptionData) } }; return aContainer; diff --git a/comphelper/source/misc/graphicmimetype.cxx b/comphelper/source/misc/graphicmimetype.cxx index 8ae3dad5619c..a9bc0e504ea5 100644 --- a/comphelper/source/misc/graphicmimetype.cxx +++ b/comphelper/source/misc/graphicmimetype.cxx @@ -73,11 +73,11 @@ OUString GraphicMimeTypeHelper::GetMimeTypeForXGraphic(const Reference<XGraphic> OUString aSourceMimeType; Reference<XPropertySet> const xGraphicPropertySet(xGraphic, UNO_QUERY); if (xGraphicPropertySet.is() && // it's null if it's an external link - (xGraphicPropertySet->getPropertyValue("MimeType") >>= aSourceMimeType)) + (xGraphicPropertySet->getPropertyValue(u"MimeType"_ustr) >>= aSourceMimeType)) { return aSourceMimeType; } - return ""; + return u""_ustr; } OUString @@ -86,7 +86,7 @@ GraphicMimeTypeHelper::GetMimeTypeForImageStream(const Reference<XInputStream>& // Create the graphic to retrieve the mimetype from it Reference<XGraphicProvider> xProvider = css::graphic::GraphicProvider::create(comphelper::getProcessComponentContext()); - Sequence<PropertyValue> aMediaProperties{ comphelper::makePropertyValue("InputStream", + Sequence<PropertyValue> aMediaProperties{ comphelper::makePropertyValue(u"InputStream"_ustr, xInputStream) }; Reference<XGraphic> xGraphic(xProvider->queryGraphic(aMediaProperties)); @@ -98,29 +98,29 @@ OUString GraphicMimeTypeHelper::GetMimeTypeForConvertDataFormat(ConvertDataForma switch (convertDataFormat) { case ConvertDataFormat::BMP: - return "image/bmp"; + return u"image/bmp"_ustr; case ConvertDataFormat::GIF: - return "image/gif"; + return u"image/gif"_ustr; case ConvertDataFormat::JPG: - return "image/jpeg"; + return u"image/jpeg"_ustr; case ConvertDataFormat::PCT: - return "image/x-pict"; + return u"image/x-pict"_ustr; case ConvertDataFormat::PNG: - return "image/png"; + return u"image/png"_ustr; case ConvertDataFormat::SVM: - return "image/x-svm"; + return u"image/x-svm"_ustr; case ConvertDataFormat::TIF: - return "image/tiff"; + return u"image/tiff"_ustr; case ConvertDataFormat::WMF: - return "image/x-wmf"; + return u"image/x-wmf"_ustr; case ConvertDataFormat::EMF: - return "image/x-emf"; + return u"image/x-emf"_ustr; case ConvertDataFormat::SVG: - return "image/svg+xml"; + return u"image/svg+xml"_ustr; case ConvertDataFormat::MET: // What is this? case ConvertDataFormat::Unknown: default: - return ""; + return u""_ustr; } } diff --git a/comphelper/source/misc/instancelocker.cxx b/comphelper/source/misc/instancelocker.cxx index 465cc5185834..ebb0983ace17 100644 --- a/comphelper/source/misc/instancelocker.cxx +++ b/comphelper/source/misc/instancelocker.cxx @@ -123,13 +123,13 @@ void SAL_CALL OInstanceLocker::initialize( const uno::Sequence< uno::Any >& aArg sal_Int32 nLen = aArguments.getLength(); if ( nLen < 2 || nLen > 3 ) throw lang::IllegalArgumentException( - "Wrong count of parameters!", + u"Wrong count of parameters!"_ustr, uno::Reference< uno::XInterface >(), 0 ); if ( !( aArguments[0] >>= xInstance ) || !xInstance.is() ) throw lang::IllegalArgumentException( - "Nonempty reference is expected as the first argument!", + u"Nonempty reference is expected as the first argument!"_ustr, uno::Reference< uno::XInterface >(), 0 ); @@ -143,14 +143,14 @@ void SAL_CALL OInstanceLocker::initialize( const uno::Sequence< uno::Any >& aArg ) { throw lang::IllegalArgumentException( - "The correct modes set is expected as the second argument!", + u"The correct modes set is expected as the second argument!"_ustr, uno::Reference< uno::XInterface >(), 0 ); } if ( nLen == 3 && !( aArguments[2] >>= xApproval ) ) throw lang::IllegalArgumentException( - "If the third argument is provided, it must be XActionsApproval implementation!", + u"If the third argument is provided, it must be XActionsApproval implementation!"_ustr, uno::Reference< uno::XInterface >(), 0 ); @@ -173,7 +173,7 @@ void SAL_CALL OInstanceLocker::initialize( const uno::Sequence< uno::Any >& aArg // XServiceInfo OUString SAL_CALL OInstanceLocker::getImplementationName( ) { - return "com.sun.star.comp.embed.InstanceLocker"; + return u"com.sun.star.comp.embed.InstanceLocker"_ustr; } sal_Bool SAL_CALL OInstanceLocker::supportsService( const OUString& ServiceName ) @@ -183,7 +183,7 @@ sal_Bool SAL_CALL OInstanceLocker::supportsService( const OUString& ServiceName uno::Sequence< OUString > SAL_CALL OInstanceLocker::getSupportedServiceNames() { - return { "com.sun.star.embed.InstanceLocker" }; + return { u"com.sun.star.embed.InstanceLocker"_ustr }; } // OLockListener diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx index c042b0c626e5..36898debc22e 100644 --- a/comphelper/source/misc/lok.cxx +++ b/comphelper/source/misc/lok.cxx @@ -275,13 +275,13 @@ void setTimezone(bool isSet, const OUString& rTimezone) if (isSet) { // Set the given timezone, even if empty. - osl_setEnvironment(OUString("TZ").pData, rTimezone.pData); + osl_setEnvironment(u"TZ"_ustr.pData, rTimezone.pData); } else { // Unset and empty aren't the same. // When unset, it means default to the system configured timezone. - osl_clearEnvironment(OUString("TZ").pData); + osl_clearEnvironment(u"TZ"_ustr.pData); } // Update the timezone data. diff --git a/comphelper/source/misc/mimeconfighelper.cxx b/comphelper/source/misc/mimeconfighelper.cxx index 30881876b925..dfd7fa53f677 100644 --- a/comphelper/source/misc/mimeconfighelper.cxx +++ b/comphelper/source/misc/mimeconfighelper.cxx @@ -44,7 +44,7 @@ MimeConfigurationHelper::MimeConfigurationHelper( uno::Reference< uno::XComponen : m_xContext(std::move( xContext )) { if ( !m_xContext.is() ) - throw uno::RuntimeException("MimeConfigurationHelper:: empty component context"); + throw uno::RuntimeException(u"MimeConfigurationHelper:: empty component context"_ustr); } @@ -129,7 +129,7 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetConfigurati {"nodepath", uno::Any(aPath)} })); xConfig.set( m_xConfigProvider->createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationAccess", + u"com.sun.star.configuration.ConfigurationAccess"_ustr, aArgs ), uno::UNO_QUERY ); } @@ -146,7 +146,7 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetObjConfigur if ( !m_xObjectConfig.is() ) m_xObjectConfig = GetConfigurationByPathImpl( - "/org.openoffice.Office.Embedding/Objects" ); + u"/org.openoffice.Office.Embedding/Objects"_ustr ); return m_xObjectConfig; } @@ -158,7 +158,7 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetVerbsConfig if ( !m_xVerbsConfig.is() ) m_xVerbsConfig = GetConfigurationByPathImpl( - "/org.openoffice.Office.Embedding/Verbs"); + u"/org.openoffice.Office.Embedding/Verbs"_ustr); return m_xVerbsConfig; } @@ -170,7 +170,7 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetMediaTypeCo if ( !m_xMediaTypeConfig.is() ) m_xMediaTypeConfig = GetConfigurationByPathImpl( - "/org.openoffice.Office.Embedding/MimeTypeClassIDRelations"); + u"/org.openoffice.Office.Embedding/MimeTypeClassIDRelations"_ustr); return m_xMediaTypeConfig; } @@ -182,7 +182,7 @@ uno::Reference< container::XNameAccess > MimeConfigurationHelper::GetFilterFacto if ( !m_xFilterFactory.is() ) m_xFilterFactory.set( - m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.FilterFactory", m_xContext), + m_xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.document.FilterFactory"_ustr, m_xContext), uno::UNO_QUERY ); return m_xFilterFactory; @@ -218,7 +218,7 @@ OUString MimeConfigurationHelper::GetDocServiceNameFromFilter( const OUString& a OUString MimeConfigurationHelper::GetDocServiceNameFromMediaType( const OUString& aMediaType ) { uno::Reference< container::XContainerQuery > xTypeCFG( - m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.TypeDetection", m_xContext), + m_xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.document.TypeDetection"_ustr, m_xContext), uno::UNO_QUERY ); if ( xTypeCFG.is() ) @@ -226,7 +226,7 @@ OUString MimeConfigurationHelper::GetDocServiceNameFromMediaType( const OUString try { // make query for all types matching the properties - uno::Sequence < beans::NamedValue > aSeq { { "MediaType", css::uno::Any(aMediaType) } }; + uno::Sequence < beans::NamedValue > aSeq { { u"MediaType"_ustr, css::uno::Any(aMediaType) } }; uno::Reference < container::XEnumeration > xEnum = xTypeCFG->createSubSetEnumerationByProperties( aSeq ); while ( xEnum->hasMoreElements() ) @@ -315,12 +315,12 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjPropsFromConfi { uno::Sequence< OUString > aVerbShortcuts; if ( !(xObjectProps->getByName( aObjPropNames[nInd] ) >>= aVerbShortcuts) ) - throw uno::RuntimeException("Failed to get verb shortcuts from object properties"); + throw uno::RuntimeException(u"Failed to get verb shortcuts from object properties"_ustr); uno::Sequence< embed::VerbDescriptor > aVerbDescriptors( aVerbShortcuts.getLength() ); auto aVerbDescriptorsRange = asNonConstRange(aVerbDescriptors); for ( sal_Int32 nVerbI = 0; nVerbI < aVerbShortcuts.getLength(); nVerbI++ ) if ( !GetVerbByShortcut( aVerbShortcuts[nVerbI], aVerbDescriptorsRange[nVerbI] ) ) - throw uno::RuntimeException("Failed to get verb descriptor by shortcut"); + throw uno::RuntimeException(u"Failed to get verb descriptor by shortcut"_ustr); pResult[nInd+1].Value <<= aVerbDescriptors; } @@ -365,9 +365,9 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByStri uno::Sequence< sal_Int8 > aClassID = GetSequenceClassIDRepresentation( aStringClassID ); if ( ClassIDsEqual( aClassID, GetSequenceClassID( SO3_DUMMY_CLASSID ) ) ) { - aObjProps = { { "ObjectFactory", - uno::Any(OUString("com.sun.star.embed.OOoSpecialEmbeddedObjectFactory")) }, - { "ClassID", uno::Any(aClassID) } }; + aObjProps = { { u"ObjectFactory"_ustr, + uno::Any(u"com.sun.star.embed.OOoSpecialEmbeddedObjectFactory"_ustr) }, + { u"ClassID"_ustr, uno::Any(aClassID) } }; return aObjProps; } @@ -396,9 +396,9 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByClas uno::Sequence< beans::NamedValue > aObjProps; if ( ClassIDsEqual( aClassID, GetSequenceClassID( SO3_DUMMY_CLASSID ) ) ) { - aObjProps = { { "ObjectFactory", - uno::Any(OUString("com.sun.star.embed.OOoSpecialEmbeddedObjectFactory")) }, - { "ClassID", uno::Any(aClassID) } }; + aObjProps = { { u"ObjectFactory"_ustr, + uno::Any(u"com.sun.star.embed.OOoSpecialEmbeddedObjectFactory"_ustr) }, + { u"ClassID"_ustr, uno::Any(aClassID) } }; } OUString aStringClassID = GetStringClassIDRepresentation( aClassID ); @@ -461,7 +461,7 @@ uno::Sequence< beans::NamedValue > MimeConfigurationHelper::GetObjectPropsByDocu OUString aEntryDocName; if ( ( xObjConfig->getByName( id ) >>= xObjectProps ) && xObjectProps.is() - && ( xObjectProps->getByName("ObjectDocumentServiceName") >>= aEntryDocName ) + && ( xObjectProps->getByName(u"ObjectDocumentServiceName"_ustr) >>= aEntryDocName ) && aEntryDocName == aDocName ) { return GetObjPropsFromConfigEntry( GetSequenceClassIDRepresentation( id ), @@ -495,13 +495,13 @@ OUString MimeConfigurationHelper::GetFactoryNameByStringClassID( const OUString& try { if ( xObjConfig.is() && ( xObjConfig->getByName( aStringClassID.toAsciiUpperCase() ) >>= xObjectProps ) && xObjectProps.is() ) - xObjectProps->getByName("ObjectFactory") >>= aResult; + xObjectProps->getByName(u"ObjectFactory"_ustr) >>= aResult; } catch( uno::Exception& ) { uno::Sequence< sal_Int8 > aClassID = GetSequenceClassIDRepresentation( aStringClassID ); if ( ClassIDsEqual( aClassID, GetSequenceClassID( SO3_DUMMY_CLASSID ) ) ) - return "com.sun.star.embed.OOoSpecialEmbeddedObjectFactory"; + return u"com.sun.star.embed.OOoSpecialEmbeddedObjectFactory"_ustr; } } @@ -527,10 +527,10 @@ OUString MimeConfigurationHelper::GetFactoryNameByDocumentName( std::u16string_v OUString aEntryDocName; if ( ( xObjConfig->getByName( id ) >>= xObjectProps ) && xObjectProps.is() - && ( xObjectProps->getByName( "ObjectDocumentServiceName" ) >>= aEntryDocName ) + && ( xObjectProps->getByName( u"ObjectDocumentServiceName"_ustr ) >>= aEntryDocName ) && aEntryDocName == aDocName ) { - xObjectProps->getByName("ObjectFactory") >>= aResult; + xObjectProps->getByName(u"ObjectFactory"_ustr) >>= aResult; break; } } @@ -574,7 +574,7 @@ OUString MimeConfigurationHelper::UpdateMediaDescriptorWithFilterName( // filter name is not specified, so type detection should be done uno::Reference< document::XTypeDetection > xTypeDetection( - m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.TypeDetection", m_xContext), + m_xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.document.TypeDetection"_ustr, m_xContext), uno::UNO_QUERY_THROW ); // typedetection can change the mode, add a stream and so on, thus a copy should be used @@ -715,8 +715,8 @@ OUString MimeConfigurationHelper::GetDefaultFilterFromServiceName( const OUStrin uno::Sequence< beans::NamedValue > aSearchRequest { - { "DocumentService", css::uno::Any(aServiceName) }, - { "FileFormatVersion", css::uno::Any(nVersion) } + { u"DocumentService"_ustr, css::uno::Any(aServiceName) }, + { u"FileFormatVersion"_ustr, css::uno::Any(nVersion) } }; uno::Reference< container::XEnumeration > xFilterEnum = @@ -786,12 +786,12 @@ OUString MimeConfigurationHelper::GetExportFilterFromImportFilter( const OUStrin if ( aImpFilterAny >>= aImpData ) { SequenceAsHashMap aImpFilterHM( aImpData ); - SfxFilterFlags nFlags = static_cast<SfxFilterFlags>(aImpFilterHM.getUnpackedValueOrDefault( "Flags", sal_Int32(0) )); + SfxFilterFlags nFlags = static_cast<SfxFilterFlags>(aImpFilterHM.getUnpackedValueOrDefault( u"Flags"_ustr, sal_Int32(0) )); if ( !( nFlags & SfxFilterFlags::IMPORT ) ) { OSL_FAIL( "This is no import filter!" ); - throw uno::Exception("this is no import filter", nullptr); + throw uno::Exception(u"this is no import filter"_ustr, nullptr); } if ( nFlags & SfxFilterFlags::EXPORT ) @@ -800,16 +800,16 @@ OUString MimeConfigurationHelper::GetExportFilterFromImportFilter( const OUStrin } else { - OUString aDocumentServiceName = aImpFilterHM.getUnpackedValueOrDefault( "DocumentService", OUString() ); - OUString aTypeName = aImpFilterHM.getUnpackedValueOrDefault( "Type", OUString() ); + OUString aDocumentServiceName = aImpFilterHM.getUnpackedValueOrDefault( u"DocumentService"_ustr, OUString() ); + OUString aTypeName = aImpFilterHM.getUnpackedValueOrDefault( u"Type"_ustr, OUString() ); OSL_ENSURE( !aDocumentServiceName.isEmpty() && !aTypeName.isEmpty(), "Incomplete filter data!" ); if ( !(aDocumentServiceName.isEmpty() || aTypeName.isEmpty()) ) { uno::Sequence< beans::NamedValue > aSearchRequest { - { "Type", css::uno::Any(aTypeName) }, - { "DocumentService", css::uno::Any(aDocumentServiceName) } + { u"Type"_ustr, css::uno::Any(aTypeName) }, + { u"DocumentService"_ustr, css::uno::Any(aDocumentServiceName) } }; uno::Sequence< beans::PropertyValue > aExportFilterProps = SearchForFilter( @@ -821,7 +821,7 @@ OUString MimeConfigurationHelper::GetExportFilterFromImportFilter( const OUStrin if ( aExportFilterProps.hasElements() ) { SequenceAsHashMap aExpPropsHM( aExportFilterProps ); - aExportFilterName = aExpPropsHM.getUnpackedValueOrDefault( "Name", OUString() ); + aExportFilterName = aExpPropsHM.getUnpackedValueOrDefault( u"Name"_ustr, OUString() ); } } } @@ -856,7 +856,7 @@ uno::Sequence< beans::PropertyValue > MimeConfigurationHelper::SearchForFilter( if ( xFilterEnum->nextElement() >>= aProps ) { SequenceAsHashMap aPropsHM( aProps ); - SfxFilterFlags nFlags = static_cast<SfxFilterFlags>(aPropsHM.getUnpackedValueOrDefault("Flags", + SfxFilterFlags nFlags = static_cast<SfxFilterFlags>(aPropsHM.getUnpackedValueOrDefault(u"Flags"_ustr, sal_Int32(0) )); if ( ( ( nFlags & nMustFlags ) == nMustFlags ) && !( nFlags & nDontFlags ) ) { diff --git a/comphelper/source/misc/numberedcollection.cxx b/comphelper/source/misc/numberedcollection.cxx index 9dec18e66a06..e47c30ee0a32 100644 --- a/comphelper/source/misc/numberedcollection.cxx +++ b/comphelper/source/misc/numberedcollection.cxx @@ -100,7 +100,7 @@ void SAL_CALL NumberedCollection::releaseNumber(::sal_Int32 nNumber) std::scoped_lock aLock(m_aMutex); if (nNumber == css::frame::UntitledNumbersConst::INVALID_NUMBER) - throw css::lang::IllegalArgumentException ("Special value INVALID_NUMBER not allowed as input parameter.", m_xOwner.get(), 1); + throw css::lang::IllegalArgumentException (u"Special value INVALID_NUMBER not allowed as input parameter."_ustr, m_xOwner.get(), 1); TDeadItemList lDeadItems; TNumberedItemHash::iterator pComponent; diff --git a/comphelper/source/misc/numbers.cxx b/comphelper/source/misc/numbers.cxx index f3b609392ceb..9bff08c79ae7 100644 --- a/comphelper/source/misc/numbers.cxx +++ b/comphelper/source/misc/numbers.cxx @@ -37,7 +37,7 @@ sal_Int16 getNumberFormatType(const css::uno::Reference<css::util::XNumberFormat { css::uno::Reference<css::beans::XPropertySet> xFormat(xFormats->getByKey(nKey)); if (xFormat.is()) - xFormat->getPropertyValue("Type") >>= nReturn; + xFormat->getPropertyValue(u"Type"_ustr) >>= nReturn; } catch(...) { @@ -67,7 +67,7 @@ css::uno::Any getNumberFormatDecimals(const css::uno::Reference<css::util::XNumb css::uno::Reference<css::beans::XPropertySet> xFormat( xFormats->getByKey(nKey)); if (xFormat.is()) { - return xFormat->getPropertyValue( "Decimals" ); + return xFormat->getPropertyValue( u"Decimals"_ustr ); } } catch(...) diff --git a/comphelper/source/misc/officerestartmanager.cxx b/comphelper/source/misc/officerestartmanager.cxx index 81e9b3351d7e..95110c75a7ab 100644 --- a/comphelper/source/misc/officerestartmanager.cxx +++ b/comphelper/source/misc/officerestartmanager.cxx @@ -36,7 +36,7 @@ namespace comphelper void SAL_CALL OOfficeRestartManager::requestRestart( const uno::Reference< task::XInteractionHandler >& /* xInteractionHandler */ ) { if ( !m_xContext.is() ) - throw uno::RuntimeException("no component context"); + throw uno::RuntimeException(u"no component context"_ustr); { std::unique_lock aGuard( m_aMutex ); @@ -60,7 +60,7 @@ void SAL_CALL OOfficeRestartManager::requestRestart( const uno::Reference< task: uno::Reference< awt::XRequestCallback > xRequestCallback( xFactory->createInstanceWithContext( - "com.sun.star.awt.AsyncCallback", + u"com.sun.star.awt.AsyncCallback"_ustr, m_xContext ), uno::UNO_QUERY_THROW ); @@ -98,7 +98,7 @@ void SAL_CALL OOfficeRestartManager::notify( const uno::Any& /* aData */ ) // Turn Quickstarter veto off uno::Reference< beans::XPropertySet > xPropertySet( xDesktop, uno::UNO_QUERY_THROW ); - OUString aVetoPropName( "SuspendQuickstartVeto" ); + OUString aVetoPropName( u"SuspendQuickstartVeto"_ustr ); uno::Any aValue; aValue <<= true; xPropertySet->setPropertyValue( aVetoPropName, aValue ); @@ -130,7 +130,7 @@ void SAL_CALL OOfficeRestartManager::notify( const uno::Any& /* aData */ ) OUString SAL_CALL OOfficeRestartManager::getImplementationName() { - return "com.sun.star.comp.task.OfficeRestartManager"; + return u"com.sun.star.comp.task.OfficeRestartManager"_ustr; } sal_Bool SAL_CALL OOfficeRestartManager::supportsService( const OUString& aServiceName ) @@ -140,7 +140,7 @@ sal_Bool SAL_CALL OOfficeRestartManager::supportsService( const OUString& aServi uno::Sequence< OUString > SAL_CALL OOfficeRestartManager::getSupportedServiceNames() { - return { "com.sun.star.comp.task.OfficeRestartManager" }; + return { u"com.sun.star.comp.task.OfficeRestartManager"_ustr }; } } // namespace comphelper diff --git a/comphelper/source/misc/sequenceashashmap.cxx b/comphelper/source/misc/sequenceashashmap.cxx index 647ccb74974d..ba4955e09780 100644 --- a/comphelper/source/misc/sequenceashashmap.cxx +++ b/comphelper/source/misc/sequenceashashmap.cxx @@ -149,7 +149,7 @@ void SequenceAsHashMap::operator<<(const css::uno::Any& aSource) } throw css::lang::IllegalArgumentException( - "Any contains wrong type.", css::uno::Reference<css::uno::XInterface>(), + u"Any contains wrong type."_ustr, css::uno::Reference<css::uno::XInterface>(), -1); } @@ -170,7 +170,7 @@ void SequenceAsHashMap::operator<<(const css::uno::Sequence< css::uno::Any >& lS (!lP.Value.hasValue()) ) throw css::lang::IllegalArgumentException( - "PropertyValue struct contains no useful information.", + u"PropertyValue struct contains no useful information."_ustr, css::uno::Reference<css::uno::XInterface>(), -1); (*this)[lP.Name] = lP.Value; continue; @@ -184,7 +184,7 @@ void SequenceAsHashMap::operator<<(const css::uno::Sequence< css::uno::Any >& lS (!lN.Value.hasValue()) ) throw css::lang::IllegalArgumentException( - "NamedValue struct contains no useful information.", + u"NamedValue struct contains no useful information."_ustr, css::uno::Reference<css::uno::XInterface>(), -1); (*this)[lN.Name] = lN.Value; continue; @@ -193,7 +193,7 @@ void SequenceAsHashMap::operator<<(const css::uno::Sequence< css::uno::Any >& lS // ignore VOID Any ... but reject wrong filled ones! if (lSource[i].hasValue()) throw css::lang::IllegalArgumentException( - "Any contains wrong type.", + u"Any contains wrong type."_ustr, css::uno::Reference<css::uno::XInterface>(), -1); } } diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index c2d295c54f26..ab6f71c7c734 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -133,7 +133,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageFromURL2( if (!xFact.is()) { if (anyEx.hasValue()) - throw css::lang::WrappedTargetRuntimeException( "", nullptr, anyEx ); + throw css::lang::WrappedTargetRuntimeException( u""_ustr, nullptr, anyEx ); else throw uno::RuntimeException(); } @@ -220,7 +220,7 @@ void OStorageHelper::SetCommonStorageEncryptionData( { uno::Reference< embed::XEncryptionProtectedStorage > xEncrSet( xStorage, uno::UNO_QUERY ); if ( !xEncrSet.is() ) - throw io::IOException("no XEncryptionProtectedStorage"); // TODO + throw io::IOException(u"no XEncryptionProtectedStorage"_ustr); // TODO if ( aEncryptionData.getLength() == 2 && aEncryptionData[0].Name == "GpgInfos" && @@ -242,7 +242,7 @@ sal_Int32 OStorageHelper::GetXStorageFormat( uno::Reference< beans::XPropertySet > xStorProps( xStorage, uno::UNO_QUERY_THROW ); OUString aMediaType; - xStorProps->getPropertyValue("MediaType") >>= aMediaType; + xStorProps->getPropertyValue(u"MediaType"_ustr) >>= aMediaType; sal_Int32 nResult = 0; @@ -305,7 +305,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL( sal_Int32 nStorageMode, const uno::Reference< uno::XComponentContext >& rxContext ) { - uno::Sequence< beans::PropertyValue > aProps{ comphelper::makePropertyValue("StorageFormat", + uno::Sequence< beans::PropertyValue > aProps{ comphelper::makePropertyValue(u"StorageFormat"_ustr, aFormat) }; uno::Sequence< uno::Any > aArgs{ uno::Any(aURL), uno::Any(nStorageMode), uno::Any(aProps) }; @@ -443,7 +443,7 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreateGpgPackageEncryptionDat uno::Sequence < sal_Int8 > aVector(32); if (rtl_random_getBytes(aRandomPool, aVector.getArray(), aVector.getLength()) != rtl_Random_E_None) { - throw uno::RuntimeException("rtl_random_getBytes failed"); + throw uno::RuntimeException(u"rtl_random_getBytes failed"_ustr); } rtl_random_destroyPool(aRandomPool); @@ -468,7 +468,7 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreateGpgPackageEncryptionDat std::unique_ptr<GpgME::Context> ctx; GpgME::Error err = GpgME::checkEngine(GpgME::OpenPGP); if (err) - throw uno::RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw uno::RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); bool bResetContext = true; for (const auto & cert : xSignCertificates) @@ -478,7 +478,7 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreateGpgPackageEncryptionDat bResetContext = false; ctx.reset( GpgME::Context::createForProtocol(GpgME::OpenPGP) ); if (ctx == nullptr) - throw uno::RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw uno::RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); ctx->setArmor(false); } @@ -535,21 +535,21 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreateGpgPackageEncryptionDat if(crypt_res.error() || !len) throw lang::IllegalArgumentException( - "Not a suitable key, or failed to encrypt.", + u"Not a suitable key, or failed to encrypt."_ustr, css::uno::Reference<css::uno::XInterface>(), -1); uno::Sequence < sal_Int8 > aCipherValue(len); result = cipher.seek(0,SEEK_SET); assert(result == 0); if( cipher.read(aCipherValue.getArray(), len) != len ) - throw uno::RuntimeException("The GpgME library failed to read the encrypted value."); + throw uno::RuntimeException(u"The GpgME library failed to read the encrypted value."_ustr); SAL_INFO("comphelper.crypto", "Generated gpg crypto of length: " << len); uno::Sequence< beans::NamedValue > aGpgEncryptionEntry{ - { "KeyId", uno::Any(aKeyID) }, - { "KeyPacket", uno::Any(aKeyID) }, - { "CipherValue", uno::Any(aCipherValue) } + { u"KeyId"_ustr, uno::Any(aKeyID) }, + { u"KeyPacket"_ustr, uno::Any(aKeyID) }, + { u"CipherValue"_ustr, uno::Any(aCipherValue) } }; aGpgEncryptions.push_back(aGpgEncryptionEntry); @@ -559,8 +559,8 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreateGpgPackageEncryptionDat = { { PACKAGE_ENCRYPTIONDATA_SHA256UTF8, uno::Any(aVector) } }; uno::Sequence<beans::NamedValue> aContainer - = { { "GpgInfos", uno::Any(comphelper::containerToSequence(aGpgEncryptions)) }, - { "EncryptionKey", uno::Any(aEncryptionData) } }; + = { { u"GpgInfos"_ustr, uno::Any(comphelper::containerToSequence(aGpgEncryptions)) }, + { u"EncryptionKey"_ustr, uno::Any(aEncryptionData) } }; return aContainer; #else @@ -706,7 +706,7 @@ OUString OStorageHelper::GetODFVersionFromStorage(const uno::Reference<embed::XS try { uno::Reference<beans::XPropertySet> xPropSet(xStorage, uno::UNO_QUERY_THROW); - xPropSet->getPropertyValue("Version") >>= aODFVersion; + xPropSet->getPropertyValue(u"Version"_ustr) >>= aODFVersion; } catch (uno::Exception&) { diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index 446e500e0250..8b72ad5f34a5 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -368,7 +368,7 @@ OUString convertCommaSeparated( { OUStringBuffer buf; ::comphelper::intersperse( - i_rSeq.begin(), i_rSeq.end(), ::comphelper::OUStringBufferAppender(buf), OUString( ", " )); + i_rSeq.begin(), i_rSeq.end(), ::comphelper::OUStringBufferAppender(buf), u", "_ustr); return buf.makeStringAndClear(); } diff --git a/comphelper/source/misc/types.cxx b/comphelper/source/misc/types.cxx index 8887d5b5ac92..8e5d42073bff 100644 --- a/comphelper/source/misc/types.cxx +++ b/comphelper/source/misc/types.cxx @@ -95,7 +95,7 @@ sal_Int32 getEnumAsINT32(const Any& _rAny) { sal_Int32 nReturn = 0; if (!::cppu::enum2int(nReturn, _rAny)) - throw IllegalArgumentException("enum2int failed", + throw IllegalArgumentException(u"enum2int failed"_ustr, css::uno::Reference<css::uno::XInterface>(), -1); return nReturn; } diff --git a/comphelper/source/misc/xmlsechelper.cxx b/comphelper/source/misc/xmlsechelper.cxx index e69f734b2b8b..e1bb828ba631 100644 --- a/comphelper/source/misc/xmlsechelper.cxx +++ b/comphelper/source/misc/xmlsechelper.cxx @@ -33,9 +33,9 @@ namespace comphelper::xmlsec switch (rKind) { case css::security::CertificateKind_X509: - return "X.509"; + return u"X.509"_ustr; case css::security::CertificateKind_OPENPGP: - return "OpenPGP"; + return u"OpenPGP"_ustr; default: return OUString(); } diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx index 010655964dcc..252ba2d5231e 100644 --- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx +++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx @@ -189,7 +189,7 @@ OfficeInstallationDirectories::makeAbsoluteURL( const OUString& URL ) OUString SAL_CALL OfficeInstallationDirectories::getImplementationName() { - return "com.sun.star.comp.util.OfficeInstallationDirectories"; + return u"com.sun.star.comp.util.OfficeInstallationDirectories"_ustr; } // virtual @@ -203,7 +203,7 @@ OfficeInstallationDirectories::supportsService( const OUString& ServiceName ) uno::Sequence< OUString > SAL_CALL OfficeInstallationDirectories::getSupportedServiceNames() { - return { "com.sun.star.util.OfficeInstallationDirectories" }; + return { u"com.sun.star.util.OfficeInstallationDirectories"_ustr }; } void OfficeInstallationDirectories::initDirs() @@ -217,7 +217,7 @@ void OfficeInstallationDirectories::initDirs() uno::Reference< util::XMacroExpander > xExpander = util::theMacroExpander::get(m_xCtx); - m_xOfficeBrandDir = xExpander->expandMacros( "$BRAND_BASE_DIR" ); + m_xOfficeBrandDir = xExpander->expandMacros( u"$BRAND_BASE_DIR"_ustr ); OSL_ENSURE( !m_xOfficeBrandDir->isEmpty(), "Unable to obtain office brand installation directory!" ); @@ -226,7 +226,7 @@ void OfficeInstallationDirectories::initDirs() m_xUserDir = xExpander->expandMacros( - "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE( "bootstrap" ) ":UserInstallation}" ); + u"${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE( "bootstrap" ) ":UserInstallation}"_ustr ); OSL_ENSURE( !m_xUserDir->isEmpty(), "Unable to obtain office user data directory!" ); diff --git a/comphelper/source/processfactory/processfactory.cxx b/comphelper/source/processfactory/processfactory.cxx index eddff2d45e04..00827434566f 100644 --- a/comphelper/source/processfactory/processfactory.cxx +++ b/comphelper/source/processfactory/processfactory.cxx @@ -75,7 +75,7 @@ Reference< XMultiServiceFactory > getProcessServiceFactory() Reference< XMultiServiceFactory> xReturn = localProcessFactory.get(); if ( !xReturn.is() ) { - throw DeploymentException( "null process service factory" ); + throw DeploymentException( u"null process service factory"_ustr ); } return xReturn; } @@ -100,7 +100,7 @@ Reference< XComponentContext > getComponentContext( if ( !xRet.is() ) { throw DeploymentException( - "no service factory DefaultContext", + u"no service factory DefaultContext"_ustr, Reference<XInterface>(factory, UNO_QUERY) ); } return xRet; diff --git a/comphelper/source/property/ChainablePropertySet.cxx b/comphelper/source/property/ChainablePropertySet.cxx index d2e7122996ed..dfb5c2b3f80d 100644 --- a/comphelper/source/property/ChainablePropertySet.cxx +++ b/comphelper/source/property/ChainablePropertySet.cxx @@ -117,7 +117,7 @@ void SAL_CALL ChainablePropertySet::setPropertyValues(const Sequence< OUString > const sal_Int32 nCount = rPropertyNames.getLength(); if( nCount != rValues.getLength() ) - throw IllegalArgumentException("lengths do not match", static_cast<cppu::OWeakObject*>(this), -1); + throw IllegalArgumentException(u"lengths do not match"_ustr, static_cast<cppu::OWeakObject*>(this), -1); if( !nCount ) return; diff --git a/comphelper/source/property/genericpropertyset.cxx b/comphelper/source/property/genericpropertyset.cxx index a6392ec757db..c33ed391ec96 100644 --- a/comphelper/source/property/genericpropertyset.cxx +++ b/comphelper/source/property/genericpropertyset.cxx @@ -217,12 +217,12 @@ sal_Bool SAL_CALL GenericPropertySet::supportsService( const OUString& ServiceN OUString SAL_CALL GenericPropertySet::getImplementationName() { - return "com.sun.star.comp.comphelper.GenericPropertySet"; + return u"com.sun.star.comp.comphelper.GenericPropertySet"_ustr; } Sequence< OUString > SAL_CALL GenericPropertySet::getSupportedServiceNames( ) { - return { "com.sun.star.beans.XPropertySet" }; + return { u"com.sun.star.beans.XPropertySet"_ustr }; } css::uno::Reference< css::beans::XPropertySet > comphelper::GenericPropertySet_CreateInstance( comphelper::PropertySetInfo* pInfo ) diff --git a/comphelper/source/property/opropertybag.cxx b/comphelper/source/property/opropertybag.cxx index 3b4a0498dcef..eec379ffd761 100644 --- a/comphelper/source/property/opropertybag.cxx +++ b/comphelper/source/property/opropertybag.cxx @@ -89,11 +89,11 @@ namespace comphelper } else { ::comphelper::NamedValueCollection aArguments( _rArguments ); - if ( aArguments.get_ensureType( "AllowedTypes", aTypes ) ) + if ( aArguments.get_ensureType( u"AllowedTypes"_ustr, aTypes ) ) m_aAllowedTypes.insert(std::cbegin(aTypes), std::cend(aTypes)); - aArguments.get_ensureType( "AutomaticAddition", m_bAutoAddProperties ); - aArguments.get_ensureType( "AllowEmptyPropertyName", + aArguments.get_ensureType( u"AutomaticAddition"_ustr, m_bAutoAddProperties ); + aArguments.get_ensureType( u"AllowEmptyPropertyName"_ustr, AllowEmptyPropertyName ); } if (AllowEmptyPropertyName) { @@ -104,7 +104,7 @@ namespace comphelper OUString SAL_CALL OPropertyBag::getImplementationName() { - return "com.sun.star.comp.comphelper.OPropertyBag"; + return u"com.sun.star.comp.comphelper.OPropertyBag"_ustr; } sal_Bool SAL_CALL OPropertyBag::supportsService( const OUString& rServiceName ) @@ -114,7 +114,7 @@ namespace comphelper Sequence< OUString > SAL_CALL OPropertyBag::getSupportedServiceNames( ) { - return { "com.sun.star.beans.PropertyBag" }; + return { u"com.sun.star.beans.PropertyBag"_ustr }; } void OPropertyBag::fireEvents( @@ -197,7 +197,7 @@ namespace comphelper // If we ever have a smarter XPropertyContainer::addProperty interface, we can remove this, ehm, well, hack. Property aProperty; if ( !( _element >>= aProperty ) ) - throw IllegalArgumentException( "element is not Property", *this, 1 ); + throw IllegalArgumentException( u"element is not Property"_ustr, *this, 1 ); { osl::MutexGuard g(m_aMutex); @@ -206,7 +206,7 @@ namespace comphelper // by m_aDynamicProperties if (!m_aAllowedTypes.empty() && m_aAllowedTypes.find(aProperty.Type) == m_aAllowedTypes.end()) - throw IllegalArgumentException("not in list of allowed types", *this, 1); + throw IllegalArgumentException(u"not in list of allowed types"_ustr, *this, 1); m_aDynamicProperties.addVoidProperty(aProperty.Name, aProperty.Type, findFreeHandle(), aProperty.Attributes); @@ -389,7 +389,7 @@ namespace comphelper { aValues = OPropertyBag_PBase::getPropertyValues( aNames ); if ( aValues.getLength() != aNames.getLength() ) - throw RuntimeException("property name and value counts out of sync"); + throw RuntimeException(u"property name and value counts out of sync"_ustr); } catch( const RuntimeException& ) { diff --git a/comphelper/source/property/propagg.cxx b/comphelper/source/property/propagg.cxx index 5acf8a1dc2d5..f84649b3bf19 100644 --- a/comphelper/source/property/propagg.cxx +++ b/comphelper/source/property/propagg.cxx @@ -588,7 +588,7 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues( else if (_rPropertyNames.getLength() == 1) // use the more efficient way { if (_rValues.getLength() != 1) - throw IllegalArgumentException("lengths do not match", static_cast<XPropertySet*>(this), + throw IllegalArgumentException(u"lengths do not match"_ustr, static_cast<XPropertySet*>(this), -1); try { @@ -633,7 +633,7 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues( else { if (_rValues.getLength() != nLen) - throw IllegalArgumentException("lengths do not match", + throw IllegalArgumentException(u"lengths do not match"_ustr, static_cast<XPropertySet*>(this), -1); // aggregate's names diff --git a/comphelper/source/property/propertybag.cxx b/comphelper/source/property/propertybag.cxx index 02e6f78c1287..b85786705cf0 100644 --- a/comphelper/source/property/propertybag.cxx +++ b/comphelper/source/property/propertybag.cxx @@ -70,7 +70,7 @@ namespace comphelper { if ( !_allowEmpty && _name.empty() ) throw IllegalArgumentException( - "The property name must not be empty.", + u"The property name must not be empty."_ustr, // TODO: resource nullptr, 1 @@ -81,7 +81,7 @@ namespace comphelper { if ( _container.hasPropertyByName( _name ) || _container.hasPropertyByHandle( _handle ) ) throw PropertyExistException( - "Property name or handle already used.", + u"Property name or handle already used."_ustr, nullptr ); } @@ -90,7 +90,7 @@ namespace comphelper { if ( _container.hasPropertyByName( _name ) || _container.hasPropertyByHandle( _handle ) ) throw ElementExistException( - "Property name or handle already used.", + u"Property name or handle already used."_ustr, nullptr ); } @@ -102,7 +102,7 @@ namespace comphelper { if ( _rType.getTypeClass() == TypeClass_VOID ) throw IllegalArgumentException( - "Illegal property type: VOID", + u"Illegal property type: VOID"_ustr, // TODO: resource nullptr, 1 @@ -127,7 +127,7 @@ namespace comphelper const Type& aPropertyType = _rInitialValue.getValueType(); if ( aPropertyType.getTypeClass() == TypeClass_VOID ) throw IllegalTypeException( - "The initial value must be non-NULL to determine the property type.", + u"The initial value must be non-NULL to determine the property type."_ustr, // TODO: resource nullptr ); diff --git a/comphelper/source/property/propshlp.cxx b/comphelper/source/property/propshlp.cxx index 307f48a42cbc..b0139c747969 100644 --- a/comphelper/source/property/propshlp.cxx +++ b/comphelper/source/property/propshlp.cxx @@ -755,8 +755,8 @@ void OPropertySetHelper::setPropertyValues(const Sequence<OUString>& rPropertyNa { sal_Int32 nSeqLen = rPropertyNames.getLength(); if (nSeqLen != rValues.getLength()) - throw IllegalArgumentException("lengths do not match", static_cast<XPropertySet*>(this), - -1); + throw IllegalArgumentException(u"lengths do not match"_ustr, + static_cast<XPropertySet*>(this), -1); std::unique_ptr<sal_Int32[]> pHandles(new sal_Int32[nSeqLen]); // get the map table IPropertyArrayHelper& rPH = getInfoHelper(); diff --git a/comphelper/source/streaming/memorystream.cxx b/comphelper/source/streaming/memorystream.cxx index 20d0fbd5766a..b457f4b42ca8 100644 --- a/comphelper/source/streaming/memorystream.cxx +++ b/comphelper/source/streaming/memorystream.cxx @@ -108,7 +108,7 @@ UNOMemoryStream::UNOMemoryStream() // XServiceInfo OUString SAL_CALL UNOMemoryStream::getImplementationName() { - return "com.sun.star.comp.MemoryStream"; + return u"com.sun.star.comp.MemoryStream"_ustr; } sal_Bool SAL_CALL UNOMemoryStream::supportsService(const OUString& ServiceName) @@ -118,7 +118,7 @@ sal_Bool SAL_CALL UNOMemoryStream::supportsService(const OUString& ServiceName) css::uno::Sequence<OUString> SAL_CALL UNOMemoryStream::getSupportedServiceNames() { - return { "com.sun.star.comp.MemoryStream" }; + return { u"com.sun.star.comp.MemoryStream"_ustr }; } // XStream @@ -136,7 +136,7 @@ Reference< XOutputStream > SAL_CALL UNOMemoryStream::getOutputStream( ) sal_Int32 SAL_CALL UNOMemoryStream::readBytes( Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) { if( nBytesToRead < 0 ) - throw IOException("nBytesToRead < 0"); + throw IOException(u"nBytesToRead < 0"_ustr); nBytesToRead = std::min( nBytesToRead, available() ); aData.realloc( nBytesToRead ); @@ -161,7 +161,7 @@ sal_Int32 SAL_CALL UNOMemoryStream::readSomeBytes( Sequence< sal_Int8 >& aData, void SAL_CALL UNOMemoryStream::skipBytes( sal_Int32 nBytesToSkip ) { if( nBytesToSkip < 0 ) - throw IOException("nBytesToSkip < 0"); + throw IOException(u"nBytesToSkip < 0"_ustr); mnCursor += std::min( nBytesToSkip, available() ); } @@ -180,7 +180,7 @@ void SAL_CALL UNOMemoryStream::closeInput() void SAL_CALL UNOMemoryStream::seek( sal_Int64 location ) { if( (location < 0) || (location > SAL_MAX_INT32) ) - throw IllegalArgumentException("this implementation does not support more than 2GB!", static_cast<OWeakObject*>(this), 0 ); + throw IllegalArgumentException(u"this implementation does not support more than 2GB!"_ustr, static_cast<OWeakObject*>(this), 0 ); // seek operation should be able to resize the stream if ( o3tl::make_unsigned(location) > maData.size() ) @@ -215,7 +215,7 @@ void UNOMemoryStream::writeBytes( const sal_Int8* pInData, sal_Int32 nBytesToWri if( nNewSize > SAL_MAX_INT32 ) { OSL_ASSERT(false); - throw IOException("this implementation does not support more than 2GB!", static_cast<OWeakObject*>(this) ); + throw IOException(u"this implementation does not support more than 2GB!"_ustr, static_cast<OWeakObject*>(this) ); } if( o3tl::make_unsigned( nNewSize ) > maData.size() ) diff --git a/comphelper/source/streaming/seekableinput.cxx b/comphelper/source/streaming/seekableinput.cxx index 264feaeb3071..6fd418df36ca 100644 --- a/comphelper/source/streaming/seekableinput.cxx +++ b/comphelper/source/streaming/seekableinput.cxx @@ -65,7 +65,7 @@ OSeekableInputWrapper::OSeekableInputWrapper( , m_xOriginalStream(std::move( xInStream )) { if ( !m_xContext.is() ) - throw lang::IllegalArgumentException("no component context", *this, 1); + throw lang::IllegalArgumentException(u"no component context"_ustr, *this, 1); } @@ -92,7 +92,7 @@ void OSeekableInputWrapper::PrepareCopy_Impl() if ( !m_xCopyInput.is() ) { if ( !m_xContext.is() ) - throw uno::RuntimeException("no component context"); + throw uno::RuntimeException(u"no component context"_ustr); uno::Reference< io::XOutputStream > xTempOut( io::TempFile::create(m_xContext), @@ -112,7 +112,7 @@ void OSeekableInputWrapper::PrepareCopy_Impl() } if ( !m_xCopyInput.is() ) - throw io::IOException("no m_xCopyInput"); + throw io::IOException(u"no m_xCopyInput"_ustr); } // XInputStream diff --git a/comphelper/source/streaming/seqinputstreamserv.cxx b/comphelper/source/streaming/seqinputstreamserv.cxx index 22fe8f8f0ea1..93d421f40fe6 100644 --- a/comphelper/source/streaming/seqinputstreamserv.cxx +++ b/comphelper/source/streaming/seqinputstreamserv.cxx @@ -86,7 +86,7 @@ SequenceInputStreamService::SequenceInputStreamService() // com.sun.star.uno.XServiceInfo: OUString SAL_CALL SequenceInputStreamService::getImplementationName() { - return "com.sun.star.comp.SequenceInputStreamService"; + return u"com.sun.star.comp.SequenceInputStreamService"_ustr; } sal_Bool SAL_CALL SequenceInputStreamService::supportsService( OUString const & serviceName ) @@ -96,7 +96,7 @@ sal_Bool SAL_CALL SequenceInputStreamService::supportsService( OUString const & uno::Sequence< OUString > SAL_CALL SequenceInputStreamService::getSupportedServiceNames() { - return { "com.sun.star.io.SequenceInputStream" }; + return { u"com.sun.star.io.SequenceInputStream"_ustr }; } // css::io::XInputStream: @@ -183,13 +183,13 @@ void SAL_CALL SequenceInputStreamService::initialize( const uno::Sequence< css:: throw frame::DoubleInitializationException(); if ( aArguments.getLength() != 1 ) - throw lang::IllegalArgumentException( "Wrong number of arguments!", + throw lang::IllegalArgumentException( u"Wrong number of arguments!"_ustr, static_cast< ::cppu::OWeakObject* >(this), 1 ); uno::Sequence< sal_Int8 > aSeq; if ( !(aArguments[0] >>= aSeq) ) - throw lang::IllegalArgumentException( "Unexpected type of argument!", + throw lang::IllegalArgumentException( u"Unexpected type of argument!"_ustr, static_cast< ::cppu::OWeakObject* >(this), 1 ); diff --git a/comphelper/source/streaming/seqoutputstreamserv.cxx b/comphelper/source/streaming/seqoutputstreamserv.cxx index 19ef79002978..144ba259a37d 100644 --- a/comphelper/source/streaming/seqoutputstreamserv.cxx +++ b/comphelper/source/streaming/seqoutputstreamserv.cxx @@ -74,7 +74,7 @@ SequenceOutputStreamService::SequenceOutputStreamService() // com.sun.star.uno.XServiceInfo: OUString SAL_CALL SequenceOutputStreamService::getImplementationName() { - return "com.sun.star.comp.SequenceOutputStreamService"; + return u"com.sun.star.comp.SequenceOutputStreamService"_ustr; } sal_Bool SAL_CALL SequenceOutputStreamService::supportsService( OUString const & serviceName ) @@ -84,7 +84,7 @@ sal_Bool SAL_CALL SequenceOutputStreamService::supportsService( OUString const & uno::Sequence< OUString > SAL_CALL SequenceOutputStreamService::getSupportedServiceNames() { - return { "com.sun.star.io.SequenceOutputStream" }; + return { u"com.sun.star.io.SequenceOutputStream"_ustr }; } // css::io::XOutputStream: diff --git a/comphelper/source/streaming/seqstream.cxx b/comphelper/source/streaming/seqstream.cxx index c7bfde712c74..03e0b7269adb 100644 --- a/comphelper/source/streaming/seqstream.cxx +++ b/comphelper/source/streaming/seqstream.cxx @@ -136,7 +136,7 @@ void SAL_CALL MemoryInputStream::closeInput( ) void SAL_CALL MemoryInputStream::seek( sal_Int64 location ) { if ( location > m_nMemoryDataLength || location < 0 || location > SAL_MAX_INT32 ) - throw IllegalArgumentException("bad location", static_cast<cppu::OWeakObject*>(this), 1); + throw IllegalArgumentException(u"bad location"_ustr, static_cast<cppu::OWeakObject*>(this), 1); std::scoped_lock aGuard( m_aMutex ); m_nPos = static_cast<sal_Int32>(location); } diff --git a/comphelper/source/xml/ofopxmlhelper.cxx b/comphelper/source/xml/ofopxmlhelper.cxx index a672bf57a6fb..c678d7841c0b 100644 --- a/comphelper/source/xml/ofopxmlhelper.cxx +++ b/comphelper/source/xml/ofopxmlhelper.cxx @@ -92,7 +92,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > ReadContentTypeSequence( const uno::Reference< io::XInputStream >& xInStream, const uno::Reference< uno::XComponentContext >& rContext ) { - return ReadSequence_Impl( xInStream, "[Content_Types].xml", CONTENTTYPE_FORMAT, rContext ); + return ReadSequence_Impl( xInStream, u"[Content_Types].xml"_ustr, CONTENTTYPE_FORMAT, rContext ); } OUString GetContentTypeByName( @@ -140,15 +140,15 @@ void WriteRelationsInfoSequence( xWriter->setOutputStream( xOutStream ); - OUString aRelListElement( "Relationships" ); - OUString aRelElement( "Relationship" ); - OUString aWhiteSpace( " " ); + OUString aRelListElement( u"Relationships"_ustr ); + OUString aRelElement( u"Relationship"_ustr ); + OUString aWhiteSpace( u" "_ustr ); // write the namespace rtl::Reference<AttributeList> pRootAttrList = new AttributeList; pRootAttrList->AddAttribute( - "xmlns", - "http://schemas.openxmlformats.org/package/2006/relationships" ); + u"xmlns"_ustr, + u"http://schemas.openxmlformats.org/package/2006/relationships"_ustr ); xWriter->startDocument(); xWriter->startElement( aRelListElement, pRootAttrList ); @@ -202,8 +202,8 @@ void WriteContentSequence( // write the namespace rtl::Reference<AttributeList> pRootAttrList = new AttributeList; pRootAttrList->AddAttribute( - "xmlns", - "http://schemas.openxmlformats.org/package/2006/content-types" ); + u"xmlns"_ustr, + u"http://schemas.openxmlformats.org/package/2006/content-types"_ustr ); xWriter->startDocument(); xWriter->startElement( aTypesElement, pRootAttrList ); @@ -211,7 +211,7 @@ void WriteContentSequence( for ( const beans::StringPair & pair : aDefaultsSequence ) { rtl::Reference<AttributeList> pAttrList = new AttributeList; - pAttrList->AddAttribute( "Extension", pair.First ); + pAttrList->AddAttribute( u"Extension"_ustr, pair.First ); pAttrList->AddAttribute( aContentTypeAttr, pair.Second ); xWriter->startElement( aDefaultElement, pAttrList ); @@ -222,7 +222,7 @@ void WriteContentSequence( for ( const beans::StringPair & pair : aOverridesSequence ) { rtl::Reference<AttributeList> pAttrList = new AttributeList; - pAttrList->AddAttribute( "PartName", pair.First ); + pAttrList->AddAttribute( u"PartName"_ustr, pair.First ); pAttrList->AddAttribute( aContentTypeAttr, pair.Second ); xWriter->startElement( aOverrideElement, pAttrList ); diff --git a/include/comphelper/SetFlagContextHelper.hxx b/include/comphelper/SetFlagContextHelper.hxx index b1b15eabba26..0df596a9ee5f 100644 --- a/include/comphelper/SetFlagContextHelper.hxx +++ b/include/comphelper/SetFlagContextHelper.hxx @@ -53,7 +53,7 @@ inline css::uno::Reference<css::uno::XCurrentContext> NewFlagContext(const OUStr // A specialization for preventing "Java must be enabled" interaction inline css::uno::Reference<css::uno::XCurrentContext> NoEnableJavaInteractionContext() { - return NewFlagContext("DontEnableJava"); + return NewFlagContext(u"DontEnableJava"_ustr); } inline bool IsContextFlagActive(const OUString& sName) diff --git a/include/comphelper/attributelist.hxx b/include/comphelper/attributelist.hxx index 35f9de82b590..e49beeb5fd60 100644 --- a/include/comphelper/attributelist.hxx +++ b/include/comphelper/attributelist.hxx @@ -71,8 +71,8 @@ public: { return mAttributes[i].sName; } - virtual OUString SAL_CALL getTypeByIndex(sal_Int16) override { return "CDATA"; } - virtual OUString SAL_CALL getTypeByName(const OUString&) override { return "CDATA"; } + virtual OUString SAL_CALL getTypeByIndex(sal_Int16) override { return u"CDATA"_ustr; } + virtual OUString SAL_CALL getTypeByName(const OUString&) override { return u"CDATA"_ustr; } virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) override { return mAttributes[i].sValue; diff --git a/include/comphelper/traceevent.hxx b/include/comphelper/traceevent.hxx index 6409c43eee4a..3d44a7a2dbe7 100644 --- a/include/comphelper/traceevent.hxx +++ b/include/comphelper/traceevent.hxx @@ -61,7 +61,7 @@ protected: static OUString createArgsString(const std::map<OUString, OUString>& args) { if (args.size() == 0) - return ""; + return u""_ustr; OUStringBuffer sResult(",\"args\":{"); bool first = true; diff --git a/include/comphelper/unique_disposing_ptr.hxx b/include/comphelper/unique_disposing_ptr.hxx index 5994799fc4bb..7f5def02508e 100644 --- a/include/comphelper/unique_disposing_ptr.hxx +++ b/include/comphelper/unique_disposing_ptr.hxx @@ -137,9 +137,9 @@ private: virtual OUString SAL_CALL getImplementationName() override { if (mbComponentDLL) - return "com.sun.star.comp.ComponentDLLListener"; + return u"com.sun.star.comp.ComponentDLLListener"_ustr; else - return "com.sun.star.comp.DisposingTerminateListener"; + return u"com.sun.star.comp.DisposingTerminateListener"_ustr; } virtual sal_Bool SAL_CALL supportsService(const OUString& /*rName*/) override diff --git a/include/comphelper/unwrapargs.hxx b/include/comphelper/unwrapargs.hxx index 76eb8b838dff..9bae72e77f0c 100644 --- a/include/comphelper/unwrapargs.hxx +++ b/include/comphelper/unwrapargs.hxx @@ -75,7 +75,7 @@ namespace detail { { if( seq.getLength() <= nArg ) { - return unwrapArgsError( OUString( "No such argument available!"), + return unwrapArgsError( u"No such argument available!"_ustr, nArg, args... ); } if( !fromAny( seq[nArg], &v ) ) |