Source Code (Use browser search to find items of interest.)
Class Index
killustrator'CutCmd (./koffice/killustrator/share/CutCmd.h:34)
class CutCmd : public Command {
public:
CutCmd (GDocument* doc);
~CutCmd ();
void execute ();
void unexecute ();
private:
GDocument* document;
list<std::pair<int, GObject*> > objects;
};
killustrator'CutCmd::CutCmd() (./koffice/killustrator/share/CutCmd.cc:36)
CutCmd::CutCmd (GDocument* doc)
: Command(i18n("Cut"))
{
document = doc;
for (list<GObject*>::iterator it = doc->getSelection ().begin ();
it != doc->getSelection ().end (); it++) {
GObject* o = *it;
o->ref ();
// store the old position of the object
int pos = doc->findIndexOfObject (o);
objects.push_back (pair<int, GObject*> (pos, o));
}
}
killustrator'CutCmd::~CutCmd() (./koffice/killustrator/share/CutCmd.cc:50)
CutCmd::~CutCmd () {
for (list<pair<int, GObject*> >::iterator it = objects.begin ();
it != objects.end (); it++)
it->second->unref ();
}
killustrator'CutCmd::execute() (./koffice/killustrator/share/CutCmd.cc:56)
void CutCmd::execute () {
ostrstream os;
XmlWriter xs (os);
xs.startTag ("doc", false);
xs.addAttribute ("mime", KILLUSTRATOR_MIMETYPE);
xs.closeTag ();
for (list<pair<int, GObject*> >::iterator it = objects.begin ();
it != objects.end (); it++) {
it->second->writeToXml (xs);
document->deleteObject (it->second);
}
xs.endTag (); // </doc>
os << ends;
QApplication::clipboard ()->setText (os.str ());
}
killustrator'CutCmd::unexecute() (./koffice/killustrator/share/CutCmd.cc:76)
void CutCmd::unexecute () {
QApplication::clipboard ()->clear ();
list<pair<int, GObject*> >::iterator i;
document->unselectAllObjects ();
for (i = objects.begin (); i != objects.end (); i++) {
// insert the object at the old position
int pos = i->first;
GObject* obj = i->second;
obj->ref ();
document->insertObjectAtIndex (obj, pos);
document->selectObject (obj);
}
}