Java 5 + Writer4LaTeX + bugfixes

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@11 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2009-03-30 07:38:37 +00:00
parent be54e842f4
commit 9241a44f6c
83 changed files with 2373 additions and 631 deletions

View file

@ -2,14 +2,15 @@
############################################################################
# This is the Ant build file for writer2latex
# Original: Sep 2004 (mgn)
# version 1.0 (2009-03-02)
# version 1.2 (2009-03-30)
############################################################################
-->
<project name="w2l" default="help" basedir=".">
<!-- set this property to the location of your SO/OOo installation -->
<!--<property name="OFFICE_HOME" location="c:/Program Files/OpenOffice.org 2.4"/>-->
<property name="OFFICE_HOME" location="/opt/openoffice.org2.4" />
<property name="OFFICE_HOME" location="/opt/openoffice.org/basis3.0" />
<property name="URE_HOME" location="/opt/openoffice.org/ure" />
<description>writer2latex - build file</description>
@ -34,8 +35,8 @@
<!-- configure the directories -->
<property name="jarfile" value="writer2latex"/>
<property name="basename" value="writer2latex10"/>
<property name="distrofile" value="${basename}beta.zip" />
<property name="basename" value="writer2latex11"/>
<property name="distrofile" value="${basename}1.zip" />
<!--<property name="sourcedistrofile" value="${basename}source.zip" />-->
<property name="src" location="source/java"/>
<property name="source.distro" location="source/distro" />
@ -48,8 +49,10 @@
<!-- classpath for the application; needs java-uno classes -->
<path id="main.class.path">
<!-- java uno classes -->
<filelist dir="${URE_HOME}/share/java"
files="jurt.jar,juh.jar,ridl.jar"/>
<filelist dir="${OFFICE_HOME}/program/classes"
files="jurt.jar,unoil.jar,ridl.jar,juh.jar"/>
files="unoil.jar"/>
<!-- additional uno interfaces generated from idl -->
<pathelement path="${source.idl}/writer2latex"/>
<pathelement path="${source.idl}/writer2xhtml"/>
@ -67,7 +70,7 @@
<javac srcdir="${src}"
destdir="${classes}"
encoding="us-ascii"
source="1.4"
source="1.5"
debug="on">
<classpath refid="main.class.path"/>
</javac>
@ -185,11 +188,36 @@
<!-- delete the jar for this extension -->
<delete file="${tmp}/writer2xhtml-filter.jar" />
<!-- Third extension: writer4latex.oxt -->
<!-- Create jar with relevant files -->
<jar jarfile="${tmp}/writer4latex.jar">
<fileset dir="${classes}">
<patternset>
<include name="org/openoffice/da/comp/w2lcommon/helper/**/*"/>
<include name="org/openoffice/da/comp/writer4latex/**/*"/>
</patternset>
</fileset>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Class-Path" value="jaxp.jar parser.jar"/>
<!-- OOo needs this to register the filter: -->
<attribute name="RegistrationClassName" value="org.openoffice.da.comp.writer4latex.W4LRegistration" />
</manifest>
</jar>
<!-- Pack extension -->
<zip destfile="${target.lib}/writer4latex.oxt">
<zipfileset dir="source/oxt/writer4latex" prefix="" />
<zipfileset dir="${tmp}" includes="writer4latex.jar" />
</zip>
<!-- delete the jar for this extension -->
<delete file="${tmp}/writer4latex.jar" />
<!-- Third extension: xhtml-config-package.oxt (xhtml sample configuration package) -->
<!-- Fourth extension: xhtml-config-package.oxt (xhtml sample configuration package) -->
<zip destfile="${target.lib}/xhtml-config-sample.oxt" basedir="source/oxt/xhtml-config-sample"/>
</target>
@ -208,7 +236,7 @@
<!-- Add jar and oxt's -->
<zipfileset dir="${target.lib}" prefix="${basename}"
includes="${jarfile}.jar,writer2latex.oxt,writer2xhtml.oxt,xhtml-config-sample.oxt"/>
includes="${jarfile}.jar,writer2latex.oxt,writer2xhtml.oxt,writer4latex.oxt,xhtml-config-sample.oxt"/>
</zip>
<!-- Pack the source distribution -->

View file

@ -1,7 +1,7 @@
Writer2LaTeX version 1.0 beta
=============================
Writer2LaTeX version 1.1.1 (development release)
================================================
This is the distribution of Writer2LaTeX version 1.0 beta
This is the distribution of Writer2LaTeX version 1.1.1
Latest version can be found at the web site
http://writer2latex.sourceforge.net

View file

