Source Code (Use browser search to find items of interest.)

Class Index

kformula'KFormulaDocument (./koffice/kformula/notsoold/kformula_doc.h:122)

class KFormulaDocument : public QObject,
			 virtual public KoDocument,
			 virtual public KFormula::Document_skel
{
    Q_OBJECT
 public:
    // C++
    KFormulaDocument();
    ~KFormulaDocument();

    int getPos();
    void setCursor(QRect re);
    void setCurrent(int cur);
    int getCurrent();
    int addBlock( int Type = -1, int ID = -1, int nextID = -1, int prevID = -1,
		  QString Cont = "", int Child1 = -1, int Child2 = -1, int Child3 = -1 );
    void checkAndCreate( FormulaBlock *bl );
    void deleteIt( FormulaBlock *bl );

    FormulaBlock *Blocks[2000];
    bool isFree[2000];
    int firstfree;
    int corr, xOff, yOff;
    QString name;

    /**
     * This is just a hack til view and doc are really split
     */
    void mousePressEvent(QMouseEvent *a,  QWidget *wid); 
    void paintEvent( QPaintEvent *_ev, QWidget *paintGround );
    void keyPressEvent( QKeyEvent *k );
 protected:
    virtual void cleanUp();
    /**
     * We dont have embedded parts or binary data => No multipart files needed.
     */
    virtual bool hasToWriteMultipart() { return false; }
  
 public:
    // IDL
    virtual CORBA::Boolean init();

    // C++
    virtual bool load( KOMLParser& parser );
    /**
     * We dont load any children.
     */
    virtual bool loadChildren( OPParts::MimeMultipartDict_ptr _dict ) { return true; }
    virtual bool save( ostream& out );

    // IDL
    virtual OPParts::View_ptr createView();

    virtual void viewList( OPParts::Document::ViewList*& _list );

    virtual char* mimeType() { return CORBA::string_dup( MIME_TYPE ); }
  
    virtual CORBA::Boolean isModified() { return m_bModified; }
 
    // C++
    virtual void addView( KFormulaView *_view );
    virtual void removeView( KFormulaView *_view );

    void emitModified();

    // IDL
    void setGreek( bool on );
    void change( const char * newcont );
    void addB0();
    void addB1();
    void addB2();
    void addB3();
    void addB4();
    void addB5();
    void addB4bis();
    void line( int i );
    void addCh1();
    void addCh2();
    void addCh3();
    void pro();
    void dele();
    void reduceAll();
    void reduce();
    void reduceRecur();
    void enlargeAll();
    void enlarge();
    void enlargeRecur();

 signals:
    void sig_modified();

    void sig_changeText( const char * );
    void sig_changeType( int );
  
 protected:
    QList<KFormulaView> m_lstViews;

    bool m_bModified;

    QPainter *painter; 
    // QTimer *cursorTimer;
    int current;
    int pos;
    QRect cursorPos;
    bool isBlack;
    bool showIt;

};

kformula'KFormulaDocument::KFormulaDocument() (./koffice/kformula/notsoold/kformula_doc.cc:22)

KFormulaDocument::KFormulaDocument()
{
    // Use CORBA mechanism for deleting views
    m_lstViews.setAutoDelete( false );

    m_bModified = false;
    Blocks[0] = new FormulaBlock(this,-1,0,-1,-1,"");
    for(firstfree=1;firstfree<2000;firstfree++)
	isFree[firstfree] = true;
    // Blocks[firstfree]=NULL;
    isFree[0]=false;
    firstfree=1;
    pos = current = 0;
}

CORBA::Boolean KFormulaDocument::init()
{
    return true;
}


kformula'KFormulaDocument::~KFormulaDocument() (./koffice/kformula/notsoold/kformula_doc.cc:42)

KFormulaDocument::~KFormulaDocument()
{
    cleanUp();
}


kformula'KFormulaDocument::cleanUp() (./koffice/kformula/notsoold/kformula_doc.cc:47)

void KFormulaDocument::cleanUp()
{
    if ( m_bIsClean )
	return;

    assert( m_lstViews.count() == 0 );
  
    Document_impl::cleanUp();
}


kformula'KFormulaDocument::load() (./koffice/kformula/notsoold/kformula_doc.cc:57)

bool KFormulaDocument::load( KOMLParser& parser )
{
    // HACK
    return false;
}


kformula'KFormulaDocument::save() (./koffice/kformula/notsoold/kformula_doc.cc:63)

