Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you have to resize lots of formulas you may fgeel tempted to try the user Subs ("macros") below I just sketched for the purpose. They are coded a bit roughly and will only work in 'Draw' and in 'Impress' documents. It should not be too difficult to adapt or generalize them for 'Writer' and 'Calc'.

Sub resizeAllMathFormulas(Optional ByVal pNewBaseFontHeight)
REM No resolving of groups!
If IsMissing(pNewBaseFontHeight) Then 
 pNewBaseFontHeight=InputBox("Please enter the new BaseFontHeight for ALL Math formulas.", "Resize ALL Formulas Generally", "48")
End If
tD=ThisComponent
tDPs=tD.DrawPages
For pN=0 To tDPs.Count -1
 tP=tD.DrawPages(pN)
 For sN=0 To tP.Count-1
  tS=tP(sN)
  If tS.SupportsService("com.sun.star.drawing.OLE2Shape") Then
   If tS.Model.SupportsService("com.sun.star.formula.FormulaProperties") Then
    tS.Model.BaseFontHeight=pNewBaseFontHeight
   End If
  End If
 Next sN
Next pN
End Sub

and

Sub askAndResizeSelectedMathFormula()
tD=ThisComponent
tSel=tD.CurrentSelection
If NOT tSel.SupportsService("com.sun.star.drawing.ShapeCollection") Then Exit Sub
If tSel.Count<>1 Then Exit Sub
tS=tSel(0)
If tS.SupportsService("com.sun.star.drawing.OLE2Shape") Then
 If tS.Model.SupportsService("com.sun.star.formula.FormulaProperties") Then
  NewBaseFontHeight=0+InputBox("please enter the new BaseFontHeight.", "Resize Formula Generally", "48")
  tS.Model.BaseFontHeight=newBaseFontHeight
 End If
End If
End Sub

(Using experimental tools always work on copies only!)

If you have to resize lots of formulas you may fgeel feel tempted to try the user Subs ("macros") below I just sketched for the purpose. They are coded a bit roughly and will only work in 'Draw' and in 'Impress' documents. It should not be too difficult to adapt or generalize them for 'Writer' and 'Calc'.

Sub resizeAllMathFormulas(Optional ByVal pNewBaseFontHeight)
REM No resolving of groups!
If IsMissing(pNewBaseFontHeight) Then 
 pNewBaseFontHeight=InputBox("Please enter the new BaseFontHeight for ALL Math formulas.", "Resize ALL Formulas Generally", "48")
End If
tD=ThisComponent
tDPs=tD.DrawPages
For pN=0 To tDPs.Count -1
 tP=tD.DrawPages(pN)
 For sN=0 To tP.Count-1
  tS=tP(sN)
  If tS.SupportsService("com.sun.star.drawing.OLE2Shape") Then
   If tS.Model.SupportsService("com.sun.star.formula.FormulaProperties") Then
    tS.Model.BaseFontHeight=pNewBaseFontHeight
   End If
  End If
 Next sN
Next pN
End Sub

and

Sub askAndResizeSelectedMathFormula()
tD=ThisComponent
tSel=tD.CurrentSelection
If NOT tSel.SupportsService("com.sun.star.drawing.ShapeCollection") Then Exit Sub
If tSel.Count<>1 Then Exit Sub
tS=tSel(0)
If tS.SupportsService("com.sun.star.drawing.OLE2Shape") Then
 If tS.Model.SupportsService("com.sun.star.formula.FormulaProperties") Then
  NewBaseFontHeight=0+InputBox("please enter the new BaseFontHeight.", "Resize Formula Generally", "48")
  tS.Model.BaseFontHeight=newBaseFontHeight
 End If
End If
End Sub