version 1.161, 2002/08/26 08:25:55
|
version 1.162, 2002/08/26 12:19:04
|
Line 491 void SetSingleIntHorizStretchAttr (Eleme
|
Line 491 void SetSingleIntHorizStretchAttr (Eleme
|
if (child) |
if (child) |
{ |
{ |
elType = TtaGetElementType (child); |
elType = TtaGetElementType (child); |
/* skip a possible empty Construct (placeholder) */ |
/* skip empty Constructs (placeholders) and comments */ |
if (elType.ElTypeNum == MathML_EL_Construct) |
while (child && |
|
(elType.ElTypeNum == MathML_EL_Construct || |
|
elType.ElTypeNum == MathML_EL_XMLcomment) && |
|
!strcmp (TtaGetSSchemaName (elType.ElSSchema), "MathML")) |
{ |
{ |
TtaNextSibling (&child); |
TtaNextSibling (&child); |
if (child) |
if (child) |
elType = TtaGetElementType (child); |
elType = TtaGetElementType (child); |
} |
} |
while (child && elType.ElTypeNum == MathML_EL_MROW) |
while (child && elType.ElTypeNum == MathML_EL_MROW && |
/* the first child is a mrow. Check whether it has a single child */ |
strcmp (TtaGetSSchemaName (elType.ElSSchema), "MathML") == 0) |
|
/* the first significant child is a mrow. Check whether it has a |
|
single child */ |
{ |
{ |
child = TtaGetFirstChild (child); |
child = TtaGetFirstChild (child); |
if (child) |
if (child) |
{ |
{ |
elType = TtaGetElementType (child); |
elType = TtaGetElementType (child); |
/* skip a possible empty Construct (placeholder) */ |
/* skip empty Constructs (placeholders) and comments */ |
if (elType.ElTypeNum == MathML_EL_Construct) |
while (child && |
|
(elType.ElTypeNum == MathML_EL_Construct || |
|
elType.ElTypeNum == MathML_EL_XMLcomment) && |
|
!strcmp (TtaGetSSchemaName (elType.ElSSchema), "MathML")) |
{ |
{ |
TtaNextSibling (&child); |
TtaNextSibling (&child); |
if (child) |
if (child) |
elType = TtaGetElementType (child); |
elType = TtaGetElementType (child); |
} |
} |
sibling = child; |
sibling = child; |
TtaNextSibling (&sibling); |
TtaNextSibling (&sibling); |
Line 518 void SetSingleIntHorizStretchAttr (Eleme
|
Line 526 void SetSingleIntHorizStretchAttr (Eleme
|
/* there are other children */ |
/* there are other children */ |
{ |
{ |
siblingType = TtaGetElementType (sibling); |
siblingType = TtaGetElementType (sibling); |
if (siblingType.ElTypeNum == MathML_EL_Construct) |
while (sibling && |
/* its a construct, skip it */ |
(siblingType.ElTypeNum == MathML_EL_Construct || |
TtaNextSibling (&sibling); |
siblingType.ElTypeNum == MathML_EL_XMLcomment) && |
|
!strcmp (TtaGetSSchemaName (siblingType.ElSSchema), "MathML")) |
|
/* its an empty construct (placeholder) or a comment, skip it*/ |
|
{ |
|
TtaNextSibling (&sibling); |
|
if (sibling) |
|
siblingType = TtaGetElementType (sibling); |
|
} |
if (sibling) |
if (sibling) |
|
/* there are significant siblings */ |
child = NULL; |
child = NULL; |
} |
} |
} |
} |
Line 533 void SetSingleIntHorizStretchAttr (Eleme
|
Line 549 void SetSingleIntHorizStretchAttr (Eleme
|
{ |
{ |
sibling = child; |
sibling = child; |
TtaNextSibling (&sibling); |
TtaNextSibling (&sibling); |
/* skip a possible empty Construct (placeholder) */ |
|
if (sibling) |
if (sibling) |
|
siblingType = TtaGetElementType (sibling); |
|
/* skip empty Constructs (placeholders) and comments */ |
|
while (sibling && |
|
(siblingType.ElTypeNum == MathML_EL_Construct || |
|
siblingType.ElTypeNum == MathML_EL_XMLcomment) && |
|
!strcmp (TtaGetSSchemaName (siblingType.ElSSchema), "MathML")) |
{ |
{ |
siblingType = TtaGetElementType (sibling); |
TtaNextSibling (&sibling); |
if (siblingType.ElTypeNum == MathML_EL_Construct) |
if (sibling) |
TtaNextSibling (&sibling); |
siblingType = TtaGetElementType (sibling); |
} |
} |
if (sibling == NULL) |
if (sibling == NULL) |
/* there is no other child */ |
/* there is no other significant child */ |
{ |
{ |
c = EOS; |
c = EOS; |
doit = FALSE; |
doit = FALSE; |
Line 652 void SetSingleIntHorizStretchAttr (Eleme
|
Line 673 void SetSingleIntHorizStretchAttr (Eleme
|
} |
} |
} |
} |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
SetIntHorizStretchAttr |
SetIntHorizStretchAttr |
|
|
Line 679 static void SetIntHorizStretchAttr (Elem
|
Line 700 static void SetIntHorizStretchAttr (Elem
|
Put a IntVertStretch attribute on element el if its base element |
Put a IntVertStretch attribute on element el if its base element |
(Base for a MSUBSUP, MSUP or MSUB; UnderOverBase for a MUNDEROVER, |
(Base for a MSUBSUP, MSUP or MSUB; UnderOverBase for a MUNDEROVER, |
a MUNDER of a MOVER) contains only a MO element that is a vertically |
a MUNDER of a MOVER) contains only a MO element that is a vertically |
stretchable symbol (integral). |
stretchable symbol (integral, vertical arrow, etc). |
-----------------------------------------------------------------------*/ |
-----------------------------------------------------------------------*/ |
void SetIntVertStretchAttr (Element el, Document doc, int base, Element* selEl) |
void SetIntVertStretchAttr (Element el, Document doc, int base, Element* selEl) |
{ |
{ |
Line 694 void SetIntVertStretchAttr (Element el,
|
Line 715 void SetIntVertStretchAttr (Element el,
|
CHAR_T text[buflen]; |
CHAR_T text[buflen]; |
unsigned char c; |
unsigned char c; |
int len, i; |
int len, i; |
ThotBool inbase, integral; |
ThotBool inbase, stretchable; |
|
|
if (el == NULL) |
if (el == NULL) |
return; |
return; |
Line 719 void SetIntVertStretchAttr (Element el,
|
Line 740 void SetIntVertStretchAttr (Element el,
|
elType.ElTypeNum != MathML_EL_MSUP && |
elType.ElTypeNum != MathML_EL_MSUP && |
elType.ElTypeNum != MathML_EL_MUNDEROVER && |
elType.ElTypeNum != MathML_EL_MUNDEROVER && |
elType.ElTypeNum != MathML_EL_MUNDER && |
elType.ElTypeNum != MathML_EL_MUNDER && |
elType.ElTypeNum != MathML_EL_MUNDEROVER)) |
elType.ElTypeNum != MathML_EL_MUNDEROVER && |
|
elType.ElTypeNum != MathML_EL_MTD)) |
operator = el; |
operator = el; |
} |
} |
} |
} |
Line 731 void SetIntVertStretchAttr (Element el,
|
Line 753 void SetIntVertStretchAttr (Element el,
|
if (child != NULL) |
if (child != NULL) |
{ |
{ |
elType = TtaGetElementType (child); |
elType = TtaGetElementType (child); |
|
/* skip empty Constructs (placeholders) and comments */ |
|
while (child && |
|
(elType.ElTypeNum == MathML_EL_Construct || |
|
elType.ElTypeNum == MathML_EL_XMLcomment) && |
|
elType.ElSSchema == MathMLSSchema) |
|
{ |
|
TtaNextSibling (&child); |
|
if (child) |
|
elType = TtaGetElementType (child); |
|
} |
|
|
if (elType.ElTypeNum == base && elType.ElSSchema == MathMLSSchema) |
if (elType.ElTypeNum == base && elType.ElSSchema == MathMLSSchema) |
/* the first child is a Base or UnderOverBase */ |
/* the first child is a Base or UnderOverBase */ |
{ |
{ |
Line 738 void SetIntVertStretchAttr (Element el,
|
Line 771 void SetIntVertStretchAttr (Element el,
|
if (child != NULL) |
if (child != NULL) |
{ |
{ |
elType = TtaGetElementType (child); |
elType = TtaGetElementType (child); |
|
/* skip empty Constructs (placeholders) and comments */ |
|
while (child && |
|
(elType.ElTypeNum == MathML_EL_Construct || |
|
elType.ElTypeNum == MathML_EL_XMLcomment) && |
|
elType.ElSSchema == MathMLSSchema) |
|
{ |
|
TtaNextSibling (&child); |
|
if (child) |
|
elType = TtaGetElementType (child); |
|
} |
|
|
if (elType.ElTypeNum == MathML_EL_MO && |
if (elType.ElTypeNum == MathML_EL_MO && |
elType.ElSSchema == MathMLSSchema) |
elType.ElSSchema == MathMLSSchema) |
/* its first child is a MO */ |
/* its first significant child is a MO */ |
{ |
{ |
sibling = child; |
sibling = child; |
TtaNextSibling (&sibling); |
TtaNextSibling (&sibling); |
|
/* skip empty Constructs (placeholders) and comments */ |
|
while (sibling && |
|
(elType.ElTypeNum == MathML_EL_Construct || |
|
elType.ElTypeNum == MathML_EL_XMLcomment) && |
|
elType.ElSSchema == MathMLSSchema) |
|
{ |
|
TtaNextSibling (&sibling); |
|
if (sibling) |
|
elType = TtaGetElementType (sibling); |
|
} |
|
|
if (sibling == NULL) |
if (sibling == NULL) |
/* there is no other child */ |
/* there is no other significant child */ |
{ |
{ |
operator = child; |
operator = child; |
if (base == MathML_EL_Base || |
if (base == MathML_EL_Base || |
Line 776 void SetIntVertStretchAttr (Element el,
|
Line 831 void SetIntVertStretchAttr (Element el,
|
TtaGiveBufferContent (textEl, text, len+1, &lang); |
TtaGiveBufferContent (textEl, text, len+1, &lang); |
script = TtaGetScript (lang); |
script = TtaGetScript (lang); |
#ifdef _I18N_ |
#ifdef _I18N_ |
integral = TRUE; |
stretchable = TRUE; |
for (i = 0; i < len; i++) |
for (i = 0; i < len; i++) |
if (text[i] < 0x222B || text[i] > 0x2233) |
if ((text[i] < 0x222B || text[i] > 0x2233) && |
|
text[i] != 0x2191 && text[i] != 0x2193 && |
|
text[i] != 0x2195 && |
|
text[i] != 0x21D1 && text[i] != 0x21D3 && |
|
text[i] != 0x21D5) |
/* accept only symbols like simple integral, double or |
/* accept only symbols like simple integral, double or |
triple integral, contour integral, etc. */ |
triple integral, contour integral, etc. or vertical |
integral = FALSE; |
arrows (add more arrows *****) */ |
|
stretchable = FALSE; |
#else |
#else |
integral = FALSE; |
stretchable = FALSE; |
if (script == 'G') |
if (script == 'G') |
/* Adobe Symbol character set */ |
/* Adobe Symbol character set */ |
{ |
{ |
integral = TRUE; |
stretchable = TRUE; |
/* check all characters in this TEXT element */ |
/* check all characters in this TEXT element */ |
for (i = 0; i < len; i++) |
for (i = 0; i < len; i++) |
if (text[i] != 242) |
if (text[i] != 242 && /* integral */ |
|
text[i] != 173 && text[i] != 175 && /* arrows */ |
|
text[i] != 221 && text[i] != 223) /* double arrows */ |
/**** accept also other symbols like double or triple |
/**** accept also other symbols like double or triple |
integral, contour integral, etc. ****/ |
integral, contour integral, etc. ****/ |
integral = FALSE; |
stretchable = FALSE; |
} |
} |
#endif |
#endif |
if (integral) |
if (stretchable) |
/* the operator contains only integral symbols */ |
/* the operator contains only stretchable symbols */ |
{ |
{ |
/* attach a IntVertStretch attribute */ |
/* attach a IntVertStretch attribute */ |
attrType.AttrSSchema = MathMLSSchema; |
attrType.AttrSSchema = MathMLSSchema; |
Line 809 void SetIntVertStretchAttr (Element el,
|
Line 871 void SetIntVertStretchAttr (Element el,
|
el, doc); |
el, doc); |
TtaRegisterAttributeCreate (attr, el, doc); |
TtaRegisterAttributeCreate (attr, el, doc); |
|
|
/* replace the Integral characters by a Thot SYMBOL |
/* replace the stretchable characters by a Thot SYMBOL |
element. If there are several such characters in |
element. If there are several such characters in |
the mo (multiple integral), replace them too. */ |
the mo (multiple integral for instance), replace |
|
them too. */ |
do |
do |
{ |
{ |
/* replace the TEXT element by a Thot SYMBOL */ |
/* replace the TEXT element by a Thot SYMBOL */ |
elType.ElTypeNum = MathML_EL_SYMBOL_UNIT; |
|
elType.ElSSchema = MathMLSSchema; |
elType.ElSSchema = MathMLSSchema; |
|
elType.ElTypeNum = MathML_EL_SYMBOL_UNIT; |
for (i = 0; i < len; i++) |
for (i = 0; i < len; i++) |
|
{ |
|
if (selEl != NULL) |
|
if (*selEl == textEl) |
|
*selEl = symbolEl; |
#ifdef _I18N_ |
#ifdef _I18N_ |
if (text[i] >= 0x222B && text[i] <= 0x2233) |
if (text[i] == 0x222B) |
|
c = 'i'; |
|
else if (text[i] == 0x222C) |
|
c = 'd'; |
|
else if (text[i] == 0x222D) |
|
c = 't'; |
|
else if (text[i] == 0x222E) |
|
c = 'c'; |
|
else if (text[i] == 0x2191) |
|
c = '^'; |
|
else if (text[i] == 0x2193) |
|
c = 'V'; |
#else |
#else |
if (text[i] == 242) |
if (text[i] == 242) |
#endif |
|
{ |
|
symbolEl = TtaNewElement (doc, elType); |
|
TtaInsertSibling (symbolEl, textEl, TRUE,doc); |
|
if (selEl != NULL) |
|
if (*selEl == textEl) |
|
*selEl = symbolEl; |
|
c = 'i'; |
c = 'i'; |
TtaSetGraphicsShape (symbolEl, c, doc); |
else if (text[i] == 173) |
TtaRegisterElementCreate (symbolEl, doc); |
c = '<'; |
} |
else if (text[i] == 175) |
|
c = '>'; |
|
#endif |
|
symbolEl = TtaNewElement (doc, elType); |
|
TtaInsertSibling (symbolEl, textEl, TRUE,doc); |
|
TtaSetGraphicsShape (symbolEl, c, doc); |
|
TtaRegisterElementCreate (symbolEl, doc); |
|
} |
TtaRegisterElementDelete (textEl, doc); |
TtaRegisterElementDelete (textEl, doc); |
TtaDeleteTree (textEl, doc); |
TtaDeleteTree (textEl, doc); |
/* is there an other text element after the |
/* is there an other text element after the |
integral symbol? */ |
stretchable symbol? */ |
textEl = symbolEl; TtaNextSibling (&textEl); |
textEl = symbolEl; TtaNextSibling (&textEl); |
if (textEl) |
if (textEl) |
{ |
{ |
Line 845 void SetIntVertStretchAttr (Element el,
|
Line 923 void SetIntVertStretchAttr (Element el,
|
textEl = NULL; |
textEl = NULL; |
else |
else |
/* there is another text element. |
/* there is another text element. |
Is it a single integral symbol? */ |
Is it a single stretchable symbol? */ |
{ |
{ |
len = TtaGetElementVolume (textEl); |
len = TtaGetElementVolume (textEl); |
if (len < 1) |
if (len < 1) |
Line 859 void SetIntVertStretchAttr (Element el,
|
Line 937 void SetIntVertStretchAttr (Element el,
|
len+1, &lang); |
len+1, &lang); |
script = TtaGetScript (lang); |
script = TtaGetScript (lang); |
#ifdef _I18N_ |
#ifdef _I18N_ |
if (text[i] < 0x222B || text[i] > 0x2233) |
if (text[i] != 0x222B && |
|
text[i] != 0x222C && |
|
text[i] != 0x222D && |
|
text[i] != 0x222E && |
|
text[i] != 0x2191 && |
|
text[i] != 0x2193) |
#else |
#else |
if (script != 'G' || text[0] != 242) |
if (script != 'G' || |
|
(text[i] != 242 && text[i] != 173 && |
|
text[i] != 175)) |
#endif |
#endif |
/* not an integral*/ |
/* not a stretchable symbol */ |
textEl = NULL; |
textEl = NULL; |
} |
} |
} |
} |
Line 1262 void CheckMTable (Element elMTABLE, Docu
|
Line 1347 void CheckMTable (Element elMTABLE, Docu
|
} |
} |
if (elType.ElTypeNum == MathML_EL_MTD) |
if (elType.ElTypeNum == MathML_EL_MTD) |
/* This is a MTD element. Wrap its contents with a CellWrapper */ |
/* This is a MTD element. Wrap its contents with a CellWrapper */ |
CreateWrapper (cell, MathML_EL_CellWrapper, doc); |
{ |
|
CreateWrapper (cell, MathML_EL_CellWrapper, doc); |
|
SetIntHorizStretchAttr (cell, doc); |
|
SetIntVertStretchAttr (cell, doc, MathML_EL_CellWrapper, NULL); |
|
} |
cell = nextCell; |
cell = nextCell; |
} |
} |
row = nextRow; |
row = nextRow; |