summaryrefslogtreecommitdiff
path: root/sw/source/core/text/txtfrm.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-08-30 12:23:33 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-09-02 01:04:09 +0200
commit481730bc4c9d63e831c088d9862b0f50f2da209f (patch)
tree4c87751af7f4b22ecfe5849e7288844c60568a11 /sw/source/core/text/txtfrm.cxx
parenta63927ea9c0103b6dbe45963dde0aca3845738d0 (diff)
tdf#118845: make HiddenPara have higher priority deciding visibility
Otherwise, a Database field in a paragraph which is non-empty would force the paragraph to be visible, regardless of HiddenPara field telling it to be hidden. Regression from commit db04be037b611e296ef9f2542322c52ed82d7a2b Change-Id: I21807e22bd339fd1ea0aaa3b382579f688903418 Reviewed-on: https://gerrit.libreoffice.org/59792 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de> (cherry picked from commit 64cb57c82d9e7f7069821b2e2ef92574ec73ebe2) Reviewed-on: https://gerrit.libreoffice.org/59865 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw/source/core/text/txtfrm.cxx')
-rw-r--r--sw/source/core/text/txtfrm.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 27f02f554370..62b281ae6974 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1045,18 +1045,25 @@ bool SwTextFrame::IsHiddenNow() const
}
sw::MergedAttrIter iter(*this);
SwTextNode const* pNode(nullptr);
+ int nNewResultWeight = 0;
for (SwTextAttr const* pHint = iter.NextAttr(&pNode); pHint; pHint = iter.NextAttr(&pNode))
{
if (pHint->Which() == RES_TXTATR_FIELD)
{
+ // see also SwpHints::CalcHiddenParaField()
const SwFormatField& rField = pHint->GetFormatField();
- if (pNode->FieldCanHidePara(rField.GetField()->GetTyp()->Which()))
+ int nCurWeight = pNode->FieldCanHideParaWeight(rField.GetField()->GetTyp()->Which());
+ if (nCurWeight > nNewResultWeight)
{
+ nNewResultWeight = nCurWeight;
+ bHiddenParaField = pNode->FieldHidesPara(*rField.GetField());
+ }
+ else if (nCurWeight == nNewResultWeight && bHiddenParaField)
+ {
+ // Currently, for both supported hiding types (HiddenPara, Database), "Don't hide"
+ // takes precedence - i.e., if there's a "Don't hide" field of that weight, we only
+ // care about fields of higher weight.
bHiddenParaField = pNode->FieldHidesPara(*rField.GetField());
- if (!bHiddenParaField)
- {
- break; // not hidden, see CalcHiddenParaField()
- }
}
}
}