summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-02-14 18:01:26 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-02-14 18:03:46 -0500
commit1eb375177a7f0356e571a0d9c34cb64c649f2f45 (patch)
tree16ec286e5a0ee9396b6ff1139a07dbf71531f513
parent38f40c5ca607b7761f6433a4d12eee5f1057fa50 (diff)
Caller should check the member visibility, not the callee.
Just to be consistent... Change-Id: I8d36c438992751c6389c9481e5ff9ea198ccbba0
-rw-r--r--sc/source/core/data/dptabres.cxx162
1 files changed, 80 insertions, 82 deletions
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 5d80477208d8..bae3831b51a8 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -1579,7 +1579,8 @@ void ScDPResultMember::FillDataResults( const ScDPResultMember* pRefMember,
OSL_ENSURE( rRow < rSequence.getLength(), "bumm" );
uno::Sequence<sheet::DataResult>& rSubSeq = rSequence.getArray()[rRow];
long nSeqCol = 0;
- pDataRoot->FillDataRow( pRefMember, rSubSeq, nSeqCol, nMemberMeasure, bHasChild, aSubState );
+ if (pRefMember->IsVisible())
+ pDataRoot->FillDataRow(pRefMember, rSubSeq, nSeqCol, nMemberMeasure, bHasChild, aSubState);
rRow += 1;
}
@@ -1975,115 +1976,112 @@ void ScDPDataMember::FillDataRow( const ScDPResultMember* pRefMember,
{
OSL_ENSURE( pRefMember == pResultMember || !pResultMember, "bla" );
- if ( pRefMember->IsVisible() ) //! here or in ScDPDataDimension::FillDataRow ???
- {
- long nStartCol = rCol;
+ long nStartCol = rCol;
- const ScDPDataDimension* pDataChild = GetChildDimension();
- const ScDPResultDimension* pRefChild = pRefMember->GetChildDimension();
+ const ScDPDataDimension* pDataChild = GetChildDimension();
+ const ScDPResultDimension* pRefChild = pRefMember->GetChildDimension();
- const ScDPLevel* pRefParentLevel = const_cast<ScDPResultMember*>(pRefMember)->GetParentLevel();
+ const ScDPLevel* pRefParentLevel = const_cast<ScDPResultMember*>(pRefMember)->GetParentLevel();
- long nExtraSpace = 0;
- if ( pRefParentLevel && pRefParentLevel->IsAddEmpty() )
- ++nExtraSpace;
+ long nExtraSpace = 0;
+ if ( pRefParentLevel && pRefParentLevel->IsAddEmpty() )
+ ++nExtraSpace;
- bool bTitleLine = false;
- if ( pRefParentLevel && pRefParentLevel->IsOutlineLayout() )
- bTitleLine = true;
+ bool bTitleLine = false;
+ if ( pRefParentLevel && pRefParentLevel->IsOutlineLayout() )
+ bTitleLine = true;
- bool bSubTotalInTitle = pRefMember->IsSubTotalInTitle( nMeasure );
+ bool bSubTotalInTitle = pRefMember->IsSubTotalInTitle( nMeasure );
- // leave space for children even if the DataMember hasn't been initialized
- // (pDataChild is null then, this happens when no values for it are in this row)
- bool bHasChild = ( pRefChild != NULL );
+ // leave space for children even if the DataMember hasn't been initialized
+ // (pDataChild is null then, this happens when no values for it are in this row)
+ bool bHasChild = ( pRefChild != NULL );
- if ( bHasChild )
- {
- if ( bTitleLine ) // in tabular layout the title is on a separate column
- ++rCol; // -> fill child dimension one column below
+ if ( bHasChild )
+ {
+ if ( bTitleLine ) // in tabular layout the title is on a separate column
+ ++rCol; // -> fill child dimension one column below
- if ( pDataChild )
- pDataChild->FillDataRow( pRefChild, rSequence, rCol, nMeasure, bIsSubTotalRow, rSubState );
- rCol += (sal_uInt16)pRefMember->GetSize( nMeasure );
+ if ( pDataChild )
+ pDataChild->FillDataRow( pRefChild, rSequence, rCol, nMeasure, bIsSubTotalRow, rSubState );
+ rCol += (sal_uInt16)pRefMember->GetSize( nMeasure );
- if ( bTitleLine ) // title column is included in GetSize, so the following
- --rCol; // positions are calculated with the normal values
+ if ( bTitleLine ) // title column is included in GetSize, so the following
+ --rCol; // positions are calculated with the normal values
+ }
+
+ long nUserSubStart;
+ long nUserSubCount = pRefMember->GetSubTotalCount(&nUserSubStart);
+ if ( nUserSubCount || !bHasChild )
+ {
+ // Calculate at least automatic if no subtotals are selected,
+ // show only own values if there's no child dimension (innermost).
+ if ( !nUserSubCount || !bHasChild )
+ {
+ nUserSubCount = 1;
+ nUserSubStart = 0;
}
- long nUserSubStart;
- long nUserSubCount = pRefMember->GetSubTotalCount(&nUserSubStart);
- if ( nUserSubCount || !bHasChild )
+ ScDPSubTotalState aLocalSubState(rSubState); // keep row state, modify column
+
+ long nMemberMeasure = nMeasure;
+ long nSubSize = pResultData->GetCountForMeasure(nMeasure);
+ if (bHasChild)
{
- // Calculate at least automatic if no subtotals are selected,
- // show only own values if there's no child dimension (innermost).
- if ( !nUserSubCount || !bHasChild )
- {
- nUserSubCount = 1;
- nUserSubStart = 0;
- }
+ rCol -= nSubSize * ( nUserSubCount - nUserSubStart ); // GetSize includes space for SubTotal
+ rCol -= nExtraSpace; // GetSize includes the empty line
+ }
- ScDPSubTotalState aLocalSubState(rSubState); // keep row state, modify column
+ long nMoveSubTotal = 0;
+ if ( bSubTotalInTitle )
+ {
+ nMoveSubTotal = rCol - nStartCol; // force to first (title) column
+ rCol = nStartCol;
+ }
- long nMemberMeasure = nMeasure;
- long nSubSize = pResultData->GetCountForMeasure(nMeasure);
- if (bHasChild)
+ for (long nUserPos=nUserSubStart; nUserPos<nUserSubCount; nUserPos++)
+ {
+ if ( pChildDimension && nUserSubCount > 1 )
{
- rCol -= nSubSize * ( nUserSubCount - nUserSubStart ); // GetSize includes space for SubTotal
- rCol -= nExtraSpace; // GetSize includes the empty line
+ const ScDPLevel* pForceLevel = pResultMember ? pResultMember->GetParentLevel() : NULL;
+ aLocalSubState.nColSubTotalFunc = nUserPos;
+ aLocalSubState.eColForce = lcl_GetForceFunc( pForceLevel, nUserPos );
}
- long nMoveSubTotal = 0;
- if ( bSubTotalInTitle )
+ for ( long nSubCount=0; nSubCount<nSubSize; nSubCount++ )
{
- nMoveSubTotal = rCol - nStartCol; // force to first (title) column
- rCol = nStartCol;
- }
+ if ( nMeasure == SC_DPMEASURE_ALL )
+ nMemberMeasure = nSubCount;
- for (long nUserPos=nUserSubStart; nUserPos<nUserSubCount; nUserPos++)
- {
- if ( pChildDimension && nUserSubCount > 1 )
- {
- const ScDPLevel* pForceLevel = pResultMember ? pResultMember->GetParentLevel() : NULL;
- aLocalSubState.nColSubTotalFunc = nUserPos;
- aLocalSubState.eColForce = lcl_GetForceFunc( pForceLevel, nUserPos );
- }
+ OSL_ENSURE( rCol < rSequence.getLength(), "bumm" );
+ sheet::DataResult& rRes = rSequence.getArray()[rCol];
- for ( long nSubCount=0; nSubCount<nSubSize; nSubCount++ )
+ if ( HasData( nMemberMeasure, aLocalSubState ) )
{
- if ( nMeasure == SC_DPMEASURE_ALL )
- nMemberMeasure = nSubCount;
-
- OSL_ENSURE( rCol < rSequence.getLength(), "bumm" );
- sheet::DataResult& rRes = rSequence.getArray()[rCol];
-
- if ( HasData( nMemberMeasure, aLocalSubState ) )
+ if ( HasError( nMemberMeasure, aLocalSubState ) )
{
- if ( HasError( nMemberMeasure, aLocalSubState ) )
- {
- rRes.Value = 0;
- rRes.Flags |= sheet::DataResultFlags::ERROR;
- }
- else
- {
- rRes.Value = GetAggregate( nMemberMeasure, aLocalSubState );
- rRes.Flags |= sheet::DataResultFlags::HASDATA;
- }
+ rRes.Value = 0;
+ rRes.Flags |= sheet::DataResultFlags::ERROR;
}
+ else
+ {
+ rRes.Value = GetAggregate( nMemberMeasure, aLocalSubState );
+ rRes.Flags |= sheet::DataResultFlags::HASDATA;
+ }
+ }
- if ( bHasChild || bIsSubTotalRow )
- rRes.Flags |= sheet::DataResultFlags::SUBTOTAL;
+ if ( bHasChild || bIsSubTotalRow )
+ rRes.Flags |= sheet::DataResultFlags::SUBTOTAL;
- rCol += 1;
- }
+ rCol += 1;
}
+ }
- // add extra space again if subtracted from GetSize above,
- // add to own size if no children
- rCol += nExtraSpace;
+ // add extra space again if subtracted from GetSize above,
+ // add to own size if no children
+ rCol += nExtraSpace;
- rCol += nMoveSubTotal;
- }
+ rCol += nMoveSubTotal;
}
}