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

How to activate other calc file

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


Joined: 03 Jan 2006
Posts: 7

PostPosted: Fri Jan 06, 2006 1:08 am    Post subject: How to activate other calc file Reply with quote

Anyone knows how to activate calc files.

I have different calc files opened. I need to activate the other calc file that is already opened.

Thanks in advance.
Back to top
View user's profile Send private message
zaphod
Power User
Power User


Joined: 04 Nov 2004
Posts: 51
Location: Magdeburg, Germany

PostPosted: Fri Jan 06, 2006 3:09 am    Post subject: Reply with quote

I guess something like that:
First get all opened components:
Code:
    XComponentContext ctx = bootstrapContext();
    XDesktop desk = getDesktop(ctx);
    com.sun.star.container.XEnumeration enum = desk.getComponents().createEnumeration();

Iterate through them via nextElement() method, until you find the appropriate component. (E.g check the Title, document type, URL or whatever via mediadescriptor). Then get the frame of the component and set it acitive:
Code:
    XModel xModel = (XModel) UnoRuntime.queryInterface( XModel.class, xCompo)
    xModel.getCurrentController().getFrame().activate();

I hope this was, what you meant.
Back to top
View user's profile Send private message
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