/usr/lib/libreoffice/share/extensions/DmathsAddon/Dmaths/RaccAutotextes.xba is in libreoffice-dmaths 3.4+dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="RaccAutotextes" script:language="StarBasic">'************************************************
'Copyright (C) 2008 Didier Dorange-Pattoret
'38, chemin de l'abbaye
'74940 Annecy le Vieux
'France
'ddorange@dmaths.com
'
'
'This library is free software; you can redistribute it and/or
'modify it under the terms of the GNU General Public Licence (GPL)
'as published by the Free Software Foundation; either
'version 2.1 of the License, or (at your option) any later version.
'This library is distributed in the hope that it will be useful,
'but WITHOUT ANY WARRANTY; without even the implied warranty of
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
'General Public License for more details.
'You should have received a copy of the GNU General Public Licence (GPL)
'along with this library; if not, write to the Free Software
'Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'************************************************
'------------------------------------------------------------------------------------------------------------------
rem cette macro permet d'inserer des autotextes collés
Sub SuperAutotexte rem écrit le 19 avril 2005 par Didier Dorange-Pattoret
rem on charge le dictionnaire si besoin
If DictionnaireCharge = False Then ChargementDuDictionnaire
rem Rien pour Auto5 comme "foncs"?
Dim oDesktop, oDocument, oText, oVCursor, oTextActif, oCursor as Object
Dim dispatcher, oFrame as Object
Dim Lachaine as String
Dim NRecul as Integer rem on doit reculer de NRecul caractere
oDesktop = createUnoService("com.sun.star.frame.Desktop")
oDocument= oDesktop.getCurrentComponent()
oText = oDocument.Text
oVCursor = oDocument.currentcontroller.getViewCursor()
oTextActif = oVCursor.Text ' la zone de texte actif page ou cellule ....
oCursor = oTextActif.createTextCursorByRange(oVCursor)
oFrame = oDocument.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
If oVCursor.IsCollapsed Then
For I =1 To 4
If Not oCursor.IsStartOfParagraph Then oCursor.Goleft(1,True)
Next I
Lachaine = oCursor.String
Else
LaChaine = oVCursor.String
oCursor.Goleft(Len(LaChaine),True)
Endif
rem initialisation de NRecul
NRecul = 0
If Len(Lachaine)=1 Then lachaine = " "+Lachaine
If Len(Lachaine)=2 Then Lachaine = " "+Lachaine
If Len(Lachaine)=3 Then Lachaine = " "+Lachaine
For I = 1 To Len(Auto(iLang,4))/4
If Mid(Lachaine,1,4)=Mid(Auto(iLang,4),4*I-3,4) Then
If oVCursor.IsCollapsed then oVCursor.Goleft(4,True)
Goto Glossaire
Endif
Next I
For I = 1 To Len(Auto(iLang,3))/3
If Mid(Lachaine,2,3)=Mid(Auto(iLang,3),3*I-2,3) Then
If oVCursor.IsCollapsed then oVCursor.Goleft(3,True)
Goto Glossaire
Endif
Next I
For I = 1 To Len(AutoFormule(iLang,3))/3
If Mid(Lachaine,2,3)=Mid(AutoFormule(iLang,3),3*I-2,3) Then
If oVCursor.IsCollapsed then oVCursor.Goleft(3,True)
EcritLaFormuleAutotexte(Mid(Lachaine,2,3),oVCursor)
Exit Sub
Endif
Next I
For I = 1 To Len(Auto(iLang,2))/2
If Mid(Lachaine,3,2)=Mid(Auto(iLang,2),2*I-1,2) Then
If oVCursor.IsCollapsed then oVCursor.Goleft(2,True)
If Mid(Lachaine,3,2) = "ni" then NRecul = 1 rem permet de reculer de 2 caracteres
If Mid(Lachaine,3,2) = "ba" then NRecul = 1
Goto Glossaire
Endif
Next I
For I = 1 To Len(AutoFormule(iLang,2))/2
If Mid(Lachaine,3,2)=Mid(AutoFormule(iLang,2),2*I-1,2) Then
If oVCursor.IsCollapsed then oVCursor.Goleft(2,True)
EcritLaFormuleAutotexte(Mid(Lachaine,3,2),oVCursor)
Exit Sub
Endif
Next I
For I = 1 To Len(Auto(iLang,1))
If Mid(Lachaine,4,1)=Mid(Auto(iLang,1),I,1) Then
If oVCursor.IsCollapsed then oVCursor.Goleft(1,True)
rem correction du bug sur d
If oVCursor.String()="d" Then oVCursor.String()="deci"
If oVCursor.String()="c" Then oVCursor.String()="cp"
If Mid(Lachaine,4,1) = "i" Then NRecul = 1 rem permet de reculer de 1 caractere
Goto Glossaire
Endif
Next I
Glossaire:
If (Lachaine = " oij" or Lachaine = "oijk" or Lachaine = " ouv") Then
If Lachaine = " oij" Then InsereRepereOij
If Lachaine = "oijk" Then InsereRepereOijk
If Lachaine = " ouv" Then RepereGraphique
Else
dim Array(0) as new com.sun.star.beans.PropertyValue
dispatcher.executeDispatch(oFrame, ".uno:ExpandGlossary", "", 0, Array())
If NRecul > 0 Then recul (NRecul) rem recule de NRecul caracteres
rem dispatcher.executeDispatch(oFrame, ".uno:ResetAttributes", "", 0, Array())
rem ligne précédente en commentaire pour éviter le formattage du paragraphe
rem dans le style par défaut, dont l'alignement...
Endif
End sub
Sub EcritLaFormuleAutotexte(Raccourci as String, oVCursor as Object )
Dim LeCodeSource as String
Dim iTailleDElaFormule as Integer
Select Case Raccourci
Case "cb"
LeCodeSource = "left( matrix{ n##p } right) = {n nitalic !}over {p nitalic !(n-p) nitalic !}"
Case "arr"
LeCodeSource = "{A_n^p} = {n nitalic !}over {(n-p) nitalic !}"
Case "fcf"
LeCodeSource = "[a_{1},a_{2}, dotslow , a_{n}] = size 12{1 over {a_{1}+ 1 over {a_{2}+1 over { {dotsaxis + 1 over {a_{n}}}} }}}"
Case "fci"
LeCodeSource = "[a_{1},a_{2}, a_{3},dotslow] = size 12{1 over {a_{1}+ 1 over {a_{2}+1 over { {a_{3}+{1 over {~ dotsdown}}}}} }}"
Case "ic"
LeCodeSource = "int from{%GAMMA} nitalic P dx + nitalic Q dy + nitalic R dz"
Case "id"
LeCodeSource = "iint from{%DELTA} f(x,y)dx dy"
Case "it"
LeCodeSource = "iiint from{%SIGMA} f(x,y,z) dx dy dz"
Case "pc"
LeCodeSource = "P(A`/B)= {P(A intersection B)} over {P(B)}"
End Select
oVCursor.String = LeCodeSource
IsFormuleItalic = bItalic
If bManuelFormula = FALSE Then InsereObjetFormule
End Sub
</script:module>
|