[Libreoffice-commits] core.git: sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Sat Dec 19 15:30:18 PST 2015
sc/source/ui/unoobj/chart2uno.cxx | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
New commits:
commit 64642dcacfc66e45977919682a026d21ca8f725b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Dec 18 23:03:17 2015 +0100
std::pair<OUString, OUString> is the more natural key type
Change-Id: I21c22d5d987d4b84b775b1c82d186f561971fb30
Reviewed-on: https://gerrit.libreoffice.org/20809
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 51a159e..695ab81 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -1762,15 +1762,14 @@ bool RangeAnalyzer::inSameSingleColumn( RangeAnalyzer& rOther )
return false;
}
-OUString constructKey(const uno::Reference< chart2::data::XLabeledDataSequence>& xNew)
+std::pair<OUString, OUString> constructKey(const uno::Reference< chart2::data::XLabeledDataSequence>& xNew)
{
- OUString key;
+ std::pair<OUString, OUString> aKey;
if( xNew->getLabel().is() )
- key += xNew->getLabel()->getSourceRangeRepresentation();
- key += "####";
+ aKey.first = xNew->getLabel()->getSourceRangeRepresentation();
if( xNew->getValues().is() )
- key += xNew->getValues()->getSourceRangeRepresentation();
- return key;
+ aKey.second = xNew->getValues()->getSourceRangeRepresentation();
+ return aKey;
}
@@ -2000,27 +1999,31 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArgum
const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence> >& aNewSequences =
xDataSource->getDataSequences();
- std::map<OUString,sal_Int32> aOldEntryToIndex;
+ std::map<std::pair<OUString, OUString>,sal_Int32> aOldEntryToIndex;
for( sal_Int32 nIndex = 0; nIndex < aOldSequences.getLength(); nIndex++ )
{
const uno::Reference< chart2::data::XLabeledDataSequence>& xOld( aOldSequences[nIndex] );
if( xOld.is() )
{
- OUString key = constructKey(xOld);
- aOldEntryToIndex[key] = nIndex;
+ std::pair<OUString, OUString> aKey = constructKey(xOld);
+ aOldEntryToIndex[aKey] = nIndex;
}
}
+
for( sal_Int32 nNewIndex = 0; nNewIndex < aNewSequences.getLength(); nNewIndex++ )
{
const uno::Reference< chart2::data::XLabeledDataSequence>& xNew( aNewSequences[nNewIndex] );
if( !xNew.is() )
continue;
- OUString key = constructKey(xNew);
- if (aOldEntryToIndex.find(key) == aOldEntryToIndex.end())
+
+ std::pair<OUString, OUString> aKey = constructKey(xNew);
+ if (aOldEntryToIndex.find(aKey) == aOldEntryToIndex.end())
continue;
- sal_Int32 nOldIndex = aOldEntryToIndex[key];
+
+ sal_Int32 nOldIndex = aOldEntryToIndex[aKey];
if( nOldIndex != nNewIndex )
bDifferentIndexes = true;
+
aSequenceMappingVector.push_back(nOldIndex);
}
}
More information about the Libreoffice-commits
mailing list