r21238 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 24 12:58:54 UTC 2016


Author: jghali
Date: Sun Apr 24 12:58:54 2016
New Revision: 21238

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21238
Log:
#13979: Incorrect colors when copy-pasting table to other doc

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

Modified: trunk/Scribus/scribus/pageitem_table.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21238&path=/trunk/Scribus/scribus/pageitem_table.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_table.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_table.cpp	Sun Apr 24 12:58:54 2016
@@ -78,6 +78,100 @@
 		m_activeCell.textFrame()->currentTextProps(parStyle);
 	else
 		parStyle = this->itemText.defaultStyle();
+}
+
+void PageItem_Table::getNamedResources(ResourceCollection& lists) const
+{
+	TableBorder lborder = leftBorder();
+	foreach (const TableBorderLine& line, lborder.borderLines())
+	{
+		if (line.color() == CommonStrings::None)
+			continue;
+		lists.collectColor(line.color());
+	}
+
+	TableBorder rborder = rightBorder();
+	foreach (const TableBorderLine& line, rborder.borderLines())
+	{
+		if (line.color() == CommonStrings::None)
+			continue;
+		lists.collectColor(line.color());
+	}
+
+	TableBorder bborder = bottomBorder();
+	foreach (const TableBorderLine& line, bborder.borderLines())
+	{
+		if (line.color() == CommonStrings::None)
+			continue;
+		lists.collectColor(line.color());
+	}
+
+	TableBorder tborder = topBorder();
+	foreach (const TableBorderLine& line, tborder.borderLines())
+	{
+		if (line.color() == CommonStrings::None)
+			continue;
+		lists.collectColor(line.color());
+	}
+
+	QString tableStyleName = this->styleName();
+	if (!tableStyleName.isEmpty())
+		lists.collectTableStyle(tableStyleName);
+
+	for (int row = 0; row < rows(); ++row)
+	{
+		int colSpan = 0;
+		for (int col = 0; col < columns(); col += colSpan)
+		{
+			TableCell cell = cellAt(row, col);
+			PageItem_TextFrame* textFrame = cell.textFrame();
+			textFrame->getNamedResources(lists);
+
+			QString cellStyle = cell.styleName();
+			if (!cellStyle.isEmpty())
+				lists.collectCellStyle(cellStyle);
+
+			QString cellFill = cell.fillColor();
+			if (cellFill != CommonStrings::None)
+				lists.collectColor(cellFill);
+
+			lborder = cell.leftBorder();
+			foreach (const TableBorderLine& line, lborder.borderLines())
+			{
+				if (line.color() == CommonStrings::None)
+					continue;
+				lists.collectColor(line.color());
+			}
+
+			rborder = cell.rightBorder();
+			foreach (const TableBorderLine& line, rborder.borderLines())
+			{
+				if (line.color() == CommonStrings::None)
+					continue;
+				lists.collectColor(line.color());
+			}
+
+			bborder = cell.bottomBorder();
+			foreach (const TableBorderLine& line, bborder.borderLines())
+			{
+				if (line.color() == CommonStrings::None)
+					continue;
+				lists.collectColor(line.color());
+			}
+
+			tborder = cell.topBorder();
+			foreach (const TableBorderLine& line, tborder.borderLines())
+			{
+				if (line.color() == CommonStrings::None)
+					continue;
+				lists.collectColor(line.color());
+			}
+
+			colSpan = cell.columnSpan();
+		}
+	}
+
+	PageItem::getNamedResources(lists);
 }
 
 void PageItem_Table::resize(double width, double height)

Modified: trunk/Scribus/scribus/pageitem_table.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21238&path=/trunk/Scribus/scribus/pageitem_table.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_table.h	(original)
+++ trunk/Scribus/scribus/pageitem_table.h	Sun Apr 24 12:58:54 2016
@@ -481,6 +481,9 @@
 	/// Returns the rows of the table for writing to SLA
 	QList<QList<TableCell> > cellRows() const { return m_cellRows; }
 
+	// Collect named resource of table and its cells
+	virtual void getNamedResources(ResourceCollection& lists) const;
+
 signals:
 	/// This signal is emitted whenever the table changes.
 	void changed();




More information about the scribus-commit mailing list