kword
KWordTableFrameSetIface.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "KWordTableFrameSetIface.h"
00021 #include "KWordTextFrameSetIface.h"
00022 #include "KWordTextFrameSetEditIface.h"
00023
00024 #include "KWFrame.h"
00025 #include "KWTableFrameSet.h"
00026 #include <kapplication.h>
00027 #include <dcopclient.h>
00028 #include "KWView.h"
00029 #include "KWDocument.h"
00030 #include "KWCanvas.h"
00031
00032 KWordTableFrameSetIface::KWordTableFrameSetIface( KWTableFrameSet *_frame )
00033 : KWordFrameSetIface( _frame)
00034 {
00035 m_table = _frame;
00036 }
00037
00038 uint KWordTableFrameSetIface::nbRows()
00039 {
00040 return m_table->getRows();
00041 }
00042
00043 uint KWordTableFrameSetIface::numCols()
00044 {
00045 return m_table->getColumns();
00046 }
00047 uint KWordTableFrameSetIface::numCells()
00048 {
00049 return m_table->getNumCells();
00050 }
00051
00052 DCOPRef KWordTableFrameSetIface::cell( int pos )
00053 {
00054
00055 KWTableFrameSet::TableIter i(m_table);
00056 int p = 0;
00057 for(; i && p <= pos; ++i,++p)
00058 if( ! i.current() )
00059 return DCOPRef();
00060
00061 return DCOPRef( kapp->dcopClient()->appId(),
00062 i->dcopObject()->objId() );
00063 }
00064
00065 DCOPRef KWordTableFrameSetIface::cell( uint row, uint col )
00066 {
00067 if( row>=m_table->getRows() || col>= m_table->getColumns())
00068 return DCOPRef();
00069 return DCOPRef( kapp->dcopClient()->appId(),
00070 m_table->cell(row,col)->dcopObject()->objId() );
00071 }
00072
00073 DCOPRef KWordTableFrameSetIface::startEditingCell(uint row, uint col )
00074 {
00075 if( row>=m_table->getRows() || col>= m_table->getColumns())
00076 return DCOPRef();
00077
00078 KWDocument *doc=m_table->kWordDocument();
00079 KWView* view = doc->getAllViews().first();
00080 KWCanvas* canvas = view->getGUI()->canvasWidget();
00081 KWTextFrameSet *m_frametext=m_table->cell(row,col);
00082 if( !m_frametext || m_frametext->isDeleted())
00083 return DCOPRef();
00084 canvas->checkCurrentEdit(m_frametext, true);
00085 return DCOPRef( kapp->dcopClient()->appId(),
00086 (static_cast<KWTextFrameSetEdit *>( canvas->currentFrameSetEdit()))->dcopObject()->objId() );
00087 }
|