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.org code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either of the GNU General Public License Version 2 or later (the "GPL"),
26 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 : /*
39 : * base class for rendering objects that can be split across lines,
40 : * columns, or pages
41 : */
42 :
43 : #ifndef nsSplittableFrame_h___
44 : #define nsSplittableFrame_h___
45 :
46 : #include "nsFrame.h"
47 :
48 : // Derived class that allows splitting
49 : class nsSplittableFrame : public nsFrame
50 0 : {
51 : public:
52 : NS_DECL_FRAMEARENA_HELPERS
53 :
54 : NS_IMETHOD Init(nsIContent* aContent,
55 : nsIFrame* aParent,
56 : nsIFrame* aPrevInFlow);
57 :
58 : virtual nsSplittableType GetSplittableType() const;
59 :
60 : virtual void DestroyFrom(nsIFrame* aDestructRoot);
61 :
62 : /*
63 : * Frame continuations can be either fluid or not:
64 : * Fluid continuations ("in-flows") are the result of line breaking,
65 : * column breaking, or page breaking.
66 : * Other (non-fluid) continuations can be the result of BiDi frame splitting.
67 : * A "flow" is a chain of fluid continuations.
68 : */
69 :
70 : // Get the previous/next continuation, regardless of its type (fluid or non-fluid).
71 : virtual nsIFrame* GetPrevContinuation() const;
72 : virtual nsIFrame* GetNextContinuation() const;
73 :
74 : // Set a previous/next non-fluid continuation.
75 : NS_IMETHOD SetPrevContinuation(nsIFrame*);
76 : NS_IMETHOD SetNextContinuation(nsIFrame*);
77 :
78 : // Get the first/last continuation for this frame.
79 : virtual nsIFrame* GetFirstContinuation() const;
80 : virtual nsIFrame* GetLastContinuation() const;
81 :
82 : #ifdef DEBUG
83 : // Can aFrame2 be reached from aFrame1 by following prev/next continuations?
84 : static bool IsInPrevContinuationChain(nsIFrame* aFrame1, nsIFrame* aFrame2);
85 : static bool IsInNextContinuationChain(nsIFrame* aFrame1, nsIFrame* aFrame2);
86 : #endif
87 :
88 : // Get the previous/next continuation, only if it is fluid (an "in-flow").
89 : nsIFrame* GetPrevInFlow() const;
90 : nsIFrame* GetNextInFlow() const;
91 :
92 0 : virtual nsIFrame* GetPrevInFlowVirtual() const { return GetPrevInFlow(); }
93 0 : virtual nsIFrame* GetNextInFlowVirtual() const { return GetNextInFlow(); }
94 :
95 : // Set a previous/next fluid continuation.
96 : NS_IMETHOD SetPrevInFlow(nsIFrame*);
97 : NS_IMETHOD SetNextInFlow(nsIFrame*);
98 :
99 : // Get the first/last frame in the current flow.
100 : virtual nsIFrame* GetFirstInFlow() const;
101 : virtual nsIFrame* GetLastInFlow() const;
102 :
103 : // Remove the frame from the flow. Connects the frame's prev-in-flow
104 : // and its next-in-flow. This should only be called in frame Destroy() methods.
105 : static void RemoveFromFlow(nsIFrame* aFrame);
106 :
107 : protected:
108 0 : nsSplittableFrame(nsStyleContext* aContext) : nsFrame(aContext) {}
109 :
110 : #ifdef DEBUG
111 : virtual void DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent);
112 : #endif
113 :
114 : nsIFrame* mPrevContinuation;
115 : nsIFrame* mNextContinuation;
116 : };
117 :
118 : #endif /* nsSplittableFrame_h___ */
|