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

Determining if text cursor is visible in Impress and Calc

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


Joined: 23 Apr 2012
Posts: 8

PostPosted: Wed Aug 15, 2012 10:07 pm    Post subject: Determining if text cursor is visible in Impress and Calc Reply with quote

I am trying to programmatically determine whether the user is in a text entry field (e.g a cell in a spreadsheet, or a text input field inside a chart or a draw shape). Basically I am trying to detect if a text cursor is currently visible inside Openoffice. Is there a simple way to do this? Thanks.
Back to top
View user's profile Send private message
ras550
General User
General User


Joined: 23 Apr 2012
Posts: 8

PostPosted: Fri Aug 17, 2012 8:29 am    Post subject: Reply with quote

Anyone?
Back to top
View user's profile Send private message
phazzy
Power User
Power User


Joined: 26 Mar 2009
Posts: 60
Location: Bucharest, Romania

PostPosted: Mon Aug 20, 2012 2:20 am    Post subject: Reply with quote

Hello,

If you can obtain an object with XTextViewCursor interface, it has a function named isVisible() that does exatly what you need.
To get the current view cursor (where the cursor is), here is the code in C# :

Code:

// Get document as XModel
XModel xModel = (XModel) xDocument; // xDocument is your document

// Get current controller as XTextViewCursorSupplier
XTextViewCursorSupplier xTxtViewSupplier = (XTextViewCursorSupplier) xModel.getCurrentController();

// Get view cursor
XTextViewCursor xTextViewCursor = xTxtViewSupplier.getViewCursor();

// Check visibility
bool visible = xTextViewCursor.isVisible();
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
ras550
General User
General User


Joined: 23 Apr 2012
Posts: 8

PostPosted: Mon Aug 20, 2012 7:36 am    Post subject: Reply with quote

Thanks for the reply!

I am working on linux so C# won't work for me. Would you have the VB or Python version of the same? Also, would it work on Writer only, or in Impress and Calc as well (My research showed me the XTextViewCursor doesn't work in impress/calc)

Thanks again!
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