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

Class Index

kspread'ChartChild (./koffice/kspread/kspread_table.h:149)

class ChartChild : public KSpreadChild
{
public:
  ChartChild( KSpreadDoc *_spread, KSpreadTable *_table, KoDocument* doc, const QRect& _rect );
    // ChartChild( KSpreadDoc *_spread, KSpreadTable *_table );
  ~ChartChild();

  void setDataArea( const QRect& _data );
  void update();

  virtual bool loadDocument( KoStore* _store );
  virtual bool save( ostream& out );

  KChartPart* chart();

private:
  bool loadTag( KOMLParser& parser, const string& tag, std::vector<KOMLAttrib>& lst );

  ChartBinding *m_pBinding;
  KSpreadTable* m_table;
};

/********************************************************************
 *
 * Table
 *
 ********************************************************************/

/**
 */

kspread'ChartChild::ChartChild() (./koffice/kspread/kspread_table.cc:4349)

ChartChild::ChartChild( KSpreadDoc *_spread, KSpreadTable *_table, KoDocument* doc, const QRect& _rect )
  : KSpreadChild( _spread, _table, doc, _rect )
{
  m_pBinding = 0;
  m_table = _table;
}

/* ChartChild::ChartChild( KSpreadDoc *_spread, KSpreadTable *_table ) :
  KSpreadChild( _spread, _table )
{
  m_pBinding = 0;
  } */


kspread'ChartChild::~ChartChild() (./koffice/kspread/kspread_table.cc:4362)

ChartChild::~ChartChild()
{
  if ( m_pBinding )
    delete m_pBinding;
}


kspread'ChartChild::setDataArea() (./koffice/kspread/kspread_table.cc:4368)

void ChartChild::setDataArea( const QRect& _data )
{
  if ( m_pBinding == 0L )
    m_pBinding = new ChartBinding( m_pTable, _data, this );
  else
    m_pBinding->setDataArea( _data );
}


kspread'ChartChild::update() (./koffice/kspread/kspread_table.cc:4376)

void ChartChild::update()
{
    if ( m_pBinding )
	m_pBinding->cellChanged( 0 );
}


kspread'ChartChild::save() (./koffice/kspread/kspread_table.cc:4382)

bool ChartChild::save( ostream& out )
{
    QString u = document()->url().url();
    QString mime = document()->mimeType();

    out << indent << "<CHART url=\"" << u.ascii() << "\" mime=\"" << mime.ascii()<< "\">"
	<< geometry();
    if ( m_pBinding )
	out << "<BINDING>" << m_pBinding->dataArea() << "</BINDING>";
    out << "</CHART>" << endl;

    return true;
}

// ############### Is this KOML stuff really needed ?

kspread'ChartChild::loadTag() (./koffice/kspread/kspread_table.cc:4397)

bool ChartChild::loadTag( KOMLParser& parser, const string& tag, vector<KOMLAttrib>& /* lst */ )
{
    if ( tag == "BINDING" )
    {
	string tag2;
	vector<KOMLAttrib> lst2;
	string name2;
	// RECT
	while( parser.open( 0L, tag2 ) )
	{
	    KOMLParser::parseTag( tag2.c_str(), name2, lst2 );

	    if ( name2 == "RECT" )
		m_pBinding = new ChartBinding( m_table, tagToRect( lst2 ), this );
	    else
	    {
		cerr << "Unknown tag '" << tag2 << "' in BINDING" << endl;
		return FALSE;
	    }
	}
	if ( !parser.close( (string &) tag ) )
	{
	    cerr << "ERR: Closing BINDING" << endl;
	    return false;
	}
	
	return TRUE;
    }

    return FALSE;
}


kspread'ChartChild::loadDocument() (./koffice/kspread/kspread_table.cc:4429)

bool ChartChild::loadDocument( KoStore* _store )
{
    // Did we see the BINDING tag ?
    if ( !m_pBinding )
	return FALSE;

    bool res = KSpreadChild::loadDocument( _store );
    if ( !res )
	return res;

  // #### Torben: Check wether the document really supports
  //      the chart interface
  /* CORBA::Object_var obj = m_rDoc->getInterface( "IDL:Chart/SimpleChart:1.0" );
  Chart::SimpleChart_var chart = Chart::SimpleChart::_narrow( obj );
  if ( CORBA::is_nil( chart ) )
  {
    QMessageBox::critical( 0L, i18n("Internal Error"),
			   i18n("Chart does not support the required interface"),
			   i18n("OK") );
    return false;
    } */

    update();

    return true;
}


kspread'ChartChild::chart() (./koffice/kspread/kspread_table.cc:4456)

KChartPart* ChartChild::chart()
{
    return (KChartPart*)document();
}