Bonsoir,

Merci Thibault. Cela fonctionne comme je le souhaitais.


Thibault Vataire a écrit :
> Bonjour,
>
> Voici une solution pour recuperer ces coordonnees : 
>
> sub main
>
>       dim doc as object
>       dim controller as object
>       dim statusBar as object
>       dim accessibleContext as object
>       dim target as object
>
>       doc = thisComponent
>       controller = doc.currentController
>       if (not isNull(controller)) then
>               statusBar = _getStatusBar(controller.frame.layoutManager)
>               if (not isNull(statusBar)) then
>                        target = 
> _getAccessibleChildByName(statusBar.realInterface, "Taille")
>                        if (not isNull(target)) then
>                               msgbox(target.text)
>                        end if
>               end if
>       end if
>
> end sub
>
> function _getAccessibleChildByName(accessibleObject as object, aName as 
> string) as object
>
>       dim result as object
>       dim accessibleContext as object
>       dim childIndex as long
>       dim aChild as object
>
>       accessibleContext = accessibleObject.accessibleContext
>       while ((childIndex < accessibleContext.accessibleChildCount) and 
> isNull(result))
>               aChild = accessibleContext.getAccessibleChild(childIndex)
>               if (aChild.accessibleName = aName) then
>                       result = aChild
>               else
>                       result = _getAccessibleChildByName(aChild, aName)
>               end if
>               childIndex = childIndex + 1
>       wend
>       
>       _getAccessibleChildByName = result
>
> end function
>
> function _getStatusBar(layManager as object) as object
>
>       dim result as object
>       dim elements as object
>       dim anElement as object
>       dim elemIndex as long
>
>       elements = layManager.elements()
>       elemIndex = lbound(elements)
>       while ((elemIndex <= ubound(elements)) and isNull(result))
>               anElement = elements(elemIndex)
>               if (_isStatusBar(anElement)) then
>                       result = anElement
>               end if
>               elemIndex = elemIndex + 1
>       wend
>
>       _getStatusBar = result
>
> end function
>
> function _isStatusBar(anObject as object) as boolean
>
>       dim success as boolean
>       
>       on local error resume next
>       success = (anObject.type = com.sun.star.ui.UIElementType.STATUSBAR)
>       
>       _isStatusBar = success
>       
> end function
>
> Cordialement,
> Thibault Vataire
>
>
>
> ----- Mail Original -----
> De: "Didier Dorange-Pattoret" <ddora...@dmaths.org>
> À: prog@fr.openoffice.org
> Envoyé: Jeudi 1 Juillet 2010 14:08:22
> Objet: [prog] Position de la souris dans un document dessin
>
> Bonjour à tous,
>
> Lorsqu'un document dessin est affiché, on peut remarquer, dans la
> dernière ligne à côté de diapo 1/1,  deux nombres qui donnent la
> position du curseur, exprimée en cm, par rapport au coin supérieur
> gauche de la page de dessin.
>
> Comment peut-on récupérer ces coordonnées ?
>
> Merci pour votre aide.
>
>   

-- 
Didier Dorange-Pattoret

http://www.dmaths.org
http://sesamath.net

Soutenez le projet Dmaths : rejoignez le club ou faites adhérer votre 
établissement !
http://www.dmaths.org/documentation/doku.php?id=presentation:club



---------------------------------------------------------------------
To unsubscribe, e-mail: prog-unsubscr...@fr.openoffice.org
For additional commands, e-mail: prog-h...@fr.openoffice.org

Répondre à