This file is indexed.

/usr/lib/libreoffice/share/extensions/DmathsAddon/BatchConv/Module1.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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
<?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="Module1" script:language="StarBasic">&apos;************************************************
&apos;Copyright (C) 2003 Laurent Godard
&apos;oooconv@free.fr 

&apos;This library is free software; you can redistribute it and/or
&apos;modify it under the terms of the GNU Lesser General Public
&apos;License as published by the Free Software Foundation; either
&apos;version 2.1 of the License, or (at your option) any later version.

&apos;This library is distributed in the hope that it will be useful,
&apos;but WITHOUT ANY WARRANTY; without even the implied warranty of
&apos;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
&apos;Lesser General Public License for more details.

&apos;You should have received a copy of the GNU Lesser General Public
&apos;License along with this library; if not, write to the Free Software
&apos;Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
&apos;************************************************

&apos; --------------------------
&apos; modifié le 20/04/2004 par Cédric Durmont (durmont@yahoo.fr)
&apos; --------------------------
&apos; Ajout de la fonctionnalité : &quot;ajout d&apos;un dossier&quot;
&apos; Procédures et fonctions ajoutées :
&apos;	- ajouteDossier : equivalent de AjouteFichier, mais qui appelle GetFileNamesFromDir plutôt que GetFileNames
&apos;	- GetFileNamesFromDir : Equivalent de GetFileNames mais affichant un dialogue &quot;choix de dossier&quot;
&apos;	- GetFilesFromDir : obtient à partir d&apos;un nom de dossier un tableau des fichiers bureautiques 
&apos;			contenus (dans le dossier ou un sous dossier quelconque)
&apos;	- FormatSupporte : teste si un nom de fichier désigne un fichier bureautique. Le test porte sur l&apos;extension (.xxx)
&apos;			La liste des extensions est &quot;en dur&quot; pour le moment. Renvoie true dans le cas d&apos;un fichier bureautique, false sinon
&apos; --------------------------

Option Explicit
dim Feuille as object, oDlg as object
dim CodeExten(1 to 16) as string
dim traduction(0 to 20) as string


Sub Main
dim button as object, file2 as object
dim pgb as object, ListeExt as object, Liste as object

Call VerifOperationnel
DialogLibraries.loadLibrary(&quot;BatchConv&quot;)
BasicLibraries.loadLibrary(&quot;Dmaths&quot;)
Feuille=DialogLibraries.BatchConv.Convert
oDlg=CreateUnoDialog(Feuille )

&apos;Initialisation
	button=odlg.GetControl(&quot;CommandButton6&quot;)
	file2=odlg.GetControl(&quot;File2&quot;)
	pgb=odlg.GetControl(&quot;pgb&quot;)
	button.visible=false
	file2.visible=false
	pgb.visible=false
	
	Rem SelectedLangNumber est le numéro de la langue chargée
	Liste=odlg.GetControl(&quot;LstLangue&quot;)
	If SelectLangNumber &lt;=2 Then Liste.selectitempos(SelectLangNumber,true) Else Liste.selectitempos(1,true)
	call TraduireFeuille()
	
ListeExt=oDlg.GetControl(&quot;LstExp&quot;)	
Call RempliListeExport(ListeExt)

oDlg.execute

End Sub

Sub Fin()
&apos;Ferme la fenêtre
	odlg.endExecute
end sub

Sub MontreFichier()
	on error resume next
	dim args()
	dim oDesktop as object, oDocument as object	
	dim surl as string
	dim Liste as object
	  
	oDesktop=createUnoService(&quot;com.sun.star.frame.Desktop&quot;)

	Liste=odlg.GetControl(&quot;Liste1&quot;)
	sUrl=ConvertToURL(Liste.GetSelectedItem)

	oDocument=oDesktop.loadComponentFromURL(surl,&quot;_blank&quot;,0,args())

end sub

sub AjouteFichier()
	dim File1 as object, nomFichier as string
	dim Liste as object
	dim lesFichiers()
	dim i as long
	dim RepBase as string
	dim nb as Long
	
	Liste=odlg.GetControl(&quot;Liste1&quot;)
	GetFileNames(lesFichiers)

	if lbound(lesfichiers)&lt;=ubound(lesfichiers) then &apos; ce test est faux si l&apos;utilisateur n&apos;a pas choisi de fichier
		if lbound(lesfichiers)=ubound(lesfichiers) then
			&apos;only one file - path included
			Liste.additem(ConvertFromUrl(LesFichiers(lbound(lesfichiers))), liste.GetItemCount)
			nb=(ubound(lesfichiers)-lbound(lesfichiers))+1
		else
			RepBase=lesfichiers(lbound(lesfichiers))
			for i=lbound(lesfichiers)+1 to ubound(lesfichiers)
				Liste.additem(ConvertFromUrl(repBase+&quot;/&quot;+LesFichiers(i)), liste.GetItemCount)
			next i
			nb=(ubound(lesfichiers)-lbound(lesfichiers))	&apos; un de moins pour ne pas compter la ligne qui contenait le nom du dossier
		endif
		MsgBox nb &amp; traduction(15),64,traduction(16)
	endif
