Bonjour François

SEGUIN François escribió:
Bonjour à tous,


Je suis actuellement en contact sur la liste USER avec un utilisateur de DRAW 
qui a besoin de changer le pas de la grille pendant la réalisation de ses 
dessins.
Il le fait en accèdant au menu "OUTILS" "OPTIONS" "OpenOffice.org  
Draw""Grille" . La manipulation prend donc du temps à chaque fois. L'idée serait de créer une macro 
associée à des boutons avec des pas de grille prédéfini. je suis prêt à faire le développement mais je ne sais pas 
comment accéder par macro au menu des options.
Un peu d'aide serait la bien venu...

Merci


François

Vous pouvez manipuler les options du menu "Outils" - "Options" -
"OpenOffice.org  Draw" - "Grille", si vous accédez à la branche de
configuration "/org.openoffice.Office.Draw"

L'arbre pour cet noeud de configuration est:


Content
        Display
                ContourMode = False
                LineContour = False
                PicturePlaceholder = False
                TextPlaceholder = False
Grid
        Option
                SnapToGrid = True
                Synchronize = False
                VisibleGrid = False
        Resolution
                XAxis
                        Metric = 1000
                        NonMetric = 1270
                YAxis
                        Metric = 1000
                        NonMetric = 1270
        SnapGrid
                Size = True
                XAxis
                        Metric = 1000
                        NonMetric = 1270
                YAxis
                        Metric = 1000
                        NonMetric = 1270
        Subdivision
                XAxis = 1
                YAxis = 1
Layout
        Display
                Bezier = False
                Contour = True
                Guide = True
                Helpline = True
                Ruler = True
        Other
                MeasureUnit
                        Metric = 2
                        NonMetric = 8
                TabStop
                        Metric = 1250
                        NonMetric = 1270
Misc
        BackgroundCache = True
        BigHandles = False
        CopyWhileMoving = False
        CreateWithAttributes = False
        DclickTextedit = True
        NoDistort = False
        ObjectMoveable = True
        Preview = 0
        RotateClick = False
        SimpleHandles = True
        Compatibility
                PrinterIndependentLayout = 2
        CrossFading
                Attributes = True
                Orientation = True
                Steps = 16
        DefaultObjectSize
                Height = 5000
                Width = 8000
        TextObject
                QuickEditing = False
                Selectable = True
Print
        Content
                Drawing = True
        Other
                Date = False
                FromPrinterSetup = False
                HiddenPage = True
                PageName = False
                Quality = 0
                Time = False
        Page
                Booklet = False
                BookletBack = True
                BookletFront = True
                PageSize = False
                PageTile = False
Snap
        Object
                Grid = False
                ObjectFrame = True
                ObjectPoint = True
                PageMargin = True
                Range = 5
                SnapLine = True
        Position
                CreatingMoving = False
                ExtendEdges = True
                PointReduction = 1500
                Rotating = False
                RotatingValue = 1500
Zoom
        ScaleX = 1
        ScaleY = 1






Pour manipuler la grille, utilisez "/org.openoffice.Office.Draw/Grid".

Exemple:

Sub DRAW_GRID_CONFIG

        Dim oDrawGridConfig as Object
        oDrawGridConfig = getConfigurationAccess(_
                                                        
"/org.openoffice.Office.Draw/Grid", true )
                                                        
        If NOT IsNull(oDrawGridConfig) Then
                Dim bIsVisibleGrid as Boolean
                bIsVisibleGrid = oDrawGridConfig.getHierarchicalPropertyValue(_
                                                        "Option/VisibleGrid")
                oDrawGridConfig.setHierarchicalPropertyValue(_
                                                        "Option/VisibleGrid", 
NOT bIsVisibleGrid)             
                
                oDrawGridConfig.setHierarchicalPropertyValue(_
                                                        
"Resolution/XAxis/Metric", 500)
                oDrawGridConfig.setHierarchicalPropertyValue(_
                                                        
"Resolution/YAxis/Metric", 500)
                
                'DO NOT forget to commit the changes!
                oDrawGridConfig.commitChanges()
                
                'BUT unfortunately, this will have NO effect until you close OOo
                'and the QuickStarter
                'NOT very useful!
                
                'Close OOo and the QuickStarter.
                'Start OOo once again, open a NEW Draw document.
                'You will see that the the grid is in the opposite state as 
before
                'and the resolution of the grid is 0,50 cm, instead of the 
default 1,00 cm
        End If
End Sub




Function getConfigurationAccess( sNodePath$, bUpdate as Boolean,
Optional aLocale$)

REM Param. aLocale is STRING, NOT com.sun.star.lang.Locale
'       for example.    "es", "es-AR"
'                       "*" for ALL locales

        On Error GoTo getConfigurationAccessErrorHandler

        Dim sConfigurationProvider$, oConfigurationProvider as Object
        Dim sConfigurationAccess$, sConfigurationUpdateAccess$, sConfiguration$
        Dim oConfigurationAccess as Object
        
        sConfigurationProvider = 
"com.sun.star.configuration.ConfigurationProvider"
        oConfigurationProvider = createUNOService(sConfigurationProvider)
        
        Dim oParametros(0) As New com.sun.star.beans.PropertyValue
        oParametros(0).Name = "nodepath"
        oParametros(0).Value = sNodePath
        
        sConfigurationAccess   = 
"com.sun.star.configuration.ConfigurationAccess"
        sConfigurationUpdateAccess =
"com.sun.star.configuration.ConfigurationUpdateAccess"
        
        if bUpdate then
                ReDim Preserve oParametros(1)
                oParametros(1).Name = "EnableAsync"
                oParametros(1).Value = FALSE
                sConfiguration = sConfigurationUpdateAccess
        else
                sConfiguration = sConfigurationAccess
        end if
        
        if NOT IsMissing(aLocale) then
                Dim n%
                n = UBound(oParametros)+1
                ReDim Preserve oParametros(n)
                oParametros(n).Name = "Locale"
                oParametros(n).Value = aLocale
        end if
                
        oConfigurationAccess = 
oConfigurationProvider.createInstanceWithArguments(_
                                                                                
sConfiguration, oParametros())
        
        getConfigurationAccessCleanUp:
                getConfigurationAccess() = oConfigurationAccess
                Exit Function
                getConfigurationAccessErrorHandler:
                        Resume getConfigurationAccessCleanUp
End Function



A bientôt
Ariel



--
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://www.arielconstenlahaile.com.ar/ooo/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Répondre à