Esempio n. 1
0
		/// <summary>
		/// creates a new MathMLOperatorElement. 
		/// </summary>
		/// <param name="prefix">The prefix of the new element (if any).</param>
		/// <param name="localName">The local name of the new element.</param>
		/// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
		/// <param name="doc">The owner document</param>
		public MathMLMultiScriptsElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
			: base(prefix, localName, namespaceURI, doc)
		{
		}
Esempio n. 2
0
		/// <summary>
		/// creates a new MathMLOperatorElement. 
		/// </summary>
		/// <param name="prefix">The prefix of the new element (if any).</param>
		/// <param name="localName">The local name of the new element.</param>
		/// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
		/// <param name="doc">The owner document</param>
		internal MathMLContentToken(string prefix, string localName, string namespaceURI, MathMLDocument doc)
			: base(prefix, localName, namespaceURI, doc)
		{
			arguments = new MathMLArgumentsList(this);
		}
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 public MathMLXMLAnnotationElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
 }
Esempio n. 4
0
		/// <summary>
		/// creates a new MathMLOperatorElement. 
		/// </summary>
		/// <param name="prefix">The prefix of the new element (if any).</param>
		/// <param name="localName">The local name of the new element.</param>
		/// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
		/// <param name="doc">The owner document</param>
		public MathMLLabeledRowElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
			: base(prefix, localName, namespaceURI, doc)
		{
		}
Esempio n. 5
0
		/// <summary>
		/// creates a new MathMLOperatorElement. 
		/// </summary>
		/// <param name="prefix">The prefix of the new element (if any).</param>
		/// <param name="localName">The local name of the new element.</param>
		/// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
		/// <param name="doc">The owner document</param>
		public MathMLAlignGroupElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
			: base(prefix, localName, namespaceURI, doc)
		{
		}
Esempio n. 6
0
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 internal MathMLContentToken(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
     arguments = new MathMLArgumentsList(this);
 }
Esempio n. 7
0
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 public MathMLPresentationToken(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
 }
Esempio n. 8
0
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 public MathMLLabeledRowElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
 }