end sub
&apos; --------------------------------
&apos; --		AjouteDossier		--
&apos; --------------------------------
sub AjouteDossier()
	dim File1 as object, nomFichier as string
	dim Liste as object
	dim lesFichiers()
	dim i as long
	dim RepBase as string
	dim nb as long
	
	Liste=odlg.GetControl(&quot;Liste1&quot;)
	GetFileNamesFromDir(lesFichiers)
	if lbound(lesfichiers)&lt;=ubound(lesfichiers) then &apos; ce test est faux si l&apos;utilisateur n&apos;a pas choisi de fichier
		RepBase=lesfichiers(lbound(lesfichiers))
		for i=lbound(lesfichiers) to ubound(lesfichiers)
			Liste.additem(LesFichiers(i), liste.GetItemCount)
		next i
		nb=(ubound(lesfichiers)-lbound(lesfichiers)+1)
		MsgBox nb &amp; traduction(15),64,traduction(16)
	endif
end sub
&apos; --------------------------------


sub EnleveFichier()
dim position as long
dim Liste as object
	Liste=odlg.GetControl(&quot;Liste1&quot;)
	position=Liste.GetSelectedItemPos()
	Liste.removeitems(position,1)
end sub

Sub AfficheChoixRep()
	dim status as boolean
	dim bouton as object, file2 as object, radio as object
	radio=odlg.GetControl(&quot;Radio1&quot;)
	bouton=odlg.GetControl(&quot;CommandButton6&quot;)
	file2=odlg.GetControl(&quot;File2&quot;)
	status=(radio.state=0)
	bouton.visible=status
	file2.visible=status
end sub

sub ChoisirRep()
	odlg.getControl(&quot;File2&quot;).text=GetFolderName()
end sub

sub Exporter

on error resume Next

dim Liste as object, LstExp as object, File2 as object
dim radio as object, pgb as object
dim Titre as string, ListeFichiers() as string, export as string
dim NomRep as string, NbFichiers as long
dim Erreur as boolean, nouveauRep as boolean 
dim NomFichier as string
dim i as long, j as long
dim IsGraphic as boolean


&apos;Declaration paor l&apos;export proprement dit
	dim args()
	dim oDesktop as object, oDocument as object	
	dim surl as string, ExtDest as string
	dim args2(0) as new com.sun.star.beans.PropertyValue
	dim args3(1) as new com.sun.star.beans.PropertyValue
	dim oPages as object, oGraphic as object
	
Titre=traduction(0)

&apos;Contrôle de la saisie des paramètres	
	Liste=odlg.GetControl(&quot;Liste1&quot;)
	if Liste.getitemcount=0 then
		msgbox traduction(10),16,Titre
		erreur=true
	endif
	LstExp=odlg.GetControl(&quot;LstExp&quot;)
	export=ucase(trim(LstExp.getSelectedItem))
	if export=&quot;&quot; then
		msgbox traduction(11),16,Titre
		erreur=true
	endif
	NouveauRep=false
	radio=odlg.GetControl(&quot;Radio2&quot;)
	if radio.state&lt;&gt;0 then
		NouveauRep=true	
		file2=odlg.GetControl(&quot;File2&quot;)
		NomRep=file2.text
		if NomRep=&quot;&quot; then
			msgbox traduction(12),16,Titre
			erreur=true
		endif
	endif
	
if erreur then exit sub
	
&apos;récupere la liste des fichiers
ListeFichiers=Liste.getItems()
NbFichiers=ubound(ListeFichiers)

&apos;progress bar
pgb=odlg.GetControl(&quot;pgb&quot;)
call pgb.setrange(0,NbFichiers+1)
pgb.visible=true

&apos;Position Export
export=CodeExten(LstExp.getSelectedItemPos()+1)

&apos;Boucle sur l&apos;export	

