diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-14 11:23:44 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-14 17:18:58 -0500 |
commit | 691f2451c86348239d3b9735ee81b8ecd3209161 (patch) | |
tree | c697301ec6abe4b773bcda1a24b43e7708cfb847 /sc | |
parent | ec7ed71cd3f6130268bae2ffba5a6c69ebed20b6 (diff) |
Removed the incorrect assumption about the data layout field.
The Excel import filter code assumed that the data layout field be
always the last row field, which is totally wrong. The data layout
field can be at any column/row field position in fact.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/dpoutputgeometry.hxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/dpoutputgeometry.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/excel/xipivot.cxx | 50 |
3 files changed, 16 insertions, 43 deletions
diff --git a/sc/inc/dpoutputgeometry.hxx b/sc/inc/dpoutputgeometry.hxx index c5c65195eff0..e0a5a8706b44 100644 --- a/sc/inc/dpoutputgeometry.hxx +++ b/sc/inc/dpoutputgeometry.hxx @@ -44,8 +44,7 @@ public: ~ScDPOutputGeometry(); /** - * @param nCount number of row fields, <b>excluding the data layout - * field if exists</b>. + * @param nCount number of row fields. */ void setRowFieldCount(sal_uInt32 nCount); void setColumnFieldCount(sal_uInt32 nCount); @@ -65,7 +64,7 @@ private: private: ScRange maOutRange; - sal_uInt32 mnRowFields; /// number of row fields (data layout field NOT included!) + sal_uInt32 mnRowFields; /// number of row fields 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 f3d7e8283c42..2defc5a6f22c 100644 --- a/sc/source/core/data/dpoutputgeometry.cxx +++ b/sc/source/core/data/dpoutputgeometry.cxx @@ -82,8 +82,6 @@ void ScDPOutputGeometry::getColumnFieldPositions(vector<ScAddress>& rAddrs) cons return; } - bool bDataLayout = mnDataFields > 1; - SCROW nCurRow = maOutRange.aStart.Row(); if (mnPageFields) @@ -97,7 +95,7 @@ void ScDPOutputGeometry::getColumnFieldPositions(vector<ScAddress>& rAddrs) cons SCROW nRow = nCurRow; SCTAB nTab = maOutRange.aStart.Tab(); - SCCOL nColStart = static_cast<SCCOL>(maOutRange.aStart.Col() + mnRowFields + (bDataLayout ? 1 : 0)); + SCCOL nColStart = static_cast<SCCOL>(maOutRange.aStart.Col() + mnRowFields); SCCOL nColEnd = nColStart + static_cast<SCCOL>(mnColumnFields-1); for (SCCOL nCol = nColStart; nCol <= nColEnd; ++nCol) diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx index 8cbd721b6d10..7e93dff05e25 100644 --- a/sc/source/filter/excel/xipivot.cxx +++ b/sc/source/filter/excel/xipivot.cxx @@ -1444,7 +1444,7 @@ void XclImpPivotTable::Convert() pDPObj->SetSaveData( aSaveData ); pDPObj->SetSheetDesc( aDesc ); pDPObj->SetOutRange( aOutRange ); - pDPObj->SetAlive( sal_True ); + pDPObj->SetAlive(true); pDPObj->SetHeaderLayout( maPTViewEx9Info.mnGridLayout == 0 ); GetDoc().GetDPCollection()->InsertNewTable(pDPObj); @@ -1472,11 +1472,7 @@ void XclImpPivotTable::ApplyMergeFlags(const ScRange& rOutRange, const ScDPSaveD aGeometry.setColumnFieldCount(maPTInfo.mnColFields); aGeometry.setPageFieldCount(maPTInfo.mnPageFields); aGeometry.setDataFieldCount(maPTInfo.mnDataFields); - - // Excel includes data layout field in the row field count. We need to - // subtract it. - bool bDataLayout = maPTInfo.mnDataFields > 1; - aGeometry.setRowFieldCount(maPTInfo.mnRowFields - static_cast<sal_uInt32>(bDataLayout)); + aGeometry.setRowFieldCount(maPTInfo.mnRowFields); ScDocument& rDoc = GetDoc(); @@ -1486,7 +1482,7 @@ void XclImpPivotTable::ApplyMergeFlags(const ScRange& rOutRange, const ScDPSaveD for (; itr != itrEnd; ++itr) { sal_uInt16 nMFlag = SC_MF_BUTTON; - String aName; + rtl::OUString aName; rDoc.GetString(itr->Col(), itr->Row(), itr->Tab(), aName); if (rSaveData.HasInvisibleMember(aName)) nMFlag |= SC_MF_HIDDEN_MEMBER; @@ -1502,7 +1498,7 @@ void XclImpPivotTable::ApplyMergeFlags(const ScRange& rOutRange, const ScDPSaveD for (; itr != itrEnd; ++itr) { sal_Int16 nMFlag = SC_MF_BUTTON | SC_MF_BUTTON_POPUP; - String aName; + rtl::OUString aName; rDoc.GetString(itr->Col(), itr->Row(), itr->Tab(), aName); if (rSaveData.HasInvisibleMember(aName)) nMFlag |= SC_MF_HIDDEN_MEMBER; @@ -1511,40 +1507,20 @@ void XclImpPivotTable::ApplyMergeFlags(const ScRange& rOutRange, const ScDPSaveD vector<ScAddress> aRowBtns; aGeometry.getRowFieldPositions(aRowBtns); - if (aRowBtns.empty()) - { - 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); - } - } - else + itr = aRowBtns.begin(); + itrEnd = aRowBtns.end(); + for (; itr != itrEnd; ++itr) { - 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); - } + sal_Int16 nMFlag = SC_MF_BUTTON | SC_MF_BUTTON_POPUP; + rtl::OUString 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); } } // ============================================================================ -// ============================================================================ XclImpPivotTableManager::XclImpPivotTableManager( const XclImpRoot& rRoot ) : XclImpRoot( rRoot ) |