REM ***** BASIC ***** Sub Main Dim oController as Object oDrawDoc = ThisComponent oController = oDrawDoc.getCurrentController oDrawPage = oDrawDoc.getCurrentController.getCurrentPage() pintarShapes(oDrawPage, oController) End Sub Function GetDocumentController( oDoc As Object ) As Object Dim oCtrl As Object ' If the caller gave us the document model... If oDoc.supportsService( "com.sun.star.document.OfficeDocument" ) Then ' ...then get the controller from that. oCtrl = oDoc.getCurrentController() ' If the caller gave us a document controller... ElseIf HasUnoInterfaces( oDoc, "com.sun.star.frame.XController" ) Then ' ...thanks! That's just what we wanted! oCtrl = oDoc ' If the caller gave us the document frame... ElseIf HasUnoInterfaces( oDoc, "com.sun.star.frame.XFrame" ) Then oFrame = oDoc ' ...then get the controller from the frame. oCtrl = oFrame.getController() Else ' The caller did not give us what we expected! MsgBox( "GetDocController called with incorrect parameter." ) EndIf GetDocumentController() = oCtrl End Function Function pintarShapes(oDrawPage As Object, ByVal oController As Object) ' Find out how many shapes are on current page. nNumShapes = oDrawPage.getCount () ' Iterate over each shape. For nShape = 0 To nNumShapes - 1 ' Get the shape. oShape = oDrawPage.getByIndex( nShape ) ' This is an example of how to check the NAME of the shape ' for something. ' If oShape.getName() = cShapeName Then ' ' Do something ' EndIf oController = GetDocumentController(oController) oController.select (oShape) ' If the shape is a control... If HasUnoInterfaces( oShape, "com.sun.star.drawing.XControlShape" ) Then ' Don't bother looking at ControlShape's. ' If the shape is a group of shapes... ElseIf HasUnoInterfaces( oShape, "com.sun.star.drawing.XShapes" ) Then pintarShapes(oShape, oController) ElseIf HasUnoInterfaces( oShape, "com.sun.star.text.XText" ) Then ooParagraphs = oShape.getText().createEnumeration() do while ooParagraphs.hasMoreElements OoPar = OoParagraphs.nextElement If OoPar.supportsService("com.sun.star.text.Paragraph") Then oTextPortionEnum = OoPar.createEnumeration() While oTextPortionEnum.hasMoreElements() oTextPortion = oTextPortionEnum.nextElement() oTextPortion.CharHeight = oTextPortion.CharHeight - 2 Wend EndIf Loop oShape.CharHeight = oShape.CharHeight - 2 EndIf Next ' nShape End Function