Guidance on 'Paragraph Tab' bug

Adam Fyne adam.fyne at cloudon.com
Mon Jul 1 02:16:21 PDT 2013


Hi Miklos,

Thanks for the help. it helps a lot !
See my comments below in blue ...



>  > I have a few questions:
> >
> > 1.       Shouldn't "CT_PTab" call "ptab" instead of "tab"?
> That's right, except that writerfilter::ooxml::OOXMLFastContextHandler
> has a tab() method, but no ptab() method, that will be one thing you
> need to implement first.
>
Why would I implement a 'ptab' function?
>From what you wrote below - it seems that I do not need to do any action
for 'ptab'.
So does your recommendation still stand that I need 'ptab'?
(you said that 'tab()' inserts a '\t' instead of the <tab> element).




> > 2.       What is the meaning of the 'tag' attribute of the 'resource'
> node?
> As far as I know, the <action .. action="name"/> is always a method call.
>
The question was actually about the 'tag' element of a resource, not the
'action' element.




> > 3.       The way information is stored in 'model.xml' is so confusing.
> You're not alone, writerfilter/documentation/ooxml/model.xml is what we
> found out so far, feel free to extend that if you manage to decode some
> more detail.
>
> In short, whenever you add support for new XML tags, you typically need
> to extend the file at two places:
>
> - the new tag is a child of some existing tag, so extend the parent's
>   definition
> - you also need to add a matching <resource> tag in model.xml
>
> Once those two definitions match, you get new tokens in dmapper.
> 363dafefad14411a16f6ea9d2ee0d55b67bc9c8d is hopefully a good example.
> (Though your case is easier, as you add a new token in an existing
> namespace.)
>
What do you mean when you say that my case is easy because I add a new
token to an existing namespace?
what namespace would that be?
(I looked at the commit you mentioned and it doesn't make any sense to
me...)



>
> > From the code – I understood that 'action' calls a function in
> > "OOXMLFastContextHandler".
> >
> > When do we need such actions? Why is this done on some nodes and on other
> > nodes (like 'run', 'paragraph', 'brush' etc) not done?
> >
> >
> > So – say I need to add a new function called 'ptab' to
> > 'OOXMLFastContextHandler' – Do I simply copy the logic of 'tab()' ?
>
> I think it's all about where do you want to handle the input. Normally,
> the tokenizer just generates these tokens, and dmapper does the mapping.
>
> However, in case of tabs, other (RTF, WW8) formats handle the tab as a
> normal character, so in case of DOCX, an action is used, that converts
> the OOXML tokens to a simple character, so in dmapper you always get a
> tab character. So actions are used to generate these "fake tokens".
> Other example: w:hyperlink is also handled in the tokenizer, and it
> generates a HYPERLINK field from it, and dmapper handles only that.
>
So, should I handle 'ptab' in OOXMLFastContextHandler' or not?
Sounds like I shouldn't.
If not - should I remove the action from the xml node?




>  > Where do I parse the attributes themselves of the 'ptab'?
> If you handle ptab as a normal element in model.xml, you'll have the
> usual way to get all its attributes. I would recommend going that way,
> as ptab is not a character (tab is), but an element with attributes.
>
>From what I saw - 'ptab' attributes *are* handled in the dmapper.
So the *current* way it works, where 'ptab' is both parsed in
'OOXMLFastContextHandler'
and it's attributes are parsed in the dmapper is very confusing.



>
> > I add it as properties to some existing object of the core?
> I would check how existing similar features are implement, and do
> something similar. Normal tabs are not a good example, as those are
> stored as a \t character inside SwTxtNode, but page break may be a good
> example.
>
How is 'Page Break' stored in the core?
Is there some tutorial on how to add an entirely new object to the core?
(you told me once that adding a property to an existing core object is
relatively easy,
but adding a new object is a much more complex task).



>
> Sure, so -- as usual, the first step would be to design how the document
> model should store these paragraph tabs, then either do the UNO API or
> some UI, so you can test it. Then you can continue with filters and
> layout, etc.
>
You say "either do the UNO API or some UI".
What UI do you mean?
How would one control the 'paragraph tabs' through the UI?


Thanks, it helps a great deal !

Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20130701/d802d577/attachment.html>


More information about the LibreOffice mailing list