diff options
Diffstat (limited to 'sc/source/core/data/dpobject.cxx')
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index dff56a52cd14..fba73d602dfb 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -1289,11 +1289,19 @@ public: FindByName(const OUString& rName) : maName(rName) {} bool operator() (const ScDPSaveDimension* pDim) const { + // Layout name takes precedence. const OUString* pLayoutName = pDim->GetLayoutName(); if (pLayoutName) return *pLayoutName == maName; - return maName == pDim->GetName(); + sheet::GeneralFunction eGenFunc = static_cast<sheet::GeneralFunction>(pDim->GetFunction()); + ScSubTotalFunc eFunc = ScDPUtil::toSubTotalFunc(eGenFunc); + OUString aSrcName = ScDPUtil::getSourceDimensionName(pDim->GetName()); + OUString aFuncName = ScDPUtil::getDisplayedMeasureName(aSrcName, eFunc); + if (maName == aFuncName) + return true; + + return maName == aSrcName; } }; |