LCOV - code coverage report
Current view: directory - layout/mathml - nsMathMLmtableFrame.h (source / functions) Found Hit Coverage
Test: app.info Lines: 48 0 0.0 %
Date: 2012-06-02 Functions: 19 0 0.0 %

       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
       4                 :  *
       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/
       9                 :  *
      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
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is Mozilla MathML Project.
      16                 :  *
      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.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Roger B. Sidje <rbs@maths.uq.edu.au>
      24                 :  *
      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.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #ifndef nsMathMLmtableFrame_h___
      40                 : #define nsMathMLmtableFrame_h___
      41                 : 
      42                 : #include "nsCOMPtr.h"
      43                 : #include "nsMathMLContainerFrame.h"
      44                 : 
      45                 : //
      46                 : // <mtable> -- table or matrix
      47                 : //
      48                 : 
      49                 : class nsMathMLmtableOuterFrame : public nsTableOuterFrame,
      50                 :                                  public nsMathMLFrame
      51                 : {
      52                 : public:
      53                 :   friend nsIFrame* NS_NewMathMLmtableOuterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
      54                 : 
      55                 :   NS_DECL_QUERYFRAME
      56                 :   NS_DECL_FRAMEARENA_HELPERS
      57                 : 
      58                 :   // Overloaded nsIMathMLFrame methods
      59                 : 
      60                 :   NS_IMETHOD
      61                 :   InheritAutomaticData(nsIFrame* aParent);
      62                 : 
      63                 :   NS_IMETHOD
      64                 :   UpdatePresentationData(PRUint32 aFlagsValues,
      65                 :                          PRUint32 aWhichFlags);
      66                 : 
      67                 :   NS_IMETHOD
      68                 :   UpdatePresentationDataFromChildAt(PRInt32         aFirstIndex,
      69                 :                                     PRInt32         aLastIndex,
      70                 :                                     PRUint32        aFlagsValues,
      71                 :                                     PRUint32        aWhichFlags);
      72                 : 
      73                 :   // overloaded nsTableOuterFrame methods
      74                 : 
      75                 :   NS_IMETHOD
      76                 :   Reflow(nsPresContext*          aPresContext,
      77                 :          nsHTMLReflowMetrics&     aDesiredSize,
      78                 :          const nsHTMLReflowState& aReflowState,
      79                 :          nsReflowStatus&          aStatus);
      80                 : 
      81                 :   NS_IMETHOD
      82                 :   AttributeChanged(PRInt32  aNameSpaceID,
      83                 :                    nsIAtom* aAttribute,
      84                 :                    PRInt32  aModType);
      85                 : 
      86               0 :   virtual bool IsFrameOfType(PRUint32 aFlags) const
      87                 :   {
      88               0 :     return nsTableOuterFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
      89                 :   }
      90                 : 
      91                 : protected:
      92               0 :   nsMathMLmtableOuterFrame(nsStyleContext* aContext) : nsTableOuterFrame(aContext) {}
      93                 :   virtual ~nsMathMLmtableOuterFrame();
      94                 : 
      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
      98                 :   nsIFrame*
      99                 :   GetRowFrameAt(nsPresContext* aPresContext,
     100                 :                 PRInt32         aRowIndex);
     101                 : }; // class nsMathMLmtableOuterFrame
     102                 : 
     103                 : // --------------
     104                 : 
     105                 : class nsMathMLmtableFrame : public nsTableFrame
     106                 : {
     107                 : public:
     108                 :   NS_DECL_FRAMEARENA_HELPERS
     109                 : 
     110                 :   friend nsIFrame* NS_NewMathMLmtableFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
     111                 : 
     112                 :   // Overloaded nsTableFrame methods
     113                 : 
     114                 :   NS_IMETHOD
     115                 :   SetInitialChildList(ChildListID  aListID,
     116                 :                       nsFrameList& aChildList);
     117                 : 
     118                 :   NS_IMETHOD
     119               0 :   AppendFrames(ChildListID  aListID,
     120                 :                nsFrameList& aFrameList)
     121                 :   {
     122               0 :     nsresult rv = nsTableFrame::AppendFrames(aListID, aFrameList);
     123               0 :     RestyleTable();
     124               0 :     return rv;
     125                 :   }
     126                 : 
     127                 :   NS_IMETHOD
     128               0 :   InsertFrames(ChildListID aListID,
     129                 :                nsIFrame* aPrevFrame,
     130                 :                nsFrameList& aFrameList)
     131                 :   {
     132               0 :     nsresult rv = nsTableFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
     133               0 :     RestyleTable();
     134               0 :     return rv;
     135                 :   }
     136                 : 
     137                 :   NS_IMETHOD
     138               0 :   RemoveFrame(ChildListID aListID,
     139                 :               nsIFrame* aOldFrame)
     140                 :   {
     141               0 :     nsresult rv = nsTableFrame::RemoveFrame(aListID, aOldFrame);
     142               0 :     RestyleTable();
     143               0 :     return rv;
     144                 :   }
     145                 : 
     146               0 :   virtual bool IsFrameOfType(PRUint32 aFlags) const
     147                 :   {
     148               0 :     return nsTableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
     149                 :   }
     150                 : 
     151                 :   // helper to restyle and reflow the table when a row is changed -- since MathML
     152                 :   // attributes are inter-dependent and row/colspan can affect the table, it is
     153                 :   // safer (albeit grossly suboptimal) to just relayout the whole thing.
     154                 :   void RestyleTable();
     155                 : 
     156                 : protected:
     157               0 :   nsMathMLmtableFrame(nsStyleContext* aContext) : nsTableFrame(aContext) {}
     158                 :   virtual ~nsMathMLmtableFrame();
     159                 : }; // class nsMathMLmtableFrame
     160                 : 
     161                 : // --------------
     162                 : 
     163                 : class nsMathMLmtrFrame : public nsTableRowFrame
     164                 : {
     165                 : public:
     166                 :   NS_DECL_FRAMEARENA_HELPERS
     167                 : 
     168                 :   friend nsIFrame* NS_NewMathMLmtrFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
     169                 : 
     170                 :   // overloaded nsTableRowFrame methods
     171                 : 
     172                 :   NS_IMETHOD
     173                 :   AttributeChanged(PRInt32  aNameSpaceID,
     174                 :                    nsIAtom* aAttribute,
     175                 :                    PRInt32  aModType);
     176                 : 
     177                 :   NS_IMETHOD
     178               0 :   AppendFrames(ChildListID  aListID,
     179                 :                nsFrameList& aFrameList)
     180                 :   {
     181               0 :     nsresult rv = nsTableRowFrame::AppendFrames(aListID, aFrameList);
     182               0 :     RestyleTable();
     183               0 :     return rv;
     184                 :   }
     185                 : 
     186                 :   NS_IMETHOD
     187               0 :   InsertFrames(ChildListID aListID,
     188                 :                nsIFrame* aPrevFrame,
     189                 :                nsFrameList& aFrameList)
     190                 :   {
     191               0 :     nsresult rv = nsTableRowFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
     192               0 :     RestyleTable();
     193               0 :     return rv;
     194                 :   }
     195                 : 
     196                 :   NS_IMETHOD
     197               0 :   RemoveFrame(ChildListID aListID,
     198                 :               nsIFrame* aOldFrame)
     199                 :   {
     200               0 :     nsresult rv = nsTableRowFrame::RemoveFrame(aListID, aOldFrame);
     201               0 :     RestyleTable();
     202               0 :     return rv;
     203                 :   }
     204                 : 
     205               0 :   virtual bool IsFrameOfType(PRUint32 aFlags) const
     206                 :   {
     207               0 :     return nsTableRowFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
     208                 :   }
     209                 : 
     210                 :   // helper to restyle and reflow the table -- @see nsMathMLmtableFrame.
     211               0 :   void RestyleTable()
     212                 :   {
     213               0 :     nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
     214               0 :     if (tableFrame && tableFrame->IsFrameOfType(nsIFrame::eMathML)) {
     215                 :       // relayout the table
     216               0 :       ((nsMathMLmtableFrame*)tableFrame)->RestyleTable();
     217                 :     }
     218               0 :   }
     219                 : 
     220                 : protected:
     221               0 :   nsMathMLmtrFrame(nsStyleContext* aContext) : nsTableRowFrame(aContext) {}
     222                 :   virtual ~nsMathMLmtrFrame();
     223                 : }; // class nsMathMLmtrFrame
     224                 : 
     225                 : // --------------
     226                 : 
     227                 : class nsMathMLmtdFrame : public nsTableCellFrame
     228                 : {
     229                 : public:
     230                 :   NS_DECL_FRAMEARENA_HELPERS
     231                 : 
     232                 :   friend nsIFrame* NS_NewMathMLmtdFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
     233                 : 
     234                 :   // overloaded nsTableCellFrame methods
     235                 : 
     236                 :   NS_IMETHOD
     237                 :   AttributeChanged(PRInt32  aNameSpaceID,
     238                 :                    nsIAtom* aAttribute,
     239                 :                    PRInt32  aModType);
     240                 : 
     241                 :   virtual PRInt32 GetRowSpan();
     242                 :   virtual PRInt32 GetColSpan();
     243               0 :   virtual bool IsFrameOfType(PRUint32 aFlags) const
     244                 :   {
     245               0 :     return nsTableCellFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
     246                 :   }
     247                 : 
     248                 : protected:
     249               0 :   nsMathMLmtdFrame(nsStyleContext* aContext) : nsTableCellFrame(aContext) {}
     250                 :   virtual ~nsMathMLmtdFrame();
     251                 : }; // class nsMathMLmtdFrame
     252                 : 
     253                 : // --------------
     254                 : 
     255                 : class nsMathMLmtdInnerFrame : public nsBlockFrame,
     256                 :                               public nsMathMLFrame {
     257                 : public:
     258                 :   friend nsIFrame* NS_NewMathMLmtdInnerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
     259                 : 
     260                 :   NS_DECL_QUERYFRAME
     261                 :   NS_DECL_FRAMEARENA_HELPERS
     262                 : 
     263                 :   // Overloaded nsIMathMLFrame methods
     264                 : 
     265                 :   NS_IMETHOD
     266               0 :   UpdatePresentationDataFromChildAt(PRInt32         aFirstIndex,
     267                 :                                     PRInt32         aLastIndex,
     268                 :                                     PRUint32        aFlagsValues,
     269                 :                                     PRUint32        aFlagsToUpdate)
     270                 :   {
     271                 :     nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(this,
     272               0 :       aFirstIndex, aLastIndex, aFlagsValues, aFlagsToUpdate);
     273               0 :     return NS_OK;
     274                 :   }
     275                 : 
     276                 :   NS_IMETHOD
     277                 :   Reflow(nsPresContext*          aPresContext,
     278                 :          nsHTMLReflowMetrics&     aDesiredSize,
     279                 :          const nsHTMLReflowState& aReflowState,
     280                 :          nsReflowStatus&          aStatus);
     281                 : 
     282               0 :   virtual bool IsFrameOfType(PRUint32 aFlags) const
     283                 :   {
     284                 :     return nsBlockFrame::IsFrameOfType(aFlags &
     285               0 :       ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace));
     286                 :   }
     287                 : 
     288                 : protected:
     289               0 :   nsMathMLmtdInnerFrame(nsStyleContext* aContext) : nsBlockFrame(aContext) {}
     290                 :   virtual ~nsMathMLmtdInnerFrame();
     291                 : 
     292               0 :   virtual PRIntn GetSkipSides() const { return 0; }
     293                 : };  // class nsMathMLmtdInnerFrame
     294                 : 
     295                 : #endif /* nsMathMLmtableFrame_h___ */

Generated by: LCOV version 1.7