sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx | 32 sw/qa/core/attr/attr.cxx | 8 sw/qa/core/crsr/crsr.cxx | 32 sw/qa/core/doc/doc.cxx | 80 - sw/qa/core/docnode/docnode.cxx | 14 sw/qa/core/draw/draw.cxx | 8 sw/qa/core/edit/edit.cxx | 2 sw/qa/core/fields/fields.cxx | 134 +-- sw/qa/core/filters-test.cxx | 30 sw/qa/core/frmedt/frmedt.cxx | 28 sw/qa/core/header_footer/HeaderFooterTest.cxx | 629 +++++++-------- sw/qa/core/layout/calcmove.cxx | 2 sw/qa/core/layout/fly.cxx | 2 sw/qa/core/layout/flycnt.cxx | 40 sw/qa/core/layout/frmtool.cxx | 2 sw/qa/core/layout/ftnfrm.cxx | 2 sw/qa/core/layout/layact.cxx | 8 sw/qa/core/layout/layout.cxx | 109 +- sw/qa/core/layout/paintfrm.cxx | 2 sw/qa/core/layout/sortedobjs.cxx | 2 sw/qa/core/layout/tabfrm.cxx | 2 sw/qa/core/layout/trvlfrm.cxx | 2 sw/qa/core/macros-test.cxx | 152 +-- sw/qa/core/objectpositioning/objectpositioning.cxx | 77 + sw/qa/core/test_ToxMiscTest.cxx | 14 sw/qa/core/test_ToxTextGenerator.cxx | 14 sw/qa/core/test_ToxWhitespaceStripper.cxx | 12 sw/qa/core/text/frmform.cxx | 6 sw/qa/core/text/itratr.cxx | 2 sw/qa/core/text/itrform2.cxx | 8 sw/qa/core/text/porlay.cxx | 2 sw/qa/core/text/porrst.cxx | 2 sw/qa/core/text/text.cxx | 339 ++++---- sw/qa/core/text/widorp.cxx | 2 sw/qa/core/theme/ThemeTest.cxx | 10 sw/qa/core/tox/tox.cxx | 94 +- sw/qa/core/txtnode/txtnode.cxx | 26 sw/qa/core/undo/undo.cxx | 19 sw/qa/core/unocore/unocore.cxx | 391 ++++----- sw/qa/core/uwriter.cxx | 160 +-- sw/qa/core/view/view.cxx | 2 sw/source/uibase/utlui/bookctrl.cxx | 4 sw/source/uibase/utlui/content.cxx | 122 +- sw/source/uibase/utlui/glbltree.cxx | 50 - sw/source/uibase/utlui/gloslst.cxx | 6 sw/source/uibase/utlui/navicfg.cxx | 48 - sw/source/uibase/utlui/navipi.cxx | 78 - sw/source/uibase/utlui/numfmtlb.cxx | 4 sw/source/uibase/utlui/tmplctrl.cxx | 4 sw/source/uibase/utlui/uitool.cxx | 18 sw/source/uibase/utlui/unotools.cxx | 16 sw/source/uibase/utlui/viewlayoutctrl.cxx | 2 52 files changed, 1440 insertions(+), 1414 deletions(-)
New commits: commit e7a7df094ebe8c1a1205c64a410df893c3acf652 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Jun 6 09:26:17 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Jun 6 19:14:55 2024 +0200 loplugin:ostr in sw/../utlui Change-Id: I542c3ab519f1b154e606943e867794127ec279c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168488 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/sw/source/uibase/utlui/bookctrl.cxx b/sw/source/uibase/utlui/bookctrl.cxx index e79821022abc..04c16b105f24 100644 --- a/sw/source/uibase/utlui/bookctrl.cxx +++ b/sw/source/uibase/utlui/bookctrl.cxx @@ -79,8 +79,8 @@ void SwBookmarkControl::Command( const CommandEvent& rCEvt ) if (!pViewFrm) return; - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/bookmarkmenu.ui")); - std::unique_ptr<weld::Menu> xPopup(xBuilder->weld_menu("menu")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, u"modules/swriter/ui/bookmarkmenu.ui"_ustr)); + std::unique_ptr<weld::Menu> xPopup(xBuilder->weld_menu(u"menu"_ustr)); IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess(); IDocumentMarkAccess::const_iterator_t ppBookmarkStart = pMarkAccess->getBookmarksBegin(); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 5be9e50e753b..a43b75de6477 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1105,7 +1105,7 @@ SwContentTree::SwContentTree(std::unique_ptr<weld::TreeView> xTreeView, SwNaviga : m_xTreeView(std::move(xTreeView)) , m_aDropTargetHelper(*this) , m_pDialog(pDialog) - , m_sSpace(OUString(" ")) + , m_sSpace(u" "_ustr) , m_aUpdTimer("SwContentTree m_aUpdTimer") , m_aOverlayObjectDelayTimer("SwContentTree m_aOverlayObjectDelayTimer") , m_sInvisible(SwResId(STR_INVISIBLE)) @@ -1600,16 +1600,16 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) m_xTreeView->set_cursor(0); } - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xTreeView.get(), "modules/swriter/ui/navigatorcontextmenu.ui")); - std::unique_ptr<weld::Menu> xPop = xBuilder->weld_menu("navmenu"); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xTreeView.get(), u"modules/swriter/ui/navigatorcontextmenu.ui"_ustr)); + std::unique_ptr<weld::Menu> xPop = xBuilder->weld_menu(u"navmenu"_ustr); bool bOutline(false); - std::unique_ptr<weld::Menu> xSubPop1 = xBuilder->weld_menu("outlinelevel"); - std::unique_ptr<weld::Menu> xSubPop2 = xBuilder->weld_menu("dragmodemenu"); - std::unique_ptr<weld::Menu> xSubPop3 = xBuilder->weld_menu("displaymenu"); - std::unique_ptr<weld::Menu> xSubPopOutlineTracking = xBuilder->weld_menu("outlinetracking"); + std::unique_ptr<weld::Menu> xSubPop1 = xBuilder->weld_menu(u"outlinelevel"_ustr); + std::unique_ptr<weld::Menu> xSubPop2 = xBuilder->weld_menu(u"dragmodemenu"_ustr); + std::unique_ptr<weld::Menu> xSubPop3 = xBuilder->weld_menu(u"displaymenu"_ustr); + std::unique_ptr<weld::Menu> xSubPopOutlineTracking = xBuilder->weld_menu(u"outlinetracking"_ustr); - std::unique_ptr<weld::Menu> xSubPopOutlineContent = xBuilder->weld_menu("outlinecontent"); + std::unique_ptr<weld::Menu> xSubPopOutlineContent = xBuilder->weld_menu(u"outlinecontent"_ustr); xSubPopOutlineContent->append(OUString::number(TOGGLE_OUTLINE_CONTENT_VISIBILITY), SwResId(STR_OUTLINE_CONTENT_VISIBILITY_TOGGLE)); @@ -1753,7 +1753,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) && nContentType != ContentTypeId::POSTIT && nContentType != ContentTypeId::UNKNOWN) { bRemoveSortEntry = false; - xPop->set_active("sort", pType->IsAlphabeticSort()); + xPop->set_active(u"sort"_ustr, pType->IsAlphabeticSort()); } OUString aIdent; @@ -1950,8 +1950,8 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) = static_cast<SwRegionContent*>(pCnt)->GetSectionFormat(); bool bHidden = pSectionFormat->GetSection()->IsHidden(); bRemoveSelectEntry = bHidden || !bVisible; - xPop->set_active("protectsection", bProtected); - xPop->set_active("hidesection", bHidden); + xPop->set_active(u"protectsection"_ustr, bProtected); + xPop->set_active(u"hidesection"_ustr, bHidden); } else bRemoveEditEntry = false; @@ -2015,39 +2015,39 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) } if (bRemoveDeleteChapterEntry) - xPop->remove("deletechapter"); + xPop->remove(u"deletechapter"_ustr); if (bRemoveDeleteTableEntry) - xPop->remove("deletetable"); + xPop->remove(u"deletetable"_ustr); if (bRemoveDeleteFrameEntry) - xPop->remove("deleteframe"); + xPop->remove(u"deleteframe"_ustr); if (bRemoveDeleteImageEntry) - xPop->remove("deleteimage"); + xPop->remove(u"deleteimage"_ustr); if (bRemoveDeleteOLEObjectEntry) - xPop->remove("deleteoleobject"); + xPop->remove(u"deleteoleobject"_ustr); if (bRemoveDeleteBookmarkEntry) - xPop->remove("deletebookmark"); + xPop->remove(u"deletebookmark"_ustr); if (bRemoveDeleteRegionEntry) - xPop->remove("deleteregion"); + xPop->remove(u"deleteregion"_ustr); if (bRemoveDeleteHyperlinkEntry) - xPop->remove("deletehyperlink"); + xPop->remove(u"deletehyperlink"_ustr); if (bRemoveDeleteReferenceEntry) - xPop->remove("deletereference"); + xPop->remove(u"deletereference"_ustr); if (bRemoveDeleteIndexEntry) - xPop->remove("deleteindex"); + xPop->remove(u"deleteindex"_ustr); if (bRemoveDeleteCommentEntry) - xPop->remove("deletecomment"); + xPop->remove(u"deletecomment"_ustr); if (bRemoveDeleteDrawingObjectEntry) - xPop->remove("deletedrawingobject"); + xPop->remove(u"deletedrawingobject"_ustr); if (bRemoveDeleteFieldEntry) - xPop->remove("deletefield"); + xPop->remove(u"deletefield"_ustr); if (bRemoveDeleteAllFootnotesEntry) - xPop->remove("deleteallfootnotes"); + xPop->remove(u"deleteallfootnotes"_ustr); if (bRemoveDeleteAllEndnotesEntry) - xPop->remove("deleteallendnotes"); + xPop->remove(u"deleteallendnotes"_ustr); if (bRemoveDeleteFootnoteEntry) - xPop->remove("deletefootnote"); + xPop->remove(u"deletefootnote"_ustr); if (bRemoveDeleteEndnoteEntry) - xPop->remove("deleteendnote"); + xPop->remove(u"deleteendnote"_ustr); // bRemoveDeleteEntry is used in determining separator 2 bool bRemoveDeleteEntry = @@ -2086,10 +2086,10 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) if (bRemoveToggleExpandEntry && bRemoveSendOutlineEntry) - xPop->remove("separator1"); + xPop->remove(u"separator1"_ustr); if (bRemoveCopyEntry) - xPop->remove("copy"); + xPop->remove(u"copy"_ustr); if (bRemoveGotoEntry && bRemoveCopyEntry && @@ -2101,7 +2101,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) bRemoveReadonlyIndexEntry && bRemoveUnprotectEntry && bRemoveEditEntry) - xPop->remove("separator2"); + xPop->remove(u"separator2"_ustr); if (!bOutline) { @@ -2119,43 +2119,43 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) { xSubPopOutlineContent.reset(); xPop->remove(OUString::number(5)); // outline folding menu - xPop->remove("separator3"); + xPop->remove(u"separator3"_ustr); } if (bRemoveTableTracking) - xPop->remove("tabletracking"); + xPop->remove(u"tabletracking"_ustr); if (bRemoveSectionTracking) - xPop->remove("sectiontracking"); + xPop->remove(u"sectiontracking"_ustr); if (bRemoveFrameTracking) - xPop->remove("frametracking"); + xPop->remove(u"frametracking"_ustr); if (bRemoveImageTracking) - xPop->remove("imagetracking"); + xPop->remove(u"imagetracking"_ustr); if (bRemoveOLEobjectTracking) - xPop->remove("oleobjecttracking"); + xPop->remove(u"oleobjecttracking"_ustr); if (bRemoveBookmarkTracking) - xPop->remove("bookmarktracking"); + xPop->remove(u"bookmarktracking"_ustr); if (bRemoveHyperlinkTracking) - xPop->remove("hyperlinktracking"); + xPop->remove(u"hyperlinktracking"_ustr); if (bRemoveReferenceTracking) - xPop->remove("referencetracking"); + xPop->remove(u"referencetracking"_ustr); if (bRemoveIndexTracking) - xPop->remove("indextracking"); + xPop->remove(u"indextracking"_ustr); if (bRemoveCommentTracking) - xPop->remove("commenttracking"); + xPop->remove(u"commenttracking"_ustr); if (bRemoveDrawingObjectTracking) - xPop->remove("drawingobjecttracking"); + xPop->remove(u"drawingobjecttracking"_ustr); if (bRemoveFieldTracking) - xPop->remove("fieldtracking"); + xPop->remove(u"fieldtracking"_ustr); if (bRemoveFootnoteTracking) - xPop->remove("footnotetracking"); + xPop->remove(u"footnotetracking"_ustr); if (bRemoveEndnoteTracking) - xPop->remove("endnotetracking"); + xPop->remove(u"endnotetracking"_ustr); if (bRemoveSortEntry) - xPop->remove("sort"); + xPop->remove(u"sort"_ustr); if (bRemoveProtectSection) - xPop->remove("protectsection"); + xPop->remove(u"protectsection"_ustr); if (bRemoveHideSection) - xPop->remove("hidesection"); + xPop->remove(u"hidesection"_ustr); bool bSetSensitiveCollapseAllCategories = false; if (!m_bIsRoot && xEntry) @@ -2171,7 +2171,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) bEntry = m_xTreeView->iter_next_sibling(*xEntry); } } - xPop->set_sensitive("collapseallcategories", bSetSensitiveCollapseAllCategories); + xPop->set_sensitive(u"collapseallcategories"_ustr, bSetSensitiveCollapseAllCategories); OUString sCommand = xPop->popup_at_rect(m_xTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))); if (!sCommand.isEmpty()) @@ -3315,7 +3315,7 @@ void SwContentTree::ToggleToRoot() } m_pConfig->SetRootType( m_nRootType ); weld::Toolbar* pBox = GetParentWindow()->m_xContent5ToolBox.get(); - pBox->set_item_active("root", m_bIsRoot); + pBox->set_item_active(u"root"_ustr, m_bIsRoot); } bool SwContentTree::HasContentChanged() @@ -3587,7 +3587,7 @@ void SwContentTree::FindActiveTypeAndRemoveUserData() // If clear is called by TimerUpdate: // Only for root can the validity of the UserData be guaranteed. m_xTreeView->all_foreach([this](weld::TreeIter& rEntry){ - m_xTreeView->set_id(rEntry, ""); + m_xTreeView->set_id(rEntry, u""_ustr); return false; }); } @@ -4793,7 +4793,7 @@ IMPL_LINK(SwContentTree, KeyInputHdl, const KeyEvent&, rEvent, bool) && (pContentType->GetType() == ContentTypeId::FOOTNOTE || pContentType->GetType() == ContentTypeId::ENDNOTE)) { - ExecuteContextMenuAction("deleteallfootnotes"); + ExecuteContextMenuAction(u"deleteallfootnotes"_ustr); } } } @@ -5543,10 +5543,10 @@ void SwContentTree::Select() } } - pNavi->m_xContent6ToolBox->set_item_sensitive("chapterup", bEnable); - pNavi->m_xContent6ToolBox->set_item_sensitive("chapterdown", bEnable); - pNavi->m_xContent6ToolBox->set_item_sensitive("promote", bEnable); - pNavi->m_xContent6ToolBox->set_item_sensitive("demote", bEnable); + pNavi->m_xContent6ToolBox->set_item_sensitive(u"chapterup"_ustr, bEnable); + pNavi->m_xContent6ToolBox->set_item_sensitive(u"chapterdown"_ustr, bEnable); + pNavi->m_xContent6ToolBox->set_item_sensitive(u"promote"_ustr, bEnable); + pNavi->m_xContent6ToolBox->set_item_sensitive(u"demote"_ustr, bEnable); } void SwContentTree::SetRootType(ContentTypeId nType) @@ -5974,10 +5974,10 @@ void SwContentTree::GotoContent(const SwContent* pCnt) if ( !xDecks.is() ) break; - if (!xDecks->hasByName("NavigatorDeck")) + if (!xDecks->hasByName(u"NavigatorDeck"_ustr)) break; - Reference<ui::XDeck> xDeck ( xDecks->getByName("NavigatorDeck"), uno::UNO_QUERY); + Reference<ui::XDeck> xDeck ( xDecks->getByName(u"NavigatorDeck"_ustr), uno::UNO_QUERY); if ( !xDeck.is() ) break; @@ -5985,9 +5985,9 @@ void SwContentTree::GotoContent(const SwContent* pCnt) if ( !xPanels.is() ) break; - if (xPanels->hasByName("SwNavigatorPanel")) + if (xPanels->hasByName(u"SwNavigatorPanel"_ustr)) { - Reference<ui::XPanel> xPanel ( xPanels->getByName("SwNavigatorPanel"), uno::UNO_QUERY); + Reference<ui::XPanel> xPanel ( xPanels->getByName(u"SwNavigatorPanel"_ustr), uno::UNO_QUERY); if ( !xPanel.is() || !xPanel->getTitle().isEmpty() ) break; diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 7d7d0104fc7b..6ae53ad36c6c 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -270,26 +270,26 @@ IMPL_LINK(SwGlobalTree, CommandHdl, const CommandEvent&, rCEvt, bool) bool bPop = false; if (m_pActiveShell && !m_pActiveShell->GetView().GetDocShell()->IsReadOnly()) { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xTreeView.get(), "modules/swriter/ui/mastercontextmenu.ui")); - std::unique_ptr<weld::Menu> xPopup = xBuilder->weld_menu("navmenu"); - std::unique_ptr<weld::Menu> xSubPopup = xBuilder->weld_menu("insertmenu"); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xTreeView.get(), u"modules/swriter/ui/mastercontextmenu.ui"_ustr)); + std::unique_ptr<weld::Menu> xPopup = xBuilder->weld_menu(u"navmenu"_ustr); + std::unique_ptr<weld::Menu> xSubPopup = xBuilder->weld_menu(u"insertmenu"_ustr); const MenuEnableFlags nEnableFlags = GetEnableFlags(); - xPopup->set_sensitive("updatesel", bool(nEnableFlags & MenuEnableFlags::UpdateSel)); + xPopup->set_sensitive(u"updatesel"_ustr, bool(nEnableFlags & MenuEnableFlags::UpdateSel)); - xPopup->set_sensitive("editlink", bool(nEnableFlags & MenuEnableFlags::EditLink)); + xPopup->set_sensitive(u"editlink"_ustr, bool(nEnableFlags & MenuEnableFlags::EditLink)); //disabling if applicable - xSubPopup->set_sensitive("insertindex", bool(nEnableFlags & MenuEnableFlags::InsertIdx )); - xSubPopup->set_sensitive("insertfile", bool(nEnableFlags & MenuEnableFlags::InsertFile)); - xSubPopup->set_sensitive("insertnewfile", bool(nEnableFlags & MenuEnableFlags::InsertFile)); - xSubPopup->set_sensitive("inserttext", bool(nEnableFlags & MenuEnableFlags::InsertText)); + xSubPopup->set_sensitive(u"insertindex"_ustr, bool(nEnableFlags & MenuEnableFlags::InsertIdx )); + xSubPopup->set_sensitive(u"insertfile"_ustr, bool(nEnableFlags & MenuEnableFlags::InsertFile)); + xSubPopup->set_sensitive(u"insertnewfile"_ustr, bool(nEnableFlags & MenuEnableFlags::InsertFile)); + xSubPopup->set_sensitive(u"inserttext"_ustr, bool(nEnableFlags & MenuEnableFlags::InsertText)); - xPopup->set_sensitive("update", bool(nEnableFlags & MenuEnableFlags::Update)); - xPopup->set_sensitive("insert", bool(nEnableFlags & MenuEnableFlags::InsertIdx)); - xPopup->set_sensitive("editcontent", bool(nEnableFlags & MenuEnableFlags::Edit)); - xPopup->set_sensitive("deleteentry", bool(nEnableFlags & MenuEnableFlags::Delete)); + xPopup->set_sensitive(u"update"_ustr, bool(nEnableFlags & MenuEnableFlags::Update)); + xPopup->set_sensitive(u"insert"_ustr, bool(nEnableFlags & MenuEnableFlags::InsertIdx)); + xPopup->set_sensitive(u"editcontent"_ustr, bool(nEnableFlags & MenuEnableFlags::Edit)); + xPopup->set_sensitive(u"deleteentry"_ustr, bool(nEnableFlags & MenuEnableFlags::Delete)); OUString sCommand = xPopup->popup_at_rect(m_xTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))); if (!sCommand.isEmpty()) @@ -305,14 +305,14 @@ void SwGlobalTree::TbxMenuHdl(std::u16string_view rCommand, weld::Menu& rMenu) const MenuEnableFlags nEnableFlags = GetEnableFlags(); if (rCommand == u"insert") { - rMenu.set_sensitive("insertindex", bool(nEnableFlags & MenuEnableFlags::InsertIdx)); - rMenu.set_sensitive("insertfile", bool(nEnableFlags & MenuEnableFlags::InsertFile)); - rMenu.set_sensitive("insertnewfile", bool(nEnableFlags & MenuEnableFlags::InsertFile)); - rMenu.set_sensitive("inserttext", bool(nEnableFlags & MenuEnableFlags::InsertText)); + rMenu.set_sensitive(u"insertindex"_ustr, bool(nEnableFlags & MenuEnableFlags::InsertIdx)); + rMenu.set_sensitive(u"insertfile"_ustr, bool(nEnableFlags & MenuEnableFlags::InsertFile)); + rMenu.set_sensitive(u"insertnewfile"_ustr, bool(nEnableFlags & MenuEnableFlags::InsertFile)); + rMenu.set_sensitive(u"inserttext"_ustr, bool(nEnableFlags & MenuEnableFlags::InsertText)); } else if (rCommand == u"update") { - rMenu.set_sensitive("updatesel", bool(nEnableFlags & MenuEnableFlags::UpdateSel)); + rMenu.set_sensitive(u"updatesel"_ustr, bool(nEnableFlags & MenuEnableFlags::UpdateSel)); } } @@ -383,12 +383,12 @@ void SwGlobalTree::Select() SwNavigationPI* pNavi = GetParentWindow(); bool bReadonly = !m_pActiveShell || m_pActiveShell->GetView().GetDocShell()->IsReadOnly(); - pNavi->m_xGlobalToolBox->set_item_sensitive("edit", nSelCount == 1 && !bReadonly); - pNavi->m_xGlobalToolBox->set_item_sensitive("insert", nSelCount <= 1 && !bReadonly); - pNavi->m_xGlobalToolBox->set_item_sensitive("update", m_xTreeView->n_children() > 0 && !bReadonly); - pNavi->m_xGlobalToolBox->set_item_sensitive("moveup", + pNavi->m_xGlobalToolBox->set_item_sensitive(u"edit"_ustr, nSelCount == 1 && !bReadonly); + pNavi->m_xGlobalToolBox->set_item_sensitive(u"insert"_ustr, nSelCount <= 1 && !bReadonly); + pNavi->m_xGlobalToolBox->set_item_sensitive(u"update"_ustr, m_xTreeView->n_children() > 0 && !bReadonly); + pNavi->m_xGlobalToolBox->set_item_sensitive(u"moveup"_ustr, nSelCount == 1 && nAbsPos && !bReadonly); - pNavi->m_xGlobalToolBox->set_item_sensitive("movedown", + pNavi->m_xGlobalToolBox->set_item_sensitive(u"movedown"_ustr, nSelCount == 1 && nAbsPos < m_xTreeView->n_children() - 1 && !bReadonly); } @@ -520,7 +520,7 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* pCont, const OUString* if ( !pFileName ) { SwNavigationPI* pNavi = GetParentWindow(); - m_pDocInserter.reset(new ::sfx2::DocumentInserter(pNavi->GetFrameWeld(), "swriter", sfx2::DocumentInserter::Mode::InsertMulti)); + m_pDocInserter.reset(new ::sfx2::DocumentInserter(pNavi->GetFrameWeld(), u"swriter"_ustr, sfx2::DocumentInserter::Mode::InsertMulti)); m_pDocInserter->StartExecuteModal( LINK( this, SwGlobalTree, DialogClosedHdl ) ); } else if ( !pFileName->isEmpty() ) @@ -1015,7 +1015,7 @@ void SwGlobalTree::OpenDoc(const SwGlblDocContent* pCont) { SfxStringItem aURL(SID_FILE_NAME, sFileName); SfxBoolItem aReadOnly(SID_DOC_READONLY, false); - SfxStringItem aTargetFrameName( SID_TARGETNAME, "_blank" ); + SfxStringItem aTargetFrameName( SID_TARGETNAME, u"_blank"_ustr ); SfxStringItem aReferer(SID_REFERER, m_pActiveShell->GetView().GetDocShell()->GetTitle()); m_pActiveShell->GetView().GetViewFrame().GetDispatcher()-> ExecuteList(SID_OPENDOC, SfxCallMode::ASYNCHRON, diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx index 9878d0aa6716..08a9c23b431c 100644 --- a/sw/source/uibase/utlui/gloslst.cxx +++ b/sw/source/uibase/utlui/gloslst.cxx @@ -64,9 +64,9 @@ public: } SwGlossDecideDlg::SwGlossDecideDlg(weld::Window* pParent) - : GenericDialogController(pParent, "modules/swriter/ui/selectautotextdialog.ui", "SelectAutoTextDialog") - , m_xOk(m_xBuilder->weld_button("ok")) - , m_xListLB(m_xBuilder->weld_tree_view("treeview")) + : GenericDialogController(pParent, u"modules/swriter/ui/selectautotextdialog.ui"_ustr, u"SelectAutoTextDialog"_ustr) + , m_xOk(m_xBuilder->weld_button(u"ok"_ustr)) + , m_xListLB(m_xBuilder->weld_tree_view(u"treeview"_ustr)) { m_xListLB->set_size_request(m_xListLB->get_approximate_digit_width() * 32, m_xListLB->get_height_rows(8)); diff --git a/sw/source/uibase/utlui/navicfg.cxx b/sw/source/uibase/utlui/navicfg.cxx index 7f913946c34c..a1b90f78e18d 100644 --- a/sw/source/uibase/utlui/navicfg.cxx +++ b/sw/source/uibase/utlui/navicfg.cxx @@ -52,33 +52,33 @@ namespace { Sequence<OUString> SwNavigationConfig::GetPropertyNames() { return css::uno::Sequence<OUString>{ - OUString("RootType"), - OUString("SelectedPosition"), - OUString("OutlineLevel"), - OUString("ActiveBlock"), - OUString("ShowListBox"), - OUString("GlobalDocMode"), - OUString("OutlineTracking"), - OUString("TableTracking"), - OUString("SectionTracking"), - OUString("FrameTracking"), - OUString("ImageTracking"), - OUString("OLEobjectTracking"), - OUString("BookmarkTracking"), - OUString("HyperlinkTracking"), - OUString("ReferenceTracking"), - OUString("IndexTracking"), - OUString("CommentTracking"), - OUString("DrawingObjectTracking"), - OUString("FieldTracking"), - OUString("FootnoteTracking"), - OUString("EndnoteTracking"), - OUString("NavigateOnSelect"), - OUString("SortAlphabeticallyBlock")}; + u"RootType"_ustr, + u"SelectedPosition"_ustr, + u"OutlineLevel"_ustr, + u"ActiveBlock"_ustr, + u"ShowListBox"_ustr, + u"GlobalDocMode"_ustr, + u"OutlineTracking"_ustr, + u"TableTracking"_ustr, + u"SectionTracking"_ustr, + u"FrameTracking"_ustr, + u"ImageTracking"_ustr, + u"OLEobjectTracking"_ustr, + u"BookmarkTracking"_ustr, + u"HyperlinkTracking"_ustr, + u"ReferenceTracking"_ustr, + u"IndexTracking"_ustr, + u"CommentTracking"_ustr, + u"DrawingObjectTracking"_ustr, + u"FieldTracking"_ustr, + u"FootnoteTracking"_ustr, + u"EndnoteTracking"_ustr, + u"NavigateOnSelect"_ustr, + u"SortAlphabeticallyBlock"_ustr}; } SwNavigationConfig::SwNavigationConfig() : - utl::ConfigItem("Office.Writer/Navigator"), + utl::ConfigItem(u"Office.Writer/Navigator"_ustr), m_nRootType(ContentTypeId::UNKNOWN), m_nSelectedPos(0), m_nOutlineLevel(MAXLEVEL), diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index e86e51c30d11..7db3f3d8c2df 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -296,7 +296,7 @@ IMPL_LINK(SwNavigationPI, ToolBoxSelectHdl, const OUString&, rCommand, void) ToggleTree(); bool bGlobalMode = IsGlobalMode(); m_pConfig->SetGlobalActive(bGlobalMode); - m_xGlobalToolBox->set_item_active("globaltoggle", bGlobalMode); + m_xGlobalToolBox->set_item_active(u"globaltoggle"_ustr, bGlobalMode); } else if (rCommand == "save") { @@ -305,11 +305,11 @@ IMPL_LINK(SwNavigationPI, ToolBoxSelectHdl, const OUString&, rCommand, void) m_xGlobalToolBox->set_item_active(rCommand, !bSave); } else if (rCommand == "headings") - m_xContent5ToolBox->set_menu_item_active("headings", !m_xContent5ToolBox->get_menu_item_active("headings")); + m_xContent5ToolBox->set_menu_item_active(u"headings"_ustr, !m_xContent5ToolBox->get_menu_item_active(u"headings"_ustr)); else if (rCommand == "update") - m_xGlobalToolBox->set_menu_item_active("update", !m_xGlobalToolBox->get_menu_item_active("update")); + m_xGlobalToolBox->set_menu_item_active(u"update"_ustr, !m_xGlobalToolBox->get_menu_item_active(u"update"_ustr)); else if (rCommand == "insert") - m_xGlobalToolBox->set_menu_item_active("insert", !m_xGlobalToolBox->get_menu_item_active("insert")); + m_xGlobalToolBox->set_menu_item_active(u"insert"_ustr, !m_xGlobalToolBox->get_menu_item_active(u"insert"_ustr)); if (nFuncId) lcl_UnSelectFrame(&rSh); @@ -373,7 +373,7 @@ void SwNavigationPI::ZoomOut() m_xContentTree->Select(); // Enable toolbox m_pConfig->SetSmall(false); - m_xContent6ToolBox->set_item_active("listbox", true); + m_xContent6ToolBox->set_item_active(u"listbox"_ustr, true); } void SwNavigationPI::ZoomIn() @@ -403,7 +403,7 @@ void SwNavigationPI::ZoomIn() m_xContentTree->Select(); // Enable toolbox m_pConfig->SetSmall(true); - m_xContent6ToolBox->set_item_active("listbox", false); + m_xContent6ToolBox->set_item_active(u"listbox"_ustr, false); } std::unique_ptr<PanelLayout> SwNavigationPI::Create(weld::Widget* pParent, @@ -411,39 +411,39 @@ std::unique_ptr<PanelLayout> SwNavigationPI::Create(weld::Widget* pParent, SfxBindings* pBindings) { if( pParent == nullptr ) - throw css::lang::IllegalArgumentException("no parent window given to SwNavigationPI::Create", nullptr, 0); + throw css::lang::IllegalArgumentException(u"no parent window given to SwNavigationPI::Create"_ustr, nullptr, 0); if( !rxFrame.is() ) - throw css::lang::IllegalArgumentException("no XFrame given to SwNavigationPI::Create", nullptr, 0); + throw css::lang::IllegalArgumentException(u"no XFrame given to SwNavigationPI::Create"_ustr, nullptr, 0); if( pBindings == nullptr ) - throw css::lang::IllegalArgumentException("no SfxBindings given to SwNavigationPI::Create", nullptr, 0); + throw css::lang::IllegalArgumentException(u"no SfxBindings given to SwNavigationPI::Create"_ustr, nullptr, 0); return std::make_unique<SwNavigationPI>(pParent, rxFrame, pBindings, nullptr); } SwNavigationPI::SwNavigationPI(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* _pBindings, SfxNavigator* pNavigatorDlg) - : PanelLayout(pParent, "NavigatorPanel", "modules/swriter/ui/navigatorpanel.ui") + : PanelLayout(pParent, u"NavigatorPanel"_ustr, u"modules/swriter/ui/navigatorpanel.ui"_ustr) , m_aDocFullName(SID_DOCFULLNAME, *_pBindings, *this) , m_aPageStats(FN_STAT_PAGE, *_pBindings, *this) , m_aNavElement(FN_NAV_ELEMENT, *_pBindings, *this) - , m_xContent1ToolBox(m_xBuilder->weld_toolbar("content1")) - , m_xContent2ToolBox(m_xBuilder->weld_toolbar("content2")) - , m_xContent3ToolBox(m_xBuilder->weld_toolbar("content3")) - , m_xContent4ToolBox(m_xBuilder->weld_toolbar("content4")) - , m_xContent5ToolBox(m_xBuilder->weld_toolbar("content5")) - , m_xContent6ToolBox(m_xBuilder->weld_toolbar("content6")) + , m_xContent1ToolBox(m_xBuilder->weld_toolbar(u"content1"_ustr)) + , m_xContent2ToolBox(m_xBuilder->weld_toolbar(u"content2"_ustr)) + , m_xContent3ToolBox(m_xBuilder->weld_toolbar(u"content3"_ustr)) + , m_xContent4ToolBox(m_xBuilder->weld_toolbar(u"content4"_ustr)) + , m_xContent5ToolBox(m_xBuilder->weld_toolbar(u"content5"_ustr)) + , m_xContent6ToolBox(m_xBuilder->weld_toolbar(u"content6"_ustr)) , m_xContent2Dispatch(new ToolbarUnoDispatcher(*m_xContent2ToolBox, *m_xBuilder, rxFrame)) , m_xContent3Dispatch(new ToolbarUnoDispatcher(*m_xContent3ToolBox, *m_xBuilder, rxFrame)) - , m_xHeadingsMenu(m_xBuilder->weld_menu("headingsmenu")) - , m_xUpdateMenu(m_xBuilder->weld_menu("updatemenu")) - , m_xInsertMenu(m_xBuilder->weld_menu("insertmenu")) - , m_xGlobalToolBox(m_xBuilder->weld_toolbar("global")) - , m_xGotoPageSpinButton(m_xBuilder->weld_spin_button("gotopage")) - , m_xContentBox(m_xBuilder->weld_widget("contentbox")) - , m_xContentTree(new SwContentTree(m_xBuilder->weld_tree_view("contenttree"), this)) - , m_xGlobalBox(m_xBuilder->weld_widget("globalbox")) - , m_xGlobalTree(new SwGlobalTree(m_xBuilder->weld_tree_view("globaltree"), this)) - , m_xDocListBox(m_xBuilder->weld_combo_box("documents")) + , m_xHeadingsMenu(m_xBuilder->weld_menu(u"headingsmenu"_ustr)) + , m_xUpdateMenu(m_xBuilder->weld_menu(u"updatemenu"_ustr)) + , m_xInsertMenu(m_xBuilder->weld_menu(u"insertmenu"_ustr)) + , m_xGlobalToolBox(m_xBuilder->weld_toolbar(u"global"_ustr)) + , m_xGotoPageSpinButton(m_xBuilder->weld_spin_button(u"gotopage"_ustr)) + , m_xContentBox(m_xBuilder->weld_widget(u"contentbox"_ustr)) + , m_xContentTree(new SwContentTree(m_xBuilder->weld_tree_view(u"contenttree"_ustr), this)) + , m_xGlobalBox(m_xBuilder->weld_widget(u"globalbox"_ustr)) + , m_xGlobalTree(new SwGlobalTree(m_xBuilder->weld_tree_view(u"globaltree"_ustr), this)) + , m_xDocListBox(m_xBuilder->weld_combo_box(u"documents"_ustr)) , m_xNavigatorDlg(pNavigatorDlg) , m_pContentView(nullptr) , m_pContentWrtShell(nullptr) @@ -457,7 +457,7 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xContainer->connect_container_focus_changed(LINK(this, SwNavigationPI, SetFocusChildHdl)); Reference<XToolbarController> xController = - m_xContent2Dispatch->GetControllerForCommand(".uno:NavElement"); + m_xContent2Dispatch->GetControllerForCommand(u".uno:NavElement"_ustr); NavElementToolBoxControl* pToolBoxControl = dynamic_cast<NavElementToolBoxControl*>(xController.get()); @@ -489,7 +489,7 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, nRootType != ContentTypeId::UNKNOWN) { m_xContentTree->SetRootType(nRootType); - m_xContent5ToolBox->set_item_active("root", true); + m_xContent5ToolBox->set_item_active(u"root"_ustr, true); if (nRootType == ContentTypeId::OUTLINE || nRootType == ContentTypeId::DRAWOBJECT) m_xContentTree->set_selection_mode(SelectionMode::Multiple); else @@ -515,8 +515,8 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, bool bFloatingNavigator = ParentIsFloatingWindow(m_xNavigatorDlg); m_xContentTree->ShowTree(); - m_xContent6ToolBox->set_item_active("listbox", true); - m_xContent6ToolBox->set_item_sensitive("listbox", bFloatingNavigator); + m_xContent6ToolBox->set_item_active(u"listbox"_ustr, true); + m_xContent6ToolBox->set_item_sensitive(u"listbox"_ustr, bFloatingNavigator); // TreeListBox for global document m_xGlobalTree->set_selection_mode(SelectionMode::Multiple); @@ -528,15 +528,15 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xContent6ToolBox->connect_clicked(aLk); m_xGlobalToolBox->connect_clicked(aLk); m_xDocListBox->connect_changed(LINK(this, SwNavigationPI, DocListBoxSelectHdl)); - m_xContent5ToolBox->set_item_menu("headings", m_xHeadingsMenu.get()); + m_xContent5ToolBox->set_item_menu(u"headings"_ustr, m_xHeadingsMenu.get()); m_xHeadingsMenu->connect_activate(LINK(this, SwNavigationPI, HeadingsMenuSelectHdl)); m_xContent5ToolBox->connect_menu_toggled(LINK(this, SwNavigationPI, ToolBox5DropdownClickHdl)); - m_xGlobalToolBox->set_item_menu("update", m_xUpdateMenu.get()); + m_xGlobalToolBox->set_item_menu(u"update"_ustr, m_xUpdateMenu.get()); m_xUpdateMenu->connect_activate(LINK(this, SwNavigationPI, GlobalMenuSelectHdl)); - m_xGlobalToolBox->set_item_menu("insert", m_xInsertMenu.get()); + m_xGlobalToolBox->set_item_menu(u"insert"_ustr, m_xInsertMenu.get()); m_xInsertMenu->connect_activate(LINK(this, SwNavigationPI, GlobalMenuSelectHdl)); m_xGlobalToolBox->connect_menu_toggled(LINK(this, SwNavigationPI, ToolBoxClickHdl)); - m_xGlobalToolBox->set_item_active("globaltoggle", true); + m_xGlobalToolBox->set_item_active(u"globaltoggle"_ustr, true); if (m_pNavigateByComboBox) m_pNavigateByComboBox->connect_changed( LINK(this, SwNavigationPI, NavigateByComboBoxSelectHdl)); @@ -549,7 +549,7 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, { SwView *pActView = GetCreateView(); if (pActView && pActView->GetWrtShellPtr()) - m_xGlobalToolBox->set_item_active("save", + m_xGlobalToolBox->set_item_active(u"save"_ustr, pActView->GetWrtShellPtr()->IsGlblDocSaveLinks()); if (m_pConfig->IsGlobalActive()) ToggleTree(); @@ -569,7 +569,7 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, if(comphelper::LibreOfficeKit::isActive()) { - m_xBuilder->weld_container("gridcontent16")->hide(); + m_xBuilder->weld_container(u"gridcontent16"_ustr)->hide(); m_xDocListBox->hide(); m_xGlobalBox->hide(); m_xGlobalToolBox->hide(); @@ -668,7 +668,7 @@ void SwNavigationPI::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState /*eState*/, m_xContentTree->SetActiveShell(pWrtShell); if (IsGlobalDoc()) { - m_xGlobalToolBox->set_item_active("save", pWrtShell->IsGlblDocSaveLinks()); + m_xGlobalToolBox->set_item_active(u"save"_ustr, pWrtShell->IsGlblDocSaveLinks()); } } else @@ -708,7 +708,7 @@ void SwNavigationPI::UpdateInitShow() // its size, the sidebar can not, and the navigator would just waste // space. Therefore disable this button. bool bParentIsFloatingWindow(ParentIsFloatingWindow(m_xNavigatorDlg)); - m_xContent6ToolBox->set_item_sensitive("listbox", bParentIsFloatingWindow); + m_xContent6ToolBox->set_item_sensitive(u"listbox"_ustr, bParentIsFloatingWindow); // show content if docked if (!bParentIsFloatingWindow && IsZoomedIn()) ZoomOut(); @@ -934,7 +934,7 @@ sal_Int8 SwNavigationPI::ExecuteDrop( const ExecuteDropEvent& rEvt ) m_oObjectShell.reset(); } SfxStringItem aFileItem(SID_FILE_NAME, sFileName ); - SfxStringItem aOptionsItem( SID_OPTIONS, "HRC" ); + SfxStringItem aOptionsItem( SID_OPTIONS, u"HRC"_ustr ); SfxLinkItem aLink( SID_DONELINK, LINK( this, SwNavigationPI, DoneLink ) ); if (SwView* pView = GetActiveView()) diff --git a/sw/source/uibase/utlui/numfmtlb.cxx b/sw/source/uibase/utlui/numfmtlb.cxx index 8a1895f47212..9d42a5bb9efe 100644 --- a/sw/source/uibase/utlui/numfmtlb.cxx +++ b/sw/source/uibase/utlui/numfmtlb.cxx @@ -267,7 +267,7 @@ void SwNumFormatBase::SetFormatType(const SvNumFormatType nFormatType) } else if( nFormatType == SvNumFormatType::TEXT ) { - pFormatter->GetOutputString( "\"ABC\"", nFormat, sValue, &pCol); + pFormatter->GetOutputString( u"\"ABC\""_ustr, nFormat, sValue, &pCol); } if (nFormat != nSysNumFormat && @@ -329,7 +329,7 @@ void SwNumFormatBase::SetDefFormat(const sal_uInt32 nDefaultFormat) if (nType == SvNumFormatType::TEXT) { - pFormatter->GetOutputString("\"ABC\"", nDefaultFormat, sValue, &pCol); + pFormatter->GetOutputString(u"\"ABC\""_ustr, nDefaultFormat, sValue, &pCol); } else { diff --git a/sw/source/uibase/utlui/tmplctrl.cxx b/sw/source/uibase/utlui/tmplctrl.cxx index 2b68905cf41d..a1bd3b824ac7 100644 --- a/sw/source/uibase/utlui/tmplctrl.cxx +++ b/sw/source/uibase/utlui/tmplctrl.cxx @@ -88,8 +88,8 @@ void SwTemplateControl::Command( const CommandEvent& rCEvt ) auto xIter = pPool->CreateIterator(SfxStyleFamily::Page); if (xIter->Count() > 1) { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/pagestylemenu.ui")); - std::unique_ptr<weld::Menu> xPopup(xBuilder->weld_menu("menu")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, u"modules/swriter/ui/pagestylemenu.ui"_ustr)); + std::unique_ptr<weld::Menu> xPopup(xBuilder->weld_menu(u"menu"_ustr)); sal_uInt32 nCount = 0; SfxStyleSheetBase* pStyle = xIter->First(); diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index 9f9a18c61664..12ed53513cf2 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -128,7 +128,7 @@ void ConvertAttrCharToGen(SfxItemSet& rSet, bool bIsPara) // SwDocStyleSheet::GetItemSet when applying attributes from char format assert(SfxItemState::SET != rSet.GetItemState(RES_PARATR_GRABBAG, false)); SfxGrabBagItem aGrabBag(RES_PARATR_GRABBAG); - aGrabBag.GetGrabBag()["DialogUseCharAttr"] <<= true; + aGrabBag.GetGrabBag()[u"DialogUseCharAttr"_ustr] <<= true; // Store initial ranges to allow restoring later uno::Sequence<sal_uInt16> aOrigRanges(rSet.GetRanges().size() * 2 + 1); int i = 0; @@ -138,7 +138,7 @@ void ConvertAttrCharToGen(SfxItemSet& rSet, bool bIsPara) aOrigRanges.getArray()[i++] = rPair.second; } aOrigRanges.getArray()[i++] = 0; - aGrabBag.GetGrabBag()["OrigItemSetRanges"] <<= aOrigRanges; + aGrabBag.GetGrabBag()[u"OrigItemSetRanges"_ustr] <<= aOrigRanges; rSet.MergeRange(RES_PARATR_GRABBAG, RES_PARATR_GRABBAG); rSet.Put(aGrabBag); } @@ -157,7 +157,7 @@ void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet, bool bIs { SfxGrabBagItem aGrabBag(*pGrabBagItem); std::map<OUString, css::uno::Any>& rMap = aGrabBag.GetGrabBag(); - auto aIterator = rMap.find("CharShadingMarker"); + auto aIterator = rMap.find(u"CharShadingMarker"_ustr); if( aIterator != rMap.end() ) { aIterator->second <<= false; @@ -175,7 +175,7 @@ void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet, bool bIs { SfxGrabBagItem aGrabBag(*pGrabBagItem); std::map<OUString, css::uno::Any>& rMap = aGrabBag.GetGrabBag(); - auto aIterator = rMap.find("OrigItemSetRanges"); + auto aIterator = rMap.find(u"OrigItemSetRanges"_ustr); if (aIterator != rMap.end()) { uno::Sequence<sal_uInt16> aOrigRanges; @@ -215,7 +215,7 @@ void ApplyCharBackground(Color const& rBackgroundColor, model::ComplexColor cons { SfxGrabBagItem aGrabBag(*pGrabBagItem); std::map<OUString, css::uno::Any>& rMap = aGrabBag.GetGrabBag(); - auto aIterator = rMap.find("CharShadingMarker"); + auto aIterator = rMap.find(u"CharShadingMarker"_ustr); if (aIterator != rMap.end()) { aIterator->second <<= false; @@ -287,13 +287,13 @@ void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc ) { bool bValue; const auto pGrabBagInner = pGrabBag->GetGrabBag(); - const auto iter = pGrabBagInner.find("BackgroundFullSize"); + const auto iter = pGrabBagInner.find(u"BackgroundFullSize"_ustr); assert(iter != pGrabBagInner.end()); if (iter->second >>= bValue) { rMaster.SetFormatAttr(SfxBoolItem(RES_BACKGROUND_FULL_SIZE, bValue)); } - auto it = pGrabBagInner.find("RtlGutter"); + auto it = pGrabBagInner.find(u"RtlGutter"_ustr); if (it != pGrabBagInner.end() && (it->second >>= bValue)) { rMaster.SetFormatAttr(SfxBoolItem(RES_RTL_GUTTER, bValue)); @@ -626,12 +626,12 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) { oGrabBag.emplace(SID_ATTR_CHAR_GRABBAG); } - oGrabBag->GetGrabBag()["BackgroundFullSize"] <<= + oGrabBag->GetGrabBag()[u"BackgroundFullSize"_ustr] <<= rMaster.GetAttrSet().GetItem<SfxBoolItem>(RES_BACKGROUND_FULL_SIZE)->GetValue(); if (IsOwnFormat(*rMaster.GetDoc())) { - oGrabBag->GetGrabBag()["RtlGutter"] + oGrabBag->GetGrabBag()[u"RtlGutter"_ustr] <<= rMaster.GetAttrSet().GetItem<SfxBoolItem>(RES_RTL_GUTTER)->GetValue(); } diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx index 3105fa9607be..680f4f22c61e 100644 --- a/sw/source/uibase/utlui/unotools.cxx +++ b/sw/source/uibase/utlui/unotools.cxx @@ -182,14 +182,14 @@ void SwOneExampleFrame::CreateControl() uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(::comphelper::getProcessComponentContext()); uno::Sequence<beans::PropertyValue> args( comphelper::InitPropertySequence({ - { "DocumentService", uno::Any(OUString("com.sun.star.text.TextDocument")) }, - { "OpenFlags", uno::Any(OUString("-RB")) }, - { "Referer", uno::Any(OUString("private:user")) }, + { "DocumentService", uno::Any(u"com.sun.star.text.TextDocument"_ustr) }, + { "OpenFlags", uno::Any(u"-RB"_ustr) }, + { "Referer", uno::Any(u"private:user"_ustr) }, { "ReadOnly", uno::Any(true) }, { "Hidden", uno::Any(true) } })); - m_xModel.set(xDesktop->loadComponentFromURL(sTempURL, "_blank", 0, args), uno::UNO_QUERY); + m_xModel.set(xDesktop->loadComponentFromURL(sTempURL, u"_blank"_ustr, 0, args), uno::UNO_QUERY); m_aLoadedIdle.Start(); } @@ -222,7 +222,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer, void ) try { uno::Reference< frame::XLayoutManager > xLayoutManager; - uno::Any aValue = xPropSet->getPropertyValue("LayoutManager"); + uno::Any aValue = xPropSet->getPropertyValue(u"LayoutManager"_ustr); aValue >>= xLayoutManager; if ( xLayoutManager.is() ) xLayoutManager->setVisible( false ); @@ -368,7 +368,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer, void ) uno::Reference< style::XStyleFamiliesSupplier > xSSupp( xDoc, uno::UNO_QUERY); uno::Reference< container::XNameAccess > xStyles = xSSupp->getStyleFamilies(); - uno::Any aPFamily = xStyles->getByName( "PageStyles" ); + uno::Any aPFamily = xStyles->getByName( u"PageStyles"_ustr ); uno::Reference< container::XNameContainer > xPFamily; if( EX_SHOW_DEFAULT_PAGE != m_nStyleFlags @@ -450,8 +450,8 @@ bool SwOneExampleFrame::CreatePopup(const Point& rPt) if (EX_SHOW_ONLINE_LAYOUT != m_nStyleFlags) return false; - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/previewmenu.ui")); - std::unique_ptr<weld::Menu> xPop(xBuilder->weld_menu("previewmenu")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, u"modules/swriter/ui/previewmenu.ui"_ustr)); + std::unique_ptr<weld::Menu> xPop(xBuilder->weld_menu(u"previewmenu"_ustr)); uno::Reference< view::XViewSettingsSupplier > xSettings(m_xController, uno::UNO_QUERY); uno::Reference< beans::XPropertySet > xViewProps = xSettings->getViewSettings(); diff --git a/sw/source/uibase/utlui/viewlayoutctrl.cxx b/sw/source/uibase/utlui/viewlayoutctrl.cxx index 89dcc30175c2..0d04fc432d43 100644 --- a/sw/source/uibase/utlui/viewlayoutctrl.cxx +++ b/sw/source/uibase/utlui/viewlayoutctrl.cxx @@ -172,7 +172,7 @@ bool SwViewLayoutControl::MouseButtonDown( const MouseEvent & rEvt ) css::uno::Any a; aViewLayout.QueryValue( a ); - css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue("ViewLayout", + css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue(u"ViewLayout"_ustr, a) }; execute( aArgs ); } commit 9aac754d39e9018ff70185956f488402ecac064c Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Jun 6 09:25:23 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Jun 6 19:14:44 2024 +0200 loplugin:ostr in sw/qa/core Change-Id: Iaafc85d9b9042769f30c5662dbc9bf8c0e415312 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168487 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx index bfe2e08d8543..8c3845332310 100644 --- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx +++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx @@ -22,7 +22,7 @@ class AccessibilityCheckTest : public SwModelTestBase { public: AccessibilityCheckTest() - : SwModelTestBase("/sw/qa/core/accessibilitycheck/data/") + : SwModelTestBase(u"/sw/qa/core/accessibilitycheck/data/"_ustr) { } }; @@ -325,10 +325,9 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testOnlineNodeSplitAppend) pWrtShell->SplitNode(); // Check the result - CPPUNIT_ASSERT_EQUAL(OUString("He heard quiet steps behind him. "), - getParagraph(1)->getString()); - CPPUNIT_ASSERT_EQUAL(OUString("That didn't bode well. Who could be following him this late at " - "night and in this deadbeat part of town?"), + CPPUNIT_ASSERT_EQUAL(u"He heard quiet steps behind him. "_ustr, getParagraph(1)->getString()); + CPPUNIT_ASSERT_EQUAL(u"That didn't bode well. Who could be following him this late at " + "night and in this deadbeat part of town?"_ustr, getParagraph(2)->getString()); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), pDoc->getOnlineAccessibilityCheck()->getNumberOfAccessibilityIssues()); @@ -346,12 +345,10 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testOnlineNodeSplitAppend) pWrtShell->SplitNode(); // Check the result - CPPUNIT_ASSERT_EQUAL(OUString("He heard quiet steps behind him. "), - getParagraph(1)->getString()); - CPPUNIT_ASSERT_EQUAL(OUString("That didn't bode well. "), getParagraph(2)->getString()); + CPPUNIT_ASSERT_EQUAL(u"He heard quiet steps behind him. "_ustr, getParagraph(1)->getString()); + CPPUNIT_ASSERT_EQUAL(u"That didn't bode well. "_ustr, getParagraph(2)->getString()); CPPUNIT_ASSERT_EQUAL( - OUString( - "Who could be following him this late at night and in this deadbeat part of town?"), + u"Who could be following him this late at night and in this deadbeat part of town?"_ustr, getParagraph(3)->getString()); CPPUNIT_ASSERT_EQUAL(sal_Int32(3), pDoc->getOnlineAccessibilityCheck()->getNumberOfAccessibilityIssues()); @@ -365,11 +362,10 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testOnlineNodeSplitAppend) checkIssuePosition(aIssues[2], __LINE__, 0, 80, SwNodeOffset(11)); // Undo second change - dispatchCommand(mxComponent, ".uno:Undo", {}); - CPPUNIT_ASSERT_EQUAL(OUString("He heard quiet steps behind him. "), - getParagraph(1)->getString()); - CPPUNIT_ASSERT_EQUAL(OUString("That didn't bode well. Who could be following him this late at " - "night and in this deadbeat part of town?"), + dispatchCommand(mxComponent, u".uno:Undo"_ustr, {}); + CPPUNIT_ASSERT_EQUAL(u"He heard quiet steps behind him. "_ustr, getParagraph(1)->getString()); + CPPUNIT_ASSERT_EQUAL(u"That didn't bode well. Who could be following him this late at " + "night and in this deadbeat part of town?"_ustr, getParagraph(2)->getString()); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), pDoc->getOnlineAccessibilityCheck()->getNumberOfAccessibilityIssues()); @@ -381,12 +377,12 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testOnlineNodeSplitAppend) checkIssuePosition(aIssues[1], __LINE__, 0, 103, SwNodeOffset(10)); // Undo first change - dispatchCommand(mxComponent, ".uno:Undo", {}); + dispatchCommand(mxComponent, u".uno:Undo"_ustr, {}); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), pDoc->getOnlineAccessibilityCheck()->getNumberOfAccessibilityIssues()); CPPUNIT_ASSERT_EQUAL( - OUString("He heard quiet steps behind him. That didn't bode well. Who could be following " - "him this late at night and in this deadbeat part of town?"), + u"He heard quiet steps behind him. That didn't bode well. Who could be following " + "him this late at night and in this deadbeat part of town?"_ustr, getParagraph(1)->getString()); aIssues = scanAccessibilityIssuesOnNodes(pDoc); CPPUNIT_ASSERT_EQUAL(size_t(2), aIssues.size()); diff --git a/sw/qa/core/attr/attr.cxx b/sw/qa/core/attr/attr.cxx index a83a3228dd1d..a1d35941d00b 100644 --- a/sw/qa/core/attr/attr.cxx +++ b/sw/qa/core/attr/attr.cxx @@ -24,7 +24,7 @@ class Test : public SwModelTestBase { public: Test() - : SwModelTestBase("/sw/qa/core/attr/data/") + : SwModelTestBase(u"/sw/qa/core/attr/data/"_ustr) { } }; @@ -36,9 +36,9 @@ CPPUNIT_TEST_FIXTURE(Test, testSwAttrSet) SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); - dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Cut", {}); - dispatchCommand(mxComponent, ".uno:SelectAll", {}); + dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); + dispatchCommand(mxComponent, u".uno:Cut"_ustr, {}); + dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); rtl::Reference<SwTransferable> xTransferable(new SwTransferable(*pWrtShell)); SwModule* pMod = SW_MOD(); SwTransferable* pOldTransferable = pMod->m_pXSelection; diff --git a/sw/qa/core/crsr/crsr.cxx b/sw/qa/core/crsr/crsr.cxx index 72d271638d09..2fa7439626d2 100644 --- a/sw/qa/core/crsr/crsr.cxx +++ b/sw/qa/core/crsr/crsr.cxx @@ -31,7 +31,7 @@ class SwCoreCrsrTest : public SwModelTestBase { public: SwCoreCrsrTest() - : SwModelTestBase("/sw/qa/core/crsr/data/") + : SwModelTestBase(u"/sw/qa/core/crsr/data/"_ustr) { } }; @@ -45,7 +45,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testFindReplace) uno::Reference<text::XText> xText = xTextDocument->getText(); // Create a document which has 2 lines: first line has foo in it, second line has the same, but // followed by a formatted soft hyphen. - xText->insertString(xText->getEnd(), "foo xxx", /*bAbsorb=*/false); + xText->insertString(xText->getEnd(), u"foo xxx"_ustr, /*bAbsorb=*/false); xText->insertControlCharacter(xText->getEnd(), text::ControlCharacter::PARAGRAPH_BREAK, /*bAbsorb=*/false); xText->insertString(xText->getEnd(), u"foo xxx \xad after"_ustr, /*bAbsorb=*/false); @@ -57,21 +57,21 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testFindReplace) xViewCursor->goLeft(/*nCount=*/6, /*bExpand=*/false); xViewCursor->goLeft(/*nCount=*/1, /*bExpand=*/true); uno::Reference<beans::XPropertySet> xViewCursorProps(xViewCursor, uno::UNO_QUERY); - xViewCursorProps->setPropertyValue("CharWeight", uno::Any(awt::FontWeight::BOLD)); + xViewCursorProps->setPropertyValue(u"CharWeight"_ustr, uno::Any(awt::FontWeight::BOLD)); xViewCursor->gotoStart(/*bExpand=*/false); // When: doing search & replace 3 times. uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence({ - { "SearchItem.SearchString", uno::Any(OUString("foo")) }, - { "SearchItem.ReplaceString", uno::Any(OUString("bar")) }, + { "SearchItem.SearchString", uno::Any(u"foo"_ustr) }, + { "SearchItem.ReplaceString", uno::Any(u"bar"_ustr) }, { "SearchItem.Command", uno::Any(static_cast<sal_Int16>(SvxSearchCmd::REPLACE)) }, })); // Find the first foo. - dispatchCommand(mxComponent, ".uno:ExecuteSearch", aArgs); + dispatchCommand(mxComponent, u".uno:ExecuteSearch"_ustr, aArgs); // Replace the first foo. - dispatchCommand(mxComponent, ".uno:ExecuteSearch", aArgs); + dispatchCommand(mxComponent, u".uno:ExecuteSearch"_ustr, aArgs); // Replace the second foo. - dispatchCommand(mxComponent, ".uno:ExecuteSearch", aArgs); + dispatchCommand(mxComponent, u".uno:ExecuteSearch"_ustr, aArgs); // Then: the second "foo" should be replaced as well. xViewCursor->gotoEnd(/*bExpand=*/false); @@ -84,7 +84,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testFindReplace) // - Expected: bar // - Actual : foo // i.e. the foo on the second line was not replaced. - CPPUNIT_ASSERT_EQUAL(OUString("bar"), aActualStart); + CPPUNIT_ASSERT_EQUAL(u"bar"_ustr, aActualStart); } CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testSelAllStartsWithTable) @@ -118,11 +118,11 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlLineBreak) uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); - xText->insertString(xCursor, "test", /*bAbsorb=*/false); + xText->insertString(xCursor, u"test"_ustr, /*bAbsorb=*/false); xCursor->gotoStart(/*bExpand=*/false); xCursor->gotoEnd(/*bExpand=*/true); uno::Reference<text::XTextContent> xContentControl( - xMSF->createInstance("com.sun.star.text.ContentControl"), uno::UNO_QUERY); + xMSF->createInstance(u"com.sun.star.text.ContentControl"_ustr), uno::UNO_QUERY); xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When pressing "enter" in the middle of that content control: @@ -130,7 +130,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlLineBreak) pWrtShell->SttEndDoc(/*bStt=*/true); // Go after "t". pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 2, /*bBasicCall=*/false); - dispatchCommand(mxComponent, ".uno:InsertPara", {}); + dispatchCommand(mxComponent, u".uno:InsertPara"_ustr, {}); // Then make sure that we only insert a line break, not a new paragraph: SwTextNode* pTextNode = pWrtShell->GetCursor()->GetMark()->GetNode().GetTextNode(); @@ -138,7 +138,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlLineBreak) // - Expected: t est // - Actual : est // i.e. a new paragraph was inserted, which is not allowed for inline content controls. - CPPUNIT_ASSERT_EQUAL(OUString("t est"), pTextNode->GetExpandText(pWrtShell->GetLayout())); + CPPUNIT_ASSERT_EQUAL(u"t est"_ustr, pTextNode->GetExpandText(pWrtShell->GetLayout())); } CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlReadOnly) @@ -154,9 +154,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testContentControlReadOnly) xCursor->gotoStart(/*bExpand=*/false); xCursor->gotoEnd(/*bExpand=*/true); uno::Reference<text::XTextContent> xContentControl( - xMSF->createInstance("com.sun.star.text.ContentControl"), uno::UNO_QUERY); + xMSF->createInstance(u"com.sun.star.text.ContentControl"_ustr), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xContentControlProps(xContentControl, uno::UNO_QUERY); - xContentControlProps->setPropertyValue("Checkbox", uno::Any(true)); + xContentControlProps->setPropertyValue(u"Checkbox"_ustr, uno::Any(true)); xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When entering the content control: @@ -187,7 +187,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testTdf135451) // - Expected: a // - Actual : CHAR_NNBSP // i.e., the cursor did not move over the narrow no-break space (CHAR_NNBSP) - CPPUNIT_ASSERT_EQUAL(OUString("a"), pWrtShell->GetSelText()); + CPPUNIT_ASSERT_EQUAL(u"a"_ustr, pWrtShell->GetSelText()); } CPPUNIT_TEST_FIXTURE(SwCoreCrsrTest, testDropdownContentControl) diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx index b653a1cc2201..b207f9c0f9bb 100644 --- a/sw/qa/core/doc/doc.cxx +++ b/sw/qa/core/doc/doc.cxx @@ -47,7 +47,7 @@ class SwCoreDocTest : public SwModelTestBase { public: SwCoreDocTest() - : SwModelTestBase("/sw/qa/core/doc/data/") + : SwModelTestBase(u"/sw/qa/core/doc/data/"_ustr) { } }; @@ -112,7 +112,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testNumDownIndent) // - Expected: B // - Actual : B // i.e. pressing <tab> at the start of the paragraph did not change the layout. - CPPUNIT_ASSERT_EQUAL(OUString(" B"), pTextNode->GetText()); + CPPUNIT_ASSERT_EQUAL(u" B"_ustr, pTextNode->GetText()); ErrorRegistry::Reset(); } @@ -136,7 +136,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testBulletsOnSpaceOff) rEditWin.KeyInput(aKeyEvent3); SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); - CPPUNIT_ASSERT_EQUAL(OUString("- a"), pTextNode->GetText()); + CPPUNIT_ASSERT_EQUAL(u"- a"_ustr, pTextNode->GetText()); ErrorRegistry::Reset(); } @@ -161,7 +161,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testBulletsOnSpace) SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); // '- ' was converted into bullet - CPPUNIT_ASSERT_EQUAL(OUString("a"), pTextNode->GetText()); + CPPUNIT_ASSERT_EQUAL(u"a"_ustr, pTextNode->GetText()); ErrorRegistry::Reset(); } @@ -195,7 +195,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextBoxZOrder) const sw::SpzFrameFormat* pEllipse = rFormats[2]; const SdrObject* pEllipseShape = pEllipse->FindRealSdrObject(); // Make sure we test the right shape. - CPPUNIT_ASSERT_EQUAL(OUString("Shape3"), pEllipseShape->GetName()); + CPPUNIT_ASSERT_EQUAL(u"Shape3"_ustr, pEllipseShape->GetName()); // Without the accompanying fix in place, this test would have failed with: // - Expected: 2 // - Actual : 1 @@ -216,8 +216,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextBoxMakeFlyFrame) rtl::Reference<SwTransferable> pTransfer = new SwTransferable(*pWrtShell); pTransfer->Cut(); TransferableDataHelper aHelper(pTransfer); - uno::Reference<lang::XComponent> xDoc2 - = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument", {}); + uno::Reference<lang::XComponent> xDoc2 = loadFromDesktop( + u"private:factory/swriter"_ustr, u"com.sun.star.text.TextDocument"_ustr, {}); SwXTextDocument* pTextDoc2 = dynamic_cast<SwXTextDocument*>(xDoc2.get()); SwDocShell* pDocShell2 = pTextDoc2->GetDocShell(); SwWrtShell* pWrtShell2 = pDocShell2->GetWrtShell(); @@ -247,15 +247,15 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testIMEGrouping) // When pressing two keys via IME: SwDocShell* pDocShell = pDoc->GetDocShell(); SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); - rEditWin.PostExtTextInputEvent(VclEventId::ExtTextInput, "a"); - rEditWin.PostExtTextInputEvent(VclEventId::EndExtTextInput, ""); - rEditWin.PostExtTextInputEvent(VclEventId::ExtTextInput, "b"); - rEditWin.PostExtTextInputEvent(VclEventId::EndExtTextInput, ""); + rEditWin.PostExtTextInputEvent(VclEventId::ExtTextInput, u"a"_ustr); + rEditWin.PostExtTextInputEvent(VclEventId::EndExtTextInput, u""_ustr); + rEditWin.PostExtTextInputEvent(VclEventId::ExtTextInput, u"b"_ustr); + rEditWin.PostExtTextInputEvent(VclEventId::EndExtTextInput, u""_ustr); // Then make sure that gets grouped together to a single undo action: SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode(); - CPPUNIT_ASSERT_EQUAL(OUString("ab"), pTextNode->GetText()); + CPPUNIT_ASSERT_EQUAL(u"ab"_ustr, pTextNode->GetText()); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 // - Actual : 2 @@ -273,17 +273,17 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testImageHyperlinkStyle) uno::Reference<text::XText> xText = xDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); uno::Reference<text::XTextContent> xImage( - xFactory->createInstance("com.sun.star.text.TextGraphicObject"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.text.TextGraphicObject"_ustr), uno::UNO_QUERY); xText->insertTextContent(xCursor, xImage, /*bAbsorb=*/false); uno::Reference<beans::XPropertySet> xImageProps(xImage, uno::UNO_QUERY); - OUString aExpected = "http://www.example.com"; - xImageProps->setPropertyValue("HyperLinkURL", uno::Any(aExpected)); + OUString aExpected = u"http://www.example.com"_ustr; + xImageProps->setPropertyValue(u"HyperLinkURL"_ustr, uno::Any(aExpected)); // When applying a frame style on it: - xImageProps->setPropertyValue("FrameStyleName", uno::Any(OUString("Frame"))); + xImageProps->setPropertyValue(u"FrameStyleName"_ustr, uno::Any(u"Frame"_ustr)); // Then make sure that the hyperlink is not lost: - auto aActual = getProperty<OUString>(xImageProps, "HyperLinkURL"); + auto aActual = getProperty<OUString>(xImageProps, u"HyperLinkURL"_ustr); // Without the accompanying fix in place, this test would have failed with: // - Expected: http://www.example.com // - Actual : @@ -301,11 +301,11 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testContentControlDelete) uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); - xText->insertString(xCursor, "test", /*bAbsorb=*/false); + xText->insertString(xCursor, u"test"_ustr, /*bAbsorb=*/false); xCursor->gotoStart(/*bExpand=*/false); xCursor->gotoEnd(/*bExpand=*/true); uno::Reference<text::XTextContent> xContentControl( - xMSF->createInstance("com.sun.star.text.ContentControl"), uno::UNO_QUERY); + xMSF->createInstance(u"com.sun.star.text.ContentControl"_ustr), uno::UNO_QUERY); xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); // When deleting the dummy character at the end of the content control: @@ -320,7 +320,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testContentControlDelete) // - Expected: ^Atest^A // - Actual : ^Atest // i.e. the end dummy character got deleted, but not the first one, which is inconsistent. - CPPUNIT_ASSERT_EQUAL(OUString("\x0001test\x0001"), pTextNode->GetText()); + CPPUNIT_ASSERT_EQUAL(u"\x0001test\x0001"_ustr, pTextNode->GetText()); } CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testCopyBookmarks) @@ -371,25 +371,25 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testLinkedStyleDelete) createSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xParaStyle( - xFactory->createInstance("com.sun.star.style.ParagraphStyle"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.style.ParagraphStyle"_ustr), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xCharStyle( - xFactory->createInstance("com.sun.star.style.CharacterStyle"), uno::UNO_QUERY); - uno::Reference<container::XNameContainer> xParaStyles(getStyles("ParagraphStyles"), + xFactory->createInstance(u"com.sun.star.style.CharacterStyle"_ustr), uno::UNO_QUERY); + uno::Reference<container::XNameContainer> xParaStyles(getStyles(u"ParagraphStyles"_ustr), uno::UNO_QUERY); - xParaStyles->insertByName("myparastyle", uno::Any(xParaStyle)); - uno::Reference<container::XNameContainer> xCharStyles(getStyles("CharacterStyles"), + xParaStyles->insertByName(u"myparastyle"_ustr, uno::Any(xParaStyle)); + uno::Reference<container::XNameContainer> xCharStyles(getStyles(u"CharacterStyles"_ustr), uno::UNO_QUERY); - xCharStyles->insertByName("mycharstyle", uno::Any(xCharStyle)); - xParaStyle->setPropertyValue("LinkStyle", uno::Any(OUString("mycharstyle"))); - xCharStyle->setPropertyValue("LinkStyle", uno::Any(OUString("myparastyle"))); + xCharStyles->insertByName(u"mycharstyle"_ustr, uno::Any(xCharStyle)); + xParaStyle->setPropertyValue(u"LinkStyle"_ustr, uno::Any(u"mycharstyle"_ustr)); + xCharStyle->setPropertyValue(u"LinkStyle"_ustr, uno::Any(u"myparastyle"_ustr)); // When deleting the paragraph style (and only that): - xParaStyles->removeByName("myparastyle"); + xParaStyles->removeByName(u"myparastyle"_ustr); // Then make sure we don't crash on save: uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aArgs = { - comphelper::makePropertyValue("FilterName", OUString("writer8")), + comphelper::makePropertyValue(u"FilterName"_ustr, u"writer8"_ustr), }; xStorable->storeAsURL(maTempFile.GetURL(), aArgs); } @@ -440,25 +440,25 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testBookmarkDeleteListeners) uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); { - xText->insertString(xCursor, "test", /*bAbsorb=*/false); + xText->insertString(xCursor, u"test"_ustr, /*bAbsorb=*/false); xCursor->gotoStart(/*bExpand=*/false); xCursor->gotoEnd(/*bExpand=*/true); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextContent> xBookmark( - xFactory->createInstance("com.sun.star.text.Bookmark"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.text.Bookmark"_ustr), uno::UNO_QUERY); uno::Reference<container::XNamed> xBookmarkNamed(xBookmark, uno::UNO_QUERY); - xBookmarkNamed->setName("mybookmark"); + xBookmarkNamed->setName(u"mybookmark"_ustr); xText->insertTextContent(xCursor, xBookmark, /*bAbsorb=*/true); } { xCursor->gotoEnd(/*bExpand=*/false); - xText->insertString(xCursor, "test2", /*bAbsorb=*/false); + xText->insertString(xCursor, u"test2"_ustr, /*bAbsorb=*/false); xCursor->goLeft(4, /*bExpand=*/true); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextContent> xBookmark( - xFactory->createInstance("com.sun.star.text.Bookmark"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.text.Bookmark"_ustr), uno::UNO_QUERY); uno::Reference<container::XNamed> xBookmarkNamed(xBookmark, uno::UNO_QUERY); - xBookmarkNamed->setName("mybookmark2"); + xBookmarkNamed->setName(u"mybookmark2"_ustr); xText->insertTextContent(xCursor, xBookmark, /*bAbsorb=*/true); } uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY); @@ -471,7 +471,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testBookmarkDeleteListeners) xController->addSelectionChangeListener(new SelectionChangeListener(xBookmarks)); // Then make sure that deleting a bookmark doesn't crash: - uno::Reference<lang::XComponent> xBookmark(xBookmarks->getByName("mybookmark2"), + uno::Reference<lang::XComponent> xBookmark(xBookmarks->getByName(u"mybookmark2"_ustr), uno::UNO_QUERY); // Without the accompanying fix in place, this test would have crashed, an invalidated iterator // was used with erase(). @@ -546,7 +546,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testSplitExpandGlossary) pWrtShell->SttEndDoc(/*bStt=*/false); // When expanding 'dt' to an actual dummy text: - dispatchCommand(mxComponent, ".uno:ExpandGlossary", {}); + dispatchCommand(mxComponent, u".uno:ExpandGlossary"_ustr, {}); // Then make sure the 2 fly frames stay on the 2 pages: SwDoc* pDoc = getSwDoc(); @@ -580,9 +580,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testSplitFlyInsertUndo) pWrtShell->InsertTable(aTableOptions, /*nRows=*/2, /*nCols=*/1); pWrtShell->MoveTable(GotoPrevTable, fnTableStart); pWrtShell->GoPrevCell(); - pWrtShell->Insert("A1"); + pWrtShell->Insert(u"A1"_ustr); pWrtShell->GoNextCell(); - pWrtShell->Insert("A2"); + pWrtShell->Insert(u"A2"_ustr); // Select cell: pWrtShell->SelAll(); // Select table: diff --git a/sw/qa/core/docnode/docnode.cxx b/sw/qa/core/docnode/docnode.cxx index 9521c67b8ef7..03b53de11f47 100644 --- a/sw/qa/core/docnode/docnode.cxx +++ b/sw/qa/core/docnode/docnode.cxx @@ -19,7 +19,7 @@ class Test : public SwModelTestBase { public: Test() - : SwModelTestBase("/sw/qa/core/docnode/data/") + : SwModelTestBase(u"/sw/qa/core/docnode/data/"_ustr) { } }; @@ -36,7 +36,7 @@ CPPUNIT_TEST_FIXTURE(Test, testRedlineEndsBeforeToC) CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(2), rTable.size()); // The redline contained the newline, too - CPPUNIT_ASSERT_EQUAL(OUString("<add-table-of-content>"), rTable[0]->GetText()); + CPPUNIT_ASSERT_EQUAL(u"<add-table-of-content>"_ustr, rTable[0]->GetText()); } CPPUNIT_TEST_FIXTURE(Test, testTdf150086) @@ -48,7 +48,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf150086) CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(8), rTable.size()); // This was "Conte" (stripped redline) - CPPUNIT_ASSERT_EQUAL(OUString("Content "), rTable[6]->GetText()); + CPPUNIT_ASSERT_EQUAL(u"Content "_ustr, rTable[6]->GetText()); } CPPUNIT_TEST_FIXTURE(Test, testTdf156267) @@ -56,12 +56,12 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156267) createSwDoc("tdf156267.docx"); CPPUNIT_ASSERT_EQUAL(1, getPages()); - dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Copy", {}); - dispatchCommand(mxComponent, ".uno:Paste", {}); + dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); + dispatchCommand(mxComponent, u".uno:Copy"_ustr, {}); + dispatchCommand(mxComponent, u".uno:Paste"_ustr, {}); // Without the fix in place, it would have crashed here - dispatchCommand(mxComponent, ".uno:Undo", {}); + dispatchCommand(mxComponent, u".uno:Undo"_ustr, {}); CPPUNIT_ASSERT_EQUAL(1, getPages()); } diff --git a/sw/qa/core/draw/draw.cxx b/sw/qa/core/draw/draw.cxx index 3879a0642e3c..e796e7d3f392 100644 --- a/sw/qa/core/draw/draw.cxx +++ b/sw/qa/core/draw/draw.cxx @@ -26,7 +26,7 @@ class SwCoreDrawTest : public SwModelTestBase { public: SwCoreDrawTest() - : SwModelTestBase("/sw/qa/core/draw/data/") + : SwModelTestBase(u"/sw/qa/core/draw/data/"_ustr) { } }; @@ -112,14 +112,14 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTdf107727FrameBorder) createSwDoc("tdf107727_FrameBorder.odt"); // Export to RTF and reload - saveAndReload("Rich Text Format"); + saveAndReload(u"Rich Text Format"_ustr); // Get frame without border and inspect it. uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xFrame0(xIndexAccess->getByIndex(0), uno::UNO_QUERY); - auto aBorder = getProperty<table::BorderLine2>(xFrame0, "LeftBorder"); + auto aBorder = getProperty<table::BorderLine2>(xFrame0, u"LeftBorder"_ustr); // fo:border="none" is not available via API, and aBorder.LineWidth has wrong value (why?). sal_uInt32 nBorderWidth = aBorder.OuterLineWidth + aBorder.InnerLineWidth + aBorder.LineDistance; @@ -128,7 +128,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTdf107727FrameBorder) // Get frame with left border and inspect it. uno::Reference<beans::XPropertySet> xFrame1(xIndexAccess->getByIndex(1), uno::UNO_QUERY); - aBorder = getProperty<table::BorderLine2>(xFrame1, "LeftBorder"); + aBorder = getProperty<table::BorderLine2>(xFrame1, u"LeftBorder"_ustr); // Without patch it failed with Expected 127, Actual 26. Default border width was used. nBorderWidth = aBorder.OuterLineWidth + aBorder.InnerLineWidth + aBorder.LineDistance; CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(127), nBorderWidth); diff --git a/sw/qa/core/edit/edit.cxx b/sw/qa/core/edit/edit.cxx index fa8fefa910c1..71dcaae879a5 100644 --- a/sw/qa/core/edit/edit.cxx +++ b/sw/qa/core/edit/edit.cxx @@ -21,7 +21,7 @@ class Test : public SwModelTestBase { public: Test() - : SwModelTestBase("/sw/qa/core/edit/data/") + : SwModelTestBase(u"/sw/qa/core/edit/data/"_ustr) { } }; diff --git a/sw/qa/core/fields/fields.cxx b/sw/qa/core/fields/fields.cxx index 36a29551097b..5ecb2ba06e0e 100644 --- a/sw/qa/core/fields/fields.cxx +++ b/sw/qa/core/fields/fields.cxx @@ -51,7 +51,7 @@ class Test : public SwModelTestBase { public: Test() - : SwModelTestBase("/sw/qa/core/fields/data/") + : SwModelTestBase(u"/sw/qa/core/fields/data/"_ustr) { } }; @@ -63,14 +63,14 @@ CPPUNIT_TEST_FIXTURE(Test, testAuthorityTooltip) SwDoc* pDoc = getSwDoc(); uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xField( - xFactory->createInstance("com.sun.star.text.TextField.Bibliography"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.text.TextField.Bibliography"_ustr), uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aFields = { - comphelper::makePropertyValue("Identifier", OUString("ARJ00")), - comphelper::makePropertyValue("Author", OUString("Ar, J")), - comphelper::makePropertyValue("Title", OUString("mytitle")), - comphelper::makePropertyValue("Year", OUString("2020")), + comphelper::makePropertyValue(u"Identifier"_ustr, u"ARJ00"_ustr), + comphelper::makePropertyValue(u"Author"_ustr, u"Ar, J"_ustr), + comphelper::makePropertyValue(u"Title"_ustr, u"mytitle"_ustr), + comphelper::makePropertyValue(u"Year"_ustr, u"2020"_ustr), }; - xField->setPropertyValue("Fields", uno::Any(aFields)); + xField->setPropertyValue(u"Fields"_ustr, uno::Any(aFields)); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XText> xText = xTextDocument->getText(); uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); @@ -89,7 +89,7 @@ CPPUNIT_TEST_FIXTURE(Test, testAuthorityTooltip) // Without the accompanying fix in place, generating this tooltip text was not possible without // first inserting an empty bibliography table into the document. - CPPUNIT_ASSERT_EQUAL(OUString("ARJ00: Ar, J, mytitle, 2020"), aTooltip); + CPPUNIT_ASSERT_EQUAL(u"ARJ00: Ar, J, mytitle, 2020"_ustr, aTooltip); } CPPUNIT_TEST_FIXTURE(Test, testTdf143424) @@ -105,19 +105,19 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143424) // Field: Chapter Format: Chapter name uno::Reference<text::XTextField> xField(xFields->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("Another title"), xField->getPresentation(false)); + CPPUNIT_ASSERT_EQUAL(u"Another title"_ustr, xField->getPresentation(false)); // Field: Chapter Format: Chapter number and name xField.set(xFields->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("Chapter 2 - Another title"), xField->getPresentation(false)); + CPPUNIT_ASSERT_EQUAL(u"Chapter 2 - Another title"_ustr, xField->getPresentation(false)); // Field: Chapter Format: Chapter number xField.set(xFields->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("Chapter 2 -"), xField->getPresentation(false)); + CPPUNIT_ASSERT_EQUAL(u"Chapter 2 -"_ustr, xField->getPresentation(false)); // Field: Chapter Format: Chapter number without separator xField.set(xFields->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("2"), xField->getPresentation(false)); + CPPUNIT_ASSERT_EQUAL(u"2"_ustr, xField->getPresentation(false)); } CPPUNIT_TEST_FIXTURE(Test, testChapterFieldsFollowedBy) @@ -131,22 +131,22 @@ CPPUNIT_TEST_FIXTURE(Test, testChapterFieldsFollowedBy) // SwModify::Add() enumerates in invalid (mostly reverse) order, not like in document std::vector<OUString> aFieldValues = { - "Followed by tab", // #1 - "I.I.I.I", // #16 - ">I.I.I.I< Followed by newline", // #15 Linefeed is replaced by space - ">I.I.I.I<", // #14 - "Followed by newline", // #13 - "I.I.I", // #12 - ">I.I.I<Followed by nothing", // #11 Nothing between text & outline - ">I.I.I<", // #10 - "Followed by nothing", // #9 - "I.I", // #8 - ">I.I< Followed by space", // #7 Space as is - ">I.I<", // #6 - "Followed by space", // #5 - "I", // #4 - ">I< Followed by tab", // #3 Here is a tab, but replaced by space in field - ">I<", // #2 + u"Followed by tab"_ustr, // #1 + u"I.I.I.I"_ustr, // #16 + u">I.I.I.I< Followed by newline"_ustr, // #15 Linefeed is replaced by space + u">I.I.I.I<"_ustr, // #14 + u"Followed by newline"_ustr, // #13 + u"I.I.I"_ustr, // #12 + u">I.I.I<Followed by nothing"_ustr, // #11 Nothing between text & outline + u">I.I.I<"_ustr, // #10 + u"Followed by nothing"_ustr, // #9 + u"I.I"_ustr, // #8 + u">I.I< Followed by space"_ustr, // #7 Space as is + u">I.I<"_ustr, // #6 + u"Followed by space"_ustr, // #5 + u"I"_ustr, // #4 + u">I< Followed by tab"_ustr, // #3 Here is a tab, but replaced by space in field + u">I<"_ustr, // #2 }; for (const auto& sValue : aFieldValues) @@ -195,7 +195,7 @@ void InsertHeading(const uno::Reference<text::XTextCursor>& xCursor, const OUStr uno::Reference<beans::XPropertySet> xCursorPropertySet(xCursor, uno::UNO_QUERY); uno::Reference<text::XText> xText = xCursor->getText(); - xCursorPropertySet->setPropertyValue("ParaStyleName", uno::Any(OUString("Heading 1"))); + xCursorPropertySet->setPropertyValue(u"ParaStyleName"_ustr, uno::Any(u"Heading 1"_ustr)); xText->insertString(xCursor, content, false); InsertParagraphBreak(xCursor); } @@ -212,11 +212,11 @@ CPPUNIT_TEST_FIXTURE(Test, testStyleRefSearchUp) uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); - InsertHeading(xCursor, "Heading far above field"); - InsertHeading(xCursor, "Heading above field"); + InsertHeading(xCursor, u"Heading far above field"_ustr); + InsertHeading(xCursor, u"Heading above field"_ustr); InsertParagraphBreak(xCursor); - InsertHeading(xCursor, "Heading below field"); - InsertHeading(xCursor, "Heading far below field"); + InsertHeading(xCursor, u"Heading below field"_ustr); + InsertHeading(xCursor, u"Heading far below field"_ustr); uno::Reference<text::XParagraphCursor> xParagraphCursor(xCursor, uno::UNO_QUERY); xParagraphCursor->gotoPreviousParagraph(false); // Heading far below... @@ -227,20 +227,20 @@ CPPUNIT_TEST_FIXTURE(Test, testStyleRefSearchUp) // Insert a STYLEREF field which looks for "Heading 1"s uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextField> xField( - xFactory->createInstance("com.sun.star.text.TextField.GetReference"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.text.TextField.GetReference"_ustr), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xFieldPropertySet(xField, uno::UNO_QUERY); - xFieldPropertySet->setPropertyValue("ReferenceFieldSource", + xFieldPropertySet->setPropertyValue(u"ReferenceFieldSource"_ustr, uno::Any(sal_Int16(text::ReferenceFieldSource::STYLE))); - xFieldPropertySet->setPropertyValue("ReferenceFieldPart", + xFieldPropertySet->setPropertyValue(u"ReferenceFieldPart"_ustr, uno::Any(sal_Int16(text::ReferenceFieldPart::TEXT))); - xFieldPropertySet->setPropertyValue("SourceName", uno::Any(OUString("Heading 1"))); + xFieldPropertySet->setPropertyValue(u"SourceName"_ustr, uno::Any(u"Heading 1"_ustr)); xField->attach(xCursor); // Assert // Make sure the field has the right text - CPPUNIT_ASSERT_EQUAL(OUString("Heading above field"), xField->getPresentation(false)); + CPPUNIT_ASSERT_EQUAL(u"Heading above field"_ustr, xField->getPresentation(false)); } /// If there is referenced text only below, STYLEREF searches down @@ -256,8 +256,8 @@ CPPUNIT_TEST_FIXTURE(Test, testStyleRefSearchDown) uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); InsertParagraphBreak(xCursor); - InsertHeading(xCursor, "Heading below field"); - InsertHeading(xCursor, "Heading far below field"); + InsertHeading(xCursor, u"Heading below field"_ustr); + InsertHeading(xCursor, u"Heading far below field"_ustr); uno::Reference<text::XParagraphCursor> xParagraphCursor(xCursor, uno::UNO_QUERY); xParagraphCursor->gotoPreviousParagraph(false); // Heading far below... @@ -268,20 +268,20 @@ CPPUNIT_TEST_FIXTURE(Test, testStyleRefSearchDown) // Insert a STYLEREF field which looks for "Heading 1"s uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextField> xField( - xFactory->createInstance("com.sun.star.text.TextField.GetReference"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.text.TextField.GetReference"_ustr), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xFieldPropertySet(xField, uno::UNO_QUERY); - xFieldPropertySet->setPropertyValue("ReferenceFieldSource", + xFieldPropertySet->setPropertyValue(u"ReferenceFieldSource"_ustr, uno::Any(sal_Int16(text::ReferenceFieldSource::STYLE))); - xFieldPropertySet->setPropertyValue("ReferenceFieldPart", + xFieldPropertySet->setPropertyValue(u"ReferenceFieldPart"_ustr, uno::Any(sal_Int16(text::ReferenceFieldPart::TEXT))); - xFieldPropertySet->setPropertyValue("SourceName", uno::Any(OUString("Heading 1"))); + xFieldPropertySet->setPropertyValue(u"SourceName"_ustr, uno::Any(u"Heading 1"_ustr)); xField->attach(xCursor); // Assert // Make sure the field has the right text - CPPUNIT_ASSERT_EQUAL(OUString("Heading below field"), xField->getPresentation(false)); + CPPUNIT_ASSERT_EQUAL(u"Heading below field"_ustr, xField->getPresentation(false)); } /// STYLEREFs in marginals (headers or footers) should search in the page they are on first, regardless if there is anything above them @@ -296,40 +296,40 @@ CPPUNIT_TEST_FIXTURE(Test, testMarginalStyleRef) uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); - InsertHeading(xCursor, "Top heading on page"); - InsertHeading(xCursor, "Bottom heading on page"); + InsertHeading(xCursor, u"Top heading on page"_ustr); + InsertHeading(xCursor, u"Bottom heading on page"_ustr); // Act // Insert a STYLEREF field which looks for "Heading 1"s into the footer uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextField> xField( - xFactory->createInstance("com.sun.star.text.TextField.GetReference"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.text.TextField.GetReference"_ustr), uno::UNO_QUERY); uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XNameContainer> xParagraphStylesContainer( - xStyleFamiliesSupplier->getStyleFamilies()->getByName("PageStyles"), uno::UNO_QUERY); + xStyleFamiliesSupplier->getStyleFamilies()->getByName(u"PageStyles"_ustr), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPagePropertySet( - xParagraphStylesContainer->getByName("Standard"), uno::UNO_QUERY); + xParagraphStylesContainer->getByName(u"Standard"_ustr), uno::UNO_QUERY); - xPagePropertySet->setPropertyValue("FooterIsOn", uno::Any(true)); - uno::Reference<text::XText> xFooterText(xPagePropertySet->getPropertyValue("FooterText"), + xPagePropertySet->setPropertyValue(u"FooterIsOn"_ustr, uno::Any(true)); + uno::Reference<text::XText> xFooterText(xPagePropertySet->getPropertyValue(u"FooterText"_ustr), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xFieldPropertySet(xField, uno::UNO_QUERY); - xFieldPropertySet->setPropertyValue("ReferenceFieldSource", + xFieldPropertySet->setPropertyValue(u"ReferenceFieldSource"_ustr, uno::Any(sal_Int16(text::ReferenceFieldSource::STYLE))); - xFieldPropertySet->setPropertyValue("ReferenceFieldPart", + xFieldPropertySet->setPropertyValue(u"ReferenceFieldPart"_ustr, uno::Any(sal_Int16(text::ReferenceFieldPart::TEXT))); - xFieldPropertySet->setPropertyValue("SourceName", uno::Any(OUString("Heading 1"))); + xFieldPropertySet->setPropertyValue(u"SourceName"_ustr, uno::Any(u"Heading 1"_ustr)); uno::Reference<text::XTextRange> xFooterCursor = xFooterText->createTextCursor(); xField->attach(xFooterCursor); // Assert // Make sure the field has the right text - CPPUNIT_ASSERT_EQUAL(OUString("Top heading on page"), xField->getPresentation(false)); + CPPUNIT_ASSERT_EQUAL(u"Top heading on page"_ustr, xField->getPresentation(false)); } /// STYLEREFs in footnotes should search from the point of the reference mark @@ -344,11 +344,11 @@ CPPUNIT_TEST_FIXTURE(Test, testFootnoteStyleRef) uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); - InsertHeading(xCursor, "Heading far above reference mark"); - InsertHeading(xCursor, "Heading above reference mark"); + InsertHeading(xCursor, u"Heading far above reference mark"_ustr); + InsertHeading(xCursor, u"Heading above reference mark"_ustr); InsertParagraphBreak(xCursor); - InsertHeading(xCursor, "Heading below reference mark"); - InsertHeading(xCursor, "Heading far below reference mark"); + InsertHeading(xCursor, u"Heading below reference mark"_ustr); + InsertHeading(xCursor, u"Heading far below reference mark"_ustr); uno::Reference<text::XParagraphCursor> xParagraphCursor(xCursor, uno::UNO_QUERY); xParagraphCursor->gotoPreviousParagraph(false); // Heading far below... @@ -360,19 +360,19 @@ CPPUNIT_TEST_FIXTURE(Test, testFootnoteStyleRef) uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<text::XFootnote> xFootnote( - xFactory->createInstance("com.sun.star.text.Footnote"), uno::UNO_QUERY); - xFootnote->setLabel("Style reference mark"); + xFactory->createInstance(u"com.sun.star.text.Footnote"_ustr), uno::UNO_QUERY); + xFootnote->setLabel(u"Style reference mark"_ustr); xText->insertTextContent(xCursor, xFootnote, false); uno::Reference<text::XTextField> xField( - xFactory->createInstance("com.sun.star.text.TextField.GetReference"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.text.TextField.GetReference"_ustr), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xFieldPropertySet(xField, uno::UNO_QUERY); - xFieldPropertySet->setPropertyValue("ReferenceFieldSource", + xFieldPropertySet->setPropertyValue(u"ReferenceFieldSource"_ustr, uno::Any(sal_Int16(text::ReferenceFieldSource::STYLE))); - xFieldPropertySet->setPropertyValue("ReferenceFieldPart", + xFieldPropertySet->setPropertyValue(u"ReferenceFieldPart"_ustr, uno::Any(sal_Int16(text::ReferenceFieldPart::TEXT))); - xFieldPropertySet->setPropertyValue("SourceName", uno::Any(OUString("Heading 1"))); + xFieldPropertySet->setPropertyValue(u"SourceName"_ustr, uno::Any(u"Heading 1"_ustr)); uno::Reference<text::XSimpleText> xFootnoteText(xFootnote, uno::UNO_QUERY); uno::Reference<text::XTextRange> xFootnoteCursor = xFootnoteText->createTextCursor(); @@ -380,7 +380,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFootnoteStyleRef) // Assert // Make sure the field has the right text - CPPUNIT_ASSERT_EQUAL(OUString("Heading above reference mark"), xField->getPresentation(false)); + CPPUNIT_ASSERT_EQUAL(u"Heading above reference mark"_ustr, xField->getPresentation(false)); } /// STYLEREFs with the REFFLDFLAG_HIDE_NON_NUMERICAL flag should hide all characters that are not numerical or delimiters diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx index 13595d42adbc..4f27c3b120bc 100644 --- a/sw/qa/core/filters-test.cxx +++ b/sw/qa/core/filters-test.cxx @@ -100,7 +100,7 @@ bool SwFiltersTest::filter(const OUString &rFilter, const OUString &rURL, if (rUserData == FILTER_TEXT_DLG) { pSrcMed->GetItemSet().Put( - SfxStringItem(SID_FILE_FILTEROPTIONS, "UTF8,LF,Liberation Mono,en-US")); + SfxStringItem(SID_FILE_FILTEROPTIONS, u"UTF8,LF,Liberation Mono,en-US"_ustr)); } bool bLoaded = xDocShRef->DoLoad(pSrcMed); @@ -132,54 +132,54 @@ bool SwFiltersTest::filter(const OUString &rFilter, const OUString &rURL, void SwFiltersTest::testCVEs() { - testDir("StarOffice XML (Writer)", + testDir(u"StarOffice XML (Writer)"_ustr, m_directories.getURLFromSrc(u"/sw/qa/core/data/xml/"), FILTER_XML, SfxFilterFlags::IMPORT | SfxFilterFlags::OWN | SfxFilterFlags::DEFAULT, isstorage, SOFFICE_FILEFORMAT_CURRENT); - testDir("writer8", + testDir(u"writer8"_ustr, m_directories.getURLFromSrc(u"/sw/qa/core/data/odt/"), FILTER_XML, SfxFilterFlags::IMPORT | SfxFilterFlags::OWN | SfxFilterFlags::DEFAULT, isstorage, SOFFICE_FILEFORMAT_CURRENT); - testDir("MS Word 97", + testDir(u"MS Word 97"_ustr, m_directories.getURLFromSrc(u"/sw/qa/core/data/ww8/"), FILTER_WW8); - testDir("MS WinWord 6.0", + testDir(u"MS WinWord 6.0"_ustr, m_directories.getURLFromSrc(u"/sw/qa/core/data/ww6/"), sWW6); - testDir("MS WinWord 5", + testDir(u"MS WinWord 5"_ustr, m_directories.getURLFromSrc(u"/sw/qa/core/data/ww5/"), sWW5); - testDir("Text (encoded)", + testDir(u"Text (encoded)"_ustr, m_directories.getURLFromSrc(u"/sw/qa/core/data/txt/"), FILTER_TEXT_DLG); - testDir("MS Word 2007 XML", + testDir(u"MS Word 2007 XML"_ustr, m_directories.getURLFromSrc(u"/sw/qa/core/data/ooxml/"), OUString(), SfxFilterFlags::STARONEFILTER); - testDir("Rich Text Format", + testDir(u"Rich Text Format"_ustr, m_directories.getURLFromSrc(u"/sw/qa/core/data/rtf/"), OUString(), SfxFilterFlags::STARONEFILTER); - testDir("HTML", + testDir(u"HTML"_ustr, m_directories.getURLFromSrc(u"/sw/qa/core/data/html/"), sHTML); - testDir("T602Document", + testDir(u"T602Document"_ustr, m_directories.getURLFromSrc(u"/sw/qa/core/data/602/"), OUString(), SfxFilterFlags::STARONEFILTER); - testDir("Rich Text Format", + testDir(u"Rich Text Format"_ustr, m_directories.getURLFromSrc(u"/sw/qa/core/exportdata/rtf/"), OUString(), SfxFilterFlags::STARONEFILTER, @@ -187,7 +187,7 @@ void SwFiltersTest::testCVEs() 0, /*bExport=*/true); - testDir("HTML", + testDir(u"HTML"_ustr, m_directories.getURLFromSrc(u"/sw/qa/core/exportdata/html/"), sHTML, SfxFilterFlags::NONE, @@ -195,7 +195,7 @@ void SwFiltersTest::testCVEs() 0, /*bExport=*/true); - testDir("MS Word 2007 XML", + testDir(u"MS Word 2007 XML"_ustr, m_directories.getURLFromSrc(u"/sw/qa/core/exportdata/ooxml/"), OUString(), SfxFilterFlags::STARONEFILTER, @@ -212,7 +212,7 @@ void SwFiltersTest::setUp() //This is a bit of a fudge, we do this to ensure that SwGlobals::ensure, //which is a private symbol to us, gets called m_xWriterComponent = - getMultiServiceFactory()->createInstance("com.sun.star.comp.Writer.TextDocument"); + getMultiServiceFactory()->createInstance(u"com.sun.star.comp.Writer.TextDocument"_ustr); CPPUNIT_ASSERT_MESSAGE("no writer component!", m_xWriterComponent.is()); } diff --git a/sw/qa/core/frmedt/frmedt.cxx b/sw/qa/core/frmedt/frmedt.cxx index 37425c13060e..438094282c18 100644 --- a/sw/qa/core/frmedt/frmedt.cxx +++ b/sw/qa/core/frmedt/frmedt.cxx @@ -35,7 +35,7 @@ class SwCoreFrmedtTest : public SwModelTestBase { public: SwCoreFrmedtTest() - : SwModelTestBase("/sw/qa/core/frmedt/data/") + : SwModelTestBase(u"/sw/qa/core/frmedt/data/"_ustr) { } }; @@ -48,7 +48,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testTextboxReanchor) SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); SdrPage* pDrawPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pDrawShape = pDrawPage->GetObj(1); - CPPUNIT_ASSERT_EQUAL(OUString("draw shape"), pDrawShape->GetName()); + CPPUNIT_ASSERT_EQUAL(u"draw shape"_ustr, pDrawShape->GetName()); // Select the shape of the textbox. Point aPoint; @@ -58,7 +58,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testTextboxReanchor) // Anchor the shape of the textbox into its own textframe. SdrObject* pTextFrameObj = pDrawPage->GetObj(2); SwFrameFormat* pTextFrameFormat = FindFrameFormat(pTextFrameObj); - CPPUNIT_ASSERT_EQUAL(OUString("Frame2"), pTextFrameFormat->GetName()); + CPPUNIT_ASSERT_EQUAL(u"Frame2"_ustr, pTextFrameFormat->GetName()); SwFrameFormat* pDrawShapeFormat = FindFrameFormat(pDrawShape); SwNodeOffset nOldAnchor = pDrawShapeFormat->GetAnchor().GetAnchorNode()->GetIndex(); pShell->FindAnchorPos(pTextFrameObj->GetLastBoundRect().Center(), true); @@ -77,14 +77,16 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testVertPosFromBottomBoundingBox) createSwDoc(); uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( - xFactory->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.drawing.RectangleShape"_ustr), uno::UNO_QUERY); xShape->setSize(awt::Size(10000, 10000)); uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); - xShapeProps->setPropertyValue("AnchorType", uno::Any(text::TextContentAnchorType_AT_CHARACTER)); - xShapeProps->setPropertyValue("VertOrient", uno::Any(text::VertOrientation::NONE)); - xShapeProps->setPropertyValue("VertOrientRelation", + xShapeProps->setPropertyValue(u"AnchorType"_ustr, + uno::Any(text::TextContentAnchorType_AT_CHARACTER)); + xShapeProps->setPropertyValue(u"VertOrient"_ustr, uno::Any(text::VertOrientation::NONE)); + xShapeProps->setPropertyValue(u"VertOrientRelation"_ustr, uno::Any(text::RelOrientation::PAGE_PRINT_AREA_BOTTOM)); - xShapeProps->setPropertyValue("VertOrientPosition", uno::Any(static_cast<sal_Int32>(-11000))); + xShapeProps->setPropertyValue(u"VertOrientPosition"_ustr, + uno::Any(static_cast<sal_Int32>(-11000))); uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); xDrawPageSupplier->getDrawPage()->add(xShape); @@ -182,11 +184,11 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testSplitFlyInsertCaption) // When trying to insert a caption below that table: SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); - pWrtShell->GotoTable("Table1"); + pWrtShell->GotoTable(u"Table1"_ustr); InsCaptionOpt aOpt; SwView& rView = pWrtShell->GetView(); - aOpt.SetCategory("Table"); - aOpt.SetCaption("Numbers English-German"); + aOpt.SetCategory(u"Table"_ustr); + aOpt.SetCaption(u"Numbers English-German"_ustr); // After, not before. aOpt.SetPos(1); // Without the accompanying fix in place, this call never finished, layout didn't handle content @@ -215,9 +217,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testSplitFlyUnfloat) pWrtShell->InsertTable(aTableOptions, /*nRows=*/2, /*nCols=*/1); pWrtShell->MoveTable(GotoPrevTable, fnTableStart); pWrtShell->GoPrevCell(); - pWrtShell->Insert("A1"); + pWrtShell->Insert(u"A1"_ustr); pWrtShell->GoNextCell(); - pWrtShell->Insert("A2"); + pWrtShell->Insert(u"A2"_ustr); // Select cell: pWrtShell->SelAll(); // Select table: diff --git a/sw/qa/core/header_footer/HeaderFooterTest.cxx b/sw/qa/core/header_footer/HeaderFooterTest.cxx index 4d2938ef28dc..acfd77f1270e 100644 --- a/sw/qa/core/header_footer/HeaderFooterTest.cxx +++ b/sw/qa/core/header_footer/HeaderFooterTest.cxx @@ -43,7 +43,7 @@ public: void checkShapeInFirstPageHeader(); HeaderFooterTest() - : SwModelTestBase("/sw/qa/core/header_footer/data/") + : SwModelTestBase(u"/sw/qa/core/header_footer/data/"_ustr) { } }; @@ -61,15 +61,15 @@ CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testStashedHeaderFooter) mxComponent.clear(); // Source - SwPageDesc* pSourcePageDesc = pSourceDocument->MakePageDesc("SourceStyle"); + SwPageDesc* pSourcePageDesc = pSourceDocument->MakePageDesc(u"SourceStyle"_ustr); pSourcePageDesc->ChgFirstShare(false); CPPUNIT_ASSERT(!pSourcePageDesc->IsFirstShared()); pSourcePageDesc->StashFrameFormat(pSourcePageDesc->GetFirstMaster(), true, false, true); - pSourceDocument->ChgPageDesc("SourceStyle", *pSourcePageDesc); + pSourceDocument->ChgPageDesc(u"SourceStyle"_ustr, *pSourcePageDesc); -e ... etc. - the rest is truncated