r21708 by jghali - implements getItemList() for table items and make geItemList() const

scribus-commit scribus-commit at lists.scribus.net
Sun Jan 8 12:56:22 UTC 2017


Author: jghali
Date: Sun Jan  8 12:56:22 2017
New Revision: 21708

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21708
Log:
implements getItemList() for table items and make geItemList() const

Modified:
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem.h
    trunk/Scribus/scribus/pageitem_group.cpp
    trunk/Scribus/scribus/pageitem_group.h
    trunk/Scribus/scribus/pageitem_table.cpp
    trunk/Scribus/scribus/pageitem_table.h

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21708&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp	(original)
+++ trunk/Scribus/scribus/pageitem.cpp	Sun Jan  8 12:56:22 2017
@@ -4404,10 +4404,9 @@
 		toggleLock();
 }
 
-QList<PageItem*> PageItem::getItemList()
+QList<PageItem*> PageItem::getItemList() const
 {
 	QList<PageItem*> ret;
-	ret.clear();
 	return ret;
 }
 

Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21708&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h	(original)
+++ trunk/Scribus/scribus/pageitem.h	Sun Jan  8 12:56:22 2017
@@ -475,7 +475,7 @@
 	void setDashes(QVector<double> val) { DashValues = val; }
 	double dashOffset() const { return DashOffset; }
 	void setDashOffset(double val) { DashOffset = val; }
-	virtual QList<PageItem*> getItemList();
+	virtual QList<PageItem*> getItemList() const;
 
 	//<< ********* Attributes of the item *********
 	//Position

Modified: trunk/Scribus/scribus/pageitem_group.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21708&path=/trunk/Scribus/scribus/pageitem_group.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_group.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_group.cpp	Sun Jan  8 12:56:22 2017
@@ -70,7 +70,7 @@
 	}
 }
 
-QList<PageItem*> PageItem_Group::getItemList()
+QList<PageItem*> PageItem_Group::getItemList() const
 {
 	QList<PageItem*> ret;
 	for (int em = 0; em < groupItemList.count(); ++em)

Modified: trunk/Scribus/scribus/pageitem_group.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21708&path=/trunk/Scribus/scribus/pageitem_group.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_group.h	(original)
+++ trunk/Scribus/scribus/pageitem_group.h	Sun Jan  8 12:56:22 2017
@@ -44,7 +44,7 @@
 	virtual bool isGroup() const { return true; }
 	virtual ItemType realItemType() const { return PageItem::Group; }
 	void adjustXYPosition();
-	virtual QList<PageItem*> getItemList();
+	virtual QList<PageItem*> getItemList() const;
 	virtual void setLayer(int layerId);
 	virtual void getNamedResources(ResourceCollection& lists) const;
 	virtual void replaceNamedResources(ResourceCollection& newNames);

Modified: trunk/Scribus/scribus/pageitem_table.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21708&path=/trunk/Scribus/scribus/pageitem_table.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_table.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_table.cpp	Sun Jan  8 12:56:22 2017
@@ -78,6 +78,28 @@
 		m_activeCell.textFrame()->currentTextProps(parStyle);
 	else
 		parStyle = this->itemText.defaultStyle();
+}
+
+QList<PageItem*> PageItem_Table::getItemList() const
+{
+	QList<PageItem*> ret;
+
+	int numRows = this->rows();
+	int numColums = this->columns();
+	for (int row = 0; row < numRows; ++row)
+	{
+		for (int col = 0; col < numColums; ++col)
+		{
+			TableCell cell = cellAt(row, col);
+			if (cell.row() == row && cell.column() == col)
+			{
+				PageItem* textFrame = cell.textFrame();
+				ret.append(textFrame);
+			}
+		}
+	}
+
+	return ret;
 }
 
 void PageItem_Table::getNamedResources(ResourceCollection& lists) const

Modified: trunk/Scribus/scribus/pageitem_table.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21708&path=/trunk/Scribus/scribus/pageitem_table.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_table.h	(original)
+++ trunk/Scribus/scribus/pageitem_table.h	Sun Jan  8 12:56:22 2017
@@ -94,6 +94,9 @@
 	/// Return current text properties (current char + paragraph properties)
 	virtual void currentTextProps(ParagraphStyle& parStyle) const;
 
+	/// Return the list of cell items
+	virtual QList<PageItem*> getItemList() const;
+
 	/// Returns the number of rows in the table.
 	int rows() const { return m_rows; }
 




More information about the scribus-commit mailing list