CFx SDK Documentation  2023 SP0
FxWebWidgetInterfaces.h
Go to the documentation of this file.
1 //
2 // (C) Copyright 2005-2022 by Graebert GmbH.
3 //
4 // Permission to use, copy, modify, and distribute this software in
5 // object code form for any purpose and without fee is hereby granted,
6 // provided that the above copyright notice appears in all copies and
7 // that both that copyright notice and the limited warranty and
8 // restricted rights notice below appear in all supporting
9 // documentation.
10 //
11 // GRAEBERT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
12 // GRAEBERT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
13 // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. GRAEBERT GMBH
14 // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
15 // UNINTERRUPTED OR ERROR FREE.
16 
17 #pragma once
18 
19 #include "FxPragmaPush.h"
20 
21 #include "DDKERNEL.h"
22 
23 #include "FxString.h"
24 
25 #include <QtCore/qurl.h>
26 #include <QtGui/qicon.h>
27 #include <QtGui/qpainter.h>
28 #include <QtNetwork/qnetworkaccessmanager.h>
29 #include <QtWidgets/qwidget.h>
30 
31 class QWidget;
32 class QAction;
33 class QNetworkCookie;
34 class QNetworkAccessManager;
35 class QPrinter;
36 
38 
47 {
48 public:
50  virtual ~CFxWebView();
51 
52 public:
56  {
57  NoWebAction = -1,
62 
63  Cut,
66 
71 
73 
79 
83 
90 
98  WebActionCount
99  };
100 
104  {
105  FindBackward = 1,
106  FindCaseSensitively = 2,
107  FindWrapsAroundDocument = 4,
108  HighlightAllOccurrences = 8,
109  FindAtWordBeginningsOnly = 16,
110  TreatMedialCapitalAsWordBeginning = 32,
111  FindBeginsInSelection = 64
112  };
113 
117  {
140  AllowRunningInsecureContent
141  };
142 
146  {
149  ForcePersistentCookies
150  };
151 
155  {
158  DelegateAllLinks
159  };
160 
161 public:
164  virtual QWidget* GetWidget() = 0;
165  virtual const QWidget* GetWidget() const = 0;
166 
169 public:
170 
171  virtual void Load( const CFxString& sURL );
172  virtual void SetURL( const CFxString& sURL );
173 
174  virtual void Load( const QString& sURL ) = 0;
175  virtual void Load( const QUrl& url ) = 0;
176  virtual void Load( const QNetworkRequest& request, QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, const QByteArray &body = QByteArray() ) = 0;
177  virtual void SetHtml( const QString& html, const QUrl& baseUrl = QUrl() ) = 0;
178  virtual void SetContent( const QByteArray& data, const QString& sMimeType = QString(), const QUrl& baseUrl = QUrl() ) = 0;
179 
180  virtual QString GetTitle() const = 0;
181  virtual void SetURL( const QUrl &url ) = 0;
182  virtual void SetURL( const QString& sURL ) = 0;
183  virtual QUrl GetURL() const = 0;
184  virtual QIcon GetIcon() const = 0;
185 
186  virtual bool HasSelection() const = 0;
187  virtual QString GetSelectedText() const = 0;
188  virtual QString GetSelectedHtml() const = 0;
189 
190  virtual QAction* GetPageAction( FxWebAction eAction ) const = 0;
191  virtual void TriggerPageAction( FxWebAction eAction, bool bChecked = false ) = 0;
192 
193  virtual bool IsModified() const = 0;
194 
195  virtual double GetZoomFactor() const = 0;
196  virtual void SetZoomFactor( double dFactor ) = 0;
197 
198  virtual void SetTextSizeMultiplier( double dFactor ) = 0;
199  virtual double GetTextSizeMultiplier() const = 0;
200 
201  virtual QSize GetPreferredContentsSize() = 0;
202 
203  virtual QPainter::RenderHints GetRenderHints() const = 0;
204  virtual void SetRenderHints( QPainter::RenderHints hints ) = 0;
205  virtual void SetRenderHint( QPainter::RenderHint hint, bool bEnabled = true ) = 0;
206 
207  virtual bool FindText( const QString& subString, FxFindFlag options = ( FxFindFlag )0 ) = 0;
208 
209  // Set default user agent string. If the passed user agent string is empty,
210  // the default user agent string is cleared and the sent string depends on the
211  // underlying implementation.
212  virtual void SetDefaultUserAgentString( const QString &userAgentString ) = 0;
213  // Set user agent string for a specific URL. Scheme and authority are used for matching.
214  // If the passed user agent string is empty, the entry is removed.
215  virtual void SetUserAgentString( const QUrl &url, const QString &userAgentString ) = 0;
216  // Get default user agent string.
217  virtual QString GetDefaultUserAgentString() = 0;
218  // Get URL-specific user agent strings.
220  // Clear default user agent string.
221  virtual void ClearDefaultUserAgentString() = 0;
222  // Clear URL-specific user agent string.
223  virtual void ClearUserAgentString( const QUrl &url ) = 0;
224  // Clear all URL-specifc user agent strings.
225  virtual void ClearUserAgentStrings() = 0;
226  // Sets whether the cache is enabled or disabled.
227  virtual void SetCacheEnabled( bool bEnable ) = 0;
228 
229 public:
230  virtual void DoStop() = 0;
231  virtual void DoBack() = 0;
232  virtual void DoForward() = 0;
233  virtual void DoReload() = 0;
234 
235  virtual void DoPrint( QPrinter* ) const = 0;
236 
237 public:
238  virtual bool CanGoBack() const = 0;
239  virtual bool CanGoForward() const = 0;
240 
241 public:
242  virtual void SetLinkDelegationPolicy( FxLinkDelegationPolicy linkDelegationPolicy ) = 0;
244  virtual void SetSettingsAttribute( FxWebAttribute eAttribute, bool bEnable ) = 0;
246  virtual void SetPersistCookies( bool bEnable ) = 0;
247  virtual QObject* GetCookieStoreForDefaultProfile() = 0;
248  virtual void SetCookieForDefaultProfile( QNetworkCookie* pCookie ) = 0;
249  virtual void SetNetworkAccessManager( QNetworkAccessManager * manager ) = 0;
250  virtual void EvaluateJavascript( const QString& script ) = 0;
251 
252  //Opens External Link in browser
253  virtual void OpenExternalLinksInBrowser( std::function< bool( const QUrl& url )> checkIfExternalLink ) = 0;
254  //Opens the clicked Link both in Browser and Widget.
255  virtual void AlsoOpenLinksInBrowser() = 0;
256  virtual void ClearCookies() = 0;
257 
258  virtual QMetaObject::Connection ConnectToLinkClickedSignal( std::function<void( const QUrl& )> slot ) = 0;
259  virtual QMetaObject::Connection ConnectToContentChangedSignal( std::function<void( void )> slot ) = 0;
260  virtual QMetaObject::Connection ConnectToGeometryChangeRequestedSignal( std::function<void( const QRect& )> slot ) = 0;
261  virtual QMetaObject::Connection ConnectToRepaintRequestedSignal( std::function<void( const QRect& )> slot ) = 0;
262  virtual QMetaObject::Connection ConnectToLoadFinishedSignal( std::function<void( bool )> slot ) = 0;
263  virtual QMetaObject::Connection ConnectToLoadStartedSignal( std::function<void( void )> slot ) = 0;
264  virtual QMetaObject::Connection ConnectToLoadProgressSignal( std::function<void( int progress )> slot ) = 0;
265  virtual QMetaObject::Connection ConnectToHttpResponseFinished( std::function<void( QNetworkReply * )> slot ) = 0;
266  virtual QMetaObject::Connection ConnectToRepaintRequestedSignalWebEngine( std::function<void( bool )> slot ) = 0;
267  virtual QMetaObject::Connection ConnectToContentsSizeChangedSignal( std::function<void( const QSizeF& )> slot ) = 0;
268  virtual QMetaObject::Connection ConnectToUrlChangedSignal( std::function<void( const QUrl& )> slot ) = 0;
269 
270 protected:
272 };
273 
275 
282 {
283 public:
286 
287 protected:
288  friend class CFxWebWidgetManager;
289  virtual CFxWebView* CreateView( CFxWebWidgetManager* pManager ) = 0;
290 
291 };
292 
294 
295 class CFxWebWidgetManagerImpl;
296 
302 class DDKERNEL_API CFxWebWidgetManager : public QObject
303 {
304  Q_OBJECT
305 public:
307 
311 
312  void SetFactory( CFxWebWidgetFactory* pFactory );
313 
317 
318 public slots:
319  bool UnloadModule();
320 
321 protected:
322  friend class CFxWebView;
323  void OnViewDeleted( CFxWebView* pView );
324 
325 protected:
327 
328  bool CheckModule();
329  bool LoadModule();
330 
331 protected:
332  CFxWebWidgetManagerImpl* m_pImpl;
333 
334 };
335 
336 #include "FxPragmaPop.h"
#define DDKERNEL_API
Definition: DDKERNEL.h:32
virtual void ClearCookies()=0
virtual void Load(const QString &sURL)=0
virtual bool CanGoBack() const =0
virtual void SetZoomFactor(double dFactor)=0
virtual QAction * GetPageAction(FxWebAction eAction) const =0
virtual QMetaObject::Connection ConnectToContentsSizeChangedSignal(std::function< void(const QSizeF &)> slot)=0
virtual void ClearDefaultUserAgentString()=0
virtual QUrl GetURL() const =0
virtual void DoForward()=0
virtual void SetRenderHint(QPainter::RenderHint hint, bool bEnabled=true)=0
virtual void TriggerPageAction(FxWebAction eAction, bool bChecked=false)=0
virtual void SetSettingsAttribute(FxWebAttribute eAttribute, bool bEnable)=0
virtual QMetaObject::Connection ConnectToLoadProgressSignal(std::function< void(int progress)> slot)=0
virtual void EvaluateJavascript(const QString &script)=0
virtual QMetaObject::Connection ConnectToRepaintRequestedSignal(std::function< void(const QRect &)> slot)=0
virtual void SetRenderHints(QPainter::RenderHints hints)=0
virtual void SetHtml(const QString &html, const QUrl &baseUrl=QUrl())=0
virtual QWidget * GetWidget()=0
virtual double GetTextSizeMultiplier() const =0
virtual void SetURL(const CFxString &sURL)
virtual ~CFxWebView()
virtual void DoBack()=0
virtual void SetLinkDelegationPolicy(FxLinkDelegationPolicy linkDelegationPolicy)=0
virtual bool FindText(const QString &subString, FxFindFlag options=(FxFindFlag) 0)=0
virtual FxLinkDelegationPolicy GetLinkDelegationPolicy()=0
virtual bool CanGoForward() const =0
virtual bool HasSelection() const =0
virtual QIcon GetIcon() const =0
virtual void DoReload()=0
virtual QMap< QUrl, QString > GetUserAgentStrings()=0
virtual void Load(const CFxString &sURL)
virtual QString GetTitle() const =0
virtual void Load(const QUrl &url)=0
virtual double GetZoomFactor() const =0
virtual void SetCookieForDefaultProfile(QNetworkCookie *pCookie)=0
virtual QMetaObject::Connection ConnectToContentChangedSignal(std::function< void(void)> slot)=0
virtual void SetContent(const QByteArray &data, const QString &sMimeType=QString(), const QUrl &baseUrl=QUrl())=0
virtual QSize GetPreferredContentsSize()=0
virtual QMetaObject::Connection ConnectToGeometryChangeRequestedSignal(std::function< void(const QRect &)> slot)=0
virtual void SetDefaultUserAgentString(const QString &userAgentString)=0
virtual void SetTextSizeMultiplier(double dFactor)=0
CFxWebView(CFxWebWidgetManager *pManager)
virtual QMetaObject::Connection ConnectToLoadFinishedSignal(std::function< void(bool)> slot)=0
virtual void ClearUserAgentStrings()=0
CFxWebWidgetManager * m_pManager
virtual void SetNetworkAccessManager(QNetworkAccessManager *manager)=0
virtual QMetaObject::Connection ConnectToUrlChangedSignal(std::function< void(const QUrl &)> slot)=0
virtual void OpenExternalLinksInBrowser(std::function< bool(const QUrl &url)> checkIfExternalLink)=0
virtual void DoStop()=0
virtual QMetaObject::Connection ConnectToHttpResponseFinished(std::function< void(QNetworkReply *)> slot)=0
virtual void SetPersistentCookiesPolicyForDefaultProfile(FxPersistentCookiesPolicy ePolicy)=0
virtual bool IsModified() const =0
virtual void SetUserAgentString(const QUrl &url, const QString &userAgentString)=0
virtual void SetURL(const QString &sURL)=0
virtual void DoPrint(QPrinter *) const =0
virtual QMetaObject::Connection ConnectToLinkClickedSignal(std::function< void(const QUrl &)> slot)=0
virtual QMetaObject::Connection ConnectToLoadStartedSignal(std::function< void(void)> slot)=0
virtual void SetURL(const QUrl &url)=0
virtual QString GetSelectedText() const =0
virtual QMetaObject::Connection ConnectToRepaintRequestedSignalWebEngine(std::function< void(bool)> slot)=0
virtual QString GetSelectedHtml() const =0
virtual void SetCacheEnabled(bool bEnable)=0
virtual QString GetDefaultUserAgentString()=0
virtual void AlsoOpenLinksInBrowser()=0
virtual QObject * GetCookieStoreForDefaultProfile()=0
virtual void ClearUserAgentString(const QUrl &url)=0
virtual QPainter::RenderHints GetRenderHints() const =0
virtual const QWidget * GetWidget() const =0
virtual void Load(const QNetworkRequest &request, QNetworkAccessManager::Operation operation=QNetworkAccessManager::GetOperation, const QByteArray &body=QByteArray())=0
virtual void SetPersistCookies(bool bEnable)=0
virtual ~CFxWebWidgetFactory()
virtual CFxWebView * CreateView(CFxWebWidgetManager *pManager)=0
virtual ~CFxWebWidgetManager()
void SetFactory(CFxWebWidgetFactory *pFactory)
void OnViewDeleted(CFxWebView *pView)
CFxWebView * CreateView()
static CFxWebWidgetManager * GetManager()
CFxWebWidgetManagerImpl * m_pImpl
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition: gles2_ext.h:110