20#include "KIvioMapIface.h"
24#include "kivio_page.h"
26#include <tdeapplication.h>
27#include <dcopclient.h>
30KIvioMapIface::KIvioMapIface( KivioMap* map )
36DCOPRef KIvioMapIface::page(
const TQString& name )
38 KivioPage* t = m_map->findPage( name );
42 return DCOPRef( kapp->dcopClient()->appId(), t->dcopObject()->objId() );
45DCOPRef KIvioMapIface::pageByIndex(
int index )
47 KivioPage* t = m_map->pageList().at( index );
50 kdDebug(43000) <<
"+++++ No page found at index " << index << endl;
54 kdDebug(43000) <<
"+++++++ Returning page " << t->TQObject::name() << endl;
56 return DCOPRef( kapp->dcopClient()->appId(), t->dcopObject()->objId() );
59int KIvioMapIface::pageCount()
const
61 return m_map->count();
64TQStringList KIvioMapIface::pageNames()
const
68 TQPtrList<KivioPage>& lst = m_map->pageList();
69 TQPtrListIterator<KivioPage> it( lst );
70 for( ; it.current(); ++it )
71 names.append( it.current()->name() );
76TQValueList<DCOPRef> KIvioMapIface::pages()
78 TQValueList<DCOPRef> t;
80 TQPtrList<KivioPage>& lst = m_map->pageList();
81 TQPtrListIterator<KivioPage> it( lst );
82 for( ; it.current(); ++it )
83 t.append( DCOPRef( kapp->dcopClient()->appId(), it.current()->dcopObject()->objId() ) );
88DCOPRef KIvioMapIface::insertPage(
const TQString& name )
90 if ( m_map->findPage( name ) )
93 KivioPage* t =
new KivioPage( m_map, name );
94 t->setPageName( name );
95 m_map->doc()->addPage( t );
100bool KIvioMapIface::processDynamic(
const TQCString &fun,
const TQByteArray &,
101 TQCString& replyType, TQByteArray &replyData)
104 uint len = fun.length();
108 if ( fun[ len - 1 ] !=
')' || fun[ len - 2 ] !=
'(' )
111 KivioPage* t = m_map->findPage( fun.left( len - 2 ).data() );
115 replyType =
"DCOPRef";
116 TQDataStream out( replyData, IO_WriteOnly );
117 out << DCOPRef( kapp->dcopClient()->appId(), t->dcopObject()->objId() );