[scribus-dev] Tables GSoC - Weekly Report #3

Elvis Stansvik elvstone at gmail.com
Sun Jun 19 17:36:32 UTC 2011

Hi Craig, all

Below is my third weekly report. As usual, it's also available at [1].


[1] http://wiki.scribus.net/canvas/GSoC_2011_Tables_Weekly_Reports

= Tables GSoC - Weekly Report #3 =

== Work Report ==
* Added a QList<QList<TableCell>> structure of cells to
PageItem_Table. And made sure that cells removed from this structure
are invalidated properly.
* Added the cellAt(int, int) API for retrieving cells from the table.
Retrieved cells can be queried for their validity with isValid().
* Added QDebug operator<<(...) to TableCell for convenient printing of cells.
* Added correct updating of the row/column span of cells when
rows/columns are removed/inserted, or when several areas of merged
cells are united.
* Added a thorough internal assertValid() method to PageItem_Table
which checks the consistency of the table. Also added an accompanying
ASSERT_VALID macro, which compiles to nothing unless WANT_DEBUG is
* Added scripting methods getCellRowSpan(...) and getCellColumnSpan(...).
* Added unit test for mergeTableCells(...) to test script.
* Added scripting API for setting/getting cell border colors and widths.
* Moved cell related command out of cmdtable.h/.cpp and into their own
* Added API for border widths/colors to PageItem_Table.
* Simplified the cellRect(int, int) and isCovered(int, int) methods in
PageItem_Table by using the new cellAt(int, int) API.
* Moved styles/overview.txt into the wiki and expanded it with a
little section on style property lookup.
* Added getNamedResources(...) and replaceNamedResources to CellStyle
and TableStyle.
* Added two new document-wide style contexts to ScribusDoc,
docTableStyles and docCellStyles, along with API that uses them:
** const TableStyle& tableStyle(QString name)
** const StyleSet<TableStyle>& tableStyles()
** bool isDefaultStyle(const TableStyle& style) const
** void redefineTableStyles(const StyleSet<TableStyle>& newStyles,
bool removeUnused = false)
** void replaceTableStyles(const QMap<QString, QString>& newNameForOld)
* Created default styles for tables/cells in ScribusDoc::init().
* Added API for handling table/cell style names to ResourceCollection.
* Added apply() and updateStylesCache() to SMTableStyle and
SMCellStyle, finally allowing the SM to redefine these new styles on
the document.
* Added getCellStyle()/setCellStyle(...) to scripting API.
* Added properties for border width/color to TableStyle and CellStyle.
* Changed PageItem_Table and TableCell to use an internal style for
storing local properties. The style has the new style context added to
ScribusDoc as context, and setting a named style on a cell or table
will set the parent style of the internal style.
* Added API and scripting API for background color to tables and cells.
* Added missing update(...) functions to TableStyle and CellStyle.
* Added getTableStyle()/setTableStyle(...) to scripting API.
* Added some initial painting of cell / table backgrounds. Color is
taken from style and direct formatting also works.
* Various documentation fixes, bug fixes and cleanups.

== Project Status ==
On the schedule for this past week was

* More advanced layout.
* Variable column widths.

But as those were already done, I decided last week that this week I'd
instead start working on proper painting of cell borders. However,
despite getting a lot of things done, it seems my schedule has finally
caught up with me. You could say that I'm now on schedule instead of
ahead of it.

The main reason why I'm no longer staying ahead is that it's been more
work than anticipated in bringing the styles up to snuff. A lot of
legwork to get them integrated into the the document and updates
SM<-->ScribusDoc working.

Things are pretty much ready now though. New properties can now easily
be added and the tables and cells will pick them up. Work on
cell/table border painting can now begin.

== Problems / Questions ==
No specific questions this time either. I had some during the week,
but those were resolved over e-mail/IRC. (Thanks to Craig/avox!).

== Next Week ==
In the timeline for next week it reads

* Cell formatting properties such as border and padding.
* Cell content layout; use Scribus' text frames to populate cells.

And for the first time since my first week, I'll actually be doing
what the schedule says :) I'll work on the painting of tables/cells.
Solid backgrounds are actually already painted, as of a commit some
hour ago. Hopefully I'll also be able to also start working on
bringing Scribus' text frames into the game. I'm sure that will be a
lot of work, which is why it's in my schedule for the week after next
as well.

More information about the scribus-dev mailing list