| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 
 | /*
 * This file is part of the DOM implementation for KDE.
 *
 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
 *           (C) 2007, 2008 Maks Orlovich (maksim@kde.org)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */
#ifndef HTML_OBJECTIMPL_H
#define HTML_OBJECTIMPL_H
#include "html_elementimpl.h"
#include "xml/dom_stringimpl.h"
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <QtCore/QStringList>
#include <QtGui/QWidget>
// -------------------------------------------------------------------------
class KHTMLPart;
namespace DOM {
class HTMLFormElementImpl;
class HTMLEmbedElementImpl;
// Base class of all objects that are displayed as KParts:
// frames, objects, applets, etc.
class HTMLPartContainerElementImpl : public QObject, public HTMLElementImpl
{
    Q_OBJECT
public:
    enum DOMChildFrameEvents { DOMCFResizeEvent = 0x3030 };
    HTMLPartContainerElementImpl(DocumentImpl *doc);
    ~HTMLPartContainerElementImpl();
    void computeContentIfNeeded();
    void setNeedComputeContent();
    virtual void recalcStyle(StyleChange ch);
    virtual void close();
    // These methods will be called to notify the element of
    // any progress in loading of the document: setWidgetNotify if the
    // KPart was created, and partLoadingErrorNotify when
    // there was a problem with creating the part or loading the data
    // (hence setWidgetNotify may be followed by partLoadingErrorNotify).
    // This class take care of all the memory management, and during
    // the setWidgetNotify call, both old (if any) and new widget are alive
    // Note: setWidgetNotify may be called with 0...
    virtual void setWidgetNotify(QWidget *widget) = 0;
    virtual void partLoadingErrorNotify();
    // This is called when a mimetype is discovered, and should return true
    // if KHTMLPart should not make a kpart for it, but rather let it be handled directly.
    virtual bool mimetypeHandledInternally(const QString& mime);
    virtual bool event(QEvent *e);
    // IMPORTANT: you should call this when requesting a URL, to make sure
    // that we don't get stale references to iframes or such.
    void clearChildWidget();
    QWidget* childWidget() const { return m_childWidget; }
    void postResizeEvent();
    static void sendPostedResizeEvents();
public slots:
    void slotEmitLoadEvent();
private:
    friend class ::KHTMLPart;
    // This is called by KHTMLPart to notify us of the new widget.
    void setWidget(QWidget* widget);
private:
    virtual void computeContent() = 0;
    bool m_needToComputeContent; // This flag is set to true when
                                 // we may have to load a new KPart, due to
                                 // source changing, etc.
    QPointer<QWidget> m_childWidget; // may be deleted by global child widget cleanup on us..
};
class HTMLObjectBaseElementImpl : public HTMLPartContainerElementImpl
{
    Q_OBJECT
public:
    HTMLObjectBaseElementImpl(DocumentImpl *doc);
    virtual void parseAttribute(AttributeImpl *attr);
    virtual void attach();
    virtual void defaultEventHandler(EventImpl *e);
    void setServiceType(const QString &);
    QString url;
    QString classId;
    QString serviceType;
    bool m_rerender; // This is set to true if a reattach is pending,
                     // due to a change in how we need to display this...
    bool m_renderAlternative;
    bool m_imageLike;
    virtual void insertedIntoDocument();
    virtual void removedFromDocument();
    virtual void addId(const DOMString& id);
    virtual void removeId(const DOMString& id);
    HTMLEmbedElementImpl* relevantEmbed();
    virtual void setWidgetNotify( QWidget *widget );
    virtual void partLoadingErrorNotify();
    virtual bool mimetypeHandledInternally(const QString& mime);
    // This method figures out what to render -- perhaps KPart, perhaps an image, perhaps
    // alternative content, and forces a reattach if need be.
    virtual void computeContent();
    // Ask for a reattach, since we may need a different renderer..
    void requestRerender();
    void renderAlternative();
protected slots:
    void slotRerender();
    void slotPartLoadingErrorNotify();
protected:
    DOMString     m_name;
};
// -------------------------------------------------------------------------
class HTMLAppletElementImpl : public HTMLObjectBaseElementImpl
{
public:
    HTMLAppletElementImpl(DocumentImpl *doc);
    ~HTMLAppletElementImpl();
    virtual Id id() const;
    virtual void parseAttribute(AttributeImpl *token);
    virtual void computeContent();
protected:
    khtml::VAlign valign;
};
// -------------------------------------------------------------------------
class HTMLEmbedElementImpl : public HTMLObjectBaseElementImpl
{
public:
    HTMLEmbedElementImpl(DocumentImpl *doc);
    ~HTMLEmbedElementImpl();
    virtual Id id() const;
    virtual void parseAttribute(AttributeImpl *attr);
    virtual void attach();
    virtual void computeContent();
    virtual HTMLEmbedElementImpl* relevantEmbed();
    QString pluginPage;
    bool hidden;
};
// -------------------------------------------------------------------------
class HTMLObjectElementImpl : public HTMLObjectBaseElementImpl
{
public:
    HTMLObjectElementImpl(DocumentImpl *doc);
    ~HTMLObjectElementImpl();
    virtual Id id() const;
    HTMLFormElementImpl *form() const;
    virtual void parseAttribute(AttributeImpl *token);
    virtual void attach();
    DocumentImpl* contentDocument() const;
};
// -------------------------------------------------------------------------
class HTMLParamElementImpl : public HTMLElementImpl
{
    friend class HTMLAppletElementImpl;
public:
    HTMLParamElementImpl(DocumentImpl* _doc) : HTMLElementImpl(_doc) {}
    virtual Id id() const;
    virtual void parseAttribute(AttributeImpl *token);
    QString name() const { return m_name; }
    QString value() const { return m_value; }
 protected:
    QString m_name;
    QString m_value;
};
} // namespace
#endif
 |