

![]() | 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: |
6 messages in org.openoffice.fr.prog[prog] Macro "Changer la casse"| From | Sent On | Attachments |
|---|---|---|
| Yves Chaufour | Jul 20, 2004 1:39 pm | |
| Agnès Simonet | Jul 20, 2004 2:52 pm | |
| serg...@neuf.fr | Jul 20, 2004 4:47 pm | |
| Agnès Simonet | Jul 20, 2004 11:46 pm | |
| Yves Chaufour | Jul 21, 2004 8:43 am | |
| Agnès Simonet | Jul 21, 2004 10:16 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: | [prog] Macro "Changer la casse" | Actions... |
|---|---|---|
| From: | Yves Chaufour (yves...@wanadoo.fr) | |
| Date: | Jul 20, 2004 1:39:15 pm | |
| List: | org.openoffice.fr.prog | |
Bonsoir à tous,
Vous connaissez peut-être la macro (http://fr.openoffice.org/Documentation/Macros/changecasse.sxw) qui permet de changer la casse d'un mot. Associée à une icône dans la barre de texte, on obtient presque la fonction équivalente de celle de M$ word. Le seul problème est que le changement de casse ne s'applique qu'au mot dans lequel se trouve le curseur, ou au premier mot de la sélection. Si on veut passer en majuscules un titre de 10 mots, il faut aller sur chaque mot et actionner la macro à chaque fois. Sinon on peut passer par Format/Caractères/Effets de caractères/Attributs ... , mais avouez que ce serait plus simple si cette macro pouvait agir sur tous les mots de la sélection en une seule fois.
Si certains d'entre vous pouvaient se pencher un peu sur cette macro et me dire comment on pourrait faire en sorte qu'elle agisse sur toute la sélection plutôt que sur un seul mot, ce serait sympa ... Je pense que tous les utilisateurs découvrant fraîchement OOo après word (mes parents par exemple !) auraient un argument de moins pour dire que OOo est pluis compliqué !!
Merci d'avance.
Yves
ps : je recopie ici la macro en question
'Silly macro by Andrew Brown ' This works like the corresponding command in MS Word, though only on single words: ' if you assign it to a key, successive key presses ' will cycle through upper case, lower case and title case. Sub Changer_Casse Dim oDocument, oDesktop as Object Dim oText as Object Dim oVCursor, oCursor As Object Dim sWombat as string ' the two following lines get the active document oDesktop = createUnoService("com.sun.star.frame.Desktop") oDocument= oDesktop.getCurrentComponent() oText = oDocument.Text oVCursor = oDocument.currentcontroller.getViewCursor() oCursor = oText.createTextCursorByRange(oVCursor.getstart()) oCursor.gotoStartOfWord(false) oCursor.gotoEndOfWord(true) ' the next routine checks if the word has several cases in it, ' and irons them out. Otherwise everything works erratically lower down if oCursor.GetPropertyState("CharCaseMap")>0 then oCursor.SetPropertyToDefault("CharCaseMap") oCursor.CharCaseMap=2 end if sWombat=oCursor.getPropertyValue("CharCaseMap") 'msgbox "CharCaseMap is now " + sWombat if sWombat="1" then ' we have lowercase text oCursor.CharCaseMap = com.sun.star.style.CaseMap.TITLE elseif sWombat="2" then ' already title case oCursor.CharCaseMap=com.sun.star.style.CaseMap.UPPERCASE elseif sWombat="3" then ' we have uppercase oCursor.CharCaseMap = com.sun.star.style.CaseMap.LOWERCASE else oCursor.SetPropertyToDefault("CharCaseMap") end if End Sub







