#include <Uri16.h>
#include <eikenv.h>
#include "htmlcontrol.hrh"
#ifdef __SERIES60__
#include <aknutils.h>
#include <AknsConstants.hrh>
#include <AknsConstants.h>
#ifdef __SERIES60_3_ONWARDS__
#include <akniconutils.h>
#endif
#endif
#include "controlimpl.h"
#include "elementimpl.h"
#include "htmlctlenv.h"
#include "htmlparser.h"
#include "imagepool.h"
#include "utils.h"
#include "element_div.h"
#include "element_hr.h"
#include "element_img.h"
#include "element_input.h"
#include "element_select.h"
#include "element_a.h"
#include "element_text.h"
#include "element_textarea.h"
#include "element_object.h"
#include "element_p.h"
#include "element_form.h"
_LIT(KHStrComment,"!--");
CHtmlParser* CHtmlParser::NewL()
{
CHtmlParser* self = new (ELeave)CHtmlParser();
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
return self;
}
CHtmlParser::~CHtmlParser()
{
iBlocks.Close();
}
void CHtmlParser::ConstructL()
{
}
void CHtmlParser::AppendBrL(TBool aForce)
{
if(iCurrent->TypeId()!=EElementTypeText || ((CHtmlElementText*)iCurrent)->iStandAlone)
{
if(!aForce && iCurrent==iHead)
return;
AppendElementL(KNullDesC, new (ELeave)CHtmlElementText(iHead->Owner()));
THcTextStyle style = iTextStyle;
style.Add(iFontStyle);
if(iFlags & KParserFlagsIgnoreFontSize)
style.Clear(THcTextStyle::ESize);
((CHtmlElementText*)iCurrent)->AppendTextL(style, NULL);
}
else
{
if(!aForce && ((CHtmlElementText*)iCurrent)->IsEndingWithBr())
return;
((CHtmlElementText*)iCurrent)->AppendTextL(iTextStyle, NULL);
}
}
void CHtmlParser::AppendTextL(const TDesC& aText, TBool aRaw)
{
HBufC* text;
if(!aRaw)
{
text = aText.AllocL();
CleanupStack::PushL(text);
TPtr textp = text->Des();
HcUtils::TrimRedundant(textp);
if(text->Length()>0 && (text->Length()>1 || !(TChar((*text)[0]).IsSpace()))) {
HBufC* text2 = HcUtils::DecodeHttpCharactersL(*text);
CleanupStack::PopAndDestroy();
text = text2;
}
else
{
CleanupStack::PopAndDestroy();
return;
}
}
else
text = aText.Alloc();
CleanupStack::PushL(text);
if(iCurrent->TypeId()!=EElementTypeText || ((CHtmlElementText*)iCurrent)->iStandAlone)
AppendElementL(KNullDesC, new (ELeave)CHtmlElementText(iHead->Owner()));
THcTextStyle style = iTextStyle;
style.Add(iFontStyle);
if(iFlags & KParserFlagsIgnoreFontSize)
style.Clear(THcTextStyle::ESize);
((CHtmlElementText*)iCurrent)->AppendTextL(style, text);
CleanupStack::Pop();
}
void CHtmlParser::AppendElementL(const TDesC& aSource, CHtmlElementImpl* aNewElement)
{
if(iBlocks.Count()==0)
aNewElement->iParent = iHead->iParent;
else
aNewElement->iParent = iBlocks.Top();
iCurrent->iNext = aNewElement;
aNewElement->iPrev = iCurrent;
iCurrent = aNewElement;
HtmlParser::ParseTag(aSource, iCurrent);
}
void CHtmlParser::RemoveDiv(CHtmlElementDiv* aDiv)
{
if(aDiv->iStyle.IsInvisibleStyle())
{
CHtmlElementImpl* e = aDiv->iNext;
CHtmlElementImpl* n;
while(e!=aDiv->iEnd)
{
n = e->iNext;
delete e;
e = n;
}
aDiv->iNext = aDiv->iEnd;
aDiv->iEnd->iPrev = aDiv;
}
else
{
CHtmlElementImpl* e = aDiv->iNext;
while(e!=aDiv->iEnd)
{
e->iParent = aDiv->iParent;
e = e->iNext;
}
}
if(aDiv->iNext!=aDiv->iEnd)
{
iCurrent = aDiv->iEnd->iPrev;
iCurrent->iNext = NULL;
aDiv->iPrev->iNext = aDiv->iNext;
aDiv->iNext->iPrev = aDiv->iPrev;
}
else
{
iCurrent = aDiv->iPrev;
iCurrent->iNext = NULL;
}
delete aDiv->iEnd;
delete aDiv;
}
void CHtmlParser::ParseL(const TDesC& aSource, CHtmlElementImpl* aHead, TInt aFlags)
{
TInt pos = 0, pos2, length, tagType;
TBuf<50> name;
TBuf<50> waitingEndTag;
TPtrC tagSource;
TInt skipText = 0;
CHtmlElementImpl* packElement = NULL;
CHtmlElementA* link = NULL;
CHtmlElementForm* form = NULL;
iFlags = aFlags;
iCurrent = aHead;
iHead = aHead;
iBlocks.Reset();
iTextStyle.ClearAll();
iFontStyle.ClearAll();
RHcStack<CHtmlElementP*> PStack;
CleanupClosePushL(PStack);
while((pos2=HcUtils::EnumTag(aSource, pos, name, length, tagType))!=KErrNotFound)
{
name.LowerCase();
if(waitingEndTag.Length()>0)
{
if(tagType==1 && name.Compare(waitingEndTag)==0)
waitingEndTag.Zero();
pos = pos2 + length;
continue;
}
if(pos!=pos2 && skipText==0)
AppendTextL(aSource.Mid(pos, pos2 - pos), EFalse);
tagSource.Set(aSource.Mid(pos2, length));
if(name.Compare(KHStrB)==0 || name.Compare(KHStrStrong)==0)
{
if(tagType==0)
iTextStyle.Set(THcTextStyle::EBold);
else if(tagType==1)
iTextStyle.Clear(THcTextStyle::EBold);
}
else if(name.Compare(KHStrI)==0)
{
if(tagType==0)
iTextStyle.Set(THcTextStyle::EItalics);
else
iTextStyle.Clear(THcTextStyle::EItalics);
}
else if(name.Compare(KHStrU)==0)
{
if(tagType==0)
iTextStyle.Set(THcTextStyle::EUnderline);
else
iTextStyle.Clear(THcTextStyle::EUnderline);
}
else if(name.Compare(KHStrSub)==0)
{
if(tagType==0)
iTextStyle.Set(THcTextStyle::ESub);
else if(tagType==1)
iTextStyle.C
没有合适的资源?快使用搜索试试~ 我知道了~
htmlcontrol-for-symbian
共176个文件
jpg:65个
h:40个
cpp:35个
3星 · 超过75%的资源 需积分: 4 40 下载量 172 浏览量
2010-09-07
16:28:46
上传
评论
收藏 19.02MB RAR 举报
温馨提示
CHtmlControl是一个Symbian平台下的自定义控件,它是一个轻量级的HTML/CSS解析和渲染的控件,可以轻松支持复杂的界面效果,也可以用来显示Web内容。 里面包含了源码、效果图、文档和编译好的二进制文件,由于SVN下载不了,所以是一页一页拷贝下来的,如有错大家请参考http://code.google.com/p/htmlcontrol-for-symbian/
资源推荐
资源详情
资源评论
收起资源包目录
htmlcontrol-for-symbian (176个子文件)
htmlparser.cpp 111KB
utils.cpp 78KB
controlimpl.cpp 62KB
list.cpp 37KB
element_text.cpp 37KB
element_div.cpp 31KB
imageimpl.cpp 30KB
element_input.cpp 29KB
scrollbar.cpp 29KB
element_select.cpp 19KB
transimpl.cpp 17KB
element_img.cpp 15KB
element_textarea.cpp 14KB
style.cpp 13KB
gcproxy.cpp 11KB
elementimpl.cpp 10KB
htmlctlenv.cpp 10KB
element_form.cpp 8KB
htmlstrings.cpp 8KB
element_a.cpp 8KB
element_object.cpp 8KB
htmlcontrol.cpp 6KB
imagepool.cpp 6KB
inputeditor.cpp 6KB
rstyle.cpp 5KB
measurestatus.cpp 4KB
stylesheet.cpp 4KB
element_hr.cpp 3KB
htmlctlutils.cpp 3KB
image.cpp 3KB
htmlelement.cpp 3KB
htmlelementiter.cpp 1KB
element_p.cpp 1KB
writablebitmap.cpp 1KB
element_body.cpp 225B
slide.gif 80KB
style.h 11KB
htmlstrings.h 8KB
gcproxy.h 7KB
htmlcontrol.h 7KB
controlimpl.h 7KB
imageimpl.h 7KB
scrollbar.h 6KB
transition.h 5KB
htmlparser.h 4KB
element_text.h 4KB
elementimpl.h 4KB
htmlctlenv.h 3KB
utils.h 3KB
measurestatus.h 3KB
image.h 3KB
list.h 3KB
element_div.h 3KB
htmlelement.h 3KB
element_input.h 3KB
element_select.h 2KB
rstyle.h 2KB
element_textarea.h 2KB
stylesheet.h 2KB
inputeditor.h 2KB
element_a.h 2KB
transimpl.h 2KB
htmlctlutils.h 1KB
stack.h 1KB
element_img.h 1KB
imagepool.h 1KB
element_object.h 1KB
element_form.h 1KB
htmlctlevent.h 1KB
timer.h 1KB
writablebitmap.h 1KB
element_p.h 947B
htmlelementiter.h 903B
element_hr.h 728B
lirenderer.h 579B
element_body.h 232B
htmlcontrol.hrh 1KB
bld.inf 549B
2009-02-23_105721.jpg 80KB
2009-02-23_102744.jpg 38KB
2009-02-23_105809.jpg 36KB
2009-06-05_134526.jpg 34KB
2009-02-23_142003.jpg 33KB
2009-02-23_153316.jpg 33KB
2009-02-24_221217.jpg 32KB
2009-02-25_102250.jpg 31KB
2009-02-24_175613.jpg 30KB
2009-02-23_105009.jpg 29KB
2009-02-23_152628.jpg 28KB
2009-05-26_105400.jpg 26KB
2009-03-04_144321.jpg 26KB
2009-02-25_103047.jpg 26KB
2009-02-23_105215.jpg 25KB
2009-05-26_105555.jpg 25KB
2009-02-23_105127.jpg 25KB
2009-03-04_144240.jpg 24KB
2009-02-23_170427.jpg 24KB
2009-02-25_101307.jpg 23KB
2009-02-23_105102.jpg 23KB
2009-02-23_170459.jpg 23KB
共 176 条
- 1
- 2
资源评论
- fly-6802012-09-19有些东西还不太清楚,要研究一下
普通网友
- 粉丝: 19
- 资源: 69
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功