2 // Open Service Platform
\r
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
\r
5 // Licensed under the Flora License, Version 1.0 (the License);
\r
6 // you may not use this file except in compliance with the License.
\r
7 // You may obtain a copy of the License at
\r
9 // http://www.tizenopensource.org/license
\r
11 // Unless required by applicable law or agreed to in writing, software
\r
12 // distributed under the License is distributed on an AS IS BASIS,
\r
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 // See the License for the specific language governing permissions and
\r
15 // limitations under the License.
\r
17 #include "FormMgr.h"
\r
18 #include "MainListForm.h"
\r
19 #include "XmlReader.h"
\r
20 #include "HtmlParser.h"
\r
21 #include "XmlParser.h"
\r
22 #include "XmlWriter.h"
\r
25 using namespace Osp::App;
\r
26 using namespace Osp::Base;
\r
27 using namespace Osp::Ui;
\r
28 using namespace Osp::Ui::Controls;
\r
30 FormMgr::FormMgr() : __pPreviousForm(null){
\r
31 // TODO Auto-generated constructor stub
\r
35 FormMgr::~FormMgr() {
\r
36 // TODO Auto-generated destructor stub
\r
40 bool FormMgr::Initialize()
\r
42 result r = E_SUCCESS;
\r
43 r = Form::Construct(FORM_STYLE_NORMAL);
\r
44 SetName(L"FormMgr");
\r
49 bool FormMgr::SetStarterForm(RequestId requestId, Osp::Base::Collection::IList* pArgs)
\r
51 Form *pCurrentForm = Application::GetInstance()->GetAppFrame()->GetFrame()->GetCurrentForm();
\r
53 if (pCurrentForm == this)
\r
54 SwitchToForm(requestId, pArgs);
\r
61 void FormMgr::OnUserEventReceivedN(RequestId requestId, Osp::Base::Collection::IList* pArgs)
\r
63 SwitchToForm(requestId, pArgs);
\r
66 void FormMgr::SwitchToForm(RequestId requestId, Osp::Base::Collection::IList* pArgs)
\r
68 Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
\r
72 case REQUEST_MainListForm:
\r
74 MainListForm *pMainListForm = new MainListForm();
\r
75 pMainListForm->Initialize();
\r
76 pFrame->AddControl(*pMainListForm);
\r
77 pFrame->SetCurrentForm(*pMainListForm);
\r
78 pMainListForm->Draw();
\r
79 if (__pPreviousForm != null)
\r
80 pFrame->RemoveControl(*__pPreviousForm);
\r
81 __pPreviousForm = pMainListForm;
\r
85 case REQUEST_XmlReader:
\r
87 XmlReader *pXmlReader = new XmlReader();
\r
88 pXmlReader->Initialize();
\r
89 pFrame->AddControl(*pXmlReader);
\r
90 pFrame->SetCurrentForm(*pXmlReader);
\r
91 pXmlReader->XMLReaderRun();
\r
93 if (__pPreviousForm != null)
\r
94 pFrame->RemoveControl(*__pPreviousForm);
\r
95 __pPreviousForm = pXmlReader;
\r
99 case REQUEST_HtmlParser:
\r
101 HtmlParser *pHtmlParser = new HtmlParser();
\r
102 pHtmlParser->Initialize();
\r
103 pFrame->AddControl(*pHtmlParser);
\r
104 pFrame->SetCurrentForm(*pHtmlParser);
\r
105 pHtmlParser->RunhtmlParser();
\r
106 pHtmlParser->Draw();
\r
107 if (__pPreviousForm != null)
\r
108 pFrame->RemoveControl(*__pPreviousForm);
\r
109 __pPreviousForm = pHtmlParser;
\r
113 case REQUEST_XmlParser:
\r
115 XmlParser *pXmlParser = new XmlParser();
\r
116 pXmlParser->Initialize();
\r
117 pFrame->AddControl(*pXmlParser);
\r
118 pFrame->SetCurrentForm(*pXmlParser);
\r
119 pXmlParser->Draw();
\r
120 if (__pPreviousForm != null)
\r
121 pFrame->RemoveControl(*__pPreviousForm);
\r
122 __pPreviousForm = pXmlParser;
\r
125 case REQUEST_XmlWriter:
\r
127 XmlWriter *pXmlWriter = new XmlWriter();
\r
128 pXmlWriter->Initialize();
\r
129 pFrame->AddControl(*pXmlWriter);
\r
130 pFrame->SetCurrentForm(*pXmlWriter);
\r
131 pXmlWriter->Draw();
\r
132 if (__pPreviousForm != null)
\r
133 pFrame->RemoveControl(*__pPreviousForm);
\r
134 __pPreviousForm = pXmlWriter;
\r