use more string_view in various

found by examining uses of OUString::copy() for likely places

Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2022-04-29 11:06:33 +02:00
parent b90d3d316d
commit 5200a73627
87 changed files with 404 additions and 377 deletions

View File

@ -61,6 +61,7 @@
#include <vcl/svapp.hxx>
#include <vcl/taskpanelist.hxx>
#include <vcl/help.hxx>
#include <o3tl/string_view.hxx>
#include <cppuhelper/implbase.hxx>
#include <vector>
#include <com/sun/star/reflection/theCoreReflection.hpp>
@ -795,17 +796,17 @@ void EditorWindow::HandleProcedureCompletion()
if( aCurrPortions.size() >= 3 )
{//at least 3 tokens: (sub|function) whitespace identifier...
HighlightPortion& r = aCurrPortions.front();
OUString sStr = aCurrLine.copy(r.nBegin, r.nEnd - r.nBegin);
std::u16string_view sStr = aCurrLine.subView(r.nBegin, r.nEnd - r.nBegin);
if( r.tokenType == TokenType::Keywords )
{
if( sStr.equalsIgnoreAsciiCase("sub") || sStr.equalsIgnoreAsciiCase("function") )
if( o3tl::equalsIgnoreAsciiCase(sStr, u"sub") || o3tl::equalsIgnoreAsciiCase(sStr, u"function") )
{
pEditView->InsertText( sText );//append to the end
GetEditView()->SetSelection(aSel);
break;
}
if( sStr.equalsIgnoreAsciiCase("end") )
if( o3tl::equalsIgnoreAsciiCase(sStr, u"end") )
break;
}
}

View File