bool KFormulaDocument::save( ostream &out )
{
    out << "<?xml version=\"1.0\"?>" << endl;
    out << otag << "<DOC author=\"" << "Torben Weis" << "\" email=\"" 
	<< "weis@kde.org" << "\" editor=\"" << "KFormula" 
	<< "\" mime=\"" << MIME_TYPE << "\" >" << endl;
    out << etag << "</DOC>" << endl;
  
    return true;
}


kformula'KFormulaDocument::viewList() (./koffice/kformula/notsoold/kformula_doc.cc:74)

void KFormulaDocument::viewList( OPParts::Document::ViewList*& _list )
{
    (*_list).length( m_lstViews.count() );

    int i = 0;
    QListIterator<KFormulaView> it( m_lstViews );
    for( ; it.current(); ++it )
	{
	    (*_list)[i++] = OPParts::View::_duplicate( it.current() );
	}
}


kformula'KFormulaDocument::addView() (./koffice/kformula/notsoold/kformula_doc.cc:86)

void KFormulaDocument::addView( KFormulaView *_view )
{
    m_lstViews.append( _view );
}


kformula'KFormulaDocument::removeView() (./koffice/kformula/notsoold/kformula_doc.cc:91)

void KFormulaDocument::removeView( KFormulaView *_view )
{
    m_lstViews.setAutoDelete( false );
    m_lstViews.removeRef( _view );
    m_lstViews.setAutoDelete( true );
}

OPParts::View_ptr KFormulaDocument::createView()
{
    KFormulaView *p = new KFormulaView( 0L );
    p->setDocument( this );
  
    return OPParts::View::_duplicate( p );
}


kformula'KFormulaDocument::emitModified() (./koffice/kformula/notsoold/kformula_doc.cc:106)

void KFormulaDocument::emitModified()
{
    emit sig_modified();
}


kformula'KFormulaDocument::getPos() (./koffice/kformula/notsoold/kformula_doc.cc:111)

int KFormulaDocument::getPos()
{
    return pos;
}


kformula'KFormulaDocument::setCurrent() (./koffice/kformula/notsoold/kformula_doc.cc:116)

void KFormulaDocument::setCurrent(int cur)
{
    if( current != cur )
	pos = Blocks[cur]->getcont().length();
    Blocks[current]->setactive(0);
    Blocks[cur]->setactive(1); 
    current = cur; 

    emit sig_changeText( Blocks[cur]->getcont() );  //Signals
    emit sig_changeType( Blocks[cur]->gettype() );
}


kformula'KFormulaDocument::getCurrent() (./koffice/kformula/notsoold/kformula_doc.cc:128)

int KFormulaDocument::getCurrent()
{
    return ( current );
}


kformula'KFormulaDocument::setCursor() (./koffice/kformula/notsoold/kformula_doc.cc:133)

void KFormulaDocument::setCursor( QRect re )
{
    cursorPos = re;
}


kformula'KFormulaDocument::setGreek() (./koffice/kformula/notsoold/kformula_doc.cc:138)

void KFormulaDocument::setGreek( bool _on )
{
    if ( _on ) 
	Blocks[getCurrent()]->fontc.setFamily("Symbol");	
    else 
	Blocks[getCurrent()]->fontc.setFamily("utopia");

    emit sig_modified();
}


kformula'KFormulaDocument::change() (./koffice/kformula/notsoold/kformula_doc.cc:148)

void KFormulaDocument::change( const char * newcont )
{
    if ( Blocks[getCurrent()]->gettype() == -1 )
	Blocks[getCurrent()]->settype(0);
    Blocks[getCurrent()]->setcont(newcont);

    emit sig_modified();
}


kformula'KFormulaDocument::reduce() (./koffice/kformula/notsoold/kformula_doc.cc:157)

void KFormulaDocument::reduce()
{   
    Blocks[getCurrent()]->reduceFont(0);
    emit sig_modified();
}


kformula'KFormulaDocument::reduceRecur() (./koffice/kformula/notsoold/kformula_doc.cc:163)

void KFormulaDocument::reduceRecur()
{   
    Blocks[getCurrent()]->reduceFont(1);
    emit sig_modified();
}

kformula'KFormulaDocument::reduceAll() (./koffice/kformula/notsoold/kformula_doc.cc:168)

void KFormulaDocument::reduceAll()
{   
    Blocks[getCurrent()]->reduceFont(2);
    emit sig_modified();
}


kformula'KFormulaDocument::enlarge() (./koffice/kformula/notsoold/kformula_doc.cc:174)