Esempio n. 9
0
        /// <summary>
        /// This function removes all attributes from MathML tags, and all comments from the MO and MI tokens that have them.  
        /// This is accomplished by walking the MathML DOM.  The resultant string will be much easier to read.
        /// </summary>
        /// <param name="xml">The string representing the MathML to clean up.</param>
        /// <returns>A string representing cleaned up MathML.</returns>
        private string RemoveXmlAttributesFromMathString( string mathStr )
        {
            // We will recreate the MathML string from walking the string as an XML document.
            string answer = "";

            // First, attempt to place the string within a MathML DOM.  This can fail for numerous reasons, but none of them
            //   should be fatal to the operation of WAVES.  If it does fail, let the user know why, and abort Paste/Import.
            MathMLDocument mathml = new MathMLDocument();

            try {
                mathml.InnerXml = mathStr;
            }
            catch( Exception theError ) {
                MessageBox.Show( "This MathML document is malformed:\n\n  " + theError.Message + "\n\nFix the source MathML and try again.", "WAVES_Token_Toolbar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
                return null;
            }

            // Retrieve the Namespace URL from the DocumentElement
            mathTagNameSpaceUrl = mathml.DocumentElement.NamespaceURI;
            if( ( mathTagNameSpaceUrl == "" ) & ( nameSpace == "" ) )
                mathTagNameSpaceUrl = "http://www.w3.org/1998/Math/MathML";

            // Walk the DOM we've created, recreating the MathML string as we go.
            answer = RemoveAttributesFromNode( mathml.DocumentElement );

            return answer;
        }
Esempio n. 10
0
        // *******************************************************************************************************************
        //   The following functions are instrumental in working with MathML excerpts, excerptIDs, MathML tags
        //     for display and editing purposes.  They're really quite handy.
        // *******************************************************************************************************************
        /// <summary>
        /// Attempts to update the renderer with the working MathML string.  If this fails, a warning label appears indicating
        ///   a problem within the MathML.
        /// </summary>
        private void UpdateMathmlRenderer()
        {
            // Attempt to render the formula in the MathML Rendering control.  This can fail, if some
            //   tags don't have the correct number of arguments.
            try {
                // Reset Rendering control
                MATHML_Display.ResetText();

                if( XmlText.IndexOf( "<math" ) == -1 )
                    XmlText = "<math>" + XmlText + "</math>";

                // Re-instantiate MathMLDocument, if an error in rendering happens, it must be
                //   re-instantiated in order to be rendered.
                doc = null;
                doc = new MathMLDocument();
                string xmlNoInvisPlus = XmlText.Replace( "⁤", "⁢" );
                doc.InnerXml = xmlNoInvisPlus;

                // Show the formula
                MATHML_Display.MathElement = ( MathMLMathElement )doc.DocumentElement;

                // If we got here, everything went smoothly.  The warning is not needed.
                LABEL_Warning.Visible = false;
            }
            catch {
                // The Rendering control could not render the formula properly.  There is a problem in
                //   the formula somewhere; alert the user.
                LABEL_Warning.Visible = true;
            }

            if( MENU_View_MathJax.Checked ) {
                // Update the MathJax Renderer if necessary
                //BROWSER_MathJaxRenderer
                UpdateMathJaxRenderer();
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Takes MathML in the form of a String (cutified or no), and configures the WAVES Toolbar to edit it as a formula.
        /// </summary>
        /// <param name="s">A string representing the MathML to convert to a formula.</param>
        private void ConstructFormulaFromMathmlString( string s )
        {
            // Remove all line breaks, with their trailing whitespaces.  Essentially, de-cutify the mathml.
            for( int i = 100; i > -1; i -= 2 ) {
                string ws = "";
                for( int j = 0; j < i; j++ )
                    ws += " ";
                ws = "\n" + ws;

                s = s.Replace( ws, "" );
            }
            s = s.Replace( "\r", "" );

            // Determine the namespace ID of the <math> tag, if any.  This will be the namespace ID that all tags will share in this formula.
            int mathLength = s.IndexOf( '>' ) + 1;
            string mathTag = s.Substring( 0, s.IndexOf( '>' ) + 1 );

            if ( mathTag.IndexOf( ':' ) > 0 )
                nameSpace = mathTag.Substring( 1, mathTag.IndexOf( ':', 0 ) );
            if ( nameSpace.Contains( "http" ) )
                nameSpace = "";

            // Remove all namespacing for the purposes of editing and displaying the MathML
            if ( ( nameSpace != "" ) & ( nameSpace != null ) ) {
                s = s.Replace( nameSpace, "" );
                mathTag = mathTag.Replace( nameSpace, "" );
            }

            // Remove all extraneous attributes from the all MathML tags, and remove any MathML <!-- comments -->...
            //   This will be in case we retrieved MathML with ID and width tags, among others
            s = RemoveXmlAttributesFromMathString( s );

            // Must reset the document for display in the MathML Renderer
            doc = null;
            doc = new MathMLDocument();

            if( s != null ) {
                // This converts all Invisible Plus tokens to Invisible Times tokens for purposes of rendering.
                //   This is done because Invisible Plus renders as a ridiculously huge space.
                string xmlNoInvisPlus = s.Replace( "⁤", "⁢" );
                doc.InnerXml = xmlNoInvisPlus;

                if( doc.DocumentElement.Name != "math" ) {
                    MessageBox.Show( "This MathML document is malformed:\n\n  The root element must be a \"math\" element.\n\nFix the source MathML and try again.", "WAVES_Token_Toolbar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
                    ClearFormula();
                    return;
                }

                // Remove the <math> wrapper from the long XML string.  By this point, the opening <math> tag has been
                //   converted to a tag without attributes.
                string innerS = s.Replace( "<math>", "" );
                innerS = innerS.Replace( "</math>", "" );

                // Clear the Listbox to prepare it for receiving the new formula
                LISTBOX_ShowExcerpts.Items.Clear();
                xmlPiece.Clear();
                for( int i = 0; i < idTaken.Count(); i++ )
                    idTaken[ i ] = false;

                // For multi-line formulas, we would need to parse MathML more than just once!
                //   And even still, the MathML renderer only does one-line rendering.
                //   Therefore, Mspace/Msytle/Mphantom would need to be supported for multi-line rendering.

                ParseMathMLtoList( innerS, 0 );

                xmlPiece.Sort();
                for( int i = 0; i < xmlPiece.Count; i++ )
                    xmlPiece[ i ] = xmlPiece[ i ].Substring( 6 );

                for( int i = 0; i < xmlPiece.Count(); i++ ) {
                    LISTBOX_ShowExcerpts.Items.Add( TagifyID( i ) + "-<" + GetExcerptDescription( xmlPiece[ i ], i ) + ">  " + DeXml( xmlPiece[ i ] ) );
                }

                XmlText = ParseMathList( 0 );
                UndoLock = true;
                LISTBOX_ShowExcerpts.SelectedIndex = 0;
                UndoLock = false;

                // Reset Undo structure
            }
            else {
                // Something did not work in the DOM-ification of the MathML string...
                ClearFormula();
                return;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Clears the working MathML formula and sets up the Toolbar workspace again.  
        /// </summary>
        private void ClearFormula()
        {
            // This check is necessary, since when the workspace is initialized for the first time,
            //   the Listbox has no items to select!
            if( LISTBOX_ShowExcerpts.Items.Count > 0 )
                LISTBOX_ShowExcerpts.SelectedIndex = 0;

            // Clear the Lists
            UndoLock = true;
            LISTBOX_ShowExcerpts.Items.Clear();
            xmlPiece.Clear();
            UndoReset();

            // Clear the namespace identifier, but add a URL to the <math> token eventually
            nameSpace = "";
            mathTagNameSpaceUrl = "http://www.w3.org/1998/Math/MathML";

            // Add an empty 1st element
            xmlPiece.Add( "<mrow></mrow>" );

            // Update the running MathML formula
            string l = ParseMathList( 0 );
            XmlText = "<math>" + l + "</math>";

            try {
                doc = null;
                doc = new MathMLDocument();
            }
            catch { }

            // This converts all Invisible Plus tokens to Invisible Times tokens for purposes of rendering.
            //   This is done because Invisible Plus renders as a ridiculously huge space.
            string xmlNoInvisPlus = XmlText.Replace( "⁤", "⁢" );
            doc.InnerXml = xmlNoInvisPlus;
            //doc.InnerXml = XmlText;

            UpdateMultiFunctionButton();

            // Set up the ListBox for adding stuff again
            LISTBOX_ShowExcerpts.Items.Add( TagifyID( 0 ) + "-<" + GetExcerptDescription( xmlPiece[ 0 ], 0 ) + ">  " + DeXml( xmlPiece[ 0 ] ) );
            TEXTBOX_MathExpression.Text = "";

            LISTBOX_ShowExcerpts.SelectedIndex = 0;

            UndoLock = false;
        }
Esempio n. 13
0
 /// <summary>
 /// creates a new MathMLElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 public MathMLElement(String prefix, String localName, String namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
     // intiialize the user data to be store an area
     userData[0].key = AreaGuid;
 }
Esempio n. 14
0
		/// <summary>
		/// creates a new MathMLOperatorElement. 
		/// </summary>
		/// <param name="prefix">The prefix of the new element (if any).</param>
		/// <param name="localName">The local name of the new element.</param>
		/// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
		/// <param name="doc">The owner document</param>		
		public MathMLMathElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
			: base(prefix, localName, namespaceURI, doc)
		{
			container_impl = new MathMLContainerImpl(this);
		}
Esempio n. 15
0
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 public MathMLSemanticsElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
 }
Esempio n. 16
0
		/// <summary>
		/// creates a new MathMLOperatorElement. 
		/// </summary>
		/// <param name="prefix">The prefix of the new element (if any).</param>
		/// <param name="localName">The local name of the new element.</param>
		/// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
		/// <param name="doc">The owner document</param>
		public MathMLPlaceholderElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
			: base(prefix, localName, namespaceURI, doc)
		{
		}
Esempio n. 17
0
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 public MathMLPresentationContainer(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
     container = new MathMLContainerImpl(this);
 }
Esempio n. 18
0
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 internal MathMLDeclareElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
 }
Esempio n. 19
0
        /// <summary>
        /// format an apply element
        /// </summary>
        /// <param name="e"></param>
        /// <param name="args"></param>
        /// <returns></returns>
		public object Visit(MathMLApplyElement e, object args) 
		{
			Area cache = Area.GetArea(e);
			if(cache != null) return cache;

            // document to create tmp elements
			MathMLDocument document = new MathMLDocument();
			Area area = null;
			IFormattingContext ctx = ((IFormattingContext)args).Clone();			

			if(e.Operator is MathMLPredefinedSymbol)
			{
				MathMLPredefinedSymbol predefSymbol = (MathMLPredefinedSymbol)e.Operator;
				PredefinedSymbolInfo info = PredefinedSymbolInfo.Get(predefSymbol.Name);
				if(info != null)
				{
					switch(info.Type)
					{
						case PredefinedSymbolType.Function:
						{
							MathMLNodeList arguments = e.Arguments;
							ArrayList argList = new ArrayList(arguments.Count);
							foreach(Object o in arguments)
							{
								argList.Add(o);
							}
							Area[] areas = new Area[3];
							areas[0] = AreaFactory.String(ctx, info.Value);
							areas[1] = GlyphFactory.GetGlyph(ctx, ctx.Size, PredefinedSymbolInfo.ApplyFunction[0]);
							ctx.Parens = false;
							areas[2] = FormatFencedContainer(e, ctx, argList, new Char[] {','}, "(", ")");
							area = AreaFactory.Horizontal(areas);							
						} break;
						case PredefinedSymbolType.Fraction:
						{
							bool parens = ctx.Parens;
							ctx.Parens = false;
							IEnumerator arguments = e.Arguments.GetEnumerator();
							arguments.MoveNext();
							MathMLElement n = (MathMLElement)arguments.Current;
							Area numerator = (Area)n.Accept(this, ctx);
							// idea is we can have lots of arguments, so keep dividing the numerator
							// by the denominator
							while(arguments.MoveNext())
							{
								MathMLElement d = (MathMLElement)arguments.Current;
								Area denominator = (Area)d.Accept(this, ctx);
								numerator = AreaFactory.Fraction(ctx, numerator, denominator, 5);
							}
							area = numerator;

							if(parens)
							{
								area = FenceArea(ctx, area, ctx.Size, '(', ')');
							}
							
						} break;
						case PredefinedSymbolType.Infix:
						{							
							// make a MathMLOperatorElement for the operator symbol
							MathMLOperatorElement opElement = (MathMLOperatorElement)document.CreateElement("mo");
							XmlNode text = opElement.OwnerDocument.CreateTextNode(info.Value);
							opElement.AppendChild(text);

							int argCount = e.ArgumentCount;

							// count of items + operators
							int itemCount = 2 * argCount - 1;
							
							// list of items to format
							ArrayList items = new ArrayList(itemCount + (info.Parens && ctx.Parens ? 2 : 0));

							// only one arg, so make it a prefix op
							if(argCount == 1)
							{
								items.Add(opElement);
								IEnumerator en = e.Arguments.GetEnumerator();
								en.MoveNext();
								items.Add(en.Current);
							}
							else
							{
								foreach(MathMLElement arg in e.Arguments)
								{
									items.Add(arg);
									if(items.Count + 1 < itemCount)
									{
										items.Add(opElement);
									}
								}
							}

							// add open and close parens if we want them
							if(info.Parens && ctx.Parens)
							{
								MathMLOperatorElement open = (MathMLOperatorElement)document.CreateElement("mo");
								MathMLOperatorElement close = (MathMLOperatorElement)document.CreateElement("mo");
								open.AppendChild(document.CreateTextNode("("));
								close.AppendChild(document.CreateTextNode(")"));
								items.Insert(0, open);
								items.Add(close);
							}

							ctx.Parens = info.ChildParens;						
							area = FormatContainer(e, ctx, items);
						
						} break;
						case PredefinedSymbolType.Postfix:
						{							
							// make a MathMLOperatorElement for the operator symbol
							MathMLOperatorElement opElement = (MathMLOperatorElement)document.CreateElement("mo");
							XmlNode text = opElement.OwnerDocument.CreateTextNode(info.Value);
							opElement.AppendChild(text);
							
							// list of items to format
							ArrayList items = new ArrayList(2 + (info.Parens && ctx.Parens ? 2 : 0));

							// a postfix element only expect one arg							
							IEnumerator en = e.Arguments.GetEnumerator();
							en.MoveNext();
							items.Add(en.Current);
							items.Add(opElement);
							

							// add open and close parens if we want them
							if(ctx.Parens && info.Parens)
							{
								MathMLOperatorElement open = (MathMLOperatorElement)document.CreateElement("mo");
								MathMLOperatorElement close = (MathMLOperatorElement)document.CreateElement("mo");
								open.AppendChild(document.CreateTextNode("("));
								close.AppendChild(document.CreateTextNode(")"));
								items.Insert(0, open);
								items.Add(close);
							}

							ctx.Parens = true;
							area = FormatContainer(e, ctx, items);
						
						} break;
						case PredefinedSymbolType.Root:
						{
							MathMLContentContainer indexElement = null;
							MathMLElement radicandElement = null;
							foreach(XmlNode node in e.ChildNodes)
							{
								if(node == e.Operator)
								{
									continue;
								}
								if(indexElement ==  null && node is MathMLContentContainer && node.Name == "degree")
								{
									indexElement = (MathMLContentContainer)node;
									continue;
								}

								if(radicandElement == null && node is MathMLElement)
								{
									radicandElement = (MathMLElement)node;
								}
							}
							if(radicandElement != null)
							{
                IFormattingContext indexCtx = ctx.Clone();
								indexCtx.ScriptLevel++;
								Area index = (Area)indexElement.Accept(this, indexCtx);
								area = AreaFactory.Radical(ctx, (Area)radicandElement.Accept(this, ctx), index);
							}
						} break;
						case PredefinedSymbolType.Power:
						{
							MathMLNodeList arguments = e.Arguments;
							int argCount = arguments.Count;
							
							Area bseArea = null, scriptArea = null;

							if(argCount > 0) 
							{
                IFormattingContext bseCtx = ctx.Clone();
								bseCtx.Parens = true;
								MathMLElement bse = (MathMLElement)arguments.Item(0);
								bseArea = (Area)bse.Accept(this, bseCtx);
							}

							if(argCount > 1)
							{
                IFormattingContext scriptCtx = ctx.Clone();
								scriptCtx.ScriptLevel++;
								scriptCtx.Parens = true;
								MathMLElement script = (MathMLElement)arguments.Item(1);
								scriptArea = (Area)script.Accept(this, scriptCtx);
							}
                            
							if(bseArea != null)
							{
								area = AreaFactory.Script(ctx, bseArea, null, new Length(LengthType.Undefined), 
									scriptArea, new Length(LengthType.Undefined));
							}
							else
							{
								// TODO error msg
							}
						} break;
						case PredefinedSymbolType.Exp:
						{
							MathMLNodeList arguments = e.Arguments;
							int argCount = arguments.Count;
							
							Area bseArea = null, scriptArea = null;

							MathMLElement baseElm = (MathMLElement)document.CreateElement("mi");
							baseElm.AppendChild(document.CreateTextNode(info.Value));
							bseArea = (Area)baseElm.Accept(this, ctx);

							if(argCount > 0)
							{
                IFormattingContext scriptCtx = ctx.Clone();
								scriptCtx.ScriptLevel++;
								scriptCtx.Parens = true;
								MathMLElement script = (MathMLElement)arguments.Item(0);
								scriptArea = (Area)script.Accept(this, scriptCtx);
							}
                            
							area = AreaFactory.Script(ctx, bseArea, null, new Length(LengthType.Undefined), 
									scriptArea, new Length(LengthType.Undefined));
				
						} break;
						case PredefinedSymbolType.Fenced:
						{
							MathMLNodeList arguments = e.Arguments;
							if(arguments.Count > 0)
							{
								MathMLElement argument = (MathMLElement)arguments.Item(0);
								ArrayList argList = new ArrayList(1);
								argList.Add(argument);
								area = FormatFencedContainer(argument, ctx, argList, new char[0], 
									info.Value[0].ToString(), info.Value[1].ToString());
							}

						} break;
						case PredefinedSymbolType.Log:
						{
							MathMLElement arg = null;
							ArrayList argList = new ArrayList(1);
							MathMLElement logbase = null;
							Area bseArea = AreaFactory.String(ctx, info.Value);
							Area logbaseArea = null;
							foreach(XmlNode n in e.ChildNodes)
							{
								if(n == e.Operator)
									continue;
								else if(logbase == null && n is MathMLElement && n.Name == "logbase")
								{
									logbase = (MathMLElement)n;
                  IFormattingContext scriptCtx = ctx.Clone();
									scriptCtx.ScriptLevel++;
									logbaseArea = (Area)logbase.Accept(this, scriptCtx);
									continue;
								}
								else if(arg == null && n is MathMLElement)
								{
                                    arg = (MathMLElement)n; 
                                    argList.Add(arg);    
								}
							}
							area = AreaFactory.Script(ctx, bseArea, logbaseArea, new Length(LengthType.Undefined), 
								null, new Length(LengthType.Undefined));
							Area[] areas = new Area[3];
							areas[0] = area;
							areas[1] = GlyphFactory.GetGlyph(ctx, ctx.Size, PredefinedSymbolInfo.ApplyFunction[0]);
							ctx.Parens = false;
							areas[2] = FormatFencedContainer(e, ctx, argList, new Char[] {','}, "(", ")");
							area = AreaFactory.Horizontal(areas);	


						} break;
					}
				}				
			}
			else if(e.Operator is MathMLApplyElement)
			{
				MathMLNodeList arguments = e.Arguments;
				ArrayList argList = new ArrayList(arguments.Count);
				foreach(Object o in arguments)
				{
					argList.Add(o);
				}
				Area[] areas = new Area[3];

				ctx.Parens = true;
				areas[0] = (Area)e.Operator.Accept(this, ctx);
				areas[1] = GlyphFactory.GetGlyph(ctx, ctx.Size, PredefinedSymbolInfo.ApplyFunction[0]);
				ctx.Parens = false;
				areas[2] = FormatFencedContainer(e, ctx, argList, new Char[] {','}, "(", ")");
				area = AreaFactory.Horizontal(areas);	
			}

			if(area == null)
			{
				area = AreaFactory.String((IFormattingContext)args, "?");
			}

			return CompleteArea(ctx, e, area);
		}
Esempio n. 20
0
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 public MathMLTableCellElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
 }
Esempio n. 21
0
		public object Visit(MathMLDocument e, object args)  
		{
			return AreaFactory.String((IFormattingContext)args, "?");
		}
Esempio n. 22
0
		/// <summary>
		/// creates a new MathMLOperatorElement. 
		/// </summary>
		/// <param name="prefix">The prefix of the new element (if any).</param>
		/// <param name="localName">The local name of the new element.</param>
		/// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
		/// <param name="doc">The owner document</param>
		internal MathMLDeclareElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
			: base(prefix, localName, namespaceURI, doc) {}
Esempio n. 23
0
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 public MathMLMathElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
     container_impl = new MathMLContainerImpl(this);
 }
Esempio n. 24
0
		/// <summary>
		/// creates a new MathMLOperatorElement. 
		/// </summary>
		/// <param name="prefix">The prefix of the new element (if any).</param>
		/// <param name="localName">The local name of the new element.</param>
		/// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
		/// <param name="doc">The owner document</param>
		public MathMLPresentationElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
			: base(prefix, localName, namespaceURI, doc)
		{
		}
Esempio n. 25
0
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 public MathMLPredefinedSymbol(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
 }
Esempio n. 26
0
		/// <summary>
		/// creates a new MathMLElement. 
		/// </summary>
		/// <param name="prefix">The prefix of the new element (if any).</param>
		/// <param name="localName">The local name of the new element.</param>
		/// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
		/// <param name="doc">The owner document</param>
		public MathMLElement(String prefix, String localName, String namespaceURI, MathMLDocument doc)
			: base(prefix, localName, namespaceURI, doc)
		{
			// intiialize the user data to be store an area
			userData[0].key = AreaGuid;
		}
Esempio n. 27
0
		/// <summary>
		/// creates a new MathMLOperatorElement. 
		/// </summary>
		/// <param name="prefix">The prefix of the new element (if any).</param>
		/// <param name="localName">The local name of the new element.</param>
		/// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
		/// <param name="doc">The owner document</param>
		public MathMLPredefinedSymbol(string prefix, string localName, string namespaceURI, MathMLDocument doc)
			: base(prefix, localName, namespaceURI, doc)
		{
		}
Esempio n. 28
0
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 public MathMLSeparator(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
 }
Esempio n. 29
0
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 public MathMLMultiScriptsElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
 }
