[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice
Subject: patch for kspread
From: montel laurent <montell () club-internet ! fr>
Date: 2000-08-27 11:19:52
[Download RAW message or body]
I added to my previous patch :
I replaced
if(m_pView->doc()->map()->findTable(area[ index
> ].table_name)) + {
> + KSpreadTable
> *table=m_pView->doc()->map()->findTable(area[ index ].table_name);
> + table->setActiveTable();
> + }
> + }
>
by
>
> KSpreadTable *table = m_pView->doc()->map()->findTable(area[ index
> ].table_name);
> if (table)
> table->setActiveTable();
>
as david told me.
thanks
["patch31.diff" (text/plain)]
? patch26.diff
? kword.kwd
? fonts.dir
? toto.csv
? toto2.ksp
? KSpreadLocation.diff
? ???
? KSpreadCellIface_stub.h
? KSpreadCellIface_stub.cpp
? toto.ksp
? filters/Makefile.in
? filters/Makefile
? filters/csv/Makefile
? filters/csv/Makefile.in
? filters/csv/csvfilter
? filters/komma/Makefile.in
? filters/komma/Makefile
? pics/@kde_minidir@
cvs server: Diffing .
Index: kspread_canvas.cc
===================================================================
RCS file: /home/kde/koffice/kspread/kspread_canvas.cc,v
retrieving revision 1.144
diff -u -p -r1.144 kspread_canvas.cc
--- kspread_canvas.cc 2000/08/24 20:10:04 1.144
+++ kspread_canvas.cc 2000/08/27 11:16:23
@@ -297,7 +297,11 @@ void KSpreadCanvas::endChoose()
return;
activeTable()->setChooseRect( QRect( 0, 0, 0, 0 ) );
- m_pView->setActiveTable( m_chooseStartTable );
+ //m_pView->setActiveTable( m_chooseStartTable );
+ KSpreadTable *table=m_pView->doc()->map()->findTable(m_chooseStartTable->tableName());
+ if(table)
+ table->setActiveTable();
+
kdDebug(36001) << "endChoose len=0" << endl;
length_namecell = 0;
m_bChoose = FALSE;
@@ -385,16 +389,17 @@ void KSpreadCanvas::gotoLocation( const
gotoLocation( _cell.pos.x(), _cell.pos.y(), table );
}
-void KSpreadCanvas::gotoLocation( int x, int y, KSpreadTable* table, bool \
make_select,bool move_into_area ) +void KSpreadCanvas::gotoLocation( int x, int y, \
KSpreadTable* table, bool make_select,bool move_into_area, bool keyPress) {
//kdDebug(36001) << "KSpreadCanvas::gotoLocation" << " x=" << x << " y=" << y <<
// " table=" << table << " make_select=" << (make_select ? "true" : "false" ) << \
endl; if ( table )
- m_pView->setActiveTable( table );
+ table->setActiveTable();
else
table = activeTable();
KSpreadCell* cell = table->cellAt( x, y );
+ QRect extraArea;
if ( cell->isObscured() && cell->isObscuringForced() )
{
int moveX=cell->obscuringCellsColumn();
@@ -403,15 +408,53 @@ void KSpreadCanvas::gotoLocation( int x,
QRect extraCell;
extraCell.setCoords(moveX,moveY,moveX+cell->extraXCells(),moveY+cell->extraYCells());
if( (x-markerColumn())!=0 && \
extraCell.contains(QPoint(markerColumn(),markerRow()))) + {
+ extraArea.setCoords(markerColumn(),1,cell->extraXCells()+x-1,0x7FFF);
+ if(keyPress && !extraArea.contains(table->getOldPos().x(),1))
+ y=table->getOldPos().y();
x=cell->extraXCells()+x;
+
+ }
else if((y-markerRow())!=0 && \
extraCell.contains(QPoint(markerColumn(),markerRow()))) + {
+
+ extraArea.setCoords(1,markerRow(),0x7FFF,cell->extraYCells()+y-1);
+ if(keyPress && !extraArea.contains(1,table->getOldPos().y()))
+ x=table->getOldPos().x();
y=cell->extraYCells()+y;
+ }
else
{
y = moveY;
x = moveX;
}
}
+ else
+ {
+ cell = table->cellAt( table->marker().x(), table->marker().y() );
+ if ( cell->isForceExtraCells() )
+ {
+ if(keyPress && (x-markerColumn())!=0)
+ {
+ extraArea.setCoords(markerColumn(),1,cell->extraXCells()+markerColumn(),0x7FFF);
+ if( !extraArea.contains(QPoint(table->getOldPos().x(),1)))
+ y=table->getOldPos().y();
+ }
+ else if(keyPress && (y-markerRow())!=0 )
+ {
+ extraArea.setCoords(1,markerRow(),0x7FFF,cell->extraYCells()+markerRow());
+ if( !extraArea.contains(QPoint(1,table->getOldPos().y())))
+ x=table->getOldPos().x();
+ }
+ }
+ }
+
+ cell= table->cellAt( x, y );
+ if( cell->isObscured() && cell->isObscuringForced() )
+ {
+ x=cell->obscuringCellsColumn();
+ y=cell->obscuringCellsRow();
+ }
int xpos = table->columnPos( x, this );
int ypos = table->rowPos( y, this );
@@ -484,7 +527,7 @@ void KSpreadCanvas::gotoLocation( int x,
void KSpreadCanvas::chooseGotoLocation( int x, int y, KSpreadTable* table, bool \
make_select ) {
if ( table )
- m_pView->setActiveTable( table );
+ table->setActiveTable( );
else
table = activeTable();
@@ -1281,17 +1324,17 @@ void KSpreadCanvas::keyPressEvent ( QKey
{
QRect selection = activeTable()->selectionRect();
if( selection.left() == 0 )
- gotoLocation( markerColumn(), QMIN( 0x7FFF, markerRow() + 1 ), 0, \
make_select ); + gotoLocation( markerColumn(), QMIN( 0x7FFF, markerRow() + \
1 ), 0, make_select,false,true ); else
{
if(markerColumn()<selection.right()&&markerRow()<selection.bottom() )
- gotoLocation( markerColumn(), QMIN( 0x7FFF, markerRow() + 1 ), 0, \
make_select,true ); + gotoLocation( markerColumn(), QMIN( 0x7FFF, \
markerRow() + 1 ), 0, make_select,true,true );
else if( markerRow()==selection.bottom() && \
markerColumn()<selection.right())
- gotoLocation( markerColumn()+1, QMIN( 0x7FFF, selection.top() ), 0, \
make_select,true ); + gotoLocation( markerColumn()+1, QMIN( 0x7FFF, \
selection.top() ), 0, make_select,true,true );
else if( markerRow()==selection.bottom() && \
markerColumn()==selection.right())
- gotoLocation( selection.left(), QMIN( 0x7FFF, selection.top() ), 0, \
make_select,true ); + gotoLocation( selection.left(), QMIN( 0x7FFF, \
selection.top() ), 0, make_select,true,true );
else if(markerColumn()==selection.right() && \
markerRow()<selection.bottom())
- gotoLocation( markerColumn(), QMIN( 0x7FFF, markerRow() + 1 ), 0, \
make_select,true ); + gotoLocation( markerColumn(), QMIN( 0x7FFF, \
markerRow() + 1 ), 0, make_select,true,true ); }
}
return;
@@ -1305,7 +1348,7 @@ void KSpreadCanvas::keyPressEvent ( QKey
if ( m_bChoose )
chooseGotoLocation( chooseMarkerColumn(), QMIN( 0x7FFF, chooseMarkerRow() + \
1 ), 0, make_select ); else
- gotoLocation( markerColumn(), QMIN( 0x7FFF, markerRow() + 1 ), 0, \
make_select ); + gotoLocation( markerColumn(), QMIN( 0x7FFF, markerRow() + 1 \
), 0, make_select,false,true );
return;
@@ -1319,7 +1362,7 @@ void KSpreadCanvas::keyPressEvent ( QKey
if ( m_bChoose )
chooseGotoLocation( chooseMarkerColumn(), QMAX( 1, chooseMarkerRow() - 1 ), \
0, make_select ); else
- gotoLocation( markerColumn(), QMAX( 1, markerRow() - 1 ), 0, make_select );
+ gotoLocation( markerColumn(), QMAX( 1, markerRow() - 1 ), 0, \
make_select,false,true );
return;
@@ -1333,7 +1376,7 @@ void KSpreadCanvas::keyPressEvent ( QKey
if ( m_bChoose )
chooseGotoLocation( QMIN( 26*26/*0x7FFF*/, chooseMarkerColumn() + 1 ), \
chooseMarkerRow(), 0, make_select ); else
- gotoLocation( QMIN( /*26*26*/0x7FFF, markerColumn() + 1 ), markerRow(), 0, \
make_select ); + gotoLocation( QMIN( /*26*26*/0x7FFF, markerColumn() + 1 ), \
markerRow(), 0, make_select,false,true );
return;
@@ -1347,7 +1390,7 @@ void KSpreadCanvas::keyPressEvent ( QKey
if ( m_bChoose )
chooseGotoLocation( QMAX( 1, chooseMarkerColumn() - 1 ), chooseMarkerRow(), \
0, make_select ); else
- gotoLocation( QMAX( 1, markerColumn() - 1 ), markerRow(), 0, make_select );
+ gotoLocation( QMAX( 1, markerColumn() - 1 ), markerRow(), 0, make_select \
,false,true);
return;
@@ -1379,7 +1422,7 @@ void KSpreadCanvas::keyPressEvent ( QKey
if ( m_bChoose )
chooseGotoLocation( 1, markerRow(), 0, make_select );
else
- gotoLocation( 1, markerRow(), 0, make_select );
+ gotoLocation( 1, markerRow(), 0, make_select,false,true );
}
return;
@@ -1393,7 +1436,7 @@ void KSpreadCanvas::keyPressEvent ( QKey
if ( m_bChoose )
chooseGotoLocation( chooseMarkerColumn(), QMAX( 1, chooseMarkerRow() - 10 ), \
0, make_select ); else
- gotoLocation( markerColumn(), QMAX( 1, markerRow() - 10 ), 0, make_select );
+ gotoLocation( markerColumn(), QMAX( 1, markerRow() - 10 ), 0, \
make_select,false,true );
return;
@@ -1407,7 +1450,7 @@ void KSpreadCanvas::keyPressEvent ( QKey
if ( m_bChoose )
chooseGotoLocation( chooseMarkerColumn(), QMIN( 0x7FFF, chooseMarkerRow() + \
10 ), 0, make_select ); else
- gotoLocation( markerColumn(), QMIN( 0x7FFF, markerRow() + 10 ), 0, \
make_select ); + gotoLocation( markerColumn(), QMIN( 0x7FFF, markerRow() + 10 \
), 0, make_select,false,true );
return;
Index: kspread_canvas.h
===================================================================
RCS file: /home/kde/koffice/kspread/kspread_canvas.h,v
retrieving revision 1.53
diff -u -p -r1.53 kspread_canvas.h
--- kspread_canvas.h 2000/08/18 21:39:10 1.53
+++ kspread_canvas.h 2000/08/27 11:16:25
@@ -208,7 +208,7 @@ public:
* moves the cursor keys. In this case the selection is
* updated accordingly.
*/
- void gotoLocation( int x, int y, KSpreadTable* table = 0, bool make_select = \
FALSE,bool move_into_area=false); + void gotoLocation( int x, int y, KSpreadTable* \
table = 0, bool make_select = FALSE,bool move_into_area=false, bool keyPress=false); \
/**
* Chooses the correct @ref #EditorType by looking at
Index: kspread_dlg_formula.cc
===================================================================
RCS file: /home/kde/koffice/kspread/kspread_dlg_formula.cc,v
retrieving revision 1.58
diff -u -p -r1.58 kspread_dlg_formula.cc
--- kspread_dlg_formula.cc 2000/08/15 09:19:21 1.58
+++ kspread_dlg_formula.cc 2000/08/27 11:16:32
@@ -27,6 +27,7 @@
#include "kspread_table.h"
#include "kspread_editors.h"
#include "kspread_doc.h"
+#include "kspread_map.h"
#include <qlayout.h>
#include <kapp.h>
#include <kdebug.h>
@@ -243,7 +244,11 @@ void KSpreadDlgFormula::slotOk()
m_pView->canvasWidget()->endChoose();
// Switch back to the old table
if(m_pView->activeTable()->tableName() != m_tableName )
- m_pView->changeTable( m_tableName );
+ {
+ KSpreadTable *table=m_pView->doc()->map()->findTable(m_tableName);
+ if( table)
+ table->setActiveTable();
+ }
// Revert the marker to its original position
m_pView->canvasWidget()->activeTable()->setMarker( QPoint( m_column, m_row ) );
@@ -269,7 +274,12 @@ void KSpreadDlgFormula::slotClose()
// Switch back to the old table
if(m_pView->activeTable()->tableName() != m_tableName )
- m_pView->changeTable( m_tableName );
+ {
+ KSpreadTable *table=m_pView->doc()->map()->findTable(m_tableName);
+ if(table)
+ table->setActiveTable();
+ }
+
// Revert the marker to its original position
m_pView->canvasWidget()->activeTable()->setMarker( QPoint( m_column, m_row ) );
Index: kspread_dlg_reference.cc
===================================================================
RCS file: /home/kde/koffice/kspread/kspread_dlg_reference.cc,v
retrieving revision 1.5
diff -u -p -r1.5 kspread_dlg_reference.cc
--- kspread_dlg_reference.cc 2000/07/15 16:27:45 1.5
+++ kspread_dlg_reference.cc 2000/08/27 11:16:33
@@ -27,6 +27,7 @@
#include "kspread_table.h"
#include "kspread_doc.h"
#include "kspread_util.h"
+#include "kspread_map.h"
#include <kapp.h>
#include <klocale.h>
#include <qstringlist.h>
@@ -116,7 +117,11 @@ void KSpreadreference::slotOk()
QValueList<Reference> area=m_pView->doc()->listArea();
if(m_pView->activeTable()->tableName()!=area[ index ].table_name)
- m_pView->changeTable(area[ index ].table_name);
+ {
+ KSpreadTable *table=m_pView->doc()->map()->findTable(area[ index \
].table_name); + if(table)
+ table->setActiveTable();
+ }
m_pView->canvasWidget()->gotoLocation(KSpreadPoint( \
m_pView->activeTable()->tableName()
+"!"+util_cellName(area[ index ].rect.left() ,area[ index \
].rect.top() ), m_pView->doc()->map() ) );
Index: kspread_table.cc
===================================================================
RCS file: /home/kde/koffice/kspread/kspread_table.cc,v
retrieving revision 1.199
diff -u -p -r1.199 kspread_table.cc
--- kspread_table.cc 2000/08/26 06:27:46 1.199
+++ kspread_table.cc 2000/08/27 11:17:05
@@ -224,6 +224,7 @@ KSpreadTable::KSpreadTable( KSpreadMap *
s.sprintf("Table%i", s_id );
QObject::setName( s.data() );
}
+ m_oldPos=QPoint(1,1);
}
bool KSpreadTable::isEmpty( unsigned long int x, unsigned long int y )
@@ -594,7 +595,7 @@ QRect KSpreadTable::marker() const
}
void KSpreadTable::setSelection( const QRect &_sel, KSpreadCanvas *_canvas )
-{
+{ m_oldPos=QPoint( m_marker.topLeft());
if ( _sel.left() == 0 )
setSelection( _sel, m_marker.topLeft(), _canvas );
else
@@ -643,10 +644,16 @@ void KSpreadTable::setSelection( const Q
cell->obscuringCellsRow(), m.x(), m.y() );
}
else
+ {
+ m_oldPos=QPoint( m.x(),m.y());
m_marker = QRect( m, m );
+ }
}
else
+ {
+ m_oldPos=QPoint( m.x(),m.y());
m_marker = QRect( m, m );
+ }
emit sig_changeSelection( this, old, old_marker );
}
Index: kspread_table.h
===================================================================
RCS file: /home/kde/koffice/kspread/kspread_table.h,v
retrieving revision 1.117
diff -u -p -r1.117 kspread_table.h
--- kspread_table.h 2000/08/26 06:27:46 1.117
+++ kspread_table.h 2000/08/27 11:17:09
@@ -517,6 +517,8 @@ public:
void setActiveTable();
+ QPoint getOldPos() {return m_oldPos;}
+
/**
* Change name of reference when the user inserts or removes a column,
* a row or a cell (= insertion of a row [or column] on a single column [or \
row]). @@ -882,6 +884,8 @@ protected:
bool m_bShowColumnNumber;
KSpreadLayout* m_defaultLayout;
+
+ QPoint m_oldPos;
/**
* @see #emptyPen
Index: kspread_view.cc
===================================================================
RCS file: /home/kde/koffice/kspread/kspread_view.cc,v
retrieving revision 1.279
diff -u -p -r1.279 kspread_view.cc
--- kspread_view.cc 2000/08/26 06:27:46 1.279
+++ kspread_view.cc 2000/08/27 11:17:18
@@ -444,6 +444,7 @@ void KSpreadView::updateEditWidget()
else
editWidget()->setText( cell->text() );
+
m_selectFontSize->setFontSize( cell->textFontSize( m_pCanvas->markerColumn(), \
m_pCanvas->markerRow() ) );
m_selectFont->setFont( cell->textFontFamily( m_pCanvas->markerColumn(), \
m_pCanvas->markerRow() ) );
m_bold->setChecked( cell->textFontBold( m_pCanvas->markerColumn(), \
m_pCanvas->markerRow() ) ); @@ -1216,7 +1217,7 @@ void KSpreadView::removeAllTables()
setActiveTable( 0L );
}
-void KSpreadView::setActiveTable( KSpreadTable *_t )
+void KSpreadView::setActiveTable( KSpreadTable *_t,bool updateTable )
{
if ( _t == m_pTable )
return;
@@ -1224,13 +1225,15 @@ void KSpreadView::setActiveTable( KSprea
m_pTable = _t;
if ( m_pTable == 0L )
return;
-
+ if(updateTable)
+ {
m_pTabBar->setActiveTab( _t->tableName() );
m_pVBorderWidget->repaint();
m_pHBorderWidget->repaint();
m_pCanvas->repaint();
m_pCanvas->slotMaxColumn( m_pTable->maxColumn() );
m_pCanvas->slotMaxRow( m_pTable->maxRow() );
+ }
}
void KSpreadView::slotTableActivated( KSpreadTable* table )
@@ -1263,8 +1266,10 @@ void KSpreadView::changeTable( const QSt
kdDebug(36001) << "Unknown table " << _name << endl;
return;
}
+
+ setActiveTable( t,false );
+
t->setActiveTable();
- setActiveTable( t );
updateEditWidget();
Index: kspread_view.h
===================================================================
RCS file: /home/kde/koffice/kspread/kspread_view.h,v
retrieving revision 1.104
diff -u -p -r1.104 kspread_view.h
--- kspread_view.h 2000/08/26 06:27:46 1.104
+++ kspread_view.h 2000/08/27 11:17:21
@@ -91,7 +91,7 @@ public:
void addTable( KSpreadTable *_t );
//void removeTable( KSpreadTable *_t );
void removeAllTables();
- void setActiveTable( KSpreadTable *_t );
+ void setActiveTable( KSpreadTable *_t,bool updateTable=true );
const KSpreadTable* activeTable() const { return m_pTable; }
KSpreadTable* activeTable() { return m_pTable; }
cvs server: Diffing dtd
cvs server: Diffing extensions
cvs server: Diffing filters
cvs server: Diffing filters/csv
cvs server: Diffing filters/komma
cvs server: Diffing pics
cvs server: Diffing plugins
cvs server: Diffing plugins/calculator
cvs server: Diffing plugins/calculator/pics
cvs server: Diffing scripts
cvs server: Diffing tablestyles
cvs server: Diffing toolbar
cvs server: Diffing toolbar/hicolor
cvs server: Diffing toolbar/locolor
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic