Writer – Liste les polices disponibles avec une phrase exemple

Auteur : Laurent Godard – Conseil et Développement – dev.godard@wanadoo.fr

Révision : 1

Enumère la liste des polices disponibles en écrivant une phrase donnée par l'utilisateur.

Note : Faire un copier/coller de l’ensemble.

'********************************************************************************

'Copyright (C) 2003 Laurent Godard

'dev.godard@wanadoo.fr

'This library is free software; you can redistribute it and/or

'modify it under the terms of the GNU Lesser General Public

'License as published by the Free Software Foundation; either

'version 2.1 of the License, or (at your option) any later version.

'This library is distributed in the hope that it will be useful,

'but WITHOUT ANY WARRANTY; without even the implied warranty of

'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU

'Lesser General Public License for more details.

'http://www.opensource.org/licenses/lgpl-license.php

'You should have received a copy of the GNU Lesser General Public

'License along with this library; if not, write to the Free Software

'Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

'******************************************************************************

Sub ExemplePolice()

Sub Macro1
phrase=InputBox("phrase de test :","Liste des polices","Ceci est un essai")
oText=thisComponent.getText()
oCursor = oText.createTextCursor()
'Liste des fontes
Dim oToolkit as Object
oToolkit = CreateUnoService("com.sun.star.awt.Toolkit")
Dim oDevice as Variant
oDevice = oToolkit.createScreenCompatibleDevice(0, 0)
Dim oFontDescriptors As Variant
oFontDescriptors = oDevice.FontDescriptors
Dim oFontDescriptor As Object
thiscomponent.lockcontrollers
for i= LBound(oFontDescriptors) to UBound(oFontDescriptors)
oCursor.CharFontName=oFontDescriptors(i).Name
oCursor.string=cstr(i)+". "+oFontDescriptors(i).Name+chr(10)
valide=oCursor.gotoEnd(false)
oCursor.string=phrase+chr(10)+chr(10)
valide=oCursor.gotoEnd(false)
next i
thiscomponent.unlockcontrollers
End Sub

Laurent Godard

2003-05-04T09:01:58