Hi Hanbo,

I keep thinking that [EMAIL PROTECTED] is a better place for this thread. Anyway I answer you here.


Hanbo Wang escribió:
Many thanks, Mathias, I checked the "ReplacementImages" directory and
ole-object images DO exist! That's fantastic!

I keep suggesting you NOT to manipulate the documents as ZIP files, that way you can destroy your own data! It's safer to use OOo API (css.ucb, css.embed) for that.


But I also found some problems that Microsoft Equation object displayed
correctly in Impress while the replacement image was wrong.

Here what do you mean: the quality of the image or the content? If this last, maybe you should update the embedded object (com::sun::star::embed::XEmbeddedObject::update() ) or refresh the whole document (com::sun::star::util::XRefreshable::refresh() ).

How these images
are generated, were they just following Ariel's  procedures?


Correctly speaking, the sample I send you didn't "generate" a replacement image. As I can't show how to access the replacement image without a document containing an embedded object, the sample first creates a new Writer document, then creates a text context of type embedded object, by setting the property CLSID I tell OOo that I want a OOo Math embedded object, then I set the formula content of the object as a string.

Just by creating an embedded object, OOo creates/generates (not in every case, f.e. Java Applets) the replacement image as Mathias Brauer explained.


You still didn't tell me exactly what you're trying to achieve here. But let's suppose you want to access the image that OOo shows to the user when the embedded object isn't activated (because in this state, the stream of the object isn't read at all, just an image - the replacement image - is read and displayed to the user).

For accessing the replacement image, you have to access its embedded object; you do this last one in different ways, depending on the document model.

As my sample code show you, Writer is more "friendly", it gives us the different text contents suppliers (see the XxxxSupplier s interfaces on the css.text module). With XTextEmbeddedObjectsSupplier::getEmbeddedObjects you access the collection of all embedded objects within the document. With a loop you can travel all the collection and store the replacement image if the embedded object has one (there is no need to open the document as a zip file, go to the folder containing the replacement image, open the stream, read it and copy it.....)

In Calc, Impress and Draw, things are a little different, because there is no embedded objects supplier (only com::sun::star::sheet::Spreadsheet implements the interface ::com::sun::star::table::XTableChartsSupplier with the method getCharts() to access only the collection of the charts of the document).

A serial approach that can be used in Calc/Impress/Draw is accessing the document draw pages (it can even be done in Writer, but taking care that Writer has only one draw page for the doc.). With a loop, travel every draw page, and in each one use other inner loop to travel all the shapes contained in the draw page. If the shape object supports the service com.sun.star.drawing.OLE2Shape, then you have an embedded object to query for.


I hope it helps you to clarify things a little.
Bye and luck,
Ariel.


--
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://www.arielconstenlahaile.com.ar/ooo/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to