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

List:       kde-commits
Subject:    koffice/kspread
From:       Inge Wallin <inge () lysator ! liu ! se>
Date:       2005-04-25 6:37:02
Message-ID: 20050425063702.B994A488 () office ! kde ! org
[Download RAW message or body]

CVS commit by ingwa: 

One more fix of painting of multi line text in a cell


  M +1 -1      TODO   1.115
  M +9 -7      kspread_cell.cc   1.710
  M +2 -1      tests/inspector.cc   1.6


--- koffice/kspread/TODO  #1.114:1.115
@@ -136,5 +136,5 @@
   + Repeated rows and columns don't work if they don't start from     2 ----
     row/column 1.   Also it is not possible to enter just one
-    row/column into the dialog, it alays has to be a range (2:3).
+    row/column into the dialog, it always has to be a range (2:3).
     - Make repeated rows/cols work with ranges that don't start at 1  2 --
     - Make it possible to enter just one row/column into GUI, don't   2 --

--- koffice/kspread/kspread_cell.cc  #1.709:1.710
@@ -1210,6 +1210,6 @@ void KSpreadCell::makeLayout( QPainter &
        && multiRow( _col, _row ) )
   {
-    // copy of d->strOutText
-    QString o = d->strOutText;
+    // Copy of d->strOutText but without the newlines.
+    QString  o = d->strOutText.replace( QChar('\n'), " " );
 
     // Break the line at appropriate places, i.e. spaces, if
@@ -1225,13 +1225,15 @@ void KSpreadCell::makeLayout( QPainter &
       int breakpos = 0;         // The next candidate pos to break the string
       int pos1 = 0;
+      int availableWidth = ( width - 2 * BORDER_SPACE
+                             - leftBorderWidth( _col, _row ) 
+                             - rightBorderWidth( _col, _row ) );
+
       do {
         breakpos = o.find( ' ', breakpos );
-        double textwidth = m_pSheet->doc()
+        double lineWidth = m_pSheet->doc()
           ->unzoomItX( fm.width( d->strOutText.mid( start, (pos1 - start) )
                                  + o.mid( pos1, breakpos - pos1 ) ) );
 
-        if ( textwidth <= ( width - 2 * BORDER_SPACE
-                            - leftBorderWidth( _col, _row ) 
-                            - rightBorderWidth( _col, _row ) ) ) {
+        if ( lineWidth <= availableWidth ) {
           // We have room for the rest of the line.  End it here.
           d->strOutText += o.mid( pos1, breakpos - pos1 );
@@ -2812,5 +2814,5 @@ void KSpreadCell::paintText( QPainter& p
   QPen tmpPen( textColorPrint );
 
-  // Set the font according to condition.
+  // Set the font according to the current zoom.
   applyZoomedFont( painter, cellRef.x(), cellRef.y() );
 

--- koffice/kspread/tests/inspector.cc  #1.5:1.6
@@ -93,5 +93,6 @@ void Inspector::Private::handleCell()
   new QListViewItem( cellView, "Properties", longAsHexstring( \
static_cast<long>(cell->kspreadStyle()->features()) ) );  new QListViewItem( \
                cellView, "Text", cell->text() );
-  new QListViewItem( cellView, "Text (Displayed)", cell->strOutText() );
+  new QListViewItem( cellView, "Text (Displayed)", 
+                     cell->strOutText().replace( QChar('\n'), "\\n" ) );
 
   QTextStream ts( &str, IO_WriteOnly );


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

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