[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 90127] reversed sheet are not displayed correctly
From:       Meni Livne <livne () kde ! org>
Date:       2004-10-09 13:20:27
Message-ID: 20041009132027.884.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
        
http://bugs.kde.org/show_bug.cgi?id=90127        




------- Additional Comments From livne kde org  2004-10-09 15:20 -------
CVS commit by livne: 

Fix problems related to moving the mouse over cells in RTL sheets (tooltips,
selection handles, links...).

CCMAIL: 90127 bugs kde org


  M +49 -22    kspread_canvas.cc   1.429


--- koffice/kspread/kspread_canvas.cc  #1.428:1.429
 @ -989,19 +989,15  @ void KSpreadCanvas::mouseMoveEvent( QMou
   }
 
+  double dwidth = doc()->unzoomItX( width() );
   double ev_PosX;
   if ( table->layoutDirection()==KSpreadSheet::RightToLeft )
-    ev_PosX = doc()->unzoomItX( _ev->pos().x() ) - xOffset();
+    ev_PosX = dwidth - doc()->unzoomItX( _ev->pos().x() ) + xOffset();
   else
     ev_PosX = doc()->unzoomItX( _ev->pos().x() ) + xOffset();
   double ev_PosY = doc()->unzoomItY( _ev->pos().y() ) + yOffset();
-  double dwidth = doc()->unzoomItX( width() );
 
   double xpos;
   double ypos;
-  int col;
-  if ( table->layoutDirection()==KSpreadSheet::RightToLeft )
-    col = table->leftColumn( dwidth - ev_PosX, xpos );
-  else
-    col = table->leftColumn( ev_PosX, xpos );
+  int col = table->leftColumn( ev_PosX, xpos );
   int row  = table->topRow( ev_PosY, ypos );
 
 @ -1036,5 +1032,10  @ void KSpreadCanvas::mouseMoveEvent( QMou
   {
     KSpreadCell *cell = table->visibleCellAt( col, row );
-    QString anchor = cell->testAnchor( doc()->zoomItX( ev_PosX - xpos ),
+    QString anchor;
+    if ( table->layoutDirection()==KSpreadSheet::RightToLeft )
+      anchor = cell->testAnchor( doc()->zoomItX( cell->dblWidth() - ev_PosX +
+                               xpos ), doc()->zoomItY( ev_PosY - ypos ) );    
+    else
+      anchor = cell->testAnchor( doc()->zoomItX( ev_PosX - xpos ),
                                        doc()->zoomItY( ev_PosY - ypos ) );
     if ( !anchor.isEmpty() && anchor != m_strAnchor )
 @ -1049,13 +1050,15  @ void KSpreadCanvas::mouseMoveEvent( QMou
     //If the cursor is over the hanlde, than it might be already on the next cell.
     //Recalculate the cell!
-    if ( table->layoutDirection()==KSpreadSheet::RightToLeft )
-      col = table->leftColumn( dwidth - ev_PosX - doc()->unzoomItX( 2 ), xpos );
-    else
       col  = table->leftColumn( ev_PosX - doc()->unzoomItX( 2 ), xpos );
     row  = table->topRow( ev_PosY - doc()->unzoomItY( 2 ), ypos );
 
     if ( !table->isProtected() )
+    {
+      if ( table->layoutDirection()==KSpreadSheet::RightToLeft )
+        setCursor( sizeBDiagCursor );
+      else
       setCursor( sizeFDiagCursor );
   }
+  }
   else if ( !m_strAnchor.isEmpty() )
   {
 @ -5599,6 +5602,14  @ void KSpreadToolTip::maybeTip( const QPo
     // Over which cell is the mouse ?
     double ypos, xpos;
-    int col = table->leftColumn( (m_canvas->doc()->unzoomItX( p.x() ) +
+    double dwidth = m_canvas->doc()->unzoomItX( m_canvas->width() );
+    int col;
+    if ( table->layoutDirection()==KSpreadSheet::RightToLeft )
+      col = table->leftColumn( (dwidth - m_canvas->doc()->unzoomItX( p.x() ) +
                                        m_canvas->xOffset()), xpos );
+    else
+      col = table->leftColumn( (m_canvas->doc()->unzoomItX( p.x() ) +
+                                     m_canvas->xOffset()), xpos );
+
+
     int row = table->topRow( (m_canvas->doc()->unzoomItY( p.y() ) +
                                    m_canvas->yOffset()), ypos );
 @ -5650,5 +5661,7  @ void KSpreadToolTip::maybeTip( const QPo
 
     // Get the cell dimensions
-    KoRect unzoomedMarker( xpos - m_canvas->xOffset(),
+    if ( table->layoutDirection()==KSpreadSheet::RightToLeft )
+    {
+      KoRect unzoomedMarker( dwidth - u - xpos + m_canvas->xOffset(),
                            ypos - m_canvas->yOffset(),
                            u,
 @ -5654,10 +5667,24  @ void KSpreadToolTip::maybeTip( const QPo
                            u,
                            v );
+
     QRect marker( m_canvas->doc()->zoomRect( unzoomedMarker ) );
+      if ( marker.contains( p ) )
+      {
+          tip( marker, comment );
+      }
+    }
+    else
+    {
+      KoRect unzoomedMarker( xpos - m_canvas->xOffset(),
+                             ypos - m_canvas->yOffset(),
+                             u,
+                             v );
 
+      QRect marker( m_canvas->doc()->zoomRect( unzoomedMarker ) );
     if ( marker.contains( p ) )
     {
         tip( marker, comment );
     }
+    }
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic