

![]() | 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: |
16 messages in org.openoffice.fr.progRe: [prog] Comment obtnir la version ...| From | Sent On | Attachments |
|---|---|---|
| Didier Dorange-Pattoret | Jan 29, 2006 6:21 am | |
| Bernard Marcelly | Jan 29, 2006 8:53 am | |
| Didier Dorange-Pattoret | Jan 29, 2006 12:37 pm | |
| Didier Dorange-Pattoret | Jan 29, 2006 2:26 pm | |
| Laurent Godard | Jan 29, 2006 11:06 pm | |
| oo...@volcar.org | Jan 30, 2006 4:54 am | |
| Didier Dorange-Pattoret | Jan 30, 2006 2:09 pm | |
| Didier Dorange-Pattoret | Jan 30, 2006 2:21 pm | |
| Catherine Bancillon | Jan 31, 2006 10:31 am | |
| Didier Dorange-Pattoret | Jan 31, 2006 12:03 pm | |
| Nojid | Jan 31, 2006 12:11 pm | |
| Catherine Bancillon | Jan 31, 2006 11:09 pm | |
| Catherine Bancillon | Jan 31, 2006 11:46 pm | |
| Catherine Bancillon | Jan 31, 2006 11:56 pm | |
| c.ma...@univitis.fr | Feb 1, 2006 12:03 am | |
| Jacques Le Moulec | Feb 1, 2006 12:10 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: | Re: [prog] Comment obtnir la version de Windows | Actions... |
|---|---|---|
| From: | Didier Dorange-Pattoret (ddor...@free.fr) | |
| Date: | Jan 30, 2006 2:09:47 pm | |
| List: | org.openoffice.fr.prog | |
Bonsoir Laurent,
Voici les macros qui permettent de redimensionner le fichier about.bmp, en gardant ses proportions et en lui donnant une largeur de 16.
Si ce code est potentiellement utile je peux le mettre en ligne. Je l'ai publié sur oooforums.org
http://www.oooforum.org/forum/viewtopic.phtml?t=30260&highlight=
Dans Dmaths, il sert à personnaliser les icônes des applications préférées de l'utilisateur.
Version en développement : http://ddorange.free.fr/Dmaths31Alpha2.zip
Cordialement.
Sub Essai ResizeExternalImageByWidth("/home/didier/tmp4/about.bmp","/home/didier/tmp4/about_1616.bmp",16)
End sub
Sub ResizeExternalImageByWidth(sURLImage,sURLImageResized as String, iWidth as Integer) rem on ouvre un document sdraw invisible Dim mFileProperties(0) As New com.sun.star.beans.PropertyValue Dim iFormat as Integer mFileProperties(0).Name="Hidden" mFileProperties(0).Value=True oDesktop=createUnoService("com.sun.star.frame.Desktop") monDocument = oDesktop.LoadComponentFromURL("private:factory/sdraw","_blank",0,mFileProperties())
maPage = monDocument.DrawPages(0) rem on insère dans la page l'image à redimmensionner et on fixe sa largeur à 1000 ImageL = monDocument.createInstance("com.sun.star.drawing.GraphicObjectShape") ImageL.GraphicURL = ConvertToURL(sURLImage) maPage.add(ImageL) resizeImageByWidth(ImageL,1000) rem on redimensionne la page du doc draw au format de l'image iFormat = Int(ImageL.Size.Height/ImageL.Size.Width) maPage.Width = 1000 maPage.Height = 1000*iFormat rem on fixe les donnees du filtre d'export Dim aFilterData (1) as new com.sun.star.beans.PropertyValue aFilterData(0).Name = "PixelWidth" ' aFilterData(0).Value = iWidth*iFormat aFilterData(1).Name = "PixelHeight" aFilterData(1).Value = iWidth rem on exporte la page de dessin au format bmp Export( maPage,sURLImageResized , aFilterData() ) On error resume Next monDocument.Close(True) On error goto 0 End Sub
Sub Export( xObject, sFileUrl As String, aFilterData ) xExporter = createUnoService( "com.sun.star.drawing.GraphicExportFilter" ) xExporter.SetSourceDocument( xObject ) Dim aArgs (2) as new com.sun.star.beans.PropertyValue Dim aURL as new com.sun.star.util.URL sFileUrl = ConvertToURL(sFileUrl) aArgs(0).Name = "FilterName" aArgs(0).Value = "bmp" aArgs(1).Name = "URL" aArgs(1).Value = sFileUrl aArgs(2).Name = "FilterData" aArgs(2).Value = aFilterData xExporter.filter( aArgs() ) End Sub
Sub resizeImageByWidth(uneImage As Object, largeur As Long) Dim leBitMap As Object, Proportion As Double Dim Taille1 As New com.sun.star.awt.Size LeBitmap = uneImage.GraphicObjectFillBitmap Taille1 = LeBitMap.Size ' taille en pixels ! Proportion = Taille1.Height / Taille1.Width Taille1.Width = largeur ' largeur en 1/100 de mm Taille1.Height = Taille1.Width * Proportion uneImage.Size = Taille1 End Sub
-- Didier Dorange-Pattoret