void KFormulaDocument::enlarge()
{   
    Blocks[getCurrent()]->enlargeFont(0);
    emit sig_modified();
}

kformula'KFormulaDocument::enlargeRecur() (./koffice/kformula/notsoold/kformula_doc.cc:179)

void KFormulaDocument::enlargeRecur()
{   
    Blocks[getCurrent()]->enlargeFont(1);
    emit sig_modified();
}

kformula'KFormulaDocument::enlargeAll() (./koffice/kformula/notsoold/kformula_doc.cc:184)

void KFormulaDocument::enlargeAll()
{   
    Blocks[getCurrent()]->enlargeFont(2);
    emit sig_modified();
}


kformula'KFormulaDocument::addCh3() (./koffice/kformula/notsoold/kformula_doc.cc:190)

void KFormulaDocument::addCh3()
{   
    warning("Add Ch3");
    int nextold=Blocks[getCurrent()]->getchild3();
    int Id=addBlock(-1,-1,nextold,getCurrent(),"");
    Blocks[getCurrent()]->setchild3(Id);
    if( Blocks[getCurrent()]->gettype() == 2 )
	Blocks[Id]->reduceFont(1);    
    setCurrent(Id);	
    emit sig_modified();
}


kformula'KFormulaDocument::line() (./koffice/kformula/notsoold/kformula_doc.cc:202)

void KFormulaDocument::line(int i)
{   
    if( i == 1 )
	Blocks[getCurrent()]->setcont("line");
    else        
	Blocks[getCurrent()]->setcont("vertical space");
    emit sig_modified();
}


kformula'KFormulaDocument::addCh2() (./koffice/kformula/notsoold/kformula_doc.cc:211)

void KFormulaDocument::addCh2()
{   
    warning("Add Ch2");
    int nextold=Blocks[getCurrent()]->getchild2();
    int Id=addBlock(-1,-1,nextold,getCurrent(),"");
    Blocks[getCurrent()]->setchild2(Id); 
    if( Blocks[getCurrent()]->gettype() < 4 )
	Blocks[Id]->reduceFont(1);    
    setCurrent(Id);	
    emit sig_modified();
}

kformula'KFormulaDocument::addCh1() (./koffice/kformula/notsoold/kformula_doc.cc:222)

void KFormulaDocument::addCh1()
{
       warning("Add Ch1");
    int nextold=Blocks[getCurrent()]->getchild1();
    int Id=addBlock(-1,-1,nextold,getCurrent(),"");
    Blocks[getCurrent()]->setchild1(Id); 	
    if( Blocks[getCurrent()]->gettype() == 0 )
	Blocks[Id]->reduceFont(1);    
    setCurrent(Id);
    emit sig_modified();
}


kformula'KFormulaDocument::pro() (./koffice/kformula/notsoold/kformula_doc.cc:234)

void KFormulaDocument::pro()
{   
    // HACK
    /*
      new ProData(Blocks[getCurrent()],this);  //proprieties
      checkAndCreate(Blocks[getCurrent()]);
      ChText(Blocks[getCurrent()]->getcont());
      ChType(Blocks[getCurrent()]->gettype());
      setFocus(); 
      update();   */       
}


kformula'KFormulaDocument::dele() (./koffice/kformula/notsoold/kformula_doc.cc:246)

void KFormulaDocument::dele()
{   
    deleteIt( Blocks[ getCurrent() ] );
}


kformula'KFormulaDocument::addB1() (./koffice/kformula/notsoold/kformula_doc.cc:251)

void KFormulaDocument::addB1()
{   
    int cur=getCurrent();
    int Id=cur;
    if( Blocks[cur]->gettype() != -1 )
	{
	    int nextold=Blocks[cur]->getnext();
	    Id = addBlock(1,-1,nextold,cur,"c");
	    Blocks[cur]->setnext(Id);
	}
    else 
	{
	    Blocks[cur]->settype(1);
	    checkAndCreate(Blocks[cur]);
	}
    setCurrent(Blocks[Id]->getchild1());
    emit sig_modified();
}


kformula'KFormulaDocument::addB2() (./koffice/kformula/notsoold/kformula_doc.cc:270)

void KFormulaDocument::addB2()
{   
    int cur=getCurrent();
    int Id=cur;
    if( Blocks[cur]->gettype() != -1 )
	{
	    int nextold=Blocks[cur]->getnext();
	    Id=addBlock(2,-1,nextold,cur,"c");
	    Blocks[cur]->setnext(Id);
	}
    else
	{
	    Blocks[cur]->settype(2);
	    checkAndCreate(Blocks[cur]);
	}
    setCurrent(Blocks[Id]->getchild1());	
    emit sig_modified();
}