@ -1,342 +1,15 @@
Changelog for Writer2LaTeX version 0.5 -> 1.0
Changelog for Writer2LaTeX version 1.0 -> 1.2
---------- version 1.0 beta ----------
---------- version 1.1.1 ----------
[w2x] Added german translation from Raphael Fetzer
[all] Bugfix: Paragraphs containing only fields are no longer lost
[w2x] Do not export character formatting in toc
[w4l] Added Writer4LaTeX extension
[w2l] Bugfix: Added missing hyperlink targets for frames and graphics
[all] Buildfile is adapted to work with separated ure and office (OOo 3.0+)
[w2x] Bugfix: Fixed null pointer exception for text frames without height attribute
[all] Bugfix: Corrected path to descriptions in oxt
[w2l] Added spanish translation from Emilio José Juárez Pérez
[w2x] Bugfix: Corrected typo in german translation of navigation bar
[w2l] Added support for bitmap graphics with backend=dvips
[all] No longer create source distribution (SourceForge provides tarballs generated
directly from SVN)
[all] Added german description to filters
[w2l] Bugfix: Fixed crash for tables with fewer columns than rows
---------- version 0.9.4 -----------
[w2l] Added sample LaTeX configuration for Google Docs from Elefterios Stamatogiannakis
[w2x] Added MathML named entites table from Bruno Mascret
[all] Bugfix: Locked controls are now updated correctly when the dialog is displayed
[w2l] New backed xetex (initial prototype)
[c2x] Bugfix: Corrected wrong calculation of column number for columns with two letters
(affected apply_print_ranges=true)
[c2x] Bugfix: Ensure that we always export a document, even if there are no defined
print ranges (affected apply_print_ranges=true)
[c2x] Bugfix: Now also exports uplink for spreadsheets
[w2l] Bugfix: No longer incorrectly assume math mode when exporting plain text
[all] Added support for the new Writer notes/annotations (which now can contain several
formatted paragraphs rather than a single, plain text paragraph)
[all] Added russian and ukrainian translations from Volodymyr Volkov
[all] Bugfix: Removed PreferredFilter propery from type definitions (makes sense
only for import filters)
[all] Changed unix startscript: By default assume that w2l and writer2latex are
in the same directory (thus using dirname $0), and assume that the java executable
is either in the PATH or the location is defined by JAVA_HOME
(which these assumptions manual editing of the script is usually not required)
[all] Added french translation from Jacques Lamoine
[w2l] The option simple_table_limit now refers to the *total* width of the table
measured in characters rather than the width of individual cells
[w2x] Bugfix: The position and dimensions of a frame is now calculated correctly
(previously the size of margins, borders and padding was not taken into account)
[w2l] The inputencoding utf8 now uses the LaTeX standard rather than ucs.sty
(which only supports latin and cyrillic alphabets)
[w2l] New style map family "text-attribute" to map text formatting to LaTeX code
currently only the values "bold", "italic", "small-caps", "subscript" and
"superscript" are supported, and the verbatim attribute is not supported
---------- version 0.9.3 -----------
[all] All source files are now US ASCII; added encoding of source files to build file
[all] Added more File-based methods to the API
[w2l] The paper sizes defined by standard LaTeX document classes are now
identified and added as global options (a4paper, a5paper, b5paper,
letterpaper, legalpaper, executivepaper, including landscape variants)
[w2x] Bugfix: Now only exports the name of a text box if it actually exists!
[w2l] Removed option "pagecolor" from \hypersetup (this option has been removed
from the hyperref package)
[all] Filter bugfix: The new option name "ConfigURL" is now used in the dialogs
[all] Added (partial) german localization from Martin Friedrich
[w2x] New option use_named_entities: When set to true, named character entities
as defined in xhtml 1.0 are used (currently only those within ISO latin 1)
[w2x] Characters not supported by the encoding are now exported as numeric
character entities
[w2x] Bugfix: Internal hyperlinks to tables, sections, frames and graphics now
works correctly
[w2x] Bugfix: Subtables are no longer exported with an id attribute
[all] Bugfix: table:number-rows-repeated is now treated correctly
[c2x] New option: apply_print_ranges
---------- version 0.9.2 -----------
[c2x] No longer exports <tbody> for tables without <thead>
[all] Renamed "class" to "family" in style maps to avoid confusion
with css classes (old name is still accepted)
[all] Filter: Renamed template and config options to the more
descriptive TemplateURL and ConfigURL
[all] API: Added convenience method convert(File) to Converterer
[all] API: Added convenience method write(File) to ConverterResult
[all] New option: save_images_in_subdir
[all] Use Robert Harders public domain Base64 decoder (replacing
the non-standard decoder in sun.misc)
[all] MIMETypes used in the API are now defined in writer2latex.api.MIMETypes
[all] Renamed the option keep_image_size to original_image_size (the meaning of
this option was confusing). The old name is still recognized.
[all] OOo now saves SVM files with a MIME type in the package format.
This is now recognized by w2l, which implies that GraphicConverter
implementations can use SVM files from a package
[w2x] New uno service org.openoffice.da.writer2xhtml.BatchConverter
provides batch conversion via uno. Interaction with the user can be implemented
using the interface org.openoffice.da.writer2xhtml.XBatchHandler
[w2x] Batch processing from the command line can now be cancelled (using the Enter key)
[all] API: Created new API for batch conversion
[w2l] Bugfix: Tables were in rare cases exported with invalid row alignment
(null character)
[w2x] Filter ui bugfix: Default value for RepeatLevels changed from
6 to 5 (6 was not valid)
[w2x] Filter: The xhtml export now uses it's own custom configuration
(writer2xhtml.xml, also stored in the user configuration of OOo)
[w2l] Tabstops are now exported as \ \ , which usually is closer to
the expectations of the user (and is not ignored at the beginning of a par.)
[w2x] Empty paragraphs are now (again!) exported with a &nbsp;
(otherwise they are ignored by the browser)
[w2x] Xhtml specific options no longer starts with the prefix xhtml_
(is still accepted for backwards compatibility)
[all] Filter: Added display name and description to the extensions
[w2x] BatchConverter: Localized alternative text for icons
[w2b] Bugfix: Replace ";" with "and" also in in editor field
[w2x] Added new options xslt_path to give the path to the XSL
transformation from w3c (also in the ui)
[all] Filter: Optimized the size of the extensions by excluding code not
relevant for the format(s) supported by the extension
[all] Separated LaTeX and xhtml code. As a consequence, it is possible to build
and run Writer2LaTeX with support for only one format
[c2x] New options display_hiddens_rows_cols and display_filtered_rows_cols. If
set to false (default), rows and columns that are hidden or filtered are not
exported
[all] Filter: Translated dialogs to Danish
[all] Filter: Raised requirement in description.xml to OOo 2.2
(needs support for localized dialogs)
[w2l] Added ui option "Support additional symbols". This sets all the
options use_pifont, use_ifsym, use_wasysym, use_eurosym and use_tipa.
The pseudo-option additional_symbols can be used in the LockedOptions list
[all] Bugfix: The class w2l.xmerge.DOMDocument did not throw IOException when
trying to read a non-xml document
[w2x] Bugfix: The convert method did not restart document enumeration
(relevant if it's called several times for the same converter instance)
[w2x] API: Created new API for batch conversion, which is also moved
from Application to a separate class
[all] API: The API now uses a interface to the configuration rather than using
the class writer2latex.util.Config
[w2x] Style of header/footer in index pages (batch conversion) aligned with
document header/footer
[all] Added package descriptions to the javadoc
[w2l] Always export non-breaking space as ~ even if inputenc supports it
directly - non-breaking spaces are usually not easy to identify in text editors
---------- version 0.9.1 -----------
[w2x] New option: xhtml_add_bom (default false), if set to true
a BOM will be added at the start of generated xhtml files
[w2x] Fixed typo in filter name: XHTML 1.0 + MathML 2.0 should be
XHTML 1.1 + MathML 2.0
[w2l] Added support for the latin language
[w2l] Removed article.xml from w2l - it now belongs to Writer4LaTeX
[all] The distribution now includes a sample configuration
package: xhtml-config-sample.oxt
[all] Filter: Split the filter component into two extensions:
writer2latex.oxt for LaTeX and BibTeX, writer2xhtml.oxt for xhtml
The build file now produces optimized jars for each application, and the
standalone jar does not contain any uno code
[w2l] Added (imcomplete) support for some of the Euclid fonts from Design Science
[w2b] Replace ";" with "and" in author field (multiple authors)
[w2l] Added support for formulas inserted by OOoLaTeX
[w2x] Now adds mini-toc to the element with id "panel" if it exists in the xhtml
template
[w2l] API: Added new api for standalone StarMath converter
Writer2LaTeX api: writer2latex.api.StarMathConverter
Uno service: org.openoffice.da.writer2latex.StarMathConverter
[all] Filter: Added dialogs to all filters (w2l, w2x and c2x)
[w2l] Vector graphics (except wmf) is now exported as pdf if backend is pdftex
[all] API: In the GraphicConverter interface, the method
supportsFormat has been replaced with the method supportsConversion
[w2l] Added support for *numbered* display equations: If paragraph
contains exactly one equation and exactly one sequence field (and otherwise
only whitespace and brackets), it treated as a numbered equation
[w2l] I18n: If several characters in a row are converted using math mode, they
are now combined (ie. ${\alpha}{\beta}$ rather than ${\alpha}$${\beta}$)
[all] Extended FilterData to support the property AutoCreate. If set to true,
the configuration file will be created if it does not exist
[w2l] Even if formatting=IGNORE_ALL, we should still obey character style maps
from the configuration
[w2x] Added german translation of navigation pane (w2l.util.L10n)
[all] Bugfix: A paragraph with a bibliographic reference as the only
content was considered empty (and the reference was lost)
[w2l] Use url decoding when creating file names for linked sections
(in order to obtain more readable file names)
[w2l] Avoid redundant \mathit in StarMathConverter in some rare
cases (such as greek letters pasted into Math)
[w2l] Support formulas for sequence fields (only the most common
cases oow:Name, oow:Name+Number, oow:Name-Number and oow:Number)
[c2x] New options xhtml_display_hidden_sheets, xhtml_use_title_as_heading and
xhtml_use_sheet_names_as_headings
[o2x] New option xhtml_notes. If true notes (annotations) are exported to xhtml
comments, if false they are ignored
[c2x] Convert notes (annotations)
[w2l] Heading formatting: The prefix and suffix to the counter should not be
included in \thesection, but rather in the formatting. This means that the
prefix and suffix no longer will be exported if formatting=CONVERT_BASIC
[w2l] Added support for chapter references to reference marks and bookmarks
(if the marks are contained in a heading)
[w2l] New option external_bibtex_files gives a list of BibTeX files. If nonempty,
these files will be used instead of converting the actual bibliography marks
[w2l] New option metadata. If true, export metadata as \author,
\date and pdf metadata, as well as pdf metadata (if use_hyperref is true)
[all] Filters/API: Changed filternames to the more obvious
org.openoffice.da.writer2latex etc.
[w2l] Updated clean.xml and ultraclean.xml. Both configurations
now exports predefined Writer styles (like article.xml)
[w2x] New option: xhtml_repeat_levels defines the number of heading
levels to repeat when splitting a file (0 means no levels are repeated)
[w2x] Allow xhtml templates without header and footer elements
[w2x] Bugfix (w2l.office.ListCounter): OpenDocument does not use
numberings like 1.0.1 if a list level is missing, but rather 1.1.1
[all] Command line application now uses internal standard configurations
(*ultraclean.xml etc.)
[all] Command line application now accepts several configuration
files (by using the -config option more than once)
[w2x] Use text style for label when applying numbering to heading
[w2x] Added support for other list styes applied to headings
[w2x] Added support for text:restart-numbering, text:is-list-header on headings
[w2x] No longer add hr and [] to links in navigation (the template and style
sheet should take care of this)
[all] New filter configuration concept: Configuration packages containing an OOo
template, a w2l configuration and registry information to bind these together:
When a configuration package is installed in OOo, the configuration is added
to the filter ui, and is preselected for documents based on the OOo template
[all] Repackaging: Distribution files are included in source, build
file is extended to create the distribution; source distribution is separated
[all] Changed to new extension format (.oxt)
[all] Filter: Added messagebox to display the error in case an
exception happens during conversion
[all] Moved default configurations to jar; the FilterData property
can refer to these using the special url *filename.xml
[all] The filter now reads the FilterData property, which can be
used to specify options, configuration fil (url) and xhtml template (url)
[all] Raised requirement from Java 1.4 to Java 5

Binary file not shown.

Binary file not shown.

View file

@ -378,7 +378,7 @@ public abstract class ExportFilterBase implements
}
// Write out files
Iterator docEnum = dataOut.iterator();
Iterator<OutputFile> docEnum = dataOut.iterator();
// Remove the file name part of the url
String sNewURL = null;
@ -393,7 +393,7 @@ public abstract class ExportFilterBase implements
}
while (docEnum.hasNext() && sURL.startsWith("file:")) {
OutputFile docOut = (OutputFile)docEnum.next();
OutputFile docOut = docEnum.next();
if (dataOut.getMasterDocument()==docOut) {
// The master document is written to the XOutStream supplied

View file

@ -232,9 +232,9 @@ public class FilterDataParser {
}
// Read further configuration properties
Enumeration keys = props.keys();
Enumeration<String> keys = props.keys();
while (keys.hasMoreElements()) {
String sKey = (String) keys.nextElement();
String sKey = keys.nextElement();
if (!"ConfigURL".equals(sKey) && !"TemplateURL".equals(sKey) && !"AutoCreate".equals(sKey)) {
Object value = props.get(sKey);
if (AnyConverter.isString(value)) {

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2009-03-08)
* Version 1.2 (2009-03-26)
*
*/
@ -58,14 +58,14 @@ import writer2latex.api.MIMETypes;
public class GraphicConverterImpl2 implements GraphicConverter {
private XComponentContext xComponentContext;
private Hashtable importFilter;
private Hashtable exportFilter;
private Hashtable<String,String> importFilter;
private Hashtable<String,String> exportFilter;
private EPSCleaner epsCleaner;
public GraphicConverterImpl2(XComponentContext xComponentContext) {
this.xComponentContext = xComponentContext;
importFilter = new Hashtable();
importFilter = new Hashtable<String,String>();
importFilter.put(MIMETypes.BMP, "BMP - MS Windows");
//importFilter.put(MIMETypes.EMF, "EMF - MS Windows Metafile");
importFilter.put(MIMETypes.EPS, "EPS - Encapsulated PostScript");
@ -76,7 +76,7 @@ public class GraphicConverterImpl2 implements GraphicConverter {
importFilter.put(MIMETypes.TIFF, "TIF - Tag Image File");
importFilter.put(MIMETypes.WMF, "WMF - MS Windows Metafile");
exportFilter = new Hashtable();
exportFilter = new Hashtable<String,String>();
exportFilter.put(MIMETypes.BMP,"draw_bmp_Export");
//exportFilter.put(MIMETypes.EMF,"draw_emf_Export");
exportFilter.put(MIMETypes.EPS,"draw_eps_Export");

View file

@ -87,7 +87,7 @@ public abstract class OptionsDialogBase extends DialogBase implements
this.xMSF = null; // must be set properly by subclass
mediaProps = null;
sConfigNames = null;
lockedOptions = new HashSet();
lockedOptions = new HashSet<String>();
}
//////////////////////////////////////////////////////////////////////////
@ -163,7 +163,7 @@ public abstract class OptionsDialogBase extends DialogBase implements
private String[] sConfigNames;
// Set of locked controls
private HashSet lockedOptions;
private HashSet<String> lockedOptions;
//////////////////////////////////////////////////////////////////////////

View file

@ -35,14 +35,14 @@ import com.sun.star.beans.PropertyValue;
*/
public class PropertyHelper {
private Hashtable data;
private Hashtable<String, Object> data;
public PropertyHelper() {
data = new Hashtable();
data = new Hashtable<String, Object>();
}
public PropertyHelper(PropertyValue[] props) {
data = new Hashtable();
data = new Hashtable<String, Object>();
int nLen = props.length;
for (int i=0; i<nLen; i++) {
data.put(props[i].Name,props[i].Value);
@ -57,7 +57,7 @@ public class PropertyHelper {
return data.get(sName);
}
public Enumeration keys() {
public Enumeration<String> keys() {
return data.keys();
}
@ -65,9 +65,9 @@ public class PropertyHelper {
int nSize = data.size();
PropertyValue[] props = new PropertyValue[nSize];
int i=0;
Enumeration keys = keys();
Enumeration<String> keys = keys();
while (keys.hasMoreElements()) {
String sKey = (String) keys.nextElement();
String sKey = keys.nextElement();
props[i] = new PropertyValue();
props[i].Name = sKey;
props[i++].Value = get(sKey);

View file

@ -0,0 +1,304 @@
/************************************************************************
*
* ConfigurationDialog.java
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2009 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2009-03-30)
*
*/
package org.openoffice.da.comp.writer4latex;
import java.io.File;
import java.net.URI;
import com.sun.star.awt.XControl;
import com.sun.star.awt.XControlContainer;
import com.sun.star.awt.XControlModel;
import com.sun.star.awt.XContainerWindowEventHandler;
import com.sun.star.awt.XWindow;
import com.sun.star.beans.XPropertySet;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.ui.dialogs.ExecutableDialogResults;
import com.sun.star.ui.dialogs.XExecutableDialog;
import com.sun.star.ui.dialogs.XFilePicker;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.lib.uno.helper.WeakBase;
/** This class provides a uno component which implements the configuration
* of Writer4LaTeX
*/
public final class ConfigurationDialog
extends WeakBase
implements XServiceInfo, XContainerWindowEventHandler {
private XComponentContext xContext;
private ExternalApps externalApps;
/** The component will be registered under this name.
*/
public static String __serviceName = "org.openoffice.da.writer4latex.ConfigurationDialog";
/** The component should also have an implementation name.
*/
public static String __implementationName = "org.openoffice.da.comp.writer4latex.ConfigurationDialog";
/** Create a new ConfigurationDialog */
public ConfigurationDialog(XComponentContext xContext) {
this.xContext = xContext;
externalApps = new ExternalApps(xContext);
}
// Implement XContainerWindowEventHandler
public boolean callHandlerMethod(XWindow xWindow, Object event, String sMethod)
throws com.sun.star.lang.WrappedTargetException {
try {
if (sMethod.equals("external_event") ){
return handleExternalEvent(xWindow, event);
}
else if (sMethod.equals("ApplicationChange")) {
return changeApplication(xWindow);
}
else if (sMethod.equals("BrowseClick")) {
return browseForExecutable(xWindow);
}
else if (sMethod.equals("ExecutableUnfocus")) {
return updateApplication(xWindow);
}
else if (sMethod.equals("OptionsUnfocus")) {
return updateApplication(xWindow);
}
else if (sMethod.equals("AutomaticClick")) {
return autoConfigure(xWindow);
}
}
catch (com.sun.star.uno.RuntimeException e) {
throw e;
}
catch (com.sun.star.uno.Exception e) {
throw new com.sun.star.lang.WrappedTargetException(sMethod, this, e);
}
return false;
}
public String[] getSupportedMethodNames() {
String[] sNames = { "external_event", "ApplicationChange", "BrowseClick", "ExecutableUnfocus", "OptionsUnfocus", "AutomaticClick" };
return sNames;
}
// Implement the interface XServiceInfo
public boolean supportsService(String sServiceName) {
return sServiceName.equals(__serviceName);
}
public String getImplementationName() {
return __implementationName;
}
public String[] getSupportedServiceNames() {
String[] sSupportedServiceNames = { __serviceName };
return sSupportedServiceNames;
}
// Private stuff
private boolean handleExternalEvent(com.sun.star.awt.XWindow xWindow, Object aEventObject)
throws com.sun.star.uno.Exception {
try {
String sMethod = AnyConverter.toString(aEventObject);
if (sMethod.equals("ok")) {
externalApps.save();
return true;
} else if (sMethod.equals("back") || sMethod.equals("initialize")) {
externalApps.load();
return changeApplication(xWindow);
}
}
catch (com.sun.star.lang.IllegalArgumentException e) {
throw new com.sun.star.lang.IllegalArgumentException(
"Method external_event requires a string in the event object argument.", this,(short) -1);
}
return false;
}
private boolean changeApplication(XWindow xWindow) {
String sAppName = getSelectedAppName(xWindow);
if (sAppName!=null) {
String[] s = externalApps.getApplication(sAppName);
setComboBoxText(xWindow, "Executable", s[0]);
setComboBoxText(xWindow, "Options", s[1]);
}
return true;
}
private boolean browseForExecutable(XWindow xWindow) {
XComponent xComponent = null;
try {
// Create FilePicker
Object filePicker = xContext.getServiceManager()
.createInstanceWithContext("com.sun.star.ui.dialogs.FilePicker", xContext);
XFilePicker xFilePicker = (XFilePicker)
UnoRuntime.queryInterface(XFilePicker.class, filePicker);
xComponent = (XComponent)
UnoRuntime.queryInterface(XComponent.class, xFilePicker);
// Display the FilePicker
XExecutableDialog xExecutable = (XExecutableDialog)
UnoRuntime.queryInterface(XExecutableDialog.class, xFilePicker);
// Get the path
if (xExecutable.execute() == ExecutableDialogResults.OK) {
String[] sPathList = xFilePicker.getFiles();
if (sPathList.length > 0) {
setComboBoxText(xWindow, "Executable", new File(new URI(sPathList[0])).getCanonicalPath());
updateApplication(xWindow);
}
}
}
catch (com.sun.star.uno.Exception e) {
}
catch (java.net.URISyntaxException e) {
}
catch (java.io.IOException e) {
}
finally{
// Always dispose the FilePicker component
if (xComponent!=null) {
xComponent.dispose();
}
}
return true;
}
private boolean updateApplication(XWindow xWindow) {
String sAppName = getSelectedAppName(xWindow);
if (sAppName!=null) {
externalApps.setApplication(sAppName, getComboBoxText(xWindow, "Executable"), getComboBoxText(xWindow, "Options"));
}
return true;
}
private boolean autoConfigure(XWindow xWindow) {
externalApps.setApplication(ExternalApps.LATEX, "latex", "--interaction=batchmode %s");
externalApps.setApplication(ExternalApps.PDFLATEX, "pdflatex", "--interaction=batchmode %s");
externalApps.setApplication(ExternalApps.XELATEX, "xelatex", "--interaction=batchmode %s");
externalApps.setApplication(ExternalApps.DVIPS, "dvips", "%s");
externalApps.setApplication(ExternalApps.BIBTEX, "bibtex", "%s");
externalApps.setApplication(ExternalApps.MAKEINDEX, "makeindex", "%s");
externalApps.setApplication(ExternalApps.OOLATEX, "oolatex", "%s");
String sOsName = System.getProperty("os.name");
if ("Linux".equals(sOsName)) {
// TODO: Search for applications (which...)
// Viewers may be evince, okular, xdvi, xpdf, ghostview or...
externalApps.setApplication(ExternalApps.DVIVIEWER, "evince", "%s");
externalApps.setApplication(ExternalApps.PDFVIEWER, "evince", "%s");
externalApps.setApplication(ExternalApps.POSTSCRIPTVIEWER, "evince", "%s");
}
else if ("Windows".equals(sOsName)) {
// Assume MikTeX
externalApps.setApplication(ExternalApps.DVIVIEWER, "yap", "--single-instance %s");
// And assume gsview for pdf and ps
// gsview32 may not be in the path, but at least this helps a bit
externalApps.setApplication(ExternalApps.PDFVIEWER, "gsview32.exe", "-e \"%s\"");
externalApps.setApplication(ExternalApps.POSTSCRIPTVIEWER, "gsview32.exe", "-e \"%s\"");
}
changeApplication(xWindow);
return true;
}
private String getSelectedAppName(XWindow xWindow) {
short nItem = getListBoxSelectedItem(xWindow, "Application");
//String sAppName = null;
switch (nItem) {
case 0: return ExternalApps.LATEX;
case 1: return ExternalApps.PDFLATEX;
case 2: return ExternalApps.XELATEX;
case 3: return ExternalApps.DVIPS;
case 4: return ExternalApps.BIBTEX;
case 5: return ExternalApps.MAKEINDEX;
case 6: return ExternalApps.OOLATEX;
case 7: return ExternalApps.DVIVIEWER;
case 8: return ExternalApps.PDFVIEWER;
case 9: return ExternalApps.POSTSCRIPTVIEWER;
}
return "???";
}
// Some helpers copied from DialogBase
private XPropertySet getControlProperties(XWindow xWindow, String sControlName) {
XControlContainer xContainer = (XControlContainer)
UnoRuntime.queryInterface(XControlContainer.class, xWindow);
XControl xControl = xContainer.getControl(sControlName);
XControlModel xModel = xControl.getModel();
XPropertySet xPropertySet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xModel);
return xPropertySet;
}
private String getComboBoxText(XWindow xWindow, String sControlName) {
// Returns the text of a combobox
XPropertySet xPropertySet = getControlProperties(xWindow, sControlName);
try {
return (String) xPropertySet.getPropertyValue("Text");
}
catch (Exception e) {
// Will fail if the control does not exist or is not a combo
return "";
}
}
private void setComboBoxText(XWindow xWindow, String sControlName, String sText) {
XPropertySet xPropertySet = getControlProperties(xWindow, sControlName);
try {
xPropertySet.setPropertyValue("Text", sText);
}
catch (Exception e) {
// Will fail if the control does not exist or is not a combo box or
// nText is an illegal value
}
}
private short getListBoxSelectedItem(XWindow xWindow, String sControlName) {
// Returns the first selected element in case of a multiselection
XPropertySet xPropertySet = getControlProperties(xWindow, sControlName);
try {
short[] selection = (short[]) xPropertySet.getPropertyValue("SelectedItems");
return selection[0];
}
catch (Exception e) {
// Will fail if the control does not exist or is not a list box
return -1;
}
}
}

View file

@ -0,0 +1,250 @@
/************************************************************************
*
* ExternalApps.java
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2009 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2009-03-30)
*
*/
package org.openoffice.da.comp.writer4latex;
import java.io.File;
import java.io.IOException;
import java.lang.Process;
import java.lang.ProcessBuilder;
import java.util.HashMap;
import java.util.Vector;
//import java.util.Map;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XMultiHierarchicalPropertySet;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.util.XChangesBatch;
/** This class manages and executes external applications used by Writer4LaTeX.
* These include TeX and friends as well as viewers for the various backend
* formats. The registry is used for persistent storage of the settings.
*/
public class ExternalApps {
public final static String LATEX = "LaTeX";
public final static String PDFLATEX = "PdfLaTeX";
public final static String XELATEX = "XeLaTeX";
public final static String BIBTEX = "BibTeX";
public final static String MAKEINDEX = "Makeindex";
public final static String OOLATEX = "Oolatex";
public final static String DVIPS = "Dvips";
public final static String DVIVIEWER = "DVIViewer";
public final static String POSTSCRIPTVIEWER = "PostscriptViewer";
public final static String PDFVIEWER = "PdfViewer";
private final static String[] sApps = { LATEX, PDFLATEX, XELATEX, BIBTEX, MAKEINDEX, OOLATEX, DVIPS, DVIVIEWER, POSTSCRIPTVIEWER, PDFVIEWER };
private XComponentContext xContext;
private HashMap<String,String[]> apps;
/** Construct a new ExternalApps object, with empty definitions */
public ExternalApps(XComponentContext xContext) {
this.xContext = xContext;
apps = new HashMap<String,String[]>();
for (int i=0; i<sApps.length; i++) {
setApplication(sApps[i], "?", "?");
}
}
/** Define an external application
* @param sAppName the name of the application to define
* @param sExecutable the system dependent path to the executable file
* @param sOptions the options to the external application; %s will be
* replaced by the filename on execution
*/
public void setApplication(String sAppName, String sExecutable, String sOptions) {
String[] sValue = { sExecutable, sOptions };
apps.put(sAppName, sValue);
}
/** Get the definition for an external application
* @param sAppName the name of the application to get
* @return a String array containg the system dependent path to the
* executable file as entry 0, and the parameters as entry 1
* returns null if the application is unknown
*/
public String[] getApplication(String sAppName) {
return apps.get(sAppName);
}
/** Execute an external application
* @param sAppName the name of the application to execute
* @param sFileName the file name to use
* @param workDir the working directory to use
* @param bWaitFor true if the method should wait for the execution to finish
* @return error code
*/
public int execute(String sAppName, String sFileName, File workDir, boolean bWaitFor) {
// Assemble the command
String[] sApp = getApplication(sAppName);
if (sApp==null) { return 1; }
try {
Vector<String> command = new Vector<String>();
command.add(sApp[0]);
String[] sArguments = sApp[1].split(" ");
for (String s : sArguments) {
command.add(s.replace("%s",sFileName));
}
ProcessBuilder pb = new ProcessBuilder(command);
//Map<String, String> env = pb.environment();
//env.put("VAR1", "myValue");
pb.directory(workDir);
Process proc = pb.start();
//Runtime rt = Runtime.getRuntime();
//Process proc = rt.exec(sCommand, new String[0], workDir);
// Gobble the error stream of the application
StreamGobbler errorGobbler = new
StreamGobbler(proc.getErrorStream(), "ERROR");
// Gooble the output stream of the application
StreamGobbler outputGobbler = new
StreamGobbler(proc.getInputStream(), "OUTPUT");
// Kick them off
errorGobbler.start();
outputGobbler.start();
// Any error?
return bWaitFor ? proc.waitFor() : 0;
}
catch (InterruptedException e) {
return 1;
}
catch (IOException e) {
return 1;
}
}
/** Load the external applications from the registry
*/
public void load() {
Object view;
try {
view = getRegistryView(false);
}
catch (com.sun.star.uno.Exception e) {
// Give up...
//setApplication(LATEX,"Error!",e.getMessage());
return;
}
XMultiHierarchicalPropertySet xProps = (XMultiHierarchicalPropertySet)
UnoRuntime.queryInterface(XMultiHierarchicalPropertySet.class, view);
for (int i=0; i<sApps.length; i++) {
String[] sNames = new String[2];
sNames[0] = sApps[i]+"/Executable";
sNames[1] = sApps[i]+"/Options";
try {
Object[] values = xProps.getHierarchicalPropertyValues(sNames);
setApplication(sApps[i], (String) values[0], (String) values[1]);
}
catch (com.sun.star.uno.Exception e) {
// Ignore...
}
}
disposeRegistryView(view);
}
/** Save the external applications to the registry
*/
public void save() {
Object view;
try {
view = getRegistryView(true);
}
catch (com.sun.star.uno.Exception e) {
// Give up...
return;
}
XMultiHierarchicalPropertySet xProps = (XMultiHierarchicalPropertySet)
UnoRuntime.queryInterface(XMultiHierarchicalPropertySet.class, view);
for (int i=0; i<sApps.length; i++) {
String[] sNames = new String[2];
sNames[0] = sApps[i]+"/Executable";
sNames[1] = sApps[i]+"/Options";
String[] sValues = getApplication(sApps[i]);
try {
xProps.setHierarchicalPropertyValues(sNames, sValues);
}
catch (com.sun.star.uno.Exception e) {
// Ignore...
}
}
// Commit registry changes
XChangesBatch xUpdateContext = (XChangesBatch)
UnoRuntime.queryInterface(XChangesBatch.class, view);
try {
xUpdateContext.commitChanges();
}
catch (Exception e) {
// ignore
}
disposeRegistryView(view);
}
// Get a view of the options root in the registry
private Object getRegistryView(boolean bUpdate)
throws com.sun.star.uno.Exception {
//Object provider = xMSF.createInstance(
Object provider = xContext.getServiceManager().createInstanceWithContext(
"com.sun.star.configuration.ConfigurationProvider", xContext);
XMultiServiceFactory xProvider = (XMultiServiceFactory)
UnoRuntime.queryInterface(XMultiServiceFactory.class,provider);
PropertyValue[] args = new PropertyValue[1];
args[0] = new PropertyValue();
args[0].Name = "nodepath";
args[0].Value = "/org.openoffice.da.Writer4LaTeX.Options/Applications";
String sServiceName = bUpdate ?
"com.sun.star.configuration.ConfigurationUpdateAccess" :
"com.sun.star.configuration.ConfigurationAccess";
Object view = xProvider.createInstanceWithArguments(sServiceName,args);
return view;
}
// Dispose a previously obtained registry view
private void disposeRegistryView(Object view) {
XComponent xComponent = (XComponent)
UnoRuntime.queryInterface(XComponent.class,view);
xComponent.dispose();
}
}

View file

@ -0,0 +1,146 @@
/************************************************************************
*
* LogViewerDialog.java
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2009 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2009-03-26)
*
*/
package org.openoffice.da.comp.writer4latex;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import com.sun.star.awt.XDialog;
import com.sun.star.uno.XComponentContext;
import org.openoffice.da.comp.w2lcommon.helper.DialogBase;
/** This class provides a uno component which displays logfiles
*/
public class LogViewerDialog extends DialogBase
implements com.sun.star.lang.XInitialization {
/** The component will be registered under this name.
*/
public static String __serviceName = "org.openoffice.da.writer4latex.LogViewerDialog";
/** The component should also have an implementation name.
*/
public static String __implementationName = "org.openoffice.da.comp.writer4latex.LogViewerDialog";
/** Return the name of the library containing the dialog
*/
public String getDialogLibraryName() {
return "W4LDialogs";
}
private String sBaseUrl = null;
private String sLaTeXLog = null;
private String sBibTeXLog = null;
private String sMakeindexLog = null;
/** Return the name of the dialog within the library
*/
public String getDialogName() {
return "LogViewer";
}
public void initialize() {
if (sBaseUrl!=null) {
sLaTeXLog = readTextFile(sBaseUrl+".log");
sBibTeXLog = readTextFile(sBaseUrl+".blg");
sMakeindexLog = readTextFile(sBaseUrl+".ilg");
setComboBoxText("LogContents",sLaTeXLog);
}
}
public void finalize() {
}
/** Create a new LogViewerDialog */
public LogViewerDialog(XComponentContext xContext) {
super(xContext);
}
// Implement com.sun.star.lang.XInitialization
public void initialize( Object[] object )
throws com.sun.star.uno.Exception {
if ( object.length > 0 ) {
if (object[0] instanceof String) {
sBaseUrl = (String) object[0];
}
}
}
// Implement XDialogEventHandler
public boolean callHandlerMethod(XDialog xDialog, Object event, String sMethod) {
if (sMethod.equals("ViewLaTeXLog")) {
setComboBoxText("LogContents", sLaTeXLog);
}
else if (sMethod.equals("ViewBibTeXLog")) {
setComboBoxText("LogContents", sBibTeXLog);
}
else if (sMethod.equals("ViewMakeindexLog")) {
setComboBoxText("LogContents", sMakeindexLog);
}
return true;
}
public String[] getSupportedMethodNames() {
String[] sNames = { "ViewLaTeXLog", "ViewBibTeXLog", "ViewMakeindexLog" };
return sNames;
}
// Utility methods
private String readTextFile(String sUrl) {
StringBuffer buf = new StringBuffer();
try {
File file = new File(new URI(sUrl));
if (file.exists() && file.isFile()) {
InputStreamReader isr = new InputStreamReader(new FileInputStream(file));
int n;
do {
n = isr.read();
if (n>-1) { buf.append((char)n); }
}
while (n>-1);
isr.close();
}
}
catch (URISyntaxException e) {
return "";
}
catch (IOException e) {
return "";
}
return buf.toString();
}
}

View file

@ -0,0 +1,56 @@
/************************************************************************
*
* StreamGobbler.java
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2009 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2009-03-30)
*
*/
package org.openoffice.da.comp.writer4latex;
import java.io.*;
class StreamGobbler extends Thread {
InputStream is;
String type;
StreamGobbler(InputStream is, String type) {
this.is = is;
this.type = type;
}
public void run() {
try {
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line=null;
while ( (line = br.readLine()) != null) {
//while ( br.readLine() != null) {
// Do nothing...
System.out.println(type + ">" + line);
}
}
catch (IOException ioe) {
ioe.printStackTrace();
}
}
}

View file

@ -0,0 +1,124 @@
/************************************************************************
*
* TeXify.java
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2009 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2009-03-30)
*
*/
package org.openoffice.da.comp.writer4latex;
import java.io.File;
import java.io.IOException;
import com.sun.star.uno.XComponentContext;
/** This class builds LaTeX documents into dvi, postscript or pdf and displays
* the result.
*/
public final class TeXify {
/** Backend format generic (dvi) */
public static final short GENERIC = 1;
/** Backend format dvips (postscript) */
public static final short DVIPS = 2;
/** Backend format pdfTeX (pdf) */
public static final short PDFTEX = 3;
// Define the applications to run for each backend
private static final String[] genericTexify = {
ExternalApps.LATEX, ExternalApps.BIBTEX, ExternalApps.MAKEINDEX,
ExternalApps.LATEX, ExternalApps.MAKEINDEX, ExternalApps.LATEX };
private static final String[] pdfTexify = {
ExternalApps.PDFLATEX, ExternalApps.BIBTEX, ExternalApps.MAKEINDEX,
ExternalApps.PDFLATEX, ExternalApps.MAKEINDEX, ExternalApps.PDFLATEX };
private static final String[] dvipsTexify = {
ExternalApps.LATEX, ExternalApps.BIBTEX, ExternalApps.MAKEINDEX,
ExternalApps.LATEX, ExternalApps.MAKEINDEX, ExternalApps.LATEX,
ExternalApps.DVIPS };
// Global objects
//private XComponentContext xContext;
private ExternalApps externalApps;
public TeXify(XComponentContext xContext) {
//this.xContext = xContext;
externalApps = new ExternalApps(xContext);
}
/** Process a document
* @param file the LaTeX file to process
* @param nBackend the desired backend format (generic, dvips, pdftex)
* @param bView set the true if the result should be displayed in the viewer
* @throws IOException if the document cannot be read
*/
public void process(File file, short nBackend, boolean bView) throws IOException {
// Remove extension from file
if (file.getName().endsWith(".tex")) {
file = new File(file.getParentFile(),
file.getName().substring(0,file.getName().length()-4));
}
// Update external apps from registry
externalApps.load();
// Process LaTeX document
if (nBackend==GENERIC) {
doTeXify(genericTexify, file);
if (externalApps.execute(ExternalApps.DVIVIEWER,
new File(file.getParentFile(),file.getName()+".dvi").getPath(),
file.getParentFile(), false)>0) {
throw new IOException("Error executing dvi viewer");
}
}
else if (nBackend==PDFTEX) {
doTeXify(pdfTexify, file);
if (externalApps.execute(ExternalApps.PDFVIEWER,
new File(file.getParentFile(),file.getName()+".pdf").getPath(),
file.getParentFile(), false)>0) {
throw new IOException("Error executing pdf viewer");
}
}
else if (nBackend==DVIPS) {
doTeXify(dvipsTexify, file);
if (externalApps.execute(ExternalApps.POSTSCRIPTVIEWER,
new File(file.getParentFile(),file.getName()+".ps").getPath(),
file.getParentFile(), false)>0) {
throw new IOException("Error executing postscript viewer");
}
}
}
private void doTeXify(String[] sAppList, File file) throws IOException {
for (int i=0; i<sAppList.length; i++) {
// Execute external application
int nReturnCode = externalApps.execute(
sAppList[i], file.getName(), file.getParentFile(), true);
if (nReturnCode>0) {
//throw new IOException("Error executing "+sAppList[i]);
}
}
}
}

View file

@ -0,0 +1,103 @@
/************************************************************************
*
* W4LRegistration.java
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2009 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2009-03-26)
*
*/
package org.openoffice.da.comp.writer4latex;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.comp.loader.FactoryHelper;
/** This class provides a static method to instantiate our uno components
* on demand (__getServiceFactory()), and a static method to give
* information about the components (__writeRegistryServiceInfo()).
* Furthermore, it saves the XMultiServiceFactory provided to the
* __getServiceFactory method for future reference by the componentes.
*/
public class W4LRegistration {
public static XMultiServiceFactory xMultiServiceFactory;
/**
* Returns a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
*
* @return returns a <code>XSingleServiceFactory</code> for creating the
* component
*
* @param implName the name of the implementation for which a
* service is desired
* @param multiFactory the service manager to be used if needed
* @param regKey the registryKey
*
* @see com.sun.star.comp.loader.JavaLoader
*/
public static XSingleServiceFactory __getServiceFactory(String implName,
XMultiServiceFactory multiFactory, XRegistryKey regKey) {
xMultiServiceFactory = multiFactory;
XSingleServiceFactory xSingleServiceFactory = null;
if (implName.equals(Writer4LaTeX.__implementationName) ) {
xSingleServiceFactory = FactoryHelper.getServiceFactory(Writer4LaTeX.class,
Writer4LaTeX.__serviceName,
multiFactory,
regKey);
}
else if (implName.equals(ConfigurationDialog.__implementationName) ) {
xSingleServiceFactory = FactoryHelper.getServiceFactory(ConfigurationDialog.class,
ConfigurationDialog.__serviceName,
multiFactory,
regKey);
}
else if (implName.equals(LogViewerDialog.__implementationName) ) {
xSingleServiceFactory = FactoryHelper.getServiceFactory(LogViewerDialog.class,
LogViewerDialog.__serviceName,
multiFactory,
regKey);
}
return xSingleServiceFactory;
}
/**
* Writes the service information into the given registry key.
* This method is called by the <code>JavaLoader</code>
* <p>
* @return returns true if the operation succeeded
* @param regKey the registryKey
* @see com.sun.star.comp.loader.JavaLoader
*/
public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
return
FactoryHelper.writeRegistryServiceInfo(Writer4LaTeX.__implementationName,
Writer4LaTeX.__serviceName, regKey) &
FactoryHelper.writeRegistryServiceInfo(ConfigurationDialog.__implementationName,
ConfigurationDialog.__serviceName, regKey) &
FactoryHelper.writeRegistryServiceInfo(LogViewerDialog.__implementationName,
LogViewerDialog.__serviceName, regKey);
}
}

View file

@ -0,0 +1,408 @@
/************************************************************************
*
* Writer4LaTeX.java
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2009 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2009-03-30)
*
*/
package org.openoffice.da.comp.writer4latex;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertyAccess;
import com.sun.star.frame.XController;
import com.sun.star.frame.XFrame;
import com.sun.star.frame.XModel;
import com.sun.star.frame.XStorable;
import com.sun.star.lib.uno.helper.WeakBase;
import com.sun.star.task.XStatusIndicator;
import com.sun.star.task.XStatusIndicatorFactory;
import com.sun.star.ui.dialogs.ExecutableDialogResults;
import com.sun.star.ui.dialogs.XExecutableDialog;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import org.openoffice.da.comp.w2lcommon.helper.MessageBox;
import org.openoffice.da.comp.w2lcommon.helper.PropertyHelper;
/** This class implements the ui (dispatch) commands provided by Writer4LaTeX.
* The actual processing is done by the three core classes <code>TeXify</code>,
* <code>LaTeXImporter</code> and <code>BibTeXImporter</code>
*/
public final class Writer4LaTeX extends WeakBase
implements com.sun.star.lang.XServiceInfo,
com.sun.star.frame.XDispatchProvider,
com.sun.star.lang.XInitialization,
com.sun.star.frame.XDispatch {
private static final String PROTOCOL = "org.openoffice.da.writer4latex:";
// From constructor+initialization
private final XComponentContext m_xContext;
private XFrame m_xFrame;
private XModel xModel = null;
// Global data
private TeXify texify = null;
private PropertyValue[] mediaProps = null;
private String sBasePath = null;
private String sBaseFileName = null;
public static final String __implementationName = Writer4LaTeX.class.getName();
public static final String __serviceName = "com.sun.star.frame.ProtocolHandler";
private static final String[] m_serviceNames = { __serviceName };
public Writer4LaTeX( XComponentContext xContext ) {
m_xContext = xContext;
}
// com.sun.star.lang.XInitialization:
public void initialize( Object[] object )
throws com.sun.star.uno.Exception {
if ( object.length > 0 ) {
// The first item is the current frame
m_xFrame = (com.sun.star.frame.XFrame) UnoRuntime.queryInterface(
com.sun.star.frame.XFrame.class, object[0]);
// Get the model for the document from the frame
XController xController = m_xFrame.getController();
if (xController!=null) {
xModel = xController.getModel();
}
}
}
// com.sun.star.lang.XServiceInfo:
public String getImplementationName() {
return __implementationName;
}
public boolean supportsService( String sService ) {
int len = m_serviceNames.length;
for( int i=0; i < len; i++) {
if (sService.equals(m_serviceNames[i]))
return true;
}
return false;
}
public String[] getSupportedServiceNames() {
return m_serviceNames;
}
// com.sun.star.frame.XDispatchProvider:
public com.sun.star.frame.XDispatch queryDispatch( com.sun.star.util.URL aURL,
String sTargetFrameName, int iSearchFlags ) {
if ( aURL.Protocol.compareTo(PROTOCOL) == 0 ) {
if ( aURL.Path.compareTo("ProcessDocument") == 0 )
return this;
else if ( aURL.Path.compareTo("ProcessDirectly") == 0 )
return this;
else if ( aURL.Path.compareTo("ViewLog") == 0 )
return this;
else if ( aURL.Path.compareTo("UseBibTeX") == 0 )
return this;
else if ( aURL.Path.compareTo("ImportBibTeX") == 0 )
return this;
else if ( aURL.Path.compareTo("ImportLaTeX") == 0 )
return this;
}
return null;
}
public com.sun.star.frame.XDispatch[] queryDispatches(
com.sun.star.frame.DispatchDescriptor[] seqDescriptors ) {
int nCount = seqDescriptors.length;
com.sun.star.frame.XDispatch[] seqDispatcher =
new com.sun.star.frame.XDispatch[seqDescriptors.length];
for( int i=0; i < nCount; ++i ) {
seqDispatcher[i] = queryDispatch(seqDescriptors[i].FeatureURL,
seqDescriptors[i].FrameName,
seqDescriptors[i].SearchFlags );
}
return seqDispatcher;
}
// com.sun.star.frame.XDispatch:
public void dispatch( com.sun.star.util.URL aURL,
com.sun.star.beans.PropertyValue[] aArguments ) {
if ( aURL.Protocol.compareTo(PROTOCOL) == 0 ) {
if ( aURL.Path.compareTo("ProcessDocument") == 0 ) {
if (updateLocation()) {
if (updateMediaProperties()) {
process();
}
}
else {
warnNotSaved();
}
return;
}
else if ( aURL.Path.compareTo("ProcessDirectly") == 0 ) {
if (updateLocation()) {
if (mediaProps!=null || updateMediaProperties()) {
process();
}
}
else {
warnNotSaved();
}
return;
}
else if ( aURL.Path.compareTo("ViewLog") == 0 ) {
viewLog();
return;
}
else if ( aURL.Path.compareTo("UseBibTeX") == 0 ) {
org.openoffice.da.comp.w2lcommon.helper.MessageBox msgBox = new org.openoffice.da.comp.w2lcommon.helper.MessageBox(m_xContext);
msgBox.showMessage("Writer4LaTeX", "This feature has not been implemented yet");
return;
}
else if ( aURL.Path.compareTo("ImportBibTeX") == 0 ) {
org.openoffice.da.comp.w2lcommon.helper.MessageBox msgBox = new org.openoffice.da.comp.w2lcommon.helper.MessageBox(m_xContext);
msgBox.showMessage("Writer4LaTeX", "This feature has not been implemented yet");
return;
}
else if ( aURL.Path.compareTo("ImportLaTeX") == 0 ) {
org.openoffice.da.comp.w2lcommon.helper.MessageBox msgBox = new org.openoffice.da.comp.w2lcommon.helper.MessageBox(m_xContext);
msgBox.showMessage("Writer4LaTeX", "This feature has not been implemented yet");
return;
}
}
}
public void addStatusListener( com.sun.star.frame.XStatusListener xControl,
com.sun.star.util.URL aURL ) {
}
public void removeStatusListener( com.sun.star.frame.XStatusListener xControl,
com.sun.star.util.URL aURL ) {
}
// The actual commands...
private void process() {
// Create a (somewhat coarse grained) status indicator/progress bar
XStatusIndicatorFactory xFactory = (com.sun.star.task.XStatusIndicatorFactory)
UnoRuntime.queryInterface(com.sun.star.task.XStatusIndicatorFactory.class, m_xFrame);
XStatusIndicator xStatus = xFactory.createStatusIndicator();
xStatus.start("Writer4LaTeX",10);
xStatus.setValue(1); // At least we have started, that's 10% :-)
try {
// Convert to LaTeX
String sTargetUrl = sBasePath+sBaseFileName+".tex";
XStorable xStorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, xModel);
xStorable.storeToURL(sTargetUrl, mediaProps);
}
catch (com.sun.star.io.IOException e) {
xStatus.end();
MessageBox msgBox = new MessageBox(m_xContext, m_xFrame);
msgBox.showMessage("Writer4LaTeX Error","Failed to export document to LaTeX");
return;
}
xStatus.setValue(6); // Export is finished, that's more than half :-)
// Get the backend from the media properties
String sBackend = "generic";
Object filterData = (new PropertyHelper(mediaProps)).get("FilterData");
if (filterData instanceof PropertyValue[]) {
Object backend = (new PropertyHelper((PropertyValue[])filterData)).get("backend");
if (backend instanceof String) {
sBackend = (String) backend;
}
}
if (texify==null) { texify = new TeXify(m_xContext); }
File file = new File(urlToFile(sBasePath),sBaseFileName);
try {
if (sBackend=="pdftex") {
texify.process(file, TeXify.PDFTEX, true);
}
else if (sBackend=="dvips") {
texify.process(file, TeXify.DVIPS, true);
}
else if (sBackend=="generic") {
texify.process(file, TeXify.GENERIC, true);
}
}
catch (IOException e) {
MessageBox msgBox = new MessageBox(m_xContext, m_xFrame);
msgBox.showMessage("Writer4LaTeX Error",e.getMessage());
}
xStatus.setValue(10); // The user will not really see this...
xStatus.end();
}
private void viewLog() {
if (updateLocation()) {
// Execute the log viewer dialog
try {
Object[] args = new Object[1];
args[0] = sBasePath+sBaseFileName;
Object dialog = m_xContext.getServiceManager()
.createInstanceWithArgumentsAndContext(
"org.openoffice.da.writer4latex.LogViewerDialog", args, m_xContext);
XExecutableDialog xDialog = (XExecutableDialog)
UnoRuntime.queryInterface(XExecutableDialog.class, dialog);
if (xDialog.execute()==ExecutableDialogResults.OK) {
// Closed with the close button
}
}
catch (com.sun.star.uno.Exception e) {
}
}
else {
warnNotSaved();
}
}
// Some utility methods
private boolean updateMediaProperties() {
// Create inital media properties
mediaProps = new PropertyValue[2];
mediaProps[0] = new PropertyValue();
mediaProps[0].Name = "FilterName";
mediaProps[0].Value = "org.openoffice.da.writer2latex";
mediaProps[1] = new PropertyValue();
mediaProps[1].Name = "Overwrite";
mediaProps[1].Value = "true";
try {
// Display options dialog
Object dialog = m_xContext.getServiceManager()
.createInstanceWithContext("org.openoffice.da.writer2latex.LaTeXOptionsDialog", m_xContext);
XPropertyAccess xPropertyAccess = (XPropertyAccess)
UnoRuntime.queryInterface(XPropertyAccess.class, dialog);
xPropertyAccess.setPropertyValues(mediaProps);
XExecutableDialog xDialog = (XExecutableDialog)
UnoRuntime.queryInterface(XExecutableDialog.class, dialog);
if (xDialog.execute()==ExecutableDialogResults.OK) {
mediaProps = xPropertyAccess.getPropertyValues();
return true;
}
else {
mediaProps = null;
return false;
}
}
catch (com.sun.star.beans.UnknownPropertyException e) {
// setPropertyValues will not fail..
mediaProps = null;
return false;
}
catch (com.sun.star.uno.Exception e) {
// getServiceManager will not fail..
mediaProps = null;
return false;
}
}
private boolean updateLocation() {
String sDocumentUrl = xModel.getURL();
if (sDocumentUrl.length()!=0) {
// Get the file name (without extension)
File f = urlToFile(sDocumentUrl);
sBaseFileName = f.getName();
int iDot = sBaseFileName.lastIndexOf(".");
if (iDot>-1) { // remove extension
sBaseFileName = sBaseFileName.substring(0,iDot);
}
sBaseFileName=makeTeXSafe(sBaseFileName);
// Get the path
int iSlash = sDocumentUrl.lastIndexOf("/");
if (iSlash>-1) {
sBasePath = sDocumentUrl.substring(0,iSlash+1);
}
else {
sBasePath = "";
}
return true;
}
else {
return false;
}
}
private void warnNotSaved() {
MessageBox msgBox = new MessageBox(m_xContext, m_xFrame);
msgBox.showMessage("Document not saved!","Please save the document before processing the file");
}
private String makeTeXSafe(String sArgument) {
String sResult = "";
for (int i=0; i<sArgument.length(); i++) {
char c = sArgument.charAt(i);
if ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='-' || c=='.') {
sResult += Character.toString(c);
}
// TODO: Create replacement table for other latin characters..
else if (c==' ') { sResult += "-"; }
else if (c=='\u00c6') { sResult += "AE"; }
else if (c=='\u00d8') { sResult += "OE"; }
else if (c=='\u00c5') { sResult += "AA"; }
else if (c=='\u00e6') { sResult += "ae"; }
else if (c=='\u00f8') { sResult += "oe"; }
else if (c=='\u00e5') { sResult += "aa"; }
}
if (sResult.length()==0) { return "writer4latex"; }
else { return sResult; }
}
private File urlToFile(String sUrl) {
try {
return new File(new URI(sUrl));
}
catch (URISyntaxException e) {
return new File(".");
}
}
/*private String urlToPath(String sUrl) {
try {
return (new File(new URI(sUrl))).getCanonicalPath();
}
catch (URISyntaxException e) {
return ".";
}
catch (IOException e) {
return ".";
}
}*/
}

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2008 by Henrik Just
* Copyright: 2002-2009 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.0 (2008-11-22)
* Version 1.2 (2009-03-26)
*
*/
@ -68,9 +68,9 @@ public final class Application {
/* Based on command-line parameters. */
private String sTargetMIME = MIMETypes.LATEX;
private boolean bRecurse = false;
private Vector configFileNames = new Vector();
private Vector<String> configFileNames = new Vector<String>();
private String sTemplateFileName = null;
private Hashtable options = new Hashtable();
private Hashtable<String,String> options = new Hashtable<String,String>();
private String sSource = null;
private String sTarget = null;
@ -208,9 +208,9 @@ public final class Application {
}
// Step 7: Set options from command line
Enumeration keys = options.keys();
Enumeration<String> keys = options.keys();
while (keys.hasMoreElements()) {
String sKey = (String) keys.nextElement();
String sKey = keys.nextElement();
String sValue = (String) options.get(sKey);
converter.getConfig().setOption(sKey,sValue);
if (batchCv!=null) {

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2009-03-25)
* Version 1.2 (2009-03-30)
*
*/
@ -32,8 +32,8 @@ package writer2latex.api;
public class ConverterFactory {
// Version information
private static final String VERSION = "1.0 beta";
private static final String DATE = "2008-03-25";
private static final String VERSION = "1.1.1";
private static final String DATE = "2008-03-30";
/** Return version information
* @return the Writer2LaTeX version in the form

View file

@ -44,7 +44,7 @@ public interface ConverterResult {
* <code>ConverterResult</code>. This <em>includes</em> the master document.
* @return an <code>Iterator</code> of all files
*/
public Iterator iterator();
public Iterator<OutputFile> iterator();
/** Write all files of the <code>ConverterResult</code> to a directory.
* Subdirectories are created as required by the individual

View file

@ -51,7 +51,7 @@ public class BibTeXDocument implements Document {
private static final String FILE_EXTENSION = ".bib";
private String sName;
private Hashtable entries = new Hashtable();
private Hashtable<String, BibMark> entries = new Hashtable<String, BibMark>();
private ExportNameCollection exportNames = new ExportNameCollection(true);
private I18n i18n;
@ -122,9 +122,9 @@ public class BibTeXDocument implements Document {
osw.write("%% This file was converted to BibTeX by Writer2BibTeX ver. "+ConverterFactory.getVersion()+".\n");
osw.write("%% See http://writer2latex.sourceforge.net for more info.\n");
osw.write("\n");
Enumeration enumeration = entries.elements();
Enumeration<BibMark> enumeration = entries.elements();
while (enumeration.hasMoreElements()) {
BibMark entry = (BibMark) enumeration.nextElement();
BibMark entry = enumeration.nextElement();
osw.write("@");
osw.write(entry.getEntryType().toUpperCase());
osw.write("{");

View file

@ -43,7 +43,7 @@ import writer2latex.latex.util.StyleMap;
public class CharStyleConverter extends StyleConverter {
// Cache of converted font declarations
private Hashtable fontDecls = new Hashtable();
private Hashtable<String, String> fontDecls = new Hashtable<String, String>();
// Which formatting should we export?
private boolean bIgnoreHardFontsize;
@ -434,7 +434,7 @@ public class CharStyleConverter extends StyleConverter {
String sFontFamilyGeneric = fd.getFontFamilyGeneric();
fontDecls.put(sName,nfssFamily(sFontFamily,sFontFamilyGeneric,sFontPitch));
}
return (String) fontDecls.get(sName);
return fontDecls.get(sName);
}
// The remaining methods are static helpers to convert single style properties

View file

@ -226,10 +226,10 @@ public final class ConverterPalette extends ConverterBase {
mathmlCv.appendDeclarations(packages,declarations);
// Add custom preamble
LinkedList customPreamble = config.getCustomPreamble();
LinkedList<String> customPreamble = config.getCustomPreamble();
int nCPLen = customPreamble.size();
for (int i=0; i<nCPLen; i++) {
declarations.append( (String) customPreamble.get(i) ).nl();
declarations.append( customPreamble.get(i) ).nl();
}
// Set \title, \author and \date (for \maketitle)

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2009-03-08)
* Version 1.2 (2009-03-26)
*
*/
@ -56,7 +56,7 @@ public class DrawConverter extends ConverterHelper {
private boolean bNeedOOoLaTeXPreamble = false;
// Keep track of floating frames (images, textboxes...)
private Stack floatingFramesStack = new Stack();
private Stack<LinkedList<Element>> floatingFramesStack = new Stack<LinkedList<Element>>();
private Element getFrame(Element onode) {
if (ofr.isOpenDocument()) return (Element) onode.getParentNode();
@ -65,7 +65,7 @@ public class DrawConverter extends ConverterHelper {
public DrawConverter(OfficeReader ofr, LaTeXConfig config, ConverterPalette palette) {
super(ofr,config,palette);
floatingFramesStack.push(new LinkedList());
floatingFramesStack.push(new LinkedList<Element>());
}
public void appendDeclarations(LaTeXDocumentPortion pack, LaTeXDocumentPortion decl) {
@ -301,7 +301,7 @@ public class DrawConverter extends ConverterHelper {
handleDrawImageAsChar(node,ldp,oc);
}
else {
((LinkedList) floatingFramesStack.peek()).add(node);
floatingFramesStack.peek().add(node);
}
}
@ -429,7 +429,7 @@ public class DrawConverter extends ConverterHelper {
makeDrawTextBox(node, ldp, oc);
}
else {
((LinkedList) floatingFramesStack.peek()).add(node);
floatingFramesStack.peek().add(node);
}
}
@ -461,7 +461,7 @@ public class DrawConverter extends ConverterHelper {
if (!bIsCaption) {
ldp.append("\\begin{minipage}{").append(sWidth).append("}").nl();
}
floatingFramesStack.push(new LinkedList());
floatingFramesStack.push(new LinkedList<Element>());
palette.getBlockCv().traverseBlockText(node,ldp,ic);
flushFloatingFrames(ldp,ic);
floatingFramesStack.pop();
@ -477,7 +477,7 @@ public class DrawConverter extends ConverterHelper {
public void flushFloatingFrames(LaTeXDocumentPortion ldp, Context oc) {
// todo: fix language
LinkedList floatingFrames = (LinkedList) floatingFramesStack.peek();
LinkedList floatingFrames = floatingFramesStack.peek();
int n = floatingFrames.size();
if (n==0) { return; }
for (int i=0; i<n; i++) {

View file

@ -60,12 +60,12 @@ public class FieldConverter extends ConverterHelper {
private ExportNameCollection seqrefnames = new ExportNameCollection(true);
// sequence declarations (maps name->text:sequence-decl element)
private Hashtable seqDecl = new Hashtable();
private Hashtable<String, Node> seqDecl = new Hashtable<String, Node>();
// first usage of sequence (maps name->text:sequence element)
private Hashtable seqFirst = new Hashtable();
private Hashtable<String, Element> seqFirst = new Hashtable<String, Element>();
private Vector postponedReferenceMarks = new Vector();
private Vector postponedBookmarks = new Vector();
private Vector<Element> postponedReferenceMarks = new Vector<Element>();
private Vector<Element> postponedBookmarks = new Vector<Element>();
private boolean bUseHyperref = false;
private boolean bUsesPageCount = false;
@ -128,11 +128,11 @@ public class FieldConverter extends ConverterHelper {
// The number format is fetched from the first occurence of the
// sequence in the text, while the outline level and the separation
// character are fetched from the declaration
Enumeration names = seqFirst.keys();
Enumeration<String> names = seqFirst.keys();
while (names.hasMoreElements()) {
// Get first text:sequence element
String sName = (String) names.nextElement();
Element first = (Element) seqFirst.get(sName);
String sName = names.nextElement();
Element first = seqFirst.get(sName);
// Collect data
String sNumFormat = Misc.getAttribute(first,XMLString.STYLE_NUM_FORMAT);
if (sNumFormat==null) { sNumFormat="1"; }
@ -525,13 +525,13 @@ public class FieldConverter extends ConverterHelper {
// Type out all postponed reference marks
int n = postponedReferenceMarks.size();
for (int i=0; i<n; i++) {
handleReferenceMark((Element) postponedReferenceMarks.get(i),ldp,oc);
handleReferenceMark(postponedReferenceMarks.get(i),ldp,oc);
}
postponedReferenceMarks.clear();
// Type out all postponed bookmarks
n = postponedBookmarks.size();
for (int i=0; i<n; i++) {
handleBookmark((Element) postponedBookmarks.get(i),ldp,oc);
handleBookmark(postponedBookmarks.get(i),ldp,oc);
}
postponedBookmarks.clear();
}

View file

@ -48,7 +48,7 @@ public class IndexConverter extends ConverterHelper {
private boolean bContainsAlphabeticalIndex = false;
private Vector postponedIndexMarks = new Vector();
private Vector<Element> postponedIndexMarks = new Vector<Element>();
/** <p>Construct a new <code>IndexConverter</code>.
* @param config the configuration to use
@ -201,7 +201,7 @@ public class IndexConverter extends ConverterHelper {
// Type out all postponed index marks
int n = postponedIndexMarks.size();
for (int i=0; i<n; i++) {
handleAlphabeticalIndexMark((Element) postponedIndexMarks.get(i),ldp,oc);
handleAlphabeticalIndexMark(postponedIndexMarks.get(i),ldp,oc);
}
postponedIndexMarks.clear();
}

View file

@ -145,7 +145,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
private static final int SAVE_IMAGES_IN_SUBDIR = 57;
private static final int DEBUG = 58;
protected LinkedList customPreamble = new LinkedList();
protected LinkedList<String> customPreamble = new LinkedList<String>();
protected StyleMap par = new StyleMap();
protected StyleMap parBlock = new StyleMap();
protected StyleMap text = new StyleMap();
@ -153,7 +153,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
protected StyleMap listItem = new StyleMap();
protected StyleMap textAttr = new StyleMap();
protected HeadingMap headingMap = new HeadingMap(5);
protected Hashtable mathSymbols = new Hashtable();
protected Hashtable<String, String> mathSymbols = new Hashtable<String, String>();
protected ReplacementTrie stringReplace = new ReplacementTrie();
public LaTeXConfig() {
@ -365,10 +365,10 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
protected void writeInner(Document dom) {
// Write math symbol map
Enumeration msEnum = mathSymbols.keys();
Enumeration<String> msEnum = mathSymbols.keys();
while (msEnum.hasMoreElements()) {
String sName = (String) msEnum.nextElement();
String sLatex = (String) mathSymbols.get(sName);
String sName = msEnum.nextElement();
String sLatex = mathSymbols.get(sName);
Element msNode = dom.createElement("math-symbol-map");
msNode.setAttribute("name",sName);
msNode.setAttribute("latex",sLatex);
@ -413,9 +413,9 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
}
private void writeStyleMap(Document dom, StyleMap sm, String sFamily) {
Enumeration smEnum = sm.getNames();
Enumeration<String> smEnum = sm.getNames();
while (smEnum.hasMoreElements()) {
String sName = (String) smEnum.nextElement();
String sName = smEnum.nextElement();
Element smNode = dom.createElement("style-map");
smNode.setAttribute("name",sName);
smNode.setAttribute("family",sFamily);
@ -434,11 +434,11 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
}
}
private void writeContent(Document dom, LinkedList list, String sElement) {
private void writeContent(Document dom, LinkedList<String> list, String sElement) {
Element node = dom.createElement(sElement);
int nLen = list.size();
for (int i=0; i<nLen; i++) {
node.appendChild( dom.createTextNode( (String) list.get(i) ) );
node.appendChild( dom.createTextNode( list.get(i) ) );
}
dom.getDocumentElement().appendChild(node);
}
@ -528,7 +528,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
public boolean splitToplevelSections() { return ((BooleanOption) options[SPLIT_TOPLEVEL_SECTIONS]).getValue(); }
public boolean saveImagesInSubdir() { return ((BooleanOption) options[SAVE_IMAGES_IN_SUBDIR]).getValue(); }
public Hashtable getMathSymbols() { return mathSymbols; }
public Hashtable<String, String> getMathSymbols() { return mathSymbols; }
public StyleMap getParStyleMap() { return par; }
public StyleMap getParBlockStyleMap() { return parBlock; }
@ -537,7 +537,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
public StyleMap getListItemStyleMap() { return listItem; }
public StyleMap getTextAttributeStyleMap() { return textAttr; }
public HeadingMap getHeadingMap() { return headingMap; }
public LinkedList getCustomPreamble() { return customPreamble; }
public LinkedList<String> getCustomPreamble() { return customPreamble; }
}

View file

@ -36,7 +36,7 @@ import writer2latex.util.Misc;
number of lines, and may include subportions. */
public class LaTeXDocumentPortion {
private Vector nodes; // The collection of all nodes in this portion
private Vector<Object> nodes; // The collection of all nodes in this portion
private StringBuffer curText; // The currently active node (always the last node)
private boolean bEmpty; // Is the active node empty?
@ -45,7 +45,7 @@ public class LaTeXDocumentPortion {
public LaTeXDocumentPortion(boolean bWrap){
this.bWrap = bWrap;
nodes = new Vector();
nodes = new Vector<Object>();
curText = new StringBuffer();
bEmpty = true;
}

View file

@ -37,7 +37,7 @@ import writer2latex.latex.util.Context;
*/
public class ListStyleConverter extends StyleConverter {
boolean bNeedSaveEnumCounter = false;
private Hashtable listStyleLevelNames = new Hashtable();
private Hashtable<String, String[]> listStyleLevelNames = new Hashtable<String, String[]>();
/** <p>Constructs a new <code>ListStyleConverter</code>.</p>
*/
@ -99,7 +99,7 @@ public class ListStyleConverter extends StyleConverter {
ba.add("\\liststyle"+styleNames.getExportName(getDisplayName(sStyleName))+"\n","");
}
if (nLevel<=4) {
String sCounterName = ((String[]) listStyleLevelNames.get(sStyleName))[nLevel];
String sCounterName = listStyleLevelNames.get(sStyleName)[nLevel];
if (bContinue && style.isNumber(nLevel)) {
bNeedSaveEnumCounter = true;
ba.add("\\setcounter{saveenum}{\\value{"+sCounterName+"}}\n","");

View file

@ -53,7 +53,7 @@ public class NoteConverter extends ConverterHelper {
private boolean bContainsEndnotes = false;
private boolean bContainsFootnotes = false;
// Keep track of footnotes (inside minipage etc.), that should be typeset later
private LinkedList postponedFootnotes = new LinkedList();
private LinkedList<Element> postponedFootnotes = new LinkedList<Element>();
public NoteConverter(OfficeReader ofr, LaTeXConfig config, ConverterPalette palette) {
super(ofr,config,palette);
@ -115,7 +115,7 @@ public class NoteConverter extends ConverterHelper {
int n = postponedFootnotes.size();
if (n==1) {
ldp.append("\\footnotetext{");
traverseNoteBody((Element) postponedFootnotes.get(0),ldp,ic);
traverseNoteBody(postponedFootnotes.get(0),ldp,ic);
ldp.append("}").nl();
postponedFootnotes.clear();
}
@ -124,7 +124,7 @@ public class NoteConverter extends ConverterHelper {
ldp.append("\\addtocounter{footnote}{-"+n+"}").nl();
for (int i=0; i<n; i++) {
ldp.append("\\stepcounter{footnote}\\footnotetext{");
traverseNoteBody((Element) postponedFootnotes.get(i),ldp,ic);
traverseNoteBody(postponedFootnotes.get(i),ldp,ic);
ldp.append("}").nl();
}
postponedFootnotes.clear();

View file

@ -157,7 +157,7 @@ public class PageStyleConverter extends StyleConverter {
context.setInHeaderFooter(true);
Enumeration styles = ofr.getMasterPages().getStylesEnumeration();
Enumeration<Object> styles = ofr.getMasterPages().getStylesEnumeration();
ldp.append("% Pages styles").nl();
if (!config.useFancyhdr()) {
ldp.append("\\makeatletter").nl();
@ -385,7 +385,7 @@ public class PageStyleConverter extends StyleConverter {
boolean bIncludeHead = false;
boolean bIncludeFoot = false;
// Look through all applied page layouts and use largest heights
Enumeration masters = ofr.getMasterPages().getStylesEnumeration();
Enumeration<Object> masters = ofr.getMasterPages().getStylesEnumeration();
while (masters.hasMoreElements()) {
MasterPage master = (MasterPage) masters.nextElement();
if (styleNames.containsName(getDisplayName(master.getName()))) {

View file

@ -698,7 +698,7 @@ public final class StarMathConverter implements writer2latex.api.StarMathConvert
private SmTokenTable keywords=new SmTokenTable(SmTokenTable.keywords);
private SmTokenTable symbols=new SmTokenTable(SmTokenTable.symbols);
private LaTeXConfig config;
private Hashtable configSymbols;
private Hashtable<String, String> configSymbols;
private boolean bUseColor;
private SmToken curToken=new SmToken(); // contains the data of the current token
private SimpleInputBuffer buffer; // contains the starmath formula
@ -860,7 +860,7 @@ public final class StarMathConverter implements writer2latex.api.StarMathConvert
buffer.getChar();
String sIdent=buffer.getIdentifier();
if (configSymbols.containsKey(sIdent)) { // symbol defined in configuration
curToken.assign(Token.SPECIAL, (String) configSymbols.get(sIdent), 5);
curToken.assign(Token.SPECIAL, configSymbols.get(sIdent), 5);
}
else if (!symbols.lookup(sIdent,false,curToken))
curToken.assign(Token.IDENT, i18n.convert(sIdent,true,"en"), 5);

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2009-02-16)
* Version 1.2 (2009-03-26)
*
*/
@ -185,12 +185,12 @@ public class ClassicI18n extends I18n {
// End of static part of I18n!
// **** Global variables ****
private Hashtable babelLanguages; // mappings iso->babel language
private Hashtable<String,String> babelLanguages; // mappings iso->babel language
// Unicode translation
private Hashtable tableSet; // all tables
private Hashtable<String,UnicodeTable> tableSet; // all tables
private UnicodeTable table; // currently active table (top of stack)
private Stack tableStack; // stack of active tables
private Stack<UnicodeTable> tableStack; // stack of active tables
private UnicodeStringParser ucparser; // Unicode string parser
// Collected data
@ -231,7 +231,7 @@ public class ClassicI18n extends I18n {
if (config.useEurosym()) sSymbols+="|eurosym";
if (config.useTipa()) sSymbols+="|tipa";
tableSet = new Hashtable();
tableSet = new Hashtable<String,UnicodeTable>();
UnicodeTableHandler handler=new UnicodeTableHandler(tableSet, sSymbols);
SAXParserFactory factory=SAXParserFactory.newInstance();
InputStream is = this.getClass().getResourceAsStream("symbols.xml");
@ -244,9 +244,9 @@ public class ClassicI18n extends I18n {
t.printStackTrace();
}
// put root table at top of stack
tableStack = new Stack();
tableStack.push((UnicodeTable) tableSet.get("root"));
table = (UnicodeTable) tableSet.get("root");
tableStack = new Stack<UnicodeTable>();
tableStack.push(tableSet.get("root"));
table = tableSet.get("root");
}
/** Construct a new I18n for general use
@ -386,8 +386,8 @@ public class ClassicI18n extends I18n {
// If no name is specified we should keep the current table
// Otherwise try to find the table, and use root if it's not available
if (sName!=null) {
table = (UnicodeTable) tableSet.get(sName);
if (table==null) { table = (UnicodeTable) tableSet.get("root"); }
table = tableSet.get(sName);
if (table==null) { table = tableSet.get("root"); }
}
tableStack.push(table);
}
@ -396,7 +396,7 @@ public class ClassicI18n extends I18n {
*/
public void popSpecialTable() {
tableStack.pop();
table = (UnicodeTable) tableStack.peek();
table = tableStack.peek();
}
/** Get the number of characters defined in the current table
@ -632,7 +632,7 @@ public class ClassicI18n extends I18n {
// todo: support automatic choice of inputenc (see comments)?
private String getBabelLanguage(String sLang) {
if (babelLanguages.containsKey(sLang)) {
return (String) babelLanguages.get(sLang);
return babelLanguages.get(sLang);
}
else {
return "english"; // interpret unknown languages as English
@ -640,7 +640,7 @@ public class ClassicI18n extends I18n {
}
private void prepareBabelLanguages() {
babelLanguages = new Hashtable();
babelLanguages = new Hashtable<String,String>();
babelLanguages.put("en", "english"); // latin1
babelLanguages.put("bg", "bulgarian"); // cp1251?
babelLanguages.put("cs", "czech"); // latin2

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2009-02-16)
* Version 1.2 (2009-03-26)
*
*/
@ -49,7 +49,7 @@ public abstract class I18n {
// Collected data
protected String sDefaultLanguage; // The default iso language to use
protected HashSet languages = new HashSet(); // All languages used
protected HashSet<String> languages = new HashSet<String>(); // All languages used
// **** Constructors ****

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2009-02-17)
* Version 1.2 (2009-03-26)
*
*/
@ -31,9 +31,10 @@ import java.util.Hashtable;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;
// Helper classs: SAX handler to parse symbols.xml from jar
class UnicodeTableHandler extends DefaultHandler{
private Hashtable tableSet; // collection of all tables
/** Helper classs: SAX handler to parse symbols.xml from jar
*/
public class UnicodeTableHandler extends DefaultHandler{
private Hashtable<String,UnicodeTable> tableSet; // collection of all tables
private UnicodeTable table; // the current table
private String sSymbolSets;
private boolean bGlobalReadThisSet;
@ -42,7 +43,12 @@ class UnicodeTableHandler extends DefaultHandler{
private int nFontencs = 0; // The currently active fontencodings
private boolean b8bit = false;
UnicodeTableHandler(Hashtable tableSet, String sSymbolSets){
/** Create a new <code>UnicodeTableHandler</code>
*
* @param tableSet the <code>Hashtable</code> to fill with tables read from the file
* @param sSymbolSets string containing table names to read (separated by |)
*/
public UnicodeTableHandler(Hashtable<String,UnicodeTable> tableSet, String sSymbolSets){
this.sSymbolSets = sSymbolSets;
this.tableSet = tableSet;
}
@ -63,7 +69,7 @@ class UnicodeTableHandler extends DefaultHandler{
}
else if (qName.equals("special-symbol-set")) {
// start a new special symbol set; this requires a new table
table = new UnicodeTable((UnicodeTable) tableSet.get("root"));
table = new UnicodeTable(tableSet.get("root"));
tableSet.put(attributes.getValue("name"),table);
// Read it if it requires nothing, or something we read

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2009-02-17)
* Version 1.2 (2009-03-26)
*
*/

View file

@ -30,7 +30,7 @@ import java.util.Hashtable;
import java.util.Enumeration;
public class StyleMap {
private Hashtable items = new Hashtable();
private Hashtable<String, StyleMapItem> items = new Hashtable<String, StyleMapItem>();
public void put(String sName, String sBefore, String sAfter, boolean bLineBreak, boolean bVerbatim) {
StyleMapItem item = new StyleMapItem();
@ -67,32 +67,32 @@ public class StyleMap {
}
public String getBefore(String sName) {
return ((StyleMapItem) items.get(sName)).sBefore;
return items.get(sName).sBefore;
}
public String getAfter(String sName) {
return ((StyleMapItem) items.get(sName)).sAfter;
return items.get(sName).sAfter;
}
public String getNext(String sName) {
String sNext = ((StyleMapItem) items.get(sName)).sNext;
String sNext = items.get(sName).sNext;
return sNext.substring(1,sNext.length()-1);
}
public boolean isNext(String sName, String sNext) {
String sNext1 = ((StyleMapItem) items.get(sName)).sNext;
String sNext1 = items.get(sName).sNext;
return sNext1.indexOf(";"+sNext+";")>-1;
}
public boolean getLineBreak(String sName) {
return contains(sName) && ((StyleMapItem) items.get(sName)).bLineBreak;
return contains(sName) && items.get(sName).bLineBreak;
}
public boolean getVerbatim(String sName) {
return contains(sName) && ((StyleMapItem) items.get(sName)).bVerbatim;
return contains(sName) && items.get(sName).bVerbatim;
}
public Enumeration getNames() {
public Enumeration<String> getNames() {
return items.keys();
}

View file

@ -42,7 +42,7 @@ public class ControlReader {
private String sId; // a control is identified by id
private Element control; // the control element
private Element controlType; // the type specific child element
private Vector items = new Vector(); // the options/items of a list/combobox
private Vector<Node> items = new Vector<Node>(); // the options/items of a list/combobox
/** <p>The constructor reads the content of a control element</p>
* The representation in OpenDocument differs slightly from OOo 1.x.

View file

@ -45,8 +45,8 @@ import org.w3c.dom.Node;
public class FormsReader {
private Element formsElement; // The office:forms element
private Hashtable forms = new Hashtable(); // all forms, indexed by name
private Hashtable controls = new Hashtable(); // all controls, indexed by id
private Hashtable<String, FormReader> forms = new Hashtable<String, FormReader>(); // all forms, indexed by name
private Hashtable<String, ControlReader> controls = new Hashtable<String, ControlReader>(); // all controls, indexed by id
/** <p>Read the content of an <code>office:forms</code> element</p>
* @param formsElement a DOM element, which must be <code>office:forms</code> node
@ -77,7 +77,7 @@ public class FormsReader {
/** <p>Get a <code>Iterator</code> over all forms.</p>
* @return a <code>Iterator</code> over all forms
*/
public Iterator getFormsIterator() {
public Iterator<FormReader> getFormsIterator() {
return forms.values().iterator();
}
@ -86,13 +86,13 @@ public class FormsReader {
* @return the form as a <code>FormReader</code> object
*/
public FormReader getForm(String sName) {
return (FormReader) forms.get(sName);
return forms.get(sName);
}
/** <p>Get a <code>Iterator</code> over all controls.</p>
* @return a <code>Iterator</code> over all controls
*/
public Iterator getControlsIterator() {
public Iterator<ControlReader> getControlsIterator() {
return controls.values().iterator();
}
@ -101,7 +101,7 @@ public class FormsReader {
* @return the control as a <code>ControlReader</code> object
*/
public ControlReader getControl(String sId) {
return (ControlReader) controls.get(sId);
return controls.get(sId);
}
/** <p>Add a control</p>

View file

@ -65,7 +65,7 @@ public final class ImageLoader {
private boolean bAcceptOtherFormats = true;
private String sDefaultFormat = null;
private String sDefaultVectorFormat = null;
private HashSet acceptedFormats = new HashSet();
private HashSet<String> acceptedFormats = new HashSet<String>();
public ImageLoader(OfficeDocument oooDoc, String sOutFileName, boolean bExtractEPS) {
this.oooDoc = oooDoc;

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2008-09-22)
* Version 1.2 (2008-09-30)
*
*/
@ -115,16 +115,10 @@ public class OfficeReader {
Node child = node.getFirstChild();
while (child!=null) {
if (child.getNodeType()==Node.ELEMENT_NODE) {
if (child.getNodeName().equals(XMLString.TEXT_SPAN)) {
if (isTextElement(child)) {
if (!isWhitespaceContent(child)) { return false; }
}
else if (child.getNodeName().equals(XMLString.TEXT_A)) {
if (!isWhitespaceContent(child)) { return false; }
}
else if (child.getNodeName().equals(XMLString.TEXT_BIBLIOGRAPHY_MARK)) {
if (!isWhitespaceContent(child)) { return false; }
}
else if (!isTextElement(child)) {
else {
return false; // found non-text content!
}
}
@ -282,32 +276,32 @@ public class OfficeReader {
//private String sFirstMasterPageName = null;
// All indexes
private Hashtable indexes = new Hashtable();
private HashSet indexSourceStyles = new HashSet();
private HashSet figureSequenceNames = new HashSet();
private HashSet tableSequenceNames = new HashSet();
private Hashtable<Element, Object> indexes = new Hashtable<Element, Object>();
private HashSet<String> indexSourceStyles = new HashSet<String>();
private HashSet<String> figureSequenceNames = new HashSet<String>();
private HashSet<String> tableSequenceNames = new HashSet<String>();
private String sAutoFigureSequenceName = null;
private String sAutoTableSequenceName = null;
// Map paragraphs to sequence names (caption helper)
private Hashtable sequenceNames = new Hashtable();
private Hashtable<Element, String> sequenceNames = new Hashtable<Element, String>();
// Map sequence reference names to sequence names
private Hashtable seqrefNames = new Hashtable();
private Hashtable<String, String> seqrefNames = new Hashtable<String, String>();
// All references
private HashSet footnoteRef = new HashSet();
private HashSet endnoteRef = new HashSet();
private HashSet referenceRef = new HashSet();
private HashSet bookmarkRef = new HashSet();
private HashSet sequenceRef = new HashSet();
private HashSet<String> footnoteRef = new HashSet<String>();
private HashSet<String> endnoteRef = new HashSet<String>();
private HashSet<String> referenceRef = new HashSet<String>();
private HashSet<String> bookmarkRef = new HashSet<String>();
private HashSet<String> sequenceRef = new HashSet<String>();
// Reference marks and bookmarks contained in headings
private HashSet referenceHeading = new HashSet();
private HashSet bookmarkHeading = new HashSet();
private HashSet<String> referenceHeading = new HashSet<String>();
private HashSet<String> bookmarkHeading = new HashSet<String>();
// All internal hyperlinks
private HashSet links = new HashSet();
private HashSet<String> links = new HashSet<String>();
// Forms
private FormsReader forms = new FormsReader();
@ -468,7 +462,7 @@ public class OfficeReader {
* @return the iso language
*/
public String getMajorityLanguage() {
Hashtable langs = new Hashtable();
Hashtable<Object, Integer> langs = new Hashtable<Object, Integer>();
// Read the default language from the default paragraph style
String sDefaultLang = null;
@ -478,7 +472,7 @@ public class OfficeReader {
}
// Collect languages from paragraph styles
Enumeration enumeration = getParStyles().getStylesEnumeration();
Enumeration<Object> enumeration = getParStyles().getStylesEnumeration();
while (enumeration.hasMoreElements()) {
style = (StyleWithProperties) enumeration.nextElement();
String sLang = style.getProperty(XMLString.FO_LANGUAGE);
@ -486,7 +480,7 @@ public class OfficeReader {
if (sLang!=null) {
int nCount = 1;
if (langs.containsKey(sLang)) {
nCount = ((Integer) langs.get(sLang)).intValue()+1;
nCount = langs.get(sLang).intValue()+1;
}
langs.put(sLang,new Integer(nCount));
}
@ -498,7 +492,7 @@ public class OfficeReader {
enumeration = langs.keys();
while (enumeration.hasMoreElements()) {
String sLang = (String) enumeration.nextElement();
int nCount = ((Integer) langs.get(sLang)).intValue();
int nCount = langs.get(sLang).intValue();
if (nCount>nMaxCount) {
nMaxCount = nCount;
sMajorityLanguage = sLang;
@ -571,7 +565,7 @@ public class OfficeReader {
* @return the sequence name or null
*/
public String getSequenceName(Element par) {
return sequenceNames.containsKey(par) ? (String) sequenceNames.get(par) : null;
return sequenceNames.containsKey(par) ? sequenceNames.get(par) : null;
}
/** <p>Get the sequence name associated with a reference name</p>
@ -579,7 +573,7 @@ public class OfficeReader {
* @return the sequence name or null
*/
public String getSequenceFromRef(String sRefName) {
return (String) seqrefNames.get(sRefName);
return seqrefNames.get(sRefName);
}
@ -1129,14 +1123,14 @@ public class OfficeReader {
}
private void collectRefName(HashSet ref, Element node) {
private void collectRefName(HashSet<String> ref, Element node) {
String sRefName = node.getAttribute(XMLString.TEXT_REF_NAME);
if (sRefName!=null && sRefName.length()>0) {
ref.add(sRefName);
}
}
private void collectMarkInHeading(HashSet marks, Element node) {
private void collectMarkInHeading(HashSet<String> marks, Element node) {
String sName = node.getAttribute(XMLString.TEXT_NAME);
if (sName!=null && sName.length()>0) {
Element par = getParagraph(node);

View file

@ -33,10 +33,10 @@ import writer2latex.util.Misc;
/** Container class representing a style family in OOo */
public class OfficeStyleFamily {
private Hashtable styles = new Hashtable();
private Hashtable<String, Object> styles = new Hashtable<String, Object>();
private Class styleClass;
private Hashtable displayNames = new Hashtable();
private Hashtable<String, String> displayNames = new Hashtable<String, String>();
private OfficeStyle defaultStyle = null;
@ -80,7 +80,7 @@ public class OfficeStyleFamily {
*/
public OfficeStyle getStyleByDisplayName(String sDisplayName) {
if (sDisplayName==null) { return null; }
else { return getStyle((String) displayNames.get(sDisplayName)); }
else { return getStyle(displayNames.get(sDisplayName)); }
}
/** Get the display name for the style with the specified name.
@ -101,7 +101,7 @@ public class OfficeStyleFamily {
/** Get all named styles in the family (ie. excluding the default style)
* @return an enumeration of all styles represented by OfficeStyle objects
*/
public Enumeration getStylesEnumeration(){
public Enumeration<Object> getStylesEnumeration(){
return styles.elements();
}

View file

@ -35,17 +35,17 @@ import java.util.Hashtable;
is simply the set of attributes of an element). </p>
*/
public class PropertySet {
private Hashtable properties = new Hashtable();
private Hashtable<String, String> properties = new Hashtable<String, String>();
private String sName;
public PropertySet() {
properties = new Hashtable();
properties = new Hashtable<String, String>();
sName="";
}
public String getProperty(String sPropName) {
if (sPropName!=null) {
String sValue = (String) properties.get(sPropName);
String sValue = properties.get(sPropName);
if (sValue!=null && sValue.endsWith("inch")) {
// Cut of inch to in
return sValue.substring(0,sValue.length()-2);
@ -86,10 +86,10 @@ public class PropertySet {
public String toString() {
String s="";
Enumeration keys = properties.keys();
Enumeration<String> keys = properties.keys();
while (keys.hasMoreElements()) {
String sKey = (String) keys.nextElement();
String sValue = (String) properties.get(sKey);
String sKey = keys.nextElement();
String sValue = properties.get(sKey);
s += sKey+"="+sValue+" ";
}
return s;

View file

@ -42,16 +42,16 @@ import writer2latex.util.Misc;
public class TableReader {
//private OfficeReader ofr;
private Element tableNode;
private LinkedList cols = new LinkedList();
private LinkedList rows = new LinkedList();
private LinkedList cells = new LinkedList();
private LinkedList<TableLine> cols = new LinkedList<TableLine>();
private LinkedList<TableLine> rows = new LinkedList<TableLine>();
private LinkedList<LinkedList<Element>> cells = new LinkedList<LinkedList<Element>>();
private int nMaxCols = 1; // real number of columns (count to last non-empty)
private int nMaxRows = 1; // real number of rows (count to last non-empty)
private String[] sColWidth;
private String[] sRelColWidth;
private String sTableWidth;
private String sRelTableWidth;
private Vector printRanges;
private Vector<TableRange> printRanges;
/**
* <p> The constructor reads a table from a table:table or table:sub-table
@ -111,7 +111,7 @@ public class TableReader {
boolean bHasRelWidth=true; // set to false if some columns does not have a relative width set
int nColSum = 0;
for (int nCol=0; nCol<nCols; nCol++) {
StyleWithProperties style = ofr.getColumnStyle(((TableLine) cols.get(nCol)).getStyleName());
StyleWithProperties style = ofr.getColumnStyle(cols.get(nCol).getStyleName());
if (style!=null) {
sColWidth[nCol] = style.getProperty(XMLString.STYLE_COLUMN_WIDTH);
String s = style.getProperty(XMLString.STYLE_REL_COLUMN_WIDTH);
@ -136,7 +136,7 @@ public class TableReader {
// (Calc exports a lot of empty rows at columns bottom/right)
int nRows = cells.size();
for (int nRow=0; nRow<nRows; nRow++) {
LinkedList row = (LinkedList) cells.get(nRow);
LinkedList row = cells.get(nRow);
nCols = row.size();
int nMaxCol = 0;
int nMaxRow = 0;
@ -154,7 +154,7 @@ public class TableReader {
}
// Finally get the print ranges, if any
printRanges = new Vector();
printRanges = new Vector<TableRange>();
if (!"false".equals(tableNode.getAttribute(XMLString.TABLE_PRINT))) {
TableRangeParser parser = new TableRangeParser(tableNode.getAttribute(XMLString.TABLE_PRINT_RANGES));
while (parser.hasMoreRanges()) {
@ -228,7 +228,7 @@ public class TableReader {
rows.add(new TableLine(node,bHeader,bDisplay));
// Read the cells in the row
LinkedList row = new LinkedList();
LinkedList<Element> row = new LinkedList<Element>();
if (node.hasChildNodes()) {
NodeList nl = node.getChildNodes();
int nLen = nl.getLength();
@ -344,7 +344,7 @@ public class TableReader {
public Element getCell(int nRow, int nCol) {
if (nRow<0 || nRow>=cells.size()) { return null; }
LinkedList row = (LinkedList) cells.get(nRow);
LinkedList row = cells.get(nRow);
if (nCol<0 || nCol>=row.size()) { return null; }
return (Element) row.get(nCol);
}
@ -373,19 +373,19 @@ public class TableReader {
public TableLine getRow(int nRow) {
if (nRow<0 || nRow>=rows.size()) { return null; }
return (TableLine) rows.get(nRow);
return rows.get(nRow);
}
public TableLine getCol(int nCol) {
if (nCol<0 || nCol>=cols.size()) { return null; }
return (TableLine) cols.get(nCol);
return cols.get(nCol);
}
public int getPrintRangeCount() { return printRanges.size(); }
public TableRange getPrintRange(int nIndex) {
if (0<=nIndex && nIndex<printRanges.size()) {
return (TableRange) printRanges.get(nIndex);
return printRanges.get(nIndex);
}
else {
return null;

View file

@ -53,7 +53,7 @@ public class TocReader {
Element indexTitleTemplate = null;
Element[] tocEntryTemplate = new Element[11];
Hashtable indexSourceStyles = new Hashtable();
Hashtable<String, Integer> indexSourceStyles = new Hashtable<String, Integer>();
@ -163,7 +163,7 @@ public class TocReader {
/** <p>Get a set view of all index source styles</p>
* @return a set of all index source style names
*/
public Set getIndexSourceStyles() { return indexSourceStyles.keySet(); }
public Set<String> getIndexSourceStyles() { return indexSourceStyles.keySet(); }
/** <p>Get the level associated with a specific index source style</p>
* @param sStyleName the style name of the index source style
@ -171,7 +171,7 @@ public class TocReader {
*/
public int getIndexSourceStyleLevel(String sStyleName) {
if (indexSourceStyles.containsKey(sStyleName)) {
return ((Integer) indexSourceStyles.get(sStyleName)).intValue();
return indexSourceStyles.get(sStyleName).intValue();
}
else {
return -1;

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2008 by Henrik Just
* Copyright: 2002-2009 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.0 (2008-11-10)
* Version 1.2 (2009-03-26)
*
*/
@ -204,6 +204,10 @@ public class XMLString {
public static final String STYLE_REPEAT="style:repeat";
public static final String STYLE_POSITION="style:position";
public static final String STYLE_ADJUSTMENT="style:adjustment";
public static final String STYLE_LANGUAGE_COMPLEX="style:language-complex";
public static final String STYLE_COUNTRY_COMPLEX="style:country-complex";
public static final String STYLE_LANGUAGE_ASIAN="style:language-asian";
public static final String STYLE_COUNTRY_ASIAN="style:country-asian";
// table namespace - elements
public static final String TABLE_="table:";

View file

@ -32,7 +32,7 @@ import java.util.Hashtable;
// Collection of export names
// Used for mapping named collections to simpler names (only A-Z, a-z and 0-9)
public class ExportNameCollection{
private Hashtable exportNames = new Hashtable();
private Hashtable<String, String> exportNames = new Hashtable<String, String>();
private String sPrefix;
private boolean bAcceptNumbers;
@ -45,7 +45,7 @@ public class ExportNameCollection{
this("",b);
}
public Enumeration keys() {
public Enumeration<String> keys() {
return exportNames.keys();
}
@ -89,7 +89,7 @@ public class ExportNameCollection{
public String getExportName(String sName) {
// add the name, if it does not exist
if (!containsName(sName)) { addName(sName); }
return sPrefix + (String) exportNames.get(sName);
return sPrefix + exportNames.get(sName);
}
public boolean containsName(String sName) {

View file

@ -81,15 +81,15 @@ public class Converter extends ConverterBase {
// The xhtml output file(s)
protected int nType = XhtmlDocument.XHTML10; // the doctype
Vector outFiles;
Vector<XhtmlDocument> outFiles;
private int nOutFileIndex;
private XhtmlDocument htmlDoc; // current outfile
private Document htmlDOM; // current DOM, usually within htmlDoc
private boolean bNeedHeaderFooter = false;
// Hyperlinks
Hashtable targets = new Hashtable();
LinkedList links = new LinkedList();
Hashtable<String, Integer> targets = new Hashtable<String, Integer>();
LinkedList<LinkDescriptor> links = new LinkedList<LinkDescriptor>();
// Strip illegal characters from internal hyperlink targets
private ExportNameCollection targetNames = new ExportNameCollection(true);
@ -136,7 +136,7 @@ public class Converter extends ConverterBase {
public void convertInner() throws IOException {
sTargetFileName = Misc.trimDocumentName(sTargetFileName,XhtmlDocument.getExtension(nType));
outFiles = new Vector();
outFiles = new Vector<XhtmlDocument>();
nOutFileIndex = -1;
bNeedHeaderFooter = ofr.isSpreadsheet() || ofr.isPresentation() || config.getXhtmlSplitLevel()>0 || config.getXhtmlUplink().length()>0;
@ -178,10 +178,10 @@ public class Converter extends ConverterBase {
textCv.insertEndnotes(htmlDoc.getContentNode());
// Resolve links
ListIterator iter = links.listIterator();
ListIterator<LinkDescriptor> iter = links.listIterator();
while (iter.hasNext()) {
LinkDescriptor ld = (LinkDescriptor) iter.next();
Integer targetIndex = (Integer) targets.get(ld.sId);
LinkDescriptor ld = iter.next();
Integer targetIndex = targets.get(ld.sId);
if (targetIndex!=null) {
int nTargetIndex = targetIndex.intValue();
if (nTargetIndex == ld.nIndex) { // same file
@ -196,7 +196,7 @@ public class Converter extends ConverterBase {
// Export styles (temp.)
for (int i=0; i<=nOutFileIndex; i++) {
Document dom = ((XhtmlDocument) outFiles.get(i)).getContentDOM();
Document dom = outFiles.get(i).getContentDOM();
NodeList hlist = dom.getElementsByTagName("head");
Node styles = styleCv.exportStyles(dom);
if (styles!=null) {
@ -208,7 +208,7 @@ public class Converter extends ConverterBase {
if (ofr.isSpreadsheet()) {
for (int i=0; i<=nOutFileIndex; i++) {
XhtmlDocument doc = (XhtmlDocument) outFiles.get(i);
XhtmlDocument doc = outFiles.get(i);
Document dom = doc.getContentDOM();
Element header = doc.getHeaderNode();
Element footer = doc.getFooterNode();
@ -233,12 +233,12 @@ public class Converter extends ConverterBase {
int nSheets = tableCv.sheetNames.size();
for (int j=0; j<nSheets; j++) {
if (config.xhtmlCalcSplit()) {
addNavigationLink(dom,headerPar,(String) tableCv.sheetNames.get(j),j);
addNavigationLink(dom,footerPar,(String) tableCv.sheetNames.get(j),j);
addNavigationLink(dom,headerPar,tableCv.sheetNames.get(j),j);
addNavigationLink(dom,footerPar,tableCv.sheetNames.get(j),j);
}
else {
addInternalNavigationLink(dom,headerPar,(String) tableCv.sheetNames.get(j),"tableheading"+j);
addInternalNavigationLink(dom,footerPar,(String) tableCv.sheetNames.get(j),"tableheading"+j);
addInternalNavigationLink(dom,headerPar,tableCv.sheetNames.get(j),"tableheading"+j);
addInternalNavigationLink(dom,footerPar,tableCv.sheetNames.get(j),"tableheading"+j);
}
}
@ -248,7 +248,7 @@ public class Converter extends ConverterBase {
}
else if (ofr.isPresentation() || config.getXhtmlSplitLevel()>0) {
for (int i=0; i<=nOutFileIndex; i++) {
XhtmlDocument doc = (XhtmlDocument) outFiles.get(i);
XhtmlDocument doc = outFiles.get(i);
Document dom = doc.getContentDOM();
//Element content = doc.getContentNode();
@ -304,7 +304,7 @@ public class Converter extends ConverterBase {
}
else if (config.getXhtmlUplink().length()>0) {
for (int i=0; i<=nOutFileIndex; i++) {
XhtmlDocument doc = (XhtmlDocument) outFiles.get(i);
XhtmlDocument doc = outFiles.get(i);
Document dom = doc.getContentDOM();
//Element content = doc.getContentNode();
@ -430,7 +430,7 @@ public class Converter extends ConverterBase {
// Use another document. TODO: This is very ugly; clean it up!!!
public void changeOutFile(int nIndex) {
nOutFileIndex = nIndex;
htmlDoc = (XhtmlDocument) outFiles.get(nIndex);
htmlDoc = outFiles.get(nIndex);
htmlDOM = htmlDoc.getContentDOM();
}
@ -537,7 +537,7 @@ public class Converter extends ConverterBase {
// Recreate nested sections, if any
if (!textCv.sections.isEmpty()) {
Iterator iter = textCv.sections.iterator();
Iterator<Node> iter = textCv.sections.iterator();
while (iter.hasNext()) {
Element section = (Element) iter.next();
String sStyleName = Misc.getAttribute(section,XMLString.TEXT_STYLE_NAME);

View file

@ -94,7 +94,7 @@ public class DrawConverter extends ConverterHelper {
private boolean bOriginalImageSize;
// Frames in spreadsheet documents are collected here
private Vector frames = new Vector();
private Vector<Element> frames = new Vector<Element>();
// This flag determines wether to collect frames or insert them immediately
private boolean bCollectFrames = false;
@ -102,9 +102,9 @@ public class DrawConverter extends ConverterHelper {
super(ofr,config,converter);
// We can only handle one form; pick an arbitrary one.
// Also we cannot split a form over several files.
Iterator formsIterator = ofr.getForms().getFormsIterator();
Iterator<FormReader> formsIterator = ofr.getForms().getFormsIterator();
if (formsIterator.hasNext() && config.getXhtmlSplitLevel()==0) {
form = (FormReader) formsIterator.next();
form = formsIterator.next();
}
bCollectFrames = ofr.isSpreadsheet();
sScale = config.getXhtmlScaling();
@ -222,7 +222,7 @@ public class DrawConverter extends ConverterHelper {
bCollectFrames = false;
int nCount = frames.size();
for (int i=0; i<nCount; i++) {
handleDrawElement((Element) frames.get(i),hnode,null,CENTERED);
handleDrawElement(frames.get(i),hnode,null,CENTERED);
}
frames.clear();
bCollectFrames = true;

View file

@ -63,9 +63,9 @@ public class FrameStyleConverter extends StyleWithPropertiesConverterHelper {
if (bConvertStyles) {
StringBuffer buf = new StringBuffer();
buf.append(super.getStyleDeclarations(sIndent));
Enumeration names = styleNames.keys();
Enumeration<String> names = styleNames.keys();
while (names.hasMoreElements()) {
String sDisplayName = (String) names.nextElement();
String sDisplayName = names.nextElement();
StyleWithProperties style = (StyleWithProperties)
getStyles().getStyleByDisplayName(sDisplayName);
if (!style.isAutomatic()) {

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2009-03-05)
* Version 1.2 (2009-03-27)
*
*/
@ -58,7 +58,7 @@ public class L10n {
case UP: return "Nach oben";
case FIRST : return "Anfang";
case PREVIOUS : return "Vorheriges";
case NEXT : return "N\u00ccchstes";
case NEXT : return "N\u00e4chstes";
case LAST : return "Ende";
case CONTENTS : return "Inhalte";
case INDEX : return "Index";

View file

@ -85,9 +85,9 @@ public class ListStyleConverter extends StyleConverterHelper {
public String getStyleDeclarations(String sIndent) {
if (bConvertStyles) {
StringBuffer buf = new StringBuffer();
Enumeration names = styleNames.keys();
Enumeration<String> names = styleNames.keys();
while (names.hasMoreElements()) {
String sDisplayName = (String) names.nextElement();
String sDisplayName = names.nextElement();
ListStyle style = (ListStyle)
getStyles().getStyleByDisplayName(sDisplayName);
if (!style.isAutomatic()) {

View file

@ -83,10 +83,10 @@ public class PageStyleConverter extends StyleConverterHelper {
*/
public String getStyleDeclarations(String sIndent) {
StringBuffer buf = new StringBuffer();
Enumeration names = styleNames.keys();
Enumeration<String> names = styleNames.keys();
while (names.hasMoreElements()) {
// This will be master pages for presentations only
String sDisplayName = (String) names.nextElement();
String sDisplayName = names.nextElement();
MasterPage style = (MasterPage)
getStyles().getStyleByDisplayName(sDisplayName);
StyleInfo info = new StyleInfo();

View file

@ -45,7 +45,7 @@ public class PresentationStyleConverter extends FrameStyleConverter {
// Data about outline styles
String sCurrentOutlineStyle = null;
Hashtable outlineStyles = new Hashtable();
Hashtable<String, String[]> outlineStyles = new Hashtable<String, String[]>();
ExportNameCollection outlineStyleNames = new ExportNameCollection(true);
/** Create a new <code>PresentationStyleConverter</code>
@ -87,9 +87,9 @@ public class PresentationStyleConverter extends FrameStyleConverter {
if (bConvertStyles) {
StringBuffer buf = new StringBuffer();
buf.append(super.getStyleDeclarations(sIndent));
Enumeration names = outlineStyleNames.keys();
Enumeration<String> names = outlineStyleNames.keys();
while (names.hasMoreElements()) {
String sDisplayName = (String) names.nextElement();
String sDisplayName = names.nextElement();
StyleWithProperties style = (StyleWithProperties)
getStyles().getStyleByDisplayName(sDisplayName);
if (!style.isAutomatic()) {
@ -147,7 +147,7 @@ public class PresentationStyleConverter extends FrameStyleConverter {
public void applyOutlineStyle(int nLevel, StyleInfo info) {
if (2<=nLevel && nLevel<=9 && sCurrentOutlineStyle!=null) {
if (outlineStyles.containsKey(sCurrentOutlineStyle)) {
info.sClass = "outline"+outlineStyleNames.getExportName(((String[]) outlineStyles.get(sCurrentOutlineStyle))[nLevel]);
info.sClass = "outline"+outlineStyleNames.getExportName(outlineStyles.get(sCurrentOutlineStyle)[nLevel]);
}
}
}

View file

@ -93,9 +93,9 @@ public abstract class StyleWithPropertiesConverterHelper
public String getStyleDeclarations(String sIndent) {
if (bConvertStyles) {
StringBuffer buf = new StringBuffer();
Enumeration names = styleNames.keys();
Enumeration<String> names = styleNames.keys();
while (names.hasMoreElements()) {
String sDisplayName = (String) names.nextElement();
String sDisplayName = names.nextElement();
StyleWithProperties style = (StyleWithProperties)
getStyles().getStyleByDisplayName(sDisplayName);
if (!style.isAutomatic()) {

View file

@ -46,7 +46,7 @@ public class TableConverter extends ConverterHelper {
// The collection of all table names
// TODO: Navigation should be handled here rather than in Converter.java
protected Vector sheetNames = new Vector();
protected Vector<String> sheetNames = new Vector<String>();
public TableConverter(OfficeReader ofr, XhtmlConfig config, Converter converter) {
super(ofr,config,converter);

View file

@ -83,27 +83,27 @@ public class TextConverter extends ConverterHelper {
private int nLastSplitLevel = 1; // The outline level at which the last split occured
private int nDontSplitLevel = 0; // if > 0 splitting is forbidden
boolean bAfterHeading=false; // last element was a top level heading
protected Stack sections = new Stack(); // stack of nested sections
protected Stack<Node> sections = new Stack<Node>(); // stack of nested sections
Element[] currentHeading = new Element[7]; // Last headings (repeated when splitting)
// Counters for generated numbers
private ListCounter outlineNumbering;
private Hashtable listCounters = new Hashtable();
private Hashtable<String, ListCounter> listCounters = new Hashtable<String, ListCounter>();
private String sCurrentListLabel = null;
// Mode used to handle floats (depends on source doc type and config)
private int nFloatMode;
// Data used for index bookkeeping
private Vector indexes = new Vector();
private Vector<IndexData> indexes = new Vector<IndexData>();
// Data used to handle Alphabetical Index
Vector index = new Vector(); // All words for the index
Vector<AlphabeticalEntry> index = new Vector<AlphabeticalEntry>(); // All words for the index
private int nIndexIndex = -1; // Current index used for id's (of form idxN)
private int nAlphabeticalIndex = -1; // File containing alphabetical index
// Data used to handle Table of Contents
private Vector tocEntries = new Vector(); // All potential(!) toc items
private Vector<TocEntry> tocEntries = new Vector<TocEntry>(); // All potential(!) toc items
private int nTocFileIndex = -1; // file index for main toc
private Element currentChapter = null; // Node for the current chapter (level 1) heading
private int nTocIndex = -1; // Current index for id's (of form tocN)
@ -116,8 +116,8 @@ public class TextConverter extends ConverterHelper {
private String sEntCitStyle = null;
// Gather the footnotes and endnotes
private LinkedList footnotes = new LinkedList();
private LinkedList endnotes = new LinkedList();
private LinkedList<Node> footnotes = new LinkedList<Node>();
private LinkedList<Node> endnotes = new LinkedList<Node>();
// Sometimes we have to create an inlinenode in a block context
// (labels for footnotes and endnotes)
@ -169,7 +169,7 @@ public class TextConverter extends ConverterHelper {
// Generate all indexes
int nIndexCount = indexes.size();
for (int i=0; i<nIndexCount; i++) {
generateToc((IndexData) indexes.get(i));
generateToc(indexes.get(i));
}
// Generate navigation links
@ -214,7 +214,7 @@ public class TextConverter extends ConverterHelper {
// Get the last heading of level <= split level for this file
TocEntry entryCurrent = null;
for (int i=nLen-1; i>=0; i--) {
TocEntry entry = (TocEntry) tocEntries.get(i);
TocEntry entry = tocEntries.get(i);
if (XMLString.TEXT_H.equals(entry.onode.getTagName()) && entry.nFileIndex==nIndex && entry.nOutlineLevel<=nSplit) {
entryCurrent = entry; break;
}
@ -237,7 +237,7 @@ public class TextConverter extends ConverterHelper {
int nPrevFileIndex = 0;
for (int i=0; i<nLen; i++) {
TocEntry entry = (TocEntry) tocEntries.get(i);
TocEntry entry = tocEntries.get(i);
if (entry.nFileIndex>nPrevFileIndex+1) {
// Skipping a file index means we have passed an index
@ -660,7 +660,7 @@ public class TextConverter extends ConverterHelper {
else if (style!=null) {
// Get existing or create new counter
if (listCounters.containsKey(style.getName())) {
return (ListCounter) listCounters.get(style.getName());
return listCounters.get(style.getName());
}
else {
ListCounter counter = new ListCounter(style);
@ -1066,7 +1066,7 @@ public class TextConverter extends ConverterHelper {
// Find the chapter
if (tocReader.isByChapter() && chapter!=null) {
for (int i=0; i<nLen; i++) {
TocEntry entry = (TocEntry) tocEntries.get(i);
TocEntry entry = tocEntries.get(i);
if (entry.onode==chapter) { nStart=i; break; }
}
@ -1074,7 +1074,7 @@ public class TextConverter extends ConverterHelper {
// Generate entries
for (int i=nStart; i<nLen; i++) {
TocEntry entry = (TocEntry) tocEntries.get(i);
TocEntry entry = tocEntries.get(i);
String sNodeName = entry.onode.getTagName();
if (XMLString.TEXT_H.equals(sNodeName)) {
int nLevel = getOutlineLevel(entry.onode);
@ -1219,8 +1219,8 @@ public class TextConverter extends ConverterHelper {
}
for (int i = 0; i<=nIndexIndex; i++) {
for (int j = i+1; j<=nIndexIndex ; j++) {
AlphabeticalEntry entryi = (AlphabeticalEntry) index.get(i);
AlphabeticalEntry entryj = (AlphabeticalEntry) index.get(j);
AlphabeticalEntry entryi = index.get(i);
AlphabeticalEntry entryj = index.get(j);
if (collator.compare(entryi.sWord, entryj.sWord) > 0) {
index.set(i,entryj);
index.set(j,entryi);
@ -1243,7 +1243,7 @@ public class TextConverter extends ConverterHelper {
int nColIndex = -1;
for (int i=0; i<=nIndexIndex; i++) {
if (i%nColEntries==0) { nColIndex++; }
AlphabeticalEntry entry = (AlphabeticalEntry) index.get(i);
AlphabeticalEntry entry = index.get(i);
Element p = createParagraph(td[nColIndex],sEntryStyleName);
Element a = converter.createLink("idx"+entry.nIndex);
p.appendChild(a);
@ -1517,7 +1517,7 @@ public class TextConverter extends ConverterHelper {
public void insertFootnotes(Node hnode) {
int n = footnotes.size();
for (int i=0; i<n; i++) {
Node footnote = (Node) footnotes.get(i);
Node footnote = footnotes.get(i);
String sId = Misc.getAttribute(footnote,XMLString.TEXT_ID);
Node citation = Misc.getChildByTagName(footnote,XMLString.TEXT_FOOTNOTE_CITATION);
if (citation==null) { // try oasis
@ -1552,7 +1552,7 @@ public class TextConverter extends ConverterHelper {
int n = endnotes.size();
if (nSplit>0 && n>0) { hnode = converter.nextOutFile(); }
for (int i=0; i<n; i++) {
Node endnote = (Node) endnotes.get(i);
Node endnote = endnotes.get(i);
String sId = Misc.getAttribute(endnote,XMLString.TEXT_ID);
Node citation = Misc.getChildByTagName(endnote,XMLString.TEXT_ENDNOTE_CITATION);
if (citation==null) { // try oasis

View file

@ -60,9 +60,9 @@ public class TextStyleConverter extends StyleWithPropertiesConverterHelper {
// Bookkeeping for anchors
private ExportNameCollection anchorStyleNames = new ExportNameCollection(true);
private ExportNameCollection anchorVisitedStyleNames = new ExportNameCollection(true);
private Hashtable anchorCombinedStyleNames = new Hashtable();
private Hashtable orgAnchorStyleNames = new Hashtable();
private Hashtable orgAnchorVisitedStyleNames = new Hashtable();
private Hashtable<String, String> anchorCombinedStyleNames = new Hashtable<String, String>();
private Hashtable<String, String> orgAnchorStyleNames = new Hashtable<String, String>();
private Hashtable<String, String> orgAnchorVisitedStyleNames = new Hashtable<String, String>();
/** Create a new <code>TextStyleConverter</code>
* @param ofr an <code>OfficeReader</code> to read style information from
@ -111,7 +111,7 @@ public class TextStyleConverter extends StyleWithPropertiesConverterHelper {
orgAnchorStyleNames.put(sExportName,sStyleName);
orgAnchorVisitedStyleNames.put(sExportName,sVisitedStyleName);
}
info.sClass = (String)anchorCombinedStyleNames.get(sName);
info.sClass = anchorCombinedStyleNames.get(sName);
}
/** <p>Convert style information for used styles</p>
@ -144,11 +144,11 @@ public class TextStyleConverter extends StyleWithPropertiesConverterHelper {
}
// Remaining link styles...
Enumeration enumer = anchorCombinedStyleNames.elements();
Enumeration<String> enumer = anchorCombinedStyleNames.elements();
while (enumer.hasMoreElements()) {
String sExportName = (String) enumer.nextElement();
String sStyleName = (String) orgAnchorStyleNames.get(sExportName);
String sVisitedStyleName = (String) orgAnchorVisitedStyleNames.get(sExportName);
String sExportName = enumer.nextElement();
String sStyleName = orgAnchorStyleNames.get(sExportName);
String sVisitedStyleName = orgAnchorVisitedStyleNames.get(sExportName);
StyleWithProperties style = ofr.getTextStyle(sStyleName);

View file

@ -191,9 +191,9 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
}
private void writeXStyleMap(Document dom, XhtmlStyleMap sm, String sFamily) {
Enumeration smEnum = sm.getNames();
Enumeration<String> smEnum = sm.getNames();
while (smEnum.hasMoreElements()) {
String sName = (String) smEnum.nextElement();
String sName = smEnum.nextElement();
Element smNode = dom.createElement("xhtml-style-map");
smNode.setAttribute("name",sName);
smNode.setAttribute("family",sFamily);

View file

@ -30,10 +30,10 @@ import java.util.Hashtable;
import java.util.Enumeration;
public class XhtmlStyleMap {
private Hashtable blockElement = new Hashtable();
private Hashtable blockCss = new Hashtable();
private Hashtable element = new Hashtable();
private Hashtable css = new Hashtable();
private Hashtable<String, String> blockElement = new Hashtable<String, String>();
private Hashtable<String, String> blockCss = new Hashtable<String, String>();
private Hashtable<String, String> element = new Hashtable<String, String>();
private Hashtable<String, String> css = new Hashtable<String, String>();
public void put(String sName, String sBlockElement, String sBlockCss, String sElement, String sCss) {
blockElement.put(sName,sBlockElement);
@ -47,22 +47,22 @@ public class XhtmlStyleMap {
}
public String getBlockElement(String sName) {
return (String) blockElement.get(sName);
return blockElement.get(sName);
}
public String getBlockCss(String sName) {
return (String) blockCss.get(sName);
return blockCss.get(sName);
}
public String getElement(String sName) {
return (String) element.get(sName);
return element.get(sName);
}
public String getCss(String sName) {
return (String) css.get(sName);
return css.get(sName);
}
public Enumeration getNames() {
public Enumeration<String> getNames() {
return element.keys();
}

View file

@ -64,7 +64,7 @@ public class ConvertData implements ConverterResult {
/**
* Vector of <code>OutputFile</code> objects.
*/
private Vector v = new Vector();
private Vector<OutputFile> v = new Vector<OutputFile>();
/** Master doc */
private OutputFile masterDoc = null;
@ -137,7 +137,7 @@ public class ConvertData implements ConverterResult {
* @return The <code>Iterator</code> to access the
* <code>Vector</code> of <code>OutputFile</code> objects.
*/
public Iterator iterator() {
public Iterator<OutputFile> iterator() {
return v.iterator();
}
@ -154,9 +154,9 @@ public class ConvertData implements ConverterResult {
public void write(File dir) throws IOException {
if (dir!=null && !dir.exists()) throw new IOException("Directory does not exist");
Iterator docEnum = iterator();
Iterator<OutputFile> docEnum = iterator();
while (docEnum.hasNext()) {
OutputFile docOut = (OutputFile) docEnum.next();
OutputFile docOut = docEnum.next();
String sDirName = "";
String sFileName = docOut.getFileName();
File subdir = dir;

View file

@ -120,7 +120,7 @@ public class OfficeDocument
private OfficeZip zip = null;
/** Collection to keep track of the embedded objects in the document. */
private Map embeddedObjects = null;
private Map<String, EmbeddedObject> embeddedObjects = null;
/**
* Default constructor.
@ -320,10 +320,10 @@ public class OfficeDocument
*
* @return An <code>Iterator</code> of <code>EmbeddedObject</code> objects.
*/
public Iterator getEmbeddedObjects() {
public Iterator<EmbeddedObject> getEmbeddedObjects() {
if (embeddedObjects == null && manifestDoc != null) {
embeddedObjects = new HashMap();
embeddedObjects = new HashMap<String, EmbeddedObject>();
// Need to read the manifest file and construct a list of objects
NodeList nl = manifestDoc.getElementsByTagName(TAG_MANIFEST_FILE);
@ -400,7 +400,7 @@ public class OfficeDocument
}
if (embeddedObjects.containsKey(name)) {
return (EmbeddedObject)embeddedObjects.get(name);
return embeddedObjects.get(name);
}
else {
return null;
@ -419,7 +419,7 @@ public class OfficeDocument
}
if (embeddedObjects == null) {
embeddedObjects = new HashMap();
embeddedObjects = new HashMap<String, EmbeddedObject>();
}
embeddedObjects.put(embObj.getName(), embObj);
@ -734,9 +734,9 @@ public class OfficeDocument
Element manifestRoot = manifestDoc.getDocumentElement();
// The EmbeddedObjects come first.
Iterator embObjs = getEmbeddedObjects();
Iterator<EmbeddedObject> embObjs = getEmbeddedObjects();
while (embObjs.hasNext()) {
EmbeddedObject obj = (EmbeddedObject)embObjs.next();
EmbeddedObject obj = embObjs.next();
obj.writeManifestData(manifestDoc);
obj.write(zip);

View file

@ -75,7 +75,7 @@ class OfficeZip {
private final static int BUFFERSIZE = 1024;
private List entryList = null;
private List<Entry> entryList = null;
private int contentIndex = -1;
private int styleIndex = -1;
@ -86,7 +86,7 @@ class OfficeZip {
/** Default constructor. */
OfficeZip() {
entryList = new LinkedList();
entryList = new LinkedList<Entry>();
}
@ -229,7 +229,7 @@ class OfficeZip {
// Could improve performance by caching the name and index when
// iterating through the ZipFile in read().
for (int i = 0; i < entryList.size(); i++) {
Entry e = (Entry)entryList.get(i);
Entry e = entryList.get(i);
if (e.zipEntry.getName().equals(name)) {
return getEntryBytes(i);
@ -252,7 +252,7 @@ class OfficeZip {
*/
void setNamedBytes(String name, byte[] bytes) {
for (int i = 0; i < entryList.size(); i++) {
Entry e = (Entry)entryList.get(i);
Entry e = entryList.get(i);
if (e.zipEntry.getName().equals(name)) {
setEntryBytes(i, bytes, name);
@ -283,7 +283,7 @@ class OfficeZip {
byte[] bytes = null;
if (index > -1) {
Entry entry = (Entry) entryList.get(index);
Entry entry = entryList.get(index);
bytes = entry.bytes;
}
return bytes;
@ -373,7 +373,7 @@ class OfficeZip {
// replace existing entry in entryList
Entry entry = (Entry) entryList.get(index);
Entry entry = entryList.get(index);
name = entry.zipEntry.getName();
int method = entry.zipEntry.getMethod();
@ -409,11 +409,11 @@ class OfficeZip {
ZipOutputStream zos = new ZipOutputStream(os);
ListIterator iterator = entryList.listIterator();
ListIterator<Entry> iterator = entryList.listIterator();
while (iterator.hasNext()) {
Entry entry = (Entry) iterator.next();
Entry entry = iterator.next();
ZipEntry ze = entry.zipEntry;
//String name = ze.getName();

View file

@ -5,7 +5,7 @@
<identifier value="org.openoffice.da.writer2latex.oxt"/>
<version value="1.0" />
<version value="1.1.1" />
<dependencies>
<OpenOffice.org-minimal-version value="2.2" d:name="OpenOffice.org 2.2"/>
@ -22,13 +22,13 @@
</display-name>
<extension-description>
<src xlink:href="description/desc_da.txt" lang="da" />
<src xlink:href="description/desc_en.txt" lang="en" />
<src xlink:href="description/desc_de.txt" lang="de" />
<src xlink:href="description/desc_es.txt" lang="es" />
<src xlink:href="description/desc_fr.txt" lang="fr" />
<src xlink:href="description/desc_ru.txt" lang="ru" />
<src xlink:href="description/desc_uk.txt" lang="uk" />
<src xlink:href="desc_da.txt" lang="da" />
<src xlink:href="desc_en.txt" lang="en" />
<src xlink:href="desc_de.txt" lang="de" />
<src xlink:href="desc_es.txt" lang="es" />
<src xlink:href="desc_fr.txt" lang="fr" />
<src xlink:href="desc_ru.txt" lang="ru" />
<src xlink:href="desc_uk.txt" lang="uk" />
</extension-description>
</description>

View file

@ -4,7 +4,7 @@
<identifier value="org.openoffice.da.writer2xhtml.oxt" />
<version value="1.0" />
<version value="1.1.1" />
<dependencies>
<OpenOffice.org-minimal-version value="2.2" d:name="OpenOffice.org 2.2"/>
@ -21,13 +21,13 @@
</display-name>
<extension-description>
<src xlink:href="description/desc_da.txt" lang="da" />
<src xlink:href="description/desc_en.txt" lang="en" />
<src xlink:href="description/desc_de.txt" lang="de" />
<src xlink:href="description/desc_es.txt" lang="es" />
<src xlink:href="description/desc_fr.txt" lang="fr" />
<src xlink:href="description/desc_ru.txt" lang="ru" />
<src xlink:href="description/desc_uk.txt" lang="uk" />
<src xlink:href="desc_da.txt" lang="da" />
<src xlink:href="desc_en.txt" lang="en" />
<src xlink:href="desc_de.txt" lang="de" />
<src xlink:href="desc_es.txt" lang="es" />
<src xlink:href="desc_fr.txt" lang="fr" />
<src xlink:href="desc_ru.txt" lang="ru" />
<src xlink:href="desc_uk.txt" lang="uk" />
</extension-description>
</description>

View file

@ -0,0 +1,142 @@
<?xml version='1.0' encoding='UTF-8'?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons" oor:package="org.openoffice.Office">
<!-- Defines the menus and toolbars provided by Writer4LaTeX -->
<node oor:name="AddonUI">
<node oor:name="OfficeMenuBar">
<node oor:name="org.openoffice.da.writer4latex" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value>Writer4LaTeX</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
<prop oor:name="ImageIdentifier" oor:type="xs:string">
<value/>
</prop>
<node oor:name="Submenu">
<node oor:name="menu1" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en-US">Run LaTeX...</value>
<value xml:lang="da">K&#x00F8;r LaTeX...</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>org.openoffice.da.writer4latex:ProcessDocument</value>
</prop>
<prop oor:name="ImageIdentifier" oor:type="xs:string">
<value/>
</prop>
</node>
<node oor:name="menu2" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en-US">Run LaTeX directly</value>
<value xml:lang="da">K&#x00F8;r LaTeX direkte</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>org.openoffice.da.writer4latex:ProcessDirectly</value>
</prop>
<prop oor:name="ImageIdentifier" oor:type="xs:string">
<value/>
</prop>
</node>
<node oor:name="menu3" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en-US">View Log files</value>
<value xml:lang="da">Vis logfiler</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>org.openoffice.da.writer4latex:ViewLog</value>
</prop>
<prop oor:name="ImageIdentifier" oor:type="xs:string">
<value/>
</prop>
</node>
<!--later:
<node oor:name="menu4" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en-US">Use BibTeX files...</value>
<value xml:lang="da">Anvend BibTeX filer...</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>org.openoffice.da.writer4latex:UseBibTeX</value>
</prop>
<prop oor:name="ImageIdentifier" oor:type="xs:string">
<value/>
</prop>
</node>
-->
<node oor:name="menu5" oor:op="replace">
<prop oor:name="URL" oor:type="xs:string">
<value>private:separator</value>
</prop>
</node>
<node oor:name="menu6" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en-US">Import LaTeX...</value>
<value xml:lang="da">Importer LaTeX...</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>org.openoffice.da.writer4latex:ImportLaTeX</value>
</prop>
<prop oor:name="ImageIdentifier" oor:type="xs:string">
<value/>
</prop>
</node>
<!--later:
<node oor:name="menu7" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.text.TextDocument</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en-US">Import BibTeX...</value>
<value xml:lang="da">Importer BibTeX...</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>org.openoffice.da.writer4latex:ImportBibTeX</value>
</prop>
<prop oor:name="ImageIdentifier" oor:type="xs:string">
<value/>
</prop>
</node>
-->
</node>
</node>
</node>
</node>
</oor:component-data>

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
<manifest:manifest>
<manifest:file-entry
manifest:full-path="ProtocolHandler.xcu"
manifest:media-type="application/vnd.sun.star.configuration-data"/>
<manifest:file-entry
manifest:full-path="Addons.xcu"
manifest:media-type="application/vnd.sun.star.configuration-data"/>
<manifest:file-entry
manifest:full-path="OptionsDialog.xcu"
manifest:media-type="application/vnd.sun.star.configuration-data"/>
<manifest:file-entry
manifest:full-path="Options.xcs"
manifest:media-type="application/vnd.sun.star.configuration-schema"/>
<manifest:file-entry
manifest:full-path="Options.xcu"
manifest:media-type="application/vnd.sun.star.configuration-data"/>
<manifest:file-entry
manifest:full-path="W2LOptions.xcu"
manifest:media-type="application/vnd.sun.star.configuration-data"/>
<manifest:file-entry
manifest:full-path="Paths.xcu"
manifest:media-type="application/vnd.sun.star.configuration-data"/>
<manifest:file-entry
manifest:full-path="writer4latex.jar"
manifest:media-type="application/vnd.sun.star.uno-component;type=Java"/>
<manifest:file-entry
manifest:full-path="W4LDialogs/"
manifest:media-type="application/vnd.sun.star.basic-library"/>
</manifest:manifest>

View file

@ -0,0 +1,28 @@
<?xml version='1.0' encoding='UTF-8'?>
<oor:component-schema oor:name="Options"
oor:package="org.openoffice.da.Writer4LaTeX"
xml:lang="en-US"
xmlns:oor="http://openoffice.org/2001/registry"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<templates>
<group oor:name="Application">
<prop oor:name="Executable" oor:type="xs:string" />
<prop oor:name="Options" oor:type="xs:string" />
</group>
</templates>
<component>
<group oor:name="Applications">
<node-ref oor:name="LaTeX" oor:node-type="Application" />
<node-ref oor:name="PdfLaTeX" oor:node-type="Application" />
<node-ref oor:name="XeLaTeX" oor:node-type="Application" />
<node-ref oor:name="BibTeX" oor:node-type="Application" />
<node-ref oor:name="Makeindex" oor:node-type="Application" />
<node-ref oor:name="Oolatex" oor:node-type="Application" />
<node-ref oor:name="Dvips" oor:node-type="Application" />
<node-ref oor:name="DVIViewer" oor:node-type="Application" />
<node-ref oor:name="PostscriptViewer" oor:node-type="Application" />
<node-ref oor:name="PdfViewer" oor:node-type="Application" />
</group>
</component>
</oor:component-schema>

View file

@ -0,0 +1,89 @@
<?xml version='1.0' encoding='UTF-8'?>
<oor:component-data oor:name="Options"
oor:package="org.openoffice.da.Writer4LaTeX"
xml:lang="en-US"
xmlns:oor="http://openoffice.org/2001/registry"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<node oor:name="Applications">
<node oor:name="LaTeX" oor:type="xs:string">
<prop oor:name="Executable">
<value>latex</value>
</prop>
<prop oor:name="Options">
<value>--interaction=batchmode %s</value>
</prop>
</node>
<node oor:name="PdfLaTeX" oor:type="xs:string">
<prop oor:name="Executable">
<value>pdflatex</value>
</prop>
<prop oor:name="Options">
<value>--interaction=batchmode %s</value>
</prop>
</node>
<node oor:name="XeLaTeX" oor:type="xs:string">
<prop oor:name="Executable">
<value>xelatex</value>
</prop>
<prop oor:name="Options">
<value>--interaction=batchmode %s</value>
</prop>
</node>
<node oor:name="BibTeX" oor:type="xs:string">
<prop oor:name="Executable">
<value>bibtex</value>
</prop>
<prop oor:name="Options">
<value>%s</value>
</prop>
</node>
<node oor:name="Makeindex" oor:type="xs:string">
<prop oor:name="Executable">
<value>makeindex</value>
</prop>
<prop oor:name="Options">
<value>%s</value>
</prop>
</node>
<node oor:name="Oolatex" oor:type="xs:string">
<prop oor:name="Executable">
<value>oolatex</value>
</prop>
<prop oor:name="Options">
<value>%s</value>
</prop>
</node>
<node oor:name="Dvips" oor:type="xs:string">
<prop oor:name="Executable">
<value>dvips</value>
</prop>
<prop oor:name="Options">
<value>%s</value>
</prop>
</node>
<node oor:name="DVIViewer" oor:type="xs:string">
<prop oor:name="Executable">
<value>evince</value>
</prop>
<prop oor:name="Options">
<value>%s</value>
</prop>
</node>
<node oor:name="PostscriptViewer" oor:type="xs:string">
<prop oor:name="Executable">
<value>evince</value>
</prop>
<prop oor:name="Options">
<value>%s</value>
</prop>
</node>
<node oor:name="PdfViewer" oor:type="xs:string">
<prop oor:name="Executable">
<value>evince</value>
</prop>
<prop oor:name="Options">
<value>%s</value>
</prop>
</node>
</node>
</oor:component-data>

View file

@ -0,0 +1,29 @@
<?xml version='1.0' encoding='UTF-8'?>
<oor:component-data oor:name="OptionsDialog" oor:package="org.openoffice.Office"
xmlns:oor="http://openoffice.org/2001/registry"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node oor:name="Nodes">
<node oor:name="Writer" oor:op="fuse">
<node oor:name="Leaves">
<node oor:name="org.openoffice.da.writer4latex.configuration"
oor:op="fuse">
<prop oor:name="Id">
<value>org.openoffice.da.writer4latex.oxt</value>
</prop>
<prop oor:name="Label">
<value xml:lang="en-US">Writer4LaTeX</value>
</prop>
<prop oor:name="OptionsPage">
<value>%origin%/W4LDialogs/Configuration.xdl</value>
</prop>
<prop oor:name="EventHandlerService">
<value>org.openoffice.da.writer4latex.ConfigurationDialog</value>
</prop>
</node>
</node>
</node>
</node>
</oor:component-data>

View file

@ -0,0 +1,12 @@
<?xml version='1.0' encoding='UTF-8'?>
<oor:component-data oor:package="org.openoffice.Office" oor:name="Paths" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- Declares the templates provided by w4l -->
<node oor:name="Paths">
<node oor:name="Template" oor:op="fuse">
<node oor:name="InternalPaths">
<node oor:name="%origin%/template" oor:op="fuse"/>
</node>
</node>
</node>
</oor:component-data>

View file

@ -0,0 +1,12 @@
<?xml version='1.0' encoding='UTF-8'?>
<oor:component-data oor:name="ProtocolHandler" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- Declares the dispatch protocol handled by Writer4LaTeX -->
<node oor:name="HandlerSet">
<!-- It seems that the node name must equal the implementation name of the service -->
<node oor:name="org.openoffice.da.comp.writer4latex.Writer4LaTeX" oor:op="replace">
<prop oor:name="Protocols" oor:type="oor:string-list">
<value>org.openoffice.da.writer4latex:*</value>
</prop>
</node>
</node>
</oor:component-data>

View file

@ -0,0 +1,36 @@
<?xml version='1.0' encoding='UTF-8'?>
<oor:component-data oor:name="Options"
oor:package="org.openoffice.da.Writer2LaTeX"
xml:lang="en-US"
xmlns:oor="http://openoffice.org/2001/registry"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Defines the w2l configuration packages -->
<node oor:name="LaTeXOptions">
<node oor:name="Configurations">
<node oor:name="w4l-article" oor:op="replace">
<prop oor:name="LockedOptions" oor:type="xs:string">
<value></value>
</prop>
<prop oor:name="DisplayName" oor:type="xs:string" oor:localized="true">
<value>W4L: LaTeX article</value>
</prop>
<prop oor:name="ConfigURL" oor:type="xs:string">
<value>%origin%/config/article.xml</value>
</prop>
</node>
</node>
<node oor:name="Templates">
<node oor:name="w4l-article-template" oor:op="replace">
<prop oor:name="TemplateName" oor:type="xs:string">
<value>LaTeX-article</value>
</prop>
<prop oor:name="ConfigName" oor:type="xs:string">
<value>w4l-article</value>
</prop>
</node>
</node>
</node>
</oor:component-data>

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Configuration" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="101" dlg:closeable="true" dlg:moveable="true" dlg:title="Writer4LaTeX Configuration" dlg:withtitlebar="false">
<dlg:bulletinboard>
<dlg:text dlg:id="ExternalAppsLabel" dlg:tab-index="0" dlg:left="6" dlg:top="4" dlg:width="210" dlg:height="12" dlg:value="External Applications"/>
<dlg:text dlg:id="AppLabel" dlg:tab-index="1" dlg:left="12" dlg:top="18" dlg:width="55" dlg:height="12" dlg:value="Application"/>
<dlg:button dlg:id="BrowseButton" dlg:tab-index="5" dlg:left="200" dlg:top="30" dlg:width="55" dlg:height="14" dlg:value="Browse...">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:BrowseClick" script:language="UNO"/>
</dlg:button>
<dlg:text dlg:id="ExecutableLabel" dlg:tab-index="3" dlg:left="12" dlg:top="32" dlg:width="55" dlg:height="12" dlg:value="Executable"/>
<dlg:menulist dlg:id="Application" dlg:tab-index="2" dlg:left="72" dlg:top="17" dlg:width="120" dlg:height="12" dlg:spin="true" dlg:linecount="9">
<dlg:menupopup>
<dlg:menuitem dlg:value="LaTeX" dlg:selected="true"/>
<dlg:menuitem dlg:value="PdfLaTeX"/>
<dlg:menuitem dlg:value="XeLaTeX"/>
<dlg:menuitem dlg:value="Dvips"/>
<dlg:menuitem dlg:value="BibTeX"/>
<dlg:menuitem dlg:value="MakeIndex"/>
<dlg:menuitem dlg:value="TeX4ht (oolatex)"/>
<dlg:menuitem dlg:value="DVI Viewer"/>
<dlg:menuitem dlg:value="PDF Viewer"/>
<dlg:menuitem dlg:value="PostScript Viewer"/>
</dlg:menupopup>
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:ApplicationChange" script:language="UNO"/>
</dlg:menulist>
<dlg:textfield dlg:id="Executable" dlg:tab-index="4" dlg:left="72" dlg:top="31" dlg:width="120" dlg:height="12">
<script:event script:event-name="on-blur" script:macro-name="vnd.sun.star.UNO:ExecutableUnfocus" script:language="UNO"/>
</dlg:textfield>
<dlg:textfield dlg:id="Options" dlg:tab-index="7" dlg:left="72" dlg:top="45" dlg:width="120" dlg:height="12">
<script:event script:event-name="on-blur" script:macro-name="vnd.sun.star.UNO:OptionsUnfocus" script:language="UNO"/>
</dlg:textfield>
<dlg:button dlg:id="AutoButton" dlg:tab-index="8" dlg:left="72" dlg:top="65" dlg:width="120" dlg:height="14" dlg:value="Automatic configuration">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:AutomaticClick" script:language="UNO"/>
</dlg:button>
<dlg:button dlg:id="CommandButton1" dlg:tab-index="9" dlg:left="205" dlg:top="85" dlg:width="2" dlg:height="0" dlg:value="CommandButton1"/>
<dlg:text dlg:id="OptionsLabel" dlg:tab-index="6" dlg:left="12" dlg:top="46" dlg:width="55" dlg:height="12" dlg:value="Options"/>
</dlg:bulletinboard>
</dlg:window>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="LogViewer" dlg:left="122" dlg:top="43" dlg:width="360" dlg:height="360" dlg:closeable="true" dlg:moveable="true" dlg:title="Writer4LaTeX Log Viewer">
<dlg:bulletinboard>
<dlg:radiogroup>
<dlg:radio dlg:id="LaTeXOption" dlg:tab-index="0" dlg:left="10" dlg:top="10" dlg:width="100" dlg:height="12" dlg:value="View LaTeX log" dlg:checked="true">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:ViewLaTeXLog" script:language="UNO"/>
</dlg:radio>
<dlg:radio dlg:id="BibTeXOption" dlg:tab-index="1" dlg:left="120" dlg:top="10" dlg:width="100" dlg:height="12" dlg:value="View BibTeX log">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:ViewBibTeXLog" script:language="UNO"/>
</dlg:radio>
<dlg:radio dlg:id="MakeindexOption" dlg:tab-index="2" dlg:left="230" dlg:top="10" dlg:width="100" dlg:height="12" dlg:value="View Makeindex log">
<script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.UNO:ViewMakeindexLog" script:language="UNO"/>
</dlg:radio>
</dlg:radiogroup>
<dlg:textfield dlg:id="LogContents" dlg:tab-index="3" dlg:left="10" dlg:top="26" dlg:width="340" dlg:height="300" dlg:hscroll="true" dlg:vscroll="true" dlg:multiline="true" dlg:value="asfg"/>
<dlg:button dlg:id="CloseButton" dlg:tab-index="4" dlg:left="10" dlg:top="336" dlg:width="70" dlg:height="12" dlg:value="Close" dlg:button-type="ok"/>
</dlg:bulletinboard>
</dlg:window>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic">REM ***** BASIC *****
Sub Main
End Sub
</script:module>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="W4LDialogs" library:readonly="false" library:passwordprotected="false">
<library:element library:name="Configuration"/>
<library:element library:name="LogViewer"/>
</library:library>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="W4LDialogs" library:readonly="false" library:passwordprotected="false">
<library:element library:name="Module1"/>
</library:library>

View file

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- article.xml
This is a configuration file for Writer4LaTeX.
It contains a lot of style mappings, which correspond to
the template LaTeX-article.stw.
Some definitions have been chosen for compatibility with tex4ht
-->
<config>
<!-- Options. These can be adjusted to add support for various packages -->
<option name="no_preamble" value="false" />
<option name="documentclass" value="article" />
<option name="global_options" value="" />
<option name="backend" value="generic" />
<option name="inputencoding" value="ascii" />
<option name="multilingual" value="true" />
<option name="greek_math" value="true" />
<option name="use_ooomath" value="true" />
<option name="use_pifont" value="false" />
<option name="use_ifsym" value="false" />
<option name="use_wasysym" value="false" />
<option name="use_bbding" value="false" />
<option name="use_eurosym" value="false" />
<option name="use_tipa" value="false" />
<option name="use_color" value="true" />
<option name="use_colortbl" value="false" />
<option name="use_hyperref" value="true" />
<option name="use_endnotes" value="false" />
<option name="use_ulem" value="false" />
<option name="use_lastpage" value="true" />
<option name="use_bibtex" value="true" />
<option name="bibtex_style" value="plain" />
<option name="formatting" value="ignore_most" />
<option name="page_formatting" value="ignore_all" />
<option name="ignore_empty_paragraphs" value="true" />
<option name="ignore_hard_page_breaks" value="false" />
<option name="ignore_hard_line_breaks" value="false" />
<option name="ignore_double_spaces" value="true" />
<option name="debug" value="false" />
<custom-preamble>\newtheorem{theorem}{Theorem}</custom-preamble>
<!-- Style maps: These rules defines how styles in OOo are mapped to LaTeX code.
Where possible, predefined styles from OOo are used. This include:
* Paragraph styles "Title", "Heading 2-6", "Quotations", "Preformatted Text",
"List Heading", "List Contents", "Text body", "First line indent",
"Table Heading", "Table contents", "Horizontal line"
* Text styles Emphasis, Teletype-->
<!-- Definitions for headings. Note that \part{} is not a heading in OOo because
it's not part of the outline numbering.
Also note that Heading 1 is not used (reserved for \chapter in book and
report classes).
-->
<style-map name="part" class="paragraph" before="\part{" after="}" line-break="false" />
<style-map name="part" class="list" before="" after="" />
<style-map name="part" class="listitem" before="" after="" />
<heading-map max-level="6">
<heading-level-map writer-level="1" name="section" level="1" />
<heading-level-map writer-level="2" name="section" level="1" />
<heading-level-map writer-level="3" name="subsection" level="2" />
<heading-level-map writer-level="4" name="subsubsection" level="3" />
<heading-level-map writer-level="5" name="paragraph" level="4" />
<heading-level-map writer-level="6" name="subparagraph" level="5" />
</heading-map>
<!-- Defintions for \maketitle. At least one of the styles Title, Author, Date
in any order will give correct results.
Uses a predefined style from OOo for the title -->
<style-map name="Title" class="paragraph" before="\title{" after="}" line-break="false" />
<style-map name="author" class="paragraph" before="\author{" after="}" line-break="false" />
<style-map name="date" class="paragraph" before="\date{" after="}" line-break="false" />
<style-map name="Title" class="paragraph-block" next="author;date" before="" after="\maketitle" />
<style-map name="author" class="paragraph-block" next="Title;date" before="" after="\maketitle" />
<style-map name="date" class="paragraph-block" next="Title;author" before="" after="\maketitle" />
<!-- Definitions for the abstract. The abstract can contain any number of paragraphs -->
<style-map name="abstract title" class="paragraph" before="\renewcommand\abstractname{" after="}" line-break="false" />
<style-map name="abstract" class="paragraph" before="" after="" />
<style-map name="abstract" class="paragraph-block" next="abstract" before="\begin{abstract}" after="\end{abstract}" />
<!-- Definitions for standard LaTeX environments. Several paragraphs will be
conbined into a single environment. -->
<!-- flushleft -->
<style-map name="flushleft" class="paragraph-block" next="flushleft" before="\begin{flushleft}" after="\end{flushleft}" />
<style-map name="flushleft" class="paragraph" before="" after="" />
<!-- flushright -->
<style-map name="flushright" class="paragraph-block" next="flushright" before="\begin{flushright}" after="\end{flushright}" />
<style-map name="flushright" class="paragraph" before="" after="" />
<!-- center -->
<style-map name="center" class="paragraph-block" next="center" before="\begin{center}" after="\end{center}" />
<style-map name="center" class="paragraph" before="" after="" />
<!-- quote -->
<style-map name="quote" class="paragraph-block" next="quote" before="\begin{quote}" after="\end{quote}" />
<style-map name="quote" class="paragraph" before="" after="" />
<!-- quotation; using predefined style from OOo -->
<style-map name="Quotations" class="paragraph-block" next="Quotations" before="\begin{quotation}" after="\end{quotation}" />
<style-map name="Quotations" class="paragraph" before="" after="" />
<!-- verse -->
<style-map name="verse" class="paragraph-block" next="verse" before="\begin{verse}" after="\end{verse}" />
<style-map name="verse" class="paragraph" before="" after="" />
<!-- verbatim; using predefined style from OOo. Note the attribute verbatim,
which instructs OOo to output the content verbatim (characters not
available in the inputencoding will be replaced by question marks; non-
character content will be lost). -->
<style-map name="Preformatted Text" class="paragraph-block" next="Preformatted Text" before="\begin{verbatim}" after="\end{verbatim}" />
<style-map name="Preformatted Text" class="paragraph" before="" after="" verbatim="true" />
<!-- Definitions for some standard OOo paragraph styles -->
<style-map name="Text body" class="paragraph" before="" after="" />
<style-map name="First line indent" class="paragraph" before="" after="" />
<style-map name="Table Heading" class="paragraph" before="\textbf{" after="}" line-break="false" />
<style-map name="Table Contents" class="paragraph" before="" after="" />
<style-map name="Horizontal Line" class="paragraph" before="" after="\begin{center}\hrule\end{center}" />
<!-- Definitions for text styles.
Uses a predefined OOo style for \emph and \texttt -->
<style-map name="obeylines-h" class="text" before="" after="" />
<style-map name="verb" class="text" before="\verb|" after="|" verbatim="true" />
<style-map name="Emphasis" class="text" before="\emph{" after="}" />
<style-map name="Strong Emphasis" class="text" before="\textbf{" after="}" />
<style-map name="textrm" class="text" before="\textrm{" after="}" />
<style-map name="textsf" class="text" before="\textsf{" after="}" />
<style-map name="Teletype" class="text" before="\texttt{" after="}" />
<style-map name="texttt" class="text" before="\texttt{" after="}" />
<style-map name="textup" class="text" before="\textup{" after="}" />
<style-map name="textsl" class="text" before="\textsl{" after="}" />
<style-map name="textit" class="text" before="\textit{" after="}" />
<style-map name="textsc" class="text" before="\textsc{" after="}" />
<style-map name="textmd" class="text" before="\textmd{" after="}" />
<style-map name="textbf" class="text" before="\textbf{" after="}" />
<style-map name="tiny" class="text" before="{\tiny " after="}" />
<style-map name="scriptsize" class="text" before="{\scriptsize " after="}" />
<style-map name="footnotesize" class="text" before="{\footnotesize " after="}" />
<style-map name="small" class="text" before="{\small " after="}" />
<style-map name="normalsize" class="text" before="{\normalsize " after="}" />
<style-map name="large" class="text" before="{\large " after="}" />
<style-map name="Large" class="text" before="{\Large " after="}" />
<style-map name="LARGE" class="text" before="{\LARGE " after="}" />
<style-map name="huge" class="text" before="{\huge " after="}" />
<style-map name="Huge" class="text" before="{\Huge " after="}" />
<!-- Definitions for a theorem environment -->
<style-map name="theorem" class="paragraph" before="" after="" />
<style-map name="theorem" class="list" before="" after="" />
<style-map name="theorem" class="listitem" before="\begin{theorem}" after="\end{theorem}" />
<!-- Definitions for description list. Uses predefined styles from OOo -->
<style-map name="List Heading" class="paragraph-block" next="List Heading;List Contents" before="\begin{description}" after="\end{description}"/>
<style-map name="List Heading" class="paragraph" before="\item[" after="]" line-break="false" />
<style-map name="List Contents" class="paragraph" before="" after="" />
<!-- Definitions for itemize and enumerate -->
<style-map name="itemize" class="paragraph" before="" after="" />
<style-map name="enumerate" class="paragraph" before="" after="" />
<!-- Definitions for verbatim LaTeX code -->
<style-map name="LaTeX" class="paragraph" before="" after="" verbatim="true" />
<style-map name="LaTeX" class="text" before="" after="" verbatim="true" />
</config>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<description xmlns="http://openoffice.org/extensions/description/2006"
xmlns:d="http://openoffice.org/extensions/description/2006">
<identifier value="org.openoffice.da.writer4latex.oxt" />
<version value="1.1.1" />
<dependencies>
<OpenOffice.org-minimal-version value="2.2" d:name="OpenOffice.org 2.2"/>
</dependencies>
</description>

View file

@ -2,5 +2,5 @@
<description xmlns="http://openoffice.org/extensions/description/2006"
xmlns:d="http://openoffice.org/extensions/description/2006">
<identifier value="org.openoffice.da.writer2latex.xhtml-config-sample.oxt" />
<version value="1.0" />
<version value="1.1.1" />
</description>

View file

@ -1,5 +1,5 @@
Writer2LaTeX source version 1.0 beta
====================================
Writer2LaTeX source version 1.1.1
=================================
Writer2LaTeX is (c) 2002-2009 by Henrik Just.
The source is available under the terms and conditions of the