Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index


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: users+unsubscribe@global.libreoffice.org
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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.