#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
#include "CutAndPaste.h"
#include "BufferView.h"
#include "buffer.h"
namespace {
-// FIXME: stupid name
+// FIXME: stupid name
Paragraph * buf = 0;
textclass_type textclass = 0;
}
return true;
}
-
+
bool actually_erased = false;
-
+
// clear end/begin fragments of the first/last par in selection
actually_erased |= (startpar)->erase(start, startpar->size());
if ((*endpar)->erase(0, end)) {
- actually_erased = true;
+ actually_erased = true;
end = 0;
}
-
+
// Loop through the deleted pars if any, erasing as needed
-
+
Paragraph * pit = startpar->next();
-
+
while (1) {
// *endpar can be 0
if (!pit)
break;
-
+
Paragraph * next = pit->next();
-
+
// "erase" the contents of the par
if (pit != *endpar) {
actually_erased |= pit->erase(0, pit->size());
if (next) {
next->previous(pit->previous());
}
- lyxerr << "deleting pit " << pit << endl;
-
+
delete pit;
}
}
-
+
if (pit == *endpar)
break;
-
+
pit = next;
}
-#if 0 // FIXME: why for cut but not copy ?
+#if 0 // FIXME: why for cut but not copy ?
// the cut selection should begin with standard layout
if (realcut) {
buf->params().clear();
buf->bibkey = 0;
buf->layout(textclasslist[buffer->params.textclass].defaultLayoutName());
}
-#endif
+#endif
if (!startpar->next())
return true;
-
+
Buffer * buffer = current_view->buffer();
if (doclear) {
if (!actually_erased)
return true;
-
+
// paste the paragraphs again, if possible
if (startpar->hasSameLayout(startpar->next()) ||
startpar->next()->empty()) {
return true;
}
-
+
bool CutAndPaste::copySelection(Paragraph * startpar, Paragraph * endpar,
int start, int end, char tc)
{