for i=0 to NbFichiers
	
	call pgb.setvalue(i+1)
	
	if NouveauRep then
		NomRep=iif(right(Nomrep,1)=&quot;/&quot;,NomRep,NomRep+&quot;/&quot;)
		NomFichier=NomRep+dir(ListeFichiers(i))
	else
		NomFichier=ListeFichiers(i)
	endif
		  
	oDesktop=createUnoService(&quot;com.sun.star.frame.Desktop&quot;)
	sURL=ConvertToURL(ListeFichiers(i))
	oDocument=oDesktop.loadComponentFromURL(surl,&quot;_blank&quot;,0,args())

	args2(0).Name = &quot;FilterName&quot;
	args2(0).Value = TrouveFilterName(oDocument,export,ExtDest,IsGraphic)

	if args2(0).Value&lt;&gt;&quot;&quot; then
		if not IsGraphic then
			NomFichier=ConvertToURL(NomFichier+ExtDest)
			odocument.storeToURL(NomFichier,args2())
		else		
			oGraphic=CreateUnoService(&quot;com.sun.star.drawing.GraphicExportFilter&quot;)
			for j=0 to odocument.drawpages.getcount()-1
				opage=odocument.drawPages(j)
				ographic.setSourceDocument(opage)
				args3(0).Name = &quot;URL&quot;
				args3(0).Value =ConvertToURL(NomFichier+&quot;-&quot;+opage.name+ ExtDest) 
				args3(1).Name = &quot;MediaType&quot;
				args3(1).Value = args2(0).Value
				oGraphic.filter(args3())
			next j		
		endif
	endif

oDocument.dispose()

next i

call pgb.setvalue(NbFichiers+1)	
pgb.visible=false
	
end sub

Function TrouveFilterName(oDoc as object, typedoc as string,ExtDest as string, IsGraphic as boolean) as string

Dim FilterName as string

FilterName=&quot;&quot;
IsGraphic=false

if oDoc.SupportsService(&quot;com.sun.star.text.TextDocument&quot;) then
&apos;Writer

			select case typedoc
				case &quot;PDF&quot;:
					  FilterName=&quot;writer_pdf_Export&quot;
					  ExtDESt=&quot;.pdf&quot;
				case &quot;OOO&quot;:
					  FilterName=&quot;StarOffice XML (Writer)&quot;
					  ExtDESt=&quot;.odt&quot;			
				case &quot;MSXP&quot;:
					  FilterName=&quot;MS Word 97&quot;
					  ExtDESt=&quot;.doc&quot;
				case &quot;MS95&quot;:
					  FilterName=&quot;MS Word 95&quot;
					  ExtDESt=&quot;.doc&quot;
				case &quot;MS60&quot;:
					  FilterName=&quot;MS WinWord 6.0&quot;
					  ExtDESt=&quot;.doc&quot;					
				case &quot;RTF&quot;:
					  FilterName=&quot;Rich Text Format&quot;
					  ExtDESt=&quot;.rtf&quot;
				case &quot;HTML&quot;:
					  FilterName=&quot;HTML (StarWriter)&quot;
					  ExtDESt=&quot;.html&quot;
				case &quot;XHTML&quot;:
					  FilterName=&quot;XHTML plus MathML File&quot;
					  ExtDESt=&quot;.xhtml&quot;
				case &quot;TEX&quot;:
					  FilterName=&quot;Latex File&quot;
					  ExtDESt=&quot;.tex&quot;
				case &quot;TXT&quot;:
					  FilterName=&quot;Text&quot;
					  ExtDESt=&quot;.txt&quot;		
			end select		
TrouveFilterName=FilterName
Exit Function
endif

if oDoc.SupportsService(&quot;com.sun.star.sheet.SpreadsheetDocument&quot;) then
&apos;Calc
			select case typedoc
				case &quot;PDF&quot;:
					  FilterName=&quot;calc_pdf_Export&quot;
					  ExtDESt=&quot;.pdf&quot;
				case &quot;OOO&quot;:
					  FilterName=&quot;StarOffice XML (Calc)&quot;
					  ExtDESt=&quot;.ods&quot;	
				case &quot;MSXP&quot;:
					  FilterName=&quot;MS Excel 97&quot;
					  ExtDESt=&quot;.xls&quot;
				case &quot;MS95&quot;:
					  FilterName=&quot;MS Excel 95&quot;
					  ExtDESt=&quot;.xls&quot;
				case &quot;MS50&quot;:
					  FilterName=&quot;MS Excel 5.0/95&quot;
					  ExtDESt=&quot;.xls&quot;
				case &quot;HTML&quot;:
					  FilterName=&quot;HTML (StarCalc)&quot;
					  ExtDESt=&quot;.html&quot;	
				case &quot;TXT&quot;:
					  FilterName=&quot;Text&quot;
					  ExtDESt=&quot;.txt&quot;								
			end select
TrouveFilterName=FilterName
Exit Function
endif

&apos;if oDoc.SupportsService(&quot;com.sun.star.text.WebDocument&quot;) then
&apos;Web
&apos;Exit Function
&apos;endif

