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

Joined: 23 Apr 2012 Posts: 8
|
Posted: Wed Aug 15, 2012 10:07 pm Post subject: Determining if text cursor is visible in Impress and Calc |
|
|
| 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 |
|
 |
ras550 General User

Joined: 23 Apr 2012 Posts: 8
|
Posted: Fri Aug 17, 2012 8:29 am Post subject: |
|
|
| Anyone? |
|
| Back to top |
|
 |
phazzy Power User

Joined: 26 Mar 2009 Posts: 60 Location: Bucharest, Romania
|
Posted: Mon Aug 20, 2012 2:20 am Post subject: |
|
|
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 |
|
 |
ras550 General User

Joined: 23 Apr 2012 Posts: 8
|
Posted: Mon Aug 20, 2012 7:36 am Post subject: |
|
|
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 |
|
 |
|