Guidance on 'Paragraph Tab' bug

Miklos Vajna vmiklos at suse.cz
Tue Jul 2 01:04:34 PDT 2013


Hi Adam,

On Mon, Jul 01, 2013 at 12:16:21PM +0300, Adam Fyne <adam.fyne at cloudon.com> wrote:
> See my comments below in blue ...

Feel free to avoid coloring your comments, what counts is the leading ">
" added by mailers to the original mail, then clients can automatically
color it. :-)

> > > 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).

If you want to design the document model (and UNO API, etc) of ptab as
an extension of tab, then it makes sense to implement the import filter
this way as well. Actually, if they are similar enough, then even using
the same method may be OK, what is the current situation.

> > > 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.

writerfilter/documentation/ooxml/model.xml suggests that it's just
documentation.

> > 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...)

In your case, w:ptab is in the existing
http://schemas.openxmlformats.org/wordprocessingml/2006/main (aka "w")
namespace.

> So, should I handle 'ptab' in OOXMLFastContextHandler' or not?
> Sounds like I shouldn't.

See above, it's all about how similar tab and ptab is. It's fine to not
handle it there, and deal with it as normal attributes in dmapper.

> If not - should I remove the action from the xml node?

You said on IRC that you tried this, and got stuck, resulting in
https://www.libreoffice.org/bugzilla/show_bug.cgi?id=66458

I'll try to look into that and give you a minimal patch that gets the
tokenizer part done.

> 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.

Nah, the normal flow is that the XML parser feeds the tokenizer, which
feeds dmapper. Even if you go the attributes way, it'll go through some
OOXML*Handler class, which will generate the attribute tokens for you,
landing in dmapper. :-)

> How is 'Page Break' stored in the core?

Sorry, page break was a bad example. I wanted to point out something
that has a special character, but actually page break is a paragraph
attribute, i.e. if you have a page break, the paragraph after the break
has a "page break before" property.

> 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).

If you mean adding a new class, which is derived from SfxPoolItem? I
haven't done that, either. ;-) I guess it's all about declaring and
implementing the class itself, finding the include where you can assign
an ID to it, and that's it.

What I referred to is adding a new SfxPoolItem to an existing
SfxItemSet, e.g. a1bef744a24b072adc22035b5b15b376961351d8. The relevant
part is the sw/source/core/bastyp/init.cxx, where the SfxItemSet gets
initialized.

You need this if you want to implement ptab as a new SfxPoolItem. You
don't need this, if you can just extend SvxTabStopItem to your needs.

> > 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?

User interface, i.e. a dialog (or something similar) a user can click on
to create paragraph tabs.

> How would one control the 'paragraph tabs' through the UI?

Either model it after the normal tab UI, or if in doubt, feel free to
ask on libreoffice-ux-advise at lists.freedesktop.org.

To sum up:

- I think this will be again a new feature, finishing your previous
  (character shading) feature would make more sense first.

- I would strongly recommend to consider basing your work on the
  existing SvxTabStopItem: if that's possible, it'll make your life much
  easier.

Miklos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20130702/4e26cd55/attachment.pgp>


More information about the LibreOffice mailing list