OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Converting an OOo macro to java query?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
malcooke
General User
General User


Joined: 06 Jan 2005
Posts: 24

PostPosted: Wed May 18, 2005 1:00 am    Post subject: Converting an OOo macro to java query? Reply with quote

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
View user's profile Send private message
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Wed May 18, 2005 1:46 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
malcooke
General User
General User


Joined: 06 Jan 2005
Posts: 24

PostPosted: Wed May 18, 2005 7:01 am    Post subject: Reply with quote

Thanks for that information Christian - all I need to do now is to be able to find the property from java Smile Still searching.

Malcolm
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Wed May 18, 2005 9:37 am    Post subject: Reply with quote

Here is XTextViewCursor Interface :
Code:

//IDL
module com {  module sun {  module star {  module text {
interface XTextViewCursor: com::sun::star::text::XTextCursor
{
   boolean isVisible();
   [oneway] void setVisible( [in] boolean bVisible );
   com::sun::star::awt::Point getPosition();
};

}; }; }; };

I don't see any UNOTYPEINFO[1] and then don't understand what do you want ?
_________________
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
View user's profile Send private message Visit poster's website
malcooke
General User
General User


Joined: 06 Jan 2005
Posts: 24

PostPosted: Thu May 19, 2005 1:01 am    Post subject: Reply with quote

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
View user's profile Send private message
malcooke
General User
General User


Joined: 06 Jan 2005
Posts: 24

PostPosted: Thu May 19, 2005 3:57 am    Post subject: Reply with quote

I should add that I mean my ignorance Embarassed

I'm always telling other people to read the manual first... should listen to my own advice sometimes.
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Thu May 19, 2005 8:09 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
RenjiKage
Power User
Power User


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

PostPosted: Thu Dec 01, 2005 7:51 pm    Post subject: Reply with quote

@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! Very Happy
Back to top
View user's profile Send private message Visit poster's website
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Fri Dec 02, 2005 9:40 am    Post subject: Reply with quote

What do you look for ? Texttable in a page ?
_________________
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
View user's profile Send private message Visit poster's website
RenjiKage
Power User
Power User


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

PostPosted: Sun Dec 04, 2005 4:01 pm    Post subject: Reply with quote

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? Confused
Back to top
View user's profile Send private message Visit poster's website
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Mon Dec 05, 2005 10:43 am    Post subject: Reply with quote

Probably defined as a UNO constant : com.sun.start.somthing.EMPTY.
I am not a Java programmer and then cannot help more.
_________________
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
View user's profile Send private message Visit poster's website
RenjiKage
Power User
Power User


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

PostPosted: Mon Dec 05, 2005 3:48 pm    Post subject: Reply with quote

I looked here:
http://api.openoffice.org/docs/common/ref/com/sun/star/beans/PropertyAttribute.html

This seemed to be a good place, since TextTable is a property, but there is no constant that seems to represent something like isEmpty(). Perhaps it's a combination of PropertyAttributes or I am just looking in the wrong place... Sad
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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