summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-09 09:55:12 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-10 12:59:38 +0200
commite4ff847fe0796420ba8023b70cad8589f5f19e9f (patch)
tree136786200de69f70dde4190c9725f35fe14b33e0 /dbaccess/source/ui
parent5a89496ffcfcd561b3e595e01f35e0302fa00841 (diff)
loplugin:stringview check for getToken and trim
since we now have o3tl versions of those that work on string_view. Also improve those o3tl functions to support both string_view and u16string_view Change-Id: Iacab2996becec62aa78a5597c52d983bb784749a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132755 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess/source/ui')
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.cxx3
-rw-r--r--dbaccess/source/ui/misc/TokenWriter.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx5
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx9
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx3
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx3
6 files changed, 16 insertions, 10 deletions
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx
index 5b2fed5c26de..7ff32140e933 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx
@@ -35,6 +35,7 @@
#include <svl/filenotation.hxx>
#include <com/sun/star/ucb/XProgressHandler.hpp>
#include <connectivity/CommonTools.hxx>
+#include <o3tl/string_view.hxx>
namespace dbaui
{
@@ -247,7 +248,7 @@ namespace dbaui
{
::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() );
m_xJavaDriver->set_text(m_xJavaDriver->get_text().trim()); // fdo#68341
- bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_xJavaDriver->get_text().trim());
+ bSuccess = ::connectivity::existsJavaClassByName(xJVM, o3tl::trim(m_xJavaDriver->get_text()));
}
}
catch(Exception&)
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index 7bfbd5d769cf..99ad22b9660e 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -55,6 +55,7 @@
#include <vcl/settings.hxx>
#include <svtools/rtfout.hxx>
#include <svtools/htmlcfg.hxx>
+#include <o3tl/string_view.hxx>
#include <connectivity/formattedcolumnvalue.hxx>
#include <memory>
@@ -351,7 +352,7 @@ bool ORTFImportExport::Write()
m_pStream->WriteCharPtr( "\\f" );
m_pStream->WriteInt32AsString(++nTok);
m_pStream->WriteCharPtr( "\\fcharset0\\fnil " );
- m_pStream->WriteOString( aFonts.getToken(0, ';', nIdx) );
+ m_pStream->WriteOString( o3tl::getToken(aFonts, 0, ';', nIdx) );
m_pStream->WriteChar( ';' );
} while (nIdx>=0);
}
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index ce6c45673688..42b0d3a7a817 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -25,6 +25,7 @@
#include <vcl/split.hxx>
#include <tools/diagnose_ex.h>
#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
@@ -919,7 +920,7 @@ namespace
{
aWorkStr += quoteTableAlias(bMulti,field->GetAlias(),aQuote) + ::dbtools::quoteName(aQuote, aColumnName);
}
- aWorkStr += " " + OUString( ";ASC;DESC" ).getToken( static_cast<sal_uInt16>(eOrder), ';' ) + ",";
+ aWorkStr += OUString::Concat(" ") + o3tl::getToken( u";ASC;DESC", static_cast<sal_uInt16>(eOrder), ';' ) + ",";
}
}
@@ -2171,7 +2172,7 @@ namespace
if ( SQL_ISRULE(pColumnRef,general_set_fct) )
{
aInfo->SetFunctionType(nFunctionType|FKT_AGGREGATE);
- aInfo->SetFunction(comphelper::string::stripEnd(aColumns.getToken(0,'('), ' '));
+ aInfo->SetFunction(comphelper::string::stripEnd(o3tl::getToken(aColumns,0,'('), ' '));
}
else
aInfo->SetFunctionType(nFunctionType|FKT_OTHER);
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index ac183e9d09e9..cc2895d12c67 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -49,6 +49,7 @@
#include <vcl/commandevent.hxx>
#include <vcl/svapp.hxx>
#include <tools/diagnose_ex.h>
+#include <o3tl/string_view.hxx>
using namespace ::svt;
using namespace ::dbaui;
@@ -74,8 +75,8 @@ namespace
if ( !bAsterisk )
{
sal_Int32 nTokenCount = comphelper::string::getTokenCount(_sFieldName, '.');
- if ( (nTokenCount == 2 && _sFieldName.getToken(1,'.')[0] == '*' )
- || (nTokenCount == 3 && _sFieldName.getToken(2,'.')[0] == '*' ) )
+ if ( (nTokenCount == 2 && o3tl::getToken(_sFieldName,1,'.')[0] == '*' )
+ || (nTokenCount == 3 && o3tl::getToken(_sFieldName,2,'.')[0] == '*' ) )
{
bAsterisk = true;
}
@@ -146,7 +147,7 @@ OSelectionBrowseBox::OSelectionBrowseBox( vcl::Window* pParent )
const OUString aTxt(DBA_RES(STR_QUERY_SORTTEXT));
for (sal_Int32 nIdx {0}; nIdx>=0;)
- rOrderBox.append_text(aTxt.getToken(0, ';', nIdx));
+ rOrderBox.append_text(OUString(o3tl::getToken(aTxt, 0, ';', nIdx)));
m_bVisibleRow.insert(m_bVisibleRow.end(), BROW_ROW_CNT, true);
@@ -492,7 +493,7 @@ void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, sal
getDesignView()->fillValidFields(aTable, rComboBox);
// replace with alias.*
- if (aField.trim() == "*")
+ if (o3tl::trim(aField) == u"*")
{
aField = aTable + ".*";
}
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 360cd2821235..248fbc66d308 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -68,6 +68,7 @@
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <osl/mutex.hxx>
+#include <o3tl/string_view.hxx>
#include <memory>
#include <vector>
@@ -874,7 +875,7 @@ OUString OQueryController::getPrivateTitle( ) const
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( getMutex() );
OUString aDefaultName = DBA_RES(editingView() ? STR_VIEW_TITLE : STR_QRY_TITLE);
- return aDefaultName.getToken(0, ' ') + OUString::number(getCurrentStartNumber());
+ return o3tl::getToken(aDefaultName, 0, ' ') + OUString::number(getCurrentStartNumber());
}
}
return m_sName;
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index 17ad5ed2f28d..fb1e4805e0d8 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -53,6 +53,7 @@
#include <tools/diagnose_ex.h>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
+#include <o3tl/string_view.hxx>
#include <algorithm>
#include <functional>
@@ -1443,7 +1444,7 @@ OUString OTableController::getPrivateTitle() const
if ( sTitle.isEmpty() )
{
OUString aName = DBA_RES(STR_TBL_TITLE);
- sTitle = aName.getToken(0,' ') + OUString::number(getCurrentStartNumber());
+ sTitle = o3tl::getToken(aName,0,' ') + OUString::number(getCurrentStartNumber());
}
}
catch( const Exception& )