1 #include "mapcenteritem.h"
2 #include "mapcenterobj.h"
7 MapCenterItem::MapCenterItem(const QList<QVariant> &data, TreeItem *parent):BranchItem (data,parent)
12 MapCenterItem::~MapCenterItem()
14 cout << "Destr. MapCenterItem\n";
15 qDeleteAll(childItems);
18 QString MapCenterItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset) //FIXME-1
20 cout << "MCI::saveToDir: "<<getHeadingStd()<<endl;
22 // Cloudy stuff can be hidden during exports
23 if (hidden) return QString();
26 BranchObj *bo=(BranchObj*)lmo;
29 // Update of note is usually done while unselecting a branch
30 if (isNoteInEditor) getNoteFromTextEditor();
34 scrolledAttr=attribut ("scrolled","yes");
38 // save area, if not scrolled
40 if (!((BranchObj*)(parObj))->isScrolled() )
43 attribut("x1",QString().setNum(absPos.x()-offset.x())) +
44 attribut("y1",QString().setNum(absPos.y()-offset.y())) +
45 attribut("x2",QString().setNum(absPos.x()+width()-offset.x())) +
46 attribut("y2",QString().setNum(absPos.y()+height()-offset.y()));
51 // Providing an ID for a branch makes export to XHTML easier
54 idAttr=attribut ("id",model->getSelectString(this)); //TODO directly access model
59 s=beginElement ("mapcenter"
65 // +getIncludeImageAttr()
70 s+=valueElement("heading", getHeading(),
71 attribut ("textColor",QColor( bo->getColor()).name()));
75 if (frame->getFrameType()!=FrameObj::NoFrame)
76 s+=frame->saveToDir ();
78 // save names of flags set
79 s+=standardFlags->saveToDir(tmpdir,prefix,0);
82 for (int i=0; i<floatimage.size(); ++i)
83 s+=floatimage.at(i)->saveToDir (tmpdir,prefix);
92 TreeItem *ti=getBranchNum(i);
95 s+=getBranchNum(i)->saveToDir(tmpdir,prefix,offset);
103 QString ol; // old link
104 QString cl; // current link
105 for (int i=0; i<xlink.size(); ++i)
107 cl=xlink.at(i)->saveToDir();
114 qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
120 s+=endElement ("mapcenter");
124 BranchObj* MapCenterItem::createMapObj(QGraphicsScene *scene)
126 // Initialize MapCenterObj, order of things is important...
127 MapCenterObj* mco=new MapCenterObj(scene);
129 mco->setParObj(NULL);
130 mco->setModel (model);
131 mco->setTreeItem (this);
132 mco->setDefAttr(BranchObj::NewBranch);
136 if (!getHeading().isEmpty() )
138 mco->updateData(); //FIXME-3 better call model->emitDataHasChanged(treeItem);
139 mco->setColor (headingColor);
142 //mco->updateLink(); //FIXME-3