Lines 544-583
bool ScDPCacheTable::isRowActive(sal_Int32 nRow) const
Link Here
|
544 |
return maRowsVisible[nRow]; |
544 |
return maRowsVisible[nRow]; |
545 |
} |
545 |
} |
546 |
|
546 |
|
547 |
void ScDPCacheTable::filterByPageDimension(const vector<ScDPDimension*>& rPageDims) |
547 |
void ScDPCacheTable::filterByPageDimension(const vector<Criterion>& rCriteria, bool bRepeatIfEmpty) |
548 |
{ |
548 |
{ |
549 |
sal_Int32 nRowSize = getRowSize(); |
549 |
sal_Int32 nRowSize = getRowSize(); |
550 |
|
550 |
sal_Int32 nColSize = getColSize(); |
551 |
if (nRowSize != static_cast<sal_Int32>(maRowsVisible.size())) |
551 |
if (nRowSize != static_cast<sal_Int32>(maRowsVisible.size())) |
552 |
{ |
552 |
{ |
553 |
fprintf(stdout, "ScDPCacheTable::filterByPageDimension: the sizes of the two tables differ.\n");fflush(stdout); |
553 |
// sizes of the two tables differ! |
554 |
return; |
554 |
return; |
555 |
} |
555 |
} |
556 |
|
556 |
|
557 |
for (sal_Int32 nRow = 0; nRow < nRowSize; ++nRow) |
557 |
for (sal_Int32 nRow = 0; nRow < nRowSize; ++nRow) |
558 |
{ |
558 |
maRowsVisible[nRow] = isRowQualified(nRow, rCriteria, bRepeatIfEmpty); |
559 |
maRowsVisible[nRow] = true; |
|
|
560 |
const vector<Cell>& rRow = maTable[nRow]; |
561 |
vector<ScDPDimension*>::const_iterator itr = rPageDims.begin(), itrEnd = rPageDims.end(); |
562 |
for (; itr != itrEnd; ++itr) |
563 |
{ |
564 |
ScDPDimension* pDim = *itr; |
565 |
if (!pDim->HasSelectedPage()) |
566 |
// 'show all' is selected. |
567 |
continue; |
568 |
|
569 |
ScDPCacheTable::Cell aDimCell = getSelectedDimension(pDim); |
570 |
|
571 |
sal_Int32 nCol = pDim->GetDimension(); |
572 |
const Cell& rCell = rRow[nCol]; |
573 |
if (aDimCell.mnStrId != rCell.mnStrId) |
574 |
{ |
575 |
// Selected page dimension value does not match the current value. Skip it. |
576 |
maRowsVisible[nRow] = false; |
577 |
break; |
578 |
} |
579 |
} |
580 |
} |
581 |
} |
559 |
} |
582 |
|
560 |
|
583 |
const ::ScDPCacheTable::Cell* ScDPCacheTable::getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const |
561 |
const ::ScDPCacheTable::Cell* ScDPCacheTable::getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const |
Lines 668-699
void ScDPCacheTable::filterTable(const vector<Criterion>& rCriteria, Sequence< S
Link Here
|
668 |
// This row is filtered out. |
646 |
// This row is filtered out. |
669 |
continue; |
647 |
continue; |
670 |
|
648 |
|
671 |
bool bRetainRow = true; |
649 |
if (!isRowQualified(nRow, rCriteria, bRepeatIfEmpty)) |
672 |
|
|
|
673 |
vector<Criterion>::const_iterator itrEnd = rCriteria.end(); |
674 |
for (vector<Criterion>::const_iterator itr = rCriteria.begin(); itr != itrEnd; ++itr) |
675 |
{ |
676 |
if (itr->mnFieldIndex >= nColSize) |
677 |
// specified field is outside the source data columns. Don't |
678 |
// use this criterion. |
679 |
continue; |
680 |
|
681 |
const Cell* pCell = getCell(static_cast<SCCOL>(itr->mnFieldIndex), nRow, bRepeatIfEmpty); |
682 |
if (!pCell) |
683 |
{ |
684 |
// This should never happen, but just in case... |
685 |
bRetainRow = false; |
686 |
break; |
687 |
} |
688 |
|
689 |
if (!itr->mpFilter->match(*pCell)) |
690 |
{ |
691 |
bRetainRow = false; |
692 |
break; |
693 |
} |
694 |
} |
695 |
|
696 |
if (!bRetainRow) |
697 |
continue; |
650 |
continue; |
698 |
|
651 |
|
699 |
// Insert this row into table. |
652 |
// Insert this row into table. |
Lines 756-761
bool ScDPCacheTable::empty() const
Link Here
|
756 |
return maTable.empty(); |
709 |
return maTable.empty(); |
757 |
} |
710 |
} |
758 |
|
711 |
|
|
|
712 |
bool ScDPCacheTable::isRowQualified(sal_Int32 nRow, const vector<Criterion>& rCriteria, bool bRepeatIfEmpty) const |
713 |
{ |
714 |
sal_Int32 nColSize = getColSize(); |
715 |
vector<Criterion>::const_iterator itrEnd = rCriteria.end(); |
716 |
for (vector<Criterion>::const_iterator itr = rCriteria.begin(); itr != itrEnd; ++itr) |
717 |
{ |
718 |
if (itr->mnFieldIndex >= nColSize) |
719 |
// specified field is outside the source data columns. Don't |
720 |
// use this criterion. |
721 |
continue; |
722 |
|
723 |
const Cell* pCell = getCell(static_cast<SCCOL>(itr->mnFieldIndex), nRow, bRepeatIfEmpty); |
724 |
if (!pCell) |
725 |
// This should never happen, but just in case... |
726 |
return false; |
727 |
|
728 |
if (!itr->mpFilter->match(*pCell)) |
729 |
return false; |
730 |
} |
731 |
return true; |
732 |
} |
733 |
|
759 |
void ScDPCacheTable::getValueData(ScDocument* pDoc, const ScAddress& rPos, Cell& rCell) |
734 |
void ScDPCacheTable::getValueData(ScDocument* pDoc, const ScAddress& rPos, Cell& rCell) |
760 |
{ |
735 |
{ |
761 |
ScBaseCell* pCell = pDoc->GetCell(rPos); |
736 |
ScBaseCell* pCell = pDoc->GetCell(rPos); |