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