if oDoc.SupportsService(&quot;com.sun.star.presentation.PresentationDocument&quot;) then
&apos;Impress

			select case typedoc
				case &quot;PDF&quot;:
					  FilterName=&quot;impress_pdf_Export&quot;
					  ExtDESt=&quot;.pdf&quot;	
				case &quot;OOO&quot;:
					  FilterName=&quot;StarOffice XML (Impress)&quot;
					  ExtDESt=&quot;.odp&quot;				
				case &quot;MSXP&quot;:
					  FilterName=&quot;MS Powerpoint 97&quot;
					  ExtDESt=&quot;.ppt&quot;	
				case &quot;JPG&quot;:
					  FilterName=&quot;image/jpeg&quot;
					  ExtDESt=&quot;.jpg&quot;		
					  IsGraphic=true
				case &quot;PNG&quot;:
					  FilterName=&quot;image/png&quot;
					  ExtDESt=&quot;.png&quot;
					  IsGraphic=true
				case &quot;TIFF&quot;:
					  FilterName=&quot;image/tiff&quot;
					  ExtDESt=&quot;.tif&quot;
					  IsGraphic=true
				case &quot;SVG&quot;:
					  FilterName=&quot;image/svg+xml&quot;
					  ExtDESt=&quot;.svg&quot;
					  IsGraphic=true
				case &quot;EPS&quot;:
					  FilterName=&quot;application/postscript&quot;
					  ExtDESt=&quot;.eps&quot;
					  IsGraphic=true
				case &quot;SWF&quot;:
					  FilterName=&quot;impress_flash_Export&quot;
					  ExtDESt=&quot;.swf&quot;	
				case &quot;HTML&quot;:
					  FilterName=&quot;impress_html_Export&quot;
					  ExtDESt=&quot;.html&quot;							
			end select
TrouveFilterName=FilterName
Exit Function
endif

if oDoc.SupportsService(&quot;com.sun.star.drawing.DrawingDocument&quot;) then
&apos;Draw
			select case typedoc
				case &quot;PDF&quot;:
					  FilterName=&quot;draw_pdf_Export&quot;
					  ExtDESt=&quot;.pdf&quot;
				case &quot;OOO&quot;:
					  FilterName=&quot;StarOffice XML (Draw)&quot;
					  ExtDESt=&quot;.odg&quot;					
				case &quot;JPG&quot;:
					  FilterName=&quot;image/jpeg&quot;
					  ExtDESt=&quot;.jpg&quot;
					  IsGraphic=true
				case &quot;PNG&quot;:
					  FilterName=&quot;image/png&quot;
					  ExtDESt=&quot;.png&quot;
					  IsGraphic=true
				case &quot;TIFF&quot;:
					  FilterName=&quot;image/tiff&quot;
					  ExtDESt=&quot;.tif&quot;
					  IsGraphic=true
				case &quot;SVG&quot;:
					  FilterName=&quot;image/svg+xml&quot;
					  ExtDESt=&quot;.svg&quot;
					  IsGraphic=true
				case &quot;EPS&quot;:
					  FilterName=&quot;application/postscript&quot;
					  ExtDESt=&quot;.eps&quot;
					  IsGraphic=true
				case &quot;SWF&quot;:
					  FilterName=&quot;draw_flash_Export&quot;
					  ExtDESt=&quot;.swf&quot;	
				case &quot;HTML&quot;:
					  FilterName=&quot;draw_html_Export&quot;
					  ExtDESt=&quot;.swf&quot;										
			end select
TrouveFilterName=FilterName
Exit Function
endif

end function

sub RempliListeExport(oListe as object)

Dim i as long, j as long

&apos;Nettoyage de la liste
while oListe.getItemCount &gt; 0
	oListe.removeitems(oListe.getItemCount-1,1)
wend

&apos;Definition Tableau
Dim Libelle(16) as string
i=0
if clng(getSolarVersion) &gt;= 644 then
	i=i+1:Libelle(i)=&quot;PDF&quot;:CodeExten(i)=&quot;PDF&quot;
endif
i=i+1:Libelle(i)=&quot;OpenOffice&quot;:CodeExten(i)=&quot;OOO&quot;
i=i+1:Libelle(i)=&quot;Microsoft Office 97/2000/XP&quot;:CodeExten(i)=&quot;MSXP&quot;
if clng(getSolarVersion) &gt;= 644 then
	i=i+1:Libelle(i)=&quot;Flash&quot;:CodeExten(i)=&quot;SWF&quot;
