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

List:       koffice-devel
Subject:    Re: Images and Stores
From:       David Faure <david () mandrakesoft ! com>
Date:       2002-01-26 11:21:28
[Download RAW message or body]

On Saturday 26 January 2002 11:52, Clarence Dang wrote:
> Hi,
> 
> These are questions to do with import filters + images + KWord:
> 
> 1. How do I position an image a certain number of points from the left margin?
> 
> Because I want the relative positions of each line of text and each picture \
> maintained, I've been forced to use inline images (correct me if I'm wrong).
> 
> The problem is that inline images like to stick to the left margin, no matter what \
> value for "left" for the frame I specify. I want to position them a certain number \
> of points from the left margin.  How do I do this?

You can't. The frame is being positioned by the text around it, and the
image fills in the whole frame, that's how things work currently.
I think you'll have to delay this until "frame inner margin" is implemented,
or to actually implement it ;)
Remind me, if I look bored one day ;)
(Or: any volunteers ?)

> 2. Is it possible to have more than one file open in a store because at the moment, \
> I have to do this:

Hehe, I can see Werner smiling from here - we discussed this in length.

> KoStore *outfile = new KoStore (outfilename, KoStore::Write);
> 
> outfile->open ("root");				// maindoc.xml
> outfile->write ("Lots and lots of text", length);
> outfile->close ();
> 
> outfile->open ("tar:/pictures/picture0.bmp");	// pictures/picture0.bmp
> outfile->write ("raw binary, bitmap data", length);
> outfile->close ();
> 
> outfile->open ("tar:/pictures/picture1.bmp");	// pictures/picture1.bmp
> outfile->write ("more raw binary, bitmap data", length);
> outfile->close ();
> 
> delete (outfile);
> 
> Is this correct?
Yes.

> I'm finding it rather inconvenient to only be able to have one file in the store \
> open at a time. e.g. suppose I was importing some text and then there was a picture \
> in the document -- with the current scheme, I would have to store the contents of \
> the picture in a buffer and then output the picture, only after I was finished with \
> the text?
Yes.
Please keep in mind that the underlying contents are a gzipped file.
How on earth would one implement "being able to write at two positions 
of the gzipped file at the same time" ? That's impossible.
The only way to provide the API you're requesting would be to buffer _everything_ 
in memory (all files to be written to the archive), and then write it all at once.
This would eat memory like an oger.
That's why the buffering has to be done in the application (or filter) : at least
it can try to minimize the amount of buffering required, since it knows when it
has finished with a given file inside the archive, which can then be written
for real and the memory for it can be discarded.

> 3. For the KEY tag, what  values should I give to these attributes?:
> filename CDATA #REQUIRED,
> year CDATA #REQUIRED,
> month CDATA #REQUIRED,
> day CDATA #REQUIRED,
> hour CDATA #REQUIRED,
> minute CDATA #REQUIRED,
> second CDATA #REQUIRED,
> msec CDATA #REQUIRED,
This only matters if the user inserts an image from the harddisk, and later 
updates the image there and inserts it again - the two resulting images will
come from the same file, but with different modification times.
I suggest that you set the filename to a random string, and the other fields
to 0 (or to random values too, doesn't matter), so that there will be no chance
of having another image hitting the same key by coincidence.

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://people.mandrakesoft.com/~david, http://www.konqueror.org
KDE 3.0: Konquering the Desktops
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://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