]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph_funcs.C
clone NVI, other small stuff
[lyx.git] / src / paragraph_funcs.C
index cb8aad1ba2035694a2c4a079570d197df6085180..20f9bcb8191f28dc135d050512320206ff827b7a 100644 (file)
@@ -38,7 +38,6 @@ using lyx::pos_type;
 using lyx::par_type;
 
 using lyx::support::ascii_lowercase;
-using lyx::support::atoi;
 using lyx::support::bformat;
 using lyx::support::compare_ascii_no_case;
 using lyx::support::compare_no_case;
@@ -340,29 +339,6 @@ par_type outerPar(Buffer const & buf, InsetBase const * inset)
 }
 
 
-Paragraph const & ownerPar(Buffer const & buf, InsetBase const * inset)
-{
-       ParConstIterator pit = buf.par_iterator_begin();
-       ParConstIterator end = buf.par_iterator_end();
-       for ( ; pit != end; ++pit) {
-               LyXText * text;
-               // the second '=' below is intentional
-               for (int i = 0; (text = inset->getText(i)); ++i)
-                       if (&text->paragraphs() == &pit.plist())
-                               return *pit;
-
-               InsetList::const_iterator ii = pit->insetlist.begin();
-               InsetList::const_iterator iend = pit->insetlist.end();
-               for ( ; ii != iend; ++ii)
-                       if (ii->inset == inset)
-                               return *pit;
-       }
-       lyxerr << "ownerPar: should not happen" << endl;
-       BOOST_ASSERT(false);
-       return buf.paragraphs().front(); // shut up compiler
-}
-
-
 /// return the range of pars [beg, end[ owning the range of y [ystart, yend]
 void getParsInRange(ParagraphList & pars, int ystart, int yend,
        par_type & beg, par_type & end)
@@ -377,3 +353,20 @@ void getParsInRange(ParagraphList & pars, int ystart, int yend,
        for (end = beg ; end != endpar && pars[end].y <= yend; ++end)
                ;
 }
+
+
+/// return the number of InsetOptArg in a paragraph
+int numberOfOptArgs(Paragraph const & par)
+{
+       int num = 0;
+       
+       InsetList::const_iterator it = par.insetlist.begin();
+       InsetList::const_iterator end = par.insetlist.end();
+       for (; it != end ; ++it) {
+               if (it->inset->lyxCode() == InsetBase::OPTARG_CODE) 
+                       ++num;
+       }
+       return num;
+}
+
+