1 #include "branchitem.h"
7 BranchItem::BranchItem(const QList<QVariant> &data, TreeItem *parent):TreeItem (data,parent)
9 //cout << "Constr. BranchItem\n";
15 BranchItem::~BranchItem()
17 cout << "Destr. BranchItem\n";
18 qDeleteAll(childItems);
21 void BranchItem::copy (BranchItem *other)
23 scrolled=other->scrolled;
24 tmpUnscrolled=other->tmpUnscrolled;
27 QString BranchItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
29 // Cloudy stuff can be hidden during exports
30 if (hidden) return QString();
33 BranchObj *bo=(BranchObj*)lmo;
36 // Update of note is usually done while unselecting a branch
37 if (isNoteInEditor) getNoteFromTextEditor();
41 scrolledAttr=attribut ("scrolled","yes");
45 // save area, if not scrolled
47 if (!((BranchObj*)(parObj))->isScrolled() )
50 attribut("x1",QString().setNum(absPos.x()-offset.x())) +
51 attribut("y1",QString().setNum(absPos.y()-offset.y())) +
52 attribut("x2",QString().setNum(absPos.x()+width()-offset.x())) +
53 attribut("y2",QString().setNum(absPos.y()+height()-offset.y()));
58 // Providing an ID for a branch makes export to XHTML easier
61 idAttr=attribut ("id",model->getSelectString(this)); //TODO directly access model
66 s=beginElement ("branch"
71 // +getIncludeImageAttr()
76 s+=valueElement("heading", getHeading(),
77 attribut ("textColor",QColor( bo->getColor()).name()));
81 if (frame->getFrameType()!=FrameObj::NoFrame)
82 s+=frame->saveToDir ();
84 // save names of flags set
85 s+=standardFlags->saveToDir(tmpdir,prefix,0);
88 for (int i=0; i<floatimage.size(); ++i)
89 s+=floatimage.at(i)->saveToDir (tmpdir,prefix);
97 TreeItem *ti=getFirstBranch();
98 TreeItem *last=getLastBranch();
99 while (ti && ti!=last)
100 s+=ti->saveToDir(tmpdir,prefix,offset);
104 QString ol; // old link
105 QString cl; // current link
106 for (int i=0; i<xlink.size(); ++i)
108 cl=xlink.at(i)->saveToDir();
115 qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
121 s+=endElement ("branch");
125 void BranchItem::unScroll()
127 if (tmpUnscrolled) resetTmpUnscroll();
128 if (scrolled) toggleScroll();
131 void BranchItem::toggleScroll()
136 //FIXME-1 systemFlags->deactivate("scrolledright");
138 for (int i=0; i<branch.size(); ++i)
139 branch.at(i)->setVisibility(true);
145 //FIXME-1 systemFlags->activate("scrolledright");
146 for (int i=0; i<branch.size(); ++i)
147 branch.at(i)->setVisibility(false);
153 move (absPos.x(), absPos.y() );
158 bool BranchItem::isScrolled()
163 bool BranchItem::hasScrolledParent(BranchItem *start)
165 // Calls parents recursivly to
166 // find out, if we are scrolled at all.
167 // But ignore myself, just look at parents.
169 if (this !=start && scrolled) return true;
171 BranchItem* bi=(BranchItem*)parentItem;
173 return bi->hasScrolledParent(start);
178 void BranchItem::tmpUnscroll()
180 // Unscroll parent (recursivly)
181 BranchItem * bi=(BranchItem*)parentItem;
182 if (bi) bi->tmpUnscroll();
188 // FIXME-1 systemFlags->activate("tmpUnscrolledright");
193 void BranchItem::resetTmpUnscroll()
195 // Unscroll parent (recursivly)
196 BranchItem * bi=(BranchItem*)parentItem;
197 if (bi) bi->resetTmpUnscroll();
203 // FIXME-1 systemFlags->deactivate("tmpUnscrolledright");