3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 /*@file: ArticleReaderForm.cpp
20 *@brief: This header file contains the definitions of the ArticleReaderForm class.
26 #include "IntArticleReaderForm.h"
27 #include "IntCommonLib.h"
28 #include "IntSceneRegister.h"
30 using namespace Tizen::App;
31 using namespace Tizen::Base;
32 using namespace Tizen::Base::Collection;
33 using namespace Tizen::Graphics;
34 using namespace Tizen::Ui;
35 using namespace Tizen::Ui::Controls;
36 using namespace Tizen::Ui::Scenes;
37 using namespace Tizen::Web::Controls;
39 static const wchar_t* IDB_SMALL_FONT = L"I01_font_button_left.png";
40 static const wchar_t* IDB_LARGE_FONT = L"I01_font_button_right.png";
41 static const wchar_t* IDB_FINDWORD_INPUT_FIELD_BG = L"I01_toolbar_input_field_findword.9.png";
43 const int ArticleReaderForm::IDA_MORE_BUTTON = 101;
44 const int ArticleReaderForm::IDA_BACK_BUTTON = 102;
45 const int ArticleReaderForm::IDA_SMALL_FONT_BUTTON = 103;
46 const int ArticleReaderForm::IDA_LARGE_FONT_BUTTON = 104;
47 const int ArticleReaderForm::IDA_SAVE_CLICKED = 105;
48 const int ArticleReaderForm::IDA_SHARE_CLICKED = 106;
49 const int ArticleReaderForm::IDA_PRINT_CLICKED = 107;
50 const int ArticleReaderForm::IDA_COPY_TEXT_CLICKED = 108;
51 const int ArticleReaderForm::IDA_FIND_TEXT_CLICKED = 109;
52 const int ArticleReaderForm::IDA_SHARE_TEXT_CLICKED = 110;
53 const int ArticleReaderForm::IDA_FINDWORD_CANCEL_CLICKED = 111;
54 const int ArticleReaderForm::IDA_FINDWORD_CLEAR_CLICKED = 112;
55 const int ArticleReaderForm::IDA_FINDWORD_NEXT_CLICKED = 113;
56 const int ArticleReaderForm::IDA_FINDWORD_PREV_CLICKED =114;
58 ArticleReaderForm::ArticleReaderForm(void):
63 ,__pSmallFontBtn(null)
64 ,__pLargeFontBtn(null)
66 ,__pHitElementResult(null)
67 ,__pSelectionMenu(null)
69 ,__pFindWordBgLabel(null)
70 ,__pFindWordClear(null)
71 ,__pFindWordCountLabel(null)
72 ,__pFindWordControl(null)
73 ,__pFindWordEditField(null)
74 ,__pFindWordNext(null)
75 ,__pFindWordPrev(null)
80 ArticleReaderForm::~ArticleReaderForm(void)
82 // RemoveAllControls();
86 ArticleReaderForm::Initialize(void)
88 AppLog("ArticleReaderForm::Initialize entered");
89 Construct(L"IDL_ARTICLE_READER_FORM");
94 ArticleReaderForm::OnInitializing(void)
96 AppLog("ArticleReaderForm::OnInitializing entered");
100 SceneManager* pSceneManager = SceneManager::GetInstance();
101 if (pSceneManager == null)
105 pSceneManager->AddSceneEventListener(IDSCN_ARTICLE_READER, *this);
107 __pFooterPanel = static_cast<Panel*>(GetControl("IDC_PANEL1",true));
108 if(__pFooterPanel == null)
110 AppLog("GetControl failed for FooterPanel button");
114 __pWebReader = new (std::nothrow) Web();
115 __pWebReader->Construct(Rectangle(0,0, GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight()));
117 settings.SetInputStyle(INPUT_STYLE_OVERLAY);
118 settings.SetFontSize(24/*SettingPresentationModel::GetInstance()->GetReaderFontSize()*/);
120 r = __pWebReader->SetSetting(settings);
121 AddControl(__pWebReader);
122 SetControlAlwaysAtBottom(*__pWebReader,true);
123 __pWebReader->LoadUrl("http://google.com");//temporary only for testing
125 AppLogDebug("Web setting add failed with %s", GetErrorMessage(r));
127 __pWebReader->AddTouchEventListener(*this);
128 __pWebReader->SetWebUiEventListener(this);
129 __pWebReader->SetTextSearchListener(this);
130 __pMoreBtn = static_cast<Button*>(GetControl("IDC_MORE_BUTTON",true));
131 if(__pMoreBtn == null)
133 AppLog("GetControl failed for more button");
136 __pMoreBtn->AddActionEventListener(*this);
137 __pMoreBtn->SetActionId(IDA_MORE_BUTTON);
140 __pBackBtn = static_cast<Button*>(GetControl("IDC_BACK_BUTTON",true));
141 if(__pBackBtn == null)
143 AppLog("GetControl failed for back button");
146 __pBackBtn->AddActionEventListener(*this);
147 __pBackBtn->SetActionId(IDA_BACK_BUTTON);
150 __pSmallFontBtn = static_cast<Button*>(GetControl("IDC_SMALL_FONT_BUTTON",true));
151 if(__pSmallFontBtn == null)
153 AppLog("GetControl failed for small font button");
156 __pSmallFontBtn->AddActionEventListener(*this);
157 __pSmallFontBtn->SetActionId(IDA_SMALL_FONT_BUTTON);
158 __pSmallFontBtn->SetEnabled(false);
161 __pLargeFontBtn = static_cast<Button*>(GetControl("IDC_LARGE_FONT_BUTTON",true));
162 if(__pLargeFontBtn == null)
164 AppLog("GetControl failed for large font button");
167 __pLargeFontBtn->AddActionEventListener(*this);
168 __pLargeFontBtn->SetActionId(IDA_LARGE_FONT_BUTTON);
170 AddOrientationEventListener(*this);
176 ArticleReaderForm::OnTerminating(void)
178 AppLog("ArticleReaderForm::OnTerminating entered");
179 result r = E_SUCCESS;
184 ArticleReaderForm::OnActionPerformed(const Control& source, int actionId)
186 AppLog("ArticleReaderForm::OnActionPerformed entered actionId %d",actionId);
188 SceneManager* pSceneManager = SceneManager::GetInstance();
189 result r = E_SUCCESS;
191 if (pSceneManager == null)
198 case IDA_MORE_BUTTON:
200 if(__pMoreMenu != null)
205 __pMoreMenu = new(std::nothrow) ContextMenu();
206 r = __pMoreMenu->Construct(Point(50,GetClientAreaBounds().height),CONTEXT_MENU_STYLE_LIST,CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
208 TryCatch(!IsFailed(r),,"Contextmenu creation failed with%s",GetErrorMessage(r));
210 __pMoreMenu->AddItem(CommonUtil::GetString(L"IDS_COM_SK_SAVE"),IDA_SAVE_CLICKED);
211 __pMoreMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_CLICKED);
212 __pMoreMenu->AddItem(CommonUtil::GetString(L"IDS_COM_SK_PRINT"),IDA_PRINT_CLICKED);
213 __pMoreMenu->SetMaxVisibleItemsCount(3);
214 __pMoreMenu->SetShowState(true);
216 __pMoreMenu->Invalidate(true);
217 __pMoreMenu->AddActionEventListener(*this);
218 SetControlAlwaysOnTop(*__pMoreMenu, true);
222 case IDA_BACK_BUTTON:
224 SceneManager::GetInstance()->GoBackward(BackwardSceneTransition());
227 case IDA_SMALL_FONT_BUTTON:
229 WebSetting setting = __pWebReader->GetSetting();
230 setting.SetFontSize(24);
232 __pWebReader->SetSetting(setting);
233 __pSmallFontBtn->SetEnabled(false);
234 __pSmallFontBtn->Invalidate(true);
236 __pLargeFontBtn->SetEnabled(true);
237 __pLargeFontBtn->Invalidate(true);
240 case IDA_LARGE_FONT_BUTTON:
242 WebSetting setting = __pWebReader->GetSetting();
243 setting.SetFontSize(32);
244 __pWebReader->SetSetting(setting);
246 __pLargeFontBtn->SetEnabled(false);
247 __pLargeFontBtn->Invalidate(true);
249 __pSmallFontBtn->SetEnabled(true);
250 __pSmallFontBtn->Invalidate(true);
254 case IDA_SAVE_CLICKED:
256 if(__pWebReader !=null)
258 r = __pWebReader->SavePageAsPdf(UiApp::GetInstance()->GetAppRootPath()+"//data//test.pdf");
259 AppLog("SavePageAsPdf result %s",GetErrorMessage(r));
261 int __modalMsgBoxResult;
262 MessageBox* pMsgBox = new MessageBox();
263 pMsgBox->Construct("Saved","Saved at "+UiApp::GetInstance()->GetAppRootPath()+"//data//test.pdf",MSGBOX_STYLE_OK,3000);
264 pMsgBox->ShowAndWait(__modalMsgBoxResult);
267 __modalMsgBoxResult = 0;
272 case IDA_SHARE_CLICKED:
279 __pPopUp = new(std::nothrow) SharePopup();
280 __pPopUp->Initialize();
282 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
283 pShareInfo->SetPageTitle(L"Google");//temporary only for testing
284 pShareInfo->SetPageUrl(L"http://www.google.com");//temporary only for testing
285 pShareInfo->SetImageAttached(false);
286 __pPopUp->RemoveAllShareInfo();
287 __pPopUp->AddShareInfo(pShareInfo);
289 __pPopUp->SetShowState(true);
293 case IDA_PRINT_CLICKED:
295 r = __pWebReader->SavePageAsPdf(UiApp::GetInstance()->GetAppRootPath()+"//data//test.pdf");
296 AppLog("SavePageAsPdf result %s",GetErrorMessage(r));
298 AppLog("RequestPrint called!");
299 AppControl* pAc = Tizen::App::AppManager::FindAppControlN(L"org.tizen.mobileprint", L"http://tizen.org/appcontrol/operation/print");
300 result nResult = E_FAILURE;
303 AppLog("TestPrint if (pAc) == true");
308 String fileType = L"service_print_files_type";
309 String typeVal = L"DOC";
311 String fileCount = L"service_print_files_count";
312 String countVal = L"1";
313 String fileFolder= L"service_print_files_folder_name";
314 String folderVal = UiApp::GetInstance()->GetAppRootPath()+"//data";
316 map.Add(&fileCount, &countVal);
317 map.Add(&fileFolder, &folderVal);
318 map.Add(&fileType, &typeVal);
320 String fileName = L"service_print_files_files_name";
322 ArrayList fileNameList;
323 fileNameList.Construct();
324 String file1 = L"test.pdf";
326 fileNameList.Add(&file1);
327 map.Add(&fileName, &fileNameList);
329 nResult = pAc->Start(NULL, NULL, &map, NULL);
331 if (nResult == E_SUCCESS) AppLog("TestPrint ret == E_SUCCESS");
332 else if (nResult == E_MAX_EXCEEDED)
333 AppLog("TestPrint ret == E_MAX_EXCEEDED");
334 else if (nResult == E_OBJ_NOT_FOUND)
335 AppLog("TestPrint ret == E_OBJ_NOT_FOUND");
336 else if (nResult == E_IN_PROGRESS)
337 AppLog("TestPrint ret == E_IN_PROGRESS");
338 else if (nResult == E_PRIVILEGE_DENIED)
339 AppLog("TestPrint ret == E_PRIVILEGE_DENIED");
340 else if(nResult == E_SYSTEM)
341 AppLog("TestPrint ret == E_SYSTEM");
347 int __modalMsgBoxResult;
348 MessageBox* pMsgBox = new MessageBox();
349 pMsgBox->Construct("Not Supported","Not Supported",MSGBOX_STYLE_OK,3000);
350 pMsgBox->ShowAndWait(__modalMsgBoxResult);
353 __modalMsgBoxResult = 0;
357 case IDA_COPY_TEXT_CLICKED:
359 __pWebReader->ReleaseBlock();
360 // Sets data to a clip board item
362 String resourcePath = App::GetInstance()->GetAppResourcePath();
363 item.Construct(CLIPBOARD_DATA_TYPE_TEXT, __pWebReader->GetTextFromBlock());
365 // copying the item to clipboard
366 Clipboard* pClipboard = Clipboard::GetInstance();
367 if (pClipboard != null)
369 pClipboard->CopyItem(item);
373 case IDA_FIND_TEXT_CLICKED:
376 __pWebReader->SetBounds(0,__pFindWordControl->GetHeight(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight() - __pFindWordControl->GetHeight());
379 case IDA_SHARE_TEXT_CLICKED:
381 AppLogDebug("IDA_SHARE_TEXT_CLICKED");
387 __pPopUp = new(std::nothrow) SharePopup();
388 __pPopUp->Initialize();
389 if (__pHitElementResult != null)
391 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
392 pShareInfo->SetPageTitle(L"");
393 pShareInfo->SetPageUrl(__pWebReader->GetTextFromBlock());
394 pShareInfo->SetImageAttached(false);
395 __pPopUp->RemoveAllShareInfo();
396 __pPopUp->AddShareInfo(pShareInfo);
397 __pPopUp->SetShowState(true);
403 case IDA_FINDWORD_CANCEL_CLICKED:
405 // __currentSearchStr = L"";
406 // __currentWordIndex = 0;
407 // __maxOccurrances = 0;
408 __pFindWordEditField->SetText(L"");
409 __pFindWordNext->SetEnabled(false);
410 __pFindWordPrev->SetEnabled(false);
411 __pFindWordCountLabel->SetText(L"0/0");
412 __pWebReader->SearchText(L"aaaabbbbcccc",true);
413 __pFooterPanel->SetShowState(true);
414 __pFindWordControl->SetShowState(false);
419 case IDA_FINDWORD_CLEAR_CLICKED:
424 case IDA_FINDWORD_NEXT_CLICKED:
429 case IDA_FINDWORD_PREV_CLICKED:
442 ArticleReaderForm::OnKeypadOpened(Tizen::Ui::Control& source)
444 __pFooterPanel->SetShowState(false);
448 ArticleReaderForm::OnKeypadClosed(Tizen::Ui::Control& source)
450 __pFooterPanel->SetShowState(true);
455 ArticleReaderForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
457 AppLog("ArticleReaderForm::OnTouchLongPressed %d, %d" ,currentPosition.x,currentPosition.y);
459 if (__pHitElementResult != null)
461 delete __pHitElementResult;
462 __pHitElementResult = null;
465 if (__pWebReader != null)
467 AppLog("ArticleReaderForm::OnTouchLongPressed web not null");
468 __pHitElementResult = __pWebReader->GetElementByPointN(currentPosition);
471 if (__pHitElementResult == null)
476 if (__pHitElementResult->HasImage() == true)
480 else if(__pHitElementResult->HasUrl() == true)
486 String tagName = __pHitElementResult->GetTagName();
487 String type = __pHitElementResult->GetAttributeValue("type");
488 String value = __pHitElementResult->GetAttributeValue(L"value");
489 String innerHtml = __pHitElementResult->GetAttributeValue(L"innerHTML");
491 result r =__pWebReader->SetBlockSelectionPosition(currentPosition);
492 AppLog("setselectionselectedornot %s",GetErrorMessage(r));
495 // __inputEventToBeSupressed = true;
499 ArticleReaderForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
501 AppLog("ArticleReaderForm::OnSceneActivatedN entered");
505 ArticleReaderForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
507 AppLog("ArticleReaderForm::OnSceneDeactivated entered");
511 ArticleReaderForm::OnTextFound(int totalCount, int currentOrdinal)
513 AppLog("ArticleReaderForm::OnTextFound totalCount %d",totalCount);
514 AppLog("ArticleReaderForm::OnTextFound currentOrdinal %d",currentOrdinal);
516 if(totalCount == -1 || totalCount == 0)
518 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
519 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
521 else if(totalCount > 100)
523 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
524 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
528 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
529 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
534 __pFindWordNext->SetEnabled(false);
538 __pFindWordNext->SetEnabled(true);
541 String countStr = L"";
542 countStr.Append(currentOrdinal);
543 countStr.Append(L"/");
544 countStr.Append(totalCount);
545 __pFindWordCountLabel->SetText(countStr);
546 __pFindWordCountLabel->Invalidate(false);
548 //FindNextWord(true);
549 //Update the controls
550 __pFindWordNext->Invalidate(false);
554 ArticleReaderForm::OnWebPageBlockSelected(Tizen::Web::Controls::Web& source, Tizen::Graphics::Point& startPoint, Tizen::Graphics::Point& endPoint)
556 AppLog("ArticleReaderForm::OnWebPageBlockSelected");
557 if (__pHitElementResult != null)
559 delete __pHitElementResult;
560 __pHitElementResult = null;
563 if (__pWebReader != null)
565 AppLog("ArticleReaderForm::OnWebPageBlockSelected web not null");
566 __pHitElementResult = __pWebReader->GetElementByPointN(startPoint);
567 if(GetLastResult() == E_INVALID_ARG)
569 __pHitElementResult = __pWebReader->GetElementByPointN(endPoint);
573 if (__pHitElementResult == null)
578 if (__pHitElementResult->HasImage() != true)
580 String tagName = __pHitElementResult->GetTagName();
581 String type = __pHitElementResult->GetAttributeValue("type");
584 if (((tagName.CompareTo(L"INPUT") == 0) || tagName.CompareTo(L"TEXTAREA") == 0))
590 AppLog("ArticleReaderForm::OnWebPageBlockSelected no paste option");
592 if(__pHitElementResult->GetUrl().GetLength() > 0)
595 InitSelectTextContextMenu(endPoint);
596 __pSelectionMenu->SetShowState(true);
597 __pSelectionMenu->Show();
598 __pSelectionMenu->Invalidate(true);
601 AppLog("ArticleReaderForm::OnWebPageBlockSelected tag name is %ls",tagName.GetPointer());
602 AppLog("ArticleReaderForm::OnWebPageBlockSelected type name is %ls",type.GetPointer());
608 ArticleReaderForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
610 AppLog("ArticleReaderForm::OnOrientationChanged entered");
611 if(__pFindWordControl)
613 if (__pFindWordBgLabel != null)
615 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
618 __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
623 __pFindWordControl->SetBounds(0,0, __pFindWordControl->GetWidth(), __pFindWordControl->GetHeight());
630 ArticleReaderForm::OnTextValueChanged (const Tizen::Ui::Control &source)
633 if (__pFindWordEditField != null)
635 __pFindWordNext->SetEnabled(false);
636 __pFindWordPrev->SetEnabled(false);
637 __pFindWordNext->Invalidate(true);
638 __pFindWordPrev->Invalidate(true);
639 __pFindWordCountLabel->SetText(L"0/0");
640 __pFindWordCountLabel->Invalidate(true);
642 if (__pFindWordEditField->GetText().GetLength() > 0)
648 __pFindWordPrev->SetEnabled(false);
649 __pWebReader->SearchText(L"aaaaaaaabbbbbbbccccccc");
654 //// __currentSearchStr = L"aaaaaaaabbbbbbbccccccc";
655 // StartWordSearch();
656 //// __currentSearchStr = L"";
657 // AppLogDebug("Enter something");
662 ArticleReaderForm::InitSelectTextContextMenu(Tizen::Graphics::Point p)
664 result r = E_SUCCESS;
665 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
667 AppLog("ArticleReaderForm::InitSelectTextContextMenu clicked on text");
668 if (__pSelectionMenu != null)
670 delete __pSelectionMenu;
671 __pSelectionMenu = null;
677 direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
681 direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
683 __pSelectionMenu = new (std::nothrow) ContextMenu();
684 r = __pSelectionMenu->Construct(p, CONTEXT_MENU_STYLE_GRID, direction);
685 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
687 r = __pSelectionMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_COPY"),IDA_COPY_TEXT_CLICKED);
688 r = __pSelectionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"),IDA_FIND_TEXT_CLICKED);
689 r = __pSelectionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_TEXT_CLICKED);
691 __pSelectionMenu->SetMaxVisibleItemsCount(3);
692 __pSelectionMenu->AddActionEventListener(*this);
693 SetControlAlwaysOnTop(*__pSelectionMenu, true);
700 ArticleReaderForm::InitFindWordPanel(void)
702 result r = E_SUCCESS;
703 Bitmap *pIconBitmap = null;
705 if (__pFindWordControl != null)
707 __pFindWordControl->SetBounds(0,0, __pFindWordControl->GetWidth(), __pFindWordControl->GetHeight());
708 __pFindWordControl->SetShowState(true);
709 __pFindWordEditField->SetText(__pWebReader->GetTextFromBlock());
712 __pFindWordEditField->SetFocus();
714 if (__pFindWordEditField->GetText().GetLength() > 0)
721 __pFindWordControl = new (std::nothrow) Panel();
722 r = __pFindWordControl->Construct(L"IDL_FIND_ON_PAGE");
725 AppLogException("There is some problem in the xml file. Please check.");
728 AddControl(__pFindWordControl);
729 __pFindWordControl->SetBounds(0,0, __pFindWordControl->GetWidth(), __pFindWordControl->GetHeight());
730 SetControlAlwaysOnTop(*__pFindWordControl,true);
731 __pFindWordControl->SetShowState(true);
732 __pFindWordControl->Invalidate(false);
734 __pFindWordBgLabel = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_LABEL1", true));
735 if (__pFindWordBgLabel != null)
737 Panel* pPanel1 = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL1", true));
738 Rectangle pRect = pPanel1->GetBounds();
739 pRect.x = pRect.y = 0;
740 __pFindWordBgLabel->SetBounds(pRect);
741 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
744 AppLogDebug("InitFindWordPanel: Coming here");
745 __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
750 AppLogDebug("InitFindWordPanel: shouldn't Come here");
754 Button* pfindWordCancel = null;
755 pfindWordCancel = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_CANCEL", true));
756 if (pfindWordCancel == null)
758 AppLogException("There is some problem in the xml file. Please check.");
761 pfindWordCancel->SetActionId(IDA_FINDWORD_CANCEL_CLICKED);
762 pfindWordCancel->AddActionEventListener(*this);
764 __pFindWordClear = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_CLEAR", true));
765 if (__pFindWordClear == null)
767 AppLogException("There is some problem in the xml file. Please check.");
771 __pFindWordClear->SetActionId(IDA_FINDWORD_CLEAR_CLICKED);
772 __pFindWordClear->AddActionEventListener(*this);
774 __pFindWordNext = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_NEXT", true));
775 if (__pFindWordNext == null)
777 AppLogException("There is some problem in the xml file. Please check.");
781 __pFindWordNext->SetActionId(IDA_FINDWORD_NEXT_CLICKED);
782 __pFindWordNext->AddActionEventListener(*this);
784 __pFindWordPrev = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_PREV", true));
785 if (__pFindWordPrev == null)
787 AppLogException("There is some problem in the xml file. Please check.");
791 __pFindWordPrev->SetActionId(IDA_FINDWORD_PREV_CLICKED);
792 __pFindWordPrev->AddActionEventListener(*this);
794 __pFindWordNext->SetEnabled(false);
795 __pFindWordPrev->SetEnabled(false);
797 __pFindWordCountLabel = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_FIND_COUNT_LABEL", true));
798 if (__pFindWordCountLabel == null)
800 AppLogException("There is some problem in the xml file. Please check.");
804 __pFindWordEditField = static_cast<EditField*>(__pFindWordControl->GetControl(L"IDC_FIND_WORD_EDITFIELD", true));
805 if (__pFindWordEditField == null)
807 AppLogException("There is some problem in the xml file. Please check.");
810 __pFindWordEditField->SetText(__pWebReader->GetTextFromBlock());
811 __pFindWordEditField->AddTextEventListener(*this);
812 __pFindWordEditField->AddKeypadEventListener(*this);
813 __pFindWordEditField->SetOverlayKeypadCommandButtonVisible(false);
815 __pFindWordEditField->SetFocus();
816 // __pFindWordEditField->ShowKeypad();
817 if (__pFindWordEditField->GetText().GetLength() > 0)
825 ArticleReaderForm::StartWordSearch()
827 __pFindWordPrev->SetEnabled(false);
828 __pWebReader->SearchTextAllAsync(__pFindWordEditField->GetText(), false);
833 ArticleReaderForm::RelayoutControls()
835 if( __pFindWordControl && __pFindWordControl->GetShowState() == true)
837 __pFindWordControl->SetBounds(0,0, __pFindWordControl->GetWidth(), __pFindWordControl->GetHeight());
838 __pWebReader->SetBounds(0,__pFindWordControl->GetHeight(),GetClientAreaBounds().width, GetClientAreaBounds().height - __pFooterPanel->GetHeight() - __pFindWordControl->GetHeight());
843 __pWebReader->SetBounds(0,0,GetClientAreaBounds().width, GetClientAreaBounds().height - __pFooterPanel->GetHeight());