[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/lib/kotext
From: David Faure <faure () kde ! org>
Date: 2006-03-03 10:30:59
Message-ID: 1141381859.038840.3056.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 515279 by dfaure:
Fix for rounding problem with right-aligned tabs slightly after the right of the \
frame (this happens with table of contents too)
CCMAIL: Marco Menardi <mmenaz@mail.com>
M +2 -2 KoTextFormatter.cpp
M +11 -2 KoTextParag.cpp
M +1 -1 KoTextParag.h
--- trunk/koffice/lib/kotext/KoTextFormatter.cpp #515278:515279
@@ -104,7 +104,7 @@
#endif
}
} else { // tab
- int nx = parag->nextTab( i, x );
+ int nx = parag->nextTab( i, x, availableWidth );
if ( nx < x )
ww = availableWidth - x;
else
@@ -503,7 +503,7 @@
initialLMargin = x;
availableWidth = dw - initialRMargin;
if ( parag->isNewLinesAllowed() && c->c == '\t' ) {
- int nx = parag->nextTab( i, x );
+ int nx = parag->nextTab( i, x, availableWidth );
if ( nx < x )
ww = availableWidth - x;
else
--- trunk/koffice/lib/kotext/KoTextParag.cpp #515278:515279
@@ -2092,7 +2092,7 @@
}
/** "Reimplemented" (compared to nextTabDefault) to implement non-left-aligned tabs \
*/
-int KoTextParag::nextTab( int chnum, int x )
+int KoTextParag::nextTab( int chnum, int x, int availableWidth )
{
if ( !m_layout.tabList().isEmpty() )
{
@@ -2107,8 +2107,17 @@
while ( i >= 0 && i < (int)m_layout.tabList().size() ) {
//kdDebug(32500) << "KoTextParag::nextTab tArray[" << i << "]=" << \
tArray[i] << " type " << m_layout.tabList()[i].type << endl; int tab = tArray[ i ];
+
+ // Fix for small rounding problems (especially when importing documents \
from OOo) + // If a right-aligned tab is slightly after the right edge \
then assume + // that it -is- on the right edge, otherwise the last \
letters will fall off. + if ( tab > availableWidth && tab - availableWidth \
< 100 /* 5pt */ ) { + kdDebug(32500) << "Tab position adjusted to \
availableWidth=" << availableWidth << endl; + tab = availableWidth;
+ }
+
if ( str->isRightToLeft() )
- tab = rect().width() - tab;
+ tab = availableWidth - tab;
if ( tab > x ) {
int type = m_layout.tabList()[i].type;
--- trunk/koffice/lib/kotext/KoTextParag.h #515278:515279
@@ -166,7 +166,7 @@
int widthUsed() const;
int nextTabDefault( int i, int x );
- int nextTab( int i, int x );
+ int nextTab( int i, int x, int availableWidth );
int *tabArray() const;
void setTabArray( int *a );
void setTabStops( int tw );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic