summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-04-02 01:18:42 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-04-02 18:46:47 +0200
commit116b9d6ddf2b61186b29f0370234eec9c1bbe306 (patch)
tree7f90a12333274086e33c4e0fabfd96a8e54e6b6c /svtools
parentd7ba78e9c7be835a1e2ecdacd25995663e96862f (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 'svtools')
-rw-r--r--svtools/source/brwbox/ebbcontrols.cxx2
-rw-r--r--svtools/source/control/scrolladaptor.cxx3
-rw-r--r--svtools/source/control/toolbarmenu.cxx2
-rw-r--r--svtools/source/control/valueset.cxx2
-rw-r--r--svtools/source/dialogs/addresstemplate.cxx4
-rw-r--r--svtools/source/uno/popupwindowcontroller.cxx9
-rw-r--r--svtools/source/uno/wizard/unowizard.cxx14
-rw-r--r--svtools/source/uno/wizard/wizardshell.cxx8
-rw-r--r--svtools/source/uno/wizard/wizardshell.hxx4
9 files changed, 23 insertions, 25 deletions
diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx
index b0a2ad1bbcc3..dc86194576e2 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -343,7 +343,7 @@ namespace svt
CallModifyHdls();
}
- ControlBase::ControlBase(BrowserDataWin* pParent, const OUString& rUIXMLDescription, const OString& rID)
+ ControlBase::ControlBase(BrowserDataWin* pParent, const OUString& rUIXMLDescription, const OUString& rID)
: InterimItemWindow(pParent, rUIXMLDescription, rID)
{
}
diff --git a/svtools/source/control/scrolladaptor.cxx b/svtools/source/control/scrolladaptor.cxx
index 64799a15e96d..6d01e9d414d7 100644
--- a/svtools/source/control/scrolladaptor.cxx
+++ b/svtools/source/control/scrolladaptor.cxx
@@ -21,7 +21,8 @@
ScrollAdaptor::ScrollAdaptor(vcl::Window* pWin, bool bHoriz)
: InterimItemWindow(pWin, "svt/ui/scrollbars.ui", "ScrollBars")
- , m_xScrollBar(m_xBuilder->weld_scrollbar(bHoriz ? "horizontal" : "vertical"))
+ , m_xScrollBar(
+ m_xBuilder->weld_scrollbar(bHoriz ? OUString("horizontal") : OUString("vertical")))
, m_bHori(bHoriz)
{
m_xScrollBar->show();
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx
index f72fbd2540cb..92519ad356ad 100644
--- a/svtools/source/control/toolbarmenu.cxx
+++ b/svtools/source/control/toolbarmenu.cxx
@@ -106,7 +106,7 @@ void InterimToolbarPopup::EndPopupMode()
WeldToolbarPopup::WeldToolbarPopup(css::uno::Reference<css::frame::XFrame> xFrame,
weld::Widget* pParent, const OUString& rUIFile,
- const OString& rId)
+ const OUString& rId)
: m_xBuilder(Application::CreateBuilder(pParent, rUIFile))
, m_xTopLevel(m_xBuilder->weld_popover(rId))
, m_xContainer(m_xBuilder->weld_container("container"))
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index bafed3e98d56..76bce45c8de3 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -154,7 +154,7 @@ void ValueSet::ImplDeleteItems()
void ValueSet::Select()
{
- collectUIInformation(OStringToOUString(GetDrawingArea()->get_buildable_name(),RTL_TEXTENCODING_UTF8) , OStringToOUString(GetDrawingArea()->get_help_id(),RTL_TEXTENCODING_UTF8) , OUString::number(GetSelectedItemId()));
+ collectUIInformation(GetDrawingArea()->get_buildable_name() , GetDrawingArea()->get_help_id() , OUString::number(GetSelectedItemId()));
maSelectHdl.Call( this );
}
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index 4e26d912b219..3564b56166f5 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -504,9 +504,9 @@ void AssignmentPersistentData::ImplCommit()
for (sal_Int32 column=0; column<2; ++column)
{
// the label
- m_pImpl->pFieldLabels[row * 2 + column] = m_xBuilder->weld_label("label" + OString::number(row * 2 + column));
+ m_pImpl->pFieldLabels[row * 2 + column] = m_xBuilder->weld_label("label" + OUString::number(row * 2 + column));
// the listbox
- m_pImpl->pFields[row * 2 + column] = m_xBuilder->weld_combo_box("box" + OString::number(row * 2 + column));
+ m_pImpl->pFields[row * 2 + column] = m_xBuilder->weld_combo_box("box" + OUString::number(row * 2 + column));
m_pImpl->pFields[row * 2 + column]->connect_changed(LINK(this, AddressBookSourceDialog, OnFieldSelect));
}
}
diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx
index 83419b4d92b9..41c8510c5f04 100644
--- a/svtools/source/uno/popupwindowcontroller.cxx
+++ b/svtools/source/uno/popupwindowcontroller.cxx
@@ -187,9 +187,8 @@ void SAL_CALL PopupWindowController::statusChanged( const frame::FeatureStateEve
if (m_pToolbar)
{
- OString sId = m_aCommandURL.toUtf8();
- m_pToolbar->set_item_active(sId, bValue);
- m_pToolbar->set_item_sensitive(sId, rEvent.IsEnabled);
+ m_pToolbar->set_item_active(m_aCommandURL, bValue);
+ m_pToolbar->set_item_sensitive(m_aCommandURL, rEvent.IsEnabled);
return;
}
@@ -248,7 +247,7 @@ void SAL_CALL PopupWindowController::click()
{
if (m_pToolbar)
{
- if (m_pToolbar->get_menu_item_active(m_aCommandURL.toUtf8()))
+ if (m_pToolbar->get_menu_item_active(m_aCommandURL))
createPopupWindow();
else
mxPopoverContainer->unsetPopover();
@@ -260,7 +259,7 @@ void SAL_CALL PopupWindowController::click()
void PopupWindowController::EndPopupMode()
{
if (m_pToolbar)
- m_pToolbar->set_menu_item_active(m_aCommandURL.toUtf8(), false);
+ m_pToolbar->set_menu_item_active(m_aCommandURL, false);
else if (mxInterimPopover)
mxInterimPopover->EndPopupMode();
}
diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx
index d7680893f40a..4ec742a24add 100644
--- a/svtools/source/uno/wizard/unowizard.cxx
+++ b/svtools/source/uno/wizard/unowizard.cxx
@@ -141,15 +141,13 @@ namespace {
{
}
- OUString lcl_getHelpURL( std::string_view sHelpId )
+ OUString lcl_getHelpURL( std::u16string_view sHelpId )
{
OUStringBuffer aBuffer;
- OUString aTmp(
- OStringToOUString( sHelpId, RTL_TEXTENCODING_UTF8 ) );
- INetURLObject aHID( aTmp );
+ INetURLObject aHID(sHelpId);
if ( aHID.GetProtocol() == INetProtocol::NotValid )
aBuffer.append( INET_HID_SCHEME );
- aBuffer.append( aTmp );
+ aBuffer.append(sHelpId);
return aBuffer.makeStringAndClear();
}
@@ -235,13 +233,13 @@ namespace {
m_bInitialized = true;
}
- OString lcl_getHelpId( std::u16string_view _rHelpURL )
+ OUString lcl_getHelpId( const OUString& _rHelpURL )
{
INetURLObject aHID( _rHelpURL );
if ( aHID.GetProtocol() == INetProtocol::Hid )
- return OUStringToOString( aHID.GetURLPath(), RTL_TEXTENCODING_UTF8 );
+ return aHID.GetURLPath();
else
- return OUStringToOString( _rHelpURL, RTL_TEXTENCODING_UTF8 );
+ return _rHelpURL;
}
std::unique_ptr<weld::DialogController> Wizard::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx
index 4b93f09eadbe..d9cbca5874dd 100644
--- a/svtools/source/uno/wizard/wizardshell.cxx
+++ b/svtools/source/uno/wizard/wizardshell.cxx
@@ -83,12 +83,12 @@ namespace svt::uno
return WizardShell_Base::run();
}
- OString WizardShell::getPageIdentForState(WizardState nState) const
+ OUString WizardShell::getPageIdentForState(WizardState nState) const
{
- return OString::number(impl_stateToPageId(nState));
+ return OUString::number(impl_stateToPageId(nState));
}
- WizardState WizardShell::getStateFromPageIdent(const OString& rIdent) const
+ WizardState WizardShell::getStateFromPageIdent(const OUString& rIdent) const
{
return impl_pageIdToState(rIdent.toInt32());
}
@@ -197,7 +197,7 @@ namespace svt::uno
sal_Int16 nPageId = impl_stateToPageId(i_nState);
- OString sIdent(OString::number(nPageId));
+ OUString sIdent(OUString::number(nPageId));
weld::Container* pPageContainer = m_xAssistant->append_page(sIdent);
auto xPage = std::make_unique<EmptyPage>(pPageContainer, this);
diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx
index 90e7269a18b2..eb2e8150bc7f 100644
--- a/svtools/source/uno/wizard/wizardshell.hxx
+++ b/svtools/source/uno/wizard/wizardshell.hxx
@@ -106,8 +106,8 @@ namespace svt::uno
PWizardPageController impl_getController(BuilderPage* i_pPage) const;
- virtual OString getPageIdentForState(WizardState nState) const override;
- virtual WizardState getStateFromPageIdent(const OString& rIdent) const override;
+ virtual OUString getPageIdentForState(WizardState nState) const override;
+ virtual WizardState getStateFromPageIdent(const OUString& rIdent) const override;
// prevent outside access to some base class members
using WizardShell_Base::skip;