Kaydet (Commit) f74281a0 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:stringloop in xmloff

Change-Id: I33a24e08b7359a75c41b88c21ee31c22b8c62d05
Reviewed-on: https://gerrit.libreoffice.org/58215
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 0c64757b
......@@ -3694,18 +3694,15 @@ void XMLShapeExport::export3DLamps( const css::uno::Reference< css::beans::XProp
const OUString aDirectionPropName("D3DSceneLightDirection");
const OUString aLightOnPropName("D3DSceneLightOn");
OUString aPropName;
OUString aIndexStr;
::basegfx::B3DVector aLightDirection;
drawing::Direction3D aLightDir;
bool bLightOnOff = false;
for(sal_Int32 nLamp = 1; nLamp <= 8; nLamp++)
{
aIndexStr = OUString::number( nLamp );
OUString aIndexStr = OUString::number( nLamp );
// lightcolor
aPropName = aColorPropName;
aPropName += aIndexStr;
OUString aPropName = aColorPropName + aIndexStr;
sal_Int32 nLightColor = 0;
xPropSet->getPropertyValue( aPropName ) >>= nLightColor;
::sax::Converter::convertColor(sStringBuffer, nLightColor);
......@@ -3713,8 +3710,7 @@ void XMLShapeExport::export3DLamps( const css::uno::Reference< css::beans::XProp
mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DIFFUSE_COLOR, aStr);
// lightdirection
aPropName = aDirectionPropName;
aPropName += aIndexStr;
aPropName = aDirectionPropName + aIndexStr;
xPropSet->getPropertyValue(aPropName) >>= aLightDir;
aLightDirection = ::basegfx::B3DVector(aLightDir.DirectionX, aLightDir.DirectionY, aLightDir.DirectionZ);
SvXMLUnitConverter::convertB3DVector(sStringBuffer, aLightDirection);
......@@ -3722,8 +3718,7 @@ void XMLShapeExport::export3DLamps( const css::uno::Reference< css::beans::XProp
mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DIRECTION, aStr);
// lighton
aPropName = aLightOnPropName;
aPropName += aIndexStr;
aPropName = aLightOnPropName + aIndexStr;
xPropSet->getPropertyValue(aPropName) >>= bLightOnOff;
::sax::Converter::convertBool(sStringBuffer, bLightOnOff);
aStr = sStringBuffer.makeStringAndClear();
......@@ -4915,9 +4910,7 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape
sal_Int32 nIndex = 0;
do
{
sPictureName = "TablePreview";
sPictureName += OUString::number( ++nIndex );
sPictureName += ".svm";
sPictureName = "TablePreview" + OUString::number( ++nIndex ) + ".svm";
}
while( xPictureStorage->hasByName( sPictureName ) );
......
This diff is collapsed.
......@@ -454,14 +454,12 @@ namespace xmloff
return OUString(sUnnamedName);
Sequence< OUString > aNames = m_xParentContainer->getElementNames();
OUString sReturn;
const OUString* pNames = nullptr;
const OUString* pNamesEnd = aNames.getConstArray() + aNames.getLength();
for (sal_Int32 i=0; i<32768; ++i) // the limit is nearly arbitrary ...
{
// assemble the new name (suggestion)
sReturn = sUnnamedName;
sReturn += OUString::number(i);
OUString sReturn = sUnnamedName + OUString::number(i);
// check the existence (this is the bad performance part ....)
for (pNames = aNames.getConstArray(); pNames<pNamesEnd; ++pNames)
{
......
......@@ -38,14 +38,13 @@ namespace xmloff
// translate the events
const ScriptEventDescriptor* pEvents = _rEvents.getConstArray();
OUString sName;
OUString sLibrary, sLocalMacroName;
for (sal_Int32 i=0; i<nEvents; ++i, ++pEvents)
{
// the name of the event is build from listener interface and listener method name
sName = pEvents->ListenerType;
sName += EVENT_NAME_SEPARATOR;
sName += pEvents->EventMethod;
OUString sName = pEvents->ListenerType
+ EVENT_NAME_SEPARATOR
+ pEvents->EventMethod;
Sequence< PropertyValue >& rMappedEvent = m_aMappedEvents[sName];
......
......@@ -390,7 +390,6 @@ void OFormLayerXMLImport_Impl::endPage()
try
{
static const sal_Unicode s_nSeparator = ',';
OUString sReferring;
OUString sCurrentReferring;
OUString sSeparator(&s_nSeparator, 1);
Reference< XPropertySet > xCurrentReferring;
......@@ -405,8 +404,7 @@ void OFormLayerXMLImport_Impl::endPage()
// in a list of n ids there are only n-1 separators ... have to catch this last id
// -> normalize the list
sReferring = aReferences->second;
sReferring += sSeparator;
OUString sReferring = aReferences->second + sSeparator;
nPrevSep = -1;
while (-1 != (nSeparator = sReferring.indexOf(s_nSeparator, nPrevSep + 1)))
......
......@@ -484,7 +484,7 @@ namespace xmloff
Sequence< OUString > aItems;
m_xProps->getPropertyValue( _rPropertyName ) >>= aItems;
OUString sFinalList;
OUStringBuffer sFinalList;
// unfortunately the OUString can't append single sal_Unicode characters ...
const OUString sQuote(&_aQuoteCharacter, 1);
......@@ -504,17 +504,17 @@ namespace xmloff
"OPropertyExport::exportStringSequenceAttribute: there is an item which contains the quote character!");
if (bQuote)
sFinalList += sQuote;
sFinalList += *pItems;
sFinalList.append(sQuote);
sFinalList.append(*pItems);
if (bQuote)
sFinalList += sQuote;
sFinalList.append(sQuote);
if (pItems != pLastElement)
sFinalList += sSeparator;
sFinalList.append(sSeparator);
}
if (!sFinalList.isEmpty())
AddAttribute(_nAttributeNamespaceKey, _pAttributeName, sFinalList);
AddAttribute(_nAttributeNamespaceKey, _pAttributeName, sFinalList.makeStringAndClear());
exportedProperty( _rPropertyName );
}
......
......@@ -194,11 +194,10 @@ OUString XMLFontAutoStylePool::Add(
{
sal_Int32 nCount = 1;
OUString sPrefix( sName );
sName += OUString::number( nCount );
sName = sPrefix + OUString::number( nCount );
while( m_aNames.find(sName) != m_aNames.end() )
{
sName = sPrefix;
sName += OUString::number( ++nCount );
sName = sPrefix + OUString::number( ++nCount );
}
}
......
......@@ -619,16 +619,16 @@ void SvXMLNumFmtExport::WriteNumberElement_Impl(
true, false );
// text as element content
OUString aContent( pObj->aText );
OUStringBuffer aContent( pObj->aText );
while ( nEntry+1 < nEntryCount && rEmbeddedEntries[nEntry+1].nFormatPos == pObj->nFormatPos )
{
// The array can contain several elements for the same position in the number
// (for example, literal text and space from underscores). They must be merged
// into a single embedded-text element.
aContent += rEmbeddedEntries[nEntry+1].aText;
aContent.append(rEmbeddedEntries[nEntry+1].aText);
++nEntry;
}
rExport.Characters( aContent );
rExport.Characters( aContent.makeStringAndClear() );
}
}
......
......@@ -547,8 +547,7 @@ void XMLTextFrameContext_Impl::Create()
sal_Int32 i = 0;
while( xTextImportHelper->HasFrameByName( sName ) )
{
sName = sOldName;
sName += OUString::number( ++i );
sName = sOldName + OUString::number( ++i );
}
xNamed->setName( sName );
if( sName != sOldName )
......
......@@ -213,8 +213,7 @@ OUString XMLTextListsHelper::GenerateNewListId() const
while ( mpProcessedLists->find( sNewListId ) != mpProcessedLists->end() )
{
++nHitCount;
sNewListId = sTmpStr;
sNewListId += OUString::number( nHitCount );
sNewListId = sTmpStr + OUString::number( nHitCount );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment