summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-10-22 11:41:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-10-22 15:37:41 +0200
commit71a24a911bb091885fb03d124d3936d955b13399 (patch)
tree234b2441bdc9cc4bd19d4ec894097d4a29f5ee98 /sc
parentf3628260e55baf871bd29922075f1498a80e438f (diff)
no need to allocate RangeIndexMapPtr separately
Change-Id: I0e2aae923530667877bfb111b006b214ca51a730 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124057 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/chart2uno.hxx6
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx20
2 files changed, 13 insertions, 13 deletions
diff --git a/sc/inc/chart2uno.hxx b/sc/inc/chart2uno.hxx
index b3d80a6ffe02..a5e4f53b032f 100644
--- a/sc/inc/chart2uno.hxx
+++ b/sc/inc/chart2uno.hxx
@@ -44,6 +44,7 @@
#include <svl/itemprop.hxx>
#include <memory>
+#include <optional>
#include <unordered_set>
#include <vector>
@@ -366,12 +367,11 @@ private:
bool m_bIncludeHiddenCells;
// internals
- typedef std::unique_ptr<std::vector<sal_uInt32> > RangeIndexMapPtr;
-
sal_Int64 m_nObjectId;
ScDocument* m_pDocument;
std::vector<ScTokenRef> m_aTokens;
- RangeIndexMapPtr m_pRangeIndices;
+ std::optional<std::vector<sal_uInt32>>
+ m_oRangeIndices;
std::unique_ptr<ExternalRefListener>
m_pExtRefListener;
SfxItemPropertySet m_aPropSet;
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 7f9d23a7d143..6ec3a1e633d1 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2682,7 +2682,7 @@ sal_Int32 ScChart2DataSequence::FillCacheFromExternalRef(const ScTokenRef& pToke
void ScChart2DataSequence::UpdateTokensFromRanges(const ScRangeList& rRanges)
{
- if (!m_pRangeIndices)
+ if (!m_oRangeIndices)
return;
for ( size_t i = 0, nCount = rRanges.size(); i < nCount; ++i )
@@ -2691,7 +2691,7 @@ void ScChart2DataSequence::UpdateTokensFromRanges(const ScRangeList& rRanges)
const ScRange & rRange = rRanges[i];
ScRefTokenHelper::getTokenFromRange(m_pDocument, pToken, rRange);
- sal_uInt32 nOrigPos = (*m_pRangeIndices)[i];
+ sal_uInt32 nOrigPos = (*m_oRangeIndices)[i];
m_aTokens[nOrigPos] = pToken;
}
@@ -2737,8 +2737,8 @@ void ScChart2DataSequence::CopyData(const ScChart2DataSequence& r)
m_aHiddenValues = r.m_aHiddenValues;
m_aRole = r.m_aRole;
- if (r.m_pRangeIndices)
- m_pRangeIndices.reset(new vector<sal_uInt32>(*r.m_pRangeIndices));
+ if (r.m_oRangeIndices)
+ m_oRangeIndices = *r.m_oRangeIndices;
if (!r.m_pExtRefListener)
return;
@@ -2764,7 +2764,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint
// updated, and bring the change back to the token list.
ScRangeList aRanges;
- m_pRangeIndices.reset(new vector<sal_uInt32>);
+ m_oRangeIndices.emplace();
vector<ScTokenRef>::const_iterator itrBeg = m_aTokens.begin(), itrEnd = m_aTokens.end();
for (vector<ScTokenRef>::const_iterator itr = itrBeg ;itr != itrEnd; ++itr)
{
@@ -2774,11 +2774,11 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint
ScRefTokenHelper::getRangeFromToken(m_pDocument, aRange, *itr, ScAddress());
aRanges.push_back(aRange);
sal_uInt32 nPos = distance(itrBeg, itr);
- m_pRangeIndices->push_back(nPos);
+ m_oRangeIndices->push_back(nPos);
}
}
- assert(m_pRangeIndices->size() == aRanges.size() &&
+ assert(m_oRangeIndices->size() == aRanges.size() &&
"range list and range index list have different sizes.");
unique_ptr<ScRangeList> pUndoRanges;
@@ -2791,7 +2791,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint
if (bChanged)
{
- assert(m_pRangeIndices->size() == aRanges.size() &&
+ assert(m_oRangeIndices->size() == aRanges.size() &&
"range list and range index list have different sizes after the reference update.");
// Bring the change back from the range list to the token list.
@@ -2811,7 +2811,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint
// The hint object provides the old ranges. Restore the old state
// from these ranges.
- if (!m_pRangeIndices || m_pRangeIndices->empty())
+ if (!m_oRangeIndices || m_oRangeIndices->empty())
{
assert(false && " faulty range indices");
break;
@@ -2820,7 +2820,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint
const ScRangeList& rRanges = pUndoHint->GetRanges();
size_t nCount = rRanges.size();
- if (nCount != m_pRangeIndices->size())
+ if (nCount != m_oRangeIndices->size())
{
assert(false && "range count and range index count differ.");
break;