2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (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 FUi_ResourceConfigParser.cpp
20 * @brief This is the header file for the ConfigParser.
22 * This header file contains the declarations of the ConfigParser.
25 #include <FBaseByteBuffer.h>
26 #include <FBaseInteger.h>
27 #include <FBaseString.h>
28 #include <FBaseSysLog.h>
29 #include <FBaseColHashMapT.h>
31 #include <FGrpColor.h>
32 #include <FGrpDimension.h>
33 #include <FBase_StringConverter.h>
34 #include "FUi_CoordinateSystemUtils.h"
35 #include "FUi_ResourceMapContainer.h"
36 #include "FUi_ResourceConfigParser.h"
38 using namespace Tizen::Base;
39 using namespace Collection;
40 using namespace Tizen::Io;
41 using namespace Tizen::Graphics;
45 class _ColorMatchingMapProvider
46 : public IHashCodeProviderT <String>
49 _ColorMatchingMapProvider(void) {}
50 virtual ~_ColorMatchingMapProvider(void) {}
52 virtual int GetHashCode(const String& obj) const
54 return obj.GetHashCode();
58 class _ColorMatchingMapComparer
59 : public IComparerT <String>
62 _ColorMatchingMapComparer(void) {}
63 virtual ~_ColorMatchingMapComparer(void) {}
64 virtual result Compare(const String& obj1, const String& obj2, int& cmp) const
82 xmlSAXHandler mySaxHandler = {null, null, null, null, null, null, null, null, null, null, null, null, null, null,
83 Tizen::Ui::_Resource::ConfigParser::StartSaxFunc,
84 null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null};
87 namespace Tizen { namespace Ui { namespace _Resource
89 ConfigParser* pConfigXmlHandler = null;
90 HashMapT<String, String*>* pColorMatchingMap = null;
92 ConfigParser::ColorMatchingMap::ColorMatchingMap(void)
93 :HashMapT<String, String*>()
97 __pProvider = new (std::nothrow) _ColorMatchingMapProvider;
98 SysTryReturnVoidResult(NID_UI, __pProvider, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
99 __pComparer = new (std::nothrow) _ColorMatchingMapComparer;
100 SysTryReturnVoidResult(NID_UI, __pComparer, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
102 ConfigParser::ColorMatchingMap::~ColorMatchingMap(void)
104 result r = E_SUCCESS;
105 Collection::IMapEnumeratorT< String, String* >* pMapEnum = null;
106 if (Collection::HashMapT<String, String*>::GetCount() > 0)
108 pMapEnum = Collection::HashMapT<String, String*>::GetMapEnumeratorN();
109 SysTryReturn(NID_UI_ANIM, (pMapEnum != null), , E_SYSTEM, "[E_SYSTEM] System Error.");
111 Collection::MapEntryT< String, String* > value;
112 while ((pMapEnum->MoveNext() == E_SUCCESS))
114 r = pMapEnum->GetCurrent(value);
115 SysTryCatch(NID_UI_ANIM, (r == E_SUCCESS), r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System Error.");
117 String* pObj = value.GetValue();
120 Collection::HashMapT<String, String*>::RemoveAll();
131 ConfigParser::ColorMatchingMap::Initialize(const String& version, const String& dVersion)
133 if (HashMapT<String, String*>::Construct(0,0,*__pProvider, *__pComparer) != E_SUCCESS)
138 if(version == L"beta1")
140 Add(L"W0612", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_handle_text_disabled"));
141 Add(L"B0622", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_list_item_divider_01"));
142 Add(L"B0231", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_item_divider_line_01"));
143 Add(L"B022", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_divider_line_01"));
145 Add(L"B011", new (std::nothrow) String(L"DEFAULTCOLORTABLE::form_bg"));
146 Add(L"B012", new (std::nothrow) String(L"DEFAULTCOLORTABLE::form_group_list_bg"));
147 Add(L"B013", new (std::nothrow) String(L"DEFAULTCOLORTABLE::form_black"));
148 Add(L"B014", new (std::nothrow) String(L"DEFAULTCOLORTABLE::form_white"));
149 Add(L"B015", new (std::nothrow) String(L"DEFAULTCOLORTABLE::form_list_reorder_bg"));
150 Add(L"B0211", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_bg"));
151 Add(L"B0211D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_bg_disabled"));
152 Add(L"B0212", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_context_item_bg"));
153 Add(L"B0213", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_grid_item_bg"));
154 Add(L"B0214", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_2nd_depth_item_bg"));
155 Add(L"B0215", new (std::nothrow) String(L"DEFAULTCOLORTABLE::searchbar_bg"));
156 Add(L"B0216", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_select_all_item_bg"));
157 Add(L"B0217", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_item_bg"));
158 Add(L"B0217D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_item_bg_disabled"));
159 Add(L"B0221", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_divider_line_01"));
160 Add(L"B0222", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_divider_line_02"));
161 Add(L"B0231L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_item_divider_line_01"));
162 Add(L"B0231L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_item_divider_line_02"));
163 Add(L"B0232", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_item_bar"));
164 Add(L"B0233", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_item_top_line"));
165 Add(L"B031", new (std::nothrow) String(L"DEFAULTCOLORTABLE::indicator_bg"));
166 Add(L"B041", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_bg_pressed"));
167 Add(L"B042", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_item_bg_pressed"));
168 Add(L"B043", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_item_bg_pressed"));
169 Add(L"B044", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_item_bg_pressed"));
170 Add(L"B0511", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_bg"));
171 Add(L"B0512", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_optiontray_bg"));
172 Add(L"B0513", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_tab_bg"));
173 Add(L"B0514", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_tab_item_bg"));
174 Add(L"B0514P1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_tab_item_bg_selected"));
175 Add(L"B0514P2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_tab_item_bg_edit"));
176 Add(L"B0515", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_toolbar_bg"));
177 Add(L"B0516", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_toolbar_item_bg_pressed"));
178 Add(L"B0517", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_tab_item_bg"));
179 Add(L"B0517P1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_tab_item_selected"));
180 Add(L"B0517P2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_tab_item_bg_edit"));
181 Add(L"B0518", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_item_bg"));
182 Add(L"B0518P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::tabbar_item_bg"));
183 Add(L"B0520", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_softkey_item_bg_normal"));
184 Add(L"B0520P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_softkey_item_bg_pressed"));
185 Add(L"B052L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_item_normal"));
186 Add(L"B052L1P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_item_selected"));
187 Add(L"B052L1D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_item_disabled"));
188 Add(L"B052L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_translucent_item_normal"));
189 Add(L"B052L2P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_more_icon_pressed"));
190 Add(L"B052L3", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_segment_font_normal"));
191 Add(L"B052L4", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_text_normal"));
192 Add(L"B052L4P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_text_pressed"));
193 Add(L"B052L4D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_text_disabled"));
194 Add(L"B052L5", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_title_text_normal"));
195 Add(L"B052L6", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_tab_text_normal"));
196 Add(L"B052L6P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_tab_text_pressed"));
197 Add(L"B052L8", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_footer_text_normal"));
198 Add(L"B052L8P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_footer_text_pressed"));
199 Add(L"B052L8D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_footer_text_disabled"));
200 Add(L"B052L9", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_softkey_item_icon_normal"));
201 Add(L"B052L9P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_softkey_item_icon_pressed"));
202 Add(L"B052L9D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_softkey_item_icon_disabled"));
203 Add(L"B0531", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_segment_item_bg_normal"));
204 Add(L"B0532", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_segment_item_bg_selected"));
205 Add(L"B0533", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_segment_item_bg_normal"));
206 Add(L"B0534", new (std::nothrow) String(L"DEFAULTCOLORTABLE::footer_segment_item_bg_selected"));
207 Add(L"B0535", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_translucent_segment_item_bg_normal"));
208 Add(L"B0536", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_translucent_segment_item_bg_selected"));
209 Add(L"B0537", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_expandable_line"));
210 Add(L"B0545", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_button_item_bg_pressed"));
211 Add(L"B0556", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_translucent_item_bg"));
212 Add(L"B0557", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_translucent_item_bg_normal"));
213 Add(L"B0558", new (std::nothrow) String(L"DEFAULTCOLORTABLE::header_translucent_item_bg_pressed"));
214 Add(L"B061L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_bg"));
215 Add(L"B061L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_title_bg"));
216 Add(L"B061L3", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_bottom_bg"));
217 Add(L"B061L4", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_bg"));
218 Add(L"B0621", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_list_item_divider"));
219 Add(L"B0622L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_list_item_divider_01"));
220 Add(L"B0622L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_list_item_divider_02"));
221 Add(L"B0623L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_grid_item_divider_01"));
222 Add(L"B0623L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_grid_item_divider_02"));
223 Add(L"B063L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_text"));
224 Add(L"B063L1P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_item_text_pressed"));
225 Add(L"B063L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::ticker_detail_text"));
226 Add(L"B063L3", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_progress_text"));
227 Add(L"B063L4", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_title_text"));
228 Add(L"B063L5", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_item_text_normal"));
229 Add(L"B063L5D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::contextmenu_item_text_disabled"));
230 Add(L"B071", new (std::nothrow) String(L"DEFAULTCOLORTABLE::scroll_bar_bg"));
231 Add(L"B0721", new (std::nothrow) String(L"DEFAULTCOLORTABLE::fastscroll_index_bar_text_normal"));
232 Add(L"B0722", new (std::nothrow) String(L"DEFAULTCOLORTABLE::fastscroll_index_bar_text_selected"));
233 Add(L"B0723", new (std::nothrow) String(L"DEFAULTCOLORTABLE::fastscroll_index_bar_bg"));
234 Add(L"B0724", new (std::nothrow) String(L"DEFAULTCOLORTABLE::fastscroll_index_bar_line_01"));
235 Add(L"B0725", new (std::nothrow) String(L"DEFAULTCOLORTABLE::fastscroll_index_bar_line_02"));
236 Add(L"B0731", new (std::nothrow) String(L"DEFAULTCOLORTABLE::fastscroll_popup_bg"));
237 Add(L"B0732", new (std::nothrow) String(L"DEFAULTCOLORTABLE::fastscroll_popup_text"));
238 Add(L"B0741", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_fastscroll_index_bar_text_normal"));
239 Add(L"B0742", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_fastscroll_index_bar_text_selected"));
240 Add(L"B0743", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_fastscroll_index_bar_bg"));
241 Add(L"B0744", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_fastscroll_index_bar_line_01"));
242 Add(L"B0745", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_fastscroll_index_bar_line_02"));
243 Add(L"B0751", new (std::nothrow) String(L"DEFAULTCOLORTABLE::old_fastscroll_popup_bg"));
244 Add(L"F011L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_text_normal"));
245 Add(L"F011L1P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_text_pressed"));
246 Add(L"F011L1D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_text_disabled"));
247 Add(L"F011L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_sub_text_setting_normal"));
248 Add(L"F011L2D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_sub_text_setting_disabled"));
249 Add(L"F011L3", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_sub_text_title_normal"));
250 Add(L"F011L3D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_sub_text_title_disabled"));
251 Add(L"F011L4", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_text_read_normal"));
252 Add(L"F011L4D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_text_read_disabled"));
253 Add(L"F011L5", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_title_text"));
254 Add(L"F011L6", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_no_content_text"));
255 Add(L"F011L7", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_3line_2nd_text_normal"));
256 Add(L"F011L7D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_3line_2nd_text_disabled"));
257 Add(L"F011L8", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_text_invalid"));
258 Add(L"F011L9", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_text_white"));
259 Add(L"F011L10", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_bubble_text"));
260 Add(L"F011L11", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_contact_text"));
261 Add(L"F011L12", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_name_text"));
262 Add(L"F011L13", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_edit_mode_text_01"));
263 Add(L"F011L14", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_edit_mode_text_02"));
264 Add(L"F011L15", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_message_time_failed_text"));
265 Add(L"F011L16", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_message_time_sent_text"));
266 Add(L"F011L17", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_message_time_receive_text"));
267 Add(L"F011L18", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_message_date_text"));
268 Add(L"F011L19", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_message_group_chat_name_text"));
269 Add(L"F011L20", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_sweep_text"));
270 Add(L"F011L21", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_help_text"));
271 Add(L"F011L22", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_message_help_text"));
272 Add(L"F021L1i", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_icon_normal"));
273 Add(L"F021L1iP", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_icon_pressed"));
274 Add(L"F021L1iD", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_icon_disabled"));
275 Add(L"F022L1i", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_star_icon_normal"));
276 Add(L"F022L2i", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_star_icon_selected"));
277 Add(L"F031L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_text_item_normal"));
278 Add(L"F031L1P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_text_item_pressed"));
279 Add(L"F031L1D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_text_item_disabled"));
280 Add(L"F031L3", new (std::nothrow) String(L"DEFAULTCOLORTABLE::tabbar_item_text_normal"));
281 Add(L"F031L3P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::tabbar_item_text_pressed"));
282 Add(L"F031L3D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::tabbar_item_text_disabled"));
283 Add(L"F032L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_icon_item_normal"));
284 Add(L"F032L1P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_icon_item_pressed"));
285 Add(L"F032L1D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_icon_item_disabled"));
286 Add(L"F032L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::warning_font_icon_normal"));
287 Add(L"F032L2P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::warning_font_icon_pressed"));
288 Add(L"F032L2D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::warning_font_icon_disabled"));
289 Add(L"F041i", new (std::nothrow) String(L"DEFAULTCOLORTABLE::searchbar_icon_normal"));
290 Add(L"F041iD", new (std::nothrow) String(L"DEFAULTCOLORTABLE::searchbar_icon_disabled"));
291 Add(L"F051", new (std::nothrow) String(L"DEFAULTCOLORTABLE::editfield_guide_text"));
292 Add(L"F052", new (std::nothrow) String(L"DEFAULTCOLORTABLE::editfield_cursor"));
293 Add(L"W011", new (std::nothrow) String(L"DEFAULTCOLORTABLE::button_bg"));
294 Add(L"W012", new (std::nothrow) String(L"DEFAULTCOLORTABLE::popup_button_bg"));
295 Add(L"W013", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_context_item_button_bg"));
296 Add(L"W0141", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_context_delete_button_bg_normal"));
297 Add(L"W0141P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_context_delete_button_bg_pressed"));
298 Add(L"W021L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_index_section_title_bg_normal"));
299 Add(L"W021L1P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_index_section_title_bg_pressed"));
300 Add(L"W021L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_index_section_title_line_normal"));
301 Add(L"W021L2P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_index_section_title_line_pressed"));
302 Add(L"W021L3", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_index_section_title_text_normal"));
303 Add(L"W021L3P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_index_section_title_text_pressed"));
304 Add(L"W031", new (std::nothrow) String(L"DEFAULTCOLORTABLE::searchbar_field_bg_normal"));
305 Add(L"W031D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::searchbar_field_bg_disabled"));
306 Add(L"W032", new (std::nothrow) String(L"DEFAULTCOLORTABLE::searchbar_text_normal"));
307 Add(L"W032D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::searchbar_text_disabled"));
308 Add(L"W041", new (std::nothrow) String(L"DEFAULTCOLORTABLE::editfield_bg"));
309 Add(L"W0611", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_handle_text"));
310 Add(L"W0611D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_handle_text_disabled"));
311 Add(L"W062L1", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_bar_bg"));
312 Add(L"W062L2", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_bar"));
313 Add(L"W062L3", new (std::nothrow) String(L"DEFAULTCOLORTABLE::progress_circle_bar_bg"));
314 Add(L"W062L4", new (std::nothrow) String(L"DEFAULTCOLORTABLE::progress_circle_bar"));
315 Add(L"W063", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_bubble_bg"));
316 Add(L"W0641", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_handle_bg"));
317 Add(L"W0641P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_handle_bg_pressed"));
318 Add(L"W0641D", new (std::nothrow) String(L"DEFAULTCOLORTABLE::slider_handle_bg_disabled"));
319 Add(L"W0711", new (std::nothrow) String(L"DEFAULTCOLORTABLE::token_edit_item_bg_normal"));
320 Add(L"W0712", new (std::nothrow) String(L"DEFAULTCOLORTABLE::token_edit_item_outline_normal"));
321 Add(L"W0713", new (std::nothrow) String(L"DEFAULTCOLORTABLE::token_edit_item_bg_pressed"));
322 Add(L"W0714", new (std::nothrow) String(L"DEFAULTCOLORTABLE::token_edit_item_outline_pressed"));
323 Add(L"W0721", new (std::nothrow) String(L"DEFAULTCOLORTABLE::token_edit_expansion_button_bg"));
324 Add(L"W0811", new (std::nothrow) String(L"DEFAULTCOLORTABLE::picker_detail_bar_bg"));
325 Add(L"W0812", new (std::nothrow) String(L"DEFAULTCOLORTABLE::picker_button_bg"));
326 Add(L"W082", new (std::nothrow) String(L"DEFAULTCOLORTABLE::picker_detail_bar_bg"));
327 Add(L"W083", new (std::nothrow) String(L"DEFAULTCOLORTABLE::picker_keypad_button_bg"));
328 Add(L"W084", new (std::nothrow) String(L"DEFAULTCOLORTABLE::picker_detail_bar_text_normal"));
329 Add(L"W084P", new (std::nothrow) String(L"DEFAULTCOLORTABLE::picker_detail_bar_text_pressed"));
330 Add(L"W101", new (std::nothrow) String(L"DEFAULTCOLORTABLE::tabbar_item_bg_pressed"));
331 Add(L"W111", new (std::nothrow) String(L"DEFAULTCOLORTABLE::optionmenu_bg"));
332 Add(L"W1121", new (std::nothrow) String(L"DEFAULTCOLORTABLE::optionmenu_item_normal"));
333 Add(L"W1122", new (std::nothrow) String(L"DEFAULTCOLORTABLE::optionmenu_item_pressed"));
334 Add(L"W1123", new (std::nothrow) String(L"DEFAULTCOLORTABLE::optionmenu_item_disabled"));
335 Add(L"W1211", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_table_item_bg"));
336 Add(L"W1212", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_table_item_inputmode_bg"));
337 Add(L"W1221", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_table_item_text"));
338 Add(L"W1222", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_table_item_text_inputmode"));
339 Add(L"W1223", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_group_table_item_text_pressed"));
340 Add(L"W131", new (std::nothrow) String(L"DEFAULTCOLORTABLE::splitpanel_divider_bg"));
341 Add(L"W132", new (std::nothrow) String(L"DEFAULTCOLORTABLE::splitpanel_divider_bg_pressed"));
342 Add(L"W141", new (std::nothrow) String(L"DEFAULTCOLORTABLE::list_item_no_content_icon"));
343 Add(L"W151", new (std::nothrow) String(L"DEFAULTCOLORTABLE::iconlist_item_border_normal"));
344 Add(L"W152", new (std::nothrow) String(L"DEFAULTCOLORTABLE::iconlist_item_border_loading"));
345 Add(L"W153", new (std::nothrow) String(L"DEFAULTCOLORTABLE::iconlist_item_border_selected"));
350 HashMapT<String, String*>*
351 ConfigParser::GetMatchingTable(void)
353 return pColorMatchingMap;
356 ConfigParser::ConfigParser(void)
357 : __pMapContainer(null)
358 , __currentAttribute(L"")
359 , __pCurrentAnimationList(null)
362 ConfigParser::~ConfigParser(void)
364 delete pColorMatchingMap;
365 pColorMatchingMap = null;
368 ConfigParser::Parse(const String& filename, MapContainer & table)
372 FileAttributes attrib;
374 byte* pXmlContents = null;
375 result r = E_SUCCESS;
378 if (!File::IsFileExist(filename))
382 r = file.Construct(filename, L"r");
385 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] Parse Failed -- XML file Construct.");
389 r = Tizen::Io::File::GetAttributes(filename, attrib);
392 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] Parse Failed -- XML file GetAttributes.");
395 size = (int) attrib.GetFileSize();
397 r = buffer.Construct(size);
400 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] Parse Failed - Buffer Construct Failed.");
404 r = file.Read(buffer);
407 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] Parse Failed -- can't read the file.");
411 readCount = buffer.GetPosition();
412 pXmlContents = new (std::nothrow) byte[readCount];
413 SysTryReturn(NID_UI, pXmlContents != null, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create XmlContents.");
416 r = buffer.GetArray(pXmlContents, 0, readCount);
419 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] Parse Failed -- buffer.GetArray is Failed.");
420 delete[] pXmlContents;
423 char* pXmlBuffer = (char*) pXmlContents;
425 __pMapContainer = &table;
426 pConfigXmlHandler = this;
427 xmlSAXHandlerPtr pMySaxhandler = &mySaxHandler;
428 xmlSubstituteEntitiesDefault(1);
429 xmlSAXUserParseMemory(pMySaxhandler, null, pXmlBuffer, readCount);
430 pConfigXmlHandler = null;
431 delete [] pXmlContents;
435 ConfigParser::StartSaxFunc(void* pXmlParserCtxt, const xmlChar* pName, const xmlChar** pAttributes)
437 if (xmlStrcasecmp(pName, (xmlChar*) "Image") == 0)
439 pConfigXmlHandler->AddImage(pAttributes);
441 else if (xmlStrcasecmp(pName, (xmlChar*) "Color") == 0)
443 pConfigXmlHandler->AddColor(pAttributes);
445 else if (xmlStrcasecmp(pName, (xmlChar*) "Theme") == 0)
447 pConfigXmlHandler->SetInformation(pAttributes);
449 else if (xmlStrcasecmp(pName, (xmlChar*) "Palette") == 0)
451 pConfigXmlHandler->StartAttribute(pAttributes);
453 else if (xmlStrcasecmp(pName, (xmlChar*) "Control") == 0)
455 pConfigXmlHandler->StartAttribute(pAttributes);
457 else if (xmlStrcasecmp(pName, (xmlChar*) "Animation") == 0)
459 pConfigXmlHandler->AddAnimation(pAttributes);
461 else if (xmlStrcasecmp(pName, (xmlChar*) "AnimationFrame") == 0)
463 pConfigXmlHandler->AddAnimationFrame(pAttributes);
472 ConfigParser::SetInformation(const xmlChar** pAttributes)
474 if (pAttributes != null)
476 for (int i = 0; (pAttributes[i] != null); i++)
478 if (xmlStrcasecmp(pAttributes[i], (xmlChar*) "Version") == 0)
480 String version = (char*) pAttributes[++i];
481 __pMapContainer->SetVersion(version);
482 // ColorMatchingMap* matchingMap = new ColorMatchingMap;
483 // if (!matchingMap->Initialize(version))
485 // delete matchingMap;
489 // pColorMatchingMap = matchingMap;
497 ConfigParser::StartAttribute(const xmlChar** pAttributes)
499 if (pAttributes != null)
501 for (int i = 0; (pAttributes[i] != null); i++)
503 if (xmlStrcasecmp(pAttributes[i], (xmlChar*) "Name") == 0)
505 __currentAttribute = (char*) pAttributes[++i];
512 ConfigParser::AddColor(const xmlChar** pAttributes)
514 if (pAttributes != null)
516 for (int i = 0; (pAttributes[i] != null); i++)
518 if (pAttributes[++i] != null)
521 String key = __currentAttribute + L"::" + (char*) pAttributes[i - 1];
522 if(__pMapContainer->GetColorMap()->ContainsKey(key, exist) == E_SUCCESS)
527 GetValue((char*) pAttributes[i], color);
528 // SysLog(NID_UI,"The resource config parser changes resource color value, key %s, color %s", pAttributes[i - 1], pAttributes[i]);
529 __pMapContainer->GetColorMap()->SetValue(key,&color);
533 Color* pColor = new (std::nothrow) Color();
534 SysTryReturnVoidResult(NID_UI, pColor, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
535 // SysLog(NID_UI,"The resource config parser adds resource color, key %s, color %s", pAttributes[i - 1], pAttributes[i]);
536 GetValue((char*) pAttributes[i], *pColor);
537 result r = __pMapContainer->GetColorMap()->Add(key, pColor);
550 ConfigParser::AddImage(const xmlChar** pAttributes)
552 if (pAttributes != null)
554 for (int i = 0; (pAttributes[i] != null); i++)
556 if (pAttributes[++i] != null)
559 String key = __currentAttribute + L"::" + (char*) pAttributes[i - 1];
560 if(__pMapContainer->GetImageMap()->ContainsKey(key, exist) == E_SUCCESS)
564 String value((char*) pAttributes[i]);
565 value.SubString(1, value);
566 __pMapContainer->GetImageMap()->SetValue(key,&value);
570 String* pString = new (std::nothrow) String((char*) pAttributes[i]);
571 SysTryReturnVoidResult(NID_UI, pString, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
572 pString->SubString(1,*pString);
573 result r = __pMapContainer->GetImageMap()->Add(key, pString);
586 ConfigParser::AddAnimation(const xmlChar** pAttributes)
588 __pCurrentAnimationList = null;
589 if (pAttributes != null)
591 for (int i = 0; (pAttributes[i] != null); i++)
593 if (xmlStrcasecmp(pAttributes[i], (xmlChar*) "Name") == 0)
596 String key =__currentAttribute + L"::" + (char*) pAttributes[++i];
597 if(__pMapContainer->GetAnimationMap()->ContainsKey(key, exist) == E_SUCCESS)
601 __pMapContainer->GetAnimationMap()->GetValue(key,__pCurrentAnimationList);
602 __pCurrentAnimationList->Clear();
606 __pCurrentAnimationList = new ResourceAnimationFrameList();
614 ConfigParser::AddAnimationFrame(const xmlChar** pAttributes)
616 ResourceAnimationFrame* pFrame = null;
619 if (pAttributes != null)
621 for (int i = 0; (pAttributes[i] != null); i++)
623 if (xmlStrcasecmp(pAttributes[i], (xmlChar*) "Image") == 0)
625 fileName = (char*) pAttributes[++i];
626 fileName.SubString(1, fileName);
628 if (xmlStrcasecmp(pAttributes[i], (xmlChar*) "Duration") == 0)
630 duration = (char*) pAttributes[++i];
634 if (!fileName.IsEmpty() && !duration.IsEmpty())
637 if (Integer::Parse(duration, durationInt) == E_SUCCESS)
639 pFrame = new (std::nothrow) ResourceAnimationFrame(fileName, durationInt);
640 SysTryReturn(NID_UI, pFrame, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory was insufficient.");
641 __pCurrentAnimationList->Add(*pFrame);
647 ConfigParser::ConvertStringToColor32(const char* pString, Color& color)
653 unsigned int temp = 0;
655 len = strlen(pString);
659 SysLog(NID_UI, "String is empty");
663 for (index = 1; index < len + 1; index++)
666 if ((ch >= '0') && (ch <= '9'))
673 else if ((ch >= 'A') && (ch <= 'F'))
680 else if ((ch >= 'a') && (ch <= 'f'))
687 color.SetRGB32(temp, true);
691 ConfigParser::GetValue(const String& value, String& out)
693 if (value.StartsWith(L"#", 0))
695 value.SubString(1, out);
697 else if (value.StartsWith(L"$", 0))
699 String* pString = null;
700 if(__pMapContainer->GetImageMap()->GetValue(value, pString) != E_SUCCESS)
712 ConfigParser::GetValue(const String& value, Color& out)
714 if (value.StartsWith(L"#", 0))
716 char* pString = _StringConverter::CopyToCharArrayN(value);
717 ConvertStringToColor32(pString, out);
720 else if (value.StartsWith(L"$", 0))
722 Color* pColor = null;
724 value.SubString(1, key);
725 if(__pMapContainer->GetColorMap()->GetValue(key, pColor) != E_SUCCESS)