summaryrefslogtreecommitdiffstats
path: root/scribus/pageitem_textframe.cpp
diff options
context:
space:
mode:
authorjghali <jghali@11d20701-8431-0410-a711-e3c959e3b870>2012-03-11 14:31:34 +0000
committerjghali <jghali@11d20701-8431-0410-a711-e3c959e3b870>2012-03-11 14:31:34 +0000
commit29534203a4b63a4488d1de767dd11eed4bc09b3e (patch)
tree2e6b7e504f8e3db17992f2fc91eb8783fb7da8fb /scribus/pageitem_textframe.cpp
parentad42cec17b6be9475517d985fe4ca229b4f6bde1 (diff)
downloadscribus-29534203a4b63a4488d1de767dd11eed4bc09b3e.tar.gz
scribus-29534203a4b63a4488d1de767dd11eed4bc09b3e.tar.xz
scribus-29534203a4b63a4488d1de767dd11eed4bc09b3e.zip
#10520: no linebreak when using negative fist line indent in narrow frames
git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17372 11d20701-8431-0410-a711-e3c959e3b870
Diffstat (limited to 'scribus/pageitem_textframe.cpp')
-rw-r--r--scribus/pageitem_textframe.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/scribus/pageitem_textframe.cpp b/scribus/pageitem_textframe.cpp
index b5b0378..d00d9b7 100644
--- a/scribus/pageitem_textframe.cpp
+++ b/scribus/pageitem_textframe.cpp
@@ -1562,25 +1562,41 @@ void PageItem_TextFrame::layout()
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);