User:MSpisiak

From Wiki.ooo4kids.org

Jump to: navigation, search

This is a page containing information about Google Summer of Code project for Go Open Office (and EducOOo) by Michal Spisiak.

Wiki page about the project: Base Alignment Equations


Contents

Improving Math Equation Editor

Project description

(copied from proposal)

Starmath - Open Office equation editor is in need of significant improvement which could help satisfy expectations of the user. Currently the main issue is baseline miscalculation that causes wrong alignment hence giving bad impression. The aim of this project is to identify the problem, fix it and thus help Open Office to be more acceptable in education, together with solving other issues concerning adding new symbols which could be beneficial and surely welcomed by all users of Starmath.


Tasks


Task clarification

Our objective is to correctly align equation if it's anchored as character. For the other cases, user sets the position himself. For equations anchored as character, user can set the vertical position also, so our aim is only to provide options that might be convenient for most of the cases. Currently equation is placed into the middle of the line, which appears to be wrongly aligned with respect to the text around. So now the task is to find the code that handles the calculation of the object position and implement options for aligning (eg middle of the line, baseline).


Diary

I'll be writing here essential outlines of daily work.

tasks for 20.-27.5.

I should build Writer with symbols and trace everything about what determines the position of the object in Writer. Hopefully make any graphical debugger work.

21.5.

I added everything what I've done and understood while searching in arrange methods to the wiki page about the project. The reason is that now when the aim of study is moved essentially to Writer code, I had to do a clear recap of what I've understood, so when I'll need it in future, it will be comprehensible. I've also tried to make beaverdbg working, but there is still the null pointer coming in.

24.5.

I started on 'Alignment of Sm objects in Writer' describing the user options with objects in Writer. I got to work beaverdbg, but I wasn't very satisfied, because it can't really do everything what gdb can and it crashes. Well, my gdb started to crash either, my build is probably quite messed up by now.

25.5.

Firstly I was trying to find out where is the difference in position of object applied in Sm code when drawing. Then I had a look at access to Sm. I'm a bit struggling with finding out the objects handling the window position, so I built Writer with symbols.

26.5.

I traced how is calculated the position of object anchored as character in Writer. I wrote something about it on the project page, explaining that now the main thing is to decide on strategy which we should take to actually implement the change.

28.5.

Backtraced from Sm SmDocShell constructor and SwAsCharAnchoredObjectPosition. I'll write things worth it tomorrow on project site.

29.5.

I did tracing the alignment function. Not very successfully, from the Sm side. Hopefully from Sw side it will be better.

31.5.

Together with Eric we did quite exhaustive search for function that sets Alignment value eVertOrient for the SwFmtVertOrient object. Everything explained in "From Sw side" part.

1.6.

I got to examine backtrace of SwFmtVertOrient constructor breakpoint and found function which passes the value of eOrient set in object dialog to SwFmtVertOrient object.

2.6.

Found function that differentiates between Sm objects and other objects and sets the initial value of eVertOrient to CHAR_CENTER.

5.6.

I rewrote observations from traces that I've done in the past about alignment setting function.

7.6.

I wrote an introduction to implementation.

8.6.

Tracing a bit more around I sort of made up my mind how to implement it. Still open to suggestions of course. What bothers me is that I don't know how to put watch point so it doesn't get destroyed immediately after leaving the function (it should be possible because the object remains on the same position). Second thing is how to print object when I know just address. Third thing is whether there isn't a way to put bp on all functions of some object at the same time (not having to do it manually for every one). Will have a look at access to Sm tomorrow.

10.6.

I'm currently looking for how to retrieve values from Sm object. We know that there are values that has to be retrieved for instance BoundRect in CalcPosition. So I traced where it's get from. SwAnchoredObject stores the values, but after getting down the backtrace few steps it wasn't possible to find out where does it come from. So I set the bp on SwAnchoredObject constructor and it gets hit exactly once when new object is created, but at that point the values are not put in and what bothers me is that there is no method that would set the value and so I can't just put bp on it to track down what function puts the value in. The SwAnchoredObject gets constructed by SwFlyFrm constructor. SwFlyFrm inherited from SwFrm that has rectangle aFrm that can be possibly copied there, but I can't find any specific method that would set it either (there are some for moving the aFrm).

14.6.

Last couple of days I've been sorting out the access to Sm discussing it with ericb, mba, tl. It should finally work. I also had a look at a problem with borders, looks like it can be sorted within CalcPosition. Although it should be done at the moment when the border values are written into something in Sw. We basically need to move the equation a bit (by width of the border). IMHO this should be sorted for all objects, because it does for any. The problem is that for "From Bottom" vertical orientation there is value stored how far is the top from baseline, now enlarging the object by the border makes it to move down because the value of how top is from baseline doesn't change.

15.6.

After long trace I finally found function which is responsible for changing size of the object and therefore something I can jump of to find the one which deals with borders and where could I set the vertical position.

22.6.

Last few days I spent tracing around SwFEShell::RequestObjectResize, but now I start to think about new way of implementing it into SmDocShell::Parse or somewhere around into Sm if possible.

23.6.

Today I messed around Sm objects trying to figure out whether we could get pointer on SwAttrSet from some of them. Later, being sick of all useless tracing I made a small experiment, trying to change the alignment inside RequestObjectResize, which had no effect. Needs to be investigated why. More general understanding of Sw code might be needed.

27.6.

I did an experiment with changing the alignment of the object inside RequestObjectResize. Worked well, which means that we could implement it, but I'm not satisfied with placing it there. Still trying to find a better place to put it in.

28.6. - 3.7.

My dear diary, I was a very bad kid, because I didn't write every day, here is what happend for the last week.

Good night...

2.8.

Oh no, the difference in dates is like a month. What happened was:

this is described in various sections which has links at the top of project site: here

and what still needs to be done is:

and what I want to still do is:

3.8. 4.8.

I firstly built OOo, upstream version, to be able to produce patches for it and also worked on writing methods for UI implementation. They are almost done. I also tidied up a bit the code, because I found there lots of tabs instead of space, which got there probably by copying some pieces of code.

5.8.

Today I was trying firstly to fix new method to align all formulas, there was a problem to get them invalidated, there is a bug in EndAllAction probably. Then I was trying to create a new method that returns all selected objects, for which I had to trace like stupid because none of already created methods could do so and the node system in Writer seems a bit crazy to me as I see it first time. Now the method seems to be working loosely, it needs lots of tidying up.

6.8.

I managed to get setting the font size working :). It's really amazing, you just highlight the text with the formula, change the text size and the formula changes too. The code needs lots of modifications though and I want to get this feature also for text font and other things not just size.

8.8.

I was checking some documentation to see how to implement change of font size for Math in Writer, but I didn't get much info, so I'll write a simple method in SwFEShell to do it. Very interesting was one wiki page Writer - core and layout, I guessed most of that already from tracing, but if someone was starting now I would recommend reading it.

9.8.

Today I spent tracing... I want to get a feature implemented that would set the font size in formula depending on font size of text when inserting the formula, not just when changing it using highlighting.

11.8.

Third day of tracing to get the font hight. And here we go, it's done. So some recap again:

to do:

finishing off:

12.8.

13.8.

14.8.

15.8.

16.8.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox