Steffen ,

I have some remarks:
Hey,

I'm currently trying to solve my problem with the speed of InsertTextContent.
I'm adding a linked picture, perform some stuff with it. Remove it again.
You can get most of the "size information" out of the dimensions off the header height and the dimensions of the original graphic so can do some calculations youself and deleting is no longer needed
After that i embed a picture in a fixed size(i retrieved the size from the linked picture) to the header of a writer document. As character! If I embed a picture to the header with OOWriter(GUI) the image get's resized to fit the header.(Most of the time it's height is extremly small then..) But I definitly want the fixed size. So the header has to be resized. Doing so seems to be an extremly slow implemented method.
due to the fact that you everytime rework the layout of the hole document

Here's the relevant snippet.

xBitmapContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xMultiServiceFactory.createInstance("com.sun.star.drawing.BitmapTable")); xImage = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xMultiServiceFactory.createInstance("com.sun.star.text.TextGraphicObject")); XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xImage); // helper-stuff to let OOo create an internal name of the graphic // that can be used later (internal name consists of various checksums)
                   xBitmapContainer.insertByName("someID", sURL);
internalURL = AnyConverter.toString(xBitmapContainer.getByName("someID"));

xProps.setPropertyValue("AnchorType",TextContentAnchorType.AS_CHARACTER);
                   xProps.setPropertyValue("GraphicURL", internalURL);
//xProps.setPropertyValue("Width", new Double(width).longValue()); //xProps.setPropertyValue("Height", new Double(height).longValue());
                   xProps.setPropertyValue("Width", width);
                   xProps.setPropertyValue("Height", height);
// insert the graphic at the cursor position (which in my problem case is at the header) // true tells to overwrite the textrange given as the cursor.
                   xText.insertTextContent(xCursor, xImage, overwrite);
                                     // remove the helper-entry
                   xBitmapContainer.removeByName("someID");
                  //if I'm not using sleep here it crashes!
                   Thread.sleep(10000);
check with "hasByName" if the graphic is removed !

After embeding the picture to the header i do want to save the document. If I'm not waiting those 10000ms (or maybe a little less, I did try 1000ms and it still crashed so i just went x10) my program crashes and the server shuts down with an DispatchException.
It's not appearing if I wait with sleep(10000).
It's also not happening if I'm embeding my picture to "normal" areas like the body or text cells. I also tried to embed the picture into the header when there's enough room to expand without having text or tables in the area which has to expand. That did function as well.

Basically I'm trying to find an evenlistener for insertTextContent to be notified when it's all done. Searching for listeners just gave me GUI listeners for user interaction. Maybe I tried the wrong keywords.
Any suggestions, hints on the subject would be great.


Steffen Boersig


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org

Reply via email to