📄 webcorebridge.h
字号:
/*
* Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
* Portions Copyright (c) 2005 Nokia Corporation, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WEBCOREBRIDGE_H
#define WEBCOREBRIDGE_H
// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include <w32std.h>
#include "WebCoreKeyboardAccess.h"
#include "WebCoreKeyValuePair.h"
#include "WebCoreFormData.h"
#include <oomdefs.h>
//#import <JavaVM/jni.h>
// CONSTANTS
// MACROS
// DATA TYPES
typedef enum {
EWebCoreDeviceScreen,
EWebCoreDevicePrinter
} TWebCoreDeviceType;
typedef enum {
EWebSelectByMoving,
EWebSelectByExtending
} TWebSelectionAlteration;
typedef enum {
EWebSelectForward,
EWebSelectBackward,
EWebSelectRight,
EWebSelectLeft
} TWebSelectionDirection;
typedef enum {
EWebSelectByCharacter,
EWebSelectByWord,
EWebSelectByLine,
EWebSelectByParagraph
} TWebSelectionGranularity;
typedef enum
{
EWebNavUp,
EWebNavDown,
EWebNavLeft,
EWebNavRight,
EWebNavAny
} TWebNavDirection;
typedef enum
{
EWebCoreElementNone,
EWebCoreElementImageBox,
EWebCoreElementAnchor,
EWebCoreElementTelAnchor,
EWebCoreElementMailtoAnchor,
EWebCoreElementInputBox,
EWebCoreElementActivatedInputBox,
EWebCoreElementSelectBox,
EWebCoreElementButton,
EWebCoreElementTextAreaBox,
EWebCoreElementRootBox,
EWebCoreElementObjectBox,
EWebCoreElementActivatedObjectBox,
EWebCoreElementDownloadedObjectBox,
EWebCoreElementFileSelectionBoxNoContent,
EWebCoreElementFileSelectionBoxWithContent,
EWebCoreElementAreaBox,
EWebCoreElementCheckBoxChecked,
EWebCoreElementCheckBoxUnChecked,
EWebCoreElementRadioButtonSelected,
EWebCoreElementRadioButtonUnSelected,
EWebCoreElementMouseButtonListener,
EWebCoreElementScrollBar
} TWebCoreFocusedElementType;
struct TWebCoreLinkItem
{
TPtrC iCharset;
TPtrC iType;
TPtrC iHref;
TPtrC iTitle;
};
// FUNCTION PROTOTYPES
// FORWARD DECLARATIONS
class KWQKHTMLPart;
class KHTMLView;
class RenderArena;
namespace khtml {
class RenderPart;
class RenderObject;
}
class CWebCoreSettings;
class CWebScriptObject;
class CDOMElement;
class MWebClientBridge;
class MWebCoreResourceHandle;
class MWebCoreResourceLoader;
class MWebCoreFileButton;
class MWebCoreFileButtonDelegate;
class MWebCoreScrollView;
class MWebCoreObjectWidget;
class MWebCoreUrlResponseHeaderInfo;
class CWebCoreGraphicsContext;
typedef khtml::RenderPart KHTMLRenderPart;
// CLASS DECLARATION
/**
* CWebCoreBridge, the main bridge interface to the WebCore library
*
* WebCoreBridge objects are used by WebCore to abstract away operations that need
* to be implemented by library clients, for example WebKit. The objects are also
* used in the opposite direction, for simple access to WebCore functions without dealing
* directly with the KHTML C++ classes.
*
* A WebCoreBridge creates and holds a reference to a KHTMLPart.
*
* The MWebCoreBridge interface contains methods for use by the non-WebCore side of the bridge.
*
* @lib WebCore
* @since ?Series60_version
*/
class CWebCoreBridge : public CBase
{
public: // Constructors and destructor
/**
* Two-phased constructor.
*/
IMPORT_C static CWebCoreBridge* NewL(MWebClientBridge& aClient);
/**
* Destructor.
*/
virtual ~CWebCoreBridge();
public: // New functions
/**
* ?member_description.
* @since ?Series60_version
* @param ?arg1 ?description
* @return ?description
*/
//?type ?member_function( ?type ?arg1 );
IMPORT_C MWebClientBridge& Client();
// static CWebCoreBridge * BridgeForDOMDocument(DOMDocument *document);
IMPORT_C void InitializeSettings(const CWebCoreSettings& aSettings);
IMPORT_C void SetRenderPart(KHTMLRenderPart *aRenderPart);
IMPORT_C KHTMLRenderPart *RenderPart() const;
IMPORT_C void SetName(const TDesC& aName);
IMPORT_C TPtrC Name() const;
IMPORT_C void SetParent(CWebCoreBridge *aParent);
IMPORT_C void ProvisionalLoadStarted();
IMPORT_C void OpenURL(const TDesC& aURL, TBool aReload,
const TDesC& aContentType, const TDesC& aRefresh, const TDateTime& aLastModified);
IMPORT_C void CreateDocumentWithEncoding(const TDesC& aEncoding, TBool aUserChosen);
IMPORT_C void AddData(const TDesC8& aData);
IMPORT_C void CloseURL();
IMPORT_C void DidNotOpenURL(const TDesC& aURL);
IMPORT_C void SaveDocumentState();
IMPORT_C void RestoreDocumentState();
IMPORT_C TBool CanCachePage() const;
// IMPORT_C TBool SaveDocumentToPageCache();
IMPORT_C void End();
IMPORT_C TPtrC URL() const;
IMPORT_C TPtrC Referrer() const;
IMPORT_C TPtrC Domain() const;
IMPORT_C void InstallInFrame(MWebCoreScrollView& aView);
IMPORT_C void RemoveFromFrame();
IMPORT_C void ScrollToAnchor(const TDesC& aAnchor);
IMPORT_C void ScrollToAnchorWithURL(const TDesC& aURL);
IMPORT_C void CreateKHTMLView(MWebCoreScrollView& aView, TInt aMarginWidth, TInt aMarginHeight);
IMPORT_C TBool IsFrameSet() const;
IMPORT_C void ReapplyStylesForDeviceType( TWebCoreDeviceType aDeviceType );
IMPORT_C void ForceLayoutAdjustingViewSize(TBool aAdjustSizeFlag);
// IMPORT_C void ForceLayoutWithMinimumPageWidth(TInt aMinPageWidth, TInt aMaxPageWidth, TBool aAdjustSizeFlag);
IMPORT_C void SendResizeEvent();
IMPORT_C void SendScrollEvent();
IMPORT_C TBool NeedsLayout() const;
IMPORT_C void SetNeedsLayout();
IMPORT_C void DrawRect(const TRect& rect, CWebCoreGraphicsContext& aGc);
// IMPORT_C void AdjustPageHeightNew(TInt aNewBottom, TInt aOldTop, TInt aOldBottom, TInt aBottomLimit);
//- (NSArray*)computePageRectsWithPrintWidthScaleFactor(float)printWidthScaleFactor printHeight(float)printHeight;
// IMPORT_C void SetUsesInactiveTextBackgroundColor(TBool aUses);
// IMPORT_C TBool UsesInactiveTextBackgroundColor();
// IMPORT_C void SetShowsFirstResponder(TBool aFlag);
IMPORT_C void PointerEvent(TPointerEvent aEvent);
IMPORT_C TBool KeyEvent(TKeyEvent aEvent, TBool aUpEvent);
IMPORT_C void ActivateEvent(TPoint& aPoint);
IMPORT_C void DeActivateEvent(TBool aAcceptChanges);
IMPORT_C void RemoveFileName( TPoint& aPoint );
//- (BOOL)sendContextMenuEvent(NSEvent *)event; // return YES if event is eaten by WebCore
//- (NSView *)nextKeyView;
//- (NSView *)previousKeyView;
//- (NSView *)nextKeyViewInsideWebFrameViews;
//- (NSView *)previousKeyViewInsideWebFrameViews;
//- (NSObject *)copyDOMTree(id <WebCoreDOMTreeCopier>)copier;
//- (NSObject *)copyRenderTree(id <WebCoreRenderTreeCopier>)copier;
//- (NSString *)renderTreeAsExternalRepresentation;
//- (NSDictionary *)elementAtPoint(NSPoint)point;
HBufC* URLWithRelativeString(const TDesC& aString);
//- (DOMElement *)elementWithName(NSString *)name inForm(DOMElement *)form;
//- (DOMElement *)elementForView(NSView *)view;
//- (BOOL)elementDoesAutoComplete(DOMElement *)element;
//- (BOOL)elementIsPassword(DOMElement *)element;
//- (DOMElement *)formForElement(DOMElement *)element;
//- (DOMElement *)currentForm;
//- (NSArray *)controlsInForm(DOMElement *)form;
//- (NSString *)searchForLabels(NSArray *)labels beforeElement(DOMElement *)element;
//- (NSString *)matchLabels(NSArray *)labels againstElement(DOMElement *)element;
/* Search for a keyword string, towards a direction (forward or backward),
* returns an integer indicating the search result */
IMPORT_C TInt SearchFor(const TDesC& aString, TBool aForward, TBool aCaseSensitive, TBool aWrap);
/* Perform a Search for the previously searched string */
IMPORT_C TInt SearchAgain(const TDesC& aString,TBool aForward, TBool aCaseSensitive, TBool aWrap);
/* change the view port to jump to the selection content */
IMPORT_C void JumpToSelection();
/* This is called when user cancel the selection action,
* the function will clean up the old selection state, and
* undo the selection highlight */
IMPORT_C void ClearFind();
IMPORT_C void SetTextSizeMultiplier(TReal aAmultiplier);
IMPORT_C TUint TextEncoding() const;
//- (NSString *)stringByEvaluatingJavaScriptFromString(NSString *)string;
//- (DOMDocument *)DOMDocument;
//- (DOMHTMLElement *)frameElement;
//void setSelectionFrom(DOMNode *)start startOffset(int)startOffset to(DOMNode *)end endOffset(int) endOffset;
//- (BOOL)isSelectionEditable;
// IMPORT_C TBool HaveSelection() const;
//- (NSAttributedString *)selectedAttributedString;
// IMPORT_C HBufC* SelectedString() const;
//- (NSString *)stringForRange(DOMRange *)range;
//- (NSString *)markupStringFromNode(DOMNode *)node nodes(NSArray **)nodes;
//- (NSString *)markupStringFromRange(DOMRange *)range nodes(NSArray **)nodes;
// IMPORT_C void SelectAll();
// IMPORT_C void DeselectAll();
// IMPORT_C void DeselectText();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -