[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-29 18:44:02
[Download RAW message or body]
Hi,
I improved my old patch (sunday's patch)
In this patch, I saved old position when I across a merged cell.
Now it works.
So could you test it please
["patch35.diff" (text/plain)]
? patch29.diff
? 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.145
diff -p -u -r1.145 kspread_canvas.cc
--- kspread_canvas.cc 2000/08/27 16:06:02 1.145
+++ kspread_canvas.cc 2000/08/29 18:41:12
@@ -389,7 +389,7 @@ 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; @@ -397,26 +397,80 @@ void KSpreadCanvas::gotoLocation( int x,
table->setActiveTable();
else
table = activeTable();
-
+ QRect extraArea;
+ QRect tmpArea;
KSpreadCell* cell = table->cellAt( x, y );
if ( cell->isObscured() && cell->isObscuringForced() )
- {
+ {
int moveX=cell->obscuringCellsColumn();
int moveY=cell->obscuringCellsRow();
cell = table->cellAt( moveX, moveY );
QRect extraCell;
extraCell.setCoords(moveX,moveY,moveX+cell->extraXCells(),moveY+cell->extraYCells());
if( (x-markerColumn())!=0 && \
extraCell.contains(QPoint(markerColumn(),markerRow())))
- x=cell->extraXCells()+x;
+ {
+ extraArea.setCoords(markerColumn(),1,cell->extraXCells()+x-1,0x7FFF);
+ if(keyPress)
+ {
+ tmpArea.setCoords(1,markerRow(),0x7FFF,cell->extraYCells()+markerRow());
+ if(!extraArea.contains(table->getOldPos().x(),1)&& \
tmpArea.contains(1,table->getOldPos().y())) + \
y=table->getOldPos().y(); + else if( \
extraArea.contains(table->getOldPos().x(),1)&& \
table->getOldPos().y()==(cell->extraYCells()+y+1)) + \
y=table->getOldPos().y()-1; + x=cell->extraXCells()+x;
+ }
+ }
else if((y-markerRow())!=0 && \
extraCell.contains(QPoint(markerColumn(),markerRow()))) + {
+ extraArea.setCoords(1,markerRow(),0x7FFF,cell->extraYCells()+y-1);
+
+ tmpArea.setCoords(markerColumn(),1,cell->extraXCells()+markerColumn(),0x7FFF);
+ if(keyPress)
+ {
+ if( \
!extraArea.contains(1,table->getOldPos().y())&&tmpArea.contains(table->getOldPos().x(),1))
+ x=table->getOldPos().x();
+ else if(/* extraArea.contains(1,table->getOldPos().y())&&*/ \
table->getOldPos().x()==(cell->extraXCells()+markerColumn()+1)) + \
x=table->getOldPos().x()-1; + }
y=cell->extraYCells()+y;
- else
+ }
+ 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);
+ tmpArea.setCoords(1,markerRow(),0x7FFF,cell->extraYCells()+markerRow());
+ if( !extraArea.contains(QPoint(table->getOldPos().x(),1))&& \
tmpArea.contains(1,table->getOldPos().y())) + \
y=table->getOldPos().y(); + else if( \
extraArea.contains(table->getOldPos().x(),1)&& \
table->getOldPos().y()==(cell->extraYCells()+markerRow()+1)) + \
y=table->getOldPos().y()-1; + }
+ else if(keyPress && (y-markerRow())!=0 )
+ {
+ tmpArea.setCoords(markerColumn(),1,cell->extraXCells()+markerColumn(),0x7FFF);
+ extraArea.setCoords(1,markerRow(),0x7FFF,cell->extraYCells()+markerRow());
+ if( \
!extraArea.contains(QPoint(1,table->getOldPos().y()))&&tmpArea.contains(table->getOldPos().x(),1))
+ x=table->getOldPos().x();
+ else if( /*extraArea.contains(QPoint(1,table->getOldPos().y()))&&*/ \
table->getOldPos().x()==(cell->extraXCells()+markerColumn()+1)) + \
x=table->getOldPos().x()-1; + }
+ }
+ }
+ 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 );
@@ -442,20 +496,14 @@ void KSpreadCanvas::gotoLocation( int x,
if ( !make_select )
{
- //if ( selection.left() != 0 && !move_into_area)
- // activeTable()->unselect();
- /*
- */
if ( selection.left() != 0 && !move_into_area)
activeTable()->setMarker( QPoint( x, y ) );
else if(selection.left() != 0 && move_into_area)
activeTable()->setSelection(selection,QPoint( x, y ),this);
else
activeTable()->setMarker( QPoint( x, y ) );
- /*
- */
- //activeTable()->setMarker( QPoint( x, y ) );
+
}
else
{
@@ -1286,17 +1334,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;
@@ -1308,9 +1356,9 @@ void KSpreadCanvas::keyPressEvent ( QKey
return;
if ( m_bChoose )
- chooseGotoLocation( chooseMarkerColumn(), QMIN( 0x7FFF, chooseMarkerRow() + \
1 ), 0, make_select ); + 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;
@@ -1324,7 +1372,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;
@@ -1338,7 +1386,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;
@@ -1352,7 +1400,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;
@@ -1384,7 +1432,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;
@@ -1398,7 +1446,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;
@@ -1412,7 +1460,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 -p -u -r1.53 kspread_canvas.h
--- kspread_canvas.h 2000/08/18 21:39:10 1.53
+++ kspread_canvas.h 2000/08/29 18:41:14
@@ -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_table.cc
===================================================================
RCS file: /home/kde/koffice/kspread/kspread_table.cc,v
retrieving revision 1.201
diff -p -u -r1.201 kspread_table.cc
--- kspread_table.cc 2000/08/29 04:33:43 1.201
+++ kspread_table.cc 2000/08/29 18:41:30
@@ -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,17 @@ 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 -p -u -r1.117 kspread_table.h
--- kspread_table.h 2000/08/26 06:27:46 1.117
+++ kspread_table.h 2000/08/29 18:41:37
@@ -516,6 +516,7 @@ public:
void removeTable();
void setActiveTable();
+ QPoint getOldPos() {return m_oldPos;}
/**
* Change name of reference when the user inserts or removes a column,
@@ -889,6 +890,8 @@ protected:
QPen m_emptyPen;
QBrush m_emptyBrush;
QColor m_emptyColor;
+
+ QPoint m_oldPos;
};
#endif
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