endif
i=i+1:Libelle(i)=&quot;HTML&quot;:CodeExten(i)=&quot;HTML&quot;
i=i+1:Libelle(i)=&quot;Fichier Texte&quot;:CodeExten(i)=&quot;TXT&quot;
i=i+1:Libelle(i)=&quot;RTF&quot;:CodeExten(i)=&quot;RTF&quot;
i=i+1:Libelle(i)=&quot;Image JPG&quot;:CodeExten(i)=&quot;JPG&quot;
i=i+1:Libelle(i)=&quot;Image PNG&quot;:CodeExten(i)=&quot;PNG&quot;
i=i+1:Libelle(i)=&quot;Image TIFF&quot;:CodeExten(i)=&quot;TIF&quot;
i=i+1:Libelle(i)=&quot;Image SVG&quot;:CodeExten(i)=&quot;SVG&quot;
i=i+1:Libelle(i)=&quot;Image EPS&quot;:CodeExten(i)=&quot;EPS&quot;
i=i+1:Libelle(i)=&quot;Microsoft Word 95&quot;:CodeExten(i)=&quot;MS95&quot;
i=i+1:Libelle(i)=&quot;Microsoft Winword 6.0&quot;:CodeExten(i)=&quot;MS60&quot;
i=i+1:Libelle(i)=&quot;Microsoft Excel 95&quot;:CodeExten(i)=&quot;MS95&quot;
i=i+1:Libelle(i)=&quot;Microsoft Excel 5.0&quot;:CodeExten(i)=&quot;MS50&quot;
&apos;Necessite AddOn
&apos;i=i+1:Libelle(i)=&quot;XHTML&quot;
&apos;i=i+1:Libelle(i)=&quot;LaTex 2e&quot;

&apos;Remplissage
for j=1 to i
	oListe.additem(Libelle(j),j-1)
next j

end Sub

Sub TraduireFeuille()

dim NumLangue as long
dim objet as object

&apos;Récupère la langue
	objet=odlg.GetControl(&quot;LstLangue&quot;)
	NumLangue=objet.GetSelectedItemPos()
