Kaydet (Commit) 4e144751 authored tarafından Mike Kaganski's avatar Mike Kaganski Kaydeden (comit) Noel Grandin

loplugin:unusedindex

Change-Id: I256a807dd2a4c81126b5a76f3d472e31b8224146
Reviewed-on: https://gerrit.libreoffice.org/46652Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 39c618ca
......@@ -138,10 +138,8 @@ static SbiSymDef* AddSym ( SbiToken eTok, SbiSymPool& rPool, SbiExprType eCurExp
if( pPar )
{
// generate dummy parameters
sal_Int32 n = 1;
for( short i = 0; i < pPar->GetSize(); i++ )
for( sal_Int32 n = 1; n <= pPar->GetSize(); n++ )
{
n += 1;
OUStringBuffer aPar("PAR");
aPar.append(n);
pProc->GetParams().AddSym( aPar.makeStringAndClear() );
......
......@@ -195,9 +195,8 @@ TokenLabelInfo::TokenLabelInfo()
// Token accepted as label by VBA
static const SbiToken eLabelToken[] = { ACCESS, ALIAS, APPEND, BASE, BINARY, CLASSMODULE,
COMPARE, COMPATIBLE, DEFERR, ERROR_, BASIC_EXPLICIT, LIB, LINE, LPRINT, NAME,
TOBJECT, OUTPUT, PROPERTY, RANDOM, READ, STEP, STOP, TEXT, VBASUPPORT, NIL };
SbiToken eTok;
for( const SbiToken* pTok = eLabelToken ; (eTok = *pTok) != NIL ; ++pTok )
TOBJECT, OUTPUT, PROPERTY, RANDOM, READ, STEP, STOP, TEXT, VBASUPPORT };
for( SbiToken eTok : eLabelToken )
{
m_pTokenCanBeLabelTab[eTok] = true;
}
......
......@@ -243,12 +243,10 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
// Export the images to the storage
Reference< document::XGraphicObjectResolver > xGraphicResolver =
document::GraphicObjectResolver::createWithStorage( mxContext, xStorage );
std::vector< OUString >::iterator it = vEmbeddedImageURLs.begin();
std::vector< OUString >::iterator it_end = vEmbeddedImageURLs.end();
if ( xGraphicResolver.is() )
{
for ( sal_Int32 count = 0; it != it_end; ++it, ++count )
xGraphicResolver->resolveGraphicObjectURL( *it );
for ( const OUString& rURL : vEmbeddedImageURLs )
xGraphicResolver->resolveGraphicObjectURL( rURL );
}
}
}
......
......@@ -217,11 +217,10 @@ sal_Int16 SAL_CALL CreationWizardUnoDlg::execute( )
void SAL_CALL CreationWizardUnoDlg::initialize( const uno::Sequence< uno::Any >& aArguments )
{
const uno::Any* pArguments = aArguments.getConstArray();
for(sal_Int32 i=0; i<aArguments.getLength(); ++i, ++pArguments)
for(const uno::Any& rArgument : aArguments)
{
beans::PropertyValue aProperty;
if(*pArguments >>= aProperty)
if(rArgument >>= aProperty)
{
if( aProperty.Name == "ParentWindow" )
{
......
......@@ -196,31 +196,29 @@ void DataSourceHelper::readArguments( const uno::Sequence< beans::PropertyValue
, OUString & rRangeRepresentation, uno::Sequence< sal_Int32 >& rSequenceMapping
, bool& bUseColumns, bool& bFirstCellAsLabel, bool& bHasCategories )
{
const beans::PropertyValue* pArguments = rArguments.getConstArray();
for(sal_Int32 i=0; i<rArguments.getLength(); ++i, ++pArguments)
for(const beans::PropertyValue& rProperty : rArguments)
{
const beans::PropertyValue& aProperty = *pArguments;
if ( aProperty.Name == "DataRowSource" )
if ( rProperty.Name == "DataRowSource" )
{
css::chart::ChartDataRowSource eRowSource;
if( aProperty.Value >>= eRowSource )
if( rProperty.Value >>= eRowSource )
bUseColumns = (eRowSource==css::chart::ChartDataRowSource_COLUMNS);
}
else if ( aProperty.Name == "FirstCellAsLabel" )
else if ( rProperty.Name == "FirstCellAsLabel" )
{
aProperty.Value >>= bFirstCellAsLabel;
rProperty.Value >>= bFirstCellAsLabel;
}
else if ( aProperty.Name == "HasCategories" )
else if ( rProperty.Name == "HasCategories" )
{
aProperty.Value >>= bHasCategories;
rProperty.Value >>= bHasCategories;
}
else if ( aProperty.Name == "CellRangeRepresentation" )
else if ( rProperty.Name == "CellRangeRepresentation" )
{
aProperty.Value >>= rRangeRepresentation;
rProperty.Value >>= rRangeRepresentation;
}
else if ( aProperty.Name == "SequenceMapping" )
else if ( rProperty.Name == "SequenceMapping" )
{
aProperty.Value >>= rSequenceMapping;
rProperty.Value >>= rSequenceMapping;
}
}
}
......@@ -398,26 +396,24 @@ bool DataSourceHelper::allArgumentsForRectRangeDetected(
{
const uno::Sequence< beans::PropertyValue > aArguments(
xDataProvider->detectArguments( pressUsedDataIntoRectangularFormat( xChartDocument )));
const beans::PropertyValue* pArguments = aArguments.getConstArray();
for(sal_Int32 i=0; i<aArguments.getLength(); ++i, ++pArguments)
for(const beans::PropertyValue& rProperty : aArguments)
{
const beans::PropertyValue& aProperty = *pArguments;
if ( aProperty.Name == "DataRowSource" )
if ( rProperty.Name == "DataRowSource" )
{
bHasDataRowSource =
(aProperty.Value.hasValue() && aProperty.Value.isExtractableTo(
(rProperty.Value.hasValue() && rProperty.Value.isExtractableTo(
cppu::UnoType<css::chart::ChartDataRowSource>::get()));
}
else if ( aProperty.Name == "FirstCellAsLabel" )
else if ( rProperty.Name == "FirstCellAsLabel" )
{
bHasFirstCellAsLabel =
(aProperty.Value.hasValue() && aProperty.Value.isExtractableTo(cppu::UnoType<bool>::get()));
(rProperty.Value.hasValue() && rProperty.Value.isExtractableTo(cppu::UnoType<bool>::get()));
}
else if ( aProperty.Name == "CellRangeRepresentation" )
else if ( rProperty.Name == "CellRangeRepresentation" )
{
OUString aRange;
bHasCellRangeRepresentation =
(aProperty.Value.hasValue() && (aProperty.Value >>= aRange) && !aRange.isEmpty());
(rProperty.Value.hasValue() && (rProperty.Value >>= aRange) && !aRange.isEmpty());
}
}
}
......
......@@ -296,17 +296,15 @@ CellRange getCellRangeFromXMLString( const OUString & rXMLString )
static const sal_Unicode aDollar( '$' );
static const sal_Unicode aBackslash( '\\' );
sal_Int32 nStartPos = 0;
sal_Int32 nEndPos = nStartPos;
const sal_Int32 nLength = rXMLString.getLength();
// reset
CellRange aResult;
// iterate over different ranges
for( sal_Int32 i = 0;
for( sal_Int32 nStartPos = 0, nEndPos = nStartPos;
nEndPos < nLength;
nStartPos = ++nEndPos, i++ )
nStartPos = ++nEndPos )
{
// find start point of next range
......
......@@ -69,20 +69,12 @@ void BubbleChart::calculateMaximumLogicBubbleSize()
sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
for( sal_Int32 nIndex = 0; nIndex < nEndIndex; nIndex++ )
{
std::vector< std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
const std::vector< std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
for( ; aZSlotIter != aZSlotEnd; ++aZSlotIter )
for( auto const& rZSlot : m_aZSlots )
{
std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
const std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
for( ; aXSlotIter != aXSlotEnd; ++aXSlotIter )
for( auto const& rXSlot : rZSlot )
{
std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
const std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
for( ; aSeriesIter != aSeriesEnd; ++aSeriesIter )
for( VDataSeries* pSeries : rXSlot.m_aSeriesVector )
{
VDataSeries* pSeries( *aSeriesIter );
if(!pSeries)
continue;
......@@ -207,31 +199,20 @@ void BubbleChart::createShapes()
//iterate through all x values per indices
for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
{
std::vector< std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
const std::vector< std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; ++aZSlotIter, nZ++ )
for( auto const& rZSlot : m_aZSlots )
{
std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
const std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
for( sal_Int32 nX=0; aXSlotIter != aXSlotEnd; ++aXSlotIter, ++nX )
for( auto const& rXSlot : rZSlot )
{
std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
const std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
//iterate through all series
for( sal_Int32 nSeriesIndex = 0; aSeriesIter != aSeriesEnd; ++aSeriesIter, ++nSeriesIndex )
for( VDataSeries* pSeries : rXSlot.m_aSeriesVector )
{
VDataSeries* pSeries( *aSeriesIter );
if(!pSeries)
continue;
bool bHasFillColorMapping = pSeries->hasPropertyMapping("FillColor");
bool bHasBorderColorMapping = pSeries->hasPropertyMapping("LineColor");
uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(*aSeriesIter, xSeriesTarget);
uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(pSeries, xSeriesTarget);
sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
PlottingPositionHelper* pPosHelper = &(getPlottingPositionHelper( nAttachedAxisIndex ));
......@@ -324,7 +305,7 @@ void BubbleChart::createShapes()
::chart::AbstractShapeFactory::setShapeName( xShape, "MarkHandles" );
//create data point label
if( (**aSeriesIter).getDataPointLabelIfLabel(nIndex) )
if( pSeries->getDataPointLabelIfLabel(nIndex) )
{
LabelAlignment eAlignment = LABEL_ALIGN_TOP;
drawing::Position3D aScenePosition3D( aScenePosition.PositionX
......@@ -366,7 +347,7 @@ void BubbleChart::createShapes()
sal_Int32 nOffset = 0;
if(eAlignment!=LABEL_ALIGN_CENTER)
nOffset = 100;//add some spacing //@todo maybe get more intelligent values
createDataLabel( xTextTarget, **aSeriesIter, nIndex
createDataLabel( xTextTarget, *pSeries, nIndex
, fBubbleSize, fBubbleSize, aScreenPosition2D, eAlignment, nOffset );
}
}
......
......@@ -137,18 +137,13 @@ void CandleStickChart::createShapes()
//iterate through all x values per indices
for( sal_Int32 nIndex = 0; nIndex < nEndIndex; nIndex++ )
{
std::vector< std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
const std::vector< std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
for( sal_Int32 nZ=0; aZSlotIter != aZSlotEnd; ++aZSlotIter, nZ++ )
for( auto const& rZSlot : m_aZSlots )
{
std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
const std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
sal_Int32 nAttachedAxisIndex = 0;
BarPositionHelper* pPosHelper = m_pMainPosHelper.get();
if( aXSlotIter != aXSlotEnd )
if( rZSlot.size() )
{
nAttachedAxisIndex = aXSlotIter->getAttachedAxisIndexForFirstSeries();
nAttachedAxisIndex = rZSlot.front().getAttachedAxisIndexForFirstSeries();
//2ND_AXIS_IN_BARS so far one can assume to have the same plotter for each z slot
pPosHelper = dynamic_cast<BarPositionHelper*>(&( getPlottingPositionHelper( nAttachedAxisIndex ) ) );
if(!pPosHelper)
......@@ -157,29 +152,26 @@ void CandleStickChart::createShapes()
PlotterBase::m_pPosHelper = pPosHelper;
//update/create information for current group
pPosHelper->updateSeriesCount( aZSlotIter->size() );
pPosHelper->updateSeriesCount( rZSlot.size() );
double fSlotX=0;
//iterate through all x slots in this category
for( double fSlotX=0; aXSlotIter != aXSlotEnd; ++aXSlotIter, fSlotX+=1.0 )
for( auto const& rXSlot : rZSlot )
{
std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
const std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
//iterate through all series in this x slot
for( ; aSeriesIter != aSeriesEnd; ++aSeriesIter )
for( VDataSeries* const pSeries : rXSlot.m_aSeriesVector )
{
//collect data point information (logic coordinates, style ):
double fUnscaledX = (*aSeriesIter)->getXValue( nIndex );
double fUnscaledX = pSeries->getXValue( nIndex );
if( m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis() )
fUnscaledX = DateHelper::RasterizeDateValue( fUnscaledX, m_aNullDate, m_nTimeResolution );
if(fUnscaledX<pPosHelper->getLogicMinX() || fUnscaledX>pPosHelper->getLogicMaxX())
continue;//point not visible
double fScaledX = pPosHelper->getScaledSlotPos( fUnscaledX, fSlotX );
double fUnscaledY_First = (*aSeriesIter)->getY_First( nIndex );
double fUnscaledY_Last = (*aSeriesIter)->getY_Last( nIndex );
double fUnscaledY_Min = (*aSeriesIter)->getY_Min( nIndex );
double fUnscaledY_Max = (*aSeriesIter)->getY_Max( nIndex );
double fUnscaledY_First = pSeries->getY_First( nIndex );
double fUnscaledY_Last = pSeries->getY_Last( nIndex );
double fUnscaledY_Min = pSeries->getY_Min( nIndex );
double fUnscaledY_Max = pSeries->getY_Max( nIndex );
bool bBlack=false;
if(fUnscaledY_Last<=fUnscaledY_First)
......@@ -216,11 +208,11 @@ void CandleStickChart::createShapes()
if(bBlack)
xLossGainTarget = xLossTarget;
uno::Reference< beans::XPropertySet > xPointProp( (*aSeriesIter)->getPropertiesOfPoint( nIndex ));
uno::Reference< beans::XPropertySet > xPointProp( pSeries->getPropertiesOfPoint( nIndex ));
uno::Reference< drawing::XShapes > xPointGroupShape_Shapes(nullptr);
{
OUString aPointCID = ObjectIdentifier::createPointCID( (*aSeriesIter)->getPointCID_Stub(), nIndex );
uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes( getSeriesGroupShape(*aSeriesIter, xSeriesTarget) );
OUString aPointCID = ObjectIdentifier::createPointCID( pSeries->getPointCID_Stub(), nIndex );
uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes( getSeriesGroupShape(pSeries, xSeriesTarget) );
xPointGroupShape_Shapes = createGroupShape(xSeriesGroupShape_Shapes,aPointCID);
}
......@@ -296,22 +288,23 @@ void CandleStickChart::createShapes()
}
//create data point label
if( (**aSeriesIter).getDataPointLabelIfLabel(nIndex) )
if( pSeries->getDataPointLabelIfLabel(nIndex) )
{
if(isValidPosition(aPosMiddleFirst))
createDataLabel( xTextTarget, **aSeriesIter, nIndex
createDataLabel( xTextTarget, *pSeries, nIndex
, fUnscaledY_First, 1.0, Position3DToAWTPoint(aPosMiddleFirst), LABEL_ALIGN_LEFT_BOTTOM );
if(isValidPosition(aPosMiddleLast))
createDataLabel( xTextTarget, **aSeriesIter, nIndex
createDataLabel( xTextTarget, *pSeries, nIndex
, fUnscaledY_Last, 1.0, Position3DToAWTPoint(aPosMiddleLast), LABEL_ALIGN_RIGHT_TOP );
if(isValidPosition(aPosMiddleMinimum))
createDataLabel( xTextTarget, **aSeriesIter, nIndex
createDataLabel( xTextTarget, *pSeries, nIndex
, fUnscaledY_Min, 1.0, Position3DToAWTPoint(aPosMiddleMinimum), LABEL_ALIGN_BOTTOM );
if(isValidPosition(aPosMiddleMaximum))
createDataLabel( xTextTarget, **aSeriesIter, nIndex
createDataLabel( xTextTarget, *pSeries, nIndex
, fUnscaledY_Max, 1.0, Position3DToAWTPoint(aPosMiddleMaximum), LABEL_ALIGN_TOP );
}
}//next series in x slot (next y slot)
fSlotX+=1.0;
}//next x slot
}//next z slot
}//next category
......@@ -319,7 +312,7 @@ void CandleStickChart::createShapes()
//remove and delete point-group-shape if empty
if(!xSeriesGroupShape_Shapes->getCount())
{
(*aSeriesIter)->m_xShape.set(NULL);
pSeries->m_xShape.set(NULL);
m_xLogicTarget->remove(xSeriesGroupShape_Shape);
}
*/
......
......@@ -406,16 +406,15 @@ void SAL_CALL OPropertySetAggregationHelper::propertiesChange(const css::uno::Se
std::unique_ptr< css::uno::Any[]> pNewValues(new css::uno::Any[nLen]);
std::unique_ptr< css::uno::Any[]> pOldValues(new css::uno::Any[nLen]);
const css::beans::PropertyChangeEvent* pEvents = _rEvents.getConstArray();
sal_Int32 nDest = 0;
for (sal_Int32 nSource=0; nSource<nLen; ++nSource, ++pEvents)
for (const css::beans::PropertyChangeEvent& rEvent : _rEvents)
{
sal_Int32 nHandle = rPH.getHandleByName(pEvents->PropertyName);
sal_Int32 nHandle = rPH.getHandleByName(rEvent.PropertyName);
if ( ( nHandle != -1 ) && !isCurrentlyForwardingProperty( nHandle ) )
{ // same as above : -1 is valid (73247) ...
pHandles[nDest] = nHandle;
pNewValues[nDest] = pEvents->NewValue;
pOldValues[nDest] = pEvents->OldValue;
pNewValues[nDest] = rEvent.NewValue;
pOldValues[nDest] = rEvent.OldValue;
++nDest;
}
}
......@@ -607,13 +606,12 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues(
OPropertyArrayAggregationHelper& rPH = static_cast< OPropertyArrayAggregationHelper& >( getInfoHelper() );
// determine which properties belong to the aggregate, and which ones to the delegator
const OUString* pNames = _rPropertyNames.getConstArray();
sal_Int32 nAggCount(0);
sal_Int32 nLen(_rPropertyNames.getLength());
for ( sal_Int32 i = 0; i < nLen; ++i, ++pNames )
for ( const OUString& rName : _rPropertyNames )
{
OPropertyArrayAggregationHelper::PropertyOrigin ePropOrg = rPH.classifyProperty( *pNames );
OPropertyArrayAggregationHelper::PropertyOrigin ePropOrg = rPH.classifyProperty( rName );
if ( OPropertyArrayAggregationHelper::PropertyOrigin::Unknown == ePropOrg )
throw WrappedTargetException( OUString(), static_cast< XMultiPropertySet* >( this ), Any( UnknownPropertyException( ) ) );
// due to a flaw in the API design, this method is not allowed to throw an UnknownPropertyException
......@@ -623,8 +621,6 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues(
++nAggCount;
}
pNames = _rPropertyNames.getConstArray(); // reset, we'll need it again below ...
// all properties belong to the aggregate
if (nAggCount == nLen)
m_xAggregateMultiSet->setPropertyValues(_rPropertyNames, _rValues);
......@@ -655,17 +651,17 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues(
Sequence< Any > DelValues( nLen - nAggCount );
Any* pDelValues = DelValues.getArray();
for ( sal_Int32 i = 0; i < nLen; ++i, ++pNames, ++pValues )
for ( const OUString& rName : _rPropertyNames )
{
if ( OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate == rPH.classifyProperty( *pNames ) )
if ( OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate == rPH.classifyProperty( rName ) )
{
*pAggNames++ = *pNames;
*pAggValues++ = *pValues;
*pAggNames++ = rName;
*pAggValues++ = *pValues++;
}
else
{
*pDelNames++ = *pNames;
*pDelValues++ = *pValues;
*pDelNames++ = rName;
*pDelValues++ = *pValues++;
}
}
......
......@@ -71,20 +71,19 @@ void copyProperties(const Reference<XPropertySet>& _rxSource,
Reference< XPropertySetInfo > xDestProps = _rxDest->getPropertySetInfo();
Sequence< Property > aSourceProps = xSourceProps->getProperties();
const Property* pSourceProps = aSourceProps.getConstArray();
Property aDestProp;
for (sal_Int32 i=0; i<aSourceProps.getLength(); ++i, ++pSourceProps)
for (const Property& rSourceProp : aSourceProps)
{
if ( xDestProps->hasPropertyByName(pSourceProps->Name) )
if ( xDestProps->hasPropertyByName(rSourceProp.Name) )
{
try
{
aDestProp = xDestProps->getPropertyByName(pSourceProps->Name);
aDestProp = xDestProps->getPropertyByName(rSourceProp.Name);
if (0 == (aDestProp.Attributes & PropertyAttribute::READONLY) )
{
const Any aSourceValue = _rxSource->getPropertyValue(pSourceProps->Name);
const Any aSourceValue = _rxSource->getPropertyValue(rSourceProp.Name);
if ( 0 != (aDestProp.Attributes & PropertyAttribute::MAYBEVOID) || aSourceValue.hasValue() )
_rxDest->setPropertyValue(pSourceProps->Name, aSourceValue);
_rxDest->setPropertyValue(rSourceProp.Name, aSourceValue);
}
}
catch (Exception&)
......@@ -92,7 +91,7 @@ void copyProperties(const Reference<XPropertySet>& _rxSource,
#if OSL_DEBUG_LEVEL > 0
OUStringBuffer aBuffer;
aBuffer.append( "::comphelper::copyProperties: could not copy property '" );
aBuffer.append( pSourceProps->Name );
aBuffer.append(rSourceProp.Name );
aBuffer.append( "' to the destination set (a '" );
Reference< XServiceInfo > xSI( _rxDest, UNO_QUERY );
......
......@@ -131,12 +131,10 @@ namespace param
OUString ParameterWrapper::impl_getPseudoAggregatePropertyName( sal_Int32 _nHandle ) const
{
Reference< XPropertySetInfo > xInfo = const_cast<ParameterWrapper*>( this )->getPropertySetInfo();
Sequence< Property > aProperties = xInfo->getProperties();
const Property* pProperties = aProperties.getConstArray();
for ( sal_Int32 i = 0; i < aProperties.getLength(); ++i, ++pProperties )
for ( const Property& rProperty : xInfo->getProperties() )
{
if ( pProperties->Handle == _nHandle )
return pProperties->Name;
if ( rProperty.Handle == _nHandle )
return rProperty.Name;
}
OSL_FAIL( "ParameterWrapper::impl_getPseudoAggregatePropertyName: invalid argument!" );
......
......@@ -170,26 +170,23 @@ void OQuery::rebuildColumns()
throw RuntimeException();
}
Sequence< OUString> aNames = xColumns->getElementNames();
const OUString* pIter = aNames.getConstArray();
const OUString* pEnd = pIter + aNames.getLength();
for ( sal_Int32 i = 0;pIter != pEnd; ++pIter,++i)
for ( const OUString& rName : xColumns->getElementNames() )
{
Reference<XPropertySet> xSource(xColumns->getByName( *pIter ),UNO_QUERY);
OUString sLabel = *pIter;
if ( xColumnDefinitions.is() && xColumnDefinitions->hasByName(*pIter) )
Reference<XPropertySet> xSource(xColumns->getByName( rName ),UNO_QUERY);
OUString sLabel = rName;
if ( xColumnDefinitions.is() && xColumnDefinitions->hasByName(rName) )
{
Reference<XPropertySet> xCommandColumn(xColumnDefinitions->getByName( *pIter ),UNO_QUERY);
Reference<XPropertySet> xCommandColumn(xColumnDefinitions->getByName( rName ),UNO_QUERY);
xCommandColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
}
OQueryColumn* pColumn = new OQueryColumn( xSource, m_xConnection, sLabel);
Reference< XChild > xChild( *pColumn, UNO_QUERY_THROW );
xChild->setParent( *this );
implAppendColumn( *pIter, pColumn );
implAppendColumn( rName, pColumn );
Reference< XPropertySet > xDest( *pColumn, UNO_QUERY_THROW );
if ( m_pColumnMediator.is() )
m_pColumnMediator->notifyElementCreated( *pIter, xDest );
m_pColumnMediator->notifyElementCreated( rName, xDest );
}
}
catch( const SQLContext& e )
......
......@@ -466,18 +466,14 @@ void ODatabaseContext::storeTransientProperties( ODatabaseModelImpl& _rModelImpl
if (xSetInfo.is())
aProperties = xSetInfo->getProperties();
if (aProperties.getLength())
for ( const Property& rProperty : aProperties )
{
const Property* pProperties = aProperties.getConstArray();
for ( sal_Int32 i=0; i<aProperties.getLength(); ++i, ++pProperties )
if ( ( ( rProperty.Attributes & PropertyAttribute::TRANSIENT) != 0 )
&& ( ( rProperty.Attributes & PropertyAttribute::READONLY) == 0 )
)
{
if ( ( ( pProperties->Attributes & PropertyAttribute::TRANSIENT) != 0 )
&& ( ( pProperties->Attributes & PropertyAttribute::READONLY) == 0 )
)
{
// found such a property
aRememberProps.put( pProperties->Name, xSource->getPropertyValue( pProperties->Name ) );
}
// found such a property
aRememberProps.put( rProperty.Name, xSource->getPropertyValue( rProperty.Name ) );
}
}
}
......
......@@ -383,12 +383,10 @@ void lcl_uglyHackToStoreDialogeEmbedImages( const Reference< XStorageBasedLibrar
{
// Export the images to the storage
Reference< XGraphicObjectResolver > xGraphicResolver = GraphicObjectResolver::createWithStorage(rxContext, xTmpPic);
std::vector< OUString >::const_iterator it = vEmbedImgUrls.begin();
std::vector< OUString >::const_iterator it_end = vEmbedImgUrls.end();
if ( xGraphicResolver.is() )
{
for ( sal_Int32 count = 0; it != it_end; ++it, ++count )
xGraphicResolver->resolveGraphicObjectURL( *it );
for ( const OUString& rURL : vEmbedImgUrls )
xGraphicResolver->resolveGraphicObjectURL( rURL );
}
// delete old 'Pictures' storage and copy the contents of tempPictures into xStorage
......
......@@ -132,39 +132,38 @@ void SbaExternalSourceBrowser::modified(const css::lang::EventObject& aEvent)
void SAL_CALL SbaExternalSourceBrowser::dispatch(const css::util::URL& aURL, const Sequence< css::beans::PropertyValue>& aArgs)
{
const css::beans::PropertyValue* pArguments = aArgs.getConstArray();
if ( aURL.Complete == ".uno:FormSlots/AddGridColumn" )
{
// search the argument describing the column to create
OUString sControlType;
sal_Int32 nControlPos = -1;
Sequence< css::beans::PropertyValue> aControlProps;
for ( sal_Int32 i = 0; i < aArgs.getLength(); ++i, ++pArguments )
for ( const css::beans::PropertyValue& rArgument : aArgs )
{
if ( pArguments->Name == "ColumnType" )
if ( rArgument.Name == "ColumnType" )
{
auto s = o3tl::tryAccess<OUString>(pArguments->Value);
auto s = o3tl::tryAccess<OUString>(rArgument.Value);
OSL_ENSURE(s, "invalid type for argument \"ColumnType\" !");
if (s)
sControlType = *s;
}
else if ( pArguments->Name == "ColumnPosition" )
else if ( rArgument.Name == "ColumnPosition" )
{
auto n = o3tl::tryAccess<sal_Int16>(pArguments->Value);
auto n = o3tl::tryAccess<sal_Int16>(rArgument.Value);
OSL_ENSURE(n, "invalid type for argument \"ColumnPosition\" !");
if (n)
nControlPos = *n;
}
else if ( pArguments->Name == "ColumnProperties" )
else if ( rArgument.Name == "ColumnProperties" )
{
auto s = o3tl::tryAccess<Sequence<css::beans::PropertyValue>>(
pArguments->Value);
rArgument.Value);
OSL_ENSURE(s, "invalid type for argument \"ColumnProperties\" !");
if (s)
aControlProps = *s;
}
else
SAL_WARN("dbaccess.ui", "SbaExternalSourceBrowser::dispatch(AddGridColumn) : unknown argument (" << pArguments->Name << ") !");
SAL_WARN("dbaccess.ui", "SbaExternalSourceBrowser::dispatch(AddGridColumn) : unknown argument (" << rArgument.Name << ") !");
}
if (sControlType.isEmpty())
{
......@@ -182,17 +181,16 @@ void SAL_CALL SbaExternalSourceBrowser::dispatch(const css::util::URL& aURL, con
// set its properties
if (xNewColProperties.is())
{
const css::beans::PropertyValue* pControlProps = aControlProps.getConstArray();
for (sal_Int32 i=0; i<aControlProps.getLength(); ++i, ++pControlProps)
for (const css::beans::PropertyValue& rControlProp : aControlProps)
{
try
{
if (xNewColProperties->hasPropertyByName(pControlProps->Name))
xNewCol->setPropertyValue(pControlProps->Name, pControlProps->Value);
if (xNewColProperties->hasPropertyByName(rControlProp.Name))
xNewCol->setPropertyValue(rControlProp.Name, rControlProp.Value);
}
catch (const Exception&)
{
SAL_WARN("dbaccess.ui", "SbaExternalSourceBrowser::dispatch : could not set a column property (" << pControlProps->Name << ")!");
SAL_WARN("dbaccess.ui", "SbaExternalSourceBrowser::dispatch : could not set a column property (" << rControlProp.Name << ")!");
}
}
}
......@@ -219,11 +217,11 @@ void SAL_CALL SbaExternalSourceBrowser::dispatch(const css::util::URL& aURL, con
Reference< XRowSet > xMasterForm;
// search the arguments for the master form
for (sal_Int32 i=0; i<aArgs.getLength(); ++i, ++pArguments)
for (const css::beans::PropertyValue& rArgument : aArgs)
{
if ( (pArguments->Name == "MasterForm") && (pArguments->Value.getValueTypeClass() == TypeClass_INTERFACE) )
if ( (rArgument.Name == "MasterForm") && (rArgument.Value.getValueTypeClass() == TypeClass_INTERFACE) )
{
xMasterForm.set(pArguments->Value, UNO_QUERY);
xMasterForm.set(rArgument.Value, UNO_QUERY);
break;
}
}
......
......@@ -1206,14 +1206,11 @@ Reference< css::beans::XPropertySetInfo > SAL_CALL SbaXFormAdapter::getPropertyS
if (-1 == m_nNamePropHandle)
{
// we need to determine the handle for the NAME property
Sequence< css::beans::Property> aProps = xReturn->getProperties();
const css::beans::Property* pProps = aProps.getConstArray();
for (sal_Int32 i=0; i<aProps.getLength(); ++i, ++pProps)
for (const css::beans::Property& rProp : xReturn->getProperties())