1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_framework.hxx"
26 
27 //_________________________________________________________________________________________________________________
28 //	my own includes
29 //_________________________________________________________________________________________________________________
30 
31 #define VCL_NEED_BASETSD
32 #include <tools/presys.h>
33 #include <windows.h>
34 #include <tools/postsys.h>
35 #include <classes/servicemanager.hxx>
36 #include <classes/filtercache.hxx>
37 #include <macros/generic.hxx>
38 #include <macros/debug.hxx>
39 #include <services.h>
40 #include <filterflags.h>
41 
42 //_________________________________________________________________________________________________________________
43 //	interface includes
44 //_________________________________________________________________________________________________________________
45 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
46 
47 //_________________________________________________________________________________________________________________
48 //	other includes
49 //_________________________________________________________________________________________________________________
50 #include <comphelper/processfactory.hxx>
51 #include <unotools/processfactory.hxx>
52 #include <vos/process.hxx>
53 #include <rtl/ustring.hxx>
54 #include <rtl/ustrbuf.hxx>
55 
56 #include <vcl/event.hxx>
57 #include <vcl/svapp.hxx>
58 #include <vcl/wrkwin.hxx>
59 #include <vcl/msgbox.hxx>
60 
61 //_________________________________________________________________________________________________________________
62 //	namespace
63 //_________________________________________________________________________________________________________________
64 
65 using namespace ::framework ;
66 
67 //_________________________________________________________________________________________________________________
68 //	const
69 //_________________________________________________________________________________________________________________
70 
71 //_________________________________________________________________________________________________________________
72 //	defines
73 //_________________________________________________________________________________________________________________
74 
75 /*
76     Versions:       1)  first revision
77                         - one entry for every property
78                         - full loclized values
79                     2)  new property "Order" for filters ... but not right set!
80                         all values are 0
81                     3)  decrease size of xml file
82                         - don't write full localized values
83                         - use own formated string for all non localized values
84                         - seperate "Installed" flag for filters
85                     4)  set right values for "Order" property of filters
86                     5)  support for ContentHandler
87               draft 6)  reactivate old filter names
88           ??? draft 7)  split xml into standard/optional => use DRAFT_SPLIT_VERSION till this version is well known!
89  */
90 #define DRAFT_SPLIT_VERSION             7
91 
92 #define ARGUMENT_PACKAGE_STANDARD       DECLARE_ASCII("-pas=")          // argument for package name of standard filters
93 #define ARGUMENT_PACKAGE_ADDITIONAL     DECLARE_ASCII("-paa=")          // argument for package name of additional filters
94 #define ARGUMENT_WRITEABLE              DECLARE_ASCII("-wri=")          // argument for "writeable"                         [true|false]
95 #define ARGUMENT_VERSION_INPUT          DECLARE_ASCII("-vin=")          // argument for file version to read                [1|2|3]
96 #define ARGUMENT_VERSION_OUTPUT         DECLARE_ASCII("-vou=")          // argument for file version to write               [1|2|3]
97 
98 #define ARGUMENTLENGTH                  5                               // All arguments should have the same lenght ... it's better to detect it!
99 #define ARGUMENTFOUND                   0                               // OUString::compareTo returns 0 if searched string match given one
100 
101 #define WRITEABLE_ON                    DECLARE_ASCII("true" )
102 #define WRITEABLE_OFF                   DECLARE_ASCII("false")
103 
104 #define MINARGUMENTCOUNT                5                               // no optional arguments allowed yet!
105 
106 #define LISTFILE_STANDARDTYPES          "typelist_standard.txt"
107 #define LISTFILE_ADDITIONALTYPES        "typelist_additional.txt"
108 #define LISTFILE_STANDARDFILTER         "filterlist_standard.txt"
109 #define LISTFILE_ADDITIONALFILTER       "filterlist_additional.txt"
110 #define SCPFILE_STANDARD                "scp_standard.txt"
111 #define SCPFILE_ADDITIONAL              "scp_additional.txt"
112 
113 //_________________________________________________________________________________________________________________
114 //	declarations
115 //_________________________________________________________________________________________________________________
116 
117 /*-***************************************************************************************************************/
118 struct AppMember
119 {
120         FilterCache*                pFilterCache                ; // pointer to configuration
121         StringHash                  aOldFilterNamesHash         ; // converter tabel to restaurate old filter names
122         EFilterPackage              ePackage                    ; // specify which package should be used => specify using of file name and buffer too!
123 //        ::rtl::OUString             sFileNameStandard           ; // file name of our standard filter cfg
124 //        ::rtl::OUString             sFileNameAdditional         ; // file name of our additional filter cfg
125         ::rtl::OUString             sPackageStandard            ; // package name of our standard filter cfg
126         ::rtl::OUString             sPackageAdditional          ; // package name of our additional filter cfg
127         ::rtl::OUStringBuffer       sBufferStandard             ; // buffer of our standard filter cfg
128         ::rtl::OUStringBuffer       sBufferAdditional           ; // buffer of our standard filter cfg
129         ::rtl::OUStringBuffer       sNew2OldSCPStandard         ; // setup script to convert new to old filternames (standard filter)
130         ::rtl::OUStringBuffer       sNew2OldSCPAdditional       ; // setup script to convert new to old filternames (additional filter)
131         ::rtl::OUStringBuffer       sStandardFilterList         ;
132         ::rtl::OUStringBuffer       sAdditionalFilterList       ;
133         ::rtl::OUStringBuffer       sStandardTypeList           ;
134         ::rtl::OUStringBuffer       sAdditionalTypeList         ;
135         sal_Bool                    bWriteable                  ; // enable/disable writable configuration items
136         sal_Int32                   nVersionInput               ; // format version of input xml file
137         sal_Int32                   nVersionOutput              ; // format version of output xcd file
138 
139         sal_Int32                   nOriginalTypes              ;
140         sal_Int32                   nOriginalFilters            ;
141         sal_Int32                   nOriginalDetectors          ;
142         sal_Int32                   nOriginalLoaders            ;
143         sal_Int32                   nOriginalContentHandlers    ;
144 
145         sal_Int32                   nWrittenTypes               ;
146         sal_Int32                   nWrittenFilters             ;
147         sal_Int32                   nWrittenDetectors           ;
148         sal_Int32                   nWrittenLoaders             ;
149         sal_Int32                   nWrittenContentHandlers     ;
150 };
151 
152 /*-***************************************************************************************************************/
153 class XCDGenerator : public Application
154 {
155 	//*************************************************************************************************************
156 	public:
157 		void Main();
158 
159 	//*************************************************************************************************************
160 	private:
161         void                    impl_printCopyright                     (                                                                                       ); // print copyright to stdout :-)
162         void                    impl_printSyntax                        (                                                                                       ); // print help to stout for user
163         void                    impl_parseCommandLine                   (           AppMember&                              rMember                             ); // parse command line arguments and fill given struct
164 
165         void                    impl_generateXCD                        (                                                                                       ); // generate all xcd files by using current configuration
166         void                    impl_generateCopyright                  (                                                                                       ); // generate copyrights
167         void                    impl_generateTypeTemplate               (                                                                                       ); // generate templates ...
168         void                    impl_generateFilterTemplate             (                                                                                       );
169         void                    impl_generateDetectorTemplate           (                                                                                       );
170         void                    impl_generateLoaderTemplate             (                                                                                       );
171         void                    impl_generateTypeSet                    (                                                                                       ); // generate sets
172         void                    impl_generateFilterSet                  (                                                                                       );
173         void                    impl_generateDetectorSet                (                                                                                       );
174         void                    impl_generateLoaderSet                  (                                                                                       );
175         void                    impl_generateDefaults                   (                                                                                       ); // generate defaults
176         void                    impl_generateContentHandlerTemplate     (                                                                                       );
177         void                    impl_generateContentHandlerSet          (                                                                                       );
178         void                    impl_generateFilterFlagTemplate         (   const   ::rtl::OUString&                        sName                               ,  // helper to write atomic elements
179                                                                                     sal_Int32                               nValue                              ,
180                                                                             const   ::rtl::OString&                         sDescription = ::rtl::OString()     );
181         void                    impl_generateIntProperty                (           ::rtl::OUStringBuffer&                  sXCD                                ,
182                                                                             const   ::rtl::OUString&                        sName                               ,
183                                                                                     sal_Int32                               nValue                              );
184         void                    impl_generateBoolProperty               (           ::rtl::OUStringBuffer&                  sXCD                                ,
185                                                                             const   ::rtl::OUString&                        sName                               ,
186                                                                                     sal_Bool                                bValue                              );
187         void                    impl_generateStringProperty             (           ::rtl::OUStringBuffer&                  sXCD                                ,
188                                                                             const   ::rtl::OUString&                        sName                               ,
189                                                                             const   ::rtl::OUString&                        sValue                              );
190         void                    impl_generateStringListProperty         (           ::rtl::OUStringBuffer&                  sXCD                                ,
191                                                                             const   ::rtl::OUString&                        sName                               ,
192                                                                             const   ::framework::StringList&                lValue                              );
193         void                    impl_generateUINamesProperty            (           ::rtl::OUStringBuffer&                  sXCD                                ,
194                                                                             const   ::rtl::OUString&                        sName                               ,
195                                                                             const   StringHash&                             lUINames                            );
196         ::rtl::OUString         impl_getOldFilterName                   (   const   ::rtl::OUString&                        sNewName                            ); // convert filter names to old format
197 
198         static void             impl_classifyType                       (   const   AppMember&                              rData                               ,
199                                                                             const   ::rtl::OUString&                        sTypeName                           ,
200                                                                                     EFilterPackage&                         ePackage                            ); // classify type as STANDARD or ADDITIONAL one
201         static void             impl_classifyFilter                     (   const   AppMember&                              rData                               ,
202                                                                             const   ::rtl::OUString&                        sFilterName                         ,
203                                                                                     EFilterPackage&                         ePackage                            ,
204                                                                                     sal_Int32&                              nOrder                              ); // classify filter as STANDARD or ADDITIONAL filter, set order of standard filter too
205         static ::rtl::OUString  impl_encodeSpecialSigns                 (   const   ::rtl::OUString&                        sValue                              ); // encode strings for xml
206         static sal_Unicode      impl_defineSeperator                    (   const   ::framework::StringList&                lList                               ); // search seperator for lists
207         static void             impl_initFilterHashNew2Old              (           StringHash&                             aHash                               ); // initialize converter table to restaurate old filter names
208         static void             impl_orderAlphabetical                  (           css::uno::Sequence< ::rtl::OUString >&  lList                               ); // sort stringlist of internal type-, filter- ... names in alphabetical order to generate xcd files everytime in the same way
209         static sal_Bool         impl_isUsAsciiAlphaDigit                (           sal_Unicode                             c                                   ,
210                                                                                     sal_Bool                                bDigitAllowed = sal_True            );
211         static ::rtl::OUString  impl_encodeSetName                      (   const   ::rtl::OUString&                        rSource                             );
212 
213     //*************************************************************************************************************
214 	private:
215         AppMember       m_aData;
216 
217 };  //  class XCDGenerator
218 
219 //_________________________________________________________________________________________________________________
220 //	global variables
221 //_________________________________________________________________________________________________________________
222 
223 XCDGenerator gGenerator;
224 
225 //*****************************************************************************************************************
Main()226 void XCDGenerator::Main()
227 {
228     // Must be :-)
229 //    impl_printCopyright();
230 
231     // Init global servicemanager and set it.
232     // It's neccessary for other services ... e.g. configuration.
233     ServiceManager aManager;
234     ::comphelper::setProcessServiceFactory( aManager.getGlobalUNOServiceManager() );
235     ::utl::setProcessServiceFactory      ( aManager.getGlobalUNOServiceManager() );
236 
237     // Get optional commands from command line.
238     impl_parseCommandLine( m_aData );
239 
240     // initialize converter table to match new to old filter names!
241     if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 )
242     {
243         XCDGenerator::impl_initFilterHashNew2Old( m_aData.aOldFilterNamesHash );
244     }
245 
246     // Create access to current set filter configuration.
247     // Attention: Please use it for a full fat office installation only!!
248     //            We need an installation with ALL filters.
249     // Member m_pData is used in some impl-methods directly ...
250     m_aData.pFilterCache = new FilterCache( m_aData.nVersionInput, CONFIG_MODE_ALL_LOCALES );
251 
252     // Get some statistic informations of current filled filter cache ... (e.g. count of current activae filters)
253     // because we need it to check if all filters are converted and written to disk.
254     // May be it's possible to lose some of them during convertion!!!
255     m_aData.nOriginalTypes     = m_aData.pFilterCache->getAllTypeNames().getLength()     ;
256     m_aData.nOriginalFilters   = m_aData.pFilterCache->getAllFilterNames().getLength()   ;
257     m_aData.nOriginalDetectors = m_aData.pFilterCache->getAllDetectorNames().getLength() ;
258     m_aData.nOriginalLoaders   = m_aData.pFilterCache->getAllLoaderNames().getLength()   ;
259     if( m_aData.nVersionInput >= 5 )
260     {
261         m_aData.nOriginalContentHandlers  = m_aData.pFilterCache->getAllContentHandlerNames().getLength()  ;
262     }
263 
264     // Start generation of xcd file(s).
265     impl_generateXCD();
266 
267     // Warn programmer if some items couldn't written to file!
268     LOG_ASSERT2( m_aData.nOriginalTypes    != m_aData.nWrittenTypes    , "XCDGenerator::Main()", "Generated xcd file could be invalid ... because I miss some types!"     )
269     LOG_ASSERT2( m_aData.nOriginalFilters  != m_aData.nWrittenFilters  , "XCDGenerator::Main()", "Generated xcd file could be invalid ... because I miss some filters!"   )
270     LOG_ASSERT2( m_aData.nOriginalDetectors!= m_aData.nWrittenDetectors, "XCDGenerator::Main()", "Generated xcd file could be invalid ... because I miss some detectors!" )
271     LOG_ASSERT2( m_aData.nOriginalLoaders  != m_aData.nWrittenLoaders  , "XCDGenerator::Main()", "Generated xcd file could be invalid ... because I miss some loaders!"   )
272 
273     // Free memory.
274     delete m_aData.pFilterCache;
275     m_aData.pFilterCache = NULL;
276 }
277 
278 /*-************************************************************************************************************//**
279     @short      print some info messages to stderr
280     @descr      We must show an copyright or help for using this file.
281                 This two methods do that.
282 
283     @seealso    -
284 
285     @param      -
286     @return     -
287 
288     @onerror    -
289 *//*-*************************************************************************************************************/
impl_printCopyright()290 void XCDGenerator::impl_printCopyright()
291 {
292     fprintf( stderr, "\nLicensed to the Apache Software Foundation.\n" );
293 }
294 
295 //*****************************************************************************************************************
impl_printSyntax()296 void XCDGenerator::impl_printSyntax()
297 {
298     // It's not possible to print it out to stdout in a svdem binary :-(
299     // So we show an assert.
300     ::rtl::OStringBuffer sBuffer( 500 );
301     sBuffer.append( "\nusing: xml2xcd -fis=<file standard filter> -fia=<file additional filter> -pas=<package standard filter> -paa=<package additional filter> -vin=<version input> -vou=<version output> [-wri=<true|false>]\n\n" );
302     sBuffer.append( "\tneccessary parameters:\n"                                                                                                                                                                                    );
303     sBuffer.append( "\t\t-fis\tname of output file in system notation\n"                                                                                                                                                            );
304     sBuffer.append( "\t\t-fia\tname of output file in system notation\n"                                                                                                                                                            );
305     sBuffer.append( "\t\t-pas\tpackage of standard filters\n"                                                                                                                                                                       );
306     sBuffer.append( "\t\t-paa\tpackage of additional filters\n"                                                                                                                                                                     );
307     sBuffer.append( "\t\t-vin\tformat version of input xml file\n"                                                                                                                                                                  );
308     sBuffer.append( "\t\t-vou\tformat version of generated xcd file\n\n"                                                                                                                                                            );
309     sBuffer.append( "\toptional parameters:\n"                                                                                                                                                                                      );
310     sBuffer.append( "\t\t-wri\tconfig items should be writeable ... [true|false]\n"                                                                                                                                                 );
311     LOG_ERROR( "", sBuffer.makeStringAndClear() )
312 }
313 
314 /*-************************************************************************************************************//**
315     @short      analyze command line arguments
316     @descr      Created binary accept different command line arguments. These parameters
317                 regulate creation of xcd file. Follow arguments are supported:
318                     "-fis=<filename of standard xcd>"
319                     "-fia=<filename of additional xcd>"
320                     "-wri=<writeable>[true|false]"
321                     "-vin=<version of input file>[1|2|3]"
322                     "-vou=<version of output file>[1|2|3]"
323 
324     @seealso    -
325 
326     @param      "rMember", reference to struct of global application member to fill arguments in it
327     @return     right filled member struct or unchanged struct if an error occure!
328 
329     @onerror    We do nothing - or warn programmer!
330 *//*-*************************************************************************************************************/
impl_parseCommandLine(AppMember & rMember)331 void XCDGenerator::impl_parseCommandLine( AppMember& rMember )
332 {
333     ::vos::OStartupInfo aInfo                                   ;
334     ::rtl::OUString     sArgument                               ;
335     sal_Int32           nArgument   = 0                         ;
336     sal_Int32           nCount      = aInfo.getCommandArgCount();
337     sal_Int32           nMinCount   = 0                         ;
338 
339 	while( nArgument<nCount )
340 	{
341 		aInfo.getCommandArg( nArgument, sArgument );
342 /*OBSOLETE
343 		//_____________________________________________________________________________________________________
344         // look for "-fis=..."
345         if( sArgument.compareTo( ARGUMENT_FILENAME_STANDARD, ARGUMENTLENGTH ) == ARGUMENTFOUND )
346 		{
347             rMember.sFileNameStandard = sArgument.copy( ARGUMENTLENGTH, sArgument.getLength()-ARGUMENTLENGTH );
348             ++nMinCount;
349 		}
350         else
351 		//_____________________________________________________________________________________________________
352         // look for "-fia=..."
353         if( sArgument.compareTo( ARGUMENT_FILENAME_ADDITIONAL, ARGUMENTLENGTH ) == ARGUMENTFOUND )
354 		{
355             rMember.sFileNameAdditional = sArgument.copy( ARGUMENTLENGTH, sArgument.getLength()-ARGUMENTLENGTH );
356             ++nMinCount;
357 		}
358         else
359 */
360 		//_____________________________________________________________________________________________________
361         // look for "-pas=..."
362         if( sArgument.compareTo( ARGUMENT_PACKAGE_STANDARD, ARGUMENTLENGTH ) == ARGUMENTFOUND )
363 		{
364             rMember.sPackageStandard = sArgument.copy( ARGUMENTLENGTH, sArgument.getLength()-ARGUMENTLENGTH );
365             ++nMinCount;
366 		}
367         else
368 		//_____________________________________________________________________________________________________
369         // look for "-paa=..."
370         if( sArgument.compareTo( ARGUMENT_PACKAGE_ADDITIONAL, ARGUMENTLENGTH ) == ARGUMENTFOUND )
371 		{
372             rMember.sPackageAdditional = sArgument.copy( ARGUMENTLENGTH, sArgument.getLength()-ARGUMENTLENGTH );
373             ++nMinCount;
374 		}
375         else
376 		//_____________________________________________________________________________________________________
377         // look for "-wri=..."
378         if( sArgument.compareTo( ARGUMENT_WRITEABLE, ARGUMENTLENGTH ) == ARGUMENTFOUND )
379 		{
380             ::rtl::OUString sWriteable = sArgument.copy( ARGUMENTLENGTH, sArgument.getLength()-ARGUMENTLENGTH );
381             if( sWriteable == WRITEABLE_ON )
382             {
383                 rMember.bWriteable = sal_True;
384             }
385             else
386             {
387                 rMember.bWriteable = sal_False;
388             }
389             ++nMinCount;
390 		}
391 		//_____________________________________________________________________________________________________
392         // look for "-vin=..."
393         if( sArgument.compareTo( ARGUMENT_VERSION_INPUT, ARGUMENTLENGTH ) == ARGUMENTFOUND )
394 		{
395             ::rtl::OUString sVersion = sArgument.copy( ARGUMENTLENGTH, sArgument.getLength()-ARGUMENTLENGTH );
396             rMember.nVersionInput = sVersion.toInt32();
397             ++nMinCount;
398 		}
399 		//_____________________________________________________________________________________________________
400         // look for "-vou=..."
401         if( sArgument.compareTo( ARGUMENT_VERSION_OUTPUT, ARGUMENTLENGTH ) == ARGUMENTFOUND )
402 		{
403             ::rtl::OUString sVersion = sArgument.copy( ARGUMENTLENGTH, sArgument.getLength()-ARGUMENTLENGTH );
404             rMember.nVersionOutput = sVersion.toInt32();
405             ++nMinCount;
406 		}
407 
408 		++nArgument;
409 	}
410 
411     // Show help if user don't call us right!
412     if( nMinCount != MINARGUMENTCOUNT )
413     {
414         impl_printSyntax();
415         exit(-1);
416     }
417 }
418 
419 /*-************************************************************************************************************//**
420     @short      regulate generation of complete xcd file(s)
421     @descr      This method is the toppest one and implement the global structure of generated xcd file(s).
422                 We create a unicode string buffer for complete xcd file in memory ...
423                 use different helper methods to fill it ...
424                 and write it to disk at the end of this method!
425 
426     @seealso    struct AppMember
427 
428     @param      -
429     @return     -
430 
431     @onerror    -
432 *//*-*************************************************************************************************************/
impl_generateXCD()433 void XCDGenerator::impl_generateXCD()
434 {
435     impl_generateCopyright();
436 
437     // Write header
438     m_aData.sBufferStandard.appendAscii     ( "\n<!-- PLEASE DON'T CHANGE TEMPLATES OR FILE FORMAT BY HAND! USE \"XML2XCD.EXE\" TO DO THAT. THANKS. -->\n\n"                                                                                                                                                               );
439     m_aData.sBufferStandard.appendAscii     ( "<!DOCTYPE schema:component SYSTEM \"../../../../schema/schema.description.dtd\">\n"                                                                                                                                                                                         );
440     m_aData.sBufferStandard.appendAscii     ( "<schema:component cfg:name=\""                                                                                                                                                                                                                                              );
441     m_aData.sBufferStandard.append          ( m_aData.sPackageStandard                                                                                                                                                                                                                                                     );
442     m_aData.sBufferStandard.appendAscii     ( "\" cfg:package=\"org.openoffice.Office\" xml:lang=\"en-US\" xmlns:schema=\"http://openoffice.org/2000/registry/schema/description\" xmlns:default=\"http://openoffice.org/2000/registry/schema/default\" xmlns:cfg=\"http://openoffice.org/2000/registry/instance\">\n"     );
443     m_aData.sBufferStandard.appendAscii     ( "\t<schema:templates>\n"                                                                                                                                                                                                                                                     );
444 
445     if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION )
446     {
447         m_aData.sBufferAdditional.appendAscii   ( "\n<!-- PLEASE DON'T CHANGE TEMPLATES OR FILE FORMAT BY HAND! USE \"XML2XCD.EXE\" TO DO THAT. THANKS. -->\n\n"                                                                                                                                                           );
448         m_aData.sBufferAdditional.appendAscii   ( "<!DOCTYPE schema:component SYSTEM \"../../../../schema/schema.description.dtd\">\n"                                                                                                                                                                                     );
449         m_aData.sBufferAdditional.appendAscii   ( "<schema:component cfg:name=\""                                                                                                                                                                                                                                          );
450         m_aData.sBufferAdditional.append        ( m_aData.sPackageAdditional                                                                                                                                                                                                                                               );
451         m_aData.sBufferAdditional.appendAscii   ( "\" cfg:package=\"org.openoffice.Office\" xml:lang=\"en-US\" xmlns:schema=\"http://openoffice.org/2000/registry/schema/description\" xmlns:default=\"http://openoffice.org/2000/registry/schema/default\" xmlns:cfg=\"http://openoffice.org/2000/registry/instance\">\n" );
452         m_aData.sBufferAdditional.appendAscii   ( "\t<schema:import cfg:name=\""                                                                                                                                                                                                                                             );
453         m_aData.sBufferAdditional.append        ( m_aData.sPackageStandard                                                                                                                                                                                                                                                 );
454         m_aData.sBufferAdditional.appendAscii   ( "\"/>\n"                                                                                                                                                                                                                                                                 );
455     }
456 
457     // Follow ...generate... methods to nothing for additional filters!
458     impl_generateTypeTemplate    ();
459     impl_generateFilterTemplate  ();
460     impl_generateDetectorTemplate();
461     if( m_aData.nVersionOutput >= 5 )
462     {
463         impl_generateContentHandlerTemplate ();
464     }
465     impl_generateLoaderTemplate  ();
466 
467     m_aData.sBufferStandard.appendAscii     ( "\t</schema:templates>\n"                     );
468     m_aData.sBufferStandard.appendAscii     ( "<schema:schema cfg:localized=\"false\">\n"   );
469 
470     if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION )
471     {
472         m_aData.sBufferAdditional.appendAscii( "\t<schema:schema cfg:localized=\"false\">\n"   );
473     }
474 
475     impl_generateTypeSet         ();
476     impl_generateFilterSet       ();
477     impl_generateDetectorSet     ();
478     if( m_aData.nVersionInput >= 5 )
479     {
480         impl_generateContentHandlerSet  ();
481     }
482     impl_generateLoaderSet       ();
483     impl_generateDefaults        ();
484 
485     m_aData.sBufferStandard.appendAscii     ( "\t</schema:schema>\n"  );
486     m_aData.sBufferStandard.appendAscii     ( "</schema:component>\n" );
487 
488     if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION )
489     {
490         m_aData.sBufferAdditional.appendAscii ( "\t</schema:schema>\n"  );
491         m_aData.sBufferAdditional.appendAscii ( "</schema:component>\n" );
492     }
493 
494     ::rtl::OUString sFileName  = m_aData.sPackageStandard   ;
495                     sFileName += DECLARE_ASCII(".xcd")      ;
496 
497     WRITE_LOGFILE( U2B( sFileName )         , U2B(m_aData.sBufferStandard.makeStringAndClear()       ))
498     WRITE_LOGFILE( LISTFILE_STANDARDFILTER  , U2B(m_aData.sStandardFilterList.makeStringAndClear()   ))
499     WRITE_LOGFILE( LISTFILE_STANDARDTYPES   , U2B(m_aData.sStandardTypeList.makeStringAndClear()     ))
500     WRITE_LOGFILE( SCPFILE_STANDARD         , U2B(m_aData.sNew2OldSCPStandard.makeStringAndClear()   ))
501 
502     if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION )
503     {
504         sFileName  = m_aData.sPackageAdditional ;
505         sFileName += DECLARE_ASCII(".xcd")      ;
506 
507         WRITE_LOGFILE( U2B(sFileName)           , U2B(m_aData.sBufferAdditional.makeStringAndClear()     ))
508         WRITE_LOGFILE( LISTFILE_ADDITIONALFILTER, U2B(m_aData.sAdditionalFilterList.makeStringAndClear() ))
509         WRITE_LOGFILE( LISTFILE_ADDITIONALTYPES , U2B(m_aData.sAdditionalTypeList.makeStringAndClear()   ))
510         WRITE_LOGFILE( SCPFILE_ADDITIONAL       , U2B(m_aData.sNew2OldSCPAdditional.makeStringAndClear() ))
511     }
512 }
513 
514 //*****************************************************************************************************************
impl_generateCopyright()515 void XCDGenerator::impl_generateCopyright()
516 {
517     m_aData.sBufferStandard.appendAscii( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"                                );
518     m_aData.sBufferStandard.appendAscii( "<!--***********************************************************\n");
519     m_aData.sBufferStandard.appendAscii( " *\n");
520     m_aData.sBufferStandard.appendAscii( " * Licensed to the Apache Software Foundation (ASF) under one\n");
521     m_aData.sBufferStandard.appendAscii( " * or more contributor license agreements.  See the NOTICE file\n");
522     m_aData.sBufferStandard.appendAscii( " * distributed with this work for additional information\n");
523     m_aData.sBufferStandard.appendAscii( " * regarding copyright ownership.  The ASF licenses this file\n");
524     m_aData.sBufferStandard.appendAscii( " * to you under the Apache License, Version 2.0 (the\n");
525     m_aData.sBufferStandard.appendAscii( " * \"License\"); you may not use this file except in compliance\n");
526     m_aData.sBufferStandard.appendAscii( " * with the License.  You may obtain a copy of the License at\n");
527     m_aData.sBufferStandard.appendAscii( " *\n");
528     m_aData.sBufferStandard.appendAscii( " *   http://www.apache.org/licenses/LICENSE-2.0\n");
529     m_aData.sBufferStandard.appendAscii( " * \n");
530     m_aData.sBufferStandard.appendAscii( " * Unless required by applicable law or agreed to in writing,\n");
531     m_aData.sBufferStandard.appendAscii( " * software distributed under the License is distributed on an\n");
532     m_aData.sBufferStandard.appendAscii( " * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n");
533     m_aData.sBufferStandard.appendAscii( " * KIND, either express or implied.  See the License for the\n");
534     m_aData.sBufferStandard.appendAscii( " * specific language governing permissions and limitations\n");
535     m_aData.sBufferStandard.appendAscii( " * under the License.\n");
536     m_aData.sBufferStandard.appendAscii( " * \n");
537     m_aData.sBufferStandard.appendAscii( " ***********************************************************-->\n");
538 
539     if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION )
540     {
541         m_aData.sBufferAdditional.appendAscii( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"                                );
542     m_aData.sBufferStandard.appendAscii( "<!--***********************************************************\n");
543     m_aData.sBufferStandard.appendAscii( " *\n");
544     m_aData.sBufferStandard.appendAscii( " * Licensed to the Apache Software Foundation (ASF) under one\n");
545     m_aData.sBufferStandard.appendAscii( " * or more contributor license agreements.  See the NOTICE file\n");
546     m_aData.sBufferStandard.appendAscii( " * distributed with this work for additional information\n");
547     m_aData.sBufferStandard.appendAscii( " * regarding copyright ownership.  The ASF licenses this file\n");
548     m_aData.sBufferStandard.appendAscii( " * to you under the Apache License, Version 2.0 (the\n");
549     m_aData.sBufferStandard.appendAscii( " * \"License\"); you may not use this file except in compliance\n");
550     m_aData.sBufferStandard.appendAscii( " * with the License.  You may obtain a copy of the License at\n");
551     m_aData.sBufferStandard.appendAscii( " *\n");
552     m_aData.sBufferStandard.appendAscii( " *   http://www.apache.org/licenses/LICENSE-2.0\n");
553     m_aData.sBufferStandard.appendAscii( " * \n");
554     m_aData.sBufferStandard.appendAscii( " * Unless required by applicable law or agreed to in writing,\n");
555     m_aData.sBufferStandard.appendAscii( " * software distributed under the License is distributed on an\n");
556     m_aData.sBufferStandard.appendAscii( " * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n");
557     m_aData.sBufferStandard.appendAscii( " * KIND, either express or implied.  See the License for the\n");
558     m_aData.sBufferStandard.appendAscii( " * specific language governing permissions and limitations\n");
559     m_aData.sBufferStandard.appendAscii( " * under the License.\n");
560     m_aData.sBufferStandard.appendAscii( " * \n");
561     m_aData.sBufferStandard.appendAscii( " ***********************************************************-->\n");
562     }
563 }
564 
565 //*****************************************************************************************************************
impl_generateTypeTemplate()566 void XCDGenerator::impl_generateTypeTemplate()
567 {
568     //_________________________________________________________________________________________________________________
569     if( m_aData.nVersionOutput==1 || m_aData.nVersionOutput==2 )
570     {
571         m_aData.sBufferStandard.appendAscii( "\t\t<schema:group cfg:name=\"Type\">\n"                                                                                                                                                                  );
572 
573         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Preferred\" cfg:type=\"boolean\" cfg:writable=\""                                                                                                                         );
574         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                                                                                 );
575         m_aData.sBufferStandard.appendAscii("\t\t\t\t<schema:documentation>\n"                                                                                                                                                                         );
576         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the preferred type for an extension if more then one match given URL</schema:description>\n"                                                                     );
577         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                                                                       );
578         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>false</default:data>\n"                                                                                                                                                            );
579         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                                                                                 );
580 
581         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"UIName\" cfg:type=\"string\" cfg:localized=\"true\" cfg:writable=\""                                                                                                      );
582         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                                                                                 );
583         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                                                                        );
584         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the external name of this type</schema:description>\n"                                                                                                           );
585         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                                                                       );
586         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                                                                                 );
587 
588         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"MediaType\" cfg:type=\"string\" cfg:writable=\""                                                                                                                          );
589         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                                                                                 );
590         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                                                                        );
591         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the mime type </schema:description>\n"                                                                                                                           );
592         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                                                                       );
593         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                                                                                 );
594 
595         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"ClipboardFormat\" cfg:type=\"string\" cfg:writable=\""                                                                                                                    );
596         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                                                                                 );
597         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                                                                        );
598         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the clipboard format name</schema:description>\n"                                                                                                                );
599         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                                                                       );
600         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                                                                                 );
601 
602         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"URLPattern\" cfg:type=\"string\" cfg:derivedBy=\"list\" cfg:writable=\""                                                                                                  );
603         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                                                                                 );
604         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                                                                        );
605         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the patterns used for URLs. This type is only relevant for HTTP, FTP etc. and is used for internal URL formats like private:factory etc.</schema:description>\n" );
606         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                                                                       );
607         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                                                                                 );
608 
609         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Extensions\" cfg:type=\"string\" cfg:derivedBy=\"list\" cfg:writable=\""                                                                                                  );
610         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                                                                                 );
611         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                                                                        );
612         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the possible file extensions.</schema:description>\n"                                                                                                            );
613         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                                                                       );
614         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                                                                                 );
615 
616         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"DocumentIconID\" cfg:type=\"int\" cfg:writable=\""                                                                                                                        );
617         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                                                                                 );
618         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                                                                        );
619         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the document icon ID of this type</schema:description>\n"                                                                                                        );
620         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                                                                       );
621         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>0</default:data>\n"                                                                                                                                                                );
622         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                                                                                 );
623 
624         m_aData.sBufferStandard.appendAscii( "\t\t</schema:group>\n"                                                                                                                                                                                   );
625     }
626     //_________________________________________________________________________________________________________________
627     else if( m_aData.nVersionOutput>=3 )
628     {
629         m_aData.sBufferStandard.appendAscii( "\t\t<schema:group cfg:name=\"Type\">\n"                                                                                                                                                                  );
630 
631         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"UIName\" cfg:type=\"string\" cfg:localized=\"true\" cfg:writable=\""                                                                                                      );
632         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                                                                                 );
633         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                                                                        );
634         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the external name of this type</schema:description>\n"                                                                                                           );
635         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                                                                       );
636         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                                                                                 );
637 
638         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Data\" cfg:type=\"string\" cfg:writable=\""                                                                                                                               );
639         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                                                                                 );
640         m_aData.sBufferStandard.appendAscii("\t\t\t\t<schema:documentation>\n"                                                                                                                                                                         );
641         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Containes all data of a type as an own formated string.{Preferred, MediaType, ClipboardFormat, URLPattern, Extensions, DocumentIconID}</schema:description>\n"             );
642         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                                                                       );
643         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>false</default:data>\n"                                                                                                                                                            );
644         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                                                                                 );
645 
646         m_aData.sBufferStandard.appendAscii( "\t\t</schema:group>\n"                                                                                                                                                                                   );
647     }
648 }
649 
650 //*****************************************************************************************************************
impl_generateFilterTemplate()651 void XCDGenerator::impl_generateFilterTemplate()
652 {
653     //_________________________________________________________________________________________________________________
654     if( m_aData.nVersionOutput==1 || m_aData.nVersionOutput==2 )
655     {
656         m_aData.sBufferStandard.appendAscii( "\t\t<schema:group cfg:name=\"Filter\">\n"                                                                                                            );
657 
658         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Installed\" cfg:type=\"boolean\" cfg:writable=\""                                                                     );
659         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                             );
660         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                    );
661         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Make it possible to enable or disable filter by setup!</schema:description>\n"                                         );
662         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                   );
663         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>false</default:data>\n"                                                                                                        );
664         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                             );
665 
666         if( m_aData.nVersionOutput==2 )
667         {
668         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Order\" cfg:type=\"int\" cfg:writable=\""                                                                             );
669         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                             );
670         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                    );
671         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies order of filters for relevant module; don't used for default filter!</schema:description>\n"                 );
672         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                   );
673         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>0</default:data>\n"                                                                                                            );
674         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                             );
675         }
676 
677         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"UIName\" cfg:type=\"string\" cfg:localized=\"true\" cfg:writable=\""                                                  );
678         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                             );
679         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                    );
680         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the external name of the filter which is displayed at the user interface (dialog).</schema:description>\n"   );
681         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                   );
682         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                             );
683 
684         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Type\" cfg:type=\"string\" cfg:writable=\""                                                                           );
685         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                             );
686         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                    );
687         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the relative type key name of the filter, e.g. Type/T1</schema:description>\n"                               );
688         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                   );
689         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                             );
690 
691         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"DocumentService\" cfg:type=\"string\" cfg:writable=\""                                                                );
692         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                             );
693         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                    );
694         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the name of the UNO service to implement the document.</schema:description>\n"                               );
695         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                   );
696         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                             );
697 
698         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"FilterService\" cfg:type=\"string\" cfg:writable=\""                                                                  );
699         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                             );
700         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                    );
701         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the name of the UNO service for importing the document.</schema:description>\n"                              );
702         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                   );
703         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                             );
704 
705         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Flags\" cfg:type=\"int\" cfg:writable=\""                                                                             );
706         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                             );
707         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                    );
708         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the properties of the filter</schema:description>\n"                                                         );
709         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                   );
710         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:type-info>\n"                                                                                                                        );
711         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:value-names>\n"                                                                                                                    );
712         impl_generateFilterFlagTemplate( FILTERFLAGNAME_IMPORT            , FILTERFLAG_IMPORT         , "mark filter for import"                                          );
713         impl_generateFilterFlagTemplate( FILTERFLAGNAME_EXPORT            , FILTERFLAG_EXPORT         , "mark filter for export"                                          );
714         impl_generateFilterFlagTemplate( FILTERFLAGNAME_TEMPLATE          , FILTERFLAG_TEMPLATE                                                                           );
715         impl_generateFilterFlagTemplate( FILTERFLAGNAME_INTERNAL          , FILTERFLAG_INTERNAL                                                                           );
716         impl_generateFilterFlagTemplate( FILTERFLAGNAME_TEMPLATEPATH      , FILTERFLAG_TEMPLATEPATH                                                                       );
717         impl_generateFilterFlagTemplate( FILTERFLAGNAME_OWN               , FILTERFLAG_OWN                                                                                );
718         impl_generateFilterFlagTemplate( FILTERFLAGNAME_ALIEN             , FILTERFLAG_ALIEN                                                                              );
719         impl_generateFilterFlagTemplate( FILTERFLAGNAME_USESOPTIONS       , FILTERFLAG_USESOPTIONS                                                                        );
720         impl_generateFilterFlagTemplate( FILTERFLAGNAME_DEFAULT           , FILTERFLAG_DEFAULT        , "most important filter, if more then ones available"              );
721         impl_generateFilterFlagTemplate( FILTERFLAGNAME_NOTINFILEDIALOG   , FILTERFLAG_NOTINFILEDIALOG, "don't show it in file dialogs!"                                  );
722         impl_generateFilterFlagTemplate( FILTERFLAGNAME_NOTINCHOOSER      , FILTERFLAG_NOTINCHOOSER   , "don't show it in chooser!"                                       );
723         impl_generateFilterFlagTemplate( FILTERFLAGNAME_ASYNCHRON         , FILTERFLAG_ASYNCHRON                                                                          );
724         impl_generateFilterFlagTemplate( FILTERFLAGNAME_NOTINSTALLED      , FILTERFLAG_NOTINSTALLED   , "set, if the filter is not installed, but available on CD"        );
725         impl_generateFilterFlagTemplate( FILTERFLAGNAME_CONSULTSERVICE    , FILTERFLAG_CONSULTSERVICE , "set, if the filter is not installed and not available an CD"     );
726         impl_generateFilterFlagTemplate( FILTERFLAGNAME_3RDPARTYFILTER    , FILTERFLAG_3RDPARTYFILTER , "must set, if the filter is an external one"                      );
727         impl_generateFilterFlagTemplate( FILTERFLAGNAME_PACKED            , FILTERFLAG_PACKED                                                                             );
728         impl_generateFilterFlagTemplate( FILTERFLAGNAME_SILENTEXPORT      , FILTERFLAG_SILENTEXPORT                                                                       );
729         impl_generateFilterFlagTemplate( FILTERFLAGNAME_PREFERED          , FILTERFLAG_PREFERED                                                                           );
730         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t</schema:value-names>\n"                                                                                                                   );
731         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:constraints xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\"/>\n"                                                                    );
732         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:type-info>\n"                                                                                                                       );
733         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>0</default:data>\n"                                                                                                            );
734         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                             );
735 
736         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"UserData\" cfg:type=\"string\" cfg:derivedBy=\"list\" cfg:writable=\""                                                );
737         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                             );
738         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                    );
739         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the user-defined data</schema:description>\n"                                                                );
740         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                   );
741         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data/>\n"                                                                                                                           );
742         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                             );
743 
744         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"FileFormatVersion\" cfg:type=\"int\" cfg:writable=\""                                                                 );
745         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                             );
746         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<!--This should be removed to UserData later-->\n"                                                                                           );
747         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                    );
748         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the file format version of the filter</schema:description>\n"                                                );
749         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                   );
750         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>0</default:data>\n"                                                                                                            );
751         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                             );
752 
753         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"TemplateName\" cfg:type=\"string\" cfg:writable=\""                                                                   );
754         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                             );
755         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<!--This should be removed to UserData later-->\n"                                                                                           );
756         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                    );
757         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the template used for importing the file with the specified filter.</schema:description>\n"                  );
758         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t</schema:documentation>\n"                                                                                                                 );
759         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                             );
760 
761         m_aData.sBufferStandard.appendAscii( "\t\t</schema:group>\n"                                                                                                                               );
762     //_________________________________________________________________________________________________________________
763     }
764     else if( m_aData.nVersionOutput>=3 )
765     {
766         m_aData.sBufferStandard.appendAscii( "\t\t<schema:group cfg:name=\"Filter\">\n"                                                                                                                                                                    );
767 
768         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Installed\" cfg:type=\"boolean\" cfg:writable=\""                                                                                                                             );
769         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                                                                                     );
770         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                                                                            );
771         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Make it possible to enable or disable filter by setup!</schema:description>\n"                                                                                                 );
772         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                                                                           );
773         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>false</default:data>\n"                                                                                                                                                                );
774         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                                                                                     );
775 
776         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"UIName\" cfg:type=\"string\" cfg:localized=\"true\" cfg:writable=\""                                                                                                          );
777         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                                                                                     );
778         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                                                                            );
779         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the external name of the filter which is displayed at the user interface (dialog).</schema:description>\n"                                                           );
780         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                                                                           );
781         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                                                                                     );
782 
783         m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Data\" cfg:type=\"string\" cfg:writable=\""                                                                                                                                   );
784         m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                                                                                     );
785         m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                                                                            );
786         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>All data of filter written in own format. {Order, OldName, Type, DocumentService, FilterService, Flags, UserData, FilteFormatVersion, TemplateName}</schema:description>\n"    );
787         m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                                                                           );
788         m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                                                                                     );
789 
790         m_aData.sBufferStandard.appendAscii( "\t\t</schema:group>\n"                                                                                                                                                                                       );
791     }
792 }
793 
794 //*****************************************************************************************************************
impl_generateFilterFlagTemplate(const::rtl::OUString & sName,sal_Int32 nValue,const::rtl::OString & sDescription)795 void XCDGenerator::impl_generateFilterFlagTemplate( const ::rtl::OUString& sName, sal_Int32 nValue, const ::rtl::OString& sDescription )
796 {
797     m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t\t<schema:named-value name=\"" );
798     m_aData.sBufferStandard.append     ( sName                                     );
799     m_aData.sBufferStandard.appendAscii( "\" value=\""                             );
800     m_aData.sBufferStandard.append     ( nValue                                    );
801     m_aData.sBufferStandard.appendAscii( "\""                                      );
802 
803 	if( sDescription.getLength() > 0 )
804 	{
805         m_aData.sBufferStandard.appendAscii( ">\n\t\t\t\t\t\t\t<schema:description>"   );
806         m_aData.sBufferStandard.appendAscii( sDescription                              );
807         m_aData.sBufferStandard.appendAscii( "</schema:description>\n"                 );
808         m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t\t</schema:named-value>\n"     );
809 	}
810 	else
811 	{
812         m_aData.sBufferStandard.appendAscii( "/>\n"                                    );
813 	}
814 }
815 
816 //*****************************************************************************************************************
impl_generateDetectorTemplate()817 void XCDGenerator::impl_generateDetectorTemplate()
818 {
819     m_aData.sBufferStandard.appendAscii( "\t\t<schema:group cfg:name=\"DetectService\">\n"                                                             );
820     m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Types\" cfg:type=\"string\" cfg:derivedBy=\"list\" cfg:writable=\""           );
821     m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                     );
822     m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                            );
823     m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>List of types which the service has registered for.</schema:description>\n"    );
824     m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                           );
825     m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                     );
826     m_aData.sBufferStandard.appendAscii( "\t\t</schema:group>\n"                                                                                       );
827 }
828 
829 //*****************************************************************************************************************
impl_generateLoaderTemplate()830 void XCDGenerator::impl_generateLoaderTemplate()
831 {
832     m_aData.sBufferStandard.appendAscii( "\t\t<schema:group cfg:name=\"FrameLoader\">\n"                                                                                                       );
833     m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"UIName\" cfg:type=\"string\" cfg:localized=\"true\" cfg:writable=\""                                                  );
834     m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                             );
835     m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                    );
836     m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the external name of the filter which is displayed at the user interface (dialog).</schema:description>\n"   );
837     m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                   );
838     m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                             );
839     m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Types\" cfg:type=\"string\" cfg:derivedBy=\"list\" cfg:writable=\""                                                   );
840     m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                                                             );
841     m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                                                                    );
842     m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>List of types which the service has registered for.</schema:description>\n"                                            );
843     m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                                                                   );
844     m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                                                             );
845     m_aData.sBufferStandard.appendAscii( "\t\t</schema:group>\n"                                                                                                                               );
846 }
847 
848 //*****************************************************************************************************************
impl_generateContentHandlerTemplate()849 void XCDGenerator::impl_generateContentHandlerTemplate()
850 {
851     m_aData.sBufferStandard.appendAscii( "\t\t<schema:group cfg:name=\"ContentHandler\">\n"                                                            );
852     m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Types\" cfg:type=\"string\" cfg:derivedBy=\"list\" cfg:writable=\""           );
853     m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n"                                                     );
854     m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n"                                                                            );
855     m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>List of types which could be handled by this service.</schema:description>\n"  );
856     m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n"                                                                           );
857     m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n"                                                                                     );
858     m_aData.sBufferStandard.appendAscii( "\t\t</schema:group>\n"                                                                                       );
859 }
860 
861 //*****************************************************************************************************************
impl_generateTypeSet()862 void XCDGenerator::impl_generateTypeSet()
863 {
864     if( m_aData.pFilterCache->hasTypes() == sal_False )
865     {
866 		// generate empty set!
867         m_aData.sBufferStandard.appendAscii  ( "\t<schema:set cfg:name=\"Types\" cfg:element-type=\"Type\"/>\n"                 );
868 
869         if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION )
870         {
871             m_aData.sBufferAdditional.appendAscii( "\t<schema:set cfg:name=\"Types\" cfg:element-type=\"Type\" cfg:component=\""    );
872             m_aData.sBufferAdditional.append     ( m_aData.sPackageStandard                                                         );
873             m_aData.sBufferAdditional.appendAscii( "\"/>\n"                                                                         );
874         }
875     }
876     else
877 	{
878         // generate filled set
879 		// open set
880         m_aData.sBufferStandard.appendAscii  ( "\t<schema:set cfg:name=\"Types\" cfg:element-type=\"Type\">\n"                  );
881 
882         if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION )
883         {
884             m_aData.sBufferAdditional.appendAscii( "\t<schema:set cfg:name=\"Types\" cfg:element-type=\"Type\" cfg:component=\""    );
885             m_aData.sBufferAdditional.append     ( m_aData.sPackageStandard                                                         );
886             m_aData.sBufferAdditional.appendAscii( "\">\n"                                                                          );
887         }
888 
889         css::uno::Sequence< ::rtl::OUString > lNames    = m_aData.pFilterCache->getAllTypeNames();
890         css::uno::Sequence< ::rtl::OUString > lEncNames ( lNames )                               ;
891         sal_Int32                             nCount    = lNames.getLength()                     ;
892         sal_Int32                             nItem     = 0                                      ;
893 
894         XCDGenerator::impl_orderAlphabetical( lNames );
895 
896         if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 )
897         {
898             ::rtl::OUString sName   ;
899             ::rtl::OUString sEncName;
900             for( nItem=0; nItem<nCount; ++nItem )
901             {
902                 sName            = lNames[nItem]              ;
903                 lEncNames[nItem] = impl_encodeSetName( sName );
904             }
905         }
906 
907         for( nItem=0; nItem<nCount; ++nItem )
908         {
909             ::rtl::OUString sName   = lNames[nItem]                         ;
910             FileType        aItem   = m_aData.pFilterCache->getType( sName );
911             EFilterPackage  ePackage                                        ;
912 
913             ++m_aData.nWrittenTypes;
914 
915             if( m_aData.nVersionOutput==1 || m_aData.nVersionOutput==2 )
916             {
917                 // open set entry by using name
918                 m_aData.sBufferStandard.appendAscii( "\t\t<default:group cfg:name=\""  );
919                 m_aData.sBufferStandard.append     ( sName                             );
920                 m_aData.sBufferStandard.appendAscii( "\">\n"                           );
921 
922                 // write properties
923                 impl_generateBoolProperty       ( m_aData.sBufferStandard, SUBKEY_PREFERRED        , aItem.bPreferred       );
924                 impl_generateUINamesProperty    ( m_aData.sBufferStandard, SUBKEY_UINAME           , aItem.lUINames         );
925                 impl_generateStringProperty     ( m_aData.sBufferStandard, SUBKEY_MEDIATYPE        , aItem.sMediaType       );
926                 impl_generateStringProperty     ( m_aData.sBufferStandard, SUBKEY_CLIPBOARDFORMAT  , aItem.sClipboardFormat );
927                 impl_generateStringListProperty ( m_aData.sBufferStandard, SUBKEY_URLPATTERN       , aItem.lURLPattern      );
928                 impl_generateStringListProperty ( m_aData.sBufferStandard, SUBKEY_EXTENSIONS       , aItem.lExtensions      );
929                 impl_generateIntProperty        ( m_aData.sBufferStandard, SUBKEY_DOCUMENTICONID   , aItem.nDocumentIconID  );
930 
931                 // close set node
932                 m_aData.sBufferStandard.appendAscii( "\t\t</default:group>\n" );
933             }
934             else if( m_aData.nVersionOutput >= 3 )
935             {
936                 ::rtl::OUString        sPath       = DECLARE_ASCII("org.openoffice.Office.");
937                 ::rtl::OUStringBuffer* pXCDBuffer  = &(m_aData.sBufferStandard      );
938                 ::rtl::OUStringBuffer* pSCPBuffer  = &(m_aData.sNew2OldSCPStandard  );
939                 ::rtl::OUStringBuffer* pListBuffer = &(m_aData.sStandardTypeList    );
940 
941                 if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION )
942                 {
943                     XCDGenerator::impl_classifyType( m_aData, sName, ePackage );
944                     switch( ePackage )
945                     {
946                         case E_ADDITIONAL   :   {
947                                                     sPath      += m_aData.sPackageAdditional      ;
948                                                     pXCDBuffer  = &(m_aData.sBufferAdditional    );
949                                                     pSCPBuffer  = &(m_aData.sNew2OldSCPAdditional);
950                                                     pListBuffer = &(m_aData.sAdditionalTypeList  );
951                                                 }
952                     }
953                 }
954                 else
955                 {
956                     sPath += m_aData.sPackageStandard;
957                 }
958 
959                 sPath += CFG_PATH_SEPERATOR      ;
960                 sPath += DECLARE_ASCII( "Types" );
961                 sPath += CFG_PATH_SEPERATOR      ;
962 
963                 pListBuffer->append     ( sName );
964                 pListBuffer->appendAscii( "\n"  );
965 
966                 if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 )
967                 {
968                     pSCPBuffer->appendAscii( "\""               );
969                     pSCPBuffer->append     ( sPath              );
970                     pSCPBuffer->append     ( lNames[nItem]      );
971                     pSCPBuffer->appendAscii( "\"\t\""           );
972                     pSCPBuffer->append     ( sPath              );
973                     pSCPBuffer->appendAscii( "Type"             );
974                     pSCPBuffer->append     ( CFG_ENCODING_OPEN  );
975                     pSCPBuffer->append     ( lNames[nItem]      );
976                     pSCPBuffer->append     ( CFG_ENCODING_CLOSE );
977                     pSCPBuffer->appendAscii( "\"\n"             );
978 
979                     sName       = lEncNames[nItem];
980                     aItem.sName = sName;
981                 }
982 
983                 // open set entry by using name
984                 pXCDBuffer->appendAscii( "\t\t<default:group cfg:name=\""  );
985                 pXCDBuffer->append     ( sName                             );
986                 pXCDBuffer->appendAscii( "\">\n"                           );
987 
988                 // write properties
989                 impl_generateUINamesProperty( *pXCDBuffer, SUBKEY_UINAME, aItem.lUINames                           );
990                 impl_generateStringProperty ( *pXCDBuffer, SUBKEY_DATA  , FilterCFGAccess::encodeTypeData( aItem ) );
991 
992                 // close set node
993                 pXCDBuffer->appendAscii( "\t\t</default:group>\n" );
994             }
995         }
996 
997 		// close set
998         m_aData.sBufferStandard.appendAscii( "\t</schema:set>\n" );
999         if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION )
1000         {
1001             m_aData.sBufferAdditional.appendAscii( "\t</schema:set>\n" );
1002         }
1003 	}
1004 }
1005 
1006 //*****************************************************************************************************************
impl_generateFilterSet()1007 void XCDGenerator::impl_generateFilterSet()
1008 {
1009     if( m_aData.pFilterCache->hasFilters() == sal_False )
1010 	{
1011 		// write empty filter set.
1012         m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"Filters\" cfg:element-type=\"Filter\"/>\n" );
1013         if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION )
1014         {
1015             m_aData.sBufferAdditional.appendAscii( "\t<schema:set cfg:name=\"Filters\" cfg:element-type=\"Filter\" cfg:component=\""    );
1016             m_aData.sBufferAdditional.append     ( m_aData.sPackageStandard                                                             );
1017             m_aData.sBufferAdditional.appendAscii( "\"/>\n"                                                                             );
1018         }
1019     }
1020     else
1021     {
1022 		// open set
1023         m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"Filters\" cfg:element-type=\"Filter\">\n" );
1024         if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION )
1025         {
1026             m_aData.sBufferAdditional.appendAscii( "\t<schema:set cfg:name=\"Filters\" cfg:element-type=\"Filter\" cfg:component=\""    );
1027             m_aData.sBufferAdditional.append     ( m_aData.sPackageStandard                                                             );
1028             m_aData.sBufferAdditional.appendAscii( "\">\n"                                                                              );
1029         }
1030 
1031         css::uno::Sequence< ::rtl::OUString > lNewNames = m_aData.pFilterCache->getAllFilterNames();
1032         css::uno::Sequence< ::rtl::OUString > lOldNames ( lNewNames )                              ;
1033         css::uno::Sequence< ::rtl::OUString > lEncNames ( lNewNames )                              ;
1034         sal_Int32                             nCount    = lNewNames.getLength()                    ;
1035         sal_Int32                             nItem     = 0                                        ;
1036 
1037         XCDGenerator::impl_orderAlphabetical( lNewNames );
1038 
1039         if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 )
1040         {
1041             ::rtl::OUString sNewName;
1042             ::rtl::OUString sOldName;
1043             for( nItem=0; nItem<nCount; ++nItem )
1044             {
1045                 sNewName         = lNewNames[nItem]                   ;
1046                 sOldName         = impl_getOldFilterName  ( sNewName );
1047                 lOldNames[nItem] = sOldName                           ;
1048                 lEncNames[nItem] = impl_encodeSetName     ( sOldName );
1049             }
1050         }
1051 
1052         for( nItem=0; nItem<nCount; ++nItem )
1053         {
1054             ::rtl::OUString sName = lNewNames[nItem]                                    ;
1055             Filter          aItem = m_aData.pFilterCache->getFilter( lNewNames[nItem] ) ;
1056             EFilterPackage  ePackage                                                    ;
1057 
1058             ++m_aData.nWrittenFilters;
1059 
1060             if( m_aData.nVersionOutput==1 || m_aData.nVersionOutput==2 )
1061             {
1062                 // open set node by using name
1063                 m_aData.sBufferStandard.appendAscii( "\t\t<default:group cfg:name=\""  );
1064                 m_aData.sBufferStandard.append     ( sName                             );
1065                 m_aData.sBufferStandard.appendAscii( "\">\n"                           );
1066 
1067                 // write properties
1068                 // Attention:
1069                 // We generate "Installed=false" for all entries ... because it's the default for all filters.
1070                 // You must work with a full office installation and change this to "true" in generated XML file!!!
1071                 impl_generateBoolProperty       ( m_aData.sBufferStandard, SUBKEY_INSTALLED        , sal_False                );
1072                 impl_generateIntProperty        ( m_aData.sBufferStandard, SUBKEY_ORDER            , aItem.nOrder             );
1073                 impl_generateStringProperty     ( m_aData.sBufferStandard, SUBKEY_TYPE             , aItem.sType              );
1074                 impl_generateUINamesProperty    ( m_aData.sBufferStandard, SUBKEY_UINAME           , aItem.lUINames           );
1075                 impl_generateStringProperty     ( m_aData.sBufferStandard, SUBKEY_DOCUMENTSERVICE  , aItem.sDocumentService   );
1076                 impl_generateStringProperty     ( m_aData.sBufferStandard, SUBKEY_FILTERSERVICE    , aItem.sFilterService     );
1077                 impl_generateIntProperty        ( m_aData.sBufferStandard, SUBKEY_FLAGS            , aItem.nFlags             );
1078                 impl_generateStringListProperty ( m_aData.sBufferStandard, SUBKEY_USERDATA         , aItem.lUserData          );
1079                 impl_generateIntProperty        ( m_aData.sBufferStandard, SUBKEY_FILEFORMATVERSION, aItem.nFileFormatVersion );
1080                 impl_generateStringProperty     ( m_aData.sBufferStandard, SUBKEY_TEMPLATENAME     , aItem.sTemplateName      );
1081 
1082                 // close set node
1083                 m_aData.sBufferStandard.appendAscii( "\t\t</default:group>\n" );
1084             }
1085             else if( m_aData.nVersionOutput>=3 )
1086             {
1087                 ::rtl::OUString        sPath       = DECLARE_ASCII("org.openoffice.Office.");
1088                 ::rtl::OUStringBuffer* pXCDBuffer  = &(m_aData.sBufferStandard      );
1089                 ::rtl::OUStringBuffer* pSCPBuffer  = &(m_aData.sNew2OldSCPStandard  );
1090                 ::rtl::OUStringBuffer* pListBuffer = &(m_aData.sStandardFilterList  );
1091 
1092                 if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION )
1093                 {
1094                     XCDGenerator::impl_classifyFilter( m_aData, sName, ePackage, aItem.nOrder );
1095                     switch( ePackage )
1096                     {
1097                         case E_ADDITIONAL   :   {
1098                                                     sPath      += m_aData.sPackageAdditional      ;
1099                                                     pXCDBuffer  = &(m_aData.sBufferAdditional    );
1100                                                     pSCPBuffer  = &(m_aData.sNew2OldSCPAdditional);
1101                                                     pListBuffer = &(m_aData.sAdditionalFilterList);
1102                                                 }
1103                     }
1104                 }
1105                 else
1106                 {
1107                     sPath += m_aData.sPackageStandard;
1108                 }
1109 
1110                 sPath += CFG_PATH_SEPERATOR        ;
1111                 sPath += DECLARE_ASCII( "Filters" );
1112                 sPath += CFG_PATH_SEPERATOR        ;
1113 
1114                 pListBuffer->append     ( sName );
1115                 pListBuffer->appendAscii( "\n"  );
1116 
1117                 if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 )
1118                 {
1119                     pSCPBuffer->appendAscii( "\""               );
1120                     pSCPBuffer->append     ( sPath              );
1121                     pSCPBuffer->append     ( lNewNames[nItem]   );
1122                     pSCPBuffer->appendAscii( "\"\t\""           );
1123                     pSCPBuffer->append     ( sPath              );
1124                     pSCPBuffer->appendAscii( "Filter"           );
1125                     pSCPBuffer->append     ( CFG_ENCODING_OPEN  );
1126                     pSCPBuffer->append     ( lOldNames[nItem]   );
1127                     pSCPBuffer->append     ( CFG_ENCODING_CLOSE );
1128                     pSCPBuffer->appendAscii( "\"\n"             );
1129 
1130                     sName       = lEncNames[nItem];
1131                     aItem.sName = sName;
1132                 }
1133 
1134                 // open set node by using name
1135                 pXCDBuffer->appendAscii( "\t\t<default:group cfg:name=\"" );
1136                 pXCDBuffer->append     ( sName                            );
1137                 pXCDBuffer->appendAscii( "\">\n"                          );
1138 
1139                 // write properties
1140                 // Attention:
1141                 // We generate "Installed=false" for all entries ... because it's the default for all filters.
1142                 // You must work with a full office installation and change this to "true" in generated XML file!!!
1143                 impl_generateBoolProperty   ( *pXCDBuffer, SUBKEY_INSTALLED, sal_False                                  );
1144                 impl_generateUINamesProperty( *pXCDBuffer, SUBKEY_UINAME   , aItem.lUINames                             );
1145                 impl_generateStringProperty ( *pXCDBuffer, SUBKEY_DATA     , FilterCFGAccess::encodeFilterData( aItem ) );
1146 
1147                 // close set node
1148                 pXCDBuffer->appendAscii( "\t\t</default:group>\n" );
1149             }
1150         }
1151 
1152 		// close set
1153         m_aData.sBufferStandard.appendAscii( "\t</schema:set>\n" );
1154         if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION )
1155         {
1156             m_aData.sBufferAdditional.appendAscii( "\t</schema:set>\n" );
1157         }
1158 	}
1159 }
1160 
1161 //*****************************************************************************************************************
impl_generateDetectorSet()1162 void XCDGenerator::impl_generateDetectorSet()
1163 {
1164     if( m_aData.pFilterCache->hasDetectors() == sal_False )
1165 	{
1166 		// write empty detector set!
1167         m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"DetectServices\" cfg:element-type=\"DetectService\"/>\n" );
1168     }
1169     else
1170     {
1171 		// open set
1172         m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"DetectServices\" cfg:element-type=\"DetectService\">\n" );
1173 
1174         css::uno::Sequence< ::rtl::OUString > lNames    = m_aData.pFilterCache->getAllDetectorNames();
1175         css::uno::Sequence< ::rtl::OUString > lEncNames ( lNames )                                   ;
1176         sal_Int32                             nCount    = lNames.getLength()                         ;
1177         sal_Int32                             nItem     = 0                                          ;
1178 
1179         XCDGenerator::impl_orderAlphabetical( lNames );
1180 
1181         if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 )
1182         {
1183             ::rtl::OUString sName   ;
1184             ::rtl::OUString sEncName;
1185             for( nItem=0; nItem<nCount; ++nItem )
1186             {
1187                 sName            = lNames[nItem]              ;
1188                 lEncNames[nItem] = impl_encodeSetName( sName );
1189 
1190                 m_aData.sNew2OldSCPStandard.appendAscii ( "org.openoffice.Office."  );
1191                 m_aData.sNew2OldSCPStandard.append      ( m_aData.sPackageStandard  );
1192                 m_aData.sNew2OldSCPStandard.append      ( CFG_PATH_SEPERATOR        );
1193                 m_aData.sNew2OldSCPStandard.append      ( sName                     );
1194                 m_aData.sNew2OldSCPStandard.appendAscii ( "\torg.openoffice.Office.");
1195                 m_aData.sNew2OldSCPStandard.append      ( m_aData.sPackageStandard  );
1196                 m_aData.sNew2OldSCPStandard.append      ( CFG_PATH_SEPERATOR        );
1197                 m_aData.sNew2OldSCPStandard.appendAscii ( "DetectService"           );
1198                 m_aData.sNew2OldSCPStandard.append      ( CFG_ENCODING_OPEN         );
1199                 m_aData.sNew2OldSCPStandard.append      ( sName                     );
1200                 m_aData.sNew2OldSCPStandard.append      ( CFG_ENCODING_CLOSE        );
1201                 m_aData.sNew2OldSCPStandard.appendAscii ( "\n"                      );
1202             }
1203         }
1204 
1205         for( nItem=0; nItem<nCount; ++nItem )
1206 		{
1207             ::rtl::OUString sName = lNames[nItem]                             ;
1208             Detector        aItem = m_aData.pFilterCache->getDetector( sName );
1209 
1210             if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 )
1211             {
1212                 sName = lEncNames[nItem];
1213             }
1214 
1215             ++m_aData.nWrittenDetectors;
1216 
1217 			// open set node by using name
1218             m_aData.sBufferStandard.appendAscii( "\t\t<default:group cfg:name=\""  );
1219             m_aData.sBufferStandard.append     ( sName                             );
1220             m_aData.sBufferStandard.appendAscii( "\">\n"                           );
1221 
1222 			// write properties
1223             impl_generateStringListProperty ( m_aData.sBufferStandard, SUBKEY_TYPES, aItem.lTypes );
1224 
1225 			// close set node
1226             m_aData.sBufferStandard.appendAscii( "\t\t</default:group>\n" );
1227 		}
1228 
1229 		// close set
1230         m_aData.sBufferStandard.appendAscii( "\t</schema:set>\n" );
1231 	}
1232 }
1233 
1234 //*****************************************************************************************************************
impl_generateLoaderSet()1235 void XCDGenerator::impl_generateLoaderSet()
1236 {
1237     if( m_aData.pFilterCache->hasLoaders() == sal_False )
1238 	{
1239 		// write empty loader set!
1240         m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"FrameLoaders\" cfg:element-type=\"FrameLoader\"/>\n" );
1241     }
1242     else
1243     {
1244 		// open set
1245         m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"FrameLoaders\" cfg:element-type=\"FrameLoader\">\n" );
1246 
1247         css::uno::Sequence< ::rtl::OUString > lNames = m_aData.pFilterCache->getAllLoaderNames();
1248         css::uno::Sequence< ::rtl::OUString > lEncNames ( lNames )                              ;
1249         sal_Int32                             nCount = lNames.getLength()                       ;
1250         sal_Int32                             nItem  = 0                                        ;
1251 
1252         XCDGenerator::impl_orderAlphabetical( lNames );
1253 
1254         if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 )
1255         {
1256             ::rtl::OUString sName   ;
1257             ::rtl::OUString sEncName;
1258             for( nItem=0; nItem<nCount; ++nItem )
1259             {
1260                 sName            = lNames[nItem]              ;
1261                 lEncNames[nItem] = impl_encodeSetName( sName );
1262 
1263                 m_aData.sNew2OldSCPStandard.appendAscii ( "org.openoffice.Office."  );
1264                 m_aData.sNew2OldSCPStandard.append      ( m_aData.sPackageStandard  );
1265                 m_aData.sNew2OldSCPStandard.append      ( CFG_PATH_SEPERATOR        );
1266                 m_aData.sNew2OldSCPStandard.append      ( sName                     );
1267                 m_aData.sNew2OldSCPStandard.appendAscii ( "\torg.openoffice.Office.");
1268                 m_aData.sNew2OldSCPStandard.append      ( m_aData.sPackageStandard  );
1269                 m_aData.sNew2OldSCPStandard.append      ( CFG_PATH_SEPERATOR        );
1270                 m_aData.sNew2OldSCPStandard.appendAscii ( "FrameLoader"             );
1271                 m_aData.sNew2OldSCPStandard.append      ( CFG_ENCODING_OPEN         );
1272                 m_aData.sNew2OldSCPStandard.append      ( sName                     );
1273                 m_aData.sNew2OldSCPStandard.append      ( CFG_ENCODING_CLOSE        );
1274                 m_aData.sNew2OldSCPStandard.appendAscii ( "\n"                      );
1275             }
1276         }
1277 
1278         for( nItem=0; nItem<nCount; ++nItem )
1279 		{
1280             ::rtl::OUString sName = lNames[nItem]                           ;
1281             Loader          aItem = m_aData.pFilterCache->getLoader( sName );
1282 
1283             if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 )
1284             {
1285                 sName = lEncNames[nItem];
1286             }
1287 
1288             ++m_aData.nWrittenLoaders;
1289 
1290 			// open set node by using name
1291             m_aData.sBufferStandard.appendAscii( "\t\t<default:group cfg:name=\""  );
1292             m_aData.sBufferStandard.append     ( sName                             );
1293             m_aData.sBufferStandard.appendAscii( "\">\n"                           );
1294 
1295 			// write properties
1296             impl_generateUINamesProperty    ( m_aData.sBufferStandard, SUBKEY_UINAME, aItem.lUINames );
1297             impl_generateStringListProperty ( m_aData.sBufferStandard, SUBKEY_TYPES , aItem.lTypes   );
1298 
1299 			// close set node
1300             m_aData.sBufferStandard.appendAscii( "\t\t</default:group>\n" );
1301 		}
1302 
1303 		// close set
1304         m_aData.sBufferStandard.appendAscii( "\t</schema:set>\n" );
1305 	}
1306 }
1307 
1308 //*****************************************************************************************************************
impl_generateDefaults()1309 void XCDGenerator::impl_generateDefaults()
1310 {
1311 	// open group
1312     m_aData.sBufferStandard.appendAscii( "\t<schema:group cfg:name=\"Defaults\">\n" );
1313 
1314 	// write generic loader
1315     m_aData.sBufferStandard.appendAscii( "\t\t<schema:value cfg:name=\"FrameLoader\" cfg:type=\"string\">\n"   );
1316     m_aData.sBufferStandard.appendAscii( "\t\t\t<default:data>"                                                );
1317     m_aData.sBufferStandard.append     ( m_aData.pFilterCache->getDefaultLoader()                              );
1318     m_aData.sBufferStandard.appendAscii( "</default:data>\n"                                                   );
1319     m_aData.sBufferStandard.appendAscii( "\t\t</schema:value>\n"                                               );
1320 
1321 	// write default detector
1322     m_aData.sBufferStandard.appendAscii( "\t\t<schema:value cfg:name=\"DetectService\" cfg:type=\"string\">\n" );
1323     m_aData.sBufferStandard.appendAscii( "\t\t\t<default:data>"                                                );
1324     m_aData.sBufferStandard.append     ( m_aData.pFilterCache->getDefaultDetector()                            );
1325     m_aData.sBufferStandard.appendAscii( "</default:data>\n"                                                   );
1326     m_aData.sBufferStandard.appendAscii( "\t\t</schema:value>\n"                                               );
1327 
1328 	// close group
1329     m_aData.sBufferStandard.appendAscii( "\t</schema:group>\n" );
1330 }
1331 
1332 //*****************************************************************************************************************
impl_generateContentHandlerSet()1333 void XCDGenerator::impl_generateContentHandlerSet()
1334 {
1335     if( m_aData.pFilterCache->hasContentHandlers() == sal_False )
1336 	{
1337         // write empty handler set!
1338         m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"ContentHandlers\" cfg:element-type=\"ContentHandler\"/>\n" );
1339     }
1340     else
1341     {
1342 		// open set
1343         m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"ContentHandlers\" cfg:element-type=\"ContentHandler\">\n" );
1344 
1345         css::uno::Sequence< ::rtl::OUString > lNames = m_aData.pFilterCache->getAllContentHandlerNames();
1346         css::uno::Sequence< ::rtl::OUString > lEncNames ( lNames )                              ;
1347         sal_Int32                             nCount = lNames.getLength()                       ;
1348         sal_Int32                             nItem  = 0                                        ;
1349 
1350         XCDGenerator::impl_orderAlphabetical( lNames );
1351 
1352         if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 )
1353         {
1354             ::rtl::OUString sName   ;
1355             ::rtl::OUString sEncName;
1356             for( nItem=0; nItem<nCount; ++nItem )
1357             {
1358                 sName            = lNames[nItem]              ;
1359                 lEncNames[nItem] = impl_encodeSetName( sName );
1360 
1361                 m_aData.sNew2OldSCPStandard.appendAscii ( "org.openoffice.Office."  );
1362                 m_aData.sNew2OldSCPStandard.append      ( m_aData.sPackageStandard  );
1363                 m_aData.sNew2OldSCPStandard.append      ( CFG_PATH_SEPERATOR        );
1364                 m_aData.sNew2OldSCPStandard.append      ( sName                     );
1365                 m_aData.sNew2OldSCPStandard.appendAscii ( "\torg.openoffice.Office.");
1366                 m_aData.sNew2OldSCPStandard.append      ( m_aData.sPackageStandard  );
1367                 m_aData.sNew2OldSCPStandard.append      ( CFG_PATH_SEPERATOR        );
1368                 m_aData.sNew2OldSCPStandard.appendAscii ( "ContentHandler"          );
1369                 m_aData.sNew2OldSCPStandard.append      ( CFG_ENCODING_OPEN         );
1370                 m_aData.sNew2OldSCPStandard.append      ( sName                     );
1371                 m_aData.sNew2OldSCPStandard.append      ( CFG_ENCODING_CLOSE        );
1372                 m_aData.sNew2OldSCPStandard.appendAscii ( "\n"                      );
1373             }
1374         }
1375 
1376         for( nItem=0; nItem<nCount; ++nItem )
1377 		{
1378             ::rtl::OUString sName = lNames[nItem]                                   ;
1379             ContentHandler  aItem = m_aData.pFilterCache->getContentHandler( sName );
1380 
1381             if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 )
1382             {
1383                 sName = lEncNames[nItem];
1384             }
1385 
1386             ++m_aData.nWrittenContentHandlers;
1387 
1388 			// open set node by using name
1389             m_aData.sBufferStandard.appendAscii( "\t\t<default:group cfg:name=\""  );
1390             m_aData.sBufferStandard.append     ( sName                             );
1391             m_aData.sBufferStandard.appendAscii( "\">\n"                           );
1392 
1393 			// write properties
1394             impl_generateStringListProperty( m_aData.sBufferStandard, SUBKEY_TYPES, aItem.lTypes );
1395 
1396 			// close set node
1397             m_aData.sBufferStandard.appendAscii( "\t\t</default:group>\n" );
1398 		}
1399 
1400 		// close set
1401         m_aData.sBufferStandard.appendAscii( "\t</schema:set>\n" );
1402 	}
1403 }
1404 
1405 //*****************************************************************************************************************
impl_generateIntProperty(::rtl::OUStringBuffer & sXCD,const::rtl::OUString & sName,sal_Int32 nValue)1406 void XCDGenerator::impl_generateIntProperty(        ::rtl::OUStringBuffer& sXCD        ,
1407                                             const   ::rtl::OUString&       sName       ,
1408                                                     sal_Int32              nValue      )
1409 {
1410 	sXCD.appendAscii( "\t\t\t<default:value cfg:name=\""		   		);
1411 	sXCD.append		( sName										   		);
1412 	sXCD.appendAscii( "\" cfg:type=\"int\" cfg:writable=\""		   		);
1413     sXCD.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" );
1414 	sXCD.appendAscii( "\t\t\t\t<default:data>"							);
1415 	sXCD.append		( (sal_Int32)(nValue)								);
1416 	sXCD.appendAscii( "</default:data>\n\t\t\t</default:value>\n"		);
1417 }
1418 
1419 //*****************************************************************************************************************
impl_generateBoolProperty(::rtl::OUStringBuffer & sXCD,const::rtl::OUString & sName,sal_Bool bValue)1420 void XCDGenerator::impl_generateBoolProperty(           ::rtl::OUStringBuffer& sXCD        ,
1421                                                 const   ::rtl::OUString&       sName       ,
1422                                                         sal_Bool               bValue      )
1423 {
1424 	sXCD.appendAscii( "\t\t\t<default:value cfg:name=\""				);
1425 	sXCD.append		( sName												);
1426     sXCD.appendAscii( "\" cfg:type=\"boolean\" cfg:writable=\""         );
1427     sXCD.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" );
1428 	sXCD.appendAscii( "\t\t\t\t<default:data>"							);
1429 	sXCD.appendAscii( bValue==sal_True ? "true" : "false"				);
1430 	sXCD.appendAscii( "</default:data>\n\t\t\t</default:value>\n"		);
1431 }
1432 
1433 //*****************************************************************************************************************
impl_generateStringProperty(::rtl::OUStringBuffer & sXCD,const::rtl::OUString & sName,const::rtl::OUString & sValue)1434 void XCDGenerator::impl_generateStringProperty(         ::rtl::OUStringBuffer& sXCD        ,
1435                                                 const   ::rtl::OUString&       sName       ,
1436                                                 const   ::rtl::OUString&       sValue      )
1437 {
1438 	sXCD.appendAscii( "\t\t\t<default:value cfg:name=\""			);
1439 	sXCD.append		( sName											);
1440 	sXCD.appendAscii( "\" cfg:type=\"string\" cfg:writable=\""		);
1441     sXCD.appendAscii( m_aData.bWriteable==sal_True ? "true\"" : "false\""   );
1442 	if( sValue.getLength() > 0 )
1443 	{
1444         sXCD.appendAscii( ">\n\t\t\t\t<default:data>"                       );
1445         sXCD.append     ( XCDGenerator::impl_encodeSpecialSigns( sValue )   );
1446         sXCD.appendAscii( "</default:data>\n\t\t\t</default:value>\n"       );
1447 	}
1448 	else
1449 	{
1450 		sXCD.appendAscii( "/>\n" );
1451 	}
1452 }
1453 
1454 //*****************************************************************************************************************
impl_generateStringListProperty(::rtl::OUStringBuffer & sXCD,const::rtl::OUString & sName,const::framework::StringList & lValue)1455 void XCDGenerator::impl_generateStringListProperty(         ::rtl::OUStringBuffer&      sXCD        ,
1456                                                     const   ::rtl::OUString&            sName       ,
1457                                                     const   ::framework::StringList&    lValue      )
1458 {
1459     sXCD.appendAscii( "\t\t\t<default:value cfg:name=\""                );
1460     sXCD.append     ( sName                                             );
1461     sXCD.appendAscii( "\" cfg:type=\"string\" cfg:derivedBy=\"list\""   );
1462 
1463     sal_Unicode cSeperator = XCDGenerator::impl_defineSeperator( lValue );
1464     if( cSeperator != ' ' )
1465     {
1466         sXCD.appendAscii( " cfg:separator=\""  );
1467         sXCD.append     ( cSeperator           );
1468         sXCD.appendAscii( "\""                 );
1469     }
1470 
1471     sXCD.appendAscii( " cfg:writable=\""                                );
1472     sXCD.appendAscii( m_aData.bWriteable==sal_True ? "true\"" : "false\""       );
1473 
1474     sal_Int32 nCount    = (sal_Int32)(lValue.size());
1475     sal_Int32 nPosition = 1;
1476 
1477     if( nCount > 0 )
1478 	{
1479 		sXCD.appendAscii( ">\n\t\t\t\t<default:data>"	);
1480         for( ConstStringListIterator pEntry=lValue.begin(); pEntry!=lValue.end(); ++pEntry )
1481 		{
1482             sXCD.append( *pEntry );
1483             if( nPosition < nCount )
1484             {
1485                 // Seperator for lists allowed only between two values!
1486                 // Don't write leading or leaving seperators ...
1487                 sXCD.append( cSeperator );
1488             }
1489             ++nPosition;
1490 		}
1491 		sXCD.appendAscii( "</default:data>\n\t\t\t</default:value>\n" );
1492 	}
1493 	else
1494 	{
1495 		sXCD.appendAscii( "/>\n" );
1496 	}
1497 }
1498 
1499 //*****************************************************************************************************************
impl_generateUINamesProperty(::rtl::OUStringBuffer & sXCD,const::rtl::OUString & sName,const StringHash & lUINames)1500 void XCDGenerator::impl_generateUINamesProperty(        ::rtl::OUStringBuffer&      sXCD        ,
1501                                                 const   ::rtl::OUString&            sName       ,
1502                                                 const   StringHash&                 lUINames    )
1503 {
1504 	sXCD.appendAscii( "\t\t\t<default:value cfg:name=\""								);
1505 	sXCD.append		( sName																);
1506 	sXCD.appendAscii( "\" cfg:type=\"string\" cfg:localized=\"true\" cfg:writable=\""	);
1507     sXCD.appendAscii( m_aData.bWriteable==sal_True ? "true\"" : "false\""               );
1508 
1509 	if( lUINames.size() > 0 )
1510 	{
1511 		sXCD.appendAscii( ">\n" );
1512 
1513         // Search for localized values, which doesn't need full localized set ...
1514         // because all values for all locales are the same!
1515         sal_Bool                   bDifferent  = sal_False       ;
1516         ConstStringHashIterator    pUIName     = lUINames.begin();
1517         ::rtl::OUString            sUIName     = pUIName->second ;
1518         while( pUIName!=lUINames.end() )
1519 		{
1520             if( sUIName != pUIName->second )
1521             {
1522                 bDifferent = sal_True;
1523                 break;
1524             }
1525             ++pUIName;
1526         }
1527 
1528         // Generate full localized set, if some values are realy loclaized.
1529         if( bDifferent == sal_True )
1530         {
1531             for( ConstStringHashIterator pUIName=lUINames.begin(); pUIName!=lUINames.end(); ++pUIName )
1532             {
1533                 sXCD.appendAscii( "\t\t\t\t<default:data xml:lang=\""                       );
1534                 sXCD.append     ( pUIName->first                                            );
1535                 sXCD.appendAscii( "\">"                                                     );
1536                 sXCD.append     ( XCDGenerator::impl_encodeSpecialSigns( pUIName->second )  );
1537                 sXCD.appendAscii( "</default:data>\n"                                       );
1538             }
1539         }
1540         // Generate ONE entry as default for our configuration if all localized values are equal!
1541         else
1542         {
1543             sXCD.appendAscii( "\t\t\t\t<default:data xml:lang=\""                                                   );
1544             sXCD.appendAscii( "en-US"                                                                               );
1545             sXCD.appendAscii( "\">"                                                                                 );
1546             sXCD.append     ( XCDGenerator::impl_encodeSpecialSigns( lUINames.find(DECLARE_ASCII("en-US"))->second ));
1547             sXCD.appendAscii( "</default:data>\n"                                                                   );
1548         }
1549 		sXCD.appendAscii( "\t\t\t</default:value>\n" );
1550 	}
1551 	else
1552 	{
1553 		sXCD.appendAscii( "/>\n" );
1554 	}
1555 }
1556 
1557 //*****************************************************************************************************************
impl_encodeSpecialSigns(const::rtl::OUString & sValue)1558 ::rtl::OUString XCDGenerator::impl_encodeSpecialSigns( const ::rtl::OUString& sValue )
1559 {
1560     ::rtl::OUStringBuffer  sSource     ( sValue );
1561     ::rtl::OUStringBuffer  sDestination( 10000  );
1562 	sal_Int32		nCount		= sValue.getLength();
1563 	sal_Int32		i			= 0;
1564 
1565 	for( i=0; i<nCount; ++i )
1566 	{
1567         sal_Unicode cSign = sSource.charAt(i);
1568         switch( cSign )
1569 		{
1570             // code &, ", ', <, > ...
1571             case '&' :  sDestination.appendAscii( "&amp;"   );
1572 						break;
1573             case '<' :  sDestination.appendAscii( "&lt;"    );
1574 						break;
1575             case '>' :  sDestination.appendAscii( "&gt;"    );
1576 						break;
1577             case '\'':  sDestination.appendAscii( "&rsquo;" );
1578 						break;
1579             case '\"':  sDestination.appendAscii( "&quot;"  );
1580 						break;
1581 			// copy all other letters
1582             default :   sDestination.append( cSign );
1583 						break;
1584 		}
1585 	}
1586 
1587 	return sDestination.makeStringAndClear();
1588 }
1589 
1590 //*****************************************************************************************************************
1591 // Step over all elements of list to find one seperator, which isn't used for any value in list.
1592 // We return an empty string if list contains no elements - because we must disable writing of
1593 // "... cfg:seperator="<seperatorvalue> ..."
1594 // => Otherwise we get a Sequence< OUString > with one empty element from configuration!!!
impl_defineSeperator(const::framework::StringList & lList)1595 sal_Unicode XCDGenerator::impl_defineSeperator( const ::framework::StringList& lList )
1596 {
1597     static cSeperator1 = ' ';
1598     static cSeperator2 = ';';
1599     static cSeperator3 = '+';
1600     static cSeperator4 = '-';
1601     static cSeperator5 = '*';
1602 
1603     // Start with first seperator.
1604     // Step over all list items.
1605     // If one item contains this seperator - try next one!
1606     // If no new one avaliable (5 tests failed!) - show an error message for user.
1607     // => File will be wrong then!
1608     // If seperator was changed start search during list again ... because
1609     // new seperator could exist at already compared elements!
1610 
1611     sal_Unicode             cSeperator = cSeperator1  ;
1612     sal_Bool                bOK        = sal_False    ;
1613     ConstStringListIterator pItem      = lList.begin();
1614 
1615     while( bOK == sal_False )
1616     {
1617         if( pItem == lList.end() )
1618         {
1619             bOK = sal_True;
1620         }
1621         else
1622         {
1623             while( pItem!=lList.end() )
1624             {
1625                 if( pItem->indexOf( cSeperator, 0 ) != -1 )
1626                 {
1627                     if( cSeperator == cSeperator1 )
1628                     {
1629                         cSeperator = cSeperator2;
1630                         pItem      = lList.begin();
1631                         break;
1632                     }
1633                     else
1634                     if( cSeperator == cSeperator2 )
1635                     {
1636                         cSeperator = cSeperator3;
1637                         pItem      = lList.begin();
1638                         break;
1639                     }
1640                     else
1641                     if( cSeperator == cSeperator3 )
1642                     {
1643                         cSeperator = cSeperator4;
1644                         pItem      = lList.begin();
1645                         break;
1646                     }
1647                     else
1648                     if( cSeperator == cSeperator4 )
1649                     {
1650                         cSeperator = cSeperator5;
1651                         pItem      = lList.begin();
1652                         break;
1653                     }
1654                     else
1655                     if( cSeperator == cSeperator5 )
1656                     {
1657                         LOG_ERROR( "XCDGenerator::impl_defineSeperator()", "Can't find seperator for given list! Generated XCD file will be wrong!" )
1658                         exit(-1);
1659                     }
1660                 }
1661                 else
1662                 {
1663                     ++pItem;
1664                 }
1665             }
1666         }
1667     }
1668 
1669     return cSeperator;
1670 }
1671 
1672 //*****************************************************************************************************************
impl_initFilterHashNew2Old(StringHash & aHash)1673 void XCDGenerator::impl_initFilterHashNew2Old( StringHash& aHash )
1674 {
1675 	// key = new filter name, value = old name
1676     aHash[DECLARE_ASCII("writer_StarOffice_XML_Writer"                      )] =   DECLARE_ASCII("swriter: StarOffice XML (Writer)"                            );
1677     aHash[DECLARE_ASCII("writer_StarWriter_50"                              )] =   DECLARE_ASCII("swriter: StarWriter 5.0"                                     );
1678     aHash[DECLARE_ASCII("writer_StarWriter_50_VorlageTemplate"              )] =   DECLARE_ASCII("swriter: StarWriter 5.0 Vorlage/Template"                    );
1679     aHash[DECLARE_ASCII("writer_StarWriter_40"                              )] =   DECLARE_ASCII("swriter: StarWriter 4.0"                                     );
1680     aHash[DECLARE_ASCII("writer_StarWriter_40_VorlageTemplate"              )] =   DECLARE_ASCII("swriter: StarWriter 4.0 Vorlage/Template"                    );
1681     aHash[DECLARE_ASCII("writer_StarWriter_30"                              )] =   DECLARE_ASCII("swriter: StarWriter 3.0"                                     );
1682     aHash[DECLARE_ASCII("writer_StarWriter_30_VorlageTemplate"              )] =   DECLARE_ASCII("swriter: StarWriter 3.0 Vorlage/Template"                    );
1683     aHash[DECLARE_ASCII("writer_StarWriter_20"                              )] =   DECLARE_ASCII("swriter: StarWriter 2.0"                                     );
1684     aHash[DECLARE_ASCII("writer_StarWriter_10"                              )] =   DECLARE_ASCII("swriter: StarWriter 1.0"                                     );
1685     aHash[DECLARE_ASCII("writer_StarWriter_DOS"                             )] =   DECLARE_ASCII("swriter: StarWriter DOS"                                     );
1686     aHash[DECLARE_ASCII("writer_HTML_StarWriter"                            )] =   DECLARE_ASCII("swriter: HTML (StarWriter)"                                  );
1687     aHash[DECLARE_ASCII("writer_Text"                                       )] =   DECLARE_ASCII("swriter: Text"                                               );
1688     aHash[DECLARE_ASCII("writer_Text_Unix"                                  )] =   DECLARE_ASCII("swriter: Text Unix"                                          );
1689     aHash[DECLARE_ASCII("writer_Text_Mac"                                   )] =   DECLARE_ASCII("swriter: Text Mac"                                           );
1690     aHash[DECLARE_ASCII("writer_Text_DOS"                                   )] =   DECLARE_ASCII("swriter: Text DOS"                                           );
1691     aHash[DECLARE_ASCII("writer_Rich_Text_Format"                           )] =   DECLARE_ASCII("swriter: Rich Text Format"                                   );
1692     aHash[DECLARE_ASCII("writer_MS_Word_97"                                 )] =   DECLARE_ASCII("swriter: MS Word 97"                                         );
1693     aHash[DECLARE_ASCII("writer_MS_Word_95"                                 )] =   DECLARE_ASCII("swriter: MS Word 95"                                         );
1694     aHash[DECLARE_ASCII("writer_MS_Word_97_Vorlage"                         )] =   DECLARE_ASCII("swriter: MS Word 97 Vorlage"                                 );
1695     aHash[DECLARE_ASCII("writer_MS_Word_95_Vorlage"                         )] =   DECLARE_ASCII("swriter: MS Word 95 Vorlage"                                 );
1696     aHash[DECLARE_ASCII("writer_MS_WinWord_60"                              )] =   DECLARE_ASCII("swriter: MS WinWord 6.0"                                     );
1697     aHash[DECLARE_ASCII("writer_MS_Word_6x_W4W"                             )] =   DECLARE_ASCII("swriter: MS Word 6.x (W4W)"                                  );
1698     aHash[DECLARE_ASCII("writer_MS_WinWord_5"                               )] =   DECLARE_ASCII("swriter: MS WinWord 5"                                       );
1699     aHash[DECLARE_ASCII("writer_MS_WinWord_2x_W4W"                          )] =   DECLARE_ASCII("swriter: MS WinWord 2.x (W4W)"                               );
1700     aHash[DECLARE_ASCII("writer_MS_MacWord_5x_W4W"                          )] =   DECLARE_ASCII("swriter: MS MacWord 5.x (W4W)"                               );
1701     aHash[DECLARE_ASCII("writer_WordPerfect_Win_61_W4W"                     )] =   DECLARE_ASCII("swriter: WordPerfect (Win) 6.1 (W4W)"                        );
1702     aHash[DECLARE_ASCII("writer_WordPerfect_Win_70_W4W"                     )] =   DECLARE_ASCII("swriter: WordPerfect (Win) 7.0 (W4W)"                        );
1703     aHash[DECLARE_ASCII("writer_WordStar_Win_1x_20_W4W"                     )] =   DECLARE_ASCII("swriter: WordStar (Win) 1.x-2.0 (W4W)"                       );
1704     aHash[DECLARE_ASCII("writer_WordStar_70_W4W"                            )] =   DECLARE_ASCII("swriter: WordStar 7.0  (W4W)"                                );
1705     aHash[DECLARE_ASCII("writer_Ami_Pro_11_12_W4W"                          )] =   DECLARE_ASCII("swriter: Ami Pro 1.1-1.2 (W4W)"                              );
1706     aHash[DECLARE_ASCII("writer_Ami_Pro_20_31_W4W"                          )] =   DECLARE_ASCII("swriter: Ami Pro 2.0-3.1 (W4W)"                              );
1707     aHash[DECLARE_ASCII("writer_MS_Excel_40_StarWriter"                     )] =   DECLARE_ASCII("swriter: MS Excel 4.0 (StarWriter)"                          );
1708     aHash[DECLARE_ASCII("writer_MS_Excel_50_StarWriter"                     )] =   DECLARE_ASCII("swriter: MS Excel 5.0 (StarWriter)"                          );
1709     aHash[DECLARE_ASCII("writer_MS_Excel_95_StarWriter"                     )] =   DECLARE_ASCII("swriter: MS Excel 95 (StarWriter)"                           );
1710     aHash[DECLARE_ASCII("writer_MS_Works_20_DOS_W4W"                        )] =   DECLARE_ASCII("swriter: MS Works 2.0 DOS (W4W)"                             );
1711     aHash[DECLARE_ASCII("writer_MS_Works_30_Win_W4W"                        )] =   DECLARE_ASCII("swriter: MS Works 3.0 Win (W4W)"                             );
1712     aHash[DECLARE_ASCII("writer_Lotus_1_2_3_10_DOS_StarWriter"              )] =   DECLARE_ASCII("swriter: Lotus 1-2-3 1.0 (DOS) (StarWriter)"                 );
1713     aHash[DECLARE_ASCII("writer_Lotus_1_2_3_10_WIN_StarWriter"              )] =   DECLARE_ASCII("swriter: Lotus 1-2-3 1.0 (WIN) (StarWriter)"                 );
1714     aHash[DECLARE_ASCII("writer_Frame_Maker_MIF_50_W4W"                     )] =   DECLARE_ASCII("swriter: Frame Maker MIF 5.0 (W4W)"                          );
1715     aHash[DECLARE_ASCII("writer_Win_Write_3x_W4W"                           )] =   DECLARE_ASCII("swriter: Win Write 3.x (W4W)"                                );
1716     aHash[DECLARE_ASCII("writer_Text_encoded"                               )] =   DECLARE_ASCII("swriter: Text (encoded)"                                     );
1717     aHash[DECLARE_ASCII("writer_MS_WinWord_1x_W4W"                          )] =   DECLARE_ASCII("swriter: MS WinWord 1.x (W4W)"                               );
1718     aHash[DECLARE_ASCII("writer_MS_Word_5x_W4W"                             )] =   DECLARE_ASCII("swriter: MS Word 5.x (W4W)"                                  );
1719     aHash[DECLARE_ASCII("writer_MS_Word_4x_W4W"                             )] =   DECLARE_ASCII("swriter: MS Word 4.x (W4W)"                                  );
1720     aHash[DECLARE_ASCII("writer_MS_Word_3x_W4W"                             )] =   DECLARE_ASCII("swriter: MS Word 3.x (W4W)"                                  );
1721     aHash[DECLARE_ASCII("writer_MS_MacWord_40_W4W"                          )] =   DECLARE_ASCII("swriter: MS MacWord 4.0 (W4W)"                               );
1722     aHash[DECLARE_ASCII("writer_MS_MacWord_30_W4W"                          )] =   DECLARE_ASCII("swriter: MS MacWord 3.0 (W4W)"                               );
1723     aHash[DECLARE_ASCII("writer_WordPerfect_Mac_1_W4W"                      )] =   DECLARE_ASCII("swriter: WordPerfect Mac 1 (W4W)"                            );
1724     aHash[DECLARE_ASCII("writer_WordPerfect_Mac_2_W4W"                      )] =   DECLARE_ASCII("swriter: WordPerfect Mac 2 (W4W)"                            );
1725     aHash[DECLARE_ASCII("writer_WordPerfect_Mac_3_W4W"                      )] =   DECLARE_ASCII("swriter: WordPerfect Mac 3 (W4W)"                            );
1726     aHash[DECLARE_ASCII("writer_WordPerfect_Win_51_52_W4W"                  )] =   DECLARE_ASCII("swriter: WordPerfect (Win) 5.1-5.2 (W4W)"                    );
1727     aHash[DECLARE_ASCII("writer_WordPerfect_Win_60_W4W"                     )] =   DECLARE_ASCII("swriter: WordPerfect (Win) 6.0 (W4W)"                        );
1728     aHash[DECLARE_ASCII("writer_WordPerfect_41_W4W"                         )] =   DECLARE_ASCII("swriter: WordPerfect 4.1 (W4W)"                              );
1729     aHash[DECLARE_ASCII("writer_WordPerfect_42_W4W"                         )] =   DECLARE_ASCII("swriter: WordPerfect 4.2 (W4W)"                              );
1730     aHash[DECLARE_ASCII("writer_WordPerfect_50_W4W"                         )] =   DECLARE_ASCII("swriter: WordPerfect 5.0 (W4W)"                              );
1731     aHash[DECLARE_ASCII("writer_WordPerfect_51_W4W"                         )] =   DECLARE_ASCII("swriter: WordPerfect 5.1 (W4W)"                              );
1732     aHash[DECLARE_ASCII("writer_WordPerfect_60_W4W"                         )] =   DECLARE_ASCII("swriter: WordPerfect 6.0 (W4W)"                              );
1733     aHash[DECLARE_ASCII("writer_WordPerfect_61_W4W"                         )] =   DECLARE_ASCII("swriter: WordPerfect 6.1 (W4W)"                              );
1734     aHash[DECLARE_ASCII("writer_WordStar_2000_Rel_30_W4W"                   )] =   DECLARE_ASCII("swriter: WordStar 2000 Rel. 3.0 (W4W)"                       );
1735     aHash[DECLARE_ASCII("writer_WordStar_2000_Rel_35_W4W"                   )] =   DECLARE_ASCII("swriter: WordStar 2000 Rel. 3.5 (W4W)"                       );
1736     aHash[DECLARE_ASCII("writer_WordStar_33x_W4W"                           )] =   DECLARE_ASCII("swriter: WordStar 3.3x (W4W)"                                );
1737     aHash[DECLARE_ASCII("writer_WordStar_345_W4W"                           )] =   DECLARE_ASCII("swriter: WordStar 3.45 (W4W)"                                );
1738     aHash[DECLARE_ASCII("writer_WordStar_40_W4W"                            )] =   DECLARE_ASCII("swriter: WordStar 4.0  (W4W)"                                );
1739     aHash[DECLARE_ASCII("writer_WordStar_50_W4W"                            )] =   DECLARE_ASCII("swriter: WordStar 5.0  (W4W)"                                );
1740     aHash[DECLARE_ASCII("writer_WordStar_55_W4W"                            )] =   DECLARE_ASCII("swriter: WordStar 5.5  (W4W)"                                );
1741     aHash[DECLARE_ASCII("writer_WordStar_60_W4W"                            )] =   DECLARE_ASCII("swriter: WordStar 6.0  (W4W)"                                );
1742     aHash[DECLARE_ASCII("writer_MS_Works_40_Mac_W4W"                        )] =   DECLARE_ASCII("swriter: MS Works 4.0 Mac (W4W)"                             );
1743     aHash[DECLARE_ASCII("writer_Mac_Write_4x_50_W4W"                        )] =   DECLARE_ASCII("swriter: Mac Write 4.x 5.0 (W4W)"                            );
1744     aHash[DECLARE_ASCII("writer_Mac_Write_II_W4W"                           )] =   DECLARE_ASCII("swriter: Mac Write II (W4W)"                                 );
1745     aHash[DECLARE_ASCII("writer_Mac_Write_Pro_W4W"                          )] =   DECLARE_ASCII("swriter: Mac Write Pro (W4W)"                                );
1746     aHash[DECLARE_ASCII("writer_Lotus_Manuscript_W4W"                       )] =   DECLARE_ASCII("swriter: Lotus Manuscript (W4W)"                             );
1747     aHash[DECLARE_ASCII("writer_MASS_11_Rel_80_83_W4W"                      )] =   DECLARE_ASCII("swriter: MASS 11 Rel. 8.0-8.3 (W4W)"                         );
1748     aHash[DECLARE_ASCII("writer_MASS_11_Rel_85_90_W4W"                      )] =   DECLARE_ASCII("swriter: MASS 11 Rel. 8.5-9.0 (W4W)"                         );
1749     aHash[DECLARE_ASCII("writer_Claris_Works_W4W"                           )] =   DECLARE_ASCII("swriter: Claris Works (W4W)"                                 );
1750     aHash[DECLARE_ASCII("writer_CTOS_DEF_W4W"                               )] =   DECLARE_ASCII("swriter: CTOS DEF (W4W)"                                     );
1751     aHash[DECLARE_ASCII("writer_OfficeWriter_40_W4W"                        )] =   DECLARE_ASCII("swriter: OfficeWriter 4.0 (W4W)"                             );
1752     aHash[DECLARE_ASCII("writer_OfficeWriter_50_W4W"                        )] =   DECLARE_ASCII("swriter: OfficeWriter 5.0 (W4W)"                             );
1753     aHash[DECLARE_ASCII("writer_OfficeWriter_6x_W4W"                        )] =   DECLARE_ASCII("swriter: OfficeWriter 6.x (W4W)"                             );
1754     aHash[DECLARE_ASCII("writer_XyWrite_III_W4W"                            )] =   DECLARE_ASCII("swriter: XyWrite III ( W4W)"                                 );
1755     aHash[DECLARE_ASCII("writer_XyWrite_IIIP_W4W"                           )] =   DECLARE_ASCII("swriter: XyWrite III+ ( W4W)"                                );
1756     aHash[DECLARE_ASCII("writer_XyWrite_Signature_W4W"                      )] =   DECLARE_ASCII("swriter: XyWrite Signature (W4W)"                            );
1757     aHash[DECLARE_ASCII("writer_XyWrite_Sig_Win_W4W"                        )] =   DECLARE_ASCII("swriter: XyWrite Sig. (Win) (W4W)"                           );
1758     aHash[DECLARE_ASCII("writer_XyWrite_IV_W4W"                             )] =   DECLARE_ASCII("swriter: XyWrite IV (W4W)"                                   );
1759     aHash[DECLARE_ASCII("writer_XyWrite_Win_10_W4W"                         )] =   DECLARE_ASCII("swriter: XyWrite (Win) 1.0 (W4W)"                            );
1760     aHash[DECLARE_ASCII("writer_XEROX_XIF_50_W4W"                           )] =   DECLARE_ASCII("swriter: XEROX XIF 5.0 (W4W)"                                );
1761     aHash[DECLARE_ASCII("writer_XEROX_XIF_50_Illustrator_W4W"               )] =   DECLARE_ASCII("swriter: XEROX XIF 5.0 (Illustrator) (W4W)"                  );
1762     aHash[DECLARE_ASCII("writer_XEROX_XIF_60_Color_Bitmap_W4W"              )] =   DECLARE_ASCII("swriter: XEROX XIF 6.0 (Color Bitmap) (W4W)"                 );
1763     aHash[DECLARE_ASCII("writer_XEROX_XIF_60_Res_Graphic_W4W"               )] =   DECLARE_ASCII("swriter: XEROX XIF 6.0 (Res Graphic) (W4W)"                  );
1764     aHash[DECLARE_ASCII("writer_WriteNow_30_Macintosh_W4W"                  )] =   DECLARE_ASCII("swriter: WriteNow 3.0 (Macintosh) (W4W)"                     );
1765     aHash[DECLARE_ASCII("writer_Writing_Assistant_W4W"                      )] =   DECLARE_ASCII("swriter: Writing Assistant (W4W)"                            );
1766     aHash[DECLARE_ASCII("writer_VolksWriter_Deluxe_W4W"                     )] =   DECLARE_ASCII("swriter: VolksWriter Deluxe (W4W)"                           );
1767     aHash[DECLARE_ASCII("writer_VolksWriter_3_and_4_W4W"                    )] =   DECLARE_ASCII("swriter: VolksWriter 3 and 4 (W4W)"                          );
1768     aHash[DECLARE_ASCII("writer_MultiMate_33_W4W"                           )] =   DECLARE_ASCII("swriter: MultiMate 3.3 (W4W)"                                );
1769     aHash[DECLARE_ASCII("writer_MultiMate_Adv_36_W4W"                       )] =   DECLARE_ASCII("swriter: MultiMate Adv. 3.6 (W4W)"                           );
1770     aHash[DECLARE_ASCII("writer_MultiMate_Adv_II_37_W4W"                    )] =   DECLARE_ASCII("swriter: MultiMate Adv. II 3.7 (W4W)"                        );
1771     aHash[DECLARE_ASCII("writer_MultiMate_4_W4W"                            )] =   DECLARE_ASCII("swriter: MultiMate 4 (W4W)"                                  );
1772     aHash[DECLARE_ASCII("writer_NAVY_DIF_W4W"                               )] =   DECLARE_ASCII("swriter: NAVY DIF (W4W)"                                     );
1773     aHash[DECLARE_ASCII("writer_PFS_Write_W4W"                              )] =   DECLARE_ASCII("swriter: PFS Write (W4W)"                                    );
1774     aHash[DECLARE_ASCII("writer_PFS_First_Choice_10_W4W"                    )] =   DECLARE_ASCII("swriter: PFS First Choice 1.0 (W4W)"                         );
1775     aHash[DECLARE_ASCII("writer_PFS_First_Choice_20_W4W"                    )] =   DECLARE_ASCII("swriter: PFS First Choice 2.0 (W4W)"                         );
1776     aHash[DECLARE_ASCII("writer_PFS_First_Choice_30_W4W"                    )] =   DECLARE_ASCII("swriter: PFS First Choice 3.0 (W4W)"                         );
1777     aHash[DECLARE_ASCII("writer_Professional_Write_10_W4W"                  )] =   DECLARE_ASCII("swriter: Professional Write 1.0 (W4W)"                       );
1778     aHash[DECLARE_ASCII("writer_Professional_Write_2x_W4W"                  )] =   DECLARE_ASCII("swriter: Professional Write 2.x (W4W)"                       );
1779     aHash[DECLARE_ASCII("writer_Professional_Write_Plus_W4W"                )] =   DECLARE_ASCII("swriter: Professional Write Plus (W4W)"                      );
1780     aHash[DECLARE_ASCII("writer_Peach_Text_W4W"                             )] =   DECLARE_ASCII("swriter: Peach Text (W4W)"                                   );
1781     aHash[DECLARE_ASCII("writer_DCA_Revisable_Form_Text_W4W"                )] =   DECLARE_ASCII("swriter: DCA Revisable Form Text (W4W)"                      );
1782     aHash[DECLARE_ASCII("writer_DCA_with_Display_Write_5_W4W"               )] =   DECLARE_ASCII("swriter: DCA with Display Write 5 (W4W)"                     );
1783     aHash[DECLARE_ASCII("writer_DCAFFT_Final_Form_Text_W4W"                 )] =   DECLARE_ASCII("swriter: DCA/FFT-Final Form Text (W4W)"                      );
1784     aHash[DECLARE_ASCII("writer_DEC_DX_W4W"                                 )] =   DECLARE_ASCII("swriter: DEC DX (W4W)"                                       );
1785     aHash[DECLARE_ASCII("writer_DEC_WPS_PLUS_W4W"                           )] =   DECLARE_ASCII("swriter: DEC WPS-PLUS (W4W)"                                 );
1786     aHash[DECLARE_ASCII("writer_DisplayWrite_20_4x_W4W"                     )] =   DECLARE_ASCII("swriter: DisplayWrite 2.0-4.x (W4W)"                         );
1787     aHash[DECLARE_ASCII("writer_DisplayWrite_5x_W4W"                        )] =   DECLARE_ASCII("swriter: DisplayWrite 5.x (W4W)"                             );
1788     aHash[DECLARE_ASCII("writer_DataGeneral_CEO_Write_W4W"                  )] =   DECLARE_ASCII("swriter: DataGeneral CEO Write (W4W)"                        );
1789     aHash[DECLARE_ASCII("writer_EBCDIC_W4W"                                 )] =   DECLARE_ASCII("swriter: EBCDIC (W4W)"                                       );
1790     aHash[DECLARE_ASCII("writer_Enable_W4W"                                 )] =   DECLARE_ASCII("swriter: Enable (W4W)"                                       );
1791     aHash[DECLARE_ASCII("writer_Frame_Maker_MIF_30_W4W"                     )] =   DECLARE_ASCII("swriter: Frame Maker MIF 3.0 (W4W)"                          );
1792     aHash[DECLARE_ASCII("writer_Frame_Maker_MIF_40_W4W"                     )] =   DECLARE_ASCII("swriter: Frame Maker MIF 4.0 (W4W)"                          );
1793     aHash[DECLARE_ASCII("writer_Frame_Work_III_W4W"                         )] =   DECLARE_ASCII("swriter: Frame Work III (W4W)"                               );
1794     aHash[DECLARE_ASCII("writer_Frame_Work_IV_W4W"                          )] =   DECLARE_ASCII("swriter: Frame Work IV  (W4W)"                               );
1795     aHash[DECLARE_ASCII("writer_HP_AdvanceWrite_Plus_W4W"                   )] =   DECLARE_ASCII("swriter: HP AdvanceWrite Plus (W4W)"                         );
1796     aHash[DECLARE_ASCII("writer_ICL_Office_Power_6_W4W"                     )] =   DECLARE_ASCII("swriter: ICL Office Power 6 (W4W)"                           );
1797     aHash[DECLARE_ASCII("writer_ICL_Office_Power_7_W4W"                     )] =   DECLARE_ASCII("swriter: ICL Office Power 7 (W4W)"                           );
1798     aHash[DECLARE_ASCII("writer_Interleaf_W4W"                              )] =   DECLARE_ASCII("swriter: Interleaf (W4W)"                                    );
1799     aHash[DECLARE_ASCII("writer_Interleaf_5_6_W4W"                          )] =   DECLARE_ASCII("swriter: Interleaf 5 - 6 (W4W)"                              );
1800     aHash[DECLARE_ASCII("writer_Legacy_Winstar_onGO_W4W"                    )] =   DECLARE_ASCII("swriter: Legacy Winstar onGO (W4W)"                          );
1801     aHash[DECLARE_ASCII("writer_QA_Write_10_30_W4W"                         )] =   DECLARE_ASCII("swriter: Q&A Write 1.0-3.0 (W4W)"                            );
1802     aHash[DECLARE_ASCII("writer_QA_Write_40_W4W"                            )] =   DECLARE_ASCII("swriter: Q&A Write 4.0 (W4W)"                                );
1803     aHash[DECLARE_ASCII("writer_Rapid_File_10_W4W"                          )] =   DECLARE_ASCII("swriter: Rapid File 1.0 (W4W)"                               );
1804     aHash[DECLARE_ASCII("writer_Rapid_File_12_W4W"                          )] =   DECLARE_ASCII("swriter: Rapid File 1.2 (W4W)"                               );
1805     aHash[DECLARE_ASCII("writer_Samna_Word_IV_IV_Plus_W4W"                  )] =   DECLARE_ASCII("swriter: Samna Word IV-IV Plus (W4W)"                        );
1806     aHash[DECLARE_ASCII("writer_Total_Word_W4W"                             )] =   DECLARE_ASCII("swriter: Total Word (W4W)"                                   );
1807     aHash[DECLARE_ASCII("writer_Uniplex_onGO_W4W"                           )] =   DECLARE_ASCII("swriter: Uniplex onGO (W4W)"                                 );
1808     aHash[DECLARE_ASCII("writer_Uniplex_V7_V8_W4W"                          )] =   DECLARE_ASCII("swriter: Uniplex V7-V8 (W4W)"                                );
1809     aHash[DECLARE_ASCII("writer_Wang_PC_W4W"                                )] =   DECLARE_ASCII("swriter: Wang PC (W4W)"                                      );
1810     aHash[DECLARE_ASCII("writer_Wang_II_SWP_W4W"                            )] =   DECLARE_ASCII("swriter: Wang II SWP (W4W)"                                  );
1811     aHash[DECLARE_ASCII("writer_Wang_WP_Plus_W4W"                           )] =   DECLARE_ASCII("swriter: Wang WP Plus (W4W)"                                 );
1812     aHash[DECLARE_ASCII("writer_WITA_W4W"                                   )] =   DECLARE_ASCII("swriter: WITA (W4W)"                                         );
1813     aHash[DECLARE_ASCII("writer_WiziWord_30_W4W"                            )] =   DECLARE_ASCII("swriter: WiziWord 3.0 (W4W)"                                 );
1814     aHash[DECLARE_ASCII("writer_web_HTML"                                   )] =   DECLARE_ASCII("swriter/web: HTML"                                           );
1815     aHash[DECLARE_ASCII("writer_web_StarWriterWeb_50_VorlageTemplate"       )] =   DECLARE_ASCII("swriter/web: StarWriter/Web 5.0 Vorlage/Template"            );
1816     aHash[DECLARE_ASCII("writer_web_StarWriterWeb_40_VorlageTemplate"       )] =   DECLARE_ASCII("swriter/web: StarWriter/Web 4.0 Vorlage/Template"            );
1817     aHash[DECLARE_ASCII("writer_web_Text_StarWriterWeb"                     )] =   DECLARE_ASCII("swriter/web: Text (StarWriter/Web)"                          );
1818     aHash[DECLARE_ASCII("writer_web_Text_DOS_StarWriterWeb"                 )] =   DECLARE_ASCII("swriter/web: Text DOS (StarWriter/Web)"                      );
1819     aHash[DECLARE_ASCII("writer_web_Text_Mac_StarWriterWeb"                 )] =   DECLARE_ASCII("swriter/web: Text Mac (StarWriter/Web)"                      );
1820     aHash[DECLARE_ASCII("writer_web_Text_Unix_StarWriterWeb"                )] =   DECLARE_ASCII("swriter/web: Text Unix (StarWriter/Web)"                     );
1821     aHash[DECLARE_ASCII("writer_web_StarWriter_50"                          )] =   DECLARE_ASCII("swriter/web: StarWriter 5.0"                                 );
1822     aHash[DECLARE_ASCII("writer_web_StarWriter_40"                          )] =   DECLARE_ASCII("swriter/web: StarWriter 4.0"                                 );
1823     aHash[DECLARE_ASCII("writer_web_StarWriter_30"                          )] =   DECLARE_ASCII("swriter/web: StarWriter 3.0"                                 );
1824     aHash[DECLARE_ASCII("writer_web_Text_encoded"                           )] =   DECLARE_ASCII("swriter/web: Text (encoded)"                                 );
1825     aHash[DECLARE_ASCII("writer_globaldocument_StarWriter_60GlobalDocument" )] =   DECLARE_ASCII("swriter/GlobalDocument: StarOffice XML (GlobalDocument)"     );
1826     aHash[DECLARE_ASCII("writer_globaldocument_StarWriter_50GlobalDocument" )] =   DECLARE_ASCII("swriter/GlobalDocument: StarWriter 5.0/GlobalDocument"       );
1827     aHash[DECLARE_ASCII("writer_globaldocument_StarWriter_40GlobalDocument" )] =   DECLARE_ASCII("swriter/GlobalDocument: StarWriter 4.0/GlobalDocument"       );
1828     aHash[DECLARE_ASCII("writer_globaldocument_StarWriter_50"               )] =   DECLARE_ASCII("swriter/GlobalDocument: StarWriter 5.0"                      );
1829     aHash[DECLARE_ASCII("writer_globaldocument_StarWriter_40"               )] =   DECLARE_ASCII("swriter/GlobalDocument: StarWriter 4.0"                      );
1830     aHash[DECLARE_ASCII("writer_globaldocument_StarWriter_30"               )] =   DECLARE_ASCII("swriter/GlobalDocument: StarWriter 3.0"                      );
1831     aHash[DECLARE_ASCII("writer_globaldocument_Text_encoded"                )] =   DECLARE_ASCII("swriter/GlobalDocument: Text (encoded)"                      );
1832     aHash[DECLARE_ASCII("chart_StarOffice_XML_Chart"                        )] =   DECLARE_ASCII("schart: StarOffice XML (Chart)"                              );
1833     aHash[DECLARE_ASCII("chart_StarChart_50"                                )] =   DECLARE_ASCII("schart: StarChart 5.0"                                       );
1834     aHash[DECLARE_ASCII("chart_StarChart_40"                                )] =   DECLARE_ASCII("schart: StarChart 4.0"                                       );
1835     aHash[DECLARE_ASCII("chart_StarChart_30"                                )] =   DECLARE_ASCII("schart: StarChart 3.0"                                       );
1836     aHash[DECLARE_ASCII("calc_StarOffice_XML_Calc"                          )] =   DECLARE_ASCII("scalc: StarOffice XML (Calc)"                                );
1837     aHash[DECLARE_ASCII("calc_StarCalc_50"                                  )] =   DECLARE_ASCII("scalc: StarCalc 5.0"                                         );
1838     aHash[DECLARE_ASCII("calc_StarCalc_50_VorlageTemplate"                  )] =   DECLARE_ASCII("scalc: StarCalc 5.0 Vorlage/Template"                        );
1839     aHash[DECLARE_ASCII("calc_StarCalc_40"                                  )] =   DECLARE_ASCII("scalc: StarCalc 4.0"                                         );
1840     aHash[DECLARE_ASCII("calc_StarCalc_40_VorlageTemplate"                  )] =   DECLARE_ASCII("scalc: StarCalc 4.0 Vorlage/Template"                        );
1841     aHash[DECLARE_ASCII("calc_StarCalc_30"                                  )] =   DECLARE_ASCII("scalc: StarCalc 3.0"                                         );
1842     aHash[DECLARE_ASCII("calc_StarCalc_30_VorlageTemplate"                  )] =   DECLARE_ASCII("scalc: StarCalc 3.0 Vorlage/Template"                        );
1843     aHash[DECLARE_ASCII("calc_MS_Excel_97"                                  )] =   DECLARE_ASCII("scalc: MS Excel 97"                                          );
1844     aHash[DECLARE_ASCII("calc_MS_Excel_97_VorlageTemplate"                  )] =   DECLARE_ASCII("scalc: MS Excel 97 Vorlage/Template"                         );
1845     aHash[DECLARE_ASCII("calc_MS_Excel_95"                                  )] =   DECLARE_ASCII("scalc: MS Excel 95"                                          );
1846     aHash[DECLARE_ASCII("calc_MS_Excel_95_VorlageTemplate"                  )] =   DECLARE_ASCII("scalc: MS Excel 95 Vorlage/Template"                         );
1847     aHash[DECLARE_ASCII("calc_MS_Excel_5095"                                )] =   DECLARE_ASCII("scalc: MS Excel 5.0/95"                                      );
1848     aHash[DECLARE_ASCII("calc_MS_Excel_5095_VorlageTemplate"                )] =   DECLARE_ASCII("scalc: MS Excel 5.0/95 Vorlage/Template"                     );
1849     aHash[DECLARE_ASCII("calc_MS_Excel_40"                                  )] =   DECLARE_ASCII("scalc: MS Excel 4.0"                                         );
1850     aHash[DECLARE_ASCII("calc_MS_Excel_40_VorlageTemplate"                  )] =   DECLARE_ASCII("scalc: MS Excel 4.0 Vorlage/Template"                        );
1851     aHash[DECLARE_ASCII("calc_Rich_Text_Format_StarCalc"                    )] =   DECLARE_ASCII("scalc: Rich Text Format (StarCalc)"                          );
1852     aHash[DECLARE_ASCII("calc_SYLK"                                         )] =   DECLARE_ASCII("scalc: SYLK"                                                 );
1853     aHash[DECLARE_ASCII("calc_DIF"                                          )] =   DECLARE_ASCII("scalc: DIF"                                                  );
1854     aHash[DECLARE_ASCII("calc_HTML_StarCalc"                                )] =   DECLARE_ASCII("scalc: HTML (StarCalc)"                                      );
1855     aHash[DECLARE_ASCII("calc_dBase"                                        )] =   DECLARE_ASCII("scalc: dBase"                                                );
1856     aHash[DECLARE_ASCII("calc_Lotus"                                        )] =   DECLARE_ASCII("scalc: Lotus"                                                );
1857     aHash[DECLARE_ASCII("calc_StarCalc_10"                                  )] =   DECLARE_ASCII("scalc: StarCalc 1.0"                                         );
1858     aHash[DECLARE_ASCII("calc_Text_txt_csv_StarCalc"                        )] =   DECLARE_ASCII("scalc: Text - txt - csv (StarCalc)"                          );
1859     aHash[DECLARE_ASCII("impress_StarOffice_XML_Impress"                    )] =   DECLARE_ASCII("simpress: StarOffice XML (Impress)"                          );
1860     aHash[DECLARE_ASCII("impress_StarImpress_50"                            )] =   DECLARE_ASCII("simpress: StarImpress 5.0"                                   );
1861     aHash[DECLARE_ASCII("impress_StarImpress_50_Vorlage"                    )] =   DECLARE_ASCII("simpress: StarImpress 5.0 Vorlage"                           );
1862     aHash[DECLARE_ASCII("impress_StarImpress_40"                            )] =   DECLARE_ASCII("simpress: StarImpress 4.0"                                   );
1863     aHash[DECLARE_ASCII("impress_StarImpress_40_Vorlage"                    )] =   DECLARE_ASCII("simpress: StarImpress 4.0 Vorlage"                           );
1864     aHash[DECLARE_ASCII("impress_StarDraw_50_StarImpress"                   )] =   DECLARE_ASCII("simpress: StarDraw 5.0 (StarImpress)"                        );
1865     aHash[DECLARE_ASCII("impress_StarDraw_50_Vorlage_StarImpress"           )] =   DECLARE_ASCII("simpress: StarDraw 5.0 Vorlage (StarImpress)"                );
1866     aHash[DECLARE_ASCII("impress_StarDraw_30_StarImpress"                   )] =   DECLARE_ASCII("simpress: StarDraw 3.0 (StarImpress)"                        );
1867     aHash[DECLARE_ASCII("impress_StarDraw_30_Vorlage_StarImpress"           )] =   DECLARE_ASCII("simpress: StarDraw 3.0 Vorlage (StarImpress)"                );
1868     aHash[DECLARE_ASCII("impress_MS_PowerPoint_97"                          )] =   DECLARE_ASCII("simpress: MS PowerPoint 97"                                  );
1869     aHash[DECLARE_ASCII("impress_MS_PowerPoint_97_Vorlage"                  )] =   DECLARE_ASCII("simpress: MS PowerPoint 97 Vorlage"                          );
1870     aHash[DECLARE_ASCII("impress_CGM_Computer_Graphics_Metafile"            )] =   DECLARE_ASCII("simpress: CGM - Computer Graphics Metafile"                  );
1871     aHash[DECLARE_ASCII("impress_StarImpress_50_packed"                     )] =   DECLARE_ASCII("simpress: StarImpress 5.0 (packed)"                          );
1872     aHash[DECLARE_ASCII("draw_StarOffice_XML_Draw"                          )] =   DECLARE_ASCII("sdraw: StarOffice XML (Draw)"                                );
1873     aHash[DECLARE_ASCII("draw_GIF_Graphics_Interchange"                     )] =   DECLARE_ASCII("sdraw: GIF - Graphics Interchange"                           );
1874     aHash[DECLARE_ASCII("draw_PCD_Photo_CD"                                 )] =   DECLARE_ASCII("sdraw: PCD - Photo CD"                                       );
1875     aHash[DECLARE_ASCII("draw_PCX_Zsoft_Paintbrush"                         )] =   DECLARE_ASCII("sdraw: PCX - Zsoft Paintbrush"                               );
1876     aHash[DECLARE_ASCII("draw_PSD_Adobe_Photoshop"                          )] =   DECLARE_ASCII("sdraw: PSD - Adobe Photoshop"                                );
1877     aHash[DECLARE_ASCII("draw_PNG_Portable_Network_Graphic"                 )] =   DECLARE_ASCII("sdraw: PNG - Portable Network Graphic"                       );
1878     aHash[DECLARE_ASCII("draw_StarDraw_50"                                  )] =   DECLARE_ASCII("sdraw: StarDraw 5.0"                                         );
1879     aHash[DECLARE_ASCII("draw_PBM_Portable_Bitmap"                          )] =   DECLARE_ASCII("sdraw: PBM - Portable Bitmap"                                );
1880     aHash[DECLARE_ASCII("draw_PGM_Portable_Graymap"                         )] =   DECLARE_ASCII("sdraw: PGM - Portable Graymap"                               );
1881     aHash[DECLARE_ASCII("draw_PPM_Portable_Pixelmap"                        )] =   DECLARE_ASCII("sdraw: PPM - Portable Pixelmap"                              );
1882     aHash[DECLARE_ASCII("draw_RAS_Sun_Rasterfile"                           )] =   DECLARE_ASCII("sdraw: RAS - Sun Rasterfile"                                 );
1883     aHash[DECLARE_ASCII("draw_TGA_Truevision_TARGA"                         )] =   DECLARE_ASCII("sdraw: TGA - Truevision TARGA"                               );
1884     aHash[DECLARE_ASCII("draw_SGV_StarDraw_20"                              )] =   DECLARE_ASCII("sdraw: SGV - StarDraw 2.0"                                   );
1885     aHash[DECLARE_ASCII("draw_TIF_Tag_Image_File"                           )] =   DECLARE_ASCII("sdraw: TIF - Tag Image File"                                 );
1886     aHash[DECLARE_ASCII("draw_SGF_StarOffice_Writer_SGF"                    )] =   DECLARE_ASCII("sdraw: SGF - StarOffice Writer SGF"                          );
1887     aHash[DECLARE_ASCII("draw_XPM"                                          )] =   DECLARE_ASCII("sdraw: XPM"                                                  );
1888     aHash[DECLARE_ASCII("gif_Graphics_Interchange"                          )] =   DECLARE_ASCII("sdraw: GIF - Graphics Interchange"                           );
1889     aHash[DECLARE_ASCII("pcd_Photo_CD"                                      )] =   DECLARE_ASCII("sdraw: PCD - Photo CD"                                       );
1890     aHash[DECLARE_ASCII("pcx_Zsoft_Paintbrush"                              )] =   DECLARE_ASCII("sdraw: PCX - Zsoft Paintbrush"                               );
1891     aHash[DECLARE_ASCII("psd_Adobe_Photoshop"                               )] =   DECLARE_ASCII("sdraw: PSD - Adobe Photoshop"                                );
1892     aHash[DECLARE_ASCII("png_Portable_Network_Graphic"                      )] =   DECLARE_ASCII("sdraw: PNG - Portable Network Graphic"                       );
1893     aHash[DECLARE_ASCII("pbm_Portable_Bitmap"                               )] =   DECLARE_ASCII("sdraw: PBM - Portable Bitmap"                                );
1894     aHash[DECLARE_ASCII("pgm_Portable_Graymap"                              )] =   DECLARE_ASCII("sdraw: PGM - Portable Graymap"                               );
1895     aHash[DECLARE_ASCII("ppm_Portable_Pixelmap"                             )] =   DECLARE_ASCII("sdraw: PPM - Portable Pixelmap"                              );
1896     aHash[DECLARE_ASCII("ras_Sun_Rasterfile"                                )] =   DECLARE_ASCII("sdraw: RAS - Sun Rasterfile"                                 );
1897     aHash[DECLARE_ASCII("tga_Truevision_TARGA"                              )] =   DECLARE_ASCII("sdraw: TGA - Truevision TARGA"                               );
1898     aHash[DECLARE_ASCII("sgv_StarDraw_20"                                   )] =   DECLARE_ASCII("sdraw: SGV - StarDraw 2.0"                                   );
1899     aHash[DECLARE_ASCII("tif_Tag_Image_File"                                )] =   DECLARE_ASCII("sdraw: TIF - Tag Image File"                                 );
1900     aHash[DECLARE_ASCII("sgf_StarOffice_Writer_SGF"                         )] =   DECLARE_ASCII("sdraw: SGF - StarOffice Writer SGF"                          );
1901     aHash[DECLARE_ASCII("xpm_XPM"                                           )] =   DECLARE_ASCII("sdraw: XPM"                                                  );
1902     aHash[DECLARE_ASCII("draw_StarDraw_50_Vorlage"                          )] =   DECLARE_ASCII("sdraw: StarDraw 5.0 Vorlage"                                 );
1903     aHash[DECLARE_ASCII("draw_StarImpress_50_StarDraw"                      )] =   DECLARE_ASCII("sdraw: StarImpress 5.0 (StarDraw)"                           );
1904     aHash[DECLARE_ASCII("draw_StarImpress_50_Vorlage_StarDraw"              )] =   DECLARE_ASCII("sdraw: StarImpress 5.0 Vorlage (StarDraw)"                   );
1905     aHash[DECLARE_ASCII("draw_StarImpress_40_StarDraw"                      )] =   DECLARE_ASCII("sdraw: StarImpress 4.0 (StarDraw)"                           );
1906     aHash[DECLARE_ASCII("draw_StarImpress_40_Vorlage_StarDraw"              )] =   DECLARE_ASCII("sdraw: StarImpress 4.0 Vorlage (StarDraw)"                   );
1907     aHash[DECLARE_ASCII("draw_StarDraw_30"                                  )] =   DECLARE_ASCII("sdraw: StarDraw 3.0"                                         );
1908     aHash[DECLARE_ASCII("draw_StarDraw_30_Vorlage"                          )] =   DECLARE_ASCII("sdraw: StarDraw 3.0 Vorlage"                                 );
1909     aHash[DECLARE_ASCII("draw_EMF_MS_Windows_Metafile"                      )] =   DECLARE_ASCII("sdraw: EMF - MS Windows Metafile"                            );
1910     aHash[DECLARE_ASCII("draw_MET_OS2_Metafile"                             )] =   DECLARE_ASCII("sdraw: MET - OS/2 Metafile"                                  );
1911     aHash[DECLARE_ASCII("draw_DXF_AutoCAD_Interchange"                      )] =   DECLARE_ASCII("sdraw: DXF - AutoCAD Interchange"                            );
1912     aHash[DECLARE_ASCII("draw_EPS_Encapsulated_PostScript"                  )] =   DECLARE_ASCII("sdraw: EPS - Encapsulated PostScript"                        );
1913     aHash[DECLARE_ASCII("draw_WMF_MS_Windows_Metafile"                      )] =   DECLARE_ASCII("sdraw: WMF - MS Windows Metafile"                            );
1914     aHash[DECLARE_ASCII("draw_PCT_Mac_Pict"                                 )] =   DECLARE_ASCII("sdraw: PCT - Mac Pict"                                       );
1915     aHash[DECLARE_ASCII("draw_SVM_StarView_Metafile"                        )] =   DECLARE_ASCII("sdraw: SVM - StarView Metafile"                              );
1916     aHash[DECLARE_ASCII("draw_BMP_MS_Windows"                               )] =   DECLARE_ASCII("sdraw: BMP - MS Windows"                                     );
1917     aHash[DECLARE_ASCII("draw_JPG_JPEG"                                     )] =   DECLARE_ASCII("sdraw: JPG - JPEG"                                           );
1918     aHash[DECLARE_ASCII("draw_XBM_X_Consortium"                             )] =   DECLARE_ASCII("sdraw: XBM - X-Consortium"                                   );
1919     aHash[DECLARE_ASCII("emf_MS_Windows_Metafile"                           )] =   DECLARE_ASCII("sdraw: EMF - MS Windows Metafile"                            );
1920     aHash[DECLARE_ASCII("met_OS2_Metafile"                                  )] =   DECLARE_ASCII("sdraw: MET - OS/2 Metafile"                                  );
1921     aHash[DECLARE_ASCII("dxf_AutoCAD_Interchange"                           )] =   DECLARE_ASCII("sdraw: DXF - AutoCAD Interchange"                            );
1922     aHash[DECLARE_ASCII("eps_Encapsulated_PostScript"                       )] =   DECLARE_ASCII("sdraw: EPS - Encapsulated PostScript"                        );
1923     aHash[DECLARE_ASCII("wmf_MS_Windows_Metafile"                           )] =   DECLARE_ASCII("sdraw: WMF - MS Windows Metafile"                            );
1924     aHash[DECLARE_ASCII("pct_Mac_Pict"                                      )] =   DECLARE_ASCII("sdraw: PCT - Mac Pict"                                       );
1925     aHash[DECLARE_ASCII("svm_StarView_Metafile"                             )] =   DECLARE_ASCII("sdraw: SVM - StarView Metafile"                              );
1926     aHash[DECLARE_ASCII("bmp_MS_Windows"                                    )] =   DECLARE_ASCII("sdraw: BMP - MS Windows"                                     );
1927     aHash[DECLARE_ASCII("jpg_JPEG"                                          )] =   DECLARE_ASCII("sdraw: JPG - JPEG"                                           );
1928     aHash[DECLARE_ASCII("xbm_X_Consortium"                                  )] =   DECLARE_ASCII("sdraw: XBM - X-Consortium"                                   );
1929     aHash[DECLARE_ASCII("math_StarOffice_XML_Math"                          )] =   DECLARE_ASCII("smath: StarOffice XML (Math)"                                );
1930     aHash[DECLARE_ASCII("math_MathML_XML_Math"                              )] =   DECLARE_ASCII("smath: MathML XML (Math)"                                    );
1931     aHash[DECLARE_ASCII("math_StarMath_50"                                  )] =   DECLARE_ASCII("smath: StarMath 5.0"                                         );
1932     aHash[DECLARE_ASCII("math_StarMath_40"                                  )] =   DECLARE_ASCII("smath: StarMath 4.0"                                         );
1933     aHash[DECLARE_ASCII("math_StarMath_30"                                  )] =   DECLARE_ASCII("smath: StarMath 3.0"                                         );
1934     aHash[DECLARE_ASCII("math_StarMath_20"                                  )] =   DECLARE_ASCII("smath: StarMath 2.0"                                         );
1935     aHash[DECLARE_ASCII("math_MathType_3x"                                  )] =   DECLARE_ASCII("smath: MathType 3.x"                                         );
1936 }
1937 
1938 //*****************************************************************************************************************
impl_getOldFilterName(const::rtl::OUString & sNewName)1939 ::rtl::OUString XCDGenerator::impl_getOldFilterName( const ::rtl::OUString& sNewName )
1940 {
1941     ::rtl::OUString sOldName;
1942     ConstStringHashIterator pEntry = m_aData.aOldFilterNamesHash.find(sNewName);
1943     if( pEntry==m_aData.aOldFilterNamesHash.end() )
1944     {
1945         sOldName = sNewName;
1946     }
1947     else
1948     {
1949         sOldName = m_aData.aOldFilterNamesHash[sNewName];
1950     }
1951     return sOldName;
1952 }
1953 
1954 //*****************************************************************************************************************
impl_classifyType(const AppMember & rData,const::rtl::OUString & sTypeName,EFilterPackage & ePackage)1955 void XCDGenerator::impl_classifyType( const AppMember& rData, const ::rtl::OUString& sTypeName, EFilterPackage& ePackage )
1956 {
1957     ePackage = E_STANDARD;
1958 
1959     // Step over all registered filters for this type ...
1960     // Classify all of these filters. If one of them a standard filter ...
1961     // type must be a standard type too - otherwise not!
1962 
1963     CheckedStringListIterator   pIterator   ;
1964     ::rtl::OUString             sFilterName ;
1965     sal_Int32                   nOrder      ;
1966     while( rData.pFilterCache->searchFilterForType( sTypeName, pIterator, sFilterName ) == sal_True )
1967     {
1968         EFilterPackage eFilterPackage;
1969         XCDGenerator::impl_classifyFilter( rData, sFilterName, eFilterPackage, nOrder );
1970         if( eFilterPackage == E_STANDARD )
1971         {
1972             ePackage = E_STANDARD;
1973             break;
1974         }
1975     }
1976 }
1977 
1978 //*****************************************************************************************************************
impl_classifyFilter(const AppMember & rData,const::rtl::OUString & sFilterName,EFilterPackage & ePackage,sal_Int32 & nOrder)1979 void XCDGenerator::impl_classifyFilter( const AppMember& rData, const ::rtl::OUString& sFilterName, EFilterPackage& ePackage, sal_Int32& nOrder )
1980 {
1981     // a) For versions less then 4 => use hard coded list of filter names to differ between standard or additional filters.
1982     //    Why? This version don't support the order flag or hasn't set it right!
1983     // b) For version greater then 3 => use order of currently cached types in FilterCache!
1984 
1985     ePackage = E_STANDARD;
1986     nOrder   = 0;
1987 
1988     // writer
1989     if( sFilterName == DECLARE_ASCII("writer_StarOffice_XML_Writer"                               ) ) { ePackage = E_STANDARD; nOrder =  1; } else
1990     if( sFilterName == DECLARE_ASCII("writer_StarOffice_XML_Writer_Template"                      ) ) { ePackage = E_STANDARD; nOrder =  2; } else
1991     if( sFilterName == DECLARE_ASCII("writer_StarWriter_50"                                       ) ) { ePackage = E_STANDARD; nOrder =  3; } else
1992     if( sFilterName == DECLARE_ASCII("writer_StarWriter_50_VorlageTemplate"                       ) ) { ePackage = E_STANDARD; nOrder =  4; } else
1993     if( sFilterName == DECLARE_ASCII("writer_StarWriter_40"                                       ) ) { ePackage = E_STANDARD; nOrder =  5; } else
1994     if( sFilterName == DECLARE_ASCII("writer_StarWriter_40_VorlageTemplate"                       ) ) { ePackage = E_STANDARD; nOrder =  6; } else
1995     if( sFilterName == DECLARE_ASCII("writer_StarWriter_30"                                       ) ) { ePackage = E_STANDARD; nOrder =  7; } else
1996     if( sFilterName == DECLARE_ASCII("writer_StarWriter_30_VorlageTemplate"                       ) ) { ePackage = E_STANDARD; nOrder =  8; } else
1997     if( sFilterName == DECLARE_ASCII("writer_StarWriter_20"                                       ) ) { ePackage = E_STANDARD; nOrder =  9; } else
1998     if( sFilterName == DECLARE_ASCII("writer_MS_Word_97"                                          ) ) { ePackage = E_STANDARD; nOrder = 10; } else
1999     if( sFilterName == DECLARE_ASCII("writer_MS_Word_97_Vorlage"                                  ) ) { ePackage = E_STANDARD; nOrder = 11; } else
2000     if( sFilterName == DECLARE_ASCII("writer_MS_Word_95"                                          ) ) { ePackage = E_STANDARD; nOrder = 12; } else
2001     if( sFilterName == DECLARE_ASCII("writer_MS_Word_95_Vorlage"                                  ) ) { ePackage = E_STANDARD; nOrder = 13; } else
2002     if( sFilterName == DECLARE_ASCII("writer_MS_WinWord_2x_W4W"                                   ) ) { ePackage = E_STANDARD; nOrder = 14; } else
2003     if( sFilterName == DECLARE_ASCII("writer_MS_WinWord_1x_W4W"                                   ) ) { ePackage = E_STANDARD; nOrder = 15; } else
2004     if( sFilterName == DECLARE_ASCII("writer_MS_Word_6x_W4W"                                      ) ) { ePackage = E_STANDARD; nOrder = 16; } else
2005     if( sFilterName == DECLARE_ASCII("writer_MS_Word_5x_W4W"                                      ) ) { ePackage = E_STANDARD; nOrder = 17; } else
2006     if( sFilterName == DECLARE_ASCII("writer_MS_Word_4x_W4W"                                      ) ) { ePackage = E_STANDARD; nOrder = 18; } else
2007     if( sFilterName == DECLARE_ASCII("writer_MS_Word_3x_W4W"                                      ) ) { ePackage = E_STANDARD; nOrder = 19; } else
2008     if( sFilterName == DECLARE_ASCII("writer_WordPerfect_Win_70_W4W"                              ) ) { ePackage = E_STANDARD; nOrder = 20; } else
2009     if( sFilterName == DECLARE_ASCII("writer_WordPerfect_Win_61_W4W"                              ) ) { ePackage = E_STANDARD; nOrder = 21; } else
2010     if( sFilterName == DECLARE_ASCII("writer_WordPerfect_Win_60_W4W"                              ) ) { ePackage = E_STANDARD; nOrder = 22; } else
2011     if( sFilterName == DECLARE_ASCII("writer_WordPerfect_Win_51_52_W4W"                           ) ) { ePackage = E_STANDARD; nOrder = 23; } else
2012     if( sFilterName == DECLARE_ASCII("writer_HTML_StarWriter"                                     ) ) { ePackage = E_STANDARD; nOrder = 24; } else
2013     if( sFilterName == DECLARE_ASCII("writer_Text"                                                ) ) { ePackage = E_STANDARD; nOrder = 25; } else
2014     if( sFilterName == DECLARE_ASCII("writer_Text_encoded"                                        ) ) { ePackage = E_STANDARD; nOrder = 26; } else
2015     if( sFilterName == DECLARE_ASCII("writer_Text_DOS"                                            ) ) { ePackage = E_STANDARD; nOrder = 27; } else
2016     if( sFilterName == DECLARE_ASCII("writer_Text_Unix"                                           ) ) { ePackage = E_STANDARD; nOrder = 28; } else
2017     if( sFilterName == DECLARE_ASCII("writer_Text_Mac"                                            ) ) { ePackage = E_STANDARD; nOrder = 29; } else
2018     if( sFilterName == DECLARE_ASCII("writer_Rich_Text_Format"                                    ) ) { ePackage = E_STANDARD; nOrder = 30; }
2019 
2020     // writer web
2021     if( sFilterName == DECLARE_ASCII("writer_web_HTML"                                            ) ) { ePackage = E_STANDARD; nOrder =  1; } else
2022     if( sFilterName == DECLARE_ASCII("writer_web_StarOffice_XML_Writer"                           ) ) { ePackage = E_STANDARD; nOrder =  2; } else
2023     if( sFilterName == DECLARE_ASCII("writer_web_StarOffice_XML_Writer_Web_Template"              ) ) { ePackage = E_STANDARD; nOrder =  3; } else
2024     if( sFilterName == DECLARE_ASCII("writer_web_StarWriter_50"                                   ) ) { ePackage = E_STANDARD; nOrder =  4; } else
2025     if( sFilterName == DECLARE_ASCII("writer_web_StarWriterWeb_50_VorlageTemplate"                ) ) { ePackage = E_STANDARD; nOrder =  5; } else
2026     if( sFilterName == DECLARE_ASCII("writer_web_StarWriter_40"                                   ) ) { ePackage = E_STANDARD; nOrder =  6; } else
2027     if( sFilterName == DECLARE_ASCII("writer_web_StarWriterWeb_40_VorlageTemplate"                ) ) { ePackage = E_STANDARD; nOrder =  7; } else
2028     if( sFilterName == DECLARE_ASCII("writer_web_StarWriter_30"                                   ) ) { ePackage = E_STANDARD; nOrder =  8; } else
2029     if( sFilterName == DECLARE_ASCII("writer_web_Text_StarWriterWeb"                              ) ) { ePackage = E_STANDARD; nOrder =  9; } else
2030     if( sFilterName == DECLARE_ASCII("writer_web_Text_encoded"                                    ) ) { ePackage = E_STANDARD; nOrder = 10; } else
2031     if( sFilterName == DECLARE_ASCII("writer_web_Text_DOS_StarWriterWeb"                          ) ) { ePackage = E_STANDARD; nOrder = 11; } else
2032     if( sFilterName == DECLARE_ASCII("writer_web_Text_Unix_StarWriterWeb"                         ) ) { ePackage = E_STANDARD; nOrder = 12; } else
2033     if( sFilterName == DECLARE_ASCII("writer_web_Text_Mac_StarWriterWeb"                          ) ) { ePackage = E_STANDARD; nOrder = 13; }
2034 
2035     // global document
2036     if( sFilterName == DECLARE_ASCII("writer_globaldocument_StarOffice_XML_Writer_GlobalDocument" ) ) { ePackage = E_STANDARD; nOrder =  1; } else
2037     if( sFilterName == DECLARE_ASCII("writer_globaldocument_StarOffice_XML_Writer"                ) ) { ePackage = E_STANDARD; nOrder =  2; } else
2038     if( sFilterName == DECLARE_ASCII("writer_globaldocument_StarWriter_50"                        ) ) { ePackage = E_STANDARD; nOrder =  3; } else
2039     if( sFilterName == DECLARE_ASCII("writer_globaldocument_StarWriter_50GlobalDocument"          ) ) { ePackage = E_STANDARD; nOrder =  4; } else
2040     if( sFilterName == DECLARE_ASCII("writer_globaldocument_StarWriter_40"                        ) ) { ePackage = E_STANDARD; nOrder =  5; } else
2041     if( sFilterName == DECLARE_ASCII("writer_globaldocument_StarWriter_40GlobalDocument"          ) ) { ePackage = E_STANDARD; nOrder =  6; } else
2042     if( sFilterName == DECLARE_ASCII("writer_globaldocument_StarWriter_30"                        ) ) { ePackage = E_STANDARD; nOrder =  7; } else
2043     if( sFilterName == DECLARE_ASCII("writer_globaldocument_Text_encoded"                         ) ) { ePackage = E_STANDARD; nOrder =  8; }
2044 
2045     // calc
2046     if( sFilterName == DECLARE_ASCII("calc_StarOffice_XML_Calc"                                   ) ) { ePackage = E_STANDARD; nOrder =  1; } else
2047     if( sFilterName == DECLARE_ASCII("calc_StarOffice_XML_Calc_Template"                          ) ) { ePackage = E_STANDARD; nOrder =  2; } else
2048     if( sFilterName == DECLARE_ASCII("calc_StarCalc_50"                                           ) ) { ePackage = E_STANDARD; nOrder =  3; } else
2049     if( sFilterName == DECLARE_ASCII("calc_StarCalc_50_VorlageTemplate"                           ) ) { ePackage = E_STANDARD; nOrder =  4; } else
2050     if( sFilterName == DECLARE_ASCII("calc_StarCalc_40"                                           ) ) { ePackage = E_STANDARD; nOrder =  5; } else
2051     if( sFilterName == DECLARE_ASCII("calc_StarCalc_40_VorlageTemplate"                           ) ) { ePackage = E_STANDARD; nOrder =  6; } else
2052     if( sFilterName == DECLARE_ASCII("calc_StarCalc_30"                                           ) ) { ePackage = E_STANDARD; nOrder =  7; } else
2053     if( sFilterName == DECLARE_ASCII("calc_StarCalc_30_VorlageTemplate"                           ) ) { ePackage = E_STANDARD; nOrder =  8; } else
2054     if( sFilterName == DECLARE_ASCII("calc_StarCalc_10"                                           ) ) { ePackage = E_STANDARD; nOrder =  9; } else
2055     if( sFilterName == DECLARE_ASCII("calc_MS_Excel_97"                                           ) ) { ePackage = E_STANDARD; nOrder = 10; } else
2056     if( sFilterName == DECLARE_ASCII("calc_MS_Excel_97_VorlageTemplate"                           ) ) { ePackage = E_STANDARD; nOrder = 11; } else
2057     if( sFilterName == DECLARE_ASCII("calc_MS_Excel_95"                                           ) ) { ePackage = E_STANDARD; nOrder = 12; } else
2058     if( sFilterName == DECLARE_ASCII("calc_MS_Excel_95_VorlageTemplate"                           ) ) { ePackage = E_STANDARD; nOrder = 13; } else
2059     if( sFilterName == DECLARE_ASCII("calc_MS_Excel_5095"                                         ) ) { ePackage = E_STANDARD; nOrder = 14; } else
2060     if( sFilterName == DECLARE_ASCII("calc_MS_Excel_5095_VorlageTemplate"                         ) ) { ePackage = E_STANDARD; nOrder = 15; } else
2061     if( sFilterName == DECLARE_ASCII("calc_MS_Excel_40"                                           ) ) { ePackage = E_STANDARD; nOrder = 16; } else
2062     if( sFilterName == DECLARE_ASCII("calc_MS_Excel_40_VorlageTemplate"                           ) ) { ePackage = E_STANDARD; nOrder = 17; } else
2063     if( sFilterName == DECLARE_ASCII("calc_HTML_StarCalc"                                         ) ) { ePackage = E_STANDARD; nOrder = 18; } else
2064     if( sFilterName == DECLARE_ASCII("calc_HTML_WebQuery"                                         ) ) { ePackage = E_STANDARD; nOrder = 19; } else
2065     if( sFilterName == DECLARE_ASCII("calc_Rich_Text_Format_StarCalc"                             ) ) { ePackage = E_STANDARD; nOrder = 20; } else
2066     if( sFilterName == DECLARE_ASCII("calc_Text_txt_csv_StarCalc"                                 ) ) { ePackage = E_STANDARD; nOrder = 21; } else
2067     if( sFilterName == DECLARE_ASCII("calc_dBase"                                                 ) ) { ePackage = E_STANDARD; nOrder = 22; } else
2068     if( sFilterName == DECLARE_ASCII("calc_Lotus"                                                 ) ) { ePackage = E_STANDARD; nOrder = 23; } else
2069     if( sFilterName == DECLARE_ASCII("calc_SYLK"                                                  ) ) { ePackage = E_STANDARD; nOrder = 24; } else
2070     if( sFilterName == DECLARE_ASCII("calc_DIF"                                                   ) ) { ePackage = E_STANDARD; nOrder = 25; }
2071 
2072     // impress
2073     if( sFilterName == DECLARE_ASCII("impress_StarOffice_XML_Impress"                             ) ) { ePackage = E_STANDARD; nOrder =  1; } else
2074     if( sFilterName == DECLARE_ASCII("impress_StarOffice_XML_Impress_Template"                    ) ) { ePackage = E_STANDARD; nOrder =  2; } else
2075     if( sFilterName == DECLARE_ASCII("impress_StarImpress_50"                                     ) ) { ePackage = E_STANDARD; nOrder =  3; } else
2076     if( sFilterName == DECLARE_ASCII("impress_StarImpress_50_Vorlage"                             ) ) { ePackage = E_STANDARD; nOrder =  4; } else
2077     if( sFilterName == DECLARE_ASCII("impress_StarImpress_50_packed"                              ) ) { ePackage = E_STANDARD; nOrder =  5; } else
2078     if( sFilterName == DECLARE_ASCII("impress_StarImpress_40"                                     ) ) { ePackage = E_STANDARD; nOrder =  6; } else
2079     if( sFilterName == DECLARE_ASCII("impress_StarImpress_40_Vorlage"                             ) ) { ePackage = E_STANDARD; nOrder =  7; } else
2080     if( sFilterName == DECLARE_ASCII("impress_MS_PowerPoint_97"                                   ) ) { ePackage = E_STANDARD; nOrder =  8; } else
2081     if( sFilterName == DECLARE_ASCII("impress_MS_PowerPoint_97_Vorlage"                           ) ) { ePackage = E_STANDARD; nOrder =  9; } else
2082     if( sFilterName == DECLARE_ASCII("impress_StarOffice_XML_Draw"                                ) ) { ePackage = E_STANDARD; nOrder = 10; } else
2083     if( sFilterName == DECLARE_ASCII("impress_StarDraw_50_StarImpress"                            ) ) { ePackage = E_STANDARD; nOrder = 11; } else
2084     if( sFilterName == DECLARE_ASCII("impress_StarDraw_50_Vorlage_StarImpress"                    ) ) { ePackage = E_STANDARD; nOrder = 12; } else
2085     if( sFilterName == DECLARE_ASCII("impress_StarDraw_30_StarImpress"                            ) ) { ePackage = E_STANDARD; nOrder = 13; } else
2086     if( sFilterName == DECLARE_ASCII("impress_StarDraw_30_Vorlage_StarImpress"                    ) ) { ePackage = E_STANDARD; nOrder = 14; } else
2087     if( sFilterName == DECLARE_ASCII("impress_CGM_Computer_Graphics_Metafile"                     ) ) { ePackage = E_STANDARD; nOrder = 15; }
2088 
2089     // draw
2090     if( sFilterName == DECLARE_ASCII("draw_StarOffice_XML_Draw"                                   ) ) { ePackage = E_STANDARD; nOrder =  1; } else
2091     if( sFilterName == DECLARE_ASCII("draw_StarOffice_XML_Draw_Template"                          ) ) { ePackage = E_STANDARD; nOrder =  2; } else
2092     if( sFilterName == DECLARE_ASCII("draw_StarDraw_50"                                           ) ) { ePackage = E_STANDARD; nOrder =  3; } else
2093     if( sFilterName == DECLARE_ASCII("draw_StarDraw_50_Vorlage"                                   ) ) { ePackage = E_STANDARD; nOrder =  4; } else
2094     if( sFilterName == DECLARE_ASCII("draw_StarDraw_30"                                           ) ) { ePackage = E_STANDARD; nOrder =  5; } else
2095     if( sFilterName == DECLARE_ASCII("draw_StarDraw_30_Vorlage"                                   ) ) { ePackage = E_STANDARD; nOrder =  6; } else
2096     if( sFilterName == DECLARE_ASCII("draw_StarOffice_XML_Impress"                                ) ) { ePackage = E_STANDARD; nOrder =  7; } else
2097     if( sFilterName == DECLARE_ASCII("draw_StarImpress_50_StarDraw"                               ) ) { ePackage = E_STANDARD; nOrder =  8; } else
2098     if( sFilterName == DECLARE_ASCII("draw_StarImpress_50_Vorlage_StarDraw"                       ) ) { ePackage = E_STANDARD; nOrder =  9; } else
2099     if( sFilterName == DECLARE_ASCII("draw_StarImpress_40_StarDraw"                               ) ) { ePackage = E_STANDARD; nOrder = 10; } else
2100     if( sFilterName == DECLARE_ASCII("draw_StarImpress_40_Vorlage_StarDraw"                       ) ) { ePackage = E_STANDARD; nOrder = 11; } else
2101     if( sFilterName == DECLARE_ASCII("draw_SGV_StarDraw_20"                                       ) ) { ePackage = E_STANDARD; nOrder = 12; } else
2102     if( sFilterName == DECLARE_ASCII("draw_SGF_StarOffice_Writer_SGF"                             ) ) { ePackage = E_STANDARD; nOrder = 13; } else
2103     if( sFilterName == DECLARE_ASCII("draw_SVM_StarView_Metafile"                                 ) ) { ePackage = E_STANDARD; nOrder = 14; } else
2104     if( sFilterName == DECLARE_ASCII("draw_WMF_MS_Windows_Metafile"                               ) ) { ePackage = E_STANDARD; nOrder = 15; } else
2105     if( sFilterName == DECLARE_ASCII("draw_EMF_MS_Windows_Metafile"                               ) ) { ePackage = E_STANDARD; nOrder = 16; } else
2106     if( sFilterName == DECLARE_ASCII("draw_EPS_Encapsulated_PostScript"                           ) ) { ePackage = E_STANDARD; nOrder = 17; } else
2107     if( sFilterName == DECLARE_ASCII("draw_DXF_AutoCAD_Interchange"                               ) ) { ePackage = E_STANDARD; nOrder = 18; } else
2108     if( sFilterName == DECLARE_ASCII("draw_BMP_MS_Windows"                                        ) ) { ePackage = E_STANDARD; nOrder = 19; } else
2109     if( sFilterName == DECLARE_ASCII("draw_GIF_Graphics_Interchange"                              ) ) { ePackage = E_STANDARD; nOrder = 20; } else
2110     if( sFilterName == DECLARE_ASCII("draw_JPG_JPEG"                                              ) ) { ePackage = E_STANDARD; nOrder = 21; } else
2111     if( sFilterName == DECLARE_ASCII("draw_MET_OS2_Metafile"                                      ) ) { ePackage = E_STANDARD; nOrder = 22; } else
2112     if( sFilterName == DECLARE_ASCII("draw_PBM_Portable_Bitmap"                                   ) ) { ePackage = E_STANDARD; nOrder = 23; } else
2113     if( sFilterName == DECLARE_ASCII("draw_PCD_Photo_CD_Base"                                     ) ) { ePackage = E_STANDARD; nOrder = 24; } else
2114     if( sFilterName == DECLARE_ASCII("draw_PCD_Photo_CD_Base4"                                    ) ) { ePackage = E_STANDARD; nOrder = 25; } else
2115     if( sFilterName == DECLARE_ASCII("draw_PCD_Photo_CD_Base16"                                   ) ) { ePackage = E_STANDARD; nOrder = 26; } else
2116     if( sFilterName == DECLARE_ASCII("draw_PCT_Mac_Pict"                                          ) ) { ePackage = E_STANDARD; nOrder = 27; } else
2117     if( sFilterName == DECLARE_ASCII("draw_PCX_Zsoft_Paintbrush"                                  ) ) { ePackage = E_STANDARD; nOrder = 28; } else
2118     if( sFilterName == DECLARE_ASCII("draw_PGM_Portable_Graymap"                                  ) ) { ePackage = E_STANDARD; nOrder = 29; } else
2119     if( sFilterName == DECLARE_ASCII("draw_PNG_Portable_Network_Graphic"                          ) ) { ePackage = E_STANDARD; nOrder = 30; } else
2120     if( sFilterName == DECLARE_ASCII("draw_PPM_Portable_Pixelmap"                                 ) ) { ePackage = E_STANDARD; nOrder = 31; } else
2121     if( sFilterName == DECLARE_ASCII("draw_PSD_Adobe_Photoshop"                                   ) ) { ePackage = E_STANDARD; nOrder = 32; } else
2122     if( sFilterName == DECLARE_ASCII("draw_RAS_Sun_Rasterfile"                                    ) ) { ePackage = E_STANDARD; nOrder = 33; } else
2123     if( sFilterName == DECLARE_ASCII("draw_TGA_Truevision_TARGA"                                  ) ) { ePackage = E_STANDARD; nOrder = 34; } else
2124     if( sFilterName == DECLARE_ASCII("draw_TIF_Tag_Image_File"                                    ) ) { ePackage = E_STANDARD; nOrder = 35; } else
2125     if( sFilterName == DECLARE_ASCII("draw_XBM_X_Consortium"                                      ) ) { ePackage = E_STANDARD; nOrder = 36; } else
2126     if( sFilterName == DECLARE_ASCII("draw_XPM"                                                   ) ) { ePackage = E_STANDARD; nOrder = 37; }
2127 
2128     // chart
2129     if( sFilterName == DECLARE_ASCII("chart_StarOffice_XML_Chart"                                 ) ) { ePackage = E_STANDARD; nOrder =  1; } else
2130     if( sFilterName == DECLARE_ASCII("chart_StarChart_50"                                         ) ) { ePackage = E_STANDARD; nOrder =  2; } else
2131     if( sFilterName == DECLARE_ASCII("chart_StarChart_40"                                         ) ) { ePackage = E_STANDARD; nOrder =  3; } else
2132     if( sFilterName == DECLARE_ASCII("chart_StarChart_30"                                         ) ) { ePackage = E_STANDARD; nOrder =  4; }
2133 
2134     // math
2135     if( sFilterName == DECLARE_ASCII("math_StarOffice_XML_Math"                                   ) ) { ePackage = E_STANDARD; nOrder =  1; } else
2136     if( sFilterName == DECLARE_ASCII("math_StarMath_50"                                           ) ) { ePackage = E_STANDARD; nOrder =  2; } else
2137     if( sFilterName == DECLARE_ASCII("math_StarMath_40"                                           ) ) { ePackage = E_STANDARD; nOrder =  3; } else
2138     if( sFilterName == DECLARE_ASCII("math_StarMath_30"                                           ) ) { ePackage = E_STANDARD; nOrder =  4; } else
2139     if( sFilterName == DECLARE_ASCII("math_StarMath_20"                                           ) ) { ePackage = E_STANDARD; nOrder =  5; } else
2140     if( sFilterName == DECLARE_ASCII("math_MathML_XML_Math"                                       ) ) { ePackage = E_STANDARD; nOrder =  6; } else
2141     if( sFilterName == DECLARE_ASCII("math_MathType_3x"                                           ) ) { ePackage = E_STANDARD; nOrder =  7; }
2142 
2143     // graphics
2144     if( sFilterName == DECLARE_ASCII("bmp_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder =  1; } else
2145     if( sFilterName == DECLARE_ASCII("bmp_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder =  2; } else
2146     if( sFilterName == DECLARE_ASCII("dxf_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder =  3; } else
2147     if( sFilterName == DECLARE_ASCII("emf_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder =  4; } else
2148     if( sFilterName == DECLARE_ASCII("emf_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder =  5; } else
2149     if( sFilterName == DECLARE_ASCII("eps_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder =  6; } else
2150     if( sFilterName == DECLARE_ASCII("eps_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder =  7; } else
2151     if( sFilterName == DECLARE_ASCII("gif_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder =  8; } else
2152     if( sFilterName == DECLARE_ASCII("gif_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder =  9; } else
2153     if( sFilterName == DECLARE_ASCII("jpg_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 10; } else
2154     if( sFilterName == DECLARE_ASCII("jpg_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder = 11; } else
2155     if( sFilterName == DECLARE_ASCII("met_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 12; } else
2156     if( sFilterName == DECLARE_ASCII("met_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder = 13; } else
2157     if( sFilterName == DECLARE_ASCII("pbm_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 14; } else
2158     if( sFilterName == DECLARE_ASCII("pbm_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder = 15; } else
2159     if( sFilterName == DECLARE_ASCII("pcd_Import_Base16"                                          ) ) { ePackage = E_STANDARD; nOrder = 16; } else
2160     if( sFilterName == DECLARE_ASCII("pcd_Import_Base4"                                           ) ) { ePackage = E_STANDARD; nOrder = 17; } else
2161     if( sFilterName == DECLARE_ASCII("pcd_Import_Base"                                            ) ) { ePackage = E_STANDARD; nOrder = 18; } else
2162     if( sFilterName == DECLARE_ASCII("pct_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 19; } else
2163     if( sFilterName == DECLARE_ASCII("pct_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder = 20; } else
2164     if( sFilterName == DECLARE_ASCII("pcx_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 21; } else
2165     if( sFilterName == DECLARE_ASCII("pgm_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 22; } else
2166     if( sFilterName == DECLARE_ASCII("pgm_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder = 23; } else
2167     if( sFilterName == DECLARE_ASCII("png_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 24; } else
2168     if( sFilterName == DECLARE_ASCII("png_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder = 25; } else
2169     if( sFilterName == DECLARE_ASCII("ppm_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 26; } else
2170     if( sFilterName == DECLARE_ASCII("ppm_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder = 27; } else
2171     if( sFilterName == DECLARE_ASCII("psd_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 28; } else
2172     if( sFilterName == DECLARE_ASCII("ras_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 29; } else
2173     if( sFilterName == DECLARE_ASCII("ras_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder = 30; } else
2174     if( sFilterName == DECLARE_ASCII("sgf_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 31; } else
2175     if( sFilterName == DECLARE_ASCII("sgv_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 32; } else
2176     if( sFilterName == DECLARE_ASCII("svg_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder = 33; } else
2177     if( sFilterName == DECLARE_ASCII("svm_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 34; } else
2178     if( sFilterName == DECLARE_ASCII("svm_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder = 35; } else
2179     if( sFilterName == DECLARE_ASCII("tga_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 36; } else
2180     if( sFilterName == DECLARE_ASCII("tif_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 37; } else
2181     if( sFilterName == DECLARE_ASCII("tif_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder = 38; } else
2182     if( sFilterName == DECLARE_ASCII("wmf_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 39; } else
2183     if( sFilterName == DECLARE_ASCII("wmf_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder = 40; } else
2184     if( sFilterName == DECLARE_ASCII("xbm_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 41; } else
2185     if( sFilterName == DECLARE_ASCII("xpm_Import"                                                 ) ) { ePackage = E_STANDARD; nOrder = 42; } else
2186     if( sFilterName == DECLARE_ASCII("xpm_Export"                                                 ) ) { ePackage = E_STANDARD; nOrder = 43; }
2187 }
2188 
2189 //*****************************************************************************************************************
impl_orderAlphabetical(css::uno::Sequence<::rtl::OUString> & lList)2190 void XCDGenerator::impl_orderAlphabetical( css::uno::Sequence< ::rtl::OUString >& lList )
2191 {
2192     ::std::vector< ::rtl::OUString > lSortedList;
2193     sal_Int32                        nCount     ;
2194     sal_Int32                        nItem      ;
2195 
2196     // Copy sequence to vector
2197     nCount = lList.getLength();
2198     for( nItem=0; nItem<nCount; ++nItem )
2199     {
2200         lSortedList.push_back( lList[nItem] );
2201     }
2202 
2203     // sort in a alphabetical order
2204     ::std::sort( lSortedList.begin(), lSortedList.end() );
2205 
2206     // copy sorted list back to sequence
2207     nItem = 0;
2208     for( ::std::vector< ::rtl::OUString >::iterator pIterator=lSortedList.begin(); pIterator!=lSortedList.end(); ++pIterator )
2209     {
2210         lList[nItem] = *pIterator;
2211         ++nItem;
2212     }
2213 }
2214 
2215 //*****************************************************************************************************************
2216 class ModifiedUTF7Buffer
2217 {
2218 	rtl::OUStringBuffer & m_rBuffer;
2219 	sal_uInt32 m_nValue;
2220 	int m_nFilled;
2221 
2222 public:
ModifiedUTF7Buffer(rtl::OUStringBuffer * pTheBuffer)2223 	ModifiedUTF7Buffer(rtl::OUStringBuffer * pTheBuffer):
2224 		m_rBuffer(*pTheBuffer), m_nFilled(0) {}
2225 
2226 	inline void write(sal_Unicode c);
2227 
2228 	void flush();
2229 };
2230 
write(sal_Unicode c)2231 inline void ModifiedUTF7Buffer::write(sal_Unicode c)
2232 {
2233 	switch (m_nFilled)
2234 	{
2235 		case 0:
2236 			m_nValue = sal_uInt32(c) << 8;
2237 			m_nFilled = 2;
2238 			break;
2239 
2240 		case 1:
2241 			m_nValue |= sal_uInt32(c);
2242 			m_nFilled = 3;
2243 			flush();
2244 			break;
2245 
2246 		case 2:
2247 			m_nValue |= sal_uInt32(c) >> 8;
2248 			m_nFilled = 3;
2249 			flush();
2250 			m_nValue = (sal_uInt32(c) & 0xFF) << 16;
2251 			m_nFilled = 1;
2252 			break;
2253 	}
2254 }
2255 
flush()2256 void ModifiedUTF7Buffer::flush()
2257 {
2258 	static sal_Unicode const aModifiedBase64[64]
2259 		= { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
2260 			'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
2261 			'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
2262 			'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
2263 			'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '.' };
2264 	switch (m_nFilled)
2265 	{
2266 		case 1:
2267 			m_rBuffer.append(aModifiedBase64[m_nValue >> 18]);
2268 			m_rBuffer.append(aModifiedBase64[m_nValue >> 12 & 63]);
2269 			break;
2270 
2271 		case 2:
2272 			m_rBuffer.append(aModifiedBase64[m_nValue >> 18]);
2273 			m_rBuffer.append(aModifiedBase64[m_nValue >> 12 & 63]);
2274 			m_rBuffer.append(aModifiedBase64[m_nValue >> 6 & 63]);
2275 			break;
2276 
2277 		case 3:
2278 			m_rBuffer.append(aModifiedBase64[m_nValue >> 18]);
2279 			m_rBuffer.append(aModifiedBase64[m_nValue >> 12 & 63]);
2280 			m_rBuffer.append(aModifiedBase64[m_nValue >> 6 & 63]);
2281 			m_rBuffer.append(aModifiedBase64[m_nValue & 63]);
2282 			break;
2283 	}
2284 	m_nFilled = 0;
2285 	m_nValue = 0;
2286 }
2287 
2288 
impl_isUsAsciiAlphaDigit(sal_Unicode c,sal_Bool bDigitAllowed)2289 sal_Bool XCDGenerator::impl_isUsAsciiAlphaDigit(sal_Unicode c, sal_Bool bDigitAllowed)
2290 {
2291 	return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z'
2292 		   || bDigitAllowed && c >= '0' && c <= '9';
2293 }
2294 
impl_encodeSetName(const::rtl::OUString & rSource)2295 ::rtl::OUString XCDGenerator::impl_encodeSetName( const ::rtl::OUString& rSource )
2296 {
2297     return impl_encodeSpecialSigns( rSource );
2298 /*
2299 	rtl::OUStringBuffer aTarget;
2300 
2301 	sal_Unicode const * pBegin = rSource.getStr();
2302 	sal_Unicode const * pEnd = pBegin + rSource.getLength();
2303 	sal_Unicode const * pCopyEnd = pBegin;
2304 	sal_Unicode const * p = pBegin;
2305 	while (p != pEnd)
2306 	{
2307 		sal_Unicode c = *p;
2308         if (!impl_isUsAsciiAlphaDigit(c,p != pBegin))
2309 			switch (c)
2310 			{
2311 				case '-':
2312 				case '.':
2313 					if (p != pBegin)
2314 						break;
2315 				default:
2316 					aTarget.append(pCopyEnd, p - pCopyEnd);
2317 					aTarget.append(sal_Unicode('_'));
2318 					ModifiedUTF7Buffer aBuffer(&aTarget);
2319 					for (;;)
2320 					{
2321 						aBuffer.write(c);
2322 						++p;
2323 						if (p == pEnd)
2324 							break;
2325 						c = *p;
2326                         if (impl_isUsAsciiAlphaDigit(c) || c == '-' || c == '.')
2327 							break;
2328 					}
2329 					aBuffer.flush();
2330 					aTarget.append(sal_Unicode('_'));
2331 					pCopyEnd = p;
2332 					continue;
2333 			}
2334 		++p;
2335 	}
2336 
2337 	if (pCopyEnd == pBegin)
2338 		return rSource;
2339 	else
2340 	{
2341 		aTarget.append(pCopyEnd, pEnd - pCopyEnd);
2342 		return aTarget.makeStringAndClear();
2343 	}
2344 */
2345 }
2346