summaryrefslogtreecommitdiff
path: root/starmath/source/node.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'starmath/source/node.cxx')
-rwxr-xr-xstarmath/source/node.cxx67
1 files changed, 50 insertions, 17 deletions
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index d8e2586e151e..b1d7d9e69210 100755
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -573,6 +573,13 @@ const SmNode * SmNode::FindNodeWithAccessibleIndex(xub_StrLen nAccIdx) const
return pResult;
}
+
+long SmNode::GetFormulaBaseline() const
+{
+ DBG_ASSERT( 0, "This dummy implementation should not have been called." );
+ return 0;
+}
+
///////////////////////////////////////////////////////////////////////////
SmStructureNode::SmStructureNode( const SmStructureNode &rNode ) :
@@ -763,7 +770,7 @@ void SmTableNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
}
Point aPos;
- SmRect::operator = (SmRect(nMaxWidth, 0));
+ SmRect::operator = (SmRect(nMaxWidth, 1));
for (i = 0; i < nSize; i++)
{ if (NULL != (pNode = GetSubNode(i)))
{ const SmRect &rNodeRect = pNode->GetRect();
@@ -779,6 +786,22 @@ void SmTableNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
ExtendBy(rNodeRect, nSize > 1 ? RCP_NONE : RCP_ARG);
}
}
+ // --> 4.7.2010 #i972#
+ if (HasBaseline())
+ nFormulaBaseline = GetBaseline();
+ else
+ {
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE);
+ aTmpDev.SetFont(GetFont());
+
+ SmRect aRect = (SmRect(aTmpDev, &rFormat, C2S("a"),
+ GetFont().GetBorderWidth()));
+ nFormulaBaseline = GetAlignM();
+ // move from middle position by constant - distance
+ // between middle and baseline for single letter
+ nFormulaBaseline += aRect.GetBaseline() - aRect.GetAlignM();
+ }
+ // <--
}
@@ -788,6 +811,12 @@ SmNode * SmTableNode::GetLeftMost()
}
+long SmTableNode::GetFormulaBaseline() const
+{
+ return nFormulaBaseline;
+}
+
+
/**************************************************************************/
@@ -818,20 +847,21 @@ void SmLineNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE);
aTmpDev.SetFont(GetFont());
- // provide an empty rectangle with alignment parameters for the "current"
- // font (in order to make "a^1 {}_2^3 a_4" work correct, that is, have the
- // same sub-/supscript positions.)
- //! be sure to use a character that has explicitly defined HiAttribut
- //! line in rect.cxx such as 'a' in order to make 'vec a' look same to
- //! 'vec {a}'.
- SmRect::operator = (SmRect(aTmpDev, &rFormat, C2S("a"),
- GetFont().GetBorderWidth()));
- // make sure that the rectangle occupies (almost) no space
- SetWidth(1);
- SetItalicSpaces(0, 0);
-
if (nSize < 1)
+ {
+ // provide an empty rectangle with alignment parameters for the "current"
+ // font (in order to make "a^1 {}_2^3 a_4" work correct, that is, have the
+ // same sub-/supscript positions.)
+ //! be sure to use a character that has explicitly defined HiAttribut
+ //! line in rect.cxx such as 'a' in order to make 'vec a' look same to
+ //! 'vec {a}'.
+ SmRect::operator = (SmRect(aTmpDev, &rFormat, C2S("a"),
+ GetFont().GetBorderWidth()));
+ // make sure that the rectangle occupies (almost) no space
+ SetWidth(1);
+ SetItalicSpaces(0, 0);
return;
+ }
// make distance depend on font size
long nDist = (rFormat.GetDistance(DIS_HORIZONTAL) * GetFont().GetSize().Height()) / 100L;
@@ -839,14 +869,17 @@ void SmLineNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
nDist = 0;
Point aPos;
- for (i = 0; i < nSize; i++)
+ // copy the first node into LineNode and extend by the others
+ if (NULL != (pNode = GetSubNode(0)))
+ SmRect::operator = (pNode->GetRect());
+
+ for (i = 1; i < nSize; i++)
if (NULL != (pNode = GetSubNode(i)))
{
aPos = pNode->AlignTo(*this, RP_RIGHT, RHA_CENTER, RVA_BASELINE);
- // no horizontal space before first node
- if (i)
- aPos.X() += nDist;
+ // add horizontal space to the left for each but the first sub node
+ aPos.X() += nDist;
pNode->MoveTo(aPos);
ExtendBy( *pNode, RCP_XOR );