]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.h
GuiPainter.cpp: correct attempt from r35491
[lyx.git] / src / Paragraph.h
index 65c0190d62ba1185a5b98e92f648179a281ba034..b6c8c12d7768029dcb79d6658c224f38ec2b6f04 100644 (file)
@@ -17,6 +17,7 @@
 #define PARAGRAPH_H
 
 #include "FontEnums.h"
+#include "SpellChecker.h"
 
 #include "insets/InsetCode.h"
 
@@ -65,6 +66,22 @@ public:
 public:
        /// Range including first and last.
        pos_type first, last;
+
+       inline bool operator<(FontSpan const & s) const
+       {
+               return first < s.first;
+       }
+       
+       inline bool operator==(FontSpan const & s) const
+       {
+               return first == s.first && last == s.last;
+       }
+       
+       inline bool inside(pos_type p) const
+       {
+               return first <= p && p <= last;
+       }
+
 };
 
 ///
@@ -146,7 +163,7 @@ public:
        /// \param force means: output even if layout.inpreamble is true.
        void latex(BufferParams const &, Font const & outerfont, odocstream &,
                   TexRow & texrow, OutputParams const &,
-                        int start_pos = 0, int end_pos = -1, bool force = false) const;
+                  int start_pos = 0, int end_pos = -1, bool force = false) const;
 
        /// Can we drop the standard paragraph wrapper?
        bool emptyTag() const;
@@ -422,13 +439,25 @@ public:
 
        /// Spellcheck word at position \p from and fill in found misspelled word
        /// and \p suggestions if \p do_suggestion is true.
-       /// \return true if pointed word is misspelled.
-       bool spellCheck(pos_type & from, pos_type & to, WordLangTuple & wl,
-               docstring_list & suggestions, bool do_suggestion =  true) const;
+       /// \return result from spell checker, SpellChecker::UNKNOWN_WORD when misspelled.
+       SpellChecker::Result spellCheck(pos_type & from, pos_type & to, WordLangTuple & wl,
+               docstring_list & suggestions, bool do_suggestion =  true,
+               bool check_learned = false) const;
 
-       /// Spellcheck word at position \p pos.
-       /// \return true if pointed word is misspelled.
+       /// Spell checker status at position \p pos.
+       /// \return true if pointed position is misspelled.
        bool isMisspelled(pos_type pos) const;
+
+       /// spell check of whole paragraph
+       /// remember results until call of requestSpellCheck()
+       void spellCheck() const;
+
+       /// query state of spell checker results
+       bool needsSpellCheck() const;
+       /// mark position of text manipulation to inform the spell checker
+       /// default value -1 marks the whole paragraph to be checked (again)
+       void requestSpellCheck(pos_type pos = -1);
+
        /// an automatically generated identifying label for this paragraph.
        /// presently used only in the XHTML output routines.
        std::string magicLabel() const;