6 messages in org.openoffice.fr.progRe: [prog] Macro "Changer la casse"
FromSent OnAttachments
Yves ChaufourJul 20, 2004 1:39 pm 
Agnès SimonetJul 20, 2004 2:52 pm 
serg...@neuf.frJul 20, 2004 4:47 pm 
Agnès SimonetJul 20, 2004 11:46 pm 
Yves ChaufourJul 21, 2004 8:43 am 
Agnès SimonetJul 21, 2004 10:16 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [prog] Macro "Changer la casse"Actions...
From:Agnès Simonet (agne@laposte.net)
Date:Jul 20, 2004 11:46:15 pm
List:org.openoffice.fr.prog

Bonjour Yves,

Yves Chaufour a écrit :

Bonsoir à tous,

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 ...

Merci d'avance.

Yves

Je ne vois pas bien l'intérêt de la macro, mais je m'y suis penchée quand même. Il suffit je crois de modifier le début en '----------------------- Sub ChangeCasse1

Dim oDocument as Object Dim oText as Object Dim oVCursor, oCursor, oCursorStart, oCursorEnd As Object Dim sWombat as string

oDocument= ThisComponent oText = oDocument.Text oVCursor = oDocument.currentcontroller.getViewCursor() oCursorStart = oText.createTextCursorByRange(oVCursor.getstart()) oCursorStart.gotoStartOfWord(false) oCursorEnd= oText.createTextCursorByRange(oVCursor.getEnd()) oCursorEnd.gotoEndOfWord(false) oCursor = oText.createTextCursorByRange(oCursorStart) oCursor.gotoRange (oCursorEnd, true) '---------------------- La suite reste identique (je la laisse ci-dessous)

' 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

Si ça ne va pas, n'hésites pas à le dire. Agnès S.