xml.cpp
author insilmaril
Tue, 05 Sep 2006 10:03:29 +0000
changeset 368 cd7558fa3ffc
parent 366 e95081c21da2
child 388 3a58c9ef4a18
permissions -rw-r--r--
Moved qt4-port branch to head
     1 #include "xml.h"
     2 
     3 #include <qmessagebox.h>
     4 #include <qcolor.h>
     5 #include <q3stylesheet.h>
     6 //Added by qt3to4:
     7 #include <QTextStream>
     8 #include <iostream>
     9 
    10 #include "misc.h"
    11 #include "settings.h"
    12 #include "linkablemapobj.h"
    13 
    14 #include "version.h"
    15 
    16 static BranchObj *lastBranch;
    17 static FloatObj *lastFloat;
    18 static OrnamentedObj *lastOO;
    19 
    20 extern Settings settings;
    21 
    22 mapBuilderHandler::mapBuilderHandler() {}
    23 
    24 mapBuilderHandler::~mapBuilderHandler() {}
    25 
    26 QString mapBuilderHandler::errorProtocol() { return errorProt; }
    27 
    28 bool mapBuilderHandler::startDocument()
    29 {
    30     errorProt = "";
    31     state = StateInit;
    32     laststate = StateInit;
    33     branchDepth=0;
    34 	htmldata="";
    35 	isVymPart=false;
    36     return true;
    37 }
    38 
    39 
    40 QString mapBuilderHandler::parseHREF(QString href)
    41 {
    42 	QString type=href.section(":",0,0);
    43 	QString path=href.section(":",1,1);
    44 	if (!tmpDir.endsWith("/"))
    45 		return tmpDir + "/" + path;
    46 	else	
    47 		return tmpDir + path;
    48 }
    49 
    50 bool mapBuilderHandler::startElement  ( const QString&, const QString&,
    51                     const QString& eName, const QXmlAttributes& atts ) 
    52 {
    53     QColor col;
    54 	//cout << "startElement <"<<eName<<">  state="<<state <<"  laststate="<<laststate<<"   loadMode="<<loadMode<<endl;
    55     if ( state == StateInit && (eName == "vymmap")  ) 
    56 	{
    57         state = StateMap;
    58 		if (!atts.value( "version").isEmpty() ) 
    59 		{
    60 			mc->setVersion(atts.value( "version" ));
    61 			if (!mc->checkVersion())
    62 				QMessageBox::warning( 0, "Warning: Version Problem" ,
    63 				   "<h3>Map is newer than VYM</h3>"
    64 				   "<p>The map you are just trying to load was "
    65 				   "saved using vym " +atts.value("version")+". "
    66 				   "The version of this vym is " __VYM_VERSION
    67 				   ". If you run into problems after pressing "
    68 				   "the ok-button below, updating vym should help.");
    69 
    70 		}
    71 		if (loadMode==NewMap)
    72 		{
    73 			if (!atts.value( "author").isEmpty() )
    74 			{
    75 				mc->setAuthor(atts.value( "author" ) );
    76 			}
    77 			if (!atts.value( "comment").isEmpty() )
    78 			{
    79 				mc->setComment (atts.value( "comment" ) );
    80 			}
    81 			if (!atts.value( "backgroundColor").isEmpty() )
    82 			{
    83 				col.setNamedColor(atts.value("backgroundColor"));
    84 				mc->getCanvas()->setBackgroundColor(col);
    85 			}	    
    86 			if (!atts.value( "linkColorHint").isEmpty() ) 
    87 			{
    88 				if (atts.value("linkColorHint")=="HeadingColor")
    89 					me->setLinkColorHint(HeadingColor);
    90 				else
    91 					me->setLinkColorHint(DefaultColor);
    92 			}
    93 			if (!atts.value( "linkStyle").isEmpty() ) 
    94 			{
    95 				QString s=atts.value("linkStyle");
    96 				if (s=="StyleLine")
    97 					me->setLinkStyle(StyleLine);
    98 				else	
    99 					if (s=="StyleParabel")
   100 						me->setLinkStyle(StyleParabel);
   101 					else	
   102 						if (s=="StylePolyLine")
   103 							me->setLinkStyle(StylePolyLine);
   104 						else	
   105 							me->setLinkStyle(StylePolyParabel);
   106 			}	
   107 			if (!atts.value( "linkColor").isEmpty() ) 
   108 			{
   109 				col.setNamedColor(atts.value("linkColor"));
   110 				me->setLinkColor(col);
   111 			}	
   112 			if (!atts.value( "defXLinkColor").isEmpty() ) 
   113 			{
   114 				col.setNamedColor(atts.value("defXLinkColor"));
   115 				me->setDefXLinkColor(col);
   116 			}	
   117 			if (!atts.value( "defXLinkWidth").isEmpty() ) 
   118 			{
   119 				me->setDefXLinkWidth(atts.value("defXLinkWidth").toInt ());
   120 			}	
   121 		}	
   122 	} else if ( eName == "select" && state == StateMap ) 
   123 	{
   124 		state=StateMapSelect;
   125 	} else if ( eName == "setting" && state == StateMap ) 
   126 	{
   127 		state=StateMapSetting;
   128 		if (loadMode==NewMap)
   129 			readSettingAttr (atts);
   130 	} else if ( eName == "mapcenter" && state == StateMap ) 
   131 	{
   132 		state=StateMapCenter;
   133 		if (loadMode==NewMap)
   134 		{	
   135 			// Really use the found mapcenter as MCO in a new map
   136 			lastBranch=mc;	// avoid empty pointer
   137 		} else
   138 		{
   139 			// Treat the found mapcenter as a branch 
   140 			// in an existing map
   141 			LinkableMapObj* lmo=me->getSelection();
   142 			if (lmo && (typeid(*lmo) == typeid(BranchObj) ) 
   143 			        || (typeid(*lmo) == typeid(MapCenterObj) ) )
   144 			{
   145 				lastBranch=(BranchObj*)lmo;
   146 				if (loadMode==ImportAdd)
   147 				{
   148 					lastBranch->addBranch();
   149 					lastBranch=lastBranch->getLastBranch();
   150 				} else
   151 					lastBranch->clear();
   152 			} else
   153 				return false;
   154 		}
   155 		readBranchAttr (atts);
   156 	} else if ( (eName == "standardflag" ||eName == "standardFlag") && state == StateMapCenter) 
   157 	{
   158 		state=StateMapCenterStandardFlag;
   159 	} else if ( eName == "heading" && state == StateMapCenter) 
   160 	{
   161 		state=StateMapCenterHeading;
   162 		if (!atts.value( "textColor").isEmpty() ) 
   163 		{
   164 			col.setNamedColor(atts.value("textColor"));
   165 			lastBranch->setColor(col );
   166 		}	    
   167 	} else if ( eName == "note" && state == StateMapCenter) 
   168 	{	// only for backward compatibility (<1.4.6). Use htmlnote now.
   169 		state=StateMapCenterNote;
   170 		if (!readNoteAttr (atts) ) return false;
   171 	} else if ( eName == "htmlnote" && state == StateMapCenter) 
   172 	{
   173 		laststate=state;
   174 		state=StateHtmlNote;
   175     } else if ( eName == "floatimage" && state == StateMapCenter ) 
   176 	{
   177 		state=StateMapCenterFloatImage;
   178         lastBranch->addFloatImage();
   179 		lastFloat=lastBranch->getLastFloatImage();
   180 		if (!readFloatImageAttr(atts)) return false;
   181 	} else if ( (eName == "branch"||eName=="floatimage") && state == StateMap) 
   182 	{
   183 		// This is used in vymparts, which have no mapcenter!
   184 		isVymPart=true;
   185 		LinkableMapObj* lmo=me->getSelection();
   186 		if (!lmo)
   187 		{
   188 			// If a vym part is _loaded_ (not imported), 
   189 			// selection==lmo==NULL
   190 			// Treat it like ImportAdd then...
   191 			loadMode=ImportAdd;
   192 			lmo=mc;
   193 		}	
   194 		if (lmo && (typeid(*lmo) == typeid(BranchObj) ) 
   195 				|| (typeid(*lmo) == typeid(MapCenterObj) ) )
   196 		{
   197 			lastBranch=(BranchObj*)(lmo);
   198 			if (eName=="branch")
   199 			{
   200 				state=StateBranch;
   201 				if (loadMode==ImportAdd)
   202 				{
   203 					lastBranch->addBranch();
   204 					lastBranch=lastBranch->getLastBranch();
   205 					
   206 				} else
   207 					lastBranch->clear();
   208 				branchDepth=1;
   209 				readBranchAttr (atts);
   210 			} else if (eName=="floatimage")
   211 			{
   212 				state=StateFloatImage;
   213 				lastBranch->addFloatImage();
   214 				lastFloat=lastBranch->getLastFloatImage();
   215 				if (!readFloatImageAttr(atts)) return false;
   216 			} else return false;
   217 		} else return false;
   218 	} else if ( eName == "branch" && state == StateMapCenter) 
   219 	{
   220 		state=StateBranch;
   221 		branchDepth=1;
   222 		lastBranch->addBranch();
   223 		lastBranch=lastBranch->getLastBranch();
   224 		readBranchAttr (atts);
   225 	} else if ( (eName=="standardflag" ||eName == "standardFlag") && state == StateBranch) 
   226 	{
   227 		state=StateBranchStandardFlag;
   228 	} else if ( eName == "heading" && state == StateBranch) 
   229 	{
   230 		state=StateBranchHeading;
   231 		if (!atts.value( "textColor").isEmpty() ) 
   232 		{
   233 			col.setNamedColor(atts.value("textColor"));
   234 			lastBranch->setColor(col );
   235 		}	    
   236     } else if ( eName == "note" && state == StateBranch) 
   237 	{
   238         state=StateBranchNote;
   239 		if (!readNoteAttr (atts) ) return false;
   240 	} else if ( eName == "htmlnote" && state == StateBranch) 
   241 	{
   242 		laststate=state;
   243 		state=StateHtmlNote;
   244 		no.clear();
   245 		if (!atts.value( "fonthint").isEmpty() ) 
   246 			no.setFontHint(atts.value ("fonthint") );
   247     } else if ( eName == "floatimage" && state == StateBranch ) 
   248 	{
   249 		state=StateBranchFloatImage;
   250         lastBranch->addFloatImage();
   251 		lastFloat=lastBranch->getLastFloatImage();
   252 		if (!readFloatImageAttr(atts)) return false;
   253     } else if ( eName == "xlink" && state == StateBranch ) 
   254 	{
   255 		state=StateBranchXLink;
   256 		if (!readXLinkAttr (atts)) return false;
   257     } else if ( eName == "branch" && state == StateBranch ) 
   258 	{
   259         lastBranch->addBranch();
   260 		lastBranch=lastBranch->getLastBranch();		
   261         branchDepth++;
   262 		readBranchAttr (atts);
   263     } else if ( eName == "html" && state == StateHtmlNote ) 
   264 	{
   265 		state=StateHtml;
   266 		htmldata="<"+eName;
   267 		readHtmlAttr(atts);
   268 		htmldata+=">";
   269     } else if ( state == StateHtml ) 
   270 	{
   271 		// accept all while in html mode,
   272 		htmldata+="<"+eName;
   273 		readHtmlAttr(atts);
   274 		htmldata+=">";
   275     } else
   276         return false;   // Error
   277     return true;
   278 }
   279 
   280 bool mapBuilderHandler::endElement  ( const QString&, const QString&, const QString &eName)
   281 {
   282 //	cout << "endElement </"<<eName<<">  state="<<state <<"  laststate="<<laststate<<endl;
   283     switch ( state ) 
   284 	{
   285         case StateMapSelect: state=StateMap;  return true;
   286         case StateMapSetting: state=StateMap;  return true;
   287         case StateMapCenter: state=StateMap;  return true;
   288         case StateMapCenterStandardFlag: state=StateMapCenter;  return true;
   289         case StateMapCenterHeading: state=StateMapCenter;  return true;
   290         case StateMapCenterNote: state=StateMapCenter;  return true;
   291         case StateMapCenterFloatImage: state=StateMapCenter;  return true;
   292         case StateFloatImage: state=StateMap; return true;
   293         case StateBranch: 
   294             if (branchDepth>1) 
   295 			{
   296                 branchDepth--;
   297                 state=StateBranch;
   298             } else  
   299 			{
   300                 branchDepth=0;
   301 				if (isVymPart)
   302 					state=StateMap;
   303 				else
   304 					state=StateMapCenter;
   305             }   
   306 			lastBranch=(BranchObj*)(lastBranch->getParObj());
   307              return true;
   308         case StateBranchStandardFlag: state=StateBranch;  return true;
   309         case StateBranchHeading: state=StateBranch;  return true;
   310         case StateBranchNote: state=StateBranch; return true;
   311         case StateBranchFloatImage: state=StateBranch;  return true;
   312         case StateBranchXLink: state=StateBranch;  return true;
   313         case StateHtmlNote: state=laststate; return true;
   314         case StateHtml: 
   315 			htmldata+="</"+eName+">";
   316 			if (eName=="html")
   317 			{
   318 				state=StateHtmlNote;  
   319 				htmldata.replace ("<br></br>","<br />");
   320 				no.setNote (htmldata);
   321 				lastBranch->setNote (no);
   322 				return true;
   323 			}	else
   324 			{
   325 				return true;
   326 			}	
   327         case StateMap: state=StateInit;  return true;
   328         default : 
   329 			// even for HTML includes, this should never be reached
   330 			return false;
   331     }   
   332 }
   333 
   334 bool mapBuilderHandler::characters   ( const QString& ch)
   335 {
   336 	//cout << "characters \""<<ch<<"\"  state="<<state <<"  laststate="<<laststate<<endl;
   337 
   338 	QString ch_org=quotemeta (ch);
   339     QString ch_simplified=ch.simplifyWhiteSpace();
   340     if ( ch_simplified.isEmpty() ) return true;
   341 
   342     switch ( state ) 
   343     {
   344         case StateInit: break;
   345         case StateMap: break; 
   346 		case StateMapSelect:
   347 			me->select(ch_simplified);
   348 			break;
   349 		case StateMapSetting:break;
   350         case StateMapCenter: break;
   351         case StateMapCenterStandardFlag: 
   352             lastBranch->activateStandardFlag(ch_simplified); 
   353             break;
   354         case StateMapCenterHeading: 
   355             lastBranch->setHeading(ch_simplified); 
   356             break;
   357         case StateMapCenterNote:
   358 			lastBranch->setNote(ch_simplified);
   359 			break;
   360         case StateBranch: break;
   361         case StateBranchStandardFlag: 
   362             lastBranch->activateStandardFlag(ch_simplified); 
   363             break;
   364         case StateBranchHeading: 
   365             lastBranch->setHeading(ch_simplified);
   366             break;
   367         case StateBranchNote: 
   368 			lastBranch->setNote(ch_simplified);
   369 			break;
   370         case StateBranchFloatImage: break;
   371         case StateHtmlNote: break;
   372         case StateHtml:
   373 			htmldata+=ch_org;
   374 			break;
   375         default: 
   376 			return false;
   377     }
   378     return true;
   379 }
   380 
   381 QString mapBuilderHandler::errorString() 
   382 {
   383     return "the document is not in the VYM file format";
   384 }
   385 
   386 bool mapBuilderHandler::fatalError( const QXmlParseException& exception ) 
   387 {
   388     errorProt += QString( "Fatal parsing error: %1 in line %2, column %3\n")
   389     .arg( exception.message() )
   390     .arg( exception.lineNumber() )
   391     .arg( exception.columnNumber() );
   392 	// Try to read the bogus line
   393 	errorProt+=QString("File is: %1\n").arg(inputFile);
   394 	QString s;
   395 	if (loadStringFromDisk (inputFile,s))
   396 	{
   397 		QStringList sl=QStringList::split ("\n",s);
   398 		int i=1;
   399 		QStringList::Iterator it = sl.begin();
   400 		while (i<exception.lineNumber()-1)
   401 		{
   402 			it++;
   403 			i++;
   404 		}
   405 		s=*it;
   406 		s.insert (exception.columnNumber()-1,"<ERROR>");
   407 		errorProt+=s;
   408     }
   409     return QXmlDefaultHandler::fatalError( exception );
   410 }
   411 
   412 void mapBuilderHandler::setMapEditor (MapEditor* e)
   413 {
   414     me=e;
   415 	mc=me->getMapCenter();
   416 }
   417 
   418 void mapBuilderHandler::setTmpDir (QString tp)
   419 {
   420 	tmpDir=tp;
   421 }
   422 
   423 void mapBuilderHandler::setInputFile (QString f)
   424 {
   425 	inputFile=f;
   426 }
   427 
   428 void mapBuilderHandler::setLoadMode (const LoadMode &lm)
   429 {
   430 	loadMode=lm;
   431 }
   432 
   433 bool mapBuilderHandler::readBranchAttr (const QXmlAttributes& a)
   434 {
   435 	lastOO=lastBranch;
   436 	if (!readOOAttr(a)) return false;
   437 
   438 	if (!a.value( "scrolled").isEmpty() )
   439 		lastBranch->toggleScroll();
   440 	if (!a.value( "frameType").isEmpty() ) 
   441 		lastBranch->setFrameType (a.value("frameType"));
   442 
   443 	if (!a.value( "incImgV").isEmpty() ) 
   444 	{	
   445 		if (a.value("incImgV")=="true")
   446 			lastBranch->setIncludeImagesVer(true);
   447 		else	
   448 			lastBranch->setIncludeImagesVer(false);
   449 	}	
   450 	if (!a.value( "incImgH").isEmpty() ) 
   451 	{	
   452 		if (a.value("incImgH")=="true")
   453 			lastBranch->setIncludeImagesHor(true);
   454 		else	
   455 			lastBranch->setIncludeImagesHor(false);
   456 	}	
   457 	return true;	
   458 }
   459 
   460 bool mapBuilderHandler::readOOAttr (const QXmlAttributes& a)
   461 {
   462 	if (lastOO)
   463 	{
   464 		bool okx,oky;
   465 		int x,y;
   466 		if (!a.value( "absPosX").isEmpty() && loadMode==NewMap && branchDepth<2) 
   467 		{
   468 			if (!a.value( "absPosY").isEmpty() ) 
   469 			{
   470 				x=a.value("absPosX").toInt (&okx, 10);
   471 				y=a.value("absPosY").toInt (&oky, 10);
   472 				if (okx && oky  )
   473 					lastOO->move(x,y);
   474 				else
   475 					return false;   // Couldn't read absPos
   476 			}           
   477 		}           
   478 		if (!a.value( "url").isEmpty() ) 
   479 			lastOO->setURL (a.value ("url"));
   480 		if (!a.value( "vymLink").isEmpty() ) 
   481 			lastOO->setVymLink (a.value ("vymLink"));
   482 		if (!a.value( "hideInExport").isEmpty() ) 
   483 			if (a.value("hideInExport")=="true")
   484 				lastOO->setHideInExport(true);
   485 
   486 		if (!a.value( "hideLink").isEmpty()) 
   487 		{
   488 			if (a.value ("hideLink") =="true")
   489 				lastOO->setHideLinkUnselected(true);
   490 			else	
   491 				lastOO->setHideLinkUnselected(false);
   492 		}	
   493 	}
   494 	return true;	
   495 }
   496 
   497 bool mapBuilderHandler::readNoteAttr (const QXmlAttributes& a)
   498 {	// only for backward compatibility (<1.4.6). Use htmlnote now.
   499 	no.clear();
   500 	QString fn;
   501 	if (!a.value( "href").isEmpty() ) 
   502 	{
   503 		// Load note
   504 		fn=parseHREF(a.value ("href") );
   505 		QFile file (fn);
   506 		QString s;						// Reading a note
   507 
   508 		if ( !file.open( QIODevice::ReadOnly) )
   509 		{
   510 			qWarning ("mapBuilderHandler::readNoteAttr:  Couldn't load "+fn);
   511 			return false;
   512 		}	
   513 		QTextStream stream( &file );
   514 		QString lines;
   515 		while ( !stream.atEnd() ) {
   516 			lines += stream.readLine()+"\n"; 
   517 		}
   518 		file.close();
   519 		// Convert to richtext
   520 		if ( !Q3StyleSheet::mightBeRichText( lines ) )
   521 		{
   522 			// Here we are workarounding the QT conversion method:
   523 			// convertFromPlainText does not generate valid xml, needed
   524 			// for the parser, but just <p> and <br> without closing tags.
   525 			// So we have to add those by ourselves
   526 			//lines=quotemeta (lines);
   527 			lines = Q3StyleSheet::convertFromPlainText( lines, Q3StyleSheetItem::WhiteSpaceNormal );
   528 			lines.replace ("<br>","<br />");
   529 		}	
   530 
   531 		lines ="<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>"+lines + "</p></body></html>";
   532 		no.setNote (lines);
   533 	}		
   534 	if (!a.value( "fonthint").isEmpty() ) 
   535 		no.setFontHint(a.value ("fonthint") );
   536 	if (state == StateMapCenterNote) 	
   537 		mc->setNote(no);
   538 	else
   539 		lastBranch->setNote(no);
   540 	return true;
   541 }
   542 
   543 bool mapBuilderHandler::readFloatImageAttr (const QXmlAttributes& a)
   544 {
   545 	lastOO=lastFloat;
   546 	
   547 	//if (!readOOAttr(a)) return false;
   548 
   549 	if (!a.value( "useOrientation").isEmpty() ) 
   550 	{
   551 		if (a.value ("useOrientation") =="true")
   552 			lastFloat->setUseOrientation (true);
   553 		else	
   554 			lastFloat->setUseOrientation (false);
   555 	}	
   556 	if (!a.value( "href").isEmpty() )
   557 	{
   558 		// Load FloatImage
   559 		if (!lastFloat->load (parseHREF(a.value ("href") ) ))
   560 		{
   561 			QMessageBox::warning( 0, "Warning: " ,
   562 				"Couldn't load float image\n"+parseHREF(a.value ("href") ));
   563 			lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
   564 			lastFloat=NULL;
   565 			return true;
   566 		}
   567 		
   568 	}	
   569 	if (!a.value( "floatExport").isEmpty() ) 
   570 	{
   571 		// Only for compatibility. THis is not used since 1.7.11 
   572 		if (a.value ("floatExport") =="true")
   573 			lastFloat->setFloatExport(true);
   574 		else	
   575 			lastFloat->setFloatExport (false);
   576 	}	
   577 	if (!a.value( "zPlane").isEmpty() ) 
   578 		lastFloat->setZ (a.value("zPlane").toInt ());
   579     int x,y;
   580     bool okx,oky;
   581 	if (!a.value( "relPosX").isEmpty() ) 
   582 	{
   583 		if (!a.value( "relPosY").isEmpty() ) 
   584 		{
   585 			// read relPos
   586 			x=a.value("relPosX").toInt (&okx, 10);
   587 			y=a.value("relPosY").toInt (&oky, 10);
   588 			if (okx && oky) 
   589 				
   590 				{
   591 					lastFloat->setRelPos (QPoint (x,y) );
   592 					// make sure floats in mapcenter are repositioned to relative pos
   593 					if (mc==lastBranch) mc->positionContents();
   594 				}
   595 			else
   596 				// Couldn't read relPos
   597 				return false;  
   598 		}           
   599 	}	
   600 	
   601 	if (!readOOAttr(a)) return false;
   602 
   603 	if (!a.value ("orgName").isEmpty() )
   604 	{
   605 		((FloatImageObj*)(lastFloat))->setOriginalFilename (a.value("orgName"));
   606 	}
   607 	return true;
   608 }
   609 
   610 bool mapBuilderHandler::readXLinkAttr (const QXmlAttributes& a)
   611 {
   612 	QColor col;
   613 	bool okx;
   614 	bool success=false;
   615 	XLinkObj *xlo=new XLinkObj (mc->getCanvas());
   616 	if (!a.value( "color").isEmpty() ) 
   617 	{
   618 		col.setNamedColor(a.value("color"));
   619 		xlo->setColor (col);
   620 	}
   621 
   622 	if (!a.value( "width").isEmpty() ) 
   623 	{
   624 		xlo->setWidth(a.value ("width").toInt (&okx, 10));
   625 	}
   626 
   627 	if (!a.value( "beginBranch").isEmpty() ) 
   628 	{
   629 		if (!a.value( "endBranch").isEmpty() ) 
   630 		{
   631 			LinkableMapObj *lmo=mc->findObjBySelect (a.value( "beginBranch"));
   632 			if (lmo && typeid (*lmo)==typeid (BranchObj))
   633 			{
   634 				xlo->setBegin ((BranchObj*)(lmo));
   635 				lmo=mc->findObjBySelect (a.value( "endBranch"));
   636 				if (lmo && typeid (*lmo)==typeid (BranchObj))
   637 				{
   638 					xlo->setEnd ((BranchObj*)(lmo));
   639 					xlo->activate();
   640 				}
   641 			}
   642 			success=true; // Not all branches there yet, no error
   643 		}           
   644 	}	
   645 	if (!success) delete (xlo);
   646 	return success;
   647 }
   648 
   649 bool mapBuilderHandler::readHtmlAttr (const QXmlAttributes& a)
   650 {
   651 	for (int i=1; i<=a.count(); i++)
   652 		htmldata+=" "+a.localName(i-1)+"=\""+a.value(i-1)+"\"";
   653 	return true;
   654 }
   655 
   656 bool mapBuilderHandler::readSettingAttr (const QXmlAttributes& a)
   657 {
   658 	if (!a.value( "key").isEmpty() ) 
   659 	{
   660 		if (!a.value( "value").isEmpty() ) 
   661 			settings.setLocalEntry (me->getDestPath(), a.value ("key"), a.value ("value"));
   662 		else
   663 			return false;
   664 		
   665 	} else
   666 		return false;
   667 	
   668 	return true;
   669 }