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

List:       koffice-devel
Subject:    Re: Modifying KWord files / Interaction with KWord
From:       David Faure <david () mandrakesoft ! com>
Date:       2001-04-30 18:42:09
[Download RAW message or body]

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

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

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

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