]> git.lyx.org Git - features.git/commitdiff
* new InsetLayout tag to disallow spell checking. This actually brings Inset::allowSp...
authorJürgen Spitzmüller <spitz@lyx.org>
Sat, 13 Feb 2010 15:44:17 +0000 (15:44 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Sat, 13 Feb 2010 15:44:17 +0000 (15:44 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33467 a592a061-630c-0410-9148-cb99ea01b6c8

lib/doc/Customization.lyx
lib/scripts/layout2layout.py
src/Paragraph.cpp
src/TextClass.cpp
src/insets/InsetLayout.cpp
src/insets/InsetLayout.h
src/insets/InsetText.h

index a98dbcad3770ddc53f3961ab546a932453529d20..1b0230ad547df10335fff3d5788f436ec1bf30c1 100644 (file)
@@ -1,5 +1,5 @@
 #LyX 2.0.0svn created this file. For more info see http://www.lyx.org/
-\lyxformat 376
+\lyxformat 378
 \begin_document
 \begin_header
 \textclass scrbook
@@ -14199,7 +14199,7 @@ reference "des:Preamble"
 status collapsed
 
 \begin_layout Plain Layout
-Requires 
+Requires
 \end_layout
 
 \end_inset
@@ -14224,6 +14224,42 @@ reference "des:Requires"
 ).
 \end_layout
 
+\begin_layout Description
+\begin_inset Flex CharStyle:Code
+status collapsed
+
+\begin_layout Plain Layout
+Spellcheck
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex CharStyle:Code
+status collapsed
+
+\begin_layout Plain Layout
+0
+\end_layout
+
+\end_inset
+
+,
+\begin_inset Flex CharStyle:Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\emph on
+1
+\end_layout
+
+\end_inset
+
+] Spellcheck the contents of this inset.
+ Default is true.
+\end_layout
+
 \begin_layout Subsection
 Counters
 \begin_inset CommandInset label
index 2ab34031c03cce988f92d68dcb801dd7962ca4bd..e26c811de1f7cc37b10e489c25f5422faa12bd25 100644 (file)
@@ -77,10 +77,13 @@ import os, re, string, sys
 
 # Incremented to format 21, 12 January 2010 by rgh
 # Added HTMLTocLayout and HTMLTitle tags.
-       
+
 # Incremented to format 22, 20 January 2010 by rgh
 # Added HTMLFormat tag to Counters.
 
+# Incremented to format 23, 13 February 2010 by spitz
+# Added Spellcheck tag.
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -88,7 +91,7 @@ import os, re, string, sys
 # development/tools/updatelayouts.sh script to update all
 # layout files to the new format.
 
-currentFormat = 22
+currentFormat = 23
 
 
 def usage(prog_name):
@@ -257,7 +260,7 @@ def convert(lines):
             continue
 
         # This just involved new features, not any changes to old ones
-        if format >= 14 and format <= 21:
+        if format >= 14 and format <= 22:
           i += 1
           continue
 
index af6158881dc8ed3287b757c048f2da441ec7f54e..4d51e2c69c3b4e39972a2bc0b55e74fbbaef069e 100644 (file)
@@ -3165,6 +3165,9 @@ bool Paragraph::spellCheck(pos_type & from, pos_type & to, WordLangTuple & wl,
        if (!speller)
                return false;
 
+       if (!inInset().allowSpellCheck())
+               return false;
+
        locateWord(from, to, WHOLE_WORD);
        if (from == to || from >= pos_type(d->text_.size()))
                return false;
index 981dcd185c23b99d256cfca5f4add1c9fb26b8e9..6b8a0bc956ccc8b74b675e277749a89136b4a6b2 100644 (file)
@@ -66,7 +66,7 @@ private:
 };
 
 // Keep the changes documented in the Customization manual. 
-int const FORMAT = 22;
+int const FORMAT = 23;
 
 
 bool layout2layout(FileName const & filename, FileName const & tempfile)
index 9b466d1c2509741a6f87c4ccaf88bd38da5e305f..ba1bbfb3e507220f647579d5cc9916f88287f49c 100644 (file)
@@ -37,7 +37,7 @@ InsetLayout::InsetLayout() :
        htmlforcecss_ (false), htmlisblock_(true),
        multipar_(true), custompars_(true), forceplain_(false), 
        passthru_(false), needprotect_(false), freespacing_(false), 
-       keepempty_(false), forceltr_(false), intoc_(false)
+       keepempty_(false), forceltr_(false), intoc_(false), spellcheck_(true)
 { 
        labelfont_.setColor(Color_error);
 }
@@ -105,6 +105,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                IL_PASSTHRU,
                IL_PREAMBLE,
                IL_REQUIRES,
+               IL_SPELLCHECK,
                IL_END
        };
 
@@ -142,7 +143,8 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                { "needprotect", IL_NEEDPROTECT },
                { "passthru", IL_PASSTHRU },
                { "preamble", IL_PREAMBLE },
-               { "requires", IL_REQUIRES }
+               { "requires", IL_REQUIRES },
+               { "spellcheck", IL_SPELLCHECK }
        };
 
        lex.pushTable(elementTags);
@@ -322,6 +324,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                        requires_.insert(req.begin(), req.end());
                        break;
                }
+               case IL_SPELLCHECK:
+                       lex >> spellcheck_;
+                       break;
                case IL_END:
                        getout = true;
                        break;
index ff3674aa5beb91a1619aaf2ea33b8bbe6280f84c..0fcbad20d0ac645eac01deff28820dcb3ef0a430 100644 (file)
@@ -137,6 +137,7 @@ public:
        ///
        bool isInToc() const { return intoc_; }
        ///
+       bool spellcheck() const { return spellcheck_; }
 private:
        ///
        void makeDefaultCSS() const;
@@ -217,6 +218,8 @@ private:
        bool forceltr_;
        /// should the contents be written to TOC strings?
        bool intoc_;
+       /// check spelling of this inset?
+       bool spellcheck_;
 };
 
 ///
index 8c1f6842e7d377f3e000483bffe430cedb4b539e..d33b6bda32bdf3fb6bd6b684d5085a8a3af06517 100644 (file)
@@ -149,8 +149,8 @@ public:
        ParagraphList const & paragraphs() const;
        ///
        bool insetAllowed(InsetCode) const { return !getLayout().isPassThru(); }
-       /// Allow spellchecking, except for insets with latex_language
-       bool allowSpellCheck() const { return !getLayout().isPassThru(); }
+       ///
+       bool allowSpellCheck() const { return getLayout().spellcheck() && !getLayout().isPassThru(); }
        ///
        virtual bool isMacroScope() const { return false; }
        ///