sc/source/core/data/fillinfo.cxx | 121 +++++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 54 deletions(-)
New commits: commit 7547ff2c31066ec1b115dcee5500b892b3d3a881 Author: Markus Mohrhard <[email protected]> Date: Wed Mar 30 02:55:18 2016 +0200 add TODO comment for a bug This bug is the first one that was discovered because it is now much easier to see which parts of the code work on cells, pattern areas and whole columns/rows. Change-Id: I8f22bf421298947d65bfc2fc9c986d85169e6545 Reviewed-on: https://gerrit.libreoffice.org/23636 Tested-by: Jenkins <[email protected]> Reviewed-by: Markus Mohrhard <[email protected]> (cherry picked from commit 2c69316037e29db52393d898100e6593a6cd5a24) Reviewed-on: https://gerrit.libreoffice.org/25291 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index ef71b30..5786216 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -363,6 +363,8 @@ bool handleConditionalFormat(ScConditionalFormatList* pCondFormList, const std:: pInfo->pConditionSet = &pStyleSheet->GetItemSet(); bAnyCondition = true; + // TODO: moggi: looks like there is a but around bHidden and bHideFormula + // They are normally for the whole pattern and not for a single cell // we need to check already here for protected cells const SfxPoolItem* pItem; if ( bTabProtect && pInfo->pConditionSet->GetItemState( ATTR_PROTECTION, true, &pItem ) == SfxItemState::SET ) commit ce571823e2be946308c814f600449e62f1b3a87d Author: Markus Mohrhard <[email protected]> Date: Wed Mar 30 02:41:07 2016 +0200 extract another function from ScDocument::FillInfo Change-Id: Ief094beebbff2bce9f087853cbda6adeeafe07fc Reviewed-on: https://gerrit.libreoffice.org/23635 Tested-by: Jenkins <[email protected]> Reviewed-by: Markus Mohrhard <[email protected]> (cherry picked from commit b22e51d0c60f959c2db77bd3d23119b53bd87545) Reviewed-on: https://gerrit.libreoffice.org/25290 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index 486adbfd..ef71b30 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -338,6 +338,68 @@ void initColWidths(RowInfo* pRowInfo, ScDocument* pDoc, double fColScale, SCTAB } } +bool handleConditionalFormat(ScConditionalFormatList* pCondFormList, const std::vector<sal_uInt32> rCondFormats, + CellInfo* pInfo, ScStyleSheetPool* pStlPool, + const ScAddress& rAddr, bool& bHidden, bool& bHideFormula, bool bTabProtect) +{ + bool bFound = false; + bool bAnyCondition = false; + for(std::vector<sal_uInt32>::const_iterator itr = rCondFormats.begin(); + itr != rCondFormats.end() && !bFound; ++itr) + { + ScConditionalFormat* pCondForm = pCondFormList->GetFormat(*itr); + if(!pCondForm) + continue; + + ScCondFormatData aData = pCondForm->GetData( + pInfo->maCell, rAddr); + if (!aData.aStyleName.isEmpty()) + { + SfxStyleSheetBase* pStyleSheet = + pStlPool->Find( aData.aStyleName, SFX_STYLE_FAMILY_PARA ); + if ( pStyleSheet ) + { + //TODO: cache Style-Sets !!! + pInfo->pConditionSet = &pStyleSheet->GetItemSet(); + bAnyCondition = true; + + // we need to check already here for protected cells + const SfxPoolItem* pItem; + if ( bTabProtect && pInfo->pConditionSet->GetItemState( ATTR_PROTECTION, true, &pItem ) == SfxItemState::SET ) + { + const ScProtectionAttr* pProtAttr = static_cast<const ScProtectionAttr*>(pItem); + bHidden = pProtAttr->GetHideCell(); + bHideFormula = pProtAttr->GetHideFormula(); + + } + bFound = true; + + } + // if style is not there, treat like no condition + } + + if(aData.pColorScale) + { + pInfo->pColorScale.reset(aData.pColorScale); + bFound = true; + } + + if(aData.pDataBar) + { + pInfo->pDataBar.reset(aData.pDataBar); + bFound = true; + } + + if(aData.pIconSet) + { + pInfo->pIconSet.reset(aData.pIconSet); + bFound = true; + } + } + + return bAnyCondition; +} + } void ScDocument::FillInfo( @@ -564,61 +626,10 @@ void ScDocument::FillInfo( pThisRowInfo->bEmptyBack = false; } - if ( bContainsCondFormat ) + if (bContainsCondFormat) { - bool bFound = false; - for(std::vector<sal_uInt32>::const_iterator itr = rCondFormats.begin(); - itr != rCondFormats.end() && !bFound; ++itr) - { - ScConditionalFormat* pCondForm = pCondFormList->GetFormat(*itr); - if(!pCondForm) - continue; - - ScCondFormatData aData = pCondForm->GetData( - pInfo->maCell, ScAddress(nX, nCurRow, nTab)); - if (!aData.aStyleName.isEmpty()) - { - SfxStyleSheetBase* pStyleSheet = - pStlPool->Find( aData.aStyleName, SFX_STYLE_FAMILY_PARA ); - if ( pStyleSheet ) - { - //TODO: cache Style-Sets !!! - pInfo->pConditionSet = &pStyleSheet->GetItemSet(); - bAnyCondition = true; - - // we need to check already here for protected cells - const SfxPoolItem* pItem; - if ( bTabProtect && pInfo->pConditionSet->GetItemState( ATTR_PROTECTION, true, &pItem ) == SfxItemState::SET ) - { - const ScProtectionAttr* pProtAttr = static_cast<const ScProtectionAttr*>(pItem); - bHidden = pProtAttr->GetHideCell(); - bHideFormula = pProtAttr->GetHideFormula(); - - } - bFound = true; - - } - // if style is not there, treat like no condition - } - - if(aData.pColorScale) - { - pInfo->pColorScale.reset(aData.pColorScale); - bFound = true; - } - - if(aData.pDataBar) - { - pInfo->pDataBar.reset(aData.pDataBar); - bFound = true; - } - - if(aData.pIconSet) - { - pInfo->pIconSet.reset(aData.pIconSet); - bFound = true; - } - } + bAnyCondition |= handleConditionalFormat(pCondFormList, rCondFormats, pInfo, pStlPool, ScAddress(nX, nCurRow, nTab), + bHidden, bHideFormula, bTabProtect); } if (bHidden || (bFormulaMode && bHideFormula && pInfo->maCell.meType == CELLTYPE_FORMULA)) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