&apos;Construit le tableau suivant la langue
select Case NumLangue

	case 0: &apos;Français
		traduction(0)=&quot;Dmaths : BatchConv&quot;
		traduction(1)=&quot;Choisir un fichier&quot;
		traduction(2)=&quot;Prévisualiser&quot;
		traduction(3)=&quot;Ajouter des fichiers&quot;
		traduction(4)=&quot;Exporter vers&quot;
		traduction(5)=&quot;Chaque Fichier dans son répertoire d&apos;origine&quot;
		traduction(6)=&quot;Tous les fichiers dans le même répertoire&quot;
		traduction(7)=&quot;Sélectionner un fichier dans le répertoire désiré&quot;
		traduction(8)=&quot;Annuler&quot;
		traduction(9)=&quot;Transformer&quot;
		traduction(10)=&quot;Liste Vide&quot;
		traduction(11)=&quot;Choisir un format d&apos;export&quot;
		traduction(12)=&quot;Saisir un répertoire de destination&quot;
		traduction(13)=&quot;Langue&quot;
		traduction(14)=&quot;Ajouter un dossier&quot;
		traduction(15)=&quot; Documents ont été ajoutés pour conversion.&quot;
		traduction(16)=&quot;Recherche des fichiers terminée&quot;
		traduction(17)=&quot;Ne pas inclure les sous-dossiers du dossier sélectionné&quot;
		
	case 2: &apos;Deutsch
		traduction(0)=&quot;Dmaths : BatchConv&quot;
		traduction(1)=&quot;Wahl der Datei&quot;
		traduction(2)=&quot;Vorschau&quot;
		traduction(3)=&quot;Datei hinzufügen&quot;
		traduction(4)=&quot;Export-Format&quot;
		traduction(5)=&quot;Jede Datei in ihrem Original-Verzeichnis&quot;
		traduction(6)=&quot;Alle Dateien im selben Verzeichnis&quot;
		traduction(7)=&quot;Wählen Sie eine Datei im gewünschten Verzeichnis aus&quot;
		traduction(8)=&quot;Abbruch&quot;
		traduction(9)=&quot;Start der Umwandlung&quot;
		traduction(10)=&quot;Die Liste ist leer!&quot;
		traduction(11)=&quot;Wählen Sie ein Export-Format !&quot;
		traduction(12)=&quot;Bestimmen Sie ein Zielverzeichnis&quot;
		traduction(13)=&quot;Sprache&quot;
		traduction(14)=&quot;Verzeichnis hinzufügen&quot;
		traduction(15)=&quot; Dokument(e) für die Umwandlung hinzugefügt.&quot;
		traduction(16)=&quot;Dateiuntersuchung beendet&quot;
		traduction(17)=&quot;Unterverzeichnisse des gewählten Verzeichnisses nicht einchließen&quot;
		traduction(18)=&quot;Textdatei&quot; &apos;fichier texte
		traduction(19)=&quot;Bild&quot;      &apos;... image
		

	case 3:
	&apos;Thanks to Arturo Garro - Costa Rica
  		traduction(0)=&quot;Dmaths : BatchConv&quot;
 	 	traduction(1)=&quot;Escoger un archivo&quot;
  		traduction(2)=&quot;Vista previa&quot;
  		traduction(3)=&quot;Agragar archivo a la lista&quot;
  		traduction(4)=&quot;Exportar a&quot;
  		traduction(5)=&quot;Cada archivo convertido en el directorio fuente&quot;
  		traduction(6)=&quot;Todos los archivos convertidos en el mismo directorio&quot;
  		traduction(7)=&quot;Seleccione un archivo en el directorio destino&quot;
  		traduction(8)=&quot;Cancelar&quot;
  		traduction(9)=&quot;Lista de exportación&quot;
  		traduction(10)=&quot;Lista vacía&quot;
  		traduction(11)=&quot;Escoja un formato de exportación&quot;
  		traduction(12)=&quot;Escoja un directorio destino&quot;
  		traduction(13)=&quot;Lenguaje&quot;
		traduction(14)=&quot;Agragar directorio&quot;
  	case 4:		
  		traduction(0)=&quot;Dmaths : BatchConv&quot;
		traduction(1)=&quot;Pasirink bylą&quot;
		traduction(2)=&quot;Peržiūra&quot;
		traduction(3)=&quot;Pridėti šią bylą į sąrašą&quot;
		traduction(4)=&quot;Konvertuoti į&quot;
		traduction(5)=&quot;Each converted file in the source directory&quot;
		traduction(6)=&quot;All converted files in the same directory&quot;
		traduction(7)=&quot;Pasirinkite bylą paskirties kataloge&quot;
		traduction(8)=&quot;Atsisakyti&quot;
		traduction(9)=&quot;Konvertuoti dokumentus&quot;
		traduction(10)=&quot;Tuščias sąrašas&quot;
		traduction(11)=&quot;Pasirinkite į kokį formatą konvertuosite&quot;
		traduction(12)=&quot;Nurodykite paskirties katalogą&quot;
		traduction(13)=&quot;Kalba&quot;
		traduction(14)=&quot;Add a directory&quot;
		
	case else: &apos;Anglais
		traduction(0)=&quot;Dmaths : BatchConv&quot;
		traduction(1)=&quot;Choose a file&quot;
		traduction(2)=&quot;Preview&quot;
		traduction(3)=&quot;Add files to the list&quot;
		traduction(4)=&quot;Export to&quot;
		traduction(5)=&quot;Each converted file in the source directory&quot;
		traduction(6)=&quot;All converted files in the same directory&quot;
		traduction(7)=&quot;Select a file in the target directory&quot;
		traduction(8)=&quot;Cancel&quot;
		traduction(9)=&quot;Export List&quot;
		traduction(10)=&quot;Empty List&quot;
		traduction(11)=&quot;Choose an export format&quot;
		traduction(12)=&quot;Choose a target directory&quot;
		traduction(13)=&quot;Language&quot;
		traduction(14)=&quot;Add a directory&quot;
		traduction(15)=&quot; Files were added to the list.&quot;
		traduction(16)=&quot;File search complete&quot;
		traduction(17)=&quot;Do not include the subfolders of the selected folder&quot;

end select

&apos;Rafraichi la boite de dialogue
odlg.title=traduction(0)
objet=odlg.GetControl(&quot;Label4&quot;):objet.text=traduction(13)
&apos;objet=odlg.GetControl(&quot;Label1&quot;):objet.text=traduction(1)
objet=odlg.GetControl(&quot;CommandButton5&quot;):objet.label=traduction(2)
objet=odlg.GetControl(&quot;CommandButton4&quot;):objet.label=traduction(3)
objet=odlg.GetControl(&quot;Label2&quot;):objet.text=traduction(4)
objet=odlg.GetControl(&quot;Radio1&quot;):objet.label=traduction(5)
objet=odlg.GetControl(&quot;Radio2&quot;):objet.label=traduction(6)
objet=odlg.GetControl(&quot;CommandButton6&quot;):objet.label=traduction(12)
objet=odlg.GetControl(&quot;CommandButton3&quot;):objet.label=traduction(8)
objet=odlg.GetControl(&quot;CommandButton1&quot;):objet.label=traduction(9)
&apos; ajouté par Cédric Durmont 
objet=odlg.GetControl(&quot;CommandButton7&quot;):objet.label=traduction(14)
&apos; ajouté par Didier Dorange-Pattoret
objet=odlg.GetControl(&quot;CheckBox1&quot;):objet.label=traduction(17)

