xml-freemind.cpp
changeset 574 56fa27b2be3e
parent 566 ebebedffba50
child 647 bef71af3f6ab
     1.1 --- a/xml-freemind.cpp	Mon Jul 30 09:47:12 2007 +0000
     1.2 +++ b/xml-freemind.cpp	Mon Jul 30 09:47:13 2007 +0000
     1.3 @@ -19,14 +19,7 @@
     1.4  
     1.5  extern QString flagsPath;
     1.6  
     1.7 -parseFMHandler::parseFMHandler() {}
     1.8 -
     1.9 -parseFMHandler::~parseFMHandler() {}
    1.10 -
    1.11 -QString parseFMHandler::errorProtocol() { return errorProt; }
    1.12 -
    1.13 -
    1.14 -bool parseFMHandler::startDocument()
    1.15 +bool parseFreemindHandler::startDocument()
    1.16  {
    1.17      errorProt = "";
    1.18      state = StateInit;
    1.19 @@ -34,13 +27,12 @@
    1.20  	stateStack.clear();
    1.21  	stateStack.append(StateInit);
    1.22      branchDepth=0;
    1.23 -	htmldata="";
    1.24  	isVymPart=false;
    1.25      return true;
    1.26  }
    1.27  
    1.28  
    1.29 -QString parseFMHandler::parseHREF(QString href)
    1.30 +QString parseFreemindHandler::parseHREF(QString href)
    1.31  {
    1.32  	QString type=href.section(":",0,0);
    1.33  	QString path=href.section(":",1,1);
    1.34 @@ -50,7 +42,7 @@
    1.35  		return tmpDir + path;
    1.36  }
    1.37  
    1.38 -bool parseFMHandler::startElement  ( const QString&, const QString&,
    1.39 +bool parseFreemindHandler::startElement  ( const QString&, const QString&,
    1.40                      const QString& eName, const QXmlAttributes& atts ) 
    1.41  {
    1.42      QColor col;
    1.43 @@ -148,7 +140,7 @@
    1.44  			else if (f=="button_cancel")
    1.45  				v="cross-red"; 
    1.46  			else if (f.contains("full-"))
    1.47 -				v=f.replace("full-","freemind-priority-"); //FIXME
    1.48 +				v=f.replace("full-","freemind-priority-"); 
    1.49  			else if (f=="back")
    1.50  				v="freemind-back"; 
    1.51  			else if (f=="forward")
    1.52 @@ -208,7 +200,7 @@
    1.53      return true;
    1.54  }
    1.55  
    1.56 -bool parseFMHandler::endElement  ( const QString&, const QString&, const QString &eName)
    1.57 +bool parseFreemindHandler::endElement  ( const QString&, const QString&, const QString &eName)
    1.58  {
    1.59  	/* Testing
    1.60  	cout << "endElement </" <<eName.ascii()
    1.61 @@ -229,7 +221,7 @@
    1.62  	return true;
    1.63  }
    1.64  
    1.65 -bool parseFMHandler::characters   ( const QString& ch)
    1.66 +bool parseFreemindHandler::characters   ( const QString& ch)
    1.67  {
    1.68  	//cout << "characters \""<<ch.ascii()<<"\"  state="<<state <<"  laststate="<<laststate<<endl;
    1.69  
    1.70 @@ -257,59 +249,12 @@
    1.71      return true;
    1.72  }
    1.73  
    1.74 -QString parseFMHandler::errorString() 
    1.75 +QString parseFreemindHandler::errorString() 
    1.76  {
    1.77 -    return "the document is not in the VYM file format";
    1.78 +    return "the document is not in the Freemind file format";
    1.79  }
    1.80  
    1.81 -bool parseFMHandler::fatalError( const QXmlParseException& exception ) 
    1.82 -{
    1.83 -    errorProt += QString( "Fatal parsing error: %1 in line %2, column %3\n")
    1.84 -    .arg( exception.message() )
    1.85 -    .arg( exception.lineNumber() )
    1.86 -    .arg( exception.columnNumber() );
    1.87 -	// Try to read the bogus line
    1.88 -	errorProt+=QString("File is: %1\n").arg(inputFile);
    1.89 -	QString s;
    1.90 -	if (loadStringFromDisk (inputFile,s))
    1.91 -	{
    1.92 -		QStringList sl=QStringList::split ("\n",s);
    1.93 -		int i=1;
    1.94 -		QStringList::Iterator it = sl.begin();
    1.95 -		while (i<exception.lineNumber())
    1.96 -		{
    1.97 -			it++;
    1.98 -			i++;
    1.99 -		}
   1.100 -		s=*it;
   1.101 -		s.insert (exception.columnNumber()-1,"<ERROR>");
   1.102 -		errorProt+=s;
   1.103 -    }
   1.104 -    return QXmlDefaultHandler::fatalError( exception );
   1.105 -}
   1.106 -
   1.107 -void parseFMHandler::setMapEditor (MapEditor* e)
   1.108 -{
   1.109 -    me=e;
   1.110 -	mc=me->getMapCenter();
   1.111 -}
   1.112 -
   1.113 -void parseFMHandler::setTmpDir (QString tp)
   1.114 -{
   1.115 -	tmpDir=tp;
   1.116 -}
   1.117 -
   1.118 -void parseFMHandler::setInputFile (QString f)
   1.119 -{
   1.120 -	inputFile=f;
   1.121 -}
   1.122 -
   1.123 -void parseFMHandler::setLoadMode (const LoadMode &lm)
   1.124 -{
   1.125 -	loadMode=lm;
   1.126 -}
   1.127 -
   1.128 -bool parseFMHandler::readNodeAttr (const QXmlAttributes& a)
   1.129 +bool parseFreemindHandler::readNodeAttr (const QXmlAttributes& a)
   1.130  {
   1.131  	lastOO=lastBranch;
   1.132