kformula'KFormulaDocument::addB0() (./koffice/kformula/notsoold/kformula_doc.cc:289)

void KFormulaDocument::addB0()
{   
warning("call");
    int cur=getCurrent();
    warning("get cur");
    int nextold=Blocks[cur]->getnext();
    int Id=addBlock(-1,-1,nextold,cur,"");
    Blocks[cur]->setnext(Id); 
    warning("Aggiungo Block type 0");
    setCurrent(Id);	
    warning("Current ID impostato");
    emit sig_modified();
    warning("Sig emitted");
}


kformula'KFormulaDocument::addB5() (./koffice/kformula/notsoold/kformula_doc.cc:304)

void KFormulaDocument::addB5()
{   
    int cur=getCurrent();
    int Id=cur;
    if( Blocks[cur]->gettype() != -1 )
	{ 
	    int nextold=Blocks[cur]->getnext();
	    Id=addBlock(5,-1,nextold,cur,"");
	    Blocks[cur]->setnext(Id);
	}
    else
	{    
	    Blocks[cur]->settype(5);
	    Blocks[cur]->setcont(">");
	    checkAndCreate(Blocks[cur]);
	} 
    setCurrent(Blocks[Id]->getchild1());	
    emit sig_modified();
}


kformula'KFormulaDocument::addB4() (./koffice/kformula/notsoold/kformula_doc.cc:324)

void KFormulaDocument::addB4()
{   
    int nextold=-1; 
    int Id,cur;
    cur=getCurrent();
    Id=cur;
    if ( Blocks[cur]->gettype() != -1 )
	{
	    nextold=Blocks[cur]->getnext();
	    Id=addBlock(4,-1,nextold,cur,"line");
	    Blocks[cur]->setnext(Id);
	}
    else
	{
	    Blocks[cur]->settype(4);
	    Blocks[cur]->setcont("line");
	    checkAndCreate(Blocks[cur]);
	}
    setCurrent(Blocks[Id]->getchild1());	
    emit sig_modified();
}

kformula'KFormulaDocument::addB4bis() (./koffice/kformula/notsoold/kformula_doc.cc:345)

void KFormulaDocument::addB4bis()
{   
    int nextold=-1; 
    int Id,cur;
    cur=getCurrent();
    Id=cur;
    if( Blocks[cur]->gettype() != -1 )
	{
	    nextold=Blocks[cur]->getnext();
	    Id=addBlock(4,-1,nextold,cur,"vertical space");
	    Blocks[cur]->setnext(Id); 
	}
    else
	{
	    Blocks[cur]->settype(4);
	    Blocks[cur]->setcont("vertical space");
	    checkAndCreate(Blocks[cur]);    
	}
    setCurrent(Blocks[Id]->getchild1());	
    emit sig_modified();
}


kformula'KFormulaDocument::addB3() (./koffice/kformula/notsoold/kformula_doc.cc:367)

void KFormulaDocument::addB3()
{   
    int nextold=-1; 
    int Id,cur;
    cur=getCurrent();
    Id=cur;
    if( Blocks[cur]->gettype() != -1 )
	{
           warning("create"); 
	    nextold=Blocks[cur]->getnext();
	    Id=addBlock(3,-1,nextold,cur,"()");
	    Blocks[cur]->setnext(Id);
	}
    else
	{
            warning("change only");
	    Blocks[cur]->settype(3);
	    Blocks[cur]->setcont("()");
	    checkAndCreate(Blocks[cur]);   
            warning("C&C called");
	}
    setCurrent(Blocks[Id]->getchild1());	
    emit sig_modified();
}



kformula'KFormulaDocument::addBlock() (./koffice/kformula/notsoold/kformula_doc.cc:393)

int KFormulaDocument::addBlock(int Type,int ID,int nextID,int prevID,
			       QString Cont, int Child1,int Child2, int Child3)
{
    if ( ID == -1 )
	ID=firstfree;
    isFree[ID]=FALSE;  
    for( firstfree=1; !isFree[firstfree]; firstfree++ );
    QString s;  
    s.sprintf("First free block: %i",firstfree);    
        warning(s);   
    
    Blocks[ID]= new FormulaBlock(this,Type,ID,nextID,prevID,Cont,Child1,Child2,Child3);
    checkAndCreate(Blocks[ID]);
    return (ID);
}


