diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-03-30 02:41:07 +0200 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2016-05-22 03:35:35 +0000 |
commit | ce571823e2be946308c814f600449e62f1b3a87d (patch) | |
tree | 216dd13749a924b85d9acb9e13b80ba056a997e8 /sc | |
parent | 09a64f221b09683e636247b20b0b1ccdd8900039 (diff) |
extract another function from ScDocument::FillInfo
Change-Id: Ief094beebbff2bce9f087853cbda6adeeafe07fc
Reviewed-on: https://gerrit.libreoffice.org/23635
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
(cherry picked from commit b22e51d0c60f959c2db77bd3d23119b53bd87545)
Reviewed-on: https://gerrit.libreoffice.org/25290
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/fillinfo.cxx | 119 |
1 files changed, 65 insertions, 54 deletions
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index 486adbfd6152..ef71b30b9e36 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)) |