Getting a viewcursor in a RichEditControl

Keyboard macros or custom scripts

Getting a viewcursor in a RichEditControl

Postby taurian » Thu Jan 25, 2018 2:37 am

I have a Python app using a non modal window with several controls in Writer 5.4.3.
I can manipulate all controls , enter text, handle keystrokes,
create text cursors, etc.
There is one thing i cannot do: create a view cursor
for a richtextcontrol (RTC). I need a view cursor to be able to parse text
at the current cursor location.

Pressing f12 opens the non modal window and populates the RTC (txt.c)
I position the cursor in the RTC and hit ctl-F12 (there are KeyListeners for all controls) which runs code similar to:
Code: Select all   Expand viewCollapse view
'''
zt.c      # non modal window control
zt.frame   # non modal window frame (zt,txt are class objects)
txt.m      # rich text model
txt.c      # rich text control
'''
txt.c.setText('wwww')   # 'wwww' is seen in the richtextcontrol
##  i thought this would work:
ctlr      =   zt.frame.getController()
txt.c.setText(repr(ctlr))  ## returns: None in the richtextcontrol
cv     =   ctlr.getViewCursor()


The value of 'ctlr' is 'None', which is not what I want. I need the controller value of the
non-modal window, not the controller of the Writer document, to get a ViewCursor here.
I have used MRI and
reviewed API Reference & Developers Guide & Basic Guide & have A. Pitonyak's book
all to no avail.
I would appreciate any assistance at all on this.
Libreoffice 5.4 on Windows 10
taurian
 
Posts: 1
Joined: Thu Jan 25, 2018 2:17 am

Re: Getting a viewcursor in a RichEditControl

Postby Villeroy » Thu Jan 25, 2018 1:35 pm

Service com.sun.star.form.component.RichTextControl is restricted to database forms. What you are using is a com.sun.star.awt.UnoControlEdit without binding to a database.
Attachments
RichTextControl_t92134.odt
(13.94 KiB) Downloaded 28 times
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Villeroy
Volunteer
 
Posts: 25560
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to OpenOffice Basic, Python, BeanShell, JavaScript

Who is online

Users browsing this forum: No registered users and 3 guests