diff options
-rw-r--r-- | sc/inc/dpoutputgeometry.hxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/dpoutputgeometry.cxx | 39 | ||||
-rw-r--r-- | sc/source/filter/excel/xipivot.cxx | 38 |
3 files changed, 51 insertions, 30 deletions
diff --git a/sc/inc/dpoutputgeometry.hxx b/sc/inc/dpoutputgeometry.hxx index dcf98f8f4ade..8183d94e2305 100644 --- a/sc/inc/dpoutputgeometry.hxx +++ b/sc/inc/dpoutputgeometry.hxx @@ -57,6 +57,8 @@ public: void getRowFieldPositions(::std::vector<ScAddress>& rAddrs) const; void getPageFieldPositions(::std::vector<ScAddress>& rAddrs) const; + SCROW getRowFieldHeaderRow() const; + FieldType getFieldButtonType(const ScAddress& rPos) const; private: @@ -64,7 +66,7 @@ private: private: ScRange maOutRange; - sal_uInt32 mnRowFields; + sal_uInt32 mnRowFields; /// number of row fields (data layout field NOT included!) sal_uInt32 mnColumnFields; sal_uInt32 mnPageFields; sal_uInt32 mnDataFields; diff --git a/sc/source/core/data/dpoutputgeometry.cxx b/sc/source/core/data/dpoutputgeometry.cxx index 1b8fc0b8435f..86b7d8f0bd15 100644 --- a/sc/source/core/data/dpoutputgeometry.cxx +++ b/sc/source/core/data/dpoutputgeometry.cxx @@ -117,23 +117,7 @@ void ScDPOutputGeometry::getRowFieldPositions(vector<ScAddress>& rAddrs) const return; } - SCROW nCurRow = maOutRange.aStart.Row(); - - if (mnPageFields) - { - SCROW nRowStart = maOutRange.aStart.Row() + mbShowFilter; - SCROW nRowEnd = nRowStart + static_cast<SCCOL>(mnPageFields-1); - nCurRow = nRowEnd + 2; - } - else if (mbShowFilter) - nCurRow += 2; - - if (mnColumnFields) - nCurRow += static_cast<SCROW>(mnColumnFields); - else - ++nCurRow; - - SCROW nRow = nCurRow; + SCROW nRow = getRowFieldHeaderRow(); SCTAB nTab = maOutRange.aStart.Tab(); SCCOL nColStart = maOutRange.aStart.Col(); SCCOL nColEnd = nColStart + static_cast<SCCOL>(mnRowFields-1); @@ -163,6 +147,27 @@ void ScDPOutputGeometry::getPageFieldPositions(vector<ScAddress>& rAddrs) const rAddrs.swap(aAddrs); } +SCROW ScDPOutputGeometry::getRowFieldHeaderRow() const +{ + SCROW nCurRow = maOutRange.aStart.Row(); + + if (mnPageFields) + { + SCROW nRowStart = maOutRange.aStart.Row() + mbShowFilter; + SCROW nRowEnd = nRowStart + static_cast<SCCOL>(mnPageFields-1); + nCurRow = nRowEnd + 2; + } + else if (mbShowFilter) + nCurRow += 2; + + if (mnColumnFields) + nCurRow += static_cast<SCROW>(mnColumnFields); + else if (mnRowFields) + ++nCurRow; + + return nCurRow; +} + ScDPOutputGeometry::FieldType ScDPOutputGeometry::getFieldButtonType(const ScAddress& rPos) const { // We will ignore the table position for now. diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx index 7ec0e5d2a694..fdc7246151ca 100644 --- a/sc/source/filter/excel/xipivot.cxx +++ b/sc/source/filter/excel/xipivot.cxx @@ -1486,21 +1486,35 @@ void XclImpPivotTable::ApplyMergeFlags(const ScRange& rOutRange, const ScDPSaveD vector<ScAddress> aRowBtns; aGeometry.getRowFieldPositions(aRowBtns); - itr = aRowBtns.begin(); - itrEnd = aRowBtns.end(); - for (; itr != itrEnd; ++itr) + if (aRowBtns.empty()) { - sal_Int16 nMFlag = SC_MF_BUTTON | SC_MF_BUTTON_POPUP; - String aName; - rDoc.GetString(itr->Col(), itr->Row(), itr->Tab(), aName); - if (rSaveData.HasInvisibleMember(aName)) - nMFlag |= SC_MF_HIDDEN_MEMBER; - rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), nMFlag); + if (bDataLayout) + { + // No row fields, but the data layout button exists. + SCROW nRow = aGeometry.getRowFieldHeaderRow(); + SCCOL nCol = rOutRange.aStart.Col(); + SCTAB nTab = rOutRange.aStart.Tab(); + rDoc.ApplyFlagsTab(nCol, nRow, nCol, nRow, nTab, SC_MF_BUTTON); + } } - if (bDataLayout) + else { - --itr; // move back to the last row field position. - rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), SC_MF_BUTTON); + itr = aRowBtns.begin(); + itrEnd = aRowBtns.end(); + for (; itr != itrEnd; ++itr) + { + sal_Int16 nMFlag = SC_MF_BUTTON | SC_MF_BUTTON_POPUP; + String aName; + rDoc.GetString(itr->Col(), itr->Row(), itr->Tab(), aName); + if (rSaveData.HasInvisibleMember(aName)) + nMFlag |= SC_MF_HIDDEN_MEMBER; + rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), nMFlag); + } + if (bDataLayout) + { + --itr; // move back to the last row field position. + rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), SC_MF_BUTTON); + } } } |