summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-11-30 15:31:47 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-11-30 15:31:47 +0000
commit9cacf489a5a09ddbe83c8c6837c4b9c231a82322 (patch)
tree934e7dc3ca6b928316d422562b5d4d337008c907
parent4f0b2503e4f27f7dad63fa77a7182fff186693e0 (diff)
parent4ad2c3addffa4030a975419f65a06f809a20a591 (diff)
slideshow1: merge with DEV300 m56
-rw-r--r--migrationanalysis/prj/build.lst2
-rw-r--r--migrationanalysis/src/wizard/makefile.mk2
-rw-r--r--reportbuilder/java/com/sun/star/report/DataRow.java6
-rw-r--r--reportbuilder/java/com/sun/star/report/DataSource.java8
-rw-r--r--reportbuilder/java/com/sun/star/report/ImageService.java8
-rw-r--r--reportbuilder/java/com/sun/star/report/InputRepository.java14
-rw-r--r--reportbuilder/java/com/sun/star/report/JobProgressIndicator.java10
-rw-r--r--reportbuilder/java/com/sun/star/report/JobProperties.java6
-rw-r--r--reportbuilder/java/com/sun/star/report/OfficeToken.java3
-rw-r--r--reportbuilder/java/com/sun/star/report/OutputRepository.java12
-rw-r--r--reportbuilder/java/com/sun/star/report/ParameterMap.java10
-rw-r--r--reportbuilder/java/com/sun/star/report/ReportAddIn.java6
-rw-r--r--reportbuilder/java/com/sun/star/report/ReportEngineMetaData.java12
-rw-r--r--reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java1
-rw-r--r--reportbuilder/java/com/sun/star/report/ReportExpression.java6
-rw-r--r--reportbuilder/java/com/sun/star/report/ReportExpressionMetaData.java14
-rw-r--r--reportbuilder/java/com/sun/star/report/ReportJob.java12
-rw-r--r--reportbuilder/java/com/sun/star/report/ReportJobDefinition.java4
-rw-r--r--reportbuilder/java/com/sun/star/report/ReportJobFactory.java2
-rw-r--r--reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java562
-rw-r--r--reportbuilder/java/com/sun/star/report/SOImageService.java2
-rw-r--r--reportbuilder/java/com/sun/star/report/StorageRepository.java2
-rw-r--r--reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java4
-rw-r--r--reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunctionDescription.java1
-rw-r--r--reportbuilder/java/com/sun/star/report/function/metadata/TitleFunctionDescription.java1
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java27
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java2
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java11
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java4
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java28
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java32
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java12
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java2
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java16
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/configuration.properties1
-rwxr-xr-xreportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java58
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java8
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java1
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupInstanceSectionLayoutController.java2
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java2
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java3
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java4
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/makefile.mk6
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java17
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java33
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java56
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java5
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportTarget.java3
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java306
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/output/text/MasterPageFactory.java4
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/output/text/PageContext.java13
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java23
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/parser/StyleMapper.java2
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/parser/data/DataStyleReadHandler.java2
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ConditionalPrintExpressionReadHandler.java4
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupReadHandler.java2
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/BackgroundColorMapper.java4
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/BorderRightMapper.java5
-rw-r--r--reportbuilder/java/com/sun/star/report/util/ReportUtil.java10
-rw-r--r--reportbuilder/registry/data/org/openoffice/Office/UI/DbReportWindowState.xcu5
-rw-r--r--sdext/prj/build.lst5
-rw-r--r--sdext/source/pdfimport/config/description.xml7
-rw-r--r--sdext/source/pdfimport/images/pdfiext.pngbin0 -> 1965 bytes
-rw-r--r--sdext/source/pdfimport/images/pdfiext_hc.pngbin0 -> 1160 bytes
-rwxr-xr-xsdext/source/pdfimport/inc/wrapper.hxx8
-rw-r--r--sdext/source/pdfimport/makefile.mk10
-rw-r--r--sdext/source/pdfimport/pdfiadaptor.cxx19
-rw-r--r--sdext/source/pdfimport/pdfiadaptor.hxx2
-rw-r--r--sdext/source/pdfimport/pdfparse/pdfentries.cxx5
-rwxr-xr-xsdext/source/pdfimport/test/tests.cxx8
-rw-r--r--sdext/source/pdfimport/tree/drawtreevisiting.cxx14
-rw-r--r--sdext/source/pdfimport/tree/genericelements.hxx3
-rw-r--r--sdext/source/pdfimport/tree/pdfiprocessor.cxx131
-rwxr-xr-xsdext/source/pdfimport/wrapper/wrapper.cxx168
-rw-r--r--sdext/source/pdfimport/xpdfwrapper/makefile.mk7
-rw-r--r--sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx246
-rw-r--r--sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx6
-rw-r--r--sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx415
-rw-r--r--sdext/source/pdfimport/xpdfwrapper/pnghelper.hxx92
-rw-r--r--sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx50
-rw-r--r--sdext/source/presenter/makefile.mk20
-rw-r--r--sdext/source/presenter/registry/data/org/openoffice/Office/extension/makefile.mk6
-rw-r--r--sdext/source/presenter/registry/schema/org/openoffice/Office/extension/PresenterScreen.xcs1
-rw-r--r--swext/mediawiki/help/makefile.mk8
-rw-r--r--swext/mediawiki/help/wiki.xhp12
-rw-r--r--swext/mediawiki/help/wikiaccount.xhp4
-rw-r--r--swext/prj/build.lst2
-rw-r--r--xpdf/makefile.mk4
88 files changed, 1880 insertions, 796 deletions
diff --git a/migrationanalysis/prj/build.lst b/migrationanalysis/prj/build.lst
index 19b8893..37f2413 100644
--- a/migrationanalysis/prj/build.lst
+++ b/migrationanalysis/prj/build.lst
@@ -1,4 +1,4 @@
-at migrationanalysis : soltools NULL
+at migrationanalysis : soltools shell NULL
at migrationanalysis\src\msokill nmake - w at_src NULL
at migrationanalysis\src\driver_docs nmake - w at_src_driver NULL
at migrationanalysis\src\resources nmake - w at_src_resources NULL
diff --git a/migrationanalysis/src/wizard/makefile.mk b/migrationanalysis/src/wizard/makefile.mk
index 38aaa38..eee2461 100644
--- a/migrationanalysis/src/wizard/makefile.mk
+++ b/migrationanalysis/src/wizard/makefile.mk
@@ -110,7 +110,7 @@ $(PAW_LAUNCHER) : $(ALTERNATE_SRC)$/$$(@:f)
# using lngconvex.exe
$(RCFILES) : $(MANIFEST) $(ULFDIR)$/$(TARGET).ulf makefile.mk rcfooter.txt rcheader.txt rctmpl.txt
- $(WRAPCMD) lngconvex.exe -ulf $(ULFDIR)$/$(TARGET).ulf -rc $(RES)$/$(TARGET).rc -rct rctmpl.txt -rch rcheader.txt -rcf rcfooter.txt
+ $(LNGCONVEX) -ulf $(ULFDIR)$/$(TARGET).ulf -rc $(RES)$/$(TARGET).rc -rct rctmpl.txt -rch rcheader.txt -rcf rcfooter.txt
$(PAW_RES_DLLS) : $(RCFILES)
-$(MKDIRHIER) $(@:d)
diff --git a/reportbuilder/java/com/sun/star/report/DataRow.java b/reportbuilder/java/com/sun/star/report/DataRow.java
index 097a798..c221b19 100644
--- a/reportbuilder/java/com/sun/star/report/DataRow.java
+++ b/reportbuilder/java/com/sun/star/report/DataRow.java
@@ -41,9 +41,9 @@ package com.sun.star.report;
public interface DataRow
{
- public int getColumnCount() throws DataSourceException;
+ int getColumnCount() throws DataSourceException;
- public String getColumnName(int column) throws DataSourceException;
+ String getColumnName(int column) throws DataSourceException;
- public Object getObject(int column) throws DataSourceException;
+ Object getObject(int column) throws DataSourceException;
}
diff --git a/reportbuilder/java/com/sun/star/report/DataSource.java b/reportbuilder/java/com/sun/star/report/DataSource.java
index a5e8a94..fc41c20 100644
--- a/reportbuilder/java/com/sun/star/report/DataSource.java
+++ b/reportbuilder/java/com/sun/star/report/DataSource.java
@@ -41,11 +41,11 @@ package com.sun.star.report;
public interface DataSource extends DataRow
{
- public int getRowCount() throws DataSourceException;
+ int getRowCount() throws DataSourceException;
- public boolean absolute(int row) throws DataSourceException;
+ boolean absolute(int row) throws DataSourceException;
- public boolean next() throws DataSourceException;
+ boolean next() throws DataSourceException;
- public void close() throws DataSourceException;
+ void close() throws DataSourceException;
}
diff --git a/reportbuilder/java/com/sun/star/report/ImageService.java b/reportbuilder/java/com/sun/star/report/ImageService.java
index a7d9b78..600cbb5 100644
--- a/reportbuilder/java/com/sun/star/report/ImageService.java
+++ b/reportbuilder/java/com/sun/star/report/ImageService.java
@@ -42,21 +42,21 @@ public interface ImageService
/**
* @return the mime-type of the image as string.
*/
- public String getMimeType(final InputStream image) throws ReportExecutionException;
+ String getMimeType(final InputStream image) throws ReportExecutionException;
/**
* @return the mime-type of the image as string.
*/
- public String getMimeType(final byte[] image) throws ReportExecutionException;
+ String getMimeType(final byte[] image) throws ReportExecutionException;
/**
* @returns the dimension in 100th mm.
**/
- public Dimension getImageSize(final InputStream image) throws ReportExecutionException;
+ Dimension getImageSize(final InputStream image) throws ReportExecutionException;
/**
* @returns the dimension in 100th mm.
**/
- public Dimension getImageSize(final byte[] image) throws ReportExecutionException;
+ Dimension getImageSize(final byte[] image) throws ReportExecutionException;
}
diff --git a/reportbuilder/java/com/sun/star/report/InputRepository.java b/reportbuilder/java/com/sun/star/report/InputRepository.java
index c8122ca..e58adc7 100644
--- a/reportbuilder/java/com/sun/star/report/InputRepository.java
+++ b/reportbuilder/java/com/sun/star/report/InputRepository.java
@@ -54,9 +54,9 @@ public interface InputRepository
*
* @return the repository id
*/
- public Object getId();
+ Object getId();
- public InputStream createInputStream(final String name) throws IOException;
+ InputStream createInputStream(final String name) throws IOException;
/** allows to acces sub repositories inside this repository
*
@@ -64,7 +64,7 @@ public interface InputRepository
* @return the sub repository
* @throws java.io.IOException when the sub repository doesn't exist.
*/
- public InputRepository openInputRepository(final String name) throws IOException;
+ InputRepository openInputRepository(final String name) throws IOException;
/**
* This returns an version number for the given resource. Return zero, if
@@ -75,11 +75,11 @@ public interface InputRepository
* @param name the name of the resource
* @return the version number
*/
- public long getVersion(final String name);
+ long getVersion(final String name);
- public boolean exists(final String name);
+ boolean exists(final String name);
- public boolean isReadable(final String name);
+ boolean isReadable(final String name);
- public void closeInputRepository();
+ void closeInputRepository();
}
diff --git a/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java b/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java
index 94d224c..29d97f2 100644
--- a/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java
+++ b/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java
@@ -43,7 +43,7 @@ public interface JobProgressIndicator
*
* @param string the new description
*/
- public void setText(String string);
+ void setText(String string);
/**
* Initializes the progress indicator and sets the progress description to
@@ -56,7 +56,7 @@ public interface JobProgressIndicator
* @param maxValue the maximum value
* @see JobProgressIndicator#setText(String)
*/
- public void start(String text, int maxValue);
+ void start(String text, int maxValue);
/**
* Updates the value to the specified value. Invalid values must be ignored.
@@ -65,17 +65,17 @@ public interface JobProgressIndicator
* @param value the new value that should be shown now. This must fit the
* range [0..maxValue] as defined in {@link JobProgressIndicator#start(String, int)}.
*/
- public void setValue(int value);
+ void setValue(int value);
/**
* Stop the progress. A progress indicator cannot be destructed before end()
* has been called.
*/
- public void end();
+ void end();
/**
* Clear progress value and description. Calling of setValue(0) and
* setText("") should do the same. Stopped indicators must ignore this call.
*/
- public void reset();
+ void reset();
}
diff --git a/reportbuilder/java/com/sun/star/report/JobProperties.java b/reportbuilder/java/com/sun/star/report/JobProperties.java
index 0ebadb1..a45e2dd 100644
--- a/reportbuilder/java/com/sun/star/report/JobProperties.java
+++ b/reportbuilder/java/com/sun/star/report/JobProperties.java
@@ -32,10 +32,10 @@ package com.sun.star.report;
public interface JobProperties
{
- public void setProperty(String key, Object value)
+ void setProperty(String key, Object value)
throws JobDefinitionException;
- public Object getProperty(String key);
+ Object getProperty(String key);
/**
* A type safe clone operation. We derive a copy of all properties,
@@ -44,5 +44,5 @@ public interface JobProperties
*
* @return a copy.
*/
- public JobProperties copy();
+ JobProperties copy();
}
diff --git a/reportbuilder/java/com/sun/star/report/OfficeToken.java b/reportbuilder/java/com/sun/star/report/OfficeToken.java
index 25f1326..e92187f 100644
--- a/reportbuilder/java/com/sun/star/report/OfficeToken.java
+++ b/reportbuilder/java/com/sun/star/report/OfficeToken.java
@@ -61,4 +61,7 @@ public class OfficeToken {
public static final String SCALE = "scale";
public static final String NAME = "name";
public static final String SHAPES = "shapes";
+ public static final String ISOTROPIC = "isotropic";
+ public static final String ANISOTROPIC = "anisotropic";
+ public static final String NONE = "none";
}
diff --git a/reportbuilder/java/com/sun/star/report/OutputRepository.java b/reportbuilder/java/com/sun/star/report/OutputRepository.java
index a35df96..74b4da4 100644
--- a/reportbuilder/java/com/sun/star/report/OutputRepository.java
+++ b/reportbuilder/java/com/sun/star/report/OutputRepository.java
@@ -53,7 +53,7 @@ public interface OutputRepository
* @return the outputstream
* @throws IOException if opening the stream fails
*/
- public OutputStream createOutputStream(final String name, final String mimeType) throws IOException;
+ OutputStream createOutputStream(final String name, final String mimeType) throws IOException;
/** allows to acces sub repositories inside this repository
*
@@ -61,13 +61,13 @@ public interface OutputRepository
* @return the sub repository
* @throws java.io.IOException when the sub repository doesn't exist.
*/
- public OutputRepository openOutputRepository(final String name, final String mimeType) throws IOException;
+ OutputRepository openOutputRepository(final String name, final String mimeType) throws IOException;
- public boolean exists(final String name);
+ boolean exists(final String name);
- public boolean existsStorage(final String name);
+ boolean existsStorage(final String name);
- public boolean isWritable(final String name);
+ boolean isWritable(final String name);
- public void closeOutputRepository();
+ void closeOutputRepository();
}
diff --git a/reportbuilder/java/com/sun/star/report/ParameterMap.java b/reportbuilder/java/com/sun/star/report/ParameterMap.java
index c663375..14bb2c8 100644
--- a/reportbuilder/java/com/sun/star/report/ParameterMap.java
+++ b/reportbuilder/java/com/sun/star/report/ParameterMap.java
@@ -49,7 +49,7 @@ public interface ParameterMap
* @return The stored value, or <code>null</code> if the key does not exist in this
* collection.
*/
- public Object get(final String key);
+ Object get(final String key);
/**
* Retrieves the value stored for a key in this properties collection, and returning the
@@ -61,11 +61,11 @@ public interface ParameterMap
* @return The stored value, or the default value if the key does not exist in this
* collection.
*/
- public Object get(final String key, final Object defaultValue);
+ Object get(final String key, final Object defaultValue);
- public String[] keys();
+ String[] keys();
- public void clear();
+ void clear();
- public int size();
+ int size();
}
diff --git a/reportbuilder/java/com/sun/star/report/ReportAddIn.java b/reportbuilder/java/com/sun/star/report/ReportAddIn.java
index 378832b..9ca9f04 100644
--- a/reportbuilder/java/com/sun/star/report/ReportAddIn.java
+++ b/reportbuilder/java/com/sun/star/report/ReportAddIn.java
@@ -40,9 +40,9 @@ package com.sun.star.report;
public interface ReportAddIn
{
- public int getExpressionCount();
+ int getExpressionCount();
- public ReportExpression createExpression(int expression);
+ ReportExpression createExpression(int expression);
- public ReportExpressionMetaData getMetaData(int expression);
+ ReportExpressionMetaData getMetaData(int expression);
}
diff --git a/reportbuilder/java/com/sun/star/report/ReportEngineMetaData.java b/reportbuilder/java/com/sun/star/report/ReportEngineMetaData.java
index de07d41..ae7d3f4 100644
--- a/reportbuilder/java/com/sun/star/report/ReportEngineMetaData.java
+++ b/reportbuilder/java/com/sun/star/report/ReportEngineMetaData.java
@@ -40,7 +40,7 @@ public interface ReportEngineMetaData
* @param mimeType
* @return true, if the output type is supported; false otherwise.
*/
- public boolean isOutputSupported(String mimeType);
+ boolean isOutputSupported(String mimeType);
/**
* Lists all supported output parameters for the given mime-type.
@@ -50,13 +50,13 @@ public interface ReportEngineMetaData
* @param mimeType
* @return
*/
- public String[] getOutputParameters(String mimeType);
+ String[] getOutputParameters(String mimeType);
- public Class getParameterType(String parameter);
+ Class getParameterType(String parameter);
- public boolean isMandatory(String parameter);
+ boolean isMandatory(String parameter);
- public boolean isEnumeration(String parameter);
+ boolean isEnumeration(String parameter);
- public Object[] getEnumerationValues(String parameter);
+ Object[] getEnumerationValues(String parameter);
}
diff --git a/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java b/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java
index 6e61844..0129352 100644
--- a/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java
+++ b/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java
@@ -51,6 +51,7 @@ public class ReportEngineParameterNames
public static final String MIMETYPE = "output.mimetype";
public static final String AUTHOR = "Author";
public static final String TITLE = "Title";
+ public static final String MAXROWS = "MaxRows";
private ReportEngineParameterNames ()
{
diff --git a/reportbuilder/java/com/sun/star/report/ReportExpression.java b/reportbuilder/java/com/sun/star/report/ReportExpression.java
index 363e5ff..453c41d 100644
--- a/reportbuilder/java/com/sun/star/report/ReportExpression.java
+++ b/reportbuilder/java/com/sun/star/report/ReportExpression.java
@@ -47,8 +47,8 @@ package com.sun.star.report;
*/
public interface ReportExpression
{
- public void setParameters (Object[] parameters);
- public Object getParameters ();
+ void setParameters (Object[] parameters);
+ Object getParameters ();
- public Object getValue(DataRow row);
+ Object getValue(DataRow row);
}
diff --git a/reportbuilder/java/com/sun/star/report/ReportExpressionMetaData.java b/reportbuilder/java/com/sun/star/report/ReportExpressionMetaData.java
index 34507e1..1aa0efc 100644
--- a/reportbuilder/java/com/sun/star/report/ReportExpressionMetaData.java
+++ b/reportbuilder/java/com/sun/star/report/ReportExpressionMetaData.java
@@ -34,17 +34,17 @@ import java.util.Locale;
public interface ReportExpressionMetaData
{
- public int getParameterCount();
+ int getParameterCount();
- public String getParameterName(int param);
+ String getParameterName(int param);
- public String getParameterDisplayName(int param, Locale locale);
+ String getParameterDisplayName(int param, Locale locale);
- public String getParameterDescription(int param, Locale locale);
+ String getParameterDescription(int param, Locale locale);
- public String getName();
+ String getName();
- public String getDisplayName(Locale l);
+ String getDisplayName(Locale l);
- public String getDescription(Locale l);
+ String getDescription(Locale l);
}
diff --git a/reportbuilder/java/com/sun/star/report/ReportJob.java b/reportbuilder/java/com/sun/star/report/ReportJob.java
index 2d51174..d84f10d 100644
--- a/reportbuilder/java/com/sun/star/report/ReportJob.java
+++ b/reportbuilder/java/com/sun/star/report/ReportJob.java
@@ -63,20 +63,20 @@ public interface ReportJob
* threading code or wont receive any progress information in single
* threaded environments.
*/
- public void execute()
+ void execute()
throws ReportExecutionException, IOException;
/**
* Interrupt the job.
*/
- public void interrupt();
+ void interrupt();
/**
* Queries the jobs execution status.
*
* @return true, if the job is currently running, false otherwise.
*/
- public boolean isRunning();
+ boolean isRunning();
/**
* Queries the jobs result status.
@@ -84,9 +84,9 @@ public interface ReportJob
* @return true, if the job is finished (or has been interrupted), false
* if the job waits for activation.
*/
- public boolean isFinished();
+ boolean isFinished();
- public void addProgressIndicator(JobProgressIndicator indicator);
+ void addProgressIndicator(JobProgressIndicator indicator);
- public void removeProgressIndicator(JobProgressIndicator indicator);
+ void removeProgressIndicator(JobProgressIndicator indicator);
}
diff --git a/reportbuilder/java/com/sun/star/report/ReportJobDefinition.java b/reportbuilder/java/com/sun/star/report/ReportJobDefinition.java
index 8914037..561fd8a 100644
--- a/reportbuilder/java/com/sun/star/report/ReportJobDefinition.java
+++ b/reportbuilder/java/com/sun/star/report/ReportJobDefinition.java
@@ -47,7 +47,7 @@ public interface ReportJobDefinition
*
* @return a map containing the report parameters
*/
- public ParameterMap getQueryParameters();
+ ParameterMap getQueryParameters();
/**
* The report processing parameters control the behaviour of the report. There are
@@ -56,5 +56,5 @@ public interface ReportJobDefinition
*
* @return the processing parameters
*/
- public JobProperties getProcessingParameters();
+ JobProperties getProcessingParameters();
}
diff --git a/reportbuilder/java/com/sun/star/report/ReportJobFactory.java b/reportbuilder/java/com/sun/star/report/ReportJobFactory.java
index 730e93f..a16ec70 100644
--- a/reportbuilder/java/com/sun/star/report/ReportJobFactory.java
+++ b/reportbuilder/java/com/sun/star/report/ReportJobFactory.java
@@ -40,5 +40,5 @@ import com.sun.star.uno.Exception;
public interface ReportJobFactory
{
- public ReportJob createReportJob(final NamedValue[] namedValue) throws IllegalArgumentException, ReportExecutionException, Exception;
+ ReportJob createReportJob(final NamedValue[] namedValue) throws IllegalArgumentException, ReportExecutionException, Exception;
}
diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java
index b4685f7..9368840 100644
--- a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java
+++ b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java
@@ -35,6 +35,7 @@ import com.sun.star.beans.XPropertySet;
import com.sun.star.container.NoSuchElementException;
import com.sun.star.container.XIndexAccess;
import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.IndexOutOfBoundsException;
import com.sun.star.lang.WrappedTargetException;
import com.sun.star.sdbc.XConnection;
import com.sun.star.container.XNameAccess;
@@ -44,12 +45,14 @@ import com.sun.star.sdb.CommandType;
import com.sun.star.sdb.XCompletedExecution;
import com.sun.star.sdb.XParametersSupplier;
import com.sun.star.sdb.XQueriesSupplier;
+import com.sun.star.sdb.XResultSetAccess;
import com.sun.star.sdb.XSingleSelectQueryComposer;
import com.sun.star.sdb.tools.XConnectionTools;
import com.sun.star.sdbc.SQLException;
import com.sun.star.sdbc.XParameters;
import com.sun.star.sdbc.XPreparedStatement;
import com.sun.star.uno.Exception;
+import java.util.HashMap;
import java.util.Map;
import com.sun.star.sdbc.XRowSet;
@@ -63,6 +66,8 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -72,6 +77,77 @@ import org.apache.commons.logging.LogFactory;
*/
public class SDBCReportDataFactory implements DataSourceFactory
{
+ private static final String ESCAPEPROCESSING = "EscapeProcessing";
+
+ private class RowSetProperties
+ {
+
+ final Boolean escapeProcessing;
+ final int commandType;
+ final Integer maxRows;
+ final String command;
+ final String filter;
+
+ public RowSetProperties(final Boolean escapeProcessing, final int commandType, final String command, final String filter, final Integer maxRows)
+ {
+ this.escapeProcessing = escapeProcessing;
+ this.commandType = commandType;
+ this.command = command;
+ this.filter = filter;
+ this.maxRows = maxRows;
+ }
+
+
+ public boolean equals(Object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ final RowSetProperties other = (RowSetProperties) obj;
+ if (this.escapeProcessing != other.escapeProcessing && (this.escapeProcessing == null || !this.escapeProcessing.equals(other.escapeProcessing)))
+ {
+ return false;
+ }
+ if (this.commandType != other.commandType)
+ {
+ return false;
+ }
+ if (this.maxRows != other.maxRows && (this.maxRows == null || !this.maxRows.equals(other.maxRows)))
+ {
+ return false;
+ }
+ if ((this.command == null) ? (other.command != null) : !this.command.equals(other.command))
+ {
+ return false;
+ }
+ if ((this.filter == null) ? (other.filter != null) : !this.filter.equals(other.filter))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int hash = 3;
+ hash = 59 * hash + (this.escapeProcessing != null ? this.escapeProcessing.hashCode() : 0);
+ hash = 59 * hash + this.commandType;
+ hash = 59 * hash + (this.maxRows != null ? this.maxRows.hashCode() : 0);
+ hash = 59 * hash + (this.command != null ? this.command.hashCode() : 0);
+ hash = 59 * hash + (this.filter != null ? this.filter.hashCode() : 0);
+ return hash;
+ }
+ }
+ class ParameterDefinition
+ {
+ int parameterCount = 0;
+ private ArrayList parameterIndex = new ArrayList();
+ }
private static final Log LOGGER = LogFactory.getLog(SDBCReportDataFactory.class);
public static final String COMMAND_TYPE = "command-type";
public static final String ESCAPE_PROCESSING = "escape-processing";
@@ -94,6 +170,9 @@ public class SDBCReportDataFactory implements DataSourceFactory
private static final int HANDLE_QUERY = 4;
private static final int HANDLE_TABLE = 5;
private static final int HANDLE_SQL = 6;
+ private final Map rowSetProperties = new HashMap();
+ private final Map parameterMap = new HashMap();
+ private boolean rowSetCreated = false;
public SDBCReportDataFactory(final XComponentContext cmpCtx, final XConnection connection)
{
@@ -105,19 +184,19 @@ public class SDBCReportDataFactory implements DataSourceFactory
{
try
{
- if ( command == null )
+ if (command == null)
{
return new SDBCReportData(null);
}
int commandType = CommandType.COMMAND;
final String commandTypeValue = (String) parameters.get(COMMAND_TYPE);
- if ( commandTypeValue != null )
+ if (commandTypeValue != null)
{
- if ( commandTypeValue.equals("query") )
+ if ("query".equals(commandTypeValue))
{
commandType = CommandType.QUERY;
}
- else if ( commandTypeValue.equals("table") )
+ else if ("table".equals(commandTypeValue))
{
commandType = CommandType.TABLE;
}
@@ -126,18 +205,22 @@ public class SDBCReportDataFactory implements DataSourceFactory
commandType = CommandType.COMMAND;
}
}
- final XRowSet rowSet = createRowSet(command, commandType, parameters);
- final XPropertySet rowSetProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet);
-
- final XConnectionTools tools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, connection);
- fillOrderStatement(command, commandType, parameters, tools, rowSetProp);
-
- if ( command.length() != 0 )
+ final Boolean escapeProcessing = (Boolean) parameters.get(ESCAPE_PROCESSING);
+ final String filter = (String) parameters.get(UNO_FILTER);
+ final Integer maxRows = (Integer) parameters.get("MaxRows");
+ RowSetProperties rowSetProps = new RowSetProperties(escapeProcessing, commandType, command, filter, maxRows);
+
+ final Object[] p = createRowSet(rowSetProps,parameters);
+ final XRowSet rowSet = (XRowSet)p[0];
+
+ if (command.length() != 0 )
{
- final int oldParameterCount = fillParameter(parameters, tools, command, commandType, rowSet);
+ final ParameterDefinition paramDef = (ParameterDefinition)p[1];
+ fillParameter(parameters, rowSet,paramDef);
+ rowSetCreated = rowSetCreated && ( maxRows == null || maxRows.intValue() == 0);
final XCompletedExecution execute = (XCompletedExecution) UnoRuntime.queryInterface(XCompletedExecution.class, rowSet);
- if ( execute != null && oldParameterCount > 0 )
+ if (rowSetCreated && execute != null && paramDef.parameterCount > 0)
{
final XInteractionHandler handler = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, m_cmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.sdb.InteractionHandler", m_cmpCtx));
execute.executeWithCompletion(handler);
@@ -147,9 +230,13 @@ public class SDBCReportDataFactory implements DataSourceFactory
rowSet.execute();
}
}
+
+ rowSetCreated = false;
return new SDBCReportData(rowSet);
- } catch ( Exception ex )
+ }
+ catch (Exception ex)
{
+ rowSetCreated = false;
throw new DataSourceException(ex.getMessage(), ex);
}
}
@@ -158,7 +245,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
{
final StringBuffer order = new StringBuffer();
final int count = groupExpressions.size();
- if ( count != 0 )
+ if (count != 0)
{
try
{
@@ -196,10 +283,6 @@ public class SDBCReportDataFactory implements DataSourceFactory
}
}
}
- catch (IndexOutOfBoundsException ex)
- {
- LOGGER.error("ReportProcessing failed", ex);
- }
catch (SQLException ex)
{
LOGGER.error("ReportProcessing failed", ex);
@@ -219,14 +302,15 @@ public class SDBCReportDataFactory implements DataSourceFactory
{
tools.getClass().getMethod("getFieldsByCommandDescriptor", parameter);
return tools.getFieldsByCommandDescriptor(commandType, command, out);
- } catch ( NoSuchMethodException ex )
+ }
+ catch (NoSuchMethodException ex)
{
}
XNameAccess xFields = null;
// some kind of state machine to ease the sharing of code
int eState = FAILED;
- switch ( commandType )
+ switch (commandType)
{
case CommandType.TABLE:
eState = HANDLE_TABLE;
@@ -248,41 +332,41 @@ public class SDBCReportDataFactory implements DataSourceFactory
// go!
while ((DONE != eState) && (FAILED != eState))
{
- switch ( eState )
+ switch (eState)
{
case HANDLE_TABLE:
- {
- // initial state for handling the tables
+ {
+ // initial state for handling the tables
- // get the table objects
- final XTablesSupplier xSupplyTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, connection);
- if ( xSupplyTables != null )
- {
- xObjectCollection = xSupplyTables.getTables();
+ // get the table objects
+ final XTablesSupplier xSupplyTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, connection);
+ if (xSupplyTables != null)
+ {
+ xObjectCollection = xSupplyTables.getTables();
// if something went wrong 'til here, then this will be handled in the next state
// next state: get the object
}
- eState = RETRIEVE_OBJECT;
- }
- break;
+ eState = RETRIEVE_OBJECT;
+ }
+ break;
case HANDLE_QUERY:
- {
- // initial state for handling the tables
+ {
+ // initial state for handling the tables
- // get the table objects
- final XQueriesSupplier xSupplyQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, connection);
- if ( xSupplyQueries != null )
- {
- xObjectCollection = xSupplyQueries.getQueries();
+ // get the table objects
+ final XQueriesSupplier xSupplyQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, connection);
+ if (xSupplyQueries != null)
+ {
+ xObjectCollection = xSupplyQueries.getQueries();
// if something went wrong 'til here, then this will be handled in the next state
// next state: get the object
}
- eState = RETRIEVE_OBJECT;
- }
- break;
+ eState = RETRIEVE_OBJECT;
+ }
+ break;
case RETRIEVE_OBJECT:
// here we should have an object (aka query or table) collection, and are going
@@ -291,7 +375,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
// next state: default to FAILED
eState = FAILED;
- if ( xObjectCollection != null && xObjectCollection.hasByName(command) )
+ if (xObjectCollection != null && xObjectCollection.hasByName(command))
{
xSupplyColumns = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xObjectCollection.getByName(command));
@@ -304,7 +388,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
// next state: default to FAILED
eState = FAILED;
- if ( xSupplyColumns != null )
+ if (xSupplyColumns != null)
{
xFields = xSupplyColumns.getColumns();
// that's it
@@ -313,75 +397,78 @@ public class SDBCReportDataFactory implements DataSourceFactory
break;
case HANDLE_SQL:
- {
- String sStatementToExecute = command;
+ {
+ String sStatementToExecute = command;
- // well, the main problem here is to handle statements which contain a parameter
- // If we would simply execute a parametrized statement, then this will fail because
- // we cannot supply any parameter values.
- // Thus, we try to analyze the statement, and to append a WHERE 0=1 filter criterion
- // This should cause every driver to not really execute the statement, but to return
- // an empty result set with the proper structure. We then can use this result set
- // to retrieve the columns.
+ // well, the main problem here is to handle statements which contain a parameter
+ // If we would simply execute a parametrized statement, then this will fail because
+ // we cannot supply any parameter values.
+ // Thus, we try to analyze the statement, and to append a WHERE 0=1 filter criterion
+ // This should cause every driver to not really execute the statement, but to return
+ // an empty result set with the proper structure. We then can use this result set
+ // to retrieve the columns.
- try
- {
- final XMultiServiceFactory xComposerFac = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, connection);
+ try
+ {
+ final XMultiServiceFactory xComposerFac = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, connection);
- if ( xComposerFac != null )
+ if (xComposerFac != null)
+ {
+ final XSingleSelectQueryComposer xComposer = (XSingleSelectQueryComposer) UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, xComposerFac.createInstance("com.sun.star.sdb.SingleSelectQueryComposer"));
+ if (xComposer != null)
{
- final XSingleSelectQueryComposer xComposer = (XSingleSelectQueryComposer) UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, xComposerFac.createInstance("com.sun.star.sdb.SingleSelectQueryComposer"));
- if ( xComposer != null )
- {
- xComposer.setQuery(sStatementToExecute);
+ xComposer.setQuery(sStatementToExecute);
- // Now set the filter to a dummy restriction which will result in an empty
- // result set.
- xComposer.setFilter("0=1");
+ // Now set the filter to a dummy restriction which will result in an empty
+ // result set.
+ xComposer.setFilter("0=1");
- sStatementToExecute = xComposer.getQuery();
- }
+ sStatementToExecute = xComposer.getQuery();
}
- } catch ( com.sun.star.uno.Exception ex )
- {
- // silent this error, this was just a try. If we're here, we did not change sStatementToExecute,
- // so it will still be _rCommand, which then will be executed without being touched
+ }
+ }
+ catch (com.sun.star.uno.Exception ex)
+ {
+ // silent this error, this was just a try. If we're here, we did not change sStatementToExecute,
+ // so it will still be _rCommand, which then will be executed without being touched
}
- // now execute
- final XPreparedStatement xStatement = connection.prepareStatement(sStatementToExecute);
- // transfer ownership of this temporary object to the caller
- out[0] = (XComponent) UnoRuntime.queryInterface(XComponent.class, xStatement);
+ // now execute
+ final XPreparedStatement xStatement = connection.prepareStatement(sStatementToExecute);
+ // transfer ownership of this temporary object to the caller
+ out[0] = (XComponent) UnoRuntime.queryInterface(XComponent.class, xStatement);
- // set the "MaxRows" to 0. This is just in case our attempt to append a 0=1 filter
- // failed - in this case, the MaxRows restriction should at least ensure that there
- // is no data returned (which would be potentially expensive)
- final XPropertySet xStatementProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xStatement);
- try
- {
- if ( xStatementProps != null )
- {
- xStatementProps.setPropertyValue("MaxRows", new Integer(0));
- }
- } catch ( com.sun.star.uno.Exception ex )
+ // set the "MaxRows" to 0. This is just in case our attempt to append a 0=1 filter
+ // failed - in this case, the MaxRows restriction should at least ensure that there
+ // is no data returned (which would be potentially expensive)
+ final XPropertySet xStatementProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xStatement);
+ try
+ {
+ if (xStatementProps != null)
{
- // oh damn. Not much of a chance to recover, we will no retrieve the complete
- // full blown result set
+ xStatementProps.setPropertyValue("MaxRows", Integer.valueOf(0));
+ }
+ }
+ catch (com.sun.star.uno.Exception ex)
+ {
+ // oh damn. Not much of a chance to recover, we will no retrieve the complete
+ // full blown result set
}
- xSupplyColumns = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xStatement.executeQuery());
- // this should have given us a result set which does not contain any data, but
- // the structural information we need
+ xSupplyColumns = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xStatement.executeQuery());
+ // this should have given us a result set which does not contain any data, but
+ // the structural information we need
- // so the next state is to get the columns
- eState = RETRIEVE_COLUMNS;
- }
- break;
+ // so the next state is to get the columns
+ eState = RETRIEVE_COLUMNS;
+ }
+ break;
default:
eState = FAILED;
}
}
- } catch ( com.sun.star.uno.Exception ex )
+ }
+ catch (com.sun.star.uno.Exception ex)
{
}
return xFields;
@@ -399,15 +486,18 @@ public class SDBCReportDataFactory implements DataSourceFactory
final Object[] param = new Object[2];
param[0] = commandType;
param[1] = command;
- Method call = tools.getClass().getMethod("getComposer", parameter);
+ final Method call = tools.getClass().getMethod("getComposer", parameter);
return (XSingleSelectQueryComposer) call.invoke(tools, param);
- } catch ( NoSuchMethodException ex )
+ }
+ catch (NoSuchMethodException ex)
{
- } catch ( IllegalAccessException ex )
+ }
+ catch (IllegalAccessException ex)
{
// should not happen
// assert False
- } catch ( java.lang.reflect.InvocationTargetException ex )
+ }
+ catch (java.lang.reflect.InvocationTargetException ex)
{
// should not happen
// assert False
@@ -418,172 +508,230 @@ public class SDBCReportDataFactory implements DataSourceFactory
final XSingleSelectQueryComposer out = (XSingleSelectQueryComposer) UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, factory.createInstance("com.sun.star.sdb.SingleSelectQueryAnalyzer"));
final String quote = connection.getMetaData().getIdentifierQuoteString();
String statement = command;
- switch ( commandType )
+ switch (commandType)
{
case CommandType.TABLE:
statement = "SELECT * FROM " + quote + command + quote;
break;
case CommandType.QUERY:
+ {
+ final XQueriesSupplier xSupplyQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, connection);
+ final XNameAccess queries = xSupplyQueries.getQueries();
+ if (queries.hasByName(command))
{
- final XQueriesSupplier xSupplyQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, connection);
- final XNameAccess queries = xSupplyQueries.getQueries();
- if ( queries.hasByName(command) )
+ final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, queries.getByName(command));
+ final Boolean escape = (Boolean) prop.getPropertyValue(ESCAPEPROCESSING);
+ if (escape.booleanValue())
{
- final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, queries.getByName(command));
- final Boolean escape = (Boolean) prop.getPropertyValue("EscapeProcessing");
- if (escape.booleanValue())
+ statement = (String) prop.getPropertyValue(UNO_COMMAND);
+ final XSingleSelectQueryComposer composer = getComposer(tools, statement, CommandType.COMMAND);
+ if (composer != null)
{
- statement = (String) prop.getPropertyValue(UNO_COMMAND);
- final XSingleSelectQueryComposer composer = getComposer(tools, statement, CommandType.COMMAND);
- if (composer != null)
+ final String order = (String) prop.getPropertyValue(UNO_ORDER);
+ if (order != null && order.length() != 0)
{
- final String order = (String) prop.getPropertyValue(UNO_ORDER);
- if (order != null && order.length() != 0)
- {
- composer.setOrder(order);
- }
- final Boolean applyFilter = (Boolean) prop.getPropertyValue(UNO_APPLY_FILTER);
- if (applyFilter.booleanValue())
+ composer.setOrder(order);
+ }
+ final Boolean applyFilter = (Boolean) prop.getPropertyValue(UNO_APPLY_FILTER);
+ if (applyFilter.booleanValue())
+ {
+ final String filter = (String) prop.getPropertyValue(UNO_FILTER);
+ if (filter != null && filter.length() != 0)
{
- final String filter = (String) prop.getPropertyValue(UNO_FILTER);
- if (filter != null && filter.length() != 0)
- {
- composer.setFilter(filter);
- }
+ composer.setFilter(filter);
}
- statement = composer.getQuery();
}
+ statement = composer.getQuery();
}
}
}
break;
+ }
case CommandType.COMMAND:
statement = command;
break;
}
out.setElementaryQuery(statement);
return out;
- } catch ( Exception e )
+ }
+ catch (Exception e)
{
}
return null;
}
- int fillParameter(final Map parameters,
- final XConnectionTools tools,
- final String command,
- final int commandType, final XRowSet rowSet)
+ private void fillParameter(final Map parameters,
+ final XRowSet rowSet,final ParameterDefinition paramDef)
throws SQLException,
UnknownPropertyException,
PropertyVetoException,
IllegalArgumentException,
WrappedTargetException
{
- int oldParameterCount = 0;
+ final ArrayList masterValues = (ArrayList) parameters.get(MASTER_VALUES);
+ if (masterValues != null && !masterValues.isEmpty())
+ {
+ final XParameters para = (XParameters) UnoRuntime.queryInterface(XParameters.class, rowSet);
+
+ for (int i = 0;
+ i < masterValues.size();
+ i++)
+ {
+ Object object = masterValues.get(i);
+ if (object instanceof BigDecimal)
+ {
+ object = ((BigDecimal) object).toString();
+ }
+ final Integer pos = (Integer)paramDef.parameterIndex.get(i);
+ para.setObject(pos + 1, object);
+ }
+ }
+ }
+
+ private final Object[] createRowSet(final RowSetProperties rowSetProps,final Map parameters)
+ throws Exception
+ {
+ final ArrayList detailColumns = (ArrayList) parameters.get(DETAIL_COLUMNS);
+ if (rowSetProperties.containsKey(rowSetProps) && detailColumns != null && !detailColumns.isEmpty() )
+ {
+ return new Object[]{ rowSetProperties.get(rowSetProps),parameterMap.get(rowSetProps)};
+ }
+
+ rowSetCreated = true;
+ final XRowSet rowSet = (XRowSet) UnoRuntime.queryInterface(XRowSet.class, m_cmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.sdb.RowSet", m_cmpCtx));
+ final XPropertySet rowSetProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet);
- final XSingleSelectQueryComposer composer = getComposer(tools, command, commandType);
- if ( composer != null )
+ rowSetProp.setPropertyValue("ActiveConnection", connection);
+ rowSetProp.setPropertyValue(ESCAPEPROCESSING, rowSetProps.escapeProcessing);
+ rowSetProp.setPropertyValue(UNO_COMMAND_TYPE, Integer.valueOf(rowSetProps.commandType));
+ rowSetProp.setPropertyValue(UNO_COMMAND, rowSetProps.command);
+
+ if (rowSetProps.filter != null)
+ {
+ rowSetProp.setPropertyValue("Filter", rowSetProps.filter);
+ rowSetProp.setPropertyValue(APPLY_FILTER, Boolean.valueOf(rowSetProps.filter.length() != 0));
+ }
+ else
+ {
+ rowSetProp.setPropertyValue(APPLY_FILTER, Boolean.FALSE);
+ }
+
+ if (rowSetProps.maxRows != null)
+ {
+ rowSetProp.setPropertyValue("MaxRows", rowSetProps.maxRows);
+ }
+
+ final XConnectionTools tools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, connection);
+ fillOrderStatement(rowSetProps.command, rowSetProps.commandType, parameters, tools, rowSetProp);
+ final ParameterDefinition paramDef = createParameter(parameters, tools, rowSetProps, rowSet);
+
+ rowSetProperties.put(rowSetProps, rowSet);
+ parameterMap.put(rowSetProps, paramDef);
+
+ return new Object[]{rowSet,paramDef};
+ }
+
+ private ParameterDefinition createParameter(final Map parameters,
+ final XConnectionTools tools,
+ RowSetProperties rowSetProps, final XRowSet rowSet)
+ throws SQLException,
+ UnknownPropertyException,
+ PropertyVetoException,
+ IllegalArgumentException,
+ WrappedTargetException
+ {
+ final ParameterDefinition paramDef = new ParameterDefinition();
+ final XSingleSelectQueryComposer composer = getComposer(tools, rowSetProps.command, rowSetProps.commandType);
+ if (composer != null)
{
final XPropertySet rowSetProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet);
- if ( ((Boolean)rowSetProp.getPropertyValue(APPLY_FILTER)).booleanValue() )
+ if (((Boolean) rowSetProp.getPropertyValue(APPLY_FILTER)).booleanValue())
{
- composer.setFilter((String)rowSetProp.getPropertyValue("Filter"));
+ composer.setFilter((String) rowSetProp.getPropertyValue("Filter"));
}
// get old parameter count
+ final ArrayList detailColumns = (ArrayList) parameters.get(DETAIL_COLUMNS);
+ final ArrayList handledColumns = new ArrayList();
final XParametersSupplier paraSup = (XParametersSupplier) UnoRuntime.queryInterface(XParametersSupplier.class, composer);
- if ( paraSup != null )
+ if (paraSup != null)
{
final XIndexAccess params = paraSup.getParameters();
- if ( params != null )
+ if (params != null)
{
- oldParameterCount = params.getCount();
+ final int oldParameterCount = params.getCount();
+ paramDef.parameterCount = oldParameterCount;
+ if ( detailColumns != null )
+ {
+ for (int i = 0; i < oldParameterCount; i++)
+ {
+ try
+ {
+ final XPropertySet parameter = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, params.getByIndex(i));
+ if (parameter != null)
+ {
+ final String name = (String) parameter.getPropertyValue("Name");
+ for (int j = 0; j < detailColumns.size(); j++)
+ {
+ if ( name.equals(detailColumns.get(j) ) )
+ {
+ handledColumns.add(name);
+ paramDef.parameterIndex.add(Integer.valueOf(i));
+ --paramDef.parameterCount;
+ break;
+ }
+ }
+ }
+ }
+ catch (IndexOutOfBoundsException ex)
+ {
+ Logger.getLogger(SDBCReportDataFactory.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+ }
}
}
final ArrayList masterValues = (ArrayList) parameters.get(MASTER_VALUES);
- if ( masterValues != null && !masterValues.isEmpty() )
+ if (masterValues != null && !masterValues.isEmpty() && paramDef.parameterIndex.size() != detailColumns.size() )
{
// Vector masterColumns = (Vector) parameters.get("master-columns");
- final ArrayList detailColumns = (ArrayList) parameters.get(DETAIL_COLUMNS);
- if ( oldParameterCount < detailColumns.size() )
+
+ // create the new filter
+ final String quote = connection.getMetaData().getIdentifierQuoteString();
+ final StringBuffer oldFilter = new StringBuffer();
+ oldFilter.append(composer.getFilter());
+ if (oldFilter.length() != 0)
{
- // create the new filter
- final String quote = connection.getMetaData().getIdentifierQuoteString();
- final StringBuffer oldFilter = new StringBuffer();
- oldFilter.append(composer.getFilter());
- if ( oldFilter.length() != 0 )
- {
- oldFilter.append(" AND ");
- }
- int newParamterCounter = 1;
- for (final Iterator it = detailColumns.iterator(); it.hasNext();
- ++newParamterCounter)
+ oldFilter.append(" AND ");
+ }
+ int newParamterCounter = 1;
+ for (final Iterator it = detailColumns.iterator(); it.hasNext();
+ ++newParamterCounter)
+ {
+ final String detail = (String) it.next();
+ if ( !handledColumns.contains(detail) )
{
- final String detail = (String) it.next();
//String master = (String) masterIt.next();
oldFilter.append(quote);
oldFilter.append(detail);
oldFilter.append(quote);
oldFilter.append(" = :link_");
oldFilter.append(newParamterCounter);
- if ( it.hasNext() )
+ if (it.hasNext())
{
oldFilter.append(" AND ");
}
+ paramDef.parameterIndex.add(Integer.valueOf(newParamterCounter + paramDef.parameterCount - 1));
}
-
- composer.setFilter(oldFilter.toString());
}
- else
- oldParameterCount = 0;
+
+ composer.setFilter(oldFilter.toString());
final String sQuery = composer.getQuery();
rowSetProp.setPropertyValue(UNO_COMMAND, sQuery);
- rowSetProp.setPropertyValue(UNO_COMMAND_TYPE,
- new Integer(CommandType.COMMAND));
-
- final XParameters para = (XParameters) UnoRuntime.queryInterface(XParameters.class, rowSet);
-
- for (int i = 0;
- i < masterValues.size();
- i++)
- {
- Object object = masterValues.get(i);
- if ( object instanceof BigDecimal )
- {
- object = ((BigDecimal) object).toString();
- }
- para.setObject(oldParameterCount + i + 1, object);
- }
+ rowSetProp.setPropertyValue(UNO_COMMAND_TYPE,Integer.valueOf(CommandType.COMMAND));
}
}
-
- return oldParameterCount;
- }
-
- private final XRowSet createRowSet(final String command,
- final int commandType, final Map parameters)
- throws Exception
- {
- final XRowSet rowSet = (XRowSet) UnoRuntime.queryInterface(XRowSet.class, m_cmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.sdb.RowSet", m_cmpCtx));
- final XPropertySet rowSetProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet);
-
- rowSetProp.setPropertyValue("ActiveConnection", connection);
- final Boolean escapeProcessing = (Boolean)parameters.get(ESCAPE_PROCESSING);
- rowSetProp.setPropertyValue("EscapeProcessing", escapeProcessing);
- rowSetProp.setPropertyValue(UNO_COMMAND_TYPE, new Integer(commandType));
- rowSetProp.setPropertyValue(UNO_COMMAND, command);
-
- final String filter = (String) parameters.get(UNO_FILTER);
- if ( filter != null )
- {
- rowSetProp.setPropertyValue("Filter", filter);
- rowSetProp.setPropertyValue(APPLY_FILTER, Boolean.valueOf(filter.length() != 0));
- }
- else
- {
- rowSetProp.setPropertyValue(APPLY_FILTER, Boolean.FALSE);
- }
- return rowSet;
+ return paramDef;
}
void fillOrderStatement(final String command,
@@ -598,16 +746,16 @@ public class SDBCReportDataFactory implements DataSourceFactory
NoSuchElementException
{
final StringBuffer order = new StringBuffer(getOrderStatement(commandType, command, (ArrayList) parameters.get(GROUP_EXPRESSIONS)));
- if ( order.length() > 0 && commandType != CommandType.TABLE )
+ if (order.length() > 0 && commandType != CommandType.TABLE)
{
String statement = command;
final XSingleSelectQueryComposer composer = getComposer(tools, command, commandType);
- if ( composer != null )
+ if (composer != null)
{
statement = composer.getQuery();
composer.setQuery(statement);
final String sOldOrder = composer.getOrder();
- if ( sOldOrder.length() > 0 )
+ if (sOldOrder.length() > 0)
{
order.append(',');
order.append(sOldOrder);
@@ -617,15 +765,15 @@ public class SDBCReportDataFactory implements DataSourceFactory
}
else
{
- if ( commandType == CommandType.QUERY )
+ if (commandType == CommandType.QUERY)
{
final XQueriesSupplier xSupplyQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, connection);
final XNameAccess queries = xSupplyQueries.getQueries();
- if ( queries.hasByName(command) )
+ if (queries.hasByName(command))
{
final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, queries.getByName(command));
- final Boolean escape = (Boolean) prop.getPropertyValue("EscapeProcessing");
- rowSetProp.setPropertyValue("EscapeProcessing", escape);
+ final Boolean escape = (Boolean) prop.getPropertyValue(ESCAPEPROCESSING);
+ rowSetProp.setPropertyValue( ESCAPEPROCESSING, escape);
final String queryCommand = (String) prop.getPropertyValue(UNO_COMMAND);
statement = "SELECT * FROM (" + queryCommand + ")";
}
@@ -637,7 +785,7 @@ public class SDBCReportDataFactory implements DataSourceFactory
}
}
rowSetProp.setPropertyValue(UNO_COMMAND, statement);
- rowSetProp.setPropertyValue(UNO_COMMAND_TYPE, new Integer(CommandType.COMMAND));
+ rowSetProp.setPropertyValue(UNO_COMMAND_TYPE, Integer.valueOf(CommandType.COMMAND));
}
rowSetProp.setPropertyValue("Order", order.toString());
}
diff --git a/reportbuilder/java/com/sun/star/report/SOImageService.java b/reportbuilder/java/com/sun/star/report/SOImageService.java
index 621419a..6678635 100644
--- a/reportbuilder/java/com/sun/star/report/SOImageService.java
+++ b/reportbuilder/java/com/sun/star/report/SOImageService.java
@@ -106,7 +106,7 @@ public class SOImageService implements ImageService
{
imageSize = (Size) xImage.getPropertyValue("SizePixel");
final int dpi = java.awt.Toolkit.getDefaultToolkit().getScreenResolution();
- final double fac = 2540 / dpi;
+ final double fac = 2540 / (double)dpi;
dim.setSize(imageSize.Width * fac, imageSize.Height * fac);
}
}
diff --git a/reportbuilder/java/com/sun/star/report/StorageRepository.java b/reportbuilder/java/com/sun/star/report/StorageRepository.java
index 7262853..665c73c 100644
--- a/reportbuilder/java/com/sun/star/report/StorageRepository.java
+++ b/reportbuilder/java/com/sun/star/report/StorageRepository.java
@@ -148,7 +148,7 @@ public class StorageRepository implements InputRepository, OutputRepository
{
LOGGER.error(REPORT_PROCESSING_FAILED, ex);
}
- catch (NoSuchElementException ex)
+ catch (NoSuchElementException e)
{
// We expect this exception, no need to log it.
}
diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java b/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java
index cc5e6d2..c6668a5 100644
--- a/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java
+++ b/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java
@@ -45,10 +45,6 @@ import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType;
public class AuthorFunction implements Function
{
- public AuthorFunction()
- {
- }
-
public String getCanonicalName()
{
return "AUTHOR";
diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunctionDescription.java b/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunctionDescription.java
index f251a8f..e2a8f00 100644
--- a/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunctionDescription.java
+++ b/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunctionDescription.java
@@ -32,7 +32,6 @@ package com.sun.star.report.function.metadata;
import org.pentaho.reporting.libraries.formula.function.AbstractFunctionDescription;
import org.pentaho.reporting.libraries.formula.function.FunctionCategory;
import org.pentaho.reporting.libraries.formula.typing.Type;
-import org.pentaho.reporting.libraries.formula.typing.coretypes.NumberType;
import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType;
/**
diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunctionDescription.java b/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunctionDescription.java
index 61a0d20..b53090e 100644
--- a/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunctionDescription.java
+++ b/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunctionDescription.java
@@ -32,7 +32,6 @@ package com.sun.star.report.function.metadata;
import org.pentaho.reporting.libraries.formula.function.AbstractFunctionDescription;
import org.pentaho.reporting.libraries.formula.function.FunctionCategory;
import org.pentaho.reporting.libraries.formula.typing.Type;
-import org.pentaho.reporting.libraries.formula.typing.coretypes.NumberType;
import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType;
/**
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java b/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java
index 72c20de..b16b409 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java
@@ -80,25 +80,28 @@ public class DefaultNameGenerator
name = "file";
}
- String firstFileName = name;
+ StringBuffer firstFileName = new StringBuffer();
+ firstFileName.append(name);
final String suffix;
if (mimeType != null)
{
suffix = getSuffixForType(mimeType);
- firstFileName += "." + suffix;
+ firstFileName.append('.');
+ firstFileName.append(suffix);
}
else
{
suffix = null;
}
+ String newName = firstFileName.toString();
boolean exists;
if (isStream)
{
- exists = outputRepository.exists(firstFileName);
+ exists = outputRepository.exists(newName);
}
else
{
- exists = outputRepository.existsStorage(firstFileName);
+ exists = outputRepository.existsStorage(newName);
}
if (exists)
{
@@ -109,23 +112,27 @@ public class DefaultNameGenerator
{
throw new IOException();
}
- firstFileName = name + counter;
+ firstFileName.delete(0,firstFileName.length() );
+ firstFileName.append(name);
+ firstFileName.append(counter);
if (suffix != null)
{
- firstFileName += "." + suffix;
+ firstFileName.append('.');
+ firstFileName.append(suffix);
}
+ newName = firstFileName.toString();
if (isStream)
{
- exists = outputRepository.exists(firstFileName);
+ exists = outputRepository.exists(newName);
}
else
{
- exists = outputRepository.existsStorage(firstFileName);
+ exists = outputRepository.existsStorage(newName);
}
- counter += 1;
+ counter++;
}
}
- return firstFileName;
+ return newName;
}
protected String getSuffixForType(final String mimeType)
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java
index dc2f0ce..8191282 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java
@@ -73,6 +73,7 @@ public class PentahoReportEngineMetaData
mandatoryParameters.add(ReportEngineParameterNames.INPUT_DETAIL_COLUMNS);
mandatoryParameters.add(ReportEngineParameterNames.AUTHOR);
mandatoryParameters.add(ReportEngineParameterNames.TITLE);
+ mandatoryParameters.add(ReportEngineParameterNames.MAXROWS);
parameterTypes = new HashMap();
@@ -89,6 +90,7 @@ public class PentahoReportEngineMetaData
parameterTypes.put(ReportEngineParameterNames.INPUT_DETAIL_COLUMNS, List.class);
parameterTypes.put(ReportEngineParameterNames.AUTHOR, String.class);
parameterTypes.put(ReportEngineParameterNames.TITLE, String.class);
+ parameterTypes.put(ReportEngineParameterNames.MAXROWS, Integer.class);
enumerationValues = new HashNMap();
enumerationValues.add(CONTENT_TYPE,
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java
index 1630160..1010ed5 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java
@@ -60,9 +60,6 @@ import org.pentaho.reporting.libraries.formula.lvalues.LValue;
import org.pentaho.reporting.libraries.formula.lvalues.Term;
import org.pentaho.reporting.libraries.formula.parser.FormulaParser;
import org.pentaho.reporting.libraries.formula.parser.ParseException;
-import org.pentaho.reporting.libraries.formula.DefaultFormulaContext;
-import org.pentaho.reporting.libraries.formula.function.FunctionCategory;
-import org.pentaho.reporting.libraries.formula.function.FunctionRegistry;
import org.jfree.report.expressions.Expression;
import org.jfree.report.expressions.FormulaExpression;
import org.jfree.report.flow.DefaultReportJob;
@@ -96,6 +93,7 @@ public class PentahoReportJob implements ReportJob
private final ReportJobDefinition definition;
private final List masterValues;
private final List detailColumns;
+ private final Integer maxRows;
public ReportJobDefinition getDefinition()
{
@@ -147,6 +145,7 @@ public class PentahoReportJob implements ReportJob
this.masterValues = (ArrayList) jobProperties.getProperty(ReportEngineParameterNames.INPUT_MASTER_VALUES);
this.detailColumns = (ArrayList) jobProperties.getProperty(ReportEngineParameterNames.INPUT_DETAIL_COLUMNS);
+ this.maxRows = (Integer) jobProperties.getProperty(ReportEngineParameterNames.MAXROWS);
this.resourceManager = new ResourceManager();
this.resourceManager.registerDefaults();
@@ -241,6 +240,8 @@ public class PentahoReportJob implements ReportJob
{
final OfficeGroup group = (OfficeGroup) node;
final FormulaExpression exp = (FormulaExpression) group.getGroupingExpression();
+ if ( exp == null )
+ continue;
try
{
@@ -343,10 +344,12 @@ public class PentahoReportJob implements ReportJob
final String escapeProcessing = (String) officeReport.getAttribute(OfficeNamespaces.OOREPORT_NS, SDBCReportDataFactory.ESCAPE_PROCESSING);
report.setQuery(command);
parameters.put(SDBCReportDataFactory.COMMAND_TYPE, commandType);
- parameters.put(SDBCReportDataFactory.ESCAPE_PROCESSING,new Boolean(!("false".equals(escapeProcessing))));
+ parameters.put(SDBCReportDataFactory.ESCAPE_PROCESSING,Boolean.valueOf(!("false".equals(escapeProcessing))));
final String filter = (String) officeReport.getAttribute(OfficeNamespaces.OOREPORT_NS, "filter");
parameters.put(SDBCReportDataFactory.UNO_FILTER, filter);
+
+ parameters.put(ReportEngineParameterNames.MAXROWS, report.getJobProperties().getProperty(ReportEngineParameterNames.MAXROWS));
final long startTime = System.currentTimeMillis();
final ReportProcessor rp = getProcessorForContentType(contentType);
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java
index 20c3a03..533f322 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java
@@ -44,16 +44,14 @@ public final class SOFormulaOpCodeMapper extends WeakBase
implements com.sun.star.sheet.XFormulaOpCodeMapper, XServiceInfo
{
- private final XComponentContext m_xContext;
private static final String __serviceName = "com.sun.star.report.pentaho.SOFormulaOpCodeMapper";
private final SOFormulaParser parser;
// attributes
final private int m_OpCodeExternal = 0;
final private int m_OpCodeUnknown = 0;
- public SOFormulaOpCodeMapper(XComponentContext context, SOFormulaParser parser)
+ public SOFormulaOpCodeMapper(SOFormulaParser parser)
{
- m_xContext = context;
this.parser = parser;
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java
index 319c142..321acb0 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -82,9 +82,9 @@ public final class SOFormulaParser extends ComponentBase
private final Map parserAllOpCodes = new HashMap();
private final Map parserNames = new HashMap();
private final Map[] groupOpCodes = new HashMap[5];
- private final Vector specialOpCodes = new Vector();
+ private final List specialOpCodes = new ArrayList();
- public Vector getSpecialOpCodes()
+ public List getSpecialOpCodes()
{
return specialOpCodes;
}
@@ -92,7 +92,7 @@ public final class SOFormulaParser extends ComponentBase
private final FormulaOpCodeMapEntry opCodePush;
private final FormulaParser parser;
- public SOFormulaParser(XComponentContext context)
+ public SOFormulaParser(final XComponentContext context)
{
m_xContext = context;
@@ -131,7 +131,6 @@ public final class SOFormulaParser extends ComponentBase
addOpCodes(names, opCodes, ARRAY_SEPARATORS, false);
opCodes = mapper.getAvailableMappings(FormulaLanguage.ODFF, FormulaMapGroup.SPECIAL);
- names = new String[opCodes.length];
for (int i = 0; i < opCodes.length; i++)
{
@@ -156,7 +155,7 @@ public final class SOFormulaParser extends ComponentBase
;
// com.sun.star.sheet.XFormulaParser:
- public com.sun.star.sheet.FormulaToken[] parseFormula(String aFormula)
+ public com.sun.star.sheet.FormulaToken[] parseFormula(String aFormula, com.sun.star.table.CellAddress aReferencePos)
{
final ArrayList tokens = new ArrayList();
if ( !"=".equals(aFormula) )
@@ -179,9 +178,9 @@ public final class SOFormulaParser extends ComponentBase
final String upper = token.image.toUpperCase();
if ( parserNames.containsKey(upper) )
{
- if ( token.image.equals("("))
+ if ( "(".equals(token.image))
brackets++;
- else if ( token.image.equals(")"))
+ else if ( ")".equals(token.image))
--brackets;
final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(upper);
formulaToken = opCode.Token;
@@ -210,7 +209,7 @@ public final class SOFormulaParser extends ComponentBase
images.add(")");
tokens.add(opCode.Token);
}
-
+
}
parser.parse(formula);
@@ -237,11 +236,10 @@ public final class SOFormulaParser extends ComponentBase
{
}
}
- FormulaToken[] ret = (FormulaToken[]) tokens.toArray(new FormulaToken[tokens.size()]);
- return ret;
+ return (FormulaToken[]) tokens.toArray(new FormulaToken[tokens.size()]);
}
- public String printFormula(com.sun.star.sheet.FormulaToken[] aTokens)
+ public String printFormula(com.sun.star.sheet.FormulaToken[] aTokens, com.sun.star.table.CellAddress aReferencePos)
{
final StringBuffer ret = new StringBuffer();
for (int i = 0; i < aTokens.length; i++)
@@ -345,7 +343,7 @@ public final class SOFormulaParser extends ComponentBase
{
if ( formulaOpCodeMapper == null )
{
- formulaOpCodeMapper = new SOFormulaOpCodeMapper(m_xContext, this);
+ formulaOpCodeMapper = new SOFormulaOpCodeMapper(this);
}
return formulaOpCodeMapper;
@@ -384,12 +382,12 @@ public final class SOFormulaParser extends ComponentBase
}
}
- final public Map getNames()
+ public Map getNames()
{
return parserNames;
}
- final public Map getGroup(int group)
+ public Map getGroup(int group)
{
return groupOpCodes[group];
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java
index 1fbdda8..6c40b5b 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java
@@ -31,8 +31,6 @@
package com.sun.star.report.pentaho;
import com.sun.star.container.NoSuchElementException;
-import com.sun.star.lang.IndexOutOfBoundsException;
-import com.sun.star.lang.WrappedTargetException;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.report.meta.XFunctionDescription;
import com.sun.star.uno.XComponentContext;
@@ -43,9 +41,6 @@ import org.pentaho.reporting.libraries.formula.DefaultFormulaContext;
import org.pentaho.reporting.libraries.formula.function.FunctionCategory;
import org.pentaho.reporting.libraries.formula.function.FunctionDescription;
import org.pentaho.reporting.libraries.formula.function.FunctionRegistry;
-import org.pentaho.reporting.libraries.formula.lvalues.LValue;
-import org.pentaho.reporting.libraries.formula.parser.FormulaParser;
-import org.pentaho.reporting.libraries.formula.parser.ParseException;
/**
* This class capsulates the class, that implements the minimal component, a factory for creating the service
@@ -150,31 +145,6 @@ public final class SOFunctionManager extends ComponentBase implements XFunctionM
return new StarFunctionCategory(defaultContext,m_xContext, functionRegistry, position, categories[position]);
}
- public int getFunctionStartAtIndex(String formula, int position)
- {
- int nStartPos = -1;
- try
- {
- final FormulaParser parser = new FormulaParser();
- final LValue x = parser.parse(formula);
- String part = x.toString();
- while ( part.length() < position )
- {
- final LValue[] children = x.getChildValues();
- if ( children != null )
- {
- for(int i = 0; i < children.length;++i)
- {
- part = children[i].toString();
- }
- }
- }
- } catch ( ParseException ex )
- {
- }
- return nStartPos;
- }
-
public XFunctionDescription getFunctionByName(String arg0) throws NoSuchElementException
{
final FunctionDescription func = functionRegistry.getMetaData(arg0);
@@ -188,7 +158,7 @@ public final class SOFunctionManager extends ComponentBase implements XFunctionM
}
try
{
- return new StarFunctionDescription(defaultContext, m_xContext, getCategory(i), functionRegistry, func);
+ return new StarFunctionDescription(defaultContext, m_xContext, getCategory(i), func);
}
catch ( Exception ex )
{
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java
index 63f8143..ce29371 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java
@@ -174,9 +174,9 @@ public class SOReportJobFactory
try
{
simpleReg.open(path, true, false);
- XRegistryKey xRegistryRootKey = simpleReg.getRootKey();
+ final XRegistryKey xRegistryRootKey = simpleReg.getRootKey();
// read locale
- XRegistryKey locale = xRegistryRootKey.openKey(value);
+ final XRegistryKey locale = xRegistryRootKey.openKey(value);
if ( locale != null )
{
final String newLocale = locale.getStringValue();
@@ -205,7 +205,7 @@ public class SOReportJobFactory
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
try
{
- XSimpleRegistry simpleReg = (XSimpleRegistry) UnoRuntime.queryInterface(XSimpleRegistry.class,
+ final XSimpleRegistry simpleReg = (XSimpleRegistry) UnoRuntime.queryInterface(XSimpleRegistry.class,
m_cmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.configuration.ConfigurationRegistry", m_cmpCtx));
String currentLocale = getLocaleFromRegistry(simpleReg,"org.openoffice.Setup","L10N/ooSetupSystemLocale");
@@ -242,6 +242,7 @@ public class SOReportJobFactory
String mimetype = null;
String author = null;
String title = null;
+ Integer maxRows = null;
for ( int i = 0; i < namedValue.length; ++i )
{
@@ -270,6 +271,10 @@ public class SOReportJobFactory
{
mimetype = (String) aProps.Value;
}
+ else if ( "MaxRows".equalsIgnoreCase(aProps.Name) )
+ {
+ maxRows = (Integer) aProps.Value;
+ }
else if ( ReportEngineParameterNames.AUTHOR.equalsIgnoreCase(aProps.Name) )
{
author = (String) aProps.Value;
@@ -324,6 +329,7 @@ public class SOReportJobFactory
procParms.setProperty(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY, dataFactory);
procParms.setProperty(ReportEngineParameterNames.IMAGE_SERVICE, new SOImageService(m_cmpCtx));
procParms.setProperty(ReportEngineParameterNames.INPUT_REPORTJOB_FACTORY, this);
+ procParms.setProperty(ReportEngineParameterNames.MAXROWS, maxRows);
if ( author != null )
{
procParms.setProperty(ReportEngineParameterNames.AUTHOR, author);
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java
index 9f5c869..80c0194 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java
@@ -156,7 +156,7 @@ public final class StarFunctionCategory extends WeakBase
{
if ( position >= functions.length )
throw new IndexOutOfBoundsException();
- return new StarFunctionDescription(defaultContext,m_xContext,this,functionRegistry,functionRegistry.getMetaData(functions[position]));
+ return new StarFunctionDescription(defaultContext,m_xContext,this,functionRegistry.getMetaData(functions[position]));
}
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java
index 083fc8b..546f512 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java
@@ -51,11 +51,10 @@ public final class StarFunctionDescription extends WeakBase
// attributes
// final private com.sun.star.report.meta.XFunctionCategory m_Category;
private final FunctionDescription functionDescription;
- private final FunctionRegistry functionRegistry;
private final XFunctionCategory category;
private final Locale defaultLocale;
- public StarFunctionDescription(final DefaultFormulaContext defaultContext, final XComponentContext context, final XFunctionCategory category, final FunctionRegistry functionRegistry, final FunctionDescription functionDescription)
+ public StarFunctionDescription(final DefaultFormulaContext defaultContext, final XComponentContext context, final XFunctionCategory category, final FunctionDescription functionDescription)
{
m_xContext = context;
this.category = category;
@@ -71,7 +70,6 @@ public final class StarFunctionDescription extends WeakBase
this.defaultLocale = locale;
this.functionDescription = functionDescription;
- this.functionRegistry = functionRegistry;
// use the last parameter of the PropertySetMixin constructor
// for your optional attributes if necessary. See the documentation
// of the PropertySetMixin helper for further information.
@@ -137,14 +135,14 @@ public final class StarFunctionDescription extends WeakBase
{
final int count = functionDescription.getParameterCount();
final StringBuffer signature = new StringBuffer(getName());
- signature.append("(");
+ signature.append('(');
for (int i = 0; i < count; i++)
{
signature.append(functionDescription.getParameterDisplayName(i, defaultLocale));
if ( i != (count - 1) )
- signature.append(";");
+ signature.append(';');
}
- signature.append(")");
+ signature.append(')');
return signature.toString();
}
@@ -176,16 +174,16 @@ public final class StarFunctionDescription extends WeakBase
throw new com.sun.star.lang.IllegalArgumentException();
final StringBuffer formula = new StringBuffer(getName());
- formula.append("(");
+ formula.append('(');
for (int i = 0; i < arguments.length; ++i)
{
if ( arguments[i].length() == 0 )
break;
formula.append(arguments[i]);
if ( i < (arguments.length - 1) && arguments[i+1].length() != 0 )
- formula.append(";");
+ formula.append(';');
}
- formula.append(")");
+ formula.append(')');
return formula.toString();
}
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties b/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties
index 8af708e..186b856 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties
+++ b/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties
@@ -140,6 +140,7 @@ com.sun.star.report.pentaho.output.namespace.oasis-data=urn:oasis:names:tc:opend
com.sun.star.report.pentaho.output.default.oasis-data=allow
com.sun.star.report.pentaho.output.tag.oasis-data.text=deny
com.sun.star.report.pentaho.output.tag.oasis-data.currency-symbol=deny
+com.sun.star.report.pentaho.output.tag.oasis-data.embedded-text=deny
com.sun.star.report.pentaho.output.namespace.oasis-draw=urn:oasis:names:tc:opendocument:xmlns:drawing:1.0
com.sun.star.report.pentaho.output.default.oasis-draw=deny
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java
index fee16b6..ce48e04 100755
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java
@@ -32,6 +32,7 @@ package com.sun.star.report.pentaho.layoutprocessor;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.sql.Time;
import com.sun.star.report.pentaho.OfficeNamespaces;
import com.sun.star.report.OfficeToken;
@@ -43,6 +44,8 @@ import org.jfree.report.data.DefaultDataFlags;
import org.jfree.report.expressions.FormulaExpression;
import org.jfree.report.flow.FlowController;
import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil;
+import org.pentaho.reporting.libraries.formula.util.DateUtil;
+import org.pentaho.reporting.libraries.formula.util.HSSFDateUtil;
/**
* Creation-Date: 06.06.2007, 17:03:30
@@ -56,6 +59,7 @@ public class FormatValueUtility
public static final String VALUE_TYPE = "value-type";
private static SimpleDateFormat dateFormat;
+ private static SimpleDateFormat timeFormat;
private FormatValueUtility()
{
@@ -64,12 +68,24 @@ public class FormatValueUtility
public static String applyValueForVariable(final Object value, final AttributeMap variableSection)
{
String ret = null;
- if (value instanceof Date)
+ if (value instanceof Time)
+ {
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "time");
+ ret = formatTime((Time) value);
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "time-value", ret);
+ }
+ else if (value instanceof java.sql.Date )
{
variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "date");
ret = formatDate((Date) value);
variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", ret);
}
+ else if (value instanceof Date)
+ {
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "float");
+ ret = HSSFDateUtil.getExcelDate((Date)value,false,2).toString();
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", ret);
+ }
else if (value instanceof Number)
{
variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "float");
@@ -100,12 +116,21 @@ public class FormatValueUtility
return ret;
}
- public static void applyValueForCell(final Object value, final AttributeMap variableSection)
+ public static void applyValueForCell(final Object value, final AttributeMap variableSection,final String valueType)
{
- if (value instanceof Date)
+ if (value instanceof Time)
+ {
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "time-value", formatTime((Time) value));
+ }
+ else if (value instanceof java.sql.Date )
{
variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value));
}
+ else if (value instanceof Date)
+ {
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "float");
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", HSSFDateUtil.getExcelDate((Date)value,false,2).toString());
+ }
else if (value instanceof Number)
{
variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", String.valueOf(value));
@@ -123,7 +148,24 @@ public class FormatValueUtility
}
else if (value != null)
{
- variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,STRING_VALUE, String.valueOf(value));
+ try
+ {
+ final Float number = Float.valueOf(String.valueOf(value));
+ applyValueForCell(number,variableSection,valueType);
+ return;
+ }
+ catch(NumberFormatException e)
+ {
+
+ }
+ if ( !"string".equals(valueType))
+ {
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", String.valueOf(value));
+ }
+ else
+ {
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,STRING_VALUE, String.valueOf(value));
+ }
}
else
{
@@ -139,6 +181,14 @@ public class FormatValueUtility
}
return dateFormat.format(date);
}
+ private static synchronized String formatTime(final Date date)
+ {
+ if (timeFormat == null)
+ {
+ timeFormat = new SimpleDateFormat("'PT'HH'H'mm'M'ss'S'");
+ }
+ return timeFormat.format(date);
+ }
public static DataFlags computeDataFlag(final FormattedTextElement element,
final FlowController flowController)
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java
index 40e40ea..0d90ff8 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java
@@ -85,20 +85,20 @@ public class ImageElementLayoutController
// A static image is easy. At least at this level. Dont ask about the weird things we have to do in the
// output targets ...
final String linkTarget = imageElement.getImageData();
- generateImage(target, linkTarget, imageElement.isScale(), imageElement.isPreserveIRI());
+ generateImage(target, linkTarget, imageElement.getScaleMode(), imageElement.isPreserveIRI());
}
else
{
final Object value =
LayoutControllerUtil.evaluateExpression(getFlowController(), imageElement, formulaExpression);
- generateImage(target, value, imageElement.isScale(), imageElement.isPreserveIRI());
+ generateImage(target, value, imageElement.getScaleMode(), imageElement.isPreserveIRI());
}
return join(getFlowController());
}
private void generateImage(final ReportTarget target,
final Object linkTarget,
- final boolean scale,
+ final String scale,
final boolean preserveIri)
throws ReportProcessingException, DataSourceException
{
@@ -110,7 +110,7 @@ public class ImageElementLayoutController
final AttributeMap image = new AttributeMap();
image.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.NAMESPACE_ATTRIBUTE, JFreeReportInfo.REPORT_NAMESPACE);
image.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.TYPE_ATTRIBUTE, OfficeToken.IMAGE);
- image.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.SCALE, String.valueOf(scale));
+ image.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.SCALE, scale);
image.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.PRESERVE_IRI, String.valueOf(preserveIri));
image.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "image-context", createContext());
image.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.IMAGE_DATA, linkTarget);
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java
index 511f23e..9e4d993 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java
@@ -30,7 +30,6 @@
package com.sun.star.report.pentaho.layoutprocessor;
import com.sun.star.report.SDBCReportDataFactory;
-import com.sun.star.report.pentaho.OfficeNamespaces;
import com.sun.star.report.OfficeToken;
import com.sun.star.report.pentaho.model.ObjectOleElement;
import java.util.ArrayList;
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupInstanceSectionLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupInstanceSectionLayoutController.java
index 8a3779c..d61f03e 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupInstanceSectionLayoutController.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupInstanceSectionLayoutController.java
@@ -152,7 +152,7 @@ public class OfficeGroupInstanceSectionLayoutController extends SectionLayoutCon
throws DataSourceException
{
final AttributeMap map = new AttributeMap( super.computeAttributes(fc, element, target) );
- map.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "iteration-count", new Integer(getIterationCount()));
+ map.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "iteration-count", Integer.valueOf(getIterationCount()));
map.makeReadOnly();
return map;
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java
index dd23cbd..e63bbbc 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java
@@ -185,7 +185,7 @@ public class OfficeGroupLayoutController extends SectionLayoutController
{
if (lc instanceof OfficeGroupLayoutController)
{
- count += 1;
+ count++;
}
lc = lc.getParent();
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java
index 8b61e71..fc91ce2 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java
@@ -70,6 +70,7 @@ public class TableCellLayoutController extends SectionLayoutController
{
final AttributeMap attributeMap = new AttributeMap(super.computeAttributes(fc, element, target));
final String definedStyle = (String) attributeMap.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);
+ final String valueType = (String) attributeMap.getAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE);
attributeMap.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, getDisplayStyleName((Section) element, definedStyle));
try
@@ -77,7 +78,7 @@ public class TableCellLayoutController extends SectionLayoutController
final DataFlags value = computeValue();
if (value != null)
{
- FormatValueUtility.applyValueForCell(value.getValue(), attributeMap);
+ FormatValueUtility.applyValueForCell(value.getValue(), attributeMap,valueType);
}
}
catch (Exception e)
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java
index 075873e..c448d93 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java
@@ -44,6 +44,7 @@ import org.jfree.report.flow.ReportTarget;
import org.jfree.report.flow.layoutprocessor.AbstractLayoutController;
import org.jfree.report.flow.layoutprocessor.LayoutController;
import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil;
+import org.pentaho.reporting.libraries.formula.util.HSSFDateUtil;
import org.jfree.report.structure.Element;
import java.util.Date;
import java.text.SimpleDateFormat;
@@ -150,13 +151,14 @@ public class VariablesDeclarationLayoutController
String formula = FormatValueUtility.applyValueForVariable(value, variableSection);
if ( formula == null )
formula = "" + value;
- if (value instanceof Date)
+ if (value instanceof java.sql.Date)
{
final Date date = (Date)value;
final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy;MM;dd");
formula = "Date(" + dateFormat.format(date) + ")";
}
variableSection.setAttribute(OfficeNamespaces.TEXT_NS, "formula", "ooow:" + formula);
+
return variableSection;
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk
index 5d448a6..36e83af 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk
+++ b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk
@@ -103,18 +103,18 @@ CUSTOMMANIFESTFILE = Manifest.mf
$(JARTARGETN) : $(COMP) $(PROPERTYFILES) $(CSSFILES) $(XSDFILES) $(TXTFILES) $(XMLFILES)
.ENDIF # "$(JARTARGETN)"!=""
-fix_system_libs:
+fix_system_libs: $(JARMANIFEST)
@echo "Fix Java Class-Path entry for libraries from system."
.IF ("$(SYSTEM_JFREEREPORT)" != "YES" && "$(SYSTEM_APACHE_COMMONS)" == "YES")
@$(SED) -r -e "s#commons-logging-1.1.1.jar#file://$(COMMONS_LOGGING_JAR)#" \
- -i ../../../../../../$(INPATH)/class/sun-report-builder/META-INF/MANIFEST.MF
+ -i $<
.ENDIF
.IF ("$(SYSTEM_JFREEREPORT)" == "YES" && "$(SYSTEM_APACHE_COMMONS)" == "YES")
@$(SED) '/flute/,/sac/d' -i ../../../../../../$(INPATH)/class/sun-report-builder/META-INF/MANIFEST.MF
@$(SED) -r -e "s#^Class-Path.*#\0\n file://$(LIBBASE_JAR)\n file://$(SAC_JAR)\n file://$(LIBXML_JAR)\n\
file://$(FLUTE_JAR)\n file://$(JFREEREPORT_JAR)\n file://$(LIBLAYOUT_JAR)\n file://$(LIBLOADER_JAR)\n file://$(LIBFORMULA_JAR)\n\
file://$(LIBREPOSITORY_JAR)\n file://$(LIBFONTS_JAR)\n file://$(LIBSERIALIZER_JAR)\n file://$(COMMONS_LOGGING_JAR)#" \
- -i ../../../../../../$(INPATH)/class/sun-report-builder/META-INF/MANIFEST.MF
+ -i $<
.ENDIF
$(CLASSDIR)$/$(PACKAGE)$/%.properties : %.properties
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java
index 71c0b61..ba45ba8 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java
@@ -59,15 +59,16 @@ public class ImageElement extends ReportElement
this.formula = formula;
}
- public boolean isScale()
- {
- return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.SCALE));
- }
- public void setScale(final boolean scale)
- {
- setAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.SCALE, String.valueOf(scale));
- }
+ public String getScaleMode()
+ {
+ String val = (String)getAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.SCALE);
+ if ( OfficeToken.TRUE.equals(val) )
+ val = OfficeToken.ANISOTROPIC;
+ else if ( OfficeToken.FALSE.equals(val) || val == null )
+ val = OfficeToken.NONE;
+ return val;
+ }
public boolean isPreserveIRI()
{
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java b/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java
index 7cc0bc2..9485b27 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java
@@ -38,6 +38,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
+import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.sql.Blob;
@@ -50,7 +51,10 @@ import com.sun.star.report.OutputRepository;
import com.sun.star.report.ImageService;
import com.sun.star.report.ReportExecutionException;
import com.sun.star.report.pentaho.DefaultNameGenerator;
+import java.net.URI;
import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jfree.layouting.input.style.values.CSSNumericType;
@@ -347,7 +351,7 @@ public class ImageProducer
final CSSNumericValue widthVal = CSSNumericValue.createValue(CSSNumericType.MM, dims.getWidth() / 100.0);
final CSSNumericValue heightVal = CSSNumericValue.createValue(CSSNumericType.MM, dims.getHeight() / 100.0);
- final String filename = copyToOutputRepository(mimeType, source, data);
+ final String filename = copyToOutputRepository(mimeType, data);
final OfficeImage officeImage = new OfficeImage(filename, widthVal, heightVal);
imageCache.put(source, officeImage);
return officeImage;
@@ -371,7 +375,17 @@ public class ImageProducer
private OfficeImage produceFromURL(final URL url,
final boolean preserveIRI)
{
- final OfficeImage o = (OfficeImage) imageCache.get(url);
+ final String urlString = url.toString();
+ URI uri = null;
+ try
+ {
+ uri = new URI(urlString);
+ }
+ catch ( URISyntaxException ex )
+ {
+ Logger.getLogger(ImageProducer.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ final OfficeImage o = (OfficeImage) imageCache.get(uri);
if (o != null)
{
return o;
@@ -398,15 +412,14 @@ public class ImageProducer
if (preserveIRI)
{
- final OfficeImage retval = new OfficeImage(url.toString(), widthVal, heightVal);
- imageCache.put(url, retval);
+ final OfficeImage retval = new OfficeImage(urlString, widthVal, heightVal);
+ imageCache.put(uri, retval);
return retval;
}
- final String file = url.getFile();
- final String name = copyToOutputRepository(mimeType, file, data);
+ final String name = copyToOutputRepository(mimeType, data);
final OfficeImage officeImage = new OfficeImage(name, widthVal, heightVal);
- imageCache.put(url, officeImage);
+ imageCache.put(uri, officeImage);
return officeImage;
}
catch (IOException e)
@@ -420,8 +433,8 @@ public class ImageProducer
if (!preserveIRI)
{
- final OfficeImage image = new OfficeImage(url.toString(), null, null);
- imageCache.put(url, image);
+ final OfficeImage image = new OfficeImage(urlString, null, null);
+ imageCache.put(uri, image);
return image;
}
@@ -429,7 +442,7 @@ public class ImageProducer
return null;
}
- private String copyToOutputRepository(final String urlMimeType, final String file, final byte[] data)
+ private String copyToOutputRepository(final String urlMimeType, final byte[] data)
throws IOException, ReportExecutionException
{
final String mimeType;
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java
index bd9ac1f..c02b5fe 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java
@@ -43,7 +43,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.InflaterInputStream;
-
+import com.sun.star.report.ReportEngineParameterNames;
import com.sun.star.report.ImageService;
import com.sun.star.report.InputRepository;
import com.sun.star.report.OutputRepository;
@@ -65,6 +65,7 @@ import org.apache.commons.logging.LogFactory;
import org.jfree.layouting.input.style.parser.CSSValueFactory;
import org.jfree.layouting.input.style.parser.StyleSheetParserUtil;
import org.jfree.layouting.input.style.values.CSSNumericValue;
+import org.jfree.layouting.input.style.values.CSSNumericType;
import org.jfree.layouting.layouter.style.CSSValueResolverUtility;
import org.jfree.layouting.namespace.NamespaceDefinition;
import org.jfree.layouting.namespace.Namespaces;
@@ -300,7 +301,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget
this.imageNames = new AttributeNameGenerator();
this.imageProducer = new ImageProducer(inputRepository, outputRepository, imageService);
- this.oleProducer = new OleProducer(inputRepository, outputRepository, imageService, datasourcefactory);
+ this.oleProducer = new OleProducer(inputRepository, outputRepository, imageService, datasourcefactory,(Integer)reportJob.getParameters().get(ReportEngineParameterNames.MAXROWS));
try
{
@@ -1121,7 +1122,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget
}
catch (IOException ioe)
{
- throw new ReportProcessingException("Unable to create the buffer");
+ throw new ReportProcessingException("Unable to create the buffer",ioe);
}
}
@@ -1152,8 +1153,9 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget
return null;
}
- protected AttributeList buildAttributeList(final AttributeMap attrs)
+ protected AttributeList buildAttributeList(final AttributeMap attrs)
{
+ final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs);
final AttributeList attrList = new AttributeList();
final String[] namespaces = attrs.getNameSpaces();
for (int i = 0; i < namespaces.length; i++)
@@ -1179,7 +1181,8 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget
tableNameGenerator.generateName(saneName));
}
else if (OfficeNamespaces.DRAWING_NS.equals(attrNamespace) &&
- "name".equals(key))
+ "name".equals(key) &&
+ !"equation".equals(elementType) )
{
final String objectName = String.valueOf(entry.getValue());
attrList.setAttribute(attrNamespace, key,
@@ -1284,6 +1287,9 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget
CSSNumericValue imageAreaWidthVal;
CSSNumericValue imageAreaHeightVal;
+ CSSNumericValue posX = CSSNumericValue.createValue(CSSNumericType.CM, 0.0);
+ CSSNumericValue posY = CSSNumericValue.createValue(CSSNumericType.CM, 0.0);
+
String styleName = null;
if (imageContext != null)
{
@@ -1303,8 +1309,8 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget
final CSSNumericValue normalizedImageHeight =
CSSValueResolverUtility.convertLength(height, imageAreaHeightVal.getType());
- final boolean scale = OfficeToken.TRUE.equals(attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.SCALE));
- if (!scale && normalizedImageWidth.getValue() > 0 && normalizedImageHeight.getValue() > 0)
+ final String scale = (String)attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.SCALE);
+ if ( OfficeToken.NONE.equals(scale) && normalizedImageWidth.getValue() > 0 && normalizedImageHeight.getValue() > 0)
{
final double clipWidth = normalizedImageWidth.getValue() - imageAreaWidthVal.getValue();
final double clipHeight = normalizedImageHeight.getValue() - imageAreaHeightVal.getValue();
@@ -1373,6 +1379,16 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget
imageAreaHeightVal = normalizedImageHeight;
}
}
+ else if ( OfficeToken.ISOTROPIC.equals(scale) )
+ {
+ final double[] ret = calcPaintSize(imageAreaWidthVal,imageAreaHeightVal,normalizedImageWidth,normalizedImageHeight);
+
+ posX = CSSNumericValue.createValue(imageAreaWidthVal.getType(),( imageAreaWidthVal.getValue() - ret[0]) * 0.5);
+ posY = CSSNumericValue.createValue(imageAreaHeightVal.getType(),( imageAreaHeightVal.getValue() - ret[1]) * 0.5);
+
+ imageAreaWidthVal = CSSNumericValue.createValue(imageAreaWidthVal.getType(),ret[0]);
+ imageAreaHeightVal = CSSNumericValue.createValue(imageAreaHeightVal.getType(),ret[1]);
+ }
}
// If we do scale, then we simply use the given image-area-size as valid image size and dont
// care about the image itself ..
@@ -1393,8 +1409,9 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget
}
frameList.setAttribute(OfficeNamespaces.TEXT_NS, "anchor-type", OfficeToken.PARAGRAPH);
frameList.setAttribute(OfficeNamespaces.SVG_NS, "z-index", "0");
- frameList.setAttribute(OfficeNamespaces.SVG_NS, "x", ZERO_CM);
- frameList.setAttribute(OfficeNamespaces.SVG_NS, "y", ZERO_CM);
+ frameList.setAttribute(OfficeNamespaces.SVG_NS, "x", posX.getValue() + posX.getType().getType());
+ frameList.setAttribute(OfficeNamespaces.SVG_NS, "y", posY.getValue() + posY.getType().getType());
+
LOGGER.debug("Image " + imageData + " A-Width: " + imageAreaWidthVal + ", A-Height: " + imageAreaHeightVal);
@@ -1635,7 +1652,28 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget
{
throw new ReportProcessingException(FAILED, ioe);
}
+ }
+ static private double[] calcPaintSize( final CSSNumericValue areaWidth, final CSSNumericValue areaHeight,
+ final CSSNumericValue imageWidth, final CSSNumericValue imageHeight)
+ {
+ final double ratioX = areaWidth.getValue() / imageWidth.getValue();
+ final double ratioY = areaHeight.getValue() / imageHeight.getValue();
+ final double ratioMin = Math.min( ratioX, ratioY );
+ double[] ret = new double[2];
+ ret[0] = imageWidth.getValue() * ratioMin;
+ ret[1] = imageHeight.getValue() * ratioMin;
+ return ret;
+ }
+ protected void writeNullDate() throws IOException
+ {
+ // write NULL DATE
+ final XmlWriter xmlWriter = getXmlWriter();
+ xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, "calculation-settings", null, XmlWriterSupport.OPEN);
+ final AttributeMap nullDateAttributes = new AttributeMap();
+ nullDateAttributes.setAttribute(OfficeNamespaces.TABLE_NS, "date-value", "1900-01-01");
+ xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, "null-date", buildAttributeList(nullDateAttributes), XmlWriterSupport.CLOSE);
+ xmlWriter.writeCloseTag();
}
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java b/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java
index acef689..83afecf 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java
@@ -57,10 +57,11 @@ public class OleProducer {
private final DefaultNameGenerator nameGenerator;
private final DataSourceFactory dataSourceFactory;
private final ImageService imageService;
+ private final Integer maxRows;
public OleProducer(final InputRepository inputRepository,
- final OutputRepository outputRepository,final ImageService imageService,final DataSourceFactory dataSourceFactory) {
+ final OutputRepository outputRepository,final ImageService imageService,final DataSourceFactory dataSourceFactory,final Integer maxRows) {
if (inputRepository == null) {
throw new NullPointerException();
}
@@ -73,6 +74,7 @@ public class OleProducer {
this.nameGenerator = new DefaultNameGenerator(outputRepository);
this.dataSourceFactory = dataSourceFactory;
this.imageService = imageService;
+ this.maxRows = maxRows;
}
String produceOle(final String source,final List masterColumns,final List masterValues,final List detailColumns) {
@@ -99,6 +101,7 @@ public class OleProducer {
procParms.setProperty(ReportEngineParameterNames.INPUT_MASTER_VALUES, masterValues);
procParms.setProperty(ReportEngineParameterNames.INPUT_DETAIL_COLUMNS, detailColumns);
procParms.setProperty(ReportEngineParameterNames.IMAGE_SERVICE, imageService);
+ procParms.setProperty(ReportEngineParameterNames.MAXROWS, maxRows);
engine.createJob(definition).execute();
} catch (ReportExecutionException ex) {
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportTarget.java b/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportTarget.java
index 6f73672..8acf19d 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportTarget.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportTarget.java
@@ -101,6 +101,7 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget
tableCount = 0;
final XmlWriter xmlWriter = getXmlWriter();
xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, getStartContent(), null, XmlWriterSupport.OPEN);
+ writeNullDate();
++closeTags;
}
@@ -280,7 +281,7 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget
}
catch (IOException ioe)
{
- throw new ReportProcessingException("Failed to write settings document");
+ throw new ReportProcessingException("Failed to write settings document",ioe);
}
}
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java
index 682592e..6625f85 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java
@@ -81,6 +81,17 @@ import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport;
public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
{
+ private static final String[] FOPROPS = new String[]
+ {
+ "letter-spacing", "font-variant", "text-transform"
+ };
+ private static final String NUMBERCOLUMNSSPANNED = "number-columns-spanned";
+ private static final String[] STYLEPROPS = new String[]
+ {
+ "text-combine", "font-pitch-complex", "text-rotation-angle", "font-name", "text-blinking", "letter-kerning", "text-combine-start-char", "text-combine-end-char", "text-position", "text-scale"
+ };
+ private static final int CELL_WIDTH_FACTOR = 10000;
+ private static final String TRANSPARENT = "transparent";
private boolean paragraphFound = false;
private boolean paragraphHandled = false;
@@ -93,9 +104,9 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
{
private final Set tableIndices;
- private final float boundary;
+ private final long boundary;
- private ColumnBoundary(final float boundary)
+ private ColumnBoundary(final long boundary)
{
this.tableIndices = new HashSet();
this.boundary = boundary;
@@ -119,13 +130,13 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
public int compareTo(final Object arg0)
{
- if (arg0.equals(this))
+ if ( arg0.equals(this) )
{
return 0;
}
- if (arg0 instanceof ColumnBoundary)
+ if ( arg0 instanceof ColumnBoundary )
{
- if (boundary > ((ColumnBoundary) arg0).boundary)
+ if ( boundary > ((ColumnBoundary) arg0).boundary )
{
return 1;
}
@@ -139,38 +150,45 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
public boolean equals(final Object obj)
{
- if (obj instanceof ColumnBoundary)
+ if ( obj instanceof ColumnBoundary )
{
return ((ColumnBoundary) obj).boundary == boundary;
}
return false;
}
+
+ public int hashCode()
+ {
+ assert false : "hashCode not designed";
+ return 42; // any arbitrary constant will do
+ }
}
private String tableBackgroundColor; // null means transparent ...
- private static final ColumnBoundary[] EMPTY_COLBOUNDS = new ColumnBoundary[0];
+ private static final ColumnBoundary[] EMPTY_COLBOUNDS = new ColumnBoundary[ 0 ];
private boolean elementBoundaryCollectionPass;
private boolean oleHandled;
private final List columnBoundaryList;
- private float currentRowBoundaryMarker;
+ private long currentRowBoundaryMarker;
private ColumnBoundary[] sortedBoundaryArray;
private ColumnBoundary[] boundariesForTableArray;
private int tableCounter;
private int columnCounter;
private int columnSpanCounter;
+ private int currentSpan = 0;
private String unitsOfMeasure;
- final private ArrayList shapes;
- final private ArrayList ole;
- final private ArrayList rowHeights;
+ final private List shapes;
+ final private List ole;
+ final private List rowHeights;
public SpreadsheetRawReportTarget(final ReportJob reportJob,
- final ResourceManager resourceManager,
- final ResourceKey baseResource,
- final InputRepository inputRepository,
- final OutputRepository outputRepository,
- final String target,
- final ImageService imageService,
- final DataSourceFactory dataSourceFactory)
- throws ReportProcessingException
+ final ResourceManager resourceManager,
+ final ResourceKey baseResource,
+ final InputRepository inputRepository,
+ final OutputRepository outputRepository,
+ final String target,
+ final ImageService imageService,
+ final DataSourceFactory dataSourceFactory)
+ throws ReportProcessingException
{
super(reportJob, resourceManager, baseResource, inputRepository, outputRepository, target, imageService, dataSourceFactory);
columnBoundaryList = new ArrayList();
@@ -183,9 +201,9 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
public void startOther(final AttributeMap attrs) throws DataSourceException, ReportProcessingException
{
- if (ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.OBJECT_OLE, attrs))
+ if ( ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.OBJECT_OLE, attrs) )
{
- if (isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE)
+ if ( isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE )
{
ole.add(attrs);
}
@@ -193,27 +211,27 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
return;
}
final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs);
- if (isRepeatingSection() || isFilteredNamespace(namespace))
+ if ( isRepeatingSection() || isFilteredNamespace(namespace) )
{
return;
}
final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs);
- if (OfficeNamespaces.TEXT_NS.equals(namespace) && OfficeToken.P.equals(elementType) && !paragraphHandled)
+ if ( OfficeNamespaces.TEXT_NS.equals(namespace) && OfficeToken.P.equals(elementType) && !paragraphHandled )
{
paragraphFound = true;
return;
}
- if (OfficeNamespaces.DRAWING_NS.equals(namespace) && OfficeToken.FRAME.equals(elementType))
+ if ( OfficeNamespaces.DRAWING_NS.equals(namespace) && OfficeToken.FRAME.equals(elementType) )
{
- if (isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE)
+ if ( isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE )
{
final LengthCalculator len = new LengthCalculator();
- for (int i = 0; i < rowHeights.size(); i++)
+ for ( int i = 0; i < rowHeights.size(); i++ )
{
len.add((CSSNumericValue) rowHeights.get(i));
- // val += ((CSSNumericValue)rowHeights.get(i)).getValue();
+ // val += ((CSSNumericValue)rowHeights.get(i)).getValue();
}
rowHeights.clear();
@@ -221,7 +239,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
rowHeights.add(currentRowHeight);
attrs.setAttribute(OfficeNamespaces.DRAWING_NS, "z-index", String.valueOf(shapes.size()));
final String y = (String) attrs.getAttribute(OfficeNamespaces.SVG_NS, "y");
- if (y != null)
+ if ( y != null )
{
len.add(parseLength(y));
final CSSNumericValue currentY = len.getResult();
@@ -231,9 +249,9 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
}
return;
}
- if (oleHandled)
+ if ( oleHandled )
{
- if (isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE)
+ if ( isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE )
{
ole.add(attrs);
}
@@ -241,14 +259,14 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
}
// if this is the report namespace, write out a table definition ..
- if (OfficeNamespaces.TABLE_NS.equals(namespace) && OfficeToken.TABLE.equals(elementType))
+ if ( OfficeNamespaces.TABLE_NS.equals(namespace) && OfficeToken.TABLE.equals(elementType) )
{
// whenever we see a new table, we increment our tableCounter
// this is used to keep tracked of the boundary conditions per table
tableCounter++;
}
- if (isElementBoundaryCollectionPass())
+ if ( isElementBoundaryCollectionPass() )
{
collectBoundaryForElement(attrs);
}
@@ -259,7 +277,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
{
processElement(attrs, namespace, elementType);
}
- catch (IOException e)
+ catch ( IOException e )
{
throw new ReportProcessingException("Failed", e);
}
@@ -268,13 +286,12 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
protected void startReportSection(final AttributeMap attrs, final int role) throws IOException, DataSourceException, ReportProcessingException
{
- if ((role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER ||
- role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) &&
- (!PageSection.isPrintWithReportHeader(attrs) ||
- !PageSection.isPrintWithReportFooter(attrs)))
+ if ( (role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER ||
+ role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER ) &&
+ (!PageSection.isPrintWithReportHeader(attrs) ||
+ !PageSection.isPrintWithReportFooter(attrs)) )
{
startBuffering(new OfficeStylesCollection(), true);
-
}
else
{
@@ -284,10 +301,10 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
protected void endReportSection(final AttributeMap attrs, final int role) throws IOException, DataSourceException, ReportProcessingException
{
- if ((role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER ||
- role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) &&
- (!PageSection.isPrintWithReportHeader(attrs) ||
- !PageSection.isPrintWithReportFooter(attrs)))
+ if ( (role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER ||
+ role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) &&
+ (!PageSection.isPrintWithReportHeader(attrs) ||
+ !PageSection.isPrintWithReportFooter(attrs)) )
{
finishBuffering();
}
@@ -299,7 +316,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
private void handleParagraph()
{
- if (paragraphFound)
+ if ( paragraphFound )
{
try
{
@@ -308,7 +325,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
paragraphHandled = true;
paragraphFound = false;
}
- catch (IOException ex)
+ catch ( IOException ex )
{
LOGGER.error("ReportProcessing failed", ex);
}
@@ -316,26 +333,25 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
}
private void processElement(final AttributeMap attrs, final String namespace, final String elementType)
- throws IOException, ReportProcessingException
+ throws IOException, ReportProcessingException
{
final XmlWriter xmlWriter = getXmlWriter();
- final AttributeMap retval = new AttributeMap(attrs);
- if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE, attrs))
+ if ( ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE, attrs) )
{
// a new table means we must clear our "calculated" table boundary array cache
boundariesForTableArray = null;
final String tableStyle = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);
- if (tableStyle == null)
+ if ( tableStyle == null )
{
tableBackgroundColor = null;
}
else
{
final Object raw = StyleUtilities.queryStyle(getPredefinedStylesCollection(), OfficeToken.TABLE, tableStyle,
- "table-properties", OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR);
- if (raw == null || "transparent".equals(raw))
+ "table-properties", OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR);
+ if ( raw == null || TRANSPARENT.equals(raw) )
{
tableBackgroundColor = null;
}
@@ -347,29 +363,29 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
return;
}
- if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMN, attrs) ||
- ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMNS, attrs))
+ if ( ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMN, attrs) ||
+ ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMNS, attrs) )
{
return;
}
// covered-table-cell elements may appear in the input from row or column spans. In the event that we hit a
// column-span we simply ignore these elements because we are going to adjust the span to fit the uniform table.
- if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.COVERED_TABLE_CELL, attrs))
+ if ( ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.COVERED_TABLE_CELL, attrs) )
{
- if (columnSpanCounter > 0)
+ if ( columnSpanCounter > 0 )
{
columnSpanCounter--;
}
- if (columnSpanCounter == 0)
+ if ( columnSpanCounter == 0 )
{
// if we weren't expecting a covered-table-cell, let's use it, it's probably from a row-span
columnCounter++;
final int span = getColumnSpanForCell(tableCounter, columnCounter, 1);
// use the calculated span for the column in the uniform table to create any additional covered-table-cell
// elements
- for (int i = 0; i < span; i++)
+ for ( int i = 0; i < span; i++ )
{
xmlWriter.writeTag(namespace, OfficeToken.COVERED_TABLE_CELL, null, XmlWriter.CLOSE);
}
@@ -377,17 +393,17 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
return;
}
- if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_ROW, attrs))
+ if ( ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_ROW, attrs) )
{
// a new row means our column counter gets reset
columnCounter = 0;
// Lets make sure the color of the table is ok ..
- if (tableBackgroundColor != null)
+ if ( tableBackgroundColor != null )
{
final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);
final OfficeStyle style = deriveStyle(OfficeToken.TABLE_ROW, styleName);
Element tableRowProperties = style.getTableRowProperties();
- if (tableRowProperties == null)
+ if ( tableRowProperties == null )
{
tableRowProperties = new Section();
tableRowProperties.setNamespace(OfficeNamespaces.STYLE_NS);
@@ -398,44 +414,59 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
else
{
final Object oldValue = tableRowProperties.getAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR);
- if (oldValue == null || "transparent".equals(oldValue))
+ if ( oldValue == null || TRANSPARENT.equals(oldValue) )
{
tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, tableBackgroundColor);
}
}
- retval.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName());
+ attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName());
}
}
- else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_CELL, attrs))
+ else if ( ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_CELL, attrs) )
{
columnCounter++;
final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);
- if (styleName != null)
+ if ( styleName != null )
{
final OfficeStyle cellStyle = getPredefinedStylesCollection().getStyle(OfficeToken.TABLE_CELL, styleName);
- if (cellStyle != null)
+ if ( cellStyle != null )
{
- final Element props = cellStyle.getTableCellProperties();
- if (props != null)
+ final Section textProperties = (Section) cellStyle.getTextProperties();
+ if ( textProperties != null )
+ {
+ for ( String i : FOPROPS )
+ {
+ textProperties.setAttribute(OfficeNamespaces.FO_NS, i, null);
+ }
+ textProperties.setAttribute(OfficeNamespaces.TEXT_NS, "display", null);
+ for ( String i : STYLEPROPS )
+ {
+ textProperties.setAttribute(OfficeNamespaces.STYLE_NS, i, null);
+ }
+ }
+ final Section props = (Section) cellStyle.getTableCellProperties();
+ if ( props != null )
{
final Object raw = props.getAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR);
- if (raw == null || "transparent".equals(raw))
+ if ( TRANSPARENT.equals(raw) )
{
- cellStyle.removeNode(props);
+ props.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, null);
+ // cellStyle.removeNode(props);
}
}
}
+ attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, styleName);
}
- final String numColSpanStr = (String) attrs.getAttribute(namespace, "number-columns-spanned");
+ final String numColSpanStr = (String) attrs.getAttribute(namespace,NUMBERCOLUMNSSPANNED);
int initialColumnSpan = columnSpanCounter = 1;
- if (numColSpanStr != null)
+ if ( numColSpanStr != null )
{
initialColumnSpan = Integer.parseInt(numColSpanStr);
columnSpanCounter = initialColumnSpan;
}
final int span = getColumnSpanForCell(tableCounter, columnCounter, initialColumnSpan);
- if (initialColumnSpan > 1)
+ if ( initialColumnSpan > 1 )
{
// add the initial column span to our column counter index (subtract 1, since it is counted by default)
columnCounter += initialColumnSpan - 1;
@@ -455,41 +486,42 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
// }
// there's no point to create number-columns-spanned attributes if we only span 1 column
- if (span > 1)
+ if ( span > 1 )
{
- retval.setAttribute(namespace, "number-columns-spanned", "" + span);
+ attrs.setAttribute(namespace,NUMBERCOLUMNSSPANNED, "" + span);
+ currentSpan = span;
}
- // we must also generate "covered-table-cell" elements for each column spanned
- // but we'll do this in the endElement, after we close this OfficeToken.TABLE_CELL
+ // we must also generate "covered-table-cell" elements for each column spanned
+ // but we'll do this in the endElement, after we close this OfficeToken.TABLE_CELL
}
// All styles have to be processed or you will loose the paragraph-styles and inline text-styles.
// ..
- performStyleProcessing(retval);
+ performStyleProcessing(attrs);
- final AttributeList attrList = buildAttributeList(retval);
+ final AttributeList attrList = buildAttributeList(attrs);
xmlWriter.writeTag(namespace, elementType, attrList, XmlWriter.OPEN);
- // System.out.println("elementType = " + elementType);
+ // System.out.println("elementType = " + elementType);
}
private void collectBoundaryForElement(final AttributeMap attrs)
{
- if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMNS, attrs))
+ if ( ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMNS, attrs) )
{
// A table row resets the column counter.
resetCurrentRowBoundaryMarker();
}
- else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMN, attrs))
+ else if ( ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMN, attrs) )
{
final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);
- if (styleName == null)
+ if ( styleName == null )
{
// This should not happen, but if it does, we will ignore that cell.
return;
}
final OfficeStyle style = getPredefinedStylesCollection().getStyle(OfficeToken.TABLE_COLUMN, styleName);
- if (style == null)
+ if ( style == null )
{
// Now this is very bad. It means that there is no style defined with the given name.
return;
@@ -498,11 +530,12 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
final Element tableColumnProperties = style.getTableColumnProperties();
String widthStr = (String) tableColumnProperties.getAttribute("column-width");
widthStr = widthStr.substring(0, widthStr.indexOf(getUnitsOfMeasure(widthStr)));
- addColumnWidthToRowBoundaryMarker(Float.parseFloat(widthStr));
+ final float val = Float.parseFloat(widthStr) * CELL_WIDTH_FACTOR;
+ addColumnWidthToRowBoundaryMarker((long) val);
ColumnBoundary currentRowBoundary = new ColumnBoundary(getCurrentRowBoundaryMarker());
final List columnBoundaryList_ = getColumnBoundaryList();
final int idx = columnBoundaryList_.indexOf(currentRowBoundary);
- if (idx == -1)
+ if ( idx == -1 )
{
columnBoundaryList_.add(currentRowBoundary);
}
@@ -516,9 +549,9 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
private String getUnitsOfMeasure(final String str)
{
- if (unitsOfMeasure == null || "".equals(unitsOfMeasure))
+ if ( unitsOfMeasure == null || "".equals(unitsOfMeasure) )
{
- if (str == null || "".equals(str))
+ if ( str == null || "".equals(str) )
{
unitsOfMeasure = "cm";
return unitsOfMeasure;
@@ -526,10 +559,10 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
// build units of measure, set it
int i = str.length() - 1;
- for (; i >= 0; i--)
+ for ( ; i >= 0; i-- )
{
final char c = str.charAt(i);
- if (Character.isDigit(c) || c == '.' || c == ',')
+ if ( Character.isDigit(c) || c == '.' || c == ',' )
{
break;
}
@@ -541,7 +574,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
private void createTableShapes() throws ReportProcessingException
{
- if (!shapes.isEmpty())
+ if ( !shapes.isEmpty() )
{
try
{
@@ -554,7 +587,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.SHAPES, null, XmlWriterSupport.OPEN);
- for (int i = 0; i < shapes.size(); i++)
+ for ( int i = 0; i < shapes.size(); i++ )
{
final AttributeMap attrs = (AttributeMap) shapes.get(i);
final AttributeList attrList = buildAttributeList(attrs);
@@ -566,7 +599,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
}
xmlWriter.writeCloseTag();
}
- catch (IOException e)
+ catch ( IOException e )
{
throw new ReportProcessingException("Failed", e);
}
@@ -589,14 +622,15 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
// blow away current column styles
// start processing at i=1 because we added a boundary for "0" which is virtual
final ColumnBoundary[] cba = getSortedColumnBoundaryArray();
- for (int i = 1; i < cba.length; i++)
+ for ( int i = 1; i < cba.length; i++ )
{
final ColumnBoundary cb = cba[i];
float columnWidth = cb.getBoundary();
- if (i > 1)
+ if ( i > 1 )
{
columnWidth -= cba[i - 1].getBoundary();
}
+ columnWidth = columnWidth / CELL_WIDTH_FACTOR;
final OfficeStyle style = deriveStyle(OfficeToken.TABLE_COLUMN, ("co" + i + "_"));
final Section tableColumnProperties = new Section();
tableColumnProperties.setType("table-column-properties");
@@ -610,7 +644,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
}
xmlWriter.writeCloseTag();
}
- catch (IOException e)
+ catch ( IOException e )
{
throw new ReportProcessingException("Failed", e);
}
@@ -618,46 +652,46 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
protected void endOther(final AttributeMap attrs) throws DataSourceException, ReportProcessingException
{
- if (ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.OBJECT_OLE, attrs) || oleHandled)
+ if ( ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.OBJECT_OLE, attrs) || oleHandled )
{
oleHandled = false;
return;
}
- if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_ROW, attrs) && isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE)
+ if ( ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_ROW, attrs) && isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE )
{
final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);
rowHeights.add(computeRowHeight(styleName));
}
- if (isRepeatingSection() || isElementBoundaryCollectionPass())
+ if ( isRepeatingSection() || isElementBoundaryCollectionPass() )
{
return;
}
final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs);
- if (isFilteredNamespace(namespace))
+ if ( isFilteredNamespace(namespace) )
{
return;
}
final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs);
- if (OfficeNamespaces.DRAWING_NS.equals(namespace) && OfficeToken.FRAME.equals(elementType))
+ if ( OfficeNamespaces.DRAWING_NS.equals(namespace) && OfficeToken.FRAME.equals(elementType) )
{
return;
}
// if this is the report namespace, write out a table definition ..
- if (OfficeNamespaces.TABLE_NS.equals(namespace) && (OfficeToken.TABLE.equals(elementType) ||
- OfficeToken.COVERED_TABLE_CELL.equals(elementType) ||
- OfficeToken.TABLE_COLUMN.equals(elementType) ||
- OfficeToken.TABLE_COLUMNS.equals(elementType)))
+ if ( OfficeNamespaces.TABLE_NS.equals(namespace) && (OfficeToken.TABLE.equals(elementType) ||
+ OfficeToken.COVERED_TABLE_CELL.equals(elementType) ||
+ OfficeToken.TABLE_COLUMN.equals(elementType) ||
+ OfficeToken.TABLE_COLUMNS.equals(elementType)) )
{
return;
}
- if ( !paragraphHandled && OfficeNamespaces.TEXT_NS.equals(namespace) && OfficeToken.P.equals(elementType))
+ if ( !paragraphHandled && OfficeNamespaces.TEXT_NS.equals(namespace) && OfficeToken.P.equals(elementType) )
{
- if (!paragraphHandled)
+ if ( !paragraphHandled )
{
return;
}
@@ -672,7 +706,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
// 'covered-table-cell' elements we need to generate
generateCoveredTableCells(attrs);
}
- catch (IOException e)
+ catch ( IOException e )
{
throw new ReportProcessingException("Failed", e);
}
@@ -680,16 +714,18 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
private void generateCoveredTableCells(final AttributeMap attrs) throws IOException
{
- if (!ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_CELL, attrs))
+ if ( !ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_CELL, attrs) )
{
return;
}
// do this after we close the tag
final XmlWriter xmlWriter = getXmlWriter();
- final Object attribute = attrs.getAttribute(OfficeNamespaces.TABLE_NS, "number-columns-spanned");
- final int span = TextUtilities.parseInt((String) attribute, 0);
- for (int i = 1; i < span; i++)
+ // final Object attribute = attrs.getAttribute(OfficeNamespaces.TABLE_NS,NUMBERCOLUMNSSPANNED);
+ // final int span = TextUtilities.parseInt((String) attribute, 0);
+ final int span = currentSpan;
+ currentSpan = 0;
+ for ( int i = 1; i < span; i++ )
{
xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.COVERED_TABLE_CELL, null, XmlWriter.CLOSE);
}
@@ -703,7 +739,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
// /////////////////////////////////////////////////////////////////////////
public void processText(final String text) throws DataSourceException, ReportProcessingException
{
- if (!(isRepeatingSection() || isElementBoundaryCollectionPass()))
+ if ( !(isRepeatingSection() || isElementBoundaryCollectionPass()) )
{
handleParagraph();
super.processText(text);
@@ -712,7 +748,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
public void processContent(final DataFlags value) throws DataSourceException, ReportProcessingException
{
- if (!(isRepeatingSection() || isElementBoundaryCollectionPass()))
+ if ( !(isRepeatingSection() || isElementBoundaryCollectionPass()) )
{
handleParagraph();
super.processContent(value);
@@ -725,13 +761,15 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
}
protected void startContent(final AttributeMap attrs) throws IOException, DataSourceException,
- ReportProcessingException
+ ReportProcessingException
{
- if (!isElementBoundaryCollectionPass())
+ if ( !isElementBoundaryCollectionPass() )
{
final XmlWriter xmlWriter = getXmlWriter();
xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, getStartContent(), null, XmlWriterSupport.OPEN);
+ writeNullDate();
+
final AttributeMap tableAttributes = new AttributeMap();
tableAttributes.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.NAMESPACE_ATTRIBUTE, OfficeNamespaces.TABLE_NS);
tableAttributes.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.TYPE_ATTRIBUTE, OfficeToken.TABLE);
@@ -750,7 +788,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
{
final OfficeStylesCollection predefStyles = getPredefinedStylesCollection();
final OfficeStyles commonStyles = predefStyles.getAutomaticStyles();
- if (!commonStyles.containsStyle(OfficeToken.TABLE, "Initial_Table"))
+ if ( !commonStyles.containsStyle(OfficeToken.TABLE, "Initial_Table") )
{
final String masterPageName = createMasterPage();
@@ -759,7 +797,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
tableStyle.setStyleName("Initial_Table");
tableStyle.setAttribute(OfficeNamespaces.STYLE_NS, "master-page-name", masterPageName);
final Element tableProperties = produceFirstChild(tableStyle, OfficeNamespaces.STYLE_NS, "table-properties");
- tableProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, "transparent");
+ tableProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR,TRANSPARENT);
commonStyles.addStyle(tableStyle);
}
return "Initial_Table";
@@ -770,13 +808,13 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
final OfficeStylesCollection predefStyles = getPredefinedStylesCollection();
final MasterPageFactory masterPageFactory = new MasterPageFactory(predefStyles.getMasterStyles());
final OfficeMasterPage masterPage;
- if (!masterPageFactory.containsMasterPage("Standard", null, null))
+ if ( !masterPageFactory.containsMasterPage("Standard", null, null) )
{
masterPage = masterPageFactory.createMasterPage("Standard", null, null);
final CSSNumericValue zeroLength = CSSNumericValue.createValue(CSSNumericType.CM, 0);
final String pageLayoutTemplate = masterPage.getPageLayout();
- if (pageLayoutTemplate == null)
+ if ( pageLayoutTemplate == null )
{
// there is no pagelayout. Create one ..
final String derivedLayout = masterPageFactory.createPageStyle(getGlobalStylesCollection().getAutomaticStyles(), zeroLength, zeroLength);
@@ -785,8 +823,8 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
else
{
final String derivedLayout = masterPageFactory.derivePageStyle(pageLayoutTemplate,
- getPredefinedStylesCollection().getAutomaticStyles(),
- getGlobalStylesCollection().getAutomaticStyles(), zeroLength, zeroLength);
+ getPredefinedStylesCollection().getAutomaticStyles(),
+ getGlobalStylesCollection().getAutomaticStyles(), zeroLength, zeroLength);
masterPage.setPageLayout(derivedLayout);
}
@@ -802,10 +840,10 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
}
protected void endContent(final AttributeMap attrs) throws IOException, DataSourceException,
- ReportProcessingException
+ ReportProcessingException
{
// todo
- if (!isElementBoundaryCollectionPass())
+ if ( !isElementBoundaryCollectionPass() )
{
final XmlWriter xmlWriter = getXmlWriter();
xmlWriter.writeCloseTag();
@@ -833,7 +871,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
private ColumnBoundary[] getSortedColumnBoundaryArray()
{
- if (sortedBoundaryArray == null)
+ if ( sortedBoundaryArray == null )
{
getColumnBoundaryList().add(new ColumnBoundary(0));
sortedBoundaryArray = (ColumnBoundary[]) getColumnBoundaryList().toArray(EMPTY_COLBOUNDS);
@@ -847,12 +885,12 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
return columnBoundaryList;
}
- private void addColumnWidthToRowBoundaryMarker(final float width)
+ private void addColumnWidthToRowBoundaryMarker(final long width)
{
currentRowBoundaryMarker += width;
}
- private float getCurrentRowBoundaryMarker()
+ private long getCurrentRowBoundaryMarker()
{
return currentRowBoundaryMarker;
}
@@ -869,14 +907,14 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
private ColumnBoundary[] getBoundariesForTable(final int table)
{
- if (boundariesForTableArray == null)
+ if ( boundariesForTableArray == null )
{
final List boundariesForTable = new ArrayList();
final List boundaryList = getColumnBoundaryList();
- for (int i = 0; i < boundaryList.size(); i++)
+ for ( int i = 0; i < boundaryList.size(); i++ )
{
final ColumnBoundary b = (ColumnBoundary) boundaryList.get(i);
- if (b.isContainedByTable(table))
+ if ( b.isContainedByTable(table) )
{
boundariesForTable.add(b);
}
@@ -897,12 +935,12 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
float cellBoundary = tableBoundaries[col - 1].getBoundary();
float cellWidth = tableBoundaries[col - 1].getBoundary();
- if (col > 1)
+ if ( col > 1 )
{
cellWidth = cellWidth - tableBoundaries[col - 2].getBoundary();
}
- if (initialColumnSpan > 1)
+ if ( initialColumnSpan > 1 )
{
// ok we've got some additional spanning specified on the input
final int index = (col - 1) + (initialColumnSpan - 1);
@@ -912,21 +950,21 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
int beginBoundaryIndex = 0;
int endBoundaryIndex = globalBoundaries.length - 1;
- for (int i = 0; i < globalBoundaries.length; i++)
+ for ( int i = 0; i < globalBoundaries.length; i++ )
{
// find beginning boundary
- if (globalBoundaries[i].getBoundary() <= cellBoundary - cellWidth)
+ if ( globalBoundaries[i].getBoundary() <= cellBoundary - cellWidth )
{
beginBoundaryIndex = i;
}
- if (globalBoundaries[i].getBoundary() <= cellBoundary)
+ if ( globalBoundaries[i].getBoundary() <= cellBoundary )
{
endBoundaryIndex = i;
}
}
final int span = endBoundaryIndex - beginBoundaryIndex;
// span will be zero for the first column, so we adjust it to 1
- if (span == 0)
+ if ( span == 0 )
{
return 1;
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/MasterPageFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/MasterPageFactory.java
index e64f71d..8b56063 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/output/text/MasterPageFactory.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/MasterPageFactory.java
@@ -265,7 +265,7 @@ public class MasterPageFactory
}
catch (CloneNotSupportedException cne)
{
- throw new IllegalStateException("Implementation error: Unable to derive page");
+ throw new IllegalStateException("Implementation error: Unable to derive page",cne);
}
}
@@ -403,7 +403,7 @@ public class MasterPageFactory
}
catch (CloneNotSupportedException e)
{
- throw new IllegalStateException("Clone failed.");
+ throw new IllegalStateException("Clone failed.",e);
}
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageContext.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageContext.java
index 8d4a0dc..01d8a9f 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageContext.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageContext.java
@@ -208,17 +208,8 @@ public class PageContext
}
final StringBuffer b = new StringBuffer();
-
- PageContext pc = this;
- while (pc != null)
- {
- final String header_ = pc.getHeader();
- if (header_ != null)
- {
- b.append(header_);
- }
- pc = pc.getParent();
- }
+ b.append(parent.getPageHeaderContent());
+ b.append(getHeader());
if (b.length() != 0)
{
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java
index 9e39a7d..ec20fc0 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java
@@ -96,7 +96,6 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget
private static final String VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT = "variables_paragraph_with_next";
private static final String VARIABLES_HIDDEN_STYLE_WITHOUT_KEEPWNEXT = "variables_paragraph_without_next";
private static final int TABLE_LAYOUT_VARIABLES_PARAGRAPH = 0;
- private static final int TABLE_LAYOUT_VARIABLES_IN_FIRST_CELL = 1;
private static final int TABLE_LAYOUT_SINGLE_DETAIL_TABLE = 2;
private static final int CP_SETUP = 0;
private static final int CP_FIRST_TABLE = 1;
@@ -132,7 +131,6 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget
private final int tableLayoutConfig;
private int expectedTableRowCount;
private boolean firstCellSeen;
- private boolean cellEmpty;
public TextRawReportTarget(final ReportJob reportJob,
final ResourceManager resourceManager,
@@ -543,6 +541,8 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget
final XmlWriter xmlWriter = getXmlWriter();
xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "text", null, XmlWriterSupport.OPEN);
+ writeNullDate();
+
// now start the buffering. We have to insert the variables declaration
// later ..
startBuffering(getStylesCollection(), true);
@@ -646,11 +646,6 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget
variables = null;
}
- if (isTableNS && ObjectUtilities.equal(OfficeToken.TABLE_CELL, elementType))
- {
- cellEmpty = true;
- }
-
final boolean keepTogetherOnParagraph = true;
if (keepTogetherOnParagraph)
@@ -658,7 +653,6 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget
if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TEXT_NS, OfficeToken.P, attrs))
{
final int keepTogetherState = getCurrentContext().getKeepTogether();
- cellEmpty = false;
if (!firstCellSeen && (sectionKeepTogether || keepTogetherState == PageContext.KEEP_TOGETHER_GROUP))
{
OfficeStyle style = null;
@@ -740,15 +734,12 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget
final AttributeList attrList = buildAttributeList(attrs);
xmlWriter.writeTag(namespace, elementType, attrList, XmlWriterSupport.OPEN);
- if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TEXT_NS, OfficeToken.P, attrs))
+ if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TEXT_NS, OfficeToken.P, attrs) &&
+ tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH && variables != null)
{
- cellEmpty = false;
- if (tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH && variables != null)
- {
- //LOGGER.debug("Variables-Section in existing cell " + variables);
- xmlWriter.writeText(variables);
- variables = null;
- }
+ //LOGGER.debug("Variables-Section in existing cell " + variables);
+ xmlWriter.writeText(variables);
+ variables = null;
}
}
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/StyleMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/StyleMapper.java
index 32ab1a2..c3e96ab 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/parser/StyleMapper.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/StyleMapper.java
@@ -35,7 +35,7 @@ import org.jfree.layouting.input.style.CSSDeclarationRule;
public interface StyleMapper
{
- public void updateStyle (final String uri,
+ void updateStyle (final String uri,
final String attrName,
final String attrValue,
final CSSDeclarationRule targetRule);
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/data/DataStyleReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/data/DataStyleReadHandler.java
index 3761768..014d36b 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/parser/data/DataStyleReadHandler.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/data/DataStyleReadHandler.java
@@ -70,7 +70,7 @@ public class DataStyleReadHandler extends ElementReadHandler
{
if (OfficeNamespaces.DATASTYLE_NS.equals(uri) || OfficeNamespaces.STYLE_NS.equals(uri))
{
- final DataStyleReadHandler xrh = new DataStyleReadHandler("text".equals(tagName) || "currency-symbol".equals(tagName));
+ final DataStyleReadHandler xrh = new DataStyleReadHandler("text".equals(tagName) || "currency-symbol".equals(tagName) || "embedded-text".equals(tagName));
children.add(xrh);
return xrh;
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ConditionalPrintExpressionReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ConditionalPrintExpressionReadHandler.java
index 75f793a..32bbd09 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ConditionalPrintExpressionReadHandler.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ConditionalPrintExpressionReadHandler.java
@@ -51,10 +51,6 @@ public class ConditionalPrintExpressionReadHandler
public ConditionalPrintExpressionReadHandler(final Element element)
{
- if (element == null)
- {
- throw new NullPointerException();
- }
this.element = element;
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupReadHandler.java
index 0bf9a38..5fb42e8 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupReadHandler.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupReadHandler.java
@@ -79,7 +79,7 @@ public class GroupReadHandler extends ElementReadHandler
super.startParsing(attrs);
final String groupExpr = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "group-expression");
- if (groupExpr != null)
+ if ( groupExpr != null && !"".equals(groupExpr) )
{
final FormulaExpression function = new FormulaExpression();
function.setFormula(groupExpr);
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/BackgroundColorMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/BackgroundColorMapper.java
index 251dcbe..bddf969 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/BackgroundColorMapper.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/BackgroundColorMapper.java
@@ -38,10 +38,6 @@ import org.jfree.layouting.util.ColorUtil;
public class BackgroundColorMapper implements StyleMapper
{
- public BackgroundColorMapper()
- {
- }
-
public void updateStyle(final String uri,
final String attrName,
final String attrValue,
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/BorderRightMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/BorderRightMapper.java
index 8b78696..b365b41 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/BorderRightMapper.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/BorderRightMapper.java
@@ -47,11 +47,6 @@ import org.jfree.layouting.input.style.CSSDeclarationRule;
public class BorderRightMapper implements StyleMapper
{
- /** Creates a new instance of BorderRightMapper */
- public BorderRightMapper()
- {
- }
-
public void updateStyle(final String uri,
final String attrName,
final String attrValue,
diff --git a/reportbuilder/java/com/sun/star/report/util/ReportUtil.java b/reportbuilder/java/com/sun/star/report/util/ReportUtil.java
index 7c3ff0c..c4c6c17 100644
--- a/reportbuilder/java/com/sun/star/report/util/ReportUtil.java
+++ b/reportbuilder/java/com/sun/star/report/util/ReportUtil.java
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.report.util;
import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
@@ -36,9 +35,14 @@ import org.pentaho.reporting.libraries.base.util.ObjectUtilities;
*
* @author Ocke Janssen
*/
-public class ReportUtil {
+public class ReportUtil
+{
+
+ private ReportUtil()
+ {
+ }
- public static boolean equalString(final String uri,final String uri2)
+ public static boolean equalString(final String uri, final String uri2)
{
return ObjectUtilities.equal(uri, uri2);
}
diff --git a/reportbuilder/registry/data/org/openoffice/Office/UI/DbReportWindowState.xcu b/reportbuilder/registry/data/org/openoffice/Office/UI/DbReportWindowState.xcu
index 2a31839..7dba5df 100644
--- a/reportbuilder/registry/data/org/openoffice/Office/UI/DbReportWindowState.xcu
+++ b/reportbuilder/registry/data/org/openoffice/Office/UI/DbReportWindowState.xcu
@@ -66,10 +66,7 @@
</prop>
<prop oor:name="Visible" oor:type="xs:boolean">
<value>true</value>
- </prop>
- <prop oor:name="ContextSensitive" oor:type="xs:boolean">
- <value>true</value>
- </prop>
+ </prop>
</node>
<node oor:name="private:resource/toolbar/reportcontrols" oor:op="replace">
<prop oor:name="UIName" oor:type="xs:string">
diff --git a/sdext/prj/build.lst b/sdext/prj/build.lst
index 394925c..9d99c11 100644
--- a/sdext/prj/build.lst
+++ b/sdext/prj/build.lst
@@ -1,11 +1,12 @@
-dx sdext : offuh comphelper unotools readlicense_oo cppu tools cppuhelper sal javaunohelper officecfg vcl XPDF:xpdf LIBXSLT:libxslt NULL
+dx sdext : l10n offuh comphelper unotools readlicense_oo cppu tools cppuhelper sal javaunohelper officecfg vcl XPDF:xpdf LIBXSLT:libxslt NULL
dx sdext usr1 - all sdext_mkout NULL
dx sdext\prj get - all sdext_prj NULL
dx sdext\source\minimizer nmake - all sdext_minimizer sdext_minimizer_rdoooe sdext_minimizer_rdooo sdext_minimizer_rdooou sdext_inc NULL
dx sdext\source\minimizer\registry\data\org\openoffice\Office\extension nmake - all sdext_minimizer_rdoooe NULL
dx sdext\source\minimizer\registry\data\org\openoffice\Office\UI nmake - all sdext_minimizer_rdooou NULL
dx sdext\source\minimizer\registry\data\org\openoffice\Office nmake - all sdext_minimizer_rdooo NULL
-dx sdext\source\presenter nmake - all sdext_presenter sdext_inc NULL
+dx sdext\source\presenter\registry\data\org\openoffice\Office\extension nmake - all sdext_presenter_xcu NULL
+dx sdext\source\presenter nmake - all sdext_presenter sdext_inc sdext_presenter_xcu NULL
dx sdext\inc nmake - all sdext_inc NULL
dx sdext\source\pdfimport\xpdfwrapper nmake - all dx_xpdfwrap NULL
dx sdext\source\pdfimport\xpdftest nmake - all dx_parsetest dx_xpdfwrap NULL
diff --git a/sdext/source/pdfimport/config/description.xml b/sdext/source/pdfimport/config/description.xml
index eebb9c1..d04364e 100644
--- a/sdext/source/pdfimport/config/description.xml
+++ b/sdext/source/pdfimport/config/description.xml
@@ -16,7 +16,7 @@
</simple-license>
</registration>
- <version value="0.3.2" />
+ <version value="1.0" />
<platform value="UPDATED_SUPPORTED_PLATFORM" />
@@ -27,5 +27,10 @@
<display-name>
<name lang="en-US">PDF Import Extension</name>
</display-name>
+
+ <icon>
+ <default xlink:href="images/pdfiext.png" />
+ <high-contrast xlink:href="images/pdfiext_hc.png" />
+ </icon>
</description>
diff --git a/sdext/source/pdfimport/images/pdfiext.png b/sdext/source/pdfimport/images/pdfiext.png
new file mode 100644
index 0000000..31f48ea
--- /dev/null
+++ b/sdext/source/pdfimport/images/pdfiext.png
Binary files differ
diff --git a/sdext/source/pdfimport/images/pdfiext_hc.png b/sdext/source/pdfimport/images/pdfiext_hc.png
new file mode 100644
index 0000000..3870cc4
--- /dev/null
+++ b/sdext/source/pdfimport/images/pdfiext_hc.png
Binary files differ
diff --git a/sdext/source/pdfimport/inc/wrapper.hxx b/sdext/source/pdfimport/inc/wrapper.hxx
index 2434f74..abd280d 100755
--- a/sdext/source/pdfimport/inc/wrapper.hxx
+++ b/sdext/source/pdfimport/inc/wrapper.hxx
@@ -47,13 +47,19 @@ namespace com { namespace sun { namespace star {
namespace pdfi
{
- bool xpdf_ImportFromFile( const ::rtl::OUString& rURL,
+ bool xpdf_ImportFromFile( const rtl::OUString& rURL,
const ContentSinkSharedPtr& rSink,
+ const com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler >& xIHdl,
+ const rtl::OUString& rPwd,
const com::sun::star::uno::Reference<
com::sun::star::uno::XComponentContext >& xContext );
bool xpdf_ImportFromStream( const com::sun::star::uno::Reference<
com::sun::star::io::XInputStream >& xInput,
const ContentSinkSharedPtr& rSink,
+ const com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler >& xIHdl,
+ const rtl::OUString& rPwd,
const com::sun::star::uno::Reference<
com::sun::star::uno::XComponentContext >& xContext );
}
diff --git a/sdext/source/pdfimport/makefile.mk b/sdext/source/pdfimport/makefile.mk
index df11c43..d6cd478 100644
--- a/sdext/source/pdfimport/makefile.mk
+++ b/sdext/source/pdfimport/makefile.mk
@@ -125,7 +125,11 @@ COMPONENT_HELP= \
COMPONENT_LIBRARIES= \
$(EXTENSIONDIR)$/$(SHL1TARGET)$(DLLPOST)
-EXTENSION_PACKDEPS=$(CONVERTER_FILE) $(COMPONENT_DIALOGS) $(COMPONENT_HELP) makefile.mk
+COMPONENT_IMAGES=\
+ $(EXTENSIONDIR)$/images$/pdfiext.png \
+ $(EXTENSIONDIR)$/images$/pdfiext_hc.png
+
+EXTENSION_PACKDEPS=$(CONVERTER_FILE) $(COMPONENT_DIALOGS) $(COMPONENT_HELP) $(COMPONENT_IMAGES) makefile.mk
.INCLUDE : extension_pre.mk
.INCLUDE : target.mk
@@ -142,3 +146,7 @@ $(COMPONENT_DIALOGS) : dialogs$/$$(@:f)
$(COMPONENT_HELP) : help$/$$(@:f)
@@-$(MKDIRHIER) $(@:d)
$(COPY) $< $@
+
+$(COMPONENT_IMAGES) : images$/$$(@:f)
+ @@-$(MKDIRHIER) $(@:d)
+ $(COPY) $< $@
diff --git a/sdext/source/pdfimport/pdfiadaptor.cxx b/sdext/source/pdfimport/pdfiadaptor.cxx
index 7eeb207..d319c60 100644
--- a/sdext/source/pdfimport/pdfiadaptor.cxx
+++ b/sdext/source/pdfimport/pdfiadaptor.cxx
@@ -238,6 +238,8 @@ void PDFIRawAdaptor::setTreeVisitorFactory(const TreeVisitorFactorySharedPtr& rV
}
bool PDFIRawAdaptor::parse( const uno::Reference<io::XInputStream>& xInput,
+ const uno::Reference<task::XInteractionHandler>& xIHdl,
+ const rtl::OUString& rPwd,
const uno::Reference<task::XStatusIndicator>& xStatus,
const XmlEmitterSharedPtr& rEmitter,
const rtl::OUString& rURL )
@@ -253,9 +255,9 @@ bool PDFIRawAdaptor::parse( const uno::Reference<io::XInputStream>& xInput
bool bSuccess=false;
if( xInput.is() && (!rURL.getLength() || rURL.compareToAscii( "file:", 5 ) != 0) )
- bSuccess = xpdf_ImportFromStream( xInput, pSink, m_xContext );
+ bSuccess = xpdf_ImportFromStream( xInput, pSink, xIHdl, rPwd, m_xContext );
else
- bSuccess = xpdf_ImportFromFile( rURL, pSink, m_xContext );
+ bSuccess = xpdf_ImportFromFile( rURL, pSink, xIHdl, rPwd, m_xContext );
if( bSuccess )
pSink->emit(*rEmitter,*m_pVisitorFactory);
@@ -268,7 +270,10 @@ bool PDFIRawAdaptor::odfConvert( const rtl::OUString& r
const uno::Reference<task::XStatusIndicator>& xStatus )
{
XmlEmitterSharedPtr pEmitter = createOdfEmitter(xOutput);
- const bool bSuccess = parse(uno::Reference<io::XInputStream>(),xStatus,pEmitter,rURL);
+ const bool bSuccess = parse(uno::Reference<io::XInputStream>(),
+ uno::Reference<task::XInteractionHandler>(),
+ rtl::OUString(),
+ xStatus,pEmitter,rURL);
// tell input stream that it is no longer needed
xOutput->closeOutput();
@@ -284,7 +289,9 @@ sal_Bool SAL_CALL PDFIRawAdaptor::importer( const uno::Sequence< beans::Property
// get the InputStream carrying the PDF content
uno::Reference< io::XInputStream > xInput;
uno::Reference< task::XStatusIndicator > xStatus;
+ uno::Reference< task::XInteractionHandler > xInteractionHandler;
rtl::OUString aURL;
+ rtl::OUString aPwd;
const beans::PropertyValue* pAttribs = rSourceData.getConstArray();
sal_Int32 nAttribs = rSourceData.getLength();
for( sal_Int32 i = 0; i < nAttribs; i++, pAttribs++ )
@@ -296,12 +303,16 @@ sal_Bool SAL_CALL PDFIRawAdaptor::importer( const uno::Sequence< beans::Property
pAttribs->Value >>= aURL;
else if( pAttribs->Name.equalsAscii( "StatusIndicator" ) )
pAttribs->Value >>= xStatus;
+ else if( pAttribs->Name.equalsAscii( "InteractionHandler" ) )
+ pAttribs->Value >>= xInteractionHandler;
+ else if( pAttribs->Name.equalsAscii( "Password" ) )
+ pAttribs->Value >>= aPwd;
}
if( !xInput.is() )
return sal_False;
XmlEmitterSharedPtr pEmitter = createSaxEmitter(rHdl);
- const bool bSuccess = parse(xInput,xStatus,pEmitter,aURL);
+ const bool bSuccess = parse(xInput,xInteractionHandler, aPwd, xStatus,pEmitter,aURL);
// tell input stream that it is no longer needed
xInput->closeInput();
diff --git a/sdext/source/pdfimport/pdfiadaptor.hxx b/sdext/source/pdfimport/pdfiadaptor.hxx
index 43298ac..d7386ec 100644
--- a/sdext/source/pdfimport/pdfiadaptor.hxx
+++ b/sdext/source/pdfimport/pdfiadaptor.hxx
@@ -96,6 +96,8 @@ namespace pdfi
bool m_bEnableToplevelText;
bool parse( const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInput,
+ const com::sun::star::uno::Reference<com::sun::star::task::XInteractionHandler>& xIHdl,
+ const rtl::OUString& rPwd,
const com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator>& xStatus,
const XmlEmitterSharedPtr& rEmitter,
const rtl::OUString& rURL );
diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
index ec08149..beb6f53 100644
--- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
@@ -703,10 +703,11 @@ static void unzipToBuffer( const char* pBegin, unsigned int nLen,
{
if( err != Z_STREAM_END )
{
- *pOutLen += buf_increment_size;
- *pOutBuf = (sal_uInt8*)rtl_reallocateMemory( *pOutBuf, *pOutLen );
+ const int nNewAlloc = *pOutLen + buf_increment_size;
+ *pOutBuf = (sal_uInt8*)rtl_reallocateMemory( *pOutBuf, nNewAlloc );
aZStr.next_out = (Bytef*)(*pOutBuf + *pOutLen);
aZStr.avail_out = buf_increment_size;
+ *pOutLen = nNewAlloc;
}
}
}
diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx
index 27dd9e7..12d384e 100755
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -442,7 +442,11 @@ namespace
xMask[0].Name.compareToAscii( "URL" ) == 0 );
CPPUNIT_ASSERT_MESSAGE( "drawAlphaMaskedImage got InputStream param #2",
xMask[1].Name.compareToAscii( "InputStream" ) == 0 );
- }
+ }
+
+ virtual void setTextRenderMode( sal_Int32 )
+ {
+ }
typedef std::hash_map<sal_Int32,FontAttributes> IdToFontMap;
typedef std::hash_map<FontAttributes,sal_Int32,FontAttrHash> FontToIdMap;
@@ -517,6 +521,8 @@ namespace
pdfi::ContentSinkSharedPtr pSink( new TestSink() );
pdfi::xpdf_ImportFromFile( msBaseDir + rtl::OUString::createFromAscii("pdfi_unittest_test.pdf"),
pSink,
+ uno::Reference< task::XInteractionHandler >(),
+ rtl::OUString(),
mxCtx );
// make destruction explicit, a bunch of things are
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index d9905e3..efe98c1 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -174,6 +174,11 @@ void DrawXmlEmitter::fillFrameProps( DrawElement& rElem,
// TODO(F2): general transformation case missing; if implemented, note
// that ODF rotation is oriented the other way
+
+ // vertical mirroring is done by horizontally mirroring and rotaing 180 degree
+ // quaint !
+ if( rElem.MirrorVertical )
+ fRotate += M_PI;
// build transformation string
if( fShearX != 0.0 )
@@ -852,7 +857,14 @@ void DrawXmlFinalizer::visit( FrameElement& elem, const std::list< Element* >::c
aGCProps[ USTR("fo:padding-top") ] = USTR("0cm");
aGCProps[ USTR("fo:padding-left") ] = USTR("0cm");
aGCProps[ USTR("fo:padding-right") ] = USTR("0cm");
- aGCProps[ USTR("fo:padding-bottom") ] = USTR("0cm");
+ aGCProps[ USTR("fo:padding-bottom") ] = USTR("0cm");
+
+ // remark: vertical mirroring is done in current OOO by
+ // mirroring horzontally and rotating 180 degrees
+ // this is quaint, but unfortunately it seems
+ // mirror=vertical is defined but not implemented in current code
+ if( elem.MirrorVertical )
+ aGCProps[ USTR("style:mirror") ] = USTR("horizontal");
StyleContainer::Style aStyle( "style:style", aProps );
StyleContainer::Style aSubStyle( "style:graphic-properties", aGCProps );
diff --git a/sdext/source/pdfimport/tree/genericelements.hxx b/sdext/source/pdfimport/tree/genericelements.hxx
index 4cecf1b..4ba66aa 100644
--- a/sdext/source/pdfimport/tree/genericelements.hxx
+++ b/sdext/source/pdfimport/tree/genericelements.hxx
@@ -133,10 +133,11 @@ namespace pdfi
{
protected:
GraphicalElement( Element* pParent, sal_Int32 nGCId )
- : Element( pParent ), GCId(nGCId ) {}
+ : Element( pParent ), GCId( nGCId ), MirrorVertical( false ) {}
public:
sal_Int32 GCId;
+ bool MirrorVertical;
};
struct DrawElement : public GraphicalElement
diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
index 6fd7aaf..4045676 100644
--- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx
+++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
@@ -369,9 +369,10 @@ void PDFIProcessor::processGlyphLine()
else
{
if (
- ( m_GlyphsList[i].getPrevGlyphsSpace()<= fPreAvarageSpaceValue )&&
- ( fPrevDiffCharSpace<=fAvarageDiffCharSpaceValue )&&
- ( fPostDiffCharSpace<=fAvarageDiffCharSpaceValue ) ||
+ ( ( m_GlyphsList[i].getPrevGlyphsSpace()<= fPreAvarageSpaceValue )&&
+ ( fPrevDiffCharSpace<=fAvarageDiffCharSpaceValue )&&
+ ( fPostDiffCharSpace<=fAvarageDiffCharSpaceValue )
+ ) ||
( m_GlyphsList[i].getPrevGlyphsSpace() == 0.0 )
)
{
@@ -446,7 +447,6 @@ void PDFIProcessor::drawGlyphLine( const rtl::OUString& rGlyphs,
const geometry::Matrix2D& rFontMatrix )
{
double isFirstLine= fYPrevTextPosition+ fXPrevTextPosition+ fPrevTextHeight+ fPrevTextWidth ;
-
if(
( ( ( fYPrevTextPosition!= rRect.Y1 ) ) ||
( ( fXPrevTextPosition > rRect.X2 ) ) ||
@@ -455,36 +455,35 @@ void PDFIProcessor::drawGlyphLine( const rtl::OUString& rGlyphs,
)
{
processGlyphLine();
-
}
-
- CharGlyph aGlyph;
-
- aGlyph.setGlyph ( rGlyphs );
- aGlyph.setRect ( rRect );
- aGlyph.setFontMatrix ( rFontMatrix );
- aGlyph.setGraphicsContext ( getCurrentContext() );
- getGCId(getCurrentContext());
- aGlyph.setCurElement( m_pCurElement );
-
- aGlyph.setYPrevGlyphPosition( fYPrevTextPosition );
- aGlyph.setXPrevGlyphPosition( fXPrevTextPosition );
- aGlyph.setPrevGlyphHeight ( fPrevTextHeight );
- aGlyph.setPrevGlyphWidth ( fPrevTextWidth );
-
- m_GlyphsList.push_back( aGlyph );
-
- fYPrevTextPosition = rRect.Y1;
- fXPrevTextPosition = rRect.X2;
- fPrevTextHeight = rRect.Y2-rRect.Y1;
- fPrevTextWidth = rRect.X2-rRect.X1;
-
- if( !m_bIsWhiteSpaceInLine )
- {
- rtl::OUString tempWhiteSpaceStr( 32 );
- m_bIsWhiteSpaceInLine=rGlyphs.equals( tempWhiteSpaceStr );
- }
-
+
+ CharGlyph aGlyph;
+
+ aGlyph.setGlyph ( rGlyphs );
+ aGlyph.setRect ( rRect );
+ aGlyph.setFontMatrix ( rFontMatrix );
+ aGlyph.setGraphicsContext ( getCurrentContext() );
+ getGCId(getCurrentContext());
+ aGlyph.setCurElement( m_pCurElement );
+
+ aGlyph.setYPrevGlyphPosition( fYPrevTextPosition );
+ aGlyph.setXPrevGlyphPosition( fXPrevTextPosition );
+ aGlyph.setPrevGlyphHeight ( fPrevTextHeight );
+ aGlyph.setPrevGlyphWidth ( fPrevTextWidth );
+
+ m_GlyphsList.push_back( aGlyph );
+
+ fYPrevTextPosition = rRect.Y1;
+ fXPrevTextPosition = rRect.X2;
+ fPrevTextHeight = rRect.Y2-rRect.Y1;
+ fPrevTextWidth = rRect.X2-rRect.X1;
+
+ if( !m_bIsWhiteSpaceInLine )
+ {
+ static rtl::OUString tempWhiteSpaceStr( 0x20 );
+ static rtl::OUString tempWhiteSpaceNonBreakingStr( 0xa0 );
+ m_bIsWhiteSpaceInLine=(rGlyphs.equals( tempWhiteSpaceStr ) || rGlyphs.equals( tempWhiteSpaceNonBreakingStr ));
+ }
}
GraphicsContext& PDFIProcessor::getTransformGlyphContext( CharGlyph& rGlyph )
@@ -571,22 +570,70 @@ void PDFIProcessor::setupImage(ImageId nImage)
{
const GraphicsContext& rGC( getCurrentContext() );
- // transform unit rect, to determine view box
- basegfx::B2DPoint aOrigin(0,0);
- aOrigin *= rGC.Transformation;
+ basegfx::B2DHomMatrix aTrans( rGC.Transformation );
+
+ // check for rotation, which is the other way around in ODF
+ basegfx::B2DTuple aScale, aTranslation;
+ double fRotate, fShearX;
+ rGC.Transformation.decompose( aScale, aTranslation, fRotate, fShearX );
+ // TODDO(F4): correcting rotation when fShearX != 0 ?
+ if( fRotate != 0.0 )
+ {
+
+ // try to create a Transformation that corrects for the wrong rotation
+ aTrans.identity();
+ aTrans.scale( aScale.getX(), aScale.getY() );
+ aTrans.rotate( -fRotate );
+
+ basegfx::B2DRange aRect( 0, 0, 1, 1 );
+ aRect.transform( aTrans );
+
+ // TODO(F3) treat translation correctly
+ // the corrections below work for multiples of 90 degree
+ // which is a common case (landscape/portrait/seascape)
+ // we need a general solution here; however this needs to
+ // work in sync with DrawXmlEmitter::fillFrameProps and WriterXmlEmitter::fillFrameProps
+ // admittedly this is a lame workaround and fails for arbitrary rotation
+ double fQuadrant = fmod( fRotate, 2.0*M_PI ) / M_PI_2;
+ int nQuadrant = (int)fQuadrant;
+ if( nQuadrant < 0 )
+ nQuadrant += 4;
+ if( nQuadrant == 1 )
+ {
+ aTranslation.setX( aTranslation.getX() + aRect.getHeight() + aRect.getWidth());
+ aTranslation.setY( aTranslation.getY() + aRect.getHeight() );
+ }
+ if( nQuadrant == 3 )
+ aTranslation.setX( aTranslation.getX() - aRect.getHeight() );
+
+ aTrans.translate( aTranslation.getX(),
+ aTranslation.getY() );
+ }
+
+ bool bMirrorVertical = aScale.getY() > 0;
- basegfx::B2DVector aSize(1,1);
- aSize *= rGC.Transformation;
+ // transform unit rect to determine view box
+ basegfx::B2DRange aRect( 0, 0, 1, 1 );
+ aRect.transform( aTrans );
// TODO(F3): Handle clip
const sal_Int32 nGCId = getGCId(rGC);
FrameElement* pFrame = m_pElFactory->createFrameElement( m_pCurElement, nGCId );
ImageElement* pImageElement = m_pElFactory->createImageElement( pFrame, nGCId, nImage );
- pFrame->x = pImageElement->x = aOrigin.getX();
- pFrame->y = pImageElement->y = aOrigin.getY();
- pFrame->w = pImageElement->w = aSize.getX();
- pFrame->h = pImageElement->h = aSize.getY();
+ pFrame->x = pImageElement->x = aRect.getMinX();
+ pFrame->y = pImageElement->y = aRect.getMinY();
+ pFrame->w = pImageElement->w = aRect.getWidth();
+ pFrame->h = pImageElement->h = aRect.getHeight();
pFrame->ZOrder = m_nNextZOrder++;
+
+ if( bMirrorVertical )
+ {
+ pFrame->MirrorVertical = pImageElement->MirrorVertical = true;
+ pFrame->x += aRect.getWidth();
+ pImageElement->x += aRect.getWidth();
+ pFrame->y += aRect.getHeight();
+ pImageElement->y += aRect.getHeight();
+ }
}
void PDFIProcessor::drawMask(const uno::Sequence<beans::PropertyValue>& xBitmap,
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 5e5596b..c4f9062 100755
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -33,36 +33,39 @@
#include "precompiled_sdext.hxx"
#include "contentsink.hxx"
-
-#include <osl/file.h>
-#include <osl/thread.h>
-#include <osl/process.h>
-#include <osl/diagnose.h>
-#include <rtl/ustring.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <rtl/strbuf.hxx>
-#include <rtl/byteseq.hxx>
-
-#include <cppuhelper/exc_hlp.hxx>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/awt/FontDescriptor.hpp>
-#include <com/sun/star/deployment/XPackageInformationProvider.hpp>
-#include <com/sun/star/beans/XMaterialHolder.hpp>
-#include <com/sun/star/rendering/PathCapType.hpp>
-#include <com/sun/star/rendering/PathJoinType.hpp>
-#include <com/sun/star/rendering/XColorSpace.hpp>
-#include <com/sun/star/rendering/XPolyPolygon2D.hpp>
-#include <com/sun/star/rendering/XBitmap.hpp>
-#include <com/sun/star/geometry/Matrix2D.hpp>
-#include <com/sun/star/geometry/AffineMatrix2D.hpp>
-#include <com/sun/star/geometry/RealRectangle2D.hpp>
-
-#include <basegfx/point/b2dpoint.hxx>
-#include <basegfx/polygon/b2dpolypolygon.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/tools/canvastools.hxx>
-#include <basegfx/tools/unopolypolygon.hxx>
+#include "pdfparse.hxx"
+#include "pdfihelper.hxx"
+
+#include "osl/file.h"
+#include "osl/thread.h"
+#include "osl/process.h"
+#include "osl/diagnose.h"
+#include "rtl/ustring.hxx"
+#include "rtl/ustrbuf.hxx"
+#include "rtl/strbuf.hxx"
+#include "rtl/byteseq.hxx"
+
+#include "cppuhelper/exc_hlp.hxx"
+#include "com/sun/star/io/XInputStream.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/awt/FontDescriptor.hpp"
+#include "com/sun/star/deployment/XPackageInformationProvider.hpp"
+#include "com/sun/star/beans/XMaterialHolder.hpp"
+#include "com/sun/star/rendering/PathCapType.hpp"
+#include "com/sun/star/rendering/PathJoinType.hpp"
+#include "com/sun/star/rendering/XColorSpace.hpp"
+#include "com/sun/star/rendering/XPolyPolygon2D.hpp"
+#include "com/sun/star/rendering/XBitmap.hpp"
+#include "com/sun/star/geometry/Matrix2D.hpp"
+#include "com/sun/star/geometry/AffineMatrix2D.hpp"
+#include "com/sun/star/geometry/RealRectangle2D.hpp"
+#include "com/sun/star/task/XInteractionHandler.hpp"
+
+#include "basegfx/point/b2dpoint.hxx"
+#include "basegfx/polygon/b2dpolypolygon.hxx"
+#include "basegfx/polygon/b2dpolygon.hxx"
+#include "basegfx/tools/canvastools.hxx"
+#include "basegfx/tools/unopolypolygon.hxx"
#include <boost/bind.hpp>
#include <boost/preprocessor/stringize.hpp>
@@ -561,18 +564,23 @@ uno::Sequence<beans::PropertyValue> Parser::readImageImpl()
static const rtl::OString aJpegMarker( "JPEG" );
static const rtl::OString aPbmMarker( "PBM" );
static const rtl::OString aPpmMarker( "PPM" );
- static const rtl::OUString aJpegFile(
+ static const rtl::OString aPngMarker( "PNG" );
+ static const rtl::OUString aJpegFile(
RTL_CONSTASCII_USTRINGPARAM( "DUMMY.JPEG" ));
static const rtl::OUString aPbmFile(
RTL_CONSTASCII_USTRINGPARAM( "DUMMY.PBM" ));
static const rtl::OUString aPpmFile(
RTL_CONSTASCII_USTRINGPARAM( "DUMMY.PPM" ));
+ static const rtl::OUString aPngFile(
+ RTL_CONSTASCII_USTRINGPARAM( "DUMMY.PNG" ));
rtl::OString aToken = readNextToken();
const sal_Int32 nImageSize( readInt32() );
rtl::OUString aFileName;
- if( aToken.compareTo( aJpegMarker ) == 0 )
+ if( aToken.compareTo( aPngMarker ) == 0 )
+ aFileName = aPngFile;
+ else if( aToken.compareTo( aJpegMarker ) == 0 )
aFileName = aJpegFile;
else if( aToken.compareTo( aPbmMarker ) == 0 )
aFileName = aPbmFile;
@@ -813,15 +821,77 @@ oslFileError readLine( oslFileHandle pFile, ::rtl::OStringBuffer& line )
} // namespace
-bool xpdf_ImportFromFile( const ::rtl::OUString& rURL,
- const ContentSinkSharedPtr& rSink,
- const uno::Reference< uno::XComponentContext >& xContext )
+static bool checkEncryption( const rtl::OUString& i_rPath,
+ const uno::Reference< task::XInteractionHandler >& i_xIHdl,
+ rtl::OUString& io_rPwd,
+ bool& o_rIsEncrypted
+ )
+{
+ bool bSuccess = false;
+ rtl::OString aPDFFile;
+ aPDFFile = rtl::OUStringToOString( i_rPath, osl_getThreadTextEncoding() );
+
+ pdfparse::PDFReader aParser;
+ boost::scoped_ptr<pdfparse::PDFEntry> pEntry( aParser.read( aPDFFile.getStr() ));
+ if( pEntry )
+ {
+ pdfparse::PDFFile* pPDFFile = dynamic_cast<pdfparse::PDFFile*>(pEntry.get());
+ if( pPDFFile )
+ {
+ o_rIsEncrypted = pPDFFile->isEncrypted();
+ if( o_rIsEncrypted )
+ {
+ bool bAuthenticated = false;
+ if( io_rPwd.getLength() )
+ {
+ rtl::OString aIsoPwd = rtl::OUStringToOString( io_rPwd,
+ RTL_TEXTENCODING_ISO_8859_1 );
+ bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd.getStr() );
+ }
+ if( bAuthenticated )
+ bSuccess = true;
+ else
+ {
+ if( i_xIHdl.is() )
+ {
+ bool bEntered = false;
+ do
+ {
+ bEntered = getPassword( i_xIHdl, io_rPwd, ! bEntered );
+ rtl::OString aIsoPwd = rtl::OUStringToOString( io_rPwd,
+ RTL_TEXTENCODING_ISO_8859_1 );
+ bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd.getStr() );
+ } while( bEntered && ! bAuthenticated );
+ }
+
+ OSL_TRACE( "password: %s\n", bAuthenticated ? "matches" : "does not match" );
+ bSuccess = bAuthenticated;
+ }
+ }
+ else
+ bSuccess = true;
+ }
+ }
+ return bSuccess;
+}
+
+bool xpdf_ImportFromFile( const ::rtl::OUString& rURL,
+ const ContentSinkSharedPtr& rSink,
+ const uno::Reference< task::XInteractionHandler >& xIHdl,
+ const rtl::OUString& rPwd,
+ const uno::Reference< uno::XComponentContext >& xContext )
{
OSL_ASSERT(rSink);
::rtl::OUString aSysUPath;
if( osl_getSystemPathFromFileURL( rURL.pData, &aSysUPath.pData ) != osl_File_E_None )
return false;
+
+ // check for encryption, if necessary get password
+ rtl::OUString aPwd( rPwd );
+ bool bIsEncrypted = false;
+ if( checkEncryption( aSysUPath, xIHdl, aPwd, bIsEncrypted ) == false )
+ return false;
rtl::OUStringBuffer converterURL = rtl::OUString::createFromAscii("xpdfimport");
@@ -853,15 +923,17 @@ bool xpdf_ImportFromFile( const ::rtl::OUString& rURL
rtl_bootstrap_expandMacros( &aStr.pData );
rtl::OUString aSysPath;
osl_getSystemPathFromFileURL( aStr.pData, &aSysPath.pData );
- rtl::OUStringBuffer aBuf( aStr.getLength() + 20 );
- aBuf.appendAscii( "LD_LIBRARY_PATH=" );
- aBuf.append( aSysPath );
- aStr = aBuf.makeStringAndClear();
+ rtl::OUStringBuffer aEnvBuf( aStr.getLength() + 20 );
+ aEnvBuf.appendAscii( "LD_LIBRARY_PATH=" );
+ aEnvBuf.append( aSysPath );
+ aStr = aEnvBuf.makeStringAndClear();
ppEnv = &aStr.pData;
nEnv = 1;
#endif
rtl_uString* args[] = { aSysUPath.pData };
+ sal_Int32 nArgs = 1;
+
oslProcess aProcess;
oslFileHandle pIn = NULL;
oslFileHandle pOut = NULL;
@@ -869,7 +941,7 @@ bool xpdf_ImportFromFile( const ::rtl::OUString& rURL
const oslProcessError eErr =
osl_executeProcess_WithRedirectedIO(converterURL.makeStringAndClear().pData,
args,
- sizeof(args)/sizeof(*args),
+ nArgs,
osl_Process_SEARCHPATH|osl_Process_HIDDEN,
osl_getCurrentSecurity(),
0, ppEnv, nEnv,
@@ -880,6 +952,17 @@ bool xpdf_ImportFromFile( const ::rtl::OUString& rURL
{
if( eErr!=osl_Process_E_None )
return false;
+
+ if( pIn )
+ {
+ rtl::OStringBuffer aBuf(256);
+ if( bIsEncrypted )
+ aBuf.append( rtl::OUStringToOString( aPwd, RTL_TEXTENCODING_ISO_8859_1 ) );
+ aBuf.append( '\n' );
+
+ sal_uInt64 nWritten = 0;
+ osl_writeFile( pIn, aBuf.getStr(), sal_uInt64(aBuf.getLength()), &nWritten );
+ }
if( pOut && pErr )
{
@@ -908,8 +991,11 @@ bool xpdf_ImportFromFile( const ::rtl::OUString& rURL
return bRet;
}
+
bool xpdf_ImportFromStream( const uno::Reference< io::XInputStream >& xInput,
const ContentSinkSharedPtr& rSink,
+ const uno::Reference<task::XInteractionHandler >& xIHdl,
+ const rtl::OUString& rPwd,
const uno::Reference< uno::XComponentContext >& xContext )
{
OSL_ASSERT(xInput.is());
@@ -952,7 +1038,7 @@ bool xpdf_ImportFromStream( const uno::Reference< io::XInputStream >& xI
osl_closeFile( aFile );
- return bSuccess && xpdf_ImportFromFile( aURL, rSink, xContext );
+ return bSuccess && xpdf_ImportFromFile( aURL, rSink, xIHdl, rPwd, xContext );
}
}
diff --git a/sdext/source/pdfimport/xpdfwrapper/makefile.mk b/sdext/source/pdfimport/xpdfwrapper/makefile.mk
index 8ce3fb7..f45840d 100644
--- a/sdext/source/pdfimport/xpdfwrapper/makefile.mk
+++ b/sdext/source/pdfimport/xpdfwrapper/makefile.mk
@@ -41,6 +41,10 @@ EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
.INCLUDE: settings.mk
+.IF "$(SYSTEM_ZLIB)" == "YES"
+CFLAGS+=-DSYSTEM_ZLIB
+.ENDIF
+
.IF "$(ENABLE_PDFIMPORT)" == "NO"
@all:
@echo "PDF Import extension disabled."
@@ -57,8 +61,9 @@ UWINAPILIB:=
APP1TARGET=$(TARGET)
APP1LIBSALCPPRT=
APP1OBJS= \
- $(OBJ)$/wrapper_gpl.obj $(OBJ)/pdfioutdev_gpl.obj
+ $(OBJ)$/wrapper_gpl.obj $(OBJ)/pdfioutdev_gpl.obj $(OBJ)/pnghelper.obj
+APP1STDLIBS+=$(ZLIB3RDLIB)
.IF "$(SYSTEM_POPPLER)" == "YES"
APP1STDLIBS+=$(POPPLER_LIBS)
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index e3041e9..d29be09 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -35,6 +35,7 @@
************************************************************************/
#include "pdfioutdev_gpl.hxx"
+#include "pnghelper.hxx"
#include <stdlib.h>
#include <stdio.h>
@@ -95,8 +96,6 @@ const char* escapeLineFeed( const char* pStr )
/// for the initial std::vector capacity when copying stream from xpdf
#define WRITE_BUFFER_INITIAL_CAPACITY (1024*100)
-typedef std::vector<char> OutputBuffer;
-
void initBuf(OutputBuffer& io_rBuffer)
{
io_rBuffer.reserve(WRITE_BUFFER_INITIAL_CAPACITY);
@@ -135,7 +134,7 @@ void writeJpeg_( OutputBuffer& o_rOutputBuf, Stream* str, bool bWithLinefeed )
str->close();
}
-void writePbm_(OutputBuffer& o_rOutputBuf, Stream* str, int width, int height, bool bWithLinefeed)
+void writePbm_(OutputBuffer& o_rOutputBuf, Stream* str, int width, int height, bool bWithLinefeed, bool bInvert )
{
// write as PBM (char by char, to avoid stdlib lineend messing)
o_rOutputBuf.clear();
@@ -163,19 +162,142 @@ void writePbm_(OutputBuffer& o_rOutputBuf, Stream* str, int width, int height, b
str->reset();
// copy the raw stream
- for( int i=0; i<size; ++i)
- o_rOutputBuf.push_back(static_cast<char>(str->getChar()));
+ if( bInvert )
+ {
+ for( int i=0; i<size; ++i)
+ o_rOutputBuf.push_back(static_cast<char>(str->getChar() ^ 0xff));
+ }
+ else
+ {
+ for( int i=0; i<size; ++i)
+ o_rOutputBuf.push_back(static_cast<char>(str->getChar()));
+ }
str->close();
}
+void writePpm_( OutputBuffer& o_rOutputBuf,
+ Stream* str,
+ int width,
+ int height,
+ GfxImageColorMap* colorMap,
+ bool bWithLinefeed )
+{
+ // write as PPM (char by char, to avoid stdlib lineend messing)
+ o_rOutputBuf.clear();
+ o_rOutputBuf.resize(WRITE_BUFFER_SIZE);
+ o_rOutputBuf[0] = 'P';
+ o_rOutputBuf[1] = '6';
+ o_rOutputBuf[2] = '\n';
+ int nOutLen = snprintf(&o_rOutputBuf[3], WRITE_BUFFER_SIZE-10, "%d %d", width, height);
+ if( nOutLen < 0 )
+ nOutLen = WRITE_BUFFER_SIZE-10;
+ o_rOutputBuf[3+nOutLen] ='\n';
+ o_rOutputBuf[3+nOutLen+1]='2';
+ o_rOutputBuf[3+nOutLen+2]='5';
+ o_rOutputBuf[3+nOutLen+3]='5';
+ o_rOutputBuf[3+nOutLen+4]='\n';
+ o_rOutputBuf[3+nOutLen+5]=0;
+
+ const int header_size = 3+nOutLen+5;
+ const int size = width*height*3 + header_size;
+
+ printf( " PPM %d", size );
+ if( bWithLinefeed )
+ printf("\n");
+
+ // trim buffer to exact header size
+ o_rOutputBuf.resize(header_size);
+
+ // initialize stream
+ Guchar *p;
+ GfxRGB rgb;
+ ImageStream* imgStr =
+ new ImageStream(str,
+ width,
+ colorMap->getNumPixelComps(),
+ colorMap->getBits());
+ imgStr->reset();
+
+ for( int y=0; y<height; ++y)
+ {
+ p = imgStr->getLine();
+ for( int x=0; x<width; ++x)
+ {
+ colorMap->getRGB(p, &rgb);
+ o_rOutputBuf.push_back(colToByte(rgb.r));
+ o_rOutputBuf.push_back(colToByte(rgb.g));
+ o_rOutputBuf.push_back(colToByte(rgb.b));
+
+ p +=colorMap->getNumPixelComps();
+ }
+ }
+
+ delete imgStr;
+
+}
+
+// call this only for 1 bit image streams !
+void writePng_( OutputBuffer& o_rOutputBuf,
+ Stream* str,
+ int width,
+ int height,
+ GfxRGB& zeroColor,
+ GfxRGB& oneColor,
+ bool bIsMask,
+ bool bWithLinefeed )
+{
+ o_rOutputBuf.clear();
+
+ // get png image
+ PngHelper::createPng( o_rOutputBuf, str, width, height, zeroColor, oneColor, bIsMask );
+
+ printf( " PNG %d", (int)o_rOutputBuf.size() );
+ if( bWithLinefeed )
+ printf("\n");
+}
+
+void writePng_( OutputBuffer& o_rOutputBuf,
+ Stream* str,
+ int width, int height, GfxImageColorMap* colorMap,
+ Stream* maskStr,
+ int maskWidth, int maskHeight, GfxImageColorMap* maskColorMap,
+ bool bWithLinefeed )
+{
+ o_rOutputBuf.clear();
+
+ // get png image
+ PngHelper::createPng( o_rOutputBuf, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskColorMap );
+
+ printf( " PNG %d", (int)o_rOutputBuf.size() );
+ if( bWithLinefeed )
+ printf("\n");
+}
+
+void writePng_( OutputBuffer& o_rOutputBuf,
+ Stream* str,
+ int width, int height, GfxImageColorMap* colorMap,
+ Stream* maskStr,
+ int maskWidth, int maskHeight, bool maskInvert,
+ bool bWithLinefeed )
+{
+ o_rOutputBuf.clear();
+
+ // get png image
+ PngHelper::createPng( o_rOutputBuf, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskInvert );
+
+ printf( " PNG %d", (int)o_rOutputBuf.size() );
+ if( bWithLinefeed )
+ printf("\n");
+}
+
// stolen from ImageOutputDev.cc
-void writeMask_( OutputBuffer& o_rOutputBuf, Stream* str, int width, int height, bool bWithLinefeed )
+void writeMask_( OutputBuffer& o_rOutputBuf, Stream* str, int width, int height, bool bWithLinefeed, bool bInvert )
{
if( str->getKind() == strDCT )
writeJpeg_(o_rOutputBuf, str, bWithLinefeed);
else
- writePbm_(o_rOutputBuf, str, width, height, bWithLinefeed);
+ writePbm_(o_rOutputBuf, str, width, height, bWithLinefeed, bInvert );
}
void writeImage_( OutputBuffer& o_rOutputBuf,
@@ -195,62 +317,21 @@ void writeImage_( OutputBuffer& o_rOutputBuf,
else if (colorMap->getNumPixelComps() == 1 &&
colorMap->getBits() == 1)
{
- writePbm_(o_rOutputBuf, str, width, height, bWithLinefeed);
- }
- else
- {
- // write as PPM (char by char, to avoid stdlib lineend messing)
- o_rOutputBuf.clear();
- o_rOutputBuf.resize(WRITE_BUFFER_SIZE);
- o_rOutputBuf[0] = 'P';
- o_rOutputBuf[1] = '6';
- o_rOutputBuf[2] = '\n';
- int nOutLen = snprintf(&o_rOutputBuf[3], WRITE_BUFFER_SIZE-10, "%d %d", width, height);
- if( nOutLen < 0 )
- nOutLen = WRITE_BUFFER_SIZE-10;
- o_rOutputBuf[3+nOutLen] ='\n';
- o_rOutputBuf[3+nOutLen+1]='2';
- o_rOutputBuf[3+nOutLen+2]='5';
- o_rOutputBuf[3+nOutLen+3]='5';
- o_rOutputBuf[3+nOutLen+4]='\n';
- o_rOutputBuf[3+nOutLen+5]=0;
-
- const int header_size = 3+nOutLen+5;
- const int size = width*height*3 + header_size;
-
- printf( " PPM %d", size );
- if( bWithLinefeed )
- printf("\n");
-
- // trim buffer to exact header size
- o_rOutputBuf.resize(header_size);
-
- // initialize stream
- Guchar *p;
- GfxRGB rgb;
- ImageStream* imgStr =
- new ImageStream(str,
- width,
- colorMap->getNumPixelComps(),
- colorMap->getBits());
- imgStr->reset();
-
- for( int y=0; y<height; ++y)
+ // this is a two color bitmap, write a png
+ // provide default colors
+ GfxRGB zeroColor = { 0, 0, 0 },
+ oneColor = { byteToCol( 0xff ), byteToCol( 0xff ), byteToCol( 0xff ) };
+ if( colorMap->getColorSpace()->getMode() == csIndexed || colorMap->getColorSpace()->getMode() == csDeviceGray )
{
- p = imgStr->getLine();
- for( int x=0; x<width; ++x)
- {
- colorMap->getRGB(p, &rgb);
- o_rOutputBuf.push_back(colToByte(rgb.r));
- o_rOutputBuf.push_back(colToByte(rgb.g));
- o_rOutputBuf.push_back(colToByte(rgb.b));
-
- p +=colorMap->getNumPixelComps();
- }
+ Guchar nIndex = 0;
+ colorMap->getRGB( &nIndex, &zeroColor );
+ nIndex = 1;
+ colorMap->getRGB( &nIndex, &oneColor );
}
-
- delete imgStr;
- }
+ writePng_( o_rOutputBuf, str, width, height, zeroColor, oneColor, false, bWithLinefeed );
+ }
+ else
+ writePpm_( o_rOutputBuf, str, width, height, colorMap, bWithLinefeed );
}
// forwarders
@@ -269,11 +350,13 @@ inline void writeImageLF( OutputBuffer& o_rOutputBuf,
inline void writeMask( OutputBuffer& o_rOutputBuf,
Stream* str,
int width,
- int height ) { writeMask_(o_rOutputBuf,str,width,height,false); }
+ int height,
+ bool bInvert ) { writeMask_(o_rOutputBuf,str,width,height,false,bInvert); }
inline void writeMaskLF( OutputBuffer& o_rOutputBuf,
Stream* str,
int width,
- int height ) { writeMask_(o_rOutputBuf,str,width,height,true); }
+ int height,
+ bool bInvert ) { writeMask_(o_rOutputBuf,str,width,height,true,bInvert); }
// ------------------------------------------------------------------
@@ -358,7 +441,7 @@ void PDFOutDev::printPath( GfxPath* pPath ) const
PDFOutDev::PDFOutDev( PDFDoc* pDoc ) :
m_pDoc( pDoc ),
m_aFontMap(),
- m_pUtf8Map( new UnicodeMap("UTF-8", gTrue, &mapUTF8) )
+ m_pUtf8Map( new UnicodeMap((char*)"UTF-8", gTrue, &mapUTF8) )
{
}
@@ -704,14 +787,29 @@ void PDFOutDev::endTextObject(GfxState*)
printf( "endTextObject\n" );
}
-void PDFOutDev::drawImageMask(GfxState*, Object*, Stream* str,
+void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str,
int width, int height, GBool invert,
GBool /*inlineImg*/ )
{
OutputBuffer aBuf; initBuf(aBuf);
printf( "drawMask %d %d %d", width, height, invert );
- writeMaskLF(aBuf, str, width, height);
+
+ int bitsPerComponent = 1;
+ StreamColorSpaceMode csMode = streamCSNone;
+ str->getImageParams( &bitsPerComponent, &csMode );
+ if( bitsPerComponent == 1 && (csMode == streamCSNone || csMode == streamCSDeviceGray) )
+ {
+ GfxRGB oneColor = { dblToCol( 1.0 ), dblToCol( 1.0 ), dblToCol( 1.0 ) };
+ GfxRGB zeroColor = { dblToCol( 0.0 ), dblToCol( 0.0 ), dblToCol( 0.0 ) };
+ pState->getFillColorSpace()->getRGB( pState->getFillColor(), &zeroColor );
+ if( invert )
+ writePng_( aBuf, str, width, height, oneColor, zeroColor, true, true );
+ else
+ writePng_( aBuf, str, width, height, zeroColor, oneColor, true, true );
+ }
+ else
+ writeMaskLF(aBuf, str, width, height, invert != 0);
writeBinaryBuffer(aBuf);
}
@@ -768,13 +866,19 @@ void PDFOutDev::drawMaskedImage(GfxState*, Object*, Stream* str,
GBool maskInvert)
{
OutputBuffer aBuf; initBuf(aBuf);
+ printf( "drawImage %d %d 0", width, height );
+ writePng_( aBuf, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskInvert, true );
+ writeBinaryBuffer( aBuf );
+ #if 0
+ OutputBuffer aBuf; initBuf(aBuf);
OutputBuffer aMaskBuf; initBuf(aMaskBuf);
- printf( "drawMaskedImage %d %d %d %d %d", width, height, maskWidth, maskHeight, maskInvert );
+ printf( "drawMaskedImage %d %d %d %d %d", width, height, maskWidth, maskHeight, 0 /*maskInvert note: currently we do inversion here*/ );
writeImage( aBuf, str, width, height, colorMap );
- writeMaskLF( aMaskBuf, maskStr, width, height );
+ writeMaskLF( aMaskBuf, maskStr, width, height, maskInvert );
writeBinaryBuffer(aBuf);
writeBinaryBuffer(aMaskBuf);
+ #endif
}
void PDFOutDev::drawSoftMaskedImage(GfxState*, Object*, Stream* str,
@@ -785,6 +889,11 @@ void PDFOutDev::drawSoftMaskedImage(GfxState*, Object*, Stream* str,
GfxImageColorMap* maskColorMap )
{
OutputBuffer aBuf; initBuf(aBuf);
+ printf( "drawImage %d %d 0", width, height );
+ writePng_( aBuf, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskColorMap, true );
+ writeBinaryBuffer( aBuf );
+ #if 0
+ OutputBuffer aBuf; initBuf(aBuf);
OutputBuffer aMaskBuf; initBuf(aMaskBuf);
printf( "drawSoftMaskedImage %d %d %d %d", width, height, maskWidth, maskHeight );
@@ -792,6 +901,7 @@ void PDFOutDev::drawSoftMaskedImage(GfxState*, Object*, Stream* str,
writeImageLF( aMaskBuf, maskStr, maskWidth, maskHeight, maskColorMap );
writeBinaryBuffer(aBuf);
writeBinaryBuffer(aMaskBuf);
+ #endif
}
void PDFOutDev::setPageNum( int nNumPages )
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
index 5be2920..af58276 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
@@ -64,6 +64,7 @@
#endif
#include <hash_map>
+#include <vector>
class GfxPath;
class GfxFont;
@@ -286,5 +287,10 @@ namespace pdfi
extern FILE* g_binary_out;
+// note: if you ever hcange Output_t, please keep in mind that the current code
+// relies on it being of 8 bit size
+typedef char Output_t;
+typedef std::vector< Output_t > OutputBuffer;
+
#endif /* INCLUDED_PDFI_OUTDEV_HXX */
diff --git a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
new file mode 100644
index 0000000..e0574c7
--- /dev/null
+++ b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
@@ -0,0 +1,415 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU General Public License Version 2.
+ *
+ *
+ * GNU General Public License, version 2
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ ************************************************************************/
+
+#include "pnghelper.hxx"
+
+#ifdef SYSTEM_ZLIB
+#include "zlib.h"
+#else
+#include <zlib/zlib.h>
+#endif
+
+using namespace pdfi;
+
+// checksum helpers, courtesy of libpng.org
+
+/* Table of CRCs of all 8-bit messages. */
+sal_uInt32 PngHelper::crc_table[256];
+
+/* Flag: has the table been computed? Initially false. */
+bool PngHelper::bCRCTableInit = true;
+
+/* Make the table for a fast CRC. */
+void PngHelper::initCRCTable()
+{
+ for (sal_uInt32 n = 0; n < 256; n++)
+ {
+ sal_uInt32 c = n;
+ for (int k = 0; k < 8; k++)
+ {
+ if (c & 1)
+ c = 0xedb88320L ^ (c >> 1);
+ else
+ c = c >> 1;
+ }
+ crc_table[n] = c;
+ }
+ bCRCTableInit = false;
+}
+
+/* Update a running CRC with the bytes buf[0..len-1]--the CRC
+ should be initialized to all 1's, and the transmitted value
+ is the 1's complement of the final running CRC (see the
+ crc() routine below)). */
+
+void PngHelper::updateCRC( sal_uInt32& io_rCRC, const sal_uInt8* i_pBuf, size_t i_nLen )
+{
+ if( bCRCTableInit )
+ initCRCTable();
+
+ sal_uInt32 nCRC = io_rCRC;
+ for( size_t n = 0; n < i_nLen; n++ )
+ nCRC = crc_table[(nCRC ^ i_pBuf[n]) & 0xff] ^ (nCRC >> 8);
+ io_rCRC = nCRC;
+}
+
+sal_uInt32 PngHelper::getCRC( const sal_uInt8* i_pBuf, size_t i_nLen )
+{
+ sal_uInt32 nCRC = 0xffffffff;
+ updateCRC( nCRC, i_pBuf, i_nLen );
+ return nCRC ^ 0xffffffff;
+}
+
+sal_uInt32 PngHelper::deflateBuffer( const Output_t* i_pBuf, size_t i_nLen, OutputBuffer& o_rOut )
+{
+ size_t nOrigSize = o_rOut.size();
+
+ // prepare z stream
+ z_stream aStream;
+ aStream.zalloc = Z_NULL;
+ aStream.zfree = Z_NULL;
+ aStream.opaque = Z_NULL;
+ deflateInit( &aStream, Z_BEST_COMPRESSION );
+ aStream.avail_in = uInt(i_nLen);
+ aStream.next_in = (Bytef*)i_pBuf;
+
+ sal_uInt8 aOutBuf[ 32768 ];
+ do
+ {
+ aStream.avail_out = sizeof( aOutBuf );
+ aStream.next_out = aOutBuf;
+
+ if( deflate( &aStream, Z_FINISH ) == Z_STREAM_ERROR )
+ {
+ deflateEnd( &aStream );
+ // scrao the data of this broken stream
+ o_rOut.resize( nOrigSize );
+ return 0;
+ }
+
+ // append compressed bytes
+ sal_uInt32 nCompressedBytes = sizeof( aOutBuf ) - aStream.avail_out;
+ if( nCompressedBytes )
+ o_rOut.insert( o_rOut.end(), aOutBuf, aOutBuf+nCompressedBytes );
+
+ } while( aStream.avail_out == 0 );
+
+ // cleanup
+ deflateEnd( &aStream );
+
+ return sal_uInt32( o_rOut.size() - nOrigSize );
+}
+
+void PngHelper::appendFileHeader( OutputBuffer& o_rOutputBuf )
+{
+ static const Output_t aHeader[] = { 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a };
+
+ o_rOutputBuf.insert( o_rOutputBuf.end(), aHeader, aHeader + sizeof(aHeader)/sizeof(aHeader[0]) );
+}
+
+size_t PngHelper::startChunk( const char* pChunkName, OutputBuffer& o_rOutputBuf )
+{
+ size_t nIndex = sal_uInt32( o_rOutputBuf.size() );
+ o_rOutputBuf.insert( o_rOutputBuf.end(), 4, (Output_t)0 );
+ o_rOutputBuf.push_back( pChunkName[0] );
+ o_rOutputBuf.push_back( pChunkName[1] );
+ o_rOutputBuf.push_back( pChunkName[2] );
+ o_rOutputBuf.push_back( pChunkName[3] );
+ return nIndex;
+}
+
+void PngHelper::set( sal_uInt32 i_nValue, OutputBuffer& o_rOutputBuf, size_t i_nIndex )
+{
+ o_rOutputBuf[ i_nIndex ] = (i_nValue & 0xff000000) >> 24;
+ o_rOutputBuf[ i_nIndex+1 ] = (i_nValue & 0x00ff0000) >> 16;
+ o_rOutputBuf[ i_nIndex+2 ] = (i_nValue & 0x0000ff00) >> 8;
+ o_rOutputBuf[ i_nIndex+3 ] = (i_nValue & 0x000000ff);
+}
+
+void PngHelper::endChunk( size_t nStart, OutputBuffer& o_rOutputBuf )
+{
+ if( nStart+8 > o_rOutputBuf.size() )
+ return; // something broken is going on
+
+ // update chunk length
+ size_t nLen = o_rOutputBuf.size() - nStart;
+ sal_uInt32 nDataLen = sal_uInt32(nLen)-8;
+ set( nDataLen, o_rOutputBuf, nStart );
+
+ // append chunk crc
+ sal_uInt32 nChunkCRC = getCRC( (sal_uInt8*)&o_rOutputBuf[nStart+4], nLen-4 );
+ append( nChunkCRC, o_rOutputBuf );
+}
+
+void PngHelper::appendIHDR( OutputBuffer& o_rOutputBuf, int width, int height, int depth, int colortype )
+{
+ size_t nStart = startChunk( "IHDR", o_rOutputBuf );
+ append( width, o_rOutputBuf );
+ append( height, o_rOutputBuf );
+ o_rOutputBuf.push_back( Output_t(depth) );
+ o_rOutputBuf.push_back( Output_t(colortype) );
+ o_rOutputBuf.push_back( 0 ); // compression method deflate
+ o_rOutputBuf.push_back( 0 ); // filtering method 0 (default)
+ o_rOutputBuf.push_back( 0 ); // no interlacing
+ endChunk( nStart, o_rOutputBuf );
+}
+
+void PngHelper::appendIEND( OutputBuffer& o_rOutputBuf )
+{
+ size_t nStart = startChunk( "IEND", o_rOutputBuf );
+ endChunk( nStart, o_rOutputBuf );
+}
+
+void PngHelper::createPng( OutputBuffer& o_rOutputBuf,
+ Stream* str,
+ int width,
+ int height,
+ GfxRGB& zeroColor,
+ GfxRGB& oneColor,
+ bool bIsMask
+ )
+{
+ appendFileHeader( o_rOutputBuf );
+ appendIHDR( o_rOutputBuf, width, height, 1, 3 );
+
+ // write palette
+ size_t nIdx = startChunk( "PLTE", o_rOutputBuf );
+ // write colors 0 and 1
+ o_rOutputBuf.push_back(colToByte(zeroColor.r));
+ o_rOutputBuf.push_back(colToByte(zeroColor.g));
+ o_rOutputBuf.push_back(colToByte(zeroColor.b));
+ o_rOutputBuf.push_back(colToByte(oneColor.r));
+ o_rOutputBuf.push_back(colToByte(oneColor.g));
+ o_rOutputBuf.push_back(colToByte(oneColor.b));
+ // end PLTE chunk
+ endChunk( nIdx, o_rOutputBuf );
+
+ if( bIsMask )
+ {
+ // write tRNS chunk
+ nIdx = startChunk( "tRNS", o_rOutputBuf );
+ o_rOutputBuf.push_back( 0xff );
+ o_rOutputBuf.push_back( 0 );
+ // end tRNS chunk
+ endChunk( nIdx, o_rOutputBuf );
+ }
+
+ // create scan line data buffer
+ OutputBuffer aScanlines;
+ int nLineSize = (width + 7)/8;
+ aScanlines.reserve( nLineSize * height + height );
+
+ str->reset();
+ for( int y = 0; y < height; y++ )
+ {
+ // determine filter type (none) for this scanline
+ aScanlines.push_back( 0 );
+ for( int x = 0; x < nLineSize; x++ )
+ aScanlines.push_back( str->getChar() );
+ }
+
+ // begin IDAT chunk for scanline data
+ nIdx = startChunk( "IDAT", o_rOutputBuf );
+ // compress scanlines
+ deflateBuffer( &aScanlines[0], aScanlines.size(), o_rOutputBuf );
+ // end IDAT chunk
+ endChunk( nIdx, o_rOutputBuf );
+
+ // output IEND
+ appendIEND( o_rOutputBuf );
+}
+
+void PngHelper::createPng( OutputBuffer& o_rOutputBuf,
+ Stream* str,
+ int width, int height, GfxImageColorMap* colorMap,
+ Stream* maskStr,
+ int maskWidth, int maskHeight, GfxImageColorMap* maskColorMap )
+{
+ appendFileHeader( o_rOutputBuf );
+ appendIHDR( o_rOutputBuf, width, height, 8, 6 ); // RGBA image
+
+ // initialize stream
+ Guchar *p, *pm;
+ GfxRGB rgb;
+ GfxGray alpha;
+ ImageStream* imgStr =
+ new ImageStream(str,
+ width,
+ colorMap->getNumPixelComps(),
+ colorMap->getBits());
+ imgStr->reset();
+
+ // create scan line data buffer
+ OutputBuffer aScanlines;
+ aScanlines.reserve( width*height*4 + height );
+
+ for( int y=0; y<height; ++y)
+ {
+ aScanlines.push_back( 0 );
+ p = imgStr->getLine();
+ for( int x=0; x<width; ++x)
+ {
+ colorMap->getRGB(p, &rgb);
+ aScanlines.push_back(colToByte(rgb.r));
+ aScanlines.push_back(colToByte(rgb.g));
+ aScanlines.push_back(colToByte(rgb.b));
+ aScanlines.push_back( 0xff );
+
+ p +=colorMap->getNumPixelComps();
+ }
+ }
+
+
+ // now fill in the mask data
+
+ // CAUTION: originally this was done in one single loop
+ // it caused merry chaos; the reason is that maskStr and str are
+ // not independent streams, it happens that reading one advances
+ // the other, too. Hence the two passes are imperative !
+
+ // initialize mask stream
+ ImageStream* imgStrMask =
+ new ImageStream(maskStr,
+ maskWidth,
+ maskColorMap->getNumPixelComps(),
+ maskColorMap->getBits());
+
+ imgStrMask->reset();
+ for( int y = 0; y < maskHeight; ++y )
+ {
+ pm = imgStrMask->getLine();
+ for( int x = 0; x < maskWidth; ++x )
+ {
+ maskColorMap->getGray(pm,&alpha);
+ pm += maskColorMap->getNumPixelComps();
+ int nIndex = (y*height/maskHeight) * (width*4+1) + // mapped line
+ (x*width/maskWidth)*4 + 1 + 3 // mapped column
+ ;
+ aScanlines[ nIndex ] = colToByte(alpha);
+ }
+ }
+
+ delete imgStr;
+ delete imgStrMask;
+
+ // begind IDAT chunk for scanline data
+ size_t nIdx = startChunk( "IDAT", o_rOutputBuf );
+ // compress scanlines
+ deflateBuffer( &aScanlines[0], aScanlines.size(), o_rOutputBuf );
+ // end IDAT chunk
+ endChunk( nIdx, o_rOutputBuf );
+ // output IEND
+ appendIEND( o_rOutputBuf );
+}
+
+// one bit mask; 0 bits opaque
+void PngHelper::createPng( OutputBuffer& o_rOutputBuf,
+ Stream* str,
+ int width, int height, GfxImageColorMap* colorMap,
+ Stream* maskStr,
+ int maskWidth, int maskHeight,
+ bool maskInvert
+ )
+{
+ appendFileHeader( o_rOutputBuf );
+ appendIHDR( o_rOutputBuf, width, height, 8, 6 ); // RGBA image
+
+ // initialize stream
+ Guchar *p;
+ GfxRGB rgb;
+ ImageStream* imgStr =
+ new ImageStream(str,
+ width,
+ colorMap->getNumPixelComps(),
+ colorMap->getBits());
+ imgStr->reset();
+
+ // create scan line data buffer
+ OutputBuffer aScanlines;
+ aScanlines.reserve( width*height*4 + height );
+
+ for( int y=0; y<height; ++y)
+ {
+ aScanlines.push_back( 0 );
+ p = imgStr->getLine();
+ for( int x=0; x<width; ++x)
+ {
+ colorMap->getRGB(p, &rgb);
+ aScanlines.push_back(colToByte(rgb.r));
+ aScanlines.push_back(colToByte(rgb.g));
+ aScanlines.push_back(colToByte(rgb.b));
+ aScanlines.push_back( 0xff );
+
+ p +=colorMap->getNumPixelComps();
+ }
+ }
+
+
+ // now fill in the mask data
+
+ // CAUTION: originally this was done in one single loop
+ // it caused merry chaos; the reason is that maskStr and str are
+ // not independent streams, it happens that reading one advances
+ // the other, too. Hence the two passes are imperative !
+
+ // initialize mask stream
+ ImageStream* imgStrMask =
+ new ImageStream(maskStr, maskWidth, 1, 1);
+
+ imgStrMask->reset();
+ for( int y = 0; y < maskHeight; ++y )
+ {
+ for( int x = 0; x < maskWidth; ++x )
+ {
+ Guchar aPixel = 0;
+ imgStrMask->getPixel( &aPixel );
+ int nIndex = (y*height/maskHeight) * (width*4+1) + // mapped line
+ (x*width/maskWidth)*4 + 1 + 3 // mapped column
+ ;
+ if( maskInvert )
+ aScanlines[ nIndex ] = aPixel ? 0xff : 0x00;
+ else
+ aScanlines[ nIndex ] = aPixel ? 0x00 : 0xff;
+ }
+ }
+
+ delete imgStr;
+ delete imgStrMask;
+
+ // begind IDAT chunk for scanline data
+ size_t nIdx = startChunk( "IDAT", o_rOutputBuf );
+ // compress scanlines
+ deflateBuffer( &aScanlines[0], aScanlines.size(), o_rOutputBuf );
+ // end IDAT chunk
+ endChunk( nIdx, o_rOutputBuf );
+ // output IEND
+ appendIEND( o_rOutputBuf );
+}
+
diff --git a/sdext/source/pdfimport/xpdfwrapper/pnghelper.hxx b/sdext/source/pdfimport/xpdfwrapper/pnghelper.hxx
new file mode 100644
index 0000000..451dcf8
--- /dev/null
+++ b/sdext/source/pdfimport/xpdfwrapper/pnghelper.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU General Public License Version 2.
+ *
+ *
+ * GNU General Public License, version 2
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ ************************************************************************/
+#ifndef _IPDF_PNGHELPER_HXX
+#define _IPDF_PNGHELPER_HXX
+
+#include "sal/types.h"
+#include "pdfioutdev_gpl.hxx"
+
+
+namespace pdfi
+{
+ class PngHelper
+ {
+ static sal_uInt32 crc_table[ 256 ];
+ static bool bCRCTableInit;
+
+ static void initCRCTable();
+ static void appendFileHeader( OutputBuffer& o_rOutputBuf );
+ static size_t startChunk( const char* pChunkName, OutputBuffer& o_rOut );
+ static void endChunk( size_t nStart, OutputBuffer& o_rOut );
+
+ static void set( sal_uInt32 i_nValue, OutputBuffer& o_rOutputBuf, size_t i_nIndex );
+ static void append( sal_uInt32 i_nValue, OutputBuffer& o_rOutputBuf )
+ {
+ size_t nCur = o_rOutputBuf.size();
+ o_rOutputBuf.insert( o_rOutputBuf.end(), 4, (Output_t)0 );
+ set( i_nValue, o_rOutputBuf, nCur );
+ }
+
+ static void appendIHDR( OutputBuffer& o_rOutputBuf, int width, int height, int depth, int colortype );
+ static void appendIEND( OutputBuffer& o_rOutputBuf );
+
+ public:
+ static void updateCRC( sal_uInt32& io_rCRC, const sal_uInt8* i_pBuf, size_t i_nLen );
+ static sal_uInt32 getCRC( const sal_uInt8* i_pBuf, size_t i_nLen );
+
+ // deflates the passed buff i_pBuf and appends it to the output vector
+ // returns the number of bytes added to the output
+ static sal_uInt32 deflateBuffer( const Output_t* i_pBuf, size_t i_nLen, OutputBuffer& o_rOut );
+
+ static void createPng( OutputBuffer& o_rOutputBuf,
+ Stream* str,
+ int width,
+ int height,
+ GfxRGB& zeroColor,
+ GfxRGB& oneColor,
+ bool bIsMask
+ );
+ static void createPng( OutputBuffer& o_rOutputBuf,
+ Stream* str,
+ int width, int height, GfxImageColorMap* colorMap,
+ Stream* maskStr,
+ int maskWidth, int maskHeight, GfxImageColorMap* maskColorMap );
+
+ // for one bit masks
+ static void createPng( OutputBuffer& o_rOutputBuf,
+ Stream* str,
+ int width, int height, GfxImageColorMap* colorMap,
+ Stream* maskStr,
+ int maskWidth, int maskHeight, bool maskInvert );
+
+ };
+}
+
+#endif
diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
index c53eaed..21a4bc7 100644
--- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
@@ -49,12 +49,12 @@ static char userPassword[33] = "\001";
static char outputFile[256] = "\001";
static ArgDesc argDesc[] = {
- {"-f", argString, outputFile, sizeof(outputFile),
- "output file for binary streams"},
- {"-opw", argString, ownerPassword, sizeof(ownerPassword),
- "owner password (for encrypted files)"},
- {"-upw", argString, userPassword, sizeof(userPassword),
- "user password (for encrypted files)"},
+ {(char*)"-f", argString, outputFile, sizeof(outputFile),
+ (char*)"output file for binary streams"},
+ {(char*)"-opw", argString, ownerPassword, sizeof(ownerPassword),
+ (char*)"owner password (for encrypted files)"},
+ {(char*)"-upw", argString, userPassword, sizeof(userPassword),
+ (char*)"user password (for encrypted files)"},
{NULL, argString, NULL, 0, NULL }
};
#else
@@ -104,13 +104,30 @@ int main(int argc, char **argv)
// read config file
globalParams = new GlobalParams(
#ifndef SYSTEM_POPPLER
- ""
+ (char*)""
#endif
);
globalParams->setErrQuiet(gTrue);
#if !defined(SYSTEM_POPPLER) || defined(_MSC_VER)
globalParams->setupBaseFonts(NULL);
#endif
+
+ // try to read a possible open password form stdin
+ char aPwBuf[34];
+ aPwBuf[33] = 0;
+ if( ! fgets( aPwBuf, sizeof(aPwBuf)-1, stdin ) )
+ aPwBuf[0] = 0; // mark as empty
+ else
+ {
+ for( unsigned int i = 0; i < sizeof(aPwBuf); i++ )
+ {
+ if( aPwBuf[i] == '\n' )
+ {
+ aPwBuf[i] = 0;
+ break;
+ }
+ }
+ }
// PDFDoc takes over ownership for all strings below
GooString* pFileName = new GooString(argv[1]);
@@ -121,12 +138,14 @@ int main(int argc, char **argv)
// check for password string(s)
- GooString* pOwnerPasswordStr(
- ownerPassword[0] != '\001' ? new GooString(ownerPassword)
- : (GooString *)NULL );
- GooString* pUserPasswordStr(
- userPassword[0] != '\001' ? new GooString(userPassword)
- : (GooString *)NULL );
+ GooString* pOwnerPasswordStr( ownerPassword[0] != '\001'
+ ? new GooString(ownerPassword)
+ : (GooString *)NULL );
+ GooString* pUserPasswordStr( aPwBuf[0] != 0
+ ? new GooString( aPwBuf )
+ : ( userPassword[0] != '\001'
+ ? new GooString(userPassword)
+ : (GooString *)NULL ) );
if( outputFile[0] != '\001' )
g_binary_out = fopen(outputFile,"wb");
@@ -150,10 +169,7 @@ int main(int argc, char **argv)
!aDoc.okToPrint() ||
!aDoc.okToChange()||
!aDoc.okToCopy()||
- !aDoc.okToAddNotes()||
- (userPassword[0] != '\001')||
- (ownerPassword[0] != '\001')
- )
+ !aDoc.okToAddNotes() )
{
pdfi::PDFOutDev* pOutDev( new pdfi::PDFOutDev(&aErrDoc) );
diff --git a/sdext/source/presenter/makefile.mk b/sdext/source/presenter/makefile.mk
index 083db8e..04b13a2 100644
--- a/sdext/source/presenter/makefile.mk
+++ b/sdext/source/presenter/makefile.mk
@@ -33,7 +33,7 @@ PRJ=..$/..
PRJNAME=sdext
TARGET=PresenterScreen
GEN_HID=FALSE
-EXTNAME=presenter
+EXTNAME=PresenterScreen
ENABLE_EXCEPTIONS=TRUE
@@ -121,13 +121,21 @@ PACKLICS:=$(foreach,i,$(alllangiso) $(ZIP1DIR)$/registry$/license_$i)
PACKLICS:=$(foreach,i,$(alllangiso) $(ZIP1DIR)$/registry$/LICENSE_$i)
.ENDIF
+.IF "$(WITH_LANG)"==""
+FIND_XCU=registry/data
+.ELSE # "$(WITH_LANG)"==""
+FIND_XCU=$(MISC)$/$(EXTNAME)_in$/merge
+.ENDIF # "$(WITH_LANG)"==""
COMPONENT_FILES= \
$(ZIP1DIR)$/registry$/data$/org$/openoffice$/Office$/Jobs.xcu \
$(ZIP1DIR)$/registry$/data$/org$/openoffice$/Office$/ProtocolHandler.xcu \
- $(ZIP1DIR)$/registry$/data$/org$/openoffice$/Office$/extension$/PresenterScreen.xcu \
- $(ZIP1DIR)$/registry$/schema/org$/openoffice$/Office$/extension$/PresenterScreen.xcs
+ $(ZIP1DIR)$/registry$/schema/org$/openoffice$/Office$/extension$/PresenterScreen.xcs \
+ $(ZIP1DIR)$/registry$/data/$/org$/openoffice$/Office$/extension$/PresenterScreen.xcu
+
+#COMPONENT_MERGED_XCU= \
+# $(FIND_XCU)$/org$/openoffice$/Office$/extension$/PresenterScreen.xcu
COMPONENT_BITMAPS= \
$(ZIP1DIR)$/bitmaps$/BorderTop.png \
@@ -243,6 +251,7 @@ ZIP1DEPS= \
$(COMPONENT_BITMAPS) \
$(COMPONENT_LIBRARY) \
$(COMPONENT_HELP)
+# $(COMPONENT_MERGED_XCU) \
PLATFORMID:=$(RTL_OS:l)_$(RTL_ARCH:l)
@@ -265,8 +274,8 @@ $(COMPONENT_HELP) : help$/$$(@:f)
$(COPY) $< $@
#$(COMPONENT_FILES) : $$(@:f)
-# @-$(MKDIRHIER) $(@:d)
-# +$(COPY) $< $@
+# -$(MKDIRHIER) $(@:d)
+# $(COPY) $< $@
$(COMPONENT_BITMAPS) : bitmaps$/$$(@:f)
@-$(MKDIRHIER) $(@:d)
@@ -328,6 +337,7 @@ $(PACKLICS) : $(SOLARBINDIR)$/osl$/LICENSE$$(@:b:s/_/./:e:s/./_/)$$(@:e)
$(GNUCOPY) $< $@
.ENDIF
+
$(ZIP1DIR)/%.xcu : %.xcu
@@-$(MKDIRHIER) $(@:d)
$(GNUCOPY) $< $@
diff --git a/sdext/source/presenter/registry/data/org/openoffice/Office/extension/makefile.mk b/sdext/source/presenter/registry/data/org/openoffice/Office/extension/makefile.mk
index 1c70204..ba7236d 100644
--- a/sdext/source/presenter/registry/data/org/openoffice/Office/extension/makefile.mk
+++ b/sdext/source/presenter/registry/data/org/openoffice/Office/extension/makefile.mk
@@ -34,18 +34,18 @@ PRJ=..$/..$/..$/..$/..$/..$/..$/..
PRJNAME=sdext
TARGET=data_ooOfficeext
PACKAGE=org.openoffice.Office.extension
-EXTNAME=presenter
+EXTENSIONNAME=PresenterScreen
.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/util$/makefile.pmk
XCSROOT=$(PRJ)$/source$/presenter
-ABSXCSROOT=$(PRJ)$/source$/presenter
+ABSXCSROOT=$(PWD)/$(PRJ)$/source$/presenter
# --- Targets ------------------------------------------------------
XCUFILES= \
- PresenterScren.xcu
+ PresenterScreen.xcu
MODULEFILES=
diff --git a/sdext/source/presenter/registry/schema/org/openoffice/Office/extension/PresenterScreen.xcs b/sdext/source/presenter/registry/schema/org/openoffice/Office/extension/PresenterScreen.xcs
index 38a8212..48aad71 100644
--- a/sdext/source/presenter/registry/schema/org/openoffice/Office/extension/PresenterScreen.xcs
+++ b/sdext/source/presenter/registry/schema/org/openoffice/Office/extension/PresenterScreen.xcs
@@ -29,7 +29,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************ -->
-<!DOCTYPE oor:component-schema SYSTEM "../../../../component-schema.dtd">
<oor:component-schema 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" oor:package="org.openoffice.Office.extension" oor:name="PresenterScreen">
<info>
<author>AF</author>
diff --git a/swext/mediawiki/help/makefile.mk b/swext/mediawiki/help/makefile.mk
index eb395ca..b706f33 100644
--- a/swext/mediawiki/help/makefile.mk
+++ b/swext/mediawiki/help/makefile.mk
@@ -30,7 +30,7 @@
#*************************************************************************
PRJ=..$/..
-PRJNAME=mediawiki
+PRJNAME=swext
TARGET=$(PRJNAME)_help
.INCLUDE : settings.mk
@@ -42,7 +42,7 @@ PACKAGE=com.sun.sun-mediawiki
# workaround for the problem in help, the help uses en instead of en-US
MEDIAWIKI_LANG= en $(alllangiso)
-OUT_MEDIAWIKI=$(MISC)$/$(PRJNAME)
+OUT_MEDIAWIKI=$(MISC)$/mediawiki
OUT_HELP=$(OUT_MEDIAWIKI)$/help
XHPFILES= \
@@ -71,7 +71,7 @@ $(OUT_HELP)$/{$(MEDIAWIKI_LANG)}$/$(PACKAGE)$/%.xhp :| %.xhp
# @$(NULL)
-$(OUT_MEDIAWIKI)$/$(TARGET).done : localize.sdf $(XHPFILES) $(HLANGXHPFILES)
- @$(AUGMENT_LIBRARY_PATH) $(WRAPCMD) helpex -QQ -p $(PRJNAME) -r $(PRJ) -i @$(mktmp $(uniq $(foreach,i,$? $(!eq,$(i:f),$(i:f:s/.xhp//) $(i:f) $(XHPFILES))))) -x $(OUT_HELP) -y $(PACKAGE) -l all -lf $(MEDIAWIKI_LANG:t",") -m localize.sdf && $(TOUCH) $@
+$(OUT_MEDIAWIKI)$/$(TARGET).done : $(LOCALIZESDF) $(XHPFILES) $(HLANGXHPFILES)
+ @$(AUGMENT_LIBRARY_PATH) $(WRAPCMD) $(HELPEX) -QQ -p $(PRJNAME) -r $(PRJ) -i @$(mktmp $(uniq $(foreach,i,$? $(!eq,$(i:f),$(i:f:s/.xhp//) $(i:f) $(XHPFILES))))) -x $(OUT_HELP) -y $(PACKAGE) -l all -lf $(MEDIAWIKI_LANG:t",") -m $(LOCALIZESDF) && $(TOUCH) $@
.ENDIF
diff --git a/swext/mediawiki/help/wiki.xhp b/swext/mediawiki/help/wiki.xhp
index 015ced6..861decd 100644
--- a/swext/mediawiki/help/wiki.xhp
+++ b/swext/mediawiki/help/wiki.xhp
@@ -53,10 +53,10 @@
<paragraph role="heading" id="hd_id4554582" xml-lang="en-US" level="2" l10n="NEW">System Requirements</paragraph>
<list type="unordered">
<listitem>
-<paragraph role="paragraph" id="par_id2597430" xml-lang="en-US" l10n="NEW">StarOffice/StarSuite 8 Update 10</paragraph>
+<paragraph role="paragraph" id="par_id2597430" xml-lang="en-US" l10n="NEW">StarOffice/StarSuite 9</paragraph>
</listitem>
<listitem>
-<paragraph role="paragraph" id="par_id8430738" xml-lang="en-US" l10n="NEW">OpenOffice.org 2.4</paragraph>
+<paragraph role="paragraph" id="par_id8430738" xml-lang="en-US" l10n="NEW">OpenOffice.org 3.0</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_id9340495" xml-lang="en-US" l10n="NEW">Java Runtime Environment 1.4</paragraph>
@@ -66,7 +66,7 @@
</listitem>
</list>
<paragraph role="heading" id="hd_id8047120" xml-lang="en-US" level="2" l10n="NEW">Installing @WIKIEXTENSIONPRODUCTNAME@</paragraph>
-<paragraph role="paragraph" id="par_id4277169" xml-lang="en-US" l10n="NEW">Before you install the @WIKIEXTENSIONPRODUCTNAME@, ensure that StarOffice or OpenOffice.org uses a Java Runtime Environment (JRE). To check the status of the JRE, choose <item type="menuitem">Tools - Options - StarOffice/OpenOffice.org - Java</item>. Ensure that "Use a Java runtime environment" is marked and that a Java runtime folder is selected in the big listbox. If no JRE was activated, then activate a JRE 1.4 or later and restart StarOffice/OpenOffice.org.</paragraph>
+<paragraph role="paragraph" id="par_id4277169" xml-lang="en-US" l10n="NEW">Before you install the @WIKIEXTENSIONPRODUCTNAME@, ensure that %PRODUCTNAME uses a Java Runtime Environment (JRE). To check the status of the JRE, choose <item type="menuitem">Tools - Options - %PRODUCTNAME - Java</item>. Ensure that "Use a Java runtime environment" is marked and that a Java runtime folder is selected in the big listbox. If no JRE was activated, then activate a JRE 1.4 or later and restart %PRODUCTNAME.</paragraph>
<paragraph role="heading" id="hd_id567339" xml-lang="en-US" level="3" l10n="NEW">To Install the @WIKIEXTENSIONPRODUCTNAME@</paragraph>
<list type="ordered">
<listitem>
@@ -79,7 +79,7 @@
<paragraph role="paragraph" id="par_id5882442" xml-lang="en-US" l10n="NEW">Locate the @WIKIEXTENSIONFILENAME@.oxt file, click Open, and then click Close. </paragraph>
</listitem>
<listitem>
-<paragraph role="paragraph" id="par_id4008911" xml-lang="en-US" l10n="NEW">Close StarOffice/StarSuite/OpenOffice.org, and close also the Quickstarter if enabled.</paragraph>
+<paragraph role="paragraph" id="par_id4008911" xml-lang="en-US" l10n="NEW">Close %PRODUCTNAME, and close also the Quickstarter if enabled.</paragraph>
</listitem>
<listitem>
<paragraph role="paragraph" id="par_id265511" xml-lang="en-US" l10n="NEW">Restart the software, open a text document, then choose <item type="menuitem">Tools - Options - Internet - MediaWiki</item> to enter your Wiki settings. See "To Connect To a Wiki" below.</paragraph>
@@ -98,7 +98,7 @@
</listitem>
</list>
<paragraph role="heading" id="hd_id5316019" xml-lang="en-US" level="2" l10n="NEW">To Connect to a Wiki</paragraph>
-<paragraph role="paragraph" id="par_id2381969" xml-lang="en-US" l10n="NEW">Note: You can store your user name and password for all respective dialogs inside StarOffice/OpenOffice.org. The password will be stored in a secure way, where access is maintained by a master password. To enable the master password, choose <item type="menuitem">Tools - Options - StarOffice/OpenOffice.org - Security</item>.</paragraph>
+<paragraph role="paragraph" id="par_id2381969" xml-lang="en-US" l10n="NEW">Note: You can store your user name and password for all respective dialogs inside %PRODUCTNAME. The password will be stored in a secure way, where access is maintained by a master password. To enable the master password, choose <item type="menuitem">Tools - Options - %PRODUCTNAME - Security</item>.</paragraph>
<paragraph role="paragraph" id="par_id3751640" xml-lang="en-US" l10n="NEW">Note: If you connect to the web using a proxy server, enter the proxy information to <item type="menuitem">Tools - Options - Internet - Proxy</item>, and restart the software.</paragraph>
<list type="ordered">
<listitem>
@@ -124,7 +124,7 @@
<paragraph role="paragraph" id="par_id8869594" xml-lang="en-US" l10n="NEW">In the Password box, enter the password for your Wiki account, then click OK.</paragraph>
</listitem>
</list>
-<paragraph role="paragraph" id="par_id292062" xml-lang="en-US" l10n="NEW">Optionally enable "Save password" to save the password between sessions. A master password is used to maintain access to all saved passwords. Choose <item type="menuitem">Tools - Options - StarOffice/OpenOffice.org - Security</item> to enable the master password. "Save password" is unavailable when the master password is not enabled.</paragraph>
+<paragraph role="paragraph" id="par_id292062" xml-lang="en-US" l10n="NEW">Optionally enable "Save password" to save the password between sessions. A master password is used to maintain access to all saved passwords. Choose <item type="menuitem">Tools - Options - %PRODUCTNAME - Security</item> to enable the master password. "Save password" is unavailable when the master password is not enabled.</paragraph>
<paragraph role="heading" id="hd_id7044892" xml-lang="en-US" level="2" l10n="NEW">To Create a New Wiki Page</paragraph>
<list type="ordered">
<listitem>
diff --git a/swext/mediawiki/help/wikiaccount.xhp b/swext/mediawiki/help/wikiaccount.xhp
index 7e92dcb..af833bf 100644
--- a/swext/mediawiki/help/wikiaccount.xhp
+++ b/swext/mediawiki/help/wikiaccount.xhp
@@ -51,9 +51,9 @@
<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.EditSetting.PasswordField" id="bm_id4558246" localize="false"/>
<paragraph role="paragraph" id="par_id1113010" xml-lang="en-US" l10n="NEW"><ahelp hid="." visibility="hidden">Enter your password on the MediaWiki server. Leave empty for anonymous access.</ahelp></paragraph><comment>Save password</comment>
<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.EditSetting.SaveBox" id="bm_id4558247" localize="false"/>
-<paragraph role="paragraph" id="par_id656758" xml-lang="en-US" l10n="NEW"><ahelp hid="." visibility="hidden">Enable to store your password between sessions. The master password must be enabled, see <item type="menuitem">Tools - Options - StarOffice/OpenOffice.org - Security</item>.</ahelp></paragraph>
+<paragraph role="paragraph" id="par_id656758" xml-lang="en-US" l10n="NEW"><ahelp hid="." visibility="hidden">Enable to store your password between sessions. The master password must be enabled, see <item type="menuitem">Tools - Options - %PRODUCTNAME - Security</item>.</ahelp></paragraph>
<paragraph role="paragraph" id="par_id3112582" xml-lang="en-US" l10n="NEW">Enter the Internet address of a Wiki server in a format like http://wiki.services.openoffice.org/wiki or copy the URL from a web browser.</paragraph>
<paragraph role="paragraph" id="par_id628070" xml-lang="en-US" l10n="NEW">If the Wiki allows anonymous access, you can leave the account text boxes empty. Else enter your user name and password.</paragraph>
-<paragraph role="paragraph" id="par_id9046601" xml-lang="en-US" l10n="NEW">If you have enabled the master password feature on the Security tab page of the Tools - Options - StarOffice/OpenOffice.org dialog, then the software can store your password and automatically insert the data where necessary. Enable the "Save password" checkbox to store your password.</paragraph>
+<paragraph role="paragraph" id="par_id9046601" xml-lang="en-US" l10n="NEW">If you have enabled the master password feature on the Security tab page of the Tools - Options - %PRODUCTNAME dialog, then the software can store your password and automatically insert the data where necessary. Enable the "Save password" checkbox to store your password.</paragraph>
</body>
</helpdocument>
diff --git a/swext/prj/build.lst b/swext/prj/build.lst
index 7dcb129..6b8c4dd 100644
--- a/swext/prj/build.lst
+++ b/swext/prj/build.lst
@@ -1,4 +1,4 @@
-swext swext : javaunohelper ridljar unoil jurt APACHE_COMMONS:apache-commons officecfg readlicense_oo xsltml filter NULL
+swext swext : l10n javaunohelper ridljar unoil jurt APACHE_COMMONS:apache-commons officecfg readlicense_oo xsltml filter NULL
swext swext usr1 - all swext_mkout NULL
swext swext\mediawiki\help nmake - all swext_mwhelp NULL
swext swext\mediawiki\src\registry\schema\org\openoffice\Office\Custom nmake - all swext_mwschema NULL
diff --git a/xpdf/makefile.mk b/xpdf/makefile.mk
index 5ae45fa..8ed2543 100644
--- a/xpdf/makefile.mk
+++ b/xpdf/makefile.mk
@@ -81,7 +81,7 @@ CONFIGURE_ACTION=./configure --without-x --enable-multithreaded --enable-excepti
.ELSE
#CONFIGURE_ACTION=./configure
#CONFIGURE_ACTION=./configure --without-x --enable-multithreaded --enable-exceptions CFLAGS="-g -O0" CXXFLAGS="-g -O0"
-CONFIGURE_ACTION=./configure --without-libpaper-library --without-x --enable-multithreaded --enable-exceptions
+CONFIGURE_ACTION=./configure --without-libpaper-library --without-t1-library --without-x --enable-multithreaded --enable-exceptions
.ENDIF
BUILD_ACTION=$(GNUMAKE) -j$(EXTMAXPROCESS)
@@ -91,7 +91,7 @@ CONFIGURE_ACTION=./configure --without-x --enable-multithreaded --enable-excepti
BUILD_ACTION=$(GNUMAKE) -j$(EXTMAXPROCESS)
.ELSE
CONFIGURE_ACTION=
-BUILD_ACTION= cmd.exe /c ms_make.bat
+BUILD_ACTION= cmd.exe /d /c ms_make.bat
.ENDIF
.ENDIF