Hi,
I am trying to add a really simple macro that I can bind to a key. I just
want ot be able ot add checkmarks to student papers veyr quickly, so I
would like to select a sentence or other text range, then press a key, and
have the ckeckmark appear in a new comment.
I can almost do htis, using code stolen from the web:
rem-------------------------------------------
rem -- misleadingly named macro adds a simple hceckmark at point, or in
response to highlighted text.
sub createComment
rem create the annotation object
oAnno =
ThisComponent.createInstance("com.sun.star.text.textfield.Annotation")
rem Chr 10004 is the decimal for hex code 2714, "heavy checkmark"
oAnno.Content = Chr(10004)
oAnno.Author = "Matt Price"
oText = ThisComponent.Text
rem check to see if anything is selected
oSels = ThisComponent.getCurrentSelection()
If Not IsNull(oSels) Then
rem I don't know what to put in here
Else
oVC = ThisComponent.CurrentController.ViewCursor
oText.insertTextContent(oVC.Start, oAnno, False)
End If
end sub
-----------------------
You can see that, if there's no selection, I already know how to insert the
annotation. But I don't know how to attach the annotation to the selected
range instead of just the start of the cursor.
In general, I don't know where to find the funciton references or even the
source code for the relevant functions. I'm finding it quite difficult to
figure out how to learn to program -- is there comprehensive documentation
somewhere?
Thanks,
Matt
--
To unsubscribe e-mail to: [email protected]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted