diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-07-26 15:52:53 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-07-30 23:49:56 -0400 |
commit | 7af53e4e75556bdea0a1e524a87671e7436cbc97 (patch) | |
tree | 51084cd8422500ed12fcd9090fce09ece06220c2 | |
parent | 813e71369309e52c62fbd9b3e2aeddb244eadf14 (diff) |
More on removing direct access to reference data members.
Change-Id: I9bb682da0408df76794a1bbf9d48995cd1633d99
-rw-r--r-- | sc/source/filter/excel/xechart.cxx | 20 | ||||
-rw-r--r-- | sc/source/filter/excel/xeformula.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/excel/xelink.cxx | 32 | ||||
-rw-r--r-- | sc/source/filter/excel/xichart.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/inc/xelink.hxx | 4 |
5 files changed, 37 insertions, 37 deletions
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 92bb9390ab0a..64e3f0d755d9 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -941,20 +941,20 @@ sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference< XDataSequence > x { // split 3-dimensional ranges into single sheets const ScComplexRefData& rComplexRef = static_cast< const ScToken* >( pToken )->GetDoubleRef(); - const ScSingleRefData& rRef1 = rComplexRef.Ref1; - const ScSingleRefData& rRef2 = rComplexRef.Ref2; - for( SCsTAB nScTab = rRef1.nTab; nScTab <= rRef2.nTab; ++nScTab ) + ScAddress aAbs1 = rComplexRef.Ref1.toAbs(ScAddress()); + ScAddress aAbs2 = rComplexRef.Ref2.toAbs(ScAddress()); + for (SCsTAB nScTab = aAbs1.Tab(); nScTab <= aAbs2.Tab(); ++nScTab) { // split 2-dimensional ranges into single columns - if( bSplitToColumns && (rRef1.nCol < rRef2.nCol) && (rRef1.nRow < rRef2.nRow) ) - for( SCsCOL nScCol = rRef1.nCol; nScCol <= rRef2.nCol; ++nScCol ) - lclAddDoubleRefData( aArray, *pToken, nScTab, nScCol, rRef1.nRow, nScTab, nScCol, rRef2.nRow ); + if (bSplitToColumns && (aAbs1.Col() < aAbs2.Col()) && (aAbs1.Row() < aAbs2.Row())) + for (SCCOL nScCol = aAbs1.Col(); nScCol <= aAbs2.Col(); ++nScCol) + lclAddDoubleRefData(aArray, *pToken, nScTab, nScCol, aAbs1.Row(), nScTab, nScCol, aAbs2.Row()); else - lclAddDoubleRefData( aArray, *pToken, nScTab, rRef1.nCol, rRef1.nRow, nScTab, rRef2.nCol, rRef2.nRow ); + lclAddDoubleRefData(aArray, *pToken, nScTab, aAbs1.Col(), aAbs1.Row(), nScTab, aAbs2.Col(), aAbs2.Row()); } - sal_uInt32 nTabs = static_cast< sal_uInt32 >( rRef2.nTab - rRef1.nTab + 1 ); - sal_uInt32 nCols = static_cast< sal_uInt32 >( rRef2.nCol - rRef1.nCol + 1 ); - sal_uInt32 nRows = static_cast< sal_uInt32 >( rRef2.nRow - rRef1.nRow + 1 ); + sal_uInt32 nTabs = static_cast<sal_uInt32>(aAbs2.Tab() - aAbs1.Tab() + 1); + sal_uInt32 nCols = static_cast<sal_uInt32>(aAbs2.Col() - aAbs1.Col() + 1); + sal_uInt32 nRows = static_cast<sal_uInt32>(aAbs2.Row() - aAbs1.Row() + 1); nValueCount += nCols * nRows * nTabs; } break; diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index 32d3d75add4f..a80300261280 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -1879,8 +1879,8 @@ void XclExpFmlaCompImpl::ConvertRefData( { // convert start and end of the range ConvertRefData( rRefData.Ref1, rXclRange.maFirst, bNatLangRef, false, false ); - bool bTruncMaxCol = !rRefData.Ref1.IsColDeleted() && (rRefData.Ref1.nCol == 0); - bool bTruncMaxRow = !rRefData.Ref1.IsRowDeleted() && (rRefData.Ref1.nRow == 0); + bool bTruncMaxCol = !rRefData.Ref1.IsColDeleted() && (rXclRange.maFirst.mnCol == 0); + bool bTruncMaxRow = !rRefData.Ref1.IsRowDeleted() && (rXclRange.maFirst.mnRow == 0); ConvertRefData( rRefData.Ref2, rXclRange.maLast, bNatLangRef, bTruncMaxCol, bTruncMaxRow ); } @@ -1916,7 +1916,7 @@ void XclExpFmlaCompImpl::ProcessCellRef( const XclExpScToken& rTokData ) { // store external cell contents in CRN records if( mxData->mrCfg.mbFromCell && mxData->mpLinkMgr && mxData->mpScBasePos ) - mxData->mpLinkMgr->StoreCell( aRefData ); + mxData->mpLinkMgr->StoreCell(aRefData, *mxData->mpScBasePos); // create the tRef, tRefErr, tRefN, tRef3d, or tRefErr3d token if( !mxData->mrCfg.mb3DRefOnly && IsRef2D( aRefData ) ) @@ -1961,7 +1961,7 @@ void XclExpFmlaCompImpl::ProcessRangeRef( const XclExpScToken& rTokData ) // store external cell contents in CRN records if( mxData->mrCfg.mbFromCell && mxData->mpLinkMgr && mxData->mpScBasePos ) - mxData->mpLinkMgr->StoreCellRange( aRefData ); + mxData->mpLinkMgr->StoreCellRange(aRefData, *mxData->mpScBasePos); // create the tArea, tAreaErr, tAreaN, tArea3d, or tAreaErr3d token if( !mxData->mrCfg.mb3DRefOnly && IsRef2D( aRefData ) ) diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index 8c1e16b35da3..2c00f9f031ab 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -470,7 +470,7 @@ public: XclExpRefLogEntry* pRefLogEntry ) = 0; /** Derived classes store all cells in the given range in a CRN record list. */ - virtual void StoreCellRange( const ScSingleRefData& rRef1, const ScSingleRefData& rRef2 ) = 0; + virtual void StoreCellRange( const ScSingleRefData& rRef1, const ScSingleRefData& rRef2, const ScAddress& rPos ) = 0; virtual void StoreCell( sal_uInt16 nFileId, const String& rTabName, const ScAddress& rPos ) = 0; virtual void StoreCellRange( sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange ) = 0; @@ -518,7 +518,7 @@ public: sal_uInt16& rnExtSheet, sal_uInt16& rnFirstSBTab, sal_uInt16& rnLastSBTab, XclExpRefLogEntry* pRefLogEntry ); - virtual void StoreCellRange( const ScSingleRefData& rRef1, const ScSingleRefData& rRef2 ); + virtual void StoreCellRange( const ScSingleRefData& rRef1, const ScSingleRefData& rRef2, const ScAddress& rPos ); virtual void StoreCell( sal_uInt16 nFileId, const String& rTabName, const ScAddress& rPos ); virtual void StoreCellRange( sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange ); @@ -588,7 +588,7 @@ public: sal_uInt16& rnExtSheet, sal_uInt16& rnFirstSBTab, sal_uInt16& rnLastSBTab, XclExpRefLogEntry* pRefLogEntry ); - virtual void StoreCellRange( const ScSingleRefData& rRef1, const ScSingleRefData& rRef2 ); + virtual void StoreCellRange( const ScSingleRefData& rRef1, const ScSingleRefData& rRef2, const ScAddress& rPos ); virtual void StoreCell( sal_uInt16 nFileId, const String& rTabName, const ScAddress& rPos ); virtual void StoreCellRange( sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange ); @@ -1959,7 +1959,7 @@ void XclExpLinkManagerImpl5::FindExtSheet( // not implemented } -void XclExpLinkManagerImpl5::StoreCellRange( const ScSingleRefData& /*rRef1*/, const ScSingleRefData& /*rRef2*/ ) +void XclExpLinkManagerImpl5::StoreCellRange( const ScSingleRefData& /*rRef1*/, const ScSingleRefData& /*rRef2*/, const ScAddress& /*rPos*/ ) { // not implemented } @@ -2140,17 +2140,17 @@ void XclExpLinkManagerImpl8::FindExtSheet( rnLastSBTab = aXti.mnLastSBTab; } -void XclExpLinkManagerImpl8::StoreCellRange( const ScSingleRefData& rRef1, const ScSingleRefData& rRef2 ) +void XclExpLinkManagerImpl8::StoreCellRange( const ScSingleRefData& rRef1, const ScSingleRefData& rRef2, const ScAddress& rPos ) { - if( !rRef1.IsDeleted() && !rRef2.IsDeleted() && (rRef1.nTab >= 0) && (rRef2.nTab >= 0) ) + ScAddress aAbs1 = rRef1.toAbs(rPos); + ScAddress aAbs2 = rRef2.toAbs(rPos); + if (!rRef1.IsDeleted() && !rRef2.IsDeleted() && (aAbs1.Tab() >= 0) && (aAbs2.Tab() >= 0)) { const XclExpTabInfo& rTabInfo = GetTabInfo(); - SCTAB nFirstScTab = static_cast< SCTAB >( rRef1.nTab ); - SCTAB nLastScTab = static_cast< SCTAB >( rRef2.nTab ); - ScRange aRange( - static_cast< SCCOL >( rRef1.nCol ), static_cast< SCROW >( rRef1.nRow ), 0, - static_cast< SCCOL >( rRef2.nCol ), static_cast< SCROW >( rRef2.nRow ), 0 ); - for( SCTAB nScTab = nFirstScTab; nScTab <= nLastScTab; ++nScTab ) + SCTAB nFirstScTab = aAbs1.Tab(); + SCTAB nLastScTab = aAbs2.Tab(); + ScRange aRange(aAbs1.Col(), aAbs1.Row(), 0, aAbs2.Col(), aAbs2.Row(), 0); + for (SCTAB nScTab = nFirstScTab; nScTab <= nLastScTab; ++nScTab) { if( rTabInfo.IsExternalTab( nScTab ) ) { @@ -2297,14 +2297,14 @@ void XclExpLinkManager::FindExtSheet( sal_uInt16 nFileId, const String& rTabName mxImpl->FindExtSheet( nFileId, rTabName, nXclTabSpan, rnExtSheet, rnFirstSBTab, rnLastSBTab, pRefLogEntry ); } -void XclExpLinkManager::StoreCell( const ScSingleRefData& rRef ) +void XclExpLinkManager::StoreCell( const ScSingleRefData& rRef, const ScAddress& rPos ) { - mxImpl->StoreCellRange( rRef, rRef ); + mxImpl->StoreCellRange(rRef, rRef, rPos); } -void XclExpLinkManager::StoreCellRange( const ScComplexRefData& rRef ) +void XclExpLinkManager::StoreCellRange( const ScComplexRefData& rRef, const ScAddress& rPos ) { - mxImpl->StoreCellRange( rRef.Ref1, rRef.Ref2 ); + mxImpl->StoreCellRange(rRef.Ref1, rRef.Ref2, rPos); } void XclExpLinkManager::StoreCell( sal_uInt16 nFileId, const String& rTabName, const ScAddress& rPos ) diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 2ccd8c5a9e82..fb16dda287b2 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -802,11 +802,11 @@ sal_uInt16 XclImpChSourceLink::GetCellCount() const { // cell range const ScComplexRefData& rComplexRef = static_cast< const ScToken* >( pToken )->GetDoubleRef(); - const ScSingleRefData& rRef1 = rComplexRef.Ref1; - const ScSingleRefData& rRef2 = rComplexRef.Ref2; - sal_uInt32 nTabs = static_cast< sal_uInt32 >( rRef2.nTab - rRef1.nTab + 1 ); - sal_uInt32 nCols = static_cast< sal_uInt32 >( rRef2.nCol - rRef1.nCol + 1 ); - sal_uInt32 nRows = static_cast< sal_uInt32 >( rRef2.nRow - rRef1.nRow + 1 ); + ScAddress aAbs1 = rComplexRef.Ref1.toAbs(ScAddress()); + ScAddress aAbs2 = rComplexRef.Ref2.toAbs(ScAddress()); + sal_uInt32 nTabs = static_cast<sal_uInt32>(aAbs2.Tab() - aAbs1.Tab() + 1); + sal_uInt32 nCols = static_cast<sal_uInt32>(aAbs2.Col() - aAbs1.Col() + 1); + sal_uInt32 nRows = static_cast<sal_uInt32>(aAbs2.Row() - aAbs1.Row() + 1); nCellCount += nCols * nRows * nTabs; } break; diff --git a/sc/source/filter/inc/xelink.hxx b/sc/source/filter/inc/xelink.hxx index cdf65d36a9d5..8331aa928fb2 100644 --- a/sc/source/filter/inc/xelink.hxx +++ b/sc/source/filter/inc/xelink.hxx @@ -166,9 +166,9 @@ public: XclExpRefLogEntry* pRefLogEntry = NULL ); /** Stores the cell with the given address in a CRN record list. */ - void StoreCell( const ScSingleRefData& rRef ); + void StoreCell( const ScSingleRefData& rRef, const ScAddress& rPos ); /** Stores all cells in the given range in a CRN record list. */ - void StoreCellRange( const ScComplexRefData& rRef ); + void StoreCellRange( const ScComplexRefData& rRef, const ScAddress& rPos ); void StoreCell( sal_uInt16 nFileId, const String& rTabName, const ScAddress& rPos ); |