]> git.lyx.org Git - lyx.git/blob - src/CutAndPaste.h
a713bc30af918ef82e06088ad7fcc92327f6c152
[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 ///
41 void cutSelection(LCursor & cur, bool doclear, bool realcut);
42
43 /* Replace using the font of the first selected character and select
44  * the new string. When \c backwards == false, set anchor before
45  * cursor; otherwise set cursor before anchor.
46  */
47 void replaceSelectionWithString(LCursor & cur, std::string const & str, 
48                                 bool backwards);
49 /// replace selection helper
50 void replaceSelection(LCursor & cur);
51
52 ///
53 void cutSelection(LCursor & cur, bool doclear = true, bool realcut = true);
54 ///
55 void copySelection(LCursor & cur);
56 ///
57 void pasteSelection(LCursor & cur, ErrorList &, size_t sel_index = 0);
58
59 ///
60 void pasteParagraphList(LCursor & cur, ParagraphList const & parlist,
61                         textclass_type textclass, ErrorList & errorList);
62
63
64 /** Needed to switch between different classes. This works
65  *  for a list of paragraphs beginning with the specified par.
66  *  It changes layouts and character styles.
67  */
68 void switchBetweenClasses(textclass_type c1, textclass_type c2,
69                           InsetText & in, ErrorList &);
70
71 ///
72 std::string grabSelection(LCursor const & cur);
73 ///
74 void eraseSelection(LCursor & cur);
75 ///
76 std::string grabAndEraseSelection(LCursor & cur);
77 // other selection methods
78 ///
79 void selCut(LCursor & cur);
80 ///
81 void selDel(LCursor & cur);
82 /// clears or deletes selection depending on lyxrc setting
83 void selClearOrDel(LCursor & cur);
84 /// pastes n-th element of cut buffer
85 void selPaste(LCursor & cur, size_t n);
86
87 /** Tabular has its own paste stack for multiple cells
88  *  but it needs to know whether there is a more recent
89  *  ordinary paste. Therefore which one is newer.
90  */
91 //FIXME: this is a workaround for bug 1919. Replace this by
92 //an all-for-one-paste mechanism in 1.5
93 /// store whether tabular or ordinary paste stack is newer
94 void dirtyTabularStack(bool b);
95 /// is the tabular paste stack newer than the ordinary one?
96 bool tabularStackDirty();
97 } // namespace cap
98 } // namespce lyx
99
100 #endif