summaryrefslogtreecommitdiff
path: root/filter/source/config/tools
diff options
context:
space:
mode:
Diffstat (limited to 'filter/source/config/tools')
-rw-r--r--filter/source/config/tools/Manifest.mf4
-rwxr-xr-xfilter/source/config/tools/merge/pyAltFCFGMerge591
-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
8 files changed, 1756 insertions, 0 deletions
diff --git a/filter/source/config/tools/Manifest.mf b/filter/source/config/tools/Manifest.mf
new file mode 100644
index 000000000000..91387715ae71
--- /dev/null
+++ b/filter/source/config/tools/Manifest.mf
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Created-By: Sun Microsystems, Inc.
+Main-Class: MergeApp
+Class-Path: .
diff --git a/filter/source/config/tools/merge/pyAltFCFGMerge b/filter/source/config/tools/merge/pyAltFCFGMerge
new file mode 100755
index 000000000000..a44a4bb81d29
--- /dev/null
+++ b/filter/source/config/tools/merge/pyAltFCFGMerge
@@ -0,0 +1,591 @@
+#!/bin/env python
+#_____________________________________________
+# Caolan McNamara caolanm@redhat.com
+# converted from original java written by Andreas Schluens so we can continue
+# to build 680 OpenOffice.org series without java
+# this is not really a replacement for the existing java tool, just the
+# minimum required to make it work for now, the existing tool is still
+# the canonical base, changes to it will have to be mirrored here until
+# there is a java which is available for use by all
+#_____________________________________________
+
+import sys, string, os.path
+
+CFGFILE = os.environ["SOLARVER"] + "/" + os.environ["INPATH"] + "/inc/l10ntools/FCFGMerge.cfg"
+
+PROP_XMLVERSION = "xmlversion" # // <= global cfg file
+PROP_XMLENCODING = "xmlencoding" # // <= global cfg file
+PROP_XMLPATH = "xmlpath" # // <= global cfg file
+PROP_XMLPACKAGE = "xmlpackage" # // <= global cfg file
+PROP_SETNAME_TYPES = "setname_types" # // <= global cfg file
+PROP_SETNAME_FILTERS = "setname_filters" # // <= global cfg file
+PROP_SETNAME_LOADERS = "setname_frameloaders" # // <= global cfg file
+PROP_SETNAME_HANDLERS = "setname_contenthandlers" # // <= global cfg file
+PROP_SUBDIR_TYPES = "subdir_types" # // <= global cfg file
+PROP_SUBDIR_FILTERS = "subdir_filters" # // <= global cfg file
+PROP_SUBDIR_LOADERS = "subdir_frameloaders" # // <= global cfg file
+PROP_SUBDIR_HANDLERS = "subdir_contenthandlers" # // <= global cfg file
+PROP_EXTENSION_XCU = "extension_xcu" # // <= global cfg file
+PROP_EXTENSION_PKG = "extension_pkg" # // <= global cfg file
+PROP_DELIMITER = "delimiter" # // <= global cfg file
+PROP_TRIM = "trim" # // <= global cfg file
+PROP_DECODE = "decode" # // <= global cfg file
+PROP_FRAGMENTSDIR = "fragmentsdir" # // <= cmdline
+PROP_TEMPDIR = "tempdir" # // <= cmdline
+PROP_OUTDIR = "outdir" # // <= cmdline
+PROP_PKG = "pkg" # // <= cmdline
+PROP_TCFG = "tcfg" # // <= cmdline
+PROP_FCFG = "fcfg" # // <= cmdline
+PROP_LCFG = "lcfg" # // <= cmdline
+PROP_CCFG = "ccfg" # // <= cmdline
+PROP_LANGUAGEPACK = "languagepack" # // <= cmdline
+PROP_ITEMS = "items" # // <= pkg cfg files!
+
+#---begin java.util.Properties copy---#
+"""
+
+An incomplete clean room implementation of
+java.util.Properties written in Python.
+
+Copyright (C) 2002,2004 - Ollie Rutherfurd <oliver@rutherfurd.net>
+
+Based on:
+
+ http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html
+
+Missing:
+
+ - Currently, u\XXXX sequences are escaped when saving, but not unescaped
+ when read..
+
+License: Python License
+
+Example Usage:
+
+>>> from properties import Properties
+>>> props = Properties()
+>>> props['one'] = '1'
+>>> props['your name'] = "I don't know"
+>>> print '\n'.join(props.keys())
+your name
+one
+>>> from StringIO import StringIO
+>>> buff = StringIO()
+>>> props.store(buff, "a little example...")
+>>> buff.seek(0)
+>>> print buff.read()
+# a little example...
+your\ name=I\ don\'t\ know
+one=1
+>>> print props['your name']
+I don't know
+
+$Id: pyAltFCFGMerge,v 1.3 2007-12-07 10:57:44 vg Exp $
+
+"""
+
+__all__ = ['Properties']
+
+
+def dec2hex(n):
+
+ h = hex(n)[2:].upper()
+ return '\\u' + '0' * (4 - len(h)) + h
+
+
+def escapestr(s):
+
+ buff = []
+ # QUESTION: escape leading or trailing spaces?
+ for c in s:
+ if c == '\\':
+ buff.append('\\\\')
+ elif c == '\t':
+ buff.append('\\t')
+ elif c == '\n':
+ buff.append('\\n')
+ elif c == '\r':
+ buff.append('\\r')
+ elif c == ' ':
+ buff.append('\\ ')
+ elif c == "'":
+ buff.append("\\'")
+ elif c == '"':
+ buff.append('\\"')
+ elif c == '#':
+ buff.append('\\#')
+ elif c == '!':
+ buff.append('\\!')
+ elif c == '=':
+ buff.append('\\=')
+ elif 32 <= ord(c) <= 126:
+ buff.append(c)
+ else:
+ buff.append(dec2hex(c))
+
+ return ''.join(buff)
+
+
+# TODO: add support for \uXXXX?
+def unescapestr(line):
+
+ buff = []
+ escape = 0
+ for i in range(len(line)):
+ c = line[i]
+ if c == '\\':
+ if escape:
+ escape = 0
+ buff.append('\\')
+ continue
+ else:
+ # this is to deal with '\'
+ # acting as a line continuation
+ # character
+ if i == len(line) - 1:
+ buff.append('\\')
+ break
+ else:
+ escape = 1
+ continue
+ elif c == 'n':
+ if escape:
+ escape = 0
+ buff.append('\n')
+ continue
+ elif c == 'r':
+ if escape:
+ escape = 0
+ buff.append('\r')
+ continue
+ elif c == 't':
+ if escape:
+ escape = 0
+ buff.append('\t')
+ continue
+
+ buff.append(c)
+
+ # make sure escape doesn't stay one
+ # all expected escape sequences either break
+ # or continue, so this should be safe
+ if escape:
+ escape = 0
+
+ return ''.join(buff)
+
+
+
+class Properties(dict):
+
+ def __init__(self, defaults={}):
+ dict.__init__(self)
+ for n,v in defaults.items():
+ self[n] = v
+
+ def __getittem__(self,key):
+ try:
+ return dict.__getittem__(self,key)
+ except KeyError:
+ return None
+
+ def read(self,filename):
+ """
+ Reads properties from a file (java Property class
+ reads from an input stream -- see load()).
+ """
+ f = None
+ try:
+ f = open(filename)
+ self.load(f)
+ finally:
+ if f:
+ f.close()
+
+ def load(self, buff):
+ """
+ Reads properties from a stream (StringIO, file, etc...)
+ """
+ props = readprops(buff)
+ for n,v in props.iteritems():
+ self[n] = v
+
+def readprops(buff):
+
+ name,value = None,''
+ props = {}
+ continued = 0
+
+ while 1:
+ line = buff.readline()
+ if not line:
+ break
+ line = line.strip()
+
+ # empty line
+ if not line:
+ continue
+
+ # comment
+ if line[0] in ('#','!'):
+ continue
+
+ # find name
+ i,escaped = 0,0
+ while i < len(line):
+ c = line[i]
+
+ if c == '\\':
+ if escaped:
+ escaped = 0
+ else:
+ escaped = 1
+ i += 1
+ continue
+
+ elif c in (' ', '\t', ':', '=') and not escaped:
+ name = unescapestr(line[:i])
+ break
+
+ # make sure escaped doesn't stay on
+ if escaped:
+ escaped = 0
+
+ i += 1
+
+ # no dlimiter was found, name is entire line, there is no value
+ if name == None:
+ name = unescapestr(line.lstrip())
+
+ # skip delimiter
+ while line[i:i+1] in ('\t', ' ', ':', '='):
+ i += 1
+
+ value = unescapestr(line[i:].strip())
+ while value[-1:] == '\\':
+ value = value[:-1] # remove \
+ line = buff.readline()
+ if not line:
+ break
+ value += unescapestr(line.strip())
+
+ #print 'value:',value ##
+ props[name] = value
+
+ return props
+#---end java.util.Properties copy---#
+
+# Its a simple command line tool, which can merge different XML fragments
+# together. Such fragments must exist as files on disk, will be moved into
+# one file together on disk.
+#
+# @author Andreas Schluens
+#
+def run(sCmdLine):
+ printCopyright()
+
+ aCfg = ConfigHelper(CFGFILE, sCmdLine)
+
+ # help requested?
+ if aCfg.isHelp():
+ printHelp()
+ sys.exit(-1)
+
+ #create new merge object and start operation
+ aMerger = Merger(aCfg)
+ aMerger.merge()
+
+ sys.exit(0)
+
+#prints out a copyright message on stdout.
+def printCopyright():
+ print "FCFGMerge"
+ print "Copyright: 2003 by Red Hat, Inc., based on FCFGMerge.java` by Sun"
+ print "All Rights Reserved."
+
+#prints out a help message on stdout.
+def printHelp():
+ print "____________________________________________________________"
+ print "usage: FCFGMerge cfg=<file name>"
+ print "parameters:"
+ print "\tcfg=<file name>"
+ print "\t\tmust point to a system file, which contains"
+ print "\t\tall neccessary configuration data for the merge process."
+ print "\tFurther cou can specify every parameter allowed in the"
+ print "\tconfig file as command line parameter too, to overwrite"
+ print "\tthe value from the file."
+
+def StringTokenizer(mstring, separators, isSepIncluded=0):
+#Return a list of tokens given a base string and a string of
+#separators, optionally including the separators if asked for"""
+ token=''
+ tokenList=[]
+ for c in mstring:
+ if c in separators:
+ if token != '':
+ tokenList.append(token)
+ token=''
+ if isSepIncluded:
+ tokenList.append(c)
+ else:
+ token+=c
+ if token:
+ tokenList.append(token)
+ return tokenList
+
+# can be used to analyze command line parameters
+# and merge it together with might existing config
+# files. That provides the possibility to overwrite
+# config values via command line parameter.
+#
+# @author Andreas Schluens
+class ConfigHelper:
+ def __init__(self, sPropFile, lCommandLineArgs):
+ self.m_bEmpty = 1
+ # first load prop file, so its values can be overwritten
+ # by command line args later
+ # Do it only, if a valid file name was given.
+ # But in case this file name is wrong, throw an exception.
+ # So the outside code can react!
+ if sPropFile != None and len(sPropFile) > 0:
+ self.props = Properties()
+ self.props.read(sPropFile)
+
+ count = 0
+ if lCommandLineArgs != None:
+ count = len(lCommandLineArgs)
+ self.m_bEmpty = (count < 1)
+
+ print lCommandLineArgs, "and len is", count
+ for arg in range(count):
+ # is it a named-value argument?
+ # Note: We ignores double "=" signs! => search from left to right
+ pos = lCommandLineArgs[arg].find('=')
+ if pos != -1:
+ sArg = lCommandLineArgs[arg][0:pos]
+ sValue = lCommandLineArgs[arg][pos+1:]
+ self.props[sArg] = sValue
+ continue
+
+ # is it a boolean argument?
+ # Note: Because "--" and "-" will be interpreted as the same
+ # we search from right to left!
+ pos = string.rfind(lCommandLineArgs[arg], '-')
+ if pos == -1:
+ pos = lCommandLineArgs[arg].rfind('/')
+ if pos != -1:
+ sArg = lCommandLineArgs[arg][pos+1:]
+ self.props[sArg] = 1
+ continue
+
+ raise Exception("Invalid command line detected. The argument \""+\
+ lCommandLineArgs[arg]+"\" use an unsupported format.")
+
+# for item in self.props:
+# print item, '->', self.props[item]
+
+ def isHelp(self):
+ return (
+ (self.props.has_key("help")) or
+ (self.props.has_key("?") ) or
+ (self.props.has_key("h") )
+ )
+
+ def getValue(self, sProp):
+ if not self.props.has_key(sProp):
+ raise Exception("The requested config value \""+sProp+"\" "\
+ "does not exists!");
+ return self.props[sProp];
+
+ def getValueWithDefault(self, sProp, default):
+ if not self.props.has_key(sProp):
+ return default;
+ return self.props[sProp];
+
+ def getStringList(self, sProp, sDelimiter, bTrim, bDecode):
+ if not self.props.has_key(sProp):
+ raise Exception("The requested config value \""+sProp+"\" does "\
+ "not exists!");
+ sValue = self.props[sProp]
+
+ lValue = []
+ lTokens = StringTokenizer(sValue, sDelimiter)
+ for sToken in lTokens:
+ if bTrim:
+ sToken = string.strip(sToken)
+ # remove ""
+ if ((bDecode) and (sToken.find("\"") == 0) and \
+ (sToken.rfind("\"") == len(sToken)-1)):
+ sToken = sToken[1, len(sToken)-1]
+ lValue.append(sToken)
+
+ return lValue
+
+def generateHeader(sVersion, sEncoding, sPath, sPackage, bLanguagePack):
+ sHeader = "<?xml version=\""
+ sHeader += sVersion
+ sHeader += "\" encoding=\""
+ sHeader += sEncoding
+ sHeader += "\"?>\n"
+
+ if bLanguagePack:
+ sHeader += "<oor:component-data oor:package=\""
+ sHeader += sPath
+ sHeader += "\" oor:name=\""
+ sHeader += sPackage
+ sHeader += "\" xmlns:install=\"http://openoffice.org/2004/installation\""
+ sHeader += " xmlns:oor=\"http://openoffice.org/2001/registry\""
+ sHeader += " xmlns:xs=\"http://www.w3.org/2001/XMLSchema\""
+ sHeader += " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"
+ else:
+ sHeader += "<oor:component-data xmlns:oor=\"http://openoffice.org/2001/registry\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" oor:package=\""
+ sHeader += sPath
+ sHeader += "\" oor:name=\""
+ sHeader += sPackage
+ sHeader += "\">\n"
+ return sHeader
+
+def generateFooter():
+ return "</oor:component-data>\n"
+
+# can merge different xml fragments together.
+#
+# @author Caolan McNamara converted from the original java by Andreas Schluens
+#
+class Merger:
+ def __init__(self, aCfg):
+ self.m_aCfg = aCfg
+
+ self.m_aFragmentsDir = self.m_aCfg.getValue(PROP_FRAGMENTSDIR)
+
+ sDelimiter = self.m_aCfg.getValue(PROP_DELIMITER)
+ bTrim = self.m_aCfg.getValue(PROP_TRIM)
+ bDecode = self.m_aCfg.getValue(PROP_DECODE)
+
+ try:
+ aFcfg = ConfigHelper(self.m_aCfg.getValue(PROP_TCFG), None)
+ self.m_lTypes = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode)
+ except:
+ self.m_lTypes = []
+
+ try:
+ aFcfg = ConfigHelper(self.m_aCfg.getValue(PROP_FCFG), None)
+ self.m_lFilters = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode)
+ except:
+ self.m_lFilters = []
+
+ try:
+ aFcfg = ConfigHelper(self.m_aCfg.getValue(PROP_LCFG), None)
+ self.m_lLoaders = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode)
+ except:
+ self.m_lLoaders = []
+
+ try:
+ aFcfg = ConfigHelper(self.m_aCfg.getValue(PROP_CCFG), None)
+ self.m_lHandlers = aFcfg.getStringList(PROP_ITEMS, sDelimiter, bTrim, bDecode)
+ except:
+ self.m_lHandlers = []
+
+ def merge(self):
+ sPackage = self.m_aCfg.getValue(PROP_PKG)
+
+ print "create package \""+sPackage+"\" ..."
+ print "generate package header ... "
+
+ sBuffer = generateHeader(\
+ self.m_aCfg.getValue(PROP_XMLVERSION ),\
+ self.m_aCfg.getValue(PROP_XMLENCODING),\
+ self.m_aCfg.getValue(PROP_XMLPATH ),\
+ self.m_aCfg.getValue(PROP_XMLPACKAGE ),\
+ self.m_aCfg.getValueWithDefault(PROP_LANGUAGEPACK, False))
+
+ # counts all transfered fragments
+ # Can be used later to decide, if a generated package file
+ # contains "nothing"!
+ nItemCount = 0
+
+ for i in range(4):
+ sSetName = None
+ sSubDir = None
+ lFragments = None
+
+ try:
+ if i == 0: #types
+ print "generate set for types ... "
+ sSetName = self.m_aCfg.getValue(PROP_SETNAME_TYPES)
+ sSubDir = self.m_aCfg.getValue(PROP_SUBDIR_TYPES )
+ lFragments = self.m_lTypes
+ elif i == 1: # filters
+ print "generate set for filter ... "
+ sSetName = self.m_aCfg.getValue(PROP_SETNAME_FILTERS)
+ sSubDir = self.m_aCfg.getValue(PROP_SUBDIR_FILTERS )
+ lFragments = self.m_lFilters
+ elif i == 2: # loaders
+ print "generate set for frame loader ... "
+ sSetName = self.m_aCfg.getValue(PROP_SETNAME_LOADERS)
+ sSubDir = self.m_aCfg.getValue(PROP_SUBDIR_LOADERS )
+ lFragments = self.m_lLoaders
+ elif i == 3: # handlers
+ print "generate set for content handler ... "
+ sSetName = self.m_aCfg.getValue(PROP_SETNAME_HANDLERS)
+ sSubDir = self.m_aCfg.getValue(PROP_SUBDIR_HANDLERS )
+ lFragments = self.m_lHandlers
+ except:
+ continue
+
+ nItemCount = nItemCount + len(lFragments)
+
+ sBuffer = sBuffer + self.getFragments(\
+ os.path.join(self.m_aFragmentsDir, sSubDir), \
+ sSetName, lFragments, 1)
+
+ print "generate package footer ... "
+ sBuffer = sBuffer + generateFooter()
+
+ # Attention!
+ # If the package seem to be empty, it make no sense to generate a
+ # corresponding xml file. We should suppress writing of this file on
+ # disk completly ...
+ if nItemCount < 1:
+ print "Package is empty and will not result into a xml file on "\
+ "disk!? Please check configuration file."
+ return
+ print "package contains "+str(nItemCount)+" items"
+
+ aPackage = open(sPackage, 'w')
+ print "write temp package \""+sPackage
+ aPackage.write(sBuffer)
+
+ def getFragments(self, aDir, sSetName, lFragments, nPrettyTabs):
+ sBuffer = ''
+ sExtXcu = self.m_aCfg.getValue(PROP_EXTENSION_XCU);
+
+ if len(lFragments) < 1:
+ return sBuffer
+
+ for tabs in range(nPrettyTabs):
+ sBuffer = sBuffer + "\t"
+ sBuffer = sBuffer + "<node oor:name=\""+sSetName+"\">\n"
+ nPrettyTabs = nPrettyTabs + 1
+
+ for sFragment in lFragments:
+ sFragPath = os.path.join(aDir, sFragment+"."+sExtXcu)
+ try:
+ aFragmentFile = open(sFragPath)
+ except:
+ # handle simple files only and check for existence!
+ raise Exception("fragment \""+sFragPath+"\" does not exists.")
+
+ print "merge fragment \""+sFragPath+"\" ..."
+ sBuffer = sBuffer + aFragmentFile.read()
+
+ sBuffer = sBuffer + "\n"
+
+ nPrettyTabs = nPrettyTabs - 1
+ for tabs in range(nPrettyTabs):
+ sBuffer = sBuffer + "\t"
+ sBuffer = sBuffer + "</node>\n"
+ return sBuffer
+
+run(sys.argv)
+
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