KHtml

render_generated.h
1 /*
2  * This file is part of the HTML rendering engine for KDE.
3  *
4  * Copyright (C) 2004,2005 Allan Sandfeld Jensen ([email protected])
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22 #ifndef RENDER_GENERATED_H
23 #define RENDER_GENERATED_H
24 
25 #include "rendering/render_text.h"
26 #include "rendering/render_box.h"
27 
28 namespace DOM
29 {
30 class CounterImpl;
31 }
32 
33 namespace khtml
34 {
35 class CounterNode;
36 
37 // -----------------------------------------------------------------------------
38 
39 class RenderCounterBase : public RenderText
40 {
41 public:
42  RenderCounterBase(DOM::NodeImpl *node);
43 
44  const char *renderName() const override
45  {
46  return "RenderCounterBase";
47  }
48 
49  void layout() override;
50  void calcMinMaxWidth() override;
51  bool isCounter() const override
52  {
53  return true;
54  }
55 
56  virtual void generateContent() = 0;
57  void updateContent();
58 
59 protected:
60  QString m_item;
61  CounterNode *m_counterNode; // Cache of the counternode
62 };
63 
64 // -----------------------------------------------------------------------------
65 
66 class RenderCounter : public RenderCounterBase
67 {
68 public:
69  RenderCounter(DOM::NodeImpl *node, const DOM::CounterImpl *counter);
70  virtual ~RenderCounter() {}
71 
72  const char *renderName() const override
73  {
74  return "RenderCounter";
75  }
76 
77  void generateContent() override;
78 
79 protected:
80  QString toListStyleType(int value, int total, EListStyleType type);
81 
82  const DOM::CounterImpl *m_counter;
83 };
84 
85 // -----------------------------------------------------------------------------
86 
87 class RenderQuote : public RenderCounterBase
88 {
89 public:
90  RenderQuote(DOM::NodeImpl *node, EQuoteContent type);
91  virtual ~RenderQuote() {}
92 
93  const char *renderName() const override
94  {
95  return "RenderQuote";
96  }
97 
98  bool isQuote() const override
99  {
100  return true;
101  }
102  virtual int quoteCount() const;
103 
104  void generateContent() override;
105 
106 protected:
107  EQuoteContent m_quoteType;
108 };
109 
110 // -----------------------------------------------------------------------------
111 
112 // Is actually a special case of renderCounter for non-counted list-styles
113 // These have traditionally been drawn rather than use Unicode characters
114 class RenderGlyph : public RenderBox
115 {
116 public:
117  RenderGlyph(DOM::NodeImpl *node, EListStyleType type);
118  virtual ~RenderGlyph() {}
119 
120  const char *renderName() const override
121  {
122  return "RenderGlyph";
123  }
124 
125  void paint(PaintInfo &paintInfo, int _tx, int _ty) override;
126  void calcMinMaxWidth() override;
127 
128  void setStyle(RenderStyle *_style) override;
129 
130  short lineHeight(bool firstLine) const override;
131  short baselinePosition(bool firstLine) const override;
132 
133  bool isGlyph() const override
134  {
135  return true;
136  }
137 
138  void position(InlineBox *box, int /*from*/, int /*len*/, bool /*reverse*/) override
139  {
140  setPos(box->xPos(), box->yPos());
141  }
142 
143 protected:
144  EListStyleType m_type;
145 };
146 
147 } //namespace
148 
149 #endif
This file is part of the HTML rendering engine for KDE.
This library provides a full-featured HTML parser and widget.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:47:59 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.