4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Lars Gullik Bjønnes
9 * \author Alfredo Braunstein
11 * Full author contact details are available in file CREDITS.
17 #include "ParagraphList_fwd.h"
19 #include "support/docstring.h"
33 /// Get all elements of the cut buffer in plain text format.
34 std::vector<docstring> const availableSelections(Buffer const & buffer);
35 /// Get the number of available elements in the cut buffer.
36 size_type numberOfSelections();
37 /// Get the sel_index-th element of the cut buffer in plain text format.
38 docstring getSelection(Buffer const & buffer, size_t sel_index);
41 * Replace using the font of the first selected character and select
42 * the new string. When \c backwards == false, set anchor before
43 * cursor; otherwise set cursor before anchor.
46 void replaceSelectionWithString(LCursor & cur, docstring const & str,
48 /// If a selection exists, cut it and push it to the cut buffer.
50 void replaceSelection(LCursor & cur);
53 * Cut the current selection and possibly push it to the cut buffer and
56 * \param doclear If this is true: Delete leading spaces in paragraphs before
58 * \param realcut If this is true: Push the selection to the cut buffer and
59 * system clipboard. Set this to false for internal cuts that
60 * do not directly originate from the user.
62 void cutSelection(LCursor & cur, bool doclear = true, bool realcut = true);
63 /// Push the current selection to the cut buffer and the system clipboard.
64 void copySelection(LCursor & cur);
65 /// Push the current selection to the cut buffer.
66 void copySelectionToStack(LCursor & cur);
67 /// Paste the sel_index-th element of the cut buffer.
68 /// Does handle undo. Does only work in text, not mathed.
69 void pasteSelection(LCursor & cur, ErrorList &, size_t sel_index = 0);
71 /// Paste the paragraph list \p parlist at the position given by \p cur.
72 /// Does not handle undo. Does only work in text, not mathed.
73 void pasteParagraphList(LCursor & cur, ParagraphList const & parlist,
74 textclass_type textclass, ErrorList & errorList);
77 /** Needed to switch between different classes. This works
78 * for a list of paragraphs beginning with the specified par.
79 * It changes layouts and character styles.
81 void switchBetweenClasses(textclass_type c1, textclass_type c2,
82 InsetText & in, ErrorList &);
84 /// Get the current selection as a string. Does not change the selection.
85 /// Does only work if the whole selection is in mathed.
86 docstring grabSelection(LCursor const & cur);
87 /// Erase the current selection.
88 /// Does not handle undo. Does only work if the whole selection is in mathed.
89 void eraseSelection(LCursor & cur);
90 /// Erase the selection and return it as a string.
91 /// Does not handle undo. Does only work if the whole selection is in mathed.
92 docstring grabAndEraseSelection(LCursor & cur);
93 // other selection methods
94 /// Erase the selection if one exists.
95 /// Does not handle undo. Does only work if the whole selection is in mathed.
96 void selDel(LCursor & cur);
97 /// Clear or delete the selection if one exists, depending on lyxrc setting.
98 /// Does not handle undo. Does only work if the whole selection is in mathed.
99 void selClearOrDel(LCursor & cur);
101 /** Tabular has its own paste stack for multiple cells
102 * but it needs to know whether there is a more recent
103 * ordinary paste. Therefore which one is newer.
105 //FIXME: this is a workaround for bug 1919. Replace this by
106 //an all-for-one-paste mechanism in 1.5
107 /// store whether tabular or ordinary paste stack is newer
108 void dirtyTabularStack(bool b);
109 /// is the tabular paste stack newer than the ordinary one?
110 bool tabularStackDirty();