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


Joined: 23 Dec 2004 Posts: 11
|
Posted: Tue Jul 19, 2005 5:25 am Post subject: API documentation - pleas help me understand |
|
|
Hello there again!
Few hours ago, i was asking question about how to get from one object to another.
I was searching in API - and I cannot understand - why I cannot find anything there.
Example:
| Code: | | oResult = something.findFirst(oSearch) |
NOW: what exactly is this oResult?
If the thing i was searching for is inside textTable's cell, then i may do:
| Code: |
oCell = oResult.cell
oTable = oResult.textTable
|
It works, but I dont know why. I tried .cell and it worked. i tried .table and it worked. Where could I get the full list of what is expected to be valid for my oResult?
I want textTableCursor, but it isn't working (oResult.textTableCursor produces some 'bridge automation' error). Can someone show me in this IDL Reference or anywhere why oResult.cell and oResult.table works and how I can find a way to get some cursor that could help me to skip to next cell in this table?
I really would like to now how may I use this API, so I could stop guessing and start writing program? Please show me on this example - what may I do with my oResult and how to find a way to get some object that would let me go through this table starting from the cell oResult had found?
Last edited by pljosh on Tue Jul 19, 2005 11:24 am; edited 1 time in total |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
Posted: Tue Jul 19, 2005 7:21 am Post subject: |
|
|
The global index is :http://api.openoffice.org/docs/common/ref/index-files/index-1.html
If you look for findfirst you find :
findFirst
| Code: |
::com::sun::star::uno::XInterface findFirst( [in] XSearchDescriptor xDesc );
|
That means it returns an XInterface.
Effectively I don't know what OOoBasic does after.
Perhaps this Bernard Marcelly's code will help
| Code: |
Dim CurseurDansCellule As Object
Dim FinParagraphe As Integer
FinParagraphe = com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK
UneCellule = MaTable.getCellByName("B3") ' (par exemple)
CurseurDansCellule = UneCellule.createTextCursor
UneCellule.insertString(CurseurDansCellule, "OpenOffice est", false)
UneCellule.insertControlCharacter(CurseurDansCellule, FinParagraphe, false)
CurseurDansCellule.CharWeight = com.sun.star.awt.FontWeight.BOLD
UneCellule.insertString(CurseurDansCellule, " formidable !", false) |
to write something in writer in a table. _________________ Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide |
|
| Back to top |
|
 |
pljosh General User


Joined: 23 Dec 2004 Posts: 11
|
Posted: Tue Jul 19, 2005 11:23 am Post subject: thats the point: who nows where it goes? |
|
|
Thank you for your answer.
However, i do know, that findFirst returns some kind of abstraction called XInterface, but it does'nt help at all, since there is no way to figure out where you can go from this point
I do not know what to say... HELLO THERE PEOPLE, how are we suppose to use OpenOffice if there is no way to figure out such a simple things?
Digging through examples is a big waste of time. It may be some help for beginners, so they may find out how to start, but is useless if you have specific problem and you have to deal with it.
Fortunatelly I found that in OO.org 2 there is someting that may be used as an 'object browser' - it shows where you can go from the object you type in to be watched (you may expand tree with properties etc...). But it is still very uncomfortable as I am writing my code in FoxPro and now everything i have to type twice (in embedded BASIC editor and in the code of my application).
But maybe I am wrong? Maybe there is some simple explanation for all this?
p.s.
After some basic experiments in embedded editor of OO2 i found that I can get cell's addres like this:
| Code: | | oResult.cell.cellName //(or something very similar, i dont remember now) |
and i could pass it as a parameter some method of oResult.textTable.something which will propably work (I have to check it tomorrow).... or maybe it will not work? And I will spend few more days and will tell my boss, that implementing OpenOffice in our program wasnt good idea, because it is much too expensive to waste time trying to accomplish simple tasks  |
|
| Back to top |
|
 |
uros Super User