end sub

&apos; --------------------------------
Function GetFileNames(lesFichiers()) as variant
&apos; --------------------------------
Dim oFileDialog as Object
Dim iAccept as Integer
Dim sPath as String
Dim InitPath as String
Dim RefControlName as String
Dim oUcb as object

on error resume next

&apos;Dim ListAny(0)
	&apos;Note: The following services have to be called in the following order
	&apos; because otherwise Basic does not remove the FileDialog Service
	oFileDialog = CreateUnoService(&quot;com.sun.star.ui.dialogs.FilePicker&quot;)
	oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
	&apos;ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE
	&apos;oFileDialog.initialize(ListAny())
	&apos;AddFiltersToDialog(FilterNames(), oFileDialog)
	&apos;InitPath = ConvertToUrl(oRefModel.Text)
	&apos;If InitPath = &quot;&quot; Then
	InitPath = GetPathSettings(&quot;Work&quot;)
	&apos;End If
	If oUcb.Exists(InitPath) Then
		oFileDialog.SetDisplayDirectory(InitPath)
	End If
	oFileDialog.setMultiSelectionMode(true)
	iAccept = oFileDialog.Execute()
	If iAccept = 1 Then
		LesFichiers=oFileDialog.files()
	End If
	oFileDialog.Dispose()
End function

&apos; --------------------------------
&apos;	Affiche le dialogue de sélection de dossier et récupère la liste des fichiers bureautique
&apos; --------------------------------
Function GetFileNamesFromDir(lesFichiers()) as variant
Dim oFolderDialog as Object
Dim iAccept as Integer
Dim sPath as String
Dim InitPath as String
Dim RefControlName as String
Dim oUcb as object

on error resume next

	&apos;Note: The following services have to be called in the following order
	&apos; because otherwise Basic does not remove the FileDialog Service
	oFolderDialog = CreateUnoService(&quot;com.sun.star.ui.dialogs.FolderPicker&quot;)
	oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)

		InitPath = GetPathSettings(&quot;Work&quot;)

	If oUcb.Exists(InitPath) Then
		oFolderDialog.SetDisplayDirectory(InitPath)
	End If
	iAccept = oFolderDialog.Execute()
	If iAccept = 1 Then
		sPath = oFolderDialog.GetDirectory()
		LesFichiers = getFilesFromDir(sPath)
		&apos;If oUcb.Exists(sPath) Then
		&apos;	GetFolderName = ConvertFromUrl(sPath)
		&apos;End If
	End If
End function
&apos; --------------------------------
&apos; Retourne une liste des fichiers bureautique contenus dans myDir (fonction pseudo-récursive)
&apos; --------------------------------
function getFilesFromDir(myDir as String) as variant
	dim fileList(0) as String		&apos; ma liste des fichiers
	dim dirList(0) as String		&apos; liste des dossiers à explorer
	dim fileNb as Long				&apos; nombre de fichiers
	dim dirNb as Long				&apos; nombre de dossiers
	dim currentDir as String			&apos; dossier courant
	dim currentDir1 as String			&apos; masque de recherche courant (=dossier courant + &quot;\*&quot;)
	dim myDir1 as String
	dim fic as String
	dim fini as Boolean
	
	fileNb=0
	dirNb=0

	myDir1= ConvertFromUrl(myDir)
	currentDir=myDir1
	fini=False
	do
		currentDir1=currentDir+getPathSeparator()+&quot;*&quot;
		&apos; liste tous les éléments de currentDir (fichiers)
		fic = Dir$(currentDir1,0+2+4)
		while fic &gt; &quot;&quot;
			&apos; 	met les fichiers dans le tableau fileList()
			if (formatSupporte(fic)) then	&apos; ce fichier est-il un fichier bureautique ?
				fileList(fileNb)=currentDir + getPathSeparator() + fic
				fileNb=fileNb+1
				ReDim Preserve fileList(fileNb) as String		&apos; augmente la taille du tableau pour l&apos;élément suivant
			end if
			fic = Dir$
		wend
		&apos; liste tous les éléments de currentDir (dossiers)
		If odlg.GetControl(&quot;CheckBox1&quot;).State = 0  Then &apos; si on inclut les sous-dossiers du dossier sélectionné. 
			fic = Dir$(currentDir1,16)
			while fic &gt; &quot;&quot;
				if (fic &lt;&gt; &quot;.&quot; and fic &lt;&gt; &quot;..&quot;) then
					&apos; met les dossiers (sauf . et ..)  dans le tableau dirList()
					dirList(dirNb)=currentDir + getPathSeparator() + fic
					dirNb=dirNb+1
					ReDim Preserve dirList(dirNb) as String		&apos; augmente la taille du tableau pour l&apos;élément suivant
				end if
				fic = Dir$
			wend		
			&apos; si dirList() est non vide, retire un élément de dirList() et le met dans currentDir
		Endif
			if dirNb&gt;0 then
				dirNb=dirNb-1
				currentDir=dirList(dirNb)
			else
				fini = True
			end if
		
	&apos; sinon sort du do...loop
	loop until fini
	ReDim Preserve fileList(fileNb-1) as String	&apos; j&apos;ajuste la taille du tableau
	getFilesFromDir = fileList()
