# khtml Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# render_flow.h

    00001 /*
    00002  * This file is part of the DOM implementation for KDE.
    00003  *
    00004  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    00005  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    00006  *
    00007  * This library is free software; you can redistribute it and/or
    00008  * modify it under the terms of the GNU Library General Public
    00009  * License as published by the Free Software Foundation; either
    00010  * version 2 of the License, or (at your option) any later version.
    00011  *
    00012  * This library is distributed in the hope that it will be useful,
    00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015  * Library General Public License for more details.
    00016  *
    00017  * You should have received a copy of the GNU Library General Public License
    00018  * along with this library; see the file COPYING.LIB.  If not, write to
    00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00020  * Boston, MA 02111-1307, USA.
    00021  *
    00022  * $Id: render_flow.h,v 1.72.2.3 2003/05/18 12:34:40 mueller Exp $
    00023  */
    00024 #ifndef RENDER_FLOW_H
    00025 #define RENDER_FLOW_H
    00026
    00027 #include <qsortedlist.h>
    00028
    00029 #include "render_box.h"
    00030 #include "bidi.h"
    00031
    00032 namespace khtml {
    00033
    00043 class RenderFlow : public RenderBox
    00044 {
    00045
    00046 public:
    00047     RenderFlow(DOM::NodeImpl* node);
    00048
    00049     virtual ~RenderFlow();
    00050
    00051     virtual const char *renderName() const { return "RenderFlow"; }
    00052
    00053     virtual void setStyle(RenderStyle *style);
    00054
    00055     virtual bool isFlow() const { return true; }
    00056     virtual bool childrenInline() const { return m_childrenInline; }
    00057     virtual bool isRendered() const { return true; }
    00058     void makeChildrenNonInline(RenderObject *box2Start = 0);
    00059
    00060     // overrides RenderObject
    00061
    00062     virtual void paint( QPainter *, int x, int y, int w, int h,
    00063                         int tx, int ty);
    00064     virtual void paintObject( QPainter *, int x, int y, int w, int h,
    00065                         int tx, int ty);
    00066     void paintSpecialObjects( QPainter *, int x, int y, int w, int h,
    00067                         int tx, int ty);
    00068
    00069     virtual void layout( );
    00070
    00071     virtual void close();
    00072
    00073     virtual void addChild(RenderObject *newChild, RenderObject *beforeChild = 0);
    00074
    00075     virtual short lineWidth(int y) const;
    00076
    00077     virtual int lowestPosition() const;
    00078     virtual int rightmostPosition() const;
    00079
    00080     int rightOffset() const;
    00081     int rightRelOffset(int y, int fixedOffset, int *heightRemaining = 0) const;
    00082     int rightOffset(int y) const { return rightRelOffset(y, rightOffset()); }
    00083
    00084     int leftOffset() const;
    00085     int leftRelOffset(int y, int fixedOffset, int *heightRemaining = 0) const;
    00086     int leftOffset(int y) const { return leftRelOffset(y, leftOffset()); }
    00087
    00088 #ifndef NDEBUG
    00089     virtual void printTree(int indent=0) const;
    00090     virtual void dump(QTextStream *stream, QString ind = "") const;
    00091 #endif
    00092
    00093     virtual FindSelectionResult checkSelectionPoint( int _x, int _y, int _tx, int _ty,
    00094                                                      DOM::NodeImpl*&, int & offset );
    00095
    00096     virtual bool nodeAtPoint(NodeInfo& info, int x, int y, int tx, int ty);
    00097
    00098 protected:
    00099
    00100     virtual void newLine();
    00101
    00102     void layoutBlockChildren( bool relayoutChildren );
    00103     void layoutInlineChildren( bool relayoutChildren );
    00104     void layoutSpecialObjects( bool relayoutChildren );
    00105
    00106 public:
    00107     int floatBottom() const;
    00108     inline int leftBottom();
    00109     inline int rightBottom();
    00110     bool checkClear(RenderObject *child);
    00111
    00112     void insertSpecialObject(RenderObject *o);
    00113     void removeSpecialObject(RenderObject *o);
    00114     // called from lineWidth, to position the floats added in the last line.
    00115     void positionNewFloats();
    00116     void clearFloats();
    00117     virtual void calcMinMaxWidth();
    00118
    00119     virtual bool containsSpecial() { return specialObjects!=0; }
    00120     virtual bool hasOverhangingFloats() { return floatBottom() > m_height; }
    00121
    00122     void addOverHangingFloats( RenderFlow *flow, int xoffset, int yoffset, bool child = false );
    00123
    00124     // implementation of the following functions is in bidi.cpp
    00125     void bidiReorderLine(const BidiIterator &start, const BidiIterator &end);
    00126     BidiIterator findNextLineBreak(BidiIterator &start);
    00127
    00128 protected:
    00129
    00130     struct SpecialObject {
    00131         enum Type {
    00132             FloatLeft,
    00133             FloatRight,
    00134             Positioned
    00135         };
    00136
    00137         SpecialObject(Type _type) {
    00138             node = 0;
    00139             startY = 0;
    00140             endY = 0;
    00141             type = _type;
    00142             left = 0;
    00143             width = 0;
    00144             count = 0;
    00145             noPaint = false;
    00146
    00147         }
    00148         RenderObject* node;
    00149         int startY;
    00150         int endY;
    00151         short left;
    00152         short width;
    00153         short count;
    00154         Type type : 2; // left or right aligned
    00155         bool noPaint : 1;
    00156
    00157         bool operator==(const SpecialObject& ) const
    00158         {
    00159             return false;
    00160         }
    00161         bool operator<(const SpecialObject& o) const;
    00162     };
    00163
    00164     QSortedList<SpecialObject>* specialObjects;
    00165
    00166 private:
    00167     bool m_childrenInline : 1;
    00168     bool m_pre            : 1;
    00169     bool firstLine        : 1; // used in inline layouting
    00170     EClear m_clearStatus  : 2; // used during layuting of paragraphs
    00171 };
    00172
    00173
    00174 } //namespace
    00175
    00176 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:34:33 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001