de.init.its.api.process
Class OdtStyleConfiguration

java.lang.Object
  extended by de.init.its.api.process.OdtStyleConfiguration

public class OdtStyleConfiguration
extends java.lang.Object

ODT File styling configuration. This class may be used to load the correct styling for all implemented ITS Data Categories inside a LibreOffice Writer Document. This class provides the styling configuration in any case. It is assumed that a CSS like file name mlw-global.css exists and tries to load it, if this file does not exist or has incorrect syntax a default configuration is provided:

.translate 
{                                                                                   
        background-color: #aaffaa;                                                                
}                                                                                         
                                                                                                              
.localizationnote 
{                                                                           
        text-overline-style: solid; text-overline-width: bold; text-overline-color: font-color;   
}                                                                                             
                                                                                                      
.terminology 
{                                                                                
        text-overline-style: solid; text-overline-width: bold; text-overline-color: #ffffff;      
}                                                                                             
                                                                                                      
 .localefilter 
 {                                                                               
        text-overline-style: solid; text-overline-width: bold; text-overline-color: #000099;
 }


Constructor Summary
OdtStyleConfiguration()
           
 
Method Summary
static java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getStyleMapping()
          returns the style mapping (wether the externally configured one, or a default mapping, if external file contains syntax errors)
static java.util.Map<java.lang.String,java.lang.String> getStyleMappingForDataCategory(ItsAttributes.DataCategories datacategory)
          Returns the style mapping for a specific ItsAttributes.DataCategories
static java.util.Map<java.lang.String,java.lang.String> getUnoStyleMappingForDataCategory(ItsAttributes.DataCategories datacategory)
           
static void load(java.net.URL resource)
           
protected static void loadConfig(java.net.URL resource)
          two pass, no lookahead simple css file parser routine. loads an externally configured css file named 'mlw-global.css'.
protected static void loadDefaultConfig()
          if loading an external files fails, initialise the style mapping using these hard-coded styles
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OdtStyleConfiguration

public OdtStyleConfiguration()
Method Detail

load

public static void load(java.net.URL resource)

loadDefaultConfig

protected static void loadDefaultConfig()
if loading an external files fails, initialise the style mapping using these hard-coded styles


loadConfig

protected static void loadConfig(java.net.URL resource)
                          throws java.lang.Exception
two pass, no lookahead simple css file parser routine. loads an externally configured css file named 'mlw-global.css'.

Throws:
java.lang.Exception

getStyleMapping

public static java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getStyleMapping()
returns the style mapping (wether the externally configured one, or a default mapping, if external file contains syntax errors)

Returns:
a mapping between the data category name ItsAttributes.DataCategories and the style values applied for an odt file reconversion

getStyleMappingForDataCategory

public static java.util.Map<java.lang.String,java.lang.String> getStyleMappingForDataCategory(ItsAttributes.DataCategories datacategory)
Returns the style mapping for a specific ItsAttributes.DataCategories

Parameters:
datacategory - the ItsAttributes.DataCategories to get the styling
Returns:
the mapping for the styles

getUnoStyleMappingForDataCategory

public static java.util.Map<java.lang.String,java.lang.String> getUnoStyleMappingForDataCategory(ItsAttributes.DataCategories datacategory)

main

public static void main(java.lang.String[] args)