summaryrefslogtreecommitdiff
path: root/sfx2/source/doc/objstor.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-07-10 00:04:48 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2018-07-10 06:04:01 +0200
commit1947730e9810cfbe5f1f7612aa48879b89c8ed6a (patch)
tree961a9122fea2baf3c832dbab554bf5d102875b84 /sfx2/source/doc/objstor.cxx
parentd27e4007c697f5eb78181181a0ddcd663ac265b2 (diff)
Use range-based for
Change-Id: I2e598aa01d42ab4f67becdba3ee30f8dbe983aa2 Reviewed-on: https://gerrit.libreoffice.org/57210 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2/source/doc/objstor.cxx')
-rw-r--r--sfx2/source/doc/objstor.cxx36
1 files changed, 20 insertions, 16 deletions
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 98435a9022d3..20c9d6bf1da6 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -3358,21 +3358,21 @@ bool SfxObjectShell::CopyStoragesOfUnknownMediaType( const uno::Reference< embed
try
{
- uno::Sequence< OUString > aSubElements = xSource->getElementNames();
- for ( sal_Int32 nInd = 0; nInd < aSubElements.getLength(); nInd++ )
+ for (const OUString& rSubElement : xSource->getElementNames())
{
- if ( aSubElements[nInd] == "Configurations" )
+ if (rSubElement == "Configurations")
{
// The workaround for compatibility with SO7, "Configurations" substorage must be preserved
- if ( xSource->isStorageElement( aSubElements[nInd] ) )
+ if (xSource->isStorageElement(rSubElement))
{
- OSL_ENSURE( !xTarget->hasByName( aSubElements[nInd] ),
- "The target storage is an output storage, the element should not exist in the target!" );
+ OSL_ENSURE(!xTarget->hasByName(rSubElement), "The target storage is an output "
+ "storage, the element should not "
+ "exist in the target!");
- xSource->copyElementTo( aSubElements[nInd], xTarget, aSubElements[nInd] );
+ xSource->copyElementTo(rSubElement, xTarget, rSubElement);
}
}
- else if ( xSource->isStorageElement( aSubElements[nInd] ) )
+ else if (xSource->isStorageElement(rSubElement))
{
OUString aMediaType;
const OUString aMediaTypePropName( "MediaType" );
@@ -3381,8 +3381,8 @@ bool SfxObjectShell::CopyStoragesOfUnknownMediaType( const uno::Reference< embed
try
{
uno::Reference< embed::XOptimizedStorage > xOptStorage( xSource, uno::UNO_QUERY_THROW );
- bGotMediaType =
- ( xOptStorage->getElementPropertyValue( aSubElements[nInd], aMediaTypePropName ) >>= aMediaType );
+ bGotMediaType = (xOptStorage->getElementPropertyValue(rSubElement, aMediaTypePropName)
+ >>= aMediaType);
}
catch( uno::Exception& )
{}
@@ -3391,7 +3391,8 @@ bool SfxObjectShell::CopyStoragesOfUnknownMediaType( const uno::Reference< embed
{
uno::Reference< embed::XStorage > xSubStorage;
try {
- xSubStorage = xSource->openStorageElement( aSubElements[nInd], embed::ElementModes::READ );
+ xSubStorage
+ = xSource->openStorageElement(rSubElement, embed::ElementModes::READ);
} catch( uno::Exception& )
{}
@@ -3401,7 +3402,7 @@ bool SfxObjectShell::CopyStoragesOfUnknownMediaType( const uno::Reference< embed
// instead of the temporary storage; this substorage should be removed later
// if the MimeType is wrong
xSubStorage = ::comphelper::OStorageHelper::GetTemporaryStorage();
- xSource->copyStorageElementLastCommitTo( aSubElements[nInd], xSubStorage );
+ xSource->copyStorageElementLastCommitTo(rSubElement, xSubStorage);
}
uno::Reference< beans::XPropertySet > xProps( xSubStorage, uno::UNO_QUERY_THROW );
@@ -3439,12 +3440,15 @@ bool SfxObjectShell::CopyStoragesOfUnknownMediaType( const uno::Reference< embed
default:
{
- OSL_ENSURE( aSubElements[nInd] == "Configurations2" || nFormat == SotClipboardFormatId::STARBASE_8 || !xTarget->hasByName( aSubElements[nInd] ),
- "The target storage is an output storage, the element should not exist in the target!" );
+ OSL_ENSURE(rSubElement == "Configurations2"
+ || nFormat == SotClipboardFormatId::STARBASE_8
+ || !xTarget->hasByName(rSubElement),
+ "The target storage is an output storage, the element "
+ "should not exist in the target!");
- if ( !xTarget->hasByName( aSubElements[nInd] ) )
+ if (!xTarget->hasByName(rSubElement))
{
- xSource->copyElementTo( aSubElements[nInd], xTarget, aSubElements[nInd] );
+ xSource->copyElementTo(rSubElement, xTarget, rSubElement);
}
}
}