/usr/lib/libreoffice/share/extensions/DmathsAddon/OOoTep/Textes.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 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | <?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="Textes" script:language="StarBasic">'OOoGdmath
'Copyright (C) 2005-2006 Gilles Daurat
'This program is free software; you can redistribute it and/or
'modify it under the terms of the GNU General Public License
'as published by the Free Software Foundation; either version 2
'of the License, or (at your option) any later version.
'This program 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 License
'along with this program; if not, write to the Free Software
'Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Option Explicit
dim oChangeTexteForm as Object
dim unGroupe as Object
dim texteCourant as Object
dim indice() as String
Sub Main
Dim Param() as string
oChangeTexteForm=LoadDialog("OOoTep", "TextesForm")
ChangeTitreDialog(oChangeTexteForm)
'on charge les polices
ChargeNomPolice(param())
oChangeTexteForm.GetControl("ComboBox2").Model.StringItemList=param()
SetListIndex(oChangeTexteForm, "ComboBox2", 0)
'on charge les formes
If ChargeTexteForme(param()) Then
oChangeTexteForm.GetControl("ComboBox1").Model.StringItemList=param()
oChangeTexteForm.GetControl("ComboBox3").Model.StringItemList=indice()
SetListIndex(oChangeTexteForm, "ComboBox1", 0)
SetListIndex(oChangeTexteForm, "ComboBox3", 0)
oChangeTexteForm.Execute()
Else
MsgBox1 "Il faut sélectionner une forme avec des textes !"
End If
End Sub
Function ChargeTexteForme(param() as string) as Boolean
Dim unDocument as Object
Dim uneForme as Object
Dim i,j
dim fparam() as string
dim iparam() as string
ChargeTexteForme() = False
on error goto Erreur
unDocument=thisComponent
unGroupe=unDocument.CurrentSelection(0)
if unGroupe.ShapeType = "com.sun.star.drawing.GroupShape" Then
redim fparam(0 to unGroupe.Count-1)
redim iparam(0 to unGroupe.Count-1)
j=0
for i=0 to unGroupe.Count-1
uneForme = unGroupe(i)
if uneForme.ShapeType="com.sun.star.drawing.TextShape" then
uneForme.RotateAngle=0
if uneForme.String<>" " then
fparam(j)=uneForme.String
iparam(j)=i
j=j+1
end if
end if
next i
redim param(0 to j-1)
redim indice(0 to j-1)
for i=0 to j-1
param(i)=fparam(i)
indice(i)=iparam(i)
next i
ChargeTexteForme() = True
Endif
Erreur:
End Function
Private Sub DeplaceUnTexte(uneCommande as String, aPoint As com.sun.star.awt.Point)
Select Case uneCommande
case "CommandButton2"
aPoint.x = aPoint.x - 50
case "CommandButton3"
aPoint.y = aPoint.y - 50
case "CommandButton4"
aPoint.x = aPoint.x + 50
case "CommandButton5"
aPoint.y = aPoint.y + 50
case "CommandButton6"
aPoint.x = aPoint.x - 300
case "CommandButton7"
aPoint.y = aPoint.y - 300
case "CommandButton8"
aPoint.x = aPoint.x + 300
case "CommandButton9"
aPoint.y = aPoint.y + 300
End Select
End Sub
Private Sub ChangeTexteForm_DeplaceObjet(Evenement as Objet)
Dim aPoint As New com.sun.star.awt.Point
Dim i,j
if oChangeTexteForm.Model.CheckBox4.State<>1 then
aPoint = unGroupe(val(indice(GetListIndex(oChangeTexteForm, "ComboBox1")))).Position
DeplaceUnTexte(Evenement.Source.Model.Name, aPoint)
unGroupe(val(indice(GetListIndex(oChangeTexteForm, "ComboBox1")))).Position = aPoint
Else
for i=lbound(indice()) to ubound(indice())
j=indice(i)
aPoint = unGroupe(j).Position
DeplaceUnTexte(Evenement.Source.Model.Name, aPoint)
unGroupe(j).Position = aPoint
Next i
End if
End Sub
Private Sub ChargeTexteForm_CommandButton1()
oChangeTexteForm.EndExecute()
End Sub
Private Sub ChargeTexteForm_CommandButton2()
Dim aPoint As New com.sun.star.awt.Point
Dim unCurseur as Object
Dim i,j
on error resume next
if oChangeTexteForm.Model.CheckBox4.State<>1 then
unCurseur=unGroupe(val(indice(GetListIndex(oChangeTexteForm, "ComboBox1")))).Text.createTextCursor
unCurseur.GotoStart(false)
unCurseur.GotoEnd(true)
unCurseur.CharHeight=val(oChangeTexteForm.Model.TextBox1.Text)
if oChangeTexteForm.Model.CheckBox3.State then
unCurseur.CharUnderLine=com.sun.star.awt.FontUnderline.SINGLE
else
unCurseur.CharUnderLine=com.sun.star.awt.FontUnderline.NONE
end if
if oChangeTexteForm.Model.CheckBox2.State then
unCurseur.CharPosture=com.sun.star.awt.FontSlant.ITALIC
else
unCurseur.CharPosture=com.sun.star.awt.FontSlant.NONE
end if
if oChangeTexteForm.Model.CheckBox1.State then
unCurseur.CharWeight=com.sun.star.awt.FontWeight.BOLD
else
unCurseur.CharWeight=com.sun.star.awt.FontWeight.NORMAL
End if
unCurseur.CharFontName=oChangeTexteForm.Model.ComboBox2.Text
else
for i=lbound(indice()) to ubound(indice())
j=indice(i)
unCurseur=unGroupe(val(j)).Text.createTextCursor
unCurseur.GotoStart(false)
unCurseur.GotoEnd(true)
unCurseur.CharHeight=val(oChangeTexteForm.Model.TextBox1.Text)
if oChangeTexteForm.Model.CheckBox3.State then
unCurseur.CharUnderLine=com.sun.star.awt.FontUnderline.SINGLE
else
unCurseur.CharUnderLine=com.sun.star.awt.FontUnderline.NONE
end if
if oChangeTexteForm.Model.CheckBox2.State then
unCurseur.CharPosture=com.sun.star.awt.FontSlant.ITALIC
else
unCurseur.CharPosture=com.sun.star.awt.FontSlant.NONE
end if
if oChangeTexteForm.Model.CheckBox1.State then
unCurseur.CharWeight=com.sun.star.awt.FontWeight.BOLD
else
unCurseur.CharWeight=com.sun.star.awt.FontWeight.NORMAL
End if
unCurseur.CharFontName=oChangeTexteForm.Model.ComboBox2.Text
next i
end if
if oChangeTexteForm.Model.CheckBox4.State<>1 then
aPoint = unGroupe(val(indice(GetListIndex(oChangeTexteForm, "ComboBox1")))).Position
unGroupe(val(indice(GetListIndex(oChangeTexteForm, "ComboBox1")))).Position = aPoint
Else
for i=lbound(indice()) to ubound(indice())
j=indice(i)
aPoint = unGroupe(j).Position
unGroupe(j).Position = aPoint
Next i
End if
on error goto 0
End Sub
Private Sub ChargeTexteForm_CheckBox1()
ChargeTexteForm_MiseAJourExemple
End Sub
Private Sub ChargeTexteForm_CheckBox2()
ChargeTexteForm_MiseAJourExemple
End Sub
Private Sub ChargeTexteForm_CheckBox3()
ChargeTexteForm_MiseAJourExemple
End Sub
Private Sub ChargeTexteForm_Scroll1()
if oChangeTexteForm.Model.ScrollBar1.ScrollValue<>val(oChangeTexteForm.Model.TextBox1.Text) then
oChangeTexteForm.Model.TextBox1.Text=oChangeTexteForm.Model.ScrollBar1.ScrollValue
ChargeTexteForm_MiseAJourExemple
end if
End Sub
Private Sub ChargeTexteForm_ComboBox1()
dim unCurseur
unCurseur=unGroupe(val(indice(GetListIndex(oChangeTexteForm, "ComboBox1")))).Text.createTextCursor
unCurseur.GotoStart(false)
unCurseur.GotoEnd(true)
oChangeTexteForm.Model.CheckBox1.State=(unCurseur.CharWeight=com.sun.star.awt.FontWeight.BOLD)
oChangeTexteForm.Model.CheckBox2.State=(unCurseur.CharPosture=com.sun.star.awt.FontSlant.ITALIC)
oChangeTexteForm.Model.CheckBox3.State=(unCurseur.CharUnderline=com.sun.star.awt.FontUnderline.SINGLE)
oChangeTexteForm.Model.TextBox1.Text=unCurseur.CharHeight
oChangeTexteForm.Model.ScrollBar1.ScrollValue=unCurseur.CharHeight
oChangeTexteForm.Model.ComboBox2.Text=unCurseur.CharFontName
ChargeTexteForm_MiseAJourExemple
End Sub
Private Sub ChargeTexteForm_ComboBox2()
ChargeTexteForm_MiseAJourExemple
End Sub
Private Sub ChargeTexteForm_TextBox1()
if oChangeTexteForm.Model.ScrollBar1.ScrollValue<>val(oChangeTexteForm.Model.TextBox1.Text) then
oChangeTexteForm.Model.ScrollBar1.ScrollValue = oChangeTexteForm.Model.TextBox1.Text
ChargeTexteForm_MiseAJourExemple
End if
End Sub
Private Sub ChargeTexteForm_MiseAJourExemple()
oChangeTexteForm.Model.Label1.FontHeight=val(oChangeTexteForm.Model.TextBox1.Text)
if oChangeTexteForm.Model.CheckBox3.State then
oChangeTexteForm.Model.Label1.FontUnderLine=com.sun.star.awt.FontUnderline.SINGLE
else
oChangeTexteForm.Model.Label1.FontUnderLine=com.sun.star.awt.FontUnderline.NONE
end if
if oChangeTexteForm.Model.CheckBox2.State then
oChangeTexteForm.Model.Label1.FontSlant=com.sun.star.awt.FontSlant.ITALIC
else
oChangeTexteForm.Model.Label1.FontSlant=com.sun.star.awt.FontSlant.NONE
end if
if oChangeTexteForm.Model.CheckBox1.State then
oChangeTexteForm.Model.Label1.FontWeight=com.sun.star.awt.FontWeight.BOLD
else
oChangeTexteForm.Model.Label1.FontWeight=com.sun.star.awt.FontWeight.NORMAL
End if
oChangeTexteForm.Model.Label1.FontName=oChangeTexteForm.Model.ComboBox2.Text
ChargeTexteForm_CommandButton2
End Sub
Sub ChargeNomPolice(fparam() as string)
Dim i,j,k
Dim oToolkit as Object
Dim oDevice as Variant
Dim oFontDescriptors As Variant
Dim param() as String
oToolkit = CreateUnoService("com.sun.star.awt.Toolkit")
oDevice = oToolkit.createScreenCompatibleDevice(0, 0)
oFontDescriptors = oDevice.FontDescriptors
Redim param(lbound(oFontDescriptors) to UBound(oFontDescriptors)) as string
thiscomponent.lockcontrollers
dim trouve as Boolean
k=0
for i= LBound(oFontDescriptors) to UBound(oFontDescriptors)
trouve=False
for j=0 to k-1
if param(j)=oFontDescriptors(i).Name then trouve=True
next j
if not trouve then
param(k)=oFontDescriptors(i).Name
k=k+1
end if
next i
thiscomponent.unlockcontrollers
redim fparam(0 to k-1)
for i=0 to k-1
fparam(i)=param(i)
next i
do
trouve=false
for i=0 to k-2
if fparam(i)>fparam(i+1) then
Echange(fparam(i), fparam(i+1))
trouve=True
end if
next i
loop while(trouve)
End Sub
</script:module>
|