2000-04-10 14:29:05 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file CutAndPaste.h
|
2003-05-06 09:34:56 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-09-07 01:45:40 +00:00
|
|
|
|
* \author J<EFBFBD>rgen Vigna
|
2003-05-06 09:34:56 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2003-06-28 01:23:11 +00:00
|
|
|
|
* \author Alfredo Braunstein
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-05-06 09:34:56 +00:00
|
|
|
|
*/
|
2000-04-10 14:29:05 +00:00
|
|
|
|
|
|
|
|
|
#ifndef CUTANDPASTE_H
|
|
|
|
|
#define CUTANDPASTE_H
|
|
|
|
|
|
2006-03-24 17:37:15 +00:00
|
|
|
|
#include "ParagraphList_fwd.h"
|
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
|
#include "support/types.h"
|
2000-04-10 14:29:05 +00:00
|
|
|
|
|
2003-10-07 06:45:25 +00:00
|
|
|
|
#include <string>
|
2003-06-17 15:33:49 +00:00
|
|
|
|
#include <vector>
|
|
|
|
|
|
2003-09-06 12:36:58 +00:00
|
|
|
|
class Buffer;
|
2003-05-20 16:51:31 +00:00
|
|
|
|
class ErrorList;
|
2006-05-22 10:12:09 +00:00
|
|
|
|
class InsetText;
|
2003-09-06 12:36:58 +00:00
|
|
|
|
class LyXTextClass;
|
2004-03-25 09:16:36 +00:00
|
|
|
|
class LCursor;
|
2000-04-10 14:29:05 +00:00
|
|
|
|
|
|
|
|
|
///
|
2004-03-25 09:16:36 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace cap {
|
2003-06-17 15:33:49 +00:00
|
|
|
|
|
|
|
|
|
///
|
2003-10-08 11:31:51 +00:00
|
|
|
|
std::vector<std::string> const availableSelections(Buffer const & buffer);
|
2004-04-18 07:32:34 +00:00
|
|
|
|
///
|
2005-11-25 09:27:08 +00:00
|
|
|
|
lyx::size_type numberOfSelections();
|
|
|
|
|
///
|
2004-04-18 07:32:34 +00:00
|
|
|
|
std::string getSelection(Buffer const & buffer, size_t sel_index);
|
2003-06-17 15:33:49 +00:00
|
|
|
|
|
2003-04-29 09:40:49 +00:00
|
|
|
|
///
|
2004-03-25 09:16:36 +00:00
|
|
|
|
void cutSelection(LCursor & cur, bool doclear, bool realcut);
|
2003-03-06 15:39:37 +00:00
|
|
|
|
|
2004-03-25 09:16:36 +00:00
|
|
|
|
/**
|
|
|
|
|
* Sets the selection from the current cursor position to length
|
|
|
|
|
* characters to the right. No safety checks.
|
|
|
|
|
*/
|
|
|
|
|
void setSelectionRange(LCursor & cur, lyx::pos_type length);
|
|
|
|
|
/// simply replace using the font of the first selected character
|
|
|
|
|
void replaceSelectionWithString(LCursor & cur, std::string const & str);
|
|
|
|
|
/// replace selection helper
|
|
|
|
|
void replaceSelection(LCursor & cur);
|
2003-05-06 09:34:56 +00:00
|
|
|
|
|
2003-03-06 15:39:37 +00:00
|
|
|
|
///
|
2004-03-25 09:16:36 +00:00
|
|
|
|
void cutSelection(LCursor & cur, bool doclear = true, bool realcut = true);
|
|
|
|
|
///
|
|
|
|
|
void copySelection(LCursor & cur);
|
|
|
|
|
///
|
|
|
|
|
void pasteSelection(LCursor & cur, size_t sel_index = 0);
|
2003-03-06 15:39:37 +00:00
|
|
|
|
|
2005-11-29 15:08:35 +00:00
|
|
|
|
///
|
|
|
|
|
void pasteParagraphList(LCursor & cur, ParagraphList const & parlist,
|
|
|
|
|
textclass_type textclass);
|
|
|
|
|
|
|
|
|
|
|
2004-03-25 09:16:36 +00:00
|
|
|
|
/** Needed to switch between different classes. This works
|
2005-05-04 11:21:14 +00:00
|
|
|
|
* for a list of paragraphs beginning with the specified par.
|
|
|
|
|
* It changes layouts and character styles.
|
2004-10-05 10:11:42 +00:00
|
|
|
|
*/
|
2006-05-22 10:12:09 +00:00
|
|
|
|
void switchBetweenClasses(lyx::textclass_type c1,
|
|
|
|
|
lyx::textclass_type c2,
|
|
|
|
|
InsetText & in, ErrorList &);
|
2003-03-06 15:39:37 +00:00
|
|
|
|
|
2004-03-25 09:16:36 +00:00
|
|
|
|
// only used by the spellchecker
|
|
|
|
|
void replaceWord(LCursor & cur, std::string const & replacestring);
|
|
|
|
|
|
2004-04-18 07:32:34 +00:00
|
|
|
|
///
|
2005-10-12 18:44:53 +00:00
|
|
|
|
std::string grabSelection(LCursor const & cur);
|
2004-04-18 07:32:34 +00:00
|
|
|
|
///
|
|
|
|
|
void eraseSelection(LCursor & cur);
|
|
|
|
|
///
|
|
|
|
|
std::string grabAndEraseSelection(LCursor & cur);
|
|
|
|
|
// other selection methods
|
|
|
|
|
///
|
|
|
|
|
void selCut(LCursor & cur);
|
|
|
|
|
///
|
|
|
|
|
void selDel(LCursor & cur);
|
|
|
|
|
/// clears or deletes selection depending on lyxrc setting
|
|
|
|
|
void selClearOrDel(LCursor & cur);
|
|
|
|
|
/// pastes n-th element of cut buffer
|
|
|
|
|
void selPaste(LCursor & cur, size_t n);
|
2005-09-06 17:39:39 +00:00
|
|
|
|
|
|
|
|
|
/** Tabular has its own paste stack for multiple cells
|
|
|
|
|
* but it needs to know whether there is a more recent
|
|
|
|
|
* ordinary paste. Therefore which one is newer.
|
|
|
|
|
*/
|
|
|
|
|
//FIXME: this is a workaround for bug 1919. Replace this by
|
|
|
|
|
//an all-for-one-paste mechanism in 1.5
|
|
|
|
|
/// store whether tabular or ordinary paste stack is newer
|
|
|
|
|
void dirtyTabularStack(bool b);
|
|
|
|
|
/// is the tabular paste stack newer than the ordinary one?
|
|
|
|
|
bool tabularStackDirty();
|
2004-03-25 09:16:36 +00:00
|
|
|
|
} // namespace cap
|
|
|
|
|
} // namespce lyx
|
2000-04-10 14:29:05 +00:00
|
|
|
|
|
|
|
|
|
#endif
|