use more string_view in cui
Change-Id: I377d95ec2d80cef611c6fce274f1e17504132564 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133074 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
#include <vcl/commandinfoprovider.hxx>
|
||||
#include <vcl/help.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <o3tl/string_view.hxx>
|
||||
|
||||
#include <sfx2/sidebar/ResourceManager.hxx>
|
||||
#include <sfx2/sidebar/Context.hxx>
|
||||
@@ -1027,22 +1028,23 @@ void CuiConfigGroupListBox::SelectMacro( const SfxMacroInfoItem *pItem )
|
||||
}
|
||||
|
||||
void CuiConfigGroupListBox::SelectMacro( std::u16string_view rBasic,
|
||||
const OUString& rMacro )
|
||||
std::u16string_view rMacro )
|
||||
{
|
||||
const OUString aBasicName(OUString::Concat(rBasic) + " " + xImp->m_sMacros);
|
||||
sal_Int32 nIdx {rMacro.lastIndexOf('.')};
|
||||
const OUString aMethod( rMacro.copy(nIdx+1) );
|
||||
OUString aLib;
|
||||
OUString aModule;
|
||||
if ( nIdx>0 )
|
||||
size_t nIdx {rMacro.rfind('.')};
|
||||
const std::u16string_view aMethod( rMacro.substr(nIdx == std::u16string_view::npos ? 0 : nIdx + 1) );
|
||||
std::u16string_view aLib;
|
||||
std::u16string_view aModule;
|
||||
if ( nIdx>0 && nIdx != std::u16string_view::npos )
|
||||
{
|
||||
// string contains at least 2 tokens
|
||||
nIdx = rMacro.lastIndexOf('.', nIdx);
|
||||
if (nIdx>=0)
|
||||
nIdx = rMacro.rfind('.', nIdx);
|
||||
if (nIdx != std::u16string_view::npos)
|
||||
{
|
||||
// string contains at least 3 tokens
|
||||
aLib = rMacro.getToken( 0, '.' );
|
||||
aModule = rMacro.getToken( 0, '.', ++nIdx );
|
||||
aLib = o3tl::getToken(rMacro, 0, '.' );
|
||||
sal_Int32 nIdx2 = nIdx + 1;
|
||||
aModule = o3tl::getToken(rMacro, 0, '.', nIdx2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <svx/svxids.hrc>
|
||||
#include <strings.hrc>
|
||||
#include <comphelper/namedvaluecollection.hxx>
|
||||
#include <o3tl/string_view.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::uno;
|
||||
@@ -269,21 +270,20 @@ bool SvxMacroTabPage_::IsReadOnly() const
|
||||
|
||||
namespace
|
||||
{
|
||||
OUString GetEventDisplayText(const OUString &rURL)
|
||||
std::u16string_view GetEventDisplayText(std::u16string_view rURL)
|
||||
{
|
||||
if (rURL.isEmpty())
|
||||
return OUString();
|
||||
sal_Int32 nIndex = rURL.indexOf(aVndSunStarUNO);
|
||||
bool bUNO = nIndex == 0;
|
||||
OUString aPureMethod;
|
||||
if (rURL.empty())
|
||||
return std::u16string_view();
|
||||
bool bUNO = o3tl::starts_with(rURL, aVndSunStarUNO);
|
||||
std::u16string_view aPureMethod;
|
||||
if (bUNO)
|
||||
{
|
||||
aPureMethod = rURL.copy(aVndSunStarUNO.getLength());
|
||||
aPureMethod = rURL.substr(aVndSunStarUNO.getLength());
|
||||
}
|
||||
else
|
||||
{
|
||||
aPureMethod = rURL.copy(strlen("vnd.sun.star.script:"));
|
||||
aPureMethod = aPureMethod.copy( 0, aPureMethod.indexOf( '?' ) );
|
||||
aPureMethod = rURL.substr(strlen("vnd.sun.star.script:"));
|
||||
aPureMethod = aPureMethod.substr( 0, aPureMethod.find( '?' ) );
|
||||
}
|
||||
return aPureMethod;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ void SvxMacroTabPage_::DisplayAppEvents( bool appEvents)
|
||||
int nRow = mpImpl->xEventLB->n_children();
|
||||
mpImpl->xEventLB->append(sEventName, displayName);
|
||||
mpImpl->xEventLB->set_image(nRow, GetEventDisplayImage(eventURL), 1);
|
||||
mpImpl->xEventLB->set_text(nRow, GetEventDisplayText(eventURL), 2);
|
||||
mpImpl->xEventLB->set_text(nRow, OUString(GetEventDisplayText(eventURL)), 2);
|
||||
}
|
||||
|
||||
mpImpl->xEventLB->thaw();
|
||||
@@ -478,7 +478,7 @@ void SvxMacroTabPage_::GenericHandler_Impl(SvxMacroTabPage_* pThis, const weld::
|
||||
}
|
||||
|
||||
rListBox.set_image(nEntry, GetEventDisplayImage(sEventURL), 1);
|
||||
rListBox.set_text(nEntry, GetEventDisplayText(sEventURL), 2);
|
||||
rListBox.set_text(nEntry, OUString(GetEventDisplayText(sEventURL)), 2);
|
||||
|
||||
rListBox.select(nEntry );
|
||||
rListBox.scroll_to_row(nEntry);
|
||||
|
||||
@@ -1113,7 +1113,7 @@ OUString FormatErrorString(
|
||||
std::u16string_view type,
|
||||
std::u16string_view message )
|
||||
{
|
||||
OUString result = unformatted.copy( 0 );
|
||||
OUString result = unformatted;
|
||||
|
||||
result = ReplaceString(result, "%LANGUAGENAME", language );
|
||||
result = ReplaceString(result, "%SCRIPTNAME", script );
|
||||
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
void GroupSelected();
|
||||
#if HAVE_FEATURE_SCRIPTING
|
||||
void SelectMacro(const SfxMacroInfoItem*);
|
||||
void SelectMacro(std::u16string_view, const OUString&);
|
||||
void SelectMacro(std::u16string_view, std::u16string_view);
|
||||
#endif
|
||||
void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user