[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-23 19:10:07
[Download RAW message or body]

Hi,

I corrected a bug :
-Now before to clear an area or adjust an area I test if area is empty.
An empty area is an area where all cells are empty.

So if area is empty, it's not necessary to clear it, or adjust it.



could you test it and apply it please.

Thanks 
bye

["patch22.diff" (text/plain)]

? 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.142
diff -u -r1.142 kspread_canvas.cc
--- kspread_canvas.cc	2000/08/20 13:00:25	1.142
+++ kspread_canvas.cc	2000/08/23 19:01:26
@@ -2033,6 +2033,9 @@
 {
   QRect selection( activeTable()->selectionRect() );
   QRect rect=selection;
+  if(activeTable()->areaIsEmpty())
+        return;
+
   if(selection.left() == 0)
         rect.setCoords(markerColumn(),markerRow(),markerColumn(),markerRow() );
   if(makeUndo)
Index: kspread_table.cc
===================================================================
RCS file: /home/kde/koffice/kspread/kspread_table.cc,v
retrieving revision 1.196
diff -u -r1.196 kspread_table.cc
--- kspread_table.cc	2000/08/22 18:22:51	1.196
+++ kspread_table.cc	2000/08/23 19:01:51
@@ -1714,7 +1714,6 @@
         else
             kdDebug(36001) << "Error in Series::type" << endl;
         }
-
 }
 
 
@@ -2820,6 +2819,56 @@
   delete tmp;
 }
 
+bool KSpreadTable::areaIsEmpty()
+{
+    bool selected = ( m_rctSelection.left() != 0 );
+
+    // Complete rows selected ?
+    if ( selected && m_rctSelection.right() == 0x7FFF )
+    {
+      KSpreadCell* c = m_cells.firstCell();
+      for( ;c; c = c->nextCell() )
+      {
+      int row = c->row();
+      if ( m_rctSelection.top() <= row && m_rctSelection.bottom() >= row
+      &&!c->isObscuringForced() && !c->text().isEmpty())
+        {
+        return false;
+        }
+      }
+    }
+    else if ( selected && m_rctSelection.bottom() == 0x7FFF )
+    {
+      KSpreadCell* c = m_cells.firstCell();
+      for( ;c; c = c->nextCell() )
+      {
+        int col = c->column();
+        if ( m_rctSelection.left() <= col && m_rctSelection.right() >= col
+        &&!c->isObscuringForced() && !c->text().isEmpty())
+        {
+        return false;
+        }
+      }
+    }
+    else
+    {
+        QRect r( m_rctSelection );
+        if ( !selected )
+            r.setCoords( marker().x(), marker().y(), marker().x(), marker().y() );
+
+        for ( int x = r.left(); x <= r.right(); x++ )
+            for ( int y = r.top(); y <= r.bottom(); y++ )
+            {
+                KSpreadCell *cell = cellAt( x, y );
+                if(!cell->isObscuringForced() && !cell->text().isEmpty())
+                {
+                return false;
+                }
+            }
+    }
+    return true;
+}
+
 void KSpreadTable::setSelectionMultiRow( const QPoint &_marker, bool enable )
 {
     m_pDoc->setModified( true );
@@ -3393,6 +3442,9 @@
 {
     m_pDoc->setModified( true );
     bool selected = ( m_rctSelection.left() != 0 );
+
+    if(areaIsEmpty())
+        return;
 
     // Complete rows selected ?
     if ( selected && m_rctSelection.right() == 0x7FFF )
Index: kspread_table.h
===================================================================
RCS file: /home/kde/koffice/kspread/kspread_table.h,v
retrieving revision 1.114
diff -u -r1.114 kspread_table.h
--- kspread_table.h	2000/08/22 18:22:51	1.114
+++ kspread_table.h	2000/08/23 19:01:54
@@ -507,6 +507,8 @@
     void dissociateCell( const QPoint &_marker, bool makeUndo=true );
     void changeMergedCell( int m_iCol, int m_iRow, int m_iExtraX, int m_iExtraY);
 
+    bool areaIsEmpty();
+
     /**
      * 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]).
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