r17372 by jghali - #10520: no linebreak when using negative fist line indent in narrow frames

scribus-commit scribus-commit at lists.scribus.net
Sun Mar 11 14:31:35 UTC 2012


Author: jghali
Date: Sun Mar 11 14:31:34 2012
New Revision: 17372

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17372
Log:
#10520: no linebreak when using negative fist line indent in narrow frames

Modified:
    branches/Version14x/Scribus/scribus/pageitem_textframe.cpp

Modified: branches/Version14x/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17372&path=/branches/Version14x/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/pageitem_textframe.cpp (original)
+++ branches/Version14x/Scribus/scribus/pageitem_textframe.cpp Sun Mar 11 14:31:34 2012
@@ -1562,25 +1562,41 @@
 				double Xpos, Xend;
 				bool done = false;
 				bool newColumn = false;
+
+				//FIX ME - that should be paragraph style`s properties
+				//if set then indent is add to possible line start point (after overflow)
+				//if not then indent is calculated from column left edge
+				//if you dont agree that adding indent to overflow should be default behaviour 
+				//then change it to false
+				bool addIndent2overflow = false; // should be addIndent2Overflow = style.addIndent2Overlow();
+				bool addFirstIndent2overflow = true; // should be addFirstIndent2Overflow = style.addFirstIndent2Overlow();
+				//if first line indent is negative and left indent should not be added to overflow
+				//then dont add first line ident either
+				if ((style.firstIndent() < 0) && !addIndent2overflow)
+					addFirstIndent2overflow = false;
+
 				while (!done)
 				{
-					Xpos = current.xPos;
+					Xpos = current.xPos + (addIndent2overflow ? 0 : current.leftIndent);
 					Xend = current.xPos + current.leftIndent;
 					//check if in indent any overflow occurs
 					while (Xpos <= Xend && Xpos < current.colRight)
 					{
+						pt.moveTopLeft(QPoint(static_cast<int>(floor(Xpos)),maxYAsc));
 						if (!regionContainsRect(cl, pt))
 						{
 							Xpos = current.xPos = realEnd = findRealOverflowEnd(cl, pt, current.colRight);
-							Xend = current.xPos + current.leftIndent;
+							Xend = current.xPos + (addIndent2overflow ? current.leftIndent : 0);
+							//for first paragraph`s line - move it back if first line offset should not be add
+							if ( addFirstIndent2overflow && (a==0 || (a > 0 && (itemText.text(a-1) == SpecialChars::PARSEP))))
+								Xend += style.firstIndent();
 						}
 						else
 							Xpos++;
-						pt.moveTopLeft(QPoint(static_cast<int>(floor(Xpos)),maxYAsc));
 					}
 					current.xPos = Xend;
 					done = true;
-					if (current.isEndOfLine((style.minGlyphExtension() * wide) + current.rightMargin + current.leftIndent))
+					if (current.isEndOfLine((style.minGlyphExtension() * wide) + current.rightMargin))
 					{
 						// new line
 						current.xPos = qMax(current.colLeft, maxDX);




More information about the scribus-commit mailing list