//copy the firs page to the clipboard
ScribusMainWindow* scMW = ScCore->primaryMainWindow();
Selection* s = new Selection(scMW);
//select items to copy
for (int i = 0; i < srcDoc->Items->count(); i++)
{
if (srcDoc->OnPage(srcDoc->Items->at(i)) == src->pageNr())
s->addItem(srcDoc->Items->at(i),false);
}
//Now, as all the relevant items have been copied, move the selection to the clipboard
QString BufferI="";
ScriXmlDoc *ss = new ScriXmlDoc();
scMW->Buffer2 = ss->WriteElem(srcDoc, view, s);
std::ostringstream xmlString;
SaxXML xmlStream(xmlString);
Serializer::serializeObjects(*s, xmlStream);
std::string xml(xmlString.str());
BufferI = QString::fromUtf8(xml.c_str(), xml.length());
scMW->Buffer2 = BufferI;
scMW->BuFromApp = true;
scMW->ClipB->setText(BufferI);
//now, start placing
Selection pastedObjects = Serializer(*targetDoc).deserializeObjects(scMW->Buffer2.utf8());