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

List:       koffice-devel
Subject:    Re: Bidi
From:       Thomas Zander <zander () kde ! org>
Date:       2007-07-09 7:05:05
Message-ID: 200707090905.06094.zander () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Saturday 07 July 2007 18:20:38 Stefan Nikolaus wrote:
> > Only paragraphs or also images, lists, tables, ... so, full or
> > fragments of odt documents? Only paragraphs include formatting would
> > be easy and as Thomas pointed out, that's already possible with
> > kotext.
>
> I'd be pleased with per-character styles, alignment, (visualization of)
> spell-checking, rotated text in a non-rotated rect.

I think this is not too hard to do, and you can do that without the 
plugin. Styles you can reuse from KoText.

A general approach I would probably take is this;
* Store either a QString and style, or a QTextDocument per cell.
This choice should be tested as the QString is obviously going to cost 
less memory, but the painting may take quite a bit longer as you end up 
doing a full text-layout (including line breaking) at every repaint.

* Use the KoText style manager and styles to format your text. The end 
result is a plain normal QTextDocument instance as the KoText/styles work 
on the normal Qt structures.

* Write a custom layouter. This can be pretty short; take a look at the
   doc/html/qt4-scribe.html#plain-text-layout
in your local Qt copy. I'm willing to help you write one, if you like.

* Write a painting method that will do any rotation or scaling and then 
will draw 1 cell using a normal QTextDocument::drawContents()
Based on the decision made in the first point (store a doc or a string) 
you can either move all these steps into 1 method, but do extra work 
every time you paint. Or you can separate those steps and let the 
QTextDocument do some caching of layout.

In the text shape I separate these items which makes repainting of text 
very responsive, but a little heavier on memory use.

Hope that helps.
-- 
Thomas Zander

[Attachment #5 (application/pgp-signature)]

_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.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