summaryrefslogtreecommitdiff
path: root/sw/inc/ndhints.hxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-05-18 18:48:38 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-05-20 13:16:28 +0200
commitdb04be037b611e296ef9f2542322c52ed82d7a2b (patch)
tree8892aa251d751037c592b3aeb4e521d067944837 /sw/inc/ndhints.hxx
parentd3122433616d4da2c6ee82f73bd8f591ea498fc0 (diff)
tdf#35798: Hide empty Database fields' paragraphs (+ compat option)
With this change, Database fields that expand to empty values behave as if they are "Hidden Paragraph" fields. A compatibility option to enable this behaviour is added. The option is enabled by default, and for any non-native documents (for compatibility with other office suites). For existing (F)ODT documents, the option is disabled for those documents that don't have this setting set, to keep the layout of legacy documents. Change-Id: Ic5e8cb15a3a7d1a765a984eef4b0d97666df7dfd Reviewed-on: https://gerrit.libreoffice.org/54552 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/inc/ndhints.hxx')
-rw-r--r--sw/inc/ndhints.hxx26
1 files changed, 15 insertions, 11 deletions
diff --git a/sw/inc/ndhints.hxx b/sw/inc/ndhints.hxx
index 77aebc67d2be..0d66f9c3ead2 100644
--- a/sw/inc/ndhints.hxx
+++ b/sw/inc/ndhints.hxx
@@ -77,6 +77,8 @@ class SwpHtEnd : public o3tl::sorted_vector<SwTextAttr*, CompareSwpHtEnd,
class SwpHints
{
private:
+ const SwTextNode& m_rParent;
+
// SAL_MAX_SIZE is used by GetStartOf to return
// failure, so just allow SAL_MAX_SIZE-1 hints
static const size_t MAX_HINTS = SAL_MAX_SIZE-1;
@@ -88,9 +90,11 @@ private:
/// true: the Node is in Split and Frames are moved
bool m_bInSplitNode : 1;
- /// m_bHasHiddenParaField is invalid, call CalcHiddenParaField()
- bool m_bCalcHiddenParaField : 1;
- bool m_bHasHiddenParaField : 1; ///< HiddenParaField
+ // m_bHiddenByParaField is invalid, call CalcHiddenParaField()
+ mutable bool m_bCalcHiddenParaField : 1;
+ // if all fields controlling visibility of the paragraph require to hide it
+ // (if there's no such fields, or if any field requires to show, then this is false)
+ mutable bool m_bHiddenByParaField : 1;
bool m_bFootnote : 1; ///< footnotes
bool m_bDDEFields : 1; ///< the TextNode has DDE fields
@@ -108,15 +112,15 @@ private:
void Delete( SwTextAttr const * pTextHt );
void SetInSplitNode(bool bInSplit) { m_bInSplitNode = bInSplit; }
- void SetCalcHiddenParaField() { m_bCalcHiddenParaField = true; }
- void SetHiddenParaField( const bool bNew ) { m_bHasHiddenParaField = bNew; }
- bool HasHiddenParaField() const
+ void SetCalcHiddenParaField() const { m_bCalcHiddenParaField = true; }
+ void SetHiddenByParaField( const bool bNew ) const { m_bHiddenByParaField = bNew; }
+ bool IsHiddenByParaField() const
{
if ( m_bCalcHiddenParaField )
{
- const_cast<SwpHints*>(this)->CalcHiddenParaField();
+ CalcHiddenParaField();
}
- return m_bHasHiddenParaField;
+ return m_bHiddenByParaField;
}
void InsertNesting(SwTextAttrNesting & rNewHint);
@@ -144,7 +148,7 @@ private:
#endif
public:
- SwpHints();
+ SwpHints(const SwTextNode& rParent);
size_t Count() const { return m_HintsByStart.size(); }
bool Contains( const SwTextAttr *pHt ) const;
@@ -179,8 +183,8 @@ public:
bool HasFootnote() const { return m_bFootnote; }
bool IsInSplitNode() const { return m_bInSplitNode; }
- /// calc current value of m_bHasHiddenParaField, returns true iff changed
- bool CalcHiddenParaField();
+ // calc current value of m_bHiddenByParaField, returns true iff changed
+ bool CalcHiddenParaField() const; // changes mutable state
DECL_FIXEDMEMPOOL_NEWDEL(SwpHints)
};