1c142477cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3c142477cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4c142477cSAndrew Rist * or more contributor license agreements. See the NOTICE file
5c142477cSAndrew Rist * distributed with this work for additional information
6c142477cSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7c142477cSAndrew Rist * to you under the Apache License, Version 2.0 (the
8c142477cSAndrew Rist * "License"); you may not use this file except in compliance
9c142477cSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11c142477cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13c142477cSAndrew Rist * Unless required by applicable law or agreed to in writing,
14c142477cSAndrew Rist * software distributed under the License is distributed on an
15c142477cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c142477cSAndrew Rist * KIND, either express or implied. See the License for the
17c142477cSAndrew Rist * specific language governing permissions and limitations
18c142477cSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20c142477cSAndrew Rist *************************************************************/
21c142477cSAndrew Rist
22c142477cSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sdext.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "pppoptimizertoken.hxx"
28cdf0e10cSrcweir #include <osl/mutex.hxx>
29cdf0e10cSrcweir #include <hash_map>
30*fda69661SHerbert Dürr #include <rtl/string.hxx>
31cdf0e10cSrcweir
32*fda69661SHerbert Dürr typedef std::hash_map< const char*, PPPOptimizerTokenEnum, rtl::CStringHash, rtl::CStringEqual> TypeNameHashMap;
33cdf0e10cSrcweir static TypeNameHashMap* pHashMap = NULL;
getHashMapMutex()34cdf0e10cSrcweir static ::osl::Mutex& getHashMapMutex()
35cdf0e10cSrcweir {
36cdf0e10cSrcweir static osl::Mutex s_aHashMapProtection;
37cdf0e10cSrcweir return s_aHashMapProtection;
38cdf0e10cSrcweir }
39cdf0e10cSrcweir
40cdf0e10cSrcweir struct TokenTable
41cdf0e10cSrcweir {
42cdf0e10cSrcweir const char* pS;
43cdf0e10cSrcweir PPPOptimizerTokenEnum pE;
44cdf0e10cSrcweir };
45cdf0e10cSrcweir
46cdf0e10cSrcweir static const TokenTable pTokenTableArray[] =
47cdf0e10cSrcweir {
48cdf0e10cSrcweir { "rdmNavi", TK_rdmNavi },
49cdf0e10cSrcweir { "lnNavSep1", TK_lnNavSep1 },
50cdf0e10cSrcweir { "lnNavSep2", TK_lnNavSep2 },
51cdf0e10cSrcweir { "btnNavHelp", TK_btnNavHelp },
52cdf0e10cSrcweir { "btnNavBack", TK_btnNavBack },
53cdf0e10cSrcweir { "btnNavNext", TK_btnNavNext },
54cdf0e10cSrcweir { "btnNavFinish", TK_btnNavFinish },
55cdf0e10cSrcweir { "btnNavCancel", TK_btnNavCancel },
56cdf0e10cSrcweir
57cdf0e10cSrcweir { "FixedText0Pg0", TK_FixedText0Pg0 },
58cdf0e10cSrcweir { "FixedText1Pg0", TK_FixedText1Pg0 },
59cdf0e10cSrcweir { "Separator1Pg0", TK_Separator1Pg0 },
60cdf0e10cSrcweir { "FixedText2Pg0", TK_FixedText2Pg0 },
61cdf0e10cSrcweir { "ListBox0Pg0", TK_ListBox0Pg0 },
62cdf0e10cSrcweir { "Button0Pg0", TK_Button0Pg0 },
63cdf0e10cSrcweir { "RadioButton0Pg1", TK_RadioButton0Pg1 },
64cdf0e10cSrcweir { "RadioButton1Pg1", TK_RadioButton1Pg1 },
65cdf0e10cSrcweir { "FixedText0Pg1", TK_FixedText0Pg1 },
66cdf0e10cSrcweir { "CheckBox1Pg1", TK_CheckBox1Pg1 },
67cdf0e10cSrcweir { "FixedText1Pg1", TK_FixedText1Pg1 },
68cdf0e10cSrcweir { "FixedText2Pg1", TK_FixedText2Pg1 },
69cdf0e10cSrcweir { "FormattedField0Pg1", TK_FormattedField0Pg1 },
70cdf0e10cSrcweir { "ComboBox0Pg1", TK_ComboBox0Pg1 },
71cdf0e10cSrcweir { "CheckBox2Pg1", TK_CheckBox2Pg1 },
72cdf0e10cSrcweir { "FixedText0Pg2", TK_FixedText0Pg2 },
73cdf0e10cSrcweir { "FixedText1Pg2", TK_FixedText1Pg2 },
74cdf0e10cSrcweir { "CheckBox0Pg2", TK_CheckBox0Pg2 },
75cdf0e10cSrcweir { "RadioButton0Pg2", TK_RadioButton0Pg2 },
76cdf0e10cSrcweir { "RadioButton1Pg2", TK_RadioButton1Pg2 },
77cdf0e10cSrcweir { "FixedText0Pg3", TK_FixedText0Pg3 },
78cdf0e10cSrcweir { "CheckBox0Pg3", TK_CheckBox0Pg3 },
79cdf0e10cSrcweir { "FixedText1Pg3", TK_FixedText1Pg3 },
80cdf0e10cSrcweir { "CheckBox1Pg3", TK_CheckBox1Pg3 },
81cdf0e10cSrcweir { "FixedText2Pg3", TK_FixedText2Pg3 },
82cdf0e10cSrcweir { "CheckBox2Pg3", TK_CheckBox2Pg3 },
83cdf0e10cSrcweir { "CheckBox3Pg3", TK_CheckBox3Pg3 },
84cdf0e10cSrcweir { "ListBox0Pg3", TK_ListBox0Pg3 },
85cdf0e10cSrcweir { "Separator0Pg4", TK_Separator0Pg4 },
86cdf0e10cSrcweir { "RadioButton0Pg4", TK_RadioButton0Pg4 },
87cdf0e10cSrcweir { "RadioButton1Pg4", TK_RadioButton1Pg4 },
88cdf0e10cSrcweir { "Separator1Pg4", TK_Separator1Pg4 },
89cdf0e10cSrcweir { "FixedText0Pg4", TK_FixedText0Pg4 },
90cdf0e10cSrcweir { "FixedText1Pg4", TK_FixedText1Pg4 },
91cdf0e10cSrcweir { "FixedText2Pg4", TK_FixedText2Pg4 },
92cdf0e10cSrcweir { "FixedText3Pg4", TK_FixedText3Pg4 },
93cdf0e10cSrcweir { "FixedText4Pg4", TK_FixedText4Pg4 },
94cdf0e10cSrcweir { "FixedText5Pg4", TK_FixedText5Pg4 },
95cdf0e10cSrcweir { "FixedText6Pg4", TK_FixedText6Pg4 },
96cdf0e10cSrcweir { "FixedText7Pg4", TK_FixedText7Pg4 },
97cdf0e10cSrcweir { "FixedText8Pg4", TK_FixedText8Pg4 },
98cdf0e10cSrcweir { "CheckBox1Pg4", TK_CheckBox1Pg4 },
99cdf0e10cSrcweir { "ComboBox0Pg4", TK_ComboBox0Pg4 },
100cdf0e10cSrcweir
101cdf0e10cSrcweir { "_blank", TK__blank },
102cdf0e10cSrcweir { "_self", TK__self },
103cdf0e10cSrcweir { "Activated", TK_Activated },
104cdf0e10cSrcweir { "Align", TK_Align },
105cdf0e10cSrcweir { "Alpha", TK_Alpha },
106cdf0e10cSrcweir { "Animated", TK_Animated },
107cdf0e10cSrcweir { "Background", TK_Background },
108cdf0e10cSrcweir { "Border", TK_Border },
109cdf0e10cSrcweir { "Closeable", TK_Closeable },
110cdf0e10cSrcweir { "ColorMode", TK_ColorMode },
111cdf0e10cSrcweir { "Complete", TK_Complete },
112cdf0e10cSrcweir { "Compression", TK_Compression },
113cdf0e10cSrcweir { "CurrentItemID", TK_CurrentItemID },
114cdf0e10cSrcweir { "DefaultButton", TK_DefaultButton },
115cdf0e10cSrcweir { "DocumentService", TK_DocumentService },
116cdf0e10cSrcweir { "Dropdown", TK_Dropdown },
117cdf0e10cSrcweir { "EffectiveValue", TK_EffectiveValue },
118cdf0e10cSrcweir { "EffectiveMin", TK_EffectiveMin },
119cdf0e10cSrcweir { "EffectiveMax", TK_EffectiveMax },
120cdf0e10cSrcweir { "Enabled", TK_Enabled },
121cdf0e10cSrcweir { "Extensions", TK_Extensions },
122cdf0e10cSrcweir { "FileSizeDestination",TK_FileSizeDestination },
123cdf0e10cSrcweir { "FileSizeSource", TK_FileSizeSource },
124cdf0e10cSrcweir { "FillBitmap", TK_FillBitmap },
125cdf0e10cSrcweir { "FillBitmapLogicalSize",TK_FillBitmapLogicalSize },
126cdf0e10cSrcweir { "FillBitmapMode", TK_FillBitmapMode },
127cdf0e10cSrcweir { "FillBitmapSizeX", TK_FillBitmapSizeX },
128cdf0e10cSrcweir { "FillBitmapSizeY", TK_FillBitmapSizeY },
129cdf0e10cSrcweir { "FillBitmapURL", TK_FillBitmapURL },
130cdf0e10cSrcweir { "FillStyle", TK_FillStyle },
131cdf0e10cSrcweir { "FilterData", TK_FilterData },
132cdf0e10cSrcweir { "FilterName", TK_FilterName },
133cdf0e10cSrcweir { "Flags", TK_Flags },
134cdf0e10cSrcweir { "FontDescriptor", TK_FontDescriptor },
135cdf0e10cSrcweir { "Graphic", TK_Graphic },
136cdf0e10cSrcweir { "GraphicCrop", TK_GraphicCrop },
137cdf0e10cSrcweir { "GraphicCropLogic", TK_GraphicCropLogic },
138cdf0e10cSrcweir { "GraphicURL", TK_GraphicURL },
139cdf0e10cSrcweir { "GraphicStreamURL", TK_GraphicStreamURL },
140cdf0e10cSrcweir { "Height", TK_Height },
141597a4c59SAriel Constenla-Haile { "HelpURL", TK_HelpURL },
142cdf0e10cSrcweir { "Hidden", TK_Hidden },
143cdf0e10cSrcweir { "ID", TK_ID },
144cdf0e10cSrcweir { "ImageURL", TK_ImageURL },
145597a4c59SAriel Constenla-Haile { "ParentWindow", TK_ParentWindow },// TODO move it
146cdf0e10cSrcweir { "InputStream", TK_InputStream },
147cdf0e10cSrcweir { "Interlaced", TK_Interlaced },
148cdf0e10cSrcweir { "IsInternal", TK_IsInternal },
149cdf0e10cSrcweir { "Label", TK_Label },
150cdf0e10cSrcweir { "LineCount", TK_LineCount },
151cdf0e10cSrcweir { "LogicalHeight", TK_LogicalHeight },
152cdf0e10cSrcweir { "LogicalWidth", TK_LogicalWidth },
153cdf0e10cSrcweir { "LogicalSize", TK_LogicalSize },
154cdf0e10cSrcweir { "MimeType", TK_MimeType },
155cdf0e10cSrcweir { "Moveable", TK_Moveable },
156cdf0e10cSrcweir { "MultiLine", TK_MultiLine },
157cdf0e10cSrcweir { "MultiSelection", TK_MultiSelection },
158cdf0e10cSrcweir { "Name", TK_Name },
159cdf0e10cSrcweir { "Orientation", TK_Orientation },
160cdf0e10cSrcweir { "OutputStream", TK_OutputStream },
161cdf0e10cSrcweir { "PixelHeight", TK_PixelHeight },
162cdf0e10cSrcweir { "PixelWidth", TK_PixelWidth },
163cdf0e10cSrcweir { "PositionX", TK_PositionX },
164cdf0e10cSrcweir { "PositionY", TK_PositionY },
165cdf0e10cSrcweir { "Progress", TK_Progress },
166cdf0e10cSrcweir { "ProgressValue", TK_ProgressValue },
167cdf0e10cSrcweir { "ProgressValueMax", TK_ProgressValueMax },
168cdf0e10cSrcweir { "ProgressValueMin", TK_ProgressValueMin },
169cdf0e10cSrcweir { "PushButtonType", TK_PushButtonType },
170cdf0e10cSrcweir { "Quality", TK_Quality },
171cdf0e10cSrcweir { "ReadOnly", TK_ReadOnly },
172cdf0e10cSrcweir { "Repeat", TK_Repeat },
173cdf0e10cSrcweir { "ScaleImage", TK_ScaleImage },
174cdf0e10cSrcweir { "SelectedItems", TK_SelectedItems },
175cdf0e10cSrcweir { "Settings", TK_Settings },
176cdf0e10cSrcweir { "Size100thMM", TK_Size100thMM },
177cdf0e10cSrcweir { "SizePixel", TK_SizePixel },
178cdf0e10cSrcweir { "Spin", TK_Spin },
179cdf0e10cSrcweir { "Step", TK_Step },
180cdf0e10cSrcweir { "State", TK_State },
181597a4c59SAriel Constenla-Haile { "StatusListener", TK_StatusListener },
182cdf0e10cSrcweir { "StringItemList", TK_StringItemList },
183cdf0e10cSrcweir { "Strings", TK_Strings },
184cdf0e10cSrcweir { "TabIndex", TK_TabIndex },
185cdf0e10cSrcweir { "Template", TK_Template },
186cdf0e10cSrcweir { "Text", TK_Text },
187cdf0e10cSrcweir { "Title", TK_Title },
188cdf0e10cSrcweir { "Transparent", TK_Transparent },
189cdf0e10cSrcweir { "Type", TK_Type },
190cdf0e10cSrcweir { "UIName", TK_UIName },
191cdf0e10cSrcweir { "Value", TK_Value },
192cdf0e10cSrcweir { "Width", TK_Width },
193cdf0e10cSrcweir { "ZOrder", TK_ZOrder },
194cdf0e10cSrcweir
195cdf0e10cSrcweir { "LastUsedSettings", TK_LastUsedSettings },
196cdf0e10cSrcweir { "Settings/Templates", TK_Settings_Templates },
197cdf0e10cSrcweir { "Settings/Templates/",TK_Settings_Templates_ },
198cdf0e10cSrcweir { "JPEGCompression", TK_JPEGCompression },
199cdf0e10cSrcweir { "JPEGQuality", TK_JPEGQuality },
200cdf0e10cSrcweir { "RemoveCropArea", TK_RemoveCropArea },
201cdf0e10cSrcweir { "ImageResolution", TK_ImageResolution },
202cdf0e10cSrcweir { "EmbedLinkedGraphics",TK_EmbedLinkedGraphics },
203cdf0e10cSrcweir { "OLEOptimization", TK_OLEOptimization },
204cdf0e10cSrcweir { "OLEOptimizationType",TK_OLEOptimizationType },
205cdf0e10cSrcweir { "DeleteUnusedMasterPages", TK_DeleteUnusedMasterPages },
206cdf0e10cSrcweir { "DeleteHiddenSlides", TK_DeleteHiddenSlides },
207cdf0e10cSrcweir { "DeleteNotesPages", TK_DeleteNotesPages },
208cdf0e10cSrcweir { "CustomShowName", TK_CustomShowName },
209cdf0e10cSrcweir { "SaveAs", TK_SaveAs },
210cdf0e10cSrcweir { "SaveAsURL", TK_SaveAsURL },
211cdf0e10cSrcweir { "OpenNewDocument", TK_OpenNewDocument },
212cdf0e10cSrcweir { "EstimatedFileSize", TK_EstimatedFileSize },
213cdf0e10cSrcweir
214cdf0e10cSrcweir { "Status", TK_Status },
215cdf0e10cSrcweir { "Pages", TK_Pages },
216cdf0e10cSrcweir { "CurrentPage", TK_CurrentPage },
217cdf0e10cSrcweir { "GraphicObjects", TK_GraphicObjects },
218cdf0e10cSrcweir { "CurrentGraphicObject",TK_CurrentGraphicObject },
219cdf0e10cSrcweir { "OLEObjects", TK_OLEObjects },
220cdf0e10cSrcweir { "CurrentOLEObject", TK_CurrentOLEObject },
221597a4c59SAriel Constenla-Haile #if 0
222597a4c59SAriel Constenla-Haile { "STR_PRESENTATION_MINIMIZER",STR_PRESENTATION_MINIMIZER },
223cdf0e10cSrcweir { "STR_STEPS", STR_STEPS },
224cdf0e10cSrcweir { "STR_HELP", STR_HELP },
225cdf0e10cSrcweir { "STR_BACK", STR_BACK },
226cdf0e10cSrcweir { "STR_NEXT", STR_NEXT },
227cdf0e10cSrcweir { "STR_FINISH", STR_FINISH },
228cdf0e10cSrcweir { "STR_CANCEL", STR_CANCEL },
229cdf0e10cSrcweir { "STR_INTRODUCTION", STR_INTRODUCTION },
230cdf0e10cSrcweir { "STR_INTRODUCTION_T", STR_INTRODUCTION_T },
231cdf0e10cSrcweir { "STR_CHOSE_SETTINGS", STR_CHOSE_SETTINGS },
232cdf0e10cSrcweir { "STR_REMOVE", STR_REMOVE },
233cdf0e10cSrcweir { "STR_GRAPHIC_OPTIMIZATION", STR_GRAPHIC_OPTIMIZATION },
234cdf0e10cSrcweir { "STR_IMAGE_OPTIMIZATION", STR_IMAGE_OPTIMIZATION },
235cdf0e10cSrcweir { "STR_LOSSLESS_COMPRESSION", STR_LOSSLESS_COMPRESSION },
236cdf0e10cSrcweir { "STR_JPEG_COMPRESSION", STR_JPEG_COMPRESSION },
237cdf0e10cSrcweir { "STR_QUALITY", STR_QUALITY },
238cdf0e10cSrcweir { "STR_REMOVE_CROP_AREA", STR_REMOVE_CROP_AREA },
239cdf0e10cSrcweir { "STR_IMAGE_RESOLUTION", STR_IMAGE_RESOLUTION },
240cdf0e10cSrcweir { "STR_IMAGE_RESOLUTION_0", STR_IMAGE_RESOLUTION_0 },
241cdf0e10cSrcweir { "STR_IMAGE_RESOLUTION_1", STR_IMAGE_RESOLUTION_1 },
242cdf0e10cSrcweir { "STR_IMAGE_RESOLUTION_2", STR_IMAGE_RESOLUTION_2 },
243cdf0e10cSrcweir { "STR_IMAGE_RESOLUTION_3", STR_IMAGE_RESOLUTION_3 },
244cdf0e10cSrcweir { "STR_EMBED_LINKED_GRAPHICS", STR_EMBED_LINKED_GRAPHICS },
245cdf0e10cSrcweir { "STR_OLE_OBJECTS", STR_OLE_OBJECTS },
246cdf0e10cSrcweir { "STR_OLE_OPTIMIZATION", STR_OLE_OPTIMIZATION },
247cdf0e10cSrcweir { "STR_OLE_REPLACE", STR_OLE_REPLACE },
248cdf0e10cSrcweir { "STR_ALL_OLE_OBJECTS", STR_ALL_OLE_OBJECTS },
249cdf0e10cSrcweir { "STR_ALIEN_OLE_OBJECTS_ONLY", STR_ALIEN_OLE_OBJECTS_ONLY },
250cdf0e10cSrcweir { "STR__OLE_OBJECTS_DESC", STR_OLE_OBJECTS_DESC },
251cdf0e10cSrcweir { "STR_NO_OLE_OBJECTS_DESC", STR_NO_OLE_OBJECTS_DESC },
252cdf0e10cSrcweir { "STR_SLIDES", STR_SLIDES },
253cdf0e10cSrcweir { "STR_CHOOSE_SLIDES", STR_CHOOSE_SLIDES },
254cdf0e10cSrcweir { "STR_MASTER_PAGES", STR_MASTER_PAGES },
255cdf0e10cSrcweir { "STR_DELETE_MASTER_PAGES", STR_DELETE_MASTER_PAGES },
256cdf0e10cSrcweir { "STR_DELETE_NOTES_PAGES", STR_DELETE_NOTES_PAGES },
257cdf0e10cSrcweir { "STR_DELETE_HIDDEN_SLIDES", STR_DELETE_HIDDEN_SLIDES },
258cdf0e10cSrcweir { "STR_CUSTOM_SHOW", STR_CUSTOM_SHOW },
259cdf0e10cSrcweir { "STR_SUMMARY", STR_SUMMARY },
260cdf0e10cSrcweir { "STR_SUMMARY_TITLE", STR_SUMMARY_TITLE },
261cdf0e10cSrcweir { "STR_PROGRESS", STR_PROGRESS },
262cdf0e10cSrcweir { "STR_OBJECTS_OPTIMIZED", STR_OBJECTS_OPTIMIZED },
263cdf0e10cSrcweir { "STR_APPLY_TO_CURRENT", STR_APPLY_TO_CURRENT },
264cdf0e10cSrcweir { "STR_AUTOMATICALLY_OPEN", STR_AUTOMATICALLY_OPEN },
265cdf0e10cSrcweir { "STR_SAVE_SETTINGS", STR_SAVE_SETTINGS },
266cdf0e10cSrcweir { "STR_SAVE_AS", STR_SAVE_AS },
267cdf0e10cSrcweir { "STR_DELETE_SLIDES", STR_DELETE_SLIDES },
268cdf0e10cSrcweir { "STR_OPTIMIZE_IMAGES", STR_OPTIMIZE_IMAGES },
269cdf0e10cSrcweir { "STR_CREATE_REPLACEMENT", STR_CREATE_REPLACEMENT },
270cdf0e10cSrcweir { "STR_CURRENT_FILESIZE", STR_CURRENT_FILESIZE },
271cdf0e10cSrcweir { "STR_ESTIMATED_FILESIZE", STR_ESTIMATED_FILESIZE },
272cdf0e10cSrcweir { "STR_MB", STR_MB },
273cdf0e10cSrcweir { "MY_SETTINGS", STR_MY_SETTINGS },
274cdf0e10cSrcweir { "STR_DEFAULT_SESSION", STR_DEFAULT_SESSION },
275cdf0e10cSrcweir { "STR_MODIFY_WARNING", STR_MODIFY_WARNING },
276cdf0e10cSrcweir { "STR_YES", STR_YES },
277cdf0e10cSrcweir { "STR_OK", STR_OK },
278cdf0e10cSrcweir { "STR_INFO_1", STR_INFO_1 },
279cdf0e10cSrcweir { "STR_INFO_2", STR_INFO_2 },
280cdf0e10cSrcweir { "STR_INFO_3", STR_INFO_3 },
281cdf0e10cSrcweir { "STR_INFO_4", STR_INFO_4 },
282cdf0e10cSrcweir { "STR_DUPLICATING_PRESENTATION",STR_DUPLICATING_PRESENTATION },
283cdf0e10cSrcweir { "STR_DELETING_SLIDES", STR_DELETING_SLIDES },
284cdf0e10cSrcweir { "STR_OPTIMIZING_GRAPHICS", STR_OPTIMIZING_GRAPHICS },
285cdf0e10cSrcweir { "STR_CREATING_OLE_REPLACEMENTS",STR_CREATING_OLE_REPLACEMENTS },
286cdf0e10cSrcweir { "STR_FileSizeSeparator", STR_FILESIZESEPARATOR },
287597a4c59SAriel Constenla-Haile #endif
288cdf0e10cSrcweir { "Last", TK_Last },
289cdf0e10cSrcweir { "NotFound", TK_NotFound }
290cdf0e10cSrcweir };
291cdf0e10cSrcweir
TKGet(const rtl::OUString & rToken)292cdf0e10cSrcweir PPPOptimizerTokenEnum TKGet( const rtl::OUString& rToken )
293cdf0e10cSrcweir {
294cdf0e10cSrcweir if ( !pHashMap )
295cdf0e10cSrcweir { // init hash map
296cdf0e10cSrcweir ::osl::MutexGuard aGuard( getHashMapMutex() );
297cdf0e10cSrcweir if ( !pHashMap )
298cdf0e10cSrcweir {
299cdf0e10cSrcweir TypeNameHashMap* pH = new TypeNameHashMap;
300cdf0e10cSrcweir const TokenTable* pPtr = pTokenTableArray;
301cdf0e10cSrcweir const TokenTable* pEnd = pPtr + ( sizeof( pTokenTableArray ) / sizeof( TokenTable ) );
302cdf0e10cSrcweir for ( ; pPtr < pEnd; pPtr++ )
303cdf0e10cSrcweir (*pH)[ pPtr->pS ] = pPtr->pE;
304cdf0e10cSrcweir pHashMap = pH;
305cdf0e10cSrcweir }
306cdf0e10cSrcweir }
307cdf0e10cSrcweir PPPOptimizerTokenEnum eRetValue = TK_NotFound;
308cdf0e10cSrcweir int i, nLen = rToken.getLength();
309cdf0e10cSrcweir char* pBuf = new char[ nLen + 1 ];
310cdf0e10cSrcweir for ( i = 0; i < nLen; i++ )
311cdf0e10cSrcweir pBuf[ i ] = (char)rToken[ i ];
312cdf0e10cSrcweir pBuf[ i ] = 0;
313cdf0e10cSrcweir TypeNameHashMap::iterator aHashIter( pHashMap->find( pBuf ) );
314cdf0e10cSrcweir delete[] pBuf;
315cdf0e10cSrcweir if ( aHashIter != pHashMap->end() )
316cdf0e10cSrcweir eRetValue = (*aHashIter).second;
317cdf0e10cSrcweir return eRetValue;
318cdf0e10cSrcweir }
319cdf0e10cSrcweir
TKGet(const PPPOptimizerTokenEnum eToken)320cdf0e10cSrcweir rtl::OUString TKGet( const PPPOptimizerTokenEnum eToken )
321cdf0e10cSrcweir {
322cdf0e10cSrcweir sal_uInt32 i = eToken >= TK_Last
323cdf0e10cSrcweir ? (sal_uInt32)TK_NotFound
324cdf0e10cSrcweir : (sal_uInt32)eToken;
325cdf0e10cSrcweir return rtl::OUString::createFromAscii( pTokenTableArray[ i ].pS );
326cdf0e10cSrcweir }
327