summaryrefslogtreecommitdiffstats
path: root/khtml/khtml_iface.h
blob: 8caade85069dd7a5fd0b7c4555aa952790fec267 (plain)
1
2
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
/* This file is part of the KDE project
 *  Copyright (C) 2002 Stephan Kulow <[email protected]>
 *
 * 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 __khtml_Iface_h__
#define __khtml_Iface_h__

#include <dcopobject.h>
#include <dcopref.h>
#include <kurl.h>

class KHTMLPart;

/**
 * DCOP interface for KHTML
 */
class KHTMLPartIface : public DCOPObject
{
    K_DCOP

public:

    KHTMLPartIface( KHTMLPart * );
    virtual ~KHTMLPartIface();

k_dcop:
    /**
     * @return the current URL
     */
    KURL url() const;

    bool closeURL();

    /**
     * Enable/disable Javascript support. Note that this will
     * in either case permanently override the default usersetting.
     * If you want to have the default UserSettings, don't call this
     * method.
     */
    void setJScriptEnabled( bool enable );

    /**
     * Returns @p true if Javascript support is enabled or @p false
     * otherwise.
     */
    bool jScriptEnabled() const;

    /**
     * Enable/disable the automatic forwarding by <meta http-equiv="refresh" ....>
     */
    void setMetaRefreshEnabled( bool enable );

    /**
     * Returns @p true if automtaic forwarding is enabled.
     */
    bool metaRefreshEnabled() const;

    /**
     * Enables or disables Drag'n'Drop support. A drag operation is started if
     * the users drags a link.
     */
    void setDNDEnabled( bool b );

    /**
     * Returns whether Dragn'n'Drop support is enabled or not.
     */
    bool dndEnabled() const;

    /**
     * Enables/disables Java applet support. Note that calling this function
     * will permanently override the User settings about Java applet support.
     * Not calling this function is the only way to let the default settings
     * apply.
     */
    void setJavaEnabled( bool enable );

    /**
     * Return if Java applet support is enabled/disabled.
     */
    bool javaEnabled() const;


    /**
     * Enables or disables plugins via, default is enabled
     */
    void setPluginsEnabled( bool enable );

    /**
     * Returns trie if plugins are enabled/disabled.
     */
    bool pluginsEnabled() const;

    /**
     * Specifies whether images contained in the document should be loaded
     * automatically or not.
     *
     * @note Request will be ignored if called before begin().
     */
    void setAutoloadImages( bool enable );

    /**
     * Returns whether images contained in the document are loaded automatically
     * or not.
     * @note that the returned information is unrelieable as long as no begin()
     * was called.
     */
    bool autoloadImages() const;

    /**
     * Security option.
     *
     * Specify whether only local references ( stylesheets, images, scripts, subdocuments )
     * should be loaded. ( default false - everything is loaded, if the more specific
     * options allow )
     */
    void setOnlyLocalReferences(bool enable);

    /**
     * Returns whether references should be loaded ( default false )
     **/
    bool onlyLocalReferences() const;

    /**
     * Sets the encoding the page uses.
     *
     * This can be different from the charset. The widget will try to reload
     * the current page in the new encoding, if url() is not empty.
     */
    bool setEncoding( const TQString &name );

    /**
     * Returns the encoding the page currently uses.
     *
     * Note that the encoding might be different from the charset.
     */
    TQString encoding() const;

    /**
     * Sets a user defined style sheet to be used on top of the HTML 4
     * default style sheet.
     *
     * This gives a wide range of possibilities to
     * change the layout of the page.
     */
    void setUserStyleSheet(const TQString &styleSheet);

    /**
     * Sets the fixed font style.
     *
     * @param name The font name to use for fixed text, e.g.
     * the <tt>&lt;pre&gt;</tt> tag.
     */
    void setFixedFont( const TQString &name );

    /**
     * Finds the anchor named @p name.
     *
     * If the anchor is found, the widget
     * scrolls to the closest position. Returns @p true if the anchor has
     * been found.
     */
    bool gotoAnchor( const TQString &name );

    /**
     * Go to next Anchor.
     *
     * This is useful to navigate from outside of the navigator.
     * @since 3.2
     */
    bool nextAnchor();

    /**
     * Go to previous Anchor.
     * @since 3.2
     */
    bool prevAnchor();

    /**
     * Activate the node that currently has the focus
     * (emulates pressing Return)
     */
    void activateNode();

    /**
     * Returns the text the user has marked.
     */
    TQString selectedText() const;

    /**
     * Marks all text in the document as selected.
     */
    void selectAll();

    /**
     * Last-modified date (in raw string format), if received in the [HTTP] headers.
     */
    TQString lastModified() const;

    /**
     * Print the contents of the current html view.
     * @param quick if true, fully automated printing, without the print dialog.
     */
    ASYNC print( bool quick );

    void debugRenderTree();
    void debugDOMTree();
    void viewDocumentSource();
    void viewFrameSource();
    void saveBackground(const TQString &url);
    void saveDocument(const TQString &url);

    /**
     * Evaluate a given piece of Javascript code
     */
    TQString evalJS(const TQString &script);

    /**
     * Stops display of animated images 
     */
    void stopAnimations();

private:
    KHTMLPart *part;
};

#endif