@ -31,6 +31,7 @@
#include <algorithm>
#include <osl/diagnose.h>
#include <rtl/ustrbuf.hxx>
#include <o3tl/string_view.hxx>
#include <com/sun/star/script/ModuleType.hpp>
// nInc is the increment size of the buffers
@ -200,24 +201,24 @@ void SbiCodeGen::Save()
if( nIfaceCount )
{
int nPropPrefixFound = aProcName.indexOf("Property ");
OUString aPureProcName = aProcName;
OUString aPropPrefix;
std::u16string_view aPureProcName = aProcName;
std::u16string_view aPropPrefix;
if( nPropPrefixFound == 0 )
{
aPropPrefix = aProcName.copy( 0, 13 ); // 13 == Len( "Property ?et " )
aPureProcName = aProcName.copy( 13 );
aPropPrefix = aProcName.subView( 0, 13 ); // 13 == Len( "Property ?et " )
aPureProcName = aProcName.subView( 13 );
}
for( int i = 0 ; i < nIfaceCount ; i++ )
{
const OUString& rIfaceName = pParser->aIfaceVector[i];
int nFound = aPureProcName.indexOf( rIfaceName );
if( nFound == 0 && aPureProcName[rIfaceName.getLength()] == '_' )
bool bFound = o3tl::starts_with(aPureProcName, rIfaceName );
if( bFound && aPureProcName[rIfaceName.getLength()] == '_' )
{
if( nPropPrefixFound == 0 )
{
aIfaceProcName.append(aPropPrefix);
}
aIfaceProcName.append(aPureProcName.subView(rIfaceName.getLength() + 1) );
aIfaceProcName.append(aPureProcName.substr(rIfaceName.getLength() + 1) );
aIfaceName = rIfaceName;
nPassCount = 2;
break;

View File

@ -27,6 +27,7 @@
#include <svl/numformat.hxx>
#include <svl/zforlist.hxx>
#include <rtl/character.hxx>
#include <o3tl/string_view.hxx>
SbiScanner::SbiScanner(const OUString& rBuf, StarBASIC* p)
: aBuf(rBuf)
@ -160,8 +161,8 @@ void SbiScanner::scanGoto()
if(n + 1 < aLine.getLength())
{
OUString aTemp = aLine.copy(n, 2);
if(aTemp.equalsIgnoreAsciiCase("to"))
std::u16string_view aTemp = aLine.subView(n, 2);
if(o3tl::equalsIgnoreAsciiCase(aTemp, u"to"))
{
aSym = "goto";
nLineIdx += n + 2 - nCol;

View File

@ -1911,7 +1911,7 @@ void SbRtl_CDateFromIso(StarBASIC *, SbxArray & rPar, bool)
break;
bool bUseTwoDigitYear = false;
OUString aYearStr, aMonthStr, aDayStr;
std::u16string_view aYearStr, aMonthStr, aDayStr;
if (nLen == 6 || nLen == 8 || nLen == 9)
{
// ((Y)YY)YYMMDD
@ -1921,9 +1921,9 @@ void SbRtl_CDateFromIso(StarBASIC *, SbxArray & rPar, bool)
const sal_Int32 nMonthPos = (nLen == 8 ? 4 : (nLen == 6 ? 2 : 5));
if (nMonthPos == 2)
bUseTwoDigitYear = true;
aYearStr = aStr.copy( 0, nMonthPos );
aMonthStr = aStr.copy( nMonthPos, 2 );
aDayStr = aStr.copy( nMonthPos + 2, 2 );
aYearStr = aStr.subView( 0, nMonthPos );
aMonthStr = aStr.subView( nMonthPos, 2 );
aDayStr = aStr.subView( nMonthPos + 2, 2 );
}
else
{
@ -1934,9 +1934,9 @@ void SbRtl_CDateFromIso(StarBASIC *, SbxArray & rPar, bool)
if (aStr.indexOf('-', nMonthSep + 1) != nMonthSep + 3)
break;
aYearStr = aStr.copy( 0, nMonthSep );
aMonthStr = aStr.copy( nMonthSep + 1, 2 );
aDayStr = aStr.copy( nMonthSep + 4, 2 );
aYearStr = aStr.subView( 0, nMonthSep );
aMonthStr = aStr.subView( nMonthSep + 1, 2 );
aDayStr = aStr.subView( nMonthSep + 4, 2 );
if ( !comphelper::string::isdigitAsciiString(aYearStr) ||
!comphelper::string::isdigitAsciiString(aMonthStr) ||
!comphelper::string::isdigitAsciiString(aDayStr))
@ -1944,8 +1944,8 @@ void SbRtl_CDateFromIso(StarBASIC *, SbxArray & rPar, bool)
}
double dDate;
if (!implDateSerial( static_cast<sal_Int16>(nSign * aYearStr.toInt32()),
static_cast<sal_Int16>(aMonthStr.toInt32()), static_cast<sal_Int16>(aDayStr.toInt32()),
if (!implDateSerial( static_cast<sal_Int16>(nSign * o3tl::toInt32(aYearStr)),
static_cast<sal_Int16>(o3tl::toInt32(aMonthStr)), static_cast<sal_Int16>(o3tl::toInt32(aDayStr)),
bUseTwoDigitYear, SbDateCorrection::None, dDate ))
break;

View File

@ -85,6 +85,7 @@
#include <svtools/acceleratorexecute.hxx>
#include <tools/diagnose_ex.h>
#include <sal/log.hxx>
#include <o3tl/string_view.hxx>
#include <boost/property_tree/json_parser.hpp>
#include <sfx2/dispatch.hxx>
@ -2086,8 +2087,8 @@ void ChartController::sendPopupRequest(OUString const & rCID, tools::Rectangle a
sal_Int32 nStartPos = rCID.lastIndexOf('.');
nStartPos++;
sal_Int32 nEndPos = rCID.getLength();
OUString sDimensionIndex = rCID.copy(nStartPos, nEndPos - nStartPos);
sal_Int32 nDimensionIndex = sDimensionIndex.toInt32();
std::u16string_view sDimensionIndex = rCID.subView(nStartPos, nEndPos - nStartPos);
sal_Int32 nDimensionIndex = o3tl::toInt32(sDimensionIndex);
awt::Rectangle xRectangle {
sal_Int32(aRectangle.Left()),

View File

@ -783,7 +783,7 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
sBuffer.append(sValue);
if(sValue.indexOf('.') != -1) // there is a dot
{
for(sal_Int32 i=sValue.copy(sValue.indexOf('.')+1).getLength(); i<scale;i++)
for(sal_Int32 i=sValue.subView(sValue.indexOf('.')+1).size(); i<scale;i++)
{
sBuffer.append('0');
}

View File

@ -4809,12 +4809,11 @@ void OSQLParser::error(const char *fmt)
sal_Int32 nPos2 = sStr.indexOf(sSQL_TOKEN,nPos1+1);
if(nPos2 != -1)
{
OUString sSecond = sStr.copy(nPos1+sSQL_TOKEN.getLength(),nPos2-nPos1-sSQL_TOKEN.getLength());
sFirst += sSecond;
sFirst += sStr.copy(nPos2+sSQL_TOKEN.getLength());
sFirst += sStr.subView(nPos1+sSQL_TOKEN.getLength(),nPos2-nPos1-sSQL_TOKEN.getLength());
sFirst += sStr.subView(nPos2+sSQL_TOKEN.getLength());
}
else
sFirst += sStr.copy(nPos1+sSQL_TOKEN.getLength());
sFirst += sStr.subView(nPos1+sSQL_TOKEN.getLength());
m_sErrorMessage = sFirst;
}

View File

@ -171,14 +171,14 @@ static Reference< XInterface > loadComponent(
Reference< XImplementationLoader > xLoader;
OUString aExt( rLocation.copy( nDot +1 ) );
std::u16string_view aExt( rLocation.subView( nDot +1 ) );
if (aExt == "dll" || aExt == "exe" || aExt == "dylib" || aExt == "so")
if (aExt == u"dll" || aExt == u"exe" || aExt == u"dylib" || aExt == u"so")
{
createInstance(
xLoader, xContext, "com.sun.star.loader.SharedLibrary" );
}
else if (aExt == "jar" || aExt == "class")
else if (aExt == u"jar" || aExt == u"class")
{
createInstance(
xLoader, xContext, "com.sun.star.loader.Java" );

View File

@ -635,8 +635,8 @@ AdditionsItem::AdditionsItem(weld::Widget* pParent, AdditionsDialog* pParentDial
if (additionInfo.sName.getLength() > maxExtensionNameLength)
{
OUString sShortName = additionInfo.sName.copy(0, maxExtensionNameLength - 3);
sExtensionName = sShortName + "...";
std::u16string_view sShortName = additionInfo.sName.subView(0, maxExtensionNameLength - 3);
sExtensionName = OUString::Concat(sShortName) + "...";
}
else
{

View File

@ -158,11 +158,11 @@ OUString SvxHyphenWordDialog::EraseUnusableHyphens_Impl()
}
// 2) remove all hyphenation positions from the start that are not considered by the core
const OUString aSearchRange( aTxt.copy( 0, nPos1 ) );
sal_Int32 nPos2 = aSearchRange.lastIndexOf( '-' ); // the '-' position the core will use by default
if (nPos2 != -1 )
const std::u16string_view aSearchRange( aTxt.subView( 0, nPos1 ) );
size_t nPos2 = aSearchRange.rfind( '-' ); // the '-' position the core will use by default
if (nPos2 != std::u16string_view::npos )
{
OUString aLeft( aSearchRange.copy( 0, nPos2 ) );
OUString aLeft( aSearchRange.substr( 0, nPos2 ) );
nPos = 0;
while (nPos != -1)
{

View File

@ -115,14 +115,14 @@ OUString SvxChartColorTable::getDefaultName( size_t _nIndex )
{
OUString aName;
OUString sDefaultNamePrefix;
OUString sDefaultNamePostfix;
std::u16string_view sDefaultNamePrefix;
std::u16string_view sDefaultNamePostfix;
OUString aResName( CuiResId( RID_CUISTR_DIAGRAM_ROW ) );
sal_Int32 nPos = aResName.indexOf( "$(ROW)" );
if( nPos != -1 )
{
sDefaultNamePrefix = aResName.copy( 0, nPos );
sDefaultNamePostfix = aResName.copy( nPos + sizeof( "$(ROW)" ) - 1 );
sDefaultNamePrefix = aResName.subView( 0, nPos );
sDefaultNamePostfix = aResName.subView( nPos + sizeof( "$(ROW)" ) - 1 );
}
else
{
@ -203,13 +203,14 @@ bool SvxChartOptions::RetrieveOptions()
// create strings for entry names
OUString aResName( CuiResId( RID_CUISTR_DIAGRAM_ROW ) );
OUString aPrefix, aPostfix, aName;
std::u16string_view aPrefix, aPostfix;
OUString aName;
sal_Int32 nPos = aResName.indexOf( "$(ROW)" );
if( nPos != -1 )
{
aPrefix = aResName.copy( 0, nPos );
aPrefix = aResName.subView( 0, nPos );
sal_Int32 idx = nPos + sizeof( "$(ROW)" ) - 1;
aPostfix = aResName.copy( idx );
aPostfix = aResName.subView( idx );
}
else
aPrefix = aResName;

View File

@ -251,9 +251,9 @@ void CreateStmtParser::parseColumnPart(std::u16string_view sColumnPart)
// search next space to get the whole type name
// eg: INTEGER, VARCHAR(10), DECIMAL(6,3)
auto nNextSpace = sFromTypeName.indexOf(" ");
OUString sFullTypeName;
std::u16string_view sFullTypeName;
if (nNextSpace > 0)
sFullTypeName = sFromTypeName.copy(0, nNextSpace);
sFullTypeName = sFromTypeName.subView(0, nNextSpace);
// perhaps column type corresponds to the last info here
else
sFullTypeName = sFromTypeName;
@ -266,7 +266,8 @@ void CreateStmtParser::parseColumnPart(std::u16string_view sColumnPart)
if (isPrimaryKey)
m_PrimaryKeys.push_back(rColumnName);
const OUString sColumnWithoutName = sColumn.copy(sColumn.indexOf(typeParts.typeName));
const std::u16string_view sColumnWithoutName
= sColumn.subView(sColumn.indexOf(typeParts.typeName));
ColumnDefinition aColDef(rColumnName, lcl_getDataTypeFromHsql(typeParts.typeName),
std::move(typeParts.params), isPrimaryKey,

View File

@ -60,9 +60,14 @@ public:
{
assert(isIndexStatement());
OUString sIndexPart = m_sql.copy(m_sql.indexOf("INDEX") + 5);
sal_Int32 nQuotePos = sIndexPart.indexOf("'") + 1;
OUString sIndexNums = sIndexPart.copy(nQuotePos, sIndexPart.lastIndexOf("'") - nQuotePos);
std::u16string_view sIndexPart = m_sql.subView(m_sql.indexOf("INDEX") + 5);
size_t nQuotePos = sIndexPart.find('\'');
if (nQuotePos == std::u16string_view::npos)
nQuotePos = 0;
else
++nQuotePos;
std::u16string_view sIndexNums
= sIndexPart.substr(nQuotePos, sIndexPart.rfind('\'') - nQuotePos);
std::vector<OUString> sIndexes = string::split(sIndexNums, u' ');
IndexVector indexes;

View File

@ -357,7 +357,7 @@ namespace dbaui
int nPos(rBox.find_text(rBox.get_active_text()));
if (nPos == -1)
return rBox.get_active_text().copy(0);
return rBox.get_active_text();
if ( m_xTextSeparator.get() != &rBox || nPos != (rBox.get_count()-1) )
return OUString(

View File

@ -1054,7 +1054,7 @@ bool OSelectionBrowseBox::SaveModified()
sal_Int32 nPos = rComboBox.get_active();
// these functions are only available in CORE
OUString sFunctionName = rComboBox.get_text(nPos);
OUString sGroupFunctionName = m_aFunctionStrings.copy(m_aFunctionStrings.lastIndexOf(';')+1);
std::u16string_view sGroupFunctionName = m_aFunctionStrings.subView(m_aFunctionStrings.lastIndexOf(';')+1);
bool bGroupBy = false;
if ( sGroupFunctionName == sFunctionName ) // check if the function name is GROUP
{
@ -2282,16 +2282,16 @@ void OSelectionBrowseBox::SetCellContents(sal_Int32 nRow, sal_uInt16 nColId, con
break;
case BROW_FUNCTION_ROW:
{
OUString sGroupFunctionName = m_aFunctionStrings.copy(m_aFunctionStrings.lastIndexOf(';')+1);
std::u16string_view sGroupFunctionName = m_aFunctionStrings.subView(m_aFunctionStrings.lastIndexOf(';')+1);
pEntry->SetFunction(strNewText);
// first reset this two member
sal_Int32 nFunctionType = pEntry->GetFunctionType();
nFunctionType &= ~FKT_AGGREGATE;
pEntry->SetFunctionType(nFunctionType);
if ( pEntry->IsGroupBy() && !sGroupFunctionName.equalsIgnoreAsciiCase(strNewText) )
if ( pEntry->IsGroupBy() && !o3tl::equalsIgnoreAsciiCase(sGroupFunctionName, strNewText) )
pEntry->SetGroupBy(false);
if ( sGroupFunctionName.equalsIgnoreAsciiCase(strNewText) )
if ( o3tl::equalsIgnoreAsciiCase(sGroupFunctionName, strNewText) )
pEntry->SetGroupBy(true);
else if ( !strNewText.isEmpty() )
{

View File

@ -1304,10 +1304,10 @@ BackendImpl::ComponentPackageImpl::isRegistered_(
{
//try to match only the file name
OUString thisUrl(getURL());
OUString thisFileName(thisUrl.copy(thisUrl.lastIndexOf('/')));
std::u16string_view thisFileName(thisUrl.subView(thisUrl.lastIndexOf('/')));
OUString locationFileName(location.copy(location.lastIndexOf('/')));
if (locationFileName.equalsIgnoreAsciiCase(thisFileName))
std::u16string_view locationFileName(location.subView(location.lastIndexOf('/')));
if (o3tl::equalsIgnoreAsciiCase(locationFileName, thisFileName))
bAmbiguousComponentName = true;
}
}

View File

@ -31,6 +31,7 @@
#include <svl/inettype.hxx>
#include <unotools/pathoptions.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <o3tl/string_view.hxx>
#if HAVE_FEATURE_XMLHELP
#include <helpcompiler/compilehelp.hxx>
@ -447,9 +448,8 @@ void BackendImpl::implProcessHelp(
implCollectXhpFiles( aSubFolderURL, aXhpFileVector );
// Copy to package (later: move?)
OUString aDestPath = aDestBasePath;
OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL );
aDestPath += aPureFolderName;
std::u16string_view aPureFolderName = aSubFolderURL.subView( nLenLangFolderURL );
OUString aDestPath = aDestBasePath + aPureFolderName;
xSFA->copy( aSubFolderURL, aDestPath );
}
@ -580,8 +580,8 @@ void BackendImpl::implCollectXhpFiles( const OUString& aDir,
sal_Int32 nLastDot = aURL.lastIndexOf( '.' );
if( nLastDot != -1 )
{
OUString aExt = aURL.copy( nLastDot + 1 );
if( aExt.equalsIgnoreAsciiCase( "xhp" ) )
std::u16string_view aExt = aURL.subView( nLastDot + 1 );
if( o3tl::equalsIgnoreAsciiCase( aExt, u"xhp" ) )
o_rXhpFileVector.push_back( aURL );
}
}

View File

@ -839,9 +839,9 @@ std::vector< MigrationModuleInfo > MigrationImpl::detectUIChangesForAllModules()
aModuleInfo.sModuleShortName = sModuleShortName;
sal_Int32 nIndex = sToolbarName.lastIndexOf('.');
if (nIndex > 0) {
OUString sExtension(sToolbarName.copy(nIndex));
std::u16string_view sExtension(sToolbarName.subView(nIndex));
OUString sToolbarResourceName(sToolbarName.copy(0, nIndex));
if (!sToolbarResourceName.isEmpty() && sExtension == ".xml")
if (!sToolbarResourceName.isEmpty() && sExtension == u".xml")
aModuleInfo.m_vToolbars.push_back(sToolbarResourceName);
}
}

View File

@ -108,7 +108,7 @@ namespace migration
TStringVectorPtr aFileList = getFiles( m_sSourceDir );
for (auto const& elem : *aFileList)
{
OUString sLocalName = elem.copy( m_sSourceDir.getLength() );
std::u16string_view sLocalName = elem.subView( m_sSourceDir.getLength() );
OUString sTargetName = sTargetDir + sLocalName;
INetURLObject aURL( sTargetName );
aURL.removeSegment();

View File

@ -138,7 +138,7 @@ static bool IsUserWordbook( const OUString& rFile )
{
if (IsUserWordbook(elem) )
{
OUString sSourceLocalName = elem.copy( m_sSourceDir.getLength() );
std::u16string_view sSourceLocalName = elem.subView( m_sSourceDir.getLength() );
OUString sTargetName = sTargetDir + sSourceLocalName;
INetURLObject aURL( sTargetName );
aURL.removeSegment();

View File

@ -1971,8 +1971,8 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
{
// TODO: handle all alternative hyphenations (see hyphen-1.2.8/tests/unicode.*)
OUString aAlt( xHyphWord->getHyphenatedWord() );
OUString aAltLeft(aAlt.copy(0, _nWordLen));
OUString aAltRight(aAlt.copy(_nWordLen));
std::u16string_view aAltLeft(aAlt.subView(0, _nWordLen));
std::u16string_view aAltRight(aAlt.subView(_nWordLen));
bAltFullLeft = aWord.startsWith(aAltLeft);
bAltFullRight = aWord.endsWith(aAltRight);
nAltDelChar = aWord.getLength() - aAlt.getLength() + static_cast<int>(!bAltFullLeft) + static_cast<int>(!bAltFullRight);

View File

@ -519,7 +519,7 @@ bool SvxAutoCorrect::FnChgOrdinalNumber(
const uno::Sequence< OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix(nNum, rCC.getLanguageTag().getLocale());
for (OUString const & sSuffix : aSuffixes)
{
OUString sEnd = rTxt.copy(nNumEnd + 1, nEndPos - nNumEnd - 1);
std::u16string_view sEnd = rTxt.subView(nNumEnd + 1, nEndPos - nNumEnd - 1);
if (sSuffix == sEnd)
{
@ -2971,7 +2971,7 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p
if (bWasWordDelim) rStt++;
OUString left_pattern = rTxt.copy(rStt, nEndPos - rStt - rChk.getLength() + left_wildcard);
// avoid double spaces before simple "word" replacement
left_pattern += (left_pattern.getLength() == 0 && pFnd->GetLong()[0] == 0x20) ? pFnd->GetLong().copy(1) : pFnd->GetLong();
left_pattern += (left_pattern.getLength() == 0 && pFnd->GetLong()[0] == 0x20) ? pFnd->GetLong().subView(1) : pFnd->GetLong();
if( const SvxAutocorrWord* pNew = Insert( SvxAutocorrWord(rTxt.copy(rStt, nEndPos - rStt), left_pattern) ) )
return pNew;
}
@ -3018,7 +3018,7 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p
if ( !left_wildcard )
{
sal_Int32 siz = nEndPos - nFndPos - sTmp.getLength();
aLong = pFnd->GetLong() + (siz > 0 ? rTxt.copy(nFndPos + sTmp.getLength(), siz) : "");
aLong = pFnd->GetLong() + (siz > 0 ? rTxt.subView(nFndPos + sTmp.getLength(), siz) : u"");
} else {
OUStringBuffer buf;
do {

View File

@ -237,11 +237,11 @@ namespace pcr
sal_Int32 nPrefixLen = aScriptEvent.ScriptCode.indexOf( ':' );
OSL_ENSURE( nPrefixLen > 0, "lcl_getAssignedScriptEvent: illegal location!" );
OUString sLocation = aScriptEvent.ScriptCode.copy( 0, nPrefixLen );
OUString sMacroPath = aScriptEvent.ScriptCode.copy( nPrefixLen + 1 );
std::u16string_view sLocation = aScriptEvent.ScriptCode.subView( 0, nPrefixLen );
std::u16string_view sMacroPath = aScriptEvent.ScriptCode.subView( nPrefixLen + 1 );
aScriptEvent.ScriptCode =
"vnd.sun.star.script:" +
OUString::Concat("vnd.sun.star.script:") +
sMacroPath +
"?language=Basic&location=" +
sLocation;

View File

@ -586,10 +586,10 @@ namespace frm
}
// is it a UNO slot?
OUString sUnoProtocolPrefix( ".uno:" );
static constexpr std::u16string_view sUnoProtocolPrefix( u".uno:" );
if ( _rURL.Complete.startsWith( sUnoProtocolPrefix ) )
{
OUString sUnoSlotName = _rURL.Complete.copy( sUnoProtocolPrefix.getLength() );
OUString sUnoSlotName = _rURL.Complete.copy( sUnoProtocolPrefix.size() );
SfxSlotId nSlotId = lcl_getSlotFromUnoName( SfxSlotPool::GetSlotPool(), sUnoSlotName );
if ( nSlotId > 0 )
{

View File

@ -460,7 +460,7 @@ bool JobData::hasCorrectContext(const OUString& rModuleIdent) const
sal_Int32 nIndex = m_sContext.indexOf( rModuleIdent );
if ( nIndex >= 0 && ( nIndex+nModuleIdLen <= nContextLen ))
{
OUString sContextModule = m_sContext.copy( nIndex, nModuleIdLen );
std::u16string_view sContextModule = m_sContext.subView( nIndex, nModuleIdLen );
return sContextModule == rModuleIdent;
}
}

View File

@ -74,6 +74,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <o3tl/safeint.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <o3tl/string_view.hxx>
#include <unotools/mediadescriptor.hxx>
#include <comphelper/multiinterfacecontainer3.hxx>
#include <comphelper/namedvaluecollection.hxx>
@ -1837,8 +1838,8 @@ void AutoRecovery::implts_readConfig()
if (pItems[i].startsWith(sRECOVERY_ITEM_BASE_IDENTIFIER))
{
OUString sID = pItems[i].copy(sRECOVERY_ITEM_BASE_IDENTIFIER.getLength());
aInfo.ID = sID.toInt32();
std::u16string_view sID = pItems[i].subView(sRECOVERY_ITEM_BASE_IDENTIFIER.getLength());
aInfo.ID = o3tl::toInt32(sID);
/* SAFE */ {
osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
if (aInfo.ID > m_nIdPool)

View File

@ -58,6 +58,7 @@
#include <comphelper/propertyvalue.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/servicehelper.hxx>
#include <o3tl/string_view.hxx>
#include <memory>
#include <mutex>
#include <string_view>
@ -243,11 +244,11 @@ sal_Int16 RetrieveTypeFromResourceURL( const OUString& aResourceURL )
if (( aResourceURL.startsWith( RESOURCEURL_PREFIX ) ) &&
( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
{
OUString aTmpStr = aResourceURL.copy( RESOURCEURL_PREFIX_SIZE );
sal_Int32 nIndex = aTmpStr.indexOf( '/' );
if (( nIndex > 0 ) && ( aTmpStr.getLength() > nIndex ))
std::u16string_view aTmpStr = aResourceURL.subView( RESOURCEURL_PREFIX_SIZE );
size_t nIndex = aTmpStr.find( '/' );
if (( nIndex > 0 ) && ( aTmpStr.size() > nIndex ))
{
OUString aTypeStr( aTmpStr.copy( 0, nIndex ));
std::u16string_view aTypeStr( aTmpStr.substr( 0, nIndex ));
for ( int i = 0; i < ui::UIElementType::COUNT; i++ )
{
if ( aTypeStr == UIELEMENTTYPENAMES[i] )
@ -375,11 +376,11 @@ void ModuleUIConfigurationManager::impl_preloadUIElementTypeList( Layer eLayer,
sal_Int32 nIndex = rElementName.lastIndexOf( '.' );
if (( nIndex > 0 ) && ( nIndex < rElementName.getLength() ))
{
OUString aExtension( rElementName.copy( nIndex+1 ));
OUString aUIElementName( rElementName.copy( 0, nIndex ));
std::u16string_view aExtension( rElementName.subView( nIndex+1 ));
std::u16string_view aUIElementName( rElementName.subView( 0, nIndex ));
if (!aUIElementName.isEmpty() &&
( aExtension.equalsIgnoreAsciiCase("xml")))
if (!aUIElementName.empty() &&
( o3tl::equalsIgnoreAsciiCase(aExtension, u"xml")))
{
aUIElementData.aResourceURL = aResURLPrefix + aUIElementName;
aUIElementData.aName = rElementName;

View File

@ -53,6 +53,7 @@
#include <comphelper/servicehelper.hxx>
#include <vcl/svapp.hxx>
#include <sal/log.hxx>
#include <o3tl/string_view.hxx>
#include <mutex>
#include <string_view>
@ -220,11 +221,11 @@ sal_Int16 RetrieveTypeFromResourceURL( const OUString& aResourceURL )
if (( aResourceURL.startsWith( RESOURCEURL_PREFIX ) ) &&
( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
{
OUString aTmpStr = aResourceURL.copy( RESOURCEURL_PREFIX_SIZE );
sal_Int32 nIndex = aTmpStr.indexOf( '/' );
if (( nIndex > 0 ) && ( aTmpStr.getLength() > nIndex ))
std::u16string_view aTmpStr = aResourceURL.subView( RESOURCEURL_PREFIX_SIZE );
size_t nIndex = aTmpStr.find( '/' );
if (( nIndex > 0 ) && ( aTmpStr.size() > nIndex ))
{
OUString aTypeStr( aTmpStr.copy( 0, nIndex ));
std::u16string_view aTypeStr( aTmpStr.substr( 0, nIndex ));
for ( int i = 0; i < UIElementType::COUNT; i++ )
{
if ( aTypeStr == UIELEMENTTYPENAMES[i] )
@ -300,11 +301,11 @@ void UIConfigurationManager::impl_preloadUIElementTypeList( sal_Int16 nElementTy
sal_Int32 nIndex = rElementName.lastIndexOf( '.' );
if (( nIndex > 0 ) && ( nIndex < rElementName.getLength() ))
{
OUString aExtension( rElementName.copy( nIndex+1 ));
OUString aUIElementName( rElementName.copy( 0, nIndex ));
std::u16string_view aExtension( rElementName.subView( nIndex+1 ));
std::u16string_view aUIElementName( rElementName.subView( 0, nIndex ));
if (!aUIElementName.isEmpty() &&
( aExtension.equalsIgnoreAsciiCase("xml")))
if (!aUIElementName.empty() &&
( o3tl::equalsIgnoreAsciiCase(aExtension, u"xml")))
{
aUIElementData.aResourceURL = aResURLPrefix + aUIElementName;
aUIElementData.aName = rElementName;

View File

@ -31,6 +31,7 @@
#include <vcl/graph.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <o3tl/string_view.hxx>
using namespace css;
using namespace com::sun::star::uno;
@ -383,14 +384,14 @@ void SAL_CALL RecentFilesMenuController::dispatch(
return;
sal_Int32 nAddArgs = aURL.Complete.indexOf( '&', nEntryPos );
OUString aEntryArg;
std::u16string_view aEntryArg;
if ( nAddArgs < 0 )
aEntryArg = aURL.Complete.copy( nEntryPos );
aEntryArg = aURL.Complete.subView( nEntryPos );
else
aEntryArg = aURL.Complete.copy( nEntryPos, nAddArgs-nEntryPos );
aEntryArg = aURL.Complete.subView( nEntryPos, nAddArgs-nEntryPos );
sal_Int32 nEntry = aEntryArg.toInt32();
sal_Int32 nEntry = o3tl::toInt32(aEntryArg);
executeEntry( nEntry );
}

View File

@ -633,9 +633,8 @@ void ToolBarManager::Init()
// set name for testtool, the useful part is after the last '/'
sal_Int32 idx = m_aResourceName.lastIndexOf('/');
idx++; // will become 0 if '/' not found: use full string
OString aHelpIdAsString( ".HelpId:" );
OUString aToolbarName = m_aResourceName.copy( idx );
aHelpIdAsString += OUStringToOString( aToolbarName, RTL_TEXTENCODING_UTF8 );
std::u16string_view aToolbarName = m_aResourceName.subView( idx );
OString aHelpIdAsString = ".HelpId" + OUStringToOString( aToolbarName, RTL_TEXTENCODING_UTF8 );
m_pImpl->SetHelpId( aHelpIdAsString );
m_aAsyncUpdateControllersTimer.SetTimeout( 50 );

View File

@ -693,7 +693,7 @@ OUString NativeNumberSupplierService::getNativeNumberString(const OUString& aNum
{
case CAPITALIZE:
return xCharClass->toTitle(aStr, 0, 1, aLocale) +
(aStr.getLength() > 1 ? aStr.copy(1) : OUString());
(aStr.getLength() > 1 ? aStr.subView(1) : u"");
case UPPER:
return xCharClass->toUpper(aStr, 0, aStr.getLength(), aLocale);
case LOWER:

View File

@ -521,7 +521,6 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
//! should at least work with the German words
//! B-"u-c-k-er and Sc-hif-fah-rt
OUString aLeft, aRight;
sal_Int16 nPos = GetOrigWordPos( rOrigWord, nChgPos );
// get words like Sc-hif-fah-rt to work correct
@ -529,12 +528,12 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
if (nChgPos > nHyphenationPos)
--nPos;
aLeft = rOrigWord.copy( 0, nPos );
aRight = rOrigWord.copy( nPos ); // FIXME: changes at the right side
std::u16string_view aLeft = rOrigWord.subView( 0, nPos );
std::u16string_view aRight = rOrigWord.subView( nPos ); // FIXME: changes at the right side
aOrigHyphenatedWord = aLeft + aRplc + aRight;
nOrigHyphenPos = sal::static_int_cast< sal_Int16 >(aLeft.getLength() +
nOrigHyphenPos = sal::static_int_cast< sal_Int16 >(aLeft.size() +
rxHyphWord->getHyphenPos() - nChgPos);
nOrigHyphenationPos = GetOrigWordPos( rOrigWord, nHyphenationPos );
}

View File

@ -373,8 +373,8 @@ void LwpFribField::RegisterTimeField(const LwpFieldMark* pFieldMark)
if (index < 0)
return;
OUString tag = sFormula.copy(0, index);
if (tag == "Now()" || tag == "CreateDate" || tag == "EditDate")
std::u16string_view tag = sFormula.subView(0, index);
if (tag == u"Now()" || tag == u"CreateDate" || tag == u"EditDate")
RegisterDateTimeStyle(sFormula.copy(index + 1));
}
}

View File

@ -429,27 +429,27 @@ bool LwpFieldMark::IsDateTimeField(sal_uInt8& type,OUString& formula)
return false;
}
OUString tag = sFormula.copy(0,index);
if (tag == "Now()")
std::u16string_view tag = sFormula.subView(0,index);
if (tag == u"Now()")
{
type = DATETIME_NOW;
formula = sFormula.copy(index+1);
return true;
}
else if (tag == "CreateDate")
else if (tag == u"CreateDate")
{
type = DATETIME_CREATE;
formula = sFormula.copy(index+1);
return true;
}
else if (tag == "EditDate")
else if (tag == u"EditDate")
{
type = DATETIME_LASTEDIT;
formula = sFormula.copy(index+1);
return true;
}
else if (tag == "YesterdaysDate" || tag == "TomorrowsDate"
|| tag == "TodaysDate")
else if (tag == u"YesterdaysDate" || tag == u"TomorrowsDate"
|| tag == u"TodaysDate")
{
type = DATETIME_SKIP;
return true;
@ -476,14 +476,14 @@ bool LwpFieldMark::IsCrossRefField(sal_uInt8& nType, OUString& sMarkName)
return false;
}
OUString tag = sFormula.copy(0,index);
if (tag == "PageRef")
std::u16string_view tag = sFormula.subView(0,index);
if (tag == u"PageRef")
{
sMarkName = sFormula.copy(index+1);
nType = CROSSREF_PAGE;
return true;
}
else if (tag == "ParaRef")
else if (tag == u"ParaRef")
{
sMarkName = sFormula.copy(index+1);
nType = CROSSREF_PARANUMBER;

View File

@ -58,6 +58,7 @@
#include <cppuhelper/implbase.hxx>
#include <rtl/uri.hxx>
#include <rtl/random.h>
#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
#include <com/sun/star/io/XAsyncOutputMonitor.hpp>
@ -602,24 +603,24 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
if ( nParam >= 0 )
{
m_aURL = aParamUrl.copy( 0, nParam );
OUString aParam = aParamUrl.copy( nParam + 1 );
std::u16string_view aParam = aParamUrl.subView( nParam + 1 );
sal_Int32 nIndex = 0;
do
{
OUString aCommand = aParam.getToken( 0, '&', nIndex );
if ( aCommand == "repairpackage" )
std::u16string_view aCommand = o3tl::getToken(aParam, 0, '&', nIndex );
if ( aCommand == u"repairpackage" )
{
m_bForceRecovery = true;
break;
}
else if ( aCommand == "purezip" )
else if ( aCommand == u"purezip" )
{
m_nFormat = embed::StorageFormats::ZIP;
m_xRootFolder->setPackageFormat_Impl( m_nFormat );
break;
}
else if ( aCommand == "ofopxml" )
else if ( aCommand == u"ofopxml" )
{
m_nFormat = embed::StorageFormats::OFOPXML;
m_xRootFolder->setPackageFormat_Impl( m_nFormat );

View File

@ -97,8 +97,8 @@ namespace rptui
// must be identical
if ( _rExpression.getLength() < nLHSIndex )
return false;
const OUString sExprPart1( _rExpression.copy( 0, nLHSIndex ) );
const OUString sMatchExprPart1( sMatchExpression.copy( 0, nLHSIndex ) );
const std::u16string_view sExprPart1( _rExpression.subView( 0, nLHSIndex ) );
const std::u16string_view sMatchExprPart1( sMatchExpression.subView( 0, nLHSIndex ) );
if ( sExprPart1 != sMatchExprPart1 )
// the left-most expression parts do not match
return false;
@ -107,11 +107,11 @@ namespace rptui
// must be identical, too
bool bHaveRHS( nRHSIndex != -1 );
sal_Int32 nRightMostIndex( bHaveRHS ? nRHSIndex : nLHSIndex );
const OUString sMatchExprPart3( sMatchExpression.copy( nRightMostIndex + 2 ) );
if ( _rExpression.getLength() < sMatchExprPart3.getLength() )
const std::u16string_view sMatchExprPart3( sMatchExpression.subView( nRightMostIndex + 2 ) );
if ( _rExpression.getLength() < static_cast<sal_Int32>(sMatchExprPart3.size()) )
// the expression is not even long enough to hold the right-most part of the match expression
return false;
const OUString sExprPart3( _rExpression.copy( _rExpression.getLength() - sMatchExprPart3.getLength() ) );
const std::u16string_view sExprPart3( _rExpression.subView( _rExpression.getLength() - sMatchExprPart3.size() ) );
if ( sExprPart3 != sMatchExprPart3 )
// the right-most expression parts do not match
return false;
@ -119,28 +119,28 @@ namespace rptui
// if we don't have an RHS, we're done
if ( !bHaveRHS )
{
_out_rLHS = _rExpression.copy( sExprPart1.getLength(), _rExpression.getLength() - sExprPart1.getLength() - sExprPart3.getLength() );
_out_rLHS = _rExpression.copy( sExprPart1.size(), _rExpression.getLength() - sExprPart1.size() - sExprPart3.size() );
return true;
}
// strip the match expression by its right-most and left-most part, and by the placeholders $1 and $2
sal_Int32 nMatchExprPart2Start( nLHSIndex + sLHSPattern.getLength() );
OUString sMatchExprPart2 = sMatchExpression.copy(
std::u16string_view sMatchExprPart2 = sMatchExpression.subView(
nMatchExprPart2Start,
sMatchExpression.getLength() - nMatchExprPart2Start - sMatchExprPart3.getLength() - 2
sMatchExpression.getLength() - nMatchExprPart2Start - sMatchExprPart3.size() - 2
);
// strip the expression by its left-most and right-most part
const OUString sExpression( _rExpression.copy(
sExprPart1.getLength(),
_rExpression.getLength() - sExprPart1.getLength() - sExprPart3.getLength()
const std::u16string_view sExpression( _rExpression.subView(
sExprPart1.size(),
_rExpression.getLength() - sExprPart1.size() - sExprPart3.size()
) );
sal_Int32 nPart2Index = sExpression.indexOf( sMatchExprPart2 );
if ( nPart2Index == -1 )
size_t nPart2Index = sExpression.find( sMatchExprPart2 );
if ( nPart2Index == std::u16string_view::npos )
// the "middle" part of the match expression does not exist in the expression at all
return false;
OSL_ENSURE( sExpression.indexOf( sMatchExprPart2, nPart2Index + 1 ) == -1,
OSL_ENSURE( sExpression.find( sMatchExprPart2, nPart2Index + 1 ) == std::u16string_view::npos,
"ConditionalExpression::matchExpression: ambiguous matching!" );
// if this fires, then we're lost: The middle part exists two times in the expression,
// so we cannot reliably determine what's the LHS and what's the RHS.
@ -154,8 +154,8 @@ namespace rptui
// Here, at the latest, you can see that we need another mechanism, anyway, which does not
// rely on those strange expression building/matching
_out_rLHS = sExpression.copy( 0, nPart2Index );
_out_rRHS = sExpression.copy( nPart2Index + sMatchExprPart2.getLength() );
_out_rLHS = sExpression.substr( 0, nPart2Index );
_out_rRHS = sExpression.substr( nPart2Index + sMatchExprPart2.size() );
return true;
}

View File

@ -247,14 +247,14 @@ void SAL_CALL ImportDocumentHandler::startElement(const OUString & _sName, const
const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
for(sal_Int16 i = 0; i < nLength; ++i)
{
OUString sLocalName;
std::u16string_view sLocalName;
const OUString sAttrName = _xAttrList->getNameByIndex( i );
const sal_Int32 nColonPos = sAttrName.indexOf( ':' );
if( -1 == nColonPos )
sLocalName = sAttrName;
else
sLocalName = sAttrName.copy( nColonPos + 1 );
if ( sLocalName == "data-source-has-labels" )
sLocalName = sAttrName.subView( nColonPos + 1 );
if ( sLocalName == u"data-source-has-labels" )
{
const OUString sValue = _xAttrList->getValueByIndex( i );
bHasCategories = sValue == "both";

View File

@ -37,6 +37,7 @@
#include <sal/log.hxx>
#include <salhelper/thread.hxx>
#include <tools/diagnose_ex.h>
#include <o3tl/string_view.hxx>
#include <queue>
#include <memory>
@ -1651,9 +1652,9 @@ static bool NormalizeOasisURN( OUString& rName )
// :urn:oasis:names:tc:[^:]:xmlns.*
nPos = nTCIdEnd + 1;
OUString sTmp( rName.copy( nPos ) );
std::u16string_view sTmp( rName.subView( nPos ) );
const OUString& rXMLNS = XML_XMLNS;
if( !sTmp.startsWith( rXMLNS ) )
if( !o3tl::starts_with(sTmp, rXMLNS ) )
return false;
// :urn:oasis:names:tc:[^:]:xmlns:.*

View File

@ -2038,7 +2038,7 @@ template<typename T > static void lcl_Format( T& r, SCTAB nTab, SCROW nRow, SCCO
{
lcl_string_append(r.append("'["), aDocName);
r.append("]");
lcl_string_append(r, aTabName.copy(1));
lcl_string_append(r, aTabName.subView(1));
}
else
{

View File

@ -291,7 +291,7 @@ void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos )
if (nSep >= 0)
{
OUString aRef = aExpr.copy(nSep+1);
OUString aExtDocNameTabName = aExpr.copy(0, nSep+1);
std::u16string_view aExtDocNameTabName = aExpr.subView(0, nSep+1);
nResult = aAddr.Parse(aRef, mrDoc, aDetails);
aAddr.SetTab(0); // force to first tab to avoid error on checking
nFlags = lcl_NextFlags( nResult );

View File

@ -431,9 +431,9 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU
if (nSepPos != -1)
{
OUString aSheetName(aTextMark.copy(0, nSepPos));
std::u16string_view aSheetName(aTextMark.subView(0, nSepPos));
if (aSheetName.indexOf(' ') != -1 && aSheetName[0] != '\'')
if (aSheetName.find(' ') != std::u16string_view::npos && aSheetName[0] != '\'')
{
aTextMark = "'" + aTextMark.replaceAt(nSepPos, 0, u"'");
}

View File

@ -26,6 +26,7 @@
#include <sal/macros.h>
#include <sal/log.hxx>
#include <tools/solar.h>
#include <o3tl/string_view.hxx>
#include <unotools/fontdefs.hxx>
#include <filter/msfilter/msvbahelper.hxx>
#include <xestream.hxx>
@ -629,8 +630,8 @@ bool XclTools::GetBuiltInStyleId( sal_uInt8& rnStyleId, sal_uInt8& rnLevel, cons
{
if( (nStyleId == EXC_STYLE_ROWLEVEL) || (nStyleId == EXC_STYLE_COLLEVEL) )
{
OUString aLevel = rStyleName.copy(nNextChar);
sal_Int32 nLevel = aLevel.toInt32();
std::u16string_view aLevel = rStyleName.subView(nNextChar);
sal_Int32 nLevel = o3tl::toInt32(aLevel);
if (std::u16string_view(OUString::number(nLevel)) == aLevel
&& nLevel > 0 && nLevel <= EXC_STYLE_LEVELCOUNT)
{

View File

@ -40,6 +40,7 @@
#include <com/sun/star/sheet/DataImportMode.hpp>
#include <com/sun/star/table/TableOrientation.hpp>
#include <osl/diagnose.h>
#include <o3tl/string_view.hxx>
#include <memory>
@ -683,12 +684,12 @@ ScXMLSortGroupsContext::ScXMLSortGroupsContext( ScXMLImport& rImport,
const OUString &sValue = aIter.toString();
if (sValue.getLength() > 8)
{
OUString sTemp = sValue.copy(0, 8);
if (sTemp == "UserList")
std::u16string_view sTemp = sValue.subView(0, 8);
if (sTemp == u"UserList")
{
pDatabaseRangeContext->SetSubTotalsEnabledUserList(true);
sTemp = sValue.copy(8);
pDatabaseRangeContext->SetSubTotalsUserListIndex(static_cast<sal_Int16>(sTemp.toInt32()));
sTemp = sValue.subView(8);
pDatabaseRangeContext->SetSubTotalsUserListIndex(static_cast<sal_Int16>(o3tl::toInt32(sTemp)));
}
else
{

View File

@ -173,12 +173,12 @@ void ScXMLSortContext::AddSortField(std::u16string_view sFieldNumber, const OUSt
aSortField.SortAscending = false;
if (sDataType.getLength() > 8)
{
OUString sTemp = sDataType.copy(0, 8);
if (sTemp == "UserList")
std::u16string_view sTemp = sDataType.subView(0, 8);
if (sTemp == u"UserList")
{
bEnabledUserList = true;
sTemp = sDataType.copy(8);
nUserListIndex = static_cast<sal_Int16>(sTemp.toInt32());
sTemp = sDataType.subView(8);
nUserListIndex = static_cast<sal_Int16>(o3tl::toInt32(sTemp));
}
else
{

View File

@ -402,7 +402,7 @@ SdStyleSheet* SdStyleSheet::GetRealStyleSheet() const
sal_Int32 nPos = aStyleName.indexOf(aOutlineStr);
if (nPos >= 0)
{
OUString aNumStr(aStyleName.copy(aOutlineStr.getLength()));
std::u16string_view aNumStr(aStyleName.subView(aOutlineStr.getLength()));
aInternalName = STR_LAYOUT_OUTLINE + aNumStr;
}
}
@ -464,7 +464,7 @@ SdStyleSheet* SdStyleSheet::GetPseudoStyleSheet() const
sal_Int32 nPos = aStyleName.indexOf(aOutlineStr);
if (nPos != -1)
{
OUString aNumStr(aStyleName.copy(aOutlineStr.getLength()));
std::u16string_view aNumStr(aStyleName.subView(aOutlineStr.getLength()));
aStyleName = SdResId(STR_PSEUDOSHEET_OUTLINE) + aNumStr;
}
}

View File

@ -83,7 +83,7 @@ StyleSheetUndoAction::StyleSheetUndoAction(SdDrawDocument* pTheDoc,
nPos = aName.indexOf(aOutlineStr);
if (nPos != -1)
{
OUString aNumStr(aName.copy(aOutlineStr.getLength()));
std::u16string_view aNumStr(aName.subView(aOutlineStr.getLength()));
aName = STR_LAYOUT_OUTLINE + aNumStr;
}
}

View File

@ -46,6 +46,7 @@
#include <svx/xflgrit.hxx>
#include <svx/xflftrit.hxx>
#include <svx/xflhtit.hxx>
#include <o3tl/string_view.hxx>
#include <app.hrc>
#include <stlsheet.hxx>
#include <sdpage.hxx>
@ -336,8 +337,8 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
{
OUString aOutlineStr(SdResId(STR_PSEUDOSHEET_OUTLINE));
// determine number, mind the blank between name and number
OUString aNumStr(aName.copy(aOutlineStr.getLength() + 1));
sal_uInt16 nLevel = static_cast<sal_uInt16>(aNumStr.toInt32());
std::u16string_view aNumStr(aName.subView(aOutlineStr.getLength() + 1));
sal_uInt16 nLevel = static_cast<sal_uInt16>(o3tl::toInt32(aNumStr));
switch (nLevel)
{
case 1: ePO = PresentationObjects::Outline_1; break;

View File

@ -53,6 +53,7 @@
#include <editeng/UnoForbiddenCharsTable.hxx>
#include <svx/svdoutl.hxx>
#include <o3tl/safeint.hxx>
#include <o3tl/string_view.hxx>
#include <o3tl/unit_conversion.hxx>
#include <svx/UnoNamespaceMap.hxx>
#include <svx/svdlayer.hxx>
@ -954,76 +955,76 @@ css::uno::Reference<css::uno::XInterface> SdXImpressDocument::create(
if( aServiceSpecifier.startsWith( "com.sun.star.presentation.") )
{
const OUString aType( aServiceSpecifier.copy(26) );
const std::u16string_view aType( aServiceSpecifier.subView(26) );
rtl::Reference<SvxShape> pShape;
SdrObjKind nType = SdrObjKind::Text;
// create a shape wrapper
if( aType.startsWith( "TitleTextShape" ) )
if( o3tl::starts_with(aType, u"TitleTextShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aType.startsWith( "OutlinerShape" ) )
else if( o3tl::starts_with(aType, u"OutlinerShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aType.startsWith( "SubtitleShape" ) )
else if( o3tl::starts_with(aType, u"SubtitleShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aType.startsWith( "GraphicObjectShape" ) )
else if( o3tl::starts_with(aType, u"GraphicObjectShape" ) )
{
nType = SdrObjKind::Graphic;
}
else if( aType.startsWith( "PageShape" ) )
else if( o3tl::starts_with(aType, u"PageShape" ) )
{
nType = SdrObjKind::Page;
}
else if( aType.startsWith( "OLE2Shape" ) )
else if( o3tl::starts_with(aType, u"OLE2Shape" ) )
{
nType = SdrObjKind::OLE2;
}
else if( aType.startsWith( "ChartShape" ) )
else if( o3tl::starts_with(aType, u"ChartShape" ) )
{
nType = SdrObjKind::OLE2;
}
else if( aType.startsWith( "CalcShape" ) )
else if( o3tl::starts_with(aType, u"CalcShape" ) )
{
nType = SdrObjKind::OLE2;
}
else if( aType.startsWith( "TableShape" ) )
else if( o3tl::starts_with(aType, u"TableShape" ) )
{
nType = SdrObjKind::Table;
}
else if( aType.startsWith( "OrgChartShape" ) )
else if( o3tl::starts_with(aType, u"OrgChartShape" ) )
{
nType = SdrObjKind::OLE2;
}
else if( aType.startsWith( "NotesShape" ) )
else if( o3tl::starts_with(aType, u"NotesShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aType.startsWith( "HandoutShape" ) )
else if( o3tl::starts_with(aType, u"HandoutShape" ) )
{
nType = SdrObjKind::Page;
}
else if( aType.startsWith( "FooterShape" ) )
else if( o3tl::starts_with(aType, u"FooterShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aType.startsWith( "HeaderShape" ) )
else if( o3tl::starts_with(aType, u"HeaderShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aType.startsWith( "SlideNumberShape" ) )
else if( o3tl::starts_with(aType, u"SlideNumberShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aType.startsWith( "DateTimeShape" ) )
else if( o3tl::starts_with(aType, u"DateTimeShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aType.startsWith( "MediaShape" ) )
else if( o3tl::starts_with(aType, u"MediaShape" ) )
{
nType = SdrObjKind::Media;
}

View File

@ -1278,8 +1278,8 @@ void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno
sal_Int32 nPos = aStrBookmark.lastIndexOf( '#' );
if( nPos >= 0 )
{
OUString aURL( aStrBookmark.copy( 0, nPos+1 ) );
aURL += getUiNameFromPageApiNameImpl( aStrBookmark.copy( nPos+1 ) );
OUString aURL = aStrBookmark.subView( 0, nPos+1 )
+ getUiNameFromPageApiNameImpl( aStrBookmark.copy( nPos+1 ) );
aStrBookmark = aURL;
}
}
@ -1531,8 +1531,8 @@ uno::Any SAL_CALL SdUnoEventsAccess::getByName( const OUString& aName )
sal_Int32 nPos = aString.lastIndexOf( '#' );
if( nPos >= 0 )
{
OUString aURL( aString.copy( 0, nPos+1 ) );
aURL += getPageApiNameFromUiName( aString.copy( nPos+1 ) );
OUString aURL = aString.subView( 0, nPos+1 ) +
getPageApiNameFromUiName( aString.copy( nPos+1 ) );
aString = aURL;
}
pProperties->Name = gaStrBookmark;

View File

@ -74,6 +74,7 @@
#include <vcl/dibtools.hxx>
#include <tools/debug.hxx>
#include <tools/stream.hxx>
#include <o3tl/string_view.hxx>
using ::com::sun::star::animations::XAnimationNode;
using ::com::sun::star::animations::XAnimationNodeSupplier;
@ -2172,16 +2173,15 @@ OUString getUiNameFromPageApiNameImpl( const OUString& rApiName )
const OUString aDefPageName( sEmptyPageName );
if( rApiName.startsWith( aDefPageName ) )
{
OUString aNumber( rApiName.copy( aDefPageName.getLength() ) );
std::u16string_view aNumber( rApiName.subView( aDefPageName.getLength() ) );
// create the page number
sal_Int32 nPageNumber = aNumber.toInt32();
sal_Int32 nPageNumber = o3tl::toInt32(aNumber);
// check if there are non number characters in the number part
const sal_Int32 nChars = aNumber.getLength();
const sal_Unicode* pString = aNumber.getStr();
sal_Int32 nChar;
for( nChar = 0; nChar < nChars; nChar++, pString++ )
const size_t nChars = aNumber.size();
const sal_Unicode* pString = aNumber.data();
for( size_t nChar = 0; nChar < nChars; nChar++, pString++ )
{
if((*pString < '0') || (*pString > '9'))
{

View File

@ -731,7 +731,7 @@ sal_Int8 View::ExecuteDrop( const ExecuteDropEvent& rEvt,
sal_Int32 nIndex = aBookmark.indexOf( '#' );
if( nIndex != -1 )
{
const OUString aDocName( aBookmark.copy( 0, nIndex ) );
const std::u16string_view aDocName( aBookmark.subView( 0, nIndex ) );
if (mpDocSh->GetMedium()->GetName() == aDocName || aDocName == mpDocSh->GetName())
{

View File

@ -372,7 +372,7 @@ void PresenterController::UpdatePaneTitles()
// Get the placeholder
++nStartIndex;
const sal_Int32 nEndIndex (sTemplate.indexOf('%', nStartIndex+1));
const OUString sPlaceholder (sTemplate.copy(nStartIndex, nEndIndex-nStartIndex));
const std::u16string_view sPlaceholder (sTemplate.subView(nStartIndex, nEndIndex-nStartIndex));
nIndex = nEndIndex+1;
// Replace the placeholder with its current value.

View File

@ -385,10 +385,10 @@ void SfxClassificationHelper::Impl::parsePolicy()
OUString aExtension(".xml");
if (aPath.endsWith(aExtension) && m_bUseLocalized)
{
OUString aBase = aPath.copy(0, aPath.getLength() - aExtension.getLength());
std::u16string_view aBase = aPath.subView(0, aPath.getLength() - aExtension.getLength());
const LanguageTag& rLanguageTag = Application::GetSettings().GetLanguageTag();
// Expected format is "<original path>_xx-XX.xml".
OUString aLocalized = aBase + "_" + rLanguageTag.getBcp47() + aExtension;
OUString aLocalized = OUString::Concat(aBase) + "_" + rLanguageTag.getBcp47() + aExtension;
if (FStatHelper::IsDocument(aLocalized))
aPath = aLocalized;
}

View File

@ -43,6 +43,7 @@
#include <xmloff/xmlmetai.hxx>
#include <xmloff/xmlnamespace.hxx>
#include <xmloff/xmltoken.hxx>
#include <o3tl/string_view.hxx>
// Our starmath tools
#include <cfgitem.hxx>
@ -840,8 +841,8 @@ SmLengthValue SmMLImportContext::handleLengthAttribute(const OUString& aAttribut
}
// Get value
OUString aValue = aAttribute.copy(0, nUnitPos);
double nValue = aValue.toDouble();
std::u16string_view aValue = aAttribute.subView(0, nUnitPos);
double nValue = o3tl::toDouble(aValue);
if (nValue == 0)
{
nUnit = SmLengthUnit::MlM;

View File

@ -1275,7 +1275,7 @@ void JavaVirtualMachine::setINetSettingsInVM(bool set_reset)
for( auto& prop : Props)
{
sal_Int32 index= prop.indexOf( '=');
OUString propName= prop.copy( 0, index);
std::u16string_view propName= prop.subView( 0, index);
OUString propValue= prop.copy( index + 1);
if( propName == sFtpProxyHost)

View File

@ -21,6 +21,7 @@
#include <sal/log.hxx>
#include <tools/color.hxx>
#include <rtl/math.hxx>
#include <o3tl/string_view.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <svgtoken.hxx>
@ -1323,20 +1324,20 @@ namespace svgio::svgreader
if(rMimeType.startsWith("image"))
{
// image data
OUString aData(rCandidate.copy(nPos));
static const char aStrBase64[] = "base64";
std::u16string_view aData(rCandidate.subView(nPos));
static constexpr std::u16string_view aStrBase64 = u"base64";
if(aData.startsWith(aStrBase64))
if(o3tl::starts_with(aData, aStrBase64))
{
// base64 encoded
nPos = strlen(aStrBase64);
nLen = aData.getLength();
nPos = aStrBase64.size();
nLen = aData.size();
skip_char(aData, ' ', ',', nPos, nLen);
if(nPos < nLen)
{
rData = aData.copy(nPos);
rData = aData.substr(nPos);
}
}
}

View File

@ -19,6 +19,7 @@
#include <comphelper/string.hxx>
#include <o3tl/sorted_vector.hxx>
#include <o3tl/string_view.hxx>
#include <svl/style.hxx>
#include <svx/svdotext.hxx>
#include <svx/svdmodel.hxx>
@ -445,9 +446,9 @@ void SdrTextObj::AppendFamilyToStyleName(OUString& styleName, SfxStyleFamily fam
SfxStyleFamily SdrTextObj::ReadFamilyFromStyleName(const OUString& styleName)
{
OUString familyString = styleName.copy(styleName.getLength() - PADDING_LENGTH_FOR_STYLE_FAMILY);
std::u16string_view familyString = styleName.subView(styleName.getLength() - PADDING_LENGTH_FOR_STYLE_FAMILY);
familyString = comphelper::string::stripEnd(familyString, PADDING_CHARACTER_FOR_STYLE_FAMILY);
sal_uInt16 nFam = static_cast<sal_uInt16>(familyString.toInt32());
sal_uInt16 nFam = static_cast<sal_uInt16>(o3tl::toInt32(familyString));
assert(nFam != 0);
return static_cast<SfxStyleFamily>(nFam);
}

View File

@ -27,6 +27,7 @@
#include <svl/itempool.hxx>
#include <svtools/unoevent.hxx>
#include <comphelper/sequence.hxx>
#include <o3tl/string_view.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/implbase.hxx>
@ -378,65 +379,65 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( c
SvxShape* pShape = nullptr;
SdrObjKind nType = SdrObjKind::Text;
OUString aTypeName = aServiceSpecifier.copy( aPackagePrefix.getLength() );
std::u16string_view aTypeName = aServiceSpecifier.subView( aPackagePrefix.getLength() );
// create a shape wrapper
if( aTypeName.startsWith("TitleTextShape") )
if( o3tl::starts_with(aTypeName, u"TitleTextShape") )
{
nType = SdrObjKind::Text;
}
else if( aTypeName.startsWith( "OutlinerShape" ) )
else if( o3tl::starts_with(aTypeName, u"OutlinerShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aTypeName.startsWith( "SubtitleShape" ) )
else if( o3tl::starts_with(aTypeName, u"SubtitleShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aTypeName.startsWith( "GraphicObjectShape" ) )
else if( o3tl::starts_with(aTypeName, u"GraphicObjectShape" ) )
{
nType = SdrObjKind::Graphic;
}
else if( aTypeName.startsWith( "PageShape" ) )
else if( o3tl::starts_with(aTypeName, u"PageShape" ) )
{
nType = SdrObjKind::Page;
}
else if( aTypeName.startsWith( "OLE2Shape" ) )
else if( o3tl::starts_with(aTypeName, u"OLE2Shape" ) )
{
nType = SdrObjKind::OLE2;
}
else if( aTypeName.startsWith( "ChartShape" ) )
else if( o3tl::starts_with(aTypeName, u"ChartShape" ) )
{
nType = SdrObjKind::OLE2;
}
else if( aTypeName.startsWith( "OrgChartShape" ) )
else if( o3tl::starts_with(aTypeName, u"OrgChartShape" ) )
{
nType = SdrObjKind::OLE2;
}
else if( aTypeName.startsWith( "NotesShape" ) )
else if( o3tl::starts_with(aTypeName, u"NotesShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aTypeName.startsWith( "HandoutShape" ) )
else if( o3tl::starts_with(aTypeName, u"HandoutShape" ) )
{
nType = SdrObjKind::Page;
}
else if( aTypeName.startsWith( "FooterShape" ) )
else if( o3tl::starts_with(aTypeName, u"FooterShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aTypeName.startsWith( "HeaderShape" ) )
else if( o3tl::starts_with(aTypeName, u"HeaderShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aTypeName.startsWith( "SlideNumberShape" ) )
else if( o3tl::starts_with(aTypeName, u"SlideNumberShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aTypeName.startsWith( "DateTimeShape" ) )
else if( o3tl::starts_with(aTypeName, u"DateTimeShape" ) )
{
nType = SdrObjKind::Text;
}
else if( aTypeName.startsWith( "TableShape" ) )
else if( o3tl::starts_with(aTypeName, u"TableShape" ) )
{
nType = SdrObjKind::Table;
}

View File

@ -1665,14 +1665,14 @@ static bool SvxUnoConvertResourceStringToApi(const TranslateId* pSourceResIds, c
}
}
const OUString aShortString( rString.copy( 0, nLength ) );
const std::u16string_view aShortString( rString.subView( 0, nLength ) );
for (int i = 0; i < nCount; ++i)
{
const OUString & aCompare = SvxResId(pSourceResIds[i]);
if( aShortString == aCompare )
{
rString = rString.replaceAt( 0, aShortString.getLength(), OUString(pDestResIds[i]) );
rString = rString.replaceAt( 0, aShortString.size(), OUString(pDestResIds[i]) );
return true;
}
else if( rString == aCompare )
@ -1711,14 +1711,14 @@ static bool SvxUnoConvertResourceStringFromApi(const rtl::OUStringConstExpr* pSo
}
}
const OUString aShortString( rString.copy( 0, nLength ) );
const std::u16string_view aShortString( rString.subView( 0, nLength ) );
for (int i = 0; i < nCount; ++i)
{
auto pCompare = pSourceResIds[i];
if( aShortString == pCompare )
if( aShortString == pCompare.asView() )
{
rString = rString.replaceAt( 0, aShortString.getLength(), SvxResId(pDestResIds[i]) );
rString = rString.replaceAt( 0, aShortString.size(), SvxResId(pDestResIds[i]) );
return true;
}
else if( rString == pCompare )

View File

@ -88,6 +88,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <svx/colorwindow.hxx>
#include <o3tl/string_view.hxx>
#include <editeng/editids.hrc>
#include <reffld.hxx>
@ -3512,11 +3513,10 @@ sal_Int32 SwAccessibleParagraph::GetRealHeadingLevel()
sal_Int32 length = sValue.getLength();
if (length == 9 || length == 10)
{
OUString headStr = sValue.copy(0, 7);
if (headStr == "Heading")
if (sValue.startsWith("Heading"))
{
OUString intStr = sValue.copy(8);
sal_Int32 headingLevel = intStr.toInt32();
std::u16string_view intStr = sValue.subView(8);
sal_Int32 headingLevel = o3tl::toInt32(intStr);
return headingLevel;
}
}

View File

@ -713,9 +713,9 @@ SwCalcOper SwCalc::GetToken()
}
else if( aRes.TokenType & KParseType::ONE_SINGLE_CHAR )
{
OUString aName( m_sCommand.copy( nRealStt,
std::u16string_view aName( m_sCommand.subView( nRealStt,
aRes.EndPos - nRealStt ));
if( 1 == aName.getLength() )
if( 1 == aName.size() )
{
bSetError = false;
sal_Unicode ch = aName[0];
@ -819,9 +819,9 @@ SwCalcOper SwCalc::GetToken()
}
else if( aRes.TokenType & KParseType::BOOLEAN )
{
OUString aName( m_sCommand.copy( nRealStt,
std::u16string_view aName( m_sCommand.subView( nRealStt,
aRes.EndPos - nRealStt ));
if( !aName.isEmpty() )
if( !aName.empty() )
{
sal_Unicode ch = aName[0];
@ -833,9 +833,9 @@ SwCalcOper SwCalc::GetToken()
SwCalcOper eTmp2 = ('<' == ch) ? CALC_LEQ : CALC_GEQ;
m_eCurrOper = ('<' == ch) ? CALC_LES : CALC_GRE;
if( 2 == aName.getLength() && '=' == aName[1] )
if( 2 == aName.size() && '=' == aName[1] )
m_eCurrOper = eTmp2;
else if( 1 != aName.getLength() )
else if( 1 != aName.size() )
bSetError = true;
}
}

View File

@ -461,12 +461,12 @@ bool DocumentLinksAdministrationManager::SelectServerObj( std::u16string_view rS
{
bool bContinue = false;
OUString sName( sItem.copy( 0, nPos ) );
OUString sCmp( sItem.copy( nPos + 1 ));
std::u16string_view sCmp( sItem.subView( nPos + 1 ));
sItem = rCC.lowercase( sItem );
FindItem aPara( sName );
if( sCmp == "table" )
if( sCmp == u"table" )
{
sName = rCC.lowercase( sName );
for( const SwFrameFormat* pFormat : *m_rDoc.GetTableFrameFormats() )
@ -481,7 +481,7 @@ bool DocumentLinksAdministrationManager::SelectServerObj( std::u16string_view rS
return true;
}
}
else if( sCmp == "frame" )
else if( sCmp == u"frame" )
{
const SwFlyFrameFormat* pFlyFormat = m_rDoc.FindFlyByName( sName );
if( pFlyFormat )
@ -498,12 +498,12 @@ bool DocumentLinksAdministrationManager::SelectServerObj( std::u16string_view rS
}
}
}
else if( sCmp == "region" )
else if( sCmp == u"region" )
{
sItem = sName; // Is being dealt with further down!
bContinue = true;
}
else if( sCmp == "outline" )
else if( sCmp == u"outline" )
{
SwPosition aPos( SwNodeIndex( m_rDoc.GetNodes() ));
if (m_rDoc.GotoOutline(aPos, sName, nullptr))

View File

@ -57,6 +57,7 @@
#include <redline.hxx>
#include <vector>
#include <calbck.hxx>
#include <o3tl/string_view.hxx>
#include <svl/numformat.hxx>
#ifdef DBG_UTIL
@ -1266,11 +1267,11 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew,
}
// return the pointer of the box specified.
static bool lcl_IsValidRowName( const OUString& rStr )
static bool lcl_IsValidRowName( std::u16string_view rStr )
{
bool bIsValid = true;
sal_Int32 nLen = rStr.getLength();
for( sal_Int32 i = 0; i < nLen && bIsValid; ++i )
size_t nLen = rStr.size();
for( size_t i = 0; i < nLen && bIsValid; ++i )
{
const sal_Unicode cChar = rStr[i];
if (cChar < '0' || cChar > '9')
@ -1328,10 +1329,10 @@ sal_uInt16 SwTable::GetBoxNum( OUString& rStr, bool bFirstPart,
else
{
nRet = 0;
const OUString aText( rStr.copy( 0, nPos ) );
const std::u16string_view aText( rStr.subView( 0, nPos ) );
if ( !bPerformValidCheck || lcl_IsValidRowName( aText ) )
{
nRet = o3tl::narrowing<sal_uInt16>(aText.toInt32());
nRet = o3tl::narrowing<sal_uInt16>(o3tl::toInt32(aText));
}
rStr = rStr.copy( nPos+1 );
}

View File

@ -883,12 +883,12 @@ void SwTOXAuthority::FillText(SwTextNode& rNd, const SwIndex& rInsPos, sal_uInt1
// Convert URL to a relative one if requested.
SwDoc* pDoc = static_cast<SwAuthorityFieldType*>(m_rField.GetField()->GetTyp())->GetDoc();
SwDocShell* pDocShell = pDoc->GetDocShell();
OUString aBaseURL = pDocShell->getDocumentBaseURL();
OUString aBaseURIScheme;
const OUString aBaseURL = pDocShell->getDocumentBaseURL();
std::u16string_view aBaseURIScheme;
sal_Int32 nSep = aBaseURL.indexOf(':');
if (nSep != -1)
{
aBaseURIScheme = aBaseURL.copy(0, nSep);
aBaseURIScheme = aBaseURL.subView(0, nSep);
}
uno::Reference<uri::XUriReferenceFactory> xUriReferenceFactory

View File

@ -3708,9 +3708,9 @@ void SwTextNode::ReplaceText( const SwIndex& rStart, const sal_Int32 nDelLen,
m_Text = m_Text.replaceAt(rStart.GetIndex(), nLen - 1, u"");
Update( rStart, nLen - 1, true );
OUString aTmpText( sInserted.copy(1) );
std::u16string_view aTmpText( sInserted.subView(1) );
m_Text = m_Text.replaceAt(rStart.GetIndex(), 0, aTmpText);
Update( rStart, aTmpText.getLength() );
Update( rStart, aTmpText.size() );
}
else
{

View File

@ -1984,16 +1984,16 @@ uno::Sequence< OUString > SAL_CALL SwChartDataSequence::generateLabel(
if (pBuf < pEnd && ('0' <= *pBuf && *pBuf <= '9'))
{
OUString aRplc;
OUString aNew;
std::u16string_view aNew;
if (bUseCol)
{
aRplc = "%COLUMNLETTER";
aNew = aCellName.copy(0, pBuf - aCellName.getStr());
aNew = aCellName.subView(0, pBuf - aCellName.getStr());
}
else
{
aRplc = "%ROWNUMBER";
aNew = OUString(pBuf, (aCellName.getStr() + nLen) - pBuf);
aNew = std::u16string_view(pBuf, (aCellName.getStr() + nLen) - pBuf);
}
aText = aText.replaceFirst( aRplc, aNew );
}

View File

@ -1224,16 +1224,16 @@ static bool OutCSS1Rule( SwHTMLWriter& rHTMLWrt, const OUString& rSelector,
if( SwHTMLWriter::HasScriptDependentItems( rItemSet, bHasClass ) )
{
bScriptDependent = true;
OUString aSelector( rSelector );
std::u16string_view aSelector( rSelector );
OUString aPseudo;
std::u16string_view aPseudo;
if( bCheckForPseudo )
{
sal_Int32 nPos = aSelector.lastIndexOf( ':' );
if( nPos >= 0 )
size_t nPos = aSelector.rfind( ':' );
if( nPos != std::u16string_view::npos )
{
aPseudo = aSelector.copy( nPos );
aSelector =aSelector.copy( 0, nPos );
aPseudo = aSelector.substr( nPos );
aSelector =aSelector.substr( 0, nPos );
}
}
@ -1257,21 +1257,21 @@ static bool OutCSS1Rule( SwHTMLWriter& rHTMLWrt, const OUString& rSelector,
aScriptItemSet( *rItemSet.GetPool() );
aScriptItemSet.Put( rItemSet );
OUString aNewSelector = aSelector + ".western" + aPseudo;
OUString aNewSelector = OUString::Concat(aSelector) + ".western" + aPseudo;
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_WESTERN|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
&aNewSelector );
rHTMLWrt.OutCSS1_SfxItemSet( aScriptItemSet, false );
}
aNewSelector = aSelector + ".cjk" + aPseudo;
aNewSelector = OUString::Concat(aSelector) + ".cjk" + aPseudo;
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CJK|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
&aNewSelector );
rHTMLWrt.OutCSS1_SfxItemSet( aScriptItemSet, false );
}
aNewSelector = aSelector + ".ctl" + aPseudo;
aNewSelector = OUString::Concat(aSelector) + ".ctl" + aPseudo;
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CTL|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
&aNewSelector );
@ -1283,21 +1283,21 @@ static bool OutCSS1Rule( SwHTMLWriter& rHTMLWrt, const OUString& rSelector,
// If there are script dependencies and we are derived from a tag,
// when we have to export a style dependent class for all
// scripts
OUString aNewSelector = aSelector + "-western" + aPseudo;
OUString aNewSelector = OUString::Concat(aSelector) + "-western" + aPseudo;
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_WESTERN|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
&aNewSelector );
rHTMLWrt.OutCSS1_SfxItemSet( rItemSet, false );
}
aNewSelector = aSelector + "-cjk" + aPseudo;
aNewSelector = OUString::Concat(aSelector) + "-cjk" + aPseudo;
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CJK|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
&aNewSelector );
rHTMLWrt.OutCSS1_SfxItemSet( rItemSet, false );
}
aNewSelector = aSelector + "-ctl" + aPseudo;
aNewSelector = OUString::Concat(aSelector) + "-ctl" + aPseudo;
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CTL|CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE,
&aNewSelector );
@ -1329,14 +1329,14 @@ static void OutCSS1DropCapRule(
if( (bHasScriptDependencies && bHasClass) ||
(pDCCharFormat && SwHTMLWriter::HasScriptDependentItems( pDCCharFormat->GetAttrSet(), false ) ) )
{
OUString aSelector( rSelector );
std::u16string_view aSelector( rSelector );
OUString aPseudo;
sal_Int32 nPos = aSelector.lastIndexOf( ':' );
if( nPos >= 0 )
std::u16string_view aPseudo;
size_t nPos = aSelector.rfind( ':' );
if( nPos != std::u16string_view::npos )
{
aPseudo = aSelector.copy( nPos );
aSelector = aSelector.copy( 0, nPos );
aPseudo = aSelector.substr( nPos );
aSelector = aSelector.substr( 0, nPos );
}
if( !bHasClass )
@ -1358,21 +1358,21 @@ static void OutCSS1DropCapRule(
if( pDCCharFormat )
aScriptItemSet.Set( pDCCharFormat->GetAttrSet() );
OUString aNewSelector = aSelector + ".western" + aPseudo;
OUString aNewSelector = OUString::Concat(aSelector) + ".western" + aPseudo;
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_WESTERN|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP,
&aNewSelector );
OutCSS1_SwFormatDropAttrs( rHTMLWrt, rDrop, &aScriptItemSet );
}
aNewSelector = aSelector + ".cjk" + aPseudo;
aNewSelector = OUString::Concat(aSelector) + ".cjk" + aPseudo;
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CJK|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP,
&aNewSelector );
OutCSS1_SwFormatDropAttrs( rHTMLWrt, rDrop, &aScriptItemSet );
}
aNewSelector = aSelector + ".ctl" + aPseudo;
aNewSelector = OUString::Concat(aSelector) + ".ctl" + aPseudo;
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CTL|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP,
&aNewSelector );
@ -1384,21 +1384,21 @@ static void OutCSS1DropCapRule(
// If there are script dependencies and we are derived from a tag,
// when we have to export a style dependent class for all
// scripts
OUString aNewSelector = aSelector + "-western" + aPseudo;
OUString aNewSelector = OUString::Concat(aSelector) + "-western" + aPseudo;
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_WESTERN|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP,
&aNewSelector );
OutCSS1_SwFormatDropAttrs( rHTMLWrt, rDrop );
}
aNewSelector = aSelector + "-cjk" + aPseudo;
aNewSelector = OUString::Concat(aSelector) + "-cjk" + aPseudo;
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CJK|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP,
&aNewSelector );
OutCSS1_SwFormatDropAttrs( rHTMLWrt, rDrop );
}
aNewSelector = aSelector + "-ctl" + aPseudo;
aNewSelector = OUString::Concat(aSelector) + "-ctl" + aPseudo;
{
SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_CTL|CSS1_OUTMODE_RULE|CSS1_OUTMODE_DROPCAP,
&aNewSelector );

View File

@ -179,15 +179,15 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
sal_Int32 nFound = sText.indexOf(cMarkSeparator);
if( nFound != -1 && (++nFound) < sText.getLength() )
{
OUString sSuffix( sText.copy(nFound) );
if( sSuffix == "table" ||
sSuffix == "frame" ||
sSuffix == "region" ||
sSuffix == "outline" ||
sSuffix == "text" ||
sSuffix == "graphic" ||
sSuffix == "ole" ||
sSuffix == "drawingobject" )
std::u16string_view sSuffix( sText.subView(nFound) );
if( sSuffix == u"table" ||
sSuffix == u"frame" ||
sSuffix == u"region" ||
sSuffix == u"outline" ||
sSuffix == u"text" ||
sSuffix == u"graphic" ||
sSuffix == u"ole" ||
sSuffix == u"drawingobject" )
sText = sText.copy( 0, nFound - 1);
}
// #i104300#

View File

@ -2180,7 +2180,7 @@ auto PrepareJumpToTOXMark(SwDoc const& rDoc, OUString const& rName)
return std::optional<std::pair<SwTOXMark, sal_Int32>>();
}
sal_uInt16 const indexType(rName[second + 1]);
OUString const indexName(rName.copy(second + 2));
std::u16string_view const indexName(rName.subView(second + 2));
SwTOXType const* pType(nullptr);
switch (indexType)
{

View File

@ -723,7 +723,7 @@ IMPL_LINK( SwView, ScrollHdl, ScrollBar *, p, void )
{
sPageStr += " - ";
sal_Int32 nChunkLen = std::min<sal_Int32>(aCnt.sStr.getLength(), 80);
OUString sChunk = aCnt.sStr.copy(0, nChunkLen);
std::u16string_view sChunk = aCnt.sStr.subView(0, nChunkLen);
sPageStr = sChunk + sPageStr;
sPageStr = sPageStr.replace('\t', ' ');
sPageStr = sPageStr.replace(0x0a, ' ');

View File

@ -4007,7 +4007,7 @@ Any SwXLinkNameAccessWrapper::getByName(const OUString& rName)
OUString sSuffix(m_sLinkSuffix);
if(sParam.getLength() > sSuffix.getLength() )
{
OUString sCmp = sParam.copy(sParam.getLength() - sSuffix.getLength(),
std::u16string_view sCmp = sParam.subView(sParam.getLength() - sSuffix.getLength(),
sSuffix.getLength());
if(sCmp == sSuffix)
{
@ -4128,7 +4128,7 @@ sal_Bool SwXLinkNameAccessWrapper::hasByName(const OUString& rName)
OUString sParam(rName);
if(sParam.getLength() > m_sLinkSuffix.getLength() )
{
OUString sCmp = sParam.copy(sParam.getLength() - m_sLinkSuffix.getLength(),
std::u16string_view sCmp = sParam.subView(sParam.getLength() - m_sLinkSuffix.getLength(),
m_sLinkSuffix.getLength());
if(sCmp == m_sLinkSuffix)
{
@ -4205,29 +4205,28 @@ void SwXLinkNameAccessWrapper::setPropertyValue(
throw UnknownPropertyException(rPropName);
}
static Any lcl_GetDisplayBitmap(const OUString& _sLinkSuffix)
static Any lcl_GetDisplayBitmap(std::u16string_view sLinkSuffix)
{
Any aRet;
OUString sLinkSuffix = _sLinkSuffix;
if(!sLinkSuffix.isEmpty())
sLinkSuffix = sLinkSuffix.copy(1);
if(!sLinkSuffix.empty())
sLinkSuffix = sLinkSuffix.substr(1);
OUString sImgId;
if(sLinkSuffix == "outline")
if(sLinkSuffix == u"outline")
sImgId = RID_BMP_NAVI_OUTLINE;
else if(sLinkSuffix == "table")
else if(sLinkSuffix == u"table")
sImgId = RID_BMP_NAVI_TABLE;
else if(sLinkSuffix == "frame")
else if(sLinkSuffix == u"frame")
sImgId = RID_BMP_NAVI_FRAME;
else if(sLinkSuffix == "graphic")
else if(sLinkSuffix == u"graphic")
sImgId = RID_BMP_NAVI_GRAPHIC;
else if(sLinkSuffix == "ole")
else if(sLinkSuffix == u"ole")
sImgId = RID_BMP_NAVI_OLE;
else if(sLinkSuffix.isEmpty())
else if(sLinkSuffix.empty())
sImgId = RID_BMP_NAVI_BOOKMARK;
else if(sLinkSuffix == "region")
else if(sLinkSuffix == u"region")
sImgId = RID_BMP_NAVI_REGION;
else if(sLinkSuffix == "drawingobject")
else if(sLinkSuffix == u"drawingobject")
sImgId = RID_BMP_NAVI_DRAWOBJECT;
if (!sImgId.isEmpty())

View File

@ -29,6 +29,7 @@
#include <vcl/salgtype.hxx>
#include <vcl/scheduler.hxx>
#include <vcl/virdev.hxx>
#include <o3tl/string_view.hxx>
#include <memory>
#include <cstring>
@ -223,8 +224,8 @@ void test::BootstrapFixture::validate(const OUString& rPath, test::ValidationFor
else
{
sal_Int32 nStartOfNumber = nIndex + std::strlen("Grand total of errors in submitted package: ");
OUString aNumber = aContentOUString.copy(nStartOfNumber);
sal_Int32 nErrors = aNumber.toInt32();
std::u16string_view aNumber = aContentOUString.subView(nStartOfNumber);
sal_Int32 nErrors = o3tl::toInt32(aNumber);
OString aMsg = "validation error in OOXML export: Errors: " + OString::number(nErrors);
if(nErrors)
{

View File

@ -646,10 +646,10 @@ std::unique_ptr<SvMemoryStream> INetURLObject::getData() const
else if (sURLPath.matchIgnoreAsciiCase(";base64,", nCharactersSkipped))
{
nCharactersSkipped += strlen(";base64,");
OUString sBase64Data = sURLPath.copy( nCharactersSkipped );
std::u16string_view sBase64Data = sURLPath.subView( nCharactersSkipped );
css::uno::Sequence< sal_Int8 > aDecodedData;
if (comphelper::Base64::decodeSomeChars(aDecodedData, sBase64Data)
== sBase64Data.getLength())
== static_cast<sal_Int32>(sBase64Data.size()))
{
return memoryStream(
aDecodedData.getArray(), aDecodedData.getLength());

View File

@ -119,9 +119,9 @@ namespace ucb::ucp::ext
}
else
{
const OUString sRelativeURL( sURL.copy( ContentProvider::getRootURL().getLength() ) );
const sal_Int32 nSepPos = sRelativeURL.indexOf( '/' );
if ( ( nSepPos == -1 ) || ( nSepPos == sRelativeURL.getLength() - 1 ) )
const std::u16string_view sRelativeURL( sURL.subView( ContentProvider::getRootURL().getLength() ) );
const size_t nSepPos = sRelativeURL.find( '/' );
if ( ( nSepPos == std::u16string_view::npos ) || ( nSepPos == sRelativeURL.size() - 1 ) )
{
m_eExtContentType = E_EXTENSION_ROOT;
}

View File

@ -80,11 +80,11 @@ namespace ucb::ucp::ext
namespace
{
void lcl_ensureAndTransfer( OUString& io_rIdentifierFragment, OUStringBuffer& o_rNormalization, const sal_Unicode i_nLeadingChar )
void lcl_ensureAndTransfer( std::u16string_view& io_rIdentifierFragment, OUStringBuffer& o_rNormalization, const sal_Unicode i_nLeadingChar )
{
if ( ( io_rIdentifierFragment.isEmpty() ) || ( io_rIdentifierFragment[0] != i_nLeadingChar ) )
if ( ( io_rIdentifierFragment.empty() ) || ( io_rIdentifierFragment[0] != i_nLeadingChar ) )
throw IllegalIdentifierException();
io_rIdentifierFragment = io_rIdentifierFragment.copy( 1 );
io_rIdentifierFragment = io_rIdentifierFragment.substr( 1 );
o_rNormalization.append( i_nLeadingChar );
}
}
@ -105,14 +105,14 @@ namespace ucb::ucp::ext
aComposer.append( sIdentifier.copy( 0, sScheme.getLength() ).toAsciiLowerCase() );
// one : is required after the scheme
OUString sRemaining( sIdentifier.copy( sScheme.getLength() ) );
std::u16string_view sRemaining( sIdentifier.subView( sScheme.getLength() ) );
lcl_ensureAndTransfer( sRemaining, aComposer, ':' );
// and at least one /
lcl_ensureAndTransfer( sRemaining, aComposer, '/' );
// the normalized form requires one additional /, but we also accept identifiers which don't have it
if ( sRemaining.isEmpty() )
if ( sRemaining.empty() )
{
// the root content is a special case, it requires /
aComposer.append( "//" );
@ -128,7 +128,7 @@ namespace ucb::ucp::ext
{
lcl_ensureAndTransfer( sRemaining, aComposer, '/' );
// by now, we moved "vnd.sun.star.extension://" from the URL to aComposer
if ( sRemaining.isEmpty() )
if ( sRemaining.empty() )
{
// again, it's the root content, but one / is missing
aComposer.append( '/' );

View File

@ -99,7 +99,7 @@ inline bool Uri::isDocument() const
{
init();
return ( ( !m_aDocId.isEmpty() ) /* not root */
&& ( m_aPath.copy( m_aDocId.getLength() + 1 ).getLength() < 2 ) );
&& ( m_aPath.subView( m_aDocId.getLength() + 1 ).size() < 2 ) );
}
} // namespace tdoc_ucp

View File

@ -246,7 +246,7 @@ CurlUri CurlUri::CloneWithRelativeRefPathAbsolute(OUString const& rRelativeRef)
CURLUcode uc;
if (indexFragment != -1)
{
OUString const fragment(rRelativeRef.copy(indexFragment + 1));
std::u16string_view const fragment(rRelativeRef.subView(indexFragment + 1));
indexEnd = indexFragment;
OString const utf8Fragment(OUStringToOString(fragment, RTL_TEXTENCODING_UTF8));
uc = curl_url_set(pUrl.get(), CURLUPART_FRAGMENT, utf8Fragment.getStr(), 0);
@ -262,7 +262,8 @@ CurlUri CurlUri::CloneWithRelativeRefPathAbsolute(OUString const& rRelativeRef)
}
if (indexQuery != -1 && (indexFragment == -1 || indexQuery < indexFragment))
{
OUString const query(rRelativeRef.copy(indexQuery + 1, indexEnd - indexQuery - 1));
std::u16string_view const query(
rRelativeRef.subView(indexQuery + 1, indexEnd - indexQuery - 1));
indexEnd = indexQuery;
OString const utf8Query(OUStringToOString(query, RTL_TEXTENCODING_UTF8));
uc = curl_url_set(pUrl.get(), CURLUPART_QUERY, utf8Query.getStr(), 0);
@ -276,7 +277,7 @@ CurlUri CurlUri::CloneWithRelativeRefPathAbsolute(OUString const& rRelativeRef)
SAL_WARN("ucb.ucp.webdav.curl", "curl_url_set failed: " << uc);
throw DAVException(DAVException::DAV_INVALID_ARG);
}
OUString const path(rRelativeRef.copy(0, indexEnd));
std::u16string_view const path(rRelativeRef.subView(0, indexEnd));
OString const utf8Path(OUStringToOString(path, RTL_TEXTENCODING_UTF8));
uc = curl_url_set(pUrl.get(), CURLUPART_PATH, utf8Path.getStr(), 0);
if (uc != CURLUE_OK)

View File

@ -92,7 +92,7 @@ bool ExecuteAction(const std::string& nWindowId, const OString& rWidget, StringM
int separatorPos = rData["data"].indexOf(';');
if (separatorPos > 0)
{
OUString entryPos = rData["data"].copy(0, separatorPos);
std::u16string_view entryPos = rData["data"].subView(0, separatorPos);
OString posString = OUStringToOString(entryPos, RTL_TEXTENCODING_ASCII_US);
int pos = std::atoi(posString.getStr());
pCombobox->set_active(pos);

View File

@ -2150,7 +2150,7 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice,
if ( nFirstContent < nLastContent )
{
OUString aTempLastStr = aStr.copy( nLastContent );
std::u16string_view aTempLastStr = aStr.subView( nLastContent );
aTempStr = aFirstStr + aTempLastStr;
if ( _rLayout.GetTextWidth( aTempStr, 0, aTempStr.getLength() ) > nMaxWidth )

View File

@ -17,45 +17,45 @@ OUString convertPdfDateToISO8601(OUString const& rInput)
if (rInput.getLength() < 6)
return {};
OUString prefix = rInput.copy(0, 2);
if (prefix != "D:")
std::u16string_view prefix = rInput.subView(0, 2);
if (prefix != u"D:")
return {};
OUString sYear = rInput.copy(2, 4);
std::u16string_view sYear = rInput.subView(2, 4);
OUString sMonth("01");
std::u16string_view sMonth(u"01");
if (rInput.getLength() >= 8)
sMonth = rInput.copy(6, 2);
sMonth = rInput.subView(6, 2);
OUString sDay("01");
std::u16string_view sDay(u"01");
if (rInput.getLength() >= 10)
sDay = rInput.copy(8, 2);
sDay = rInput.subView(8, 2);
OUString sHours("00");
std::u16string_view sHours(u"00");
if (rInput.getLength() >= 12)
sHours = rInput.copy(10, 2);
sHours = rInput.subView(10, 2);
OUString sMinutes("00");
std::u16string_view sMinutes(u"00");
if (rInput.getLength() >= 14)
sMinutes = rInput.copy(12, 2);
sMinutes = rInput.subView(12, 2);
OUString sSeconds("00");
std::u16string_view sSeconds(u"00");
if (rInput.getLength() >= 16)
sSeconds = rInput.copy(14, 2);
sSeconds = rInput.subView(14, 2);
OUString sTimeZoneMark("Z");
if (rInput.getLength() >= 17)
sTimeZoneMark = rInput.copy(16, 1);
sTimeZoneMark = rInput.subView(16, 1);
OUString sTimeZoneHours("00");
OUString sTimeZoneMinutes("00");
std::u16string_view sTimeZoneHours(u"00");
std::u16string_view sTimeZoneMinutes(u"00");
if ((sTimeZoneMark == "+" || sTimeZoneMark == "-") && rInput.getLength() >= 22)
{
OUString sTimeZoneSeparator = rInput.copy(19, 1);
if (sTimeZoneSeparator == "'")
std::u16string_view sTimeZoneSeparator = rInput.subView(19, 1);
if (sTimeZoneSeparator == u"'")
{
sTimeZoneHours = rInput.copy(17, 2);
sTimeZoneMinutes = rInput.copy(20, 2);
sTimeZoneHours = rInput.subView(17, 2);
sTimeZoneMinutes = rInput.subView(20, 2);
}
}
@ -65,8 +65,8 @@ OUString convertPdfDateToISO8601(OUString const& rInput)
else if (sTimeZoneMark == "Z")
sTimeZoneString = sTimeZoneMark;
return sYear + "-" + sMonth + "-" + sDay + "T" + sHours + ":" + sMinutes + ":" + sSeconds
+ sTimeZoneString;
return OUString::Concat(sYear) + "-" + sMonth + "-" + sDay + "T" + sHours + ":" + sMinutes + ":"
+ sSeconds + sTimeZoneString;
}
} // end vcl::pdf

View File

@ -5609,7 +5609,7 @@ gboolean GtkSalFrame::IMHandler::signalIMRetrieveSurrounding( GtkIMContext* pCon
pThis->m_pFrame->CallCallback(SalEvent::SurroundingTextRequest, &aEvt);
OString sUTF = OUStringToOString(aEvt.maText, RTL_TEXTENCODING_UTF8);
OUString sCursorText(aEvt.maText.copy(0, aEvt.mnStart));
std::u16string_view sCursorText(aEvt.maText.subView(0, aEvt.mnStart));
gtk_im_context_set_surrounding(pContext, sUTF.getStr(), sUTF.getLength(),
OUStringToOString(sCursorText, RTL_TEXTENCODING_UTF8).getLength());
return true;

View File

@ -17946,7 +17946,7 @@ public:
if (nCursorIndex != -1)
{
OString sUTF = OUStringToOString(sSurroundingText, RTL_TEXTENCODING_UTF8);
OUString sCursorText(sSurroundingText.copy(0, nCursorIndex));
std::u16string_view sCursorText(sSurroundingText.subView(0, nCursorIndex));
gtk_im_context_set_surrounding(pContext, sUTF.getStr(), sUTF.getLength(),
OUStringToOString(sCursorText, RTL_TEXTENCODING_UTF8).getLength());
}

View File

@ -5488,13 +5488,15 @@ void DomainMapper_Impl::handleRubyEQField( const FieldContextPtr& pContext)
if (nEnd <= nIndex)
return;
OUString sRubyParts = rCommand.copy(nIndex+1,nEnd-nIndex-1);
std::u16string_view sRubyParts = rCommand.subView(nIndex+1,nEnd-nIndex-1);
nIndex = 0;
OUString sPart1 = sRubyParts.getToken(0, ',', nIndex);
OUString sPart2 = sRubyParts.getToken(0, ',', nIndex);
if ((nIndex = sPart1.indexOf('(')) != -1 && (nEnd = sPart1.lastIndexOf(')'))!=-1 && nEnd > nIndex)
std::u16string_view sPart1 = o3tl::getToken(sRubyParts, 0, ',', nIndex);
std::u16string_view sPart2 = o3tl::getToken(sRubyParts, 0, ',', nIndex);
size_t nIndex2 = 0;
size_t nEnd2 = 0;
if ((nIndex2 = sPart1.find('(')) != std::u16string_view::npos && (nEnd2 = sPart1.rfind(')')) != std::u16string_view::npos && nEnd2 > nIndex2)
{
aInfo.sRubyText = sPart1.copy(nIndex+1,nEnd-nIndex-1);
aInfo.sRubyText = sPart1.substr(nIndex2+1,nEnd2-nIndex2-1);
}
PropertyMapPtr pRubyContext(new PropertyMap());
@ -5518,7 +5520,7 @@ void DomainMapper_Impl::handleRubyEQField( const FieldContextPtr& pContext)
if ( aInfo.nRubyAlign == NS_ooxml::LN_Value_ST_RubyAlign_rightVertical )
pCharContext->Insert(PROP_RUBY_POSITION, uno::makeAny(css::text::RubyPosition::INTER_CHARACTER));
pCharContext->Insert(PROP_RUBY_STYLE, uno::makeAny(aInfo.sRubyStyle));
appendTextPortion(sPart2, pCharContext);
appendTextPortion(OUString(sPart2), pCharContext);
}

View File

@ -488,15 +488,15 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
sal_Int32 nCharIndex = 0; // Character index
do
{
OUString aToken = rProperty.second.getToken(0, ';', nCharIndex);
std::u16string_view aToken = o3tl::getToken(rProperty.second, 0, ';', nCharIndex);
if (!nSize)
nSize = aToken.toInt32();
nSize = o3tl::toInt32(aToken);
else if (!nCount)
nCount = aToken.toInt32();
else if (aToken.getLength())
nCount = o3tl::toInt32(aToken);
else if (!aToken.empty())
{
// The coordinates are in an (x,y) form.
aToken = aToken.copy(1, aToken.getLength() - 2);
aToken = aToken.substr(1, aToken.size() - 2);
sal_Int32 nI = 0;
sal_Int32 nX = o3tl::toInt32(o3tl::getToken(aToken, 0, ',', nI));
sal_Int32 nY
@ -835,15 +835,15 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
sal_Int32 nCharIndex = 0; // Character index
do
{
OUString aToken = rProperty.second.getToken(0, ';', nCharIndex);
std::u16string_view aToken = o3tl::getToken(rProperty.second, 0, ';', nCharIndex);
if (!nSize)
nSize = aToken.toInt32();
nSize = o3tl::toInt32(aToken);
else if (!nCount)
nCount = aToken.toInt32();
else if (aToken.getLength())
nCount = o3tl::toInt32(aToken);
else if (!aToken.empty())
{
// The coordinates are in an (x,y) form.
aToken = aToken.copy(1, aToken.getLength() - 2);
aToken = aToken.substr(1, aToken.size() - 2);
sal_Int32 nI = 0;
sal_Int32 nX = o3tl::toInt32(o3tl::getToken(aToken, 0, ',', nI));
sal_Int32 nY

View File

@ -380,9 +380,9 @@ bool URLParameter::scheme()
if( m_aExpr.startsWith("vnd.sun.star.help:///") )
{
sal_Int32 nLen = m_aExpr.getLength();
OUString aLastStr =
m_aExpr.copy(sal::static_int_cast<sal_uInt32>(nLen) - 6);
if( aLastStr == "DbPAR=" )
std::u16string_view aLastStr =
m_aExpr.subView(sal::static_int_cast<sal_uInt32>(nLen) - 6);
if( aLastStr == u"DbPAR=" )
{
m_aExpr = OUString::Concat(m_aExpr.subView( 0, 20 )) +
"shared" +

View File

@ -22,6 +22,7 @@
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <o3tl/safeint.hxx>
#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <tvread.hxx>
#include <expat.h>
@ -500,8 +501,8 @@ TVChildTarget::SearchAndInsert(std::unique_ptr<TVDom> p, TVDom* tvDom)
Any SAL_CALL
TVChildTarget::getByName( const OUString& aName )
{
OUString num( aName.copy( 2, aName.getLength()-4 ) );
sal_Int32 idx = num.toInt32() - 1;
std::u16string_view num( aName.subView( 2, aName.getLength()-4 ) );
sal_Int32 idx = o3tl::toInt32(num) - 1;
if( idx < 0 || Elements.size() <= o3tl::make_unsigned( idx ) )
throw NoSuchElementException();
@ -523,8 +524,8 @@ TVChildTarget::getElementNames( )
sal_Bool SAL_CALL
TVChildTarget::hasByName( const OUString& aName )
{
OUString num( aName.copy( 2, aName.getLength()-4 ) );
sal_Int32 idx = num.toInt32() - 1;
std::u16string_view num( aName.subView( 2, aName.getLength()-4 ) );
sal_Int32 idx = o3tl::toInt32(num) - 1;
if( idx < 0 || Elements.size() <= o3tl::make_unsigned( idx ) )
return false;
@ -540,8 +541,8 @@ TVChildTarget::getByHierarchicalName( const OUString& aName )
if( ( idx = aName.indexOf( '/' ) ) != -1 )
{
OUString num( aName.copy( 2, idx-4 ) );
sal_Int32 pref = num.toInt32() - 1;
std::u16string_view num( aName.subView( 2, idx-4 ) );
sal_Int32 pref = o3tl::toInt32(num) - 1;
if( pref < 0 || Elements.size() <= o3tl::make_unsigned( pref ) )
throw NoSuchElementException();
@ -559,8 +560,8 @@ TVChildTarget::hasByHierarchicalName( const OUString& aName )
if( ( idx = aName.indexOf( '/' ) ) != -1 )
{
OUString num( aName.copy( 2, idx-4 ) );
sal_Int32 pref = num.toInt32() - 1;
std::u16string_view num( aName.subView( 2, idx-4 ) );
sal_Int32 pref = o3tl::toInt32(num) - 1;
if( pref < 0 || Elements.size() <= o3tl::make_unsigned( pref ) )
return false;

View File

@ -330,8 +330,8 @@ void OOXMLSecExporter::Impl::writePackageObjectSignatureProperties()
sal_Int32 nCommaPos = m_aSignatureTimeValue.indexOf(',');
if (nCommaPos != -1)
{
m_aSignatureTimeValue = m_aSignatureTimeValue.copy(0, nCommaPos);
m_aSignatureTimeValue += "Z";
m_aSignatureTimeValue
= OUString::Concat(m_aSignatureTimeValue.subView(0, nCommaPos)) + "Z";
}
}
m_xDocumentHandler->characters(m_aSignatureTimeValue);