summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-09-24 22:35:19 +0200
committerTomaž Vajngerl <quikee@gmail.com>2022-10-16 21:27:31 +0200
commite051b3a6d59ed925e1cddfa72696c9a740830808 (patch)
tree1bb56f7ee6f66667446a0a8cc460ba0be2d94c95 /sw/inc
parent822e5aba1b40c69591b5fa6cf94819011adc8455 (diff)
sw: refactor SwParaIdleData - rename, lifecycle, move to header
This renames SwParaIdleData to sw::ParagraphIdleData, moves it to the header file and changes from a raw pointer initialized at the SwTextNode construction and deleted at SwTextNode destruction to a pure member variable (which has the same lifecycle). A it is not a pointer anymore, there is no need to check if it is nullptr or not, which simplifies the code. Change-Id: I74413eef2cfd3666cf75177a6ea080219eee0ac0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140681 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/ndtxt.hxx36
1 files changed, 26 insertions, 10 deletions
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 2a1f9f878cfa..a37661e18547 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -63,7 +63,6 @@ class SwInterHyphInfo;
class SwWrongList;
class SwGrammarMarkUp;
struct SwDocStat;
-struct SwParaIdleData_Impl;
enum class ExpandMode;
enum class SwFieldIds : sal_uInt16;
class SwField;
@@ -81,6 +80,29 @@ namespace com::sun::star {
typedef o3tl::sorted_vector< sal_Int32 > SwSoftPageBreakList;
+namespace sw
+{
+
+enum class WrongState { TODO, PENDING, DONE };
+
+struct ParagraphIdleData
+{
+ std::unique_ptr<SwWrongList> pWrong; // for spell checking
+ std::unique_ptr<SwGrammarMarkUp> pGrammarCheck; // for grammar checking / proof reading
+ std::unique_ptr<SwWrongList> pSmartTags;
+ sal_uLong nNumberOfWords = 0;
+ sal_uLong nNumberOfAsianWords = 0;
+ sal_uLong nNumberOfChars = 0;
+ sal_uLong nNumberOfCharsExcludingSpaces = 0;
+ bool bWordCountDirty = true;
+ WrongState eWrongDirty = WrongState::TODO; ///< online spell checking needed/done?
+ bool bGrammarCheckDirty = true;
+ bool bSmartTagDirty = true;
+ bool bAutoComplDirty = true; ///< auto complete list dirty
+};
+
+} // end namespace sw
+
/// SwTextNode is a paragraph in the document model.
class SW_DLLPUBLIC SwTextNode final
: public SwContentNode
@@ -105,7 +127,7 @@ class SW_DLLPUBLIC SwTextNode final
OUString m_Text;
- SwParaIdleData_Impl* m_pParaIdleData_Impl;
+ mutable sw::ParagraphIdleData m_aParagraphIdleData;
/** Some of the chars this para are hidden. Paragraph has to be reformatted
on changing the view to print preview. */
@@ -172,10 +194,6 @@ class SW_DLLPUBLIC SwTextNode final
LanguageType nLang, sal_uInt16 nLangWhichId,
const vcl::Font *pFont, sal_uInt16 nFontWhichId );
- /// Start: Data collected during idle time
-
- SAL_DLLPRIVATE void InitSwParaStatistics( bool bNew );
-
inline void TryDeleteSwpHints();
SAL_DLLPRIVATE void impl_FormatToTextAttr(const SfxItemSet& i_rAttrSet);
@@ -186,16 +204,14 @@ class SW_DLLPUBLIC SwTextNode final
void HandleNonLegacyHint(const SfxHint&);
public:
- enum class WrongState { TODO, PENDING, DONE };
-
bool IsWordCountDirty() const;
- WrongState GetWrongDirty() const;
+ sw::WrongState GetWrongDirty() const;
bool IsWrongDirty() const;
bool IsGrammarCheckDirty() const;
bool IsSmartTagDirty() const;
bool IsAutoCompleteWordDirty() const;
void SetWordCountDirty( bool bNew ) const;
- void SetWrongDirty(WrongState eNew) const;
+ void SetWrongDirty(sw::WrongState eNew) const;
void SetGrammarCheckDirty( bool bNew ) const;
void SetSmartTagDirty( bool bNew ) const;
void SetAutoCompleteWordDirty( bool bNew ) const;