kformula'KFormulaDocument::deleteIt() (./koffice/kformula/notsoold/kformula_doc.cc:409)

void KFormulaDocument::deleteIt(FormulaBlock *bl)
{
    int id=bl->getID();
    if( id != 0 )
	{
	    int next=bl->getnext();
	    int prev=bl->getprev();
	    int child1=bl->getchild1();
	    int child2=bl->getchild2();
	    int child3=bl->getchild3(); 
	    if( next != -1 )
		Blocks[next]->setprev(prev);
	    if( prev != -1 )
		{
		    if( Blocks[prev]->getnext() == id )
			Blocks[prev]->setnext(next);
		    if( Blocks[prev]->getchild1() == id )
			Blocks[prev]->setchild1(next);
		    if( Blocks[prev]->getchild2() == id )
			Blocks[prev]->setchild2(next);
		    if( (Blocks[prev]->getchild3() == id )
			/*&&(Blocks[prev]->gettype()!=4)*/) Blocks[prev]->setchild3(next);
		}
	    if( child1 != -1 )
		deleteIt(Blocks[child1]);
	    if( child2 != -1 )
		deleteIt(Blocks[child2]);
	    if( ( child3 != -1 )
		/*&&(bl->gettype()!=4)*/) deleteIt(Blocks[child3]);
	    checkAndCreate(Blocks[prev]);
	    if( prev != -1 )
		setCurrent(prev);
	    isFree[id]=TRUE; 
	    delete bl;
	    emit sig_modified();
	}
    else
	QMessageBox::critical( 0L, i18n("Error"), i18n("Can not delete First Block !!"), i18n( OK ) );
}


kformula'KFormulaDocument::mousePressEvent() (./koffice/kformula/notsoold/kformula_doc.cc:449)

void KFormulaDocument::mousePressEvent( QMouseEvent *a,QWidget *wid)
{
   setCurrent(Blocks[0]->getClick(a->pos()));
   emit sig_modified();
if(a->button()==RightButton){
   QPopupMenu *mousepopup = new QPopupMenu;
   QPopupMenu *convert = new QPopupMenu;
   QPopupMenu *fontpopup = new QPopupMenu;    
       fontpopup->insertItem(i18n("Font +"), this, SLOT(enlarge()), ALT+Key_K);
    fontpopup->insertItem(i18n("Font -"), this, SLOT(reduce()), ALT+Key_K);
    fontpopup->insertItem(i18n("Font + (also Children)"), this, SLOT(enlargeRecur()), ALT+Key_K);
    fontpopup->insertItem(i18n("Font - (also Children)"), this, SLOT(reduceRecur()), ALT+Key_K);
    fontpopup->insertItem(i18n("All Font +"), this, SLOT(enlargeAll()), ALT+Key_K);
    fontpopup->insertItem(i18n("All Font -"), this, SLOT(reduceAll()), ALT+Key_K);
//    convert->insertItem(klocale("Simple Text"), parent->_part, SLOT(slotQuit()), ALT+Key_E);
//    convert->insertItem("AAAARGGHHH", _part, SLOT(slotQuit()), ALT+Key_E);
    mousepopup->insertItem(i18n("Proprieties"), this,SLOT(pro()), ALT+Key_E);
    mousepopup->insertItem(i18n("Delete"), this,SLOT(dele()), ALT+Key_E);
    mousepopup->insertSeparator();
    mousepopup->insertItem(i18n("Change font.."),fontpopup);    
    mousepopup->insertItem(i18n("Convert to.."),convert);
//    mousepopup->insertSeparator();
//    mousepopup->insertItem(i18n("Quit"), _part, SLOT(slotQuit()), ALT+Key_Q);
    mousepopup->popup(wid->mapToGlobal(a->pos()));
}
}


kformula'KFormulaDocument::keyPressEvent() (./koffice/kformula/notsoold/kformula_doc.cc:476)

