r20633 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Tue Dec 29 11:15:39 UTC 2015


Author: jghali
Date: Tue Dec 29 11:15:39 2015
New Revision: 20633

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20633
Log:
#13247: Table cell border color information not correct after save/reload

Modified:
    trunk/Scribus/scribus/pageitem_table.cpp
    trunk/Scribus/scribus/pageitem_table.h
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdcell.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdtable.cpp
    trunk/Scribus/scribus/tablecell.h

Modified: trunk/Scribus/scribus/pageitem_table.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20633&path=/trunk/Scribus/scribus/pageitem_table.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_table.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_table.cpp	Tue Dec 29 11:15:39 2015
@@ -857,7 +857,12 @@
 	emit changed();
 }
 
-QString PageItem_Table::style() const
+const TableStyle& PageItem_Table::style() const
+{
+	return m_style;
+}
+
+QString PageItem_Table::styleName() const
 {
 	return m_style.parent();
 }

Modified: trunk/Scribus/scribus/pageitem_table.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20633&path=/trunk/Scribus/scribus/pageitem_table.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_table.h	(original)
+++ trunk/Scribus/scribus/pageitem_table.h	Tue Dec 29 11:15:39 2015
@@ -58,7 +58,7 @@
 	Q_PROPERTY(TableBorder rightBorder READ rightBorder WRITE setRightBorder RESET unsetRightBorder NOTIFY changed)
 	Q_PROPERTY(TableBorder topBorder READ topBorder WRITE setTopBorder RESET unsetTopBorder NOTIFY changed)
 	Q_PROPERTY(TableBorder bottomBorder READ bottomBorder WRITE setBottomBorder RESET unsetBottomBorder NOTIFY changed)
-	Q_PROPERTY(QString style READ style WRITE setStyle RESET unsetStyle NOTIFY changed)
+	Q_PROPERTY(QString style READ styleName WRITE setStyle RESET unsetStyle NOTIFY changed)
 
 public:
 	/**
@@ -443,7 +443,10 @@
 	void unsetDirectFormatting();
 
 	/// Returns the style of this table.
-	QString style() const;
+	const TableStyle& style() const;
+
+	/// Returns the style name of this table.
+	QString styleName() const;
 
 	/// Updates the position and size of all cell text frames for this table.
 	void updateCells() { updateCells(0, 0, rows() - 1, columns() - 1); }

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20633&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	(original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	Tue Dec 29 11:15:39 2015
@@ -2207,11 +2207,11 @@
 			//PTYPE == PageItem::Table or 16 (pageitem.h)
 			PageItem_Table* tableItem = item->asTable();
 			docu.writeStartElement("TableData");
-			QString tstyle = tableItem->style();
-			docu.writeAttribute("Style", tableItem->style());
+			QString tstyle = tableItem->styleName();
+			docu.writeAttribute("Style", tableItem->styleName());
 			TableStyle ts;
 			if (!tstyle.isEmpty())
-				ts = m_Doc->tableStyle(tstyle);
+				ts = tableItem->style();
 
 			if ((tstyle.isEmpty()) || ((!tstyle.isEmpty()) && (!ts.isInhFillColor())))
 				docu.writeAttribute("FillColor", tableItem->fillColor());
@@ -2288,8 +2288,8 @@
 					PageItem* textFrame = cell.textFrame();
 					docu.writeStartElement("Cell");
 					docu.writeAttribute("Row", cell.row());
-					docu.writeAttribute("Column",cell.column());
-					docu.writeAttribute("Style",cell.style());
+					docu.writeAttribute("Column", cell.column());
+					docu.writeAttribute("Style", cell.styleName());
 					docu.writeAttribute("TextColumns", textFrame->columns());
 					docu.writeAttribute("TextColGap", textFrame->columnGap());
 					docu.writeAttribute("TextDistLeft", textFrame->textToFrameDistLeft());
@@ -2299,10 +2299,10 @@
 					docu.writeAttribute("TextVertAlign", textFrame->verticalAlignment());
 					docu.writeAttribute("Flop", textFrame->firstLineOffset());
 
-					QString cstyle = cell.style();
+					QString cstyle = cell.styleName();
 					CellStyle cs;
-					if (!cell.style().isEmpty())
-						cs = m_Doc->cellStyle(cell.style());
+					if (!cstyle.isEmpty())
+						cs = cell.style();
 					if ((cstyle.isEmpty()) || ((!cstyle.isEmpty()) && ( !cs.isInhFillColor())))
 						docu.writeAttribute("FillColor", cell.fillColor());
 					if ((cstyle.isEmpty()) || ((!cstyle.isEmpty()) && ( !cs.isInhFillShade())))
@@ -2709,7 +2709,7 @@
 		docu.writeAttribute("CellAreas", outputData.simplified());
 		outputData.clear();
 
-		docu.writeAttribute("TableStyle",tableItem->style());
+		docu.writeAttribute("TableStyle",tableItem->styleName());
 	}
 
 	if (item->isGroup())

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdcell.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20633&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdcell.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdcell.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdcell.cpp	Tue Dec 29 11:15:39 2015
@@ -61,7 +61,7 @@
 		PyErr_SetString(PyExc_ValueError, QObject::tr("The cell %1,%2 does not exist in table", "python error").arg(row).arg(column).toLocal8Bit().constData());
 		return NULL;
 	}
-	return PyString_FromString(table->cellAt(row, column).style().toUtf8());
+	return PyString_FromString(table->cellAt(row, column).styleName().toUtf8());
 }
 
 PyObject *scribus_setcellstyle(PyObject* /* self */, PyObject* args)

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtable.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20633&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtable.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtable.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtable.cpp	Tue Dec 29 11:15:39 2015
@@ -338,7 +338,7 @@
 		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get table style on a non-table item.","python error").toLocal8Bit().constData());
 		return NULL;
 	}
-	return PyString_FromString(table->style().toUtf8());
+	return PyString_FromString(table->styleName().toUtf8());
 }
 
 PyObject *scribus_settablestyle(PyObject* /* self */, PyObject* args)

Modified: trunk/Scribus/scribus/tablecell.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20633&path=/trunk/Scribus/scribus/tablecell.h
==============================================================================
--- trunk/Scribus/scribus/tablecell.h	(original)
+++ trunk/Scribus/scribus/tablecell.h	Tue Dec 29 11:15:39 2015
@@ -201,7 +201,10 @@
 	void unsetDirectFormatting();
 
 	/// Returns the named cell style for this cell.
-	QString style() const { return d->style.parent(); }
+	const CellStyle& style() const { return d->style; }
+
+	/// Returns the cell style name for this cell.
+	QString styleName() const { return d->style.parent(); }
 
 	/// Sets the text for this cell to @a text.
 	void setText(const QString& text);




More information about the scribus-commit mailing list