1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is Mozilla MathML Project.
17 * The Initial Developer of the Original Code is
18 * The University Of Queensland.
19 * Portions created by the Initial Developer are Copyright (C) 1999
20 * the Initial Developer. All Rights Reserved.
23 * Roger B. Sidje <rbs@maths.uq.edu.au>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #ifndef nsMathMLmtableFrame_h___
40 #define nsMathMLmtableFrame_h___
43 #include "nsMathMLContainerFrame.h"
46 // <mtable> -- table or matrix
49 class nsMathMLmtableOuterFrame
: public nsTableOuterFrame
,
53 friend nsIFrame
* NS_NewMathMLmtableOuterFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
55 NS_DECL_ISUPPORTS_INHERITED
57 // Overloaded nsIMathMLFrame methods
60 InheritAutomaticData(nsIFrame
* aParent
);
63 UpdatePresentationData(PRUint32 aFlagsValues
,
64 PRUint32 aWhichFlags
);
67 UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex
,
69 PRUint32 aFlagsValues
,
70 PRUint32 aWhichFlags
);
72 // overloaded nsTableOuterFrame methods
75 Reflow(nsPresContext
* aPresContext
,
76 nsHTMLReflowMetrics
& aDesiredSize
,
77 const nsHTMLReflowState
& aReflowState
,
78 nsReflowStatus
& aStatus
);
81 AttributeChanged(PRInt32 aNameSpaceID
,
85 virtual PRBool
IsFrameOfType(PRUint32 aFlags
) const
87 return nsTableOuterFrame::IsFrameOfType(aFlags
&
88 ~(nsIFrame::eMathML
| nsIFrame::eExcludesIgnorableWhitespace
));
92 nsMathMLmtableOuterFrame(nsStyleContext
* aContext
) : nsTableOuterFrame(aContext
) {}
93 virtual ~nsMathMLmtableOuterFrame();
95 // helper to find the row frame at a given index, positive or negative, e.g.,
96 // 1..n means the first row down to the last row, -1..-n means the last row
97 // up to the first row. Used for alignments that are relative to a given row
99 GetRowFrameAt(nsPresContext
* aPresContext
,
101 }; // class nsMathMLmtableOuterFrame
105 class nsMathMLmtableFrame
: public nsTableFrame
108 friend nsIFrame
* NS_NewMathMLmtableFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
110 NS_DECL_ISUPPORTS_INHERITED
112 // Overloaded nsTableFrame methods
115 SetInitialChildList(nsIAtom
* aListName
,
116 nsIFrame
* aChildList
);
119 AppendFrames(nsIAtom
* aListName
,
120 nsIFrame
* aFrameList
)
122 nsresult rv
= nsTableFrame::AppendFrames(aListName
, aFrameList
);
128 InsertFrames(nsIAtom
* aListName
,
129 nsIFrame
* aPrevFrame
,
130 nsIFrame
* aFrameList
)
132 nsresult rv
= nsTableFrame::InsertFrames(aListName
, aPrevFrame
, aFrameList
);
138 RemoveFrame(nsIAtom
* aListName
,
141 nsresult rv
= nsTableFrame::RemoveFrame(aListName
, aOldFrame
);
146 virtual PRBool
IsFrameOfType(PRUint32 aFlags
) const
148 return nsTableFrame::IsFrameOfType(aFlags
&
149 ~(nsIFrame::eMathML
| nsIFrame::eExcludesIgnorableWhitespace
));
152 // helper to restyle and reflow the table when a row is changed -- since MathML
153 // attributes are inter-dependent and row/colspan can affect the table, it is
154 // safer (albeit grossly suboptimal) to just relayout the whole thing.
158 nsMathMLmtableFrame(nsStyleContext
* aContext
) : nsTableFrame(aContext
) {}
159 virtual ~nsMathMLmtableFrame();
160 }; // class nsMathMLmtableFrame
164 class nsMathMLmtrFrame
: public nsTableRowFrame
167 friend nsIFrame
* NS_NewMathMLmtrFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
169 NS_DECL_ISUPPORTS_INHERITED
171 // overloaded nsTableRowFrame methods
174 AttributeChanged(PRInt32 aNameSpaceID
,
179 AppendFrames(nsIAtom
* aListName
,
180 nsIFrame
* aFrameList
)
182 nsresult rv
= nsTableRowFrame::AppendFrames(aListName
, aFrameList
);
188 InsertFrames(nsIAtom
* aListName
,
189 nsIFrame
* aPrevFrame
,
190 nsIFrame
* aFrameList
)
192 nsresult rv
= nsTableRowFrame::InsertFrames(aListName
, aPrevFrame
, aFrameList
);
198 RemoveFrame(nsIAtom
* aListName
,
201 nsresult rv
= nsTableRowFrame::RemoveFrame(aListName
, aOldFrame
);
206 virtual PRBool
IsFrameOfType(PRUint32 aFlags
) const
208 return nsTableRowFrame::IsFrameOfType(aFlags
&
209 ~(nsIFrame::eMathML
| nsIFrame::eExcludesIgnorableWhitespace
));
212 // helper to restyle and reflow the table -- @see nsMathMLmtableFrame.
215 nsTableFrame
* tableFrame
= nsTableFrame::GetTableFrame(this);
216 if (tableFrame
&& tableFrame
->IsFrameOfType(nsIFrame::eMathML
)) {
217 // relayout the table
218 ((nsMathMLmtableFrame
*)tableFrame
)->RestyleTable();
223 nsMathMLmtrFrame(nsStyleContext
* aContext
) : nsTableRowFrame(aContext
) {}
224 virtual ~nsMathMLmtrFrame();
225 }; // class nsMathMLmtrFrame
229 class nsMathMLmtdFrame
: public nsTableCellFrame
232 friend nsIFrame
* NS_NewMathMLmtdFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
234 NS_DECL_ISUPPORTS_INHERITED
236 // overloaded nsTableCellFrame methods
239 AttributeChanged(PRInt32 aNameSpaceID
,
243 virtual PRInt32
GetRowSpan();
244 virtual PRInt32
GetColSpan();
245 virtual PRBool
IsFrameOfType(PRUint32 aFlags
) const
247 return nsTableCellFrame::IsFrameOfType(aFlags
&
248 ~(nsIFrame::eMathML
| nsIFrame::eExcludesIgnorableWhitespace
));
252 nsMathMLmtdFrame(nsStyleContext
* aContext
) : nsTableCellFrame(aContext
) {}
253 virtual ~nsMathMLmtdFrame();
254 }; // class nsMathMLmtdFrame
258 class nsMathMLmtdInnerFrame
: public nsBlockFrame
,
259 public nsMathMLFrame
{
261 friend nsIFrame
* NS_NewMathMLmtdInnerFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
263 NS_DECL_ISUPPORTS_INHERITED
265 // Overloaded nsIMathMLFrame methods
268 UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex
,
270 PRUint32 aFlagsValues
,
271 PRUint32 aFlagsToUpdate
)
273 nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(this,
274 aFirstIndex
, aLastIndex
, aFlagsValues
, aFlagsToUpdate
);
279 Reflow(nsPresContext
* aPresContext
,
280 nsHTMLReflowMetrics
& aDesiredSize
,
281 const nsHTMLReflowState
& aReflowState
,
282 nsReflowStatus
& aStatus
);
284 virtual PRBool
IsFrameOfType(PRUint32 aFlags
) const
286 return nsBlockFrame::IsFrameOfType(aFlags
&
287 ~(nsIFrame::eMathML
| nsIFrame::eExcludesIgnorableWhitespace
));
291 nsMathMLmtdInnerFrame(nsStyleContext
* aContext
) : nsBlockFrame(aContext
) {}
292 virtual ~nsMathMLmtdInnerFrame();
294 virtual PRIntn
GetSkipSides() const { return 0; }
295 }; // class nsMathMLmtdInnerFrame
297 #endif /* nsMathMLmtableFrame_h___ */