void KFormulaDocument::keyPressEvent( QKeyEvent *k )
{


 int c,prev,next,c1,c2,c3,len,type;
 c=getCurrent(); 
 prev=Blocks[c]->getprev();
 next=Blocks[c]->getnext();
 c1=Blocks[c]->getchild1();
 c2=Blocks[c]->getchild2();
 c3=Blocks[c]->getchild3();
 type=Blocks[c]->gettype();
 len=Blocks[c]->getcont().length();
 warning("Get everything...process key pressed...");
 if(k->key()==Key_Left) {
		       if((type==0)&&(pos>0)) pos--;
		    else  
                       if(prev!=-1)setCurrent(prev);
				     }
 if(k->key()==Key_Right) { 
                        if((type==0)&&(pos<len)) pos++;
			else
			 if(next!=-1)  setCurrent(next);
			else
			 if(c1!=-1)    setCurrent(c1);
			else
			 if(c2!=-1)    setCurrent(c2);
			  }			
if(k->key()==Key_Up) {
		      if(c1!=-1)    setCurrent(c1);                        
	   	    else
		      if(prev!=-1)  setCurrent(prev);						 
    		     }  

if(k->key()==Key_Down) {
		      if(c2!=-1)    setCurrent(c2);                        
	   	    else
		      if(prev!=-1)  setCurrent(prev);						 
    		     }  

if(k->key()==Key_Backspace) {
	                 if(pos>0) { pos--;
		                     Blocks[c]->getcont().remove(pos,1);
				   }
			    }
 else 
 if(k->key()==Key_Delete) {
    if(type==0) Blocks[c]->getcont().remove(pos,1); else deleteIt(Blocks[c]);  
    }    else 
 
 if((k->ascii()>32)&&(k->ascii()<127))
  { 
    warning("Ascii");
c1=c;
c2=c1;
if(Blocks[c1]->gettype()>0) {    
    next=Blocks[c1]->getnext();
    c2=addBlock(0,-1,next,c1,"");
    Blocks[c1]->setnext(c2);
    warning("Add a block type0"); 
     }
       else Blocks[c1]->settype(0);
    setCurrent(c2);	   
    warning("Set current");
    Blocks[getCurrent()]->getcont().insert(pos,k->ascii());
    warning("insert success");
    pos++; 
    warning("pos ++");
  } 
//ChText(Blocks[getCurrent()]->getcont());
//ChType(Blocks[getCurrent()]->gettype());
//update();
	    emit sig_modified();
}



kformula'KFormulaDocument::paintEvent() (./koffice/kformula/notsoold/kformula_doc.cc:552)

void KFormulaDocument::paintEvent( QPaintEvent *_ev, QWidget *paintGround )
{
    QPainter painter(paintGround);
    Blocks[0]->getDimensions(); // Get dimension of Block0 (all formula dimension)
    painter.setPen( black );
    Blocks[0]->PaintIt(&painter,1+xOff,1+yOff+Blocks[0]->getLYU(),1);
    isBlack=false;
}


kformula'KFormulaDocument::checkAndCreate() (./koffice/kformula/notsoold/kformula_doc.cc:561)

void KFormulaDocument::checkAndCreate(FormulaBlock *bl)
{
    int ID=bl->getID();
    switch ( bl->gettype() )
	{
	case 1:
            warning("case 1"); 
	    if ( bl->getchild1() == -1 )
		bl->setchild1(addBlock(-1,-1,-1,ID,""));
	    break;
	case 2:
            warning("case 2"); 
	    if ( bl->getchild1() == -1 )
		bl->setchild1(addBlock(-1,-1,-1,ID,""));
	    break;
	case 3:
            warning("case 3"); 
	    if( bl->getcont() == "" )
		bl->setcont("()");      
	    if ( bl->getchild1() == -1 )
		bl->setchild1(addBlock(-1,-1,-1,ID,""));
	    break;
	case 4:
            warning("case 4"); 
	    if ( bl->getcont() == "" )
		bl->setcont("line");
	    if ( bl->getchild1() == -1 )
		bl->setchild1(addBlock(-1,-1,-1,ID,""));
	    if ( bl->getchild2() == -1 )
		bl->setchild2(addBlock(-1,-1,-1,ID,"")); 
	    if ( bl->getsp() == -1 )
		bl->setsp(10);  
	    break;
	case 5:
            warning("case 5"); 
	    if ( bl->getcont() == "" )
		bl->setcont(">");
	    if ( bl->getchild1() == -1 )
		bl->setchild1(addBlock(-1,-1,-1,ID,""));
	    break;
	}
}

/****************************************************************
 *
 * KFormulaBlock
 *
 ****************************************************************/

/**
 * CLASS FormulaBlock
 *
 * a component of AFormula
 *
 * Structure of a Block:
 *
 *
 * Prev(BL)---BL-------Next(Bl)
 *          /  |  \
 *        /    |     \
 *  child1   child2  child3       
 *
 * Prev(child1)=prev(child2)=prev(child3)=BL
 * more info about child1,child2,child3 on widget.h
 */