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

xSearchable NOT in XDocument

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


Joined: 05 Dec 2004
Posts: 8

PostPosted: Fri Feb 17, 2006 4:33 am    Post subject: xSearchable NOT in XDocument Reply with quote

How can i use the XSearchable interface in an already exatracted textRange resulted from a previous search action.

First search is working, but i cannot obtain the next xSearchable interface related to textRange obtained.

Code:

com.sun.star.util.XSearchDescriptor xSearchDescriptor = null;
            com.sun.star.util.XSearchable xSearchable = null;

                        
            xSearchable = (XSearchable) UnoRuntime.queryInterface(XSearchable.class,xTextDocument);
            xSearchDescriptor = (XSearchDescriptor) xSearchable.createSearchDescriptor();
            
            xSearchDescriptor.setPropertyValue("SearchRegularExpression", new Boolean(true));
            
            xSearchDescriptor.setSearchString("<#.*/#>");
            
            XIndexAccess tagIndex = xSearchable.findAll(xSearchDescriptor);
            //   se inregistreaza functiile
            for (int j = 0; j < tagIndex.getCount(); j++)
            {
               XTextRange tagTxtRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class,tagIndex.getByIndex(j));
               xSearchable = (XSearchable) UnoRuntime.queryInterface(XSearchable.class,tagTxtRange);
               
               String tagName = tagTxtRange.getString().replaceAll("<#", "").replaceAll("/#>", "");
               
               javaData.append("\n");
               javaData.append("\tpublic Object get" + functionBaseName + functionId + "()" + "\n");
               javaData.append("\t{" + "\n");
               javaData.append("\t\treturn " + tagName + ";" + "\n");
               javaData.append("\t}" + "\n");
               javaData.append("\n");
               tagTxtRange.setString("<#" + functionBaseName + functionId + "/#>");
               functionId ++;
            }
            javaData.append("}");
Back to top
View user's profile Send private message Yahoo Messenger
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