From db2ef0c0f2bda49ab0843d89a00a9ed2627e6572 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Thu, 13 Jul 2006 08:25:14 +0000 Subject: [PATCH] INTEGRATION: CWS latex (1.1.2); FILE ADDED 2006/04/06 14:10:26 sus 1.1.2.1: #i24813# Adding LaTeX and BibTeX filter --- .../latex/style/TableStyleConverter.java | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 xmerge/source/writer2latex/source/writer2latex/latex/style/TableStyleConverter.java diff --git a/xmerge/source/writer2latex/source/writer2latex/latex/style/TableStyleConverter.java b/xmerge/source/writer2latex/source/writer2latex/latex/style/TableStyleConverter.java new file mode 100644 index 000000000000..159996cd6a3a --- /dev/null +++ b/xmerge/source/writer2latex/source/writer2latex/latex/style/TableStyleConverter.java @@ -0,0 +1,68 @@ +/************************************************************************ + * + * TableStyleConverter.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-2004 by Henrik Just + * + * All Rights Reserved. + * + * Version 0.3.3f (2004-09-17) + * + */ + +package writer2latex.latex.style; + +import writer2latex.util.*; +import writer2latex.office.*; +import writer2latex.latex.LaTeXDocumentPortion; +import writer2latex.latex.ConverterPalette; + +/**

This class creates LaTeX code from OOo table styles. + */ +public class TableStyleConverter extends StyleConverter { + + private boolean bNeedLongtable = false; + private boolean bContainsTables = false; + + /**

Constructs a new TableStyleConverter.

+ */ + public TableStyleConverter(WriterStyleCollection wsc, Config config, + ConverterPalette palette) { + super(wsc,config,palette); + } + + public void appendDeclarations(LaTeXDocumentPortion pack, LaTeXDocumentPortion decl) { + if (bNeedLongtable) { pack.append("\\usepackage{longtable}").nl(); } + // Set padding for table cells (1mm is default in OOo!) + // For vertical padding we can only specify a relative size + if (bContainsTables) { + decl.append("\\setlength\\tabcolsep{1mm}").nl(); + decl.append("\\renewcommand\\arraystretch{1.3}").nl(); + } + } + + public TableFormatter getTableFormatter(TableGridModel table, + boolean bAllowLongtable, boolean bApplyCellFormat) { + + TableFormatter formatter = new TableFormatter(wsc,table,bAllowLongtable,bApplyCellFormat); + bContainsTables = true; + bNeedLongtable |= formatter.isLongtable(); + return formatter; + } + + +}