4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
10 * \author Alfredo Braunstein
11 * \author Tommaso Cucinotta
13 * Full author contact details are available in file CREDITS.
19 #include "support/strfwd.h"
22 #include "support/docstring.h"
34 /** Encode the parameters needed to find \c search as a string
35 * that can be dispatched to the LyX core in a FuncRequest wrapper.
37 docstring const find2string(docstring const & search,
42 /** Encode the parameters needed to replace \c search with \c replace
43 * as a string that can be dispatched to the LyX core in a FuncRequest
46 docstring const replace2string(docstring const & search,
47 docstring const & replace,
53 /** Parse the string encoding of the find request that is found in
54 * \c ev.argument and act on it.
55 * The string is encoded by \c find2string.
56 * \return true if the string was found.
58 bool find(BufferView * bv, FuncRequest const & ev);
60 /** Parse the string encoding of the replace request that is found in
61 * \c ev.argument and act on it.
62 * The string is encoded by \c replace2string.
64 void replace(BufferView * bv, FuncRequest const &, bool has_deleted = false);
66 /// find the next change in the buffer
67 bool findNextChange(BufferView * bv);
69 class FindAdvOptions {
72 docstring const & search,
89 /// Write a FindAdvOptions instance to a stringstream
90 std::ostringstream & operator<<(std::ostringstream & os, lyx::FindAdvOptions const & opt);
92 /// Read a FindAdvOptions instance from a stringstream
93 std::istringstream & operator>>(std::istringstream & is, lyx::FindAdvOptions & opt);
95 /// Dispatch a LFUN_WORD_FINDADV command request
96 void findAdv(BufferView * bv, FuncRequest const & ev);
98 /// Perform a FindAdv operation.
99 bool findAdv(BufferView * bv, FindAdvOptions const & opt);
101 /** Computes the simple-text or LaTeX export (depending on opt) of buf starting
102 ** from cur and ending len positions after cur, if len is positive, or at the
103 ** paragraph or innermost inset end if len is -1.
105 ** This is useful for computing opt.search from the SearchAdvDialog controller (ControlSearchAdv).
106 ** Ideally, this should not be needed, and the opt.search field should become a Text const &.
108 docstring stringifyFromForSearch(FindAdvOptions const & opt,
109 Buffer const & buf, DocIterator const & cur, int len = -1);