]> git.lyx.org Git - lyx.git/blob - src/CutAndPaste.h
e7a8765cac1b5d69f2c3a33b21d7c6a6cc8f5161
[lyx.git] / src / CutAndPaste.h
1 // -*- C++ -*-
2 /**
3  * \file CutAndPaste.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Jürgen Vigna
8  * \author Lars Gullik Bjønnes
9  * \author Alfredo Braunstein
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef CUTANDPASTE_H
15 #define CUTANDPASTE_H
16
17 #include "ParagraphList_fwd.h"
18
19 #include "support/docstring.h"
20
21 #include <vector>
22
23 namespace lyx {
24
25 class Buffer;
26 class ErrorList;
27 class InsetText;
28 class LyXTextClass;
29 class LCursor;
30
31 namespace cap {
32
33 ///
34 std::vector<docstring> const availableSelections(Buffer const & buffer);
35 ///
36 size_type numberOfSelections();
37 ///
38 docstring getSelection(Buffer const & buffer, size_t sel_index);
39
40 /* Replace using the font of the first selected character and select
41  * the new string. When \c backwards == false, set anchor before
42  * cursor; otherwise set cursor before anchor.
43  */
44 void replaceSelectionWithString(LCursor & cur, docstring const & str,
45                                 bool backwards);
46 /// replace selection helper
47 void replaceSelection(LCursor & cur);
48
49 ///
50 void cutSelection(LCursor & cur, bool doclear = true, bool realcut = true);
51 ///
52 void copySelection(LCursor & cur);
53 ///
54 void pasteSelection(LCursor & cur, ErrorList &, size_t sel_index = 0);
55
56 /// Paste the paragraph list \p parlist at the position given by \p cur.
57 /// Does not handle undo. Does only work in text, not mathed.
58 void pasteParagraphList(LCursor & cur, ParagraphList const & parlist,
59                         textclass_type textclass, ErrorList & errorList);
60
61
62 /** Needed to switch between different classes. This works
63  *  for a list of paragraphs beginning with the specified par.
64  *  It changes layouts and character styles.
65  */
66 void switchBetweenClasses(textclass_type c1, textclass_type c2,
67                           InsetText & in, ErrorList &);
68
69 ///
70 docstring grabSelection(LCursor const & cur);
71 ///
72 void eraseSelection(LCursor & cur);
73 ///
74 docstring grabAndEraseSelection(LCursor & cur);
75 // other selection methods
76 ///
77 void selCut(LCursor & cur);
78 ///
79 void selDel(LCursor & cur);
80 /// clears or deletes selection depending on lyxrc setting
81 void selClearOrDel(LCursor & cur);
82 /// pastes n-th element of cut buffer
83 void selPaste(LCursor & cur, size_t n);
84
85 /** Tabular has its own paste stack for multiple cells
86  *  but it needs to know whether there is a more recent
87  *  ordinary paste. Therefore which one is newer.
88  */
89 //FIXME: this is a workaround for bug 1919. Replace this by
90 //an all-for-one-paste mechanism in 1.5
91 /// store whether tabular or ordinary paste stack is newer
92 void dirtyTabularStack(bool b);
93 /// is the tabular paste stack newer than the ordinary one?
94 bool tabularStackDirty();
95 } // namespace cap
96 } // namespce lyx
97
98 #endif