xml-vym.cpp
author insilmaril
Thu, 02 Apr 2009 09:54:42 +0000
changeset 751 7fa9b3164cbe
parent 749 9ff332964015
child 753 25a77484ec72
permissions -rw-r--r--
More moving from BranchObj to BranchItem
     1 #include "xml-vym.h"
     2 
     3 #include <QMessageBox>
     4 #include <QColor>
     5 #include <QTextStream>
     6 #include <iostream>
     7 #include <typeinfo>
     8 
     9 #include "branchitem.h"
    10 #include "misc.h"
    11 #include "settings.h"
    12 #include "linkablemapobj.h"
    13 #include "mainwindow.h"
    14 #include "version.h"
    15 
    16 static FloatObj *lastFloat;
    17 static OrnamentedObj *lastOO;
    18 
    19 extern Main *mainWindow;
    20 extern Settings settings;
    21 extern QString vymVersion;
    22 
    23 bool parseVYMHandler::startDocument()
    24 {
    25     errorProt = "";
    26     state = StateInit;
    27     laststate = StateInit;
    28 	stateStack.clear();
    29 	stateStack.append(StateInit);
    30 	htmldata="";
    31 	isVymPart=false;
    32     return true;
    33 }
    34 
    35 bool parseVYMHandler::startElement  ( const QString&, const QString&,
    36                     const QString& eName, const QXmlAttributes& atts ) 
    37 {
    38     QColor col;
    39 	/* Testing
    40 	cout << "startElement <"<< qPrintable(eName)
    41 		<<">  state="<<state 
    42 		<<"  laststate="<<stateStack.last()
    43 		<<"   loadMode="<<loadMode
    44 	//	<<"       line="<<QXmlDefaultHandler::lineNumber()
    45 		<<endl;
    46 	*/	
    47 	stateStack.append (state);	
    48     if ( state == StateInit && (eName == "vymmap")  ) 
    49 	{
    50         state = StateMap;
    51 		branchesTotal=branchesCurrent=0;
    52 
    53 		if (loadMode==NewMap )
    54 		{
    55 			// Create mapCenter
    56 			model->clear();
    57 			lastBranch=NULL;
    58 			lastBranchItem=NULL;
    59 
    60 			if (!atts.value( "author").isEmpty() )
    61 				model->setAuthor(atts.value( "author" ) );
    62 			if (!atts.value( "comment").isEmpty() )
    63 				model->setComment (atts.value( "comment" ) );
    64 			if (!atts.value( "branchCount").isEmpty() )
    65 			{
    66 				branchesTotal=atts.value("branchCount").toInt();
    67 				if (branchesTotal>10)
    68 				{
    69 					mainWindow->setProgressMinimum (0);
    70 					mainWindow->setProgressMaximum (branchesTotal);
    71 					mainWindow->setProgressValue(0);
    72 				}
    73 			} else
    74 			{
    75 				mainWindow->setProgressMinimum (0);
    76 				mainWindow->setProgressMaximum (0);
    77 				mainWindow->setProgressValue(0);
    78 			}
    79 
    80 				
    81 			if (!atts.value( "backgroundColor").isEmpty() )
    82 			{
    83 				col.setNamedColor(atts.value("backgroundColor"));
    84 				model->getScene()->setBackgroundBrush(col);
    85 			}	    
    86 			if (!atts.value( "selectionColor").isEmpty() )
    87 			{
    88 				col.setNamedColor(atts.value("selectionColor"));
    89 				model->setSelectionColor(col);
    90 			}	    
    91 			if (!atts.value( "linkColorHint").isEmpty() ) 
    92 			{
    93 				if (atts.value("linkColorHint")=="HeadingColor")
    94 					model->setMapLinkColorHint(LinkableMapObj::HeadingColor);
    95 				else
    96 					model->setMapLinkColorHint(LinkableMapObj::DefaultColor);
    97 			}
    98 			if (!atts.value( "linkStyle").isEmpty() ) 
    99 				model->setMapLinkStyle(atts.value("linkStyle"));
   100 			if (!atts.value( "linkColor").isEmpty() ) 
   101 			{
   102 				col.setNamedColor(atts.value("linkColor"));
   103 				model->setMapDefLinkColor(col);
   104 			}	
   105 			if (!atts.value( "defXLinkColor").isEmpty() ) 
   106 			{
   107 				col.setNamedColor(atts.value("defXLinkColor"));
   108 				model->setMapDefXLinkColor(col);
   109 			}	
   110 			if (!atts.value( "defXLinkWidth").isEmpty() ) 
   111 				model->setMapDefXLinkWidth(atts.value("defXLinkWidth").toInt ());
   112 		}	
   113 		// Check version
   114 		if (!atts.value( "version").isEmpty() ) 
   115 		{
   116 			if (!checkVersion(atts.value("version")))
   117 				QMessageBox::warning( 0, "Warning: Version Problem" ,
   118 				   "<h3>Map is newer than VYM</h3>"
   119 				   "<p>The map you are just trying to load was "
   120 				   "saved using vym " +atts.value("version")+". "
   121 				   "The version of this vym is " + vymVersion + 
   122 				   ". If you run into problems after pressing "
   123 				   "the ok-button below, updating vym should help.");
   124 			else	   
   125 				model->setVersion(atts.value( "version" ));
   126 
   127 		}
   128 
   129 	} else if ( eName == "select" && state == StateMap ) 
   130 	{
   131 		state=StateMapSelect;
   132 	} else if ( eName == "setting" && state == StateMap ) 
   133 	{
   134 		state=StateMapSetting;
   135 		if (loadMode==NewMap)
   136 			readSettingAttr (atts);
   137 	} else if ( eName == "mapcenter" && state == StateMap ) 
   138 	{
   139 		state=StateMapCenter;
   140 		if (loadMode==NewMap)
   141 		{	
   142 			// Really use the found mapcenter as MCO in a new map
   143 
   144 			model->createMapCenter(); 
   145 			lastBranch=model->getSelectedBranch();
   146 		} else
   147 		{
   148 			// Treat the found mapcenter as a branch 
   149 			// in an existing map
   150 			LinkableMapObj* lmo=model->getSelectedLMO();
   151 			if (lmo && ( (typeid(*lmo) == typeid(BranchObj) ) 
   152 			        || (typeid(*lmo) == typeid(MapCenterObj) ) ) )
   153 			{
   154 				lastBranch=(BranchObj*)lmo;
   155 				if (loadMode==ImportAdd)
   156 				{
   157 					model->createBranch();
   158 					lastBranch=model->getSelectedBranch();
   159 				} else
   160 					lastBranch->clear();
   161 			} else
   162 				return false;
   163 		}
   164 		readBranchAttr (atts);
   165 	} else if ( 
   166 		(eName == "standardflag" ||eName == "standardFlag") && 
   167 		(state == StateMapCenter || state==StateBranch)) 
   168 	{
   169 		state=StateStandardFlag;
   170 	} else if ( eName == "heading" && (state == StateMapCenter||state==StateBranch)) 
   171 	{
   172 		laststate=state;
   173 		state=StateHeading;
   174 		if (!atts.value( "textColor").isEmpty() ) 
   175 		{
   176 			col.setNamedColor(atts.value("textColor"));
   177 			lastBranch->setColor(col );
   178 		}	    
   179 	} else if ( eName == "note" && 
   180 				(state == StateMapCenter ||state==StateBranch))
   181 	{	// only for backward compatibility (<1.4.6). Use htmlnote now.
   182 		state=StateNote;
   183 		if (!readNoteAttr (atts) ) return false;
   184 	} else if ( eName == "htmlnote" && state == StateMapCenter) 
   185 	{
   186 		laststate=state;
   187 		state=StateHtmlNote;
   188     } else if ( eName == "floatimage" && 
   189 				(state == StateMapCenter ||state==StateBranch)) 
   190 	{
   191 		state=StateFloatImage;
   192         lastBranch->addFloatImage();
   193 		lastFloat=lastBranch->getLastFloatImage();
   194 		if (!readFloatImageAttr(atts)) return false;
   195 	} else if ( (eName == "branch"||eName=="floatimage") && state == StateMap) 
   196 	{
   197 		// This is used in vymparts, which have no mapcenter!
   198 		isVymPart=true;
   199 		LinkableMapObj* lmo=model->getSelectedLMO();
   200 		if (!lmo)
   201 		{
   202 			// If a vym part is _loaded_ (not imported), 
   203 			// selection==lmo==NULL
   204 			// Treat it like ImportAdd then...
   205 			loadMode=ImportAdd;
   206 			// FIXME-3 lmo=model->first()->getLMO();		
   207 			// Do we really have no MCO when loading?????
   208 			cout << "xml-vym aborted\n";
   209 		}	
   210 		if (lmo && ( (typeid(*lmo) == typeid(BranchObj) ) 
   211 				|| (typeid(*lmo) == typeid(MapCenterObj) ) ) )
   212 		{
   213 			lastBranch=(BranchObj*)(lmo);
   214 			if (eName=="branch")
   215 			{
   216 				state=StateBranch;
   217 				if (loadMode==ImportAdd)
   218 				{
   219 					model->createBranch();
   220 					lastBranch=model->getSelectedBranch();
   221 					
   222 				} else
   223 					lastBranch->clear();
   224 				readBranchAttr (atts);
   225 			} else if (eName=="floatimage")
   226 			{
   227 				state=StateFloatImage;
   228 				lastBranch->addFloatImage();
   229 				lastFloat=lastBranch->getLastFloatImage();
   230 				if (!readFloatImageAttr(atts)) return false;
   231 			} else return false;
   232 		} else return false;
   233 	} else if ( eName == "branch" && state == StateMapCenter) 
   234 	{
   235 		state=StateBranch;
   236 		model->createBranch();
   237 		lastBranch=model->getSelectedBranch();
   238 		readBranchAttr (atts);
   239 	} else if ( eName == "htmlnote" && state == StateBranch) 
   240 	{
   241 		laststate=state;
   242 		state=StateHtmlNote;
   243 		no.clear();
   244 		if (!atts.value( "fonthint").isEmpty() ) 
   245 			no.setFontHint(atts.value ("fonthint") );
   246 	} else if ( eName == "frame" && (state == StateBranch||state==StateMapCenter)) 
   247 	{
   248 		laststate=state;
   249 		state=StateFrame;
   250 		if (!readFrameAttr(atts)) return false;
   251     } else if ( eName == "xlink" && state == StateBranch ) 
   252 	{
   253 		state=StateBranchXLink;
   254 		if (!readXLinkAttr (atts)) return false;
   255     } else if ( eName == "branch" && state == StateBranch ) 
   256 	{
   257 		model->createBranch();
   258 		lastBranch=model->getSelectedBranch();
   259 		readBranchAttr (atts);
   260     } else if ( eName == "html" && state == StateHtmlNote ) 
   261 	{
   262 		state=StateHtml;
   263 		htmldata="<"+eName;
   264 		readHtmlAttr(atts);
   265 		htmldata+=">";
   266     } else if ( state == StateHtml ) 
   267 	{
   268 		// accept all while in html mode,
   269 		htmldata+="<"+eName;
   270 		readHtmlAttr(atts);
   271 		htmldata+=">";
   272     } else
   273         return false;   // Error
   274     return true;
   275 }
   276 
   277 bool parseVYMHandler::endElement  ( const QString&, const QString&, const QString &eName)
   278 {
   279 	/* Testing
   280 	cout << "endElement </" <<qPrintable(eName)
   281 		<<">  state=" <<state 
   282 		<<"  laststate=" <<laststate
   283 		<<"  stateStack="<<stateStack.last() 
   284 		<<endl;
   285 	*/
   286     switch ( state ) 
   287 	{
   288 		case StateMap:
   289 			mainWindow->removeProgressBar();
   290 			break;
   291         case StateBranch: 
   292 			model->selectParent();
   293 			lastBranch=model->getSelectedBranch();
   294             break;
   295         case StateHtml: 
   296 			htmldata+="</"+eName+">";
   297 			if (eName=="html")
   298 			{
   299 				state=StateHtmlNote;  
   300 				htmldata.replace ("<br></br>","<br />");
   301 				no.setNote (htmldata);
   302 				lastBranch->getTreeItem()->setNoteObj (no);
   303 			}	
   304 			break;
   305 		default: 
   306 			break;
   307     }  
   308 	state=stateStack.takeLast();	
   309 	return true;
   310 }
   311 
   312 bool parseVYMHandler::characters   ( const QString& ch)
   313 {
   314 	//cout << "characters \""<<ch<<"\"  state="<<state <<"  laststate="<<laststate<<endl;
   315 
   316 	QString ch_org=quotemeta (ch);
   317     QString ch_simplified=ch.simplifyWhiteSpace();
   318     if ( ch_simplified.isEmpty() ) return true;
   319 
   320     switch ( state ) 
   321     {
   322         case StateInit: break;
   323         case StateMap: break; 
   324 		case StateMapSelect:
   325 			model->select(ch_simplified);
   326 			break;
   327 		case StateMapSetting:break;
   328         case StateMapCenter: break;
   329         case StateNote:
   330 			lastBranch->getTreeItem()->setNote(ch_simplified);
   331 			break;
   332         case StateBranch: break;
   333         case StateStandardFlag: 
   334             lastBranch->activateStandardFlag(ch_simplified); 
   335             break;
   336         case StateFloatImage: break;
   337         case StateHtmlNote: break;
   338         case StateHtml:
   339 			htmldata+=ch_org;
   340 			break;
   341         case StateHeading: 
   342             model->setHeading(ch_simplified);
   343             break;
   344         default: 
   345 			return false;
   346     }
   347     return true;
   348 }
   349 
   350 QString parseVYMHandler::errorString() 
   351 {
   352     return "the document is not in the VYM file format";
   353 }
   354 
   355 bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a)
   356 {
   357 	branchesCurrent++;
   358 	mainWindow->setProgressValue (branchesCurrent);
   359 	lastOO=lastBranch;
   360 	lastBranchItem=(BranchItem*)(lastBranch->getTreeItem());
   361 
   362 	if (!readOOAttr(a)) return false;
   363 
   364 	if (!a.value( "scrolled").isEmpty() )
   365 		lastBranchItem->toggleScroll();
   366 	if (!a.value( "frameType").isEmpty() ) 
   367 		lastOO->setFrameType (a.value("frameType")); //Compatibility 1.8.1
   368 
   369 	if (!a.value( "incImgV").isEmpty() ) 
   370 	{	
   371 		if (a.value("incImgV")=="true")
   372 			lastBranch->setIncludeImagesVer(true);
   373 		else	
   374 			lastBranch->setIncludeImagesVer(false);
   375 	}	
   376 	if (!a.value( "incImgH").isEmpty() ) 
   377 	{	
   378 		if (a.value("incImgH")=="true")
   379 			lastBranch->setIncludeImagesHor(true);
   380 		else	
   381 			lastBranch->setIncludeImagesHor(false);
   382 	}	
   383 	return true;	
   384 }
   385 
   386 bool parseVYMHandler::readFrameAttr (const QXmlAttributes& a)
   387 {
   388 	bool ok;
   389 	int x;
   390 	if (lastOO)
   391 	{
   392 		if (!a.value( "frameType").isEmpty() ) 
   393 			lastOO->setFrameType (a.value("frameType"));
   394 		if (!a.value( "penColor").isEmpty() ) 
   395 			lastOO->setFramePenColor (a.value("penColor"));
   396 		if (!a.value( "brushColor").isEmpty() ) 
   397 			lastOO->setFrameBrushColor (a.value("brushColor"));
   398 		if (!a.value( "padding").isEmpty() ) 
   399 		{
   400 			x=a.value("padding").toInt(&ok);
   401 			if (ok) lastOO->setFramePadding(x);
   402 		}	
   403 		if (!a.value( "borderWidth").isEmpty() ) 
   404 		{
   405 			x=a.value("borderWidth").toInt(&ok);
   406 			if (ok) lastOO->setFrameBorderWidth(x);
   407 		}	
   408 	}		
   409 	return true;
   410 }
   411 
   412 bool parseVYMHandler::readOOAttr (const QXmlAttributes& a)
   413 {
   414 	if (lastOO)
   415 	{
   416 		bool okx,oky;
   417 		float x,y;
   418 		if (!a.value( "relPosX").isEmpty() ) 
   419 		{
   420 			if (!a.value( "relPosY").isEmpty() ) 
   421 			{
   422 				x=a.value("relPosX").toFloat (&okx);
   423 				y=a.value("relPosY").toFloat (&oky);
   424 				if (okx && oky  )
   425 				{
   426 					lastOO->setUseRelPos (true);
   427 					lastOO->move2RelPos (x,y);
   428 				}	
   429 				else
   430 					return false;   // Couldn't read relPos
   431 			}           
   432 		}           
   433 		if (!a.value( "absPosX").isEmpty() && loadMode==NewMap ) 
   434 		{
   435 			if (!a.value( "absPosY").isEmpty() ) 
   436 			{
   437 				x=a.value("absPosX").toFloat (&okx);
   438 				y=a.value("absPosY").toFloat (&oky);
   439 				if (okx && oky  )
   440 					lastOO->move(x,y);
   441 				else
   442 					return false;   // Couldn't read absPos
   443 			}           
   444 		}           
   445 		if (!a.value( "id").isEmpty() ) 
   446 			lastOO->setID (a.value ("id"));
   447 		if (!a.value( "url").isEmpty() ) 
   448 			lastOO->setURL (a.value ("url"));
   449 		if (!a.value( "vymLink").isEmpty() ) 
   450 			lastOO->setVymLink (a.value ("vymLink"));
   451 		if (!a.value( "hideInExport").isEmpty() ) 
   452 			if (a.value("hideInExport")=="true")
   453 				lastOO->setHideInExport(true);
   454 
   455 		if (!a.value( "hideLink").isEmpty()) 
   456 		{
   457 			if (a.value ("hideLink") =="true")
   458 				lastOO->setHideLinkUnselected(true);
   459 			else	
   460 				lastOO->setHideLinkUnselected(false);
   461 		}	
   462 	}
   463 	return true;	
   464 }
   465 
   466 bool parseVYMHandler::readNoteAttr (const QXmlAttributes& a)
   467 {	// only for backward compatibility (<1.4.6). Use htmlnote now.
   468 	no.clear();
   469 	QString fn;
   470 	if (!a.value( "href").isEmpty() ) 
   471 	{
   472 		// Load note
   473 		fn=parseHREF(a.value ("href") );
   474 		QFile file (fn);
   475 		QString s;						// Reading a note
   476 
   477 		if ( !file.open( QIODevice::ReadOnly) )
   478 		{
   479 			qWarning ("parseVYMHandler::readNoteAttr:  Couldn't load "+fn);
   480 			return false;
   481 		}	
   482 		QTextStream stream( &file );
   483 		QString lines;
   484 		while ( !stream.atEnd() ) {
   485 			lines += stream.readLine()+"\n"; 
   486 		}
   487 		file.close();
   488 
   489 		lines ="<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>"+lines + "</p></body></html>";
   490 		no.setNote (lines);
   491 	}		
   492 	if (!a.value( "fonthint").isEmpty() ) 
   493 		no.setFontHint(a.value ("fonthint") );
   494 	lastBranch->getTreeItem()->setNoteObj(no);
   495 	return true;
   496 }
   497 
   498 bool parseVYMHandler::readFloatImageAttr (const QXmlAttributes& a)
   499 {
   500 	lastOO=lastFloat;
   501 	
   502 	//if (!readOOAttr(a)) return false;
   503 
   504 	if (!a.value( "useOrientation").isEmpty() ) 
   505 	{
   506 		if (a.value ("useOrientation") =="true")
   507 			lastFloat->setUseOrientation (true);
   508 		else	
   509 			lastFloat->setUseOrientation (false);
   510 	}	
   511 	if (!a.value( "href").isEmpty() )
   512 	{
   513 		// Load FloatImage
   514 		if (!lastFloat->load (parseHREF(a.value ("href") ) ))
   515 		{
   516 			QMessageBox::warning( 0, "Warning: " ,
   517 				"Couldn't load float image\n"+parseHREF(a.value ("href") ));
   518 			lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
   519 			lastFloat=NULL;
   520 			return true;
   521 		}
   522 		
   523 	}	
   524 	if (!a.value( "floatExport").isEmpty() ) 
   525 	{
   526 		// Only for compatibility. THis is not used since 1.7.11 
   527 		if (a.value ("floatExport") =="true")
   528 			lastFloat->setFloatExport(true);
   529 		else	
   530 			lastFloat->setFloatExport (false);
   531 	}	
   532 	if (!a.value( "zPlane").isEmpty() ) 
   533 		lastFloat->setZValue (a.value("zPlane").toInt ());
   534     float x,y;
   535     bool okx,oky;
   536 	if (!a.value( "relPosX").isEmpty() ) 
   537 	{
   538 		if (!a.value( "relPosY").isEmpty() ) 
   539 		{
   540 			// read relPos
   541 			x=a.value("relPosX").toFloat (&okx);
   542 			y=a.value("relPosY").toFloat (&oky);
   543 			if (okx && oky) 
   544 				
   545 				{
   546 					lastFloat->setRelPos (QPointF (x,y) );
   547 					// make sure floats in mapcenter are repositioned to relative pos
   548 					if (lastBranch->getDepth()==0) lastBranch->positionContents();
   549 				}
   550 			else
   551 				// Couldn't read relPos
   552 				return false;  
   553 		}           
   554 	}	
   555 	
   556 	if (!readOOAttr(a)) return false;
   557 
   558 	if (!a.value ("orgName").isEmpty() )
   559 	{
   560 		((FloatImageObj*)(lastFloat))->setOriginalFilename (a.value("orgName"));
   561 	}
   562 	return true;
   563 }
   564 
   565 bool parseVYMHandler::readXLinkAttr (const QXmlAttributes& a)
   566 {
   567 	QColor col;
   568 	bool okx;
   569 	bool success=false;
   570 	XLinkObj *xlo=new XLinkObj (model->getScene());
   571 	if (!a.value( "color").isEmpty() ) 
   572 	{
   573 		col.setNamedColor(a.value("color"));
   574 		xlo->setColor (col);
   575 	}
   576 
   577 	if (!a.value( "width").isEmpty() ) 
   578 	{
   579 		xlo->setWidth(a.value ("width").toInt (&okx, 10));
   580 	}
   581 
   582 	// Connecting by select string for compatibility with version < 1.8.76
   583 	if (!a.value( "beginBranch").isEmpty() ) 
   584 	{ 
   585 		if (!a.value( "endBranch").isEmpty() ) 
   586 		{
   587 			LinkableMapObj *lmo=model->findObjBySelect (a.value( "beginBranch"));
   588 			if (lmo && typeid (*lmo)==typeid (BranchObj))
   589 			{
   590 				xlo->setBegin ((BranchObj*)lmo);
   591 				lmo=model->findObjBySelect (a.value( "endBranch"));
   592 				if (lmo && typeid (*lmo)==typeid (BranchObj))
   593 				{
   594 					xlo->setEnd ((BranchObj*)(lmo));
   595 					xlo->activate();
   596 					success=true;
   597 				}
   598 			}
   599 		}           
   600 	}	
   601 
   602 	// object ID is used starting in version 1.8.76
   603 	if (!a.value( "beginID").isEmpty() ) 
   604 	{ 
   605 		if (!a.value( "endID").isEmpty() ) 
   606 		{
   607 			LinkableMapObj *lmo=model->findID (a.value( "beginID"));
   608 			if (lmo && typeid (*lmo)==typeid (BranchObj))
   609 			{
   610 				xlo->setBegin ((BranchObj*)lmo);
   611 				lmo=model->findID (a.value( "endID"));
   612 				if (lmo && typeid (*lmo)==typeid (BranchObj))
   613 				{
   614 					xlo->setEnd ((BranchObj*)(lmo));
   615 					xlo->activate();
   616 					success=true;
   617 				}
   618 			}
   619 		}           
   620 	}	
   621 	if (!success) delete (xlo);
   622 	return true;	// xLinks can only be established at the "end branch", return true
   623 }
   624 
   625 bool parseVYMHandler::readHtmlAttr (const QXmlAttributes& a)
   626 {
   627 	for (int i=1; i<=a.count(); i++)
   628 		htmldata+=" "+a.localName(i-1)+"=\""+a.value(i-1)+"\"";
   629 	return true;
   630 }
   631 
   632 bool parseVYMHandler::readSettingAttr (const QXmlAttributes& a)
   633 {
   634 	if (!a.value( "key").isEmpty() ) 
   635 	{
   636 		if (!a.value( "value").isEmpty() ) 
   637 			settings.setLocalEntry (model->getDestPath(), a.value ("key"), a.value ("value"));
   638 		else
   639 			return false;
   640 		
   641 	} else
   642 		return false;
   643 	
   644 	return true;
   645 }