r17319 by fschmid - Tables: table and cell styles are now working.
scribus-commit
scribus-commit at lists.scribus.net
Tue Feb 21 22:32:40 UTC 2012
Author: fschmid
Date: Tue Feb 21 22:32:40 2012
New Revision: 17319
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17319
Log:
Tables: table and cell styles are now working.
Modified:
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
trunk/Scribus/scribus/ui/smcellstyle.cpp
trunk/Scribus/scribus/ui/smcellstyle.h
trunk/Scribus/scribus/ui/smcellstylewidget.cpp
trunk/Scribus/scribus/ui/smcellstylewidget.ui
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17319&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Tue Feb 21 22:32:40 2012
@@ -4745,7 +4745,7 @@
{
if (tAtt.hasAttribute("Style"))
{
- QString Style = attrs.valueAsString("Style");
+ QString Style = tAtt.valueAsString("Style");
if (!Style.isEmpty())
item->cellAt(row, col).setStyle(Style);
}
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17319&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 Feb 21 22:32:40 2012
@@ -819,54 +819,66 @@
docu.writeAttribute("FillColor", style.fillColor());
if ( ! style.isInhFillShade())
docu.writeAttribute("FillShade", style.fillShade());
- TableBorder tbLeft = style.leftBorder();
- docu.writeStartElement("TableBorderLeft");
- foreach (TableBorderLine tbl, tbLeft.borderLines())
- {
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ if ( ! style.isInhLeftBorder())
+ {
+ TableBorder tbLeft = style.leftBorder();
+ docu.writeStartElement("TableBorderLeft");
+ foreach (TableBorderLine tbl, tbLeft.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
- TableBorder tbRight = style.rightBorder();
- docu.writeStartElement("TableBorderRight");
- foreach (TableBorderLine tbl, tbRight.borderLines())
- {
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ if ( ! style.isInhRightBorder())
+ {
+ TableBorder tbRight = style.rightBorder();
+ docu.writeStartElement("TableBorderRight");
+ foreach (TableBorderLine tbl, tbRight.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
- TableBorder tbTop = style.topBorder();
- docu.writeStartElement("TableBorderTop");
- foreach (TableBorderLine tbl, tbTop.borderLines())
- {
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ if ( ! style.isInhTopBorder())
+ {
+ TableBorder tbTop = style.topBorder();
+ docu.writeStartElement("TableBorderTop");
+ foreach (TableBorderLine tbl, tbTop.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
- TableBorder tbBottom = style.bottomBorder();
- docu.writeStartElement("TableBorderBottom");
- foreach (TableBorderLine tbl, tbBottom.borderLines())
- {
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ if ( ! style.isInhBottomBorder())
+ {
+ TableBorder tbBottom = style.bottomBorder();
+ docu.writeStartElement("TableBorderBottom");
+ foreach (TableBorderLine tbl, tbBottom.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
}
void Scribus150Format::putCellStyle(ScXmlStreamWriter &docu, const CellStyle &style)
@@ -881,58 +893,74 @@
docu.writeAttribute("FillColor", style.fillColor());
if ( ! style.isInhFillShade())
docu.writeAttribute("FillShade", style.fillShade());
- docu.writeAttribute("LeftPadding",style.leftPadding());
- docu.writeAttribute("RightPadding", style.rightPadding());
- docu.writeAttribute("TopPadding",style.topPadding());
- docu.writeAttribute("BottomPadding", style.bottomPadding());
- TableBorder tbLeft = style.leftBorder();
- docu.writeStartElement("TableBorderLeft");
- foreach (TableBorderLine tbl, tbLeft.borderLines())
- {
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ if ( ! style.isInhLeftPadding())
+ docu.writeAttribute("LeftPadding",style.leftPadding());
+ if ( ! style.isInhRightPadding())
+ docu.writeAttribute("RightPadding", style.rightPadding());
+ if ( ! style.isInhTopPadding())
+ docu.writeAttribute("TopPadding",style.topPadding());
+ if ( ! style.isInhBottomPadding())
+ docu.writeAttribute("BottomPadding", style.bottomPadding());
+ if ( ! style.isInhLeftBorder())
+ {
+ TableBorder tbLeft = style.leftBorder();
+ docu.writeStartElement("TableBorderLeft");
+ foreach (TableBorderLine tbl, tbLeft.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
- TableBorder tbRight = style.rightBorder();
- docu.writeStartElement("TableBorderRight");
- foreach (TableBorderLine tbl, tbRight.borderLines())
- {
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ if ( ! style.isInhRightBorder())
+ {
+ TableBorder tbRight = style.rightBorder();
+ docu.writeStartElement("TableBorderRight");
+ foreach (TableBorderLine tbl, tbRight.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
- TableBorder tbTop = style.topBorder();
- docu.writeStartElement("TableBorderTop");
- foreach (TableBorderLine tbl, tbTop.borderLines())
- {
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ if ( ! style.isInhTopBorder())
+ {
+ TableBorder tbTop = style.topBorder();
+ docu.writeStartElement("TableBorderTop");
+ foreach (TableBorderLine tbl, tbTop.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
- TableBorder tbBottom = style.bottomBorder();
- docu.writeStartElement("TableBorderBottom");
- foreach (TableBorderLine tbl, tbBottom.borderLines())
- {
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ if ( ! style.isInhBottomBorder())
+ {
+ TableBorder tbBottom = style.bottomBorder();
+ docu.writeStartElement("TableBorderBottom");
+ foreach (TableBorderLine tbl, tbBottom.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
}
void Scribus150Format::writeLayers(ScXmlStreamWriter & docu)
@@ -1914,57 +1942,76 @@
//PTYPE == PageItem::Table or 16 (pageitem.h)
PageItem_Table* tableItem = item->asTable();
docu.writeStartElement("TableData");
- docu.writeAttribute("FillColor", tableItem->fillColor());
- docu.writeAttribute("FillShade", tableItem->fillShade());
+ QString tstyle = tableItem->style();
docu.writeAttribute("Style", tableItem->style());
- TableBorder tbLeft = tableItem->leftBorder();
- docu.writeStartElement("TableBorderLeft");
- foreach (TableBorderLine tbl, tbLeft.borderLines())
+ TableStyle ts;
+ if (!tstyle.isEmpty())
+ ts = m_Doc->tableStyle(tstyle);
+
+ if ((tstyle.isEmpty()) || ((!tstyle.isEmpty()) && (!ts.isInhFillColor())))
+ docu.writeAttribute("FillColor", tableItem->fillColor());
+ if ((tstyle.isEmpty()) || ((!tstyle.isEmpty()) && ( !ts.isInhFillShade())))
+ docu.writeAttribute("FillShade", tableItem->fillShade());
+ if ((tstyle.isEmpty()) || ((!tstyle.isEmpty()) && ( !ts.isInhLeftBorder())))
{
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ TableBorder tbLeft = tableItem->leftBorder();
+ docu.writeStartElement("TableBorderLeft");
+ foreach (TableBorderLine tbl, tbLeft.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
- TableBorder tbRight = tableItem->rightBorder();
- docu.writeStartElement("TableBorderRight");
- foreach (TableBorderLine tbl, tbRight.borderLines())
+ if ((tstyle.isEmpty()) || ((!tstyle.isEmpty()) && ( !ts.isInhRightBorder())))
{
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ TableBorder tbRight = tableItem->rightBorder();
+ docu.writeStartElement("TableBorderRight");
+ foreach (TableBorderLine tbl, tbRight.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
- TableBorder tbTop = tableItem->topBorder();
- docu.writeStartElement("TableBorderTop");
- foreach (TableBorderLine tbl, tbTop.borderLines())
+ if ((tstyle.isEmpty()) || ((!tstyle.isEmpty()) && ( !ts.isInhTopBorder())))
{
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ TableBorder tbTop = tableItem->topBorder();
+ docu.writeStartElement("TableBorderTop");
+ foreach (TableBorderLine tbl, tbTop.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
- TableBorder tbBottom = tableItem->bottomBorder();
- docu.writeStartElement("TableBorderBottom");
- foreach (TableBorderLine tbl, tbBottom.borderLines())
+ if ((tstyle.isEmpty()) || ((!tstyle.isEmpty()) && ( !ts.isInhBottomBorder())))
{
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ TableBorder tbBottom = tableItem->bottomBorder();
+ docu.writeStartElement("TableBorderBottom");
+ foreach (TableBorderLine tbl, tbBottom.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
//for each cell, write it to the doc
for (int row = 0; row < tableItem->rows(); ++row)
{
@@ -1977,71 +2024,86 @@
docu.writeAttribute("Row", cell.row());
docu.writeAttribute("Column",cell.column());
docu.writeAttribute("Style",cell.style());
- //TODO
- //BoundRect?
- //ContentRect?
- docu.writeAttribute("FillColor", cell.fillColor());
- docu.writeAttribute("FillShade", cell.fillShade());
- docu.writeAttribute("LeftPadding",cell.leftPadding());
- docu.writeAttribute("RightPadding", cell.rightPadding());
- docu.writeAttribute("TopPadding",cell.topPadding());
- docu.writeAttribute("BottomPadding", cell.bottomPadding());
-
- TableBorder tbLeft = cell.leftBorder();
- docu.writeStartElement("TableBorderLeft");
- docu.writeAttribute("Width", tbLeft.width());
- foreach (TableBorderLine tbl, tbLeft.borderLines())
+ QString cstyle = cell.style();
+ CellStyle cs;
+ if (!cell.style().isEmpty())
+ cs = m_Doc->cellStyle(cell.style());
+ if ((cstyle.isEmpty()) || ((!cstyle.isEmpty()) && ( !cs.isInhFillColor())))
+ docu.writeAttribute("FillColor", cell.fillColor());
+ if ((cstyle.isEmpty()) || ((!cstyle.isEmpty()) && ( !cs.isInhFillShade())))
+ docu.writeAttribute("FillShade", cell.fillShade());
+ if ((cstyle.isEmpty()) || ((!cstyle.isEmpty()) && ( !cs.isInhLeftPadding())))
+ docu.writeAttribute("LeftPadding",cell.leftPadding());
+ if ((cstyle.isEmpty()) || ((!cstyle.isEmpty()) && ( !cs.isInhRightPadding())))
+ docu.writeAttribute("RightPadding", cell.rightPadding());
+ if ((cstyle.isEmpty()) || ((!cstyle.isEmpty()) && ( !cs.isInhTopPadding())))
+ docu.writeAttribute("TopPadding",cell.topPadding());
+ if ((cstyle.isEmpty()) || ((!cstyle.isEmpty()) && ( !cs.isInhBottomPadding())))
+ docu.writeAttribute("BottomPadding", cell.bottomPadding());
+ if ((cstyle.isEmpty()) || ((!cstyle.isEmpty()) && ( !cs.isInhLeftBorder())))
{
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ TableBorder tbLeft = cell.leftBorder();
+ docu.writeStartElement("TableBorderLeft");
+ docu.writeAttribute("Width", tbLeft.width());
+ foreach (TableBorderLine tbl, tbLeft.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
-
- TableBorder tbRight = cell.rightBorder();
- docu.writeStartElement("TableBorderRight");
- docu.writeAttribute("Width", tbRight.width());
- foreach (TableBorderLine tbl, tbRight.borderLines())
+ if ((cstyle.isEmpty()) || ((!cstyle.isEmpty()) && ( !cs.isInhRightBorder())))
{
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ TableBorder tbRight = cell.rightBorder();
+ docu.writeStartElement("TableBorderRight");
+ docu.writeAttribute("Width", tbRight.width());
+ foreach (TableBorderLine tbl, tbRight.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
-
- TableBorder tbTop = cell.topBorder();
- docu.writeStartElement("TableBorderTop");
- docu.writeAttribute("Width", tbTop.width());
- foreach (TableBorderLine tbl, tbTop.borderLines())
+ if ((cstyle.isEmpty()) || ((!cstyle.isEmpty()) && ( !cs.isInhTopBorder())))
{
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ TableBorder tbTop = cell.topBorder();
+ docu.writeStartElement("TableBorderTop");
+ docu.writeAttribute("Width", tbTop.width());
+ foreach (TableBorderLine tbl, tbTop.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
-
- TableBorder tbBottom = cell.bottomBorder();
- docu.writeStartElement("TableBorderBottom");
- docu.writeAttribute("Width", tbBottom.width());
- foreach (TableBorderLine tbl, tbBottom.borderLines())
+ if ((cstyle.isEmpty()) || ((!cstyle.isEmpty()) && ( !cs.isInhBottomBorder())))
{
- docu.writeStartElement("TableBorderLine");
- docu.writeAttribute("Width", tbl.width());
- docu.writeAttribute("PenStyle", tbl.style());
- docu.writeAttribute("Color", tbl.color());
- docu.writeAttribute("Shade", tbl.shade());
+ TableBorder tbBottom = cell.bottomBorder();
+ docu.writeStartElement("TableBorderBottom");
+ docu.writeAttribute("Width", tbBottom.width());
+ foreach (TableBorderLine tbl, tbBottom.borderLines())
+ {
+ docu.writeStartElement("TableBorderLine");
+ docu.writeAttribute("Width", tbl.width());
+ docu.writeAttribute("PenStyle", tbl.style());
+ docu.writeAttribute("Color", tbl.color());
+ docu.writeAttribute("Shade", tbl.shade());
+ docu.writeEndElement();
+ }
docu.writeEndElement();
}
- docu.writeEndElement();
//End Cell
writeITEXTs(doc, docu, cell.textFrame());
docu.writeEndElement();
Modified: trunk/Scribus/scribus/ui/smcellstyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17319&path=/trunk/Scribus/scribus/ui/smcellstyle.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smcellstyle.cpp (original)
+++ trunk/Scribus/scribus/ui/smcellstyle.cpp Tue Feb 21 22:32:40 2012
@@ -398,11 +398,9 @@
{
if (!m_doc)
return; // No document available.
-
m_selection.clear();
m_cachedStyles.clear();
m_deleted.clear();
-
m_cachedStyles.redefine(m_doc->cellStyles(), true);
}
@@ -410,31 +408,44 @@
{
if (!m_page)
return;
-
- connect(m_page->fillColor, SIGNAL(activated(const QString&)),
- this, SLOT(slotFillColor()));
+ connect(m_page->fillColor, SIGNAL(activated(const QString&)), this, SLOT(slotFillColor()));
+ connect(m_page->fillShade_, SIGNAL(clicked()), this, SLOT(slotFillShade()));
}
void SMCellStyle::removeConnections()
{
if (!m_page)
return;
-
- disconnect(m_page->fillColor, SIGNAL(activated(const QString&)),
- this, SLOT(slotFillColor()));
+ disconnect(m_page->fillColor, SIGNAL(activated(const QString&)), this, SLOT(slotFillColor()));
+ disconnect(m_page->fillShade_, SIGNAL(clicked()), this, SLOT(slotFillShade()));
}
void SMCellStyle::slotFillColor()
{
// TODO: Handle inheritance as well.
QString fillColor(m_page->fillColor->currentText());
- foreach (CellStyle *cellStyle, m_selection) {
+ foreach (CellStyle *cellStyle, m_selection)
+ {
cellStyle->setFillColor(fillColor);
}
-
if (!m_selectionIsDirty)
{
m_selectionIsDirty = true;
emit selectionDirty();
}
}
+
+void SMCellStyle::slotFillShade()
+{
+ // TODO: Handle inheritance as well.
+ double fillShade = m_page->fillShade_->getValue();
+ foreach (CellStyle *cellStyle, m_selection)
+ {
+ cellStyle->setFillShade(fillShade);
+ }
+ if (!m_selectionIsDirty)
+ {
+ m_selectionIsDirty = true;
+ emit selectionDirty();
+ }
+}
Modified: trunk/Scribus/scribus/ui/smcellstyle.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17319&path=/trunk/Scribus/scribus/ui/smcellstyle.h
==============================================================================
--- trunk/Scribus/scribus/ui/smcellstyle.h (original)
+++ trunk/Scribus/scribus/ui/smcellstyle.h Tue Feb 21 22:32:40 2012
@@ -92,6 +92,7 @@
private slots:
void slotFillColor();
+ void slotFillShade();
};
#endif // SMCELLSTYLES_H
Modified: trunk/Scribus/scribus/ui/smcellstylewidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17319&path=/trunk/Scribus/scribus/ui/smcellstylewidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smcellstylewidget.cpp (original)
+++ trunk/Scribus/scribus/ui/smcellstylewidget.cpp Tue Feb 21 22:32:40 2012
@@ -16,6 +16,8 @@
fillColorIcon->setPixmap(loadIcon("16/color-fill.png"));
fillColor->addItem(CommonStrings::tr_NoneColor);
+ fillShadeLabel->setPixmap( loadIcon("shade.png") );
+ fillShade_->setToolTip( tr("Fill Shade"));
}
SMCellStyleWidget::~SMCellStyleWidget()
@@ -32,6 +34,7 @@
// TODO: Handle parent styles (and language?)
fillColor->setCurrentText(cellStyle->fillColor());
+ fillShade_->setValue(qRound(cellStyle->fillShade()));
}
void SMCellStyleWidget::show(QList<CellStyle*> &cellStyles, QList<CellStyle> &cellStylesAll, const QString &defaultLanguage, int unitIndex)
Modified: trunk/Scribus/scribus/ui/smcellstylewidget.ui
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17319&path=/trunk/Scribus/scribus/ui/smcellstylewidget.ui
==============================================================================
--- trunk/Scribus/scribus/ui/smcellstylewidget.ui (original)
+++ trunk/Scribus/scribus/ui/smcellstylewidget.ui Tue Feb 21 22:32:40 2012
@@ -10,15 +10,15 @@
<height>478</height>
</rect>
</property>
- <layout class="QVBoxLayout">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="smColorGroup">
<property name="title">
<string>Colors</string>
</property>
- <layout class="QVBoxLayout">
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
- <layout class="QHBoxLayout">
+ <layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="fillColorIcon">
<property name="maximumSize">
@@ -39,6 +39,20 @@
<widget class="SMColorCombo" name="fillColor"/>
</item>
<item>
+ <widget class="QLabel" name="fillShadeLabel">
+ <property name="text">
+ <string>Text</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SMShadeButton" name="fillShade_">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -53,24 +67,24 @@
</item>
</layout>
</item>
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::MinimumExpanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>72</width>
- <height>0</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>72</width>
+ <height>388</height>
+ </size>
+ </property>
+ </spacer>
</item>
</layout>
</widget>
@@ -81,6 +95,11 @@
<extends>QComboBox</extends>
<header>ui/smcolorcombo.h</header>
</customwidget>
+ <customwidget>
+ <class>SMShadeButton</class>
+ <extends>QPushButton</extends>
+ <header>ui/smshadebutton.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
More information about the scribus-commit
mailing list