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

Joined: 06 Jan 2005 Posts: 24
|
Posted: Wed May 18, 2005 1:00 am Post subject: Converting an OOo macro to java query? |
|
|
Hi,
I have a macro the functionality of which I'd like to embed in our java applications. I'm ok with converting it so far but there is one area I have come across which is leaving me baffled.
My macro code snippet is :
| Code: |
Do While cur.getPage() = currentpage
If cur.goLeft(1, True) Then
charcount = charcount + 1
if Not isEmpty(cur.TextTable) Then # this is my query line
bEmptyPage = False
Exit Do
End If
|
My java code :
| Code: |
while (pageCursor.getPage()== currentPage){
if (textViewCursor.goLeft(oneChar,true)) {
charCount += 1;
if (XTextViewCursor.UNOTYPEINFO[1] != null) { // this is not correct I know
// do stuff here
}
|
The query line I've indicated in the macro code refers to a property TextTable of the cursor.
What I need to know is how do I reference such a property from java. (I suspect something to do with the array of InfoType - UNOINFOTYPE), and secondly am I right in assuming that isEmpty is the same as == null in java?
[A plug here for Andrew Pitonyaks book - OpenOffice.org macros explained - This is where I found the reference to the TextTable property- a mine of useful information.]
Thanks
Malcolm |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Wed May 18, 2005 1:46 am Post subject: |
|
|
| Quote: | | isEmpty is the same as == null in java? |
No, it is not. There is a Starbasic function checking for Null called "IsNull()". You can see that if you do use IsNull on your TextTable property it will say false although IsEmpty returns True.
The actual UNO type returned is "void", which is the same in the Java language binding.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
malcooke General User

Joined: 06 Jan 2005 Posts: 24
|
Posted: Wed May 18, 2005 7:01 am Post subject: |
|
|
Thanks for that information Christian - all I need to do now is to be able to find the property from java Still searching.
Malcolm |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
malcooke General User

Joined: 06 Jan 2005 Posts: 24
|
Posted: Thu May 19, 2005 1:01 am Post subject: |
|
|
Ignorance is bliss - well sometimes.
What I was trying to do was to reproduce the macro code in java, and needed to know how to access the property on the cursor.
I have now found the appropriate section (3.3.4) in the SDK manual re UNO properties and there in front of me is an explanation of how to get the properties and property state using Java.
The UNOINFOTYPE was a red herring because I assumed that was the container for the properties.
Thank you to all |
|
| Back to top |
|
 |
malcooke General User

Joined: 06 Jan 2005 Posts: 24
|
Posted: Thu May 19, 2005 3:57 am Post subject: |
|
|
I should add that I mean my ignorance
I'm always telling other people to read the manual first... should listen to my own advice sometimes. |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
Posted: Thu May 19, 2005 8:09 am Post subject: |
|
|
My answer was also not complete : I forget to have a look at XTextCursor.idl file, but again don't find what I look for. Here is the IDL file :
| Code: |
module com { module sun { module star { module text {
interface XTextCursor: com::sun::star::text::XTextRange
{
[oneway] void collapseToStart();
[oneway] void collapseToEnd();
boolean isCollapsed();
boolean goLeft( [in] short nCount,
[in] boolean bExpand );
boolean goRight( [in] short nCount,
[in] boolean bExpand );
void gotoStart( [in] boolean bExpand );
void gotoEnd( [in] boolean bExpand );
void gotoRange( [in] com::sun::star::text::XTextRange xRange,
[in] boolean bExpand );
};
}; }; }; };
|
Hope you will publish your code later. Thank you in advance. _________________ 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 |
|
 |
RenjiKage Power User


Joined: 13 Oct 2005 Posts: 88 Location: Kokubunji-shi, Tokyo-to, Japan
|
Posted: Thu Dec 01, 2005 7:51 pm Post subject: |
|
|
@malcooke: Have you found a solution for your problem? I have, right now, the same problem (how can isEmpty() be translated to Java?) as you had before. If you know an answer, please tell me!  |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
RenjiKage Power User


Joined: 13 Oct 2005 Posts: 88 Location: Kokubunji-shi, Tokyo-to, Japan
|
Posted: Sun Dec 04, 2005 4:01 pm Post subject: |
|
|
I want to know where a cursor is positioned in a text document (main body, text table, header, footer,...) and react accordingly. I wanted to check the XTextCursor properties, but a check on == null is not successful. In OO Basic, you can check whether the property is "empty", but how do you do that in Java? What means "empty", technically?  |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
RenjiKage Power User


Joined: 13 Oct 2005 Posts: 88 Location: Kokubunji-shi, Tokyo-to, Japan
|
|
| Back to top |
|
 |
|