summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/doc.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/doc/doc.cxx')
-rw-r--r--sw/source/core/doc/doc.cxx18
1 files changed, 11 insertions, 7 deletions
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 450fc3aed05c..4f4fb864512e 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1360,17 +1360,20 @@ bool HandleHidingField(SwFormatField& rFormatField, const SwNodes& rNodes,
}
}
-bool SwDoc::FieldCanHidePara(SwFieldIds eFieldId) const
+// The greater the returned value, the more weight has this field type on deciding the final
+// paragraph state
+int SwDoc::FieldCanHideParaWeight(SwFieldIds eFieldId) const
{
switch (eFieldId)
{
case SwFieldIds::HiddenPara:
- return true;
+ return 20;
case SwFieldIds::Database:
- return GetDocumentSettingManager().get(
- DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA);
+ return GetDocumentSettingManager().get(DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA)
+ ? 10
+ : 0;
default:
- return false;
+ return 0;
}
}
@@ -1381,7 +1384,8 @@ bool SwDoc::FieldHidesPara(const SwField& rField) const
case SwFieldIds::HiddenPara:
return static_cast<const SwHiddenParaField&>(rField).IsHidden();
case SwFieldIds::Database:
- return FieldCanHidePara(SwFieldIds::Database) && rField.ExpandField(true).isEmpty();
+ return FieldCanHideParaWeight(SwFieldIds::Database)
+ && rField.ExpandField(true).isEmpty();
default:
return false;
}
@@ -1413,7 +1417,7 @@ bool SwDoc::RemoveInvisibleContent()
std::vector<std::unique_ptr<FieldTypeGuard>> aHidingFieldTypes;
for (SwFieldType* pType : *getIDocumentFieldsAccess().GetFieldTypes())
{
- if (FieldCanHidePara(pType->Which()))
+ if (FieldCanHideParaWeight(pType->Which()))
aHidingFieldTypes.push_back(o3tl::make_unique<FieldTypeGuard>(pType));
}
for (const auto& pTypeGuard : aHidingFieldTypes)