Joined: 22 May 2003 Posts: 601 Location: Slovenia
|
Posted: Tue Jul 19, 2005 10:23 pm Post subject: Re: thats the point: who nows where it goes? |
|
|
Hi pljosh!
| pljosh wrote: | I do not know what to say... HELLO THERE PEOPLE, how are we suppose to use OpenOffice if there is no way to figure out such a simple things?
Digging through examples is a big waste of time. It may be some help for beginners, so they may find out how to start, but is useless if you have specific problem and you have to deal with it. |
I can't agree with you. I grow up with Basic on ZX81 and Spectrum (if this means anything to you ) and work with Clipper later, I didn't have any knowledge about object-oriented programming. All I know now I learned from examples! Not only little things shown by each of them but the system of objects, services, interfaces, methods, properties,...There is no way to learn all of them (no one need or use all of them anyway), you just have to understand logic of objects. Don't underestimate examples, this is IMHO the easiest way to get it. Not from one, from the mass...
You didn't explain yor problem in details. It is hard to give you some direct advice to solve your actual problem. Anyway,as old Chinese said, teach a man to fish... You are on a right way to learn more then solve this problem only. Just dig and don't lose courage to soon!
| Quote: | | ...I am writing my code in FoxPro... | I don't know if there is a way to use Xray, a great tool of Bernard Marcelly. For start you can use following properties
| Code: | oObject.Dbg_Properties
oObject.Dbg_Methods
oObject.Dbg_SupportedInterfaces |
to find out properties, methodes and interfaces of an object (oResult in your case = oResult.Dbg_Methods). Result can be Print, put into variable, write down in a text file or spreadsheet.... Details of found props,... can be found in SDK.
Hope this helps you in some way. Don't give up!
Uros |
|
| Back to top |
|
 |
Danad OOo Advocate

Joined: 22 Feb 2004 Posts: 293 Location: Brasil
|
Posted: Wed Jul 20, 2005 7:22 am Post subject: |
|
|
| Quote: |
But it is still very uncomfortable as I am writing my code in FoxPro and now everything i have to type twice (in embedded BASIC editor and in the code of my application).
|
Well, you can write some single routines to inspect objects with your favourite language. Look for Some Introspection techniques (various languages) here in this forum (Code Snippets).
HTH |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Wed Jul 20, 2005 12:18 pm Post subject: |
|
|
As you use the API, you start to understand how it works
| Quote: |
I was searching in API - and I cannot understand - why I cannot find anything there.
|
It takes time to understand how it works. First, do you know what an interface is? Do you know what a service is? It is a pain initial process
| Quote: |
Example:
oResult = something.findFirst(oSearch)
NOW: what exactly is this oResult?
|
An interface is returned, specifically because many types of objects are searchable. In a text document, a text range is returned. I do not remember off hand what is returned in a calc document, but it is probably either a cell or a cell range. The fact that different objects return different types is why the return type is simply listed as interface. I know, this is not friendly...
| Quote: |
If the thing i was searching for is inside textTable's cell, then i may do:
oCell = oResult.cell
oTable = oResult.textTable
|
Most of the text range objects have Cell, TextTable, TextSection, etc... properties that you can use to see if the object is located inside of these objects. For example, the CellProperties service defines the TextSection attribute that will be set if the table containing the cell is inside of a text section.
| Quote: |
It works, but I dont know why. I tried .cell and it worked. i tried .table and it worked. Where could I get the full list of what is expected to be valid for my oResult?
|
I usually inspect the object, as mentioned already, to see what properties and methods are supported. I then usually try to find where they are documented. Slow and painful...
| Quote: |
I want textTableCursor, but it isn't working (oResult.textTableCursor produces some 'bridge automation' error). Can someone show me in this IDL Reference or anywhere why oResult.cell and oResult.table works and how I can find a way to get some cursor that could help me to skip to next cell in this table?
|
You must create a table cursor and then you can use that to move around in the text table. Read the section labeled The cursor in a text table in my free macro document.
[/b] _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Wed Jul 20, 2005 4:47 pm Post subject: |
|
|
pljosh:
There are ways to figure things out and they are very very extensively documented in the Developer's Guide which you can read on api.openoffice.org . Also the IDL reference always has a short description to an object, thus if you browse to XInterface you can read what is said about it.
Then it also came up that you can use some introspection techniques, so you don't need to switch between Starbasic inspector and your language.
I know it is hard to get into it, but the thing is: There is documentation out there that gives enough information.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|