Back to index

lightning-sunbird  0.9+nobinonly
nsMathMLmsqrtFrame.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is Mozilla MathML Project.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * The University Of Queensland.
00018  * Portions created by the Initial Developer are Copyright (C) 1999
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *   Roger B. Sidje <rbs@maths.uq.edu.au>
00023  *   David J. Fiddes <D.J.Fiddes@hw.ac.uk>
00024  *   Vilya Harvey <vilya@nag.co.uk>
00025  *   Shyjan Mahamud <mahamud@cs.cmu.edu>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either of the GNU General Public License Version 2 or later (the "GPL"),
00029  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #ifndef nsMathMLmsqrtFrame_h___
00042 #define nsMathMLmsqrtFrame_h___
00043 
00044 #include "nsCOMPtr.h"
00045 #include "nsMathMLContainerFrame.h"
00046 
00047 //
00048 // <msqrt> -- form a fraction from two subexpressions 
00049 //
00050 
00051 /*
00052 The MathML REC describes:
00053 
00054 The <msqrt> element is used to display square roots.
00055 The syntax for <msqrt> is:
00056   <msqrt> base </msqrt>
00057 
00058 Attributes of <msqrt> and <mroot>:
00059 
00060 None (except the attributes allowed for all MathML elements, listed in Section
00061 2.3.4). 
00062 
00063 The <mroot> element increments scriptlevel by 2, and sets displaystyle to
00064 "false", within index, but leaves both attributes unchanged within base. The
00065 <msqrt> element leaves both attributes unchanged within all its arguments.
00066 These attributes are inherited by every element from its rendering environment,
00067 but can be set explicitly only on <mstyle>. (See Section 3.3.4.) 
00068 */
00069 
00070 /*
00071 TODO:
00072 */
00073 
00074 class nsMathMLmsqrtFrame : public nsMathMLContainerFrame {
00075 public:
00076   friend nsresult NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
00077 
00078   virtual void
00079   SetAdditionalStyleContext(PRInt32          aIndex, 
00080                             nsStyleContext*  aStyleContext);
00081   virtual nsStyleContext*
00082   GetAdditionalStyleContext(PRInt32 aIndex) const;
00083 
00084   NS_IMETHOD
00085   Init(nsPresContext*  aPresContext,
00086        nsIContent*      aContent,
00087        nsIFrame*        aParent,
00088        nsStyleContext*  aContext,
00089        nsIFrame*        aPrevInFlow);
00090 
00091   NS_IMETHOD
00092   Reflow(nsPresContext*          aPresContext,
00093          nsHTMLReflowMetrics&     aDesiredSize,
00094          const nsHTMLReflowState& aReflowState,
00095          nsReflowStatus&          aStatus);
00096 
00097   NS_IMETHOD 
00098   Paint(nsPresContext*      aPresContext,
00099         nsIRenderingContext& aRenderingContext,
00100         const nsRect&        aDirtyRect,
00101         nsFramePaintLayer    aWhichLayer,
00102         PRUint32             aFlags = 0);
00103 
00104   NS_IMETHOD
00105   InheritAutomaticData(nsIFrame* aParent);
00106 
00107   NS_IMETHOD
00108   TransmitAutomaticData();
00109 
00110   // the base method doesn't deal fully with <msqrt> because it only
00111   // slides child frames and has no idea that we have a sqrt glyph that
00112   // is part of the flow without being a frame. We need to shift our
00113   // sqrt glyph too. 
00114   virtual nscoord
00115   FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize);
00116 
00117 protected:
00118   nsMathMLmsqrtFrame();
00119   virtual ~nsMathMLmsqrtFrame();
00120   
00121   virtual PRIntn GetSkipSides() const { return 0; }
00122 
00123   nsMathMLChar mSqrChar;
00124   nsRect       mBarRect;
00125 };
00126 
00127 #endif /* nsMathMLmsqrtFrame_h___ */
00128