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