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

List:       kde-commits
Subject:    koffice/kspread/ui
From:       Marijn Kruisselbrink <m.kruisselbrink () student ! tue ! nl>
Date:       2010-09-20 11:05:27
Message-ID: 20100920110527.3B007AC88E () svn ! kde ! org
[Download RAW message or body]

SVN commit 1177488 by mkruisselbrink:

properly handle indentation when rendering cell-text
BUG: 250672

 M  +11 -5     CellView.cpp  


--- trunk/koffice/kspread/ui/CellView.cpp #1177487:1177488
@@ -1903,10 +1903,12 @@
 
     const bool tmpVerticalText = d->style.verticalText();
     const bool tmpAngled = fixAngle(d->style.angle()) != 0;
+    const qreal tmpIndent = cell.isEmpty() || d->style.halign() != Style::Left ? 0.0 \
                : style().indentation();
     const qreal lineWidth = tmpAngled ? 1e9 : tmpVerticalText ? \
fontMetrics.maxWidth() :  (d->width - 2 * s_borderSpace
                              - 0.5 * d->style.leftBorderPen().width()
-                             - 0.5 * d->style.rightBorderPen().width());
+                             - 0.5 * d->style.rightBorderPen().width())
+                             - tmpIndent;
 
     qreal offset = 1.0 - fontMetrics.ascent();
     for (int i = 0; i < textLines.count(); ++i) {
@@ -2015,6 +2017,12 @@
     const qreal leading = fontMetrics.leading();
     const QTextOption options = textOptions();
 
+    const qreal tmpIndent = style.halign() != Style::Left ? 0.0 : \
style.indentation(); +    const qreal lineWidth = (width - 2 * s_borderSpace
+                             - 0.5 * style.leftBorderPen().width()
+                             - 0.5 * style.rightBorderPen().width())
+                             - tmpIndent;
+
     textHeight = 0.0;
     textWidth = 0.0;
     textLinesCount = 0;
@@ -2029,7 +2037,7 @@
             QTextLine line = textLayout.createLine();
             if (!line.isValid())
                 break; // forever
-            line.setLineWidth(width);
+            line.setLineWidth(lineWidth);
             textHeight += leading + line.height();
             if ((textHeight - fontMetrics.descent()) > (height - 2 * s_borderSpace
                     - 0.5 * style.topBorderPen().width()
@@ -2043,9 +2051,7 @@
     }
     // The width fits, if the text is wrapped or all lines are smaller than the cell \
width.  fittingWidth = style.wrapText() ||
-                   textWidth <= (width - 2 * s_borderSpace
-                                 - 0.5 * style.leftBorderPen().width()
-                                 - 0.5 * style.rightBorderPen().width());
+                   textWidth <= lineWidth;
 }
 
 void CellView::Private::calculateVerticalTextSize(const QFont& font, const \
QFontMetricsF& fontMetrics)


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

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