From 7d6e751faa545552de7859cd6530926676caf09f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 6 May 2024 10:17:54 +0200 Subject: [PATCH] loplugin:ostr basic Change-Id: Ie5fc4676bd1cab2c0417b479bf08dda00936469a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167191 Tested-by: Jenkins Reviewed-by: Noel Grandin --- basic/qa/cppunit/basic_coverage.cxx | 6 +- basic/qa/cppunit/basictest.cxx | 4 +- basic/qa/cppunit/test_append.cxx | 12 +- basic/qa/cppunit/test_compiler_checks.cxx | 48 +-- basic/qa/cppunit/test_global_array.cxx | 12 +- basic/qa/cppunit/test_global_as_new.cxx | 12 +- .../qa/cppunit/test_language_conditionals.cxx | 24 +- basic/qa/cppunit/test_nested_struct.cxx | 40 +-- basic/qa/cppunit/test_scanner.cxx | 283 +++++++++--------- basic/qa/cppunit/test_tdf149714.cxx | 7 +- basic/qa/cppunit/test_vba.cxx | 6 +- .../source/basmgr/basicmanagerrepository.cxx | 8 +- basic/source/basmgr/basmgr.cxx | 12 +- basic/source/classes/errobject.cxx | 6 +- basic/source/classes/eventatt.cxx | 10 +- basic/source/classes/image.cxx | 4 +- basic/source/classes/propacc.cxx | 2 +- basic/source/classes/sb.cxx | 44 +-- basic/source/classes/sbunoobj.cxx | 28 +- basic/source/classes/sbxmod.cxx | 66 ++-- basic/source/comp/codegen.cxx | 6 +- basic/source/comp/dim.cxx | 12 +- basic/source/comp/exprgen.cxx | 2 +- basic/source/comp/exprtree.cxx | 2 +- basic/source/comp/io.cxx | 2 +- basic/source/comp/loops.cxx | 6 +- basic/source/comp/parser.cxx | 56 ++-- basic/source/comp/symtbl.cxx | 4 +- basic/source/comp/token.cxx | 2 +- basic/source/runtime/comenumwrapper.cxx | 4 +- basic/source/runtime/inputbox.cxx | 10 +- basic/source/runtime/iosys.cxx | 12 +- basic/source/runtime/methods.cxx | 12 +- basic/source/runtime/methods1.cxx | 28 +- basic/source/runtime/runtime.cxx | 2 +- basic/source/runtime/stdobj.cxx | 4 +- basic/source/runtime/stdobj1.cxx | 38 +-- basic/source/sbx/sbxbase.cxx | 6 +- basic/source/sbx/sbxcoll.cxx | 2 +- basic/source/sbx/sbxform.cxx | 2 +- basic/source/sbx/sbxobj.cxx | 2 +- basic/source/sbx/sbxscan.cxx | 2 +- basic/source/uno/dlgcont.cxx | 16 +- basic/source/uno/namecont.cxx | 62 ++-- basic/source/uno/scriptcont.cxx | 34 +-- 45 files changed, 481 insertions(+), 481 deletions(-) diff --git a/basic/qa/cppunit/basic_coverage.cxx b/basic/qa/cppunit/basic_coverage.cxx index 0f0722917232..6f68e19dac4b 100644 --- a/basic/qa/cppunit/basic_coverage.cxx +++ b/basic/qa/cppunit/basic_coverage.cxx @@ -77,14 +77,14 @@ void Coverage::process_directory(const OUString& sDirName) if (sFileURL.endsWith(".bas")) { MacroSnippet testMacro; - testMacro.LoadSourceFromFile("TestUtil", sMacroUtilsURL); - testMacro.LoadSourceFromFile("TestModule", sFileURL); + testMacro.LoadSourceFromFile(u"TestUtil"_ustr, sMacroUtilsURL); + testMacro.LoadSourceFromFile(u"TestModule"_ustr, sFileURL); SbxVariableRef pReturn = testMacro.Run(); CPPUNIT_ASSERT_MESSAGE("No return variable huh?", pReturn.is()); fprintf(stderr, "macro result for %s\n", OUStringToOString(sFileURL,RTL_TEXTENCODING_UTF8).getStr()); fprintf(stderr, "macro returned:\n%s\n", OUStringToOString(pReturn->GetOUString(), RTL_TEXTENCODING_UTF8).getStr()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Result not as expected", OUString("OK"), + CPPUNIT_ASSERT_EQUAL_MESSAGE("Result not as expected", u"OK"_ustr, pReturn->GetOUString()); } } diff --git a/basic/qa/cppunit/basictest.cxx b/basic/qa/cppunit/basictest.cxx index 13dc8c72e4cb..f93961deab8a 100644 --- a/basic/qa/cppunit/basictest.cxx +++ b/basic/qa/cppunit/basictest.cxx @@ -30,7 +30,7 @@ MacroSnippet::MacroSnippet( const OUString& sSource ) : mbError(false) { InitSnippet(); - MakeModule("TestModule", sSource); + MakeModule(u"TestModule"_ustr, sSource); } MacroSnippet::MacroSnippet() @@ -74,7 +74,7 @@ SbxVariableRef MacroSnippet::Run( const css::uno::Sequence< css::uno::Any >& rAr SbxVariableRef pReturn; if ( !Compile() ) return pReturn; - SbMethod* pMeth = mpMod.is() ? static_cast(mpMod->Find( "doUnitTest", SbxClassType::Method )) : nullptr; + SbMethod* pMeth = mpMod.is() ? static_cast(mpMod->Find( u"doUnitTest"_ustr, SbxClassType::Method )) : nullptr; if ( pMeth ) { if ( rArgs.hasElements() ) diff --git a/basic/qa/cppunit/test_append.cxx b/basic/qa/cppunit/test_append.cxx index aa3280a4ad86..d2de74167a70 100644 --- a/basic/qa/cppunit/test_append.cxx +++ b/basic/qa/cppunit/test_append.cxx @@ -31,18 +31,18 @@ namespace }; OUString sTestEnableRuntime( - "Function doUnitTest as Integer\n" + u"Function doUnitTest as Integer\n" "Dim Enable as Integer\n" "Enable = 1\n" "Enable = Enable + 2\n" "doUnitTest = Enable\n" - "End Function\n" + "End Function\n"_ustr ); OUString sTestDimEnable( - "Sub doUnitTest\n" + u"Sub doUnitTest\n" "Dim Enable as String\n" - "End Sub\n" + "End Sub\n"_ustr ); void EnableTest::testEnableRuntime() @@ -63,10 +63,10 @@ void EnableTest::testDimEnable() void EnableTest::testWin64() { - MacroSnippet myMacro(" #If Win64\n" + MacroSnippet myMacro(u" #If Win64\n" "Declare PtrSafe Function aht_apiGetOpenFileName Lib \"comdlg32.dll\"" "\n" - "#End if\n"); + "#End if\n"_ustr); myMacro.Compile(); CPPUNIT_ASSERT_MESSAGE("#if Win64 Declare PtrSafe causes compile error", !myMacro.HasError() ); } diff --git a/basic/qa/cppunit/test_compiler_checks.cxx b/basic/qa/cppunit/test_compiler_checks.cxx index 2b8e72997c64..06586aaa3382 100644 --- a/basic/qa/cppunit/test_compiler_checks.cxx +++ b/basic/qa/cppunit/test_compiler_checks.cxx @@ -14,11 +14,11 @@ CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testRedefineArgument) { - MacroSnippet aMacro("Sub doUnitTest(argName)\n" + MacroSnippet aMacro(u"Sub doUnitTest(argName)\n" " If False Then\n" " Dim argName\n" " End If\n" - "End Sub\n"); + "End Sub\n"_ustr); aMacro.Compile(); CPPUNIT_ASSERT(aMacro.HasError()); CPPUNIT_ASSERT_EQUAL(ERRCODE_BASIC_VAR_DEFINED, aMacro.getError().GetCode()); @@ -26,8 +26,8 @@ CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testRedefineArgument) CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testDoubleArgument) { - MacroSnippet aMacro("Sub doUnitTest(argName, argName)\n" - "End Sub\n"); + MacroSnippet aMacro(u"Sub doUnitTest(argName, argName)\n" + "End Sub\n"_ustr); aMacro.Compile(); CPPUNIT_ASSERT(aMacro.HasError()); CPPUNIT_ASSERT_EQUAL(ERRCODE_BASIC_VAR_DEFINED, aMacro.getError().GetCode()); @@ -35,81 +35,81 @@ CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testDoubleArgument) CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf149157) { - MacroSnippet aMacro("Function extentComment() As Integer\n" + MacroSnippet aMacro(u"Function extentComment() As Integer\n" " ' _\n" " If Not extentComment Then\n" " extentComment = 1\n" " End If\n" - "End Function\n"); + "End Function\n"_ustr); aMacro.Compile(); CPPUNIT_ASSERT(!aMacro.HasError()); } CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf149157_compatible) { - MacroSnippet aMacro("Option Compatible\n" + MacroSnippet aMacro(u"Option Compatible\n" "Function extentComment() As Integer\n" " ' _\n" "\n" " If Not extentComment Then\n" " extentComment = 1\n" " End If\n" - "End Function\n"); + "End Function\n"_ustr); aMacro.Compile(); CPPUNIT_ASSERT(!aMacro.HasError()); } CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf149157_vba) { - MacroSnippet aMacro("Option VBASupport 1\n" + MacroSnippet aMacro(u"Option VBASupport 1\n" "Function extentComment() As Integer\n" " ' _\n" "\n" " If Not extentComment Then\n" " extentComment = 1\n" " End If\n" - "End Function\n"); + "End Function\n"_ustr); aMacro.Compile(); CPPUNIT_ASSERT(!aMacro.HasError()); } CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf149402) { - MacroSnippet aMacro("Function extentComment() As Integer\n" + MacroSnippet aMacro(u"Function extentComment() As Integer\n" " ' _ \n" " If Not extentComment Then\n" " extentComment = 1\n" " Else\n" " End If\n" - "End Function\n"); + "End Function\n"_ustr); aMacro.Compile(); CPPUNIT_ASSERT(!aMacro.HasError()); } CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf149402_compatible) { - MacroSnippet aMacro("Option Compatible\n" + MacroSnippet aMacro(u"Option Compatible\n" "Function extentComment() As Integer\n" " ' _ \n" " If Not extentComment Then\n" " extentComment = 1\n" " Else\n" " End If\n" - "End Function\n"); + "End Function\n"_ustr); aMacro.Compile(); CPPUNIT_ASSERT(!aMacro.HasError()); } CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf149402_vba) { - MacroSnippet aMacro("Option VBASupport 1\n" + MacroSnippet aMacro(u"Option VBASupport 1\n" "Function extentComment() As Integer\n" " ' _ \n" " If Not extentComment Then\n" " extentComment = 1\n" " Else\n" " End If\n" - "End Function\n"); + "End Function\n"_ustr); aMacro.Compile(); CPPUNIT_ASSERT(!aMacro.HasError()); } @@ -117,11 +117,11 @@ CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf149402_vba) CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf93727_if) { // #If and #End directive - MacroSnippet aMacro("Sub doUnitTest\n" + MacroSnippet aMacro(u"Sub doUnitTest\n" " #If 1 = 1 Then\n" " Const a = 10\n" " #End If\n" - "End Sub\n"); + "End Sub\n"_ustr); aMacro.Compile(); CPPUNIT_ASSERT_MESSAGE("#If directive causes compile error", !aMacro.HasError()); } @@ -129,14 +129,14 @@ CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf93727_if) CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf93727_else) { // #Else directive - MacroSnippet aMacro("Sub doUnitTest\n" + MacroSnippet aMacro(u"Sub doUnitTest\n" "a = 0\n" "#If 1 = 0 Then\n" " a = 10\n" "#Else\n" " a = 20\n" "#End If\n" - "End Sub\n"); + "End Sub\n"_ustr); aMacro.Compile(); CPPUNIT_ASSERT_MESSAGE("#Else directive causes compile error", !aMacro.HasError()); } @@ -144,14 +144,14 @@ CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf93727_else) CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf93727_elseif) { // #ElseIf directive - MacroSnippet aMacro("Sub doUnitTest\n" + MacroSnippet aMacro(u"Sub doUnitTest\n" "a = 0\n" " #If 1 = 0 Then\n" " a = 10\n" " #ElseIf 2 = 2 Then\n" " a = 20\n" " #End If\n" - "End Sub\n"); + "End Sub\n"_ustr); aMacro.Compile(); CPPUNIT_ASSERT_MESSAGE("#ElseIf directive causes compile error", !aMacro.HasError()); } @@ -159,11 +159,11 @@ CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf93727_elseif) CPPUNIT_TEST_FIXTURE(CppUnit::TestFixture, testTdf93727_const) { // #Const directive - MacroSnippet aMacro("#Const MaxValue = 1000\n" + MacroSnippet aMacro(u"#Const MaxValue = 1000\n" "Sub doUnitTest\n" " Dim value As Integer\n" " value = MaxValue\n" - "End Sub\n"); + "End Sub\n"_ustr); aMacro.Compile(); CPPUNIT_ASSERT_MESSAGE("#Const directive causes compile error", !aMacro.HasError()); } diff --git a/basic/qa/cppunit/test_global_array.cxx b/basic/qa/cppunit/test_global_array.cxx index d2dafcfbda00..3d978872245e 100644 --- a/basic/qa/cppunit/test_global_array.cxx +++ b/basic/qa/cppunit/test_global_array.cxx @@ -28,7 +28,7 @@ class GlobalArrayTest : public CppUnit::TestFixture SbModuleRef Module() { interpreter = new StarBASIC(); - auto mod = interpreter->MakeModule("GlobalArray", R"BAS( + auto mod = interpreter->MakeModule(u"GlobalArray"_ustr, uR"BAS( Type testType iNr As Integer @@ -49,7 +49,7 @@ Function Macro2 As String Macro2 = aTestTypes(0).iNr & aTestTypes(0).sType & aTestTypes(1).iNr & aTestTypes(1).sType End Function - )BAS"); + )BAS"_ustr); CPPUNIT_ASSERT(mod->Compile()); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, StarBASIC::GetErrBasic()); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, SbxBase::GetError()); @@ -61,15 +61,15 @@ End Function void GlobalArrayTest::testMaintainsValueAcrossCalls() { auto m = Module(); - auto Macro1 = m->FindMethod("Macro1", SbxClassType::Method); + auto Macro1 = m->FindMethod(u"Macro1"_ustr, SbxClassType::Method); CPPUNIT_ASSERT_MESSAGE("Could not Find Macro1 in module", Macro1 != nullptr); // There is no SbxMethod::call(), the basic code is exercised here in the copy ctor SbxVariableRef returned = new SbxMethod{ *Macro1 }; CPPUNIT_ASSERT(returned->IsString()); - CPPUNIT_ASSERT_EQUAL(OUString{ "1A" }, returned->GetOUString()); + CPPUNIT_ASSERT_EQUAL(u"1A"_ustr, returned->GetOUString()); - auto Macro2 = m->FindMethod("Macro2", SbxClassType::Method); + auto Macro2 = m->FindMethod(u"Macro2"_ustr, SbxClassType::Method); CPPUNIT_ASSERT_MESSAGE("Could not Find Macro2 in module", Macro2 != nullptr); returned = new SbxMethod{ *Macro2 }; CPPUNIT_ASSERT(returned->IsString()); @@ -77,7 +77,7 @@ void GlobalArrayTest::testMaintainsValueAcrossCalls() // Without the fix in place, this test would have failed with: // - Expected: 1A2B // - Actual : 02B - CPPUNIT_ASSERT_EQUAL(OUString("1A2B"), returned->GetOUString()); + CPPUNIT_ASSERT_EQUAL(u"1A2B"_ustr, returned->GetOUString()); } // Put the test suite in the registry diff --git a/basic/qa/cppunit/test_global_as_new.cxx b/basic/qa/cppunit/test_global_as_new.cxx index 868f62d3ec15..44b767259985 100644 --- a/basic/qa/cppunit/test_global_as_new.cxx +++ b/basic/qa/cppunit/test_global_as_new.cxx @@ -28,7 +28,7 @@ class GlobalAsNewTest : public CppUnit::TestFixture SbModuleRef Module() { interpreter = new StarBASIC(); - auto mod = interpreter->MakeModule("GlobalAsNew", R"BAS( + auto mod = interpreter->MakeModule(u"GlobalAsNew"_ustr, uR"BAS( Global aDate As New "com.sun.star.util.Date" Function GetDateAsString As String @@ -43,7 +43,7 @@ Function SetDate SetDate = GetDateAsString() End Function - )BAS"); + )BAS"_ustr); CPPUNIT_ASSERT(mod->Compile()); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, StarBASIC::GetErrBasic()); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, SbxBase::GetError()); @@ -55,20 +55,20 @@ End Function void GlobalAsNewTest::testMaintainsValueAcrossCalls() { auto m = Module(); - auto GetDateAsString = m->FindMethod("GetDateAsString", SbxClassType::Method); + auto GetDateAsString = m->FindMethod(u"GetDateAsString"_ustr, SbxClassType::Method); CPPUNIT_ASSERT_MESSAGE("Could not Find GetDateAsString in module", GetDateAsString != nullptr); // There is no SbxMethod::call(), the basic code is exercised here in the copy ctor SbxVariableRef returned = new SbxMethod{ *GetDateAsString }; CPPUNIT_ASSERT(returned->IsString()); //0-00-0 is the result of reading the default-initialized date - CPPUNIT_ASSERT_EQUAL(OUString{ "0-00-0" }, returned->GetOUString()); + CPPUNIT_ASSERT_EQUAL(u"0-00-0"_ustr, returned->GetOUString()); - auto SetDate = m->FindMethod("SetDate", SbxClassType::Method); + auto SetDate = m->FindMethod(u"SetDate"_ustr, SbxClassType::Method); CPPUNIT_ASSERT_MESSAGE("Could not Find SetDate in module", SetDate != nullptr); returned = new SbxMethod{ *SetDate }; CPPUNIT_ASSERT(returned->IsString()); - OUString set_val("2019-06-30"); + OUString set_val(u"2019-06-30"_ustr); CPPUNIT_ASSERT_EQUAL(set_val, returned->GetOUString()); returned = new SbxMethod{ *GetDateAsString }; diff --git a/basic/qa/cppunit/test_language_conditionals.cxx b/basic/qa/cppunit/test_language_conditionals.cxx index c35d5571e9db..d32b6c6fe144 100644 --- a/basic/qa/cppunit/test_language_conditionals.cxx +++ b/basic/qa/cppunit/test_language_conditionals.cxx @@ -34,7 +34,7 @@ public: void Language_Conditionals::testIfNot() { { // need a block to ensure MacroSnippet is cleaned properly - MacroSnippet myMacro("Option VBASupport 1\n" + MacroSnippet myMacro(u"Option VBASupport 1\n" "Option Explicit\n" "\n" "Function doUnitTest() As Integer\n" @@ -45,14 +45,14 @@ void Language_Conditionals::testIfNot() "Else\n" "doUnitTest = 0\n" "End If\n" - "End Function\n"); + "End Function\n"_ustr); myMacro.Compile(); CPPUNIT_ASSERT(!myMacro.HasError()); SbxVariableRef pNew = myMacro.Run(); CPPUNIT_ASSERT_EQUAL(static_cast(1), pNew->GetInteger()); } { // need a block to ensure MacroSnippet is cleaned properly - MacroSnippet myMacro("Option VBASupport 0\n" + MacroSnippet myMacro(u"Option VBASupport 0\n" "Option Explicit\n" "\n" "Function doUnitTest() As Integer\n" @@ -63,7 +63,7 @@ void Language_Conditionals::testIfNot() "Else\n" "doUnitTest = 0\n" "End If\n" - "End Function\n"); + "End Function\n"_ustr); myMacro.Compile(); CPPUNIT_ASSERT(!myMacro.HasError()); SbxVariableRef pNew = myMacro.Run(); @@ -74,7 +74,7 @@ void Language_Conditionals::testIfNot() void Language_Conditionals::testIfAndNot() { { // need a block to ensure MacroSnippet is cleaned properly - MacroSnippet myMacro("Option VBASupport 1\n" + MacroSnippet myMacro(u"Option VBASupport 1\n" "Option Explicit\n" "\n" "Function doUnitTest() As Integer\n" @@ -87,14 +87,14 @@ void Language_Conditionals::testIfAndNot() "Else\n" "doUnitTest = 0\n" "End If\n" - "End Function\n"); + "End Function\n"_ustr); myMacro.Compile(); CPPUNIT_ASSERT(!myMacro.HasError()); SbxVariableRef pNew = myMacro.Run(); CPPUNIT_ASSERT_EQUAL(static_cast(1), pNew->GetInteger()); } { // need a block to ensure MacroSnippet is cleaned properly - MacroSnippet myMacro("Option VBASupport 0\n" + MacroSnippet myMacro(u"Option VBASupport 0\n" "Option Explicit\n" "\n" "Function doUnitTest() As Integer\n" @@ -107,7 +107,7 @@ void Language_Conditionals::testIfAndNot() "Else\n" "doUnitTest = 0\n" "End If\n" - "End Function\n"); + "End Function\n"_ustr); myMacro.Compile(); CPPUNIT_ASSERT(!myMacro.HasError()); SbxVariableRef pNew = myMacro.Run(); @@ -118,7 +118,7 @@ void Language_Conditionals::testIfAndNot() void Language_Conditionals::testNENot() { { // need a block to ensure MacroSnippet is cleaned properly - MacroSnippet myMacro("Option VBASupport 1\n" + MacroSnippet myMacro(u"Option VBASupport 1\n" "Option Explicit\n" "\n" "Function doUnitTest() As Integer\n" @@ -131,14 +131,14 @@ void Language_Conditionals::testNENot() "Else\n" "doUnitTest = 0\n" "End If\n" - "End Function\n"); + "End Function\n"_ustr); myMacro.Compile(); CPPUNIT_ASSERT(!myMacro.HasError()); SbxVariableRef pNew = myMacro.Run(); CPPUNIT_ASSERT_EQUAL(static_cast(1), pNew->GetInteger()); } { // need a block to ensure MacroSnippet is cleaned properly - MacroSnippet myMacro("Option VBASupport 0\n" + MacroSnippet myMacro(u"Option VBASupport 0\n" "Option Explicit\n" "\n" "Function doUnitTest() As Integer\n" @@ -151,7 +151,7 @@ void Language_Conditionals::testNENot() "Else\n" "doUnitTest = 0\n" "End If\n" - "End Function\n"); + "End Function\n"_ustr); myMacro.Compile(); CPPUNIT_ASSERT(!myMacro.HasError()); SbxVariableRef pNew = myMacro.Run(); diff --git a/basic/qa/cppunit/test_nested_struct.cxx b/basic/qa/cppunit/test_nested_struct.cxx index daced48ba2bf..c7b9127592e2 100644 --- a/basic/qa/cppunit/test_nested_struct.cxx +++ b/basic/qa/cppunit/test_nested_struct.cxx @@ -52,19 +52,19 @@ namespace // tests the new behaviour, we should be able to // directly modify the value of the nested 'HorizontalLine' struct OUString sTestSource1( - "Function doUnitTest() as Integer\n" + u"Function doUnitTest() as Integer\n" "Dim b0 as new \"com.sun.star.table.TableBorder\"\n" "b0.HorizontalLine.OuterLineWidth = 9\n" "doUnitTest = b0.HorizontalLine.OuterLineWidth\n" - "End Function\n" + "End Function\n"_ustr ); OUString sTestSource1Alt( - "Function doUnitTest() as Object\n" + u"Function doUnitTest() as Object\n" "Dim b0 as new \"com.sun.star.table.TableBorder\"\n" "b0.HorizontalLine.OuterLineWidth = 9\n" "doUnitTest = b0\n" - "End Function\n" + "End Function\n"_ustr ); // tests the old behaviour, we should still be able @@ -74,23 +74,23 @@ OUString sTestSource1Alt( // c) modifying the new instance // d) setting b0.HorizontalLine with the value of the new instance OUString sTestSource2( - "Function doUnitTest()\n" + u"Function doUnitTest()\n" "Dim b0 as new \"com.sun.star.table.TableBorder\", l as new \"com.sun.star.table.BorderLine\"\n" "l = b0.HorizontalLine\n" "l.OuterLineWidth = 9\n" "b0.HorizontalLine = l\n" "doUnitTest = b0.HorizontalLine.OuterLineWidth\n" -"End Function\n" +"End Function\n"_ustr ); OUString sTestSource2Alt( - "Function doUnitTest()\n" + u"Function doUnitTest()\n" "Dim b0 as new \"com.sun.star.table.TableBorder\", l as new \"com.sun.star.table.BorderLine\"\n" "l = b0.HorizontalLine\n" "l.OuterLineWidth = 9\n" "b0.HorizontalLine = l\n" "doUnitTest = b0\n" -"End Function\n" +"End Function\n"_ustr ); // it should be legal to assign a variant to a struct ( and copy by val ) // make sure we aren't copying by reference, we make sure that l is not @@ -98,18 +98,18 @@ OUString sTestSource2Alt( // OuterLineWidth of 4 & 9 respectively and we should be returning // 13 the sum of the two ( hopefully unique values if we haven't copied by reference ) OUString sTestSource3( - "Function doUnitTest()\n" + u"Function doUnitTest()\n" "Dim b0 as new \"com.sun.star.table.TableBorder\"\n" "l = b0.HorizontalLine\n" "l.OuterLineWidth = 9\n" "b0.HorizontalLine = l\n" "l.OuterLineWidth = 4\n" "doUnitTest = b0.HorizontalLine.OuterLineWidth + l.OuterLineWidth\n" -"End Function\n" +"End Function\n"_ustr ); OUString sTestSource3Alt( - "Function doUnitTest()\n" + u"Function doUnitTest()\n" "Dim b0 as new \"com.sun.star.table.TableBorder\"\n" "l = b0.HorizontalLine\n" "l.OuterLineWidth = 9\n" @@ -119,24 +119,24 @@ OUString sTestSource3Alt( "result(0) = b0\n" "result(1) = l\n" "doUnitTest = result\n" -"End Function\n" +"End Function\n"_ustr ); // nearly the same as above but this time for a fixed type // variable OUString sTestSource4( - "Function doUnitTest()\n" + u"Function doUnitTest()\n" "Dim b0 as new \"com.sun.star.table.TableBorder\", l as new \"com.sun.star.table.BorderLine\"\n" "l = b0.HorizontalLine\n" "l.OuterLineWidth = 9\n" "b0.HorizontalLine = l\n" "l.OuterLineWidth = 4\n" "doUnitTest = b0.HorizontalLine.OuterLineWidth + l.OuterLineWidth\n" -"End Function\n" +"End Function\n"_ustr ); OUString sTestSource4Alt( - "Function doUnitTest()\n" + u"Function doUnitTest()\n" "Dim b0 as new \"com.sun.star.table.TableBorder\", l as new \"com.sun.star.table.BorderLine\"\n" "l = b0.HorizontalLine\n" "l.OuterLineWidth = 9\n" @@ -146,7 +146,7 @@ OUString sTestSource4Alt( "result(0) = b0\n" "result(1) = l\n" "doUnitTest = result\n" -"End Function\n" +"End Function\n"_ustr ); // Although basic might appear to correctly change nested struct elements @@ -155,13 +155,13 @@ OUString sTestSource4Alt( // We need to additionally check the actual uno struct to see if the // changes made are *really* reflected in the object OUString sTestSource5( - "Function doUnitTest() as Object\n" + u"Function doUnitTest() as Object\n" "Dim aWinDesc as new \"com.sun.star.awt.WindowDescriptor\"\n" "Dim aRect as new \"com.sun.star.awt.Rectangle\"\n" "aRect.X = 200\n" "aWinDesc.Bounds = aRect\n" "doUnitTest = aWinDesc\n" -"End Function\n" +"End Function\n"_ustr ); @@ -300,13 +300,13 @@ void Nested_Struct::testUnoAccess() void Nested_Struct::testTdf134576() { - MacroSnippet myMacro("Function doUnitTest()\n" + MacroSnippet myMacro(u"Function doUnitTest()\n" " On Error Resume Next\n" " For Each a In b\n" " c.d\n" " Next\n" " doUnitTest = 1\n" - "End Function\n"); + "End Function\n"_ustr); myMacro.Compile(); CPPUNIT_ASSERT(!myMacro.HasError()); diff --git a/basic/qa/cppunit/test_scanner.cxx b/basic/qa/cppunit/test_scanner.cxx index f17750c89a6e..1591ca891c85 100644 --- a/basic/qa/cppunit/test_scanner.cxx +++ b/basic/qa/cppunit/test_scanner.cxx @@ -106,53 +106,53 @@ std::vector getSymbols(const OUString& source, bool bCompatible = false) void ScannerTest::testBlankLines() { std::vector symbols; - symbols = getSymbols(""); + symbols = getSymbols(u""_ustr); CPPUNIT_ASSERT(symbols.empty()); - symbols = getSymbols("\r\n"); + symbols = getSymbols(u"\r\n"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(1), symbols.size()); CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); - symbols = getSymbols("\n"); + symbols = getSymbols(u"\n"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(1), symbols.size()); CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); - symbols = getSymbols("\r"); + symbols = getSymbols(u"\r"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(1), symbols.size()); CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); - symbols = getSymbols("\r\n\r\n"); + symbols = getSymbols(u"\r\n\r\n"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); - symbols = getSymbols("\n\r"); + symbols = getSymbols(u"\n\r"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); - symbols = getSymbols("\n\r\n"); + symbols = getSymbols(u"\n\r\n"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); - symbols = getSymbols("\r\n\r"); + symbols = getSymbols(u"\r\n\r"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); - symbols = getSymbols(" "); + symbols = getSymbols(u" "_ustr); CPPUNIT_ASSERT_EQUAL(size_t(1), symbols.size()); CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); @@ -206,7 +206,7 @@ void ScannerTest::testOperators() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); - symbols = getSymbols("=="); + symbols = getSymbols(u"=="_ustr); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT_EQUAL(sourceE, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); @@ -255,12 +255,12 @@ void ScannerTest::testAlphanum() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); - symbols = getSymbols("1asfdasfd"); + symbols = getSymbols(u"1asfdasfd"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT(symbols[0].text.isEmpty()); // Can't start symbol with a digit CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type); - CPPUNIT_ASSERT_EQUAL(OUString("asfdasfd"), symbols[1].text); + CPPUNIT_ASSERT_EQUAL(u"asfdasfd"_ustr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type); @@ -293,33 +293,32 @@ void ScannerTest::testAlphanum() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); + // tdf#125637 - don't change underscore to space symbols = getSymbols(source7); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); - CPPUNIT_ASSERT_EQUAL(OUString("joxclk_"), symbols[0].text); + CPPUNIT_ASSERT_EQUAL(u"joxclk_"_ustr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); - // tdf#125637 - don't change underscore to space - CPPUNIT_ASSERT_EQUAL(OUString("joxclk_"), source7); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); - symbols = getSymbols(" asdf "); + symbols = getSymbols(u" asdf "_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); - CPPUNIT_ASSERT_EQUAL(OUString("asdf"), symbols[0].text); + CPPUNIT_ASSERT_EQUAL(u"asdf"_ustr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); - symbols = getSymbols(" 19395 asdfa "); + symbols = getSymbols(u" 19395 asdfa "_ustr); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT(symbols[0].text.isEmpty()); CPPUNIT_ASSERT_DOUBLES_EQUAL(19395.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type); - CPPUNIT_ASSERT_EQUAL(OUString("asdfa"), symbols[1].text); + CPPUNIT_ASSERT_EQUAL(u"asdfa"_ustr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type); - symbols = getSymbols("\n1\n2\na sdf"); + symbols = getSymbols(u"\n1\n2\na sdf"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(8), symbols.size()); CPPUNIT_ASSERT_EQUAL(cr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); @@ -336,12 +335,12 @@ void ScannerTest::testAlphanum() CPPUNIT_ASSERT_EQUAL(1u, static_cast(symbols[5].text.getLength())); CPPUNIT_ASSERT_EQUAL('a', static_cast(symbols[5].text[0])); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[5].type); - CPPUNIT_ASSERT_EQUAL(OUString("sdf"), symbols[6].text); + CPPUNIT_ASSERT_EQUAL(u"sdf"_ustr, symbols[6].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[6].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[7].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[7].type); - symbols = getSymbols("asdf.asdf"); + symbols = getSymbols(u"asdf.asdf"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(4), symbols.size()); CPPUNIT_ASSERT_EQUAL(asdf, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); @@ -352,7 +351,7 @@ void ScannerTest::testAlphanum() CPPUNIT_ASSERT_EQUAL(cr, symbols[3].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[3].type); - symbols = getSymbols(".."); + symbols = getSymbols(u".."_ustr); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT_EQUAL(dot, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); @@ -366,31 +365,31 @@ void ScannerTest::testComments() { std::vector symbols; - symbols = getSymbols("REM asdf"); + symbols = getSymbols(u"REM asdf"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(1), symbols.size()); CPPUNIT_ASSERT_EQUAL(rem, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); - symbols = getSymbols("REMasdf"); + symbols = getSymbols(u"REMasdf"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); - CPPUNIT_ASSERT_EQUAL(OUString("REMasdf"), symbols[0].text); + CPPUNIT_ASSERT_EQUAL(u"REMasdf"_ustr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); - symbols = getSymbols("'asdf"); + symbols = getSymbols(u"'asdf"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(1), symbols.size()); CPPUNIT_ASSERT_EQUAL(rem, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); - symbols = getSymbols("asdf _\n'100"); + symbols = getSymbols(u"asdf _\n'100"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(asdf, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); CPPUNIT_ASSERT_EQUAL(rem, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); - symbols = getSymbols("'asdf _\n100"); + symbols = getSymbols(u"'asdf _\n100"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT_EQUAL(rem, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); @@ -400,14 +399,14 @@ void ScannerTest::testComments() CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type); - symbols = getSymbols("'asdf _\n'100"); + symbols = getSymbols(u"'asdf _\n'100"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(rem, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); CPPUNIT_ASSERT_EQUAL(rem, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); - symbols = getSymbols("'asdf _\n 1234 _\n asdf'"); + symbols = getSymbols(u"'asdf _\n 1234 _\n asdf'"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(4), symbols.size()); CPPUNIT_ASSERT_EQUAL(rem, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); @@ -424,29 +423,29 @@ void ScannerTest::testGoto() { std::vector symbols; - symbols = getSymbols("goto"); + symbols = getSymbols(u"goto"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(goto_, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); - symbols = getSymbols("go to"); + symbols = getSymbols(u"go to"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); - CPPUNIT_ASSERT_EQUAL(OUString("go"), symbols[0].text); + CPPUNIT_ASSERT_EQUAL(u"go"_ustr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); - CPPUNIT_ASSERT_EQUAL(OUString("to"), symbols[1].text); + CPPUNIT_ASSERT_EQUAL(u"to"_ustr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type); - symbols = getSymbols("go\nto"); + symbols = getSymbols(u"go\nto"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(4), symbols.size()); - CPPUNIT_ASSERT_EQUAL(OUString("go"), symbols[0].text); + CPPUNIT_ASSERT_EQUAL(u"go"_ustr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); - CPPUNIT_ASSERT_EQUAL(OUString("to"), symbols[2].text); + CPPUNIT_ASSERT_EQUAL(u"to"_ustr, symbols[2].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[2].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[3].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[3].type); @@ -456,21 +455,21 @@ void ScannerTest::testGotoCompatible() { std::vector symbols; - symbols = getSymbols("goto", true); + symbols = getSymbols(u"goto"_ustr, true); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(goto_, symbols[0].text); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("go to", true); + symbols = getSymbols(u"go to"_ustr, true); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(goto_, symbols[0].text); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("go\nto", true); + symbols = getSymbols(u"go\nto"_ustr, true); CPPUNIT_ASSERT_EQUAL(size_t(4), symbols.size()); - CPPUNIT_ASSERT_EQUAL(OUString("go"), symbols[0].text); + CPPUNIT_ASSERT_EQUAL(u"go"_ustr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - CPPUNIT_ASSERT_EQUAL(OUString("to"), symbols[2].text); + CPPUNIT_ASSERT_EQUAL(u"to"_ustr, symbols[2].text); CPPUNIT_ASSERT_EQUAL(cr, symbols[3].text); } @@ -478,39 +477,39 @@ void ScannerTest::testExclamation() { std::vector symbols; - symbols = getSymbols("asdf!asdf"); + symbols = getSymbols(u"asdf!asdf"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(4), symbols.size()); CPPUNIT_ASSERT_EQUAL(asdf, symbols[0].text); CPPUNIT_ASSERT_EQUAL(excl, symbols[1].text); CPPUNIT_ASSERT_EQUAL(asdf, symbols[2].text); CPPUNIT_ASSERT_EQUAL(cr, symbols[3].text); - symbols = getSymbols("!1234"); + symbols = getSymbols(u"!1234"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT_EQUAL(excl, symbols[0].text); CPPUNIT_ASSERT(symbols[1].text.isEmpty()); CPPUNIT_ASSERT_DOUBLES_EQUAL(1234.0, symbols[1].number, 1E-12); CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); - symbols = getSymbols("!_3"); + symbols = getSymbols(u"!_3"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT_EQUAL(excl, symbols[0].text); - CPPUNIT_ASSERT_EQUAL(OUString("_3"), symbols[1].text); + CPPUNIT_ASSERT_EQUAL(u"_3"_ustr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); - symbols = getSymbols("!$"); + symbols = getSymbols(u"!$"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT_EQUAL(excl, symbols[0].text); - CPPUNIT_ASSERT_EQUAL(OUString("$"), symbols[1].text); + CPPUNIT_ASSERT_EQUAL(u"$"_ustr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); - symbols = getSymbols("!%"); + symbols = getSymbols(u"!%"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT_EQUAL(excl, symbols[0].text); - CPPUNIT_ASSERT_EQUAL(OUString("%"), symbols[1].text); + CPPUNIT_ASSERT_EQUAL(u"%"_ustr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); - symbols = getSymbols("!\n"); + symbols = getSymbols(u"!\n"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(excl, symbols[0].text); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); @@ -521,14 +520,14 @@ void ScannerTest::testNumbers() std::vector symbols; sal_Int32 errors; - symbols = getSymbols("12345", errors); + symbols = getSymbols(u"12345"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(12345.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(0u, static_cast(errors)); - symbols = getSymbols("1.2.3", errors); + symbols = getSymbols(u"1.2.3"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.2, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type); @@ -537,115 +536,115 @@ void ScannerTest::testNumbers() CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); CPPUNIT_ASSERT_EQUAL(1u, static_cast(errors)); - symbols = getSymbols("123.4", errors); + symbols = getSymbols(u"123.4"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(123.4, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(0u, static_cast(errors)); - symbols = getSymbols("0.5", errors); + symbols = getSymbols(u"0.5"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(.5, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(0u, static_cast(errors)); - symbols = getSymbols("5.0", errors); + symbols = getSymbols(u"5.0"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(5.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(0u, static_cast(errors)); - symbols = getSymbols("0.0", errors); + symbols = getSymbols(u"0.0"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(0u, static_cast(errors)); - symbols = getSymbols("-3", errors); + symbols = getSymbols(u"-3"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); - CPPUNIT_ASSERT_EQUAL(OUString("-"), symbols[0].text); + CPPUNIT_ASSERT_EQUAL(u"-"_ustr, symbols[0].text); CPPUNIT_ASSERT_DOUBLES_EQUAL(3.0, symbols[1].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[1].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); CPPUNIT_ASSERT_EQUAL(0u, static_cast(errors)); - symbols = getSymbols("-0.0", errors); + symbols = getSymbols(u"-0.0"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); - CPPUNIT_ASSERT_EQUAL(OUString("-"), symbols[0].text); + CPPUNIT_ASSERT_EQUAL(u"-"_ustr, symbols[0].text); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[1].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[1].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); CPPUNIT_ASSERT_EQUAL(0u, static_cast(errors)); - symbols = getSymbols("12dE3", errors); + symbols = getSymbols(u"12dE3"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(12.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type); - CPPUNIT_ASSERT_EQUAL(OUString("dE3"), symbols[1].text); + CPPUNIT_ASSERT_EQUAL(u"dE3"_ustr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); CPPUNIT_ASSERT_EQUAL(1u, static_cast(errors)); - symbols = getSymbols("12e3", errors); + symbols = getSymbols(u"12e3"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(12000.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(0u, static_cast(errors)); - symbols = getSymbols("12D+3", errors); + symbols = getSymbols(u"12D+3"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(12000.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(0u, static_cast(errors)); - symbols = getSymbols("12e++3", errors); + symbols = getSymbols(u"12e++3"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(6), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(12.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type); - CPPUNIT_ASSERT_EQUAL(OUString("e"), symbols[1].text); - CPPUNIT_ASSERT_EQUAL(OUString("+"), symbols[2].text); - CPPUNIT_ASSERT_EQUAL(OUString("+"), symbols[3].text); + CPPUNIT_ASSERT_EQUAL(u"e"_ustr, symbols[1].text); + CPPUNIT_ASSERT_EQUAL(u"+"_ustr, symbols[2].text); + CPPUNIT_ASSERT_EQUAL(u"+"_ustr, symbols[3].text); CPPUNIT_ASSERT_DOUBLES_EQUAL(3.0, symbols[4].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[4].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[5].text); CPPUNIT_ASSERT_EQUAL(1u, static_cast(errors)); - symbols = getSymbols("12e-3", errors); + symbols = getSymbols(u"12e-3"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(.012, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(0u, static_cast(errors)); - symbols = getSymbols("12e-3+", errors); + symbols = getSymbols(u"12e-3+"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(.012, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type); - CPPUNIT_ASSERT_EQUAL(OUString("+"), symbols[1].text); + CPPUNIT_ASSERT_EQUAL(u"+"_ustr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); CPPUNIT_ASSERT_EQUAL(0u, static_cast(errors)); - symbols = getSymbols("1,2,3", errors); + symbols = getSymbols(u"1,2,3"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(6), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type); - CPPUNIT_ASSERT_EQUAL(OUString(","), symbols[1].text); + CPPUNIT_ASSERT_EQUAL(u","_ustr, symbols[1].text); CPPUNIT_ASSERT_DOUBLES_EQUAL(2.0, symbols[2].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[2].type); - CPPUNIT_ASSERT_EQUAL(OUString(","), symbols[3].text); + CPPUNIT_ASSERT_EQUAL(u","_ustr, symbols[3].text); CPPUNIT_ASSERT_DOUBLES_EQUAL(3.0, symbols[4].number, 1E-12); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[4].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[5].text); CPPUNIT_ASSERT_EQUAL(0u, static_cast(errors)); - symbols = getSymbols("1." + symbols = getSymbols(u"1." "0000000000000000000000000000000000000000000000000000000000000000000000000" - "000000000000000000000000000000000000000000000000000", + "000000000000000000000000000000000000000000000000000"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, symbols[0].number, 1E-12); @@ -655,7 +654,7 @@ void ScannerTest::testNumbers() // the buffer is artificially constrained by the scanner. CPPUNIT_ASSERT_EQUAL(1u, static_cast(errors)); // HACK - symbols = getSymbols("10e308", errors); + symbols = getSymbols(u"10e308"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(std::numeric_limits::infinity(), symbols[0].number); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type); @@ -663,7 +662,7 @@ void ScannerTest::testNumbers() CPPUNIT_ASSERT_EQUAL(1u, static_cast(errors)); // math error, overflow // trailing data type character % = SbxINTEGER - symbols = getSymbols("1.23%"); + symbols = getSymbols(u"1.23%"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.23, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -671,7 +670,7 @@ void ScannerTest::testNumbers() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // trailing data type character & = SbxLONG - symbols = getSymbols("1.23&"); + symbols = getSymbols(u"1.23&"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.23, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -679,7 +678,7 @@ void ScannerTest::testNumbers() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // trailing data type character ! = SbxSINGLE - symbols = getSymbols("1.23!"); + symbols = getSymbols(u"1.23!"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.23, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -687,7 +686,7 @@ void ScannerTest::testNumbers() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // trailing data type character # = SbxDOUBLE - symbols = getSymbols("1.23#"); + symbols = getSymbols(u"1.23#"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.23, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -695,7 +694,7 @@ void ScannerTest::testNumbers() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // trailing data type character @ = SbxCURRENCY - symbols = getSymbols("1.23@"); + symbols = getSymbols(u"1.23@"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.23, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -703,7 +702,7 @@ void ScannerTest::testNumbers() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // trailing data type character $ = SbxSTRING - symbols = getSymbols("1.23$", errors); + symbols = getSymbols(u"1.23$"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.23, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -717,37 +716,37 @@ void ScannerTest::testDataType() { std::vector symbols; - symbols = getSymbols("asdf%"); + symbols = getSymbols(u"asdf%"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("asdf&"); + symbols = getSymbols(u"asdf&"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(SbxLONG, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("asdf!"); + symbols = getSymbols(u"asdf!"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(SbxSINGLE, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("asdf#"); + symbols = getSymbols(u"asdf#"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(SbxDOUBLE, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("asdf@"); + symbols = getSymbols(u"asdf@"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(SbxCURRENCY, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("asdf$"); + symbols = getSymbols(u"asdf$"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(SbxSTRING, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("asdf "); + symbols = getSymbols(u"asdf "_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); @@ -758,31 +757,31 @@ void ScannerTest::testHexOctal() sal_Int32 errors; std::vector symbols; - symbols = getSymbols("&HA"); + symbols = getSymbols(u"&HA"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("&HASDF"); + symbols = getSymbols(u"&HASDF"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(2783.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("&H10"); + symbols = getSymbols(u"&H10"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(16.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("&&H&1H1&H1"); + symbols = getSymbols(u"&&H&1H1&H1"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(6), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); - CPPUNIT_ASSERT_EQUAL(OUString("&"), symbols[0].text); + CPPUNIT_ASSERT_EQUAL(u"&"_ustr, symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[0].type); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[1].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[1].text); @@ -791,44 +790,44 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(OUString(), symbols[2].text); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[2].type); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, symbols[3].number, 1E-12); - CPPUNIT_ASSERT_EQUAL(OUString("H1"), symbols[3].text); + CPPUNIT_ASSERT_EQUAL(u"H1"_ustr, symbols[3].text); CPPUNIT_ASSERT_EQUAL(SbxLONG, symbols[3].type); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, symbols[4].number, 1E-12); - CPPUNIT_ASSERT_EQUAL(OUString("H1"), symbols[4].text); + CPPUNIT_ASSERT_EQUAL(u"H1"_ustr, symbols[4].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[4].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[5].text); - symbols = getSymbols("&O&O12"); + symbols = getSymbols(u"&O&O12"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxLONG, symbols[0].type); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[1].number, 1E-12); - CPPUNIT_ASSERT_EQUAL(OUString("O12"), symbols[1].text); + CPPUNIT_ASSERT_EQUAL(u"O12"_ustr, symbols[1].text); CPPUNIT_ASSERT_EQUAL(SbxVARIANT, symbols[1].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); - symbols = getSymbols("&O10"); + symbols = getSymbols(u"&O10"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(8.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("&HO"); + symbols = getSymbols(u"&HO"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("&O123000000000000000000000"); + symbols = getSymbols(u"&O123000000000000000000000"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); // TODO: this line fails on 64 bit systems!!! // CPPUNIT_ASSERT_EQUAL(symbols[0].number, -1744830464); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("&H1.23"); + symbols = getSymbols(u"&H1.23"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, symbols[0].number, 1E-12); @@ -841,7 +840,7 @@ void ScannerTest::testHexOctal() /* tdf#62323, tdf#62326 - conversion of Hex literals to basic signed Integers */ // &H0 = 0 - symbols = getSymbols("&H0"); + symbols = getSymbols(u"&H0"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -849,7 +848,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // &H8000 = -32768 - symbols = getSymbols("&H8000"); + symbols = getSymbols(u"&H8000"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(SbxMININT, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -857,7 +856,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // &H80000000 = -2147483648 - symbols = getSymbols("&H80000000"); + symbols = getSymbols(u"&H80000000"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(SbxMINLNG, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -865,7 +864,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // &HFFFF = -1 - symbols = getSymbols("&HFFFF"); + symbols = getSymbols(u"&HFFFF"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -873,7 +872,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // &HFFFFFFFF = -1 - symbols = getSymbols("&HFFFFFFFF"); + symbols = getSymbols(u"&HFFFFFFFF"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -881,7 +880,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // &H7FFF = 32767 - symbols = getSymbols("&H7FFF"); + symbols = getSymbols(u"&H7FFF"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(SbxMAXINT, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -889,7 +888,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // &H7FFFFFFF = 2147483647 - symbols = getSymbols("&H7FFFFFFF"); + symbols = getSymbols(u"&H7FFFFFFF"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(SbxMAXLNG, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -899,7 +898,7 @@ void ScannerTest::testHexOctal() /* tdf#130476 - trailing data type characters */ // % = SbxINTEGER - symbols = getSymbols("&H0%"); + symbols = getSymbols(u"&H0%"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -907,7 +906,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // & = SbxLONG - symbols = getSymbols("&H0&"); + symbols = getSymbols(u"&H0&"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -915,7 +914,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // ! = SbxSINGLE - symbols = getSymbols("&H0!"); + symbols = getSymbols(u"&H0!"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -923,7 +922,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // # = SbxDOUBLE - symbols = getSymbols("&H0#"); + symbols = getSymbols(u"&H0#"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -931,7 +930,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // @ = SbxCURRENCY - symbols = getSymbols("&H0@"); + symbols = getSymbols(u"&H0@"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -939,7 +938,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // $ = SbxSTRING - symbols = getSymbols("&H0$", errors); + symbols = getSymbols(u"&H0$"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -949,7 +948,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(1u, static_cast(errors)); // % = SbxINTEGER - symbols = getSymbols("&O0%"); + symbols = getSymbols(u"&O0%"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -957,7 +956,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // & = SbxLONG - symbols = getSymbols("&O0&"); + symbols = getSymbols(u"&O0&"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -965,7 +964,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // ! = SbxSINGLE - symbols = getSymbols("&O0!"); + symbols = getSymbols(u"&O0!"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -973,7 +972,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // # = SbxDOUBLE - symbols = getSymbols("&O0#"); + symbols = getSymbols(u"&O0#"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -981,7 +980,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // @ = SbxCURRENCY - symbols = getSymbols("&O0@"); + symbols = getSymbols(u"&O0@"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -989,7 +988,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // $ = SbxSTRING - symbols = getSymbols("&O0$", errors); + symbols = getSymbols(u"&O0$"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -999,7 +998,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(1u, static_cast(errors)); // maximum for Hex % = SbxINTEGER - symbols = getSymbols("&HFFFF%"); + symbols = getSymbols(u"&HFFFF%"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -1007,7 +1006,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // overflow for Hex % = SbxINTEGER - symbols = getSymbols("&H10000%", errors); + symbols = getSymbols(u"&H10000%"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -1017,7 +1016,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(1u, static_cast(errors)); // maximum for Octal % = SbxINTEGER - symbols = getSymbols("&O177777%"); + symbols = getSymbols(u"&O177777%"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -1025,7 +1024,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // overflow for Octal % = SbxINTEGER - symbols = getSymbols("&O200000%", errors); + symbols = getSymbols(u"&O200000%"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -1035,7 +1034,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(1u, static_cast(errors)); // maximum for Hex & = SbxLONG - symbols = getSymbols("&H7FFFFFFF&"); + symbols = getSymbols(u"&H7FFFFFFF&"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(2147483647.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -1043,7 +1042,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // minimum for Hex & = SbxLONG - symbols = getSymbols("&H80000000&"); + symbols = getSymbols(u"&H80000000&"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(-2147483648.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -1051,7 +1050,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // overflow for Hex & = SbxLONG - symbols = getSymbols("&H100000000&", errors); + symbols = getSymbols(u"&H100000000&"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -1061,7 +1060,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(1u, static_cast(errors)); // maximum for Octal & = SbxLONG - symbols = getSymbols("&O17777777777&"); + symbols = getSymbols(u"&O17777777777&"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(2147483647.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -1069,7 +1068,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // minimum for Octal & = SbxLONG - symbols = getSymbols("&O20000000000&", errors); + symbols = getSymbols(u"&O20000000000&"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(-2147483648.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -1077,7 +1076,7 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // overflow for Octal & = SbxLONG - symbols = getSymbols("&O40000000000&", errors); + symbols = getSymbols(u"&O40000000000&"_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -1089,7 +1088,7 @@ void ScannerTest::testHexOctal() /* test for leading zeros */ // &H0000000FFFF = 65535 - symbols = getSymbols("&H0000000FFFF"); + symbols = getSymbols(u"&H0000000FFFF"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -1097,14 +1096,14 @@ void ScannerTest::testHexOctal() CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); // &O00000123 = 83 - symbols = getSymbols("&O00000123"); + symbols = getSymbols(u"&O00000123"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(83.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); CPPUNIT_ASSERT_EQUAL(SbxINTEGER, symbols[0].type); CPPUNIT_ASSERT_EQUAL(cr, symbols[1].text); - symbols = getSymbols("&O7777777"); + symbols = getSymbols(u"&O7777777"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(2), symbols.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(2097151.0, symbols[0].number, 1E-12); CPPUNIT_ASSERT_EQUAL(OUString(), symbols[0].text); @@ -1116,14 +1115,14 @@ void ScannerTest::testTdf103104() { std::vector symbols; - symbols = getSymbols("asdf _\n asdf"); + symbols = getSymbols(u"asdf _\n asdf"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(3), symbols.size()); CPPUNIT_ASSERT_EQUAL(asdf, symbols[0].text); CPPUNIT_ASSERT_EQUAL(asdf, symbols[1].text); CPPUNIT_ASSERT(symbols[1].ws); CPPUNIT_ASSERT_EQUAL(cr, symbols[2].text); - symbols = getSymbols("asdf. _\n asdf"); + symbols = getSymbols(u"asdf. _\n asdf"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(4), symbols.size()); CPPUNIT_ASSERT_EQUAL(asdf, symbols[0].text); CPPUNIT_ASSERT_EQUAL(dot, symbols[1].text); @@ -1132,7 +1131,7 @@ void ScannerTest::testTdf103104() CPPUNIT_ASSERT(symbols[2].ws); CPPUNIT_ASSERT_EQUAL(cr, symbols[3].text); - symbols = getSymbols("asdf _\n .asdf"); + symbols = getSymbols(u"asdf _\n .asdf"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(4), symbols.size()); CPPUNIT_ASSERT_EQUAL(asdf, symbols[0].text); CPPUNIT_ASSERT_EQUAL(dot, symbols[1].text); @@ -1149,10 +1148,10 @@ void ScannerTest::testTdf136032() // tdf#136032 - abort scan of a string beginning with a hashtag, // if a comma/whitespace is found. Otherwise, the compiler raises a syntax error. - symbols = getSymbols("Print #i,\"A#B\"", errors); + symbols = getSymbols(u"Print #i,\"A#B\""_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(5), symbols.size()); CPPUNIT_ASSERT_EQUAL(0u, static_cast(errors)); - symbols = getSymbols("Print #i, \"A#B\"", errors); + symbols = getSymbols(u"Print #i, \"A#B\""_ustr, errors); CPPUNIT_ASSERT_EQUAL(size_t(5), symbols.size()); CPPUNIT_ASSERT_EQUAL(0u, static_cast(errors)); } diff --git a/basic/qa/cppunit/test_tdf149714.cxx b/basic/qa/cppunit/test_tdf149714.cxx index 76713508560c..0c58038daedf 100644 --- a/basic/qa/cppunit/test_tdf149714.cxx +++ b/basic/qa/cppunit/test_tdf149714.cxx @@ -52,7 +52,7 @@ End Function sBasic = sBasic.replaceFirst("$PNGFILENAME", aDataFileName); interpreter = new StarBASIC(); - auto mod = interpreter->MakeModule("BitsPerPixel", sBasic); + auto mod = interpreter->MakeModule(u"BitsPerPixel"_ustr, sBasic); CPPUNIT_ASSERT(mod->Compile()); CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, StarBASIC::GetErrBasic()); @@ -65,7 +65,8 @@ End Function void TestTdf149714::testBitsPerPixel() { auto m = Module(); - auto GetBitsPerPixelAsString = m->FindMethod("GetBitsPerPixelAsString", SbxClassType::Method); + auto GetBitsPerPixelAsString + = m->FindMethod(u"GetBitsPerPixelAsString"_ustr, SbxClassType::Method); CPPUNIT_ASSERT_MESSAGE("Could not Find GetBitsPerPixelAsString in module", GetBitsPerPixelAsString != nullptr); @@ -75,7 +76,7 @@ void TestTdf149714::testBitsPerPixel() // Without the fix in place this would fail with: // - Expected: 24 // - Actual: True - CPPUNIT_ASSERT_EQUAL(OUString{ "24" }, returned->GetOUString()); + CPPUNIT_ASSERT_EQUAL(u"24"_ustr, returned->GetOUString()); } // Put the test suite in the registry diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx index 8a15ba7234e8..d9c26acb87e5 100644 --- a/basic/qa/cppunit/test_vba.cxx +++ b/basic/qa/cppunit/test_vba.cxx @@ -164,14 +164,14 @@ void VBATest::testMiscVBAFunctions() + OUString::createFromAscii( macroSource[ i ] ); MacroSnippet myMacro; - myMacro.LoadSourceFromFile("TestUtil", sMacroUtilsURL); - myMacro.LoadSourceFromFile("TestModule", sMacroURL); + myMacro.LoadSourceFromFile(u"TestUtil"_ustr, sMacroUtilsURL); + myMacro.LoadSourceFromFile(u"TestModule"_ustr, sMacroURL); SbxVariableRef pReturn = myMacro.Run(); CPPUNIT_ASSERT_MESSAGE("No return variable huh?", pReturn.is()); fprintf(stderr, "macro result for %s\n", macroSource[i]); fprintf(stderr, "macro returned:\n%s\n", OUStringToOString(pReturn->GetOUString(), RTL_TEXTENCODING_UTF8).getStr()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Result not as expected", OUString("OK"), + CPPUNIT_ASSERT_EQUAL_MESSAGE("Result not as expected", u"OK"_ustr, pReturn->GetOUString()); } } diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 525482d8dbae..7912c2a723d6 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -272,12 +272,12 @@ namespace basic OUString aAppBasicDir( aPathCFG.GetBasicPath() ); if ( aAppBasicDir.isEmpty() ) { - aPathCFG.SetBasicPath("$(prog)"); + aPathCFG.SetBasicPath(u"$(prog)"_ustr); } // Create basic and load it // AppBasicDir is now a PATH - INetURLObject aAppBasic( SvtPathOptions().SubstituteVariable("$(progurl)") ); + INetURLObject aAppBasic( SvtPathOptions().SubstituteVariable(u"$(progurl)"_ustr) ); aAppBasic.insertName( Application::GetAppName() ); BasicManager* pBasicManager = new BasicManager( new StarBASIC, &aAppBasicDir ); @@ -307,7 +307,7 @@ namespace basic // StarDesktop Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - pBasicManager->SetGlobalUNOConstant( "StarDesktop", css::uno::Any( Desktop::create(xContext))); + pBasicManager->SetGlobalUNOConstant( u"StarDesktop"_ustr, css::uno::Any( Desktop::create(xContext))); // (BasicLibraries and DialogLibraries have automatically been added in SetLibraryContainerInfo) @@ -473,7 +473,7 @@ namespace basic _out_rpBasicManager->GetLib(0)->SetParent( pAppBasic ); // global properties in the document's Basic - _out_rpBasicManager->SetGlobalUNOConstant( "ThisComponent", css::uno::Any( _rxDocumentModel ) ); + _out_rpBasicManager->SetGlobalUNOConstant( u"ThisComponent"_ustr, css::uno::Any( _rxDocumentModel ) ); // notify impl_notifyCreationListeners( _rxDocumentModel, *_out_rpBasicManager ); diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 72b6f0de5ddf..985f66e0f3f2 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -529,7 +529,7 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo ) { // Register listener for lib container uno::Reference< container::XContainerListener > xLibContainerListener - = new BasMgrContainerListenerImpl( this, "" ); + = new BasMgrContainerListenerImpl( this, u""_ustr ); uno::Reference< container::XContainer> xLibContainer( xScriptCont, uno::UNO_QUERY ); xLibContainer->addContainerListener( xLibContainerListener ); @@ -579,8 +579,8 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo ) } } - SetGlobalUNOConstant( "BasicLibraries", uno::Any( maContainerInfo.mxScriptCont ) ); - SetGlobalUNOConstant( "DialogLibraries", uno::Any( maContainerInfo.mxDialogCont ) ); + SetGlobalUNOConstant( u"BasicLibraries"_ustr, uno::Any( maContainerInfo.mxScriptCont ) ); + SetGlobalUNOConstant( u"DialogLibraries"_ustr, uno::Any( maContainerInfo.mxDialogCont ) ); } BasicManager::BasicManager( StarBASIC* pSLib, OUString const * pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr ) @@ -1688,7 +1688,7 @@ uno::Any ModuleContainer_Impl::getByName( const OUString& aName ) SbModule* pMod = mpLib ? mpLib->FindModule( aName ) : nullptr; if( !pMod ) throw container::NoSuchElementException(); - uno::Reference< script::XStarBasicModuleInfo > xMod = new ModuleInfo_Impl( aName, "StarBasic", pMod->GetSource32() ); + uno::Reference< script::XStarBasicModuleInfo > xMod = new ModuleInfo_Impl( aName, u"StarBasic"_ustr, pMod->GetSource32() ); uno::Any aRetAny; aRetAny <<= xMod; return aRetAny; @@ -1729,7 +1729,7 @@ void ModuleContainer_Impl::insertByName( const OUString& aName, const uno::Any& const uno::Type& aAnyType = aElement.getValueType(); if( aModuleType != aAnyType ) { - throw lang::IllegalArgumentException("types do not match", getXWeak(), 2); + throw lang::IllegalArgumentException(u"types do not match"_ustr, getXWeak(), 2); } uno::Reference< script::XStarBasicModuleInfo > xMod; aElement >>= xMod; @@ -1893,7 +1893,7 @@ void DialogContainer_Impl::insertByName( const OUString&, const uno::Any& aEleme const uno::Type& aAnyType = aElement.getValueType(); if( aModuleType != aAnyType ) { - throw lang::IllegalArgumentException("types do not match", getXWeak(), 2); + throw lang::IllegalArgumentException(u"types do not match"_ustr, getXWeak(), 2); } uno::Reference< script::XStarBasicDialogInfo > xMod; aElement >>= xMod; diff --git a/basic/source/classes/errobject.cxx b/basic/source/classes/errobject.cxx index 85423101b827..b2340fe3fc54 100644 --- a/basic/source/classes/errobject.cxx +++ b/basic/source/classes/errobject.cxx @@ -156,13 +156,13 @@ ErrObject::Raise( const uno::Any& Number, const uno::Any& Source, const uno::Any OUString SAL_CALL ErrObject::getDefaultPropertyName( ) { - return "Number"; + return u"Number"_ustr; } void ErrObject::setData( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext ) { if ( !Number.hasValue() ) - throw uno::RuntimeException("Missing Required Parameter" ); + throw uno::RuntimeException(u"Missing Required Parameter"_ustr ); Number >>= m_nNumber; Description >>= m_sDescription; Source >>= m_sSource; @@ -202,7 +202,7 @@ SbxErrObject::getErrObject() static std::mutex aMutex; std::scoped_lock aGuard(aMutex); if (!rGlobErr) - rGlobErr = new SbxErrObject("Err", + rGlobErr = new SbxErrObject(u"Err"_ustr, uno::Any(uno::Reference(new ErrObject()))); } return rGlobErr; diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index 6cf371f3869a..3ffe183e3a3b 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -85,7 +85,7 @@ void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Refere provider::theMasterScriptProviderFactory::get( xContext ); Any aCtx; - aCtx <<= OUString("user"); + aCtx <<= u"user"_ustr; xScriptProvider = xFactory->createScriptProvider( aCtx ); } @@ -318,7 +318,7 @@ css::uno::Reference< css::container::XNameContainer > implFindDialogLibForDialog { css::uno::Reference< css::container::XNameContainer > aRetDlgLib; - SbxVariable* pDlgLibContVar = pBasic->Find("DialogLibraries", SbxClassType::Object); + SbxVariable* pDlgLibContVar = pBasic->Find(u"DialogLibraries"_ustr, SbxClassType::Object); if( auto pDlgLibContUnoObj = dynamic_cast( pDlgLibContVar) ) { Any aDlgLibContAny = pDlgLibContUnoObj->getUnoAny(); @@ -433,7 +433,7 @@ void RTL_Impl_CreateUnoDialog( SbxArray& rPar ) // Create new uno dialog Reference< XNameContainer > xDialogModel( xContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.awt.UnoControlDialogModel", xContext), UNO_QUERY ); + u"com.sun.star.awt.UnoControlDialogModel"_ustr, xContext), UNO_QUERY ); if( !xDialogModel.is() ) { return; @@ -455,13 +455,13 @@ void RTL_Impl_CreateUnoDialog( SbxArray& rPar ) try { bool bDecoration = true; - OUString aDecorationPropName("Decoration"); + OUString aDecorationPropName(u"Decoration"_ustr); Any aDecorationAny = xDlgModPropSet->getPropertyValue( aDecorationPropName ); aDecorationAny >>= bDecoration; if( !bDecoration ) { xDlgModPropSet->setPropertyValue( aDecorationPropName, Any( true ) ); - xDlgModPropSet->setPropertyValue( "Title", Any( OUString() ) ); + xDlgModPropSet->setPropertyValue( u"Title"_ustr, Any( OUString() ) ); } } catch(const UnknownPropertyException& ) diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index eafb129894ab..336666300fd2 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -343,8 +343,8 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion ) } - pType->Remove( "Name", SbxClassType::DontCare ); - pType->Remove( "Parent", SbxClassType::DontCare ); + pType->Remove( u"Name"_ustr, SbxClassType::DontCare ); + pType->Remove( u"Parent"_ustr, SbxClassType::DontCare ); AddType(pType); } diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx index f9eacc3d1298..3f72c50f0683 100644 --- a/basic/source/classes/propacc.cxx +++ b/basic/source/classes/propacc.cxx @@ -129,7 +129,7 @@ Sequence< PropertyValue > SbPropertyValues::getPropertyValues() void SbPropertyValues::setPropertyValues(const Sequence< PropertyValue >& rPropertyValues ) { if (!m_aPropVals.empty()) - throw IllegalArgumentException("m_aPropVals not empty", getXWeak(), -1); + throw IllegalArgumentException(u"m_aPropVals not empty"_ustr, getXWeak(), -1); for (const PropertyValue& i : rPropertyValues) { diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 9b702e08d5a1..143bf86ff18f 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -136,7 +136,7 @@ void DocBasicItem::clearDependingVarsOnDelete( StarBASIC& rDeletedBasic ) void DocBasicItem::startListening() { Any aThisComp; - mrDocBasic.GetUNOConstant( "ThisComponent", aThisComp ); + mrDocBasic.GetUNOConstant( u"ThisComponent"_ustr, aThisComp ); Reference< util::XCloseBroadcaster > xCloseBC( aThisComp, UNO_QUERY ); mbDisposed = !xCloseBC.is(); if( xCloseBC.is() ) @@ -150,7 +150,7 @@ void DocBasicItem::stopListening() if( mbDisposed ) return; mbDisposed = true; Any aThisComp; - if (!mrDocBasic.GetUNOConstant("ThisComponent", aThisComp)) + if (!mrDocBasic.GetUNOConstant(u"ThisComponent"_ustr, aThisComp)) return; Reference< util::XCloseBroadcaster > xCloseBC( aThisComp, UNO_QUERY ); @@ -235,14 +235,14 @@ SbxObject* StarBASIC::getVBAGlobals( ) if ( !pVBAGlobals.is() ) { Any aThisDoc; - if ( GetUNOConstant("ThisComponent", aThisDoc) ) + if ( GetUNOConstant(u"ThisComponent"_ustr, aThisDoc) ) { Reference< XMultiServiceFactory > xDocFac( aThisDoc, UNO_QUERY ); if ( xDocFac.is() ) { try { - xDocFac->createInstance("ooo.vba.VBAGlobals"); + xDocFac->createInstance(u"ooo.vba.VBAGlobals"_ustr); } catch(const Exception& ) { @@ -250,7 +250,7 @@ SbxObject* StarBASIC::getVBAGlobals( ) } } } - pVBAGlobals = static_cast(Find( "VBAGlobals" , SbxClassType::DontCare )); + pVBAGlobals = static_cast(Find( u"VBAGlobals"_ustr , SbxClassType::DontCare )); } return pVBAGlobals.get(); } @@ -422,11 +422,11 @@ SbxBaseRef SbiFactory::Create( sal_uInt16 nSbxId, sal_uInt32 nCreator ) case SBXID_BASIC: return new StarBASIC( nullptr ); case SBXID_BASICMOD: - return new SbModule( "" ); + return new SbModule( u""_ustr ); case SBXID_BASICPROP: - return new SbProperty( "", SbxVARIANT, nullptr ); + return new SbProperty( u""_ustr, SbxVARIANT, nullptr ); case SBXID_BASICMETHOD: - return new SbMethod( "", SbxVARIANT, nullptr ); + return new SbMethod( u""_ustr, SbxVARIANT, nullptr ); case SBXID_JSCRIPTMOD: return new SbJScriptModule; case SBXID_JSCRIPTMETH: @@ -448,14 +448,14 @@ SbxObjectRef SbiFactory::CreateObject( const OUString& rClass ) } else if( rClass.equalsIgnoreAsciiCase( "Collection" ) ) { - return new BasicCollection( "Collection" ); + return new BasicCollection( u"Collection"_ustr ); } else if( rClass.equalsIgnoreAsciiCase( "FileSystemObject" ) ) { try { Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), UNO_SET_THROW ); - OUString aServiceName("ooo.vba.FileSystemObject"); + OUString aServiceName(u"ooo.vba.FileSystemObject"_ustr); Reference< XInterface > xInterface( xFactory->createInstance( aServiceName ), UNO_SET_THROW ); return new SbUnoObject( aServiceName, uno::Any( xInterface ) ); } @@ -728,7 +728,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) } else if( aObjClass.equalsIgnoreAsciiCase( "Collection" ) ) { - BasicCollection* pNewCollection = new BasicCollection( "Collection" ); + BasicCollection* pNewCollection = new BasicCollection( u"Collection"_ustr ); pNewCollection->SetName( pProp->GetName() ); pNewCollection->SetParent( pClassModule->pParent ); pNewProp->PutObject( pNewCollection ); @@ -794,7 +794,7 @@ void SbClassModuleObject::triggerInitializeEvent() mbInitializeEventDone = true; // Search method - SbxVariable* pMeth = SbxObject::Find("Class_Initialize", SbxClassType::Method); + SbxVariable* pMeth = SbxObject::Find(u"Class_Initialize"_ustr, SbxClassType::Method); if( pMeth ) { SbxValues aVals; @@ -809,7 +809,7 @@ void SbClassModuleObject::triggerTerminateEvent() return; } // Search method - SbxVariable* pMeth = SbxObject::Find("Class_Terminate", SbxClassType::Method ); + SbxVariable* pMeth = SbxObject::Find(u"Class_Terminate"_ustr, SbxClassType::Method ); if( pMeth ) { SbxValues aVals; @@ -893,7 +893,7 @@ SbModule* SbClassFactory::FindClass( const OUString& rClassName ) } StarBASIC::StarBASIC( StarBASIC* p, bool bIsDocBasic ) - : SbxObject("StarBASIC"), bDocBasic( bIsDocBasic ) + : SbxObject(u"StarBASIC"_ustr), bDocBasic( bIsDocBasic ) { SetParent( p ); bNoRtl = bBreak = false; @@ -1562,7 +1562,7 @@ void StarBASIC::MakeErrorText( ErrCode nId, std::u16string_view aMsg ) OUString sError = BasResId(pErrorMsg); OUStringBuffer aMsg1(sError); // replace argument placeholder with %s - OUString aSrgStr( "$(ARG1)" ); + OUString aSrgStr( u"$(ARG1)"_ustr ); sal_Int32 nResult = sError.indexOf(aSrgStr); if( nResult >= 0 ) @@ -1831,12 +1831,12 @@ bool StarBASIC::LoadData( SvStream& r, sal_uInt16 nVer ) } } // HACK for SFX-Bullshit! - SbxVariable* p = Find( "FALSE", SbxClassType::Property ); + SbxVariable* p = Find( u"FALSE"_ustr, SbxClassType::Property ); if( p ) { Remove( p ); } - p = Find( "TRUE", SbxClassType::Property ); + p = Find( u"TRUE"_ustr, SbxClassType::Property ); if( p ) { Remove( p ); @@ -1991,15 +1991,15 @@ void BasicCollection::Initialize() if ( !xAddInfo.is() ) { xAddInfo = new SbxInfo; - xAddInfo->AddParam( "Item", SbxVARIANT ); - xAddInfo->AddParam( "Key", SbxVARIANT, SbxFlagBits::Read | SbxFlagBits::Optional ); - xAddInfo->AddParam( "Before", SbxVARIANT, SbxFlagBits::Read | SbxFlagBits::Optional ); - xAddInfo->AddParam( "After", SbxVARIANT, SbxFlagBits::Read | SbxFlagBits::Optional ); + xAddInfo->AddParam( u"Item"_ustr, SbxVARIANT ); + xAddInfo->AddParam( u"Key"_ustr, SbxVARIANT, SbxFlagBits::Read | SbxFlagBits::Optional ); + xAddInfo->AddParam( u"Before"_ustr, SbxVARIANT, SbxFlagBits::Read | SbxFlagBits::Optional ); + xAddInfo->AddParam( u"After"_ustr, SbxVARIANT, SbxFlagBits::Read | SbxFlagBits::Optional ); } if ( !xItemInfo.is() ) { xItemInfo = new SbxInfo; - xItemInfo->AddParam( "Index", SbxVARIANT, SbxFlagBits::Read | SbxFlagBits::Optional); + xItemInfo->AddParam( u"Index"_ustr, SbxVARIANT, SbxFlagBits::Read | SbxFlagBits::Optional); } } diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 5fea3f14179f..419b2bb31a84 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -193,14 +193,14 @@ static Reference< XHierarchicalNameAccess > const & getTypeProvider_Impl() if( xContext.is() ) { xContext->getValueByName( - "/singletons/com.sun.star.reflection.theTypeDescriptionManager" ) + u"/singletons/com.sun.star.reflection.theTypeDescriptionManager"_ustr ) >>= xAccess; OSL_ENSURE( xAccess.is(), "### TypeDescriptionManager singleton not accessible!?" ); } if( !xAccess.is() ) { throw DeploymentException( - "/singletons/com.sun.star.reflection.theTypeDescriptionManager singleton not accessible" ); + u"/singletons/com.sun.star.reflection.theTypeDescriptionManager singleton not accessible"_ustr ); } } return xAccess; @@ -223,7 +223,7 @@ static Reference< XTypeConverter > const & getTypeConverter_Impl() if( !xTypeConverter.is() ) { throw DeploymentException( - "com.sun.star.script.Converter service not accessible" ); + u"com.sun.star.script.Converter service not accessible"_ustr ); } } return xTypeConverter; @@ -240,7 +240,7 @@ SbUnoObject* createOLEObject_Impl( const OUString& aType ) { Reference xSMgr = xContext->getServiceManager(); xFactory.set( - xSMgr->createInstanceWithContext( "com.sun.star.bridge.OleObjectFactory", xContext ), + xSMgr->createInstanceWithContext( u"com.sun.star.bridge.OleObjectFactory"_ustr, xContext ), UNO_QUERY ); } return xFactory; @@ -1703,7 +1703,7 @@ bool checkUnoObjectType(SbUnoObject& rUnoObj, const OUString& rClass) if ( xInv.is() ) { OUString sTypeName; - xInv->getValue( "$GetTypeName" ) >>= sTypeName; + xInv->getValue( u"$GetTypeName"_ustr ) >>= sTypeName; if ( sTypeName.isEmpty() || sTypeName == "IDispatch" ) { // can't check type, leave it pass @@ -2287,8 +2287,8 @@ SbUnoObject::SbUnoObject( const OUString& aName_, const Any& aUnoObj_ ) , bNativeCOMObject( false ) { // beat out again the default properties of Sbx - Remove( "Name", SbxClassType::DontCare ); - Remove( "Parent", SbxClassType::DontCare ); + Remove( u"Name"_ustr, SbxClassType::DontCare ); + Remove( u"Parent"_ustr, SbxClassType::DontCare ); // check the type of the objects TypeClass eType = aUnoObj_.getValueType().getTypeClass(); @@ -3028,7 +3028,7 @@ void RTL_Impl_GetProcessServiceManager( SbxArray& rPar ) Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() ); // Create a SbUnoObject out of it and return it - SbUnoObjectRef xUnoObj = new SbUnoObject( "ProcessServiceManager", Any(xFactory) ); + SbUnoObjectRef xUnoObj = new SbUnoObject( u"ProcessServiceManager"_ustr, Any(xFactory) ); refVar->PutObject( xUnoObj.get() ); } @@ -3220,7 +3220,7 @@ void VBAConstantHelper::init() if ( isInited ) return; - Reference< XTypeDescriptionEnumeration > xEnum = getTypeDescriptorEnumeration( "ooo.vba", {TypeClass_CONSTANTS}, TypeDescriptionSearchDepth_INFINITE ); + Reference< XTypeDescriptionEnumeration > xEnum = getTypeDescriptorEnumeration( u"ooo.vba"_ustr, {TypeClass_CONSTANTS}, TypeDescriptionSearchDepth_INFINITE ); if ( !xEnum.is()) { @@ -3706,7 +3706,7 @@ SbUnoSingleton* findUnoSingleton( const OUString& rName ) SbUnoSingleton::SbUnoSingleton( const OUString& aName_ ) : SbxObject( aName_ ) { - SbxVariableRef xGetMethodRef = new SbxMethod( "get", SbxOBJECT ); + SbxVariableRef xGetMethodRef = new SbxMethod( u"get"_ustr, SbxOBJECT ); QuickInsert( xGetMethodRef.get() ); } @@ -4064,7 +4064,7 @@ void RTL_Impl_GetDefaultContext( SbxArray& rPar ) Any aContextAny( comphelper::getProcessComponentContext() ); - SbUnoObjectRef xUnoObj = new SbUnoObject( "DefaultContext", aContextAny ); + SbUnoObjectRef xUnoObj = new SbUnoObject( u"DefaultContext"_ustr, aContextAny ); refVar->PutObject( xUnoObj.get() ); } @@ -4374,7 +4374,7 @@ Reference< XInterface > createComListener( const Any& aControlAny, const OUStrin try { xRet = xServiceMgr->createInstanceWithArgumentsAndContext( - "com.sun.star.custom.UnoComListener", + u"com.sun.star.custom.UnoComListener"_ustr, args, xContext ); } catch( const Exception& ) @@ -4480,7 +4480,7 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() ); Reference< XSingleServiceFactory > xComImplementsFactory ( - xServiceMgr->createInstanceWithContext( "com.sun.star.custom.ComImplementsFactory", xContext ), + xServiceMgr->createInstanceWithContext( u"com.sun.star.custom.ComImplementsFactory"_ustr, xContext ), UNO_QUERY ); if( !xComImplementsFactory.is() ) @@ -4559,7 +4559,7 @@ bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal ) // Only for native COM objects if( pUnoObj->isNativeCOMObject() ) { - SbxVariableRef pMeth = pObj->Find( "toString", SbxClassType::Method ); + SbxVariableRef pMeth = pObj->Find( u"toString"_ustr, SbxClassType::Method ); if ( pMeth.is() ) { SbxValues aRes; diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 8ca156b1238a..f3551bc1b425 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -199,7 +199,7 @@ DocObjectWrapper::invoke( const OUString& aFunctionName, const Sequence< Any >& return m_xAggInv->invoke( aFunctionName, aParams, aOutParamIndex, aOutParam ); SbMethodRef pMethod = getMethod( aFunctionName ); if ( !pMethod.is() ) - throw RuntimeException("DocObjectWrapper::invoke - Could not get the method reference!"); + throw RuntimeException(u"DocObjectWrapper::invoke - Could not get the method reference!"_ustr); // check number of parameters sal_Int32 nParamsCount = aParams.getLength(); SbxInfo* pInfo = pMethod->GetInfo(); @@ -217,7 +217,7 @@ DocObjectWrapper::invoke( const OUString& aFunctionName, const Sequence< Any >& sal_Int32 nSbxCount = n - 1; if ( nParamsCount < nSbxCount - nSbxOptional ) { - throw RuntimeException( "wrong number of parameters!" ); + throw RuntimeException( u"wrong number of parameters!"_ustr ); } } // set parameters @@ -384,7 +384,7 @@ uno::Reference< frame::XModel > getDocumentModel( StarBASIC* pb ) if( pb && pb->IsDocBasic() ) { uno::Any aDoc; - if( pb->GetUNOConstant( "ThisComponent", aDoc ) ) + if( pb->GetUNOConstant( u"ThisComponent"_ustr, aDoc ) ) xModel.set( aDoc, uno::UNO_QUERY ); } return xModel; @@ -396,7 +396,7 @@ static uno::Reference< vba::XVBACompatibility > getVBACompatibility( const uno:: try { uno::Reference< beans::XPropertySet > xModelProps( rxModel, uno::UNO_QUERY_THROW ); - xVBACompat.set( xModelProps->getPropertyValue( "BasicLibraries" ), uno::UNO_QUERY ); + xVBACompat.set( xModelProps->getPropertyValue( u"BasicLibraries"_ustr ), uno::UNO_QUERY ); } catch(const uno::Exception& ) { @@ -417,7 +417,7 @@ static bool getDefaultVBAMode( StarBASIC* pb ) // could be found from other module. SbModule::SbModule( const OUString& rName, bool bVBASupport ) - : SbxObject( "StarBASICModule" ), + : SbxObject( u"StarBASICModule"_ustr ), pBreaks(nullptr), mbVBASupport(bVBASupport), mbCompat(bVBASupport), bIsProxyModule(false) { SetName( rName ); @@ -425,7 +425,7 @@ SbModule::SbModule( const OUString& rName, bool bVBASupport ) SetModuleType( script::ModuleType::NORMAL ); // #i92642: Set name property to initial name - SbxVariable* pNameProp = pProps->Find( "Name", SbxClassType::Property ); + SbxVariable* pNameProp = pProps->Find( u"Name"_ustr, SbxClassType::Property ); if( pNameProp != nullptr ) { pNameProp->PutString( GetName() ); @@ -922,25 +922,25 @@ static void SendHint( SbxObject* pObj, SfxHintId nId, SbMethod* p ) static void ClearUnoObjectsInRTL_Impl_Rek( StarBASIC* pBasic ) { // delete the return value of CreateUnoService - SbxVariable* pVar = pBasic->GetRtl()->Find( "CreateUnoService", SbxClassType::Method ); + SbxVariable* pVar = pBasic->GetRtl()->Find( u"CreateUnoService"_ustr, SbxClassType::Method ); if( pVar ) { pVar->SbxValue::Clear(); } // delete the return value of CreateUnoDialog - pVar = pBasic->GetRtl()->Find( "CreateUnoDialog", SbxClassType::Method ); + pVar = pBasic->GetRtl()->Find( u"CreateUnoDialog"_ustr, SbxClassType::Method ); if( pVar ) { pVar->SbxValue::Clear(); } // delete the return value of CDec - pVar = pBasic->GetRtl()->Find( "CDec", SbxClassType::Method ); + pVar = pBasic->GetRtl()->Find( u"CDec"_ustr, SbxClassType::Method ); if( pVar ) { pVar->SbxValue::Clear(); } // delete return value of CreateObject - pVar = pBasic->GetRtl()->Find( "CreateObject", SbxClassType::Method ); + pVar = pBasic->GetRtl()->Find( u"CreateObject"_ustr, SbxClassType::Method ); if( pVar ) { pVar->SbxValue::Clear(); @@ -987,7 +987,7 @@ void SbModule::SetVBASupport( bool bSupport ) mbCompat = true; StarBASIC* pBasic = static_cast< StarBASIC* >( GetParent() ); uno::Reference< lang::XMultiServiceFactory > xFactory( getDocumentModel( pBasic ), uno::UNO_QUERY_THROW ); - xFactory->createInstance( "ooo.vba.VBAGlobals" ); + xFactory->createInstance( u"ooo.vba.VBAGlobals"_ustr ); } catch( Exception& ) { @@ -1107,7 +1107,7 @@ void SbModule::Run( SbMethod* pMeth ) // Launcher problem // i80726 The Find below will generate an error in Testtool so we reset it unless there was one before already bool bWasError = SbxBase::GetError() != ERRCODE_NONE; - SbxVariable* pMSOMacroRuntimeLibVar = Find( "Launcher", SbxClassType::Object ); + SbxVariable* pMSOMacroRuntimeLibVar = Find( u"Launcher"_ustr, SbxClassType::Object ); if ( !bWasError && (SbxBase::GetError() == ERRCODE_BASIC_PROC_UNDEFINED) ) SbxBase::ResetError(); if( pMSOMacroRuntimeLibVar ) @@ -1117,7 +1117,7 @@ void SbModule::Run( SbMethod* pMeth ) { SbxFlagBits nGblFlag = pMSOMacroRuntimeLib->GetFlags() & SbxFlagBits::GlobalSearch; pMSOMacroRuntimeLib->ResetFlag( SbxFlagBits::GlobalSearch ); - SbxVariable* pAppSymbol = pMSOMacroRuntimeLib->Find( "Application", SbxClassType::Method ); + SbxVariable* pAppSymbol = pMSOMacroRuntimeLib->Find( u"Application"_ustr, SbxClassType::Method ); pMSOMacroRuntimeLib->SetFlag( nGblFlag ); if( pAppSymbol ) { @@ -1902,7 +1902,7 @@ void SbModule::handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rH // Implementation SbJScriptModule (Basic module for JavaScript source code) SbJScriptModule::SbJScriptModule() - :SbModule( "" ) + :SbModule( u""_ustr ) { } @@ -2132,7 +2132,7 @@ void SbMethod::Broadcast( SfxHintId nHintId ) // Implementation of SbJScriptMethod (method class as a wrapper for JavaScript-functions) SbJScriptMethod::SbJScriptMethod( SbxDataType t ) - : SbMethod( "", t, nullptr ) + : SbMethod( u""_ustr, t, nullptr ) { } @@ -2146,7 +2146,7 @@ SbObjModule::SbObjModule( const OUString& rName, const css::script::ModuleInfo& SetModuleType( mInfo.ModuleType ); if ( mInfo.ModuleType == script::ModuleType::FORM ) { - SetClassName( "Form" ); + SetClassName( u"Form"_ustr ); } else if ( mInfo.ModuleObject.is() ) { @@ -2167,13 +2167,13 @@ SbObjModule::SetUnoObject( const uno::Any& aObj ) pDocObject = new SbUnoObject( GetName(), aObj ); css::uno::Reference< css::lang::XServiceInfo > xServiceInfo( aObj, css::uno::UNO_QUERY_THROW ); - if( xServiceInfo->supportsService( "ooo.vba.excel.Worksheet" ) ) + if( xServiceInfo->supportsService( u"ooo.vba.excel.Worksheet"_ustr ) ) { - SetClassName( "Worksheet" ); + SetClassName( u"Worksheet"_ustr ); } - else if( xServiceInfo->supportsService( "ooo.vba.excel.Workbook" ) ) + else if( xServiceInfo->supportsService( u"ooo.vba.excel.Workbook"_ustr ) ) { - SetClassName( "Workbook" ); + SetClassName( u"Workbook"_ustr ); } } @@ -2479,36 +2479,36 @@ void SbUserFormModule::triggerMethod( const OUString& aMethodToRun, Sequence< An void SbUserFormModule::triggerActivateEvent() { - triggerMethod( "UserForm_Activate" ); + triggerMethod( u"UserForm_Activate"_ustr ); } void SbUserFormModule::triggerDeactivateEvent() { - triggerMethod( "Userform_Deactivate" ); + triggerMethod( u"Userform_Deactivate"_ustr ); } void SbUserFormModule::triggerInitializeEvent() { if ( mbInit ) return; - triggerMethod("Userform_Initialize"); + triggerMethod(u"Userform_Initialize"_ustr); mbInit = true; } void SbUserFormModule::triggerTerminateEvent() { - triggerMethod("Userform_Terminate"); + triggerMethod(u"Userform_Terminate"_ustr); mbInit=false; } void SbUserFormModule::triggerLayoutEvent() { - triggerMethod("Userform_Layout"); + triggerMethod(u"Userform_Layout"_ustr); } void SbUserFormModule::triggerResizeEvent() { - triggerMethod("Userform_Resize"); + triggerMethod(u"Userform_Resize"_ustr); } SbUserFormModuleInstance* SbUserFormModule::CreateInstance() @@ -2552,7 +2552,7 @@ void SbUserFormModule::Unload() Sequence< Any > aParams = { Any(nCancel), Any(sal_Int8(::ooo::vba::VbQueryClose::vbFormCode)) }; - triggerMethod( "Userform_QueryClose", aParams); + triggerMethod( u"Userform_QueryClose"_ustr, aParams); aParams[0] >>= nCancel; // basic boolean ( and what the user might use ) can be ambiguous ( e.g. basic true = -1 ) @@ -2568,7 +2568,7 @@ void SbUserFormModule::Unload() triggerTerminateEvent(); } // Search method - SbxVariable* pMeth = SbObjModule::Find( "UnloadObject", SbxClassType::Method ); + SbxVariable* pMeth = SbObjModule::Find( u"UnloadObject"_ustr, SbxClassType::Method ); if( !pMeth ) return; @@ -2595,7 +2595,7 @@ void SbUserFormModule::InitObject() { try { - SbUnoObject* pGlobs = static_cast(GetParent()->Find( "VBAGlobals", SbxClassType::DontCare )); + SbUnoObject* pGlobs = static_cast(GetParent()->Find( u"VBAGlobals"_ustr, SbxClassType::DontCare )); if ( m_xModel.is() && pGlobs ) { // broadcast INITIALIZE_USERFORM script event before the dialog is created @@ -2603,13 +2603,13 @@ void SbUserFormModule::InitObject() xVBACompat->broadcastVBAScriptEvent( script::vba::VBAScriptEventId::INITIALIZE_USERFORM, GetName() ); uno::Reference< lang::XMultiServiceFactory > xVBAFactory( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW ); uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); - OUString sDialogUrl( "vnd.sun.star.script:" ); - OUString sProjectName( "Standard" ); + OUString sDialogUrl( u"vnd.sun.star.script:"_ustr ); + OUString sProjectName( u"Standard"_ustr ); try { Reference< beans::XPropertySet > xProps( m_xModel, UNO_QUERY_THROW ); - uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( "BasicLibraries" ), uno::UNO_QUERY_THROW ); + uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( u"BasicLibraries"_ustr ), uno::UNO_QUERY_THROW ); sProjectName = xVBAMode->getProjectName(); } catch(const Exception& ) {} @@ -2627,7 +2627,7 @@ void SbUserFormModule::InitObject() Any(m_xModel), Any(GetParent()->GetName()) }; - pDocObject = new SbUnoObject( GetName(), uno::Any( xVBAFactory->createInstanceWithArguments( "ooo.vba.msforms.UserForm", aArgs ) ) ); + pDocObject = new SbUnoObject( GetName(), uno::Any( xVBAFactory->createInstanceWithArguments( u"ooo.vba.msforms.UserForm"_ustr, aArgs ) ) ); uno::Reference< lang::XComponent > xComponent( m_xDialog, uno::UNO_QUERY_THROW ); diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx index 9f2f4960bf9a..ea3856269cf3 100644 --- a/basic/source/comp/codegen.cxx +++ b/basic/source/comp/codegen.cxx @@ -92,7 +92,7 @@ sal_uInt32 SbiCodeGen::Gen( SbiOpcode eOpcode ) #ifdef DBG_UTIL if( eOpcode < SbiOpcode::SbOP0_START || eOpcode > SbiOpcode::SbOP0_END ) - pParser->Error( ERRCODE_BASIC_INTERNAL_ERROR, "OPCODE1" ); + pParser->Error( ERRCODE_BASIC_INTERNAL_ERROR, u"OPCODE1"_ustr ); #endif GenStmnt(); aCode += static_cast(eOpcode); @@ -106,7 +106,7 @@ sal_uInt32 SbiCodeGen::Gen( SbiOpcode eOpcode, sal_uInt32 nOpnd ) #ifdef DBG_UTIL if( eOpcode < SbiOpcode::SbOP1_START || eOpcode > SbiOpcode::SbOP1_END ) - pParser->Error( ERRCODE_BASIC_INTERNAL_ERROR, "OPCODE2" ); + pParser->Error( ERRCODE_BASIC_INTERNAL_ERROR, u"OPCODE2"_ustr ); #endif GenStmnt(); aCode += static_cast(eOpcode); @@ -122,7 +122,7 @@ sal_uInt32 SbiCodeGen::Gen( SbiOpcode eOpcode, sal_uInt32 nOpnd1, sal_uInt32 nOp #ifdef DBG_UTIL if( eOpcode < SbiOpcode::SbOP2_START || eOpcode > SbiOpcode::SbOP2_END ) - pParser->Error( ERRCODE_BASIC_INTERNAL_ERROR, "OPCODE3" ); + pParser->Error( ERRCODE_BASIC_INTERNAL_ERROR, u"OPCODE3"_ustr ); #endif GenStmnt(); aCode += static_cast(eOpcode); diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index cbc25b0152b4..7321d8496a6e 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -66,7 +66,7 @@ SbiSymDef* SbiParser::VarDecl( SbiExprListPtr* ppDim, bool bStatic, bool bConst if( !ppDim && pDim ) { if(pDim->GetDims() ) - Error( ERRCODE_BASIC_EXPECTED, "()" ); + Error( ERRCODE_BASIC_EXPECTED, u"()"_ustr ); } else if( ppDim ) *ppDim = std::move(pDim); @@ -704,8 +704,8 @@ void SbiParser::DefType() } } - pType->Remove( "Name", SbxClassType::DontCare ); - pType->Remove( "Parent", SbxClassType::DontCare ); + pType->Remove( u"Name"_ustr, SbxClassType::DontCare ); + pType->Remove( u"Parent"_ustr, SbxClassType::DontCare ); rTypeArray->Insert(pType, rTypeArray->Count()); } @@ -835,8 +835,8 @@ void SbiParser::DefEnum( bool bPrivate ) } } - pEnum->Remove( "Name", SbxClassType::DontCare ); - pEnum->Remove( "Parent", SbxClassType::DontCare ); + pEnum->Remove( u"Name"_ustr, SbxClassType::DontCare ); + pEnum->Remove( u"Parent"_ustr, SbxClassType::DontCare ); rEnumArray->Insert(pEnum, rEnumArray->Count()); } @@ -1220,7 +1220,7 @@ void SbiParser::DefProc( bool bStatic, bool bPrivate ) } else { - Error( ERRCODE_BASIC_EXPECTED, "Get or Let or Set" ); + Error( ERRCODE_BASIC_EXPECTED, u"Get or Let or Set"_ustr ); } } diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx index 76f1ab776a63..b02db9fe6a24 100644 --- a/basic/source/comp/exprgen.cxx +++ b/basic/source/comp/exprgen.cxx @@ -178,7 +178,7 @@ void SbiExprNode::GenElement( SbiCodeGen& rGen, SbiOpcode eOp ) { #ifdef DBG_UTIL if ((eOp < SbiOpcode::RTL_ || eOp > SbiOpcode::CALLC_) && eOp != SbiOpcode::FIND_G_ && eOp != SbiOpcode::FIND_CM_ && eOp != SbiOpcode::FIND_STATIC_) - rGen.GetParser()->Error( ERRCODE_BASIC_INTERNAL_ERROR, "Opcode" ); + rGen.GetParser()->Error( ERRCODE_BASIC_INTERNAL_ERROR, u"Opcode"_ustr ); #endif SbiSymDef* pDef = aVar.pDef; // The ID is either the position or the String-ID diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx index 989f1c6330c5..db7254033e5e 100644 --- a/basic/source/comp/exprtree.cxx +++ b/basic/source/comp/exprtree.cxx @@ -1034,7 +1034,7 @@ SbiExprListPtr SbiExprList::ParseParameters( SbiParser* pParser, bool bStandalon // tdf#106529: only fail here in strict mode (i.e. when compiled from IDE), and // allow legacy code with missing closing parenthesis when started e.g. from // extensions and event handlers - if (comphelper::IsContextFlagActive("BasicStrict")) + if (comphelper::IsContextFlagActive(u"BasicStrict"_ustr)) { pParser->Error(ERRCODE_BASIC_EXPECTED, RPAREN); pExprList->bError = true; diff --git a/basic/source/comp/io.cxx b/basic/source/comp/io.cxx index 9e91413fd997..716d8ee95dda 100644 --- a/basic/source/comp/io.cxx +++ b/basic/source/comp/io.cxx @@ -38,7 +38,7 @@ bool SbiParser::Channel( bool bAlways ) bRes = true; } else if( bAlways ) - Error( ERRCODE_BASIC_EXPECTED, "#" ); + Error( ERRCODE_BASIC_EXPECTED, u"#"_ustr ); return bRes; } diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx index 2a756b6fb3a5..1d7f9ff84dfd 100644 --- a/basic/source/comp/loops.cxx +++ b/basic/source/comp/loops.cxx @@ -299,7 +299,7 @@ void SbiParser::BadBlock() if( eEndTok ) Error( ERRCODE_BASIC_BAD_BLOCK, eEndTok ); else - Error( ERRCODE_BASIC_BAD_BLOCK, "Loop/Next/Wend" ); + Error( ERRCODE_BASIC_BAD_BLOCK, u"Loop/Next/Wend"_ustr ); } // On expr Goto/Gosub n,n,n... @@ -312,7 +312,7 @@ void SbiParser::OnGoto() SbiToken eTok = Next(); if( eTok != GOTO && eTok != GOSUB ) { - Error( ERRCODE_BASIC_EXPECTED, "GoTo/GoSub" ); + Error( ERRCODE_BASIC_EXPECTED, u"GoTo/GoSub"_ustr ); eTok = GOTO; } @@ -533,7 +533,7 @@ void SbiParser::On() TestToken( NEXT ); aGen.Gen( SbiOpcode::NOERROR_ ); } - else Error( ERRCODE_BASIC_EXPECTED, "GoTo/Resume" ); + else Error( ERRCODE_BASIC_EXPECTED, u"GoTo/Resume"_ustr ); } } diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx index 97bd27675fa8..bab048d9f5d7 100644 --- a/basic/source/comp/parser.cxx +++ b/basic/source/comp/parser.cxx @@ -495,7 +495,7 @@ void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo ) bool bEQ = ( Peek() == EQ ); if( !bEQ && bVBASupportOn && aVar.IsBracket() ) - Error( ERRCODE_BASIC_EXPECTED, "=" ); + Error( ERRCODE_BASIC_EXPECTED, u"="_ustr ); RecursiveMode eRecMode = ( bEQ ? PREVENT_CALL : FORCE_CALL ); bool bSpecialMidHandling = false; @@ -772,14 +772,14 @@ void SbiParser::Option() nBase = static_cast(nVal); break; } - Error( ERRCODE_BASIC_EXPECTED, "0/1" ); + Error( ERRCODE_BASIC_EXPECTED, u"0/1"_ustr ); break; case PRIVATE: { OUString aString = SbiTokenizer::Symbol(Next()); if( !aString.equalsIgnoreAsciiCase("Module") ) { - Error( ERRCODE_BASIC_EXPECTED, "Module" ); + Error( ERRCODE_BASIC_EXPECTED, u"Module"_ustr ); } break; } @@ -794,7 +794,7 @@ void SbiParser::Option() } else { - Error( ERRCODE_BASIC_EXPECTED, "Text/Binary" ); + Error( ERRCODE_BASIC_EXPECTED, u"Text/Binary"_ustr ); } break; } @@ -825,7 +825,7 @@ void SbiParser::Option() break; } } - Error( ERRCODE_BASIC_EXPECTED, "0/1" ); + Error( ERRCODE_BASIC_EXPECTED, u"0/1"_ustr ); break; default: Error( ERRCODE_BASIC_BAD_OPTION, eCurTok ); @@ -851,39 +851,39 @@ void SbiParser::AddConstants() { // tdf#153543 - shell constants // See https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/shell-constants - addNumericConst(aPublics, "vbHide", 0); - addNumericConst(aPublics, "vbNormalFocus", 1); - addNumericConst(aPublics, "vbMinimizedFocus", 2); - addNumericConst(aPublics, "vbMaximizedFocus", 3); - addNumericConst(aPublics, "vbNormalNoFocus", 4); - addNumericConst(aPublics, "vbMinimizedNoFocus", 6); + addNumericConst(aPublics, u"vbHide"_ustr, 0); + addNumericConst(aPublics, u"vbNormalFocus"_ustr, 1); + addNumericConst(aPublics, u"vbMinimizedFocus"_ustr, 2); + addNumericConst(aPublics, u"vbMaximizedFocus"_ustr, 3); + addNumericConst(aPublics, u"vbNormalNoFocus"_ustr, 4); + addNumericConst(aPublics, u"vbMinimizedNoFocus"_ustr, 6); // tdf#131563 - add vba color constants // See https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/color-constants - addNumericConst(aPublics, "vbBlack", 0x0); - addNumericConst(aPublics, "vbRed", 0xFF); - addNumericConst(aPublics, "vbGreen", 0xFF00); - addNumericConst(aPublics, "vbYellow", 0xFFFF); - addNumericConst(aPublics, "vbBlue", 0xFF0000); - addNumericConst(aPublics, "vbMagenta", 0xFF00FF); - addNumericConst(aPublics, "vbCyan", 0xFFFF00); - addNumericConst(aPublics, "vbWhite", 0xFFFFFF); + addNumericConst(aPublics, u"vbBlack"_ustr, 0x0); + addNumericConst(aPublics, u"vbRed"_ustr, 0xFF); + addNumericConst(aPublics, u"vbGreen"_ustr, 0xFF00); + addNumericConst(aPublics, u"vbYellow"_ustr, 0xFFFF); + addNumericConst(aPublics, u"vbBlue"_ustr, 0xFF0000); + addNumericConst(aPublics, u"vbMagenta"_ustr, 0xFF00FF); + addNumericConst(aPublics, u"vbCyan"_ustr, 0xFFFF00); + addNumericConst(aPublics, u"vbWhite"_ustr, 0xFFFFFF); // #113063 Create constant RTL symbols - addStringConst( aPublics, "vbCr", "\x0D" ); - addStringConst( aPublics, "vbCrLf", "\x0D\x0A" ); - addStringConst( aPublics, "vbFormFeed", "\x0C" ); - addStringConst( aPublics, "vbLf", "\x0A" ); + addStringConst( aPublics, u"vbCr"_ustr, u"\x0D"_ustr ); + addStringConst( aPublics, u"vbCrLf"_ustr, u"\x0D\x0A"_ustr ); + addStringConst( aPublics, u"vbFormFeed"_ustr, u"\x0C"_ustr ); + addStringConst( aPublics, u"vbLf"_ustr, u"\x0A"_ustr ); #ifdef _WIN32 addStringConst( aPublics, "vbNewLine", "\x0D\x0A" ); #else - addStringConst( aPublics, "vbNewLine", "\x0A" ); + addStringConst( aPublics, u"vbNewLine"_ustr, u"\x0A"_ustr ); #endif - addStringConst( aPublics, "vbNullString", "" ); - addStringConst( aPublics, "vbTab", "\x09" ); - addStringConst( aPublics, "vbVerticalTab", "\x0B" ); + addStringConst( aPublics, u"vbNullString"_ustr, u""_ustr ); + addStringConst( aPublics, u"vbTab"_ustr, u"\x09"_ustr ); + addStringConst( aPublics, u"vbVerticalTab"_ustr, u"\x0B"_ustr ); - addStringConst( aPublics, "vbNullChar", OUString(u'\0') ); + addStringConst( aPublics, u"vbNullChar"_ustr, OUString(u'\0') ); } // ERROR n diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx index 6caa3b2ed3d3..0040e55613d5 100644 --- a/basic/source/comp/symtbl.cxx +++ b/basic/source/comp/symtbl.cxx @@ -170,7 +170,7 @@ void SbiSymPool::Add( SbiSymDef* pDef ) { #ifdef DBG_UTIL - pParser->Error( ERRCODE_BASIC_INTERNAL_ERROR, "Dbl Pool" ); + pParser->Error( ERRCODE_BASIC_INTERNAL_ERROR, u"Dbl Pool"_ustr ); #endif return; } @@ -494,7 +494,7 @@ void SbiProcDef::setPropertyMode( PropertyMode ePropMode ) // CompleteProcName includes "Property xxx " // to avoid conflicts with other symbols - OUString aCompleteProcName = "Property "; + OUString aCompleteProcName = u"Property "_ustr; switch( mePropMode ) { case PropertyMode::Get: aCompleteProcName += "Get "; break; diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx index 814d5488f8ee..2c68b883da89 100644 --- a/basic/source/comp/token.cxx +++ b/basic/source/comp/token.cxx @@ -227,7 +227,7 @@ SbiTokenizer::SbiTokenizer( const OUString& rSrc, StarBASIC* pb ) void SbiTokenizer::Push( SbiToken t ) { if( ePush != NIL ) - Error( ERRCODE_BASIC_INTERNAL_ERROR, "PUSH" ); + Error( ERRCODE_BASIC_INTERNAL_ERROR, u"PUSH"_ustr ); else ePush = t; } diff --git a/basic/source/runtime/comenumwrapper.cxx b/basic/source/runtime/comenumwrapper.cxx index b7881a1b9ade..2434197d76d8 100644 --- a/basic/source/runtime/comenumwrapper.cxx +++ b/basic/source/runtime/comenumwrapper.cxx @@ -30,7 +30,7 @@ sal_Bool SAL_CALL ComEnumerationWrapper::hasMoreElements() if ( m_xInvocation.is() ) { sal_Int32 nLength = 0; - bResult = ( ( m_xInvocation->getValue( "length" ) >>= nLength ) && nLength > m_nCurInd ); + bResult = ( ( m_xInvocation->getValue( u"length"_ustr ) >>= nLength ) && nLength > m_nCurInd ); } } catch(const uno::Exception& ) @@ -49,7 +49,7 @@ uno::Any SAL_CALL ComEnumerationWrapper::nextElement() uno::Sequence< uno::Any > aNamedParam; uno::Sequence< uno::Any > aArgs{ uno::Any(m_nCurInd++) }; - return m_xInvocation->invoke( "item", + return m_xInvocation->invoke( u"item"_ustr, aArgs, aNamedParamIndex, aNamedParam ); diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx index 2e154d0e0027..134c1a0759c7 100644 --- a/basic/source/runtime/inputbox.cxx +++ b/basic/source/runtime/inputbox.cxx @@ -52,11 +52,11 @@ public: SvRTLInputBox::SvRTLInputBox(weld::Window* pParent, const OUString& rPrompt, const OUString& rTitle, const OUString& rDefault, tools::Long nXTwips, tools::Long nYTwips) - : GenericDialogController(pParent, "svt/ui/inputbox.ui", "InputBox") - , m_xEdit(m_xBuilder->weld_entry("entry")) - , m_xOk(m_xBuilder->weld_button("ok")) - , m_xCancel(m_xBuilder->weld_button("cancel")) - , m_xPromptText(m_xBuilder->weld_label("prompt")) + : GenericDialogController(pParent, u"svt/ui/inputbox.ui"_ustr, u"InputBox"_ustr) + , m_xEdit(m_xBuilder->weld_entry(u"entry"_ustr)) + , m_xOk(m_xBuilder->weld_button(u"ok"_ustr)) + , m_xCancel(m_xBuilder->weld_button(u"cancel"_ustr)) + , m_xPromptText(m_xBuilder->weld_label(u"prompt"_ustr)) { PositionDialog( nXTwips, nYTwips ); InitButtons(); diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index 015ed8abc29b..1cb7f77d90b7 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -63,11 +63,11 @@ public: } SbiInputDialog::SbiInputDialog(weld::Window* pParent, const OUString& rPrompt) - : GenericDialogController(pParent, "svt/ui/inputbox.ui", "InputBox") - , m_xInput(m_xBuilder->weld_entry("entry")) - , m_xOk(m_xBuilder->weld_button("ok")) - , m_xCancel(m_xBuilder->weld_button("cancel")) - , m_xPromptText(m_xBuilder->weld_label("prompt")) + : GenericDialogController(pParent, u"svt/ui/inputbox.ui"_ustr, u"InputBox"_ustr) + , m_xInput(m_xBuilder->weld_entry(u"entry"_ustr)) + , m_xOk(m_xBuilder->weld_button(u"ok"_ustr)) + , m_xCancel(m_xBuilder->weld_button(u"cancel"_ustr)) + , m_xPromptText(m_xBuilder->weld_label(u"prompt"_ustr)) { m_xDialog->set_title(rPrompt); m_xPromptText->set_label(rPrompt); @@ -141,7 +141,7 @@ bool hasUno() { Reference< XUniversalContentBroker > xManager = UniversalContentBroker::create(xContext); - if ( !( xManager->queryContentProvider( "file:///" ).is() ) ) + if ( !( xManager->queryContentProvider( u"file:///"_ustr ).is() ) ) { // No UCB return false; diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index dd8aabfde6d5..0235db0fc06a 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -1347,7 +1347,7 @@ void SbRtl_Str(StarBASIC *, SbxArray & rPar, bool) else { OUString aStr; - OUString aStrNew(""); + OUString aStrNew(u""_ustr); SbxVariableRef pArg = rPar.Get(1); pArg->Format( aStr ); @@ -2534,7 +2534,7 @@ void SbRtl_Dir(StarBASIC *, SbxArray & rPar, bool) } else { - rPar.Get(0)->PutString(""); + rPar.Get(0)->PutString(u""_ustr); } SbAttributes nFlags = SbAttributes::NONE; @@ -3617,7 +3617,7 @@ OUString getBasicTypeName( SbxDataType eType ) static OUString getObjectTypeName( SbxVariable* pVar ) { - OUString sRet( "Object" ); + OUString sRet( u"Object"_ustr ); if ( pVar ) { SbxBase* pBaseObj = pVar->GetObject(); @@ -3659,7 +3659,7 @@ static OUString getObjectTypeName( SbxVariable* pVar ) { try { - xInv->getValue( "$GetTypeName" ) >>= sRet; + xInv->getValue( u"$GetTypeName"_ustr ) >>= sRet; } catch(const Exception& ) { @@ -4133,7 +4133,7 @@ void SbRtl_Load(StarBASIC *, SbxArray & rPar, bool) } else if (SbxObject* pSbxObj = dynamic_cast(pObj)) { - SbxVariable* pVar = pSbxObj->Find("Load", SbxClassType::Method); + SbxVariable* pVar = pSbxObj->Find(u"Load"_ustr, SbxClassType::Method); if( pVar ) { pVar->GetInteger(); @@ -4160,7 +4160,7 @@ void SbRtl_Unload(StarBASIC *, SbxArray & rPar, bool) } else if (SbxObject *pSbxObj = dynamic_cast(pObj)) { - SbxVariable* pVar = pSbxObj->Find("Unload", SbxClassType::Method); + SbxVariable* pVar = pSbxObj->Find(u"Unload"_ustr, SbxClassType::Method); if( pVar ) { pVar->GetInteger(); diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 57d95b93a526..4730f7633038 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -2325,7 +2325,7 @@ static void CallFunctionAccessFunction( const Sequence< Any >& aArgs, const OUSt Reference< XMultiServiceFactory > xFactory( getProcessServiceFactory() ); if( xFactory.is() ) { - xFunc.set( xFactory->createInstance("com.sun.star.sheet.FunctionAccess"), UNO_QUERY_THROW); + xFunc.set( xFactory->createInstance(u"com.sun.star.sheet.FunctionAccess"_ustr), UNO_QUERY_THROW); } } Any aRet = xFunc->callFunction( sFuncName, aArgs ); @@ -2359,7 +2359,7 @@ void SbRtl_SYD(StarBASIC *, SbxArray & rPar, bool) Any(rPar.Get(4)->GetDouble()) }; - CallFunctionAccessFunction(aParams, "SYD", rPar.Get(0)); + CallFunctionAccessFunction(aParams, u"SYD"_ustr, rPar.Get(0)); } void SbRtl_SLN(StarBASIC *, SbxArray & rPar, bool) @@ -2381,7 +2381,7 @@ void SbRtl_SLN(StarBASIC *, SbxArray & rPar, bool) Any(rPar.Get(3)->GetDouble()) }; - CallFunctionAccessFunction(aParams, "SLN", rPar.Get(0)); + CallFunctionAccessFunction(aParams, u"SLN"_ustr, rPar.Get(0)); } void SbRtl_Pmt(StarBASIC *, SbxArray & rPar, bool) @@ -2425,7 +2425,7 @@ void SbRtl_Pmt(StarBASIC *, SbxArray & rPar, bool) Any(type) }; - CallFunctionAccessFunction(aParams, "Pmt", rPar.Get(0)); + CallFunctionAccessFunction(aParams, u"Pmt"_ustr, rPar.Get(0)); } void SbRtl_PPmt(StarBASIC *, SbxArray & rPar, bool) @@ -2471,7 +2471,7 @@ void SbRtl_PPmt(StarBASIC *, SbxArray & rPar, bool) Any(type) }; - CallFunctionAccessFunction(aParams, "PPmt", rPar.Get(0)); + CallFunctionAccessFunction(aParams, u"PPmt"_ustr, rPar.Get(0)); } void SbRtl_PV(StarBASIC *, SbxArray & rPar, bool) @@ -2515,7 +2515,7 @@ void SbRtl_PV(StarBASIC *, SbxArray & rPar, bool) Any(type) }; - CallFunctionAccessFunction(aParams, "PV", rPar.Get(0)); + CallFunctionAccessFunction(aParams, u"PV"_ustr, rPar.Get(0)); } void SbRtl_NPV(StarBASIC *, SbxArray & rPar, bool) @@ -2542,7 +2542,7 @@ void SbRtl_NPV(StarBASIC *, SbxArray & rPar, bool) aValues }; - CallFunctionAccessFunction(aParams, "NPV", rPar.Get(0)); + CallFunctionAccessFunction(aParams, u"NPV"_ustr, rPar.Get(0)); } void SbRtl_NPer(StarBASIC *, SbxArray & rPar, bool) @@ -2586,7 +2586,7 @@ void SbRtl_NPer(StarBASIC *, SbxArray & rPar, bool) Any(type) }; - CallFunctionAccessFunction(aParams, "NPer", rPar.Get(0)); + CallFunctionAccessFunction(aParams, u"NPer"_ustr, rPar.Get(0)); } void SbRtl_MIRR(StarBASIC *, SbxArray & rPar, bool) @@ -2616,7 +2616,7 @@ void SbRtl_MIRR(StarBASIC *, SbxArray & rPar, bool) Any(rPar.Get(3)->GetDouble()) }; - CallFunctionAccessFunction(aParams, "MIRR", rPar.Get(0)); + CallFunctionAccessFunction(aParams, u"MIRR"_ustr, rPar.Get(0)); } void SbRtl_IRR(StarBASIC *, SbxArray & rPar, bool) @@ -2652,7 +2652,7 @@ void SbRtl_IRR(StarBASIC *, SbxArray & rPar, bool) Any(guess) }; - CallFunctionAccessFunction(aParams, "IRR", rPar.Get(0)); + CallFunctionAccessFunction(aParams, u"IRR"_ustr, rPar.Get(0)); } void SbRtl_IPmt(StarBASIC *, SbxArray & rPar, bool) @@ -2698,7 +2698,7 @@ void SbRtl_IPmt(StarBASIC *, SbxArray & rPar, bool) Any(type) }; - CallFunctionAccessFunction(aParams, "IPmt", rPar.Get(0)); + CallFunctionAccessFunction(aParams, u"IPmt"_ustr, rPar.Get(0)); } void SbRtl_FV(StarBASIC *, SbxArray & rPar, bool) @@ -2742,7 +2742,7 @@ void SbRtl_FV(StarBASIC *, SbxArray & rPar, bool) Any(type) }; - CallFunctionAccessFunction(aParams, "FV", rPar.Get(0)); + CallFunctionAccessFunction(aParams, u"FV"_ustr, rPar.Get(0)); } void SbRtl_DDB(StarBASIC *, SbxArray & rPar, bool) @@ -2780,7 +2780,7 @@ void SbRtl_DDB(StarBASIC *, SbxArray & rPar, bool) Any(factor) }; - CallFunctionAccessFunction(aParams, "DDB", rPar.Get(0)); + CallFunctionAccessFunction(aParams, u"DDB"_ustr, rPar.Get(0)); } void SbRtl_Rate(StarBASIC *, SbxArray & rPar, bool) @@ -2838,7 +2838,7 @@ void SbRtl_Rate(StarBASIC *, SbxArray & rPar, bool) Any(guess) }; - CallFunctionAccessFunction(aParams, "Rate", rPar.Get(0)); + CallFunctionAccessFunction(aParams, u"Rate"_ustr, rPar.Get(0)); } void SbRtl_StrReverse(StarBASIC *, SbxArray & rPar, bool) diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 12d522790c38..e2f82d5ad97d 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -3759,7 +3759,7 @@ SbxBase* SbiRuntime::FindElementExtern( const OUString& rName ) { // Parameter is missing pElem = new SbxVariable( SbxSTRING ); - pElem->PutString( ""); + pElem->PutString( u""_ustr); } else { diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx index 5b123d00d5a2..122c00f2aebc 100644 --- a/basic/source/runtime/stdobj.cxx +++ b/basic/source/runtime/stdobj.cxx @@ -929,8 +929,8 @@ static_assert(MethodsTableValid(aMethods)); SbiStdObject::SbiStdObject( const OUString& r, StarBASIC* pb ) : SbxObject( r ) { // #i92642: Remove default properties - Remove( "Name", SbxClassType::DontCare ); - Remove( "Parent", SbxClassType::DontCare ); + Remove( u"Name"_ustr, SbxClassType::DontCare ); + Remove( u"Parent"_ustr, SbxClassType::DontCare ); SetParent( pb ); diff --git a/basic/source/runtime/stdobj1.cxx b/basic/source/runtime/stdobj1.cxx index c24c59af95a3..533eb2f92f24 100644 --- a/basic/source/runtime/stdobj1.cxx +++ b/basic/source/runtime/stdobj1.cxx @@ -104,16 +104,16 @@ void SbStdPicture::PropHeight( SbxVariable* pVar, bool bWrite ) SbStdPicture::SbStdPicture() : - SbxObject( "Picture" ) + SbxObject( u"Picture"_ustr ) { // Properties - SbxVariable* p = Make( "Type", SbxClassType::Property, SbxVARIANT ); + SbxVariable* p = Make( u"Type"_ustr, SbxClassType::Property, SbxVARIANT ); p->SetFlags( SbxFlagBits::Read | SbxFlagBits::DontStore ); p->SetUserData( ATTR_IMP_TYPE ); - p = Make( "Width", SbxClassType::Property, SbxVARIANT ); + p = Make( u"Width"_ustr, SbxClassType::Property, SbxVARIANT ); p->SetFlags( SbxFlagBits::Read | SbxFlagBits::DontStore ); p->SetUserData( ATTR_IMP_WIDTH ); - p = Make( "Height", SbxClassType::Property, SbxVARIANT ); + p = Make( u"Height"_ustr, SbxClassType::Property, SbxVARIANT ); p->SetFlags( SbxFlagBits::Read | SbxFlagBits::DontStore ); p->SetUserData( ATTR_IMP_HEIGHT ); } @@ -208,7 +208,7 @@ void SbStdFont::PropName( SbxVariable* pVar, bool bWrite ) SbStdFont::SbStdFont() - : SbxObject( "Font" ) + : SbxObject( u"Font"_ustr ) , bBold(false) , bItalic(false) , bStrikeThrough(false) @@ -216,24 +216,24 @@ SbStdFont::SbStdFont() , nSize(0) { // Properties - SbxVariable* p = Make( "Bold", SbxClassType::Property, SbxVARIANT ); + SbxVariable* p = Make( u"Bold"_ustr, SbxClassType::Property, SbxVARIANT ); p->SetFlags( SbxFlagBits::ReadWrite | SbxFlagBits::DontStore ); p->SetUserData( ATTR_IMP_BOLD ); - p = Make( "Italic", SbxClassType::Property, SbxVARIANT ); + p = Make( u"Italic"_ustr, SbxClassType::Property, SbxVARIANT ); p->SetFlags( SbxFlagBits::ReadWrite | SbxFlagBits::DontStore ); p->SetUserData( ATTR_IMP_ITALIC ); - p = Make( "StrikeThrough", SbxClassType::Property, SbxVARIANT ); + p = Make( u"StrikeThrough"_ustr, SbxClassType::Property, SbxVARIANT ); p->SetFlags( SbxFlagBits::ReadWrite | SbxFlagBits::DontStore ); p->SetUserData( ATTR_IMP_STRIKETHROUGH ); - p = Make( "Underline", SbxClassType::Property, SbxVARIANT ); + p = Make( u"Underline"_ustr, SbxClassType::Property, SbxVARIANT ); p->SetFlags( SbxFlagBits::ReadWrite | SbxFlagBits::DontStore ); p->SetUserData( ATTR_IMP_UNDERLINE ); - p = Make( "Size", SbxClassType::Property, SbxVARIANT ); + p = Make( u"Size"_ustr, SbxClassType::Property, SbxVARIANT ); p->SetFlags( SbxFlagBits::ReadWrite | SbxFlagBits::DontStore ); p->SetUserData( ATTR_IMP_SIZE ); // handle name property yourself - p = Find( "Name", SbxClassType::Property ); + p = Find( u"Name"_ustr, SbxClassType::Property ); assert(p && "No Name Property"); p->SetUserData( ATTR_IMP_NAME ); } @@ -360,29 +360,29 @@ void SbStdClipboard::MethSetText( SbxArray const * pPar_ ) SbStdClipboard::SbStdClipboard() : - SbxObject( "Clipboard" ) + SbxObject( u"Clipboard"_ustr ) { - SbxVariable* p = Find( "Name", SbxClassType::Property ); + SbxVariable* p = Find( u"Name"_ustr, SbxClassType::Property ); assert(p && "No Name Property"); p->SetUserData( ATTR_IMP_NAME ); // register methods - p = Make( "Clear", SbxClassType::Method, SbxEMPTY ); + p = Make( u"Clear"_ustr, SbxClassType::Method, SbxEMPTY ); p->SetFlag( SbxFlagBits::DontStore ); p->SetUserData( METH_CLEAR ); - p = Make( "GetData", SbxClassType::Method, SbxEMPTY ); + p = Make( u"GetData"_ustr, SbxClassType::Method, SbxEMPTY ); p->SetFlag( SbxFlagBits::DontStore ); p->SetUserData( METH_GETDATA ); - p = Make( "GetFormat", SbxClassType::Method, SbxEMPTY ); + p = Make( u"GetFormat"_ustr, SbxClassType::Method, SbxEMPTY ); p->SetFlag( SbxFlagBits::DontStore ); p->SetUserData( METH_GETFORMAT ); - p = Make( "GetText", SbxClassType::Method, SbxEMPTY ); + p = Make( u"GetText"_ustr, SbxClassType::Method, SbxEMPTY ); p->SetFlag( SbxFlagBits::DontStore ); p->SetUserData( METH_GETTEXT ); - p = Make( "SetData", SbxClassType::Method, SbxEMPTY ); + p = Make( u"SetData"_ustr, SbxClassType::Method, SbxEMPTY ); p->SetFlag( SbxFlagBits::DontStore ); p->SetUserData( METH_SETDATA ); - p = Make( "SetText", SbxClassType::Method, SbxEMPTY ); + p = Make( u"SetText"_ustr, SbxClassType::Method, SbxEMPTY ); p->SetFlag( SbxFlagBits::DontStore ); p->SetUserData( METH_SETTEXT ); } diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx index b90368f68f26..1d34683aea19 100644 --- a/basic/source/sbx/sbxbase.cxx +++ b/basic/source/sbx/sbxbase.cxx @@ -158,12 +158,12 @@ SbxBaseRef SbxBase::Create( sal_uInt16 nSbxId, sal_uInt32 nCreator ) case SBXID_VARIABLE: return new SbxVariable; case SBXID_ARRAY: return new SbxArray; case SBXID_DIMARRAY: return new SbxDimArray; - case SBXID_OBJECT: return new SbxObject( "" ); + case SBXID_OBJECT: return new SbxObject( u""_ustr ); case SBXID_COLLECTION: return new SbxCollection; case SBXID_FIXCOLLECTION: return new SbxStdCollection; - case SBXID_METHOD: return new SbxMethod( "", SbxEMPTY ); - case SBXID_PROPERTY: return new SbxProperty( "", SbxEMPTY ); + case SBXID_METHOD: return new SbxMethod( u""_ustr, SbxEMPTY ); + case SBXID_PROPERTY: return new SbxProperty( u""_ustr, SbxEMPTY ); } // Unknown type: go over the factories! SbxAppData& r = GetSbxData_Impl(); diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx index a29e832fa2a8..0aeffc6ecefc 100644 --- a/basic/source/sbx/sbxcoll.cxx +++ b/basic/source/sbx/sbxcoll.cxx @@ -33,7 +33,7 @@ static sal_uInt16 nCountHash = 0, nAddHash, nItemHash, nRemoveHash; SbxCollection::SbxCollection() - : SbxObject( "" ) + : SbxObject( u""_ustr ) { if( !nCountHash ) { diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx index 49d45ccc5f38..d0640e71a7d6 100644 --- a/basic/source/sbx/sbxform.cxx +++ b/basic/source/sbx/sbxform.cxx @@ -851,7 +851,7 @@ OUString SbxBasicFormater::BasicFormatNull( std::u16string_view sFormatStrg ) { return sNullFormatStrg; } - return "null"; + return u"null"_ustr; } OUString SbxBasicFormater::BasicFormat( double dNumber, const OUString& _sFormatStrg ) diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx index be1aec16393a..66933a6d4cbf 100644 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.cxx @@ -693,7 +693,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill ) return; } ++nLevel; - OUString aIndent(""); + OUString aIndent(u""_ustr); for ( sal_uInt16 n = 1; n < nLevel; ++n ) { aIndent += " "; diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 0d6949e913d6..87f4455ca5d2 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -200,7 +200,7 @@ ErrCode ImpScan( const OUString& rWSrc, double& nVal, SbxDataType& rType, { p++; eScanType = SbxLONG; - OUString aCmp( "0123456789ABCDEF" ); + OUString aCmp( u"0123456789ABCDEF"_ustr ); char base = 16; char ndig = 8; switch( *p++ ) diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index 533deb182d58..e302c1dd392f 100644 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -140,7 +140,7 @@ static bool writeOasis2OOoLibraryElement( Sequence aArgs{ Any(xWriter) }; Reference< xml::sax::XDocumentHandler > xHandler( xSMgr->createInstanceWithArgumentsAndContext( - "com.sun.star.comp.Oasis2OOoTransformer", + u"com.sun.star.comp.Oasis2OOoTransformer"_ustr, aArgs, xContext ), UNO_QUERY ); @@ -244,7 +244,7 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e { Reference< io::XInputStream > xInput( xISP->createInputStream() ); Reference< XNameContainer > xDialogModel( - mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", mxContext), + mxContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.awt.UnoControlDialogModel"_ustr, mxContext), UNO_QUERY ); ::xmlscript::importDialogModel( xInput, xDialogModel, mxContext, mxOwnerDocument ); std::vector> vxGraphicList; @@ -291,7 +291,7 @@ Any SfxDialogLibraryContainer::importLibraryElement Reference< XParser > xParser = xml::sax::Parser::create( mxContext ); Reference< XNameContainer > xDialogModel( - mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", mxContext), + mxContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.awt.UnoControlDialogModel"_ustr, mxContext), UNO_QUERY ); if( !xDialogModel.is() ) { @@ -387,19 +387,19 @@ Reference< css::resource::XStringResourcePersistence > xLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ ); // TODO: Should be READWRITE with new storage concept using store() instead of storeTo() if ( !xLibrariesStor.is() ) - throw uno::RuntimeException("null returned from openStorageElement",getXWeak()); + throw uno::RuntimeException(u"null returned from openStorageElement"_ustr,getXWeak()); xLibraryStor = xLibrariesStor->openStorageElement( aLibName, embed::ElementModes::READ ); // TODO: Should be READWRITE with new storage concept using store() instead of storeTo() if ( !xLibraryStor.is() ) - throw uno::RuntimeException("null returned from openStorageElement",getXWeak()); + throw uno::RuntimeException(u"null returned from openStorageElement"_ustr,getXWeak()); } catch(const uno::Exception& ) { // Something went wrong while trying to get the storage library. // Return an object that supports StringResourceWithStorage, give it a storage location later. xRet = Reference< resource::XStringResourcePersistence >( - mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.resource.StringResourceWithStorage", mxContext), + mxContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.resource.StringResourceWithStorage"_ustr, mxContext), UNO_QUERY ); return xRet; } @@ -440,12 +440,12 @@ void SfxDialogLibraryContainer::onNewRootStorage() try { xLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READWRITE ); if ( !xLibrariesStor.is() ) - throw uno::RuntimeException("null returned from openStorageElement",getXWeak()); + throw uno::RuntimeException(u"null returned from openStorageElement"_ustr,getXWeak()); OUString aLibName = pDialogLibrary->getName(); xLibraryStor = xLibrariesStor->openStorageElement( aLibName, embed::ElementModes::READWRITE ); if ( !xLibraryStor.is() ) - throw uno::RuntimeException("null returned from openStorageElement",getXWeak()); + throw uno::RuntimeException(u"null returned from openStorageElement"_ustr,getXWeak()); Reference< resource::XStringResourceWithStorage > xStringResourceWithStorage( xStringResourcePersistence, UNO_QUERY ); diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 228220182811..02c2e78e3f16 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -143,7 +143,7 @@ void NameContainer::replaceByName( const OUString& aName, const Any& aElement ) const Type& aAnyType = aElement.getValueType(); if( mType != aAnyType ) { - throw IllegalArgumentException("types do not match", getXWeak(), 2); + throw IllegalArgumentException(u"types do not match"_ustr, getXWeak(), 2); } NameContainerNameMap::iterator aIt = mHashMap.find( aName ); if( aIt == mHashMap.end() ) @@ -196,7 +196,7 @@ void NameContainer::insertNoCheck(const OUString& aName, const Any& aElement) const Type& aAnyType = aElement.getValueType(); if( mType != aAnyType ) { - throw IllegalArgumentException("types do not match", getXWeak(), 2); + throw IllegalArgumentException(u"types do not match"_ustr, getXWeak(), 2); } sal_Int32 nCount = mNames.size(); @@ -293,7 +293,7 @@ void SAL_CALL NameContainer::addContainerListener( const Reference< XContainerLi { if( !xListener.is() ) { - throw RuntimeException("addContainerListener called with null xListener",getXWeak()); + throw RuntimeException(u"addContainerListener called with null xListener"_ustr,getXWeak()); } std::unique_lock aGuard(m_aMutex); maContainerListeners.addInterface( aGuard, xListener ); @@ -303,7 +303,7 @@ void SAL_CALL NameContainer::removeContainerListener( const Reference< XContaine { if( !xListener.is() ) { - throw RuntimeException("removeContainerListener called with null xListener",getXWeak()); + throw RuntimeException(u"removeContainerListener called with null xListener"_ustr,getXWeak()); } std::unique_lock aGuard(m_aMutex); maContainerListeners.removeInterface( aGuard, xListener ); @@ -314,7 +314,7 @@ void SAL_CALL NameContainer::addChangesListener( const Reference< XChangesListen { if( !xListener.is() ) { - throw RuntimeException("addChangesListener called with null xListener",getXWeak()); + throw RuntimeException(u"addChangesListener called with null xListener"_ustr,getXWeak()); } std::unique_lock aGuard(m_aMutex); maChangesListeners.addInterface( aGuard, xListener ); @@ -324,7 +324,7 @@ void SAL_CALL NameContainer::removeChangesListener( const Reference< XChangesLis { if( !xListener.is() ) { - throw RuntimeException("removeChangesListener called with null xListener",getXWeak()); + throw RuntimeException(u"removeChangesListener called with null xListener"_ustr,getXWeak()); } std::unique_lock aGuard(m_aMutex); maChangesListeners.removeInterface( aGuard, xListener ); @@ -431,7 +431,7 @@ void SAL_CALL SfxLibraryContainer::setRootStorage( const Reference< XStorage >& LibraryContainerMethodGuard aGuard( *this ); if ( !_rxRootStorage.is() ) { - throw IllegalArgumentException("no root storage", getXWeak(), 1); + throw IllegalArgumentException(u"no root storage"_ustr, getXWeak(), 1); } mxStorage = _rxRootStorage; onNewRootStorage(); @@ -442,7 +442,7 @@ void SAL_CALL SfxLibraryContainer::storeLibrariesToStorage( const Reference< XSt LibraryContainerMethodGuard aGuard( *this ); if ( !_rxRootStorage.is() ) { - throw IllegalArgumentException("no root storage", getXWeak(), 1); + throw IllegalArgumentException(u"no root storage"_ustr, getXWeak(), 1); } try { @@ -993,7 +993,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL, return; INetURLObject aUserBasicInetObj( o3tl::getToken(maLibraryPath, 1, ';') ); - OUString aStandardStr("Standard"); + OUString aStandardStr(u"Standard"_ustr); INetURLObject aPrevUserBasicInetObj_1( aUserBasicInetObj ); aPrevUserBasicInetObj_1.removeSegment(); @@ -1019,7 +1019,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL, OUString aPrevStandardFolder = aPrevUserBasicStandardInetObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ); if( mxSFI->isFolder( aPrevStandardFolder ) ) { - OUString aXlbExtension( "xlb" ); + OUString aXlbExtension( u"xlb"_ustr ); OUString aCheckFileName; // Check if script.xlb exists @@ -1425,10 +1425,10 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib, if ( xProps.is() ) { - xProps->setPropertyValue("MediaType", uno::Any( OUString( "text/xml" ) ) ); + xProps->setPropertyValue(u"MediaType"_ustr, uno::Any( u"text/xml"_ustr ) ); // #87671 Allow encryption - xProps->setPropertyValue("UseCommonStoragePasswordEncryption", uno::Any( true ) ); + xProps->setPropertyValue(u"UseCommonStoragePasswordEncryption"_ustr, uno::Any( true ) ); Reference< XOutputStream > xOutput = xElementStream->getOutputStream(); Reference< XNameContainer > xLib( pLib ); @@ -1562,10 +1562,10 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib, if ( xProps.is() ) { - xProps->setPropertyValue("MediaType", uno::Any( OUString("text/xml") ) ); + xProps->setPropertyValue(u"MediaType"_ustr, uno::Any( u"text/xml"_ustr ) ); // #87671 Allow encryption - xProps->setPropertyValue("UseCommonStoragePasswordEncryption", uno::Any( true ) ); + xProps->setPropertyValue(u"UseCommonStoragePasswordEncryption"_ustr, uno::Any( true ) ); xOut = xInfoStream->getOutputStream(); } @@ -2066,10 +2066,10 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto { xInfoStream = xTargetLibrariesStor->openStreamElement( aStreamName, embed::ElementModes::READWRITE ); uno::Reference< beans::XPropertySet > xProps( xInfoStream, uno::UNO_QUERY_THROW ); - xProps->setPropertyValue("MediaType", uno::Any( OUString( "text/xml" ) ) ); + xProps->setPropertyValue(u"MediaType"_ustr, uno::Any( u"text/xml"_ustr ) ); // #87671 Allow encryption - xProps->setPropertyValue("UseCommonStoragePasswordEncryption", uno::Any( true ) ); + xProps->setPropertyValue(u"UseCommonStoragePasswordEncryption"_ustr, uno::Any( true ) ); xOut = xInfoStream->getOutputStream(); } @@ -2237,7 +2237,7 @@ void SAL_CALL SfxLibraryContainer::removeLibrary( const OUString& Name ) SfxLibrary* pImplLib = static_cast< SfxLibrary* >( xNameAccess.get() ); if( pImplLib->mbReadOnly && !pImplLib->mbLink ) { - throw IllegalArgumentException("readonly && !link", getXWeak(), 1); + throw IllegalArgumentException(u"readonly && !link"_ustr, getXWeak(), 1); } // Remove from container maNameContainer->removeByName( Name ); @@ -2343,7 +2343,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name ) " storage!")); if ( !xLibrariesStor.is() ) { - throw uno::RuntimeException("null returned from openStorageElement",getXWeak()); + throw uno::RuntimeException(u"null returned from openStorageElement"_ustr,getXWeak()); } xLibraryStor = xLibrariesStor->openStorageElement( Name, embed::ElementModes::READ ); @@ -2353,7 +2353,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name ) " storage!")); if ( !xLibrariesStor.is() ) { - throw uno::RuntimeException("null returned from openStorageElement",getXWeak()); + throw uno::RuntimeException(u"null returned from openStorageElement"_ustr,getXWeak()); } #if OSL_DEBUG_LEVEL > 0 } @@ -2412,7 +2412,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name ) "basic", "couldn't open library element stream - attempted to" " open library \"" << Name << '"'); - throw RuntimeException("couldn't open library element stream", *this); + throw RuntimeException(u"couldn't open library element stream"_ustr, *this); } } else @@ -2460,7 +2460,7 @@ OUString SAL_CALL SfxLibraryContainer::getLibraryLinkURL( const OUString& Name ) bool bLink = pImplLib->mbLink; if( !bLink ) { - throw IllegalArgumentException("!link", getXWeak(), 1); + throw IllegalArgumentException(u"!link"_ustr, getXWeak(), 1); } OUString aRetStr = pImplLib->maLibInfoFileURL; return aRetStr; @@ -2638,7 +2638,7 @@ void SAL_CALL SfxLibraryContainer::initialize( const Sequence< Any >& _rArgument LibraryContainerMethodGuard aGuard( *this ); sal_Int32 nArgCount = _rArguments.getLength(); if ( nArgCount != 1 ) - throw IllegalArgumentException("too many args", getXWeak(), -1); + throw IllegalArgumentException(u"too many args"_ustr, getXWeak(), -1); OUString sInitialDocumentURL; Reference< XStorageBasedDocument > xDocument; @@ -2653,7 +2653,7 @@ void SAL_CALL SfxLibraryContainer::initialize( const Sequence< Any >& _rArgument initializeFromDocument( xDocument ); return; } - throw IllegalArgumentException("arg1 unknown type", getXWeak(), 1); + throw IllegalArgumentException(u"arg1 unknown type"_ustr, getXWeak(), 1); } @@ -2664,7 +2664,7 @@ void SfxLibraryContainer::initializeFromDocument( const Reference< XStorageBased try { Reference< XServiceInfo > xSI( _rxDocument, UNO_QUERY_THROW ); - if ( xSI->supportsService("com.sun.star.document.OfficeDocument")) + if ( xSI->supportsService(u"com.sun.star.document.OfficeDocument"_ustr)) { xDocStorage.set( _rxDocument->getDocumentStorage(), UNO_SET_THROW ); } @@ -2678,7 +2678,7 @@ void SfxLibraryContainer::initializeFromDocument( const Reference< XStorageBased if ( !xDocStorage.is() ) { - throw IllegalArgumentException("no doc storage", getXWeak(), 1); + throw IllegalArgumentException(u"no doc storage"_ustr, getXWeak(), 1); } init( OUString(), xDocStorage ); } @@ -2804,7 +2804,7 @@ OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString bool bLink = pImplLib->mbLink; if( !bLink ) { - throw IllegalArgumentException("!link", getXWeak(), 1); + throw IllegalArgumentException(u"!link"_ustr, getXWeak(), 1); } OUString aRetStr = pImplLib->maOriginalStorageURL; return aRetStr; @@ -2848,7 +2848,7 @@ void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( sal_Bool _vbacompatm { Reference< XModel > xModel( mxOwnerDocument ); // weak-ref -> ref Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW ); - xFactory->createInstance("ooo.vba.VBAGlobals"); + xFactory->createInstance(u"ooo.vba.VBAGlobals"_ustr); } catch(const Exception& ) { @@ -3075,7 +3075,7 @@ void SfxLibrary::impl_checkReadOnly() if( mbReadOnly || (mbLink && mbReadOnlyLink) ) { throw IllegalArgumentException( - "Library is readonly.", + u"Library is readonly."_ustr, // TODO: resource *this, 0 ); @@ -3377,7 +3377,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextUserScript try { Reference< XExtensionManager > xManager = ExtensionManager::get( m_xContext ); - m_aUserPackagesSeq = xManager->getDeployedExtensions("user", + m_aUserPackagesSeq = xManager->getDeployedExtensions(u"user"_ustr, Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); } @@ -3429,7 +3429,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri try { Reference< XExtensionManager > xSharedManager = ExtensionManager::get( m_xContext ); - m_aSharedPackagesSeq = xSharedManager->getDeployedExtensions("shared", + m_aSharedPackagesSeq = xSharedManager->getDeployedExtensions(u"shared"_ustr, Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); } @@ -3480,7 +3480,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScr try { Reference< XExtensionManager > xManager = ExtensionManager::get( m_xContext ); - m_aBundledPackagesSeq = xManager->getDeployedExtensions("bundled", + m_aBundledPackagesSeq = xManager->getDeployedExtensions(u"bundled"_ustr, Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); } diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index d078deddece4..07ddb654f815 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -263,7 +263,7 @@ Any SfxScriptLibraryContainer::importLibraryElement { Reference< frame::XModel > xModel( mxOwnerDocument ); // weak-ref -> ref Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW ); - xFactory->createInstance("ooo.vba.VBAGlobals"); + xFactory->createInstance(u"ooo.vba.VBAGlobals"_ustr); } catch(const Exception& ) { @@ -293,7 +293,7 @@ Any SfxScriptLibraryContainer::importLibraryElement { Reference xModel( mxOwnerDocument ); Reference< XMultiServiceFactory> xSF( xModel, UNO_QUERY_THROW ); - mxCodeNameAccess.set( xSF->createInstance("ooo.vba.VBAObjectModuleObjectProvider"), UNO_QUERY ); + mxCodeNameAccess.set( xSF->createInstance(u"ooo.vba.VBAObjectModuleObjectProvider"_ustr), UNO_QUERY ); } catch(const Exception& ) {} @@ -361,7 +361,7 @@ sal_Bool SAL_CALL SfxScriptLibraryContainer::isLibraryPasswordVerified( const OU SfxLibrary* pImplLib = getImplLib( Name ); if( !pImplLib->mbPasswordProtected ) { - throw IllegalArgumentException("!passwordProtected", getXWeak(), 1); + throw IllegalArgumentException(u"!passwordProtected"_ustr, getXWeak(), 1); } bool bRet = pImplLib->mbPasswordVerified; return bRet; @@ -374,7 +374,7 @@ sal_Bool SAL_CALL SfxScriptLibraryContainer::verifyLibraryPassword SfxLibrary* pImplLib = getImplLib( Name ); if( !pImplLib->mbPasswordProtected || pImplLib->mbPasswordVerified ) { - throw IllegalArgumentException("!PasswordProtected || PasswordVerified", getXWeak(), 1); + throw IllegalArgumentException(u"!PasswordProtected || PasswordVerified"_ustr, getXWeak(), 1); } // Test password bool bSuccess = false; @@ -613,7 +613,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons if ( !xCodeStream.is() ) { - throw uno::RuntimeException("null returned from openStreamElement"); + throw uno::RuntimeException(u"null returned from openStreamElement"_ustr); } SvMemoryStream aMemStream; /*sal_Bool bStore = */pMod->StoreBinaryData( aMemStream ); @@ -653,7 +653,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons aSourceStreamName, embed::ElementModes::READWRITE ); uno::Reference< beans::XPropertySet > xProps( xSourceStream, uno::UNO_QUERY_THROW ); - xProps->setPropertyValue("MediaType", uno::Any( OUString( "text/xml" ) ) ); + xProps->setPropertyValue(u"MediaType"_ustr, uno::Any( u"text/xml"_ustr ) ); // Set encryption key setStreamKey( xSourceStream, pLib->maPassword ); @@ -730,14 +730,14 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons embed::ElementModes::READWRITE ); if ( !xElementRootStorage.is() ) { - throw uno::RuntimeException("null returned from GetStorageFromURL"); + throw uno::RuntimeException(u"null returned from GetStorageFromURL"_ustr); } // Write binary image stream SbModule* pMod = pBasicLib->FindModule( aElementName ); if( pMod ) { uno::Reference< io::XStream > xCodeStream = xElementRootStorage->openStreamElement( - "code.bin", + u"code.bin"_ustr, embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE ); SvMemoryStream aMemStream; @@ -758,7 +758,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons } // Write encrypted source stream - OUString aSourceStreamName( "source.xml" ); + OUString aSourceStreamName( u"source.xml"_ustr ); uno::Reference< io::XStream > xSourceStream; try @@ -780,7 +780,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons } uno::Reference< beans::XPropertySet > xProps( xSourceStream, uno::UNO_QUERY_THROW ); - xProps->setPropertyValue("MediaType", uno::Any( OUString( "text/xml" ) ) ); + xProps->setPropertyValue(u"MediaType"_ustr, uno::Any( u"text/xml"_ustr ) ); Reference< XOutputStream > xOut = xSourceStream->getOutputStream(); Reference< XNameContainer > xLib( pLib ); @@ -861,12 +861,12 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary xLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ ); if ( !xLibrariesStor.is() ) { - throw uno::RuntimeException("null returned from openStorageElement"); + throw uno::RuntimeException(u"null returned from openStorageElement"_ustr); } xLibraryStor = xLibrariesStor->openStorageElement( Name, embed::ElementModes::READ ); if ( !xLibraryStor.is() ) { - throw uno::RuntimeException("null returned from openStorageElement"); + throw uno::RuntimeException(u"null returned from openStorageElement"_ustr); } } catch(const uno::Exception& ) @@ -897,7 +897,7 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary embed::ElementModes::READ ); if ( !xCodeStream.is() ) { - throw uno::RuntimeException("null returned from openStreamElement"); + throw uno::RuntimeException(u"null returned from openStreamElement"_ustr); } std::unique_ptr pStream(::utl::UcbStreamHelper::CreateStream( xCodeStream )); if ( !pStream || pStream->GetError() ) @@ -932,7 +932,7 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary pLib->maPassword ); if ( !xSourceStream.is() ) { - throw uno::RuntimeException("null returned from openEncryptedStreamElement"); + throw uno::RuntimeException(u"null returned from openEncryptedStreamElement"_ustr); } // if this point is reached then the password is correct if ( !bVerifyPasswordOnly ) @@ -1008,7 +1008,7 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary try { uno::Reference< io::XStream > xCodeStream = xElementRootStorage->openStreamElement( - "code.bin", + u"code.bin"_ustr, embed::ElementModes::READ ); std::unique_ptr pStream(::utl::UcbStreamHelper::CreateStream( xCodeStream )); @@ -1038,14 +1038,14 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary // Access encrypted source stream try { - OUString aSourceStreamName( "source.xml" ); + OUString aSourceStreamName( u"source.xml"_ustr ); uno::Reference< io::XStream > xSourceStream = xElementRootStorage->openEncryptedStreamElement( aSourceStreamName, embed::ElementModes::READ, pLib->maPassword ); if ( !xSourceStream.is() ) { - throw uno::RuntimeException("null returned from openEncryptedStreamElement"); + throw uno::RuntimeException(u"null returned from openEncryptedStreamElement"_ustr); } if ( !bVerifyPasswordOnly ) {