<p>Hello,</p>
<p>Progress so far is.<br>
+finally finished with import of column and row formatting data for tables.<br>
+progressing on exporting back to ooxml.</p>
<p>Need to code faster since i am behind schedule. But I think I can cope up well. This week by thursday you should see export feature for ooxml in place.</p>
<div class="gmail_quote">On Jun 4, 2013 1:15 AM, "Markus Mohrhard" <<a href="mailto:markus.mohrhard@googlemail.com">markus.mohrhard@googlemail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hey Akash,<br>
<br>
2013/6/2 Akash Shetye <<a href="mailto:shetyeakash@gmail.com">shetyeakash@gmail.com</a>>:<br>
> Hey devs,<br>
><br>
> Thank you moggi and kohei for helping me out on the IRC constantly.<br>
><br>
> With the design I am describing now, the feature becomes an n-ternating (not<br>
> alternating) row formatting (not just colouring) feature. Please help with<br>
> your advice and discussions.<br>
><br>
> The feature design can be compartmentalised as follows:<br>
> 1. The 'Row Formatting definition' part, where used selects the targeted<br>
> database range and the styles to be applied to it.<br>
> 2. The 'Row Formatting core' where DB Range code and this feature interact.<br>
> 3. The rendering end.<br>
<br>
After reading this I think we need to split the task into smaller and<br>
easier to handle steps. Hopefully it helps us to focus on the<br>
important tasks for now. I'll explain some of the problems with your<br>
proposal below but the general point is that we should work on the<br>
model right now. Don't think about anything redering related, updating<br>
references or similar stuff until we have implemented the model and<br>
maybe have the import and export implemented. The visual<br>
representation of the feature is something that we can later add but<br>
is of less importance than you think right now.<br>
<br>
><br>
> Row Formatting definition:<br>
><br>
> [Data Structures]<br>
><br>
> About the storage of this formatting information and how alternating<br>
> formatting info will be defined:<br>
><br>
> User defines each alternating format as a band, and as such 'n' number of<br>
> bands constitute particular n-ternating format. The user select the<br>
> formatting options and the size of the band i.e, how many consecutive rows<br>
> it will cover/applied to. When the user defines another band, the new band<br>
> will follow the previously defined band. Thus we can have more than just<br>
> alternating colours for our DB ranges. Eg. define first band of size 1 and<br>
> bold text, band 2 of size 3 italic text and band 3 of size 1 underlined<br>
> text; for a range of 10 rows, the first will be bold followed by 3 italic<br>
> rows followed by 1 underlined row and so on..<br>
><br>
> Every defined band for an Alternating row format will be stored as a<br>
> ScDBDataRowFormat that will have the attributes: 1. index number which helps<br>
> define the sequence of these bands 2. band size 3. Formatting information<br>
> (ScStyleSheet instance??). It has its method GetStyle() that returns the<br>
> style to be applied<br>
<br>
Let us limit ourself for now to 2 alternating styles. Extending this<br>
later is easier than trying to implement everything at once.<br>
<br>
><br>
> Many such ScDBDataRowFormat instances are added to a container which is a<br>
> part of ScDBDataRowFormatting object. This object represents the total style<br>
> you have created and also contains the defined style name you give to it.<br>
><br>
> All such defined styles are added to a pool of ScDBDataRowFormatting<br>
> objects; lets say this pool is represented by<br>
> ScDBDataRowFormattingCollection (the names are getting scarily long), so<br>
> styles once custom defined can be used again and again.<br>
><br>
> Associating every ScDBData object with it's ScDBDataRowFormatting object:<br>
><br>
> Every ScDBData object has an attribute of type ScDBDataRowFormatting which<br>
> is assigned to it by picking it up from the ScDBDataRowFormattingCollection<br>
> pool.<br>
> Thus many DB Ranges can use the same style without having to have any<br>
> multiple copies to themselves.<br>
<br>
That design is overcomplicated and lacks some of the important<br>
features. We need at least the following features: two column styles,<br>
two row styles, information about header row, total row, column<br>
labels, ... Please have a look at Excel to see some of the information<br>
we need to store in data structures. A good starting point for the<br>
design is to list all the information we need to store for each table.<br>
Starting with the list we will then decide for each information how to<br>
represent it and how they interact and influence each other.<br>
<br>
Just a short note: When you think about styles in Calc's core<br>
implementation please always think only about the style name.<br>
Everything that is hidden behind ScDocument should at least for you<br>
only use the style name and never the ScStyleSheet object. If there is<br>
ever a case where we need access to the full style we will need to<br>
look closer into it.<br>
<br>
<br>
><br>
> Row Formatting Core:<br>
><br>
> The row formatting core is composed of the modifications needed in ScDBData<br>
> itself to support the new alternating colour functionality.<br>
><br>
> ScDBData will have a new method GetRowFormatting() just like the one in<br>
> conditio.cxx (GetData()); however this will return a ScDBDataRowFormatting<br>
> object.<br>
><br>
> The rendering half will have to iterate over each row of the the range while<br>
> iterating over the ScDBRowFormat items in the container in ScDBRowFormatting<br>
> instance taking care of the band size of each and thus applying it to the<br>
> row cells accordingly. This makes the rendering code a little more<br>
> complicated as multiple styles have to be related to different rows.<br>
><br>
> Events (not actually events) in ScDBData such as:<br>
><br>
> UpdateMoveTab - changes the table<br>
> UpdateReference()<br>
> ExtendDataArea - extends/shrinks the area under ScDBData<br>
<br>
Don't worry about them right now. We will come back to them when we<br>
have implemented all the data structures and the import/export.<br>
<br>
><br>
> make changes to the structure and coverage of the defined database range. We<br>
> need to take care of such events that may wipe out or add newer rows to the<br>
> range. Such updates set the bModified bool in ScDBData, this needs to be<br>
> known and be handled by the rendering half of this feature.<br>
><br>
> The rendering end:<br>
><br>
> This rendering end is the something I am discovering with each passing day.<br>
> Not much to write here.<br>
><br>
> Some design issues:<br>
><br>
> I see one big problem with the way this are laid out now. The formatting<br>
> information and ScDBData's bounds (i.e its rows) are very decoupled. It<br>
> becomes the job of the rendering end to apply the correct formatting by<br>
> iterating over the ScDBRowFormatting container and getting the ScDBRowFormat<br>
> objects taking care of their band sizes as it moves over each row adding in<br>
> the formatting information.<br>
><br>
> This makes the rendering end very complicated (maybe). Since rendering is<br>
> not just taking the concerned rows and style and shoving in the attributes.<br>
> One way out can be having a member function in ScDBData that returns an<br>
> array of  size[No.OfRows], each entry containing the applicable stylesheet<br>
> for that row. This shifts the 'making sense of' part, out of the rendering<br>
> part.<br>
<br>
Don't think about the rendering right now. This will be much simpler<br>
than you expect and all most of the logic that you think belongs into<br>
the rendering part actually is part of the mode and we will need it<br>
also for other parts of the mode implementation. In the end we will<br>
just have a method that returns the style name for a cell and not much<br>
more. But please don't worry about that right now because in the end<br>
you'll see that this will look just natural after all other parts are<br>
implemented.<br>
<br>
><br>
> [UI Stuff]<br>
> Speaking of what to call this functionality and where to place it in the<br>
> menu hierarchy:<br>
> Either we can:<br>
<br>
That is even one step past the implementation of the rendering. We'll<br>
work with the UX team when we are ready to come up with a mock-up for<br>
the UI parts.<br>
<br>
><br>
> Greet the user with the same dialog as seen in Calc's Data->Select Range,<br>
> from where the user selects a range to be formatted as table i.e, coloured<br>
> alternately.<br>
> Or, since clicking format as table option in MS Excel marks a bunch of cells<br>
> as a table with a name, which 'optionally' can be coloured; we will need to<br>
> incorporate the alternate colouring option in the Data -> Define Range<br>
> dialog in its 'more' section.<br>
><br>
> In any case once this option is clicked, the user must define a custom<br>
> design or choose from a few existing ones, just like in Excel.<br>
><br>
<br>
<br>
So let us split the task into several smaller steps that we tackle and<br>
where you should not worry about the next step.<br>
<br>
1.) Model data structures<br>
2.) Import/export (OOXML and ODF)<br>
3.) Rendering and user interaction<br>
4.) UI<br>
<br>
So for now we concentrate on how to implement all the model data<br>
structures. Mainly how we can represent all the information we need in<br>
calc's core implementation and let them work together. As first step<br>
please list all the information we need to store in the model and we<br>
will discuss on IRC how to represent them.<br>
<br>
Regards,<br>
Markus<br>
</blockquote></div>