r22292 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Fri Dec 29 00:13:05 UTC 2017


Author: jghali
Date: Fri Dec 29 00:13:04 2017
New Revision: 22292

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22292
Log:
#15085: Linked text restart at beginning of linked frame

Modified:
    trunk/Scribus/scribus/text/boxes.h
    trunk/Scribus/scribus/text/textlayout.cpp

Modified: trunk/Scribus/scribus/text/boxes.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22292&path=/trunk/Scribus/scribus/text/boxes.h
==============================================================================
--- trunk/Scribus/scribus/text/boxes.h	(original)
+++ trunk/Scribus/scribus/text/boxes.h	Fri Dec 29 00:13:04 2017
@@ -121,6 +121,12 @@
 	const QList<const Box*>& boxes() const {
 		return reinterpret_cast<const QList<const Box*> & > (m_boxes);
 	}
+
+	/// Returns the number of child boxes
+	int boxCount() const { return m_boxes.count(); }
+
+	/// Returns if current box contains any child boxes
+	bool isEmpty() const { return m_boxes.isEmpty(); }
 
 	/// Renders the box and any boxes it contains, recursively.
 	virtual void render(TextLayoutPainter *p) const = 0;

Modified: trunk/Scribus/scribus/text/textlayout.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22292&path=/trunk/Scribus/scribus/text/textlayout.cpp
==============================================================================
--- trunk/Scribus/scribus/text/textlayout.cpp	(original)
+++ trunk/Scribus/scribus/text/textlayout.cpp	Fri Dec 29 00:13:04 2017
@@ -259,26 +259,51 @@
 
 int TextLayout::startOfFrame() const
 {
-	QList<Box*>& boxes = m_box->boxes();
-	if (boxes.isEmpty())
+	if (m_box->isEmpty())
 		return 0;
+	const QList<Box*>& boxes = m_box->boxes();
 
 	const GroupBox* column = dynamic_cast<const GroupBox*>(boxes.first());
 	assert(column);
 
-	return column->firstChar();
+	// Beware of columns hidden by other objects
+	if (column->boxCount() > 0)
+		return column->firstChar();
+	
+	int columnCount = boxes.count();
+	for (int i = 1; i < columnCount; ++i)
+	{
+		column = dynamic_cast<const GroupBox*>(boxes.at(i));
+		assert(column);
+
+		if (!column->isEmpty())
+			return column->firstChar();
+	}
+
+	return 0;
 }
 
 int TextLayout::endOfFrame() const
 {
-	QList<Box*>& boxes = m_box->boxes();
-	if (boxes.isEmpty())
+	if (m_box->isEmpty())
 		return 0;
-
-	const GroupBox* column = dynamic_cast<const GroupBox*>(boxes.last());
-	assert(column);
-
-	return column->lastChar() + 1;
+	const QList<Box*>& boxes = m_box->boxes();
+
+	// Beware of columns hidden by other objects
+	const GroupBox* column = 0;
+	int columnIndex = boxes.count() - 1;
+	do
+	{
+		column = dynamic_cast<const GroupBox*>(boxes.at(columnIndex));
+		assert(column);
+
+		if (!column->isEmpty())
+			return column->lastChar() + 1;
+		--columnIndex;
+	}
+	while (columnIndex >= 0);
+
+	return 0;
 }
 
 




More information about the scribus-commit mailing list