summaryrefslogtreecommitdiff
path: root/filter/source/config/tools/split
diff options
context:
space:
mode:
Diffstat (limited to 'filter/source/config/tools/split')
-rw-r--r--filter/source/config/tools/split/FCFGSplit.cfg110
-rw-r--r--filter/source/config/tools/split/FCFGSplit.java565
-rw-r--r--filter/source/config/tools/split/Manifest.mf1
-rw-r--r--filter/source/config/tools/split/Splitter.java310
-rw-r--r--filter/source/config/tools/split/SplitterData.java87
-rw-r--r--filter/source/config/tools/split/makefile.mk88
6 files changed, 1161 insertions, 0 deletions
diff --git a/filter/source/config/tools/split/FCFGSplit.cfg b/filter/source/config/tools/split/FCFGSplit.cfg
new file mode 100644
index 000000000000..0c3c72b2029d
--- /dev/null
+++ b/filter/source/config/tools/split/FCFGSplit.cfg
@@ -0,0 +1,110 @@
+#------------------------------------------------------
+# must be a system file name, which points to the
+# xcu file, should be analyzed and splitted
+#------------------------------------------------------
+xmlfile =o:/SRC680/src.m21/officecfg/registry/data/org/openoffice/Office/TypeDetection.xcu
+
+#------------------------------------------------------
+# specify the format of the specified "xmlfile"
+#------------------------------------------------------
+informat = 6.0
+
+#------------------------------------------------------
+# must be a system directory, which can be cleared completly
+# and will be used then to generate all results of this
+# program there - means to generate al xcu fragments
+#------------------------------------------------------
+outdir =c:/temp/split/fragments
+
+#------------------------------------------------------
+# specify the format of the generated xcu fragments
+# inside the "outdir"
+#------------------------------------------------------
+outformat = 6.Y
+
+#------------------------------------------------------
+# specify the text encoding, which must be used for
+# reading the "xmlfile"
+#------------------------------------------------------
+inencoding = UTF-8
+
+#------------------------------------------------------
+# specify the text encoding, which must be used for
+# writing the xcu fragments
+#------------------------------------------------------
+outencoding = UTF-8
+
+#------------------------------------------------------
+# The following defines specify system directories
+# which must be sub directories of "outdir".
+# Every of these sub dir willl be used to generate
+# groups of xcu fragments there.
+#------------------------------------------------------
+subdir_types = types
+subdir_filters = filters
+subdir_detectservices = detectservices
+subdir_frameloaders = frameloaders
+subdir_contenthandlers = contenthandlers
+
+#------------------------------------------------------
+# Enable/Disable grouping of filter fragments and using
+# of specialized sub directories.
+#------------------------------------------------------
+seperate_filters_by_module = false
+
+#------------------------------------------------------
+# The following defines specify system directories
+# which must be sub directories of "outdir/subdir_filters".
+# Every of these sub dir willl be used to generate
+# groups of filter fragments there.
+# Note: These sub directories are used only if
+# "seperate_filters_by_module" is set to true!
+#------------------------------------------------------
+subdir_module_swriter = swriter
+subdir_module_sweb = sweb
+subdir_module_sglobal = sglobal
+subdir_module_scalc = scalc
+subdir_module_sdraw = sdraw
+subdir_module_simpress = simpress
+subdir_module_smath = smath
+subdir_module_schart = schart
+subdir_module_others = others
+
+#------------------------------------------------------
+# Define the file extension, which is used for
+# every generated fragment inside "outdir".
+#------------------------------------------------------
+fragment_extension = .xcu
+
+#------------------------------------------------------
+# specify a debug level for generating debug output
+# on the console
+# The following levels exists:
+# 0 = no output
+# 1 = only errors/exceptions will be shown
+# 2 = errors/exceptions and warnings will be shown
+# 3 = additional to errors and warnings some global
+# informations are shown
+# 4 = additional to errors and warnings some global
+# and many detailed informations are shown
+#------------------------------------------------------
+debug = 4
+
+#------------------------------------------------------
+# Enable/Disable creation of the new "COMBINED" filter flag
+# for 6.y versions. That means: every filter with set
+# "IMPORT" and "EXPORT" flag will get the new flag value
+# and lose the old ones.
+#------------------------------------------------------
+create_combine_filter_flag = false
+
+#------------------------------------------------------
+# Remove some obsolete filter flags for 6.y versions.
+#------------------------------------------------------
+remove_filter_flag_browserpreferred = true
+remove_filter_flag_preferred = false
+remove_filter_flag_3rdparty = false
+
+remove_graphic_filters = false
+remove_filter_uinames = false
+set_default_detector = false
diff --git a/filter/source/config/tools/split/FCFGSplit.java b/filter/source/config/tools/split/FCFGSplit.java
new file mode 100644
index 000000000000..4693db4cdf83
--- /dev/null
+++ b/filter/source/config/tools/split/FCFGSplit.java
@@ -0,0 +1,565 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.filter.config.tools.split;
+
+//_______________________________________________
+
+import java.lang.*;
+import java.util.*;
+import java.io.*;
+import com.sun.star.filter.config.tools.utils.*;
+
+//_______________________________________________
+
+/**
+ * Implements a simple command line tool, which can read a given xml
+ * configuration file of the filter configuration, analyze it
+ * and split it into different xml fragments.
+ * All parameters of this process can be given by a configuration file.
+ *
+ *
+ */
+public class FCFGSplit
+{
+ //___________________________________________
+ // private const
+
+ /** specify the command line parameter to set the debug level for this app. */
+ private static final java.lang.String CMD_DEBUG = "debug" ;
+
+ /** specify the command line parameter to set a configuration file for this app. */
+ private static final java.lang.String CMD_CONFIG = "config";
+
+ /** The following strings are used as property names of
+ * the configuration file we need here.
+ *
+ * @seealso readCfg()
+ */
+
+ private static final java.lang.String CFGKEY_XMLFILE = "xmlfile" ;
+ private static final java.lang.String CFGKEY_INFORMAT = "informat" ;
+ private static final java.lang.String CFGKEY_OUTFORMAT = "outformat" ;
+ private static final java.lang.String CFGKEY_INENCODING = "inencoding" ;
+ private static final java.lang.String CFGKEY_OUTENCODING = "outencoding" ;
+ private static final java.lang.String CFGKEY_OUTDIR = "outdir" ;
+ private static final java.lang.String CFGKEY_FRAGMENT_EXTENSION = "fragment_extension" ;
+ private static final java.lang.String CFGKEY_CREATE_COMBINE_FILTER_FLAG = "create_combine_filter_flag" ;
+ private static final java.lang.String CFGKEY_REMOVE_FILTER_FLAG_BROWSERPREFERRED = "remove_filter_flag_browserpreferred" ;
+ private static final java.lang.String CFGKEY_REMOVE_FILTER_FLAG_PREFERRED = "remove_filter_flag_preferred" ;
+ private static final java.lang.String CFGKEY_REMOVE_FILTER_FLAG_3RDPARTY = "remove_filter_flag_3rdparty" ;
+ private static final java.lang.String CFGKEY_REMOVE_FILTER_UINAMES = "remove_filter_uinames" ;
+ private static final java.lang.String CFGKEY_REMOVE_GRAPHIC_FILTERS = "remove_graphic_filters" ;
+ private static final java.lang.String CFGKEY_SET_DEFAULT_DETECTOR = "set_default_detector" ;
+
+ private static final java.lang.String CFGKEY_SUBDIR_TYPES = "subdir_types" ;
+ private static final java.lang.String CFGKEY_SUBDIR_FILTERS = "subdir_filters" ;
+ private static final java.lang.String CFGKEY_SUBDIR_DETECTSERVICES = "subdir_detectservices" ;
+ private static final java.lang.String CFGKEY_SUBDIR_FRAMELOADERS = "subdir_frameloaders" ;
+ private static final java.lang.String CFGKEY_SUBDIR_CONTENTHANDLERS = "subdir_contenthandlers" ;
+
+ private static final java.lang.String CFGKEY_SEPERATE_FILTERS_BY_MODULE = "seperate_filters_by_module" ;
+
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SWRITER = "subdir_module_swriter" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SWEB = "subdir_module_sweb" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SGLOBAL = "subdir_module_sglobal" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SCALC = "subdir_module_scalc" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SDRAW = "subdir_module_sdraw" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SIMPRESS = "subdir_module_simpress" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SMATH = "subdir_module_smath" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_SCHART = "subdir_module_schart" ;
+ private static final java.lang.String CFGKEY_SUBDIR_MODULE_OTHERS = "subdir_module_others" ;
+
+ /** The following strings are used as property default
+ * values if a configuration key does not exist.
+ * It must be a string value, because the class java.util.Properties
+ * accept it as the only type. But of course the value must be
+ * convertable to the right target type.
+ *
+ * @seealso readCfg()
+ */
+
+ private static final java.lang.String DEFAULT_XMLFILE = ".//TypeDetection.xcu" ;
+ private static final java.lang.String DEFAULT_INFORMAT = "6.0" ;
+ private static final java.lang.String DEFAULT_OUTFORMAT = "6.Y" ;
+ private static final java.lang.String DEFAULT_INENCODING = "UTF-8" ;
+ private static final java.lang.String DEFAULT_OUTENCODING = "UTF-8" ;
+ private static final java.lang.String DEFAULT_OUTDIR = ".//temp" ;
+ private static final java.lang.String DEFAULT_FRAGMENT_EXTENSION = ".xcu" ;
+ private static final java.lang.String DEFAULT_CREATE_COMBINE_FILTER_FLAG = "false" ;
+ private static final java.lang.String DEFAULT_REMOVE_FILTER_FLAG_BROWSERPREFERRED = "false" ;
+ private static final java.lang.String DEFAULT_REMOVE_FILTER_FLAG_PREFERRED = "false" ;
+ private static final java.lang.String DEFAULT_REMOVE_FILTER_FLAG_3RDPARTY = "false" ;
+ private static final java.lang.String DEFAULT_REMOVE_FILTER_UINAMES = "false" ;
+ private static final java.lang.String DEFAULT_REMOVE_GRAPHIC_FILTERS = "false" ;
+ private static final java.lang.String DEFAULT_SET_DEFAULT_DETECTOR = "false" ;
+
+ private static final java.lang.String DEFAULT_SUBDIR_TYPES = "Types" ;
+ private static final java.lang.String DEFAULT_SUBDIR_FILTERS = "Filters" ;
+ private static final java.lang.String DEFAULT_SUBDIR_DETECTSERVICES = "DetectServices" ;
+ private static final java.lang.String DEFAULT_SUBDIR_FRAMELOADERS = "FrameLoaders" ;
+ private static final java.lang.String DEFAULT_SUBDIR_CONTENTHANDLERS = "ContentHandlers" ;
+
+ private static final java.lang.String DEFAULT_SEPERATE_FILTERS_BY_MODULE = "false" ;
+
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SWRITER = "SWriter" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SWEB = "SWeb" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SGLOBAL = "SGlobal" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SCALC = "SCalc" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SDRAW = "SDraw" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SIMPRESS = "SImpress" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SMATH = "SMath" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_SCHART = "SChart" ;
+ private static final java.lang.String DEFAULT_SUBDIR_MODULE_OTHERS = "Others" ;
+
+ //___________________________________________
+ // private member
+
+ /** contains the name of the reading xcu file. */
+ private static java.lang.String m_sXMLFile;
+
+ /** specify the xml file format, which must be interpreted at reading time. */
+ private static int m_nInFormat;
+
+ /** specify the xml file format, which must be used
+ * to generate all xcu fragments. */
+ private static int m_nOutFormat;
+
+ /** specify the file encoding for reading. */
+ private static java.lang.String m_sInEncoding;
+
+ /** specify the file encoding for writing fragments. */
+ private static java.lang.String m_sOutEncoding;
+
+ /** specify the target directory, where all results of this
+ * process can be generated.
+ * Note: May it will be cleared! */
+ private static java.lang.String m_sOutDir;
+
+ /** can be used to generate some output on the console. */
+ private static Logger m_aDebug;
+
+ /** contains the file extension for all generated xml fragments. */
+ private static java.lang.String m_sFragmentExtension;
+
+ /** specify the sub directory to generate type fragments.
+ * Its meaned relativ to m_sOutDir. */
+ private static java.lang.String m_sSubDirTypes;
+
+ /** specify the sub directory to generate filter fragments.
+ * Its meaned relativ to m_sOutDir. */
+ private static java.lang.String m_sSubDirFilters;
+
+ /** specify the sub directory to generate detect service fragments.
+ * Its meaned relativ to m_sOutDir. */
+ private static java.lang.String m_sSubDirDetectServices;
+
+ /** specify the sub directory to generate frame loader fragments.
+ * Its meaned relativ to m_sOutDir. */
+ private static java.lang.String m_sSubDirFrameLoaders;
+
+ /** specify the sub directory to generate content handler fragments.
+ * Its meaned relativ to m_sOutDir. */
+ private static java.lang.String m_sSubDirContentHandlers;
+
+ /** enable/disable generating of filter groups - seperated by
+ * application modules. */
+ private static boolean m_bSeperateFiltersByModule;
+
+ /** specify the sub directory to generate filter groups
+ * for the module writer. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSWriter;
+
+ /** specify the sub directory to generate filter groups
+ * for the module writer/web. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSWeb;
+
+ /** specify the sub directory to generate filter groups
+ * for the module writer/global. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSGlobal;
+
+ /** specify the sub directory to generate filter groups
+ * for the module calc. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSCalc;
+
+ /** specify the sub directory to generate filter groups
+ * for the module draw. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSDraw;
+
+ /** specify the sub directory to generate filter groups
+ * for the module impress. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSImpress;
+
+ /** specify the sub directory to generate filter groups
+ * for the module math. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSMath;
+
+ /** specify the sub directory to generate filter groups
+ * for the module chart. Will be used only,
+ * if m_bSeperateFiltersByModule is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleSChart;
+
+ /** specify the sub directory to generate filter groups
+ * for unknown modules - e.g. the graphic filters.
+ * Will be used only, if m_bSeperateFiltersByModule
+ * is set to TRUE.*/
+ private static java.lang.String m_sSubDirModuleOthers;
+
+ private static boolean m_bCreateCombineFilterFlag;
+ private static boolean m_bRemoveFilterFlagBrowserPreferred;
+ private static boolean m_bRemoveFilterFlagPreferred;
+ private static boolean m_bRemoveFilterFlag3rdparty;
+ private static boolean m_bRemoveFilterUINames;
+ private static boolean m_bRemoveGraphicFilters;
+ private static boolean m_bSetDefaultDetector;
+
+ //___________________________________________
+ // main
+
+ /** main.
+ *
+ * Analyze the command line arguments, load the configuration file,
+ * fill a cache from the specified xml file and generate all
+ * needed xml fragments inside the specified output directory.
+ *
+ * @param lArgs
+ * contains the command line arguments.
+ */
+ public static void main(java.lang.String[] lArgs)
+ {
+ long t_start = System.currentTimeMillis();
+
+ // must be :-)
+ FCFGSplit.printCopyright();
+ // can be used as exit code
+ int nErr = 0;
+
+ // --------------------------------------------------------------------
+ // analyze command line parameter
+ ConfigHelper aCmdLine = null;
+ try
+ {
+ aCmdLine = new ConfigHelper("com/sun/star/filter/config/tools/split/FCFGSplit.cfg", lArgs);
+ }
+ catch(java.lang.Throwable exCmdLine)
+ {
+ exCmdLine.printStackTrace();
+ FCFGSplit.printHelp();
+ System.exit(--nErr);
+ }
+
+ // --------------------------------------------------------------------
+ // help requested?
+ if (aCmdLine.isHelp())
+ {
+ FCFGSplit.printHelp();
+ System.exit(--nErr);
+ }
+
+ // --------------------------------------------------------------------
+ // initialize an output channel for errors/warnings etc.
+ int nLevel = aCmdLine.getInt(CMD_DEBUG, Logger.LEVEL_DETAILEDINFOS);
+ m_aDebug = new Logger(nLevel);
+ try
+ {
+ FCFGSplit.readCfg(aCmdLine);
+ }
+ catch(java.lang.Exception exCfgLoad)
+ {
+ m_aDebug.setException(exCfgLoad);
+ System.exit(--nErr);
+ }
+
+ // --------------------------------------------------------------------
+ // check if the required resources exists
+ java.io.File aXMLFile = new java.io.File(m_sXMLFile);
+ if (!aXMLFile.exists() || !aXMLFile.isFile())
+ {
+ m_aDebug.setError("The specified xml file \""+aXMLFile.getPath()+"\" does not exist or seems not to be a simple file.");
+ System.exit(--nErr);
+ }
+
+ java.io.File aOutDir = new java.io.File(m_sOutDir);
+ if (!aOutDir.exists() || !aOutDir.isDirectory())
+ {
+ m_aDebug.setError("The specified directory \""+aOutDir.getPath()+"\" does not exist or seems not to be a directory.");
+ System.exit(--nErr);
+ }
+
+ if (m_nInFormat == Cache.FORMAT_UNSUPPORTED)
+ {
+ m_aDebug.setError("The specified xml format for input is not supported.");
+ System.exit(--nErr);
+ }
+
+ if (m_nOutFormat == Cache.FORMAT_UNSUPPORTED)
+ {
+ m_aDebug.setError("The specified xml format for output is not supported.");
+ System.exit(--nErr);
+ }
+
+ // --------------------------------------------------------------------
+ // load the xml file
+ m_aDebug.setGlobalInfo("loading xml file \""+aXMLFile.getPath()+"\" ...");
+ long t_load_start = System.currentTimeMillis();
+ Cache aCache = new Cache(m_aDebug);
+ try
+ {
+ aCache.fromXML(aXMLFile, m_nInFormat);
+ }
+ catch(java.lang.Throwable exLoad)
+ {
+ m_aDebug.setException(exLoad);
+ System.exit(--nErr);
+ }
+ long t_load_end = System.currentTimeMillis();
+
+ // --------------------------------------------------------------------
+ // validate the content, fix some problems and convert it to the output format
+ m_aDebug.setGlobalInfo("validate and transform to output format ...");
+ long t_transform_start = System.currentTimeMillis();
+ try
+ {
+ aCache.validate(m_nInFormat);
+ if (
+ (m_nInFormat == Cache.FORMAT_60) &&
+ (m_nOutFormat == Cache.FORMAT_6Y)
+ )
+ {
+ aCache.transform60to6Y(m_bCreateCombineFilterFlag ,
+ m_bRemoveFilterFlagBrowserPreferred,
+ m_bRemoveFilterFlagPreferred ,
+ m_bRemoveFilterFlag3rdparty ,
+ m_bRemoveFilterUINames ,
+ m_bRemoveGraphicFilters ,
+ m_bSetDefaultDetector );
+ }
+ aCache.validate(m_nOutFormat);
+ }
+ catch(java.lang.Throwable exTransform)
+ {
+ m_aDebug.setException(exTransform);
+ System.exit(--nErr);
+ }
+ long t_transform_end = System.currentTimeMillis();
+
+ // --------------------------------------------------------------------
+ // generate all xml fragments
+ m_aDebug.setGlobalInfo("generate xml fragments into directory \""+aOutDir.getPath()+"\" ...");
+ long t_split_start = System.currentTimeMillis();
+ try
+ {
+ SplitterData aDataSet = new SplitterData();
+ aDataSet.m_aDebug = m_aDebug ;
+ aDataSet.m_aCache = aCache ;
+ aDataSet.m_nFormat = m_nOutFormat ;
+ aDataSet.m_sEncoding = m_sOutEncoding ;
+ aDataSet.m_bSeperateFiltersByModule = m_bSeperateFiltersByModule;
+ aDataSet.m_sFragmentExtension = m_sFragmentExtension ;
+ aDataSet.m_aOutDir = aOutDir ;
+
+ aDataSet.m_aFragmentDirTypes = new java.io.File(aOutDir, m_sSubDirTypes );
+ aDataSet.m_aFragmentDirFilters = new java.io.File(aOutDir, m_sSubDirFilters );
+ aDataSet.m_aFragmentDirDetectServices = new java.io.File(aOutDir, m_sSubDirDetectServices );
+ aDataSet.m_aFragmentDirFrameLoaders = new java.io.File(aOutDir, m_sSubDirFrameLoaders );
+ aDataSet.m_aFragmentDirContentHandlers = new java.io.File(aOutDir, m_sSubDirContentHandlers);
+
+ if (m_bSeperateFiltersByModule)
+ {
+ aDataSet.m_aFragmentDirModuleSWriter = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSWriter );
+ aDataSet.m_aFragmentDirModuleSWeb = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSWeb );
+ aDataSet.m_aFragmentDirModuleSGlobal = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSGlobal );
+ aDataSet.m_aFragmentDirModuleSCalc = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSCalc );
+ aDataSet.m_aFragmentDirModuleSDraw = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSDraw );
+ aDataSet.m_aFragmentDirModuleSImpress = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSImpress);
+ aDataSet.m_aFragmentDirModuleSMath = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSMath );
+ aDataSet.m_aFragmentDirModuleSChart = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSChart );
+ aDataSet.m_aFragmentDirModuleOthers = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleOthers );
+ }
+ else
+ {
+ aDataSet.m_aFragmentDirModuleSWriter = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleSWeb = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleSGlobal = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleSCalc = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleSDraw = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleSImpress = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleSMath = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleSChart = aDataSet.m_aFragmentDirFilters;
+ aDataSet.m_aFragmentDirModuleOthers = aDataSet.m_aFragmentDirFilters;
+ }
+
+ Splitter aSplitter = new Splitter(aDataSet);
+ aSplitter.split();
+ }
+ catch(java.lang.Throwable exSplit)
+ {
+ m_aDebug.setException(exSplit);
+ System.exit(--nErr);
+ }
+ long t_split_end = System.currentTimeMillis();
+
+ // --------------------------------------------------------------------
+ // generate some special views
+ m_aDebug.setGlobalInfo("generate views and statistics ...");
+ long t_statistics_start = System.currentTimeMillis();
+ try
+ {
+ aCache.analyze();
+ aCache.toHTML(aOutDir, m_nOutFormat, m_sOutEncoding);
+ m_aDebug.setDetailedInfo(aCache.getStatistics());
+ }
+ catch(java.lang.Throwable exStatistics)
+ {
+ m_aDebug.setException(exStatistics);
+ System.exit(--nErr);
+ }
+ long t_statistics_end = System.currentTimeMillis();
+
+ // --------------------------------------------------------------------
+ // analyze some time stamps
+ long t_end = System.currentTimeMillis();
+
+ java.lang.StringBuffer sTimes = new java.lang.StringBuffer(100);
+ sTimes.append("Needed times:\n" );
+ sTimes.append("t [all]\t\t=\t" );
+ sTimes.append(t_end-t_start );
+ sTimes.append(" ms\n" );
+ sTimes.append("t [load]\t=\t" );
+ sTimes.append(t_load_end-t_load_start );
+ sTimes.append(" ms\n" );
+ sTimes.append("t [transform]\t=\t" );
+ sTimes.append(t_transform_end-t_transform_start );
+ sTimes.append(" ms\n" );
+ sTimes.append("t [split]\t=\t" );
+ sTimes.append(t_split_end-t_split_start );
+ sTimes.append(" ms\n" );
+ sTimes.append("t [statistics]\t=\t" );
+ sTimes.append(t_statistics_end-t_statistics_start);
+ sTimes.append(" ms\n" );
+ m_aDebug.setDetailedInfo(sTimes.toString());
+
+ // everyting seems to be ok.
+ // Return "OK" to calli.
+ m_aDebug.setGlobalInfo("Finish.");
+ System.exit(0);
+ }
+
+ //___________________________________________
+
+ /** read the configuration file.
+ *
+ * @param aCfg
+ * contains the content of the
+ * loaded configuration file.
+ */
+ private static void readCfg(java.util.Properties aCfg)
+ {
+ m_sXMLFile = aCfg.getProperty(CFGKEY_XMLFILE , DEFAULT_XMLFILE );
+
+ m_sInEncoding = aCfg.getProperty(CFGKEY_INENCODING , DEFAULT_INENCODING );
+ m_sOutEncoding = aCfg.getProperty(CFGKEY_OUTENCODING , DEFAULT_OUTENCODING );
+ m_sOutDir = aCfg.getProperty(CFGKEY_OUTDIR , DEFAULT_OUTDIR );
+ m_sFragmentExtension = aCfg.getProperty(CFGKEY_FRAGMENT_EXTENSION , DEFAULT_FRAGMENT_EXTENSION );
+
+ m_sSubDirTypes = aCfg.getProperty(CFGKEY_SUBDIR_TYPES , DEFAULT_SUBDIR_TYPES );
+ m_sSubDirFilters = aCfg.getProperty(CFGKEY_SUBDIR_FILTERS , DEFAULT_SUBDIR_FILTERS );
+ m_sSubDirDetectServices = aCfg.getProperty(CFGKEY_SUBDIR_DETECTSERVICES , DEFAULT_SUBDIR_DETECTSERVICES );
+ m_sSubDirFrameLoaders = aCfg.getProperty(CFGKEY_SUBDIR_FRAMELOADERS , DEFAULT_SUBDIR_FRAMELOADERS );
+ m_sSubDirContentHandlers = aCfg.getProperty(CFGKEY_SUBDIR_CONTENTHANDLERS , DEFAULT_SUBDIR_CONTENTHANDLERS );
+
+ m_sSubDirModuleSWriter = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SWRITER , DEFAULT_SUBDIR_MODULE_SWRITER );
+ m_sSubDirModuleSWeb = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SWEB , DEFAULT_SUBDIR_MODULE_SWEB );
+ m_sSubDirModuleSGlobal = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SGLOBAL , DEFAULT_SUBDIR_MODULE_SGLOBAL );
+ m_sSubDirModuleSCalc = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SCALC , DEFAULT_SUBDIR_MODULE_SCALC );
+ m_sSubDirModuleSDraw = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SDRAW , DEFAULT_SUBDIR_MODULE_SDRAW );
+ m_sSubDirModuleSImpress = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SIMPRESS , DEFAULT_SUBDIR_MODULE_SIMPRESS );
+ m_sSubDirModuleSMath = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SMATH , DEFAULT_SUBDIR_MODULE_SMATH );
+ m_sSubDirModuleSChart = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SCHART , DEFAULT_SUBDIR_MODULE_SCHART );
+ m_sSubDirModuleOthers = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_OTHERS , DEFAULT_SUBDIR_MODULE_OTHERS );
+
+ m_bSeperateFiltersByModule = new java.lang.Boolean(aCfg.getProperty(CFGKEY_SEPERATE_FILTERS_BY_MODULE , DEFAULT_SEPERATE_FILTERS_BY_MODULE )).booleanValue();
+ m_bCreateCombineFilterFlag = new java.lang.Boolean(aCfg.getProperty(CFGKEY_CREATE_COMBINE_FILTER_FLAG , DEFAULT_CREATE_COMBINE_FILTER_FLAG )).booleanValue();
+ m_bRemoveFilterFlagBrowserPreferred = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_FLAG_BROWSERPREFERRED, DEFAULT_REMOVE_FILTER_FLAG_BROWSERPREFERRED)).booleanValue();
+ m_bRemoveFilterFlagPreferred = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_FLAG_PREFERRED , DEFAULT_REMOVE_FILTER_FLAG_PREFERRED )).booleanValue();
+ m_bRemoveFilterFlag3rdparty = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_FLAG_3RDPARTY , DEFAULT_REMOVE_FILTER_FLAG_3RDPARTY )).booleanValue();
+ m_bRemoveFilterUINames = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_UINAMES , DEFAULT_REMOVE_FILTER_UINAMES )).booleanValue();
+ m_bRemoveGraphicFilters = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_GRAPHIC_FILTERS , DEFAULT_REMOVE_GRAPHIC_FILTERS )).booleanValue();
+ m_bSetDefaultDetector = new java.lang.Boolean(aCfg.getProperty(CFGKEY_SET_DEFAULT_DETECTOR , DEFAULT_SET_DEFAULT_DETECTOR )).booleanValue();
+
+ java.lang.String sFormat = aCfg.getProperty(CFGKEY_INFORMAT, DEFAULT_INFORMAT);
+ m_nInFormat = Cache.mapFormatString2Format(sFormat);
+
+ sFormat = aCfg.getProperty(CFGKEY_OUTFORMAT, DEFAULT_OUTFORMAT);
+ m_nOutFormat = Cache.mapFormatString2Format(sFormat);
+ }
+
+ //___________________________________________
+
+ /** prints out a copyright message on stdout.
+ */
+ private static void printCopyright()
+ {
+ java.lang.StringBuffer sOut = new java.lang.StringBuffer(256);
+ sOut.append("FCFGSplit\n");
+ sOut.append("Copyright: 2000 by Sun Microsystems, Inc.\n");
+ sOut.append("All Rights Reserved.\n");
+ System.out.println(sOut.toString());
+ }
+
+ //___________________________________________
+
+ /** prints out a help message on stdout.
+ */
+ private static void printHelp()
+ {
+ java.lang.StringBuffer sOut = new java.lang.StringBuffer(1000);
+ sOut.append("_______________________________________________________________________________\n\n" );
+ sOut.append("usage: FCFGSplit "+CMD_CONFIG+"=<file name> "+CMD_DEBUG+"=<level>\n" );
+ sOut.append("parameters:\n" );
+ sOut.append("\t-help\n" );
+ sOut.append("\t\tshow this little help.\n\n" );
+ sOut.append("\t"+CMD_CONFIG+"=<file name>\n" );
+ sOut.append("\t\tspecify the configuration file.\n\n" );
+ sOut.append("\t"+CMD_DEBUG+"=<level>\n" );
+ sOut.append("\t\tprints out some debug messages.\n" );
+ sOut.append("\t\tlevel=[0..4]\n" );
+ sOut.append("\t\t0 => no debug messages\n" );
+ sOut.append("\t\t1 => print out errors only\n" );
+ sOut.append("\t\t2 => print out errors & warnings\n" );
+ sOut.append("\t\t3 => print out some global actions (e.g. load file ...)\n" );
+ sOut.append("\t\t4 => print out more detailed actions (e.g. load item nr. xxx of file.)\n\n" );
+ System.out.println(sOut.toString());
+ }
+}
diff --git a/filter/source/config/tools/split/Manifest.mf b/filter/source/config/tools/split/Manifest.mf
new file mode 100644
index 000000000000..4d0d20ed59cc
--- /dev/null
+++ b/filter/source/config/tools/split/Manifest.mf
@@ -0,0 +1 @@
+Main-Class: com.sun.star.filter.config.tools.split.FCFGSplit
diff --git a/filter/source/config/tools/split/Splitter.java b/filter/source/config/tools/split/Splitter.java
new file mode 100644
index 000000000000..d9c171382596
--- /dev/null
+++ b/filter/source/config/tools/split/Splitter.java
@@ -0,0 +1,310 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.filter.config.tools.split;
+
+//_______________________________________________
+
+import java.lang.*;
+import java.util.*;
+import java.io.*;
+import com.sun.star.filter.config.tools.utils.*;
+
+//_______________________________________________
+
+/**
+ * Can split one xml file into its different xml fragments.
+ *
+ *
+ */
+public class Splitter
+{
+ //___________________________________________
+ // const
+
+ //___________________________________________
+ // member
+
+ /** contains all real member of this instance.
+ * That make it easy to initialize an instance
+ * of this class inside a multi-threaded environment. */
+ private SplitterData m_aDataSet;
+
+ //___________________________________________
+ // interface
+
+ /** initialize a new instance of this class with all
+ * needed resources.
+ *
+ * @param aDataSet
+ * contains all needed parameters for this instance
+ * as a complete set, which can be filled outside.
+ */
+ public Splitter(SplitterData aDataSet)
+ {
+ m_aDataSet = aDataSet;
+ }
+
+ //___________________________________________
+ // interface
+
+ /** generate xml fragments for all cache items.
+ *
+ * @throw [java.lang.Exception]
+ * if anything will fail inside during
+ * this operation runs.
+ */
+ public synchronized void split()
+ throws java.lang.Exception
+ {
+ createDirectoryStructures();
+
+ // use some statistic values to check if all cache items
+ // will be transformed realy.
+ int nTypes = m_aDataSet.m_aCache.getItemCount(Cache.E_TYPE );
+ int nFilters = m_aDataSet.m_aCache.getItemCount(Cache.E_FILTER );
+ int nDetectServices = m_aDataSet.m_aCache.getItemCount(Cache.E_DETECTSERVICE );
+ int nFrameLoaders = m_aDataSet.m_aCache.getItemCount(Cache.E_FRAMELOADER );
+ int nContentHandlers = m_aDataSet.m_aCache.getItemCount(Cache.E_CONTENTHANDLER);
+
+ // generate all type fragments
+ m_aDataSet.m_aDebug.setGlobalInfo("generate type fragments ...");
+ java.util.Vector lNames = m_aDataSet.m_aCache.getItemNames(Cache.E_TYPE);
+ java.util.Enumeration it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_TYPE, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirTypes);
+ nTypes -= lNames.size();
+
+ // generate filter fragments for the writer module
+ m_aDataSet.m_aDebug.setGlobalInfo("generate filter fragments ...");
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module writer ...");
+ java.util.HashMap rRequestedProps = new java.util.HashMap();
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.text.TextDocument");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSWriter);
+ nFilters -= lNames.size();
+
+ // generate filter fragments for the writer/web module
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module writer/web ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.text.WebDocument");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSWeb);
+ nFilters -= lNames.size();
+
+ // generate filter fragments for the writer/global module
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module writer/global ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.text.GlobalDocument");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSGlobal);
+ nFilters -= lNames.size();
+
+ // generate filter fragments for the calc module
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module calc ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.sheet.SpreadsheetDocument");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSCalc);
+ nFilters -= lNames.size();
+
+ // generate filter fragments for the draw module
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module draw ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.drawing.DrawingDocument");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSDraw);
+ nFilters -= lNames.size();
+
+ // generate filter fragments for the impress module
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module impress ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.presentation.PresentationDocument");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSImpress);
+ nFilters -= lNames.size();
+
+ // generate filter fragments for the chart module
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module chart ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.chart2.ChartDocument");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSChart);
+ nFilters -= lNames.size();
+
+ // generate filter fragments for the math module
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor module math ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "com.sun.star.formula.FormulaProperties");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleSMath);
+ nFilters -= lNames.size();
+
+ // generate fragments for 3rdParty or unspecified (may graphics) filters!
+ m_aDataSet.m_aDebug.setGlobalInfo("\tfor unknown modules ...");
+ rRequestedProps.put(Cache.PROPNAME_DOCUMENTSERVICE, "");
+ lNames = m_aDataSet.m_aCache.getMatchedItemNames(Cache.E_FILTER, rRequestedProps);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FILTER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirModuleOthers);
+ nFilters -= lNames.size();
+
+ // generate all detect service fragments
+ m_aDataSet.m_aDebug.setGlobalInfo("generate detect service fragments ...");
+ lNames = m_aDataSet.m_aCache.getItemNames(Cache.E_DETECTSERVICE);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_DETECTSERVICE, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirDetectServices);
+ nDetectServices -= lNames.size();
+
+ // generate all frame loader fragments
+ m_aDataSet.m_aDebug.setGlobalInfo("generate frame loader fragments ...");
+ lNames = m_aDataSet.m_aCache.getItemNames(Cache.E_FRAMELOADER);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_FRAMELOADER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirFrameLoaders);
+ nFrameLoaders -= lNames.size();
+
+ // generate all content handler fragments
+ m_aDataSet.m_aDebug.setGlobalInfo("generate content handler fragments ...");
+ lNames = m_aDataSet.m_aCache.getItemNames(Cache.E_CONTENTHANDLER);
+ it = lNames.elements();
+ while(it.hasMoreElements())
+ generateXMLFragment(Cache.E_CONTENTHANDLER, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirContentHandlers);
+ nContentHandlers -= lNames.size();
+
+ // check if all cache items was handled
+ if (
+ (nTypes != 0) ||
+ (nFilters != 0) ||
+ (nDetectServices != 0) ||
+ (nFrameLoaders != 0) ||
+ (nContentHandlers != 0)
+ )
+ {
+ java.lang.StringBuffer sStatistic = new java.lang.StringBuffer(256);
+ sStatistic.append("some cache items seems to be not transformed:\n");
+ sStatistic.append(nTypes +" unhandled types\n" );
+ sStatistic.append(nFilters +" unhandled filters\n" );
+ sStatistic.append(nDetectServices +" unhandled detect services\n");
+ sStatistic.append(nFrameLoaders +" unhandled frame loader\n" );
+ sStatistic.append(nContentHandlers+" unhandled content handler\n");
+ throw new java.lang.Exception(sStatistic.toString());
+ }
+ }
+
+ //___________________________________________
+
+ /** generate a xml fragment file from the specified cache item.
+ *
+ * @param eItemType
+ * specify, which sub container of the cache must be used
+ * to locate the right item.
+ *
+ * @param sItemName
+ * the name of the cache item inside the specified sub container.
+ *
+ * @param aOutDir
+ * output directory.
+ *
+ * @throw [java.lang.Exception]
+ * if the fragment file already exists or could not be created
+ * successfully.
+ */
+ private void generateXMLFragment(int eItemType,
+ java.lang.String sItemName,
+ java.io.File aOutDir )
+ throws java.lang.Exception
+ {
+ java.lang.String sFileName = FileHelper.convertName2FileName(sItemName);
+ java.lang.String sXML = m_aDataSet.m_aCache.getItemAsXML(eItemType, sItemName, m_aDataSet.m_nFormat);
+ java.io.File aFile = new java.io.File(aOutDir, sFileName+m_aDataSet.m_sFragmentExtension);
+
+ if (aFile.exists())
+ throw new java.lang.Exception("fragment["+eItemType+", \""+sItemName+"\"] file named \""+aFile.getPath()+"\" already exists.");
+
+ java.io.FileOutputStream aStream = new java.io.FileOutputStream(aFile);
+ java.io.OutputStreamWriter aWriter = new java.io.OutputStreamWriter(aStream, m_aDataSet.m_sEncoding);
+ aWriter.write(sXML, 0, sXML.length());
+ aWriter.flush();
+ aWriter.close();
+
+ m_aDataSet.m_aDebug.setDetailedInfo("fragment["+eItemType+", \""+sItemName+"\"] => \""+aFile.getPath()+"\" ... OK");
+ }
+
+ //___________________________________________
+
+ /** create all needed directory structures.
+ *
+ * First it try to clear old structures and
+ * create new ones afterwards.
+ *
+ * @throw [java.lang.Exception]
+ * if some of the needed structures
+ * could not be created successfully.
+ */
+ private void createDirectoryStructures()
+ throws java.lang.Exception
+ {
+ m_aDataSet.m_aDebug.setGlobalInfo("create needed directory structures ...");
+
+ // delete simple files only; no directories!
+ // Because this tool may run inside
+ // a cvs environment its not a godd idea to do so.
+ boolean bFilesOnly = false;
+ FileHelper.makeDirectoryEmpty(m_aDataSet.m_aOutDir, bFilesOnly);
+
+ if (
+ (!m_aDataSet.m_aFragmentDirTypes.exists() && !m_aDataSet.m_aFragmentDirTypes.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirFilters.exists() && !m_aDataSet.m_aFragmentDirFilters.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirDetectServices.exists() && !m_aDataSet.m_aFragmentDirDetectServices.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirFrameLoaders.exists() && !m_aDataSet.m_aFragmentDirFrameLoaders.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirContentHandlers.exists() && !m_aDataSet.m_aFragmentDirContentHandlers.mkdir()) ||
+ (!m_aDataSet.m_aFragmentDirModuleSWriter.exists() && !m_aDataSet.m_aFragmentDirModuleSWriter.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleSWeb.exists() && !m_aDataSet.m_aFragmentDirModuleSWeb.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleSGlobal.exists() && !m_aDataSet.m_aFragmentDirModuleSGlobal.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleSCalc.exists() && !m_aDataSet.m_aFragmentDirModuleSCalc.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleSDraw.exists() && !m_aDataSet.m_aFragmentDirModuleSDraw.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleSImpress.exists() && !m_aDataSet.m_aFragmentDirModuleSImpress.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleSMath.exists() && !m_aDataSet.m_aFragmentDirModuleSMath.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleSChart.exists() && !m_aDataSet.m_aFragmentDirModuleSChart.mkdir() ) ||
+ (!m_aDataSet.m_aFragmentDirModuleOthers.exists() && !m_aDataSet.m_aFragmentDirModuleOthers.mkdir() )
+ )
+ {
+ throw new java.lang.Exception("some directory structures does not exists and could not be created successfully.");
+ }
+ }
+}
diff --git a/filter/source/config/tools/split/SplitterData.java b/filter/source/config/tools/split/SplitterData.java
new file mode 100644
index 000000000000..daa09797da68
--- /dev/null
+++ b/filter/source/config/tools/split/SplitterData.java
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.filter.config.tools.split;
+
+//_______________________________________________
+
+import java.lang.*;
+import java.io.*;
+import com.sun.star.filter.config.tools.utils.*;
+
+//_______________________________________________
+
+/**
+ * Data container for class Splitter.
+ *
+ *
+ */
+public class SplitterData
+{
+ /** can be used to generate some debug output. */
+ public Logger m_aDebug;
+
+ /** contains all configuration structures, for which the xml
+ fragments should be generated. */
+ public Cache m_aCache;
+
+ /** specify the output xml format. */
+ public int m_nFormat;
+
+ /** specify the encoding for the output xml files. */
+ public java.lang.String m_sEncoding;
+
+ /** directory to generate some generic views. */
+ public java.io.File m_aOutDir;
+
+ /** directories to generate all xml fragments there.
+ * Must be relative to "m_aOutDir"! */
+ public java.io.File m_aFragmentDirTypes;
+ public java.io.File m_aFragmentDirFilters;
+ public java.io.File m_aFragmentDirDetectServices;
+ public java.io.File m_aFragmentDirFrameLoaders;
+ public java.io.File m_aFragmentDirContentHandlers;
+
+ /** enable/disable grouping of filters by its application modules. */
+ public boolean m_bSeperateFiltersByModule;
+
+ /** directories to group all filter fragments ... if requested.
+ * Must be relative to "m_aOutDir/m_aFragmentDirFilters" and
+ * will be used only, if "m_bSeperateFiltersByModule" is set to true. */
+ public java.io.File m_aFragmentDirModuleSWriter;
+ public java.io.File m_aFragmentDirModuleSWeb;
+ public java.io.File m_aFragmentDirModuleSGlobal;
+ public java.io.File m_aFragmentDirModuleSCalc;
+ public java.io.File m_aFragmentDirModuleSDraw;
+ public java.io.File m_aFragmentDirModuleSImpress;
+ public java.io.File m_aFragmentDirModuleSMath;
+ public java.io.File m_aFragmentDirModuleSChart;
+ public java.io.File m_aFragmentDirModuleOthers;
+
+ /** file extension for generated xml fragments. */
+ public java.lang.String m_sFragmentExtension;
+}
diff --git a/filter/source/config/tools/split/makefile.mk b/filter/source/config/tools/split/makefile.mk
new file mode 100644
index 000000000000..a6942bfa6d5f
--- /dev/null
+++ b/filter/source/config/tools/split/makefile.mk
@@ -0,0 +1,88 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..
+PRJNAME = filter
+TARGET = FCFGSplit
+PACKAGE = com$/sun$/star$/filter$/config$/tools$/split
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+#----- compile .java files -----------------------------------------
+
+OWNCOPY = \
+ $(MISC)$/$(TARGET)_copied.done
+
+JARFILES = \
+ ridl.jar \
+ unoil.jar \
+ jurt.jar \
+ juh.jar \
+ java_uno.jar
+
+CFGFILES = \
+ FCFGSplit.cfg
+
+JAVACLASSFILES = \
+ $(CLASSDIR)$/$(PACKAGE)$/SplitterData.class \
+ $(CLASSDIR)$/$(PACKAGE)$/Splitter.class \
+ $(CLASSDIR)$/$(PACKAGE)$/FCFGSplit.class
+
+CUSTOMMANIFESTFILE = \
+ Manifest.mf
+
+MAXLINELENGTH = 100000
+
+#----- make a jar from compiled files ------------------------------
+
+JARCLASSDIRS = \
+ com$/sun$/star$/filter$/config$/tools$/utils \
+ com$/sun$/star$/filter$/config$/tools$/split
+
+JARTARGET = $(TARGET).jar
+
+JARCOMPRESS = TRUE
+
+# --- targets -----------------------------------------------------
+
+.INCLUDE : target.mk
+
+ALLTAR : $(OWNCOPY)
+
+.IF "$(JARTARGETN)" != ""
+$(JARTARGETN) : $(OWNCOPY)
+.ENDIF
+
+$(OWNCOPY) : $(CFGFILES)
+ -$(MKDIR) $(CLASSDIR)$/$(PACKAGE)
+ $(COPY) $? $(CLASSDIR)$/$(PACKAGE) && $(TOUCH) $@
+
+run :
+ @$(MKDIR) c:\temp\fragments
+ @$(JAVA) -jar $(CLASSDIR)$/FCFGSplit.jar debug=4 xmlfile=o:/src680/src.m7/officecfg/registry/data/org/openoffice/Office/TypeDetection.xcu outdir=c:/temp/fragments