Source Code (Use browser search to find items of interest.)
Class Index
killustrator'UngroupCmd (./koffice/killustrator/share/UngroupCmd.h:37)
class UngroupCmd : public Command {
public:
UngroupCmd (GDocument* doc);
~UngroupCmd ();
void execute ();
void unexecute ();
private:
GDocument* document;
typedef std::pair<GGroup*, std::list<GObject*> > GPair;
std::list<GPair> groups;
};
killustrator'UngroupCmd::UngroupCmd() (./koffice/killustrator/share/UngroupCmd.cc:33)
UngroupCmd::UngroupCmd (GDocument* doc) : Command(i18n("Ungroup")) {
document = doc;
for (list<GObject*>::iterator it = doc->getSelection ().begin ();
it != doc->getSelection ().end (); it++) {
GObject* o = *it;
if (o->isA ("GGroup")) {
GGroup* gobj = (GGroup *) o;
gobj->ref ();
list<GObject*> dummy;
groups.push_back (GPair (gobj, dummy));
}
}
}
killustrator'UngroupCmd::~UngroupCmd() (./koffice/killustrator/share/UngroupCmd.cc:47)
UngroupCmd::~UngroupCmd () {
for (list<GPair>::iterator it = groups.begin ();
it != groups.end (); it++) {
it->first->unref ();
list<GObject*>& olist = it->second;
for (list<GObject*>::iterator it2 = olist.begin ();
it2 != olist.end (); it2++)
(*it2)->unref ();
}
}
killustrator'UngroupCmd::execute() (./koffice/killustrator/share/UngroupCmd.cc:58)
void UngroupCmd::execute () {
for (list<GPair>::iterator it = groups.begin (); it != groups.end (); it++) {
GGroup *group = it->first;
list<GObject*>& olist = it->second;
int pos = document->findIndexOfObject (group);
if (pos != -1) {
document->setAutoUpdate (false);
// extract the members of the group
const list<GObject*> members = group->getMembers ();
list<GObject*>::const_iterator mi = members.begin ();
for (int offs = 0; mi != members.end (); mi++, offs++) {
GObject* obj = *mi;
// transform it according to the group transformation matrix
obj->transform (group->matrix (), true);
// and insert it into the object list at the former position
// of the group object
document->insertObjectAtIndex (obj, pos + offs);
document->selectObject (obj);
olist.push_back (obj);
obj->ref ();
}
// remove the group object
document->deleteObject (group);
document->setAutoUpdate (true);
}
}
}
killustrator'UngroupCmd::unexecute() (./koffice/killustrator/share/UngroupCmd.cc:88)
void UngroupCmd::unexecute () {
document->setAutoUpdate (false);
document->unselectAllObjects ();
for (list<GPair>::iterator it = groups.begin (); it != groups.end (); it++) {
GGroup *group = it->first;
QWMatrix m = group->matrix ().invert ();
list<GObject*>& olist = it->second;
for (list<GObject*>::iterator it2 = olist.begin ();
it2 != olist.end (); it2++) {
GObject* obj = *it2;
obj->transform (m, true);
group->addObject (obj);
document->deleteObject (obj);
}
document->insertObject (group);
document->selectObject (group);
}
document->setAutoUpdate (true);
}