25#include <dcopclient.h>
26#include <tdeapplication.h>
29#include "kspread_doc.h"
30#include "kspread_map.h"
31#include "kspread_sheet.h"
33#include "KSpreadMapIface.h"
37MapIface::MapIface(
Map* map )
43DCOPRef MapIface::sheet(
const TQString& name )
49 return DCOPRef( kapp->dcopClient()->appId(), t->dcopObject()->objId() );
52DCOPRef MapIface::sheetByIndex(
int index )
54 Sheet* t = m_map->sheetList().at( index );
57 kdDebug(36001) <<
"+++++ No table found at index " << index << endl;
61 kdDebug(36001) <<
"+++++++ Returning table " << t->TQObject::name() << endl;
63 return DCOPRef( kapp->dcopClient()->appId(), t->dcopObject()->objId() );
66int MapIface::sheetCount()
const
68 return m_map->count();
71TQStringList MapIface::sheetNames()
const
75 TQPtrList<Sheet>& lst = m_map->sheetList();
76 TQPtrListIterator<Sheet> it( lst );
77 for( ; it.current(); ++it )
78 names.append( it.current()->name() );
83TQValueList<DCOPRef> MapIface::sheets()
85 TQValueList<DCOPRef> t;
87 TQPtrList<Sheet>& lst = m_map->sheetList();
88 TQPtrListIterator<Sheet> it( lst );
89 for( ; it.current(); ++it )
90 t.append( DCOPRef( kapp->dcopClient()->appId(), it.current()->dcopObject()->objId() ) );
95DCOPRef MapIface::insertSheet(
const TQString& name )
97 if ( m_map->findSheet( name ) )
100 Sheet* t = m_map->addNewSheet ();
101 t->setSheetName( name );
103 return sheet( name );
106bool MapIface::processDynamic(
const TQCString &fun,
const TQByteArray &,
107 TQCString& replyType, TQByteArray &replyData)
110 uint len = fun.length();
114 if ( fun[ len - 1 ] !=
')' || fun[ len - 2 ] !=
'(' )
117 Sheet* t = m_map->findSheet( fun.left( len - 2 ).data() );
121 replyType =
"DCOPRef";
122 TQDataStream out( replyData, IO_WriteOnly );
123 out << DCOPRef( kapp->dcopClient()->appId(), t->dcopObject()->objId() );
A map is a simple container for all sheets.
Sheet * findSheet(const TQString &_name)
searches for a sheet named _name