]> git.lyx.org Git - lyx.git/blob - src/CutAndPaste.h
Fix bug 2195: Slowness in rendering inside insets, especially on the Mac
[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 "support/types.h"
18
19 #include <string>
20 #include <vector>
21
22 class Buffer;
23 class ErrorList;
24 class LyXTextClass;
25 class LCursor;
26 class ParagraphList;
27
28 ///
29 namespace lyx {
30 namespace cap {
31
32 ///
33 std::vector<std::string> const availableSelections(Buffer const & buffer);
34 ///
35 lyx::size_type numberOfSelections();
36 ///
37 std::string getSelection(Buffer const & buffer, size_t sel_index);
38
39 ///
40 void cutSelection(LCursor & cur, bool doclear, bool realcut);
41
42 /**
43  * Sets the selection from the current cursor position to length
44  * characters to the right. No safety checks.
45  */
46 void setSelectionRange(LCursor & cur, lyx::pos_type length);
47 /// simply replace using the font of the first selected character
48 void replaceSelectionWithString(LCursor & cur, std::string const & str);
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, size_t sel_index = 0);
58
59 ///
60 void pasteParagraphList(LCursor & cur, ParagraphList const & parlist, 
61                         textclass_type textclass);
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(lyx::textclass_type c1,
69                                 lyx::textclass_type c2,
70                                 ParagraphList & par,
71                                 ErrorList &);
72
73 // only used by the spellchecker
74 void replaceWord(LCursor & cur, std::string const & replacestring);
75
76 ///
77 std::string grabSelection(LCursor const & cur);
78 ///
79 void eraseSelection(LCursor & cur);
80 ///
81 std::string grabAndEraseSelection(LCursor & cur);
82 // other selection methods
83 ///
84 void selCut(LCursor & cur);
85 ///
86 void selDel(LCursor & cur);
87 /// clears or deletes selection depending on lyxrc setting
88 void selClearOrDel(LCursor & cur);
89 /// pastes n-th element of cut buffer
90 void selPaste(LCursor & cur, size_t n);
91
92 /** Tabular has its own paste stack for multiple cells
93  *  but it needs to know whether there is a more recent 
94  *  ordinary paste. Therefore which one is newer.
95  */
96 //FIXME: this is a workaround for bug 1919. Replace this by
97 //an all-for-one-paste mechanism in 1.5
98 /// store whether tabular or ordinary paste stack is newer
99 void dirtyTabularStack(bool b);
100 /// is the tabular paste stack newer than the ordinary one?
101 bool tabularStackDirty();
102 } // namespace cap
103 } // namespce lyx
104
105 #endif