Jiri Palecek wrote:
> Mathias Bauer <nospamforMBA <at> gmx.de> writes:
>
>>
>> Jiri Palecek wrote:
>> > Hi all, I have a question. Is there any way (best through UNO) to
>> > insert an object in a document or to create an object that can be
>> > inserted?
>>
>> You mean something like inserting a Chart into Writer:
>>
>> obj=ThisComponent.CreateInstance("com.sun.star.text.TextEmbeddedObject")
>> obj.CLSID="12DCAE26-281F-416F-A234-C3086127382E"
>> sel = ThisComponent.CurrentController.Selection
>> range = sel.getByIndex(0)
>> obj.attach( range )
>>
>> Best regards,
>> Mathias
>>
> Yes, exactly.
> �
> However, I have some more questions:
> 1) Is an object implementing service BaseFrame sufficient
> to insert it to insert it into the document?
Sorry, I don't understand this, please rephrase.
> 2) What is the CLSID thing when I�m not on Windows?
This is not related to Windows at all. "CLSID" is just a property that
identifies a type of an object. The one in my example is for Chart.
> 3) Are there means to add custom objects in the insert dialog?
Currently (OOo1.1) only on windows ("Further objects"), OOo2.0 will
allow to add custom objects, but somebody needs to provide an
implementation for them. If you don't want inplace activation for your
object such an implementation in C++ in Java is not trivial but by no
means complicated. Of course only for people that understand how to
implement UNO components. :-)
> 4) How about other document types (chart into spreadsheet?)
The API for text document containers is as shown above, all other
containers (spreadsheet, presentation, drawing) use a different one
because they have a much simpler way to handle emebedded objects.
First you need to get access to the DrawPage. In Calc that could be done
for example by accessing the current sheet:
page = ThisComponent.CurrentController.ActiveSheet.DrawPage
The rest is the same in all those containers (again with a Chart):
obj=ThisComponent.CreateInstance("com.sun.star.drawing.OLE2Shape")
obj.CLSID="12DCAE26-281F-416F-A234-C3086127382E"
page.add( obj ).
Best regards,
Mathias
--
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]