Issue 118043

Summary: Bad alignment when topMargin of a formula change
Product: Math Reporter: cdeval <cdeval>
Component: uiAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Normal    
Priority: P3 CC: cdeval, issues, rb.henschel
Version: 3.4.0   
Target Milestone: ---   
Hardware: PC   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description cdeval 2011-05-18 19:44:41 UTC
With 3.4 version, OOo can now align formula on baseline (see new option MathBaselineAlignment in document settings or option dialog)
But there is a problem with the top margin.
I wrote a macro you can run step by step to see the problem.
You will have the same problem inserting the formula with menu "insert->object->formula" but changing properties with menu is not easy to describe. So try this macro :


sub badAlignment
	param=ThisComponent.createInstance("com.sun.star.document.Settings")
	param.MathBaselineAlignment=true
	obj=ThisComponent.CreateInstance("com.sun.star.text.TextEmbeddedObject")
	obj.CLSID="078B7ABA-54FC-457F-8551-6147e776a997"
    obj.AnchorType=com.sun.star.text.TextContentAnchorType.AS_CHARACTER
    oViewCursor = ThisComponent.getCurrentController().getViewCursor()
	oTextCursor=oViewCursor.Text.createTextCursorByRange(oViewCursor)
	oTextCursor.Text.insertString(oTextCursor,"this formula ...",false)
    oTextCursor.Text.insertTextContent(oTextCursor, obj, true)
   	obj.Model.leftMargin=0
  	obj.Model.rightMargin=0
   	obj.Model.bottomMargin=0
  	obj.Model.topMargin=0
	obj.Model.formula="x ^ {1 over 2}"
	oTextCursor.Text.insertString(oTextCursor," is aligned, ",false)
   	obj.Model.bottomMargin=100
	oTextCursor.Text.insertString(oTextCursor," still aligned, ",false)
   	obj.Model.topMargin=100
	oTextCursor.Text.insertString(oTextCursor," not aligned anymore ! ",false)
end sub
Comment 1 cdeval 2012-05-17 20:53:44 UTC
The bug is still here (AOO 3.4).
Run this macro step by step in a writer blank document to see the problem :

sub badAlignment
    param=ThisComponent.createInstance("com.sun.star.document.Settings")
    param.MathBaselineAlignment=true
    obj=ThisComponent.CreateInstance("com.sun.star.text.TextEmbeddedObject")
    obj.CLSID="078B7ABA-54FC-457F-8551-6147e776a997"
    obj.AnchorType=com.sun.star.text.TextContentAnchorType.AS_CHARACTER
    oViewCursor = ThisComponent.getCurrentController().getViewCursor()
    oTextCursor=oViewCursor.Text.createTextCursorByRange(oViewCursor)
    oTextCursor.Text.insertString(oTextCursor,"this formula ...",false)
    oTextCursor.Text.insertTextContent(oTextCursor, obj, true)
    obj.Model.leftMargin=0
    obj.Model.rightMargin=0
    obj.Model.bottomMargin=0
    obj.Model.topMargin=0
    obj.Model.formula="x ^ {1 over 2}"
    obj.ExtendedControlOverEmbeddedObject.update()
    oTextCursor.Text.insertString(oTextCursor," is well aligned, ",false)
    obj.Model.bottomMargin=100
    oTextCursor.Text.insertString(oTextCursor," still aligned, ",false)
    obj.Model.topMargin=100
    oTextCursor.Text.insertString(oTextCursor," not aligned anymore ! ",false)
end sub
Comment 2 Regina Henschel 2012-05-17 22:53:35 UTC
You can see the error too with setting the top border distance to 1mm in an existing formula, no need for a macro. I have tested it with AOO3.4 on WinXP.