Esempio n. 30
0
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 public MathMLAlignGroupElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
 }
Esempio n. 31
0
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 public MathMLPiecewiseElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
 }
Esempio n. 32
0
		/// <summary>
		/// creates a new MathMLOperatorElement. 
		/// </summary>
		/// <param name="prefix">The prefix of the new element (if any).</param>
		/// <param name="localName">The local name of the new element.</param>
		/// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
		/// <param name="doc">The owner document</param>
		public MathMLEncloseElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
			: base(prefix, localName, namespaceURI, doc)
		{
		}
Esempio n. 33
0
		/// <summary>
		/// creates a new MathMLOperatorElement. 
		/// </summary>
		/// <param name="prefix">The prefix of the new element (if any).</param>
		/// <param name="localName">The local name of the new element.</param>
		/// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
		/// <param name="doc">The owner document</param>
		public MathMLSeparator(string prefix, string localName, string namespaceURI, MathMLDocument doc)
			: base(prefix, localName, namespaceURI, doc)
		{
		}
Esempio n. 34
0
 /// <summary>
 /// creates a new MathMLOperatorElement.
 /// </summary>
 /// <param name="prefix">The prefix of the new element (if any).</param>
 /// <param name="localName">The local name of the new element.</param>
 /// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
 /// <param name="doc">The owner document</param>
 public MathMLUnderOverElement(string prefix, string localName, string namespaceURI, MathMLDocument doc)
     : base(prefix, localName, namespaceURI, doc)
 {
 }
Esempio n. 35
0
		/// <summary>
		/// creates a new MathMLOperatorElement. 
		/// </summary>
		/// <param name="prefix">The prefix of the new element (if any).</param>
		/// <param name="localName">The local name of the new element.</param>
		/// <param name="namespaceURI">The namespace URI of the new element (if any).</param>
		/// <param name="doc">The owner document</param>        
		public MathMLPresentationContainer(string prefix, string localName, string namespaceURI, MathMLDocument doc)
			: base(prefix, localName, namespaceURI, doc)
		{
			container = new MathMLContainerImpl(this);
		}