-
Notifications
You must be signed in to change notification settings - Fork 0
/
HTMLDocument.cpp
47 lines (40 loc) · 1.08 KB
/
HTMLDocument.cpp
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
//---------------------------------------------------------------------------
#pragma hdrstop
#include <fstream.h>
#include "HTMLDocument.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
void HTMLDocument::OpenFile(const String &filename)
{
TStringList *sl = new TStringList;
FileName = filename;
sl->LoadFromFile(filename);
browser->OpenFile(filename);
rcedit->Lines->Clear();
html = sl->Text;
rcedit->Text = html;
setchanged(false);
delete sl;
}
void HTMLDocument::Update(const String &html){
this->html = html;
setchanged(true);
browser->SetText(html);
}
void HTMLDocument::SaveFile(const String &filename)
{ TStringList *sl = new TStringList;
sl->Text = html;
sl->SaveToFile(filename);
delete sl;
setchanged(false);
}
bool HTMLDocument::changed(){
return _changed;
}
HTMLDocument::HTMLDocument(TRichEdit *rche, BrowserSys *Browser):
rcedit(rche),browser(Browser)
{
};
void HTMLDocument::setchanged(bool flag){
_changed = flag;
}