#include <config.h>
-#include "lyxtext.h"
#include "lyxfind.h"
-#include "paragraph.h"
-#include "frontends/LyXView.h"
-#include "frontends/Alert.h"
-#include "support/textutils.h"
-#include "support/lstrings.h"
-#include "BufferView.h"
+
#include "buffer.h"
-#include "debug.h"
+#include "BufferView.h"
#include "gettext.h"
+#include "lyxtext.h"
+#include "paragraph.h"
+
+#include "frontends/Alert.h"
+
#include "insets/insettext.h"
-#include "changes.h"
-using namespace lyx::support;
+#include "support/textutils.h"
-using lyx::pos_type;
-using std::endl;
+using lyx::support::lowercase;
+using lyx::support::uppercase;
+
+using std::string;
namespace lyx {
namespace find {
+
namespace {
// returns true if the specified string is at the specified position
string::size_type size = str.length();
pos_type i = 0;
pos_type parsize = par.size();
- while (((pos + i) < parsize)
+ while ((pos + i < parsize)
&& (string::size_type(i) < size)
&& (cs ? (str[i] == par.getChar(pos + i))
: (uppercase(str[i]) == uppercase(par.getChar(pos + i))))) {
SearchResult searchForward(BufferView * bv, LyXText * text, string const & str,
bool const & cs, bool const & mw)
{
- ParagraphList::iterator pit = text->cursor.par();
+ ParagraphList::iterator pit = text->cursorPar();
ParagraphList::iterator pend = text->ownerParagraphs().end();
pos_type pos = text->cursor.pos();
UpdatableInset * inset;
if (pit != pend) {
text->setCursor(pit, pos);
return SR_FOUND;
- } else
- return SR_NOT_FOUND;
+ }
+ return SR_NOT_FOUND;
}
string const & str,
bool const & cs, bool const & mw)
{
- ParagraphList::iterator pit = text->cursor.par();
+ ParagraphList::iterator pit = text->cursorPar();
ParagraphList::iterator pbegin = text->ownerParagraphs().begin();
pos_type pos = text->cursor.pos();
} // anon namespace
+
int replace(BufferView * bv,
string const & searchstr, string const & replacestr,
bool forward, bool casesens, bool matchwrd, bool replaceall,
SearchResult nextChange(BufferView * bv, LyXText * text, pos_type & length)
{
- ParagraphList::iterator pit = text->cursor.par();
+ ParagraphList::iterator pit = text->cursorPar();
ParagraphList::iterator pend = text->ownerParagraphs().end();
pos_type pos = text->cursor.pos();