| View previous topic :: View next topic |
| Author |
Message |
Keymaster General User

Joined: 17 Feb 2005 Posts: 23 Location: München, Germany
|
Posted: Fri Feb 18, 2005 5:19 am Post subject: Missing Class in com.sun.star.drawing |
|
|
I have a big problem. i use this statement in my java application
Object oGraphic = xMSF.createInstance("com.sun.star.drawing.GraphicObjectShape");
The problem is that the oGraphic object is null. I have no GraphicObjectShape in the package com.sun.star.drawing, but why?
The peace of Code is out of a other Thread in this Forum an there it works.
(Sorry for my bad english, i am from germany)
Please help me, i am searching for an solution since 2 Days. |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3622 Location: Columbus, Ohio, USA
|
Posted: Fri Feb 18, 2005 6:35 am Post subject: |
|
|
In the other code, did it create an object of this type, or did it obtain the interface? There are two chapters available for free from my book from the publisher. One of the free chapters is the chapter dealing with drawing documents. _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
Keymaster General User

Joined: 17 Feb 2005 Posts: 23 Location: München, Germany
|
Posted: Fri Feb 18, 2005 6:48 am Post subject: |
|
|
| thanks i have found the free Chapter. I hope it will help me |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Sat Feb 19, 2005 10:57 am Post subject: Re: Missing Class in com.sun.star.drawing |
|
|
| Keymaster wrote: | Object oGraphic = xMSF.createInstance("com.sun.star.drawing.GraphicObjectShape");
The problem is that the oGraphic object is null. I have no GraphicObjectShape in the package com.sun.star.drawing, but why?
|
What is xMSF?
I would guess from the name, that it is an XMultiServiceFactory of some object. But that object?
Is xMSF the XMultiServiceFactory of the Service Manager? This will not work.
You need to ask the XMultiServiceFactory of the document to create the GraphicObjectShape. _________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
Keymaster General User

Joined: 17 Feb 2005 Posts: 23 Location: München, Germany
|
Posted: Sat Feb 19, 2005 11:21 am Post subject: |
|
|
ok thats one point ^^
the next problem is that there is no GraphicObjectShape at sun.star.drawing
or is GraphicObjectShape not a Class? I am a noob in every OO things |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
|
| Back to top |
|
 |
Keymaster General User

Joined: 17 Feb 2005 Posts: 23 Location: München, Germany
|
Posted: Sun Feb 20, 2005 3:41 am Post subject: |
|
|
Yes normaly everyone can find it at com.sun.star.drawing. I can call the package drawing normally but there is now GraphicObjectShape. I find it in the sun docus and so on but not in my libs. I dont know why but there is no GraphicObjectShape and no other Class having nearly the same name. What OpenOffice Lib i have to include in my java project to use the GraphicObjectShape? Perhaps i have forgotten somthing.
I have included the openOffce jars in program\classes |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Sun Feb 20, 2005 9:20 am Post subject: |
|
|
If you are building a component that is installed into the office, and runs within the office, then you need to put the jar files from OOo into your compile-time classpath.
If your java program runs from outside of the office (i.e. a standalone program, or a servlet, for example) then you must include some of the OOo jar files in your runtime classpath.
The jars are found under your
$OOo/program/classes
folder. _________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
Keymaster General User

Joined: 17 Feb 2005 Posts: 23 Location: München, Germany
|
Posted: Mon Feb 21, 2005 4:06 am Post subject: |
|
|
Ok that is whate i have done.
alle these jars are included but no GraphicObjectShape file is available.
Is the GraphicObject Shape a Class ! File ! or is it only something else?
But if i can call it with com.sun.star.drawing.GraphicObjectShape it have to be a class file i think. Or be i wrong?
If it is a class, only god knows why it is not available in my application |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Mon Feb 21, 2005 10:58 am Post subject: |
|
|
Keymaster:
Do you have the SDK installed?
If not, please do that. The Developer's Guide describes the first steps of coding in Java in its first or second chapter, I think.
It's a very simple and good description and will probably help to solve your problems.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
Keymaster General User

Joined: 17 Feb 2005 Posts: 23 Location: München, Germany
|
Posted: Wed Feb 23, 2005 7:12 am Post subject: |
|
|
| Yes i have installt the SDK it helps much but solves not all my probs ^^ |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Sat Feb 26, 2005 10:22 am Post subject: |
|
|
| Keymaster wrote: | | Is the GraphicObject Shape a Class ! File ! or is it only something else? |
The OOo jars will NOT include any classes, such as GraphicObjectShape.
The OOo jars WILL include the interfaces of OOo's API. GraphicObjectShape implements at least one interface. When you createInstance() of a GraphicObjectShape, an interface will be returned. You can queryInterface on this to obtain any of the other interfaces that are also implemented by GraphicObjectShape.
GraphicObjectShape is a service. It exists within the OOo, not within the java process. In Java a proxy object is returned, Actually an interface is returned. Using the queryInterface() function, you can obtain any of the other interfaces to the same object.
You can only get hold of one or more of the interfaces of a Service in OOo. Each Service many offer multiple interfaces to do different things on that Service. You use queryInterface to switch among the different interfaces of the same Service object. _________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
|