Simplify containers iterations in chart2, cli_ure, comphelper, configmgr
Use range-based loop or replace with STL functions Change-Id: I7c229faa96e08b76cb4f182a1bd77c15bac4ba76 Reviewed-on: https://gerrit.libreoffice.org/69010 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
f9b354784f
commit
95a538180f
@@ -107,26 +107,23 @@ void SelectorListBox::UpdateChartElementsListAndSelection()
|
||||
ObjectHierarchy aHierarchy( xChartDoc, pExplicitValueProvider, true /*bFlattenDiagram*/, true /*bOrderingForElementSelector*/ );
|
||||
lcl_addObjectsToList( aHierarchy, ::chart::ObjectHierarchy::getRootNodeOID(), m_aEntries, 0, xChartDoc );
|
||||
|
||||
std::vector< ListBoxEntryData >::iterator aIt( m_aEntries.begin() );
|
||||
if( bAddSelectionToList )
|
||||
{
|
||||
if ( aSelectedOID.isAutoGeneratedObject() )
|
||||
{
|
||||
OUString aSeriesCID = ObjectIdentifier::createClassifiedIdentifierForParticle( ObjectIdentifier::getSeriesParticleFromCID( aSelectedCID ) );
|
||||
for( aIt = m_aEntries.begin(); aIt != m_aEntries.end(); ++aIt )
|
||||
std::vector< ListBoxEntryData >::iterator aIt = std::find_if(m_aEntries.begin(), m_aEntries.end(),
|
||||
[&aSeriesCID](const ListBoxEntryData& rEntry) { return rEntry.OID.getObjectCID().match(aSeriesCID); });
|
||||
if (aIt != m_aEntries.end())
|
||||
{
|
||||
if( aIt->OID.getObjectCID().match( aSeriesCID ) )
|
||||
{
|
||||
ListBoxEntryData aEntry;
|
||||
aEntry.UIName = ObjectNameProvider::getNameForCID( aSelectedCID, xChartDoc );
|
||||
aEntry.OID = aSelectedOID;
|
||||
++aIt;
|
||||
if( aIt != m_aEntries.end() )
|
||||
m_aEntries.insert(aIt, aEntry);
|
||||
else
|
||||
m_aEntries.push_back( aEntry );
|
||||
break;
|
||||
}
|
||||
ListBoxEntryData aEntry;
|
||||
aEntry.UIName = ObjectNameProvider::getNameForCID( aSelectedCID, xChartDoc );
|
||||
aEntry.OID = aSelectedOID;
|
||||
++aIt;
|
||||
if( aIt != m_aEntries.end() )
|
||||
m_aEntries.insert(aIt, aEntry);
|
||||
else
|
||||
m_aEntries.push_back( aEntry );
|
||||
}
|
||||
}
|
||||
else if ( aSelectedOID.isAdditionalShape() )
|
||||
|
||||
@@ -1436,15 +1436,10 @@ TitleHelper::eTitleType ObjectIdentifier::getTitleTypeForCID( const OUString& rC
|
||||
|
||||
OUString aParentParticle = ObjectIdentifier::getFullParentParticle( rCID );
|
||||
const tTitleMap& rMap = lcl_getTitleMap();
|
||||
tTitleMap::const_iterator aIt( rMap.begin() );
|
||||
for( ;aIt != rMap.end(); ++aIt )
|
||||
{
|
||||
if( aParentParticle == (*aIt).second )
|
||||
{
|
||||
eRet = (*aIt).first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
tTitleMap::const_iterator aIt = std::find_if(rMap.begin(), rMap.end(),
|
||||
[&aParentParticle](tTitleMap::const_reference rEntry) { return aParentParticle == rEntry.second; });
|
||||
if (aIt != rMap.end())
|
||||
eRet = (*aIt).first;
|
||||
|
||||
return eRet;
|
||||
}
|
||||
|
||||
@@ -1844,12 +1844,16 @@ void VCartesianAxis::createShapes()
|
||||
if (rAllTickInfos.empty())
|
||||
return;
|
||||
|
||||
TickInfoArraysType::iterator aDepthIter = rAllTickInfos.begin();
|
||||
const TickInfoArraysType::const_iterator aDepthEnd = rAllTickInfos.end();
|
||||
|
||||
sal_Int32 nDepth = 0;
|
||||
sal_Int32 nTickmarkPropertiesCount = m_aAxisProperties.m_aTickmarkPropertiesList.size();
|
||||
for( sal_Int32 nDepth=0; aDepthIter != aDepthEnd && nDepth < nTickmarkPropertiesCount; ++aDepthIter, nDepth++ )
|
||||
createTickMarkLineShapes( *aDepthIter, m_aAxisProperties.m_aTickmarkPropertiesList[nDepth], *pTickFactory2D, false /*bOnlyAtLabels*/ );
|
||||
for( auto& rTickInfos : rAllTickInfos )
|
||||
{
|
||||
if (nDepth == nTickmarkPropertiesCount)
|
||||
break;
|
||||
|
||||
createTickMarkLineShapes( rTickInfos, m_aAxisProperties.m_aTickmarkPropertiesList[nDepth], *pTickFactory2D, false /*bOnlyAtLabels*/ );
|
||||
nDepth++;
|
||||
}
|
||||
}
|
||||
//create axis main lines
|
||||
//it serves also as the handle shape for the axis selection
|
||||
|
||||
@@ -1453,10 +1453,8 @@ long VSeriesPlotter::calculateTimeResolutionOnXAxis()
|
||||
if( !rDateCategories.empty() )
|
||||
{
|
||||
std::vector< double >::const_iterator aIt = rDateCategories.begin(), aEnd = rDateCategories.end();
|
||||
while (rtl::math::isNan(*aIt) && aIt != aEnd)
|
||||
{
|
||||
++aIt;
|
||||
}
|
||||
aIt = std::find_if(aIt, aEnd, [](const double& rDateCategory) { return !rtl::math::isNan(rDateCategory); });
|
||||
|
||||
Date aPrevious(aNullDate); aPrevious.AddDays(rtl::math::approxFloor(*aIt));
|
||||
++aIt;
|
||||
for(;aIt!=aEnd;++aIt)
|
||||
|
||||
@@ -393,17 +393,15 @@ SAL_IMPLEMENT_MAIN()
|
||||
css::uno::Reference< container::XSet > xSet( xTDmgr, UNO_QUERY_THROW );
|
||||
rtl::Reference unoidlMgr(new unoidl::Manager);
|
||||
std::vector< rtl::Reference< unoidl::Provider > > unoidlMandatoryProvs;
|
||||
for (vector< OUString >::iterator i(extra_registries.begin());
|
||||
i != extra_registries.end(); ++i)
|
||||
for (auto& rRegistry : extra_registries)
|
||||
{
|
||||
xSet->insert(makeAny(*i));
|
||||
unoidlMgr->addProvider(*i);
|
||||
xSet->insert(makeAny(rRegistry));
|
||||
unoidlMgr->addProvider(rRegistry);
|
||||
}
|
||||
for (vector< OUString >::iterator i(mandatory_registries.begin());
|
||||
i != mandatory_registries.end(); ++i)
|
||||
for (auto& rRegistry : mandatory_registries)
|
||||
{
|
||||
xSet->insert(makeAny(*i));
|
||||
rtl::Reference< unoidl::Provider > prov(unoidlMgr->addProvider(*i));
|
||||
xSet->insert(makeAny(rRegistry));
|
||||
rtl::Reference< unoidl::Provider > prov(unoidlMgr->addProvider(rRegistry));
|
||||
unoidlMandatoryProvs.push_back(prov);
|
||||
}
|
||||
|
||||
@@ -586,16 +584,8 @@ SAL_IMPLEMENT_MAIN()
|
||||
css::uno::Reference< reflection::XTypeDescription > td(
|
||||
xTD_enum->nextTypeDescription());
|
||||
OUString name(td->getName());
|
||||
bool bEmit = false;
|
||||
for (std::vector< rtl::Reference< unoidl::Provider > >::iterator
|
||||
i(unoidlMandatoryProvs.begin());
|
||||
i != unoidlMandatoryProvs.end(); ++i)
|
||||
{
|
||||
if ((*i)->findEntity(name).is()) {
|
||||
bEmit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool bEmit = std::any_of(unoidlMandatoryProvs.begin(), unoidlMandatoryProvs.end(),
|
||||
[&name](rtl::Reference<unoidl::Provider>& rProv) { return rProv->findEntity(name).is(); });
|
||||
if (bEmit) {
|
||||
type_emitter->get_type(td);
|
||||
}
|
||||
|
||||
@@ -434,41 +434,37 @@ void EmbeddedObjectContainer::AddEmbeddedObject( const css::uno::Reference < css
|
||||
// look for object in temporary container
|
||||
if ( pImpl->mpTempObjectContainer )
|
||||
{
|
||||
EmbeddedObjectContainerNameMap::iterator aEnd = pImpl->mpTempObjectContainer->pImpl->maObjectContainer.end();
|
||||
for( EmbeddedObjectContainerNameMap::iterator aIter = pImpl->mpTempObjectContainer->pImpl->maObjectContainer.begin();
|
||||
aIter != aEnd;
|
||||
++aIter )
|
||||
auto& rObjectContainer = pImpl->mpTempObjectContainer->pImpl->maObjectContainer;
|
||||
auto aIter = std::find_if(rObjectContainer.begin(), rObjectContainer.end(),
|
||||
[&xObj](const EmbeddedObjectContainerNameMap::value_type& rEntry) { return rEntry.second == xObj; });
|
||||
if (aIter != rObjectContainer.end())
|
||||
{
|
||||
if ( aIter->second == xObj )
|
||||
// copy replacement image from temporary container (if there is any)
|
||||
OUString aTempName = aIter->first;
|
||||
OUString aMediaType;
|
||||
uno::Reference < io::XInputStream > xStream = pImpl->mpTempObjectContainer->GetGraphicStream( xObj, &aMediaType );
|
||||
if ( xStream.is() )
|
||||
{
|
||||
// copy replacement image from temporary container (if there is any)
|
||||
OUString aTempName = aIter->first;
|
||||
OUString aMediaType;
|
||||
uno::Reference < io::XInputStream > xStream = pImpl->mpTempObjectContainer->GetGraphicStream( xObj, &aMediaType );
|
||||
if ( xStream.is() )
|
||||
{
|
||||
InsertGraphicStream( xStream, rName, aMediaType );
|
||||
xStream = nullptr;
|
||||
pImpl->mpTempObjectContainer->RemoveGraphicStream( aTempName );
|
||||
}
|
||||
|
||||
// remove object from storage of temporary container
|
||||
uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
|
||||
if ( xPersist.is() )
|
||||
{
|
||||
try
|
||||
{
|
||||
pImpl->mpTempObjectContainer->pImpl->mxStorage->removeElement( aTempName );
|
||||
}
|
||||
catch (const uno::Exception&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// temp. container needs to forget the object
|
||||
pImpl->mpTempObjectContainer->pImpl->maObjectContainer.erase( aIter );
|
||||
break;
|
||||
InsertGraphicStream( xStream, rName, aMediaType );
|
||||
xStream = nullptr;
|
||||
pImpl->mpTempObjectContainer->RemoveGraphicStream( aTempName );
|
||||
}
|
||||
|
||||
// remove object from storage of temporary container
|
||||
uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
|
||||
if ( xPersist.is() )
|
||||
{
|
||||
try
|
||||
{
|
||||
pImpl->mpTempObjectContainer->pImpl->mxStorage->removeElement( aTempName );
|
||||
}
|
||||
catch (const uno::Exception&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// temp. container needs to forget the object
|
||||
pImpl->mpTempObjectContainer->pImpl->maObjectContainer.erase( aIter );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -960,24 +956,18 @@ bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < embed
|
||||
return false;
|
||||
}
|
||||
|
||||
bool bFound = false;
|
||||
EmbeddedObjectContainerNameMap::iterator aEnd = pImpl->maObjectContainer.end();
|
||||
for( EmbeddedObjectContainerNameMap::iterator aIter = pImpl->maObjectContainer.begin();
|
||||
aIter != aEnd;
|
||||
++aIter )
|
||||
auto aIter = std::find_if(pImpl->maObjectContainer.begin(), pImpl->maObjectContainer.end(),
|
||||
[&xObj](const EmbeddedObjectContainerNameMap::value_type& rEntry) { return rEntry.second == xObj; });
|
||||
if (aIter != pImpl->maObjectContainer.end())
|
||||
{
|
||||
if ( aIter->second == xObj )
|
||||
{
|
||||
pImpl->maObjectContainer.erase( aIter );
|
||||
bFound = true;
|
||||
uno::Reference < container::XChild > xChild( xObj, uno::UNO_QUERY );
|
||||
if ( xChild.is() )
|
||||
xChild->setParent( uno::Reference < uno::XInterface >() );
|
||||
break;
|
||||
}
|
||||
pImpl->maObjectContainer.erase( aIter );
|
||||
uno::Reference < container::XChild > xChild( xObj, uno::UNO_QUERY );
|
||||
if ( xChild.is() )
|
||||
xChild->setParent( uno::Reference < uno::XInterface >() );
|
||||
}
|
||||
else
|
||||
SAL_WARN( "comphelper.container", "Object not found for removal!" );
|
||||
|
||||
SAL_WARN_IF( !bFound,"comphelper.container", "Object not found for removal!" );
|
||||
if ( xPersist.is() && bKeepToTempStorage ) // #i119941#
|
||||
{
|
||||
// remove replacement image (if there is one)
|
||||
@@ -1007,22 +997,12 @@ void EmbeddedObjectContainer::CloseEmbeddedObject( const uno::Reference < embed:
|
||||
{
|
||||
// disconnect the object from the container and close it if possible
|
||||
|
||||
bool bFound = false;
|
||||
EmbeddedObjectContainerNameMap::iterator aEnd = pImpl->maObjectContainer.end();
|
||||
for( EmbeddedObjectContainerNameMap::iterator aIter = pImpl->maObjectContainer.begin();
|
||||
aIter != aEnd;
|
||||
++aIter )
|
||||
auto aIter = std::find_if(pImpl->maObjectContainer.begin(), pImpl->maObjectContainer.end(),
|
||||
[&xObj](const EmbeddedObjectContainerNameMap::value_type& rEntry) { return rEntry.second == xObj; });
|
||||
if (aIter != pImpl->maObjectContainer.end())
|
||||
{
|
||||
if ( aIter->second == xObj )
|
||||
{
|
||||
pImpl->maObjectContainer.erase( aIter );
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pImpl->maObjectContainer.erase( aIter );
|
||||
|
||||
if ( bFound )
|
||||
{
|
||||
uno::Reference < ::util::XCloseable > xClose( xObj, uno::UNO_QUERY );
|
||||
try
|
||||
{
|
||||
|
||||
@@ -124,16 +124,11 @@ namespace comphelper
|
||||
|
||||
static void lcl_revokeMapModificationListener( MapData& _mapData, MapEnumerator& _listener )
|
||||
{
|
||||
for ( std::vector< MapEnumerator* >::iterator lookup = _mapData.m_aModListeners.begin();
|
||||
lookup != _mapData.m_aModListeners.end();
|
||||
++lookup
|
||||
)
|
||||
auto lookup = std::find(_mapData.m_aModListeners.begin(), _mapData.m_aModListeners.end(), &_listener);
|
||||
if (lookup != _mapData.m_aModListeners.end())
|
||||
{
|
||||
if ( *lookup == &_listener )
|
||||
{
|
||||
_mapData.m_aModListeners.erase( lookup );
|
||||
return;
|
||||
}
|
||||
_mapData.m_aModListeners.erase( lookup );
|
||||
return;
|
||||
}
|
||||
OSL_FAIL( "lcl_revokeMapModificationListener: the listener is not registered!" );
|
||||
}
|
||||
|
||||
@@ -210,30 +210,17 @@ sal_Int32 OInterfaceContainerHelper2::removeInterface( const Reference<XInterfac
|
||||
|
||||
if( bIsList )
|
||||
{
|
||||
sal_Int32 nLen = aData.pAsVector->size();
|
||||
sal_Int32 i;
|
||||
for( i = 0; i < nLen; i++ )
|
||||
{
|
||||
// It is not valid to compare the pointer directly, but it's faster.
|
||||
if( (*aData.pAsVector)[i].get() == rListener.get() )
|
||||
{
|
||||
aData.pAsVector->erase(aData.pAsVector->begin()+i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// It is not valid to compare the pointer directly, but it's faster.
|
||||
auto it = std::find_if(aData.pAsVector->begin(), aData.pAsVector->end(),
|
||||
[&rListener](const css::uno::Reference<css::uno::XInterface>& rItem) {
|
||||
return rItem.get() == rListener.get(); });
|
||||
|
||||
// interface not found, use the correct compare method
|
||||
if( i == nLen )
|
||||
{
|
||||
for( i = 0; i < nLen; i++ )
|
||||
{
|
||||
if( (*aData.pAsVector)[i] == rListener )
|
||||
{
|
||||
aData.pAsVector->erase(aData.pAsVector->begin()+i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (it == aData.pAsVector->end())
|
||||
it = std::find(aData.pAsVector->begin(), aData.pAsVector->end(), rListener);
|
||||
|
||||
if (it != aData.pAsVector->end())
|
||||
aData.pAsVector->erase(it);
|
||||
|
||||
if( aData.pAsVector->size() == 1 )
|
||||
{
|
||||
|
||||
@@ -464,19 +464,14 @@ void SAL_CALL ImplEventAttacherManager::revokeScriptEvent
|
||||
if (nLastDot != -1)
|
||||
aLstType = aLstType.copy(nLastDot+1);
|
||||
|
||||
std::deque< ScriptEventDescriptor >::const_iterator aEvtEnd = aIt->aEventList.end();
|
||||
for( std::deque< ScriptEventDescriptor >::iterator aEvtIt = aIt->aEventList.begin();
|
||||
aEvtIt != aEvtEnd;
|
||||
++aEvtIt )
|
||||
{
|
||||
if( aLstType == aEvtIt->ListenerType &&
|
||||
EventMethod == aEvtIt->EventMethod &&
|
||||
ToRemoveListenerParam == aEvtIt->AddListenerParam )
|
||||
{
|
||||
aIt->aEventList.erase( aEvtIt );
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto aEvtIt = std::find_if(aIt->aEventList.begin(), aIt->aEventList.end(),
|
||||
[&aLstType, &EventMethod, &ToRemoveListenerParam](const ScriptEventDescriptor& rEvent) {
|
||||
return aLstType == rEvent.ListenerType
|
||||
&& EventMethod == rEvent.EventMethod
|
||||
&& ToRemoveListenerParam == rEvent.AddListenerParam;
|
||||
});
|
||||
if (aEvtIt != aIt->aEventList.end())
|
||||
aIt->aEventList.erase( aEvtIt );
|
||||
|
||||
for( const auto& rObj : aList )
|
||||
attach( nIndex, rObj.xTarget, rObj.aHelper );
|
||||
@@ -562,19 +557,17 @@ void SAL_CALL ImplEventAttacherManager::attach(sal_Int32 nIndex, const Reference
|
||||
return;
|
||||
|
||||
Sequence<css::script::EventListener> aEvents(aCurrentPosition->aEventList.size());
|
||||
std::deque<ScriptEventDescriptor>::iterator itr = aCurrentPosition->aEventList.begin();
|
||||
std::deque<ScriptEventDescriptor>::iterator itrEnd = aCurrentPosition->aEventList.end();
|
||||
css::script::EventListener* p = aEvents.getArray();
|
||||
size_t i = 0;
|
||||
for (; itr != itrEnd; ++itr)
|
||||
for (const auto& rEvent : aCurrentPosition->aEventList)
|
||||
{
|
||||
css::script::EventListener aListener;
|
||||
aListener.AllListener =
|
||||
new AttacherAllListener_Impl(this, itr->ScriptType, itr->ScriptCode);
|
||||
new AttacherAllListener_Impl(this, rEvent.ScriptType, rEvent.ScriptCode);
|
||||
aListener.Helper = rCurObj.aHelper;
|
||||
aListener.ListenerType = itr->ListenerType;
|
||||
aListener.EventMethod = itr->EventMethod;
|
||||
aListener.AddListenerParam = itr->AddListenerParam;
|
||||
aListener.ListenerType = rEvent.ListenerType;
|
||||
aListener.EventMethod = rEvent.EventMethod;
|
||||
aListener.AddListenerParam = rEvent.AddListenerParam;
|
||||
p[i++] = aListener;
|
||||
}
|
||||
|
||||
@@ -598,32 +591,27 @@ void SAL_CALL ImplEventAttacherManager::detach(sal_Int32 nIndex, const Reference
|
||||
throw IllegalArgumentException();
|
||||
|
||||
std::deque< AttacherIndex_Impl >::iterator aCurrentPosition = aIndex.begin() + nIndex;
|
||||
std::deque< AttachedObject_Impl >::iterator aObjEnd = aCurrentPosition->aObjList.end();
|
||||
for( std::deque< AttachedObject_Impl >::iterator aObjIt = aCurrentPosition->aObjList.begin();
|
||||
aObjIt != aObjEnd;
|
||||
++aObjIt )
|
||||
auto aObjIt = std::find_if(aCurrentPosition->aObjList.begin(), aCurrentPosition->aObjList.end(),
|
||||
[&xObject](const AttachedObject_Impl& rObj) { return rObj.xTarget == xObject; });
|
||||
if (aObjIt != aCurrentPosition->aObjList.end())
|
||||
{
|
||||
if( aObjIt->xTarget == xObject )
|
||||
sal_Int32 i = 0;
|
||||
for( const auto& rEvt : aCurrentPosition->aEventList )
|
||||
{
|
||||
sal_Int32 i = 0;
|
||||
for( const auto& rEvt : aCurrentPosition->aEventList )
|
||||
if( aObjIt->aAttachedListenerSeq[i].is() )
|
||||
{
|
||||
if( aObjIt->aAttachedListenerSeq[i].is() )
|
||||
try
|
||||
{
|
||||
xAttacher->removeListener( aObjIt->xTarget, rEvt.ListenerType,
|
||||
rEvt.AddListenerParam, aObjIt->aAttachedListenerSeq[i] );
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
try
|
||||
{
|
||||
xAttacher->removeListener( aObjIt->xTarget, rEvt.ListenerType,
|
||||
rEvt.AddListenerParam, aObjIt->aAttachedListenerSeq[i] );
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
++i;
|
||||
}
|
||||
aCurrentPosition->aObjList.erase( aObjIt );
|
||||
break;
|
||||
++i;
|
||||
}
|
||||
aCurrentPosition->aObjList.erase( aObjIt );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,17 +82,14 @@ namespace comphelper
|
||||
{
|
||||
Reference< XInterface > xReturn;
|
||||
|
||||
for ( ComponentDescriptions::const_iterator component = m_pImpl->m_aRegisteredComponents.begin();
|
||||
component != m_pImpl->m_aRegisteredComponents.end();
|
||||
++component
|
||||
)
|
||||
for (const auto& rComponent : m_pImpl->m_aRegisteredComponents)
|
||||
{
|
||||
if ( component->sImplementationName == _rImplementationName )
|
||||
if ( rComponent.sImplementationName == _rImplementationName )
|
||||
{
|
||||
xReturn = component->pFactoryCreationFunc(
|
||||
component->pComponentCreationFunc,
|
||||
component->sImplementationName,
|
||||
component->aSupportedServices,
|
||||
xReturn = rComponent.pFactoryCreationFunc(
|
||||
rComponent.pComponentCreationFunc,
|
||||
rComponent.sImplementationName,
|
||||
rComponent.aSupportedServices,
|
||||
nullptr
|
||||
);
|
||||
if ( xReturn.is() )
|
||||
|
||||
@@ -431,14 +431,16 @@ OUString DocPasswordHelper::GetOoxHashAsBase64(
|
||||
*pbIsDefaultPassword = false;
|
||||
if( pDefaultPasswords )
|
||||
{
|
||||
for( std::vector< OUString >::const_iterator aIt = pDefaultPasswords->begin(), aEnd = pDefaultPasswords->end(); (eResult == DocPasswordVerifierResult::WrongPassword) && (aIt != aEnd); ++aIt )
|
||||
for( const auto& rPassword : *pDefaultPasswords )
|
||||
{
|
||||
OSL_ENSURE( !aIt->isEmpty(), "DocPasswordHelper::requestAndVerifyDocPassword - unexpected empty default password" );
|
||||
if( !aIt->isEmpty() )
|
||||
OSL_ENSURE( !rPassword.isEmpty(), "DocPasswordHelper::requestAndVerifyDocPassword - unexpected empty default password" );
|
||||
if( !rPassword.isEmpty() )
|
||||
{
|
||||
eResult = rVerifier.verifyPassword( *aIt, aEncData );
|
||||
eResult = rVerifier.verifyPassword( rPassword, aEncData );
|
||||
if( pbIsDefaultPassword )
|
||||
*pbIsDefaultPassword = eResult == DocPasswordVerifierResult::OK;
|
||||
if( eResult != DocPasswordVerifierResult::WrongPassword )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,18 +198,14 @@ OUString SAL_CALL NumberedCollection::getUntitledPrefix()
|
||||
::osl::ResettableMutexGuard aLock(m_aMutex);
|
||||
{
|
||||
TDeadItemList lDeadItems;
|
||||
TNumberedItemHash::const_iterator pComponent;
|
||||
|
||||
for ( pComponent = m_lComponents.begin ();
|
||||
pComponent != m_lComponents.end ();
|
||||
++pComponent )
|
||||
for (const auto& [rComponent, rItem] : m_lComponents)
|
||||
{
|
||||
const TNumberedItem& rItem = pComponent->second;
|
||||
const css::uno::Reference< css::uno::XInterface > xItem = rItem.xItem.get();
|
||||
|
||||
if ( ! xItem.is ())
|
||||
{
|
||||
lDeadItems.push_back(pComponent->first);
|
||||
lDeadItems.push_back(rComponent);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -233,13 +229,8 @@ OUString SAL_CALL NumberedCollection::getUntitledPrefix()
|
||||
void NumberedCollection::impl_cleanUpDeadItems ( TNumberedItemHash& lItems ,
|
||||
const TDeadItemList& lDeadItems)
|
||||
{
|
||||
TDeadItemList::const_iterator pIt;
|
||||
|
||||
for ( pIt = lDeadItems.begin ();
|
||||
pIt != lDeadItems.end ();
|
||||
++pIt )
|
||||
for (const long& rDeadItem : lDeadItems)
|
||||
{
|
||||
const long& rDeadItem = *pIt;
|
||||
lItems.erase(rDeadItem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -632,16 +632,14 @@ LifecycleProxy::~LifecycleProxy() { }
|
||||
|
||||
void LifecycleProxy::commitStorages()
|
||||
{
|
||||
for (Impl::reverse_iterator iter = m_xBadness->rbegin();
|
||||
iter != m_xBadness->rend(); ++iter) // reverse order (outwards)
|
||||
{
|
||||
uno::Reference<embed::XTransactedObject> const xTransaction(*iter,
|
||||
uno::UNO_QUERY);
|
||||
if (xTransaction.is())
|
||||
{
|
||||
xTransaction->commit();
|
||||
}
|
||||
}
|
||||
std::for_each(m_xBadness->rbegin(), m_xBadness->rend(), // reverse order (outwards)
|
||||
[](Impl::reference rxItem) {
|
||||
uno::Reference<embed::XTransactedObject> const xTransaction(rxItem, uno::UNO_QUERY);
|
||||
if (xTransaction.is())
|
||||
{
|
||||
xTransaction->commit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void splitPath( std::vector<OUString> &rElems,
|
||||
|
||||
@@ -178,13 +178,10 @@ namespace
|
||||
void OPropertyContainerHelper::implPushBackProperty(const PropertyDescription& _rProp)
|
||||
{
|
||||
#ifdef DBG_UTIL
|
||||
for ( PropertiesIterator checkConflicts = m_aProperties.begin();
|
||||
checkConflicts != m_aProperties.end();
|
||||
++checkConflicts
|
||||
)
|
||||
for (auto& checkConflicts : m_aProperties)
|
||||
{
|
||||
OSL_ENSURE(checkConflicts->aProperty.Name != _rProp.aProperty.Name, "OPropertyContainerHelper::implPushBackProperty: name already exists!");
|
||||
OSL_ENSURE(checkConflicts->aProperty.Handle != _rProp.aProperty.Handle, "OPropertyContainerHelper::implPushBackProperty: handle already exists!");
|
||||
OSL_ENSURE(checkConflicts.aProperty.Name != _rProp.aProperty.Name, "OPropertyContainerHelper::implPushBackProperty: name already exists!");
|
||||
OSL_ENSURE(checkConflicts.aProperty.Handle != _rProp.aProperty.Handle, "OPropertyContainerHelper::implPushBackProperty: handle already exists!");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -464,15 +461,13 @@ void OPropertyContainerHelper::describeProperties(Sequence< Property >& _rProps)
|
||||
Sequence< Property > aOwnProps(m_aProperties.size());
|
||||
Property* pOwnProps = aOwnProps.getArray();
|
||||
|
||||
for ( ConstPropertiesIterator aLoop = m_aProperties.begin();
|
||||
aLoop != m_aProperties.end();
|
||||
++aLoop, ++pOwnProps
|
||||
)
|
||||
for (const auto& rProp : m_aProperties)
|
||||
{
|
||||
pOwnProps->Name = aLoop->aProperty.Name;
|
||||
pOwnProps->Handle = aLoop->aProperty.Handle;
|
||||
pOwnProps->Attributes = static_cast<sal_Int16>(aLoop->aProperty.Attributes);
|
||||
pOwnProps->Type = aLoop->aProperty.Type;
|
||||
pOwnProps->Name = rProp.aProperty.Name;
|
||||
pOwnProps->Handle = rProp.aProperty.Handle;
|
||||
pOwnProps->Attributes = static_cast<sal_Int16>(rProp.aProperty.Attributes);
|
||||
pOwnProps->Type = rProp.aProperty.Type;
|
||||
++pOwnProps;
|
||||
}
|
||||
|
||||
// as our property vector is sorted by handles, not by name, we have to sort aOwnProps
|
||||
|
||||
@@ -106,80 +106,68 @@ void Broadcaster::addChangesNotification(
|
||||
void Broadcaster::send() {
|
||||
css::uno::Any exception;
|
||||
OUStringBuffer messages;
|
||||
for (DisposeNotifications::iterator i(disposeNotifications_.begin());
|
||||
i != disposeNotifications_.end(); ++i) {
|
||||
for (auto& rNotification : disposeNotifications_) {
|
||||
try {
|
||||
i->listener->disposing(i->event);
|
||||
rNotification.listener->disposing(rNotification.event);
|
||||
} catch (css::lang::DisposedException &) {
|
||||
} catch (css::uno::Exception & e) {
|
||||
exception = cppu::getCaughtException();
|
||||
appendMessage(messages, e);
|
||||
}
|
||||
}
|
||||
for (ContainerNotifications::iterator i(
|
||||
containerElementInsertedNotifications_.begin());
|
||||
i != containerElementInsertedNotifications_.end(); ++i)
|
||||
for (auto& rNotification : containerElementInsertedNotifications_)
|
||||
{
|
||||
try {
|
||||
i->listener->elementInserted(i->event);
|
||||
rNotification.listener->elementInserted(rNotification.event);
|
||||
} catch (css::lang::DisposedException &) {
|
||||
} catch (css::uno::Exception & e) {
|
||||
exception = cppu::getCaughtException();
|
||||
appendMessage(messages, e);
|
||||
}
|
||||
}
|
||||
for (ContainerNotifications::iterator i(
|
||||
containerElementRemovedNotifications_.begin());
|
||||
i != containerElementRemovedNotifications_.end(); ++i)
|
||||
for (auto& rNotification : containerElementRemovedNotifications_)
|
||||
{
|
||||
try {
|
||||
i->listener->elementRemoved(i->event);
|
||||
rNotification.listener->elementRemoved(rNotification.event);
|
||||
} catch (css::lang::DisposedException &) {
|
||||
} catch (css::uno::Exception & e) {
|
||||
exception = cppu::getCaughtException();
|
||||
appendMessage(messages, e);
|
||||
}
|
||||
}
|
||||
for (ContainerNotifications::iterator i(
|
||||
containerElementReplacedNotifications_.begin());
|
||||
i != containerElementReplacedNotifications_.end(); ++i)
|
||||
for (auto& rNotification : containerElementReplacedNotifications_)
|
||||
{
|
||||
try {
|
||||
i->listener->elementReplaced(i->event);
|
||||
rNotification.listener->elementReplaced(rNotification.event);
|
||||
} catch (css::lang::DisposedException &) {
|
||||
} catch (css::uno::Exception & e) {
|
||||
exception = cppu::getCaughtException();
|
||||
appendMessage(messages, e);
|
||||
}
|
||||
}
|
||||
for (PropertyChangeNotifications::iterator i(
|
||||
propertyChangeNotifications_.begin());
|
||||
i != propertyChangeNotifications_.end(); ++i)
|
||||
for (auto& rNotification : propertyChangeNotifications_)
|
||||
{
|
||||
try {
|
||||
i->listener->propertyChange(i->event);
|
||||
rNotification.listener->propertyChange(rNotification.event);
|
||||
} catch (css::lang::DisposedException &) {
|
||||
} catch (css::uno::Exception & e) {
|
||||
exception = cppu::getCaughtException();
|
||||
appendMessage(messages, e);
|
||||
}
|
||||
}
|
||||
for (PropertiesChangeNotifications::iterator i(
|
||||
propertiesChangeNotifications_.begin());
|
||||
i != propertiesChangeNotifications_.end(); ++i)
|
||||
for (auto& rNotification : propertiesChangeNotifications_)
|
||||
{
|
||||
try {
|
||||
i->listener->propertiesChange(i->event);
|
||||
rNotification.listener->propertiesChange(rNotification.event);
|
||||
} catch (css::lang::DisposedException &) {
|
||||
} catch (css::uno::Exception & e) {
|
||||
exception = cppu::getCaughtException();
|
||||
appendMessage(messages, e);
|
||||
}
|
||||
}
|
||||
for (ChangesNotifications::iterator i(changesNotifications_.begin());
|
||||
i != changesNotifications_.end(); ++i) {
|
||||
for (auto& rNotification : changesNotifications_) {
|
||||
try {
|
||||
i->listener->changesOccurred(i->event);
|
||||
rNotification.listener->changesOccurred(rNotification.event);
|
||||
} catch (css::lang::DisposedException &) {
|
||||
} catch (css::uno::Exception & e) {
|
||||
exception = cppu::getCaughtException();
|
||||
|
||||
Reference in New Issue
Block a user