Rem Macro pour/for OpenOffice: ' A (execute macro) --> Á Rem Compose toute lettre accentuée Rem La macro doit être affectée à une touche (F6, ctrl-n, ...) Rem Compose any accented letter Rem The macro should be assigned to a key (F6, ctrl-n, ...) Rem Logiciel libre. Rem This macro is free software, you can use it as you like. Rem Created by Malcolm Read m@andromeda-it.co.uk 30th June 2003 Rem Based on a StarOffice macro created by... Rem J.-P. Gallou gallou@cict.fr, 11 mar 2000 Rem mis a jour/updated 22 mar 2002 Rem Dim l, ls, c, st As String Sub Main Dim s, lc As String '=============================== ' the two following lines get the active document oDesktop = createUnoService("com.sun.star.frame.Desktop") oDocument= oDesktop.getCurrentComponent() oText = oDocument.Text ' after this, an obscure call gets the current cursor position ' but most cursor methods don't work with a view cursor oVCursor = oDocument.currentcontroller.getViewCursor() '- #original ' Create a range to be selected... ' start from original position oVCursor.getstart() and then oCursor = oText.createTextCursorByRange(oVCursor.getstart()) ' #original ' go 2 characters left oCursor.goLeft(2,TRUE) ' get the 2 characters in the cursor range s = oCursor.getString() st = s l=right (s, 1) ls="aceinosuyzACEINOSUYZ" c="" Select Case left (s, 1) Case "'", "'", "'" MetAccent("á éí ó úý Á ÉÍ Ó ÚÝ ") Case "`" MetAccent("à èì ò ù À ÈÌ Ò Ù ") Case "^" MetAccent("âçêî ôs(û z(ÂÇÊÎ ÔS(Û Z(") Case """", ":" MetAccent("ä ëï ö üÿ Ä ËÏ Ö ÜY") Case "~" MetAccent("ã ñõ Ã ÑÕ ") Case else Select Case s Case "eu" c = "EUR" Case "mi", "mu" c = "µ" Case "ae" c = "æ" Case "AE" c = "Æ" Case "oe" c = "oe" Case "OE" c = "OE" Case "sz" c = "ß" Case ".a", "°a" c = "å" Case ".A", "°A" c = "Å" Case "/o" c = "ø" Case "/O" c = "Ø" Case "pm", "pt" c = "0/00" Case "tm" c = "^(TM)" Case "po" c = "£" Case "sp" c = " " Case "!!" c = "¡" Case "??" c = "¿" Case "mo" c = "¤" Case "ye" c = "¥" Case "se" c = "§" Case "pa" c = "¶" Case "co" c = "©" Case "re" c = "®" Case "ma" c = "¯" Case "no" c = "¬" Case "+-" c = "±" Case "xx" c = "×" Case "-n" c = "-" Case "-m" c = "--" Case ":-" c = "÷" Case ".." c = "..." Case "of" c = "ª" Case "om" c = "º" Case "e1", "s1" c = "¹" Case "e2", "s2" c = "²" Case "e3", "s3" c = "³" Case "14" c = "¼" Case "12" c = "½" Case "34" c = "¾" Case "ce" c = "¢" Case "et" c = "ð" Case "ET" c = "Ð" Case "th" c = "þ" Case "TH" c = "Þ" End Select End Select if c = "" or c = " " then oCursor.goLeft(2,TRUE) Else oText.insertString(oCursor,c,TRUE) End If end sub Function MetAccent(la as String) Dim i As Integer For i = 1 To 20 if mid (ls, i, 1) = l then c = mid (la, i, 1) exit for end if Next i end Function