khtml Library API Documentation

khtml_iface.cc

00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 2002 Stephan Kulow <coolo@kde.org> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 * Boston, MA 02111-1307, USA. 00019 */ 00020 00021 #include "khtml_iface.h" 00022 #include "khtml_part.h" 00023 #include "khtmlview.h" 00024 #include "khtml_ext.h" 00025 #include <kio/global.h> 00026 #include <qapplication.h> 00027 #include <qvariant.h> 00028 00029 KHTMLPartIface::KHTMLPartIface( KHTMLPart *_part ) 00030 : DCOPObject( _part->dcopObjectId() ), part(_part) 00031 { 00032 } 00033 00034 KHTMLPartIface::~KHTMLPartIface() 00035 { 00036 } 00037 00038 KURL KHTMLPartIface::url() const 00039 { 00040 return part->url(); 00041 } 00042 00043 void KHTMLPartIface::setJScriptEnabled( bool enable ) 00044 { 00045 part->setJScriptEnabled(enable); 00046 } 00047 00048 bool KHTMLPartIface::jScriptEnabled() const 00049 { 00050 return part->jScriptEnabled(); 00051 } 00052 00053 bool KHTMLPartIface::closeURL() 00054 { 00055 return part->closeURL(); 00056 } 00057 00058 bool KHTMLPartIface::metaRefreshEnabled() const 00059 { 00060 return part->metaRefreshEnabled(); 00061 } 00062 00063 void KHTMLPartIface::setDNDEnabled( bool b ) 00064 { 00065 part->setDNDEnabled(b); 00066 } 00067 00068 bool KHTMLPartIface::dndEnabled() const 00069 { 00070 return part->dndEnabled(); 00071 } 00072 00073 void KHTMLPartIface::setJavaEnabled( bool enable ) 00074 { 00075 part->setJavaEnabled( enable ); 00076 } 00077 00078 bool KHTMLPartIface::javaEnabled() const 00079 { 00080 return part->javaEnabled(); 00081 } 00082 00083 void KHTMLPartIface::setPluginsEnabled( bool enable ) 00084 { 00085 part->setPluginsEnabled( enable ); 00086 } 00087 00088 bool KHTMLPartIface::pluginsEnabled() const 00089 { 00090 return part->pluginsEnabled(); 00091 } 00092 00093 void KHTMLPartIface::setAutoloadImages( bool enable ) 00094 { 00095 part->setAutoloadImages( enable ); 00096 } 00097 00098 bool KHTMLPartIface::autoloadImages() const 00099 { 00100 return part->autoloadImages(); 00101 } 00102 00103 void KHTMLPartIface::setOnlyLocalReferences(bool enable) 00104 { 00105 part->setOnlyLocalReferences(enable); 00106 } 00107 00108 void KHTMLPartIface::setMetaRefreshEnabled( bool enable ) 00109 { 00110 part->setMetaRefreshEnabled(enable); 00111 } 00112 00113 bool KHTMLPartIface::onlyLocalReferences() const 00114 { 00115 return part->onlyLocalReferences(); 00116 } 00117 00118 bool KHTMLPartIface::setEncoding( const QString &name ) 00119 { 00120 return part->setEncoding(name); 00121 } 00122 00123 QString KHTMLPartIface::encoding() const 00124 { 00125 return part->encoding(); 00126 } 00127 00128 void KHTMLPartIface::setFixedFont( const QString &name ) 00129 { 00130 part->setFixedFont(name); 00131 00132 } 00133 00134 bool KHTMLPartIface::gotoAnchor( const QString &name ) 00135 { 00136 return part->gotoAnchor(name); 00137 } 00138 00139 bool KHTMLPartIface::nextAnchor() 00140 { 00141 return part->nextAnchor(); 00142 } 00143 00144 bool KHTMLPartIface::prevAnchor() 00145 { 00146 return part->prevAnchor(); 00147 } 00148 00149 void KHTMLPartIface::activateNode() 00150 { 00151 KParts::ReadOnlyPart* p = part->currentFrame(); 00152 if ( p && p->widget() ) { 00153 QKeyEvent ev( QKeyEvent::KeyPress, Qt::Key_Return, '\n', 0, "\n" ); 00154 QApplication::sendEvent( p->widget(), &ev ); 00155 } 00156 } 00157 00158 void KHTMLPartIface::selectAll() 00159 { 00160 part->selectAll(); 00161 } 00162 00163 QString KHTMLPartIface::lastModified() const 00164 { 00165 return part->lastModified(); 00166 } 00167 00168 void KHTMLPartIface::debugRenderTree() 00169 { 00170 part->slotDebugRenderTree(); 00171 } 00172 00173 void KHTMLPartIface::debugDOMTree() 00174 { 00175 part->slotDebugDOMTree(); 00176 } 00177 00178 void KHTMLPartIface::stopAnimations() 00179 { 00180 part->slotStopAnimations(); 00181 } 00182 00183 void KHTMLPartIface::viewDocumentSource() 00184 { 00185 part->slotViewDocumentSource(); 00186 } 00187 00188 void KHTMLPartIface::saveBackground(const QString &destination) 00189 { 00190 KURL back = part->backgroundURL(); 00191 if (back.isEmpty()) 00192 return; 00193 00194 KIO::MetaData metaData; 00195 metaData["referrer"] = part->referrer(); 00196 KHTMLPopupGUIClient::saveURL( back, KURL( destination ), metaData ); 00197 } 00198 00199 void KHTMLPartIface::saveDocument(const QString &destination) 00200 { 00201 KURL srcURL( part->url() ); 00202 00203 if ( srcURL.fileName(false).isEmpty() ) 00204 srcURL.setFileName( "index.html" ); 00205 00206 KIO::MetaData metaData; 00207 // Referrer unknown? 00208 KHTMLPopupGUIClient::saveURL( srcURL, KURL( destination ), metaData, part->cacheId() ); 00209 } 00210 00211 void KHTMLPartIface::setUserStyleSheet(const QString &styleSheet) 00212 { 00213 part->setUserStyleSheet(styleSheet); 00214 } 00215 00216 QString KHTMLPartIface::selectedText() const 00217 { 00218 return part->selectedText(); 00219 } 00220 00221 void KHTMLPartIface::viewFrameSource() 00222 { 00223 part->slotViewFrameSource(); 00224 } 00225 00226 QString KHTMLPartIface::evalJS(const QString &script) 00227 { 00228 return part->executeScript(DOM::Node(), script).toString(); 00229 } 00230 00231 void KHTMLPartIface::print( bool quick ) { 00232 part->view()->print( quick ); 00233 }
KDE Logo
This file is part of the documentation for khtml Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:44:54 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003