[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Modifying KWord files / Interaction with KWord
From:       "Pascal A. Niklaus" <Pascal.Niklaus () unibas ! ch>
Date:       2001-05-01 20:58:47
[Download RAW message or body]

At 10:38 AM 01/05/2001, you wrote:

>On Wednesday 25 April 2001 23:50, Pascal A. Niklaus wrote:
> > KCite needs access to the whole document and should be able to insert
> > formatted text (bold/underline etc, but also inserting indented paragraphs
> > etc. - it's really turning the document upside down). What data should be
> > passed to the data tool then? The whole document as an XML string? Then
> > I'll have to deal with all the internals of KWord's format again. Ideally
> > there would be a possibility to parse and manipulate the document from 
> some
> > kind of 'meta' level, with KWord doing the lower level maintenance of the
> > document's structure.
>
>Yes. Well. Two solutions.
>Either you want to do this without KWord running, and in that case you'll
>have to manipulate the XML itself (but with QDom it's clean and easy).
>Or you can rely on KWord running [whether the tool is interactive or not,
>this doesn't matter]. And in that case, the QRichText classes indeed provide
>the 'meta' level, that's unrelated to the XML file format. They represent
>the whole data of the document, organized in paragraphs, and characters,
>with formatting information.
>I thought that the data tool could in fact pass a QTextCursor. From there
>you can get the current paragraph, and from there the document. This way
>a tool can act on the current cursor, on the selection, on the whole 
>document, etc.
>(Not through framesets though, only in the current frameset, but that should
>hopefully be ok).

I think being able to access only one frame is a limitation I'd like to 
avoid. It can imagine that a text is organised in different frames, and one 
wants a reference list somewhere in the last frame. The QTextCursor-data 
tool would be fine to insert citations into the text. For the formatting of 
the whole document, however, access to the whole XML document will be needed.

> > As I said, something like field codes would be very helpful, because it
> > would be much safer and more flexible in that a document would not loose
> > all the information that was in it when it is formatted. Something like 
> the
> > already existing 'custom variables' would do it, if some
> > application-specific attributes could be stored in them and if the
> > variables could contain multiple paragraphs and formatted text. Is
> > something like that planned for the future of KWord?
>
>I'm not sure about a "variable that contains multiple paragraphs"...
>QRichText doesn't make it easy to remember where it would start and end,
>when creating/deleting paragraphs (since qrt doesn't know about variables).
>
>Do you want to insert text once, or to update the inserted text later... ?
>What I did for the Table Of Contents (which is, in a way, a 
>multiple-paragraphs
>variable), was to use styles for it - everything with one of the "Table Of 
>contents"
>style is part of it, and is deleted before the TOC is recreated.
>Would a similar solution help in your case, or do you need a smaller
>level than full paragraphs [since styles always apply to a full parag] ?

The styles approach you suggest seems perfectly suited!

> > If you think the KoDataTool is the way to do that - would it be possible
> > that someone adds a hook for it to KWord and very briefly tell me how 
> these
> > text manipulations can be done? I'd rather prefer to concentrate on the
> > KCite code than to start manipulating a large project which I do not
> > understand well enough... Or is it too early to do that? Should I wait
> > until other functions are implemented in KWord?
>
>If it's up to me it'll have to wait a little bit, there are many things
>to do on KWord.

Ok, I'll work on the other parts of KCite until the 'field codes' idea has 
found its way into the KWord source. But let me know once the 
koDataTool-hook has been implemented in KWord.

Pascal

--
>David FAURE, david@mandrakesoft.com, faure@kde.org
>http://perso.mandrakesoft.com/~david/, http://www.konqueror.org/
>KDE, Making The Future of Computing Available Today

_______________________________________________
Koffice-devel mailing list
Koffice-devel@master.kde.org
http://master.kde.org/mailman/listinfo/koffice-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic