File indexing completed on 2024-04-28 15:24:06
0001 /* 0002 * This file is part of the HTML rendering engine for KDE. 0003 * 0004 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) 0005 * (C) 1999 Antti Koivisto (koivisto@kde.org) 0006 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 0007 * 0008 * This library is free software; you can redistribute it and/or 0009 * modify it under the terms of the GNU Library General Public 0010 * License as published by the Free Software Foundation; either 0011 * version 2 of the License, or (at your option) any later version. 0012 * 0013 * This library is distributed in the hope that it will be useful, 0014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0016 * Library General Public License for more details. 0017 * 0018 * You should have received a copy of the GNU Library General Public License 0019 * along with this library; see the file COPYING.LIB. If not, write to 0020 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0021 * Boston, MA 02110-1301, USA. 0022 * 0023 */ 0024 #ifndef RENDER_LIST_H 0025 #define RENDER_LIST_H 0026 0027 #include "rendering/render_block.h" 0028 0029 // ### list-style-position, list-style-image is still missing 0030 0031 namespace khtml 0032 { 0033 0034 class RenderListItem; 0035 class RenderListMarker; 0036 class CounterNode; 0037 0038 // ----------------------------------------------------------------------------- 0039 0040 class RenderListItem : public RenderBlock 0041 { 0042 friend class RenderListMarker; 0043 // friend class CounterListItem; 0044 0045 public: 0046 RenderListItem(DOM::NodeImpl *); 0047 0048 const char *renderName() const override 0049 { 0050 return "RenderListItem"; 0051 } 0052 0053 void setStyle(RenderStyle *style) override; 0054 0055 bool isListItem() const override 0056 { 0057 return true; 0058 } 0059 0060 void setValue(long v) 0061 { 0062 predefVal = v; 0063 } 0064 0065 void layout() override; 0066 void detach() override; 0067 void calcMinMaxWidth() override; 0068 //virtual short marginLeft() const; 0069 //virtual short marginRight() const; 0070 0071 void setInsideList(bool b) 0072 { 0073 m_insideList = b; 0074 } 0075 0076 protected: 0077 0078 void updateMarkerLocation(); 0079 void resetListMarker() 0080 { 0081 m_marker = nullptr; 0082 } 0083 0084 RenderListMarker *m_marker; 0085 CounterNode *m_counter; 0086 signed long predefVal : 30; 0087 bool m_insideList : 1; 0088 bool m_deleteMarker: 1; 0089 }; 0090 0091 // ----------------------------------------------------------------------------- 0092 0093 class RenderListMarker : public RenderBox 0094 { 0095 public: 0096 RenderListMarker(DOM::NodeImpl *node); 0097 ~RenderListMarker(); 0098 0099 void setStyle(RenderStyle *style) override; 0100 0101 const char *renderName() const override 0102 { 0103 return "RenderListMarker"; 0104 } 0105 // so the marker gets to layout itself. Only needed for 0106 // list-style-position: inside 0107 0108 void paint(PaintInfo &i, int xoff, int yoff) override; 0109 void layout() override; 0110 void calcMinMaxWidth() override; 0111 0112 short lineHeight(bool firstLine) const override; 0113 short baselinePosition(bool firstLine) const override; 0114 0115 void updatePixmap(const QRect &, CachedImage *) override; 0116 0117 void calcWidth() override; 0118 0119 bool isListMarker() const override 0120 { 0121 return true; 0122 } 0123 0124 virtual short markerWidth() const 0125 { 0126 return m_markerWidth; 0127 } 0128 0129 RenderListItem *listItem() const 0130 { 0131 return m_listItem; 0132 } 0133 void setListItem(RenderListItem *listItem) 0134 { 0135 m_listItem = listItem; 0136 } 0137 0138 bool listPositionInside() const 0139 { 0140 return !m_listItem->m_insideList || style()->listStylePosition() == INSIDE; 0141 } 0142 0143 protected: 0144 friend class RenderListItem; 0145 0146 QString m_item; 0147 CachedImage *m_listImage; 0148 short m_markerWidth; 0149 RenderListItem *m_listItem; 0150 }; 0151 0152 // Implementation of list-item counter 0153 // ### should replace most list-item specific code in renderObject::getCounter 0154 /* 0155 class CounterListItem : public CounterNode 0156 { 0157 public: 0158 int count() const; 0159 0160 virtual void recount( bool first = false ); 0161 virtual void setSelfDirty(); 0162 0163 }; */ 0164 0165 } //namespace 0166 0167 #endif