mapcenteritem.cpp
changeset 749 9ff332964015
child 760 59614eaf5fbb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mapcenteritem.cpp	Wed Apr 01 15:06:57 2009 +0000
     1.3 @@ -0,0 +1,118 @@
     1.4 +#include "mapcenteritem.h"
     1.5 +#include "mapcenterobj.h"
     1.6 +
     1.7 +#include <iostream>
     1.8 +using namespace std;
     1.9 +
    1.10 +MapCenterItem::MapCenterItem(const QList<QVariant> &data, TreeItem *parent):BranchItem (data,parent)
    1.11 +{
    1.12 +	scrolled=false;
    1.13 +	tmpUnscrolled=false;
    1.14 +}
    1.15 +
    1.16 +MapCenterItem::~MapCenterItem()
    1.17 +{
    1.18 +	cout << "Destr. MapCenterItem\n";
    1.19 +    qDeleteAll(childItems);
    1.20 +}
    1.21 +
    1.22 +QString MapCenterItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
    1.23 +{
    1.24 +	// Cloudy stuff can be hidden during exports
    1.25 +	if (hidden) return QString();
    1.26 +
    1.27 +    QString s,a;
    1.28 +	BranchObj *bo=(BranchObj*)lmo;
    1.29 +
    1.30 +	/* FIXME-1
    1.31 +	// Update of note is usually done while unselecting a branch
    1.32 +	if (isNoteInEditor) getNoteFromTextEditor();
    1.33 +	
    1.34 +	QString scrolledAttr;
    1.35 +	if (scrolled) 
    1.36 +		scrolledAttr=attribut ("scrolled","yes");
    1.37 +	else
    1.38 +		scrolledAttr="";
    1.39 +
    1.40 +	// save area, if not scrolled
    1.41 +	QString areaAttr;
    1.42 +	if (!((BranchObj*)(parObj))->isScrolled() )
    1.43 +	{
    1.44 +		areaAttr=
    1.45 +			attribut("x1",QString().setNum(absPos.x()-offset.x())) +
    1.46 +			attribut("y1",QString().setNum(absPos.y()-offset.y())) +
    1.47 +			attribut("x2",QString().setNum(absPos.x()+width()-offset.x())) +
    1.48 +			attribut("y2",QString().setNum(absPos.y()+height()-offset.y()));
    1.49 +
    1.50 +	} else
    1.51 +		areaAttr="";
    1.52 +	
    1.53 +	// Providing an ID for a branch makes export to XHTML easier
    1.54 +	QString idAttr;
    1.55 +	if (countXLinks()>0)
    1.56 +		idAttr=attribut ("id",model->getSelectString(this)); //TODO directly access model
    1.57 +	else
    1.58 +		idAttr="";
    1.59 +
    1.60 +	*/
    1.61 +    s=beginElement ("branch" 
    1.62 +	//	+getOrnXMLAttr() 
    1.63 +	//	+scrolledAttr 
    1.64 +	//	+areaAttr 
    1.65 +	//	+idAttr 
    1.66 +	//	+getIncludeImageAttr() 
    1.67 +		);
    1.68 +    incIndent();
    1.69 +
    1.70 +	// save heading
    1.71 +    s+=valueElement("heading", getHeading(),
    1.72 +		attribut ("textColor",QColor( bo->getColor()).name()));
    1.73 +
    1.74 +/*
    1.75 +	// Save frame
    1.76 +	if (frame->getFrameType()!=FrameObj::NoFrame) 
    1.77 +		s+=frame->saveToDir ();
    1.78 +
    1.79 +	// save names of flags set
    1.80 +	s+=standardFlags->saveToDir(tmpdir,prefix,0);
    1.81 +	
    1.82 +	// Save FloatImages
    1.83 +	for (int i=0; i<floatimage.size(); ++i)
    1.84 +		s+=floatimage.at(i)->saveToDir (tmpdir,prefix);
    1.85 +*/
    1.86 +
    1.87 +	// save note
    1.88 +	if (!note.isEmpty() )
    1.89 +		s+=note.saveToDir();
    1.90 +	
    1.91 +	// Save branches
    1.92 +	TreeItem *ti=getFirstBranch();
    1.93 +	TreeItem *last=getLastBranch();
    1.94 +	while (ti && ti!=last) 
    1.95 +		s+=ti->saveToDir(tmpdir,prefix,offset);
    1.96 +
    1.97 +	/*
    1.98 +	// Save XLinks
    1.99 +	QString ol;	// old link
   1.100 +	QString cl;	// current link
   1.101 +	for (int i=0; i<xlink.size(); ++i)
   1.102 +	{
   1.103 +		cl=xlink.at(i)->saveToDir();
   1.104 +		if (cl!=ol)
   1.105 +		{
   1.106 +			s+=cl;
   1.107 +			ol=cl;
   1.108 +		} else
   1.109 +		{
   1.110 +			qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
   1.111 +		}
   1.112 +	}	
   1.113 +	*/
   1.114 +
   1.115 +    decIndent();
   1.116 +    s+=endElement   ("branch");
   1.117 +    return s;
   1.118 +}
   1.119 +
   1.120 +
   1.121 +