end function
&apos;----------------------------------------
&apos;--		teste si nomFic est un fichier bureautique
&apos;----------------------------------------
function formatSupporte(nomFic) as Boolean
	dim i as Integer
	dim ext(8) as String
	dim retour as Boolean
	ext(0)=&quot;.doc&quot;
	ext(1)=&quot;.xls&quot;
	ext(2)=&quot;.ppt&quot;
	ext(3)=&quot;.sxw&quot;
	ext(4)=&quot;.sxc&quot;
	ext(5)=&quot;.sxi&quot;
	ext(6)=&quot;.sxg&quot;
	ext(7)=&quot;.rtf&quot;
	ext(8)=&quot;.csv&quot;
	&apos; etc, etc...
	retour=false
	for i=0 to 8 
		if (Right(Lcase(nomFic),4)= ext(i)) then
			retour=true
		end if
	next
	formatSupporte=retour
end function

function GetFolderName() as string
Dim oFolderDialog as Object
Dim iAccept as Integer
Dim sPath as String
Dim InitPath as String
Dim RefControlName as String
Dim oUcb as object

on error resume next

	&apos;Note: The following services have to be called in the following order
	&apos; because otherwise Basic does not remove the FileDialog Service
	oFolderDialog = CreateUnoService(&quot;com.sun.star.ui.dialogs.FolderPicker&quot;)
	oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)

		InitPath = GetPathSettings(&quot;Work&quot;)

	If oUcb.Exists(InitPath) Then
		oFolderDialog.SetDisplayDirectory(InitPath)
	End If
	iAccept = oFolderDialog.Execute()
	If iAccept = 1 Then
		sPath = oFolderDialog.GetDirectory()
		If oUcb.Exists(sPath) Then
			GetFolderName = ConvertFromUrl(sPath)
		End If
	End If
End function

Function GetPathSettings(sPathType as String,  Optional bshowall as Boolean, Optional ListIndex as integer) as String
Dim oSettings, oPathSettings as Object
Dim sPath as String
Dim PathList() as String
Dim MaxIndex as Integer
Dim oUcb as Object
	oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
	oSettings = createUnoService(&quot;com.sun.star.frame.Settings&quot;)
	oPathSettings = oSettings.getByName(&quot;PathSettings&quot;)
  	If Not IsMissing(bShowall) Then
		If bShowAll Then
			ShowPropertyValues(oPathSettings)
			Exit Function
		End If
	End If
 	sPath = oPathSettings.GetPropertyValue(sPathType)
	If Not IsMissing(ListIndex) Then
		&apos; Share and User-Directory
		If Instr(1,sPath,&quot;;&quot;) &lt;&gt; 0 Then
			PathList = ArrayoutofString(sPath,&quot;;&quot;, MaxIndex)
			If ListIndex &lt;= MaxIndex Then
				sPath = PathList(ListIndex)
			Else
				Msgbox(&quot;String Cannot be analyzed!&quot; &amp; sPath , 16, GetProductName())
			End If
		End If
	End If
	If Instr(1, sPath, &quot;;&quot;) = 0 Then
		GetPathSettings = ConvertToUrl(sPath)
	Else
		GetPathSettings = sPath
	End If

End Function


Function SelectLangNumber as Integer
Dim iLangNumber as integer
Dim  oPathSubstSrv as Object
Dim sLangPath as String
If Globalscope.BasicLibraries.HasByName(&quot;Dmaths&quot;) Then
	Globalscope.BasicLibraries.loadLibrary(&quot;Dmaths&quot;)
	If iLang &lt;=2 Then iLangNumber=iLang Else iLangNumber = 1
Else
	  oPathSubstSrv = createUnoService(&quot;com.sun.star.comp.framework.PathSubstitution&quot;)
	  sLangPath = ConvertFromUrl(oPathSubstSrv.getSubstituteVariableValue(&quot;$(vlang)&quot;))
	Select Case sLangPath 
		Case &quot;french&quot;
		iLangNumber = 0
		Case &quot;german&quot;
		iLangNumber = 2
		Case Else
		iLangNumber = 1
	End Select
Endif
SelectLangNumber = iLangNumber
End Function
</script:module>