diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-02 01:18:42 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-02 18:46:47 +0200 |
commit | 116b9d6ddf2b61186b29f0370234eec9c1bbe306 (patch) | |
tree | 7f90a12333274086e33c4e0fabfd96a8e54e6b6c /sfx2/source | |
parent | d7ba78e9c7be835a1e2ecdacd25995663e96862f (diff) |
Avoid conversions between OUString and OString in VCL
Standardize on OUString, which is the main internal string class.
Convert from/to OUString only when communicating with respective
external APIs.
Removes about 200 conversions from the code.
Change-Id: I96ecee7c6fd271bb76639220e96d69d2964bed26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149930
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2/source')
49 files changed, 269 insertions, 296 deletions
diff --git a/sfx2/source/appl/appdispatchprovider.cxx b/sfx2/source/appl/appdispatchprovider.cxx index d3f64e1d4f34..0ac4f59d88d1 100644 --- a/sfx2/source/appl/appdispatchprovider.cxx +++ b/sfx2/source/appl/appdispatchprovider.cxx @@ -205,7 +205,7 @@ Sequence< frame::DispatchInformation > SAL_CALL SfxAppDispatchProvider::getConfi if ( pSfxSlot->GetMode() & nMode ) { frame::DispatchInformation aCmdInfo; - aCmdInfo.Command = ".uno:" + OUString::createFromAscii(pSfxSlot->GetUnoName()); + aCmdInfo.Command = pSfxSlot->GetCommand(); aCmdInfo.GroupId = nCommandGroup; aCmdVector.push_back( aCmdInfo ); } diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 5ccfd3c6a597..7b233434dc57 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1703,7 +1703,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext ); - OUString aCmd = OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() ); + OUString aCmd = GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName(); Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) ); Sequence < beans::PropertyValue > aSeq; if ( rReq.GetArgs() ) @@ -1723,7 +1723,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference< frame::XDispatchProvider > xProv = text::ModuleDispatcher::create( xContext ); - OUString aCmd = OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() ); + OUString aCmd = GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName(); Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) ); Sequence < beans::PropertyValue > aSeq; if ( rReq.GetArgs() ) diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 26f0e336a9f2..e4443b7f46fc 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -202,7 +202,7 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert const beans::PropertyValue& rProp = pPropsVal[0]; const OUString& rName = rProp.Name; - if ( nCount == 1 && rName == OUString( pSlot->pUnoName, strlen( pSlot->pUnoName ), RTL_TEXTENCODING_UTF8 ) ) + if ( nCount == 1 && rName == pSlot->pUnoName ) { // there is only one parameter and its name matches the name of the property, // so it's either a simple property or a complex property in one single UNO struct @@ -242,8 +242,8 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert for ( nSub=0; nSub<nSubCount; nSub++ ) { // search sub item by name - OString aStr = OString::Concat(pSlot->pUnoName) + "." + pType->aAttrib[nSub].pName; - if ( rPropValue.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) ) + OUString aStr = pSlot->pUnoName + "." + OUString::createFromAscii(pType->aAttrib[nSub].pName); + if ( rPropValue.Name == aStr ) { sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->aAttrib[nSub].nAID)); if ( bConvertTwips ) @@ -884,7 +884,7 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert else { // transform parameter "OptionsPageURL" of slot "OptionsTreeDialog" - if ( "OptionsTreeDialog" == OUString( pSlot->pUnoName, strlen(pSlot->pUnoName), RTL_TEXTENCODING_UTF8 ) ) + if ( "OptionsTreeDialog" == pSlot->pUnoName ) { auto pProp = std::find_if(rArgs.begin(), rArgs.end(), [](const PropertyValue& rProp) { return rProp.Name == "OptionsPageURL"; }); @@ -1299,7 +1299,7 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b sal_uInt16 nSubCount = pType->nAttribs; if ( !nSubCount ) { - pValue[nActProp].Name = OUString::createFromAscii(pSlot->pUnoName) ; + pValue[nActProp].Name = pSlot->pUnoName; if ( !pItem->QueryValue( pValue[nActProp].Value ) ) { SAL_WARN( "sfx", "Item not convertible: " << nSlotId ); @@ -1315,7 +1315,7 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b nSubId |= CONVERT_TWIPS; DBG_ASSERT(( pType->aAttrib[n-1].nAID ) <= 127, "Member ID out of range" ); - pValue[nActProp].Name = OUString::createFromAscii( pSlot->pUnoName ) + + pValue[nActProp].Name = pSlot->pUnoName + "." + OUString::createFromAscii( pType->aAttrib[n-1].pName ); if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) ) diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index a9c94152d383..1fe6c39a7a03 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -286,7 +286,7 @@ void SfxChildWindow::SaveStatus(const SfxChildWinInfo& rInfo) if (!rInfo.aModule.isEmpty()) sName = rInfo.aModule + "/" + sName; SvtViewOptions aWinOpt(EViewType::Window, sName); - aWinOpt.SetWindowState(OStringToOUString(rInfo.aWinState, RTL_TEXTENCODING_UTF8)); + aWinOpt.SetWindowState(rInfo.aWinState); css::uno::Sequence < css::beans::NamedValue > aSeq { { "Data", css::uno::Any(aWinData) } }; @@ -371,7 +371,7 @@ void SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI aSeq[0].Value >>= aTmp; OUString aWinData( aTmp ); - rInfo.aWinState = OUStringToOString(xWinOpt->GetWindowState(), RTL_TEXTENCODING_UTF8); + rInfo.aWinState = xWinOpt->GetWindowState(); if ( aWinData.isEmpty() ) return; diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index dcd710e16704..aae69dff4db2 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -314,7 +314,7 @@ OUString ContentTabPage_Impl::GetSelectedEntry() const // class HelpTabPage_Impl ------------------------------------------------ HelpTabPage_Impl::HelpTabPage_Impl(weld::Widget* pParent, SfxHelpIndexWindow_Impl* pIdxWin, - const OString& rID, const OUString& rUIXMLDescription) + const OUString& rID, const OUString& rUIXMLDescription) : BuilderPage(pParent, nullptr, rUIXMLDescription, rID) , m_pIdxWin(pIdxWin) { @@ -1080,11 +1080,11 @@ bool SearchTabPage_Impl::OpenKeyword( const OUString& rKeyword ) // class BookmarksTabPage_Impl ------------------------------------------- -void BookmarksTabPage_Impl::DoAction(std::string_view rAction) +void BookmarksTabPage_Impl::DoAction(std::u16string_view rAction) { - if (rAction == "display") + if (rAction == u"display") aDoubleClickHdl.Call(nullptr); - else if (rAction == "rename") + else if (rAction == u"rename") { sal_Int32 nPos = m_xBookmarksBox->get_selected_index(); if (nPos != -1) @@ -1101,7 +1101,7 @@ void BookmarksTabPage_Impl::DoAction(std::string_view rAction) } } } - else if (rAction == "delete") + else if (rAction == u"delete") { sal_Int32 nPos = m_xBookmarksBox->get_selected_index(); if (nPos != -1) @@ -1126,7 +1126,7 @@ IMPL_LINK(BookmarksTabPage_Impl, CommandHdl, const CommandEvent&, rCEvt, bool) std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xBookmarksBox.get(), "sfx/ui/bookmarkmenu.ui")); std::unique_ptr<weld::Menu> xMenu = xBuilder->weld_menu("menu"); - OString sIdent = xMenu->popup_at_rect(m_xBookmarksBox.get(), ::tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))); + OUString sIdent = xMenu->popup_at_rect(m_xBookmarksBox.get(), ::tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))); if (!sIdent.isEmpty()) DoAction(sIdent); return true; @@ -1138,7 +1138,7 @@ IMPL_LINK(BookmarksTabPage_Impl, KeyInputHdl, const KeyEvent&, rKEvt, bool) sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); if (KEY_DELETE == nCode && m_xBookmarksBox->n_children() > 0) { - DoAction("delete"); + DoAction(u"delete"); bHandled = true; } return bHandled; @@ -1268,7 +1268,7 @@ void SfxHelpWindow_Impl::loadHelpContent(const OUString& sHelpURL, bool bAddToHi LeaveWait(); } -IMPL_LINK(SfxHelpIndexWindow_Impl, ActivatePageHdl, const OString&, rPage, void) +IMPL_LINK(SfxHelpIndexWindow_Impl, ActivatePageHdl, const OUString&, rPage, void) { GetPage(rPage)->Activate(); } @@ -1289,11 +1289,11 @@ SfxHelpIndexWindow_Impl::SfxHelpIndexWindow_Impl(SfxHelpWindow_Impl* _pParent, w GetSearchPage(); GetBookmarksPage(); - OString sPageId("index"); + OUString sPageId("index"); SvtViewOptions aViewOpt( EViewType::TabDialog, CONFIGNAME_INDEXWIN ); if ( aViewOpt.Exists() ) { - OString sSavedPageId = aViewOpt.GetPageID(); + OUString sSavedPageId = aViewOpt.GetPageID(); if (m_xTabCtrl->get_page_index(sSavedPageId) != -1) sPageId = sSavedPageId; } @@ -1363,17 +1363,17 @@ void SfxHelpIndexWindow_Impl::SetActiveFactory() } } -HelpTabPage_Impl* SfxHelpIndexWindow_Impl::GetPage(std::string_view rName) +HelpTabPage_Impl* SfxHelpIndexWindow_Impl::GetPage(std::u16string_view rName) { HelpTabPage_Impl* pPage = nullptr; - if (rName == "contents") + if (rName == u"contents") pPage = GetContentPage(); - else if (rName == "index") + else if (rName == u"index") pPage = GetIndexPage(); - else if (rName == "find") + else if (rName == u"find") pPage = GetSearchPage(); - else if (rName == "bookmarks") + else if (rName == u"bookmarks") pPage = GetBookmarksPage(); assert(pPage && "SfxHelpIndexWindow_Impl::GetCurrentPage(): no current page"); @@ -1414,7 +1414,7 @@ IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, KeywordHdl, IndexTabPage_Impl&, void) if( !bIndex) bIndex = xIPage->HasKeywordIgnoreCase(); // then set index or search page as current. - OString sPageId = bIndex ? "index" : "find"; + OUString sPageId = bIndex ? OUString("index") : OUString("find"); if (sPageId != m_xTabCtrl->get_current_page_ident()) m_xTabCtrl->set_current_page(sPageId); @@ -1462,7 +1462,7 @@ OUString SfxHelpIndexWindow_Impl::GetSelectedEntry() const { OUString sRet; - OString sName(m_xTabCtrl->get_current_page_ident()); + OUString sName(m_xTabCtrl->get_current_page_ident()); if (sName == "contents") { @@ -1512,7 +1512,7 @@ void SfxHelpIndexWindow_Impl::ClearSearchPage() void SfxHelpIndexWindow_Impl::GrabFocusBack() { - OString sName(m_xTabCtrl->get_current_page_ident()); + OUString sName(m_xTabCtrl->get_current_page_ident()); if (sName == "contents" && xCPage) xCPage->SetFocusOnBox(); @@ -1527,7 +1527,7 @@ void SfxHelpIndexWindow_Impl::GrabFocusBack() bool SfxHelpIndexWindow_Impl::HasFocusOnEdit() const { bool bRet = false; - OString sName(m_xTabCtrl->get_current_page_ident()); + OUString sName(m_xTabCtrl->get_current_page_ident()); if (sName == "index" && xIPage) bRet = xIPage->HasFocusOnEdit(); else if (sName == "find" && xSPage) @@ -1538,7 +1538,7 @@ bool SfxHelpIndexWindow_Impl::HasFocusOnEdit() const OUString SfxHelpIndexWindow_Impl::GetSearchText() const { OUString sRet; - OString sName(m_xTabCtrl->get_current_page_ident()); + OUString sName(m_xTabCtrl->get_current_page_ident()); if (sName == "find" && xSPage) sRet = xSPage->GetSearchText(); return sRet; @@ -1547,7 +1547,7 @@ OUString SfxHelpIndexWindow_Impl::GetSearchText() const bool SfxHelpIndexWindow_Impl::IsFullWordSearch() const { bool bRet = false; - OString sName(m_xTabCtrl->get_current_page_ident()); + OUString sName(m_xTabCtrl->get_current_page_ident()); if (sName == "find" && xSPage) bRet = xSPage->IsFullWordSearch(); return bRet; @@ -1562,7 +1562,7 @@ void SfxHelpIndexWindow_Impl::OpenKeyword( const OUString& rKeyword ) void SfxHelpIndexWindow_Impl::SelectExecutableEntry() { - OString sName(m_xTabCtrl->get_current_page_ident()); + OUString sName(m_xTabCtrl->get_current_page_ident()); if (sName == "index" && xIPage ) xIPage->SelectExecutableEntry(); } @@ -2293,7 +2293,7 @@ void SfxHelpWindow_Impl::ShowStartPage() loadHelpContent(SfxHelpWindow_Impl::buildHelpURL(xIndexWin->GetFactory(), u"/start", u"")); } -IMPL_LINK(SfxHelpWindow_Impl, SelectHdl, const OString&, rCurItem, void) +IMPL_LINK(SfxHelpWindow_Impl, SelectHdl, const OUString&, rCurItem, void) { bGrabFocusToToolBox = pTextWin->GetToolBox().has_focus(); DoAction(rCurItem); @@ -2483,7 +2483,7 @@ bool SfxHelpWindow_Impl::PreNotify( NotifyEvent& rNEvt ) if ( ( rKeyCode.IsMod2() && ( KEY_LEFT == nKey || KEY_RIGHT == nKey ) ) || ( !rKeyCode.GetModifier() && KEY_BACKSPACE == nKey && !xIndexWin->HasFocusOnEdit() ) ) { - DoAction( rKeyCode.GetCode() == KEY_RIGHT ? "forward" : "backward" ); + DoAction( rKeyCode.GetCode() == KEY_RIGHT ? u"forward" : u"backward" ); bHandled = true; } else if ( rKeyCode.IsMod1() && ( KEY_F4 == nKey || KEY_W == nKey ) ) @@ -2522,43 +2522,43 @@ void SfxHelpWindow_Impl::SetHelpURL( std::u16string_view rURL ) SetFactory( aObj.GetHost() ); } -void SfxHelpWindow_Impl::DoAction(std::string_view rActionId) +void SfxHelpWindow_Impl::DoAction(std::u16string_view rActionId) { - if (rActionId == "index") + if (rActionId == u"index") { bIndex = !bIndex; MakeLayout(); pTextWin->ToggleIndex( bIndex ); } - else if (rActionId == "start") + else if (rActionId == u"start") { ShowStartPage(); } - else if (rActionId == "backward" || rActionId == "forward") + else if (rActionId == u"backward" || rActionId == u"forward") { URL aURL; aURL.Complete = ".uno:Backward"; - if (rActionId == "forward") + if (rActionId == u"forward") aURL.Complete = ".uno:Forward"; Reference< util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict(aURL); pHelpInterceptor->dispatch( aURL, Sequence < PropertyValue >() ); } - else if (rActionId == "searchdialog") + else if (rActionId == u"searchdialog") { pTextWin->DoSearch(); } - else if (rActionId == "print" || rActionId == "sourceview" || rActionId == "copy" || rActionId == "selectionmode") + else if (rActionId == u"print" || rActionId == u"sourceview" || rActionId == u"copy" || rActionId == u"selectionmode") { Reference < XDispatchProvider > xProv = pTextWin->getFrame(); if ( xProv.is() ) { URL aURL; - if (rActionId == "print") + if (rActionId == u"print") aURL.Complete = ".uno:Print"; - else if (rActionId == "sourceview") + else if (rActionId == u"sourceview") aURL.Complete = ".uno:SourceView"; - else if (rActionId == "copy") + else if (rActionId == u"copy") aURL.Complete = ".uno:Copy"; else // rActionId == "selectionmode" aURL.Complete = ".uno:SelectTextMode"; @@ -2569,7 +2569,7 @@ void SfxHelpWindow_Impl::DoAction(std::string_view rActionId) xDisp->dispatch( aURL, Sequence < PropertyValue >() ); } } - else if (rActionId == "bookmarks") + else if (rActionId == u"bookmarks") { OUString aURL = pHelpInterceptor->GetCurrentURL(); if ( !aURL.isEmpty() ) diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx index 9d5a5e42209a..08f2b8a20e23 100644 --- a/sfx2/source/appl/newhelp.hxx +++ b/sfx2/source/appl/newhelp.hxx @@ -52,7 +52,7 @@ protected: public: HelpTabPage_Impl(weld::Widget* pParent, SfxHelpIndexWindow_Impl* _pIdxWin, - const OString& rID, const OUString& rUIXMLDescription); + const OUString& rID, const OUString& rUIXMLDescription); virtual ~HelpTabPage_Impl() override; }; @@ -201,7 +201,7 @@ private: DECL_LINK(CommandHdl, const CommandEvent&, bool); DECL_LINK(KeyInputHdl, const KeyEvent&, bool); - void DoAction(std::string_view rAction); + void DoAction(std::u16string_view rAction); public: BookmarksTabPage_Impl(weld::Widget* pParent, SfxHelpIndexWindow_Impl* pIdxWin); @@ -243,14 +243,14 @@ private: void Initialize(); void SetActiveFactory(); - HelpTabPage_Impl* GetPage(std::string_view ); + HelpTabPage_Impl* GetPage(std::u16string_view ); inline ContentTabPage_Impl* GetContentPage(); inline IndexTabPage_Impl* GetIndexPage(); inline SearchTabPage_Impl* GetSearchPage(); inline BookmarksTabPage_Impl* GetBookmarksPage(); - DECL_LINK(ActivatePageHdl, const OString&, void); + DECL_LINK(ActivatePageHdl, const OUString&, void); DECL_LINK(SelectHdl, weld::ComboBox&, void); DECL_LINK(InitHdl, Timer *, void); DECL_LINK(SelectFactoryHdl, Timer *, void); @@ -398,7 +398,7 @@ public: const css::uno::Reference < css::frame::XFrame2 >& getFrame() const { return xFrame; } - void SetSelectHdl(const Link<const OString&, void>& rLink) { xToolBox->connect_clicked(rLink); } + void SetSelectHdl(const Link<const OUString&, void>& rLink) { xToolBox->connect_clicked(rLink); } void ToggleIndex( bool bOn ); void SelectSearchText( const OUString& rSearchText, bool _bIsFullWordSearch ); void SetPageStyleHeaderOff() const; @@ -449,7 +449,7 @@ friend class SfxHelpIndexWindow_Impl; void ShowStartPage(); void Split(); - DECL_LINK(SelectHdl, const OString&, void); + DECL_LINK(SelectHdl, const OUString&, void); DECL_LINK(OpenHdl, LinkParamNone*, void); DECL_LINK(SelectFactoryHdl, SfxHelpIndexWindow_Impl*, void); DECL_LINK(ChangeHdl, HelpListener_Impl&, void); @@ -469,7 +469,7 @@ public: void SetFactory( const OUString& rFactory ); void SetHelpURL( std::u16string_view rURL ); - void DoAction(std::string_view rAction); + void DoAction(std::u16string_view rAction); void CloseWindow(); weld::Container* GetContainer() { return m_xHelpTextWindow.get(); } diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index d49c76e822a8..72124835a410 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -588,7 +588,7 @@ OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* p OUString sRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand(aProperties); OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? aCommandURL : sRealCommand, sModuleName ); - OString aNewHelpId; + OUString aNewHelpId; if (pWindow && sHelpText.isEmpty()) { @@ -597,7 +597,7 @@ OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* p while ( pParent ) { aNewHelpId = pParent->GetHelpId(); - sHelpText = SfxHelp_Impl::GetHelpText( OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8), sModuleName ); + sHelpText = SfxHelp_Impl::GetHelpText( aNewHelpId, sModuleName ); if (!sHelpText.isEmpty()) pParent = nullptr; else @@ -615,8 +615,7 @@ OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* p sModuleName + ": " + aCommandURL; if ( !aNewHelpId.isEmpty() ) { - sHelpText += " - " + - OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8); + sHelpText += " - " + aNewHelpId; } } @@ -630,7 +629,7 @@ OUString SfxHelp::GetHelpText(const OUString& aCommandURL, const weld::Widget* p OUString sRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand(aProperties); OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? aCommandURL : sRealCommand, sModuleName ); - OString aNewHelpId; + OUString aNewHelpId; if (pWidget && sHelpText.isEmpty()) { @@ -639,7 +638,7 @@ OUString SfxHelp::GetHelpText(const OUString& aCommandURL, const weld::Widget* p while (xParent) { aNewHelpId = xParent->get_help_id(); - sHelpText = SfxHelp_Impl::GetHelpText( OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8), sModuleName ); + sHelpText = SfxHelp_Impl::GetHelpText( aNewHelpId, sModuleName ); if (!sHelpText.isEmpty()) xParent.reset(); else @@ -657,8 +656,7 @@ OUString SfxHelp::GetHelpText(const OUString& aCommandURL, const weld::Widget* p sModuleName + ": " + aCommandURL; if ( !aNewHelpId.isEmpty() ) { - sHelpText += " - " + - OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8); + sHelpText += " - " + aNewHelpId; } } @@ -1079,8 +1077,8 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow) vcl::Window* pParent = pWindow->GetParent(); while ( pParent ) { - OString aHelpId = pParent->GetHelpId(); - aHelpURL = CreateHelpURL( OStringToOUString(aHelpId, RTL_TEXTENCODING_UTF8), aHelpModuleName ); + OUString aHelpId = pParent->GetHelpId(); + aHelpURL = CreateHelpURL( aHelpId, aHelpModuleName ); if ( !SfxContentHelper::IsHelpErrorDocument( aHelpURL ) ) { @@ -1253,10 +1251,10 @@ bool SfxHelp::Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUSt { bool bUseFinalFallback = true; // no help found -> try ids of parents. - pWidget->help_hierarchy_foreach([&aHelpModuleName, &aHelpURL, &bUseFinalFallback](const OString& rHelpId){ + pWidget->help_hierarchy_foreach([&aHelpModuleName, &aHelpURL, &bUseFinalFallback](const OUString& rHelpId){ if (rHelpId.isEmpty()) return false; - aHelpURL = CreateHelpURL( OStringToOUString(rHelpId, RTL_TEXTENCODING_UTF8), aHelpModuleName); + aHelpURL = CreateHelpURL(rHelpId, aHelpModuleName); bool bFinished = !SfxContentHelper::IsHelpErrorDocument(aHelpURL); if (bFinished) bUseFinalFallback = false; diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 5eb19de835ca..629ad3aa41df 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -1513,13 +1513,13 @@ SfxItemState SfxBindings::QueryState( sal_uInt16 nSlot, std::unique_ptr<SfxPoolI if ( xDisp.is() || !pCache ) { const SfxSlot* pSlot = SfxSlotPool::GetSlotPool( pDispatcher->GetFrame() ).GetSlot( nSlot ); - if ( !pSlot || !pSlot->pUnoName ) + if ( !pSlot || pSlot->pUnoName.isEmpty() ) return SfxItemState::DISABLED; css::util::URL aURL; OUString aCmd( ".uno:" ); aURL.Protocol = aCmd; - aURL.Path = OUString::createFromAscii(pSlot->GetUnoName()); + aURL.Path = pSlot->GetUnoName(); aCmd += aURL.Path; aURL.Complete = aCmd; aURL.Main = aCmd; diff --git a/sfx2/source/control/charwin.cxx b/sfx2/source/control/charwin.cxx index 39f473ce47b9..f0c687082c9a 100644 --- a/sfx2/source/control/charwin.cxx +++ b/sfx2/source/control/charwin.cxx @@ -118,11 +118,11 @@ void SvxCharView::createContextMenu() Invalidate(); } -void SvxCharView::ContextMenuSelect(std::string_view rMenuId) +void SvxCharView::ContextMenuSelect(std::u16string_view rMenuId) { - if (rMenuId == "clearchar") + if (rMenuId == u"clearchar") maClearClickHdl.Call(this); - else if (rMenuId == "clearallchar") + else if (rMenuId == u"clearallchar") maClearAllClickHdl.Call(this); } diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 8cd0ec2c2fb3..f9b8ac53ea66 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1749,7 +1749,7 @@ boost::property_tree::ptree fillPopupMenu(Menu* pMenu) { const SfxSlot *pSlot = SFX_SLOTPOOL().GetSlot(nItemId); if (pSlot) - aCommandURL = pSlot->GetCommandString(); + aCommandURL = pSlot->GetCommand(); } const OUString aItemText = pMenu->GetItemText(nItemId); diff --git a/sfx2/source/control/msg.cxx b/sfx2/source/control/msg.cxx index c6ed821c1874..27a3d0abdd07 100644 --- a/sfx2/source/control/msg.cxx +++ b/sfx2/source/control/msg.cxx @@ -43,14 +43,9 @@ sal_uInt16 SfxSlot::GetWhich( const SfxItemPool &rPool ) const return nMasterSlotId; } -OString SfxSlot::GetCommand() const +OUString SfxSlot::GetCommand() const { - return OString::Concat(".uno:") + pUnoName; -} - -OUString SfxSlot::GetCommandString() const -{ - return OStringToOUString(GetCommand(), RTL_TEXTENCODING_UTF8); + return ".uno:" + pUnoName; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx index 5938b68f0b8d..ed4393fa45d3 100644 --- a/sfx2/source/control/objface.cxx +++ b/sfx2/source/control/objface.cxx @@ -209,8 +209,7 @@ const SfxSlot* SfxInterface::GetSlot( const OUString& rCommand ) const for ( sal_uInt16 n=0; n<nCount; n++ ) { - if ( (pSlots+n)->pUnoName && - aCommand.compareToIgnoreAsciiCaseAscii( (pSlots+n)->GetUnoName() ) == 0 ) + if ( aCommand.equalsIgnoreAsciiCase( (pSlots+n)->GetUnoName() ) ) return pSlots+n; } diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index 802fc3b34c9e..9279b5dceb5a 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -332,7 +332,7 @@ void SfxRequest_Impl::Record if(!xRecorder.is()) return; - OUString aCmd = ".uno:" + OUString::createFromAscii( pSlot->GetUnoName() ); + OUString aCmd = pSlot->GetCommand(); uno::Reference< container::XIndexReplace > xReplace( xRecorder, uno::UNO_QUERY ); if ( xReplace.is() && aCmd == ".uno:InsertText" ) @@ -573,10 +573,10 @@ void SfxRequest::Done_Impl // recordable? // new Recording uses UnoName! - SAL_WARN_IF( !pImpl->pSlot->pUnoName, "sfx", "Recording not exported slot: " + SAL_WARN_IF( pImpl->pSlot->pUnoName.isEmpty(), "sfx", "Recording not exported slot: " << pImpl->pSlot->GetSlotId() ); - if ( !pImpl->pSlot->pUnoName ) // playing it safe + if ( pImpl->pSlot->pUnoName.isEmpty() ) // playing it safe return; // often required values diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index cf1e8092371b..5bbeb01d92cd 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -565,21 +565,15 @@ void SfxShell::SetVerbs(const css::uno::Sequence < css::embed::VerbDescriptor >& if (nSlotId > SID_VERB_END) break; - SfxSlot *pNewSlot = new SfxSlot; - pNewSlot->nSlotId = nSlotId; - pNewSlot->nGroupId = SfxGroupId::NONE; - - // Verb slots must be executed asynchronously, so that they can be - // destroyed while executing. - pNewSlot->nFlags = SfxSlotMode::ASYNCHRON | SfxSlotMode::CONTAINER; - pNewSlot->nMasterSlotId = 0; - pNewSlot->nValue = 0; - pNewSlot->fnExec = SFX_STUB_PTR(SfxShell,VerbExec); - pNewSlot->fnState = SFX_STUB_PTR(SfxShell,VerbState); - pNewSlot->pType = nullptr; // HACK(SFX_TYPE(SfxVoidItem)) ??? - pNewSlot->nArgDefCount = 0; - pNewSlot->pFirstArgDef = nullptr; - pNewSlot->pUnoName = nullptr; + SfxSlot* pNewSlot = new SfxSlot( + nSlotId, SfxGroupId::NONE, + // Verb slots must be executed asynchronously, so that they can be + // destroyed while executing. + SfxSlotMode::ASYNCHRON | SfxSlotMode::CONTAINER, + 0, 0, + SFX_STUB_PTR(SfxShell, VerbExec), SFX_STUB_PTR(SfxShell, VerbState), + nullptr, // HACK(SFX_TYPE(SfxVoidItem)) ??? + nullptr, nullptr, 0, SfxDisableFlags::NONE, ""); if (!pImpl->aSlotArr.empty()) { diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index ee20d38c5d81..03f1daa5a370 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -242,7 +242,7 @@ const SfxSlotServer* SfxStateCache::GetSlotServer( SfxDispatcher &rDispat , cons // get the slot - even if it is disabled on the dispatcher pSlot = SfxSlotPool::GetSlotPool( rDispat.GetFrame() ).GetSlot( nId ); - if ( !pSlot || !pSlot->pUnoName ) + if ( !pSlot || pSlot->pUnoName.isEmpty() ) { bSlotDirty = false; bCtrlDirty = true; @@ -253,7 +253,7 @@ const SfxSlotServer* SfxStateCache::GetSlotServer( SfxDispatcher &rDispat , cons css::util::URL aURL; OUString aCmd = ".uno:"; aURL.Protocol = aCmd; - aURL.Path = OUString::createFromAscii( pSlot->GetUnoName() ); + aURL.Path = pSlot->GetUnoName(); aCmd += aURL.Path; aURL.Complete = aCmd; aURL.Main = aCmd; diff --git a/sfx2/source/control/templatedlglocalview.cxx b/sfx2/source/control/templatedlglocalview.cxx index 6aefe5d5acf2..b469ea716dc8 100644 --- a/sfx2/source/control/templatedlglocalview.cxx +++ b/sfx2/source/control/templatedlglocalview.cxx @@ -136,13 +136,13 @@ void TemplateDlgLocalView::createContextMenu(const bool bIsDefault, const bool b mxTreeView.get(), tools::Rectangle(maPosition, Size(1, 1)))); } -void TemplateDlgLocalView::ContextMenuSelectHdl(std::string_view rIdent) +void TemplateDlgLocalView::ContextMenuSelectHdl(std::u16string_view rIdent) { - if (rIdent == "open") + if (rIdent == u"open") maOpenTemplateHdl.Call(maSelectedItem); - else if (rIdent == "edit") + else if (rIdent == u"edit") maEditTemplateHdl.Call(maSelectedItem); - else if (rIdent == "rename") + else if (rIdent == u"rename") { InputDialog aTitleEditDlg(GetDrawingArea(), SfxResId(STR_RENAME_TEMPLATE)); aTitleEditDlg.set_title(SfxResId(STR_WINDOW_TITLE_RENAME_TEMPLATE)); @@ -178,7 +178,7 @@ void TemplateDlgLocalView::ContextMenuSelectHdl(std::string_view rIdent) ListView::rename(OUString::number(maSelectedItem->mnId), maSelectedItem->maTitle); } } - else if (rIdent == "delete") + else if (rIdent == u"delete") { std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog( GetDrawingArea(), VclMessageType::Question, VclButtonsType::YesNo, @@ -189,16 +189,16 @@ void TemplateDlgLocalView::ContextMenuSelectHdl(std::string_view rIdent) maDeleteTemplateHdl.Call(maSelectedItem); reload(); } - else if (rIdent == "default") + else if (rIdent == u"default") { maDefaultTemplateHdl.Call(maSelectedItem); ListView::refreshDefaultColumn(); } - else if (rIdent == "move") + else if (rIdent == u"move") { maMoveTemplateHdl.Call(maSelectedItem); } - else if (rIdent == "export") + else if (rIdent == u"export") { maExportTemplateHdl.Call(maSelectedItem); } diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx index a223b62e128a..bd5fd7f649c2 100644 --- a/sfx2/source/control/templatelocalview.cxx +++ b/sfx2/source/control/templatelocalview.cxx @@ -193,13 +193,13 @@ TemplateContainerItem* TemplateLocalView::getRegion(std::u16string_view rName) return nullptr; } -void TemplateLocalView::ContextMenuSelectHdl(std::string_view rIdent) +void TemplateLocalView::ContextMenuSelectHdl(std::u16string_view rIdent) { - if (rIdent == "open") + if (rIdent == u"open") maOpenTemplateHdl.Call(maSelectedItem); - else if (rIdent == "edit") + else if (rIdent == u"edit") maEditTemplateHdl.Call(maSelectedItem); - else if (rIdent == "rename") + else if (rIdent == u"rename") { InputDialog aTitleEditDlg(GetDrawingArea(), SfxResId(STR_RENAME_TEMPLATE)); OUString sOldTitle = maSelectedItem->getTitle(); @@ -233,7 +233,7 @@ void TemplateLocalView::ContextMenuSelectHdl(std::string_view rIdent) maSelectedItem->setTitle(sNewTitle); } } - else if (rIdent == "delete") + else if (rIdent == u"delete") { std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetDrawingArea(), VclMessageType::Question, VclButtonsType::YesNo, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE))); @@ -243,7 +243,7 @@ void TemplateLocalView::ContextMenuSelectHdl(std::string_view rIdent) maDeleteTemplateHdl.Call(maSelectedItem); reload(); } - else if (rIdent == "default") + else if (rIdent == u"default") maDefaultTemplateHdl.Call(maSelectedItem); } diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 346528d4b0d9..e329e746881e 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -335,9 +335,9 @@ SfxDispatchController_Impl::SfxDispatchController_Impl( , bMasterSlave( false ) , bVisible( true ) { - if ( aDispatchURL.Protocol == "slot:" && pSlot->pUnoName ) + if ( aDispatchURL.Protocol == "slot:" && !pSlot->pUnoName.isEmpty() ) { - aDispatchURL.Complete = ".uno:" + OUString::createFromAscii(pSlot->pUnoName); + aDispatchURL.Complete = pSlot->GetCommand(); Reference< XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aDispatchURL ); } @@ -655,7 +655,7 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, sal_Int32 nIndex = lNewArgs.getLength(); lNewArgs.realloc( nIndex+1 ); auto plNewArgs = lNewArgs.getArray(); - plNewArgs[nIndex].Name = OUString::createFromAscii( pSlot->pUnoName ); + plNewArgs[nIndex].Name = pSlot->pUnoName; plNewArgs[nIndex].Value <<= SfxDispatchController_Impl::getSlaveCommand( aDispatchURL ); } diff --git a/sfx2/source/devtools/DevelopmentToolDockingWindow.cxx b/sfx2/source/devtools/DevelopmentToolDockingWindow.cxx index de0950a7edaf..0095e3396cf8 100644 --- a/sfx2/source/devtools/DevelopmentToolDockingWindow.cxx +++ b/sfx2/source/devtools/DevelopmentToolDockingWindow.cxx @@ -69,7 +69,8 @@ IMPL_LINK(DevelopmentToolDockingWindow, DocumentModelTreeViewSelectionHandler, w maObjectInspectorTreeHandler.introspect(xObject); } -IMPL_LINK(DevelopmentToolDockingWindow, DomToolbarButtonClicked, const OString&, rSelectionId, void) +IMPL_LINK(DevelopmentToolDockingWindow, DomToolbarButtonClicked, const OUString&, rSelectionId, + void) { if (rSelectionId == "dom_refresh_button") { diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx index 53d4d8b08bab..d99fa2388f99 100644 --- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx +++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx @@ -1113,7 +1113,7 @@ IMPL_LINK(ObjectInspectorTreeHandler, PopupMenuHandler, const CommandEvent&, rCo mpObjectInspectorWidgets->mpPropertiesTreeView.get(), "sfx/ui/devtoolsmenu.ui")); std::unique_ptr<weld::Menu> xMenu(xBuilder->weld_menu("inspect_menu")); - OString sCommand( + OUString sCommand( xMenu->popup_at_rect(mpObjectInspectorWidgets->mpPropertiesTreeView.get(), tools::Rectangle(rCommandEvent.GetMousePosPixel(), Size(1, 1)))); @@ -1126,7 +1126,7 @@ IMPL_LINK(ObjectInspectorTreeHandler, PopupMenuHandler, const CommandEvent&, rCo return true; } -IMPL_LINK(ObjectInspectorTreeHandler, ToolbarButtonClicked, const OString&, rSelectionId, void) +IMPL_LINK(ObjectInspectorTreeHandler, ToolbarButtonClicked, const OUString&, rSelectionId, void) { if (rSelectionId == "inspect") { @@ -1153,7 +1153,7 @@ IMPL_LINK(ObjectInspectorTreeHandler, ToolbarButtonClicked, const OString&, rSel } } -IMPL_LINK(ObjectInspectorTreeHandler, NotebookEnterPage, const OString&, rPageId, void) +IMPL_LINK(ObjectInspectorTreeHandler, NotebookEnterPage, const OUString&, rPageId, void) { uno::Any aAny = maInspectionStack.back(); if (!aAny.hasValue()) @@ -1190,7 +1190,7 @@ IMPL_LINK(ObjectInspectorTreeHandler, NotebookEnterPage, const OString&, rPageId } } -IMPL_LINK(ObjectInspectorTreeHandler, NotebookLeavePage, const OString&, rPageId, bool) +IMPL_LINK(ObjectInspectorTreeHandler, NotebookLeavePage, const OUString&, rPageId, bool) { if (rPageId == "object_inspector_interfaces_tab") { diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx index c34bdf1e2aa1..be63cb5c6e31 100644 --- a/sfx2/source/dialog/StyleList.cxx +++ b/sfx2/source/dialog/StyleList.cxx @@ -94,7 +94,7 @@ public: StyleList::StyleList(weld::Builder* pBuilder, SfxBindings* pBindings, SfxCommonTemplateDialog_Impl* Parent, weld::Container* pC, - OString treeviewname, OString flatviewname) + OUString treeviewname, OUString flatviewname) : m_bHierarchical(false) , m_bAllowReParentDrop(false) , m_bNewByExampleDisabled(false) @@ -289,7 +289,7 @@ void StyleList::FilterSelect(sal_uInt16 nActFilter, bool bsetFilter) IMPL_LINK(StyleList, SetFamily, sal_uInt16, nId, void) { if (m_nActFamily != 0xFFFF) - m_pParentDialog->CheckItem(OString::number(m_nActFamily), false); + m_pParentDialog->CheckItem(OUString::number(m_nActFamily), false); m_nActFamily = nId; if (nId != 0xFFFF) { @@ -1339,12 +1339,12 @@ void StyleList::ShowMenu(const CommandEvent& rCEvt) { CreateContextMenu(); weld::TreeView* pTreeView = m_xTreeBox->get_visible() ? m_xTreeBox.get() : m_xFmtLb.get(); - OString sCommand( + OUString sCommand( mxMenu->popup_at_rect(pTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1)))); MenuSelect(sCommand); } -void StyleList::MenuSelect(const OString& rIdent) +void StyleList::MenuSelect(const OUString& rIdent) { sLastItemIdent = rIdent; if (sLastItemIdent.isEmpty()) @@ -1670,7 +1670,7 @@ void StyleList::Update() // current region not within the allowed region or default if (m_nActFamily == 0xffff || nullptr == (pItem = m_pFamilyState[m_nActFamily - 1].get())) { - m_pParentDialog->CheckItem(OString::number(m_nActFamily), false); + m_pParentDialog->CheckItem(OUString::number(m_nActFamily), false); const size_t nFamilyCount = m_xStyleFamilies->size(); size_t n; for (n = 0; n < nFamilyCount; n++) @@ -1685,7 +1685,7 @@ void StyleList::Update() else if (bDocChanged) { // other DocShell -> all new - m_pParentDialog->CheckItem(OString::number(m_nActFamily)); + m_pParentDialog->CheckItem(OUString::number(m_nActFamily)); m_nActFilter = static_cast<sal_uInt16>(m_aLoadFactoryStyleFilter.Call(pDocShell)); m_pParentDialog->IsUpdate(*this); if (0xffff == m_nActFilter) @@ -1704,7 +1704,7 @@ void StyleList::Update() else { // other filters for automatic - m_pParentDialog->CheckItem(OString::number(m_nActFamily)); + m_pParentDialog->CheckItem(OUString::number(m_nActFamily)); const SfxStyleFamilyItem* pStyleItem = GetFamilyItem(); if (pStyleItem && SfxStyleSearchBits::Auto == pStyleItem->GetFilterList()[m_nActFilter].nFlags diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index d7889dd87913..fbae5e1af221 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -210,7 +210,7 @@ BackingWindow::BackingWindow(vcl::Window* i_pParent) IMPL_LINK(BackingWindow, ClickHelpHdl, weld::Button&, rButton, void) { if (Help* pHelp = Application::GetHelp()) - pHelp->Start(OUString::fromUtf8(m_xContainer->get_help_id()), &rButton); + pHelp->Start(m_xContainer->get_help_id(), &rButton); } BackingWindow::~BackingWindow() @@ -643,7 +643,7 @@ IMPL_LINK( BackingWindow, ClickHdl, weld::Button&, rButton, void ) } } -IMPL_LINK (BackingWindow, MenuSelectHdl, const OString&, rId, void) +IMPL_LINK (BackingWindow, MenuSelectHdl, const OUString&, rId, void) { if (rId == "clear_all") { diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx index 2bd2e04e87a1..af31e250d723 100644 --- a/sfx2/source/dialog/backingwindow.hxx +++ b/sfx2/source/dialog/backingwindow.hxx @@ -94,7 +94,7 @@ class BackingWindow : public InterimItemWindow DECL_LINK(FilterHdl, weld::ComboBox&, void); DECL_LINK(ClickHdl, weld::Button&, void); DECL_LINK(ClickHelpHdl, weld::Button&, void); - DECL_LINK(MenuSelectHdl, const OString&, void); + DECL_LINK(MenuSelectHdl, const OUString&, void); DECL_LINK(ExtLinkClickHdl, weld::Button&, void); DECL_LINK(CreateContextMenuHdl, ThumbnailViewItem*, void); DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*, void); diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index ab976093025a..285c3b5b526e 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -38,7 +38,7 @@ constexpr OUStringLiteral USERITEM_NAME = u"UserItem"; class SfxModelessDialog_Impl : public SfxListener { public: - OString aWinState; + OUString aWinState; SfxChildWindow* pMgr; bool bClosing; void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; @@ -74,7 +74,7 @@ void SfxModelessDialogController::Initialize(SfxChildWinInfo const *pInfo) SfxModelessDialogController::SfxModelessDialogController(SfxBindings* pBindinx, SfxChildWindow *pCW, weld::Window *pParent, const OUString& rUIXMLDescription, - const OString& rID) + const OUString& rID) : SfxDialogController(pParent, rUIXMLDescription, rID) { Init(pBindinx, pCW); @@ -201,7 +201,7 @@ void SfxModelessDialogController::Close() } SfxDialogController::SfxDialogController(weld::Widget* pParent, const OUString& rUIFile, - const OString& rDialogId) + const OUString& rDialogId) : GenericDialogController(pParent, rUIFile, rDialogId, comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() @@ -223,7 +223,7 @@ IMPL_STATIC_LINK_NOARG(SfxDialogController, InstallLOKNotifierHdl, void*, vcl::I } SfxSingleTabDialogController::SfxSingleTabDialogController(weld::Widget *pParent, const SfxItemSet* pSet, - const OUString& rUIXMLDescription, const OString& rID) + const OUString& rUIXMLDescription, const OUString& rID) : SfxOkDialogController(pParent, rUIXMLDescription, rID) , m_pInputSet(pSet) , m_xContainer(m_xDialog->weld_content_area()) @@ -250,7 +250,7 @@ void SfxSingleTabDialogController::SetTabPage(std::unique_ptr<SfxTabPage> xTabPa return; // First obtain the user data, only then Reset() - OUString sConfigId = OStringToOUString(m_xSfxPage->GetConfigId(), RTL_TEXTENCODING_UTF8); + OUString sConfigId = m_xSfxPage->GetConfigId(); SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId); Any aUserItem = aPageOpt.GetUserItem( USERITEM_NAME ); OUString sUserData; @@ -266,7 +266,7 @@ void SfxSingleTabDialogController::SetTabPage(std::unique_ptr<SfxTabPage> xTabPa m_xDialog->set_title(sTitle); // Dialog receives the HelpId of TabPage if there is any - OString sHelpId(m_xSfxPage->GetHelpId()); + OUString sHelpId(m_xSfxPage->GetHelpId()); if (!sHelpId.isEmpty()) m_xDialog->set_help_id(sHelpId); } @@ -309,8 +309,7 @@ IMPL_LINK_NOARG(SfxSingleTabDialogController, OKHdl_Impl, weld::Button&, void) m_xSfxPage->FillUserData(); OUString sData(m_xSfxPage->GetUserData()); - OUString sConfigId = OStringToOUString(m_xSfxPage->GetConfigId(), - RTL_TEXTENCODING_UTF8); + OUString sConfigId = m_xSfxPage->GetConfigId(); SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId); aPageOpt.SetUserItem( USERITEM_NAME, Any( sData ) ); m_xDialog->response(RET_OK); diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 3067229b96eb..ece02823fd37 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1211,7 +1211,7 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog(weld::Window* pParent, const SfxIte RemoveTabPage("security"); } -void SfxDocumentInfoDialog::PageCreated(const OString& rId, SfxTabPage &rPage) +void SfxDocumentInfoDialog::PageCreated(const OUString& rId, SfxTabPage &rPage) { if (rId == "general") static_cast<SfxDocumentPage&>(rPage).EnableUseUserData(); @@ -1568,13 +1568,13 @@ void CustomPropertiesWindow::CreateNewLine() // for ui-testing. Distinguish the elements in the lines sal_uInt16 nSize = m_aCustomPropertiesLines.size(); pNewLine->m_xNameBox->set_buildable_name( - pNewLine->m_xNameBox->get_buildable_name() + OString::number(nSize)); + pNewLine->m_xNameBox->get_buildable_name() + OUString::number(nSize)); pNewLine->m_xTypeBox->set_buildable_name( - pNewLine->m_xTypeBox->get_buildable_name() + OString::number(nSize)); + pNewLine->m_xTypeBox->get_buildable_name() + OUString::number(nSize)); pNewLine->m_xValueEdit->set_buildable_name( - pNewLine->m_xValueEdit->get_buildable_name() + OString::number(nSize)); + pNewLine->m_xValueEdit->get_buildable_name() + OUString::number(nSize)); pNewLine->m_xRemoveButton->set_buildable_name( - pNewLine->m_xRemoveButton->get_buildable_name() + OString::number(nSize)); + pNewLine->m_xRemoveButton->get_buildable_name() + OUString::number(nSize)); } pNewLine->DoTypeHdl(*pNewLine->m_xTypeBox); diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index ce37aa53ec8d..dcf50ee5d304 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -389,7 +389,7 @@ friend class SfxDockingWindow; sal_uInt16 nDockPos; bool bNewLine; bool bDockingPrevented; - OString aWinState; + OUString aWinState; explicit SfxDockingWindow_Impl(SfxDockingWindow *pBase); SfxChildAlignment GetLastAlignment() const @@ -760,7 +760,7 @@ SfxDockingWindow::SfxDockingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW, required because the docking is implemented in Sfx through SfxChildWindows. */ SfxDockingWindow::SfxDockingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW, - vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription) + vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription) : ResizableDockingWindow(pParent) , pBindings(pBindinx) , pMgr(pCW) diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 541d26a9ae29..1cab715a79ff 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -211,7 +211,7 @@ OUString FileDialogHelper_Impl::handleHelpRequested( const FilePickerEvent& aEve { //!!! todo: cache the help strings (here or TRA) - OString sHelpId; + OUString sHelpId; // mapping from element id -> help id switch ( aEvent.ElementId ) { @@ -274,7 +274,7 @@ OUString FileDialogHelper_Impl::handleHelpRequested( const FilePickerEvent& aEve OUString aHelpText; Help* pHelp = Application::GetHelp(); if ( pHelp ) - aHelpText = pHelp->GetHelpText(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), static_cast<weld::Widget*>(nullptr)); + aHelpText = pHelp->GetHelpText(sHelpId, static_cast<weld::Widget*>(nullptr)); return aHelpText; } diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index 3eeb41b98e32..5bcb8b7e9a69 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -340,7 +340,7 @@ void SfxInfoBarWindow::Update(const OUString& sPrimaryMessage, const OUString& s Invalidate(); } -IMPL_LINK_NOARG(SfxInfoBarWindow, CloseHandler, const OString&, void) +IMPL_LINK_NOARG(SfxInfoBarWindow, CloseHandler, const OUString&, void) { static_cast<SfxInfoBarContainerWindow*>(GetParent())->removeInfoBar(this); } diff --git a/sfx2/source/dialog/styledlg.cxx b/sfx2/source/dialog/styledlg.cxx index 786a6401a62b..2384e2471fb0 100644 --- a/sfx2/source/dialog/styledlg.cxx +++ b/sfx2/source/dialog/styledlg.cxx @@ -33,7 +33,7 @@ SfxStyleDialogController::SfxStyleDialogController ( weld::Window* pParent, // Parent - const OUString& rUIXMLDescription, const OString& rID, + const OUString& rUIXMLDescription, const OUString& rID, SfxStyleSheetBase& rStyle // stylesheet to be processed ) : SfxTabDialogController(pParent, rUIXMLDescription, rID, &rStyle.GetItemSet(), true) @@ -86,7 +86,7 @@ short SfxStyleDialogController::Ok() */ IMPL_LINK_NOARG(SfxStyleDialogController, CancelHdl, weld::Button&, void) { - SfxTabPage* pPage = GetTabPage("organizer"); + SfxTabPage* pPage = GetTabPage(u"organizer"); const SfxItemSet* pInSet = GetInputSetImpl(); SfxWhichIter aIter(*pInSet); diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index beb0ebc73518..ce79cfd2d676 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -55,14 +55,14 @@ namespace { struct Data_Impl { - OString sId; // The ID + OUString sId; // The ID CreateTabPage fnCreatePage; // Pointer to Factory GetTabPageRanges fnGetRanges; // Pointer to Ranges-Function std::unique_ptr<SfxTabPage> xTabPage; // The TabPage itself bool bRefresh; // Flag: Page must be re-initialized // Constructor - Data_Impl( const OString& rId, CreateTabPage fnPage, + Data_Impl( const OUString& rId, CreateTabPage fnPage, GetTabPageRanges fnRanges ) : sId ( rId ), @@ -106,7 +106,7 @@ struct TabDlg_Impl } }; -static Data_Impl* Find( const SfxTabDlgData_Impl& rArr, std::string_view rId, sal_uInt16* pPos = nullptr) +static Data_Impl* Find( const SfxTabDlgData_Impl& rArr, std::u16string_view rId, sal_uInt16* pPos = nullptr) { const sal_uInt16 nCount = rArr.size(); @@ -137,7 +137,7 @@ css::uno::Reference< css::frame::XFrame > SfxTabPage::GetFrame() const return css::uno::Reference< css::frame::XFrame >(); } -SfxTabPage::SfxTabPage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet *rAttrSet) +SfxTabPage::SfxTabPage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OUString& rID, const SfxItemSet *rAttrSet) : BuilderPage(pPage, pController, rUIXMLDescription, rID, comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() && SfxViewShell::Current()->isLOKMobilePhone()) @@ -286,11 +286,11 @@ SfxOkDialogController* SfxTabPage::GetDialogController() const return pImpl->mpSfxDialogController; } -OString SfxTabPage::GetHelpId() const +OUString SfxTabPage::GetHelpId() const { if (m_xContainer) return m_xContainer->get_help_id(); - return OString(); + return {}; } weld::Window* SfxTabPage::GetFrameWeld() const @@ -310,7 +310,7 @@ const SfxItemSet* SfxTabPage::GetDialogExampleSet() const SfxTabDialogController::SfxTabDialogController ( weld::Widget* pParent, // Parent Window - const OUString& rUIXMLDescription, const OString& rID, // Dialog .ui path, Dialog Name + const OUString& rUIXMLDescription, const OUString& rID, // Dialog .ui path, Dialog Name const SfxItemSet* pItemSet, // Itemset with the data; // can be NULL, when Pages are onDemand bool bEditFmt // when yes -> additional Button for standard @@ -509,12 +509,12 @@ IMPL_LINK_NOARG(SfxTabDialogController, BaseFmtHdl, weld::Button&, void) pDataObject->xTabPage->pImpl->mbStandard = true; } -IMPL_LINK(SfxTabDialogController, ActivatePageHdl, const OString&, rPage, void) +IMPL_LINK(SfxTabDialogController, ActivatePageHdl, const OUString&, rPage, void) { ActivatePage(rPage); } -void SfxTabDialogController::ActivatePage(const OString& rPage) +void SfxTabDialogController::ActivatePage(const OUString& rPage) /* [Description] Handler that is called by StarView for switching to a different page. @@ -548,12 +548,12 @@ void SfxTabDialogController::ActivatePage(const OString& rPage) m_xResetBtn->show(); } -IMPL_LINK(SfxTabDialogController, DeactivatePageHdl, const OString&, rPage, bool) +IMPL_LINK(SfxTabDialogController, DeactivatePageHdl, const OUString&, rPage, bool) { return DeactivatePage(rPage); } -bool SfxTabDialogController::DeactivatePage(std::string_view aPage) +bool SfxTabDialogController::DeactivatePage(std::u16string_view aPage) /* [Description] Handler that is called by StarView before leaving a page. @@ -626,7 +626,7 @@ bool SfxTabDialogController::DeactivatePage(std::string_view aPage) bool SfxTabDialogController::PrepareLeaveCurrentPage() { - const OString sId = m_xTabCtrl->get_current_page_ident(); + const OUString sId = m_xTabCtrl->get_current_page_ident(); Data_Impl* pDataObject = Find(m_pImpl->aData, sId); DBG_ASSERT( pDataObject, "Id not known" ); SfxTabPage* pPage = pDataObject ? pDataObject->xTabPage.get() : nullptr; @@ -725,9 +725,7 @@ SfxTabDialogController::~SfxTabDialogController() if ( !aPageData.isEmpty() ) { // save settings of all pages (user data) - OUString sConfigId = OStringToOUString(elem->xTabPage->GetConfigId(), - RTL_TEXTENCODING_UTF8); - SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId); + SvtViewOptions aPageOpt(EViewType::TabPage, elem->xTabPage->GetConfigId()); aPageOpt.SetUserItem( USERITEM_NAME, Any( aPageData ) ); } @@ -821,7 +819,7 @@ void SfxTabDialogController::PageCreated */ ( - const OString&, // Id of the created page + const OUString&, // Id of the created page SfxTabPage& // Reference to the created page ) { @@ -830,7 +828,7 @@ void SfxTabDialogController::PageCreated void SfxTabDialogController::SavePosAndId() { // save settings (screen position and current page) - SvtViewOptions aDlgOpt(EViewType::TabDialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + SvtViewOptions aDlgOpt(EViewType::TabDialog, m_xDialog->get_help_id()); aDlgOpt.SetPageID(m_xTabCtrl->get_current_page_ident()); } @@ -838,14 +836,14 @@ void SfxTabDialogController::SavePosAndId() Adds a page to the dialog. The Name must correspond to an entry in the TabControl in the dialog .ui */ -void SfxTabDialogController::AddTabPage(const OString &rName /* Page ID */, +void SfxTabDialogController::AddTabPage(const OUString &rName /* Page ID */, CreateTabPage pCreateFunc /* Pointer to the Factory Method */, GetTabPageRanges pRangesFunc /* Pointer to the Method for querying Ranges onDemand */) { m_pImpl->aData.push_back(new Data_Impl(rName, pCreateFunc, pRangesFunc)); } -void SfxTabDialogController::AddTabPage(const OString &rName /* Page ID */, +void SfxTabDialogController::AddTabPage(const OUString &rName /* Page ID */, sal_uInt16 nPageCreateId /* Identifier of the Factory Method to create the page */) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); @@ -860,7 +858,7 @@ void SfxTabDialogController::AddTabPage(const OString &rName /* Page ID */, counterpart in the TabControl in the resource of the dialogue. */ -void SfxTabDialogController::AddTabPage(const OString &rName, /* Page ID */ +void SfxTabDialogController::AddTabPage(const OUString &rName, /* Page ID */ const OUString& rRiderText, CreateTabPage pCreateFunc /* Pointer to the Factory Method */) { @@ -869,7 +867,7 @@ void SfxTabDialogController::AddTabPage(const OString &rName, /* Page ID */ AddTabPage(rName, pCreateFunc, nullptr); } -void SfxTabDialogController::AddTabPage(const OString &rName, const OUString& rRiderText, +void SfxTabDialogController::AddTabPage(const OUString &rName, const OUString& rRiderText, sal_uInt16 nPageCreateId /* Identifier of the Factory Method to create the page */) { assert(!m_xTabCtrl->get_page(rName) && "Double Page-Ids in the Tabpage"); @@ -882,7 +880,7 @@ void SfxTabDialogController::AddTabPage(const OString &rName, const OUString& rR Default implementation of the virtual Method. This is called when pages create their sets onDemand. */ -SfxItemSet* SfxTabDialogController::CreateInputItemSet(const OString&) +SfxItemSet* SfxTabDialogController::CreateInputItemSet(const OUString&) { SAL_WARN( "sfx.dialog", "CreateInputItemSet not implemented" ); m_xItemSet = std::make_unique<SfxAllItemSet>(SfxGetpApp()->GetPool()); @@ -901,8 +899,7 @@ void SfxTabDialogController::CreatePages() else pDataObject->xTabPage = (pDataObject->fnCreatePage)(pPage, this, CreateInputItemSet(pDataObject->sId)); pDataObject->xTabPage->SetDialogController(this); - OUString sConfigId = OStringToOUString(pDataObject->xTabPage->GetConfigId(), RTL_TEXTENCODING_UTF8); - SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId); + SvtViewOptions aPageOpt(EViewType::TabPage, pDataObject->xTabPage->GetConfigId()); OUString sUserData; Any aUserItem = aPageOpt.GetUserItem(USERITEM_NAME); OUString aTemp; @@ -948,7 +945,7 @@ void SfxTabDialogController::setPreviewsToSamePlace() m_xSizeGroup->add_widget(rGrid.get()); } -void SfxTabDialogController::RemoveTabPage(const OString& rId) +void SfxTabDialogController::RemoveTabPage(const OUString& rId) /* [Description] @@ -969,9 +966,7 @@ void SfxTabDialogController::RemoveTabPage(const OString& rId) if ( !aPageData.isEmpty() ) { // save settings of this page (user data) - OUString sConfigId = OStringToOUString(pDataObject->xTabPage->GetConfigId(), - RTL_TEXTENCODING_UTF8); - SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId); + SvtViewOptions aPageOpt(EViewType::TabPage, pDataObject->xTabPage->GetConfigId()); aPageOpt.SetUserItem( USERITEM_NAME, Any( aPageData ) ); } @@ -1000,7 +995,7 @@ void SfxTabDialogController::Start_Impl() // something that the sort dialog in calc depends on if (m_sAppPageId.isEmpty()) { - SvtViewOptions aDlgOpt(EViewType::TabDialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + SvtViewOptions aDlgOpt(EViewType::TabDialog, m_xDialog->get_help_id()); if (aDlgOpt.Exists()) m_xTabCtrl->set_current_page(aDlgOpt.GetPageID()); } @@ -1010,7 +1005,7 @@ void SfxTabDialogController::Start_Impl() m_pImpl->bStarted = true; } -void SfxTabDialogController::SetCurPageId(const OString& rIdent) +void SfxTabDialogController::SetCurPageId(const OUString& rIdent) { m_sAppPageId = rIdent; m_xTabCtrl->set_current_page(m_sAppPageId); @@ -1020,13 +1015,13 @@ void SfxTabDialogController::SetCurPageId(const OString& rIdent) The TabPage is activated with the specified Id. */ -void SfxTabDialogController::ShowPage(const OString& rIdent) +void SfxTabDialogController::ShowPage(const OUString& rIdent) { SetCurPageId(rIdent); ActivatePage(rIdent); } -OString SfxTabDialogController::GetCurPageId() const +OUString SfxTabDialogController::GetCurPageId() const { return m_xTabCtrl->get_current_page_ident(); } @@ -1085,7 +1080,7 @@ void SfxTabDialogController::RemoveStandardButton() m_xBaseFmtBtn->hide(); } -SfxTabPage* SfxTabDialogController::GetTabPage(std::string_view rPageId) const +SfxTabPage* SfxTabDialogController::GetTabPage(std::u16string_view rPageId) const /* [Description] @@ -1124,17 +1119,17 @@ bool SfxTabDialogController::Apply() return bApplied; } -std::vector<OString> SfxTabDialogController::getAllPageUIXMLDescriptions() const +std::vector<OUString> SfxTabDialogController::getAllPageUIXMLDescriptions() const { int nPages = m_xTabCtrl->get_n_pages(); - std::vector<OString> aRet; + std::vector<OUString> aRet; aRet.reserve(nPages); for (int i = 0; i < nPages; ++i) aRet.push_back(m_xTabCtrl->get_page_ident(i)); return aRet; } -bool SfxTabDialogController::selectPageByUIXMLDescription(const OString& rUIXMLDescription) +bool SfxTabDialogController::selectPageByUIXMLDescription(const OUString& rUIXMLDescription) { ShowPage(rUIXMLDescription); return m_xTabCtrl->get_current_page_ident() == rUIXMLDescription; @@ -1152,14 +1147,14 @@ BitmapEx SfxTabDialogController::createScreenshot() const return xDialogSurface->GetBitmapEx(Point(), xDialogSurface->GetOutputSizePixel()); } -OString SfxTabDialogController::GetScreenshotId() const +OUString SfxTabDialogController::GetScreenshotId() const { - const OString sId = m_xTabCtrl->get_current_page_ident(); + const OUString sId = m_xTabCtrl->get_current_page_ident(); Data_Impl* pDataObject = Find(m_pImpl->aData, sId); SfxTabPage* pPage = pDataObject ? pDataObject->xTabPage.get() : nullptr; if (pPage) { - OString sHelpId(pPage->GetHelpId()); + OUString sHelpId(pPage->GetHelpId()); if (!sHelpId.isEmpty()) return sHelpId; } diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index a0cc25da07c4..9001ee0740e1 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -271,7 +271,7 @@ IMPL_LINK(SfxCommonTemplateDialog_Impl, UpdateStyles_Hdl, StyleFlags, nFlags, vo if (nFlags & StyleFlags::UpdateFamily) // Update view type list (Hierarchical, All, etc. { - CheckItem(OString::number(nActFamily)); // check Button in Toolbox + CheckItem(OUString::number(nActFamily)); // check Button in Toolbox mxFilterLb->freeze(); mxFilterLb->clear(); @@ -522,13 +522,13 @@ void SfxCommonTemplateDialog_Impl::FamilySelect(sal_uInt16 nEntry, StyleList&, b assert((0 < nEntry && nEntry <= MAX_FAMILIES) || 0xffff == nEntry); if( nEntry != nActFamily || bPreviewRefresh ) { - CheckItem(OString::number(nActFamily), false); + CheckItem(OUString::number(nActFamily), false); nActFamily = nEntry; m_aStyleList.FamilySelect(nEntry); } } -void SfxCommonTemplateDialog_Impl::ActionSelect(const OString& rEntry, StyleList& rStyleList) +void SfxCommonTemplateDialog_Impl::ActionSelect(const OUString& rEntry, StyleList& rStyleList) { if (rEntry == "watercan") { @@ -715,13 +715,13 @@ void SfxTemplateDialog_Impl::Initialize() void SfxTemplateDialog_Impl::EnableFamilyItem(sal_uInt16 nId, bool bEnable) { - m_xActionTbL->set_item_sensitive(OString::number(nId), bEnable); + m_xActionTbL->set_item_sensitive(OUString::number(nId), bEnable); } // Insert element into dropdown filter "Frame Styles", "List Styles", etc. void SfxTemplateDialog_Impl::InsertFamilyItem(sal_uInt16 nId, const SfxStyleFamilyItem &rItem) { - OString sHelpId; + OUString sHelpId; switch( rItem.GetFamily() ) { case SfxStyleFamily::Char: sHelpId = ".uno:CharStyle"; break; @@ -733,7 +733,7 @@ void SfxTemplateDialog_Impl::InsertFamilyItem(sal_uInt16 nId, const SfxStyleFami default: OSL_FAIL("unknown StyleFamily"); break; } - OString sId(OString::number(nId)); + OUString sId(OUString::number(nId)); m_xActionTbL->set_item_visible(sId, true); m_xActionTbL->set_item_icon_name(sId, rItem.GetImage()); m_xActionTbL->set_item_tooltip_text(sId, rItem.GetText()); @@ -763,14 +763,14 @@ SfxTemplateDialog_Impl::~SfxTemplateDialog_Impl() m_xActionTbR.reset(); } -void SfxTemplateDialog_Impl::EnableItem(const OString& rMesId, bool bCheck) +void SfxTemplateDialog_Impl::EnableItem(const OUString& rMesId, bool bCheck) { if (rMesId == "watercan" && !bCheck && IsCheckedItem("watercan")) Execute_Impl(SID_STYLE_WATERCAN, "", "", 0, m_aStyleList); m_xActionTbR->set_item_sensitive(rMesId, bCheck); } -void SfxTemplateDialog_Impl::CheckItem(const OString &rMesId, bool bCheck) +void SfxTemplateDialog_Impl::CheckItem(const OUString &rMesId, bool bCheck) { if (rMesId == "watercan") { @@ -781,19 +781,19 @@ void SfxTemplateDialog_Impl::CheckItem(const OString &rMesId, bool bCheck) m_xActionTbL->set_item_active(rMesId, bCheck); } -bool SfxTemplateDialog_Impl::IsCheckedItem(const OString& rMesId) +bool SfxTemplateDialog_Impl::IsCheckedItem(const OUString& rMesId) { if (rMesId == "watercan") return m_xActionTbR->get_item_active("watercan"); return m_xActionTbL->get_item_active(rMesId); } -IMPL_LINK( SfxTemplateDialog_Impl, ToolBoxLSelect, const OString&, rEntry, void) +IMPL_LINK( SfxTemplateDialog_Impl, ToolBoxLSelect, const OUString&, rEntry, void) { FamilySelect(rEntry.toUInt32(), m_aStyleList); } -IMPL_LINK(SfxTemplateDialog_Impl, ToolBoxRSelect, const OString&, rEntry, void) +IMPL_LINK(SfxTemplateDialog_Impl, ToolBoxRSelect, const OUString&, rEntry, void) { if (rEntry == "newmenu") m_xActionTbR->set_menu_item_active(rEntry, !m_xActionTbR->get_menu_item_active(rEntry)); @@ -819,7 +819,7 @@ void SfxTemplateDialog_Impl::FillToolMenu() m_xToolMenu->append("load", sLabel); } -IMPL_LINK(SfxTemplateDialog_Impl, ToolMenuSelectHdl, const OString&, rMenuId, void) +IMPL_LINK(SfxTemplateDialog_Impl, ToolMenuSelectHdl, const OUString&, rMenuId, void) { if (rMenuId.isEmpty()) return; @@ -865,7 +865,7 @@ sal_Int8 SfxTemplateDialog_Impl::AcceptToolbarDrop(const AcceptDropEvent& rEvt, if (nIndex >= m_nActionTbLVisible) nIndex = m_nActionTbLVisible - 1; - OString sIdent = m_xActionTbL->get_item_ident(nIndex); + OUString sIdent = m_xActionTbL->get_item_ident(nIndex); if (!sIdent.isEmpty() && !m_xActionTbL->get_item_active(sIdent)) ToolBoxLSelect(sIdent); diff --git a/sfx2/source/doc/autoredactdialog.cxx b/sfx2/source/doc/autoredactdialog.cxx index 6e438a90bd1b..5e61849c079a 100644 --- a/sfx2/source/doc/autoredactdialog.cxx +++ b/sfx2/source/doc/autoredactdialog.cxx @@ -534,8 +534,7 @@ SfxAutoRedactDialog::SfxAutoRedactDialog(weld::Window* pParent) { // Can be used to remember the last set of redaction targets? OUString sExtraData; - SvtViewOptions aDlgOpt(EViewType::Dialog, - OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id()); if (aDlgOpt.Exists()) { @@ -586,8 +585,7 @@ SfxAutoRedactDialog::~SfxAutoRedactDialog() if (m_aTableTargets.empty()) { // Clear the dialog data - SvtViewOptions aDlgOpt(EViewType::Dialog, - OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id()); aDlgOpt.Delete(); return; } @@ -612,8 +610,7 @@ SfxAutoRedactDialog::~SfxAutoRedactDialog() OUString sUserDataStr(OUString::fromUtf8(aStream.str().c_str())); // Store the dialog data - SvtViewOptions aDlgOpt(EViewType::Dialog, - OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id()); aDlgOpt.SetUserItem("UserItem", css::uno::Any(sUserDataStr)); if (!m_bTargetsCopied) diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index a6922befcc95..a9bba4f0fc2d 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -271,7 +271,7 @@ SfxNewFileDialog::SfxNewFileDialog(weld::Window *pParent, SfxNewFileDialogMode n } OUString sExtraData; - SvtViewOptions aDlgOpt(EViewType::Dialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id()); if (aDlgOpt.Exists()) { css::uno::Any aUserItem = aDlgOpt.GetUserItem("UserItem"); @@ -307,7 +307,7 @@ SfxNewFileDialog::SfxNewFileDialog(weld::Window *pParent, SfxNewFileDialogMode n SfxNewFileDialog::~SfxNewFileDialog() { - SvtViewOptions aDlgOpt(EViewType::Dialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id()); aDlgOpt.SetUserItem("UserItem", css::uno::Any(m_xMoreBt->get_expanded() ? OUString("Y") : OUString("N"))); } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 1a0356279c4d..2d7b0c31ef6e 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1045,7 +1045,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } xHelper->GUIStoreModel( GetModel(), - OUString::createFromAscii( pSlot->GetUnoName() ), + pSlot->GetUnoName(), aDispatchArgs, bPreselectPassword, GetDocumentSignatureState(), diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 84797484d3a3..73f0a3137d7e 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3586,10 +3586,7 @@ static void ConvertSlotsToCommands( SfxObjectShell const * pDoc, Reference< cont const SfxSlot* pSlot = pModule->GetSlotPool()->GetSlot( nSlot ); if ( pSlot ) { - OUStringBuffer aStrBuf( ".uno:" ); - aStrBuf.appendAscii( pSlot->GetUnoName() ); - - aCommand = aStrBuf.makeStringAndClear(); + aCommand = pSlot->GetCommand(); aSeqPropValue.getArray()[nIndex].Value <<= aCommand; rToolbarDefinition->replaceByIndex( i, Any( aSeqPropValue )); } diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 6bbb7988e726..dec37dd0c406 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -58,16 +58,16 @@ constexpr OUStringLiteral TM_SETTING_LASTFOLDER = u"LastFolder"; constexpr OUStringLiteral TM_SETTING_LASTAPPLICATION = u"LastApplication"; constexpr OUStringLiteral TM_SETTING_VIEWMODE = u"ViewMode"; -#define MNI_ACTION_NEW_FOLDER "new" -#define MNI_ACTION_RENAME_FOLDER "rename" -#define MNI_ACTION_DELETE_FOLDER "delete" -#define MNI_ACTION_DEFAULT "default" -#define MNI_ACTION_DEFAULT_WRITER "default_writer" -#define MNI_ACTION_DEFAULT_CALC "default_calc" -#define MNI_ACTION_DEFAULT_IMPRESS "default_impress" -#define MNI_ACTION_DEFAULT_DRAW "default_draw" -#define MNI_ACTION_IMPORT "import_template" -#define MNI_ACTION_EXTENSIONS "extensions" +constexpr OUStringLiteral MNI_ACTION_NEW_FOLDER = u"new"; +constexpr OUStringLiteral MNI_ACTION_RENAME_FOLDER = u"rename"; +constexpr OUStringLiteral MNI_ACTION_DELETE_FOLDER = u"delete"; +constexpr OUStringLiteral MNI_ACTION_DEFAULT = u"default"; +constexpr OUStringLiteral MNI_ACTION_DEFAULT_WRITER = u"default_writer"; +constexpr OUStringLiteral MNI_ACTION_DEFAULT_CALC = u"default_calc"; +constexpr OUStringLiteral MNI_ACTION_DEFAULT_IMPRESS = u"default_impress"; +constexpr OUStringLiteral MNI_ACTION_DEFAULT_DRAW = u"default_draw"; +constexpr OUStringLiteral MNI_ACTION_IMPORT = u"import_template"; +constexpr OUStringLiteral MNI_ACTION_EXTENSIONS = u"extensions"; #define MNI_ALL_APPLICATIONS 0 #define MNI_WRITER 1 #define MNI_CALC 2 @@ -508,7 +508,7 @@ IMPL_LINK(SfxTemplateManagerDlg, TVItemStateHdl, const ThumbnailViewItem*, pItem OnTemplateState(pItem); } -IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, const OString&, rIdent, void) +IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, const OUString&, rIdent, void) { if (rIdent == MNI_ACTION_NEW_FOLDER) OnCategoryNew(); @@ -532,7 +532,7 @@ IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, const OString&, rIdent, void) ExtensionsActionHdl(); } -void SfxTemplateManagerDlg::DefaultTemplateMenuSelectHdl(std::string_view rIdent) +void SfxTemplateManagerDlg::DefaultTemplateMenuSelectHdl(std::u16string_view rIdent) { SvtModuleOptions aModOpt; OUString aFactoryURL; diff --git a/sfx2/source/inc/StyleList.hxx b/sfx2/source/inc/StyleList.hxx index f6ba9f318593..5eba936c6cb5 100644 --- a/sfx2/source/inc/StyleList.hxx +++ b/sfx2/source/inc/StyleList.hxx @@ -63,7 +63,7 @@ class StyleList final : public SfxListener public: // Constructor StyleList(weld::Builder* pBuilder, SfxBindings* pBindings, SfxCommonTemplateDialog_Impl* Parent, - weld::Container* pC, OString treeviewname, OString flatviewname); + weld::Container* pC, OUString treeviewname, OUString flatviewname); // Destructor ~StyleList(); @@ -144,7 +144,7 @@ private: sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt, const DropTargetHelper& rHelper); void DropHdl(const OUString& rStyle, const OUString& rParent); - void MenuSelect(const OString& rIdent); + void MenuSelect(const OUString& rIdent); void PrepareMenu(const Point& rPos); void ShowMenu(const CommandEvent& rCEvt); void CreateContextMenu(); @@ -232,7 +232,7 @@ private: std::unique_ptr<Idle> pIdle; - OString sLastItemIdent; + OUString sLastItemIdent; SfxModule* m_Module; sal_uInt16 m_nModifier; weld::Container* m_pContainer; diff --git a/sfx2/source/inc/helpids.h b/sfx2/source/inc/helpids.h index 91248f469163..7dbce5235779 100644 --- a/sfx2/source/inc/helpids.h +++ b/sfx2/source/inc/helpids.h @@ -19,30 +19,30 @@ #ifndef INCLUDED_SFX2_SOURCE_INC_HELPIDS_H #define INCLUDED_SFX2_SOURCE_INC_HELPIDS_H -#include <rtl/string.hxx> +#include <rtl/ustring.hxx> -inline constexpr OStringLiteral HID_TEMPLATE_FMT = "SFX2_HID_TEMPLATE_FMT"; -inline constexpr OStringLiteral HID_TEMPLATE_FILTER = "SFX2_HID_TEMPLATE_FILTER"; -inline constexpr OStringLiteral HID_TEMPLDLG_NEWBYEXAMPLE = "SFX2_HID_TEMPLDLG_NEWBYEXAMPLE"; -inline constexpr OStringLiteral HID_TEMPLDLG_UPDATEBYEXAMPLE = "SFX2_HID_TEMPLDLG_UPDATEBYEXAMPLE"; -inline constexpr OStringLiteral HID_TEMPLDLG_WATERCAN = "SFX2_HID_TEMPLDLG_WATERCAN"; -inline constexpr OStringLiteral HID_NAVIGATOR_WINDOW = "SFX2_HID_NAVIGATOR_WINDOW"; -inline constexpr OStringLiteral HID_TABDLG_RESET_BTN = "SFX2_HID_TABDLG_RESET_BTN"; -inline constexpr OStringLiteral HID_TABDLG_STANDARD_BTN = "SFX2_HID_TABDLG_STANDARD_BTN"; -inline constexpr OStringLiteral HID_TEMPLDLG_TOOLBOX_LEFT = "SFX2_HID_TEMPLDLG_TOOLBOX_LEFT"; -inline constexpr OStringLiteral HID_HELP_WINDOW = "SFX2_HID_HELP_WINDOW"; -inline constexpr OStringLiteral HID_HELP_TOOLBOX = "SFX2_HID_HELP_TOOLBOX"; -inline constexpr OStringLiteral HID_HELP_TOOLBOXITEM_INDEX = "SFX2_HID_HELP_TOOLBOXITEM_INDEX"; -inline constexpr OStringLiteral HID_HELP_TOOLBOXITEM_START = "SFX2_HID_HELP_TOOLBOXITEM_START"; -inline constexpr OStringLiteral HID_HELP_TOOLBOXITEM_BACKWARD = "SFX2_HID_HELP_TOOLBOXITEM_BACKWARD"; -inline constexpr OStringLiteral HID_HELP_TOOLBOXITEM_FORWARD = "SFX2_HID_HELP_TOOLBOXITEM_FORWARD"; -inline constexpr OStringLiteral HID_HELP_TOOLBOXITEM_PRINT = "SFX2_HID_HELP_TOOLBOXITEM_PRINT"; -inline constexpr OStringLiteral HID_HELP_TOOLBOXITEM_BOOKMARKS = "SFX2_HID_HELP_TOOLBOXITEM_BOOKMARKS"; -inline constexpr OStringLiteral HID_HELP_TOOLBOXITEM_SEARCHDIALOG = "SFX2_HID_HELP_TOOLBOXITEM_SEARCHDIALOG"; +inline constexpr OUStringLiteral HID_TEMPLATE_FMT = u"SFX2_HID_TEMPLATE_FMT"; +inline constexpr OUStringLiteral HID_TEMPLATE_FILTER = u"SFX2_HID_TEMPLATE_FILTER"; +inline constexpr OUStringLiteral HID_TEMPLDLG_NEWBYEXAMPLE = u"SFX2_HID_TEMPLDLG_NEWBYEXAMPLE"; +inline constexpr OUStringLiteral HID_TEMPLDLG_UPDATEBYEXAMPLE = u"SFX2_HID_TEMPLDLG_UPDATEBYEXAMPLE"; +inline constexpr OUStringLiteral HID_TEMPLDLG_WATERCAN = u"SFX2_HID_TEMPLDLG_WATERCAN"; +inline constexpr OUStringLiteral HID_NAVIGATOR_WINDOW = u"SFX2_HID_NAVIGATOR_WINDOW"; +inline constexpr OUStringLiteral HID_TABDLG_RESET_BTN = u"SFX2_HID_TABDLG_RESET_BTN"; +inline constexpr OUStringLiteral HID_TABDLG_STANDARD_BTN = u"SFX2_HID_TABDLG_STANDARD_BTN"; +inline constexpr OUStringLiteral HID_TEMPLDLG_TOOLBOX_LEFT = u"SFX2_HID_TEMPLDLG_TOOLBOX_LEFT"; +inline constexpr OUStringLiteral HID_HELP_WINDOW = u"SFX2_HID_HELP_WINDOW"; +inline constexpr OUStringLiteral HID_HELP_TOOLBOX = u"SFX2_HID_HELP_TOOLBOX"; +inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_INDEX = u"SFX2_HID_HELP_TOOLBOXITEM_INDEX"; +inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_START = u"SFX2_HID_HELP_TOOLBOXITEM_START"; +inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_BACKWARD = u"SFX2_HID_HELP_TOOLBOXITEM_BACKWARD"; +inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_FORWARD = u"SFX2_HID_HELP_TOOLBOXITEM_FORWARD"; +inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_PRINT = u"SFX2_HID_HELP_TOOLBOXITEM_PRINT"; +inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_BOOKMARKS = u"SFX2_HID_HELP_TOOLBOXITEM_BOOKMARKS"; +inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_SEARCHDIALOG = u"SFX2_HID_HELP_TOOLBOXITEM_SEARCHDIALOG"; -inline constexpr OStringLiteral HID_QUERY_LOAD_TEMPLATE = "SFX2_HID_QUERY_LOAD_TEMPLATE"; +inline constexpr OUStringLiteral HID_QUERY_LOAD_TEMPLATE = u"SFX2_HID_QUERY_LOAD_TEMPLATE"; -inline constexpr OStringLiteral HID_SIDEBAR_WINDOW = "SFX2_HID_SIDEBAR_WINDOW"; +inline constexpr OUStringLiteral HID_SIDEBAR_WINDOW = u"SFX2_HID_SIDEBAR_WINDOW"; #endif diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index 89d8fcfe0bc3..322747b5636e 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -112,7 +112,7 @@ protected: bool IsSafeForWaterCan() const; void SetFamily(SfxStyleFamily nFamily); - void ActionSelect(const OString& rId, StyleList& rStyleList); + void ActionSelect(const OUString& rId, StyleList& rStyleList); void SaveFactoryStyleFilter(SfxObjectShell const* i_pObjSh, sal_Int32 i_nFilter); @@ -160,11 +160,11 @@ public: void EnableExample_Impl(sal_uInt16 nId, bool bEnable); // This comes into action when a family is selected or a style is applied for use - virtual void CheckItem(const OString& /*rMesId*/, bool /*bCheck*/ = true) {} + virtual void CheckItem(const OUString& /*rMesId*/, bool /*bCheck*/ = true) {} // This is used for watercan or when newmenu or watercan is enabled or updated - virtual void EnableItem(const OString& /*rMesId*/, bool /*bCheck*/ = true) {} + virtual void EnableItem(const OUString& /*rMesId*/, bool /*bCheck*/ = true) {} // This is used for watercan - virtual bool IsCheckedItem(const OString& /*rMesId*/) { return true; } + virtual bool IsCheckedItem(const OUString& /*rMesId*/) { return true; } // This is used when a style is selected void SelectStyle(const OUString& rStyle, bool bIsCallback, StyleList& rStyleList); @@ -210,14 +210,14 @@ private: void FillToolMenu(); - DECL_LINK(ToolBoxLSelect, const OString&, void); - DECL_LINK(ToolBoxRSelect, const OString&, void); - DECL_LINK(ToolMenuSelectHdl, const OString&, void); + DECL_LINK(ToolBoxLSelect, const OUString&, void); + DECL_LINK(ToolBoxRSelect, const OUString&, void); + DECL_LINK(ToolMenuSelectHdl, const OUString&, void); virtual void EnableEdit( bool, StyleList* rStyleList) override; - virtual void EnableItem(const OString& rMesId, bool bCheck = true) override; - virtual void CheckItem(const OString& rMesId, bool bCheck = true) override; - virtual bool IsCheckedItem(const OString& rMesId) override; + virtual void EnableItem(const OUString& rMesId, bool bCheck = true) override; + virtual void CheckItem(const OUString& rMesId, bool bCheck = true) override; + virtual bool IsCheckedItem(const OUString& rMesId) override; virtual void InsertFamilyItem(sal_uInt16 nId, const SfxStyleFamilyItem& rItem) override; virtual void EnableFamilyItem(sal_uInt16 nId, bool bEnabled) override; virtual void ClearFamilyList() override; diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx index 5473aa95f001..05a82dd2003f 100644 --- a/sfx2/source/sidebar/DeckLayouter.cxx +++ b/sfx2/source/sidebar/DeckLayouter.cxx @@ -310,7 +310,7 @@ sal_Int32 PlacePanels ( if (comphelper::LibreOfficeKit::isActive()) { sal_uInt64 nShellId = reinterpret_cast<sal_uInt64>(SfxViewShell::Current()); - jsdialog::SendFullUpdate(std::to_string(nShellId) + "sidebar", "Panel"); + jsdialog::SendFullUpdate(OUString::number(nShellId) + "sidebar", "Panel"); } return nY; diff --git a/sfx2/source/sidebar/PanelLayout.cxx b/sfx2/source/sidebar/PanelLayout.cxx index ef80cb3d26f5..afe018db8a93 100644 --- a/sfx2/source/sidebar/PanelLayout.cxx +++ b/sfx2/source/sidebar/PanelLayout.cxx @@ -17,7 +17,7 @@ using namespace sfx2::sidebar; -PanelLayout::PanelLayout(weld::Widget* pParent, const OString& rID, const OUString& rUIXMLDescription) +PanelLayout::PanelLayout(weld::Widget* pParent, const OUString& rID, const OUString& rUIXMLDescription) : m_xBuilder(Application::CreateBuilder(pParent, rUIXMLDescription, false, reinterpret_cast<sal_uInt64>(SfxViewShell::Current()))) , m_xContainer(m_xBuilder->weld_container(rID)) , m_pPanel(nullptr) diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx index 50d6e6abb58a..8fa401f4074e 100644 --- a/sfx2/source/sidebar/PanelTitleBar.cxx +++ b/sfx2/source/sidebar/PanelTitleBar.cxx @@ -90,7 +90,7 @@ void PanelTitleBar::SetMoreOptionsCommand(const OUString& rsCommandName, if (msMoreOptionsCommand.isEmpty()) return; - msIdent = msMoreOptionsCommand.toUtf8(); + msIdent = msMoreOptionsCommand; mxToolBox->set_item_ident(0, msIdent); Reference<lang::XComponent> xComponent(mxController, UNO_QUERY); diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 3546297df79c..703c5020635a 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -1092,8 +1092,8 @@ void SidebarController::PopulatePopupMenus(weld::Menu& rMenu, weld::Menu& rCusto sal_Int32 nIndex (0); for (const auto& rItem : rMenuData) { - OString sIdent("select" + OString::number(nIndex)); - rMenu.insert(nIndex, OUString::fromUtf8(sIdent), rItem.msDisplayName, + OUString sIdent("select" + OUString::number(nIndex)); + rMenu.insert(nIndex, sIdent, rItem.msDisplayName, nullptr, nullptr, nullptr, TRISTATE_FALSE); rMenu.set_active(sIdent, rItem.mbIsCurrentDeck); rMenu.set_sensitive(sIdent, rItem.mbIsEnabled && rItem.mbIsActive); @@ -1103,15 +1103,15 @@ void SidebarController::PopulatePopupMenus(weld::Menu& rMenu, weld::Menu& rCusto if (rItem.mbIsCurrentDeck) { // Don't allow the currently visible deck to be disabled. - OString sSubIdent("nocustomize" + OString::number(nIndex)); - rCustomizationMenu.insert(nIndex, OUString::fromUtf8(sSubIdent), rItem.msDisplayName, + OUString sSubIdent("nocustomize" + OUString::number(nIndex)); + rCustomizationMenu.insert(nIndex, sSubIdent, rItem.msDisplayName, nullptr, nullptr, nullptr, TRISTATE_FALSE); rCustomizationMenu.set_active(sSubIdent, true); } else { - OString sSubIdent("customize" + OString::number(nIndex)); - rCustomizationMenu.insert(nIndex, OUString::fromUtf8(sSubIdent), rItem.msDisplayName, + OUString sSubIdent("customize" + OUString::number(nIndex)); + rCustomizationMenu.insert(nIndex, sSubIdent, rItem.msDisplayName, nullptr, nullptr, nullptr, TRISTATE_TRUE); rCustomizationMenu.set_active(sSubIdent, rItem.mbIsEnabled && rItem.mbIsActive); } @@ -1138,7 +1138,7 @@ void SidebarController::PopulatePopupMenus(weld::Menu& rMenu, weld::Menu& rCusto rMenu.set_visible("customization", !comphelper::LibreOfficeKit::isActive()); } -IMPL_LINK(SidebarController, OnMenuItemSelected, const OString&, rCurItemId, void) +IMPL_LINK(SidebarController, OnMenuItemSelected, const OUString&, rCurItemId, void) { if (rCurItemId == "unlocktaskpanel") { @@ -1171,7 +1171,7 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, const OString&, rCurItemId, voi { try { - OString sNumber; + OUString sNumber; if (rCurItemId.startsWith("select", &sNumber)) { RequestOpenDeck(); @@ -1185,7 +1185,7 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, const OString&, rCurItemId, voi } } -IMPL_LINK(SidebarController, OnSubMenuItemSelected, const OString&, rCurItemId, void) +IMPL_LINK(SidebarController, OnSubMenuItemSelected, const OUString&, rCurItemId, void) { if (rCurItemId == "restoredefault") mpTabBar->RestoreHideFlags(); @@ -1193,7 +1193,7 @@ IMPL_LINK(SidebarController, OnSubMenuItemSelected, const OString&, rCurItemId, { try { - OString sNumber; + OUString sNumber; if (rCurItemId.startsWith("customize", &sNumber)) { mpTabBar->ToggleHideFlag(sNumber.toInt32()); diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx index 6b77096898c7..9d92d24cd93a 100644 --- a/sfx2/source/sidebar/TabBar.cxx +++ b/sfx2/source/sidebar/TabBar.cxx @@ -267,7 +267,7 @@ TabBar::Item::~Item() mrTabBar.GetContainer()->move(mxButton.get(), nullptr); } -IMPL_LINK_NOARG(TabBar::Item, HandleClick, const OString&, void) +IMPL_LINK_NOARG(TabBar::Item, HandleClick, const OUString&, void) { // tdf#143146 copy the functor and arg before calling // GrabFocusToDocument which may destroy this object @@ -363,13 +363,13 @@ IMPL_LINK_NOARG(TabBar, OnToolboxClicked, weld::Toggleable&, void) for (int i = mxMainMenu->n_children() - 1; i >= 0; --i) { - OString sIdent = mxMainMenu->get_id(i); + OUString sIdent = mxMainMenu->get_id(i); if (sIdent.startsWith("select")) mxMainMenu->remove(sIdent); } for (int i = mxSubMenu->n_children() - 1; i >= 0; --i) { - OString sIdent = mxSubMenu->get_id(i); + OUString sIdent = mxSubMenu->get_id(i); if (sIdent.indexOf("customize") != -1) mxSubMenu->remove(sIdent); } diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx index dd00d42175b9..edab6d58b811 100644 --- a/sfx2/source/sidebar/TitleBar.cxx +++ b/sfx2/source/sidebar/TitleBar.cxx @@ -70,7 +70,7 @@ void TitleBar::SetIcon(const css::uno::Reference<css::graphic::XGraphic>& rIcon) mxAddonImage->set_visible(rIcon.is()); } -IMPL_LINK_NOARG(TitleBar, SelectionHandler, const OString&, void) +IMPL_LINK_NOARG(TitleBar, SelectionHandler, const OUString&, void) { HandleToolBoxItemClick(); } diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx index d1b1ed58b905..e9d8512fa832 100644 --- a/sfx2/source/statbar/stbitem.cxx +++ b/sfx2/source/statbar/stbitem.cxx @@ -104,7 +104,7 @@ rtl::Reference<svt::StatusbarController> SfxStatusBarControllerFactory( sal_uInt16 nSlotId = pSlot->GetSlotId(); if ( nSlotId > 0 ) { - OString aCmd = OString::Concat(".uno:") + pSlot->GetUnoName(); + OUString aCmd = pSlot->GetCommand(); pStatusBar->SetHelpId( nSlotId, aCmd ); return SfxStatusBarControl::CreateControl( nSlotId, nID, pStatusBar, pModule ); } diff --git a/sfx2/source/toolbox/weldutils.cxx b/sfx2/source/toolbox/weldutils.cxx index eff86b0b857f..a20c9a9a21e7 100644 --- a/sfx2/source/toolbox/weldutils.cxx +++ b/sfx2/source/toolbox/weldutils.cxx @@ -91,12 +91,12 @@ ToolbarUnoDispatcher::ToolbarUnoDispatcher(weld::Toolbar& rToolbar, weld::Builde for (int i = 0, nItems = rToolbar.get_n_items(); i < nItems; ++i) { - OString sIdent(rToolbar.get_item_ident(i)); + OUString sIdent(rToolbar.get_item_ident(i)); if (!sIdent.startsWith(".uno:")) continue; - OUString sCommand = OUString::fromUtf8(sIdent); + OUString sCommand = sIdent; if (bRTL && lcl_RTLizeCommandURL(sCommand)) - rToolbar.set_item_ident(i, sCommand.toUtf8()); + rToolbar.set_item_ident(i, sCommand); auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sCommand, aModuleName); OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(aProperties)); @@ -135,19 +135,19 @@ ToolbarUnoDispatcher::GetControllerForCommand(const OUString& rCommand) const return css::uno::Reference<css::frame::XToolbarController>(); } -IMPL_LINK(ToolbarUnoDispatcher, SelectHdl, const OString&, rCommand, void) +IMPL_LINK(ToolbarUnoDispatcher, SelectHdl, const OUString&, rCommand, void) { css::uno::Reference<css::frame::XToolbarController> xController( - GetControllerForCommand(OUString::fromUtf8(rCommand))); + GetControllerForCommand(rCommand)); if (xController.is()) xController->execute(0); } -IMPL_LINK(ToolbarUnoDispatcher, ToggleMenuHdl, const OString&, rCommand, void) +IMPL_LINK(ToolbarUnoDispatcher, ToggleMenuHdl, const OUString&, rCommand, void) { css::uno::Reference<css::frame::XToolbarController> xController( - GetControllerForCommand(OUString::fromUtf8(rCommand))); + GetControllerForCommand(rCommand)); if (xController.is()) xController->click(); @@ -160,9 +160,8 @@ IMPL_LINK_NOARG(ToolbarUnoDispatcher, ChangedIconSizeHandler, LinkParamNone*, vo for (int i = 0, nItems = m_pToolbar->get_n_items(); i < nItems; ++i) { - OString sIdent(m_pToolbar->get_item_ident(i)); - auto xImage(vcl::CommandInfoProvider::GetXGraphicForCommand(OUString::fromUtf8(sIdent), - m_xFrame, eSize)); + OUString sIdent(m_pToolbar->get_item_ident(i)); + auto xImage(vcl::CommandInfoProvider::GetXGraphicForCommand(sIdent, m_xFrame, eSize)); m_pToolbar->set_item_image(sIdent, xImage); } @@ -197,7 +196,7 @@ void ToolbarUnoDispatcher::dispose() } m_xImageController->dispose(); - m_pToolbar->connect_clicked(Link<const OString&, void>()); + m_pToolbar->connect_clicked(Link<const OUString&, void>()); m_pToolbar = nullptr; m_pBuilder = nullptr; } diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 6cf26ca47433..6fb0d844fd47 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -526,10 +526,9 @@ namespace { const SfxSlot* pSlot = SfxSlotPool::GetSlotPool(pShell->GetFrame()).GetSlot(nWhich); if (pSlot) { - const char* pName = pSlot->GetUnoName(); - if (pName) + if (!pSlot->GetUnoName().isEmpty()) { - return ".uno:" + OStringToOUString(pName, RTL_TEXTENCODING_ASCII_US); + return pSlot->GetCommand(); } } } diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 9dc38304b95a..5d8973fa41e5 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1092,7 +1092,7 @@ uno::Sequence< frame::DispatchInformation > SAL_CALL SfxBaseController::getConfi if ( pSfxSlot->GetMode() & nMode ) { frame::DispatchInformation aCmdInfo; - aCmdInfo.Command = ".uno:" + OUString::createFromAscii( pSfxSlot->GetUnoName() ); + aCmdInfo.Command = pSfxSlot->GetCommand(); aCmdInfo.GroupId = nCommandGroup; aCmdVector.push_back( aCmdInfo ); } |