

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
3 messages in org.openoffice.fr.progStyle Alien| From | Sent On | Attachments |
|---|---|---|
| Aladdin | Sep 14, 2007 3:28 am | |
| Laurent Godard | Sep 14, 2007 3:35 am | |
| Aladdin | Sep 14, 2007 5:43 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Style Alien | Actions... |
|---|---|---|
| From: | Aladdin (alad...@altern.org) | |
| Date: | Sep 14, 2007 3:28:24 am | |
| List: | org.openoffice.fr.prog | |
Bonjour à vous,
J'ai réutiliser la macro de Mr Bruno MOUTOUH pour enlever les styles personnalisés lors d'une migration de document.
REM ***** BASIC *****
Option Explicit
Dim Dialogue As Object
Sub Main OuvrirDiag End Sub
' Auteur : Bruno MOUTOUH <brun...@douane.finances.gouv.fr> ' Source : http://fr.openoffice.org/servlets/ReadMsg?list=dev&msgNo=16448 Sub SupprimerStylesWW()
Dim monDocument As Object Dim lesFamilles As Object, uneFamille As Object Dim styleX As Object, liste As String, nomFam As String Dim f As integer, x As integer, nbSupp as integer dim aSupp() as string, nbStyles as integer const BOUTON_OUINON = 4 const BOUTONDEFAUT_NON = 256 const ICONE_QUESTION = 32 const CHOIX_NON = 7
if msgbox("Supprimer tous les styles commençant par WW ?",BOUTON_OUINON+BOUTONDEFAUT_NON+ICONE_QUESTION)= CHOIX_NON then exit sub endif
monDocument = ThisComponent
lesFamilles = monDocument.StyleFamilies for f = 0 to lesFamilles.Count -1 ' chaque famille nomFam = lesFamilles.ElementNames(f) if (nomFam="ParagraphStyles" or nomFam="CharacterStyles" or nomFam="NumberingStyles") then uneFamille = lesFamilles.getByName(nomFam) nbStyles = uneFamille.count for x = 0 to nbStyles -1 ' chaque style de cette famille styleX = uneFamille(x) if left(styleX.Name,2)="WW" then nbSupp=nbSupp+1 redim preserve aSupp(nbSupp+1) aSupp(nbSupp) = styleX.Name endif next x endif ' suppression des styles WW de cette famille for x=1 to nbSupp uneFamille.removeByName(aSupp(x)) next x
msgbox str(nbSupp)+" styles supprimés dans la famille "+ nomFam nbSupp = 0 redim aSupp(0)
next f
End Sub
Sub OuvrirDiag DialogLibraries.LoadLibrary("AlienStyle") 'Boite de dialogue AlienStyle Dialogue = createUNODialog(DialogLibraries.AlienStyle.Dialog1)
'Affichage de la boite de dialogue Dialogue.execute()
End Sub
Sub Bouton_OK
'Suppression des styles en WW If (Dialogue.getControl("CheckBoxWW").State) Then SupprimerStylesWW End If
'Suppression des styles de caractère personnalisés If (Dialogue.getControl("CheckBoxCaractere").State) Then MsgBox "Suppression des styles personnalisés de caractère" SuppStyle("CharacterStyles") End If
'Suppression des styles de paragraphe personnalisés If (Dialogue.getControl("CheckBoxParagraphe").State) Then MsgBox "Suppression des styles personnalisés de paragraphe" SuppStyle("ParagraphStyles") End If
'Suppression des styles de pages personnalisés If (Dialogue.getControl("CheckBoxPage").State) Then MsgBox "Suppression des styles personnalisés de page" SuppStyle("PageStyles") End If
'Suppression des styles de liste personnalisés If (Dialogue.getControl("CheckBoxListe").State) Then MsgBox "Suppression des styles personnalisés de liste" SuppStyle("NumberingStyles") End If Dialogue.endExecute() End Sub
Sub Bouton_Annuler Dialogue.endExecute() End Sub
'Supprime les styles personnalisés Sub SuppStyle(StyleType As String) Dim familleStyle As Object Dim i As Integer
familleStyle = thisComponent.StyleFamilies.getByName(StyleType)
For i=familleStyle.count-1 to 0 Step -1 If(familleStyle.getByIndex(i).isUSerDefined()) Then familleStyle.removeByName(familleStyle.getByIndex(i).displayName) End If
Next i
End Sub
Si vous avez des suggestions, améliorations ;-) Par exemple, au lieu de supprimer un style de paragraphe le remplacer par un style d'OpenOffice.org correspondant.
Petite question pourquoi on ne pas enlever les styles de liste personnalisés ? Même à la main via l'outil "Styles et formatage" .
J'ai déposé l'extension ici (renommer en AlienStyle.oxt) : http://www.cijoint.fr/cij88956106725639.zip
Merci à vous.







