summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-29 10:29:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-29 12:35:47 +0200
commit38d4b6eb42246c0dbd4958a50ed8437bc93508d6 (patch)
treef5cb5690566cf9bb90944458e9b6c862a8870f58 /oox
parentf56f8be65b26cb3c8e83af05f10ba9f717ff76b2 (diff)
use more string_view in oox
found by examining uses of OUString::copy() for likely places Change-Id: I23c397b0438e67e0fdbc1fb4ffa6882aa5e2bf91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133591 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/hyperlinkcontext.cxx4
-rw-r--r--oox/source/dump/oledumper.cxx9
-rw-r--r--oox/source/export/drawingml.cxx4
-rw-r--r--oox/source/ole/olehelper.cxx6
-rw-r--r--oox/source/ole/vbamodule.cxx4
-rw-r--r--oox/source/vml/vmlformatting.cxx12
6 files changed, 19 insertions, 20 deletions
diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx
index 7bb6930eca13..352eb7bf5efa 100644
--- a/oox/source/drawingml/hyperlinkcontext.cxx
+++ b/oox/source/drawingml/hyperlinkcontext.cxx
@@ -91,8 +91,8 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent,
static const OUStringLiteral sJump( u"jump=" );
if ( aPPAct.match( sJump, nIndex + 1 ) )
{
- OUString aDestination( aPPAct.copy( nIndex + 1 + sJump.getLength() ) );
- sURL += "#action?jump=" + aDestination;
+ std::u16string_view aDestination( aPPAct.subView( nIndex + 1 + sJump.getLength() ) );
+ sURL += OUString::Concat("#action?jump=") + aDestination;
}
}
else if ( aPPAction.match( "hlinksldjump" ) )
diff --git a/oox/source/dump/oledumper.cxx b/oox/source/dump/oledumper.cxx
index 036c12a5670e..92e67c04590f 100644
--- a/oox/source/dump/oledumper.cxx
+++ b/oox/source/dump/oledumper.cxx
@@ -24,6 +24,7 @@
#include <oox/dump/oledumper.hxx>
#include <rtl/tencinfo.h>
+#include <o3tl/string_view.hxx>
#include <oox/ole/vbainputstream.hxx>
#ifdef DBG_UTIL
@@ -1830,10 +1831,10 @@ bool VbaContainerStorageObject::isFormStorage( const OUString& rStrgPath ) const
{
if( (rStrgPath.getLength() >= 3) && (rStrgPath[ 0 ] == 'i') )
{
- OUString aId = rStrgPath.copy( 1 );
- if( (aId.getLength() == 2) && (aId[ 0 ] == '0') )
- aId = aId.copy( 1 );
- sal_Int32 nId = aId.toInt32();
+ std::u16string_view aId = rStrgPath.subView( 1 );
+ if( (aId.size() == 2) && (aId[ 0 ] == '0') )
+ aId = aId.substr( 1 );
+ sal_Int32 nId = o3tl::toInt32(aId);
if( (nId > 0) && (std::u16string_view(OUString::number( nId )) == aId) )
for (auto const& siteInfo : maFormData.maSiteInfos)
if( siteInfo.mnId == nId )
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 609528cd33bf..bbeea30af4e5 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2389,9 +2389,9 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
else
{
sal_Int32 nIndex = sURL.indexOf('=');
- OUString aDestination(sURL.copy(nIndex + 1));
+ std::u16string_view aDestination(sURL.subView(nIndex + 1));
mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, XML_id), "", XML_action,
- "ppaction://hlinkshowjump?jump=" + aDestination);
+ OUString::Concat("ppaction://hlinkshowjump?jump=") + aDestination);
}
}
}
diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx
index 16b38919a213..41ab34febea3 100644
--- a/oox/source/ole/olehelper.cxx
+++ b/oox/source/ole/olehelper.cxx
@@ -525,8 +525,7 @@ bool MSConvertOCXControls::WriteOCXExcelKludgeStream( const css::uno::Reference<
return false;
rName = exportHelper.getTypeName();
SvGlobalName aName;
- OUString sId = exportHelper.getGUID();
- aName.MakeId(sId);
+ aName.MakeId(exportHelper.getGUID());
BinaryXOutputStream aOut( xOutStrm, false );
OleHelper::exportGuid( aOut, aName );
exportHelper.exportControl( xOutStrm, rSize );
@@ -544,8 +543,7 @@ bool MSConvertOCXControls::WriteOCXStream( const Reference< XModel >& rxModel, t
if ( !exportHelper.isValid() )
return false;
- OUString sId = exportHelper.getGUID();
- aName.MakeId(sId);
+ aName.MakeId(exportHelper.getGUID());
OUString sFullName = exportHelper.getFullName();
rName = exportHelper.getTypeName();
diff --git a/oox/source/ole/vbamodule.cxx b/oox/source/ole/vbamodule.cxx
index 21a2af75caed..207a76e83bb3 100644
--- a/oox/source/ole/vbamodule.cxx
+++ b/oox/source/ole/vbamodule.cxx
@@ -199,13 +199,13 @@ OUString VbaModule::readSourceCode( StorageBase& rVbaStrg )
int nSpaceIndex = aCodeLine.indexOf(' ');
OUString sProc = aCodeLine.copy( nSpaceIndex + 1, index - nSpaceIndex - 1);
// for Excel short cut key seems limited to cntrl+'a-z, A-Z'
- OUString sKey = aCodeLine.copy( aCodeLine.lastIndexOf("= ") + 3, 1 );
+ std::u16string_view sKey = aCodeLine.subView( aCodeLine.lastIndexOf("= ") + 3, 1 );
// only alpha key valid for key shortcut, however the api will accept other keys
if ( rtl::isAsciiAlpha( sKey[ 0 ] ) )
{
// cntrl modifier is explicit ( but could be cntrl+shift ), parseKeyEvent
// will handle and uppercase letter appropriately
- OUString sApiKey = "^" + sKey;
+ OUString sApiKey = OUString::Concat("^") + sKey;
maKeyBindings.push_back({sApiKey, sProc});
}
}
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 655069842eda..e83209a7e014 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -166,14 +166,14 @@ sal_Int64 ConversionHelper::decodeMeasureToEmu( const GraphicHelper& rGraphicHel
return 0;
// process trailing unit, convert to EMU
- OUString aUnit;
+ std::u16string_view aUnit;
if( (0 < nEndPos) && (nEndPos < rValue.getLength()) )
- aUnit = rValue.copy( nEndPos );
+ aUnit = rValue.subView( nEndPos );
else if( bDefaultAsPixel )
- aUnit = "px";
+ aUnit = u"px";
// else default is EMU
- if( aUnit.getLength() == 2 )
+ if( aUnit.size() == 2 )
{
sal_Unicode cChar1 = aUnit[ 0 ];
sal_Unicode cChar2 = aUnit[ 1 ];
@@ -192,11 +192,11 @@ sal_Int64 ConversionHelper::decodeMeasureToEmu( const GraphicHelper& rGraphicHel
: rGraphicHelper.convertScreenPixelYToHmm(fValue),
o3tl::Length::mm100, o3tl::Length::emu);
}
- else if( (aUnit.getLength() == 1) && (aUnit[ 0 ] == '%') )
+ else if( (aUnit.size() == 1) && (aUnit[ 0 ] == '%') )
{
fValue *= nRefValue / 100.0;
}
- else if( bDefaultAsPixel || !aUnit.isEmpty() ) // default as EMU and no unit -> do nothing
+ else if( bDefaultAsPixel || !aUnit.empty() ) // default as EMU and no unit -> do nothing
{
OSL_FAIL( "ConversionHelper::decodeMeasureToEmu - unknown measure unit" );
fValue = nRefValue;