From 9544c14f4a931d8d8b2e66a6cb87fb53d4505cd4 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Wed, 4 Mar 2009 15:27:10 +0000 Subject: CWS-TOOLING: integrate CWS rptfix04 2009-02-23 01:59:54 +0100 rene r268341 : #i10000# fix system-jfreereport build 2009-02-13 10:17:16 +0100 oj r267696 : #i98549# integrate zip form pentaho package 2009-02-03 14:48:34 +0100 oj r267330 : set formula locale to doc locale 2009-02-03 14:45:54 +0100 oj r267329 : set formula locale to doc locale 2009-02-03 11:50:03 +0100 oj r267311 : set formula locale to doc locale 2009-02-03 08:55:02 +0100 oj r267297 : unix line ends 2009-01-28 11:21:24 +0100 rene r267043 : #i98549# s/DESIGN/BUILDER/ also for Sun 2009-01-27 17:17:50 +0100 rene r267012 : merge builfix from trunk 2009-01-27 14:16:30 +0100 rene r266991 : #i10000# fix rebase which left out the whole changes in former config_office; sync variable names (s/LIB_//) and some other things 2009-01-27 10:01:09 +0100 oj r266959 : CWS-TOOLING: rebase CWS rptfix04 to trunk@266944 (milestone: DEV300:m40) 2009-01-27 08:00:16 +0100 oj r266951 : conflict in mergeinfo 2009-01-26 12:23:03 +0100 oj r266914 : #i98383# fix grouping 2009-01-23 22:03:03 +0100 rene r266852 : fix --enable-report-builder description 2009-01-23 10:37:27 +0100 oj r266778 : set escape processing when set at query 2009-01-23 09:17:16 +0100 fs r266770 : add CWS name to version 2009-01-21 13:57:35 +0100 oj r266669 : merge for build bots 2009-01-20 09:07:24 +0100 oj r266552 : CWS-TOOLING: rebase CWS rptfix04 to trunk@266428 (milestone: DEV300:m39) 2009-01-20 08:34:16 +0100 oj r266551 : rebase 2009-01-20 08:33:59 +0100 oj r266550 : rebase 2009-01-20 08:32:50 +0100 oj r266549 : rebase 2009-01-20 08:30:13 +0100 oj r266548 : rebase 2009-01-20 08:29:30 +0100 oj r266547 : rebase 2009-01-20 08:22:33 +0100 oj r266546 : merge short cuts from dba31g 2009-01-19 21:04:08 +0100 rene r266525 : #i10000# we need officecfg for component-update.dtd 2009-01-19 21:01:26 +0100 rene r266524 : #i10000# fix import 2009-01-19 20:26:20 +0100 rene r266523 : #i10000# remove svn conflicts markers; fix build 2009-01-19 14:23:56 +0100 rene r266496 : libbase depends on apache-commons.. 2009-01-19 14:00:42 +0100 oj r266495 : merge from m39 2009-01-19 12:39:00 +0100 oj r266489 : CWS-TOOLING: rebase CWS rptfix04 to trunk@266428 (milestone: DEV300:m39) 2009-01-16 11:47:04 +0100 oj r266410 : #i97560# add , between expressions 2009-01-09 17:11:38 +0100 rene r266103 : don't show "checking which Apache commons-* libs to use" when we neither build the wiki editor nor the SRB 2009-01-09 16:48:02 +0100 rene r266099 : #i10000# reportbuilder needs apache-commons 2009-01-09 15:43:35 +0100 oj r266093 : use of new nspaces 2009-01-09 15:41:34 +0100 oj r266092 : use of new nspaces 2009-01-09 14:44:15 +0100 rene r266088 : fix typo/description 2009-01-09 12:48:51 +0100 rene r266074 : #i10000# fix install 2009-01-09 11:52:53 +0100 rene r266070 : #i10000# more build fixes 2009-01-09 10:53:13 +0100 rene r266062 : #i10000# ENABLE_REPORTBUILDER also in set_soenv.in, fix typo 2009-01-09 10:40:24 +0100 rene r266060 : #i10000# configure fix for new reportbuilder module, typo fix at libfonts 2009-01-09 10:01:52 +0100 rene r266055 : #i10000# adapt to current configure.in 2009-01-09 09:59:32 +0100 oj r266054 : add new pentaho jars 2009-01-09 09:47:54 +0100 oj r266049 : merge changes from DEV300_m39 2009-01-09 09:14:08 +0100 oj r266048 : merge from DEV300_m39 2009-01-09 08:28:43 +0100 oj r266045 : merge changes from dba31g 2009-01-09 07:58:10 +0100 oj r266044 : replace JCOMMON with LIB 2009-01-08 13:42:24 +0100 oj r266005 : move ext to reportbuilder 2009-01-08 13:41:38 +0100 oj r266004 : add dep for license 2009-01-08 13:27:56 +0100 oj r266001 : new module for Sun report Builder extension 2009-01-07 12:58:13 +0100 oj r265960 : CWS-TOOLING: rebase CWS rptfix04 to trunk@265758 (milestone: DEV300:m38) 2008-12-15 13:47:18 +0100 oj r265481 : new pentaho resources 2008-12-15 10:04:01 +0100 oj r265462 : integrate new pentaho sources 2008-12-15 10:02:54 +0100 oj r265461 : #i96888# fix date time function 2008-12-12 09:23:29 +0100 oj r265389 : #97174# check of res < 0 removed 2008-12-12 09:15:54 +0100 oj r265388 : #i9716# fix for DayFunction 2008-12-11 12:24:24 +0100 oj r265281 : integrate new pentaho sources 2008-12-11 11:49:16 +0100 oj r265273 : integrate new pentaho sources 2008-12-11 09:34:07 +0100 oj r265248 : integrate new pentaho sources 2008-12-10 18:58:06 +0100 oj r265227 : introduce new pentaho sources 2008-12-10 18:56:43 +0100 oj r265226 : introduce new pentaho sources 2008-12-10 18:54:26 +0100 oj r265225 : introduce new pentaho sources 2008-12-10 18:42:59 +0100 oj r265221 : introduce new pentaho sources 2008-12-10 17:24:23 +0100 oj r265212 : introduce new pentaho sources 2008-12-10 17:24:07 +0100 oj r265211 : new pentaho sources 2008-12-10 17:23:00 +0100 oj r265210 : introduce new pentaho sources --- .../java/com/sun/star/report/DataRow.java | 49 + .../java/com/sun/star/report/DataSource.java | 51 + .../com/sun/star/report/DataSourceException.java | 97 ++ .../com/sun/star/report/DataSourceFactory.java | 46 + .../java/com/sun/star/report/ImageService.java | 62 + .../java/com/sun/star/report/InputRepository.java | 85 + .../sun/star/report/JobDefinitionException.java | 67 + .../com/sun/star/report/JobProgressIndicator.java | 81 + .../java/com/sun/star/report/JobProperties.java | 48 + .../java/com/sun/star/report/OfficeToken.java | 64 + .../java/com/sun/star/report/OutputRepository.java | 73 + .../java/com/sun/star/report/ParameterMap.java | 71 + .../java/com/sun/star/report/ReportAddIn.java | 48 + .../java/com/sun/star/report/ReportEngine.java | 58 + .../com/sun/star/report/ReportEngineMetaData.java | 62 + .../star/report/ReportEngineParameterNames.java | 58 + .../sun/star/report/ReportExecutionException.java | 90 ++ .../java/com/sun/star/report/ReportExpression.java | 54 + .../sun/star/report/ReportExpressionMetaData.java | 50 + .../java/com/sun/star/report/ReportFunction.java | 47 + .../java/com/sun/star/report/ReportJob.java | 92 ++ .../com/sun/star/report/ReportJobDefinition.java | 60 + .../java/com/sun/star/report/ReportJobFactory.java | 44 + .../java/com/sun/star/report/SDBCReportData.java | 375 +++++ .../com/sun/star/report/SDBCReportDataFactory.java | 645 ++++++++ .../java/com/sun/star/report/SOImageService.java | 182 +++ .../com/sun/star/report/StorageRepository.java | 339 ++++ .../function/metadata/Author-Function.properties | 33 + .../metadata/Author-Function_en_US.properties | 33 + .../report/function/metadata/AuthorFunction.java | 67 + .../metadata/AuthorFunctionDescription.java | 74 + .../metadata/MetaDataFunctionCategory.java | 49 + .../function/metadata/Title-Function.properties | 33 + .../metadata/Title-Function_en_US.properties | 33 + .../report/function/metadata/TitleFunction.java | 67 + .../metadata/TitleFunctionDescription.java | 74 + .../report/function/metadata/category.properties | 33 + .../function/metadata/category_en_US.properties | 33 + .../sun/star/report/function/metadata/makefile.mk | 68 + reportbuilder/java/com/sun/star/report/makefile.mk | 78 + .../star/report/pentaho/DefaultNameGenerator.java | 149 ++ .../java/com/sun/star/report/pentaho/Manifest.mf | 7 + .../sun/star/report/pentaho/OfficeNamespaces.java | 74 + .../star/report/pentaho/PentahoFormulaContext.java | 99 ++ .../star/report/pentaho/PentahoReportAddIn.java | 63 + .../star/report/pentaho/PentahoReportEngine.java | 74 + .../pentaho/PentahoReportEngineMetaData.java | 146 ++ .../sun/star/report/pentaho/PentahoReportJob.java | 396 +++++ .../star/report/pentaho/SOFormulaOpCodeMapper.java | 155 ++ .../sun/star/report/pentaho/SOFormulaParser.java | 429 +++++ .../sun/star/report/pentaho/SOFunctionManager.java | 198 +++ .../star/report/pentaho/SOReportJobFactory.java | 437 ++++++ .../star/report/pentaho/StarFunctionCategory.java | 162 ++ .../report/pentaho/StarFunctionDescription.java | 191 +++ .../sun/star/report/pentaho/StarReportData.java | 170 ++ .../star/report/pentaho/StarReportDataFactory.java | 126 ++ .../sun/star/report/pentaho/StarReportModule.java | 62 + .../star/report/pentaho/configuration.properties | 158 ++ .../report/pentaho/expressions/SumExpression.java | 60 + .../pentaho/expressions/SumExpressionMetaData.java | 81 + .../AbstractReportElementLayoutController.java | 270 ++++ .../layoutprocessor/FixedTextLayoutController.java | 91 ++ .../layoutprocessor/FormatValueUtility.java | 166 ++ .../FormattedTextLayoutController.java | 217 +++ .../layoutprocessor/ImageElementContext.java | 94 ++ .../ImageElementLayoutController.java | 332 ++++ .../layoutprocessor/ObjectOleLayoutController.java | 126 ++ .../OfficeDetailLayoutController.java | 164 ++ ...OfficeGroupInstanceSectionLayoutController.java | 160 ++ .../OfficeGroupLayoutController.java | 209 +++ .../OfficeGroupSectionLayoutController.java | 115 ++ .../OfficePageSectionLayoutController.java | 29 + .../OfficeRepeatingStructureLayoutController.java | 48 + .../OfficeReportLayoutController.java | 277 ++++ .../OfficeTableLayoutController.java | 82 + .../OfficeTableTemplateLayoutController.java | 191 +++ .../layoutprocessor/TableCellLayoutController.java | 193 +++ .../layoutprocessor/VariablesCollection.java | 103 ++ .../VariablesDeclarationLayoutController.java | 190 +++ .../pentaho/loader/InputRepositoryLoader.java | 172 ++ .../loader/InputRepositoryResourceData.java | 88 ++ .../report/pentaho/loader/InputResourceKey.java | 71 + .../java/com/sun/star/report/pentaho/makefile.mk | 124 ++ .../sun/star/report/pentaho/model/DataStyle.java | 60 + .../report/pentaho/model/FixedTextElement.java | 56 + .../report/pentaho/model/FontFaceDeclsSection.java | 78 + .../star/report/pentaho/model/FontFaceElement.java | 60 + .../star/report/pentaho/model/FormatCondition.java | 72 + .../report/pentaho/model/FormattedTextElement.java | 63 + .../star/report/pentaho/model/ImageElement.java | 86 + .../report/pentaho/model/ObjectOleElement.java | 82 + .../report/pentaho/model/OfficeDetailSection.java | 47 + .../star/report/pentaho/model/OfficeDocument.java | 74 + .../sun/star/report/pentaho/model/OfficeGroup.java | 99 ++ .../pentaho/model/OfficeGroupInstanceSection.java | 15 + .../report/pentaho/model/OfficeGroupSection.java | 56 + .../report/pentaho/model/OfficeMasterPage.java | 72 + .../report/pentaho/model/OfficeMasterStyles.java | 87 ++ .../star/report/pentaho/model/OfficeReport.java | 131 ++ .../sun/star/report/pentaho/model/OfficeStyle.java | 134 ++ .../star/report/pentaho/model/OfficeStyles.java | 199 +++ .../pentaho/model/OfficeStylesCollection.java | 126 ++ .../report/pentaho/model/OfficeTableSection.java | 46 + .../sun/star/report/pentaho/model/PageLayout.java | 72 + .../sun/star/report/pentaho/model/PageSection.java | 62 + .../com/sun/star/report/pentaho/model/RawText.java | 50 + .../star/report/pentaho/model/ReportElement.java | 115 ++ .../report/pentaho/model/TableCellElement.java | 48 + .../pentaho/model/VariablesDeclarationSection.java | 57 + .../com/sun/star/report/pentaho/module.properties | 48 + .../sun/star/report/pentaho/oasis-datastyle.css | 5 + .../com/sun/star/report/pentaho/oasis-draw.css | 5 + .../com/sun/star/report/pentaho/oasis-form.css | 5 + .../com/sun/star/report/pentaho/oasis-style.css | 10 + .../com/sun/star/report/pentaho/oasis-table.css | 37 + .../com/sun/star/report/pentaho/oasis-text.css | 9 + .../star/report/pentaho/output/ImageProducer.java | 458 ++++++ .../pentaho/output/OfficeDocumentReportTarget.java | 1641 ++++++++++++++++++++ .../star/report/pentaho/output/OleProducer.java | 121 ++ .../star/report/pentaho/output/StyleUtilities.java | 611 ++++++++ .../star/report/pentaho/output/StylesWriter.java | 374 +++++ .../output/chart/ChartRawReportProcessor.java | 107 ++ .../pentaho/output/chart/ChartRawReportTarget.java | 256 +++ .../spreadsheet/SpreadsheetRawReportProcessor.java | 122 ++ .../spreadsheet/SpreadsheetRawReportTarget.java | 942 +++++++++++ .../pentaho/output/text/MasterPageFactory.java | 423 +++++ .../pentaho/output/text/PageBreakDefinition.java | 52 + .../report/pentaho/output/text/PageContext.java | 239 +++ .../output/text/TextRawReportProcessor.java | 117 ++ .../pentaho/output/text/TextRawReportTarget.java | 1517 ++++++++++++++++++ .../pentaho/output/text/VariablesDeclarations.java | 110 ++ .../pentaho/parser/AttributeSpecification.java | 61 + .../report/pentaho/parser/ElementReadHandler.java | 92 ++ .../parser/OfficeDocumentXmlResourceFactory.java | 56 + .../report/pentaho/parser/OfficeParserUtil.java | 190 +++ .../parser/OfficeStylesXmlResourceFactory.java | 64 + .../pentaho/parser/StarStyleXmlFactoryModule.java | 65 + .../pentaho/parser/StarXmlFactoryModule.java | 65 + .../star/report/pentaho/parser/StyleMapper.java | 42 + .../pentaho/parser/chart/ChartReadHandler.java | 112 ++ .../pentaho/parser/data/DataStyleReadHandler.java | 129 ++ .../pentaho/parser/draw/ObjectOleReadHandler.java | 84 + .../pentaho/parser/office/BodyReadHandler.java | 91 ++ .../parser/office/DocumentContentReadHandler.java | 234 +++ .../parser/office/DocumentStylesReadHandler.java | 110 ++ .../parser/office/FontFaceDeclsReadHandler.java | 119 ++ .../parser/office/MasterStylesReadHandler.java | 124 ++ .../report/pentaho/parser/rpt-schema-v1.0-os.xsd | 418 +++++ .../rpt/ConditionalPrintExpressionReadHandler.java | 85 + .../parser/rpt/DetailRootTableReadHandler.java | 41 + .../parser/rpt/FixedContentReadHandler.java | 98 ++ .../parser/rpt/FormatConditionReadHandler.java | 100 ++ .../parser/rpt/FormattedTextReadHandler.java | 118 ++ .../pentaho/parser/rpt/FunctionReadHandler.java | 116 ++ .../pentaho/parser/rpt/GroupReadHandler.java | 181 +++ .../parser/rpt/GroupSectionReadHandler.java | 41 + .../pentaho/parser/rpt/ImageReadHandler.java | 141 ++ .../parser/rpt/MasterDetailReadHandler.java | 109 ++ .../parser/rpt/ReportElementReadHandler.java | 109 ++ .../pentaho/parser/rpt/ReportReadHandler.java | 237 +++ .../pentaho/parser/rpt/RootTableReadHandler.java | 105 ++ .../pentaho/parser/rpt/SubDocumentReadHandler.java | 137 ++ .../report/pentaho/parser/selectors.properties | 116 ++ .../star/report/pentaho/parser/style-mapping.txt | 8 + .../pentaho/parser/style/FontFaceReadHandler.java | 59 + .../parser/style/MasterPageReadHandler.java | 107 ++ .../parser/style/OfficeStyleReadHandler.java | 106 ++ .../parser/style/OfficeStylesReadHandler.java | 143 ++ .../parser/style/PageLayoutReadHandler.java | 105 ++ .../parser/style/StyleDefinitionReadHandler.java | 101 ++ .../parser/stylemapper/OneOfConstantsMapper.java | 78 + .../draw/TextAreaVerticalAlignMapper.java | 48 + .../stylemapper/fo/BackgroundColorMapper.java | 56 + .../parser/stylemapper/fo/BorderRightMapper.java | 62 + .../pentaho/parser/stylemapper/fo/ColorMapper.java | 54 + .../parser/stylemapper/fo/FontSizeMapper.java | 48 + .../parser/stylemapper/fo/FontStyleMapper.java | 49 + .../parser/stylemapper/fo/FontWeightMapper.java | 49 + .../parser/stylemapper/fo/TextAlignMapper.java | 51 + .../stylemapper/style/FontFamilyGenericMapper.java | 64 + .../parser/stylemapper/style/FontFamilyMapper.java | 64 + .../parser/stylemapper/style/FontNameMapper.java | 52 + .../parser/stylemapper/style/FontPitchMapper.java | 46 + .../parser/stylemapper/style/FontReliefMapper.java | 50 + .../stylemapper/style/TextEmphasizeMapper.java | 49 + .../style/TextUnderlineColorMapper.java | 57 + .../style/TextUnderlineStyleMapper.java | 55 + .../style/TextUnderlineWidthMapper.java | 78 + .../stylemapper/style/TextUnderlineWordMode.java | 48 + .../stylemapper/style/VerticalAlignMapper.java | 50 + .../stylemapper/table/ColumnWidthMapper.java | 55 + .../parser/stylemapper/table/RowHeightMapper.java | 55 + .../parser/table/CoveredCellReadHandler.java | 56 + .../pentaho/parser/table/TableCellReadHandler.java | 49 + .../parser/table/TableColumnReadHandler.java | 54 + .../parser/table/TableColumnsReadHandler.java | 102 ++ .../pentaho/parser/table/TableReadHandler.java | 144 ++ .../pentaho/parser/table/TableRowReadHandler.java | 125 ++ .../pentaho/parser/table/TableRowsReadHandler.java | 101 ++ .../parser/text/NoCDATATextContentReadHandler.java | 164 ++ .../parser/text/TextContentReadHandler.java | 72 + .../pentaho/parser/xlink/XLinkReadHandler.java | 98 ++ .../java/com/sun/star/report/pentaho/smil.css | 5 + .../com/sun/star/report/pentaho/star-office.css | 5 + .../com/sun/star/report/pentaho/star-report.css | 73 + .../java/com/sun/star/report/pentaho/star-rpt.css | 5 + .../report/pentaho/styles/LengthCalculator.java | 116 ++ .../star/report/pentaho/styles/StyleMapper.java | 106 ++ .../star/report/pentaho/styles/StyleMapperKey.java | 123 ++ .../styles/StyleMapperXmlFactoryModule.java | 74 + .../styles/StyleMapperXmlResourceFactory.java | 59 + .../styles/StyleMappingDocumentReadHandler.java | 108 ++ .../pentaho/styles/StyleMappingReadHandler.java | 109 ++ .../report/pentaho/styles/StyleMappingRule.java | 70 + .../sun/star/report/pentaho/styles/stylemapper.xml | 172 ++ .../sun/star/report/pentaho/styles/stylemapper.xsd | 95 ++ .../java/com/sun/star/report/pentaho/svg.css | 5 + .../java/com/sun/star/report/pentaho/xsl-fo.css | 5 + .../sun/star/report/util/DefaultJobProperties.java | 83 + .../sun/star/report/util/DefaultParameterMap.java | 129 ++ .../report/util/DefaultReportJobDefinition.java | 123 ++ .../com/sun/star/report/util/ManifestWriter.java | 122 ++ .../java/com/sun/star/report/util/ReportUtil.java | 45 + .../java/com/sun/star/report/util/makefile.mk | 49 + 224 files changed, 27961 insertions(+) create mode 100644 reportbuilder/java/com/sun/star/report/DataRow.java create mode 100644 reportbuilder/java/com/sun/star/report/DataSource.java create mode 100644 reportbuilder/java/com/sun/star/report/DataSourceException.java create mode 100644 reportbuilder/java/com/sun/star/report/DataSourceFactory.java create mode 100644 reportbuilder/java/com/sun/star/report/ImageService.java create mode 100644 reportbuilder/java/com/sun/star/report/InputRepository.java create mode 100644 reportbuilder/java/com/sun/star/report/JobDefinitionException.java create mode 100644 reportbuilder/java/com/sun/star/report/JobProgressIndicator.java create mode 100644 reportbuilder/java/com/sun/star/report/JobProperties.java create mode 100644 reportbuilder/java/com/sun/star/report/OfficeToken.java create mode 100644 reportbuilder/java/com/sun/star/report/OutputRepository.java create mode 100644 reportbuilder/java/com/sun/star/report/ParameterMap.java create mode 100644 reportbuilder/java/com/sun/star/report/ReportAddIn.java create mode 100644 reportbuilder/java/com/sun/star/report/ReportEngine.java create mode 100644 reportbuilder/java/com/sun/star/report/ReportEngineMetaData.java create mode 100644 reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java create mode 100644 reportbuilder/java/com/sun/star/report/ReportExecutionException.java create mode 100644 reportbuilder/java/com/sun/star/report/ReportExpression.java create mode 100644 reportbuilder/java/com/sun/star/report/ReportExpressionMetaData.java create mode 100644 reportbuilder/java/com/sun/star/report/ReportFunction.java create mode 100644 reportbuilder/java/com/sun/star/report/ReportJob.java create mode 100644 reportbuilder/java/com/sun/star/report/ReportJobDefinition.java create mode 100644 reportbuilder/java/com/sun/star/report/ReportJobFactory.java create mode 100644 reportbuilder/java/com/sun/star/report/SDBCReportData.java create mode 100644 reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java create mode 100644 reportbuilder/java/com/sun/star/report/SOImageService.java create mode 100644 reportbuilder/java/com/sun/star/report/StorageRepository.java create mode 100644 reportbuilder/java/com/sun/star/report/function/metadata/Author-Function.properties create mode 100644 reportbuilder/java/com/sun/star/report/function/metadata/Author-Function_en_US.properties create mode 100644 reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java create mode 100644 reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunctionDescription.java create mode 100644 reportbuilder/java/com/sun/star/report/function/metadata/MetaDataFunctionCategory.java create mode 100644 reportbuilder/java/com/sun/star/report/function/metadata/Title-Function.properties create mode 100644 reportbuilder/java/com/sun/star/report/function/metadata/Title-Function_en_US.properties create mode 100644 reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java create mode 100644 reportbuilder/java/com/sun/star/report/function/metadata/TitleFunctionDescription.java create mode 100644 reportbuilder/java/com/sun/star/report/function/metadata/category.properties create mode 100644 reportbuilder/java/com/sun/star/report/function/metadata/category_en_US.properties create mode 100644 reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk create mode 100644 reportbuilder/java/com/sun/star/report/makefile.mk create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/PentahoReportAddIn.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngine.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/StarReportData.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/StarReportModule.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/configuration.properties create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java create mode 100755 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementContext.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupInstanceSectionLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficePageSectionLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeRepeatingStructureLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/loader/InputResourceKey.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/makefile.mk create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/FormattedTextElement.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDetailSection.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupInstanceSection.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/OfficeTableSection.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/PageSection.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/module.properties create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/oasis-datastyle.css create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/oasis-draw.css create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/oasis-form.css create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/oasis-style.css create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/oasis-table.css create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/oasis-text.css create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportProcessor.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportTarget.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/text/MasterPageFactory.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/text/PageBreakDefinition.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/text/PageContext.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/output/text/VariablesDeclarations.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/AttributeSpecification.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/ElementReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/StyleMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/chart/ChartReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/data/DataStyleReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/office/BodyReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/office/MasterStylesReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ConditionalPrintExpressionReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/DetailRootTableReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FixedContentReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormatConditionReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FunctionReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupSectionReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ImageReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/RootTableReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/SubDocumentReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/selectors.properties create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/style-mapping.txt create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/BackgroundColorMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/BorderRightMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/ColorMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/table/CoveredCellReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableCellReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowsReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/text/NoCDATATextContentReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/text/TextContentReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/parser/xlink/XLinkReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/smil.css create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/star-office.css create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/star-report.css create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/star-rpt.css create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/styles/LengthCalculator.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xml create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xsd create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/svg.css create mode 100644 reportbuilder/java/com/sun/star/report/pentaho/xsl-fo.css create mode 100644 reportbuilder/java/com/sun/star/report/util/DefaultJobProperties.java create mode 100644 reportbuilder/java/com/sun/star/report/util/DefaultParameterMap.java create mode 100644 reportbuilder/java/com/sun/star/report/util/DefaultReportJobDefinition.java create mode 100644 reportbuilder/java/com/sun/star/report/util/ManifestWriter.java create mode 100644 reportbuilder/java/com/sun/star/report/util/ReportUtil.java create mode 100644 reportbuilder/java/com/sun/star/report/util/makefile.mk (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/DataRow.java b/reportbuilder/java/com/sun/star/report/DataRow.java new file mode 100644 index 000000000000..1875578213ed --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/DataRow.java @@ -0,0 +1,49 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: DataRow.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +/** + * This feeds data into the reporting engine, in case the data has been provided + * by the caller. The methods are a mix of TableModel methods and methods borrowed + * from the java.sql.ResultSet interface. + * + * The column and row index starts at 1 (as it is done in JDBC). + * + * @author Thomas Morgner + */ +public interface DataRow +{ + + public int getColumnCount() throws DataSourceException; + + public String getColumnName(int column) throws DataSourceException; + + public 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 new file mode 100644 index 000000000000..20f83a8a7798 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/DataSource.java @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: DataSource.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +/** + * This feeds data into the reporting engine, in case the data has been provided + * by the caller. The methods are a mix of TableModel methods and methods borrowed + * from the java.sql.ResultSet interface. + * + * The column and row index starts at 1 (as it is done in JDBC). + * + * @author Thomas Morgner + */ +public interface DataSource extends DataRow +{ + + public int getRowCount() throws DataSourceException; + + public boolean absolute(int row) throws DataSourceException; + + public boolean next() throws DataSourceException; + + public void close() throws DataSourceException; +} diff --git a/reportbuilder/java/com/sun/star/report/DataSourceException.java b/reportbuilder/java/com/sun/star/report/DataSourceException.java new file mode 100644 index 000000000000..cbb6b394f914 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/DataSourceException.java @@ -0,0 +1,97 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: DataSourceException.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +/** + * A general exception to indicate that there was an error while accessing the + * datasource. + * + * @author Thomas Morgner + */ +public class DataSourceException extends Exception +{ + + /** + * Constructs a new exception with null as its detail message. + * The cause is not initialized, and may subsequently be initialized by a call + * to {@link #initCause}. + */ + public DataSourceException() + { + super(); + } + + /** + * Constructs a new exception with the specified detail message. The cause is + * not initialized, and may subsequently be initialized by a call to {@link + * #initCause}. + * + * @param message the detail message. The detail message is saved for later + * retrieval by the {@link #getMessage()} method. + */ + public DataSourceException(String message) + { + super(message); + } + + /** + * Constructs a new exception with the specified detail message and cause. + *

Note that the detail message associated with cause is + * not automatically incorporated in this exception's detail message. + * + * @param message the detail message (which is saved for later retrieval by + * the {@link #getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the {@link + * #getCause()} method). (A null value is permitted, + * and indicates that the cause is nonexistent or unknown.) + * @since 1.4 + */ + public DataSourceException(String message, Throwable cause) + { + super(message, cause); + } + + /** + * Constructs a new exception with the specified cause and a detail message of + * (cause==null ? null : cause.toString()) (which typically contains + * the class and detail message of cause). This constructor is useful + * for exceptions that are little more than wrappers for other throwables (for + * example, {@link PrivilegedActionException}). + * + * @param cause the cause (which is saved for later retrieval by the {@link + * #getCause()} method). (A null value is permitted, + * and indicates that the cause is nonexistent or unknown.) + * @since 1.4 + */ + public DataSourceException(Throwable cause) + { + super(cause); + } +} diff --git a/reportbuilder/java/com/sun/star/report/DataSourceFactory.java b/reportbuilder/java/com/sun/star/report/DataSourceFactory.java new file mode 100644 index 000000000000..01a64436e7c0 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/DataSourceFactory.java @@ -0,0 +1,46 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: DataSourceFactory.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +import java.util.Map; + +/** + * Allows to query the data repository and returns a datasource for the + * specified name and parameters. The parameters-map can be null, if there + * are no parameters required. + * + * @author Thomas Morgner + */ +public interface DataSourceFactory +{ + + public DataSource queryData(String name, Map parameter) + throws DataSourceException; +} diff --git a/reportbuilder/java/com/sun/star/report/ImageService.java b/reportbuilder/java/com/sun/star/report/ImageService.java new file mode 100644 index 000000000000..e0b558933703 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/ImageService.java @@ -0,0 +1,62 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ImageService.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +import java.io.InputStream; +import java.awt.Dimension; + +/** + * + * @author oj93728 + */ +public interface ImageService +{ + + /** + * @return the mime-type of the image as string. + */ + public String getMimeType(final InputStream image) throws ReportExecutionException; + + /** + * @return the mime-type of the image as string. + */ + public String getMimeType(final byte[] image) throws ReportExecutionException; + + /** + * @returns the dimension in 100th mm. + **/ + public Dimension getImageSize(final InputStream image) throws ReportExecutionException; + + /** + * @returns the dimension in 100th mm. + **/ + public 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 new file mode 100644 index 000000000000..5ee660f9d03a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/InputRepository.java @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: InputRepository.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +import java.io.InputStream; +import java.io.IOException; + +/** + * This allows the job processor to load data from a repository. It is assumed, + * that all resource names are given as strings and furthermore, that the names + * identify a resource uniquely within the input repository. + * + * An input repository connects the report processing to the xml definitions. + * Unless defined otherwise, it is assumed, that the input-name is 'content.xml'; + * possible other files are 'settings.xml' and 'styles.xml' (see the Oasis standard + * for details on these files and their contents). + * + * @author Thomas Morgner + */ +public interface InputRepository +{ + + /** + * Returns a unique identifier for this repository. Two repositories accessing + * the same location should return the same id. The identifier must never + * be null. + * + * @return the repository id + */ + public Object getId(); + + public InputStream createInputStream(final String name) throws IOException; + + /** allows to acces sub repositories inside this repository + * + * @param name describes the path to the sub repository + * @return the sub repository + * @throws java.io.IOException when the sub repository doesn't exist. + */ + public InputRepository openInputRepository(final String name) throws IOException; + + /** + * This returns an version number for the given resource. Return zero, if + * the resource is not versionable, else return a unique number for each version. + * As rule of thumb: Increase the version number by at least one for each change + * made to the resource. + * + * @param name the name of the resource + * @return the version number + */ + public long getVersion(final String name); + + public boolean exists(final String name); + + public boolean isReadable(final String name); + + public void closeInputRepository(); +} diff --git a/reportbuilder/java/com/sun/star/report/JobDefinitionException.java b/reportbuilder/java/com/sun/star/report/JobDefinitionException.java new file mode 100644 index 000000000000..74a33077fcf8 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/JobDefinitionException.java @@ -0,0 +1,67 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: JobDefinitionException.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +/** + * Creation-Date: 05.02.2006, 17:36:33 + * + * @author Thomas Morgner + */ +public class JobDefinitionException extends RuntimeException +{ + + /** + * Creates a StackableRuntimeException with no message and no parent. + */ + public JobDefinitionException() + { + } + + /** + * Creates an exception. + * + * @param message the exception message. + */ + public JobDefinitionException(final String message) + { + super(message); + } + + /** + * Creates an exception. + * + * @param message the exception message. + * @param ex the parent exception. + */ + public JobDefinitionException(final String message, final Exception ex) + { + super(message, ex); + } +} diff --git a/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java b/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java new file mode 100644 index 000000000000..00dcdecc9a8d --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: JobProgressIndicator.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +/** + * Based on + * http://api.openoffice.org/docs/common/ref/com/sun/star/task/XStatusIndicator.html + * + * @author Thomas Morgner + */ +public interface JobProgressIndicator +{ + + /** + * Updates the progress description. + * + * @param string the new description + */ + public void setText(String string); + + /** + * Initializes the progress indicator and sets the progress description to + * the text given in the parameter text. The progress values + * passed to this indicator will not exceed the given maxValue. + * The value range of this indicator is set to 0 to maxValue + * Stopped indicators must ignore that call. + * + * @param string the progress description + * @param maxValue the maximum value + * @see JobProgressIndicator#setText(String) + */ + public void start(String text, int maxValue); + + /** + * Updates the value to the specified value. Invalid values must be ignored. + * Stopped indicators must ignore that call. + * + * @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); + + /** + * Stop the progress. A progress indicator cannot be destructed before end() + * has been called. + */ + public 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(); +} diff --git a/reportbuilder/java/com/sun/star/report/JobProperties.java b/reportbuilder/java/com/sun/star/report/JobProperties.java new file mode 100644 index 000000000000..b0fcff494b87 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/JobProperties.java @@ -0,0 +1,48 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: JobProperties.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +public interface JobProperties +{ + + public void setProperty(String key, Object value) + throws JobDefinitionException; + + public Object getProperty(String key); + + /** + * A type safe clone operation. We derive a copy of all properties, + * so that changes to the original job properties collection does not + * affect the copy. + * + * @return a copy. + */ + public JobProperties copy(); +} diff --git a/reportbuilder/java/com/sun/star/report/OfficeToken.java b/reportbuilder/java/com/sun/star/report/OfficeToken.java new file mode 100644 index 000000000000..5649abdac863 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/OfficeToken.java @@ -0,0 +1,64 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeToken.java,v $ + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package com.sun.star.report; + +/** + * + * @author Ocke Janssen + */ +public class OfficeToken { + public static final String GRAPHIC = "graphic"; + public static final String GRAPHICS = "Graphics"; + public static final String GRAPHIC_PROPERTIES = "graphic-properties"; + public static final String PARAGRAPH = "paragraph"; + public static final String TRUE = "true"; + public static final String FALSE = "false"; + public static final String FRAME = "frame"; + public static final String STYLE_NAME = "style-name"; + public static final String BACKGROUND_COLOR = "background-color"; + public static final String COVERED_TABLE_CELL = "covered-table-cell"; + public static final String TABLE = "table"; + public static final String TABLE_COLUMN = "table-column"; + public static final String TABLE_COLUMNS = "table-columns"; + public static final String TABLE_HEADER_COLUMNS = "table-header-columns"; + public static final String TABLE_HEADER_ROWS = "table-header-rows"; + public static final String TABLE_ROWS = "table-rows"; + public static final String TABLE_ROW = "table-row"; + public static final String TABLE_CELL = "table-cell"; + public static final String P = "p"; + public static final String OBJECT_OLE = "object-ole"; + public static final String IMAGE = "image"; + public static final String IMAGE_DATA = "image-data"; + public static final String PRESERVE_IRI = "preserve-IRI"; + public static final String SCALE = "scale"; + public static final String NAME = "name"; + public static final String SHAPES = "shapes"; +} diff --git a/reportbuilder/java/com/sun/star/report/OutputRepository.java b/reportbuilder/java/com/sun/star/report/OutputRepository.java new file mode 100644 index 000000000000..915ca1b88324 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/OutputRepository.java @@ -0,0 +1,73 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OutputRepository.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +import java.io.OutputStream; +import java.io.IOException; + +/** + * A repository for writing. Providing a repository always assumes, + * that more than one stream can be written. + * + * @author Thomas Morgner + */ +public interface OutputRepository +{ + + /** + * Creates an output stream for writing the data. If there is an entry with + * that name already contained in the repository, try to overwrite it. + * + * @param name + * the name of the output stream + * @param mimeType + * the mime type of the to-be-created output stream. Repository implementations which do not support + * associating a mime time with a stream might ignore this parameter. + * @return the outputstream + * @throws IOException if opening the stream fails + */ + public OutputStream createOutputStream(final String name, final String mimeType) throws IOException; + + /** allows to acces sub repositories inside this repository + * + * @param name describes the path to the sub repository + * @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; + + public boolean exists(final String name); + + public boolean existsStorage(final String name); + + public boolean isWritable(final String name); + + public void closeOutputRepository(); +} diff --git a/reportbuilder/java/com/sun/star/report/ParameterMap.java b/reportbuilder/java/com/sun/star/report/ParameterMap.java new file mode 100644 index 000000000000..cf3aed4de598 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/ParameterMap.java @@ -0,0 +1,71 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ParameterMap.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +public interface ParameterMap +{ + + /** + * Adds a property to this properties collection. If a property with the given name + * exist, the property will be replaced with the new value. If the value is null, the + * property will be removed. + * + * @param key the property key. + * @param value the property value. + */ + public void put(final String key, final Object value); + + /** + * Retrieves the value stored for a key in this properties collection. + * + * @param key the property key. + * @return The stored value, or null if the key does not exist in this + * collection. + */ + public Object get(final String key); + + /** + * Retrieves the value stored for a key in this properties collection, and returning the + * default value if the key was not stored in this properties collection. + * + * @param key the property key. + * @param defaultValue the default value to be returned when the key is not stored in + * this properties collection. + * @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); + + public String[] keys(); + + public void clear(); + + public int size(); +} diff --git a/reportbuilder/java/com/sun/star/report/ReportAddIn.java b/reportbuilder/java/com/sun/star/report/ReportAddIn.java new file mode 100644 index 000000000000..6057a1e20eb2 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/ReportAddIn.java @@ -0,0 +1,48 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportAddIn.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +/** + * A report add-in defines a set of expressions, which can + * be used in the reporting. + * + * Each expression must provide meta-data to support GUI implementors. + * Expressions are assumed to be statefull, if they are not, they are + * free to be implemented as stateless expression. + */ +public interface ReportAddIn +{ + + public int getExpressionCount(); + + public ReportExpression createExpression(int expression); + + public ReportExpressionMetaData getMetaData(int expression); +} diff --git a/reportbuilder/java/com/sun/star/report/ReportEngine.java b/reportbuilder/java/com/sun/star/report/ReportEngine.java new file mode 100644 index 000000000000..549f5bb224c7 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/ReportEngine.java @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportEngine.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +/** + * The job factory collects all required properties to build a reportJob + * object. Implementors should define a suitable set of properties to allow + * the configuration of the created report jobs. + * + * How these properties are collected is beyond the scope of this interface. + * For each type of Job, there should be separate job-factory (remote jobs + * vs. local jobs etc). + * + * @author Thomas Morgner + */ +public interface ReportEngine +{ + + public ReportJobDefinition createJobDefinition(); + + public ReportEngineMetaData getMetaData(); + + /** + * Open points: How to define scheduling? + * + * @return the report job definition for the job description. + * @throws JobDefinitionException + */ + public ReportJob createJob(ReportJobDefinition definition) + throws JobDefinitionException; +} diff --git a/reportbuilder/java/com/sun/star/report/ReportEngineMetaData.java b/reportbuilder/java/com/sun/star/report/ReportEngineMetaData.java new file mode 100644 index 000000000000..486a58053e51 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/ReportEngineMetaData.java @@ -0,0 +1,62 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportEngineMetaData.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +public interface ReportEngineMetaData +{ + + /** + * Checks, whether a certain output type is available. + * Feed the mime-type of the output type in and you'll get + * a true or false back. + * + * @param mimeType + * @return true, if the output type is supported; false otherwise. + */ + public boolean isOutputSupported(String mimeType); + + /** + * Lists all supported output parameters for the given mime-type. + * This listing can be used to build a generic user interface for + * configuring a certain output. + * + * @param mimeType + * @return + */ + public String[] getOutputParameters(String mimeType); + + public Class getParameterType(String parameter); + + public boolean isMandatory(String parameter); + + public boolean isEnumeration(String parameter); + + public Object[] getEnumerationValues(String parameter); +} diff --git a/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java b/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java new file mode 100644 index 000000000000..4b0002ba8d8c --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportEngineParameterNames.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report; + +/** + * Making this enumeration typesafe and fully defined here would + * be nice, wouldn't it? + */ +public class ReportEngineParameterNames +{ + public static final String CONTENT_TYPE = "content-type"; + public static final String INPUT_NAME= "input.name"; + public static final String INPUT_REPOSITORY = "input.repository"; + public static final String OUTPUT_NAME= "output.name"; + public static final String OUTPUT_REPOSITORY = "output.repository"; + public static final String INPUT_DATASOURCE_FACTORY = "input.datasource-factory"; + public static final String IMAGE_SERVICE = "ImageService"; + public static final String INPUT_REPORTJOB_FACTORY = "input.reportjob-factory"; + public static final String INPUT_MASTER_COLUMNS = "input.master-columns"; + public static final String INPUT_MASTER_VALUES = "input.master-values"; + public static final String INPUT_DETAIL_COLUMNS = "input.detail-columns"; + public static final String MIMETYPE = "output.mimetype"; + public static final String AUTHOR = "Author"; + public static final String TITLE = "Title"; + + private ReportEngineParameterNames () + { + } +} diff --git a/reportbuilder/java/com/sun/star/report/ReportExecutionException.java b/reportbuilder/java/com/sun/star/report/ReportExecutionException.java new file mode 100644 index 000000000000..55ba51e4a61e --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/ReportExecutionException.java @@ -0,0 +1,90 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportExecutionException.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report; + +public class ReportExecutionException extends Exception +{ + /** + * Constructs a new exception with null as its detail message. The cause is + * not initialized, and may subsequently be initialized by a call to {@link + * #initCause}. + */ + public ReportExecutionException () + { + } + + /** + * Constructs a new exception with the specified cause and a detail message of + * (cause==null ? null : cause.toString()) (which typically contains the class + * and detail message of cause). This constructor is useful for exceptions that + * are little more than wrappers for other throwables (for example, {@link + * java.security.PrivilegedActionException}). + * + * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} + * method). (A null value is permitted, and indicates that the + * cause is nonexistent or unknown.) + * @since 1.4 + */ + public ReportExecutionException (Throwable cause) + { + super(cause); + } + + /** + * Constructs a new exception with the specified detail message. The cause is not + * initialized, and may subsequently be initialized by a call to {@link #initCause}. + * + * @param message the detail message. The detail message is saved for later retrieval by + * the {@link #getMessage()} method. + */ + public ReportExecutionException (String message) + { + super(message); + } + + /** + * Constructs a new exception with the specified detail message and cause.

Note that + * the detail message associated with cause is not automatically + * incorporated in this exception's detail message. + * + * @param message the detail message (which is saved for later retrieval by the {@link + * #getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the {@link + * #getCause()} method). (A null value is permitted, and + * indicates that the cause is nonexistent or unknown.) + * @since 1.4 + */ + public ReportExecutionException (String message, Throwable cause) + { + super(message, cause); + } +} diff --git a/reportbuilder/java/com/sun/star/report/ReportExpression.java b/reportbuilder/java/com/sun/star/report/ReportExpression.java new file mode 100644 index 000000000000..c544659f2c4f --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/ReportExpression.java @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportExpression.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report; + +/** + * Expressions are simple computation components. + * + * Expressions are always assumed to be immutable. They are not allowed to + * change their state and it is not guaranteed, in which order they get called. + * If the expression has been called before, the last computed value will be + * available from the datarow. + * + * This construct allows us to write expressions in the form + * "Sum := Sum + Column". + * + * Multiple calls to getValue on the same expression instance must return the + * same value (assuming that the datarow passed in is the same). + */ +public interface ReportExpression +{ + public void setParameters (Object[] parameters); + public Object getParameters (); + + public Object getValue(DataRow row); +} diff --git a/reportbuilder/java/com/sun/star/report/ReportExpressionMetaData.java b/reportbuilder/java/com/sun/star/report/ReportExpressionMetaData.java new file mode 100644 index 000000000000..830ae3927f44 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/ReportExpressionMetaData.java @@ -0,0 +1,50 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportExpressionMetaData.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +import java.util.Locale; + +public interface ReportExpressionMetaData +{ + + public int getParameterCount(); + + public String getParameterName(int param); + + public String getParameterDisplayName(int param, Locale locale); + + public String getParameterDescription(int param, Locale locale); + + public String getName(); + + public String getDisplayName(Locale l); + + public String getDescription(Locale l); +} diff --git a/reportbuilder/java/com/sun/star/report/ReportFunction.java b/reportbuilder/java/com/sun/star/report/ReportFunction.java new file mode 100644 index 000000000000..e7127552cb39 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/ReportFunction.java @@ -0,0 +1,47 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportFunction.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +/** + * Functions are statefull computation components. + * + * Functions are allowed to have a state, but are considered + * immutable (the same is true for expressions). Functions are + * allowed to update their state on every call to 'advance', which + * signals, that the cursor has been moved. + * + * Functions have no way to 'reset' their state, if a reset is needed, + * the report engine is urged to query a new instance from the ReportAddin. + */ +public interface ReportFunction extends ReportExpression +{ + + public ReportFunction advance(DataRow row); +} diff --git a/reportbuilder/java/com/sun/star/report/ReportJob.java b/reportbuilder/java/com/sun/star/report/ReportJob.java new file mode 100644 index 000000000000..bbd02ff5e390 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/ReportJob.java @@ -0,0 +1,92 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportJob.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +import java.io.IOException; + +/** + * This allows some simple job control. A job can be interrupted (or if it has + * not yet been started, canceled), and the job status can be queried (scheduled, + * running, finished). + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
JobStatusrunningfinished
Scheduledfalsefalse
Runningtruefalse
Finishedfalsetrue
+ * + * @author Thomas Morgner + */ +public interface ReportJob +{ + + /** + * Although we might want to run the job as soon as it has been + * created, sometimes it is wiser to let the user add some listeners + * first. If we execute at once, the user either has to deal with + * threading code or wont receive any progress information in single + * threaded environments. + */ + public void execute() + throws ReportExecutionException, IOException; + + /** + * Interrupt the job. + */ + public void interrupt(); + + /** + * Queries the jobs execution status. + * + * @return true, if the job is currently running, false otherwise. + */ + public boolean isRunning(); + + /** + * Queries the jobs result status. + * + * @return true, if the job is finished (or has been interrupted), false + * if the job waits for activation. + */ + public boolean isFinished(); + + public void addProgressIndicator(JobProgressIndicator indicator); + + public void removeProgressIndicator(JobProgressIndicator indicator); +} diff --git a/reportbuilder/java/com/sun/star/report/ReportJobDefinition.java b/reportbuilder/java/com/sun/star/report/ReportJobDefinition.java new file mode 100644 index 000000000000..ff1b78b6aace --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/ReportJobDefinition.java @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportJobDefinition.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +/** + * The report job is created by the report job factory and holds all properties + * required to complete the reporting task. + * + * @author Thomas Morgner + */ +public interface ReportJobDefinition +{ + + /** + * The parameters of the root report definition. The report parameters are using + * by the query factory to parametrize the query statement. + * + * The query parameters for the subreports are defined using mappings, it would not + * make sense to define them here. + * + * @return a map containing the report parameters + */ + public ParameterMap getQueryParameters(); + + /** + * The report processing parameters control the behaviour of the report. There are + * several mandatory parameters, some optional and possibly some not-yet-understood + * parameters. Use the engine meta data to find out, which parameters are supported. + * + * @return the processing parameters + */ + public JobProperties getProcessingParameters(); +} diff --git a/reportbuilder/java/com/sun/star/report/ReportJobFactory.java b/reportbuilder/java/com/sun/star/report/ReportJobFactory.java new file mode 100644 index 000000000000..cf8ed01ba736 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/ReportJobFactory.java @@ -0,0 +1,44 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportJobFactory.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +import com.sun.star.beans.NamedValue; +import com.sun.star.lang.IllegalArgumentException; +import com.sun.star.uno.Exception; + +/** + * + * @author Ocke Janssen + */ +public interface ReportJobFactory +{ + + public ReportJob createReportJob(final NamedValue[] namedValue) throws IllegalArgumentException, ReportExecutionException, Exception; +} diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportData.java b/reportbuilder/java/com/sun/star/report/SDBCReportData.java new file mode 100644 index 000000000000..5107d8ebf427 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/SDBCReportData.java @@ -0,0 +1,375 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: SDBCReportData.java,v $ + * $Revision: 1.6.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +import com.sun.star.beans.UnknownPropertyException; +import com.sun.star.beans.XPropertySet; +import com.sun.star.container.XIndexAccess; +import com.sun.star.container.XNameAccess; +import com.sun.star.lang.IndexOutOfBoundsException; +import com.sun.star.lang.WrappedTargetException; +import com.sun.star.sdb.XParametersSupplier; +import java.sql.Timestamp; + +import com.sun.star.sdbc.DataType; +import com.sun.star.sdbc.SQLException; +import com.sun.star.sdbc.XResultSetMetaData; +import com.sun.star.sdbc.XResultSetMetaDataSupplier; +import com.sun.star.sdbc.XRow; +import com.sun.star.sdbc.XRowSet; +import com.sun.star.sdbcx.XColumnsSupplier; +import com.sun.star.uno.Any; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.util.DateTime; +import com.sun.star.util.Time; + +public class SDBCReportData implements DataSource +{ + + private final XRowSet rowSet; + private final XRow row; + private int rowCount; + private XIndexAccess parameters; + private int firstParameterIndex = -1; + private int columnCount; + private final String[] columnNames; + private final int[] columnTypes; + + public SDBCReportData(final XRowSet rowSet) throws SQLException + { + row = (XRow) UnoRuntime.queryInterface(XRow.class, rowSet); + this.rowSet = rowSet; + + if (rowSet == null) + { + rowCount = 0; + columnCount = 0; + columnTypes = new int[1]; + columnNames = new String[1]; + } + else + { + final XParametersSupplier xSuppParams = (XParametersSupplier) UnoRuntime.queryInterface( + XParametersSupplier.class, rowSet); + if (xSuppParams != null) + { + parameters = xSuppParams.getParameters(); + } + + final XColumnsSupplier columnsSup = (XColumnsSupplier)UnoRuntime.queryInterface(XColumnsSupplier.class, rowSet); + final XNameAccess columns = columnsSup.getColumns(); + final String[] columnNamesList = columns.getElementNames(); + final XResultSetMetaDataSupplier sup = (XResultSetMetaDataSupplier) UnoRuntime.queryInterface(XResultSetMetaDataSupplier.class, rowSet); + final XResultSetMetaData resultSetMetaData = sup.getMetaData(); + + columnCount = resultSetMetaData.getColumnCount(); + firstParameterIndex = columnCount + 1; + if (parameters != null) + columnCount += parameters.getCount(); + + columnTypes = new int[columnCount]; + columnNames = new String[columnCount]; + + for (int i = 1; i <= columnCount; ++i) + { + if (i < firstParameterIndex) + { + columnNames[i - 1] = columnNamesList[i - 1];// resultSetMetaData.getColumnName(i); + columnTypes[i - 1] = resultSetMetaData.getColumnType(i); + } + else + { + try + { + final XPropertySet paramColumn = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet.class, parameters.getByIndex(i - firstParameterIndex)); + columnNames[i - 1] = (String) paramColumn.getPropertyValue("Name"); + columnTypes[i - 1] = ((Integer) paramColumn.getPropertyValue("Type")).intValue(); + } + catch (Exception e) + { + columnNames[i - 1] = "Error"; + columnTypes[i - 1] = DataType.CHAR; + } + } + } + + if (rowSet.last()) + { + rowCount = rowSet.getRow(); + rowSet.beforeFirst(); + } + else + { + rowCount = 0; + } + } + } + + public int getColumnCount() throws DataSourceException + { + return columnCount; + } + + public int getRowCount() + { + return rowCount; + } + + public String getColumnName(final int column) throws DataSourceException + { + return columnNames[column - 1]; + } + + public boolean absolute(final int row) throws DataSourceException + { + if (rowSet == null) + return false; + try + { + if (row == 0) + { + rowSet.beforeFirst(); + return true; + } + return rowSet.absolute(row); + } + catch (SQLException e) + { + throw new DataSourceException(e.getMessage(), e); + } + } + + public boolean next() throws DataSourceException + { + if (rowSet == null) + return false; + try + { + return rowSet.next(); + } + catch (SQLException e) + { + throw new DataSourceException(e.getMessage(), e); + } + } + + public void close() throws DataSourceException + { + } + +// public int getCurrentRow() throws DataSourceException +// { +// try +// { +// return rowSet.getRow(); +// } +// catch (SQLException e) +// { +// throw new DataSourceException(e.getMessage(), e); +// } +// } + static private java.sql.Date getDate(final Object obj) + { + final java.sql.Date date; + if (obj instanceof com.sun.star.util.Date) + { + final com.sun.star.util.Date unodate = (com.sun.star.util.Date) obj; + date = java.sql.Date.valueOf(getDateString(unodate.Year, unodate.Month, unodate.Day).toString()); + } + else + { + date = null; + } + return date; + } + + private static StringBuffer getTimeString(final int hours, final int minutes, final int seconds) + { + final StringBuffer timeString = new StringBuffer(); + if (hours < 10) + { + timeString.append('0'); + } + timeString.append(hours); + timeString.append(':'); + if (minutes < 10) + { + timeString.append('0'); + } + timeString.append(minutes); + timeString.append(':'); + if (seconds < 10) + { + timeString.append('0'); + } + timeString.append(seconds); + return timeString; + } + + static private StringBuffer getDateString(final int years, final int months, final int days) + { + final StringBuffer str = new StringBuffer(); + str.append(years); + final StringBuffer str2 = new StringBuffer("0000"); + str2.delete(0, str.length()); + str.insert(0, str2); + str.append('-'); + if (months < 10) + { + str.append('0'); + } + str.append(months); + str.append('-'); + if (days < 10) + { + str.append('0'); + } + str.append(days); + return str; + } + + static private java.sql.Time getTime(final Object obj) + { + final java.sql.Time time; + if (obj instanceof Time) + { + final Time unoTime = (Time) obj; + time = java.sql.Time.valueOf(getTimeString(unoTime.Hours, unoTime.Minutes, unoTime.Seconds).toString()); + } + else + { + time = null; + } + return time; + } + + static private Timestamp getTimestamp(final Object obj) + { + final Timestamp ts; + if (obj instanceof DateTime) + { + final DateTime unoTs = (DateTime) obj; + final StringBuffer str = getDateString(unoTs.Year, unoTs.Month, unoTs.Day); + str.append(' '); + str.append(getTimeString(unoTs.Hours, unoTs.Minutes, unoTs.Seconds)); + str.append('.'); + str.append(unoTs.HundredthSeconds); + ts = java.sql.Timestamp.valueOf(str.toString()); + } + else + { + ts = null; + } + return ts; + } + + public Object getObject(final int column) throws DataSourceException + { + if (rowSet == null) + return null; + try + { + final boolean isParameterValue = (parameters != null) && (column >= firstParameterIndex); + Object obj; + final boolean wasNull; + if (isParameterValue) + { + final XPropertySet paramCol = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet.class, parameters.getByIndex(column - firstParameterIndex)); + obj = paramCol.getPropertyValue("Value"); + wasNull = obj == null; + } + else + { + obj = row.getObject(column, null); + wasNull = row.wasNull(); + } + + if (wasNull) + { + obj = null; + } + else + { + obj = convertObject(columnTypes[column - 1], obj); + } + return obj; + } + catch (SQLException ex) + { + throw new DataSourceException(ex.getMessage(), ex); + } + catch (UnknownPropertyException ex) + { + throw new DataSourceException(ex.getMessage(), ex); + } + catch (IndexOutOfBoundsException ex) + { + throw new DataSourceException(ex.getMessage(), ex); + } + catch (WrappedTargetException ex) + { + throw new DataSourceException(ex.getMessage(), ex); + } + } + + private Object convertObject(final int type, final Object obj) + { + final Object ret; + switch (type) + { + case DataType.DATE: + ret = getDate(obj); + break; + case DataType.TIME: + ret = getTime(obj); + break; + case DataType.TIMESTAMP: + ret = getTimestamp(obj); + break; + case DataType.DECIMAL: + case DataType.NUMERIC: + if (!(obj instanceof Any)) + { + ret = new java.math.BigDecimal((String) obj); + } + else + { + ret = obj; + } + break; + default: + ret = obj; + break; + } + return ret; + } +} diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java new file mode 100644 index 000000000000..bc248c29bbd9 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java @@ -0,0 +1,645 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: SDBCReportDataFactory.java,v $ + * $Revision: 1.9.18.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +import com.sun.star.beans.PropertyVetoException; +import com.sun.star.beans.UnknownPropertyException; +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.WrappedTargetException; +import com.sun.star.sdbc.XConnection; +import com.sun.star.container.XNameAccess; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +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.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.Map; + +import com.sun.star.sdbc.XRowSet; +import com.sun.star.sdbcx.XColumnsSupplier; +import com.sun.star.sdbcx.XTablesSupplier; +import com.sun.star.task.XInteractionHandler; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Very primitive implementation, just to show how this could be used ... + * + */ +public class SDBCReportDataFactory implements DataSourceFactory +{ + 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"; + public static final String GROUP_EXPRESSIONS = "group-expressions"; + public static final String MASTER_VALUES = "master-values"; + public static final String MASTER_COLUMNS = "master-columns"; + public static final String DETAIL_COLUMNS = "detail-columns"; + public static final String UNO_FILTER = "Filter"; + private static final String APPLY_FILTER = "ApplyFilter"; + private static final String UNO_COMMAND = "Command"; + private static final String UNO_ORDER = "Order"; + private static final String UNO_APPLY_FILTER = "ApplyFilter"; + private static final String UNO_COMMAND_TYPE = "CommandType"; + private final XConnection connection; + private final XComponentContext m_cmpCtx; + private static final int FAILED = 0; + private static final int DONE = 1; + private static final int RETRIEVE_COLUMNS = 2; + private static final int RETRIEVE_OBJECT = 3; + private static final int HANDLE_QUERY = 4; + private static final int HANDLE_TABLE = 5; + private static final int HANDLE_SQL = 6; + + public SDBCReportDataFactory(final XComponentContext cmpCtx, final XConnection connection) + { + this.connection = connection; + m_cmpCtx = cmpCtx; + } + + public DataSource queryData(final String command, final Map parameters) throws DataSourceException + { + try + { + if ( command == null ) + { + return new SDBCReportData(null); + } + int commandType = CommandType.COMMAND; + final String commandTypeValue = (String) parameters.get(COMMAND_TYPE); + if ( commandTypeValue != null ) + { + if ( commandTypeValue.equals("query") ) + { + commandType = CommandType.QUERY; + } + else if ( commandTypeValue.equals("table") ) + { + commandType = CommandType.TABLE; + } + else + { + 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 int oldParameterCount = fillParameter(parameters, tools, command, commandType, rowSet); + + final XCompletedExecution execute = (XCompletedExecution) UnoRuntime.queryInterface(XCompletedExecution.class, rowSet); + if ( execute != null && oldParameterCount > 0 ) + { + final XInteractionHandler handler = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, m_cmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.sdb.InteractionHandler", m_cmpCtx)); + execute.executeWithCompletion(handler); + } + else + { + rowSet.execute(); + } + } + return new SDBCReportData(rowSet); + } catch ( Exception ex ) + { + throw new DataSourceException(ex.getMessage(), ex); + } + } + + private String getOrderStatement(final int commandType, final String command, final List groupExpressions) + { + final StringBuffer order = new StringBuffer(); + final int count = groupExpressions.size(); + if ( count != 0 ) + { + try + { + final String quote = connection.getMetaData().getIdentifierQuoteString(); + final XComponent[] hold = new XComponent[1]; + final XNameAccess columns = getFieldsByCommandDescriptor(commandType, command, hold); + + for (int i = 0; i < count; i++) + { + final Object[] pair = (Object[]) groupExpressions.get(i); + String expression = (String) pair[0]; + + if (columns.hasByName(expression)) + { + expression = quote + expression + quote; + } + expression = expression.trim(); // Trim away white spaces + + if (expression.length() > 0) + { + order.append(expression); + if (order.length() > 0) + { + order.append(' '); + } + final String sorting = (String) pair[1]; + if (sorting == null || sorting.equals(OfficeToken.FALSE)) + { + order.append("DESC"); + } + if ((i + 1) < count) + { + order.append(", "); + } + } + } + } + catch (IndexOutOfBoundsException ex) + { + LOGGER.error("ReportProcessing failed", ex); + } + catch (SQLException ex) + { + LOGGER.error("ReportProcessing failed", ex); + } + } + return order.toString(); + } + + private XNameAccess getFieldsByCommandDescriptor(final int commandType, final String command, final XComponent[] out) throws SQLException + { + final Class[] parameter = new Class[3]; + parameter[0] = Integer.class; + parameter[1] = String.class; + parameter[2] = out.getClass(); + final XConnectionTools tools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, connection); + try + { + tools.getClass().getMethod("getFieldsByCommandDescriptor", parameter); + return tools.getFieldsByCommandDescriptor(commandType, command, out); + } catch ( NoSuchMethodException ex ) + { + } + + XNameAccess xFields = null; + // some kind of state machine to ease the sharing of code + int eState = FAILED; + switch ( commandType ) + { + case CommandType.TABLE: + eState = HANDLE_TABLE; + break; + case CommandType.QUERY: + eState = HANDLE_QUERY; + break; + case CommandType.COMMAND: + eState = HANDLE_SQL; + break; + } + + // needed in various states: + XNameAccess xObjectCollection = null; + XColumnsSupplier xSupplyColumns = null; + + try + { + // go! + while ((DONE != eState) && (FAILED != eState)) + { + switch ( eState ) + { + case HANDLE_TABLE: + { + // 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(); + // if something went wrong 'til here, then this will be handled in the next state + + // next state: get the object + } + eState = RETRIEVE_OBJECT; + } + break; + + case HANDLE_QUERY: + { + // 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(); + // if something went wrong 'til here, then this will be handled in the next state + + // next state: get the object + } + eState = RETRIEVE_OBJECT; + } + break; + + case RETRIEVE_OBJECT: + // here we should have an object (aka query or table) collection, and are going + // to retrieve the desired object + + // next state: default to FAILED + eState = FAILED; + + if ( xObjectCollection != null && xObjectCollection.hasByName(command) ) + { + xSupplyColumns = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xObjectCollection.getByName(command)); + + // next: go for the columns + eState = RETRIEVE_COLUMNS; + } + break; + + case RETRIEVE_COLUMNS: + // next state: default to FAILED + eState = FAILED; + + if ( xSupplyColumns != null ) + { + xFields = xSupplyColumns.getColumns(); + // that's it + eState = DONE; + } + break; + + case HANDLE_SQL: + { + 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. + + try + { + final XMultiServiceFactory xComposerFac = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, connection); + + if ( xComposerFac != null ) + { + final XSingleSelectQueryComposer xComposer = (XSingleSelectQueryComposer) UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, xComposerFac.createInstance("com.sun.star.sdb.SingleSelectQueryComposer")); + if ( xComposer != null ) + { + xComposer.setQuery(sStatementToExecute); + + // Now set the filter to a dummy restriction which will result in an empty + // result set. + xComposer.setFilter("0=1"); + + 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 + } + + // 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 ) + { + // 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 + + // so the next state is to get the columns + eState = RETRIEVE_COLUMNS; + } + break; + default: + eState = FAILED; + } + } + } catch ( com.sun.star.uno.Exception ex ) + { + } + return xFields; + } + + private XSingleSelectQueryComposer getComposer(final XConnectionTools tools, + final String command, + final int commandType) + { + final Class[] parameter = new Class[2]; + parameter[0] = int.class; + parameter[1] = String.class; + try + { + final Object[] param = new Object[2]; + param[0] = commandType; + param[1] = command; + Method call = tools.getClass().getMethod("getComposer", parameter); + return (XSingleSelectQueryComposer) call.invoke(tools, param); + } catch ( NoSuchMethodException ex ) + { + } catch ( IllegalAccessException ex ) + { + // should not happen + // assert False + } catch ( java.lang.reflect.InvocationTargetException ex ) + { + // should not happen + // assert False + } + try + { + final XMultiServiceFactory factory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, connection); + 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 ) + { + 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 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) + { + 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()) + { + final String filter = (String) prop.getPropertyValue(UNO_FILTER); + if (filter != null && filter.length() != 0) + { + composer.setFilter(filter); + } + } + statement = composer.getQuery(); + } + } + } + } + break; + case CommandType.COMMAND: + statement = command; + break; + } + out.setElementaryQuery(statement); + return out; + } catch ( Exception e ) + { + } + return null; + } + + int fillParameter(final Map parameters, + final XConnectionTools tools, + final String command, + final int commandType, final XRowSet rowSet) + throws SQLException, + UnknownPropertyException, + PropertyVetoException, + IllegalArgumentException, + WrappedTargetException + { + int oldParameterCount = 0; + + final XSingleSelectQueryComposer composer = getComposer(tools, command, commandType); + if ( composer != null ) + { + final XPropertySet rowSetProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet); + if ( ((Boolean)rowSetProp.getPropertyValue(APPLY_FILTER)).booleanValue() ) + { + composer.setFilter((String)rowSetProp.getPropertyValue("Filter")); + } + // get old parameter count + final XParametersSupplier paraSup = (XParametersSupplier) UnoRuntime.queryInterface(XParametersSupplier.class, composer); + if ( paraSup != null ) + { + final XIndexAccess params = paraSup.getParameters(); + if ( params != null ) + { + oldParameterCount = params.getCount(); + } + } + final ArrayList masterValues = (ArrayList) parameters.get(MASTER_VALUES); + if ( masterValues != null && !masterValues.isEmpty() ) + { + // 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 ) + { + oldFilter.append(" AND "); + } + int newParamterCounter = 1; + for (final Iterator it = detailColumns.iterator(); it.hasNext(); + ++newParamterCounter) + { + 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() ) + { + oldFilter.append(" AND "); + } + } + + composer.setFilter(oldFilter.toString()); + } + else + oldParameterCount = 0; + + 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); + } + } + } + + 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; + } + + void fillOrderStatement(final String command, + final int commandType, final Map parameters, + final XConnectionTools tools, + final XPropertySet rowSetProp) + throws SQLException, + UnknownPropertyException, + PropertyVetoException, + IllegalArgumentException, + WrappedTargetException, + NoSuchElementException + { + final StringBuffer order = new StringBuffer(getOrderStatement(commandType, command, (ArrayList) parameters.get(GROUP_EXPRESSIONS))); + if ( order.length() > 0 && commandType != CommandType.TABLE ) + { + String statement = command; + final XSingleSelectQueryComposer composer = getComposer(tools, command, commandType); + if ( composer != null ) + { + statement = composer.getQuery(); + composer.setQuery(statement); + final String sOldOrder = composer.getOrder(); + if ( sOldOrder.length() > 0 ) + { + order.append(','); + order.append(sOldOrder); + composer.setOrder(""); + statement = composer.getQuery(); + } + } + else + { + if ( commandType == CommandType.QUERY ) + { + 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"); + rowSetProp.setPropertyValue("EscapeProcessing", escape); + final String queryCommand = (String) prop.getPropertyValue(UNO_COMMAND); + statement = "SELECT * FROM (" + queryCommand + ")"; + } + + } + else + { + statement = "SELECT * FROM (" + command + ")"; + } + } + rowSetProp.setPropertyValue(UNO_COMMAND, statement); + rowSetProp.setPropertyValue(UNO_COMMAND_TYPE, new Integer(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 new file mode 100644 index 000000000000..3073a52179fa --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/SOImageService.java @@ -0,0 +1,182 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: SOImageService.java,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +import java.awt.Dimension; +import java.io.InputStream; + +import com.sun.star.awt.Size; +import com.sun.star.beans.PropertyValue; +import com.sun.star.beans.UnknownPropertyException; +import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.XPropertySetInfo; +import com.sun.star.graphic.XGraphicProvider; +import com.sun.star.io.IOException; +import com.sun.star.io.XInputStream; +import com.sun.star.lang.WrappedTargetException; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter; +import com.sun.star.lib.uno.adapter.InputStreamToXInputStreamAdapter; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; + +/** + * @author oj93728 + */ +public class SOImageService implements ImageService +{ + + private final XGraphicProvider m_xGraphicProvider; + + /** + * Creates a new instance of SOImageService + */ + public SOImageService(final XComponentContext xCompContext) + throws ReportExecutionException, com.sun.star.uno.Exception + { + if (xCompContext == null) + { + throw new ReportExecutionException(); + } + + + final XMultiComponentFactory m_xMCF = xCompContext.getServiceManager(); + m_xGraphicProvider = (XGraphicProvider) UnoRuntime.queryInterface(XGraphicProvider.class, + m_xMCF.createInstanceWithContext("com.sun.star.graphic.GraphicProvider", xCompContext)); + + if (m_xGraphicProvider == null) + { + throw new ReportExecutionException("There is no graphic-provider available."); + } + } + + public Dimension getImageSize(final InputStream image) throws ReportExecutionException + { + return getImageSize(new InputStreamToXInputStreamAdapter(image)); + } + + private Dimension getImageSize(final XInputStream image) throws ReportExecutionException + { + final Dimension dim = new Dimension(); + try + { + final PropertyValue[] value = new PropertyValue[]{new PropertyValue()}; + // value[0] = new PropertyValue(); + value[0].Name = "InputStream"; + value[0].Value = image; + + final XPropertySet xImage = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, + m_xGraphicProvider.queryGraphic(value)); + + if (xImage != null) + { + final XPropertySetInfo xInfo = xImage.getPropertySetInfo(); + if (xInfo.hasPropertyByName("Size100thMM")) + { + Size imageSize = (Size) xImage.getPropertyValue("Size100thMM"); + dim.setSize(imageSize.Width, imageSize.Height); + if (dim.height == 0 && dim.width == 0) + { + imageSize = (Size) xImage.getPropertyValue("SizePixel"); + final int dpi = java.awt.Toolkit.getDefaultToolkit().getScreenResolution(); + final double fac = 2540 / dpi; + dim.setSize(imageSize.Width * fac, imageSize.Height * fac); + } + } + else if (xInfo.hasPropertyByName("SizePixel")) + { + final Size imageSize = (Size) xImage.getPropertyValue("SizePixel"); + final int dpi = java.awt.Toolkit.getDefaultToolkit().getScreenResolution(); + final double fac = 2540 / dpi; + dim.setSize(imageSize.Width * fac, imageSize.Height * fac); + } + } + } + catch (Exception ex) + { + throw new ReportExecutionException("Failed to query Image-Size", ex); + } + return dim; + } + + public Dimension getImageSize(final byte[] image) throws ReportExecutionException + { + return getImageSize(new ByteArrayToXInputStreamAdapter(image)); + } + + private String getMimeType(final XInputStream image) throws ReportExecutionException + { + try + { + final PropertyValue[] value = new PropertyValue[]{new PropertyValue()}; + value[0].Name = "InputStream"; + value[0].Value = image; + + final XPropertySet xImage = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, + m_xGraphicProvider.queryGraphic(value)); + + if (xImage != null) + { + final XPropertySetInfo xInfo = xImage.getPropertySetInfo(); + if (xInfo.hasPropertyByName("MimeType")) + { + return (String) xImage.getPropertyValue("MimeType"); + } + } + } + catch (UnknownPropertyException ex) + { + throw new ReportExecutionException(); + } + catch (WrappedTargetException ex) + { + throw new ReportExecutionException(); + } + catch (com.sun.star.lang.IllegalArgumentException ex) + { + throw new ReportExecutionException(); + } + catch (IOException ex) + { + throw new ReportExecutionException(); + } + return null; + } + + public String getMimeType(final InputStream image) throws ReportExecutionException + { + return getMimeType(new InputStreamToXInputStreamAdapter(image)); + } + + public String getMimeType(final byte[] image) throws ReportExecutionException + { + return getMimeType(new ByteArrayToXInputStreamAdapter(image)); + } +} diff --git a/reportbuilder/java/com/sun/star/report/StorageRepository.java b/reportbuilder/java/com/sun/star/report/StorageRepository.java new file mode 100644 index 000000000000..bf5687da14ae --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/StorageRepository.java @@ -0,0 +1,339 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StorageRepository.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report; + +import com.sun.star.beans.PropertyVetoException; +import com.sun.star.beans.UnknownPropertyException; +import com.sun.star.beans.XPropertySet; +import com.sun.star.container.NoSuchElementException; +import com.sun.star.embed.ElementModes; +import com.sun.star.embed.InvalidStorageException; +import com.sun.star.lang.IllegalArgumentException; +import com.sun.star.lang.WrappedTargetException; +import java.io.*; +import com.sun.star.embed.XStorage; +import com.sun.star.embed.XTransactedObject; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.io.XStream; +import com.sun.star.lib.uno.adapter.XInputStreamToInputStreamAdapter; +import com.sun.star.lib.uno.adapter.XOutputStreamToOutputStreamAdapter; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * A directory holds all the contents here. + * + * + * @author Ocke Janssen + */ +public class StorageRepository implements InputRepository, OutputRepository +{ + private static final Log LOGGER = LogFactory.getLog(SDBCReportDataFactory.class); + private static final String REPORT_PROCESSING_FAILED = "ReportProcessing failed"; + private XStorage input; + private XStorage output; + + /** + * + * @param input + * @param output + * @throws java.io.IOException + */ + public StorageRepository(final XStorage input, final XStorage output) + { + this.input = input; + this.output = output; + } + + public StorageRepository(final XStorage storage, final boolean isOutput) + { + if (isOutput) + { + this.output = storage; + } + else + { + this.input = storage; + } + } + + public InputStream createInputStream(final String name) throws IOException + { + if (input == null) + { + throw new IOException("input is NULL"); + } + try + { + final XStream xStream = (XStream) UnoRuntime.queryInterface(XStream.class, input.openStreamElement(name, ElementModes.READ)); + return new BufferedInputStream(new XInputStreamToInputStreamAdapter(xStream.getInputStream()), 102400); + } + catch (com.sun.star.uno.Exception e) + { + throw new IOException("createInputStream"); + } + } + + /** + * Creates an output stream for writing the data. If there is an entry with + * that name already contained in the repository, try to overwrite it. + * + * @param name + * @param mimeType + * @return the outputstream + * @throws IOException if opening the stream fails + */ + public OutputStream createOutputStream(final String name, final String mimeType) throws IOException + { + if (output == null) + { + throw new IOException("output is NULL"); + } + try + { + final XStream stream = (XStream) UnoRuntime.queryInterface(XStream.class, output.openStreamElement(name, ElementModes.WRITE | ElementModes.TRUNCATE)); + stream.getInputStream().closeInput(); + if (mimeType != null) + { + final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, stream); + prop.setPropertyValue("MediaType", mimeType); + } + return new BufferedOutputStream(new XOutputStreamToOutputStreamAdapter(stream.getOutputStream()), 204800); + } + catch (com.sun.star.uno.Exception e) + { + throw new IOException("createOutputStream"); + } + } + + public boolean exists(final String name) + { + try + { + return output.isStreamElement(name); + } + catch (InvalidStorageException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (com.sun.star.lang.IllegalArgumentException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (NoSuchElementException ex) + { + // We expect this exception, no need to log it. + } + return false; + } + + public boolean isWritable(final String name) + { + return true; + } + + public Object getId() + { + return "1"; + } + + public long getVersion(final String name) + { + return 1; + } + + public boolean isReadable(final String name) + { + try + { + if (input != null) + { + return input.isStreamElement(name); + } + } + catch (InvalidStorageException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (com.sun.star.lang.IllegalArgumentException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (NoSuchElementException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + return false; + } + + public InputRepository openInputRepository(final String name) throws IOException + { + try + { + final String temp = shortenName(name); + if (!input.isStorageElement(temp)) + { + throw new IOException(); + } + final XStorage storage = (XStorage) UnoRuntime.queryInterface(XStorage.class, input.openStorageElement(temp, ElementModes.READ)); + return new StorageRepository(storage, false); + } + catch (NoSuchElementException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (WrappedTargetException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (InvalidStorageException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (IllegalArgumentException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (com.sun.star.io.IOException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + throw new IOException(); + } + + final String shortenName(final String name) + { + final String temp; + if (name.startsWith("./")) + { + temp = name.substring(2); + } + else + { + temp = name; + } + return temp; + } + + public OutputRepository openOutputRepository(final String name, final String mimeType) throws IOException + { + try + { + final String temp = shortenName(name); + final XStorage storage = (XStorage) UnoRuntime.queryInterface(XStorage.class, output.openStorageElement(temp, ElementModes.WRITE)); + if (mimeType != null) + { + final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, storage); + prop.setPropertyValue("MediaType", mimeType); + } + return new StorageRepository(storage, true); + } + catch (UnknownPropertyException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (PropertyVetoException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (IllegalArgumentException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (WrappedTargetException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (InvalidStorageException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (com.sun.star.io.IOException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + + throw new IOException(); + } + + public void closeInputRepository() + { + if (input != null) + { + input.dispose(); + } + } + + public void closeOutputRepository() + { + if (output != null) + { + try + { + final XTransactedObject obj = (XTransactedObject) UnoRuntime.queryInterface(XTransactedObject.class, output); + if (obj != null) + { + obj.commit(); + } + } + catch (com.sun.star.io.IOException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (WrappedTargetException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + output.dispose(); + } + + } + + public boolean existsStorage(final String name) + { + try + { + return output.isStorageElement(name); + } + catch (InvalidStorageException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (com.sun.star.lang.IllegalArgumentException ex) + { + LOGGER.error(REPORT_PROCESSING_FAILED, ex); + } + catch (NoSuchElementException ex) + { + // We expect this exception, no need to log it. + } + return false; + } +} diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function.properties b/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function.properties new file mode 100644 index 000000000000..4dfc3e01f0be --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function.properties @@ -0,0 +1,33 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: Author-Function.properties,v $ +# +# $Revision: 1.2 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +display-name=AUTHOR +description=Returns the author of the report. \ No newline at end of file diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function_en_US.properties b/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function_en_US.properties new file mode 100644 index 000000000000..4dfc3e01f0be --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function_en_US.properties @@ -0,0 +1,33 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: Author-Function.properties,v $ +# +# $Revision: 1.2 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +display-name=AUTHOR +description=Returns the author of the report. \ No newline at end of file diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java b/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java new file mode 100644 index 000000000000..63b15fab0200 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java @@ -0,0 +1,67 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: AuthorFunction.java,v $ + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.function.metadata; + +import com.sun.star.report.ReportEngineParameterNames; +import org.pentaho.reporting.libraries.formula.EvaluationException; +import org.pentaho.reporting.libraries.formula.FormulaContext; +import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; +import org.pentaho.reporting.libraries.formula.function.Function; +import org.pentaho.reporting.libraries.formula.function.ParameterCallback; +import org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair; +import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType; + +/** + * + * @author Ocke Janssen + */ +public class AuthorFunction implements Function +{ + + public AuthorFunction() + { + } + + public String getCanonicalName() + { + return "AUTHOR"; + } + + public TypeValuePair evaluate(final FormulaContext context,final ParameterCallback parameters) + throws EvaluationException + { + if (parameters.getParameterCount() != 0) + { + throw new EvaluationException(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE); + } + + return new TypeValuePair(TextType.TYPE, context.getConfiguration().getConfigProperty(ReportEngineParameterNames.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 new file mode 100644 index 000000000000..fecfcd5753c1 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunctionDescription.java @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: AuthorFunctionDescription.java,v $ + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +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; + +/** + * + * @author Ocke Janssen + */ +public class AuthorFunctionDescription extends AbstractFunctionDescription +{ + + public AuthorFunctionDescription() + { + super("AUTHOR","com.sun.star.report.function.metadata.Author-Function"); + } + + public FunctionCategory getCategory() + { + return MetaDataFunctionCategory.CATEGORY; + } + + public int getParameterCount() + { + return 0; + } + + public Type getParameterType(final int position) + { + return null; + } + + public Type getValueType() + { + return TextType.TYPE; + } + + public boolean isParameterMandatory(final int position) + { + return false; + } +} diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/MetaDataFunctionCategory.java b/reportbuilder/java/com/sun/star/report/function/metadata/MetaDataFunctionCategory.java new file mode 100644 index 000000000000..2e47bafaceca --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/function/metadata/MetaDataFunctionCategory.java @@ -0,0 +1,49 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: MetaDataFunctionCategory.java,v $ + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.function.metadata; + +import org.pentaho.reporting.libraries.formula.function.AbstractFunctionCategory; +import org.pentaho.reporting.libraries.formula.function.FunctionCategory; + +/** + * + * @author Ocke Janssen + */ +public class MetaDataFunctionCategory extends AbstractFunctionCategory +{ + + public static final FunctionCategory CATEGORY = new MetaDataFunctionCategory(); + + private MetaDataFunctionCategory() + { + super("com.sun.star.report.function.metadata.category"); + } +} + diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function.properties b/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function.properties new file mode 100644 index 000000000000..ef678be150da --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function.properties @@ -0,0 +1,33 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: Title-Function.properties,v $ +# +# $Revision: 1.2 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +display-name=TITLE +description=Returns the title of the report. \ No newline at end of file diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function_en_US.properties b/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function_en_US.properties new file mode 100644 index 000000000000..ef678be150da --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function_en_US.properties @@ -0,0 +1,33 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: Title-Function.properties,v $ +# +# $Revision: 1.2 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +display-name=TITLE +description=Returns the title of the report. \ No newline at end of file diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java b/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java new file mode 100644 index 000000000000..be342dc27706 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java @@ -0,0 +1,67 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TitleFunction.java,v $ + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.function.metadata; + +import com.sun.star.report.ReportEngineParameterNames; +import org.pentaho.reporting.libraries.formula.EvaluationException; +import org.pentaho.reporting.libraries.formula.FormulaContext; +import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; +import org.pentaho.reporting.libraries.formula.function.Function; +import org.pentaho.reporting.libraries.formula.function.ParameterCallback; +import org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair; +import org.pentaho.reporting.libraries.formula.typing.coretypes.TextType; + +/** + * + * @author Ocke Janssen + */ +public class TitleFunction implements Function +{ + + public TitleFunction() + { + } + + public String getCanonicalName() + { + return "TITLE"; + } + + public TypeValuePair evaluate(final FormulaContext context,final ParameterCallback parameters) + throws EvaluationException + { + if (parameters.getParameterCount() != 0) + { + throw new EvaluationException(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE); + } + + return new TypeValuePair(TextType.TYPE, context.getConfiguration().getConfigProperty(ReportEngineParameterNames.TITLE)); + } +} diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunctionDescription.java b/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunctionDescription.java new file mode 100644 index 000000000000..5db1a898b04e --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunctionDescription.java @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TitleFunctionDescription.java,v $ + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +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; + +/** + * + * @author Ocke Janssen + */ +public class TitleFunctionDescription extends AbstractFunctionDescription +{ + + public TitleFunctionDescription() + { + super("TITLE","com.sun.star.report.function.metadata.Title-Function"); + } + + public FunctionCategory getCategory() + { + return MetaDataFunctionCategory.CATEGORY; + } + + public int getParameterCount() + { + return 0; + } + + public Type getParameterType(final int position) + { + return null; + } + + public Type getValueType() + { + return TextType.TYPE; + } + + public boolean isParameterMandatory(final int position) + { + return false; + } +} diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/category.properties b/reportbuilder/java/com/sun/star/report/function/metadata/category.properties new file mode 100644 index 000000000000..c193c5c7374a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/function/metadata/category.properties @@ -0,0 +1,33 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: category.properties,v $ +# +# $Revision: 1.2 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +display-name=Document Information +description=Contains functions to access document information. diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/category_en_US.properties b/reportbuilder/java/com/sun/star/report/function/metadata/category_en_US.properties new file mode 100644 index 000000000000..44b7ed1d5e9b --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/function/metadata/category_en_US.properties @@ -0,0 +1,33 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: category.properties,v $ +# +# $Revision: 1.2 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +display-name=MetaData +description=Contains functions about meta data \ No newline at end of file diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk new file mode 100644 index 000000000000..1025bcea7cb7 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk @@ -0,0 +1,68 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3.22.2 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ = ..$/..$/..$/..$/..$/..$/.. +PRJNAME = reportbuilder +TARGET= rpt_java_css_metadata +PACKAGE = com$/sun$/star$/report$/function$/metadata + +# --- Settings ----------------------------------------------------- +.INCLUDE: settings.mk +#----- compile .java files ----------------------------------------- + +.IF "$(SYSTEM_JFREEREPORT)" == "YES" +CLASSPATH!:==$(CLASSPATH)$(PATH_SEPERATOR)$(LIBBASE_JAR)$(PATH_SEPERATOR)$(LIBFORMULA_JAR) +.ELSE +JARFILES += libbase-1.0.0.jar libformula-0.2.0.jar +.ENDIF + +JAVAFILES := AuthorFunction.java \ + AuthorFunctionDescription.java \ + TitleFunction.java \ + TitleFunctionDescription.java \ + MetaDataFunctionCategory.java + +# PROPERTYFILES := $(shell @$(FIND) . -name "*.properties") +PROPERTYFILES := $(CLASSDIR)$/$(PACKAGE)$/category.properties \ + $(CLASSDIR)$/$(PACKAGE)$/category_en_US.properties \ + $(CLASSDIR)$/$(PACKAGE)$/Author-Function.properties \ + $(CLASSDIR)$/$(PACKAGE)$/Author-Function_en_US.properties \ + $(CLASSDIR)$/$(PACKAGE)$/Title-Function.properties \ + $(CLASSDIR)$/$(PACKAGE)$/Title-Function_en_US.properties + +# --- Targets ------------------------------------------------------ +.INCLUDE : target.mk + +ALLTAR : $(PROPERTYFILES) + +$(CLASSDIR)$/$(PACKAGE)$/%.properties : %.properties + @@-$(MKDIRHIER) $(@:d) + $(COPY) $< $@ diff --git a/reportbuilder/java/com/sun/star/report/makefile.mk b/reportbuilder/java/com/sun/star/report/makefile.mk new file mode 100644 index 000000000000..9c5c2998f5c0 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/makefile.mk @@ -0,0 +1,78 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.8.46.2 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ = ..$/..$/..$/..$/.. +PRJNAME = reportbuilder +TARGET=rpt_java_css +PACKAGE = com$/sun$/star$/report + +# --- Settings ----------------------------------------------------- +.INCLUDE: settings.mk +#----- compile .java files ----------------------------------------- + +JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar +.IF "$(SYSTEM_JFREEREPORT)" == "YES" +XCLASSPATH!:==$(XCLASSPATH)$(PATH_SEPERATOR)$(JCOMMON_JAR)$(PATH_SEPERATOR)$(COMMONS_LOGGING_JAR) +.ELSE +JARFILES += jcommon-1.0.10.jar commons-logging-1.1.1.jar +.ENDIF + +JAVAFILES := DataRow.java\ + DataSource.java\ + DataSourceException.java\ + DataSourceFactory.java\ + InputRepository.java\ + JobDefinitionException.java\ + JobProgressIndicator.java\ + JobProperties.java\ + OutputRepository.java\ + ParameterMap.java\ + ReportAddIn.java\ + ReportEngine.java\ + ReportEngineMetaData.java\ + ReportEngineParameterNames.java\ + ReportExecutionException.java\ + ReportExpression.java\ + ReportExpressionMetaData.java\ + ReportFunction.java\ + ReportJob.java\ + ReportJobFactory.java\ + ReportJobDefinition.java\ + ImageService.java\ + SOImageService.java\ + StorageRepository.java\ + SDBCReportData.java\ + SDBCReportDataFactory.java \ + OfficeToken.java + + +# --- Targets ------------------------------------------------------ +.INCLUDE : target.mk diff --git a/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java b/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java new file mode 100644 index 000000000000..6cfac589b900 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java @@ -0,0 +1,149 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: DefaultNameGenerator.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho; + +import java.io.IOException; + +import com.sun.star.report.OutputRepository; + +public class DefaultNameGenerator +{ + + private final OutputRepository outputRepository; + + public DefaultNameGenerator(final OutputRepository outputRepository) + { + if (outputRepository == null) + { + throw new NullPointerException(); + } + this.outputRepository = outputRepository; + } + + public String generateName(final String namePrefix, final String mimeType) + throws IOException + { + return generateName(namePrefix, mimeType, true); + } + + public String generateStorageName(final String namePrefix, final String mimeType) + throws IOException + { + return generateName(namePrefix, mimeType, false); + } + + /** + * Generates a new, unique name for storing resources in the output repository. Assuming that proper synchronization + * has been applied, the generated name will be unique within that repository. + * + * @param namePrefix a user defined name for that resource. + * @param mimeType the mime type of the resource to be stored in the repository. + * @return the generated, fully qualified name. + */ + private String generateName(final String namePrefix, final String mimeType, final boolean isStream) + throws IOException + { + final String name; + if (namePrefix != null) + { + name = namePrefix; + } + else + { + name = "file"; + } + + String firstFileName = name; + final String suffix; + if (mimeType != null) + { + suffix = getSuffixForType(mimeType); + firstFileName += "." + suffix; + } + else + { + suffix = null; + } + boolean exists; + if (isStream) + { + exists = outputRepository.exists(firstFileName); + } + else + { + exists = outputRepository.existsStorage(firstFileName); + } + if (exists) + { + int counter = 0; + while (exists) + { + if (counter < 0) // wraparound should not happen.. + { + throw new IOException(); + } + firstFileName = name + counter; + if (suffix != null) + { + firstFileName += "." + suffix; + } + if (isStream) + { + exists = outputRepository.exists(firstFileName); + } + else + { + exists = outputRepository.existsStorage(firstFileName); + } + counter += 1; + } + } + return firstFileName; + } + + protected String getSuffixForType(final String mimeType) + { + if ("image/png".equals(mimeType)) + { + return "png"; + } + if ("image/jpeg".equals(mimeType)) + { + return "jpg"; + } + if ("image/gif".equals(mimeType)) + { + return "gif"; + } + + // todo ... use a flexible mapping ... + return "dat"; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf b/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf new file mode 100644 index 000000000000..70f3ff695cbb --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf @@ -0,0 +1,7 @@ +RegistrationClassName: com.sun.star.report.pentaho.SOReportJobFactory +Class-Path: reportbuilderwizard.jar + flute-1.3.0.jar libserializer-1.0.0.jar libbase-1.0.0.jar + libfonts-1.0.0.jar libformula-0.2.0.jar liblayout-0.2.9.jar + libloader-1.0.0.jar librepository-1.0.0.jar libxml-1.0.0.jar + flow-engine-0.9.2.jar sac.jar commons-logging-1.1.1.jar +UNO-Type-Path: diff --git a/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java b/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java new file mode 100644 index 000000000000..15e364c40e8d --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeNamespaces.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho; + +/** + * Creation-Date: Feb 22, 2007, 1:53:29 PM + * + * @author Thomas Morgner + */ +public class OfficeNamespaces +{ + + public static final String OFFICE_NS = "urn:oasis:names:tc:opendocument:xmlns:office:1.0"; + public static final String TABLE_NS = "urn:oasis:names:tc:opendocument:xmlns:table:1.0"; + public static final String TEXT_NS = "urn:oasis:names:tc:opendocument:xmlns:text:1.0"; + public static final String STYLE_NS = "urn:oasis:names:tc:opendocument:xmlns:style:1.0"; + public static final String DRAWING_NS = "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"; + public static final String FO_NS = "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"; + public static final String XLINK_NS = "http://www.w3.org/1999/xlink"; + public static final String PURL_NS = "http://purl.org/dc/elements/1.1/"; + public static final String META_NS = "urn:oasis:names:tc:opendocument:xmlns:meta:1.0"; + public static final String DATASTYLE_NS = "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"; + public static final String SVG_NS = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"; + public static final String CHART_NS = "urn:oasis:names:tc:opendocument:xmlns:chart:1.0"; + public static final String DR3D_NS = "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"; + public static final String MATHML_NS = "http://www.w3.org/1998/Math/MathML"; + public static final String FORM_NS = "urn:oasis:names:tc:opendocument:xmlns:form:1.0"; + public static final String SCRIPT_NS = "urn:oasis:names:tc:opendocument:xmlns:script:1.0"; + public static final String OO2004_NS = "http://openoffice.org/2004/office"; + public static final String OOW2004_NS = "http://openoffice.org/2004/writer"; + public static final String OOC2004_NS = "http://openoffice.org/2004/calc"; + public static final String XML_EVENT_NS = "http://www.w3.org/2001/xml-events"; + public static final String XFORMS_NS = "http://www.w3.org/2002/xforms"; + public static final String XSD_NS = "http://www.w3.org/2001/XMLSchema"; + public static final String XSI_NS = "http://www.w3.org/2001/XMLSchema-instance"; + public static final String OOREPORT_NS = "http://openoffice.org/2005/report"; + public static final String CONFIG = "urn:oasis:names:tc:opendocument:xmlns:config:1.0"; + + /** + * @deprecated + */ + public static final String NUMBER_NS = DATASTYLE_NS; + + private OfficeNamespaces() + { + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java new file mode 100644 index 000000000000..46d541679741 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java @@ -0,0 +1,99 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: PentahoFormulaContext.java,v $ + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho; + +import org.pentaho.reporting.libraries.formula.ContextEvaluationException; +import org.pentaho.reporting.libraries.formula.FormulaContext; +import org.pentaho.reporting.libraries.formula.LocalizationContext; +import org.pentaho.reporting.libraries.formula.function.FunctionRegistry; +import org.pentaho.reporting.libraries.formula.operators.OperatorFactory; +import org.pentaho.reporting.libraries.formula.typing.Type; +import org.pentaho.reporting.libraries.formula.typing.TypeRegistry; +import org.pentaho.reporting.libraries.base.config.Configuration; + +/** + * + * @author Ocke Janssen + */ +public class PentahoFormulaContext implements FormulaContext +{ + final private FormulaContext backend; + final private Configuration config; + + public PentahoFormulaContext(final FormulaContext backend, final Configuration _config) + { + this.backend = backend; + config = _config; + } + + public LocalizationContext getLocalizationContext() + { + return backend.getLocalizationContext(); + } + + public Configuration getConfiguration() + { + return config; + } + + public FunctionRegistry getFunctionRegistry() + { + return backend.getFunctionRegistry(); + } + + public TypeRegistry getTypeRegistry() + { + return backend.getTypeRegistry(); + } + + public OperatorFactory getOperatorFactory() + { + return backend.getOperatorFactory(); + } + + public Type resolveReferenceType(final Object name) throws ContextEvaluationException + { + return backend.resolveReferenceType(name); + } + + public Object resolveReference(final Object name) throws ContextEvaluationException + { + if (name == null) + { + throw new NullPointerException(); + } + return backend.resolveReference(name); + } + + public boolean isReferenceDirty(final Object name) throws ContextEvaluationException + { + return backend.isReferenceDirty(name); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportAddIn.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportAddIn.java new file mode 100644 index 000000000000..db8ad9e4409e --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportAddIn.java @@ -0,0 +1,63 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: PentahoReportAddIn.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho; + +import com.sun.star.report.ReportAddIn; +import com.sun.star.report.ReportExpression; +import com.sun.star.report.ReportExpressionMetaData; +import com.sun.star.report.pentaho.expressions.SumExpression; + +/** + * This class is a dummy implementation. Ignore it for now, we may extend this + * one later. + */ +public class PentahoReportAddIn implements ReportAddIn +{ + + public PentahoReportAddIn() + { + } + + public ReportExpression createExpression(final int expression) + { + return (expression == 0) ? new SumExpression() : null; + } + + public int getExpressionCount() + { + return 1; + } + + public ReportExpressionMetaData getMetaData(final int expression) + { + // todo implement me + return null; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngine.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngine.java new file mode 100644 index 000000000000..d114edf34f71 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngine.java @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: PentahoReportEngine.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho; + +import com.sun.star.report.JobDefinitionException; +import com.sun.star.report.ReportEngine; +import com.sun.star.report.ReportEngineMetaData; +import com.sun.star.report.ReportJob; +import com.sun.star.report.ReportJobDefinition; +import com.sun.star.report.util.DefaultReportJobDefinition; +import org.jfree.report.JFreeReportBoot; + +public class PentahoReportEngine implements ReportEngine +{ + + private final ReportEngineMetaData metaData; + + public PentahoReportEngine() + { + JFreeReportBoot.getInstance().start(); + this.metaData = new PentahoReportEngineMetaData(); + } + + public ReportEngineMetaData getMetaData() + { + return metaData; + } + + public ReportJobDefinition createJobDefinition() + { + return new DefaultReportJobDefinition(metaData); + } + + /** + * Open points: How to define scheduling? + * + * @return the report job definition for the job description. + * + * @throws com.sun.star.report.JobDefinitionException + * + */ + public ReportJob createJob(final ReportJobDefinition definition) + throws JobDefinitionException + { + return new PentahoReportJob(definition); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java new file mode 100644 index 000000000000..7285e9b897be --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java @@ -0,0 +1,146 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: PentahoReportEngineMetaData.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho; + +import com.sun.star.report.ReportJobFactory; +import java.util.HashMap; +import java.util.HashSet; + +import com.sun.star.report.DataSourceFactory; +import com.sun.star.report.InputRepository; +import com.sun.star.report.OutputRepository; +import com.sun.star.report.ReportEngineMetaData; +import com.sun.star.report.ReportEngineParameterNames; +import com.sun.star.report.ImageService; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.pentaho.reporting.libraries.base.util.HashNMap; + +public class PentahoReportEngineMetaData + implements ReportEngineMetaData +{ + + public static final String OPENDOCUMENT_TEXT = "application/vnd.oasis.opendocument.text"; + public static final String OPENDOCUMENT_SPREADSHEET = "application/vnd.oasis.opendocument.spreadsheet"; + public static final String OPENDOCUMENT_CHART = "application/vnd.oasis.opendocument.chart"; + public final static String CONTENT_TYPE = "content-type"; + public static final String DEBUG = "raw/text+xml"; + private final Set mandatoryParameters; + private final Map parameterTypes; + private final HashNMap enumerationValues; + + public PentahoReportEngineMetaData() + { + mandatoryParameters = new HashSet(); + mandatoryParameters.add(ReportEngineParameterNames.CONTENT_TYPE); + mandatoryParameters.add(ReportEngineParameterNames.INPUT_NAME); + mandatoryParameters.add(ReportEngineParameterNames.INPUT_REPOSITORY); + mandatoryParameters.add(ReportEngineParameterNames.OUTPUT_NAME); + mandatoryParameters.add(ReportEngineParameterNames.OUTPUT_REPOSITORY); + mandatoryParameters.add(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY); + mandatoryParameters.add(ReportEngineParameterNames.IMAGE_SERVICE); + mandatoryParameters.add(ReportEngineParameterNames.INPUT_REPORTJOB_FACTORY); + mandatoryParameters.add(ReportEngineParameterNames.INPUT_MASTER_COLUMNS); + mandatoryParameters.add(ReportEngineParameterNames.INPUT_MASTER_VALUES); + mandatoryParameters.add(ReportEngineParameterNames.INPUT_DETAIL_COLUMNS); + mandatoryParameters.add(ReportEngineParameterNames.AUTHOR); + mandatoryParameters.add(ReportEngineParameterNames.TITLE); + + + parameterTypes = new HashMap(); + parameterTypes.put(ReportEngineParameterNames.CONTENT_TYPE, String.class); + parameterTypes.put(ReportEngineParameterNames.INPUT_NAME, String.class); + parameterTypes.put(ReportEngineParameterNames.OUTPUT_NAME, String.class); + parameterTypes.put(ReportEngineParameterNames.INPUT_REPOSITORY, InputRepository.class); + parameterTypes.put(ReportEngineParameterNames.OUTPUT_REPOSITORY, OutputRepository.class); + parameterTypes.put(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY, DataSourceFactory.class); + parameterTypes.put(ReportEngineParameterNames.IMAGE_SERVICE, ImageService.class); + parameterTypes.put(ReportEngineParameterNames.INPUT_REPORTJOB_FACTORY, ReportJobFactory.class); + parameterTypes.put(ReportEngineParameterNames.INPUT_MASTER_COLUMNS, List.class); + parameterTypes.put(ReportEngineParameterNames.INPUT_MASTER_VALUES, List.class); + parameterTypes.put(ReportEngineParameterNames.INPUT_DETAIL_COLUMNS, List.class); + parameterTypes.put(ReportEngineParameterNames.AUTHOR, String.class); + parameterTypes.put(ReportEngineParameterNames.TITLE, String.class); + + enumerationValues = new HashNMap(); + enumerationValues.add(CONTENT_TYPE, + PentahoReportEngineMetaData.OPENDOCUMENT_TEXT); + enumerationValues.add(CONTENT_TYPE, + PentahoReportEngineMetaData.OPENDOCUMENT_SPREADSHEET); + enumerationValues.add(CONTENT_TYPE, + PentahoReportEngineMetaData.OPENDOCUMENT_CHART); + enumerationValues.add(CONTENT_TYPE, PentahoReportEngineMetaData.DEBUG); + } + + public Object[] getEnumerationValues(final String parameter) + { + return enumerationValues.toArray(parameter); + } + + public Class getParameterType(final String parameter) + { + return (Class) parameterTypes.get(parameter); + } + + public boolean isEnumeration(final String parameter) + { + return enumerationValues.containsKey(parameter); + } + + /** + * Checks, whether a certain output type is available. Feed the mime-type of the output + * type in and you'll get a true or false back. + * + * @param mimeType + * @return true, if the output type is supported; false otherwise. + */ + public boolean isOutputSupported(final String mimeType) + { + return enumerationValues.containsValue(CONTENT_TYPE, mimeType.toLowerCase()); + } + + /** + * Lists all supported output parameters for the given mime-type. This listing can be + * used to build a generic user interface for configuring a certain output. + * + * @param mimeType + * @return + */ + public String[] getOutputParameters(final String mimeType) + { + return new String[0]; + } + + public boolean isMandatory(final String parameter) + { + return mandatoryParameters.contains(parameter); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java new file mode 100644 index 000000000000..f64c1bd7d741 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java @@ -0,0 +1,396 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: PentahoReportJob.java,v $ + * $Revision: 1.8.16.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho; + +import java.io.IOException; +import java.util.ArrayList; + +import com.sun.star.report.DataSourceFactory; +import com.sun.star.report.InputRepository; +import com.sun.star.report.JobDefinitionException; +import com.sun.star.report.JobProgressIndicator; +import com.sun.star.report.JobProperties; +import com.sun.star.report.OutputRepository; +import com.sun.star.report.ParameterMap; +import com.sun.star.report.ReportEngineParameterNames; +import com.sun.star.report.ReportExecutionException; +import com.sun.star.report.ReportJob; +import com.sun.star.report.ReportJobDefinition; +import com.sun.star.report.ImageService; +import com.sun.star.report.SDBCReportDataFactory; +import com.sun.star.report.pentaho.loader.InputRepositoryLoader; +import com.sun.star.report.pentaho.model.OfficeDetailSection; +import com.sun.star.report.pentaho.model.OfficeDocument; +import com.sun.star.report.pentaho.model.OfficeGroup; +import com.sun.star.report.pentaho.model.OfficeReport; +import com.sun.star.report.pentaho.output.chart.ChartRawReportProcessor; +import com.sun.star.report.pentaho.output.text.TextRawReportProcessor; +import com.sun.star.report.pentaho.output.spreadsheet.SpreadsheetRawReportProcessor; +import java.util.List; +import org.pentaho.reporting.libraries.formula.lvalues.ContextLookup; +import org.pentaho.reporting.libraries.formula.lvalues.FormulaFunction; +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; +import org.jfree.report.flow.ReportProcessor; +import org.jfree.report.flow.raw.XmlPrintReportProcessor; +import org.jfree.report.structure.Node; +import org.jfree.report.structure.Section; +import org.jfree.report.util.ReportParameters; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.pentaho.reporting.libraries.resourceloader.Resource; +import org.pentaho.reporting.libraries.resourceloader.ResourceException; +import org.pentaho.reporting.libraries.resourceloader.ResourceManager; + +/** + * ToDo: Allow interrupting of jobs and report the report progress + */ +public class PentahoReportJob implements ReportJob +{ + private static final Log LOGGER = LogFactory.getLog(PentahoReportJob.class); + private boolean finished; + private final List listeners; + private final DataSourceFactory dataSourceFactory; + private final OutputRepository outputRepository; + private final JobProperties jobProperties; + private OfficeDocument report; + private final ResourceManager resourceManager; + private final String outputName; + private final ImageService imageService; + private final InputRepository inputRepository; + private final ReportJobDefinition definition; + private final List masterValues; + private final List detailColumns; + + public ReportJobDefinition getDefinition() + { + return definition; + } + + public PentahoReportJob(final ReportJobDefinition definition) + throws JobDefinitionException + { + if (definition == null) + { + throw new NullPointerException(); + } + + this.definition = definition; + this.listeners = new ArrayList(); + this.jobProperties = definition.getProcessingParameters().copy(); + + this.dataSourceFactory = (DataSourceFactory) jobProperties.getProperty(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY); + if (this.dataSourceFactory == null) + { + throw new JobDefinitionException("DataSourceFactory must not be null."); + } + + this.outputRepository = (OutputRepository) jobProperties.getProperty(ReportEngineParameterNames.OUTPUT_REPOSITORY); + if (this.outputRepository == null) + { + throw new JobDefinitionException("OutputRepository must not be null."); + } + + this.inputRepository = + (InputRepository) jobProperties.getProperty(ReportEngineParameterNames.INPUT_REPOSITORY); + if (inputRepository == null) + { + throw new JobDefinitionException("InputRepository must not be null."); + } + + this.outputName = (String) jobProperties.getProperty(ReportEngineParameterNames.OUTPUT_NAME); + if (outputName == null) + { + throw new JobDefinitionException("OutputName must not be null"); + } + + this.imageService = (ImageService) jobProperties.getProperty(ReportEngineParameterNames.IMAGE_SERVICE); + if (imageService == null) + { + throw new JobDefinitionException("A valid image-service implementation must be given."); + } + + this.masterValues = (ArrayList) jobProperties.getProperty(ReportEngineParameterNames.INPUT_MASTER_VALUES); + this.detailColumns = (ArrayList) jobProperties.getProperty(ReportEngineParameterNames.INPUT_DETAIL_COLUMNS); + + this.resourceManager = new ResourceManager(); + this.resourceManager.registerDefaults(); + this.resourceManager.registerLoader(new InputRepositoryLoader(inputRepository)); + + try + { + this.report = parseReport(definition); + } + catch (ResourceException e) + { + throw new JobDefinitionException("Failed to parse the report.", e); + } + } + + private OfficeDocument parseReport(final ReportJobDefinition definition) + throws ResourceException, JobDefinitionException + { + final String reportResource = (String) this.jobProperties.getProperty(ReportEngineParameterNames.INPUT_NAME); + if (reportResource == null) + { + throw new JobDefinitionException("Report definition name must be given"); + } + + final Resource res = resourceManager.createDirectly("sun:oo://" + reportResource, OfficeDocument.class); + final OfficeDocument tempReport = (OfficeDocument) res.getResource(); + tempReport.setDataFactory(new StarReportDataFactory(dataSourceFactory)); + tempReport.setJobProperties(definition.getProcessingParameters().copy()); + final ReportParameters inputParameters = tempReport.getInputParameters(); + + final ParameterMap queryParameters = definition.getQueryParameters(); + final String[] paramKeys = queryParameters.keys(); + for (int i = 0; i < paramKeys.length; i++) + { + final String key = paramKeys[i]; + inputParameters.put(key, queryParameters.get(key)); + } + + return tempReport; + } + + public void addProgressIndicator(final JobProgressIndicator indicator) + { + listeners.add(indicator); + } + + /** + * Interrupt the job. + */ + public void interrupt() + { + // hey, not yet .. + } + + /** + * Queries the jobs result status. + * + * @return true, if the job is finished (or has been interrupted), false if the job + * waits for activation. + */ + public boolean isFinished() + { + return finished; + } + + public void finish() + { + finished = true; + } + + /** + * Queries the jobs execution status. + * + * @return true, if the job is currently running, false otherwise. + */ + public boolean isRunning() + { + return !finished; + } + + public void removeProgressIndicator(final JobProgressIndicator indicator) + { + listeners.remove(indicator); + } + + private void collectGroupExpressions(final Node[] nodes, final List expressions, final FormulaParser parser, final Expression reportFunctions[]) + { + for (int i = 0; i < nodes.length; i++) + { + final Node node = nodes[i]; + if (node instanceof OfficeGroup) + { + final OfficeGroup group = (OfficeGroup) node; + final FormulaExpression exp = (FormulaExpression) group.getGroupingExpression(); + + try + { + final String expression = exp.getFormulaExpression(); + if ( expression == null) + continue; + final FormulaFunction function = (FormulaFunction) parser.parse(expression); + final LValue[] parameters = function.getChildValues(); + if (parameters.length > 0) + { + String name = parameters[0].toString(); + for (int j = 0; j < reportFunctions.length; j++) + { + if (reportFunctions[j] instanceof FormulaExpression) + { + final FormulaExpression reportExp = (FormulaExpression) reportFunctions[j]; + + if (reportExp.getName().equals(name)) + { + final LValue val = (LValue) parser.parse(reportExp.getFormulaExpression()); + if (val instanceof FormulaFunction) + { + final FormulaFunction reportFunction = (FormulaFunction) val; + + final ContextLookup context = (ContextLookup) reportFunction.getChildValues()[0]; + name = context.getName(); + } + else if (val instanceof Term) + { + final Term term = (Term) val; + final ContextLookup context = (ContextLookup) term.getHeadValue().getChildValues()[0]; + name = context.getName(); + } + break; + } + } + } + + final Object[] pair = new Object[2]; + pair[0] = name; + pair[1] = group.getAttribute(OfficeNamespaces.OOREPORT_NS, "sort-ascending"); + expressions.add(pair); + } + } + catch (ParseException ex) + { + LOGGER.error("ReportProcessing failed", ex); + } + } + else if (node instanceof OfficeDetailSection) + { + return; + } + if (node instanceof Section) + { + final Section section = (Section) node; + collectGroupExpressions(section.getNodeArray(), expressions, parser, reportFunctions); + } + } + } + + private void setMetaDataProperties(DefaultReportJob job) + { + job.getConfiguration().setConfigProperty(ReportEngineParameterNames.AUTHOR, (String) jobProperties.getProperty(ReportEngineParameterNames.AUTHOR)); + job.getConfiguration().setConfigProperty(ReportEngineParameterNames.TITLE, (String) jobProperties.getProperty(ReportEngineParameterNames.TITLE)); + } + /** + * Although we might want to run the job as soon as it has been created, sometimes it is + * wiser to let the user add some listeners first. If we execute at once, the user + * either has to deal with threading code or wont receive any progress information in + * single threaded environments. + */ + public void execute() + throws ReportExecutionException, IOException + { + final DefaultReportJob job = new DefaultReportJob(report); + setMetaDataProperties(job); + final String contentType = (String) jobProperties.getProperty(ReportEngineParameterNames.CONTENT_TYPE); + //noinspection OverlyBroadCatchBlock + try + { + final ReportParameters parameters = job.getParameters(); + + if (masterValues != null && detailColumns != null) + { + parameters.put(SDBCReportDataFactory.MASTER_VALUES, masterValues); + parameters.put(SDBCReportDataFactory.DETAIL_COLUMNS, detailColumns); + } + + final Node[] nodes = report.getNodeArray(); + + final FormulaParser parser = new FormulaParser(); + final ArrayList expressions = new ArrayList(); + final OfficeReport officeReport = (OfficeReport) ((Section) nodes[0]).getNode(0); + final Section reportBody = (Section) officeReport.getBodySection(); + collectGroupExpressions(reportBody.getNodeArray(), expressions, parser, officeReport.getExpressions()); + parameters.put(SDBCReportDataFactory.GROUP_EXPRESSIONS, expressions); + final String command = (String) officeReport.getAttribute(OfficeNamespaces.OOREPORT_NS, "command"); + final String commandType = (String) officeReport.getAttribute(OfficeNamespaces.OOREPORT_NS, SDBCReportDataFactory.COMMAND_TYPE); + 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)))); + + final String filter = (String) officeReport.getAttribute(OfficeNamespaces.OOREPORT_NS, "filter"); + parameters.put(SDBCReportDataFactory.UNO_FILTER, filter); + + final long startTime = System.currentTimeMillis(); + final ReportProcessor rp = getProcessorForContentType(contentType); + rp.processReport(job); + job.close(); + final long endTime = System.currentTimeMillis(); + LOGGER.debug("Report processing time: " + (endTime - startTime)); + } + catch (final Exception e) + { + String message = e.getMessage(); + if ( message.length() == 0 ) + message = "Failed to process the report"; + throw new ReportExecutionException(message, e); + } + + } + + protected ReportProcessor getProcessorForContentType(final String mimeType) + throws ReportExecutionException + { + final ReportProcessor ret; + + if (PentahoReportEngineMetaData.OPENDOCUMENT_SPREADSHEET.equals(mimeType)) + { + ret = new SpreadsheetRawReportProcessor(inputRepository, outputRepository, outputName, imageService, dataSourceFactory); + } + else if (PentahoReportEngineMetaData.OPENDOCUMENT_TEXT.equals(mimeType)) + { + ret = new TextRawReportProcessor(inputRepository, outputRepository, outputName, imageService, dataSourceFactory); + } + else if (PentahoReportEngineMetaData.OPENDOCUMENT_CHART.equals(mimeType)) + { + ret = new ChartRawReportProcessor(inputRepository, outputRepository, outputName, imageService, dataSourceFactory); + } + else if (PentahoReportEngineMetaData.DEBUG.equals(mimeType)) + { + ret = new XmlPrintReportProcessor(System.out, "ISO-8859-1"); + } + else + { + throw new ReportExecutionException("Invalid mime-type"); + } + + return ret; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java new file mode 100644 index 000000000000..a225c93a749d --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java @@ -0,0 +1,155 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: SOFormulaOpCodeMapper.java,v $ + * + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho; + +import com.sun.star.lang.XServiceInfo; +import com.sun.star.uno.XComponentContext; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.sheet.FormulaLanguage; +import com.sun.star.sheet.FormulaMapGroup; +import com.sun.star.sheet.FormulaOpCodeMapEntry; +import com.sun.star.sheet.FormulaToken; +import java.util.ArrayList; +import java.util.Map; + +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) + { + m_xContext = context; + this.parser = parser; + } + + + // com.sun.star.sheet.XFormulaOpCodeMapper: + public int getOpCodeExternal() + { + return m_OpCodeExternal; + } + + public int getOpCodeUnknown() + { + return m_OpCodeUnknown; + } + + public com.sun.star.sheet.FormulaToken[] getMappings(String[] Names, int Language) throws com.sun.star.lang.IllegalArgumentException + { + if ( Language != FormulaLanguage.ODFF ) + throw new IllegalArgumentException(); + final ArrayList token = new ArrayList(); + final Map parserNames = parser.getNames(); + for (int i = 0; i < Names.length; i++) + { + if ( parserNames.containsKey(Names[i]) ) + { + token.add(((FormulaOpCodeMapEntry) parserNames.get(Names[i])).Token); + } + + } + return (com.sun.star.sheet.FormulaToken[]) token.toArray(new FormulaToken[token.size()]); + } + + public com.sun.star.sheet.FormulaOpCodeMapEntry[] getAvailableMappings(int Language, int Groups) throws com.sun.star.lang.IllegalArgumentException + { + if ( Language != FormulaLanguage.ODFF ) + throw new IllegalArgumentException(); + final ArrayList token = new ArrayList(); + if ( Groups == FormulaMapGroup.SPECIAL ) + { + return (com.sun.star.sheet.FormulaOpCodeMapEntry[]) parser.getSpecialOpCodes().toArray(new FormulaOpCodeMapEntry[parser.getSpecialOpCodes().size()]); + } + else + { + if ( (Groups & FormulaMapGroup.ARRAY_SEPARATORS) != 0 ) + { + token.addAll(parser.getGroup(SOFormulaParser.ARRAY_SEPARATORS).values()); + } + if ( (Groups & FormulaMapGroup.SEPARATORS) != 0 ) + { + token.addAll(parser.getGroup(SOFormulaParser.SEPARATORS).values()); + } + if ( (Groups & FormulaMapGroup.ARRAY_SEPARATORS) != 0 ) + { + token.addAll(parser.getGroup(SOFormulaParser.ARRAY_SEPARATORS).values()); + } + if ( (Groups & FormulaMapGroup.UNARY_OPERATORS) != 0 ) + { + token.addAll(parser.getGroup(SOFormulaParser.UNARY_OPERATORS).values()); + } + if ( (Groups & FormulaMapGroup.BINARY_OPERATORS) != 0 ) + { + token.addAll(parser.getGroup(SOFormulaParser.BINARY_OPERATORS).values()); + } + if ( (Groups & FormulaMapGroup.FUNCTIONS) != 0 ) + { + token.addAll(parser.getGroup(SOFormulaParser.FUNCTIONS).values()); + } + } + + return (com.sun.star.sheet.FormulaOpCodeMapEntry[]) token.toArray(new FormulaOpCodeMapEntry[token.size()]); + } + + public String getImplementationName() + { + return SOFormulaOpCodeMapper.class.getName(); + } + + public boolean supportsService(String sServiceName) + { + return sServiceName.equals(__serviceName); + } + + public String[] getSupportedServiceNames() + { + return getServiceNames(); + } + + /** + * This method is a simple helper function to used in the static component initialisation functions as well as + * in getSupportedServiceNames. + */ + public static String[] getServiceNames() + { + return new String[] + { + __serviceName + }; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java new file mode 100644 index 000000000000..26a454cab9aa --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java @@ -0,0 +1,429 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: SOFormulaParser.java,v $ + * + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho; + +import com.sun.star.lang.XServiceInfo; +import com.sun.star.sheet.XFormulaOpCodeMapper; +import com.sun.star.uno.Exception; +import com.sun.star.uno.XComponentContext; +import com.sun.star.lib.uno.helper.ComponentBase; +import com.sun.star.uno.Type; +import com.sun.star.lib.uno.helper.PropertySetMixin; +import com.sun.star.sheet.FormulaLanguage; +import com.sun.star.sheet.FormulaMapGroup; +import com.sun.star.sheet.FormulaMapGroupSpecialOffset; +import com.sun.star.sheet.FormulaOpCodeMapEntry; +import com.sun.star.sheet.FormulaToken; +import com.sun.star.uno.Any; +import com.sun.star.uno.UnoRuntime; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Vector; +import org.pentaho.reporting.libraries.formula.DefaultFormulaContext; +import org.pentaho.reporting.libraries.formula.function.FunctionRegistry; +import org.pentaho.reporting.libraries.formula.parser.FormulaParser; +import org.pentaho.reporting.libraries.formula.parser.GeneratedFormulaParserConstants; +import org.pentaho.reporting.libraries.formula.parser.GeneratedFormulaParserTokenManager; +import org.pentaho.reporting.libraries.formula.parser.JavaCharStream; +import org.pentaho.reporting.libraries.formula.parser.ParseException; +import org.pentaho.reporting.libraries.formula.parser.Token; +import org.pentaho.reporting.libraries.formula.parser.TokenMgrError; +import org.pentaho.reporting.libraries.base.config.Configuration; + +public final class SOFormulaParser extends ComponentBase + implements com.sun.star.report.meta.XFormulaParser, XServiceInfo +{ + + public static final int SEPARATORS = 0; + public static final int ARRAY_SEPARATORS = 1; + public static final int UNARY_OPERATORS = 2; + public static final int BINARY_OPERATORS = 3; + public static final int FUNCTIONS = 4; + private final XComponentContext m_xContext; + private final PropertySetMixin m_prophlp; + private static final String __serviceName = "com.sun.star.report.meta.FormulaParser"; + private static final String OPERATORS = "org.pentaho.reporting.libraries.formula.operators."; + + // attributes + final private List m_OpCodeMap = new ArrayList(); + private XFormulaOpCodeMapper formulaOpCodeMapper = null; + 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(); + + public Vector getSpecialOpCodes() + { + return specialOpCodes; + } + private int ownTokenCounter = 1000; + private final FormulaOpCodeMapEntry opCodePush; + private final FormulaParser parser; + + public SOFormulaParser(XComponentContext context) + { + + m_xContext = context; + final ClassLoader cl = java.lang.Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); + + parser = new FormulaParser(); + try + { + final XFormulaOpCodeMapper mapper = (XFormulaOpCodeMapper) UnoRuntime.queryInterface(XFormulaOpCodeMapper.class, m_xContext.getServiceManager().createInstanceWithContext("simple.formula.FormulaOpCodeMapperObj", m_xContext)); + FormulaOpCodeMapEntry[] opCodes = mapper.getAvailableMappings(FormulaLanguage.ODFF, FormulaMapGroup.FUNCTIONS); + final DefaultFormulaContext defaultContext = new DefaultFormulaContext(); + final FunctionRegistry functionRegistry = defaultContext.getFunctionRegistry(); + + String[] names = functionRegistry.getFunctionNames(); + addOpCodes(names, opCodes, FUNCTIONS); + names = getOperators(defaultContext, OPERATORS); + opCodes = mapper.getAvailableMappings(FormulaLanguage.ODFF, FormulaMapGroup.UNARY_OPERATORS); + addOpCodes(names, opCodes, UNARY_OPERATORS); + opCodes = mapper.getAvailableMappings(FormulaLanguage.ODFF, FormulaMapGroup.BINARY_OPERATORS); + addOpCodes(names, opCodes, BINARY_OPERATORS); + + names = GeneratedFormulaParserConstants.tokenImage.clone(); + for (int i = 0; i < names.length; i++) + { + final String token = names[i]; + if ( token != null && token.length() > 0 && token.charAt(0) == '"' ) + { + names[i] = token.substring(1, token.length() - 1); + } + } + opCodes = mapper.getAvailableMappings(FormulaLanguage.ODFF, FormulaMapGroup.SEPARATORS); + addOpCodes(names, opCodes, SEPARATORS, false); + + opCodes = mapper.getAvailableMappings(FormulaLanguage.ODFF, FormulaMapGroup.ARRAY_SEPARATORS); + 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++) + { + final FormulaOpCodeMapEntry opCode = opCodes[i]; + parserAllOpCodes.put(opCode.Token.OpCode, opCode); + specialOpCodes.add(opCode); + } + // addOpCodes(names, opCodes,SPECIAL,false); + } catch ( Exception ex ) + { + ex.printStackTrace(); + } + opCodePush = (FormulaOpCodeMapEntry) specialOpCodes.get(FormulaMapGroupSpecialOffset.PUSH); + Thread.currentThread().setContextClassLoader(cl); + // use the last parameter of the PropertySetMixin constructor + // for your optional attributes if necessary. See the documentation + // of the PropertySetMixin helper for further information. + // Ensure that your attributes are initialized correctly! + m_prophlp = new PropertySetMixin(m_xContext, this, + new Type(com.sun.star.report.meta.XFormulaParser.class), null); + } + ; + + // com.sun.star.sheet.XFormulaParser: + public com.sun.star.sheet.FormulaToken[] parseFormula(String aFormula) + { + final ArrayList tokens = new ArrayList(); + if ( !"=".equals(aFormula) ) + { + String formula; + if ( aFormula.charAt(0) == '=' ) + formula = aFormula.substring(1); + else + formula = aFormula; + final ArrayList images = new ArrayList(); + try + { + int brackets = 0; + final GeneratedFormulaParserTokenManager tokenParser = new GeneratedFormulaParserTokenManager(new JavaCharStream(new StringReader(formula), 1, 1)); + Token token = tokenParser.getNextToken(); + while (token.kind != GeneratedFormulaParserConstants.EOF) + { + final FormulaToken formulaToken; + images.add(token.image); + final String upper = token.image.toUpperCase(); + if ( parserNames.containsKey(upper) ) + { + if ( token.image.equals("(")) + brackets++; + else if ( token.image.equals(")")) + --brackets; + final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(upper); + formulaToken = opCode.Token; + } + else if ( token.kind == GeneratedFormulaParserConstants.WHITESPACE ) + { + final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) specialOpCodes.get(FormulaMapGroupSpecialOffset.SPACES); + formulaToken = opCode.Token; + } + else + { + formulaToken = new FormulaToken(); + formulaToken.OpCode = opCodePush.Token.OpCode; + formulaToken.Data = new Any(Type.STRING, token.image); + } + + tokens.add(formulaToken); + token = tokenParser.getNextToken(); + } + if ( brackets > 0 ) + { + final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(")"); + while ( brackets-- != 0 ) + { + formula = formula.concat(")"); + images.add(")"); + tokens.add(opCode.Token); + } + + } + + parser.parse(formula); + } catch ( ParseException ex ) + { + boolean found = false; + // error occured so all token must be bad + for (int i = 0; i < tokens.size(); i++) + { + if ( !found && images.get(i).equals(ex.currentToken.image) ) + found = true; + if ( found ) + { + final FormulaToken dest = new FormulaToken(); + dest.OpCode = ((FormulaOpCodeMapEntry) specialOpCodes.get(FormulaMapGroupSpecialOffset.BAD)).Token.OpCode; + dest.Data = new Any(Type.STRING, images.get(i)); + tokens.remove(i); + tokens.add(i, dest); + } + } + } catch ( java.lang.Exception e ) + { + } catch ( TokenMgrError e ) + { + } + } + FormulaToken[] ret = (FormulaToken[]) tokens.toArray(new FormulaToken[tokens.size()]); + return ret; + } + + public String printFormula(com.sun.star.sheet.FormulaToken[] aTokens) + { + final StringBuffer ret = new StringBuffer(); + for (int i = 0; i < aTokens.length; i++) + { + final FormulaToken formulaToken = aTokens[i]; + if ( formulaToken.OpCode == opCodePush.Token.OpCode && !formulaToken.Data.equals(Any.VOID) ) + { + ret.append(formulaToken.Data); + } + else if ( parserAllOpCodes.containsKey(formulaToken.OpCode) ) + { + final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserAllOpCodes.get(formulaToken.OpCode); + if ( opCode.Name.length() > 0 ) + ret.append(opCode.Name); + else if ( !formulaToken.Data.equals(Any.VOID) ) + ret.append(formulaToken.Data); + } + } + return ret.toString(); + } + + // com.sun.star.beans.XPropertySet: + public com.sun.star.beans.XPropertySetInfo getPropertySetInfo() + { + return m_prophlp.getPropertySetInfo(); + } + + public void setPropertyValue(String aPropertyName, Object aValue) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.beans.PropertyVetoException, com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException + { + m_prophlp.setPropertyValue(aPropertyName, aValue); + } + + public Object getPropertyValue(String aPropertyName) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + return m_prophlp.getPropertyValue(aPropertyName); + } + + public void addPropertyChangeListener(String aPropertyName, com.sun.star.beans.XPropertyChangeListener xListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + m_prophlp.addPropertyChangeListener(aPropertyName, xListener); + } + + public void removePropertyChangeListener(String aPropertyName, com.sun.star.beans.XPropertyChangeListener xListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + m_prophlp.removePropertyChangeListener(aPropertyName, xListener); + } + + public void addVetoableChangeListener(String aPropertyName, com.sun.star.beans.XVetoableChangeListener xListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + m_prophlp.addVetoableChangeListener(aPropertyName, xListener); + } + + public void removeVetoableChangeListener(String aPropertyName, com.sun.star.beans.XVetoableChangeListener xListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + m_prophlp.removeVetoableChangeListener(aPropertyName, xListener); + } + + // com.sun.star.report.meta.XFormulaParser: + public com.sun.star.sheet.FormulaOpCodeMapEntry[] getOpCodeMap() + { + return (com.sun.star.sheet.FormulaOpCodeMapEntry[]) m_OpCodeMap.toArray(new FormulaOpCodeMapEntry[m_OpCodeMap.size()]); + } + + public void setOpCodeMap(com.sun.star.sheet.FormulaOpCodeMapEntry[] the_value) + { +// m_prophlp.prepareSet("OpCodeMap", null); +// synchronized (this) +// { +// m_OpCodeMap.clear(); +// } + } + + public String getImplementationName() + { + return SOFormulaParser.class.getName(); + } + + public boolean supportsService(String sServiceName) + { + return sServiceName.equals(__serviceName); + } + + public String[] getSupportedServiceNames() + { + return getServiceNames(); + } + + /** + * This method is a simple helper function to used in the static component initialisation functions as well as + * in getSupportedServiceNames. + */ + public static String[] getServiceNames() + { + return new String[] + { + __serviceName + }; + } + + public XFormulaOpCodeMapper getFormulaOpCodeMapper() + { + if ( formulaOpCodeMapper == null ) + { + formulaOpCodeMapper = new SOFormulaOpCodeMapper(m_xContext, this); + } + + return formulaOpCodeMapper; + } + + private void addOpCodes(String[] names, FormulaOpCodeMapEntry[] opCodes, int group) + { + addOpCodes(names, opCodes, group, true); + } + + private void addOpCodes(String[] names, FormulaOpCodeMapEntry[] opCodes, int group, boolean add) + { + groupOpCodes[group] = new HashMap(); + for (int j = 0; j < names.length; j++) + { + FormulaOpCodeMapEntry opCode = null; + int i = 0; + for (; i < opCodes.length; i++) + { + opCode = opCodes[i]; + if ( names[j].equals(opCode.Name) ) + { + break; + } + } + if ( i >= opCodes.length ) + { + if ( !add ) + continue; + final FormulaToken token = new FormulaToken(ownTokenCounter++, Any.VOID); + opCode = new FormulaOpCodeMapEntry(names[j], token); + } + parserNames.put(names[j], opCode); + parserAllOpCodes.put(opCode.Token.OpCode, opCode); + groupOpCodes[group].put(opCode.Token.OpCode, opCode); + } + } + + final public Map getNames() + { + return parserNames; + } + + final public Map getGroup(int group) + { + return groupOpCodes[group]; + } + + private String[] getOperators(DefaultFormulaContext defaultContext, final String _kind) + { + final ArrayList ops = new ArrayList(); + final Configuration configuration = defaultContext.getConfiguration(); + final Iterator iter = configuration.findPropertyKeys(_kind); + while (iter.hasNext()) + { + final String configKey = (String) iter.next(); + if ( configKey.endsWith(".class") == false ) + { + continue; + } + final String operatorClass = configuration.getConfigProperty(configKey); + if ( operatorClass == null ) + { + continue; + } + if ( operatorClass.length() == 0 ) + { + continue; + } + final String tokenKey = configKey.substring(0, configKey.length() - ".class".length()) + ".token"; + final String token = configuration.getConfigProperty(tokenKey); + if ( token == null ) + { + continue; + } + ops.add(token.trim()); + } + return (String[]) ops.toArray(new String[ops.size()]); + } +} + diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java new file mode 100644 index 000000000000..059aed34796a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java @@ -0,0 +1,198 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: XFunctionManager.java,v $ + * + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +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; +import com.sun.star.lib.uno.helper.ComponentBase; +import com.sun.star.report.meta.XFunctionCategory; +import com.sun.star.report.meta.XFunctionManager; +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 + * (__getComponentFactory) and a method, that writes the information into the given registry key + * (__writeRegistryServiceInfo). + */ +public final class SOFunctionManager extends ComponentBase implements XFunctionManager, XServiceInfo +{ + + private final XComponentContext m_xContext; + /** + * The service name, that must be used to get an instance of this service. + */ + private static final String __serviceName = + "com.sun.star.report.meta.FunctionManager"; + final private FunctionCategory[] categories; + final private FunctionRegistry functionRegistry; + final private DefaultFormulaContext defaultContext; + + public SOFunctionManager(XComponentContext context) + { + m_xContext = context; + final ClassLoader cl = java.lang.Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); + defaultContext = new DefaultFormulaContext(); + functionRegistry = defaultContext.getFunctionRegistry(); + categories = functionRegistry.getCategories(); + Thread.currentThread().setContextClassLoader(cl); + + } + + /** + * This method returns an array of all supported service names. + * + * @return Array of supported service names. + */ + public String[] getSupportedServiceNames() + { + return getServiceNames(); + } + + /** + * This method is a simple helper function to used in the static component initialisation functions as well as + * in getSupportedServiceNames. + */ + public static String[] getServiceNames() + { + return new String[] + { + __serviceName + }; + } + + /** + * This method returns true, if the given service will be supported by the component. + * + * @param sServiceName Service name. + * @return True, if the given service name will be supported. + */ + public boolean supportsService(final String sServiceName) + { + return sServiceName.equals(__serviceName); + } + + /** + * Return the class name of the component. + * + * @return Class name of the component. + */ + public String getImplementationName() + { + return SOFunctionManager.class.getName(); + } + + // com.sun.star.container.XElementAccess: + public com.sun.star.uno.Type getElementType() + { + return new com.sun.star.uno.Type(XFunctionCategory.class); + } + + public boolean hasElements() + { + return categories.length != 0; + } + + // com.sun.star.container.XIndexAccess: + public int getCount() + { + return categories.length; + } + + public Object getByIndex(int Index) throws com.sun.star.lang.IndexOutOfBoundsException, com.sun.star.lang.WrappedTargetException + { + return getCategory(Index); + } + + // com.sun.star.report.meta.XFunctionManager: + public com.sun.star.report.meta.XFunctionCategory getCategory(int position) throws com.sun.star.lang.IndexOutOfBoundsException, com.sun.star.lang.WrappedTargetException + { + if ( position >= categories.length ) + throw new com.sun.star.lang.IndexOutOfBoundsException(); + 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); + if ( func == null ) + throw new NoSuchElementException(); + int i = 0; + for (; i < categories.length; i++) + { + if ( categories[i] == func.getCategory() ) + break; + } + try + { + return new StarFunctionDescription(defaultContext, m_xContext, getCategory(i), functionRegistry, func); + } + catch ( Exception ex ) + { + } + return null; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java new file mode 100644 index 000000000000..cda541184968 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java @@ -0,0 +1,437 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: SOReportJobFactory.java,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho; + +import com.sun.star.beans.NamedValue; +import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.UnknownPropertyException; +import com.sun.star.beans.PropertyVetoException; +import com.sun.star.beans.XPropertyChangeListener; +import com.sun.star.beans.XVetoableChangeListener; +import com.sun.star.embed.XStorage; +import com.sun.star.lang.IllegalArgumentException; +import com.sun.star.lang.XInitialization; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lang.WrappedTargetException; +import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.Factory; +import com.sun.star.lib.uno.helper.PropertySetMixin; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.registry.InvalidRegistryException; +import com.sun.star.registry.InvalidValueException; +import com.sun.star.registry.XRegistryKey; +import com.sun.star.registry.XSimpleRegistry; +import com.sun.star.report.DataSourceFactory; +import com.sun.star.report.JobProperties; +import com.sun.star.report.ReportEngineParameterNames; +import com.sun.star.report.ReportExecutionException; +import com.sun.star.report.ReportJob; +import com.sun.star.report.ReportJobDefinition; +import com.sun.star.report.ReportJobFactory; +import com.sun.star.report.SDBCReportDataFactory; +import com.sun.star.report.SOImageService; +import com.sun.star.report.StorageRepository; +import com.sun.star.report.XReportDefinition; +import com.sun.star.report.pentaho.SOReportJobFactory._SOReportJobFactory; +import com.sun.star.sdbc.XConnection; +import com.sun.star.sdbc.XRowSet; +import com.sun.star.task.XJob; +import com.sun.star.uno.Exception; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * This class capsulates the class, that implements the minimal component, a factory for creating the service + * (__getComponentFactory) and a method, that writes the information into the given registry key + * (__writeRegistryServiceInfo). + */ +public class SOReportJobFactory +{ + + private SOReportJobFactory() + { + } + + public static class _SOReportJobFactory extends WeakBase implements XInitialization, XServiceInfo, XJob, XPropertySet, ReportJobFactory + { + + private static final Log LOGGER = LogFactory.getLog(_SOReportJobFactory.class); + /** + * The service name, that must be used to get an instance of this service. + */ + private static final String __serviceName = + "com.sun.star.report.pentaho.SOReportJobFactory"; + private final PropertySetMixin m_prophlp; + /** + * The initial component contextr, that gives access to the service manager, supported singletons, ... It's + * often later used + */ + private final XComponentContext m_cmpCtx; + private XConnection activeConnection; + private XReportDefinition report; + + public _SOReportJobFactory(final XComponentContext xCompContext) + { + m_cmpCtx = xCompContext; + m_prophlp = new PropertySetMixin(m_cmpCtx, this, + new Type(XJob.class), + null); // no optionals + } + + /** + * This method is a member of the interface for initializing an object directly after its creation. + * + * @param object This array of arbitrary objects will be passed to the component after its creation. + * @throws Exception Every exception will not be handled, but will be passed to the caller. + */ + public void initialize(final Object[] object) + throws com.sun.star.uno.Exception + { + /* The component describes what arguments its expected and in which + * order!At this point you can read the objects and can intialize + * your component using these objects. + */ + } + + /** + * This method returns an array of all supported service names. + * + * @return Array of supported service names. + */ + public String[] getSupportedServiceNames() + { + return getServiceNames(); + } + + /** + * This method is a simple helper function to used in the static component initialisation functions as well as + * in getSupportedServiceNames. + */ + public static String[] getServiceNames() + { + return new String[] + { + __serviceName + }; + } + + /** + * This method returns true, if the given service will be supported by the component. + * + * @param sServiceName Service name. + * @return True, if the given service name will be supported. + */ + public boolean supportsService(final String sServiceName) + { + return sServiceName.equals(__serviceName); + } + + /** + * Return the class name of the component. + * + * @return Class name of the component. + */ + public String getImplementationName() + { + return SOReportJobFactory.class.getName(); + } + + private String getLocaleFromRegistry(final XSimpleRegistry simpleReg, final String path, final String value) + { + String currentLocale = null; + try + { + simpleReg.open(path, true, false); + XRegistryKey xRegistryRootKey = simpleReg.getRootKey(); + // read locale + XRegistryKey locale = xRegistryRootKey.openKey(value); + if ( locale != null ) + { + final String newLocale = locale.getStringValue(); + if ( newLocale != null ) + { + currentLocale = newLocale.replace('-', '_'); + } + } + } + catch ( InvalidValueException ex ) + { + Logger.getLogger(SOReportJobFactory.class.getName()).log(Level.SEVERE, null, ex); + } + catch ( InvalidRegistryException ex ) + { + Logger.getLogger(SOReportJobFactory.class.getName()).log(Level.SEVERE, null, ex); + } + + return currentLocale; + } + + public Object execute(final NamedValue[] namedValue) + throws com.sun.star.lang.IllegalArgumentException, com.sun.star.uno.Exception + { + final ClassLoader cl = java.lang.Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); + try + { + 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"); + if ( currentLocale == null || "".equals(currentLocale) ) + { + currentLocale = getLocaleFromRegistry(simpleReg,"org.openoffice.Office.Linguistic","General/DefaultLocale"); + } + if ( currentLocale != null && !"".equals(currentLocale) ) + System.setProperty("org.pentaho.reporting.libraries.formula.locale", currentLocale); + final ReportJob job = createReportJob(namedValue); + job.execute(); + + } + catch ( java.lang.Exception e ) + { + LOGGER.error("ReportProcessing failed", e); + throw new com.sun.star.lang.WrappedTargetException(e.getMessage(), this, null); + } + catch ( java.lang.IncompatibleClassChangeError e2 ) + { + LOGGER.error("Detected an IncompatibleClassChangeError"); + throw new com.sun.star.lang.WrappedTargetException("caught a " + e2.getClass().getName(), this, new com.sun.star.uno.Exception(e2.getLocalizedMessage())); + } + Thread.currentThread().setContextClassLoader(cl); + + return null; + } + + public ReportJob createReportJob(final NamedValue[] namedValue) throws IllegalArgumentException, ReportExecutionException, Exception + { + XStorage input = null; + XStorage output = null; + XRowSet rowSet = null; + String mimetype = null; + String author = null; + String title = null; + + for ( int i = 0; i < namedValue.length; ++i ) + { + final NamedValue aProps = namedValue[i]; + if ( "ActiveConnection".equalsIgnoreCase(aProps.Name) ) + { + activeConnection = (XConnection) UnoRuntime.queryInterface(XConnection.class, aProps.Value); + } + else if ( "ReportDefinition".equalsIgnoreCase(aProps.Name) ) + { + report = (XReportDefinition) UnoRuntime.queryInterface(XReportDefinition.class, aProps.Value); + } + else if ( "InputStorage".equalsIgnoreCase(aProps.Name) ) + { + input = (XStorage) UnoRuntime.queryInterface(XStorage.class, aProps.Value); + } + else if ( "OutputStorage".equalsIgnoreCase(aProps.Name) ) + { + output = (XStorage) UnoRuntime.queryInterface(XStorage.class, aProps.Value); + } + else if ( "RowSet".equalsIgnoreCase(aProps.Name) ) + { + rowSet = (XRowSet) UnoRuntime.queryInterface(XRowSet.class, aProps.Value); + } + else if ( "mimetype".equalsIgnoreCase(aProps.Name) ) + { + mimetype = (String) aProps.Value; + } + else if ( ReportEngineParameterNames.AUTHOR.equalsIgnoreCase(aProps.Name) ) + { + author = (String) aProps.Value; + } + else if ( ReportEngineParameterNames.TITLE.equalsIgnoreCase(aProps.Name) ) + { + title = (String) aProps.Value; + } + } + + if ( input == null || output == null ) + { + throw new com.sun.star.lang.IllegalArgumentException(); + } + + if ( rowSet == null ) + { + if ( report == null || activeConnection == null ) + { + throw new com.sun.star.lang.IllegalArgumentException(); + } + mimetype = report.getMimeType(); + } + else + { + final XPropertySet set = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet); + if ( set == null ) + { + throw new com.sun.star.lang.IllegalArgumentException(); + } + activeConnection = (XConnection) UnoRuntime.queryInterface(XConnection.class, set.getPropertyValue("ActiveConnection")); + } + if ( mimetype == null ) + { + mimetype = PentahoReportEngineMetaData.OPENDOCUMENT_TEXT; + } + + final DataSourceFactory dataFactory = new SDBCReportDataFactory(m_cmpCtx, activeConnection); + final StorageRepository storageRepository = new StorageRepository(input, output); + + final String inputName = "content.xml"; + final String outputName = "content.xml"; + + final PentahoReportEngine engine = new PentahoReportEngine(); + final ReportJobDefinition definition = engine.createJobDefinition(); + final JobProperties procParms = definition.getProcessingParameters(); + procParms.setProperty(ReportEngineParameterNames.INPUT_REPOSITORY, storageRepository); + procParms.setProperty(ReportEngineParameterNames.OUTPUT_REPOSITORY, storageRepository); + procParms.setProperty(ReportEngineParameterNames.INPUT_NAME, inputName); + procParms.setProperty(ReportEngineParameterNames.OUTPUT_NAME, outputName); + procParms.setProperty(ReportEngineParameterNames.CONTENT_TYPE, mimetype); + procParms.setProperty(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY, dataFactory); + procParms.setProperty(ReportEngineParameterNames.IMAGE_SERVICE, new SOImageService(m_cmpCtx)); + procParms.setProperty(ReportEngineParameterNames.INPUT_REPORTJOB_FACTORY, this); + if ( author != null ) + { + procParms.setProperty(ReportEngineParameterNames.AUTHOR, author); + } + if ( title != null ) + { + procParms.setProperty(ReportEngineParameterNames.TITLE, title); + } + + return engine.createJob(definition); + } + + // com.sun.star.beans.XPropertySet: + public com.sun.star.beans.XPropertySetInfo getPropertySetInfo() + { + return m_prophlp.getPropertySetInfo(); + } + + public void setPropertyValue(final String aPropertyName, final Object aValue) + throws UnknownPropertyException, PropertyVetoException, com.sun.star.lang.IllegalArgumentException, + WrappedTargetException + { + m_prophlp.setPropertyValue(aPropertyName, aValue); + } + + public Object getPropertyValue(final String aPropertyName) + throws UnknownPropertyException, WrappedTargetException + { + return m_prophlp.getPropertyValue(aPropertyName); + } + + public void addPropertyChangeListener(final String aPropertyName, final XPropertyChangeListener xListener) + throws UnknownPropertyException, WrappedTargetException + { + m_prophlp.addPropertyChangeListener(aPropertyName, xListener); + } + + public void removePropertyChangeListener(final String aPropertyName, final XPropertyChangeListener xListener) + throws UnknownPropertyException, WrappedTargetException + { + m_prophlp.removePropertyChangeListener(aPropertyName, xListener); + } + + public void addVetoableChangeListener(final String aPropertyName, final XVetoableChangeListener xListener) + throws UnknownPropertyException, WrappedTargetException + { + m_prophlp.addVetoableChangeListener(aPropertyName, xListener); + } + + public void removeVetoableChangeListener(final String aPropertyName, final XVetoableChangeListener xListener) + throws UnknownPropertyException, WrappedTargetException + { + m_prophlp.removeVetoableChangeListener(aPropertyName, xListener); + } + } + + /** + * Gives a factory for creating the service. This method is called by the JavaLoader + *

+ * + * @param sImplName the name of the implementation for which a service is desired + * @return returns a XSingleComponentFactory for creating the component + * @see com.sun.star.comp.loader.JavaLoader + */ + public static XSingleComponentFactory __getComponentFactory(final String sImplName) + { + XSingleComponentFactory xFactory = null; + + try + { + if ( sImplName.equals(_SOReportJobFactory.class.getName()) ) + { + xFactory = Factory.createComponentFactory(_SOReportJobFactory.class, _SOReportJobFactory.getServiceNames()); + } + else if ( sImplName.equals(SOFunctionManager.class.getName()) ) + { + xFactory = Factory.createComponentFactory(SOFunctionManager.class, SOFunctionManager.getServiceNames()); + } + else if ( sImplName.equals(SOFormulaParser.class.getName()) ) + { + xFactory = Factory.createComponentFactory(SOFormulaParser.class, SOFormulaParser.getServiceNames()); + } + } + catch ( java.lang.IncompatibleClassChangeError e2 ) + { + } + + return xFactory; + } + + /** + * Writes the service information into the given registry key. This method is called by the JavaLoader + *

+ * + * @param regKey the registryKey + * @return returns true if the operation succeeded + * @see com.sun.star.comp.loader.JavaLoader + */ + public static boolean __writeRegistryServiceInfo(final XRegistryKey regKey) + { + return Factory.writeRegistryServiceInfo(SOFunctionManager.class.getName(), + SOFunctionManager.getServiceNames(), + regKey) && + Factory.writeRegistryServiceInfo(_SOReportJobFactory.class.getName(), + _SOReportJobFactory.getServiceNames(), + regKey) && + Factory.writeRegistryServiceInfo(SOFormulaParser.class.getName(), + SOFormulaParser.getServiceNames(), + regKey); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java new file mode 100644 index 000000000000..9c98f42eb6eb --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java @@ -0,0 +1,162 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StarFunctionCategory.java,v $ + * + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho; + +import com.sun.star.uno.XComponentContext; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.Type; +import com.sun.star.lib.uno.helper.PropertySetMixin; +import com.sun.star.report.meta.XFunctionDescription; +import java.util.Locale; +import java.util.MissingResourceException; +import org.pentaho.reporting.libraries.formula.DefaultFormulaContext; +import org.pentaho.reporting.libraries.formula.function.FunctionCategory; +import org.pentaho.reporting.libraries.formula.function.FunctionRegistry; + + +public final class StarFunctionCategory extends WeakBase + implements com.sun.star.report.meta.XFunctionCategory +{ + private final XComponentContext m_xContext; + private final PropertySetMixin m_prophlp; + // attributes + private final int m_Number; + private final FunctionCategory category; + private final FunctionRegistry functionRegistry; + private final String functions[]; + private final DefaultFormulaContext defaultContext; + private final Locale defaultLocale; + + public StarFunctionCategory( DefaultFormulaContext defaultContext,final XComponentContext context,final FunctionRegistry functionRegistry,final int _number,final FunctionCategory category ) + { + this.defaultContext = defaultContext; + m_xContext = context; + m_Number = _number; + this.category = category; + this.functionRegistry = functionRegistry; + Locale locale; + try + { + category.getDisplayName(defaultContext.getLocalizationContext().getLocale()); + locale = defaultContext.getLocalizationContext().getLocale(); + } + catch(MissingResourceException e) + { + locale = Locale.ENGLISH; + } + this.defaultLocale = locale; + + functions = functionRegistry.getFunctionNamesByCategory(category); + // use the last parameter of the PropertySetMixin constructor + // for your optional attributes if necessary. See the documentation + // of the PropertySetMixin helper for further information. + // Ensure that your attributes are initialized correctly! + m_prophlp = new PropertySetMixin(m_xContext, this, + new Type(com.sun.star.report.meta.XFunctionCategory.class), null); + }; + + // com.sun.star.beans.XPropertySet: + public com.sun.star.beans.XPropertySetInfo getPropertySetInfo() + { + return m_prophlp.getPropertySetInfo(); + } + + public void setPropertyValue(String aPropertyName, Object aValue) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.beans.PropertyVetoException, com.sun.star.lang.IllegalArgumentException,com.sun.star.lang.WrappedTargetException + { + m_prophlp.setPropertyValue(aPropertyName, aValue); + } + + public Object getPropertyValue(String aPropertyName) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + return m_prophlp.getPropertyValue(aPropertyName); + } + + public void addPropertyChangeListener(String aPropertyName, com.sun.star.beans.XPropertyChangeListener xListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + m_prophlp.addPropertyChangeListener(aPropertyName, xListener); + } + + public void removePropertyChangeListener(String aPropertyName, com.sun.star.beans.XPropertyChangeListener xListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + m_prophlp.removePropertyChangeListener(aPropertyName, xListener); + } + + public void addVetoableChangeListener(String aPropertyName, com.sun.star.beans.XVetoableChangeListener xListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + m_prophlp.addVetoableChangeListener(aPropertyName, xListener); + } + + public void removeVetoableChangeListener(String aPropertyName, com.sun.star.beans.XVetoableChangeListener xListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + m_prophlp.removeVetoableChangeListener(aPropertyName, xListener); + } + + // com.sun.star.container.XElementAccess: + public com.sun.star.uno.Type getElementType() + { + return new com.sun.star.uno.Type(XFunctionDescription.class); + } + + public boolean hasElements() + { + return functions.length != 0; + } + + // com.sun.star.container.XIndexAccess: + public int getCount() + { + return functions.length; + } + + public Object getByIndex(int Index) throws com.sun.star.lang.IndexOutOfBoundsException, com.sun.star.lang.WrappedTargetException + { + return getFunction(Index); + } + + // com.sun.star.report.meta.XFunctionCategory: + public int getNumber() + { + return m_Number; + } + + public String getName() + { + return category.getDisplayName(defaultLocale); + } + + public com.sun.star.report.meta.XFunctionDescription getFunction(int position) throws com.sun.star.lang.IndexOutOfBoundsException, com.sun.star.lang.WrappedTargetException + { + if ( position >= functions.length ) + throw new IndexOutOfBoundsException(); + return new StarFunctionDescription(defaultContext,m_xContext,this,functionRegistry,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 new file mode 100644 index 000000000000..bca8ad026b19 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java @@ -0,0 +1,191 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StarFunctionDescription.java,v $ + * + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho; + +import com.sun.star.uno.XComponentContext; +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.uno.Type; +import com.sun.star.lib.uno.helper.PropertySetMixin; +import com.sun.star.report.meta.XFunctionCategory; +import com.sun.star.sheet.FunctionArgument; +import java.util.Locale; +import java.util.MissingResourceException; +import org.pentaho.reporting.libraries.formula.DefaultFormulaContext; +import org.pentaho.reporting.libraries.formula.function.FunctionDescription; +import org.pentaho.reporting.libraries.formula.function.FunctionRegistry; + +public final class StarFunctionDescription extends WeakBase + implements com.sun.star.report.meta.XFunctionDescription +{ + + private final XComponentContext m_xContext; + private final PropertySetMixin m_prophlp; + // 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) + { + m_xContext = context; + this.category = category; + Locale locale; + try + { + functionDescription.getDisplayName(defaultContext.getLocalizationContext().getLocale()); + locale = defaultContext.getLocalizationContext().getLocale(); + } catch ( MissingResourceException e ) + { + locale = Locale.ENGLISH; + } + 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. + // Ensure that your attributes are initialized correctly! + m_prophlp = new PropertySetMixin(m_xContext, this, + new Type(com.sun.star.report.meta.XFunctionDescription.class), null); + } + ; + + // com.sun.star.beans.XPropertySet: + public com.sun.star.beans.XPropertySetInfo getPropertySetInfo() + { + return m_prophlp.getPropertySetInfo(); + } + + public void setPropertyValue(String aPropertyName, Object aValue) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.beans.PropertyVetoException, com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException + { + m_prophlp.setPropertyValue(aPropertyName, aValue); + } + + public Object getPropertyValue(String aPropertyName) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + return m_prophlp.getPropertyValue(aPropertyName); + } + + public void addPropertyChangeListener(String aPropertyName, com.sun.star.beans.XPropertyChangeListener xListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + m_prophlp.addPropertyChangeListener(aPropertyName, xListener); + } + + public void removePropertyChangeListener(String aPropertyName, com.sun.star.beans.XPropertyChangeListener xListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + m_prophlp.removePropertyChangeListener(aPropertyName, xListener); + } + + public void addVetoableChangeListener(String aPropertyName, com.sun.star.beans.XVetoableChangeListener xListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + m_prophlp.addVetoableChangeListener(aPropertyName, xListener); + } + + public void removeVetoableChangeListener(String aPropertyName, com.sun.star.beans.XVetoableChangeListener xListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException + { + m_prophlp.removeVetoableChangeListener(aPropertyName, xListener); + } + + // com.sun.star.report.meta.XFunctionDescription: + public com.sun.star.report.meta.XFunctionCategory getCategory() + { + return category; + } + + public String getName() + { + return functionDescription.getDisplayName(defaultLocale); + } + + public String getDescription() + { + return functionDescription.getDescription(defaultLocale); + } + + public String getSignature() + { + final int count = functionDescription.getParameterCount(); + final StringBuffer signature = new StringBuffer(getName()); + signature.append("("); + for (int i = 0; i < count; i++) + { + signature.append(functionDescription.getParameterDisplayName(i, defaultLocale)); + if ( i != (count - 1) ) + signature.append(";"); + } + signature.append(")"); + return signature.toString(); + } + + public com.sun.star.sheet.FunctionArgument[] getArguments() + { + int count = functionDescription.getParameterCount(); + final boolean infinite = functionDescription.isInfiniteParameterCount(); + if ( infinite ) + { + count = 30; + } + final FunctionArgument[] args = new FunctionArgument[count]; + for (int i = 0; i < args.length; i++) + { + final int pos = infinite ? 0 : i; + args[i] = new FunctionArgument(); + args[i].Description = functionDescription.getParameterDescription(pos, defaultLocale); + args[i].Name = functionDescription.getParameterDisplayName(pos, defaultLocale); + args[i].IsOptional = !functionDescription.isParameterMandatory(pos); + } + return args; + } + + public String createFormula(String[] arguments) throws com.sun.star.lang.DisposedException, com.sun.star.lang.IllegalArgumentException, com.sun.star.uno.Exception + { + final boolean infinite = functionDescription.isInfiniteParameterCount(); + final int count = functionDescription.getParameterCount(); + if ( !infinite && arguments.length > count ) + throw new com.sun.star.lang.IllegalArgumentException(); + + final StringBuffer formula = new StringBuffer(getName()); + 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(")"); + return formula.toString(); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarReportData.java b/reportbuilder/java/com/sun/star/report/pentaho/StarReportData.java new file mode 100644 index 000000000000..7d65f881ec6c --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarReportData.java @@ -0,0 +1,170 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StarReportData.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho; + +import com.sun.star.report.DataSource; +import org.jfree.report.DataSourceException; +import org.jfree.report.ReportData; + +public class StarReportData implements ReportData +{ + + private final DataSource dataSource; + private int currentRow; + private final int rowCount; + + public StarReportData(final DataSource dataSource) + throws com.sun.star.report.DataSourceException + { + if (dataSource == null) + { + throw new NullPointerException(); + } + this.dataSource = dataSource; + this.currentRow = 0; + this.rowCount = dataSource.getRowCount(); + } + + public boolean setCursorPosition(final int row) throws DataSourceException + { + try + { + final boolean ret = dataSource.absolute(row); + if (ret) + { + currentRow = row; + } + return ret; + } + catch (com.sun.star.report.DataSourceException e) + { + throw new DataSourceException("Failed to move cursor", e); + } + } + + public void close() + throws DataSourceException + { + try + { + dataSource.close(); + } + catch (com.sun.star.report.DataSourceException e) + { + throw new DataSourceException("Failed to close datasource", e); + } + } + + public int getCursorPosition() + throws DataSourceException + { + return currentRow; + } + + /** + * This operation checks, whether a call to next will be likely to succeed. If + * there is a next data row, this should return true. + * + * @return + * @throws org.jfree.report.DataSourceException + * + */ + public boolean isAdvanceable() throws DataSourceException + { + return currentRow < rowCount; + } + + public boolean next() + throws DataSourceException + { + try + { + if (dataSource.next()) + { + currentRow += 1; + return true; + } + return false; + } + catch (com.sun.star.report.DataSourceException e) + { + throw new DataSourceException("Failed to move cursor", e); + } + } + + public Object get(final int column) + throws DataSourceException + { + if (!isReadable()) + { + throw new DataSourceException("Failed to query column."); + } + + try + { + return dataSource.getObject(column + 1); + } + catch (com.sun.star.report.DataSourceException e) + { + throw new DataSourceException("Failed to query column.", e); + } + } + + public int getColumnCount() + throws DataSourceException + { + try + { + return dataSource.getColumnCount(); + } + catch (com.sun.star.report.DataSourceException e) + { + throw new DataSourceException("Failed to query column count.", e); + } + } + + public String getColumnName(final int column) + throws DataSourceException + { + try + { + return dataSource.getColumnName(column + 1); + } + catch (com.sun.star.report.DataSourceException e) + { + throw new DataSourceException("Failed to query column name.", e); + } + } + + public boolean isReadable() throws DataSourceException + { + return currentRow > 0 && rowCount > 0; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java new file mode 100644 index 000000000000..2a3600213d6c --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java @@ -0,0 +1,126 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StarReportDataFactory.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho; + +import java.util.HashMap; + +import org.jfree.report.ReportDataFactory; +import org.jfree.report.ReportData; +import org.jfree.report.DataSet; +import org.jfree.report.ReportDataFactoryException; +import com.sun.star.report.DataSourceException; +import com.sun.star.report.DataSourceFactory; + +public class StarReportDataFactory implements ReportDataFactory, Cloneable +{ + private final DataSourceFactory backend; + + public StarReportDataFactory (DataSourceFactory backend) + { + this.backend = backend; + } + + /** + * Queries a datasource. The string 'query' defines the name of the query. The + * Parameterset given here may contain more data than actually needed. + *

+ * The dataset may change between two calls, do not assume anything! + * + * @param query + * @param parameters + * @return + */ + public ReportData queryData (final String query, final DataSet parameters) + throws ReportDataFactoryException + { + try + { + final HashMap map = new HashMap(); + final int count = parameters.getColumnCount(); + for (int i = 0; i < count; i++) + { + final Object o = parameters.get(i); + map.put (parameters.getColumnName(i), o); + } + return new StarReportData(backend.queryData(query, map)); + } + catch(DataSourceException dse) + { + String message = dse.getMessage(); + if ( message.length() == 0 ) + message = "Failed to create report data wrapper"; + throw new ReportDataFactoryException(message,dse); + } + catch (org.jfree.report.DataSourceException e) + { + String message = e.getMessage(); + if ( message.length() == 0 ) + message = "Failed to query data"; + throw new ReportDataFactoryException(message); + } + } + + public void open() + { + + } + + public void close() + { + + } + + + /** + * Derives a freshly initialized report data factory, which is independend of + * the original data factory. Opening or Closing one data factory must not + * affect the other factories. + * + * @return + */ + public ReportDataFactory derive() + { + try + { + return (ReportDataFactory) clone(); + } + catch (CloneNotSupportedException e) + { + throw new IllegalStateException("Clone failed?"); + } + } + + public Object clone () throws CloneNotSupportedException + { + return super.clone(); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarReportModule.java b/reportbuilder/java/com/sun/star/report/pentaho/StarReportModule.java new file mode 100644 index 000000000000..e39de6fb2f00 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarReportModule.java @@ -0,0 +1,62 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StarReportModule.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho; + +import org.pentaho.reporting.libraries.base.boot.AbstractModule; +import org.pentaho.reporting.libraries.base.boot.ModuleInitializeException; +import org.pentaho.reporting.libraries.base.boot.SubSystem; + +public class StarReportModule extends AbstractModule +{ + public StarReportModule () + throws ModuleInitializeException + { + loadModuleInfo(); + } + + /** + * Initializes the module. Use this method to perform all initial setup operations. This + * method is called only once in a modules lifetime. If the initializing cannot be + * completed, throw a ModuleInitializeException to indicate the error,. The module will + * not be available to the system. + * + * @param subSystem the subSystem. + * @throws org.jfree.base.modules.ModuleInitializeException + * if an error ocurred while initializing the module. + */ + public void initialize (final SubSystem subSystem) + throws ModuleInitializeException + { + + + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties b/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties new file mode 100644 index 000000000000..8af708eb60c5 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties @@ -0,0 +1,158 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: configuration.properties,v $ +# +# $Revision: 1.6 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + + +## +# Do not modify the following lines. They connect this module to the central +# parser registry. +org.pentaho.reporting.libraries.resourceloader.factory.modules.com.sun.star.report.pentaho.model.OfficeDocument.star=com.sun.star.report.pentaho.parser.StarXmlFactoryModule +org.pentaho.reporting.libraries.resourceloader.factory.modules.com.sun.star.report.pentaho.model.OfficeStylesCollection.star=com.sun.star.report.pentaho.parser.StarStyleXmlFactoryModule +org.pentaho.reporting.libraries.resourceloader.factory.modules.com.sun.star.report.pentaho.styles.StyleMapper.star=com.sun.star.report.pentaho.styles.StyleMapperXmlFactoryModule + +## +# The known namespaces. +# +org.jfree.report.namespaces.star-rpt.Uri=http://openoffice.org/2005/report +org.jfree.report.namespaces.star-rpt.Default-Style=res://com/sun/star/report/pentaho/star-rpt.css +org.jfree.report.namespaces.star-rpt.Prefix=rpt +org.jfree.report.namespaces.star-rpt.ClassAttr=style-name + +org.jfree.report.namespaces.star-office.Uri=http://openoffice.org/2004/office +org.jfree.report.namespaces.star-office.Default-Style=res://com/sun/star/report/pentaho/star-office.css +org.jfree.report.namespaces.star-office.Prefix=office +org.jfree.report.namespaces.star-office.ClassAttr=style-name + +org.jfree.report.namespaces.oasis-style.Uri=urn:oasis:names:tc:opendocument:xmlns:style:1.0 +org.jfree.report.namespaces.oasis-style.Default-Style=res://com/sun/star/report/pentaho/oasis-style.css +org.jfree.report.namespaces.oasis-style.Prefix=style + +org.jfree.report.namespaces.oasis-table.Uri=urn:oasis:names:tc:opendocument:xmlns:table:1.0 +org.jfree.report.namespaces.oasis-table.Default-Style=res://com/sun/star/report/pentaho/oasis-table.css +org.jfree.report.namespaces.oasis-table.Prefix=table +org.jfree.report.namespaces.oasis-table.ClassAttr=style-name + +org.jfree.report.namespaces.oasis-draw.Uri=urn:oasis:names:tc:opendocument:xmlns:drawing:1.0 +org.jfree.report.namespaces.oasis-draw.Default-Style=res://com/sun/star/report/pentaho/oasis-draw.css +org.jfree.report.namespaces.oasis-draw.Prefix=draw +org.jfree.report.namespaces.oasis-draw.ClassAttr=style-name + +org.jfree.report.namespaces.oasis-chart.Uri=urn:oasis:names:tc:opendocument:xmlns:chart:1.0 +org.jfree.report.namespaces.oasis-chart.Default-Style=res://com/sun/star/report/pentaho/oasis-chart.css +org.jfree.report.namespaces.oasis-chart.Prefix=chart +org.jfree.report.namespaces.oasis-chart.ClassAttr=style-name + +org.jfree.report.namespaces.oasis-text.Uri=urn:oasis:names:tc:opendocument:xmlns:text:1.0 +org.jfree.report.namespaces.oasis-text.Default-Style=res://com/sun/star/report/pentaho/oasis-text.css +org.jfree.report.namespaces.oasis-text.Prefix=text +org.jfree.report.namespaces.oasis-text.ClassAttr=style-name + +org.jfree.report.namespaces.oasis-number.Uri=urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0 +org.jfree.report.namespaces.oasis-number.Default-Style=res://com/sun/star/report/pentaho/oasis-number.css +org.jfree.report.namespaces.oasis-number.Prefix=number +org.jfree.report.namespaces.oasis-number.ClassAttr=style-name + +org.jfree.report.namespaces.oasis-form.Uri=urn:oasis:names:tc:opendocument:xmlns:form:1.0 +org.jfree.report.namespaces.oasis-form.Default-Style=res://com/sun/star/report/pentaho/oasis-form.css +org.jfree.report.namespaces.oasis-form.Prefix=form + +# +# This defines a subset of the real XSL-FO standard. +org.jfree.report.namespaces.oasis-compat-fo.Uri=urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0 +org.jfree.report.namespaces.oasis-compat-fo.Default-Style=res://com/sun/star/report/pentaho/xsl-fo.css +org.jfree.report.namespaces.oasis-compat-fo.Prefix=fo + +# +# This defines a subset of the real XSL-FO standard. +org.jfree.report.namespaces.oasis-compat-svg.Uri=urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0 +org.jfree.report.namespaces.oasis-compat-svg.Default-Style=res://com/sun/star/report/pentaho/svg.css +org.jfree.report.namespaces.oasis-compat-svg.Prefix=svg + +# +# This defines a subset of the real XSL-FO standard. +org.jfree.report.namespaces.oasis-compat-smil.Uri=urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0 +org.jfree.report.namespaces.oasis-compat-smil.Default-Style=res://com/sun/star/report/pentaho/smil.css +org.jfree.report.namespaces.oasis-compat-smil.Prefix=svg + +org.jfree.report.namespaces.xsl-fo.Uri=http://www.w3.org/1999/XSL/Format +org.jfree.report.namespaces.xsl-fo.Default-Style=res://com/sun/star/report/pentaho/xsl-fo.css +org.jfree.report.namespaces.xsl-fo.Prefix=fo + +org.jfree.report.namespaces.svg.Uri=http://www.w3.org/2000/svg +org.jfree.report.namespaces.svg.Default-Style=res://com/sun/star/report/pentaho/svg.css +org.jfree.report.namespaces.svg.Prefix=svg +org.jfree.report.namespaces.svg.ClassAttr=class +org.jfree.report.namespaces.svg.StyleAttr=style + +org.jfree.report.namespaces.xml-xlink.Uri=http://www.w3.org/1999/xlink +#org.jfree.report.namespaces.xml-xlink.Default-Style=res://com/sun/star/report/pentaho/xml-xlink.css +org.jfree.report.namespaces.xml-xlink.Prefix=xlink + +# +# Tag-definition for the XML-writer. +# Prefix is 'com.sun.star.report.pentaho.output.' +# +# Declare the namespaces (this is independent of the ones defined above ..) +# "namespace."= +com.sun.star.report.pentaho.output.namespace.oasis-text=urn:oasis:names:tc:opendocument:xmlns:text:1.0 +com.sun.star.report.pentaho.output.default.oasis-text=deny + +com.sun.star.report.pentaho.output.namespace.oasis-config=urn:oasis:names:tc:opendocument:xmlns:config:1.0 +com.sun.star.report.pentaho.output.default.oasis-config=allow + +# +# Next define the tags for which we want to customize the indent-behaviour +com.sun.star.report.pentaho.output.tag.oasis-text.p=deny +com.sun.star.report.pentaho.output.tag.oasis-text.section=allow +com.sun.star.report.pentaho.output.tag.oasis-text.variable-decls=allow +com.sun.star.report.pentaho.output.tag.oasis-text.variable-decl=allow + +com.sun.star.report.pentaho.output.tag.oasis-config.config-item=deny + +com.sun.star.report.pentaho.output.namespace.oasis-data=urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0 +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.namespace.oasis-draw=urn:oasis:names:tc:opendocument:xmlns:drawing:1.0 +com.sun.star.report.pentaho.output.default.oasis-draw=deny + +org.jfree.report.flow.structure.com.sun.star.report.pentaho.model.FixedTextElement=com.sun.star.report.pentaho.layoutprocessor.FixedTextLayoutController +org.jfree.report.flow.structure.com.sun.star.report.pentaho.model.FormattedTextElement=com.sun.star.report.pentaho.layoutprocessor.FormattedTextLayoutController +org.jfree.report.flow.structure.com.sun.star.report.pentaho.model.ObjectOleElement=com.sun.star.report.pentaho.layoutprocessor.ObjectOleLayoutController +org.jfree.report.flow.structure.com.sun.star.report.pentaho.model.ImageElement=com.sun.star.report.pentaho.layoutprocessor.ImageElementLayoutController +org.jfree.report.flow.structure.com.sun.star.report.pentaho.model.TableCellElement=com.sun.star.report.pentaho.layoutprocessor.TableCellLayoutController +org.jfree.report.flow.structure.com.sun.star.report.pentaho.model.OfficeReport=com.sun.star.report.pentaho.layoutprocessor.OfficeReportLayoutController +org.jfree.report.flow.structure.com.sun.star.report.pentaho.model.OfficeGroup=com.sun.star.report.pentaho.layoutprocessor.OfficeGroupLayoutController +org.jfree.report.flow.structure.com.sun.star.report.pentaho.model.OfficeGroupSection=com.sun.star.report.pentaho.layoutprocessor.OfficeGroupSectionLayoutController +org.jfree.report.flow.structure.com.sun.star.report.pentaho.model.VariablesDeclarationSection=com.sun.star.report.pentaho.layoutprocessor.VariablesDeclarationLayoutController +org.jfree.report.flow.structure.com.sun.star.report.pentaho.model.OfficeDetailSection=com.sun.star.report.pentaho.layoutprocessor.OfficeDetailLayoutController +org.jfree.report.flow.structure.com.sun.star.report.pentaho.model.OfficeTableSection=com.sun.star.report.pentaho.layoutprocessor.OfficeTableLayoutController +org.jfree.report.flow.structure.com.sun.star.report.pentaho.model.OfficeGroupInstanceSection=com.sun.star.report.pentaho.layoutprocessor.OfficeGroupInstanceSectionLayoutController diff --git a/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java new file mode 100644 index 000000000000..e1259d168b44 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: SumExpression.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.expressions; + +import com.sun.star.report.ReportExpression; +import com.sun.star.report.DataRow; + +public class SumExpression implements ReportExpression +{ + private Object[] parameters; + + public SumExpression () + { + } + + public Object getParameters () + { + return parameters; + } + + public Object getValue (final DataRow row) + { + + return null; + } + + public void setParameters (final Object[] parameters) + { + this.parameters = parameters; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java new file mode 100644 index 000000000000..8e2d395c8493 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: SumExpressionMetaData.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.expressions; + +import java.util.Locale; + +import com.sun.star.report.ReportExpressionMetaData; + +public class SumExpressionMetaData implements ReportExpressionMetaData +{ + public String getDescription (final Locale l) + { + // todo implement me + return null; + } + + public String getDisplayName (final Locale l) + { + // todo implement me + return null; + } + + public String getName () + { + // todo implement me + return null; + } + + public int getParameterCount () + { + // todo implement me + return 0; + } + + public String getParameterDescription (final int param,final Locale locale) + { + // todo implement me + return null; + } + + public String getParameterDisplayName (final int param,final Locale locale) + { + // todo implement me + return null; + } + + public String getParameterName (final int param) + { + // todo implement me + return null; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java new file mode 100644 index 000000000000..3f7245bf12c9 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java @@ -0,0 +1,270 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: AbstractReportElementLayoutController.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.layoutprocessor; + +import com.sun.star.report.pentaho.model.ReportElement; +import com.sun.star.report.pentaho.model.OfficeGroupSection; +import org.jfree.report.DataSourceException; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.DataRow; +import org.jfree.report.DataFlags; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Group; +import org.jfree.report.expressions.Expression; +import org.jfree.report.flow.FlowController; +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.jfree.report.flow.layoutprocessor.SectionLayoutController; +import org.pentaho.reporting.libraries.formula.lvalues.LValue; +import org.pentaho.reporting.libraries.formula.lvalues.ContextLookup; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 05.03.2007 + * @noinspection CloneableClassWithoutClone + */ +public abstract class AbstractReportElementLayoutController + extends AbstractLayoutController +{ + + public static final int NOT_STARTED = 0; + public static final int FINISHED = 2; + private int state; + + protected AbstractReportElementLayoutController() + { + } + + /** + * Advances the processing position. + * + * @param target the report target that receives generated events. + * @return the new layout controller instance representing the new state. + * + * @throws org.jfree.report.DataSourceException if there was a problem reading data from + * the datasource. + * @throws org.jfree.report.ReportProcessingException if there was a general problem during + * the report processing. + * @throws org.jfree.report.ReportDataFactoryException if a query failed. + */ + public LayoutController advance(final ReportTarget target) + throws DataSourceException, ReportDataFactoryException, + ReportProcessingException + { + if (state != AbstractReportElementLayoutController.NOT_STARTED) + { + throw new IllegalStateException(); + } + + boolean isPrintableContent = true; + final ReportElement text = (ReportElement) getNode(); + // Tests we have to perform: + // 1. Print when group changes. We can know whether a group changed by + // looking at the newly introduced iteration counter. + // + // Whether we use the next one or the one after that depends on whether + // this element is a child of a group-header or group-footer. + + // 2. Print repeated values. This never applies to static text or static + // elements. + if ((text.isPrintWhenGroupChanges() && !isGroupChanged()) || (!text.isPrintRepeatedValues() && !isValueChanged())) + { + // if this is set to true, then we print the element only if this is the + // first occurrence in this group. + // or + // If this is set to true, we evaluate the formula of the element and + // try to derive whether there was a change. + isPrintableContent = false; + } + + // 3. Evaluate the Display Condition + final Expression dc = text.getDisplayCondition(); + if (dc != null) + { + final Object o = LayoutControllerUtil.evaluateExpression(getFlowController(), text, dc); + if (Boolean.FALSE.equals(o)) + { +// LOGGER.debug ("DISPLAY Condition forbids printing"); + isPrintableContent = false; + } + } + + if (!isPrintableContent) + { + // There is no printable content at all. Set the state to FINISHED + return join(getFlowController()); + } + else + { + // delegate to the handler .. + return delegateContentGeneration(target); + } + + } + + protected abstract boolean isValueChanged(); + + protected boolean isGroupChanged() + { + // search the group. + final SectionLayoutController slc = findGroup(); + if (slc == null) + { + // Always print the content of the report header and footer and + // the page header and footer. + return true; + } + + // we are in the first iteration, so yes, the group has changed recently. + return slc.getIterationCount() == 0; + } + + private SectionLayoutController findGroup() + { + LayoutController parent = getParent(); + boolean skipNext = false; + while (parent != null) + { + if (!(parent instanceof SectionLayoutController)) + { + parent = parent.getParent(); + } + else + { + final SectionLayoutController slc = (SectionLayoutController) parent; + final Element element = slc.getElement(); + if (element instanceof OfficeGroupSection) + { + // This is a header or footer. So we take the next group instead. + skipNext = true; + parent = parent.getParent(); + } + else if (!(element instanceof Group)) + { + parent = parent.getParent(); + } + else if (skipNext) + { + skipNext = false; + parent = parent.getParent(); + } + else + { + return (SectionLayoutController) parent; + } + } + } + return null; + } + + /** + * Joins with a delegated process flow. This is generally called from a child + * flow and should *not* (I mean it!) be called from outside. If you do, + * you'll suffer. + * + * @param flowController the flow controller of the parent. + * @return the joined layout controller that incorperates all changes from the + * delegate. + */ + public LayoutController join(final FlowController flowController) + throws DataSourceException, ReportDataFactoryException, + ReportProcessingException + { + final AbstractReportElementLayoutController alc = + (AbstractReportElementLayoutController) clone(); + alc.state = AbstractReportElementLayoutController.FINISHED; + return alc; + } + + protected abstract LayoutController delegateContentGeneration(final ReportTarget target) + throws ReportProcessingException, ReportDataFactoryException, + DataSourceException; + + /** + * Checks, whether the layout controller would be advanceable. If this method + * returns true, it is generally safe to call the 'advance()' method. + * + * @return true, if the layout controller is advanceable, false otherwise. + */ + public boolean isAdvanceable() + { + return state != AbstractReportElementLayoutController.FINISHED; + } + + protected boolean isReferenceChanged(final LValue lValue) + { + if (lValue instanceof ContextLookup) + { + final ContextLookup rval = (ContextLookup) lValue; + final String s = rval.getName(); + final DataRow view = getFlowController().getMasterRow().getGlobalView(); + try + { + final DataFlags flags = view.getFlags(s); + if (flags != null && flags.isChanged()) + { +// LOGGER.debug ("Reference " + s + " is changed"); + return true; + } +// LOGGER.debug ("Reference " + s + " is unchanged"); + } + catch (DataSourceException e) + { + // ignore .. assume that the reference has not changed. + } + } + final LValue[] childValues = lValue.getChildValues(); + for (int i = 0; i < childValues.length; i++) + { + final LValue value = childValues[i]; + if (isReferenceChanged(value)) + { + return true; + } + } +// LOGGER.debug ("Unchanged."); + return false; + } + + public int getState() + { + return state; + } + + protected void setState(final int state) + { + this.state = state; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java new file mode 100644 index 000000000000..9ced56ef7ac4 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java @@ -0,0 +1,91 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FixedTextLayoutController.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.layoutprocessor; + +import org.jfree.report.flow.layoutprocessor.LayoutController; +import org.jfree.report.flow.layoutprocessor.LayoutControllerFactory; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.ReportContext; +import org.jfree.report.data.GlobalMasterRow; +import org.jfree.report.data.ReportDataRow; +import org.jfree.report.structure.Section; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.DataSourceException; +import com.sun.star.report.pentaho.model.FixedTextElement; + +/** + * Processes a fixed-text element of the OpenOffice reporting specifciation. + * The element itself contains a single paragraph which contains the content. + * After checking, whether this element should be printed, this layout + * controller simply delegates the dirty work to a suitable handler. + * + * @author Thomas Morgner + * @noinspection CloneableClassWithoutClone + * @since 05.03.2007 + */ +public class FixedTextLayoutController + extends AbstractReportElementLayoutController +{ + + public FixedTextLayoutController() + { + } + + + protected boolean isValueChanged() + { + final FlowController controller = getFlowController(); + final GlobalMasterRow masterRow = controller.getMasterRow(); + final ReportDataRow reportDataRow = masterRow.getReportDataRow(); + return reportDataRow.getCursor() == 0; + } + + protected LayoutController delegateContentGeneration + (final ReportTarget target) + throws ReportProcessingException, ReportDataFactoryException, + DataSourceException + { + final FixedTextElement fte = (FixedTextElement) getNode(); + final Section content = fte.getContent(); + + final FlowController flowController = getFlowController(); + final ReportContext reportContext = flowController.getReportContext(); + final LayoutControllerFactory layoutControllerFactory = + reportContext.getLayoutControllerFactory(); + + final FixedTextLayoutController flc = (FixedTextLayoutController) clone(); + flc.setState(AbstractReportElementLayoutController.FINISHED); + return layoutControllerFactory.create(flowController, content, flc); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java new file mode 100755 index 000000000000..4eea93329cb4 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -0,0 +1,166 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FormatValueUtility.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package com.sun.star.report.pentaho.layoutprocessor; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.model.FormattedTextElement; +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.DataFlags; +import org.jfree.report.DataSourceException; +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; + +/** + * Creation-Date: 06.06.2007, 17:03:30 + * + * @author Thomas Morgner + */ +public class FormatValueUtility +{ + private static final String BOOLEAN_VALUE = "boolean-value"; + private static final String STRING_VALUE = "string-value"; + + public static final String VALUE_TYPE = "value-type"; + private static SimpleDateFormat dateFormat; + + private FormatValueUtility() + { + } + + public static String applyValueForVariable(final Object value, final AttributeMap variableSection) + { + String ret = null; + if (value instanceof 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 Number) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "float"); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", String.valueOf(value)); + } + else if (value instanceof Boolean) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "boolean"); + if (Boolean.TRUE.equals(value)) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,BOOLEAN_VALUE, OfficeToken.TRUE); + } + else + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,BOOLEAN_VALUE, OfficeToken.FALSE); + } + } + else if (value != null) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "string"); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,STRING_VALUE, String.valueOf(value)); + } + else + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "string"); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,STRING_VALUE, ""); + } + return ret; + } + + public static void applyValueForCell(final Object value, final AttributeMap variableSection) + { + if (value instanceof Date) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value)); + } + else if (value instanceof Number) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", String.valueOf(value)); + } + else if (value instanceof Boolean) + { + if (Boolean.TRUE.equals(value)) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,BOOLEAN_VALUE, OfficeToken.TRUE); + } + else + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,BOOLEAN_VALUE, OfficeToken.FALSE); + } + } + else if (value != null) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,STRING_VALUE, String.valueOf(value)); + } + else + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,STRING_VALUE, ""); + } + } + + private static synchronized String formatDate(final Date date) + { + if (dateFormat == null) + { + dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'S'Z'"); + } + return dateFormat.format(date); + } + + public static DataFlags computeDataFlag(final FormattedTextElement element, + final FlowController flowController) + throws DataSourceException + { + // here it is relatively easy. We have to evaluate the expression, convert + // the result into a string, and print that string. + final FormulaExpression formulaExpression = element.getValueExpression(); + final Object result = LayoutControllerUtil.evaluateExpression(flowController, element, formulaExpression); + if (result == null) + { + // ignore it. Ignoring it is much better than printing 'null'. + // LOGGER.debug("Formula '" + formulaExpression.getFormula() + "' evaluated to null."); + return null; + } + else if (result instanceof DataFlags) + { + return (DataFlags) result; + } + else + { + return new DefaultDataFlags(null, result, true); + } + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java new file mode 100644 index 000000000000..c5c69d24716b --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java @@ -0,0 +1,217 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FormattedTextLayoutController.java,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.layoutprocessor; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.model.FormattedTextElement; +import com.sun.star.report.pentaho.model.OfficeDocument; +import com.sun.star.report.pentaho.model.OfficeStyle; +import org.pentaho.reporting.libraries.formula.Formula; +import org.pentaho.reporting.libraries.formula.lvalues.LValue; +import org.pentaho.reporting.libraries.formula.parser.ParseException; +import org.jfree.report.DataFlags; +import org.jfree.report.DataSourceException; +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.expressions.FormulaExpression; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.layoutprocessor.LayoutController; +import org.jfree.report.structure.Element; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jfree.layouting.util.AttributeMap; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 05.03.2007 + */ +public class FormattedTextLayoutController + extends AbstractReportElementLayoutController +{ + private static final Log LOGGER = LogFactory.getLog(FormattedTextLayoutController.class); + public FormattedTextLayoutController() + { + } + + private VariablesCollection getVariablesCollection() + { + LayoutController parent = getParent(); + while (parent != null) + { + if (parent instanceof OfficeRepeatingStructureLayoutController) + { + final OfficeRepeatingStructureLayoutController orslc = + (OfficeRepeatingStructureLayoutController) parent; + if (orslc.isNormalFlowProcessing()) + { + return null; + } + + return orslc.getVariablesCollection(); + } + parent = parent.getParent(); + } + return null; + } + + protected boolean isValueChanged() + { + try + { + final FormattedTextElement element = (FormattedTextElement) getNode(); + final FormulaExpression formulaExpression = element.getValueExpression(); + final Formula formula = formulaExpression.getCompiledFormula(); + final LValue lValue = formula.getRootReference(); + return isReferenceChanged(lValue); + } + catch (final ParseException e) + { + LOGGER.debug("Parse Exception", e); + return false; + } + } + + protected LayoutController delegateContentGeneration(final ReportTarget target) + throws ReportProcessingException, ReportDataFactoryException, + DataSourceException + { + final FormattedTextElement element = (FormattedTextElement) getNode(); + final VariablesCollection vc = getVariablesCollection(); + if (vc != null) + { + final String name = vc.addVariable(element); + final AttributeMap variablesGet = new AttributeMap(); + variablesGet.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, + Element.TYPE_ATTRIBUTE, "variable-get"); + variablesGet.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, + Element.NAMESPACE_ATTRIBUTE, OfficeNamespaces.TEXT_NS); + variablesGet.setAttribute(OfficeNamespaces.TEXT_NS, "name", name); + //variablesGet.setAttribute(OfficeNamespaces.TEXT_NS, "display", "value"); + + final String dataStyleName = computeValueStyle(); + if (dataStyleName != null) + { + variablesGet.setAttribute(OfficeNamespaces.STYLE_NS, "data-style-name", dataStyleName); + } + + final String valueType = computeValueType(); + variablesGet.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE, valueType); + target.startElement(variablesGet); + + target.endElement(variablesGet); + } + else + { + + final DataFlags df = FormatValueUtility.computeDataFlag(element, getFlowController()); + if (df != null) + { + target.processContent(df); + } + } + + return join(getFlowController()); + } + + private OfficeDocument getDocument() + { + LayoutController parent = getParent(); + while (parent != null) + { + final Object node = parent.getNode(); + if (node instanceof OfficeDocument) + { + return (OfficeDocument) node; + } + parent = parent.getParent(); + } + return null; + } + + private Element getParentTableCell() + { + LayoutController parent = getParent(); + while (parent != null) + { + if (parent instanceof TableCellLayoutController) + { + final TableCellLayoutController cellController = (TableCellLayoutController) parent; + return cellController.getElement(); + } + parent = parent.getParent(); + } + return null; + } + + private String computeValueStyle() + { + final Element tce = getParentTableCell(); + if (tce == null) + { + return null; + } + + final String cellStyleName = (String) tce.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); + if (cellStyleName == null) + { + return null; + } + final OfficeDocument document = getDocument(); + if (document == null) + { + return null; + } + + final OfficeStyle style = document.getStylesCollection().getStyle("table-cell", cellStyleName); + return (String) style.getAttribute(OfficeNamespaces.STYLE_NS, "data-style-name"); + } + + private String computeValueType() + { + final Element tce = getParentTableCell(); + if (tce == null) + { + // NO particular format means: Fallback to string and hope and pray .. + throw new IllegalStateException("A formatted text element must be a child of a Table-Cell."); + } + + final String type = (String) tce.getAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE); + if (type == null) + { + LOGGER.error("The Table-Cell does not have a office:value attribute defined. Your content will be messed up."); + return "string"; + } + return type; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementContext.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementContext.java new file mode 100644 index 000000000000..4f5ffbdcf35e --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementContext.java @@ -0,0 +1,94 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ImageElementContext.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.layoutprocessor; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 30.03.2007 + */ +public class ImageElementContext +{ + private final int colSpan; + private final int rowSpan; + private String[] rowStyles; + private String[] colStyles; + + public ImageElementContext(final int colSpan, final int rowSpan) + { + this.colSpan = colSpan; + this.rowSpan = rowSpan; + this.colStyles = new String[colSpan]; + this.rowStyles = new String[rowSpan]; + } + + public int getColSpan() + { + return colSpan; + } + + public int getRowSpan() + { + return rowSpan; + } + + public String[] getRowStyles() + { + return rowStyles; + } + + public String[] getColStyles() + { + return colStyles; + } + + public void setRowStyle (final int pos, final String styleName) + { + rowStyles[pos] = styleName; + } + + public void setColStyle (final int pos, final String styleName) + { + colStyles[pos] = styleName; + } + + public String getRowStyle (final int pos) + { + return rowStyles[pos]; + } + + public String getColStyle (final int pos) + { + return colStyles[pos]; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java new file mode 100644 index 000000000000..8cd296151005 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java @@ -0,0 +1,332 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ImageElementLayoutController.java,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.layoutprocessor; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.model.ImageElement; +import org.pentaho.reporting.libraries.formula.Formula; +import org.pentaho.reporting.libraries.formula.lvalues.LValue; +import org.pentaho.reporting.libraries.formula.parser.ParseException; +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.DataSourceException; +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.util.TextUtilities; +import org.jfree.report.data.GlobalMasterRow; +import org.jfree.report.data.ReportDataRow; +import org.jfree.report.expressions.FormulaExpression; +import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.layoutprocessor.LayoutController; +import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; +import org.jfree.report.structure.Node; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.pentaho.reporting.libraries.base.util.ObjectUtilities; + +/** + * Produces an image. The image-structures itself (draw:frame and so on) are not generated here. This element produces a + * place-holder element and relies on the output target to compute a sensible position for the element. The report + * definition does not give any hints about the size of the image, so we have to derive this from the surrounding + * context. + * + * @author Thomas Morgner + * @since 05.03.2007 + */ +public class ImageElementLayoutController + extends AbstractReportElementLayoutController +{ + private static final Log LOGGER = LogFactory.getLog(ImageElementLayoutController.class); + private ImageElementContext context; + + public ImageElementLayoutController() + { + } + + protected LayoutController delegateContentGeneration(final ReportTarget target) + throws ReportProcessingException, ReportDataFactoryException, + DataSourceException + { + final ImageElement imageElement = (ImageElement) getNode(); + final FormulaExpression formulaExpression = imageElement.getFormula(); + if (formulaExpression == null) + { + // 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()); + } + else + { + final Object value = + LayoutControllerUtil.evaluateExpression(getFlowController(), imageElement, formulaExpression); + generateImage(target, value, imageElement.isScale(), imageElement.isPreserveIRI()); + } + return join(getFlowController()); + } + + private void generateImage(final ReportTarget target, + final Object linkTarget, + final boolean scale, + final boolean preserveIri) + throws ReportProcessingException, DataSourceException + { + if (linkTarget == null) + { + return; + } + + 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.PRESERVE_IRI, String.valueOf(preserveIri)); + image.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "image-context", createContext()); + image.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.IMAGE_DATA, linkTarget); + target.startElement(image); + target.endElement(image); + } + + protected ImageElementContext createContext() + { + if (context == null) + { + + // Step 1: Find the parent cell. + final LayoutController cellController = findParentCell(); + if (cellController == null) + { + LOGGER.warn("Image is not contained in a table. Unable to calculate the image-size."); + return null; + } + final Element tableCell = (Element) cellController.getNode(); + final int rowSpan = TextUtilities.parseInt((String) tableCell.getAttribute(OfficeNamespaces.TABLE_NS, "number-rows-spanned"), 1); + final int colSpan = TextUtilities.parseInt((String) tableCell.getAttribute(OfficeNamespaces.TABLE_NS, "number-columns-spanned"), 1); + if (rowSpan < 1 || colSpan < 1) + { + LOGGER.warn("Rowspan or colspan for image-size calculation was invalid."); + return null; + } + + final LayoutController rowController = cellController.getParent(); + if (rowController == null) + { + LOGGER.warn("Table-Cell has no parent. Unable to calculate the image-size."); + return null; + } + final Section tableRow = (Section) rowController.getNode(); + // we are now making the assumption, that the row is a section, that contains the table-cell. + // This breaks the ability to return nodes or to construct reports on the fly, but the OO-report format + // is weird anyway and wont support such advanced techniques for the next few centuries .. + final int columnPos = findNodeInSection(tableRow, tableCell, OfficeToken.COVERED_TABLE_CELL); + if (columnPos == -1) + { + LOGGER.warn("Table-Cell is not a direct child of the table-row. Unable to calculate the image-size."); + return null; + } + + final LayoutController tableController = rowController.getParent(); + if (tableController == null) + { + LOGGER.warn("Table-Row has no Table. Unable to calculate the image-size."); + return null; + } + + final Section table = (Section) tableController.getNode(); + // ok, we got a table, so as next we have to search for the columns now. + final Section columns = (Section) table.findFirstChild(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMNS); + if (columns.getNodeCount() <= columnPos + colSpan) + { + // the colspan is to large. The table definition is therefore invalid. We do not try to fix this. + LOGGER.warn( + "The Table's defined columns do not match the col-span or col-position. Unable to calculate the image-size."); + return null; + } + + final ImageElementContext context = new ImageElementContext(colSpan, rowSpan); + addColumnStyles(context, columns, columnPos, colSpan); + // finally search the styles for the row now. + final int rowPos = findNodeInSection(table, tableRow, null); + if (rowPos == -1) + { + LOGGER.warn("Table-Cell is not a direct child of the table-row. Unable to calculate the image-size."); + return null; + } + + addRowStyles(context, table,rowPos,rowSpan); + this.context = context; + } + return this.context; + } + + private int findNodeInSection(final Section tableRow, + final Element tableCell, + final String secondType) + { + int retval = 0; + final Node[] nodes = tableRow.getNodeArray(); + final String namespace = tableCell.getNamespace(); + final String type = tableCell.getType(); + for (int i = 0; i < nodes.length; i++) + { + final Node node = nodes[i]; + if (!(node instanceof Element)) + { + continue; + } + final Element child = (Element) node; + /* + if (! OfficeToken.COVERED_TABLE_CELL.equals(child.getType()) && + (ObjectUtilities.equal(child.getNamespace(), namespace) == false || + ObjectUtilities.equal(child.getType(), type) == false)) + */ + if (!ObjectUtilities.equal(child.getNamespace(), namespace) || + (!ObjectUtilities.equal(child.getType(), type) && (secondType == null || !ObjectUtilities.equal(child.getType(), secondType)))) + { + continue; + } + + if (node == tableCell) + { + return retval; + } + retval += 1; + } + return -1; + } + + private LayoutController findParentCell() + { + LayoutController parent = getParent(); + while (parent != null) + { + final Object node = parent.getNode(); + if (node instanceof Element) + { + final Element element = (Element) node; + if (OfficeNamespaces.TABLE_NS.equals(element.getNamespace()) && "table-cell".equals(element.getType())) + { + return parent; + } + } + parent = parent.getParent(); + } + return null; + } + + protected boolean isValueChanged() + { + final ImageElement imageElement = (ImageElement) getNode(); + final FormulaExpression formulaExpression = imageElement.getFormula(); + if (formulaExpression == null) + { + final FlowController controller = getFlowController(); + final GlobalMasterRow masterRow = controller.getMasterRow(); + final ReportDataRow reportDataRow = masterRow.getReportDataRow(); + if (reportDataRow.getCursor() == 0) + { + return true; + } + return false; + } + + try + { + final Formula formula = formulaExpression.getCompiledFormula(); + final LValue lValue = formula.getRootReference(); + return isReferenceChanged(lValue); + } + catch (ParseException e) + { + return false; + } + } + + void addColumnStyles(final ImageElementContext context, final Section columns, final int columnPos, final int colSpan) + { + final Node[] columnDefs = columns.getNodeArray(); + int columnCounter = 0; + for (int i = 0; i < columnDefs.length; i++) + { + final Element column = (Element) columnDefs[i]; + + if (!ObjectUtilities.equal(column.getNamespace(), OfficeNamespaces.TABLE_NS) || + !ObjectUtilities.equal(column.getType(), OfficeToken.TABLE_COLUMN)) + { + continue; + } + if (columnCounter >= columnPos) + { + final String colStyle = (String) column.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); + context.setColStyle(columnCounter - columnPos, colStyle); + } + + columnCounter += 1; + + if (columnCounter >= (columnPos + colSpan)) + { + break; + } + + } + } + + void addRowStyles(final ImageElementContext context, final Section table, final int rowPos, final int rowSpan) + { + final Node[] rows = table.getNodeArray(); + int rowCounter = 0; + for (int i = 0; i < rows.length; i++) + { + final Element row = (Element) rows[i]; + + if (!ObjectUtilities.equal(row.getNamespace(), OfficeNamespaces.TABLE_NS) || + !ObjectUtilities.equal(row.getType(), OfficeToken.TABLE_ROW)) + { + continue; + } + if (rowCounter >= rowPos) + { + final String rowStyle = (String) row.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); + context.setRowStyle(rowCounter - rowPos, rowStyle); + } + + rowCounter += 1; + + if (rowCounter >= (rowPos + rowSpan)) + { + break; + } + } + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java new file mode 100644 index 000000000000..97e4332217a9 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java @@ -0,0 +1,126 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ObjectOleLayoutController.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +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; +import java.util.Iterator; +import java.util.List; +import org.jfree.report.DataSourceException; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.layoutprocessor.LayoutController; +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.DataFlags; +import org.jfree.report.DataRow; +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.structure.Element; + +/** + * + * @author Ocke Janssen + */ +public class ObjectOleLayoutController extends AbstractReportElementLayoutController +{ + + public ObjectOleLayoutController() + { + } + + protected boolean isValueChanged() + { + final ObjectOleElement element = (ObjectOleElement) getNode(); + final List masterfields = element.getMasterfields(); + final DataRow view = getFlowController().getMasterRow().getGlobalView(); + for (final Iterator iter = masterfields.iterator(); iter.hasNext();) + { + final String master = (String) iter.next(); + try + { + final DataFlags flags = view.getFlags(master); + if (flags != null && flags.isChanged()) + { + return true; + } + } + catch (DataSourceException e) + { + // ignore .. assume that the reference has not changed. + } + } + return false; + } + + protected LayoutController delegateContentGeneration(final ReportTarget target) throws ReportProcessingException, ReportDataFactoryException, DataSourceException + { + final ObjectOleElement element = (ObjectOleElement) getNode(); + final String url = element.getUrl(); + if (url != null) + { + final AttributeMap ole = new AttributeMap(); + ole.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.NAMESPACE_ATTRIBUTE, JFreeReportInfo.REPORT_NAMESPACE); + ole.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.TYPE_ATTRIBUTE, OfficeToken.OBJECT_OLE); + ole.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "href", url); + ole.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "class-id", element.getClassid()); + final List masterfields = element.getMasterfields(); + final List values = new ArrayList(); + final DataRow view = getFlowController().getMasterRow().getGlobalView(); + for (final Iterator iter = masterfields.iterator(); iter.hasNext();) + { + final String master = (String) iter.next(); + try + { + final DataFlags flags = view.getFlags(master); + if (flags != null) + { + values.add(flags.getValue()); + } + } + catch (DataSourceException e) + { + // ignore .. assume that the reference has not changed. + } + } + ole.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, SDBCReportDataFactory.MASTER_COLUMNS, masterfields); + ole.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, SDBCReportDataFactory.MASTER_VALUES, values); + ole.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, SDBCReportDataFactory.DETAIL_COLUMNS, element.getDetailfields()); + + target.startElement(ole); + target.endElement(ole); + } + + return join(getFlowController()); + } +} + diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java new file mode 100644 index 000000000000..9060ed64981d --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java @@ -0,0 +1,164 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeDetailLayoutController.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.layoutprocessor; + +import com.sun.star.report.pentaho.model.VariablesDeclarationSection; +import org.jfree.report.DataSourceException; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.ReportData; +import org.jfree.report.data.GlobalMasterRow; +import org.jfree.report.data.ReportDataRow; +import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.layoutprocessor.ElementLayoutController; +import org.jfree.report.flow.layoutprocessor.LayoutController; +import org.jfree.report.flow.layoutprocessor.SectionLayoutController; + +/** + * Creation-Date: 11.04.2007, 11:04:02 + * + * @author Thomas Morgner + */ +public class OfficeDetailLayoutController extends SectionLayoutController +{ + public static final int STATE_PROCESS_VARIABLES = 2; + public static final int STATE_PROCESS_NORMAL_FLOW = 3; + + private boolean waitForJoin; + private int state; + + public OfficeDetailLayoutController() + { + } + + /** + * Initializes the layout controller. This method is called exactly once. It + * is the creators responsibility to call this method. + *

+ * Calling initialize after the first advance must result in a + * IllegalStateException. + * + * @param node the currently processed object or layout node. + * @param flowController the current flow controller. + * @param parent the parent layout controller that was responsible for + * instantiating this controller. + * @throws org.jfree.report.DataSourceException + * if there was a problem reading data from the datasource. + * @throws org.jfree.report.ReportProcessingException + * if there was a general problem during the report processing. + * @throws org.jfree.report.ReportDataFactoryException + * if a query failed. + */ + public void initialize(final Object node, + final FlowController flowController, + final LayoutController parent) + throws DataSourceException, ReportDataFactoryException, + ReportProcessingException + { + super.initialize(node, flowController, parent); + state = OfficeDetailLayoutController.STATE_PROCESS_VARIABLES; + } + + /** + * This method is called for each newly instantiated layout controller. The returned layout controller instance should + * have a processing state of either 'OPEN' or 'FINISHING' depending on whether there is any content or any child + * nodes to process. + * + * @param target the report target that receives generated events. + * @return the new layout controller instance representing the new state. + * @throws org.jfree.report.DataSourceException + * if there was a problem reading data from the datasource. + * @throws org.jfree.report.ReportProcessingException + * if there was a general problem during the report processing. + * @throws org.jfree.report.ReportDataFactoryException + * if a query failed. + */ + protected LayoutController startElement(final ReportTarget target) + throws DataSourceException, ReportProcessingException, ReportDataFactoryException + { + final FlowController fc = getFlowController(); + final GlobalMasterRow masterRow = fc.getMasterRow(); + final ReportDataRow reportDataRow = masterRow.getReportDataRow(); + final ReportData reportData = reportDataRow.getReportData(); + if (!reportData.isReadable()) + { + reportData.isReadable(); + // If this report has no data, then do not print the detail section. The detail section + // is the only section that behaves this way, and for now this is only done in the OO-implementation + final SectionLayoutController derived = (SectionLayoutController) clone(); + derived.setProcessingState(ElementLayoutController.FINISHED); + derived.setFlowController(fc); + return derived; + } + + if (state == OfficeDetailLayoutController.STATE_PROCESS_VARIABLES) + { + final VariablesDeclarationSection variables = new VariablesDeclarationSection(); + final OfficeDetailLayoutController controller = (OfficeDetailLayoutController) clone(); + controller.state = OfficeDetailLayoutController.STATE_PROCESS_NORMAL_FLOW; + controller.waitForJoin = true; + return processChild(controller, variables, fc); + } + + return super.startElement(target); + } + + protected void resetSectionForRepeat() + { + super.resetSectionForRepeat(); + state = STATE_PROCESS_VARIABLES; + } + + /** + * Joins with a delegated process flow. This is generally called from a child + * flow and should *not* (I mean it!) be called from outside. If you do, + * you'll suffer. + * + * @param flowController the flow controller of the parent. + * @return the joined layout controller that incorperates all changes from the + * delegate. + */ + public LayoutController join(final FlowController flowController) + { + if (waitForJoin) + { + final OfficeDetailLayoutController derived = (OfficeDetailLayoutController) clone(); + derived.setProcessingState(ElementLayoutController.NOT_STARTED); + derived.setFlowController(flowController); + derived.waitForJoin = false; + return derived; + } + return super.join(flowController); + } + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupInstanceSectionLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupInstanceSectionLayoutController.java new file mode 100644 index 000000000000..8a3779cebe03 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupInstanceSectionLayoutController.java @@ -0,0 +1,160 @@ +package com.sun.star.report.pentaho.layoutprocessor; + +import org.jfree.report.flow.layoutprocessor.SectionLayoutController; +import org.jfree.report.flow.layoutprocessor.LayoutController; +import org.jfree.report.flow.layoutprocessor.ElementLayoutController; +import org.jfree.report.flow.layoutprocessor.LayoutControllerFactory; +import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil; +import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.ReportContext; +import org.jfree.report.DataSourceException; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.expressions.Expression; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Node; +import org.jfree.layouting.util.AttributeMap; +import com.sun.star.report.pentaho.model.VariablesDeclarationSection; +import com.sun.star.report.pentaho.model.OfficeGroupSection; +import org.jfree.report.JFreeReportInfo; + +/** + * Creation-Date: 25.07.2007, 14:50:45 + * + * @author Thomas Morgner + */ +public class OfficeGroupInstanceSectionLayoutController extends SectionLayoutController +{ + public static final int STATE_PROCESS_VARIABLES = 2; + public static final int STATE_PROCESS_NORMAL_FLOW = 3; + private int state; + private boolean waitForJoin; + + public OfficeGroupInstanceSectionLayoutController() + { + } + + public void initialize(final Object node, final FlowController flowController, final LayoutController parent) + throws DataSourceException, ReportDataFactoryException, ReportProcessingException + { + super.initialize(node, flowController, parent); + state = STATE_PROCESS_VARIABLES; + } + + protected LayoutController processContent(final ReportTarget target) + throws DataSourceException, ReportProcessingException, ReportDataFactoryException + { + if (state == OfficeGroupInstanceSectionLayoutController.STATE_PROCESS_VARIABLES) + { + // todo: Fill the variables section with something sensible .. + final VariablesDeclarationSection variables = new VariablesDeclarationSection(); + final OfficeGroupInstanceSectionLayoutController controller = + (OfficeGroupInstanceSectionLayoutController) clone(); + controller.state = + OfficeGroupLayoutController.STATE_PROCESS_NORMAL_FLOW; + controller.waitForJoin = true; + return processChild(controller, variables, getFlowController()); + } + return super.processContent(target); + } + + // isDisplayable is private in version 0.9.1, so until the upgrade we keep this copy of the method + // todo: Delete it unce the sun-cvs contains version 0.9.2. + protected LayoutController processChild(final SectionLayoutController derived, + final Node node, + final FlowController flowController) + throws DataSourceException, ReportProcessingException, + ReportDataFactoryException + { + final ReportContext reportContext = flowController.getReportContext(); + final LayoutControllerFactory layoutControllerFactory = reportContext.getLayoutControllerFactory(); + if (isDisplayable(node)) + { + derived.setProcessingState(ElementLayoutController.WAITING_FOR_JOIN); + return layoutControllerFactory.create(flowController, node, derived); + } + else + { + derived.setProcessingState(ElementLayoutController.WAITING_FOR_JOIN); + final LayoutController childLc = layoutControllerFactory.create(flowController, node, derived); + return LayoutControllerUtil.skipInvisibleElement(childLc); + } + } + + protected boolean isDisplayable(final Node node) throws DataSourceException + { + if (! (node instanceof OfficeGroupSection) ) + { + return _isDisplayable(node); + } + + final OfficeGroupSection section = (OfficeGroupSection) node; + if (section.isRepeatSection()) + { + return false; + } + return _isDisplayable(node); + } + + protected boolean _isDisplayable(final Node node) + throws DataSourceException + { + // temp method until the pending upgrade to 0.9.2. Later we just call super.isDisplayable(..) instead. + if (!node.isEnabled()) + { + return false; + } + + final Expression expression = node.getDisplayCondition(); + if (expression == null) + { + return true; + } + + final Object result = LayoutControllerUtil.evaluateExpression(getFlowController(), node, expression); + if (Boolean.TRUE.equals(result)) + { + return true; + } + return false; + } + + protected void resetSectionForRepeat() + { + super.resetSectionForRepeat(); + state = STATE_PROCESS_VARIABLES; + } + + /** + * Joins with a delegated process flow. This is generally called from a child + * flow and should *not* (I mean it!) be called from outside. If you do, + * you'll suffer. + * + * @param flowController the flow controller of the parent. + * @return the joined layout controller that incorperates all changes from the + * delegate. + */ + public LayoutController join(final FlowController flowController) + { + if (waitForJoin) + { + final OfficeGroupInstanceSectionLayoutController derived = (OfficeGroupInstanceSectionLayoutController) clone(); + derived.setProcessingState(ElementLayoutController.OPENED); + derived.setFlowController(flowController); + derived.waitForJoin = false; + return derived; + } + return super.join(flowController); + } + + protected AttributeMap computeAttributes(final FlowController fc, final Element element, final ReportTarget target) + throws DataSourceException + { + final AttributeMap map = new AttributeMap( super.computeAttributes(fc, element, target) ); + map.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "iteration-count", new Integer(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 new file mode 100644 index 000000000000..78180c7dc9cb --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java @@ -0,0 +1,209 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeGroupLayoutController.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.layoutprocessor; + +import com.sun.star.report.pentaho.model.OfficeGroup; +import com.sun.star.report.pentaho.model.OfficeGroupSection; +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.DataSourceException; +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.layoutprocessor.ElementLayoutController; +import org.jfree.report.flow.layoutprocessor.LayoutController; +import org.jfree.report.flow.layoutprocessor.SectionLayoutController; +import org.jfree.report.structure.Element; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 15.03.2007 + */ +public class OfficeGroupLayoutController extends SectionLayoutController + implements OfficeRepeatingStructureLayoutController +{ + public static final int STATE_PROCESS_REPEATING_HEADER = 0; + public static final int STATE_PROCESS_REPEATING_FOOTER = 1; + public static final int STATE_PROCESS_NORMAL_FLOW = 3; + private boolean waitForJoin; + private int state; + private VariablesCollection variablesCollection; + private boolean repeatHeader; + private boolean repeatFooter; + + public OfficeGroupLayoutController() + { + } + + + /** + * Initializes the layout controller. This method is called exactly once. It + * is the creators responsibility to call this method. + *

+ * Calling initialize after the first advance must result in a + * IllegalStateException. + * + * @param node the currently processed object or layout node. + * @param flowController the current flow controller. + * @param parent the parent layout controller that was responsible for + * instantiating this controller. + * @throws org.jfree.report.DataSourceException + * if there was a problem reading data from the datasource. + * @throws org.jfree.report.ReportProcessingException + * if there was a general problem during the report processing. + * @throws org.jfree.report.ReportDataFactoryException + * if a query failed. + */ + public void initialize(final Object node, + final FlowController flowController, + final LayoutController parent) + throws DataSourceException, ReportDataFactoryException, + ReportProcessingException + { + super.initialize(node, flowController, parent); + state = OfficeGroupLayoutController.STATE_PROCESS_REPEATING_HEADER; + variablesCollection = new VariablesCollection(computeVariablesPrefix()); + + + final OfficeGroup group = (OfficeGroup) getElement(); + final OfficeGroupSection header = group.getHeader(); + repeatHeader = (header != null && header.isRepeatSection()); + + final OfficeGroupSection footer = group.getFooter(); + repeatFooter = (footer != null && footer.isRepeatSection()); + } + + + protected LayoutController processContent(final ReportTarget target) + throws DataSourceException, ReportProcessingException, + ReportDataFactoryException + { + if (state == OfficeGroupLayoutController.STATE_PROCESS_REPEATING_HEADER) + { + + final OfficeGroupLayoutController controller = + (OfficeGroupLayoutController) clone(); + controller.state = + OfficeGroupLayoutController.STATE_PROCESS_REPEATING_FOOTER; + + if (!repeatHeader) + { + return controller; + } + + final OfficeGroup group = (OfficeGroup) getElement(); + final OfficeGroupSection header = group.getHeader(); + controller.waitForJoin = true; + return processChild(controller, header, getFlowController()); + } + + if (state == OfficeGroupLayoutController.STATE_PROCESS_REPEATING_FOOTER) + { + + final OfficeGroupLayoutController controller = + (OfficeGroupLayoutController) clone(); + controller.state = OfficeGroupLayoutController.STATE_PROCESS_NORMAL_FLOW; + + if (!repeatFooter) + { + return controller; + } + + final OfficeGroup group = (OfficeGroup) getElement(); + final OfficeGroupSection footer = group.getFooter(); + controller.waitForJoin = true; + return processChild(controller, footer, getFlowController()); + } + + return super.processContent(target); + } + + /** + * Joins with a delegated process flow. This is generally called from a child + * flow and should *not* (I mean it!) be called from outside. If you do, + * you'll suffer. + * + * @param flowController the flow controller of the parent. + * @return the joined layout controller that incorperates all changes from the + * delegate. + */ + public LayoutController join(final FlowController flowController) + { + if (waitForJoin) + { + final OfficeGroupLayoutController derived = (OfficeGroupLayoutController) clone(); + derived.setProcessingState(ElementLayoutController.OPENED); + derived.setFlowController(flowController); + derived.waitForJoin = false; + return derived; + } + return super.join(flowController); + } + + public boolean isNormalFlowProcessing () + { + return state == OfficeGroupLayoutController.STATE_PROCESS_NORMAL_FLOW; + } + + private String computeVariablesPrefix() + { + int count = 0; + LayoutController lc = this; + while (lc != null) + { + if (lc instanceof OfficeGroupLayoutController) + { + count += 1; + } + lc = lc.getParent(); + } + return "auto_group_" + count + "_"; + } + + public VariablesCollection getVariablesCollection() + { + return variablesCollection; + } + + protected AttributeMap computeAttributes(final FlowController fc, final Element element, final ReportTarget target) + throws DataSourceException + { + final AttributeMap map = new AttributeMap( super.computeAttributes(fc, element, target) ); + final String value = String.valueOf(repeatHeader || repeatFooter); + map.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeating-header-or-footer", value); + map.makeReadOnly(); + return map; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java new file mode 100644 index 000000000000..496ccd841e46 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java @@ -0,0 +1,115 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeGroupSectionLayoutController.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.layoutprocessor; + +import org.jfree.report.flow.layoutprocessor.SectionLayoutController; +import org.jfree.report.flow.layoutprocessor.LayoutController; +import org.jfree.report.flow.layoutprocessor.ElementLayoutController; +import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.structure.Element; +import org.jfree.report.DataSourceException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.layouting.util.AttributeMap; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.model.OfficeGroupSection; +import org.jfree.report.JFreeReportInfo; + +/** + * This layoutcontroller simply checks, whether the parent layout controller + * is a OfficeGroupLayoutController and whether this layout controller is + * processing the normal flow or an repeating section. If a repeating section + * is being processed, an marker attribute is added to the element's call + * to OutputProcessor.startElement() and OutputProcessor.endElement(). + * + * @author Thomas Morgner + * @since 19.03.2007 + */ +public class OfficeGroupSectionLayoutController extends SectionLayoutController +{ + + public OfficeGroupSectionLayoutController() + { + } + + protected LayoutController startElement(final ReportTarget target) + throws DataSourceException, ReportProcessingException, ReportDataFactoryException + { + final OfficeGroupSection section = (OfficeGroupSection) getElement(); + if (!section.isRepeatSection()) + { + return super.startElement(target); + } + + final LayoutController controller = getParent(); + if (!(controller instanceof OfficeGroupLayoutController)) + { + return super.startElement(target); + } + final OfficeGroupLayoutController oglc = (OfficeGroupLayoutController) controller; + if (!oglc.isNormalFlowProcessing()) + { + return super.startElement(target); + } + + // Skip the processing if the section is a repeating header or footer and we are processing the normal flow .. + final ElementLayoutController clone = (ElementLayoutController) this.clone(); + clone.setProcessingState(ElementLayoutController.FINISHED); + return clone; + } + + protected AttributeMap computeAttributes(final FlowController fc, + final Element element, + final ReportTarget target) + throws DataSourceException + { + final AttributeMap attrs = super.computeAttributes(fc, element, target); + final LayoutController controller = getParent(); + if (!(controller instanceof OfficeGroupLayoutController)) + { + return attrs; + } + final OfficeGroupLayoutController oglc = (OfficeGroupLayoutController) controller; + if (oglc.isNormalFlowProcessing()) + { + return attrs; + } + + final AttributeMap retval = new AttributeMap(attrs); + retval.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeated-section", OfficeToken.TRUE); + retval.makeReadOnly(); + return retval; + } + + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficePageSectionLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficePageSectionLayoutController.java new file mode 100644 index 000000000000..9189cb06f9a5 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficePageSectionLayoutController.java @@ -0,0 +1,29 @@ +package com.sun.star.report.pentaho.layoutprocessor; + +import org.jfree.report.flow.layoutprocessor.SectionLayoutController; +import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.structure.Element; +import org.jfree.report.DataSourceException; +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.JFreeReportInfo; + +/** + * Todo: Document Me + * + * @author Thomas Morgner + */ +public class OfficePageSectionLayoutController extends SectionLayoutController +{ + public OfficePageSectionLayoutController() + { + } + + protected AttributeMap computeAttributes(final FlowController flowController, final Element element, final ReportTarget reportTarget) throws DataSourceException + { + final AttributeMap map = new AttributeMap( super.computeAttributes(flowController, element, reportTarget)); + map.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "role", "spreadsheet-section"); + map.makeReadOnly(); + return map; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeRepeatingStructureLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeRepeatingStructureLayoutController.java new file mode 100644 index 000000000000..47a1daa1b7fa --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeRepeatingStructureLayoutController.java @@ -0,0 +1,48 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeRepeatingStructureLayoutController.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.layoutprocessor; + +import org.jfree.report.flow.layoutprocessor.LayoutController; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 22.03.2007 + */ +public interface OfficeRepeatingStructureLayoutController extends LayoutController +{ + public boolean isNormalFlowProcessing(); + + public VariablesCollection getVariablesCollection(); + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java new file mode 100644 index 000000000000..20816814e11c --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java @@ -0,0 +1,277 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeReportLayoutController.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.layoutprocessor; + +import com.sun.star.report.pentaho.model.OfficeReport; +import com.sun.star.report.pentaho.model.VariablesDeclarationSection; +import org.jfree.report.DataSourceException; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.ReportContext; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.layoutprocessor.ElementLayoutController; +import org.jfree.report.flow.layoutprocessor.LayoutController; +import org.jfree.report.flow.layoutprocessor.LayoutControllerFactory; +import org.jfree.report.structure.Node; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 06.03.2007 + */ +public class OfficeReportLayoutController extends ElementLayoutController + implements OfficeRepeatingStructureLayoutController +{ + private static final int STATE_NOT_STARTED = 0; + private static final int STATE_TEMPLATES = 1; + private static final int STATE_PAGE_HEADER_DONE = 2; + private static final int STATE_PAGE_FOOTER_DONE = 3; + private static final int STATE_SPREADSHEET_PAGE_HEADER_DONE = 4; + private static final int STATE_SPREADSHEET_PAGE_FOOTER_DONE = 5; + private static final int STATE_COLUMN_HEADER_DONE = 6; + private static final int STATE_COLUMN_FOOTER_DONE = 7; + private static final int STATE_INITIAL_VARIABLES_DONE = 8; + private static final int STATE_REPORT_HEADER_DONE = 9; + private static final int STATE_REPORT_BODY_DONE = 10; + private static final int STATE_REPORT_FOOTER_VARIABLES = 11; + private static final int STATE_REPORT_FOOTER_DONE = 12; + + private int state; + private VariablesCollection variablesCollection; + + public OfficeReportLayoutController() + { + } + + + /** + * Initializes the layout controller. This method is called exactly once. It + * is the creators responsibility to call this method. + *

+ * Calling initialize after the first advance must result in a + * IllegalStateException. + * + * @param node the currently processed object or layout node. + * @param flowController the current flow controller. + * @param parent the parent layout controller that was responsible for + * instantiating this controller. + * @throws org.jfree.report.DataSourceException + * if there was a problem reading data from the datasource. + * @throws org.jfree.report.ReportProcessingException + * if there was a general problem during the report processing. + * @throws org.jfree.report.ReportDataFactoryException + * if a query failed. + */ + public void initialize(final Object node, final FlowController flowController, + final LayoutController parent) + throws DataSourceException, ReportDataFactoryException, + ReportProcessingException + { + super.initialize(node, flowController, parent); + variablesCollection = new VariablesCollection("auto_report_"); + } + + /** + * Processes any content in this element. This method is called when the + * processing state is 'OPENED'. The returned layout controller will retain + * the 'OPENED' state as long as there is more content available. Once all + * content has been processed, the returned layout controller should carry a + * 'FINISHED' state. + * + * @param target the report target that receives generated events. + * @return the new layout controller instance representing the new state. + * + * @throws org.jfree.report.DataSourceException + * if there was a problem reading data from the datasource. + * @throws org.jfree.report.ReportProcessingException + * if there was a general problem during the report processing. + * @throws org.jfree.report.ReportDataFactoryException + * if a query failed. + */ + protected LayoutController processContent(final ReportTarget target) + throws DataSourceException, ReportProcessingException, + ReportDataFactoryException + { + final OfficeReport or = (OfficeReport) getElement(); + + switch (state) + { + case OfficeReportLayoutController.STATE_NOT_STARTED: + { + return delegateToTemplates(OfficeReportLayoutController.STATE_TEMPLATES); + } + case OfficeReportLayoutController.STATE_TEMPLATES: + { + return delegateSection(or.getPageHeader(), + OfficeReportLayoutController.STATE_PAGE_HEADER_DONE); + } + case OfficeReportLayoutController.STATE_PAGE_HEADER_DONE: + { + return delegateSpreadsheetSection(or.getPageHeader(), + OfficeReportLayoutController.STATE_SPREADSHEET_PAGE_HEADER_DONE); + } + case OfficeReportLayoutController.STATE_SPREADSHEET_PAGE_HEADER_DONE: + { + return delegateSection(or.getPageFooter(), + OfficeReportLayoutController.STATE_PAGE_FOOTER_DONE); + } + case OfficeReportLayoutController.STATE_PAGE_FOOTER_DONE: + { + return delegateSection(or.getColumnHeader(), + OfficeReportLayoutController.STATE_COLUMN_HEADER_DONE); + } + case OfficeReportLayoutController.STATE_COLUMN_HEADER_DONE: + { + return delegateSection(or.getColumnFooter(), + OfficeReportLayoutController.STATE_COLUMN_FOOTER_DONE); + } + case OfficeReportLayoutController.STATE_COLUMN_FOOTER_DONE: + { + return delegateSection(new VariablesDeclarationSection(), + OfficeReportLayoutController.STATE_INITIAL_VARIABLES_DONE); + } + case OfficeReportLayoutController.STATE_INITIAL_VARIABLES_DONE: + { + return delegateSection(or.getReportHeader(), + OfficeReportLayoutController.STATE_REPORT_HEADER_DONE); + } + case OfficeReportLayoutController.STATE_REPORT_HEADER_DONE: + { + return delegateSection(or.getBodySection(), + OfficeReportLayoutController.STATE_REPORT_BODY_DONE); + } + case OfficeReportLayoutController.STATE_REPORT_BODY_DONE: + { + return delegateSection(new VariablesDeclarationSection(), + OfficeReportLayoutController.STATE_REPORT_FOOTER_VARIABLES); + } + case OfficeReportLayoutController.STATE_REPORT_FOOTER_VARIABLES: + { + return delegateSection(or.getReportFooter(), + OfficeReportLayoutController.STATE_REPORT_FOOTER_DONE); + } + case OfficeReportLayoutController.STATE_REPORT_FOOTER_DONE: + { + return delegateSpreadsheetSection(or.getPageFooter(), + OfficeReportLayoutController.STATE_SPREADSHEET_PAGE_FOOTER_DONE); + } + case OfficeReportLayoutController.STATE_SPREADSHEET_PAGE_FOOTER_DONE: + { + final OfficeReportLayoutController olc = (OfficeReportLayoutController) clone(); + olc.setProcessingState(ElementLayoutController.FINISHING); + return olc; + } + default: + { + throw new IllegalStateException("Invalid processing state encountered."); + } + } + } + + private LayoutController delegateSpreadsheetSection(final Node node, final int nextState) + throws DataSourceException, ReportProcessingException, ReportDataFactoryException + { + final OfficeReportLayoutController olc = (OfficeReportLayoutController) clone(); + olc.state = nextState; + + if (node == null) + { + return olc; + } + + final OfficePageSectionLayoutController templateLc = new OfficePageSectionLayoutController(); + templateLc.initialize(node, getFlowController(), olc); + return templateLc; + } + + private LayoutController delegateToTemplates(final int nextState) + throws ReportProcessingException, ReportDataFactoryException, + DataSourceException + { + final OfficeReportLayoutController olc = (OfficeReportLayoutController) clone(); + olc.state = nextState; + + final OfficeTableTemplateLayoutController templateLc = new OfficeTableTemplateLayoutController(); + templateLc.initialize(getElement(), getFlowController(), olc); + return templateLc; + + } + + private LayoutController delegateSection(final Node n, final int nextState) + throws ReportProcessingException, ReportDataFactoryException, + DataSourceException + { + final OfficeReportLayoutController olc = (OfficeReportLayoutController) clone(); + olc.state = nextState; + if (n == null) + { + return olc; + } + + final FlowController flowController = getFlowController(); + final ReportContext reportContext = flowController.getReportContext(); + final LayoutControllerFactory layoutControllerFactory = + reportContext.getLayoutControllerFactory(); + return layoutControllerFactory.create(flowController, n, olc); + + } + + + /** + * Joins with a delegated process flow. This is generally called from a child + * flow and should *not* (I mean it!) be called from outside. If you do, + * you'll suffer. + * + * @param flowController the flow controller of the parent. + * @return the joined layout controller that incorperates all changes from the + * delegate. + */ + public LayoutController join(final FlowController flowController) + { + final OfficeReportLayoutController derived = (OfficeReportLayoutController) clone(); + derived.setFlowController(flowController); + return derived; + } + + public boolean isNormalFlowProcessing() + { + return state != OfficeReportLayoutController.STATE_PAGE_HEADER_DONE && + state != OfficeReportLayoutController.STATE_PAGE_FOOTER_DONE; + } + + public VariablesCollection getVariablesCollection() + { + return variablesCollection; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java new file mode 100644 index 000000000000..d83ebb63957d --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeTableLayoutController.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.layoutprocessor; + +import org.jfree.report.flow.layoutprocessor.SectionLayoutController; +import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; +import org.jfree.report.structure.Node; +import org.jfree.report.DataSourceException; +import org.jfree.report.util.IntegerCache; +import org.jfree.layouting.util.AttributeMap; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import org.jfree.report.JFreeReportInfo; + +/** + * Creation-Date: 24.04.2007, 14:40:20 + * + * @author Thomas Morgner + */ +public class OfficeTableLayoutController extends SectionLayoutController +{ + + public OfficeTableLayoutController() + { + } + + protected AttributeMap computeAttributes(final FlowController fc, final Element element, final ReportTarget target) + throws DataSourceException + { + final AttributeMap attributeMap = new AttributeMap( super.computeAttributes(fc, element, target) ); + final Section s = (Section) element; + int rowCount = 0; + final Node[] nodeArray = s.getNodeArray(); + for (int i = 0; i < nodeArray.length; i++) + { + final Node node = nodeArray[i]; + if (node instanceof Element) + { + final Element child = (Element) node; + if (OfficeNamespaces.TABLE_NS.equals(child.getNamespace()) && + OfficeToken.TABLE_ROW.equals(child.getType())) + { + rowCount += 1; + } + } + } + + attributeMap.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "table-row-count", IntegerCache.getInteger(rowCount)); + attributeMap.makeReadOnly(); + return attributeMap; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java new file mode 100644 index 000000000000..f3a7f776db5c --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java @@ -0,0 +1,191 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeTableTemplateLayoutController.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.layoutprocessor; + +import java.util.ArrayList; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.OfficeGroup; +import com.sun.star.report.pentaho.model.OfficeReport; +import java.util.List; +import org.jfree.report.DataSourceException; +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.layoutprocessor.LayoutController; +import org.jfree.report.flow.layoutprocessor.SectionLayoutController; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Node; +import org.jfree.report.structure.Section; + +/** + * Creation-Date: 24.04.2007, 16:06:52 + * + * @author Thomas Morgner + */ +public class OfficeTableTemplateLayoutController extends SectionLayoutController +{ + + private Node[] nodes; + + public OfficeTableTemplateLayoutController() + { + } + + /** + * Initializes the layout controller. This method is called exactly once. It is the creators responsibility to call + * this method. + *

+ * Calling initialize after the first advance must result in a IllegalStateException. + * + * @param node the currently processed object or layout node. + * @param flowController the current flow controller. + * @param parent the parent layout controller that was responsible for instantiating this controller. + * @throws org.jfree.report.DataSourceException + * if there was a problem reading data from the datasource. + * @throws org.jfree.report.ReportProcessingException + * if there was a general problem during the report processing. + * @throws org.jfree.report.ReportDataFactoryException + * if a query failed. + */ + public void initialize(final Object node, final FlowController flowController, final LayoutController parent) + throws DataSourceException, ReportDataFactoryException, ReportProcessingException + { + final Section section = new Section(); + section.setNamespace(JFreeReportInfo.REPORT_NAMESPACE); + section.setType("template"); + super.initialize(section, flowController, parent); + + final OfficeReport report = (OfficeReport) node; + final ArrayList tables = new ArrayList(); + if (report.getPageHeader() != null) + { + addFromSection(tables, (Section) report.getPageHeader()); + } + if (report.getReportHeader() != null) + { + addFromSection(tables, (Section) report.getReportHeader()); + } + addPBody(tables, (Section) report.getPreBodySection()); + addFromBody(tables, (Section) report.getBodySection()); + addPBody(tables, (Section) report.getPostBodySection()); + if (report.getReportFooter() != null) + { + addFromSection(tables, (Section) report.getReportFooter()); + } + if (report.getPageFooter() != null) + { + addFromSection(tables, (Section) report.getPageFooter()); + } + + this.nodes = (Node[]) tables.toArray(new Node[tables.size()]); + } + + private void addPBody(final List tables, final Section section) + { + if (section != null) + { + // tables.add(section); + final Node[] nodeArray = section.getNodeArray(); + for (int i = 0; i < nodeArray.length; i++) + { + final Node node = nodeArray[i]; + tables.add(node); + } + + } + } + + private void addFromBody(final List tables, final Section section) + { + final Node[] nodeArray = section.getNodeArray(); + for (int i = 0; i < nodeArray.length; i++) + { + final Node node = nodeArray[i]; + if (node instanceof Section) + { + final Section child = (Section) node; + if (node instanceof OfficeGroup) + { + addFromGroup(tables, child); + } + else + { + addFromSection(tables, child); + } + } + } + } + + private void addFromGroup(final List tables, final Section section) + { + final Node[] nodeArray = section.getNodeArray(); + for (int i = 0; i < nodeArray.length; i++) + { + final Node node = nodeArray[i]; + if (node instanceof Section) + { + final Section element = (Section) node; + if (JFreeReportInfo.REPORT_NAMESPACE.equals(element.getNamespace()) && "group-body".equals(element.getType())) + { + addFromBody(tables, element); + } + else + { + addFromSection(tables, element); + } + } + } + } + + private void addFromSection(final List tables, final Section section) + { + final Node[] nodeArray = section.getNodeArray(); + for (int i = 0; i < nodeArray.length; i++) + { + final Node node = nodeArray[i]; + if (node instanceof Element) + { + final Element element = (Element) node; + if (OfficeNamespaces.TABLE_NS.equals(element.getNamespace()) && + "table".equals(element.getType())) + { + tables.add(element); + } + } + } + } + + public Node[] getNodes() + { + return nodes; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java new file mode 100644 index 000000000000..daacce47aa48 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java @@ -0,0 +1,193 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TableCellLayoutController.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.layoutprocessor; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.model.FormatCondition; +import com.sun.star.report.pentaho.model.FormattedTextElement; +import com.sun.star.report.pentaho.model.ReportElement; +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.DataSourceException; +import org.jfree.report.DataFlags; +import org.jfree.report.expressions.Expression; +import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil; +import org.jfree.report.flow.layoutprocessor.SectionLayoutController; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Node; +import org.jfree.report.structure.Section; +import org.pentaho.reporting.libraries.base.util.ObjectUtilities; + +/** + * Before writing the table cell, we have to evaluate the childs of the cell. The cell itself can either be empty or it + * has a one ore more paragraphs inside. The paragraph contains a single report element, but may contain additional + * other content. + * + * @author Thomas Morgner + * @noinspection CloneableClassWithoutClone + * @since 05.03.2007 + */ +public class TableCellLayoutController extends SectionLayoutController +{ + + public TableCellLayoutController() + { + } + + protected AttributeMap computeAttributes(final FlowController fc, + final Element element, + final ReportTarget target) + throws DataSourceException + { + final AttributeMap attributeMap = new AttributeMap(super.computeAttributes(fc, element, target)); + final String definedStyle = (String) attributeMap.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); + attributeMap.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, getDisplayStyleName((Section) element, definedStyle)); + + try + { + final DataFlags value = computeValue(); + if (value != null) + { + FormatValueUtility.applyValueForCell(value.getValue(), attributeMap); + } + } + catch (Exception e) + { + // ignore .. + } + attributeMap.makeReadOnly(); + return attributeMap; + } + + private DataFlags computeValue() throws DataSourceException + { + // Search for the first FormattedTextElement + final Section cell = (Section) getElement(); + final FormattedTextElement element = findFormattedTextElement(cell); + if (element == null) + { + return null; + } + return FormatValueUtility.computeDataFlag(element, getFlowController()); + } + + private FormattedTextElement findFormattedTextElement(final Section section) + { + final Node[] nodeArray = section.getNodeArray(); + for (int i = 0; i < nodeArray.length; i++) + { + final Node node = nodeArray[i]; + if (node instanceof FormattedTextElement) + { + return (FormattedTextElement) node; + } + else if (node instanceof Section) + { + final FormattedTextElement retval = findFormattedTextElement((Section) node); + if (retval != null) + { + return retval; + } + } + } + return null; + } + + private String getDisplayStyleName(final Section section, + final String defaultStyle) + { + if (!section.isEnabled() || section.getNodeCount() == 0) + { + return defaultStyle; + } + + final Node[] nodes = section.getNodeArray(); + for (int i = 0; i < nodes.length; i++) + { + final Node child = nodes[i]; + if (child instanceof ReportElement && child.isEnabled()) + { + final ReportElement element = (ReportElement) child; + if (element.getFormatConditionCount() > 0) + { + final Expression displayCond = element.getDisplayCondition(); + if (displayCond != null) + { + try + { + if (Boolean.FALSE.equals(LayoutControllerUtil.evaluateExpression(getFlowController(), element, displayCond))) + { + continue; + } + } + catch (DataSourceException e) + { + // ignore silently .. + } + } + + final FormatCondition[] conditions = element.getFormatConditions(); + for (int j = 0; j < conditions.length; j++) + { + final FormatCondition formCond = conditions[j]; + if (formCond.isEnabled()) + { + try + { + final Object o = LayoutControllerUtil.evaluateExpression(getFlowController(), element, formCond.getFormula()); + if (Boolean.TRUE.equals(o)) + { + return formCond.getStyleName(); + } + } + catch (DataSourceException e) + { + // ignore silently .. + } + } + } + } + } + + if (child instanceof Section) + { + final String childFormatCondition = + getDisplayStyleName((Section) child, defaultStyle); + if (!ObjectUtilities.equal(childFormatCondition, defaultStyle)) + { + return childFormatCondition; + } + } + } + return defaultStyle; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java new file mode 100644 index 000000000000..ee9bfd442bca --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java @@ -0,0 +1,103 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: VariablesCollection.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.layoutprocessor; + +import java.util.ArrayList; + +import com.sun.star.report.pentaho.model.FormattedTextElement; +import java.util.List; + +/** + * A variables collection is used to collect all FormattedTextElement objects + * of a repeated header or footer. Later, for each of these elements a variable + * setter is inserted into a hidden (in fact just very small) paragraph. These + * variables can later be read using the 'variable-get' construct. + * + * From the idea, this is equal to the 'strings' declaration of CSS3, although + * this code is explicit instead of declarative. + * + * @author Thomas Morgner + * @since 22.03.2007 + */ +public class VariablesCollection +{ + private VariablesCollection parent; + private String namePrefix; + private List variables; + + public VariablesCollection(final String namePrefix) + { + this(namePrefix, null); + } + + public VariablesCollection(final String namePrefix, final VariablesCollection parent) + { + if (namePrefix == null) + { + throw new NullPointerException("NamePrefix cannot be null"); + } + + this.namePrefix = namePrefix; + this.parent = parent; + this.variables = new ArrayList(); + } + + public VariablesCollection getParent() + { + return parent; + } + + public String getNamePrefix() + { + return namePrefix; + } + + public String addVariable (final FormattedTextElement element) + { + variables.add(element); + final int size = variables.size(); + return namePrefix + size; + } + + public FormattedTextElement[] getVariables () + { + return (FormattedTextElement[]) + variables.toArray(new FormattedTextElement[variables.size()]); + } + + public int getVariablesCount () + { + return variables.size(); + } + + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java new file mode 100644 index 000000000000..6a6b6f19d1f0 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java @@ -0,0 +1,190 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: VariablesDeclarationLayoutController.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.layoutprocessor; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.FormattedTextElement; +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.DataSourceException; +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.expressions.FormulaExpression; +import org.jfree.report.flow.FlowController; +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.jfree.report.structure.Element; +import java.util.Date; +import java.text.SimpleDateFormat; + +/** + * Writes a full variables-declaration section. + * + * @author Thomas Morgner + * @since 20.03.2007 + */ +public class VariablesDeclarationLayoutController + extends AbstractLayoutController +{ + private boolean processed; + + public VariablesDeclarationLayoutController() + { + } + + private OfficeRepeatingStructureLayoutController getRepeatingParent() + { + LayoutController parent = getParent(); + while (parent != null) + { + if (parent instanceof OfficeRepeatingStructureLayoutController) + { + return (OfficeRepeatingStructureLayoutController) parent; + } + parent = parent.getParent(); + } + return null; + } + + /** + * Advances the processing position. + * + * @param target the report target that receives generated events. + * @return the new layout controller instance representing the new state. + * + * @throws org.jfree.report.DataSourceException + * if there was a problem reading data from the datasource. + * @throws org.jfree.report.ReportProcessingException + * if there was a general problem during the report processing. + * @throws org.jfree.report.ReportDataFactoryException + * if a query failed. + */ + public LayoutController advance(final ReportTarget target) + throws DataSourceException, ReportDataFactoryException, + ReportProcessingException + { + if (processed) + { + throw new IllegalStateException("Already processed."); + } + + final VariablesDeclarationLayoutController vlc = + (VariablesDeclarationLayoutController) clone(); + vlc.processed = true; + + final OfficeRepeatingStructureLayoutController orslc = getRepeatingParent(); + if (orslc == null) + { + // There is no repeating parent. What the heck are we doing here .. + return vlc; + } + + final VariablesCollection collection = orslc.getVariablesCollection(); + if (collection.getVariablesCount() == 0) + { + // no processing necessary, as the header or footer contain no variables at all .. + return vlc; + } + + + final Element node = (Element) getNode(); + final AttributeMap vdSection = node.getAttributeMap(); + target.startElement(vdSection); + + final FormattedTextElement[] variables = collection.getVariables(); + for (int i = 0; i < variables.length; i++) + { + final FormattedTextElement variable = variables[i]; + final String varName = collection.getNamePrefix() + (i + 1); + final AttributeMap map = generateVariableSetSection(variable); + map.setAttribute(OfficeNamespaces.TEXT_NS, "name", varName); + target.startElement(map); + target.endElement(map); + + } + target.endElement(vdSection); + return vlc; + } + + private AttributeMap generateVariableSetSection(final FormattedTextElement variable) + throws DataSourceException + { + final AttributeMap variableSection = new AttributeMap(); + variableSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.NAMESPACE_ATTRIBUTE, OfficeNamespaces.TEXT_NS); + variableSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.TYPE_ATTRIBUTE, "variable-set"); + variableSection.setAttribute(OfficeNamespaces.TEXT_NS, "display", "none"); + + final FormulaExpression valueExpression = variable.getValueExpression(); + final Object value = LayoutControllerUtil.evaluateExpression(getFlowController(), variable, valueExpression); + String formula = FormatValueUtility.applyValueForVariable(value, variableSection); + if ( formula == null ) + formula = "" + value; + if (value instanceof 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; + } + + /** + * Checks, whether the layout controller would be advanceable. If this method + * returns true, it is generally safe to call the 'advance()' method. + * + * @return true, if the layout controller is advanceable, false otherwise. + */ + public boolean isAdvanceable() + { + return !processed; + } + + /** + * Joins with a delegated process flow. This is generally called from a child + * flow and should *not* (I mean it!) be called from outside. If you do, + * you'll suffer. + * + * @param flowController the flow controller of the parent. + * @return the joined layout controller that incorperates all changes from the + * delegate. + */ + public LayoutController join(final FlowController flowController) + throws DataSourceException, ReportDataFactoryException, + ReportProcessingException + { + throw new UnsupportedOperationException + ("Join is not supported in this layout controller"); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java new file mode 100644 index 000000000000..fc6021202e68 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java @@ -0,0 +1,172 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: InputRepositoryLoader.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.loader; + +import java.net.URL; +import java.util.Map; +import java.util.HashMap; + +import com.sun.star.report.InputRepository; +import org.pentaho.reporting.libraries.resourceloader.ResourceData; +import org.pentaho.reporting.libraries.resourceloader.ResourceKey; +import org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException; +import org.pentaho.reporting.libraries.resourceloader.ResourceLoader; +import org.pentaho.reporting.libraries.resourceloader.ResourceLoadingException; +import org.pentaho.reporting.libraries.resourceloader.ResourceManager; +import org.pentaho.reporting.libraries.resourceloader.loader.LoaderUtils; + +public class InputRepositoryLoader implements ResourceLoader +{ + + private final InputRepository inputRepository; + private ResourceManager resourceManager; + + public InputRepositoryLoader(final InputRepository inputRepository) + { + if (inputRepository == null) + { + throw new NullPointerException(); + } + this.inputRepository = inputRepository; + } + + /** + * Checks, whether this resource loader implementation was responsible for + * creating this key. + * + * @param key + * @return + */ + public boolean isSupportedKey(final ResourceKey key) + { + return InputRepositoryLoader.class.getName().equals(key.getSchema()); + } + + /** + * Creates a new resource key from the given object and the factory keys. + * + * @param value + * @param factoryKeys + * @return the created key or null, if the format was not recognized. + * @throws org.jfree.resourceloader.ResourceKeyCreationException + * if creating the key failed. + */ + public ResourceKey createKey(final Object value, + final Map factoryKeys) + throws ResourceKeyCreationException + { + if (value instanceof String) + { + final String strVal = (String) value; + if (strVal.startsWith("sun:oo://")) + { + return new ResourceKey(InputRepositoryLoader.class.getName(), + new InputResourceKey(inputRepository.getId(), strVal), factoryKeys); + } + } + return null; + } + + /** + * Derives a new resource key from the given key. If neither a path nor new + * factory-keys are given, the parent key is returned. + * + * @param parent the parent + * @param path the derived path (can be null). + * @param factoryKeys the optional factory keys (can be null). + * @return the derived key. + * @throws org.jfree.resourceloader.ResourceKeyCreationException + * if the key cannot be derived for any reason. + */ + public ResourceKey deriveKey(final ResourceKey parent, + final String path, + final Map factoryKeys) + throws ResourceKeyCreationException + { + if (!isSupportedKey(parent)) + { + throw new ResourceKeyCreationException("Assertation: Unsupported parent key type"); + } + + final InputResourceKey parentKey = (InputResourceKey) parent.getIdentifier(); + final String resource; + if (path.startsWith("sun:oo://")) + { + resource = path; + } + else if (path.charAt(0) == '/') + { + resource = "sun:oo:/" + path; + } + else + { + resource = LoaderUtils.mergePaths(parentKey.getPath(), path); + } + final Map map; + if (factoryKeys != null) + { + map = new HashMap(); + map.putAll(parent.getFactoryParameters()); + map.putAll(factoryKeys); + } + else + { + map = parent.getFactoryParameters(); + } + return new ResourceKey(parent.getSchema(), + new InputResourceKey(parentKey.getInputRepositoryId(), resource), map); + } + + public URL toURL(final ResourceKey key) + { + return null; + } + + public ResourceData load(final ResourceKey key) + throws ResourceLoadingException + { + if (!isSupportedKey(key)) + { + throw new ResourceLoadingException("None of my keys."); + } + + return new InputRepositoryResourceData(key, inputRepository); + } + + public void setResourceManager(final ResourceManager manager) + { + this.resourceManager = manager; + } + + public ResourceManager getResourceManager() + { + return resourceManager; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java new file mode 100644 index 000000000000..14a437f4bb57 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: InputRepositoryResourceData.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.loader; + +import java.io.IOException; +import java.io.InputStream; + +import com.sun.star.report.InputRepository; +import org.pentaho.reporting.libraries.resourceloader.ResourceKey; +import org.pentaho.reporting.libraries.resourceloader.ResourceLoadingException; +import org.pentaho.reporting.libraries.resourceloader.ResourceManager; +import org.pentaho.reporting.libraries.resourceloader.loader.AbstractResourceData; + +public class InputRepositoryResourceData extends AbstractResourceData +{ + private final InputRepository inputRepository; + private final ResourceKey key; + private final String resourceIdentifer; + + public InputRepositoryResourceData (final ResourceKey key, + final InputRepository repository) + { + this.key = key; + this.inputRepository = repository; + final InputResourceKey rkey = (InputResourceKey) key.getIdentifier(); + final String identifier = rkey.getPath(); + this.resourceIdentifer = identifier.substring("sun:oo://".length()); + } + + public Object getAttribute (final String key) + { + // we dont support attributes here .. + return null; + } + + public ResourceKey getKey () + { + return key; + } + + public InputStream getResourceAsStream (final ResourceManager caller) + throws ResourceLoadingException + { + try + { + return inputRepository.createInputStream(resourceIdentifer); + } + catch (IOException e) + { + throw new ResourceLoadingException + ("Failed to create input stream for " + resourceIdentifer, e); + } + } + + public long getVersion (final ResourceManager caller) + { + return inputRepository.getVersion(resourceIdentifer); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputResourceKey.java b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputResourceKey.java new file mode 100644 index 000000000000..a4f2f1ca4553 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputResourceKey.java @@ -0,0 +1,71 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: InputResourceKey.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.loader; + +import java.io.Serializable; + +/** + * Creation-Date: Feb 22, 2007, 8:51:42 PM + * + * @author Thomas Morgner + */ +public class InputResourceKey implements Serializable +{ + private static final long serialVersionUID = 2819901838705793075L; + + private final Object inputRepositoryId; + private final String path; + + public InputResourceKey(final Object inputRepositoryId, final String path) + { + this.inputRepositoryId = inputRepositoryId; + this.path = path; + } + + public Object getInputRepositoryId() + { + return inputRepositoryId; + } + + public String getPath() + { + return path; + } + + public String toString() + { + return "InputResourceKey{" + + "inputRepositoryId=" + inputRepositoryId + + ", path='" + path + '\'' + + '}'; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk new file mode 100644 index 000000000000..fc2abb55e96a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk @@ -0,0 +1,124 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.7.58.2 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ = ..$/..$/..$/..$/..$/.. +PRJNAME = reportbuilder +TARGET=sun-report-builder +PACKAGE = com$/sun$/star$/report$/pentaho +# we have circular dependencies +nodep=true +# --- Settings ----------------------------------------------------- +.INCLUDE: settings.mk + +#----- compile .java files ----------------------------------------- +JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar +.IF "$(SYSTEM_JFREEREPORT)" == "YES" +XCLASSPATH!:=$(XCLASSPATH)$(FLUTE_JAR)$(PATH_SEPERATOR)$(LIBBASE_JAR)$(PATH_SEPERATOR)$(LIBXML_JAR)$(PATH_SEPERATOR)$(JFREEREPORT_JAR)$(PATH_SEPERATOR)$(LIBLOADER_JAR)$(PATH_SEPERATOR)$(SAC_JAR)$(PATH_SEPERATOR)$(LIBLAYOUT_JAR)$(PATH_SEPERATOR)$(LIBSERIALIZER_JAR)$(PATH_SEPERATOR)$(LIBFONTS_JAR)$(PATH_SEPERATOR)$(LIBFORMULA_JAR)$(PATH_SEPERATOR)$(LIBREPOSITORY_JAR)$(PATH_SEPERATOR)$(COMMONS_LOGGING_JAR) +COMP=fix_system_jfreereport +.ELSE +JARFILES += flute-1.3.0.jar libbase-1.0.0.jar libfonts-1.0.0.jar libformula-0.2.0.jar liblayout-0.2.9.jar libloader-1.0.0.jar librepository-1.0.0.jar libxml-1.0.0.jar flow-engine-0.9.2.jar sac.jar commons-logging-1.1.1.jar +.ENDIF + +JAVAFILES := $(shell @$(FIND) . -name "*.java") +# JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:s/.java/.class/)) + +#----- copy .properties and .css files ----------------------------------------- +# external find gives / for 4nt too... +# PROPERTYFILES := $(subst,/,$/ $(subst,./,$(CLASSDIR)$/$(PACKAGE)$/ $(shell @$(FIND) . -name "*.properties"))) +PROPERTYFILES := $(CLASSDIR)$/$(PACKAGE)$/configuration.properties \ + $(CLASSDIR)$/$(PACKAGE)$/module.properties \ + $(CLASSDIR)$/$(PACKAGE)$/parser$/selectors.properties + +# CSSFILES := $(subst,./,$(CLASSDIR)$/$(PACKAGE)$/ $(shell @$(FIND) . -name "*.css")) +CSSFILES := $(CLASSDIR)$/$(PACKAGE)$/oasis-datastyle.css\ + $(CLASSDIR)$/$(PACKAGE)$/oasis-draw.css\ + $(CLASSDIR)$/$(PACKAGE)$/oasis-form.css\ + $(CLASSDIR)$/$(PACKAGE)$/oasis-style.css\ + $(CLASSDIR)$/$(PACKAGE)$/oasis-table.css\ + $(CLASSDIR)$/$(PACKAGE)$/oasis-text.css\ + $(CLASSDIR)$/$(PACKAGE)$/smil.css\ + $(CLASSDIR)$/$(PACKAGE)$/star-office.css\ + $(CLASSDIR)$/$(PACKAGE)$/star-report.css\ + $(CLASSDIR)$/$(PACKAGE)$/star-rpt.css\ + $(CLASSDIR)$/$(PACKAGE)$/svg.css\ + $(CLASSDIR)$/$(PACKAGE)$/xsl-fo.css + +XSDFILES := $(CLASSDIR)$/$(PACKAGE)$/parser$/rpt-schema-v1.0-os.xsd \ + $(CLASSDIR)$/$(PACKAGE)$/styles$/stylemapper.xsd + +XMLFILES := $(CLASSDIR)$/$(PACKAGE)$/styles$/stylemapper.xml + +TXTFILES := $(CLASSDIR)$/$(PACKAGE)$/parser$/style-mapping.txt + + +#----- make a jar from compiled files ------------------------------ + +JARCLASSDIRS = . +JARTARGET = $(TARGET).jar +JARCOMPRESS = TRUE +CUSTOMMANIFESTFILE = Manifest.mf + + +# --- Targets ------------------------------------------------------ +.INCLUDE : target.mk + +.IF "$(JARTARGETN)"!="" +$(JARTARGETN) : $(COMP) $(PROPERTYFILES) $(CSSFILES) $(XSDFILES) $(TXTFILES) $(XMLFILES) +.ENDIF # "$(JARTARGETN)"!="" + +fix_system_jfreereport: + @echo "Fix Java Class-Path entry for JFree JFreeReport libraries from system." + @$(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)#" \ + -i ../../../../../../$(INPATH)/class/sun-report-builder/META-INF/MANIFEST.MF + +$(CLASSDIR)$/$(PACKAGE)$/%.properties : %.properties + @@-$(MKDIRHIER) $(@:d) + $(COPY) $< $@ + +$(CLASSDIR)$/$(PACKAGE)$/%.css : %.css + @@-$(MKDIRHIER) $(@:d) + $(COPY) $< $@ + +$(CLASSDIR)$/$(PACKAGE)$/%.xsd : %.xsd + @@-$(MKDIRHIER) $(@:d) + $(COPY) $< $@ + +$(CLASSDIR)$/$(PACKAGE)$/%.xml : %.xml + @@-$(MKDIRHIER) $(@:d) + $(COPY) $< $@ + +$(CLASSDIR)$/$(PACKAGE)$/%.txt : %.txt + @@-$(MKDIRHIER) $(@:d) + $(COPY) $< $@ + diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java b/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java new file mode 100644 index 000000000000..efef723425da --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: DataStyle.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; +import com.sun.star.report.pentaho.OfficeNamespaces; + +/** + * Represents an automatic or manual data style definition. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class DataStyle extends Section +{ + public DataStyle() + { + } + + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } + + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java new file mode 100644 index 000000000000..7632ee1fd650 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java @@ -0,0 +1,56 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FixedTextElement.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class FixedTextElement extends ReportElement +{ + private final Section content; + + public FixedTextElement() + { + content = new Section(); + content.setVirtual(true); + } + + public Section getContent() + { + return content; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java new file mode 100644 index 000000000000..9b509b0b0157 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FontFaceDeclsSection.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import java.util.HashMap; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import java.util.Map; +import org.jfree.report.structure.Element; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class FontFaceDeclsSection extends Element +{ + private final Map fontFaces; + + public FontFaceDeclsSection() + { + fontFaces = new HashMap(); + setType("font-face-decls"); + setNamespace(OfficeNamespaces.OFFICE_NS); + } + + public void addFontFace(final FontFaceElement style) + { + fontFaces.put (style.getStyleName(), style); + } + + public FontFaceElement getFontFace (final String name) + { + return (FontFaceElement) fontFaces.get(name); + } + + public FontFaceElement[] getAllFontFaces() + { + return (FontFaceElement[]) fontFaces.values().toArray + (new FontFaceElement[fontFaces.size()]); + } + + + public boolean containsFont(final String fontName) + { + return fontFaces.containsKey(fontName); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java new file mode 100644 index 000000000000..48abe9e1f088 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FontFaceElement.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; +import com.sun.star.report.pentaho.OfficeNamespaces; + +/** + * Represents an automatic or manual data style definition. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class FontFaceElement extends Section +{ + public FontFaceElement() + { + } + + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } + + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java new file mode 100644 index 000000000000..43e84abc4651 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FormatCondition.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.expressions.FormulaExpression; + +/** + * The format condition defines, what style-format is applied to an element. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class FormatCondition +{ + private final FormulaExpression formula; + private final String styleName; + private final boolean enabled; + + public FormatCondition(final FormulaExpression formula, + final String styleName, + final boolean enabled) + { + this.formula = formula; + this.styleName = styleName; + this.enabled = enabled; + } + + + public FormulaExpression getFormula() + { + return formula; + } + + public String getStyleName() + { + return styleName; + } + + public boolean isEnabled() + { + return enabled; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FormattedTextElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FormattedTextElement.java new file mode 100644 index 000000000000..f902cae1a346 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FormattedTextElement.java @@ -0,0 +1,63 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FormattedTextElement.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.expressions.FormulaExpression; + +/** + * A formatted text element takes a formula, evaluates it and formats the + * given element using some arbitary style. (As this is totally undocumented, + * we leave this out for now. Either we'll insert a field there or we call + * an UNO-component to do the formatting. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class FormattedTextElement extends ReportElement +{ + private FormulaExpression valueExpression; + + public FormattedTextElement() + { + } + + + public FormulaExpression getValueExpression() + { + return valueExpression; + } + + public void setValueExpression(final FormulaExpression valueExpression) + { + this.valueExpression = valueExpression; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java new file mode 100644 index 000000000000..45e11580cd8f --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java @@ -0,0 +1,86 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ImageElement.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.expressions.FormulaExpression; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class ImageElement extends ReportElement +{ + private FormulaExpression formula; + + public ImageElement() + { + } + + public FormulaExpression getFormula() + { + return formula; + } + + public void setFormula(final FormulaExpression formula) + { + 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 boolean isPreserveIRI() + { + return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.PRESERVE_IRI)); + } + + public void setPreserveIRI(final boolean preserveIRI) + { + setAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.PRESERVE_IRI, String.valueOf(preserveIRI)); + } + + public String getImageData() + { + return (String) getAttribute(OfficeNamespaces.FORM_NS, OfficeToken.IMAGE_DATA); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java new file mode 100644 index 000000000000..c31c3ae8497a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ObjectOleElement.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author Ocke Janssen + */ +public class ObjectOleElement extends ReportElement{ + + private String url; + private final List masterfields; + private final List detailfields; + private String classid; + + public String getClassid() { + return classid; + } + + public List getDetailfields() { + return detailfields; + } + + public List getMasterfields() { + return masterfields; + } + + public ObjectOleElement() + { + masterfields = new ArrayList(); + detailfields = new ArrayList(); + } + + public String getUrl() { + return url; + } + + public void setClassId(final String classid) { + this.classid = classid; + } + public void setUrl(final String _url ){ + url = _url; + } + + public void addMasterDetailFields(final String master,final String detail){ + if ( master != null ){ + masterfields.add(master); + detailfields.add(detail == null ? master : detail); + } + } + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDetailSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDetailSection.java new file mode 100644 index 000000000000..d66c17c29132 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDetailSection.java @@ -0,0 +1,47 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeDetailSection.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.DetailSection; + +/** + * A Marker-Class. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class OfficeDetailSection extends DetailSection +{ + public OfficeDetailSection() + { + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java new file mode 100644 index 000000000000..02727c2b9d2a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeDocument.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import com.sun.star.report.JobProperties; +import org.jfree.report.JFreeReport; + +/** + * An office document represents the root of the report processing. In + * OpenOffice reports, this is the only child of the report object. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class OfficeDocument extends JFreeReport +{ + private OfficeStylesCollection stylesCollection; + private JobProperties jobProperties; + + public JobProperties getJobProperties() { + return jobProperties; + } + + public void setJobProperties(final JobProperties jobProperties) { + this.jobProperties = jobProperties; + } + + public OfficeDocument() + { + } + + public OfficeStylesCollection getStylesCollection() + { + return stylesCollection; + } + + public void setStylesCollection(final OfficeStylesCollection stylesCollection) + { + if (stylesCollection == null) + { + throw new NullPointerException(); + } + this.stylesCollection = stylesCollection; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java new file mode 100644 index 000000000000..2717eadea602 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java @@ -0,0 +1,99 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeGroup.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.expressions.Expression; +import org.jfree.report.structure.Section; + +/** + * An office group is a virtual section that contains the group header, footer + * and either a detail section or another group. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class OfficeGroup extends Section +{ + public OfficeGroup() + { + } + + public boolean isStartNewColumn () + { + return OfficeToken.TRUE.equals + (getAttribute(OfficeNamespaces.OOREPORT_NS, "start-new-column")); + } + + public boolean isResetPageNumber () + { + return OfficeToken.TRUE.equals + (getAttribute(OfficeNamespaces.OOREPORT_NS, "reset-page-number")); + } + + public OfficeGroupSection getHeader() + { + final OfficeGroupInstanceSection instanceSection = + (OfficeGroupInstanceSection) findFirstChild(JFreeReportInfo.REPORT_NAMESPACE, "group-instance"); + if (instanceSection == null) + { + return null; + } + return (OfficeGroupSection) instanceSection.findFirstChild + (OfficeNamespaces.OOREPORT_NS, "group-header"); + + } + + public OfficeGroupSection getFooter() + { + final OfficeGroupInstanceSection instanceSection = + (OfficeGroupInstanceSection) findFirstChild(JFreeReportInfo.REPORT_NAMESPACE, "group-instance"); + if (instanceSection == null) + { + return null; + } + return (OfficeGroupSection) instanceSection.findFirstChild + (OfficeNamespaces.OOREPORT_NS, "group-footer"); + + } + public Expression getGroupingExpression(){ + final OfficeGroupInstanceSection instanceSection = + (OfficeGroupInstanceSection) findFirstChild(JFreeReportInfo.REPORT_NAMESPACE, "group-instance"); + if (instanceSection == null) + { + return null; + } + return instanceSection.getGroupingExpression(); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupInstanceSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupInstanceSection.java new file mode 100644 index 000000000000..26ec1d8f9c6d --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupInstanceSection.java @@ -0,0 +1,15 @@ +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Group; + +/** + * Creation-Date: 25.07.2007, 14:41:54 + * + * @author Thomas Morgner + */ +public class OfficeGroupInstanceSection extends Group +{ + public OfficeGroupInstanceSection() + { + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java new file mode 100644 index 000000000000..72c8e97ddb6a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java @@ -0,0 +1,56 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeGroupSection.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; + +/** + * A group header or footer. If such a section is marked as sticky, it will be + * repeated on each new page. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class OfficeGroupSection extends Section +{ + + public OfficeGroupSection() + { + } + + public boolean isRepeatSection() + { + final Object repeatFlag = + getAttribute(OfficeNamespaces.OOREPORT_NS, "repeat-section"); + return OfficeToken.TRUE.equals(repeatFlag); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java new file mode 100644 index 000000000000..6dca280618cc --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeMasterPage.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; +import com.sun.star.report.pentaho.OfficeNamespaces; + +/** + * A master page. A master page can contain header and footer and is linked + * to a page-layout. + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class OfficeMasterPage extends Section +{ + + public OfficeMasterPage() + { + } + + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } + + public String getPageLayout() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "page-layout-name"); + } + + public void setPageLayout(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "page-layout-name", name); + } + + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java new file mode 100644 index 000000000000..fed1f04db958 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java @@ -0,0 +1,87 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeMasterStyles.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import java.util.HashMap; + +import java.util.Map; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; + +/** + * The master-styles section can have either a master-page, handout-master + * or draw-layer-set. (The latter ones are ignored for the reporting purposes, + * they are PowerPoint related.) + * + * There is no documentation how the system selects a master-page if there is + * no master-page assigned to the paragraph. However, it seems as if the + * master-page called 'Standard' is used as initial default. + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class OfficeMasterStyles extends Element +{ + private final Map masterPages; + private final Section otherNodes; + + public OfficeMasterStyles() + { + masterPages = new HashMap(); + otherNodes = new Section(); + } + + public void addMasterPage (final OfficeMasterPage masterPage) + { + if (masterPage == null) + { + throw new NullPointerException(); + } + this.masterPages.put(masterPage.getStyleName(), masterPage); + } + + public OfficeMasterPage getMasterPage (final String name) + { + return (OfficeMasterPage) masterPages.get (name); + } + + public OfficeMasterPage[] getAllMasterPages() + { + return (OfficeMasterPage[]) masterPages.values().toArray + (new OfficeMasterPage[masterPages.size()]); + } + + public Section getOtherNodes() + { + return otherNodes; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java new file mode 100644 index 000000000000..74afacbc4026 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java @@ -0,0 +1,131 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeReport.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Node; + +/** + * A office report is an ordered section. It contains several root-level bands + * which need to be processed in a given order. + * + * A report can have named expression attached. These expressions will be + * computed at the global scope and will be available for all child elements. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class OfficeReport extends Element { + + private Node pageHeader; + private Node pageFooter; + private Node columnHeader; + private Node columnFooter; + private Node reportHeader; + private Node reportFooter; + private Node bodySection; + private Node preBodySection; + private Node postBodySection; + + public Node getPostBodySection() { + return postBodySection; + } + + public void setPostBodySection(final Node postBodySection) { + this.postBodySection = postBodySection; + } + + public Node getPreBodySection() { + return preBodySection; + } + + public void setPreBodySection(final Node preBodySection) { + this.preBodySection = preBodySection; + } + + public OfficeReport() { + } + + public Node getPageHeader() { + return pageHeader; + } + + public void setPageHeader(final Node pageHeader) { + this.pageHeader = pageHeader; + } + + public Node getPageFooter() { + return pageFooter; + } + + public void setPageFooter(final Node pageFooter) { + this.pageFooter = pageFooter; + } + + public Node getColumnHeader() { + return columnHeader; + } + + public void setColumnHeader(final Node columnHeader) { + this.columnHeader = columnHeader; + } + + public Node getColumnFooter() { + return columnFooter; + } + + public void setColumnFooter(final Node columnFooter) { + this.columnFooter = columnFooter; + } + + public Node getReportHeader() { + return reportHeader; + } + + public void setReportHeader(final Node reportHeader) { + this.reportHeader = reportHeader; + } + + public Node getReportFooter() { + return reportFooter; + } + + public void setReportFooter(final Node reportFooter) { + this.reportFooter = reportFooter; + } + + public Node getBodySection() { + return bodySection; + } + + public void setBodySection(final Node bodySection) { + this.bodySection = bodySection; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java new file mode 100644 index 000000000000..5f6bef8f1492 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java @@ -0,0 +1,134 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeStyle.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; + +/** + * Represents an automatic or manual style definition. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class OfficeStyle extends Section +{ + public OfficeStyle() + { + setNamespace(OfficeNamespaces.STYLE_NS); + setType("style"); + } + + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } + + /** + * A parent style name must be a common style (it cannot be an automatic + * style) and has to exist. If no parent style is given, an implementation + * specific default style is used. + * + * @return + */ + public String getStyleParent() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "parent-style-name"); + } + + public void setStyleParent(final String parentName) + { + setAttribute(OfficeNamespaces.STYLE_NS, "parent-style-name", parentName); + } + + public String getStyleFamily() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "family"); + } + + public void setStyleFamily(final String family) + { + setAttribute(OfficeNamespaces.STYLE_NS, "family", family); + } + +// public String getMasterPageName() +// { +// return (String) getAttribute(OfficeNamespaces.STYLE_NS, "master-page-name"); +// } + + public Element getParagraphProperties () + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "paragraph-properties"); + } + + public Element getTextProperties () + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "text-properties"); + } + + public Element getTableRowProperties () + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "table-row-properties"); + } + + public Element getTableProperties () + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "table-properties"); + } + + public Element getTableColumnProperties () + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "table-column-properties"); + } + + public Element getSectionProperties () + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "section-properties"); + } + + public Element getTableCellProperties () + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "table-cell-properties"); + } + + public Element getGraphicProperties () + { + return findFirstChild(OfficeNamespaces.STYLE_NS, OfficeToken.GRAPHIC_PROPERTIES); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java new file mode 100644 index 000000000000..29f2a923dae3 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java @@ -0,0 +1,199 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeStyles.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; + +import java.util.List; +import java.util.Map; +import org.jfree.report.structure.Element; + +/** + * Holds one style type, either an automatic, common or master style. This is a + * marker container that defines the nature of the styles contained within this + * container. (Yeah, it is awkward, but that's how the document model describes + * it.) + * + * The style family can be one of paragraph, text, section, table, table-column, + * table-row, table-cell, table-page, chart, default, drawing-page, graphic, + * presentation, control and ruby. + * + * @author Thomas Morgner + * @since 07.03.2007 + */ +public class OfficeStyles extends Element +{ + + public static class StyleKey implements Serializable + { + + private static final long serialVersionUID = 4931878927362887477L; + private final String family; + private final String name; + + public StyleKey(final String family, final String name) + { + if (family == null) + { + throw new NullPointerException(); + } + this.family = family; + this.name = name; + } + + public String getFamily() + { + return family; + } + + public String getName() + { + return name; + } + + public boolean equals(final Object obj) + { + if (this != obj) + { + if (obj == null || getClass() != obj.getClass()) + { + return false; + } + + final StyleKey styleKey = (StyleKey) obj; + + if (!family.equals(styleKey.family) || ( name != null ? !name.equals(styleKey.name) : styleKey.name != null) ) + { + return false; + } + } + return true; + } + + public int hashCode() + { + int result = family.hashCode(); + result = 31 * result + (name != null ? name.hashCode() : 0); + return result; + } + } + private final Map pageStyles; + private final Map dataStyles; + private final Map styles; + private final List otherChilds; + + public OfficeStyles() + { + this.styles = new HashMap(); + this.dataStyles = new HashMap(); + this.pageStyles = new HashMap(); + this.otherChilds = new ArrayList(); + } + + public OfficeStyle getStyle(final String family, final String name) + { + return (OfficeStyle) styles.get(new StyleKey(family, name)); + } + + public void addStyle(final OfficeStyle style) + { + if (style == null) + { + throw new NullPointerException(); + } + final String styleFamily = style.getStyleFamily(); + if (styleFamily == null) + { + throw new NullPointerException(); + } + if (style.getStyleName() == null) + { + throw new NullPointerException(); + } + styles.put(new StyleKey(styleFamily, style.getStyleName()), style); + } + + public void addPageStyle(final PageLayout style) + { + pageStyles.put(style.getStyleName(), style); + } + + public PageLayout getPageStyle(final String name) + { + return (PageLayout) pageStyles.get(name); + } + + public void addDataStyle(final DataStyle style) + { + dataStyles.put(style.getStyleName(), style); + } + + public DataStyle getDataStyle(final String name) + { + return (DataStyle) dataStyles.get(name); + } + + public void addOtherNode(final Element node) + { + otherChilds.add(node); + } + + public DataStyle[] getAllDataStyles() + { + return (DataStyle[]) dataStyles.values().toArray(new DataStyle[dataStyles.size()]); + } + + public PageLayout[] getAllPageStyles() + { + return (PageLayout[]) pageStyles.values().toArray(new PageLayout[pageStyles.size()]); + } + + public OfficeStyle[] getAllStyles() + { + return (OfficeStyle[]) styles.values().toArray(new OfficeStyle[styles.size()]); + } + + public Element[] getOtherStyles() + { + return (Element[]) otherChilds.toArray(new Element[otherChilds.size()]); + } + + public boolean containsStyle(final String family, final String name) + { + return styles.containsKey(new StyleKey(family, name)); + } + + public boolean containsDataStyle(final String styleName) + { + return dataStyles.containsKey(styleName); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java new file mode 100644 index 000000000000..58e6d4639add --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java @@ -0,0 +1,126 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeStylesCollection.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import org.jfree.report.structure.Element; + +/** + * Holds all style-definitions and provides some simplified lookup methods to + * grab them by their type and name. + *

+ * For now, we are only interested in 'style:style' nodes. Each of these nodes + * has a style-name and a style-family. Each style declaration can have a parent + * style, from which properties are inherited. + *

+ * Style names are unique within the family, no matter whether the style is an + * automatic style, an common style or a master style. + *

+ * The contents of this element are the union of the 'styles.xml' file (if it + * exists), the font-declarations and auto-styles of the document-content.xml + * and the styles declared in the main document. + * + * @author Thomas Morgner + * @since 06.03.2007 + */ +public class OfficeStylesCollection extends Element +{ + // Font-face declarations are copied as is. We simply merge them by adding + // them all in one set. This may result in duplicate entries, but as the + // fileformat does not forbid that, it therefore must be ok. + private final FontFaceDeclsSection fontFaceDecls; + private final OfficeStyles automaticStyles; + private final OfficeStyles commonStyles; + private final OfficeMasterStyles masterStyles; + + public OfficeStylesCollection() + { + fontFaceDecls = new FontFaceDeclsSection(); + + automaticStyles = new OfficeStyles(); + automaticStyles.setType("automatic-styles"); + automaticStyles.setNamespace(OfficeNamespaces.OFFICE_NS); + + commonStyles = new OfficeStyles(); + commonStyles.setType("styles"); + commonStyles.setNamespace(OfficeNamespaces.OFFICE_NS); + + masterStyles = new OfficeMasterStyles(); + masterStyles.setType("master-styles"); + masterStyles.setNamespace(OfficeNamespaces.OFFICE_NS); + } + + public OfficeStyle getStyle(final String family, final String name) + { + final OfficeStyle commonStyle = commonStyles.getStyle(family, name); + if (commonStyle != null) + { + return commonStyle; + } + final OfficeStyle autoStyle = automaticStyles.getStyle(family, name); + if (autoStyle != null) + { + return autoStyle; + } + + // And later: Autogenerate one of the default styles. + // However, at this moment, we dont have a clue about the default styles + // at all. Maybe we should add them to make this implementation more robust + // against invalid documents. + return null; + } + + public boolean containsStyle (final String family, final String name) + { + return (getStyle(family, name) != null); + } + + public OfficeStyles getAutomaticStyles() + { + return automaticStyles; + } + + public OfficeStyles getCommonStyles() + { + return commonStyles; + } + + public OfficeMasterStyles getMasterStyles() + { + return masterStyles; + } + + public FontFaceDeclsSection getFontFaceDecls() + { + return fontFaceDecls; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeTableSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeTableSection.java new file mode 100644 index 000000000000..96d6a4dd7e9e --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeTableSection.java @@ -0,0 +1,46 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeTableSection.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; + +/** + * Creation-Date: 24.04.2007, 15:55:17 + * + * @author Thomas Morgner + */ +public class OfficeTableSection extends Section +{ + public OfficeTableSection() + { + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java b/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java new file mode 100644 index 000000000000..29b916778ab7 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: PageLayout.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; +import com.sun.star.report.pentaho.OfficeNamespaces; + +/** + * A page layout describes the physical properties of a page. It is equal to + * an @page rule in CSS. + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class PageLayout extends Section +{ + + public PageLayout() + { + setNamespace(OfficeNamespaces.STYLE_NS); + setType("page-layout"); + } + + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } + + public Section getHeaderStyle () + { + return (Section) findFirstChild(OfficeNamespaces.STYLE_NS, "header-style"); + } + + public Section getFooterStyle () + { + return (Section) findFirstChild(OfficeNamespaces.STYLE_NS, "footer-style"); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/PageSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/PageSection.java new file mode 100644 index 000000000000..537a1cc3af42 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/PageSection.java @@ -0,0 +1,62 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: PageSection.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; +import org.jfree.layouting.util.AttributeMap; +import com.sun.star.report.pentaho.OfficeNamespaces; + +/** + * This represents either a page header or page footer. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class PageSection extends Section +{ + + private static final String NOT_WITH_REPORT_HEADER_NOR_FOOTER = "not-with-report-header-nor-footer"; + + public PageSection() + { + } + + public static boolean isPrintWithReportHeader(final AttributeMap attrs) + { + final String pagePrintOption = (String) attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "page-print-option"); + return !("not-with-report-header".equals(pagePrintOption) || NOT_WITH_REPORT_HEADER_NOR_FOOTER.equals(pagePrintOption)); + } + + public static boolean isPrintWithReportFooter(final AttributeMap attrs) + { + final String pagePrintOption = (String) attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "page-print-option"); + return !("not-with-report-footer".equals(pagePrintOption) || NOT_WITH_REPORT_HEADER_NOR_FOOTER.equals(pagePrintOption)); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java b/reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java new file mode 100644 index 000000000000..679dd30fdff3 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java @@ -0,0 +1,50 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: RawText.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.StaticText; + +/** + * A marker implementation. If encountered by the OfficeRawTarget, this text + * will be written without being normalized. Such text represents a page + * header or footer. + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class RawText extends StaticText +{ + public RawText(final String text) + { + super(text); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java new file mode 100644 index 000000000000..df1de0154e6a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java @@ -0,0 +1,115 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportElement.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import java.util.ArrayList; + +import org.jfree.report.structure.Element; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import java.util.List; + +/** + * A report element is the base class for all content generating elements in a + * report. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public abstract class ReportElement extends Element +{ + private final List formatConditions; + + protected ReportElement() + { + formatConditions = new ArrayList(); + } + + /** + * Checks the current group and prints this element only if the current row is + * the first row for that particular group. + * + * @return true, if the element should only be printed in the first row of the + * current group, false otherwise. + */ + public boolean isPrintWhenGroupChanges() + { + return OfficeToken.TRUE.equals(getAttribute + (OfficeNamespaces.OOREPORT_NS, "print-when-group-changes")); + } + + public void setPrintWhenGroupChanges(final boolean printWhenGroupChanges) + { + setAttribute(OfficeNamespaces.OOREPORT_NS, "print-when-group-changes", + String.valueOf(printWhenGroupChanges)); + } + + /** + * Checks, whether the printed value has been changed since the last run. The + * element will only be printed, if there was at least one change. + * + * @return true, if repeated values should be printed, false if repeated + * values should be surpressed. + */ + public boolean isPrintRepeatedValues() + { + return OfficeToken.TRUE.equals(getAttribute + (OfficeNamespaces.OOREPORT_NS, "print-repeated-values")); + } + + public void setPrintRepeatedValues(final boolean printRepeatedValues) + { + setAttribute(OfficeNamespaces.OOREPORT_NS, "print-repeated-values", + String.valueOf(printRepeatedValues)); + } + + public void addFormatCondition(final FormatCondition formatCondition) + { + if (formatCondition == null) + { + throw new NullPointerException(); + } + + this.formatConditions.add(formatCondition); + } + + public FormatCondition[] getFormatConditions () + { + return (FormatCondition[]) this.formatConditions.toArray + (new FormatCondition[this.formatConditions.size()]); + } + + public int getFormatConditionCount () + { + return formatConditions.size(); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java new file mode 100644 index 000000000000..74334dc11c52 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java @@ -0,0 +1,48 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TableCellElement.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 05.03.2007 + */ +public class TableCellElement extends Section +{ + + public TableCellElement() + { + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java new file mode 100644 index 000000000000..3dcdc302ef7a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: VariablesDeclarationSection.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.structure.Section; + +/** + * A paragraph that contains variables-declarations. This paragraph will be + * printed in the first cell of the first table (if there's one). + * + * The VariablesDeclarationSection is an auto-generated structure element that + * has no model-representation. The section itself is empty and simply acts + * as flag for the output-processor. The output processor itself is responsible + * to maintain the variables. + * + * @author Thomas Morgner + * @since 19.03.2007 + */ +public class VariablesDeclarationSection extends Section +{ + + public VariablesDeclarationSection() + { + setNamespace(JFreeReportInfo.REPORT_NAMESPACE); + setType("variables-section"); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/module.properties b/reportbuilder/java/com/sun/star/report/pentaho/module.properties new file mode 100644 index 000000000000..a2f9f7f4222b --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/module.properties @@ -0,0 +1,48 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: module.properties,v $ +# +# $Revision: 1.3 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + + +module-info: + name: factory-report-sun + producer: The JFreeReport project - www.jfree.org/jfreereport + description: XML-Parsers for OpenOffice.org report definitions. These definitions\ + are basicly similiar to the old JFreeReport format, with some limited absolute\ + positioning capabilities. + version.major: 0 + version.minor: 90 + version.patchlevel: 0 + +depends: + module: org.jfree.report.modules.factories.report.base.ReportFactoryBaseModule + version.major: 0 + version.minor: 92 + version.patchlevel: 0 + diff --git a/reportbuilder/java/com/sun/star/report/pentaho/oasis-datastyle.css b/reportbuilder/java/com/sun/star/report/pentaho/oasis-datastyle.css new file mode 100644 index 000000000000..01fa9d16fe03 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/oasis-datastyle.css @@ -0,0 +1,5 @@ +@namespace url("urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"); + +/** + * All default styles for data-styles elements. + */ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/oasis-draw.css b/reportbuilder/java/com/sun/star/report/pentaho/oasis-draw.css new file mode 100644 index 000000000000..87fe338294e2 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/oasis-draw.css @@ -0,0 +1,5 @@ +@namespace url("urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"); + +/** + * All default styles for draw elements. + */ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/oasis-form.css b/reportbuilder/java/com/sun/star/report/pentaho/oasis-form.css new file mode 100644 index 000000000000..b9f4967eaa1b --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/oasis-form.css @@ -0,0 +1,5 @@ +@namespace url("urn:oasis:names:tc:opendocument:xmlns:form:1.0"); + +/** + * All default styles for form elements. + */ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/oasis-style.css b/reportbuilder/java/com/sun/star/report/pentaho/oasis-style.css new file mode 100644 index 000000000000..6e5f9c8f51c5 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/oasis-style.css @@ -0,0 +1,10 @@ +@namespace url("urn:oasis:names:tc:opendocument:xmlns:style:1.0"); + +/** + * All default styles for style elements. (They should not be visible anyway, + * but better be complete than be sorry afterwards.) + */ + +raw-styles { + display:none; +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/oasis-table.css b/reportbuilder/java/com/sun/star/report/pentaho/oasis-table.css new file mode 100644 index 000000000000..efddd2919966 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/oasis-table.css @@ -0,0 +1,37 @@ +@namespace url("urn:oasis:names:tc:opendocument:xmlns:table:1.0"); + +table { + display: table; +} + +table-columns { + display: table-column-group; +} + +table-column { + display: table-column; +} + +table-row { + display: table-row; +} + +table-cell { + display: table-cell; +} + +table-cell[number-cols-spanned], +table-cell[number-cols-spanned], +table-columns[number-cols-spanned], +table-column[number-cols-spanned] { + -x-liblayout-colspan: attr(number-cols-spanned); +} + +table-cell[number-rows-spanned], +table-cell[number-rows-spanned] { + -x-liblayout-rowspan: attr(number-rows-spanned); +} + + + + diff --git a/reportbuilder/java/com/sun/star/report/pentaho/oasis-text.css b/reportbuilder/java/com/sun/star/report/pentaho/oasis-text.css new file mode 100644 index 000000000000..c8b6acc03d94 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/oasis-text.css @@ -0,0 +1,9 @@ +@namespace url("urn:oasis:names:tc:opendocument:xmlns:text:1.0"); + +/** + * All default styles for form elements. + */ + +p { + display: block; +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java b/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java new file mode 100644 index 000000000000..94f2d4fffad0 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java @@ -0,0 +1,458 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ImageProducer.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.output; + +import java.awt.Image; +import java.awt.Dimension; +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.sql.Blob; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Arrays; + +import com.sun.star.report.InputRepository; +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.util.Map; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jfree.layouting.input.style.values.CSSNumericType; +import org.jfree.layouting.input.style.values.CSSNumericValue; +import org.pentaho.reporting.libraries.base.util.IOUtils; +import org.pentaho.reporting.libraries.base.util.PngEncoder; +import org.pentaho.reporting.libraries.base.util.WaitingImageObserver; + +/** + * This class manages the images embedded in a report. + * + * @author Thomas Morgner + * @since 31.03.2007 + */ +public class ImageProducer +{ + private static final Log LOGGER = LogFactory.getLog(ImageProducer.class); + public static class OfficeImage + { + + private final CSSNumericValue width; + private final CSSNumericValue height; + private final String embeddableLink; + + public OfficeImage(final String embeddableLink, final CSSNumericValue width, final CSSNumericValue height) + { + this.embeddableLink = embeddableLink; + this.width = width; + this.height = height; + } + + public CSSNumericValue getWidth() + { + return width; + } + + public CSSNumericValue getHeight() + { + return height; + } + + public String getEmbeddableLink() + { + return embeddableLink; + } + } + + private static class ByteDataImageKey + { + + private final byte[] keyData; + private Integer hashCode; + + protected ByteDataImageKey(final byte[] keyData) + { + if (keyData == null) + { + throw new NullPointerException(); + } + this.keyData = keyData; + } + + public boolean equals(final Object o) + { + if (this != o) + { + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final ByteDataImageKey key = (ByteDataImageKey) o; + if (!Arrays.equals(keyData, key.keyData)) + { + return false; + } + } + + return true; + } + + public int hashCode() + { + if (hashCode != null) + { + return hashCode.intValue(); + } + + final int length = Math.min(keyData.length, 512); + int hashValue = 0; + for (int i = 0; i < length; i++) + { + final byte b = keyData[i]; + hashValue = b + hashValue * 23; + } + this.hashCode = new Integer(hashValue); + return hashValue; + } + } + private final Map imageCache; + private final InputRepository inputRepository; + private final OutputRepository outputRepository; + private final ImageService imageService; + private final DefaultNameGenerator nameGenerator; + + public ImageProducer(final InputRepository inputRepository, + final OutputRepository outputRepository, + final ImageService imageService) + { + if (inputRepository == null) + { + throw new NullPointerException(); + } + if (outputRepository == null) + { + throw new NullPointerException(); + } + if (imageService == null) + { + throw new NullPointerException(); + } + + this.inputRepository = inputRepository; + this.outputRepository = outputRepository; + this.imageService = imageService; + this.imageCache = new HashMap(); + this.nameGenerator = new DefaultNameGenerator(outputRepository); + } + + /** + * Image-Data can be one of the following types: String, URL, URI, byte-array, blob. + * + * @param imageData + * @param preserveIRI + * @return + */ + public OfficeImage produceImage(final Object imageData, + final boolean preserveIRI) + { + + LOGGER.debug("Want to produce image " + imageData); + if (imageData instanceof String) + { + return produceFromString((String) imageData, preserveIRI); + } + + if (imageData instanceof URL) + { + return produceFromURL((URL) imageData, preserveIRI); + } + + if (imageData instanceof Blob) + { + return produceFromBlob((Blob) imageData); + } + + if (imageData instanceof byte[]) + { + return produceFromByteArray((byte[]) imageData); + } + + if (imageData instanceof Image) + { + return produceFromImage((Image) imageData); + } + // not usable .. + return null; + } + + private OfficeImage produceFromImage(final Image image) + { + // quick caching ... use a weak list ... + final WaitingImageObserver obs = new WaitingImageObserver(image); + obs.waitImageLoaded(); + + final PngEncoder encoder = new PngEncoder(image, PngEncoder.ENCODE_ALPHA, PngEncoder.FILTER_NONE, 5); + final byte[] data = encoder.pngEncode(); + return produceFromByteArray(data); + } + + private OfficeImage produceFromBlob(final Blob blob) + { + try + { + final InputStream inputStream = blob.getBinaryStream(); + final int length = (int) blob.length(); + + final ByteArrayOutputStream bout = new ByteArrayOutputStream(length); + try + { + IOUtils.getInstance().copyStreams(inputStream, bout); + } finally + { + inputStream.close(); + } + return produceFromByteArray(bout.toByteArray()); + } + catch (IOException e) + { + LOGGER.warn("Failed to produce image from Blob", e); + } + catch (SQLException e) + { + LOGGER.warn("Failed to produce image from Blob", e); + } + return null; + } + + private OfficeImage produceFromByteArray(final byte[] data) + { + final ByteDataImageKey imageKey = new ByteDataImageKey(data); + final OfficeImage o = (OfficeImage) imageCache.get(imageKey); + if (o != null) + { + return o; + } + + try + { + final String mimeType = imageService.getMimeType(data); + final Dimension dims = imageService.getImageSize(data); + + // copy the image into the local output-storage + // todo: Implement data-fingerprinting so that we can detect the mime-type + final String name = nameGenerator.generateName("Pictures/image", mimeType); + final OutputStream outputStream = outputRepository.createOutputStream(name, mimeType); + final ByteArrayInputStream bin = new ByteArrayInputStream(data); + + try + { + IOUtils.getInstance().copyStreams(bin, outputStream); + } finally + { + outputStream.close(); + } + + final CSSNumericValue widthVal = CSSNumericValue.createValue(CSSNumericType.MM, dims.getWidth() / 100.0); + final CSSNumericValue heightVal = CSSNumericValue.createValue(CSSNumericType.MM, dims.getHeight() / 100.0); + final OfficeImage officeImage = new OfficeImage(name, widthVal, heightVal); + imageCache.put(imageKey, officeImage); + return officeImage; + } + catch (IOException e) + { + LOGGER.warn("Failed to load image from local input-repository", e); + } + catch (ReportExecutionException e) + { + LOGGER.warn("Failed to create image from local input-repository", e); + } + return null; + } + + private OfficeImage produceFromString(final String source, + final boolean preserveIRI) + { + + try + { + final URL url = new URL(source); + return produceFromURL(url, preserveIRI); + } + catch (MalformedURLException e) + { + // ignore .. but we had to try this .. + } + + final OfficeImage o = (OfficeImage) imageCache.get(source); + if (o != null) + { + return o; + } + + // Next, check whether this is a local path. + if (inputRepository.isReadable(source)) + { + // cool, the file exists. Let's try to read it. + try + { + final ByteArrayOutputStream bout = new ByteArrayOutputStream(8192); + final InputStream inputStream = inputRepository.createInputStream(source); + try + { + IOUtils.getInstance().copyStreams(inputStream, bout); + } finally + { + inputStream.close(); + } + final byte[] data = bout.toByteArray(); + final Dimension dims = imageService.getImageSize(data); + final String mimeType = imageService.getMimeType(data); + + 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 OfficeImage officeImage = new OfficeImage(filename, widthVal, heightVal); + imageCache.put(source, officeImage); + return officeImage; + } + catch (IOException e) + { + LOGGER.warn("Failed to load image from local input-repository", e); + } + catch (ReportExecutionException e) + { + LOGGER.warn("Failed to create image from local input-repository", e); + } + } + + // Return the image as broken image instead .. + final OfficeImage officeImage = new OfficeImage(source, null, null); + imageCache.put(source, officeImage); + return officeImage; + } + + private OfficeImage produceFromURL(final URL url, + final boolean preserveIRI) + { + final OfficeImage o = (OfficeImage) imageCache.get(url); + if (o != null) + { + return o; + } + + try + { + final ByteArrayOutputStream bout = new ByteArrayOutputStream(8192); + final URLConnection urlConnection = url.openConnection(); + final InputStream inputStream = new BufferedInputStream(urlConnection.getInputStream()); + try + { + IOUtils.getInstance().copyStreams(inputStream, bout); + } finally + { + inputStream.close(); + } + final byte[] data = bout.toByteArray(); + + final Dimension dims = imageService.getImageSize(data); + final String mimeType = imageService.getMimeType(data); + final CSSNumericValue widthVal = CSSNumericValue.createValue(CSSNumericType.MM, dims.getWidth() / 100.0); + final CSSNumericValue heightVal = CSSNumericValue.createValue(CSSNumericType.MM, dims.getHeight() / 100.0); + + if (preserveIRI) + { + final OfficeImage retval = new OfficeImage(url.toString(), widthVal, heightVal); + imageCache.put(url, retval); + return retval; + } + + final String file = url.getFile(); + final String name = copyToOutputRepository(mimeType, file, data); + final OfficeImage officeImage = new OfficeImage(name, widthVal, heightVal); + imageCache.put(url, officeImage); + return officeImage; + } + catch (IOException e) + { + LOGGER.warn("Failed to load image from local input-repository" + e); + } + catch (ReportExecutionException e) + { + LOGGER.warn("Failed to create image from local input-repository" + e); + } + + if (!preserveIRI) + { + final OfficeImage image = new OfficeImage(url.toString(), null, null); + imageCache.put(url, image); + return image; + } + + // OK, everything failed; the image is not - repeat it - not usable. + return null; + } + + private String copyToOutputRepository(final String urlMimeType, final String file, final byte[] data) + throws IOException, ReportExecutionException + { + final String mimeType; + if (urlMimeType == null) + { + mimeType = imageService.getMimeType(data); + } + else + { + mimeType = urlMimeType; + } + + // copy the image into the local output-storage + final String name = nameGenerator.generateName("Pictures/image", mimeType); + final OutputStream outputStream = outputRepository.createOutputStream(name, mimeType); + final ByteArrayInputStream bin = new ByteArrayInputStream(data); + + try + { + IOUtils.getInstance().copyStreams(bin, outputStream); + } finally + { + outputStream.close(); + } + return name; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java new file mode 100644 index 000000000000..e9b6f8da882c --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java @@ -0,0 +1,1641 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeDocumentReportTarget.java,v $ + * $Revision: 1.9 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.output; + +import com.sun.star.report.DataSourceFactory; +import java.awt.Image; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.StringWriter; +import java.io.Writer; +import java.util.Iterator; +import java.util.Map; +import java.util.zip.DeflaterOutputStream; +import java.util.zip.InflaterInputStream; + +import com.sun.star.report.ImageService; +import com.sun.star.report.InputRepository; +import com.sun.star.report.OutputRepository; +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.layoutprocessor.ImageElementContext; +import com.sun.star.report.pentaho.model.OfficeDocument; +import com.sun.star.report.pentaho.model.OfficeStyle; +import com.sun.star.report.pentaho.model.OfficeStyles; +import com.sun.star.report.pentaho.model.OfficeStylesCollection; +import com.sun.star.report.pentaho.styles.LengthCalculator; +import com.sun.star.report.pentaho.styles.StyleMapper; +import java.io.BufferedReader; +import java.io.StringReader; +import java.util.ArrayList; +import org.apache.commons.logging.Log; +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.layouter.style.CSSValueResolverUtility; +import org.jfree.layouting.namespace.NamespaceDefinition; +import org.jfree.layouting.namespace.Namespaces; +import org.jfree.layouting.util.AttributeMap; +import org.jfree.layouting.util.LazyAttributeMap; +import org.jfree.report.DataFlags; +import org.jfree.report.DataSourceException; +import org.jfree.report.JFreeReportBoot; +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.flow.AbstractReportTarget; +import org.jfree.report.flow.ReportJob; +import org.jfree.report.flow.ReportStructureRoot; +import org.jfree.report.flow.ReportTargetUtil; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; +import org.jfree.report.util.AttributeNameGenerator; +import org.jfree.report.util.IntegerCache; +import org.jfree.report.util.MemoryByteArrayOutputStream; +import org.pentaho.reporting.libraries.base.util.FastStack; +import org.pentaho.reporting.libraries.base.util.IOUtils; +import org.pentaho.reporting.libraries.resourceloader.ResourceException; +import org.pentaho.reporting.libraries.resourceloader.ResourceKey; +import org.pentaho.reporting.libraries.resourceloader.ResourceManager; +import org.pentaho.reporting.libraries.xmlns.common.AttributeList; +import org.pentaho.reporting.libraries.xmlns.writer.DefaultTagDescription; +import org.pentaho.reporting.libraries.xmlns.writer.XmlWriter; +import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport; +import org.w3c.css.sac.LexicalUnit; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 08.03.2007 + */ +public abstract class OfficeDocumentReportTarget extends AbstractReportTarget +{ + protected static final Log LOGGER = LogFactory.getLog(OfficeDocumentReportTarget.class); + public static final String HORIZONTAL_POS = "horizontal-pos"; + public static final String TAG_DEF_PREFIX = "com.sun.star.report.pentaho.output."; + public static final int ROLE_NONE = 0; + public static final int ROLE_REPORT_HEADER = 1; + public static final int ROLE_REPORT_FOOTER = 2; + public static final int ROLE_GROUP_HEADER = 3; + public static final int ROLE_GROUP_FOOTER = 4; + public static final int ROLE_REPEATING_GROUP_HEADER = 5; + public static final int ROLE_REPEATING_GROUP_FOOTER = 6; + public static final int ROLE_PAGE_HEADER = 7; + public static final int ROLE_PAGE_FOOTER = 8; + public static final int ROLE_DETAIL = 9; + public static final int ROLE_VARIABLES = 10; + public static final int ROLE_TEMPLATE = 11; + public static final int ROLE_SPREADSHEET_PAGE_HEADER = 12; + public static final int ROLE_SPREADSHEET_PAGE_FOOTER = 13; + public static final int STATE_IN_DOCUMENT = 0; + public static final int STATE_IN_BODY = 1; + public static final int STATE_IN_CONTENT = 2; + public static final int STATE_IN_GROUP = 3; + public static final int STATE_IN_GROUP_BODY = 4; + public static final int STATE_IN_SECTION = 5; + public static final int STATE_IN_OTHER = 6; + public static final int STATE_IN_GROUP_INSTANCE = 7; + public static final String FAILED = "Failed"; + public static final String VERTICAL_POS = "vertical-pos"; + private static final String ZERO_CM = "0cm"; + + protected static class BufferState + { + + private final XmlWriter xmlWriter; + private final MemoryByteArrayOutputStream xmlBuffer; + private final OfficeStylesCollection stylesCollection; + + protected BufferState(final XmlWriter xmlWriter, + final MemoryByteArrayOutputStream xmlBuffer, + final OfficeStylesCollection stylesCollection) + { + this.stylesCollection = stylesCollection; + this.xmlWriter = xmlWriter; + this.xmlBuffer = xmlBuffer; + } + + public OfficeStylesCollection getStylesCollection() + { + return stylesCollection; + } + + public XmlWriter getXmlWriter() + { + return xmlWriter; + } + + public String getXmlBuffer() throws ReportProcessingException + { + try + { + final byte[] zippedData = xmlBuffer.getRaw(); + final InputStreamReader reader = new InputStreamReader(new InflaterInputStream(new ByteArrayInputStream(zippedData, 0, xmlBuffer.getLength())), "UTF-16"); + final StringWriter writer = new StringWriter((zippedData.length / 2) + 1); + IOUtils.getInstance().copyWriter(reader, writer); + return writer.toString(); + } + catch (IOException e) + { + throw new ReportProcessingException("Failed to copy buffer", e); + } + } + + public Reader getXmlAsReader() throws ReportProcessingException + { + try + { + final byte[] zippedData = xmlBuffer.getRaw(); + return new InputStreamReader(new InflaterInputStream(new ByteArrayInputStream(zippedData, 0, xmlBuffer.getLength())), "UTF-16"); + } + catch (IOException e) + { + throw new ReportProcessingException("Failed to copy buffer", e); + } + } + } + + protected static class GroupContext + { + + private final GroupContext parent; + private int iterationCount; + private boolean groupWithRepeatingSection; + + protected GroupContext(final GroupContext parent) + { + this.parent = parent; + } + + public GroupContext getParent() + { + return parent; + } + + public int getIterationCount() + { + return iterationCount; + } + + public void setIterationCount(final int iterationCount) + { + this.iterationCount = iterationCount; + } + + public boolean isGroupWithRepeatingSection() + { + return groupWithRepeatingSection; + } + + public void setGroupWithRepeatingSection(final boolean groupWithRepeatingSection) + { + this.groupWithRepeatingSection = groupWithRepeatingSection; + } + + public String toString() + { + return "GroupContext{" + + "parent=" + parent + + ", iterationCount=" + iterationCount + + ", groupWithRepeatingSection=" + groupWithRepeatingSection + + '}'; + } + } + private final FastStack states; + private int currentRole; + private final FastStack xmlWriters; + private XmlWriter rootXmlWriter; + /** + * This styles-collection contains all styles that were predefined in the report definition file. The common styles + * and the master-styles will be written unmodified, the automatic styles will be ignored. + */ + private OfficeStylesCollection predefinedStylesCollection; + /** + * This styles-collection contains all master-styles that have been generated by the report definition process. It + * also contains all automatic styles that have been generated for the page-bands (and the pagebands as well). + */ + private OfficeStylesCollection globalStylesCollection; + /** + * The content styles collection contains all automatic styles that have been generated for the normal-flow content. + */ + private OfficeStylesCollection contentStylesCollection; + private final OutputRepository outputRepository; + private final InputRepository inputRepository; + private final AttributeNameGenerator tableNameGenerator; + private final AttributeNameGenerator frameNameGenerator; + private final AttributeNameGenerator autoStyleNameGenerator; + private final String target; + private static final int INITIAL_BUFFER_SIZE = 40960; + private StyleMapper styleMapper; + private StyleSheetParserUtil styleSheetParserUtil; + private final AttributeNameGenerator imageNames; + private final ImageProducer imageProducer; + private final OleProducer oleProducer; + private GroupContext groupContext; + private static final boolean DEBUG_ELEMENTS = + JFreeReportBoot.getInstance().getExtendedConfig().getBoolProperty("com.sun.star.report.pentaho.output.DebugElements"); + + protected OfficeDocumentReportTarget(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 + { + super(reportJob, resourceManager, baseResource); + if (imageService == null) + { + throw new NullPointerException("ImageService must not be null"); + } + if (target == null) + { + throw new NullPointerException("Target-Name must not be null"); + } + + this.target = target; + + this.tableNameGenerator = new AttributeNameGenerator(); + this.frameNameGenerator = new AttributeNameGenerator(); + this.autoStyleNameGenerator = new AttributeNameGenerator(); + this.outputRepository = outputRepository; + this.inputRepository = inputRepository; + this.states = new FastStack(); + this.xmlWriters = new FastStack(); + this.imageNames = new AttributeNameGenerator(); + + this.imageProducer = new ImageProducer(inputRepository, outputRepository, imageService); + this.oleProducer = new OleProducer(inputRepository, outputRepository, imageService, datasourcefactory); + + try + { + final ResourceManager realResourceManager = getResourceManager(); + styleMapper = StyleMapper.loadInstance(realResourceManager); + } + catch (ResourceException e) + { + throw new ReportProcessingException("Failed to load style-mapper", e); + } + } + + protected abstract String getTargetMimeType(); + + protected OutputRepository getOutputRepository() + { + return outputRepository; + } + + protected InputRepository getInputRepository() + { + return inputRepository; + } + + /** + * Starts the output of a new office document. This method writes the generic 'office:document-content' tag along with + * all known namespace declarations. + * + * @param report the report object. + * @throws DataSourceException if there was an error accessing the datasource + * @throws ReportProcessingException if some other error occured. + */ + public void startReport(final ReportStructureRoot report) + throws DataSourceException, ReportProcessingException + { + imageNames.reset(); + this.groupContext = new GroupContext(null); + + final DefaultTagDescription tagDescription = createTagDescription(); + try + { + final OutputStream outputStream = outputRepository.createOutputStream(target, "text/xml"); + final Writer writer = new OutputStreamWriter(outputStream, "UTF-8"); + + this.rootXmlWriter = new XmlWriter(writer, tagDescription); + this.rootXmlWriter.setAlwaysAddNamespace(true); + + final AttributeList rootAttributes = new AttributeList(); + rootAttributes.addNamespaceDeclaration("office", OfficeNamespaces.OFFICE_NS); + rootAttributes.addNamespaceDeclaration("style", OfficeNamespaces.STYLE_NS); + rootAttributes.addNamespaceDeclaration("text", OfficeNamespaces.TEXT_NS); + rootAttributes.addNamespaceDeclaration("table", OfficeNamespaces.TABLE_NS); + rootAttributes.addNamespaceDeclaration("draw", OfficeNamespaces.DRAWING_NS); + rootAttributes.addNamespaceDeclaration("fo", OfficeNamespaces.FO_NS); + rootAttributes.addNamespaceDeclaration("xlink", OfficeNamespaces.XLINK_NS); + rootAttributes.addNamespaceDeclaration("dc", OfficeNamespaces.PURL_NS); + rootAttributes.addNamespaceDeclaration("meta", OfficeNamespaces.META_NS); + rootAttributes.addNamespaceDeclaration("number", OfficeNamespaces.DATASTYLE_NS); + rootAttributes.addNamespaceDeclaration("svg", OfficeNamespaces.SVG_NS); + rootAttributes.addNamespaceDeclaration("chart", OfficeNamespaces.CHART_NS); + rootAttributes.addNamespaceDeclaration("dr3d", OfficeNamespaces.DR3D_NS); + rootAttributes.addNamespaceDeclaration("math", OfficeNamespaces.MATHML_NS); + rootAttributes.addNamespaceDeclaration("form", OfficeNamespaces.FORM_NS); + rootAttributes.addNamespaceDeclaration("script", OfficeNamespaces.SCRIPT_NS); + rootAttributes.addNamespaceDeclaration("ooo", OfficeNamespaces.OO2004_NS); + rootAttributes.addNamespaceDeclaration("ooow", OfficeNamespaces.OOW2004_NS); + rootAttributes.addNamespaceDeclaration("oooc", OfficeNamespaces.OOC2004_NS); + rootAttributes.addNamespaceDeclaration("dom", OfficeNamespaces.XML_EVENT_NS); + rootAttributes.addNamespaceDeclaration("xforms", OfficeNamespaces.XFORMS_NS); + rootAttributes.addNamespaceDeclaration("xsd", OfficeNamespaces.XSD_NS); + rootAttributes.addNamespaceDeclaration("xsi", OfficeNamespaces.XSI_NS); + rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.0"); + + this.rootXmlWriter.writeXmlDeclaration("UTF-8"); + this.rootXmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "document-content", rootAttributes, XmlWriterSupport.OPEN); + + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_DOCUMENT)); + + autoStyleNameGenerator.reset(); + tableNameGenerator.reset(); + frameNameGenerator.reset(); + + final OfficeDocument reportDoc = (OfficeDocument) report; + predefinedStylesCollection = reportDoc.getStylesCollection(); + + final OfficeStyles commonStyles = predefinedStylesCollection.getCommonStyles(); + if (!commonStyles.containsStyle(OfficeToken.GRAPHIC, OfficeToken.GRAPHICS)) + { + final OfficeStyle graphicsDefaultStyle = new OfficeStyle(); + graphicsDefaultStyle.setStyleFamily(OfficeToken.GRAPHIC); + graphicsDefaultStyle.setStyleName(OfficeToken.GRAPHICS); + final Element graphicProperties = produceFirstChild(graphicsDefaultStyle, OfficeNamespaces.STYLE_NS, OfficeToken.GRAPHIC_PROPERTIES); + graphicProperties.setAttribute(OfficeNamespaces.TEXT_NS, "anchor-type", OfficeToken.PARAGRAPH); + graphicProperties.setAttribute(OfficeNamespaces.SVG_NS, "x", ZERO_CM); + graphicProperties.setAttribute(OfficeNamespaces.SVG_NS, "y", ZERO_CM); + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "wrap", "dynamic"); + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "number-wrapped-paragraphs", "no-limit"); + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "wrap-contour", OfficeToken.FALSE); + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, VERTICAL_POS, "from-top"); // changed for chart + + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "vertical-rel", OfficeToken.PARAGRAPH); + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, HORIZONTAL_POS, "from-left"); // changed for chart + + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "horizontal-rel", OfficeToken.PARAGRAPH); + commonStyles.addStyle(graphicsDefaultStyle); + } + + // Make sure that later generated styles do not overwrite existing styles. + fillStyleNameGenerator(predefinedStylesCollection); + + contentStylesCollection = new OfficeStylesCollection(); + globalStylesCollection = new OfficeStylesCollection(); + + startBuffering(contentStylesCollection, true); + } + catch (IOException e) + { + throw new ReportProcessingException(FAILED, e); + } + } + + protected AttributeNameGenerator getAutoStyleNameGenerator() + { + return autoStyleNameGenerator; + } + + private void fillStyleNameGenerator(final OfficeStylesCollection stylesCollection) + { + final OfficeStyles commonStyles = stylesCollection.getCommonStyles(); + final OfficeStyle[] allCommonStyles = commonStyles.getAllStyles(); + for (int i = 0; i < allCommonStyles.length; i++) + { + final OfficeStyle style = allCommonStyles[i]; + autoStyleNameGenerator.generateName(style.getStyleName()); + } + + final OfficeStyles autoStyles = stylesCollection.getAutomaticStyles(); + final OfficeStyle[] allAutoStyles = autoStyles.getAllStyles(); + for (int i = 0; i < allAutoStyles.length; i++) + { + final OfficeStyle style = allAutoStyles[i]; + autoStyleNameGenerator.generateName(style.getStyleName()); + } + } + + public OfficeStylesCollection getPredefinedStylesCollection() + { + return predefinedStylesCollection; + } + + public OfficeStylesCollection getGlobalStylesCollection() + { + return globalStylesCollection; + } + + public OfficeStylesCollection getContentStylesCollection() + { + return contentStylesCollection; + } + + /** + * Returns the XML-Writer tag description. This description defines whether an element can have character data inside. + * Such element will disable the indention, as in that case the additional whitespaces might alter the meaning of the + * element's contents. + * + * @return the tag description library. + */ + protected DefaultTagDescription createTagDescription() + { + final DefaultTagDescription tagDescription = new DefaultTagDescription(); + tagDescription.configure(JFreeReportBoot.getInstance().getGlobalConfig(), + OfficeDocumentReportTarget.TAG_DEF_PREFIX); + return tagDescription; + } + + /** + * Returns the current processing state. + * + * @return the processing state. + */ + protected int getCurrentState() + { + if (states.isEmpty()) + { + throw new IllegalStateException(); + } + final Integer o = (Integer) states.peek(); + return o.intValue(); + } + + /** + * Starts the processing of an element and updates the processing state. This will select an apropriate handler method + * for the call and will call one of the start* methods. + * + * @param roAttrs the attribute map for the current element + * @throws DataSourceException + * @throws ReportProcessingException + */ + public final void startElement(final AttributeMap roAttrs) + throws DataSourceException, ReportProcessingException + { + final AttributeMap attrs = new LazyAttributeMap(roAttrs); + // todo + if (DEBUG_ELEMENTS) + { + LOGGER.debug("Starting " + getCurrentState() + '/' + states.size() + ' ' + + ReportTargetUtil.getNamespaceFromAttribute(attrs) + " -> " + + ReportTargetUtil.getElemenTypeFromAttribute(attrs)); + } + try + { + switch (getCurrentState()) + { + case OfficeDocumentReportTarget.STATE_IN_DOCUMENT: + { + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OFFICE_NS, "body", attrs)) + { + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_BODY)); + startBody(attrs); + } + else + { + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_OTHER)); + if (!isFilteredNamespace(ReportTargetUtil.getNamespaceFromAttribute(attrs))) + { + startOther(attrs); + } + } + break; + } + case OfficeDocumentReportTarget.STATE_IN_BODY: + { + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OFFICE_NS, "report", attrs)) + { + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_CONTENT)); + startContent(attrs); + } + else + { + throw new IllegalStateException("The 'office:body' element must have exactly one child of type 'report'"); + } + break; + } + case OfficeDocumentReportTarget.STATE_IN_CONTENT: + { + // Either a ordinary section or a group .. + // A group. + if (ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, "report-body", attrs)) + { + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_GROUP_BODY)); + startGroupBody(attrs); + } + else + { + // Either a template-section, page-header, page-footer, report-header, report-footer + // or variables-section + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_SECTION)); + if (ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, "template", attrs)) + { + currentRole = OfficeDocumentReportTarget.ROLE_TEMPLATE; + } + else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "page-header", attrs)) + { + if ("spreadsheet-section".equals(attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "role"))) + { + currentRole = OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER; + } + else + { + currentRole = OfficeDocumentReportTarget.ROLE_PAGE_HEADER; + } + } + else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "page-footer", attrs)) + { + if ("spreadsheet-section".equals(attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "role"))) + { + currentRole = OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER; + } + else + { + currentRole = OfficeDocumentReportTarget.ROLE_PAGE_FOOTER; + } + } + else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "report-header", attrs)) + { + currentRole = OfficeDocumentReportTarget.ROLE_REPORT_HEADER; + } + else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "report-footer", attrs)) + { + currentRole = OfficeDocumentReportTarget.ROLE_REPORT_FOOTER; + } + else if (ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, "variables-section", attrs)) + { + currentRole = OfficeDocumentReportTarget.ROLE_VARIABLES; + } + else + { + throw new IllegalStateException("Expected either 'template', 'report-body', " + + "'report-header', 'report-footer', 'variables-section', 'page-header' or 'page-footer'"); + } + startReportSection(attrs, currentRole); + } + break; + } + case OfficeDocumentReportTarget.STATE_IN_GROUP_BODY: + { + // We now expect either an other group or a detail band. + + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group", attrs)) + { + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_GROUP)); + groupContext = new GroupContext(groupContext); + startGroup(attrs); + } + else + { + // Either a variables-section, or a detail-band + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_SECTION)); + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "detail", attrs)) + { + currentRole = OfficeDocumentReportTarget.ROLE_DETAIL; + } + else if (ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, "variables-section", attrs)) + { + currentRole = OfficeDocumentReportTarget.ROLE_VARIABLES; + } + else + { + throw new IllegalStateException("Expected either 'group', 'detail' or 'variables-section'"); + } + startReportSection(attrs, currentRole); + } + break; + } + case OfficeDocumentReportTarget.STATE_IN_GROUP: + { + // A group can carry a repeating group header/footer or a group-instance section. + if (ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, "group-instance", attrs)) + { + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_GROUP_INSTANCE)); + startGroupInstance(attrs); + } + else + { + // repeating group header/footer, but *no* variables section + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_SECTION)); + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group-header", attrs) && + OfficeToken.TRUE.equals(attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeated-section"))) + { + currentRole = OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER; + } + else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group-footer", attrs) && + OfficeToken.TRUE.equals(attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeated-section"))) + { + currentRole = OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER; + } + else + { + throw new IllegalStateException("Expected either 'group-instance', " + + "'repeating group-header' or 'repeating group-footer'"); + } + startReportSection(attrs, currentRole); + } + break; + } + case OfficeDocumentReportTarget.STATE_IN_GROUP_INSTANCE: + { + if (ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, "group-body", attrs)) + { + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_GROUP_BODY)); + startGroupBody(attrs); + } + else + { + // Either a group-header or group-footer or variables-section + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_SECTION)); + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group-header", attrs)) + { + currentRole = OfficeDocumentReportTarget.ROLE_GROUP_HEADER; + } + else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group-footer", attrs)) + { + currentRole = OfficeDocumentReportTarget.ROLE_GROUP_FOOTER; + } + else if (ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, "variables-section", attrs)) + { + currentRole = OfficeDocumentReportTarget.ROLE_VARIABLES; + } + else + { + throw new IllegalStateException("Expected either 'group-body', 'group-header', 'group-footer' or 'variables-section'"); + } + startReportSection(attrs, currentRole); + } + break; + } + case OfficeDocumentReportTarget.STATE_IN_SECTION: + { + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_OTHER)); + startOther(attrs); + break; + } + case OfficeDocumentReportTarget.STATE_IN_OTHER: + { + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_OTHER)); + startOther(attrs); + break; + } + default: + throw new IllegalStateException("Failure: " + getCurrentState()); + } + } + catch (IOException ioe) + { + LOGGER.error("ReportProcessing failed", ioe); + throw new ReportProcessingException("Failed to write content", ioe); + } +// finally +// { +// LOGGER.debug ("Started " + getNamespaceFromAttribute(attrs) + ":" + +// getElemenTypeFromAttribute(attrs) + " -> " + getCurrentState()); +// } + } + + protected GroupContext getGroupContext() + { + return groupContext; + } + + protected void performStyleProcessing(final AttributeMap attrs) + throws ReportProcessingException + { + final OfficeStylesCollection stylesCollection = getStylesCollection(); + final OfficeStylesCollection predefCollection = getPredefinedStylesCollection(); + final OfficeStylesCollection globalStylesCollection = getGlobalStylesCollection(); + + final String elementNamespace = + ReportTargetUtil.getNamespaceFromAttribute(attrs); + final String elementName = + ReportTargetUtil.getElemenTypeFromAttribute(attrs); + + final String[] namespaces = attrs.getNameSpaces(); + for (int i = 0; i < namespaces.length; i++) + { + final String attrNamespace = namespaces[i]; + if (isFilteredNamespace(attrNamespace)) + { + continue; + } + + final Map attributes = attrs.getAttributes(attrNamespace); + final Iterator iterator = attributes.entrySet().iterator(); + while (iterator.hasNext()) + { + final Map.Entry entry = (Map.Entry) iterator.next(); + final String attrName = (String) entry.getKey(); + final String attrValue = String.valueOf(entry.getValue()); + + final String styleFamily = styleMapper.getStyleFamilyFor(elementNamespace, elementName, attrNamespace, attrName); + if (styleFamily == null) + { + // None of the known style attributes. + continue; + } + + if (styleMapper.isListOfStyles(elementNamespace, elementName, attrNamespace, attrName)) + { + // ignored for now. + LOGGER.warn("List of styles is not yet implemented."); + continue; + } + + // Copy styles is only called once per style. + StyleUtilities.copyStyle(styleFamily, attrValue, stylesCollection, globalStylesCollection, predefCollection); + } + } + } + + protected void startBody(final AttributeMap attrs) + throws IOException + { + getXmlWriter().writeTag(OfficeNamespaces.OFFICE_NS, "body", XmlWriterSupport.OPEN); + } + + private final boolean allowBuffering(final int role) + { + return (role == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER || + role == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER || + role == OfficeDocumentReportTarget.ROLE_TEMPLATE); + } + + protected void startReportSection(final AttributeMap attrs, final int role) + throws IOException, DataSourceException, ReportProcessingException + { + if (allowBuffering(role)) + { + startBuffering(new OfficeStylesCollection(), true); + } + } + + protected abstract void startContent(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException; + + protected void startGroup(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + final Object repeatingHeaderOrFooter = attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeating-header-or-footer"); + if (OfficeToken.TRUE.equals(repeatingHeaderOrFooter)) + { + getGroupContext().setGroupWithRepeatingSection(true); + } + + final Object iterationCount = attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "iteration-count"); + if (iterationCount instanceof Number) + { + final Number itNumber = (Number) iterationCount; + getGroupContext().setIterationCount(itNumber.intValue()); + } + } + + protected void startGroupInstance(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + } + + protected void startGroupBody(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + } + + protected abstract void startOther(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException; + + public void processText(final String text) + throws DataSourceException, ReportProcessingException + { + try + { + final XmlWriter xmlWriter = getXmlWriter(); + final BufferedReader br = new BufferedReader(new StringReader(text)); + String line = br.readLine(); + while (line != null) + { + xmlWriter.writeTextNormalized(line, false); + line = br.readLine(); + if (line != null) + { + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "line-break", XmlWriterSupport.CLOSE); + } + } + } + catch (IOException e) + { + throw new ReportProcessingException(FAILED, e); + } + } + + protected boolean isFilteredNamespace(final String namespace) + { + if (Namespaces.LIBLAYOUT_NAMESPACE.equals(namespace)) + { + return true; + } + if (JFreeReportInfo.REPORT_NAMESPACE.equals(namespace)) + { + return true; + } + if (JFreeReportInfo.REPORT_NAMESPACE.equals(namespace)) + { + return true; + } + if (JFreeReportInfo.COMPATIBILITY_NAMESPACE.equals(namespace)) + { + return true; + } + if (OfficeNamespaces.OOREPORT_NS.equals(namespace)) + { + return true; + } + return false; + } + + public void processContent(final DataFlags value) + throws DataSourceException, ReportProcessingException + { + final Object rawvalue = value.getValue(); + if (rawvalue == null) + { + return; + } + + // special handler for image (possibly also for URL ..) + if (rawvalue instanceof Image) + { + // do nothing yet. We should define something for that later .. + return; + } + + final XmlWriter xmlWriter = getXmlWriter(); + final String text = String.valueOf(rawvalue); + try + { + final BufferedReader br = new BufferedReader(new StringReader(text)); + String line = br.readLine(); + while (line != null) + { + xmlWriter.writeTextNormalized(line, false); + line = br.readLine(); + if (line != null) + { + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "line-break", XmlWriterSupport.CLOSE); + } + } + } + catch (IOException e) + { + throw new ReportProcessingException(FAILED, e); + } + } + + public final void endElement(final AttributeMap roAttrs) + throws DataSourceException, ReportProcessingException + { + final AttributeMap attrs = new LazyAttributeMap(roAttrs); + // final int oldState = getCurrentState(); + try + { + + switch (getCurrentState()) + { + case OfficeDocumentReportTarget.STATE_IN_OTHER: + { + endOther(attrs); + break; + } + case OfficeDocumentReportTarget.STATE_IN_SECTION: + { + endReportSection(attrs, currentRole); + currentRole = OfficeDocumentReportTarget.ROLE_NONE; + break; + } + case OfficeDocumentReportTarget.STATE_IN_GROUP: + { + endGroup(attrs); + groupContext = groupContext.getParent(); + break; + } + case OfficeDocumentReportTarget.STATE_IN_GROUP_INSTANCE: + { + endGroupInstance(attrs); + break; + } + case OfficeDocumentReportTarget.STATE_IN_GROUP_BODY: + { + endGroupBody(attrs); + break; + } + case OfficeDocumentReportTarget.STATE_IN_CONTENT: + { + endContent(attrs); + break; + } + case OfficeDocumentReportTarget.STATE_IN_BODY: + { + endBody(attrs); + break; + } + case OfficeDocumentReportTarget.STATE_IN_DOCUMENT: + { + throw new IllegalStateException("This cannot be."); + } + default: + { + throw new IllegalStateException("Invalid state encountered."); + } + } + } + catch (IOException ioe) + { + throw new ReportProcessingException("IO Error while writing content", + ioe); + } finally + { + states.pop(); + + if (DEBUG_ELEMENTS) + { + LOGGER.debug("Finished " + getCurrentState() + "/" + states.size() + " " + + ReportTargetUtil.getNamespaceFromAttribute(attrs) + ":" + + ReportTargetUtil.getElemenTypeFromAttribute(attrs)); + } + + } + } + + protected void endGroupBody(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + } + + protected void endGroupInstance(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + } + + public int getCurrentRole() + { + return currentRole; + } + + protected abstract void endOther(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException; + + protected void endReportSection(final AttributeMap attrs, + final int role) + throws IOException, DataSourceException, ReportProcessingException + { + if (allowBuffering(role)) + { + finishBuffering(); + } + } + + protected void endGroup(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + } + + protected abstract void endContent(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException; + + protected void endBody(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + getXmlWriter().writeCloseTag(); + } + + public void endReport(final ReportStructureRoot report) + throws DataSourceException, ReportProcessingException + { + if (xmlWriters.size() != 1) + { + throw new IllegalStateException("Invalid writer-stack state"); + } + + try + { + final StylesWriter inlineStylesWriter = new StylesWriter(rootXmlWriter); + inlineStylesWriter.writeContentStyles(predefinedStylesCollection, contentStylesCollection); + + final BufferState state = finishBuffering(); + this.rootXmlWriter.writeStream(state.getXmlAsReader()); + + final OutputStream stylesOutStream = + outputRepository.createOutputStream("styles.xml", "text/xml"); + final OutputStreamWriter osw = + new OutputStreamWriter(stylesOutStream, "UTF-8"); + final StylesWriter stylesWriter = new StylesWriter(osw); + stylesWriter.writeGlobalStyles(predefinedStylesCollection, globalStylesCollection); + stylesWriter.close(); + + this.rootXmlWriter.writeCloseTag(); + this.rootXmlWriter.close(); + } + catch (IOException e) + { + throw new ReportProcessingException(FAILED, e); + } + } + + public XmlWriter getXmlWriter() + { + final BufferState bufferState = (BufferState) xmlWriters.peek(); + return bufferState.getXmlWriter(); + } + + public OfficeStylesCollection getStylesCollection() + { + final BufferState bufferState = (BufferState) xmlWriters.peek(); + return bufferState.getStylesCollection(); + } + + public void startBuffering(final OfficeStylesCollection stylesCollection, + final boolean indent) throws ReportProcessingException + { + final XmlWriter currentWriter; + if (xmlWriters.isEmpty()) + { + currentWriter = rootXmlWriter; + } + else + { + final BufferState bufferState = (BufferState) xmlWriters.peek(); + currentWriter = bufferState.getXmlWriter(); + } + + try + { + final MemoryByteArrayOutputStream out = + new MemoryByteArrayOutputStream(INITIAL_BUFFER_SIZE, 256 * INITIAL_BUFFER_SIZE); + final DeflaterOutputStream deflateOut = new DeflaterOutputStream(out); + final OutputStreamWriter xmlBuffer = new OutputStreamWriter(deflateOut, "UTF-16"); + // final StringWriter xmlBuffer = new StringWriter + // (OfficeDocumentReportTarget.INITIAL_BUFFER_SIZE); + final XmlWriter contentXmlWriter = new XmlWriter(xmlBuffer, createTagDescription()); + contentXmlWriter.copyNamespaces(currentWriter); + if (indent) + { + contentXmlWriter.setAdditionalIndent(currentWriter.getCurrentIndentLevel()); + contentXmlWriter.setWriteFinalLinebreak(true); + } + else + { + contentXmlWriter.setWriteFinalLinebreak(false); + } + contentXmlWriter.setAlwaysAddNamespace(true); + xmlWriters.push(new BufferState(contentXmlWriter, out, stylesCollection)); + } + catch (IOException ioe) + { + throw new ReportProcessingException("Unable to create the buffer"); + } + } + + public BufferState finishBuffering() throws ReportProcessingException + { + final BufferState state = (BufferState) xmlWriters.pop(); + try + { + state.getXmlWriter().close(); + } + catch (IOException e) + { + LOGGER.error("ReportProcessing failed", e); + } + return state; + } + + public void commit() + throws ReportProcessingException + { + // do not call flush before the report is fully finished. Every flush + // causes the Office-Backend to fully ZIP all contents (it acts like a + // 'Save' call from the UI) and that's expensive like hell + } + + public NamespaceDefinition getNamespaceByUri(final String uri) + { + return null; + } + + protected AttributeList buildAttributeList(final AttributeMap attrs) + { + final AttributeList attrList = new AttributeList(); + final String[] namespaces = attrs.getNameSpaces(); + for (int i = 0; i < namespaces.length; i++) + { + final String attrNamespace = namespaces[i]; + if (isFilteredNamespace(attrNamespace)) + { + continue; + } + + final Map localAttributes = attrs.getAttributes(attrNamespace); + final Iterator entries = localAttributes.entrySet().iterator(); + while (entries.hasNext()) + { + final Map.Entry entry = (Map.Entry) entries.next(); + final String key = String.valueOf(entry.getKey()); + if (OfficeNamespaces.TABLE_NS.equals(attrNamespace) && + "name".equals(key)) + { + final String tableName = String.valueOf(entry.getValue()); + final String saneName = sanitizeName(tableName); + attrList.setAttribute(attrNamespace, key, + tableNameGenerator.generateName(saneName)); + } + else if (OfficeNamespaces.DRAWING_NS.equals(attrNamespace) && + "name".equals(key)) + { + final String objectName = String.valueOf(entry.getValue()); + attrList.setAttribute(attrNamespace, key, + frameNameGenerator.generateName(objectName)); + } + else + { + attrList.setAttribute(attrNamespace, key, String.valueOf(entry.getValue())); + } + } + } + return attrList; + } + + protected String sanitizeName(final String name) + { + // A table name cannot contain spaces and should only contain + // ascii-characters. + if (name == null) + { + return ""; + } + final char[] chars = name.toCharArray(); + final StringBuffer buffer = new StringBuffer(); + for (int i = 0; i < chars.length; i++) + { + final char aChar = chars[i]; + if (Character.isWhitespace(aChar)) + { + buffer.append('_'); + } + else + { + buffer.append(aChar); + } + } + return buffer.toString(); + } + + /** + * Returns the length in point. This method is f**king slow, it eats half of the processing time. I surely should + * replace it with something more efficient later. + * + * @param text + * @return + */ + protected CSSNumericValue parseLength(final String text) + { + if (styleSheetParserUtil == null) + { + styleSheetParserUtil = StyleSheetParserUtil.getInstance(); + } + + final LexicalUnit cssValue = styleSheetParserUtil.parseLexicalStyleValue( + text); + return CSSValueFactory.createLengthValue(cssValue); + } + + protected boolean isRepeatingSection() + { + return (currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER || + currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER || + currentRole == OfficeDocumentReportTarget.ROLE_PAGE_FOOTER || + currentRole == OfficeDocumentReportTarget.ROLE_PAGE_HEADER || + currentRole == OfficeDocumentReportTarget.ROLE_VARIABLES); + + } + + protected OfficeStyle deriveStyle(final String styleFamily, final String styleName) + throws ReportProcessingException + { + // autogenerate a style. The style has already been added to the current + // auto-collection. + final OfficeStyle style = StyleUtilities.deriveStyle(styleFamily, styleName, + getStylesCollection(), getGlobalStylesCollection(), + getPredefinedStylesCollection(), getAutoStyleNameGenerator()); + return style; + } + + protected void startImageProcessing(final AttributeMap attrs) + throws ReportProcessingException + { + final Object imageData = attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.IMAGE_DATA); + final boolean preserveIRI = OfficeToken.TRUE.equals(attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.PRESERVE_IRI)); + + // for the first shot, do nothing fancy .. + final ImageProducer.OfficeImage image = imageProducer.produceImage(imageData, preserveIRI); + if (image != null) + { + final ImageElementContext imageContext = (ImageElementContext) attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "image-context"); + + // When scaling, we have to create an image-style. + final CSSNumericValue width = image.getWidth(); // always in 100th of a mm + + final CSSNumericValue height = image.getHeight(); // always in 100th of a mm + + LOGGER.debug("Image " + imageData + " Width: " + width + ", Height: " + height); + if (width == null || height == null) + { + return; + } + + CSSNumericValue imageAreaWidthVal; + CSSNumericValue imageAreaHeightVal; + String styleName = null; + if (imageContext != null) + { + imageAreaWidthVal = computeImageWidth(imageContext); + imageAreaHeightVal = computeImageHeight(imageContext); + + if (imageAreaWidthVal == null || imageAreaHeightVal == null) + { + LOGGER.debug("Image data returned from context is invalid. Maybe this is not an image?"); + return; + } + else + { + // compute the clip-area .. + final CSSNumericValue normalizedImageWidth = + CSSValueResolverUtility.convertLength(width, imageAreaWidthVal.getType()); + 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 double clipWidth = normalizedImageWidth.getValue() - imageAreaWidthVal.getValue(); + final double clipHeight = normalizedImageHeight.getValue() - imageAreaHeightVal.getValue(); + if (clipWidth > 0 && clipHeight > 0) + { + final OfficeStyle imageStyle = deriveStyle(OfficeToken.GRAPHIC, OfficeToken.GRAPHICS); + final Element graphProperties = produceFirstChild(imageStyle, OfficeNamespaces.STYLE_NS, OfficeToken.GRAPHIC_PROPERTIES); + final StringBuffer buffer = new StringBuffer(); + buffer.append("rect("); + buffer.append(clipHeight / 2); + buffer.append(imageAreaHeightVal.getType().getType()); + buffer.append(' '); + buffer.append(clipWidth / 2); + buffer.append(imageAreaWidthVal.getType().getType()); + buffer.append(' '); + buffer.append(clipHeight / 2); + buffer.append(imageAreaHeightVal.getType().getType()); + buffer.append(' '); + buffer.append(clipWidth / 2); + buffer.append(imageAreaWidthVal.getType().getType()); + buffer.append(')'); + graphProperties.setAttribute(OfficeNamespaces.FO_NS, "clip", buffer.toString()); + + styleName = imageStyle.getStyleName(); + getStylesCollection().getAutomaticStyles().addStyle(imageStyle); + } + else if (clipWidth > 0) + { + final OfficeStyle imageStyle = deriveStyle(OfficeToken.GRAPHIC, OfficeToken.GRAPHICS); + final Element graphProperties = produceFirstChild(imageStyle, OfficeNamespaces.STYLE_NS, OfficeToken.GRAPHIC_PROPERTIES); + final StringBuffer buffer = new StringBuffer(); + buffer.append("rect(0cm "); + buffer.append(clipWidth / 2); + buffer.append(imageAreaWidthVal.getType().getType()); + buffer.append(" 0cm "); + buffer.append(clipWidth / 2); + buffer.append(imageAreaWidthVal.getType().getType()); + buffer.append(')'); + graphProperties.setAttribute(OfficeNamespaces.FO_NS, "clip", buffer.toString()); + + styleName = imageStyle.getStyleName(); + getStylesCollection().getAutomaticStyles().addStyle(imageStyle); + imageAreaHeightVal = normalizedImageHeight; + } + else if (clipHeight > 0) + { + final OfficeStyle imageStyle = deriveStyle(OfficeToken.GRAPHIC, OfficeToken.GRAPHICS); + final Element graphProperties = produceFirstChild(imageStyle, OfficeNamespaces.STYLE_NS, OfficeToken.GRAPHIC_PROPERTIES); + final StringBuffer buffer = new StringBuffer(); + buffer.append("rect("); + buffer.append(clipHeight / 2); + buffer.append(imageAreaHeightVal.getType().getType()); + buffer.append(" 0cm "); + buffer.append(clipHeight / 2); + buffer.append(imageAreaHeightVal.getType().getType()); + buffer.append(" 0cm)"); + graphProperties.setAttribute(OfficeNamespaces.FO_NS, "clip", buffer.toString()); + + styleName = imageStyle.getStyleName(); + getStylesCollection().getAutomaticStyles().addStyle(imageStyle); + imageAreaWidthVal = normalizedImageWidth; + } + else + { + imageAreaWidthVal = normalizedImageWidth; + imageAreaHeightVal = normalizedImageHeight; + } + } + } + // If we do scale, then we simply use the given image-area-size as valid image size and dont + // care about the image itself .. + } + else + { + LOGGER.debug("There is no image-context, so we have to rely on the image's natural bounds. " + + "This may go awfully wrong."); + imageAreaWidthVal = image.getWidth(); + imageAreaHeightVal = image.getHeight(); + } + + final AttributeList frameList = new AttributeList(); + frameList.setAttribute(OfficeNamespaces.DRAWING_NS, "name", imageNames.generateName("Image")); + if (styleName != null) + { + frameList.setAttribute(OfficeNamespaces.DRAWING_NS, OfficeToken.STYLE_NAME, styleName); + } + 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); + + LOGGER.debug("Image " + imageData + " A-Width: " + imageAreaWidthVal + ", A-Height: " + imageAreaHeightVal); + + if (imageAreaWidthVal != null) + { + frameList.setAttribute(OfficeNamespaces.SVG_NS, + "width", imageAreaWidthVal.getValue() + imageAreaWidthVal.getType().getType()); + } + + if (imageAreaHeightVal != null) + { + frameList.setAttribute(OfficeNamespaces.SVG_NS, + "height", imageAreaHeightVal.getValue() + imageAreaHeightVal.getType().getType()); + } + + + final AttributeList imageList = new AttributeList(); + imageList.setAttribute(OfficeNamespaces.XLINK_NS, "href", image.getEmbeddableLink()); + imageList.setAttribute(OfficeNamespaces.XLINK_NS, "type", "simple"); + imageList.setAttribute(OfficeNamespaces.XLINK_NS, "show", "embed"); + imageList.setAttribute(OfficeNamespaces.XLINK_NS, "actuate", "onLoad"); + + + try + { + getXmlWriter().writeTag(OfficeNamespaces.DRAWING_NS, "frame", frameList, XmlWriterSupport.OPEN); + getXmlWriter().writeTag(OfficeNamespaces.DRAWING_NS, OfficeToken.IMAGE, imageList, XmlWriterSupport.CLOSE); + getXmlWriter().writeCloseTag(); + } + catch (IOException ioe) + { + throw new ReportProcessingException(FAILED, ioe); + } + } + } + + private CSSNumericValue computeImageWidth(final ImageElementContext imageElementContext) + { + final LengthCalculator calculator = new LengthCalculator(); + final String[] strings = imageElementContext.getColStyles(); + for (int i = 0; i < strings.length; i++) + { + final String styleName = strings[i]; + final CSSNumericValue value = computeColumnWidth(styleName); + if (value != null) + { + calculator.add(value); + } + } + return calculator.getResult(); + } + + private CSSNumericValue computeImageHeight(final ImageElementContext imageElementContext) + { + final LengthCalculator calculator = new LengthCalculator(); + final String[] strings = imageElementContext.getRowStyles(); + for (int i = 0; i < strings.length; i++) + { + final String styleName = strings[i]; + final CSSNumericValue value = computeRowHeight(styleName); + if (value != null) + { + calculator.add(value); + } + } + return calculator.getResult(); + } + + protected CSSNumericValue computeRowHeight(final String rowStyle) + { + final OfficeStylesCollection contentStyles = getContentStylesCollection(); + final OfficeStyle style = contentStyles.getStyle(OfficeToken.TABLE_ROW, rowStyle); + if (style != null) + { + final Element element = style.getTableRowProperties(); + if (element != null) + { + final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "row-height"); + if (height != null) + { + return parseLength(height); + } + } + + final String styleParent = style.getStyleParent(); + if (styleParent != null) + { + return computeRowHeight(styleParent); + } + } + + final OfficeStylesCollection globalStyles = getGlobalStylesCollection(); + final OfficeStyle globalStyle = globalStyles.getStyle(OfficeToken.TABLE_ROW, rowStyle); + if (globalStyle != null) + { + final Element element = globalStyle.getTableRowProperties(); + if (element != null) + { + final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "row-height"); + if (height != null) + { + return parseLength(height); + } + } + final String styleParent = globalStyle.getStyleParent(); + if (styleParent != null) + { + return computeRowHeight(styleParent); + } + } + + final OfficeStylesCollection predefStyles = getPredefinedStylesCollection(); + final OfficeStyle predefStyle = predefStyles.getStyle(OfficeToken.TABLE_ROW, rowStyle); + if (predefStyle != null) + { + final Element element = predefStyle.getTableRowProperties(); + if (element != null) + { + final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "row-height"); + if (height != null) + { + return parseLength(height); + } + } + final String styleParent = predefStyle.getStyleParent(); + if (styleParent != null) + { + return computeRowHeight(styleParent); + } + } + // not found. + return null; + } + + protected CSSNumericValue computeColumnWidth(final String colStyle) + { + final OfficeStylesCollection contentStyles = getContentStylesCollection(); + final OfficeStyle style = contentStyles.getStyle(OfficeToken.TABLE_COLUMN, colStyle); + if (style != null) + { + final Element element = style.getTableColumnProperties(); + if (element != null) + { + final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "column-width"); + if (height != null) + { + return parseLength(height); + } + } + + final String styleParent = style.getStyleParent(); + if (styleParent != null) + { + return computeRowHeight(styleParent); + } + } + + final OfficeStylesCollection globalStyles = getGlobalStylesCollection(); + final OfficeStyle globalStyle = globalStyles.getStyle(OfficeToken.TABLE_COLUMN, colStyle); + if (globalStyle != null) + { + final Element element = globalStyle.getTableColumnProperties(); + if (element != null) + { + final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "column-width"); + if (height != null) + { + return parseLength(height); + } + } + final String styleParent = globalStyle.getStyleParent(); + if (styleParent != null) + { + return computeRowHeight(styleParent); + } + } + + final OfficeStylesCollection predefStyles = getPredefinedStylesCollection(); + final OfficeStyle predefStyle = predefStyles.getStyle(OfficeToken.TABLE_COLUMN, colStyle); + if (predefStyle != null) + { + final Element element = predefStyle.getTableColumnProperties(); + if (element != null) + { + final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "column-width"); + if (height != null) + { + return parseLength(height); + } + } + final String styleParent = predefStyle.getStyleParent(); + if (styleParent != null) + { + return computeRowHeight(styleParent); + } + } + // not found. + return null; + } + + protected Element produceFirstChild(final Section style, + final String nameSpace, + final String type) + { + Element paragraphProps = style.findFirstChild(nameSpace, type); + if (paragraphProps == null) + { + paragraphProps = new Section(); + paragraphProps.setNamespace(nameSpace); + paragraphProps.setType(type); + style.addNode(paragraphProps); + } + return paragraphProps; + } + + protected void startChartProcessing(final AttributeMap attrs) + throws ReportProcessingException + { + final String classId = (String) attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "class-id"); + final String chartUrl = (String) attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "href"); + final ArrayList masterColumns = (ArrayList) attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, SDBCReportDataFactory.MASTER_COLUMNS); + final ArrayList masterValues = (ArrayList) attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, SDBCReportDataFactory.MASTER_VALUES); + final ArrayList detailColumns = (ArrayList) attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, SDBCReportDataFactory.DETAIL_COLUMNS); + final String href = oleProducer.produceOle(chartUrl, masterColumns, masterValues, detailColumns); + + final AttributeList oleList = new AttributeList(); + oleList.setAttribute(OfficeNamespaces.DRAWING_NS, "class-id", classId); + oleList.setAttribute(OfficeNamespaces.XLINK_NS, "href", "./" + href); + oleList.setAttribute(OfficeNamespaces.XLINK_NS, "type", "simple"); + oleList.setAttribute(OfficeNamespaces.XLINK_NS, "show", "embed"); + oleList.setAttribute(OfficeNamespaces.XLINK_NS, "actuate", "onLoad"); + + try + { + getXmlWriter().writeTag(OfficeNamespaces.DRAWING_NS, OfficeToken.OBJECT_OLE, oleList, XmlWriterSupport.CLOSE); + } + catch (IOException ioe) + { + throw new ReportProcessingException(FAILED, ioe); + } + + + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java b/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java new file mode 100644 index 000000000000..cc4b466fae31 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java @@ -0,0 +1,121 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OleProducer.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.output; + +import com.sun.star.report.DataSourceFactory; +import com.sun.star.report.ImageService; +import com.sun.star.report.InputRepository; +import com.sun.star.report.JobProperties; +import com.sun.star.report.OutputRepository; +import com.sun.star.report.ReportEngineParameterNames; +import com.sun.star.report.ReportExecutionException; +import com.sun.star.report.ReportJobDefinition; +import com.sun.star.report.pentaho.DefaultNameGenerator; +import com.sun.star.report.pentaho.PentahoReportEngine; +import com.sun.star.report.pentaho.PentahoReportEngineMetaData; +import java.io.IOException; +import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Ocke Janssen + */ +public class OleProducer { + + private static final Log LOGGER = LogFactory.getLog(OleProducer.class); + private final InputRepository inputRepository; + private final OutputRepository outputRepository; + private final DefaultNameGenerator nameGenerator; + private final DataSourceFactory dataSourceFactory; + private final ImageService imageService; + + + public OleProducer(final InputRepository inputRepository, + final OutputRepository outputRepository,final ImageService imageService,final DataSourceFactory dataSourceFactory) { + if (inputRepository == null) { + throw new NullPointerException(); + } + if (outputRepository == null) { + throw new NullPointerException(); + } + + this.inputRepository = inputRepository; + this.outputRepository = outputRepository; + this.nameGenerator = new DefaultNameGenerator(outputRepository); + this.dataSourceFactory = dataSourceFactory; + this.imageService = imageService; + } + + String produceOle(final String source,final List masterColumns,final List masterValues,final List detailColumns) { + InputRepository subInputRepository = null; + OutputRepository subOutputRepository = null; + String output = ""; + try { + subInputRepository = inputRepository.openInputRepository(source); + output = nameGenerator.generateStorageName("Object", null); + subOutputRepository = outputRepository.openOutputRepository(output, PentahoReportEngineMetaData.OPENDOCUMENT_CHART); + try { + + final PentahoReportEngine engine = new PentahoReportEngine(); + final ReportJobDefinition definition = engine.createJobDefinition(); + final JobProperties procParms = definition.getProcessingParameters(); + + procParms.setProperty(ReportEngineParameterNames.INPUT_REPOSITORY, subInputRepository); + procParms.setProperty(ReportEngineParameterNames.OUTPUT_REPOSITORY, subOutputRepository); + procParms.setProperty(ReportEngineParameterNames.INPUT_NAME, "content.xml"); + procParms.setProperty(ReportEngineParameterNames.OUTPUT_NAME, "content.xml"); + procParms.setProperty(ReportEngineParameterNames.CONTENT_TYPE, PentahoReportEngineMetaData.OPENDOCUMENT_CHART); + procParms.setProperty(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY, dataSourceFactory); + procParms.setProperty(ReportEngineParameterNames.INPUT_MASTER_COLUMNS, masterColumns); + procParms.setProperty(ReportEngineParameterNames.INPUT_MASTER_VALUES, masterValues); + procParms.setProperty(ReportEngineParameterNames.INPUT_DETAIL_COLUMNS, detailColumns); + procParms.setProperty(ReportEngineParameterNames.IMAGE_SERVICE, imageService); + + engine.createJob(definition).execute(); + } catch (ReportExecutionException ex) { + LOGGER.error("ReportProcessing failed", ex); + } catch (IOException ex) { + LOGGER.error("ReportProcessing failed", ex); + } + } catch (IOException ex) { + LOGGER.error("ReportProcessing failed", ex); + } finally { + if (subInputRepository != null) { + subInputRepository.closeInputRepository(); + } + if (subOutputRepository != null) { + subOutputRepository.closeOutputRepository(); + } + } + return output; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java b/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java new file mode 100644 index 000000000000..948e140f76ff --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java @@ -0,0 +1,611 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StyleUtilities.java,v $ + * $Revision: 1.9 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.output; + +import java.util.HashSet; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.DataStyle; +import com.sun.star.report.pentaho.model.FontFaceDeclsSection; +import com.sun.star.report.pentaho.model.FontFaceElement; +import com.sun.star.report.pentaho.model.OfficeStyle; +import com.sun.star.report.pentaho.model.OfficeStyles; +import com.sun.star.report.pentaho.model.OfficeStylesCollection; +import java.util.ArrayList; +import java.util.Set; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; +import org.jfree.report.util.AttributeNameGenerator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class StyleUtilities +{ + private static final Log LOGGER = LogFactory.getLog(StyleUtilities.class); + private static final String STYLE = "style"; + + private StyleUtilities() + { + } + + /** + * Copies the specififed style (keyed by its family and name) into the current styles collection. This copies the + * style and all inherited styles into the target collection. Inherited common styles will be always be added to the + * common collection (which will be written into the 'styles.xml' later). + *

+ * This method does nothing if the specified style already exists in the styles collection. + * + * @param styleFamily the family of the style to copy + * @param styleName the unique name of the style. + * @param stylesCollection the current styles collection + * @param commonCollection the global styles collection + * @param predefCollection the predefined styles from where to copy the styles. + * @throws ReportProcessingException if the style copying failed. + */ + public static void copyStyle(final String styleFamily, + final String styleName, + final OfficeStylesCollection stylesCollection, + final OfficeStylesCollection commonCollection, + final OfficeStylesCollection predefCollection) + throws ReportProcessingException + { + copyStyle(styleFamily, styleName, stylesCollection, + commonCollection, predefCollection, new HashSet()); + } + + /** + * Copies the specififed style (keyed by its family and name) into the current styles collection. This copies the + * style and all inherited styles into the target collection. Inherited common styles will be always be added to the + * common collection (which will be written into the 'styles.xml' later). + *

+ * This method does nothing if the specified style already exists in the styles collection. + * + * @param styleFamily the family of the style to copy + * @param styleName the unique name of the style. + * @param stylesCollection the current styles collection + * @param commonCollection the global styles collection + * @param predefCollection the predefined styles from where to copy the styles. + * @param inheritanceTracker a collection of all styles that have been touched. This is used to prevent infinite + * loops and duplicates. + * @throws ReportProcessingException if the style copying failed. + */ + private static void copyStyle(final String styleFamily, + final String styleName, + final OfficeStylesCollection stylesCollection, + final OfficeStylesCollection commonCollection, + final OfficeStylesCollection predefCollection, + final Set inheritanceTracker) + throws ReportProcessingException + { + if (inheritanceTracker.contains(styleName)) + { + return; + } + inheritanceTracker.add(styleName); + + if (stylesCollection.containsStyle(styleFamily, styleName) || + commonCollection.getCommonStyles().containsStyle(styleFamily, styleName)) + { + // fine, there's already a copy of the stylesheet. + return; + } + + final OfficeStyle predefCommonStyle = + predefCollection.getCommonStyles().getStyle(styleFamily, styleName); + if (predefCommonStyle != null) + { + // so we have an style from the predefined collection. + // copy it an add it to the current stylescollection + final OfficeStyles commonStyles = commonCollection.getCommonStyles(); + + copyStyleInternal(predefCommonStyle, commonStyles, stylesCollection, + commonCollection, predefCollection, styleFamily, inheritanceTracker); + return; + } + + final OfficeStyle predefAutoStyle = + predefCollection.getAutomaticStyles().getStyle(styleFamily, styleName); + if (predefAutoStyle != null) + { + // so we have an style from the predefined collection. + // copy it an add it to the current stylescollection + final OfficeStyles autoStyles = stylesCollection.getAutomaticStyles(); + copyStyleInternal(predefAutoStyle, autoStyles, stylesCollection, + commonCollection, predefCollection, styleFamily, inheritanceTracker); + return; + } + + // There is no automatic style either. Now this means that someone + // messed up the fileformat. Lets create a new empty style for this. + final OfficeStyle autostyle = new OfficeStyle(); + autostyle.setNamespace(OfficeNamespaces.STYLE_NS); + autostyle.setType(STYLE); + autostyle.setStyleFamily(styleFamily); + autostyle.setStyleName(styleName); + + final OfficeStyles autoStyles = stylesCollection.getAutomaticStyles(); + autoStyles.addStyle(autostyle); + } + + private static OfficeStyle copyStyleInternal( + final OfficeStyle predefCommonStyle, + final OfficeStyles styles, + final OfficeStylesCollection stylesCollection, + final OfficeStylesCollection commonCollection, + final OfficeStylesCollection predefCollection, + final String styleFamily, + final Set inheritanceTracker) + throws ReportProcessingException + { + try + { + final OfficeStyle preStyle = (OfficeStyle) predefCommonStyle.clone(); + styles.addStyle(preStyle); + performFontFaceProcessing(preStyle, stylesCollection, predefCollection); + performDataStyleProcessing(preStyle, stylesCollection, predefCollection); + + // Lookup the parent style .. + final String styleParent = preStyle.getStyleParent(); + final OfficeStyle inherited = + stylesCollection.getStyle(styleFamily, styleParent); + if (inherited != null) + { + // OK, recurse (and hope that we dont run into an infinite loop) .. + copyStyle(styleFamily, styleParent, stylesCollection, + commonCollection, predefCollection, inheritanceTracker); + } + else if (styleParent != null) + { + LOGGER.warn("Inconsistent styles: " + styleFamily + ":" + styleParent + " does not exist."); + } + return preStyle; + } catch (CloneNotSupportedException e) + { + throw new ReportProcessingException("Failed to derive a stylesheet", e); + } + } + + private static void performFontFaceProcessing(final OfficeStyle style, + final OfficeStylesCollection stylesCollection, + final OfficeStylesCollection predefCollection) + throws ReportProcessingException + { + final Element textProperties = style.getTextProperties(); + if (textProperties == null) + { + return; + } + + try + { + final FontFaceDeclsSection currentFonts = stylesCollection.getFontFaceDecls(); + final FontFaceDeclsSection predefFonts = predefCollection.getFontFaceDecls(); + + final String fontName = (String) textProperties.getAttribute(OfficeNamespaces.STYLE_NS, "font-name"); + if (fontName != null && !currentFonts.containsFont(fontName)) + { + final FontFaceElement element = predefFonts.getFontFace(fontName); + if (element != null) + { + currentFonts.addFontFace((FontFaceElement) element.clone()); + } + } + + final String fontNameAsian = (String) textProperties.getAttribute(OfficeNamespaces.STYLE_NS, + "font-name-asian"); + if (fontNameAsian != null && !currentFonts.containsFont(fontNameAsian)) + { + final FontFaceElement element = predefFonts.getFontFace( + fontNameAsian); + if (element != null) + { + currentFonts.addFontFace((FontFaceElement) element.clone()); + } + } + + final String fontNameComplex = (String) textProperties.getAttribute(OfficeNamespaces.STYLE_NS, + "font-name-complex"); + if (fontNameComplex != null && !currentFonts.containsFont(fontNameComplex)) + { + final FontFaceElement element = predefFonts.getFontFace( + fontNameComplex); + if (element != null) + { + currentFonts.addFontFace((FontFaceElement) element.clone()); + } + } + } catch (CloneNotSupportedException e) + { + throw new ReportProcessingException("Failed to clone font-face element"); + } + } + + private static void performDataStyleProcessing(final OfficeStyle style, + final OfficeStylesCollection stylesCollection, + final OfficeStylesCollection predefCollection) + throws ReportProcessingException + { + final Section derivedStyle = performDataStyleProcessing(style, stylesCollection, predefCollection, "data-style-name"); + if (derivedStyle != null) + { + try + { + final Section styleMap = (Section) derivedStyle.findFirstChild(OfficeNamespaces.STYLE_NS,"map"); + if (styleMap != null) + { + performDataStyleProcessing(styleMap, stylesCollection, predefCollection, "apply-style-name"); + } + } catch (Exception e) + { + } + } + } + + private static Section performDataStyleProcessing(final Section style, + final OfficeStylesCollection stylesCollection, + final OfficeStylesCollection predefCollection, + final String attributeName) + throws ReportProcessingException + { + final Object attribute = style.getAttribute(OfficeNamespaces.STYLE_NS, attributeName); + final DataStyle derivedStyle; + if (attribute != null) + { + final String styleName = String.valueOf(attribute); + if (!stylesCollection.getAutomaticStyles().containsDataStyle(styleName) && + !stylesCollection.getCommonStyles().containsDataStyle(styleName)) + { + try + { + final OfficeStyles automaticStyles = predefCollection.getAutomaticStyles(); + final DataStyle autoDataStyle = automaticStyles.getDataStyle(styleName); + if (autoDataStyle != null) + { + derivedStyle = (DataStyle) autoDataStyle.clone(); + stylesCollection.getAutomaticStyles().addDataStyle(derivedStyle); + } + else + { + final OfficeStyles commonStyles = predefCollection.getCommonStyles(); + final DataStyle commonDataStyle = commonStyles.getDataStyle(styleName); + if (commonDataStyle != null) + { + derivedStyle = (DataStyle) commonDataStyle.clone(); + stylesCollection.getCommonStyles().addDataStyle(derivedStyle); + } + else + { + LOGGER.warn("Dangling data style: " + styleName); + derivedStyle = null; + } + } + } catch (CloneNotSupportedException e) + { + throw new ReportProcessingException("Failed to copy style. This should not have happened."); + } + } + else + { + derivedStyle = null; + } + } + else + { + derivedStyle = null; + } + return derivedStyle; + } + + /** + * Derives the named style. If the style is a common style, a new automatic style is generated and inserted into the + * given stylesCollection. If the named style is an automatic style, the style is copied and inserted as new automatic + * style. + *

+ * After the style has been created, the style's inheritance hierarchy will be copied as well. + *

+ * If there is no style with the given name and family, a new empty automatic style will be created. + * + * @param styleFamily the family of the style to copy + * @param styleName the unique name of the style. + * @param stylesCollection the current styles collection + * @param commonCollection the global styles collection + * @param predefCollection the predefined styles from where to copy the styles. + * @param generator the style-name-generator of the current report-target + * @return the derived style instance. + * @throws ReportProcessingException if the style copying failed. + */ + public static OfficeStyle deriveStyle(final String styleFamily, + final String styleName, + final OfficeStylesCollection stylesCollection, + final OfficeStylesCollection commonCollection, + final OfficeStylesCollection predefCollection, + final AttributeNameGenerator generator) + throws ReportProcessingException + { + if (styleFamily == null) + { + throw new NullPointerException("StyleFamily must not be null"); + } + if (styleName != null) + { + + final OfficeStyle currentAuto = + stylesCollection.getAutomaticStyles().getStyle(styleFamily, + styleName); + if (currentAuto != null) + { + // handle an automatic style .. + final OfficeStyle derivedStyle = + deriveAutomaticStyle(currentAuto, styleFamily, styleName, + generator, commonCollection, predefCollection); + stylesCollection.getAutomaticStyles().addStyle(derivedStyle); + return derivedStyle; + } + + final OfficeStyle currentCommon = + stylesCollection.getCommonStyles().getStyle(styleFamily, styleName); + if (currentCommon != null) + { + // handle an common style .. + final OfficeStyle derivedStyle = + deriveCommonStyle(currentCommon, styleFamily, styleName, + generator, commonCollection, predefCollection); + stylesCollection.getAutomaticStyles().addStyle(derivedStyle); + return derivedStyle; + } + +// final OfficeStyle commonAuto = +// commonCollection.getAutomaticStyles().getStyle(styleFamily, +// styleName); +// if (commonAuto != null) +// { +// // handle an automatic style .. +// final OfficeStyle derivedStyle = +// deriveAutomaticStyle(commonAuto, styleFamily, styleName, +// generator, commonCollection, predefCollection); +// stylesCollection.getAutomaticStyles().addStyle(derivedStyle); +// return derivedStyle; +// } + + final OfficeStyle commonCommon = + commonCollection.getCommonStyles().getStyle(styleFamily, styleName); + if (commonCommon != null) + { + // handle an common style .. + final OfficeStyle derivedStyle = + deriveCommonStyle(commonCommon, styleFamily, styleName, + generator, commonCollection, predefCollection); + stylesCollection.getAutomaticStyles().addStyle(derivedStyle); + return derivedStyle; + } + + final OfficeStyle predefAuto = + predefCollection.getAutomaticStyles().getStyle(styleFamily, + styleName); + if (predefAuto != null) + { + // handle an automatic style .. + final OfficeStyle derivedStyle = + deriveAutomaticStyle(predefAuto, styleFamily, styleName, + generator, commonCollection, predefCollection); + stylesCollection.getAutomaticStyles().addStyle(derivedStyle); + return derivedStyle; + } + + final OfficeStyle predefCommon = + predefCollection.getCommonStyles().getStyle(styleFamily, styleName); + if (predefCommon != null) + { + // handle an common style .. + final OfficeStyle derivedStyle = + deriveCommonStyle(predefCommon, styleFamily, styleName, + generator, commonCollection, predefCollection); + stylesCollection.getAutomaticStyles().addStyle(derivedStyle); + return derivedStyle; + } + } + + // No such style. Create a new one .. + final OfficeStyle autostyle = new OfficeStyle(); + autostyle.setNamespace(OfficeNamespaces.STYLE_NS); + autostyle.setType(STYLE); + autostyle.setStyleFamily(styleFamily); + if (styleName != null) + { + autostyle.setStyleName(styleName); + } + else + { + autostyle.setStyleName(generator.generateName("derived_anonymous")); + } + + final OfficeStyles autoStyles = stylesCollection.getAutomaticStyles(); + autoStyles.addStyle(autostyle); + return autostyle; + } + + private static OfficeStyle deriveCommonStyle(final OfficeStyle commonStyle, + final String styleFamily, + final String styleName, + final AttributeNameGenerator nameGenerator, + final OfficeStylesCollection commonCollection, + final OfficeStylesCollection predefCollection) + throws ReportProcessingException + { + final OfficeStyle autostyle = new OfficeStyle(); + autostyle.setNamespace(OfficeNamespaces.STYLE_NS); + autostyle.setType(STYLE); + autostyle.setStyleFamily(styleFamily); + autostyle.setStyleName(nameGenerator.generateName("derived_" + styleName)); + autostyle.setStyleParent(styleName); + + // now copy the common style .. + final OfficeStyles commonStyles = commonCollection.getCommonStyles(); + if (!commonStyles.containsStyle(styleFamily, styleName)) + { + copyStyleInternal(commonStyle, commonStyles, + commonCollection, commonCollection, predefCollection, + styleFamily, new HashSet()); + } + return autostyle; + } + + private static OfficeStyle deriveAutomaticStyle(final OfficeStyle commonStyle, + final String styleFamily, + final String styleName, + final AttributeNameGenerator nameGenerator, + final OfficeStylesCollection commonCollection, + final OfficeStylesCollection predefCollection) + throws ReportProcessingException + { + try + { + final OfficeStyle autostyle = (OfficeStyle) commonStyle.clone(); + autostyle.setNamespace(OfficeNamespaces.STYLE_NS); + autostyle.setType(STYLE); + autostyle.setStyleFamily(styleFamily); + autostyle.setStyleName(nameGenerator.generateName("derived_auto_" + styleName)); + + + final String parent = autostyle.getStyleParent(); + if (parent != null) + { + copyStyle(styleFamily, parent, commonCollection, commonCollection, + predefCollection); + } + return autostyle; + } catch (CloneNotSupportedException e) + { + throw new ReportProcessingException( + "Deriving the style failed. Clone error: ", e); + } + } + + public static String queryStyle(final OfficeStylesCollection predefCollection, + final String styleFamily, + final String styleName, + final String sectionName, + final String propertyNamespace, + final String propertyName) + { + return queryStyle(predefCollection, styleFamily, + styleName, sectionName, propertyNamespace, propertyName, new HashSet()); + } + + public static OfficeStyle queryStyleByProperties(final OfficeStylesCollection predefCollection, + final String styleFamily, + final String sectionName, + final ArrayList propertyNamespace, + final ArrayList propertyName, + final ArrayList propertyValues) + { + if (propertyNamespace.size() != propertyName.size()) + { + return null; + } + final OfficeStyle[] styles = predefCollection.getAutomaticStyles().getAllStyles(); + for (int i = 0; i < styles.length; i++) + { + final OfficeStyle officeStyle = styles[i]; + if (officeStyle.getStyleFamily().equals(styleFamily)) + { + final Element section = officeStyle.findFirstChild(OfficeNamespaces.STYLE_NS, sectionName); + if (section != null) + { + int j = 0; + for (; j < propertyNamespace.size(); j++) + { + final String ns = (String) propertyNamespace.get(j); + final String prop = (String) propertyName.get(j); + final Object obj = section.getAttribute(ns, prop); + final Object value = propertyValues.get(j); + if (obj == null || value == null) + { + continue; + } + if (!propertyValues.get(j).equals(obj)) + { + break; + } + } + if (j == propertyName.size()) + { + return officeStyle; + } + } + } + } + return null; + } + + private static String queryStyle(final OfficeStylesCollection predefCollection, + final String styleFamily, + final String styleName, + final String sectionName, + final String propertyNamespace, + final String propertyName, + final Set seenStyles) + { + if (seenStyles.contains(styleName)) + { + return null; + } + seenStyles.add(styleName); + + final OfficeStyle style = predefCollection.getStyle(styleFamily, styleName); + if (style == null) + { + return null; // no such style + + } + final Element section = style.findFirstChild(OfficeNamespaces.STYLE_NS, sectionName); + if (section != null) + { + final Object attribute = section.getAttribute(propertyNamespace, propertyName); + if (attribute != null) + { + return String.valueOf(attribute); + } + } + final String parent = style.getStyleParent(); + if (parent == null) + { + return null; + } + return queryStyle(predefCollection, styleFamily, parent, sectionName, propertyNamespace, propertyName, seenStyles); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java new file mode 100644 index 000000000000..4300d44defd3 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java @@ -0,0 +1,374 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StylesWriter.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.output; + +import java.io.IOException; +import java.io.Writer; +import java.util.Iterator; +import java.util.Map; +import java.util.TreeMap; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.FontFaceDeclsSection; +import com.sun.star.report.pentaho.model.FontFaceElement; +import com.sun.star.report.pentaho.model.OfficeStyle; +import com.sun.star.report.pentaho.model.OfficeStyles; +import com.sun.star.report.pentaho.model.OfficeStylesCollection; +import com.sun.star.report.pentaho.model.OfficeMasterStyles; +import com.sun.star.report.pentaho.model.OfficeMasterPage; +import com.sun.star.report.pentaho.model.DataStyle; +import com.sun.star.report.pentaho.model.PageLayout; +import com.sun.star.report.pentaho.model.RawText; +import org.jfree.layouting.namespace.Namespaces; +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.JFreeReportBoot; +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Node; +import org.jfree.report.structure.Section; +import org.jfree.report.structure.StaticText; +import org.pentaho.reporting.libraries.xmlns.common.AttributeList; +import org.pentaho.reporting.libraries.xmlns.writer.DefaultTagDescription; +import org.pentaho.reporting.libraries.xmlns.writer.XmlWriter; +import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport; + +/** + * This class writes the style collection into a 'styles.xml' document. + * + * @author Thomas Morgner + * @since 09.03.2007 + */ +public class StylesWriter +{ + private final XmlWriter xmlWriter; + private final boolean writeOpeningTag; + + public StylesWriter(final Writer writer) + { + final DefaultTagDescription tagDescription = new DefaultTagDescription(); + tagDescription.configure (JFreeReportBoot.getInstance().getGlobalConfig(), + OfficeDocumentReportTarget.TAG_DEF_PREFIX); + + this.xmlWriter = new XmlWriter(writer, tagDescription); + this.xmlWriter.setAlwaysAddNamespace(true); + this.writeOpeningTag = true; + } + + public StylesWriter(final XmlWriter xmlWriter) + { + this.xmlWriter = xmlWriter; + this.writeOpeningTag = false; + } + + public void writeContentStyles (final OfficeStylesCollection predefined, + final OfficeStylesCollection globals) + throws IOException, ReportProcessingException + { + writeFontFaces(new OfficeStylesCollection[] { globals }); + writeAutomaticStylesSection(new OfficeStylesCollection[] { globals }); + } + + public void writeGlobalStyles (final OfficeStylesCollection predefined, + final OfficeStylesCollection globals) + throws IOException, ReportProcessingException + { + if (writeOpeningTag) + { + performWriteRootTag(); + } + + writeFontFaces(new OfficeStylesCollection[] { globals }); + writeAutomaticStylesSection(new OfficeStylesCollection[] { globals }); + writeCommonStylesSection(new OfficeStylesCollection[] { globals }); + writeMasterStylesSection(new OfficeStylesCollection[] { globals }); + + if (writeOpeningTag) + { + xmlWriter.writeCloseTag(); + } + } + + private void writeMasterStylesSection(final OfficeStylesCollection[] osc) + throws IOException + { + xmlWriter.writeTag + (OfficeNamespaces.OFFICE_NS, "master-styles", XmlWriterSupport.OPEN); + for (int sci = 0; sci < osc.length; sci++) + { + final OfficeStylesCollection collection = osc[sci]; + final OfficeMasterStyles officeStyles = collection.getMasterStyles(); + final OfficeMasterPage[] officeMasterPages = officeStyles.getAllMasterPages(); + for (int i = 0; i < officeMasterPages.length; i++) + { + final OfficeMasterPage masterPage = officeMasterPages[i]; + writeSection(masterPage); + } + + writeSectionChilds(officeStyles.getOtherNodes().getNodeArray()); + } + + xmlWriter.writeCloseTag(); + } + + private void writeCommonStylesSection(final OfficeStylesCollection[] osc) + throws IOException + { + xmlWriter.writeTag + (OfficeNamespaces.OFFICE_NS, "styles", XmlWriterSupport.OPEN); + + for (int sci = 0; sci < osc.length; sci++) + { + final OfficeStylesCollection collection = osc[sci]; + final OfficeStyles officeStyles = collection.getCommonStyles(); + writeStyles(officeStyles); + } + + xmlWriter.writeCloseTag(); + } + + private void writeAutomaticStylesSection(final OfficeStylesCollection[] osc) + throws IOException + { + xmlWriter.writeTag + (OfficeNamespaces.OFFICE_NS, "automatic-styles", XmlWriterSupport.OPEN); + for (int sci = 0; sci < osc.length; sci++) + { + final OfficeStylesCollection collection = osc[sci]; + final OfficeStyles officeStyles = collection.getAutomaticStyles(); + writeStyles(officeStyles); + } + + xmlWriter.writeCloseTag(); + } + + private void writeFontFaces(final OfficeStylesCollection[] osc) + throws IOException + { + xmlWriter.writeTag + (OfficeNamespaces.OFFICE_NS, "font-face-decls", XmlWriterSupport.OPEN); + + final TreeMap fontFaces = new TreeMap(); + for (int sci = 0; sci < osc.length; sci++) + { + final OfficeStylesCollection collection = osc[sci]; + final FontFaceDeclsSection fontFaceDecls = collection.getFontFaceDecls(); + final FontFaceElement[] fontFaceElements = fontFaceDecls.getAllFontFaces(); + for (int i = 0; i < fontFaceElements.length; i++) + { + final FontFaceElement element = fontFaceElements[i]; + fontFaces.put (element.getStyleName(), element); + } + } + + final Iterator values = fontFaces.values().iterator(); + while (values.hasNext()) + { + final FontFaceElement element = (FontFaceElement) values.next(); + writeElement(element); + } + + xmlWriter.writeCloseTag(); + } + + private void writeStyles (final OfficeStyles styles) + throws IOException + { + final OfficeStyle[] allStyles = styles.getAllStyles(); + for (int i = 0; i < allStyles.length; i++) + { + final OfficeStyle style = allStyles[i]; + writeSection(style); + } + + final DataStyle[] allDataStyles = styles.getAllDataStyles(); + for (int i = 0; i < allDataStyles.length; i++) + { + final DataStyle style = allDataStyles[i]; + writeSection(style); + } + + final PageLayout[] allPageStyles = styles.getAllPageStyles(); + for (int i = 0; i < allPageStyles.length; i++) + { + final PageLayout style = allPageStyles[i]; + writeSection(style); + } + + writeSectionChilds(styles.getOtherStyles()); + } + + private void writeElement (final Element element) + throws IOException + { + final String type = element.getType(); + final String namespace = element.getNamespace(); + final AttributeList attrList = buildAttributeList(element.getAttributeMap()); + xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.CLOSE); + } + + private void writeSection (final Section section) + throws IOException + { + final String type = section.getType(); + final String namespace = section.getNamespace(); + final AttributeList attrList = buildAttributeList(section.getAttributeMap()); + if (section.getNodeCount() == 0) + { + xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.CLOSE); + return; + } + + xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.OPEN); + writeSectionChilds(section.getNodeArray()); + + xmlWriter.writeCloseTag(); + } + + private void writeSectionChilds(final Node[] nodes) + throws IOException + { + for (int i = 0; i < nodes.length; i++) + { + final Node node = nodes[i]; + if (node instanceof Section) + { + writeSection((Section) node); + } + else if (node instanceof Element) + { + writeElement((Element) node); + } + else if (node instanceof RawText) + { + final RawText text = (RawText) node; + xmlWriter.writeText(text.getText()); + } + else if (node instanceof StaticText) + { + final StaticText text = (StaticText) node; + xmlWriter.writeTextNormalized(text.getText(), false); + } + } + } + + protected AttributeList buildAttributeList(final AttributeMap attrs) + { + final AttributeList attrList = new AttributeList(); + final String[] namespaces = attrs.getNameSpaces(); + for (int i = 0; i < namespaces.length; i++) + { + final String attrNamespace = namespaces[i]; + if (isFilteredNamespace(attrNamespace)) + { + continue; + } + + final Map localAttributes = attrs.getAttributes(attrNamespace); + final Iterator entries = localAttributes.entrySet().iterator(); + while (entries.hasNext()) + { + final Map.Entry entry = (Map.Entry) entries.next(); + final String key = String.valueOf(entry.getKey()); + attrList.setAttribute(attrNamespace, key, String.valueOf(entry.getValue())); + } + } + return attrList; + } + + protected boolean isFilteredNamespace(final String namespace) + { + if (Namespaces.LIBLAYOUT_NAMESPACE.equals(namespace)) + { + return true; + } + if (JFreeReportInfo.REPORT_NAMESPACE.equals(namespace)) + { + return true; + } + if (JFreeReportInfo.COMPATIBILITY_NAMESPACE.equals(namespace)) + { + return true; + } + if (OfficeNamespaces.OOREPORT_NS.equals(namespace)) + { + return true; + } + return false; + } + + private void performWriteRootTag() + throws IOException + { + final AttributeList rootAttributes = new AttributeList(); + rootAttributes.addNamespaceDeclaration("office", + OfficeNamespaces.OFFICE_NS); + rootAttributes.addNamespaceDeclaration("style", OfficeNamespaces.STYLE_NS); + rootAttributes.addNamespaceDeclaration("text", OfficeNamespaces.TEXT_NS); + rootAttributes.addNamespaceDeclaration("table", OfficeNamespaces.TABLE_NS); + rootAttributes.addNamespaceDeclaration("draw", OfficeNamespaces.DRAWING_NS); + rootAttributes.addNamespaceDeclaration("fo", OfficeNamespaces.FO_NS); + rootAttributes.addNamespaceDeclaration("xlink", OfficeNamespaces.XLINK_NS); + rootAttributes.addNamespaceDeclaration("dc", OfficeNamespaces.PURL_NS); + rootAttributes.addNamespaceDeclaration("meta", OfficeNamespaces.META_NS); + rootAttributes.addNamespaceDeclaration("number", + OfficeNamespaces.DATASTYLE_NS); + rootAttributes.addNamespaceDeclaration("svg", OfficeNamespaces.SVG_NS); + rootAttributes.addNamespaceDeclaration("chart", OfficeNamespaces.CHART_NS); + rootAttributes.addNamespaceDeclaration("dr3d", OfficeNamespaces.DR3D_NS); + rootAttributes.addNamespaceDeclaration("math", OfficeNamespaces.MATHML_NS); + rootAttributes.addNamespaceDeclaration("form", OfficeNamespaces.FORM_NS); + rootAttributes.addNamespaceDeclaration("script", + OfficeNamespaces.SCRIPT_NS); + rootAttributes.addNamespaceDeclaration("ooo", OfficeNamespaces.OO2004_NS); + rootAttributes.addNamespaceDeclaration("ooow", OfficeNamespaces.OOW2004_NS); + rootAttributes.addNamespaceDeclaration("oooc", OfficeNamespaces.OOC2004_NS); + rootAttributes.addNamespaceDeclaration("dom", + OfficeNamespaces.XML_EVENT_NS); + rootAttributes.addNamespaceDeclaration("xforms", + OfficeNamespaces.XFORMS_NS); + rootAttributes.addNamespaceDeclaration("xsd", OfficeNamespaces.XSD_NS); + rootAttributes.addNamespaceDeclaration("xsi", OfficeNamespaces.XSI_NS); + rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.0"); + + this.xmlWriter.writeXmlDeclaration("UTF-8"); + this.xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, + "document-content", rootAttributes, XmlWriterSupport.OPEN); + } + + public void close() + throws IOException + { + xmlWriter.close(); + } + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportProcessor.java b/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportProcessor.java new file mode 100644 index 000000000000..1845fc59a78f --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportProcessor.java @@ -0,0 +1,107 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ChartRawReportProcessor.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.output.chart; + +import com.sun.star.report.DataSourceFactory; +import com.sun.star.report.ImageService; +import com.sun.star.report.InputRepository; +import com.sun.star.report.OutputRepository; +import org.jfree.report.DataSourceException; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.flow.ReportJob; +import org.jfree.report.flow.ReportStructureRoot; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.SinglePassReportProcessor; +import org.pentaho.reporting.libraries.resourceloader.ResourceManager; + +/** + * + * @author Ocke Janssen + */ +public class ChartRawReportProcessor extends SinglePassReportProcessor +{ + + private final OutputRepository outputRepository; + private final String targetName; + private final InputRepository inputRepository; + private final ImageService imageService; + private final DataSourceFactory dataSourceFactory; + + public ChartRawReportProcessor(final InputRepository inputRepository, + final OutputRepository outputRepository, + final String targetName, + final ImageService imageService, + final DataSourceFactory dataSourceFactory) + { + if (inputRepository == null) + { + throw new NullPointerException(); + } + if (outputRepository == null) + { + throw new NullPointerException(); + } + if (targetName == null) + { + throw new NullPointerException(); + } + if (imageService == null) + { + throw new NullPointerException(); + } + if (dataSourceFactory == null) + { + throw new NullPointerException(); + } + this.targetName = targetName; + this.inputRepository = inputRepository; + this.outputRepository = outputRepository; + this.imageService = imageService; + this.dataSourceFactory = dataSourceFactory; + } + + protected ReportTarget createReportTarget(final ReportJob job) + throws ReportProcessingException + { + final ReportStructureRoot report = job.getReportStructureRoot(); + final ResourceManager resourceManager = report.getResourceManager(); + + return new ChartRawReportTarget(job, resourceManager, report.getBaseResource(), + inputRepository, outputRepository, targetName, imageService, dataSourceFactory); + } + + public void processReport(final ReportJob job) throws ReportDataFactoryException, DataSourceException, + ReportProcessingException + { + final ReportTarget reportTarget = createReportTarget(job); + processReportRun(job, reportTarget); + } +} 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 new file mode 100644 index 000000000000..a98b64495579 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportTarget.java @@ -0,0 +1,256 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ChartRawReportTarget.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.output.chart; + +import com.sun.star.report.DataSourceFactory; +import com.sun.star.report.ImageService; +import com.sun.star.report.InputRepository; +import com.sun.star.report.OutputRepository; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.PentahoReportEngineMetaData; +import com.sun.star.report.pentaho.output.OfficeDocumentReportTarget; +import java.io.IOException; +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.DataFlags; +import org.jfree.report.DataSourceException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.flow.ReportJob; +import org.jfree.report.flow.ReportTargetUtil; +import org.pentaho.reporting.libraries.resourceloader.ResourceKey; +import org.pentaho.reporting.libraries.resourceloader.ResourceManager; +import org.pentaho.reporting.libraries.xmlns.common.AttributeList; +import org.pentaho.reporting.libraries.xmlns.writer.XmlWriter; +import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport; + +/** + * + * @author Ocke Janssen + */ +public class ChartRawReportTarget extends OfficeDocumentReportTarget +{ + + private boolean inFilterElements = false; + private boolean tableRowsStarted = false; + private int tableCount = 0; + private int closeTags = 0; + + public ChartRawReportTarget(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 + { + super(reportJob, resourceManager, baseResource, inputRepository, outputRepository, target, imageService, dataSourceFactory); + } + + protected String getTargetMimeType() + { + return "application/vnd.oasis.opendocument.chart"; + } + + protected String getStartContent() + { + return "chart"; + } + + public String getExportDescriptor() + { + return "raw/" + PentahoReportEngineMetaData.OPENDOCUMENT_CHART; + } + + protected void startContent(final AttributeMap attrs) throws IOException, DataSourceException, ReportProcessingException + { + inFilterElements = false; + closeTags = 0; + tableCount = 0; + final XmlWriter xmlWriter = getXmlWriter(); + xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, getStartContent(), null, XmlWriterSupport.OPEN); + ++closeTags; + } + + protected void endContent(final AttributeMap attrs) throws IOException, DataSourceException, ReportProcessingException + { + final XmlWriter xmlWriter = getXmlWriter(); + //xmlWriter.writeCloseTag(); + while (closeTags > 0) + { + xmlWriter.writeCloseTag(); + --closeTags; + } + } + + protected void startReportSection(final AttributeMap attrs, final int role) + throws IOException, DataSourceException, ReportProcessingException + { + } + + protected void endReportSection(final AttributeMap attrs, final int role) + throws IOException, DataSourceException, ReportProcessingException + { + } + + protected void startOther(final AttributeMap attrs) throws IOException, DataSourceException, ReportProcessingException + { + final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs); + if (!isFilteredNamespace(namespace)) + { + final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs); + try + { + processElement(attrs, namespace, elementType); + } + catch (IOException e) + { + throw new ReportProcessingException("Failed", e); + } + } + } + + private boolean isFiltered(final String elementType) + { + return OfficeToken.TABLE_HEADER_COLUMNS.equals(elementType) || + OfficeToken.TABLE_HEADER_ROWS.equals(elementType) || + OfficeToken.TABLE_COLUMNS.equals(elementType); + } + + protected void endOther(final AttributeMap attrs) throws IOException, DataSourceException, ReportProcessingException + { + if ( tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE) + { + return; + } + final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs); + if (!isFilteredNamespace(namespace)) + { + final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs); + // if this is the report namespace, write out a table definition .. + if (OfficeNamespaces.TABLE_NS.equals(namespace)) + { + if (OfficeToken.TABLE.equals(elementType) || + OfficeToken.TABLE_ROWS.equals(elementType)) + { + return; + } + else if (isFiltered(elementType)) + { + inFilterElements = false; + if (tableCount > 1) + { + return; + } + } + } + else if (OfficeNamespaces.CHART_NS.equals(namespace) && "chart".equals(elementType)) + { + return; + } + if (inFilterElements && tableCount > 1) + { + return; + } + final XmlWriter xmlWriter = getXmlWriter(); + xmlWriter.writeCloseTag(); + --closeTags; + } + } + + public void processContent(final DataFlags value) + throws DataSourceException, ReportProcessingException + { + if ( !(tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE)) + { + super.processContent(value); + } + } + + private void processElement(final AttributeMap attrs, final String namespace, final String elementType) + throws IOException, ReportProcessingException + { + if ( tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE) + { + return; + } + if (OfficeNamespaces.TABLE_NS.equals(namespace)) + { + if (OfficeToken.TABLE.equals(elementType)) + { + tableCount += 1; + if (tableCount > 1) + { + return; + } + } + else if (OfficeToken.TABLE_ROWS.equals(elementType)) + { + if (tableCount > 1) + { + return; + } + tableRowsStarted = true; + } + else if (isFiltered(elementType)) + { + inFilterElements = true; + if (tableCount > 1) + { + return; + } + } + } + if (inFilterElements && tableCount > 1) + { + return; + } + + // All styles have to be processed or you will loose the paragraph-styles and inline text-styles. + // .. + performStyleProcessing(attrs); + + final AttributeList attrList = buildAttributeList(attrs); + final XmlWriter xmlWriter = getXmlWriter(); + xmlWriter.writeTag(namespace, elementType, attrList, XmlWriter.OPEN); + ++closeTags; + // System.out.println("elementType = " + elementType); + } + // ///////////////////////////////////////////////////////////////////////// + public void processText(final String text) throws DataSourceException, ReportProcessingException + { + if (inFilterElements && tableCount > 1) + { + return; + } + super.processText(text); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java new file mode 100644 index 000000000000..268450de3b08 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java @@ -0,0 +1,122 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: SpreadsheetRawReportProcessor.java,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.output.spreadsheet; + +import com.sun.star.report.DataSourceFactory; +import org.jfree.report.DataSourceException; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.flow.AbstractReportProcessor; +import org.jfree.report.flow.ReportJob; +import org.jfree.report.flow.ReportStructureRoot; +import org.jfree.report.flow.ReportTarget; +import com.sun.star.report.OutputRepository; +import com.sun.star.report.InputRepository; +import com.sun.star.report.ImageService; +import com.sun.star.report.pentaho.PentahoFormulaContext; +import org.jfree.report.data.ReportContextImpl; +import org.jfree.report.flow.ReportContext; +import org.pentaho.reporting.libraries.resourceloader.ResourceManager; + +/** + * @author Michael D'Amour + */ +public class SpreadsheetRawReportProcessor extends AbstractReportProcessor +{ + + private final OutputRepository outputRepository; + private final String targetName; + private final InputRepository inputRepository; + private final ImageService imageService; + private final DataSourceFactory dataSourceFactory; + + public SpreadsheetRawReportProcessor(final InputRepository inputRepository, + final OutputRepository outputRepository, + final String targetName, + final ImageService imageService, + final DataSourceFactory dataSourceFactory) + { + if (outputRepository == null) + { + throw new NullPointerException(); + } + if (targetName == null) + { + throw new NullPointerException(); + } + if (imageService == null) + { + throw new NullPointerException(); + } + if (inputRepository == null) + { + throw new NullPointerException(); + } + if (dataSourceFactory == null) + { + throw new NullPointerException(); + } + + this.targetName = targetName; + this.inputRepository = inputRepository; + this.outputRepository = outputRepository; + this.imageService = imageService; + this.dataSourceFactory = dataSourceFactory; + } + + protected ReportTarget createReportTarget(final ReportJob job) throws ReportProcessingException + { + final ReportStructureRoot report = job.getReportStructureRoot(); + final ResourceManager resourceManager = report.getResourceManager(); + return new SpreadsheetRawReportTarget(job, resourceManager, report.getBaseResource(), inputRepository, outputRepository, targetName, imageService, dataSourceFactory); + } + + public void processReport(final ReportJob job) throws ReportDataFactoryException, DataSourceException, + ReportProcessingException + { + final ReportTarget reportTarget = createReportTarget(job); + // first run: collect table cell sizes for all tables + processReportRun(job, reportTarget); + // second run: uses table cell data to output a single uniform table + processReportRun(job, reportTarget); + } + + protected ReportContext createReportContext(final ReportJob job, + final ReportTarget target) + { + final ReportContext context = super.createReportContext(job, target); + if (context instanceof ReportContextImpl) + { + final ReportContextImpl impl = (ReportContextImpl) context; + impl.setFormulaContext(new PentahoFormulaContext(impl.getFormulaContext(),job.getConfiguration())); + } + return context; + } +} 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 new file mode 100644 index 000000000000..2b764f371fc1 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java @@ -0,0 +1,942 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: SpreadsheetRawReportTarget.java,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.output.spreadsheet; + +import com.sun.star.report.DataSourceFactory; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; + +import com.sun.star.report.InputRepository; +import com.sun.star.report.OutputRepository; +import com.sun.star.report.ImageService; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.PentahoReportEngineMetaData; +import com.sun.star.report.pentaho.model.OfficeStyle; +import com.sun.star.report.pentaho.model.OfficeStyles; +import com.sun.star.report.pentaho.model.OfficeStylesCollection; +import com.sun.star.report.pentaho.model.OfficeMasterPage; +import com.sun.star.report.pentaho.model.OfficeMasterStyles; +import com.sun.star.report.pentaho.model.PageSection; +import com.sun.star.report.pentaho.output.OfficeDocumentReportTarget; +import com.sun.star.report.pentaho.output.StyleUtilities; +import com.sun.star.report.pentaho.output.text.MasterPageFactory; +import com.sun.star.report.pentaho.styles.LengthCalculator; +import java.util.Set; +import org.jfree.layouting.util.AttributeMap; +import org.jfree.layouting.input.style.values.CSSNumericValue; +import org.jfree.layouting.input.style.values.CSSNumericType; +import org.jfree.report.DataFlags; +import org.jfree.report.DataSourceException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.flow.ReportJob; +import org.jfree.report.flow.ReportStructureRoot; +import org.jfree.report.flow.ReportTargetUtil; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; +import org.jfree.report.util.IntegerCache; +import org.jfree.report.util.TextUtilities; +import org.pentaho.reporting.libraries.resourceloader.ResourceKey; +import org.pentaho.reporting.libraries.resourceloader.ResourceManager; +import org.pentaho.reporting.libraries.xmlns.common.AttributeList; +import org.pentaho.reporting.libraries.xmlns.writer.XmlWriter; +import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport; + +/** + * Creation-Date: 03.11.2007 + * + * @author Michael D'Amour + */ +public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget +{ + + private boolean paragraphFound = false; + private boolean paragraphHandled = false; + + /** + * This class represents a column boundary, not in width, but it's actual boundary location. One of the motivations + * for creating this class was to be able to record the boundaries for each incoming table while consuming as few + * objects/memory as possible. + */ + private static class ColumnBoundary implements Comparable + { + + private final Set tableIndices; + private final float boundary; + + private ColumnBoundary(final float boundary) + { + this.tableIndices = new HashSet(); + this.boundary = boundary; + } + + public void addTableIndex(final int table) + { + tableIndices.add(IntegerCache.getInteger(table)); + } + + public float getBoundary() + { + return boundary; + } + + public boolean isContainedByTable(final int table) + { + final Integer index = IntegerCache.getInteger(table); + return tableIndices.contains(index); + } + + public int compareTo(final Object arg0) + { + if (arg0.equals(this)) + { + return 0; + } + if (arg0 instanceof ColumnBoundary) + { + if (boundary > ((ColumnBoundary) arg0).boundary) + { + return 1; + } + else + { + return -1; + } + } + return 1; + } + + public boolean equals(final Object obj) + { + if (obj instanceof ColumnBoundary) + { + return ((ColumnBoundary) obj).boundary == boundary; + } + return false; + } + } + private String tableBackgroundColor; // null means transparent ... + private static final ColumnBoundary[] EMPTY_COLBOUNDS = new ColumnBoundary[0]; + private boolean elementBoundaryCollectionPass; + private boolean oleHandled; + private final List columnBoundaryList; + private float currentRowBoundaryMarker; + private ColumnBoundary[] sortedBoundaryArray; + private ColumnBoundary[] boundariesForTableArray; + private int tableCounter; + private int columnCounter; + private int columnSpanCounter; + private String unitsOfMeasure; + final private ArrayList shapes; + final private ArrayList ole; + final private ArrayList 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 + { + super(reportJob, resourceManager, baseResource, inputRepository, outputRepository, target, imageService, dataSourceFactory); + columnBoundaryList = new ArrayList(); + elementBoundaryCollectionPass = true; + rowHeights = new ArrayList(); + shapes = new ArrayList(); + ole = new ArrayList(); + oleHandled = false; + } + + public void startOther(final AttributeMap attrs) throws DataSourceException, ReportProcessingException + { + if (ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.OBJECT_OLE, attrs)) + { + if (isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE) + { + ole.add(attrs); + } + oleHandled = true; + return; + } + final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs); + if (isRepeatingSection() || isFilteredNamespace(namespace)) + { + return; + } + + final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs); + 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 (isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE) + { + final LengthCalculator len = new LengthCalculator(); + for (int i = 0; i < rowHeights.size(); i++) + { + len.add((CSSNumericValue) rowHeights.get(i)); + // val += ((CSSNumericValue)rowHeights.get(i)).getValue(); + } + + rowHeights.clear(); + final CSSNumericValue currentRowHeight = len.getResult(); + 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) + { + len.add(parseLength(y)); + final CSSNumericValue currentY = len.getResult(); + attrs.setAttribute(OfficeNamespaces.SVG_NS, "y", currentY.getValue() + currentY.getType().getType()); + } + shapes.add(attrs); + } + return; + } + if (oleHandled) + { + if (isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE) + { + ole.add(attrs); + } + return; + } + + // if this is the report namespace, write out a table definition .. + 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()) + { + collectBoundaryForElement(attrs); + } + else + // if (!isElementBoundaryCollectionPass()) + { + try + { + processElement(attrs, namespace, elementType); + } + catch (IOException e) + { + throw new ReportProcessingException("Failed", e); + } + } + } + + 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))) + { + startBuffering(new OfficeStylesCollection(), true); + + } + else + { + super.startReportSection(attrs, role); + } + } + + 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))) + { + finishBuffering(); + } + else + { + super.endReportSection(attrs, role); + } + } + + private void handleParagraph() + { + if (paragraphFound) + { + try + { + final XmlWriter xmlWriter = getXmlWriter(); + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, null, XmlWriterSupport.OPEN); + paragraphHandled = true; + paragraphFound = false; + } + catch (IOException ex) + { + LOGGER.error("ReportProcessing failed", ex); + } + } + } + + private void processElement(final AttributeMap attrs, final String namespace, final String elementType) + throws IOException, ReportProcessingException + { + final XmlWriter xmlWriter = getXmlWriter(); + final AttributeMap retval = new AttributeMap(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) + { + 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)) + { + tableBackgroundColor = null; + } + else + { + tableBackgroundColor = String.valueOf(raw); + } + } + return; + } + + 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 (columnSpanCounter > 0) + { + columnSpanCounter--; + } + + 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++) + { + xmlWriter.writeTag(namespace, OfficeToken.COVERED_TABLE_CELL, null, XmlWriter.CLOSE); + } + } + return; + } + + 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) + { + 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) + { + tableRowProperties = new Section(); + tableRowProperties.setNamespace(OfficeNamespaces.STYLE_NS); + tableRowProperties.setType("table-row-properties"); + tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, tableBackgroundColor); + style.addNode(tableRowProperties); + } + else + { + final Object oldValue = tableRowProperties.getAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR); + 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()); + } + } + 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) + { + final OfficeStyle cellStyle = getPredefinedStylesCollection().getStyle(OfficeToken.TABLE_CELL, styleName); + if (cellStyle != null) + { + final Element props = cellStyle.getTableCellProperties(); + if (props != null) + { + final Object raw = props.getAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR); + if (raw == null || "transparent".equals(raw)) + { + cellStyle.removeNode(props); + } + } + } + } + + final String numColSpanStr = (String) attrs.getAttribute(namespace, "number-columns-spanned"); + int initialColumnSpan = columnSpanCounter = 1; + if (numColSpanStr != null) + { + initialColumnSpan = Integer.parseInt(numColSpanStr); + columnSpanCounter = initialColumnSpan; + } + final int span = getColumnSpanForCell(tableCounter, columnCounter, initialColumnSpan); + if (initialColumnSpan > 1) + { + // add the initial column span to our column counter index (subtract 1, since it is counted by default) + columnCounter += initialColumnSpan - 1; + } + + // if (span < initialColumnSpan) + // { + // // ColumnBoundary cbs[] = getBoundariesForTable(tableCounter); + // // for (int i = 0; i < cbs.length; i++) + // // { + // // System.out.print(cbs[i].getBoundary() + " "); + // // } + // // System.out.println(); + // + // LOGGER.error("A cell cannot span less than the declared columns: Declared=" + initialColumnSpan + " Computed=" + // + span); + // } + + // there's no point to create number-columns-spanned attributes if we only span 1 column + if (span > 1) + { + retval.setAttribute(namespace, "number-columns-spanned", "" + 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 + } + + // All styles have to be processed or you will loose the paragraph-styles and inline text-styles. + // .. + performStyleProcessing(retval); + + final AttributeList attrList = buildAttributeList(retval); + xmlWriter.writeTag(namespace, elementType, attrList, XmlWriter.OPEN); + // System.out.println("elementType = " + elementType); + } + + private void collectBoundaryForElement(final AttributeMap 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)) + { + final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); + 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) + { + // Now this is very bad. It means that there is no style defined with the given name. + return; + } + + final Element tableColumnProperties = style.getTableColumnProperties(); + String widthStr = (String) tableColumnProperties.getAttribute("column-width"); + widthStr = widthStr.substring(0, widthStr.indexOf(getUnitsOfMeasure(widthStr))); + addColumnWidthToRowBoundaryMarker(Float.parseFloat(widthStr)); + ColumnBoundary currentRowBoundary = new ColumnBoundary(getCurrentRowBoundaryMarker()); + final List columnBoundaryList_ = getColumnBoundaryList(); + final int idx = columnBoundaryList_.indexOf(currentRowBoundary); + if (idx == -1) + { + columnBoundaryList_.add(currentRowBoundary); + } + else + { + currentRowBoundary = (ColumnBoundary) columnBoundaryList_.get(idx); + } + currentRowBoundary.addTableIndex(tableCounter); + } + } + + private String getUnitsOfMeasure(final String str) + { + if (unitsOfMeasure == null || "".equals(unitsOfMeasure)) + { + if (str == null || "".equals(str)) + { + unitsOfMeasure = "cm"; + return unitsOfMeasure; + } + + // build units of measure, set it + int i = str.length() - 1; + for (; i >= 0; i--) + { + final char c = str.charAt(i); + if (Character.isDigit(c) || c == '.' || c == ',') + { + break; + } + } + unitsOfMeasure = str.substring(i + 1); + } + return unitsOfMeasure; + } + + private void createTableShapes() throws ReportProcessingException + { + if (!shapes.isEmpty()) + { + try + { + final XmlWriter xmlWriter = getXmlWriter(); + // at this point we need to generate the table-columns section based on our boundary table + // + // + // .. + // + xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.SHAPES, null, XmlWriterSupport.OPEN); + + + for (int i = 0; i < shapes.size(); i++) + { + final AttributeMap attrs = (AttributeMap) shapes.get(i); + final AttributeList attrList = buildAttributeList(attrs); + attrList.removeAttribute(OfficeNamespaces.DRAWING_NS, OfficeToken.STYLE_NAME); + xmlWriter.writeTag(OfficeNamespaces.DRAWING_NS, OfficeToken.FRAME, attrList, XmlWriterSupport.OPEN); + startChartProcessing((AttributeMap) ole.get(i)); + + xmlWriter.writeCloseTag(); + } + xmlWriter.writeCloseTag(); + } + catch (IOException e) + { + throw new ReportProcessingException("Failed", e); + } + } + } + + private void createTableColumns() throws ReportProcessingException + { + try + { + final XmlWriter xmlWriter = getXmlWriter(); + // at this point we need to generate the table-columns section based on our boundary table + // + // + // .. + // + // the first boundary is '0' which is a placeholder so we will ignore it + xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMNS, null, XmlWriterSupport.OPEN); + + // 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++) + { + final ColumnBoundary cb = cba[i]; + float columnWidth = cb.getBoundary(); + if (i > 1) + { + columnWidth -= cba[i - 1].getBoundary(); + } + final OfficeStyle style = deriveStyle(OfficeToken.TABLE_COLUMN, ("co" + i + "_")); + final Section tableColumnProperties = new Section(); + tableColumnProperties.setType("table-column-properties"); + tableColumnProperties.setNamespace(style.getNamespace()); + tableColumnProperties.setAttribute(style.getNamespace(), "column-width", columnWidth + getUnitsOfMeasure(null)); + style.addNode(tableColumnProperties); + + final AttributeList myAttrList = new AttributeList(); + myAttrList.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName()); + xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMN, myAttrList, XmlWriterSupport.CLOSE); + } + xmlWriter.writeCloseTag(); + } + catch (IOException e) + { + throw new ReportProcessingException("Failed", e); + } + } + + protected void endOther(final AttributeMap attrs) throws DataSourceException, ReportProcessingException + { + 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) + { + final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); + rowHeights.add(computeRowHeight(styleName)); + } + + if (isRepeatingSection() || isElementBoundaryCollectionPass()) + { + return; + } + + final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs); + if (isFilteredNamespace(namespace)) + { + return; + } + final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs); + 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))) + { + return; + } + + if ( !paragraphHandled && OfficeNamespaces.TEXT_NS.equals(namespace) && OfficeToken.P.equals(elementType)) + { + if (!paragraphHandled) + { + return; + } + + paragraphHandled = false; + } + try + { + final XmlWriter xmlWriter = getXmlWriter(); + xmlWriter.writeCloseTag(); + // table-cell elements may have a number-columns-spanned attribute which indicates how many + // 'covered-table-cell' elements we need to generate + generateCoveredTableCells(attrs); + } + catch (IOException e) + { + throw new ReportProcessingException("Failed", e); + } + } + + private void generateCoveredTableCells(final AttributeMap attrs) throws IOException + { + 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++) + { + xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.COVERED_TABLE_CELL, null, XmlWriter.CLOSE); + } + } + + public String getExportDescriptor() + { + return "raw/" + PentahoReportEngineMetaData.OPENDOCUMENT_SPREADSHEET; + } + + // ///////////////////////////////////////////////////////////////////////// + public void processText(final String text) throws DataSourceException, ReportProcessingException + { + if (!(isRepeatingSection() || isElementBoundaryCollectionPass())) + { + handleParagraph(); + super.processText(text); + } + } + + public void processContent(final DataFlags value) throws DataSourceException, ReportProcessingException + { + if (!(isRepeatingSection() || isElementBoundaryCollectionPass())) + { + handleParagraph(); + super.processContent(value); + } + } + + protected String getStartContent() + { + return "spreadsheet"; + } + + protected void startContent(final AttributeMap attrs) throws IOException, DataSourceException, + ReportProcessingException + { + if (!isElementBoundaryCollectionPass()) + { + final XmlWriter xmlWriter = getXmlWriter(); + xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, getStartContent(), null, XmlWriterSupport.OPEN); + + 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); + tableAttributes.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, generateInitialTableStyle()); + tableAttributes.setAttribute(OfficeNamespaces.TABLE_NS, "name", "Report"); + + performStyleProcessing(tableAttributes); + + xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE, buildAttributeList(tableAttributes), XmlWriterSupport.OPEN); + createTableShapes(); + createTableColumns(); + } + } + + private String generateInitialTableStyle() throws ReportProcessingException + { + final OfficeStylesCollection predefStyles = getPredefinedStylesCollection(); + final OfficeStyles commonStyles = predefStyles.getAutomaticStyles(); + if (!commonStyles.containsStyle(OfficeToken.TABLE, "Initial_Table")) + { + final String masterPageName = createMasterPage(); + + final OfficeStyle tableStyle = new OfficeStyle(); + tableStyle.setStyleFamily(OfficeToken.TABLE); + 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"); + commonStyles.addStyle(tableStyle); + } + return "Initial_Table"; + } + + private String createMasterPage() throws ReportProcessingException + { + final OfficeStylesCollection predefStyles = getPredefinedStylesCollection(); + final MasterPageFactory masterPageFactory = new MasterPageFactory(predefStyles.getMasterStyles()); + final OfficeMasterPage masterPage; + 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) + { + // there is no pagelayout. Create one .. + final String derivedLayout = masterPageFactory.createPageStyle(getGlobalStylesCollection().getAutomaticStyles(), zeroLength, zeroLength); + masterPage.setPageLayout(derivedLayout); + } + else + { + final String derivedLayout = masterPageFactory.derivePageStyle(pageLayoutTemplate, + getPredefinedStylesCollection().getAutomaticStyles(), + getGlobalStylesCollection().getAutomaticStyles(), zeroLength, zeroLength); + masterPage.setPageLayout(derivedLayout); + } + + final OfficeStylesCollection officeStylesCollection = getGlobalStylesCollection(); + final OfficeMasterStyles officeMasterStyles = officeStylesCollection.getMasterStyles(); + officeMasterStyles.addMasterPage(masterPage); + } + else + { + masterPage = masterPageFactory.getMasterPage("Standard", null, null); + } + return masterPage.getStyleName(); + } + + protected void endContent(final AttributeMap attrs) throws IOException, DataSourceException, + ReportProcessingException + { + // todo + if (!isElementBoundaryCollectionPass()) + { + final XmlWriter xmlWriter = getXmlWriter(); + xmlWriter.writeCloseTag(); + xmlWriter.writeCloseTag(); + } + } + + public void endReport(final ReportStructureRoot report) throws DataSourceException, ReportProcessingException + { + super.endReport(report); + setElementBoundaryCollectionPass(false); + resetTableCounter(); + columnCounter = 0; + } + + private boolean isElementBoundaryCollectionPass() + { + return elementBoundaryCollectionPass; + } + + private void setElementBoundaryCollectionPass(final boolean elementBoundaryCollectionPass) + { + this.elementBoundaryCollectionPass = elementBoundaryCollectionPass; + } + + private ColumnBoundary[] getSortedColumnBoundaryArray() + { + if (sortedBoundaryArray == null) + { + getColumnBoundaryList().add(new ColumnBoundary(0)); + sortedBoundaryArray = (ColumnBoundary[]) getColumnBoundaryList().toArray(EMPTY_COLBOUNDS); + Arrays.sort(sortedBoundaryArray); + } + return sortedBoundaryArray; + } + + private List getColumnBoundaryList() + { + return columnBoundaryList; + } + + private void addColumnWidthToRowBoundaryMarker(final float width) + { + currentRowBoundaryMarker += width; + } + + private float getCurrentRowBoundaryMarker() + { + return currentRowBoundaryMarker; + } + + private void resetTableCounter() + { + tableCounter = 0; + } + + private void resetCurrentRowBoundaryMarker() + { + currentRowBoundaryMarker = 0; + } + + private ColumnBoundary[] getBoundariesForTable(final int table) + { + if (boundariesForTableArray == null) + { + final List boundariesForTable = new ArrayList(); + final List boundaryList = getColumnBoundaryList(); + for (int i = 0; i < boundaryList.size(); i++) + { + final ColumnBoundary b = (ColumnBoundary) boundaryList.get(i); + if (b.isContainedByTable(table)) + { + boundariesForTable.add(b); + } + } + boundariesForTableArray = (ColumnBoundary[]) boundariesForTable.toArray(EMPTY_COLBOUNDS); + Arrays.sort(boundariesForTableArray); + } + return boundariesForTableArray; + } + + private int getColumnSpanForCell(final int table, final int col, final int initialColumnSpan) + { + final ColumnBoundary[] globalBoundaries = getSortedColumnBoundaryArray(); + final ColumnBoundary[] tableBoundaries = getBoundariesForTable(table); + // how many column boundaries in the globalBoundaries list fall between the currentRowWidth and the next boundary + // for the current row + + float cellBoundary = tableBoundaries[col - 1].getBoundary(); + float cellWidth = tableBoundaries[col - 1].getBoundary(); + + if (col > 1) + { + cellWidth = cellWidth - tableBoundaries[col - 2].getBoundary(); + } + + if (initialColumnSpan > 1) + { + // ok we've got some additional spanning specified on the input + final int index = (col - 1) + (initialColumnSpan - 1); + cellWidth += tableBoundaries[index].getBoundary() - tableBoundaries[col - 1].getBoundary(); + cellBoundary = tableBoundaries[index].getBoundary(); + } + + int beginBoundaryIndex = 0; + int endBoundaryIndex = globalBoundaries.length - 1; + for (int i = 0; i < globalBoundaries.length; i++) + { + // find beginning boundary + if (globalBoundaries[i].getBoundary() <= cellBoundary - cellWidth) + { + beginBoundaryIndex = i; + } + 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) + { + return 1; + } + // System.out.println("table = " + table + " col = " + col + " rowBoundaries.length = " + tableBoundaries.length + " + // cellWidth = " + cellWidth + " span = " + span); + return span; + } + + protected String getTargetMimeType() + { + return "application/vnd.oasis.opendocument.spreadsheet"; + } +} 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 new file mode 100644 index 000000000000..48879bf8ce2b --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/MasterPageFactory.java @@ -0,0 +1,423 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: MasterPageFactory.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.output.text; + +import java.util.HashMap; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.OfficeMasterPage; +import com.sun.star.report.pentaho.model.OfficeMasterStyles; +import com.sun.star.report.pentaho.model.RawText; +import com.sun.star.report.pentaho.model.OfficeStyles; +import com.sun.star.report.pentaho.model.PageLayout; +import java.util.Map; +import org.jfree.layouting.input.style.values.CSSNumericValue; +import org.jfree.report.structure.Section; +import org.jfree.report.structure.Element; +import org.jfree.report.util.AttributeNameGenerator; +import org.jfree.report.ReportProcessingException; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 14.03.2007 + */ +public class MasterPageFactory +{ + + private static class MasterPageFactoryKey + { + + private final String template; + private final String pageHeader; + private final String pageFooter; + + public MasterPageFactoryKey(final String template, + final String pageHeader, + final String pageFooter) + { + this.template = template; + this.pageHeader = pageHeader; + this.pageFooter = pageFooter; + } + + public boolean equals(final Object o) + { + if (this != o) + { + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final MasterPageFactoryKey that = (MasterPageFactoryKey) o; + + if (pageFooter != null ? !pageFooter.equals( + that.pageFooter) : that.pageFooter != null) + { + return false; + } + if (pageHeader != null ? !pageHeader.equals( + that.pageHeader) : that.pageHeader != null) + { + return false; + } + if (template != null ? !template.equals( + that.template) : that.template != null) + { + return false; + } + } + + return true; + } + + public int hashCode() + { + int result = (template != null ? template.hashCode() : 0); + result = 31 * result + (pageHeader != null ? pageHeader.hashCode() : 0); + result = 31 * result + (pageFooter != null ? pageFooter.hashCode() : 0); + return result; + } + + public String getTemplate() + { + return template; + } + + public String getPageHeader() + { + return pageHeader; + } + + public String getPageFooter() + { + return pageFooter; + } + } + + private static class PageLayoutKey + { + + private final String templateName; + private final CSSNumericValue headerHeight; + private final CSSNumericValue footerHeight; + + public PageLayoutKey(final String templateName, + final CSSNumericValue headerHeight, + final CSSNumericValue footerHeight) + { + this.templateName = templateName; + this.headerHeight = headerHeight; + this.footerHeight = footerHeight; + } + + public String getTemplateName() + { + return templateName; + } + + public CSSNumericValue getHeaderHeight() + { + return headerHeight; + } + + public CSSNumericValue getFooterHeight() + { + return footerHeight; + } + + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final PageLayoutKey key = (PageLayoutKey) o; + + if (footerHeight != null ? !footerHeight.equals( + key.footerHeight) : key.footerHeight != null) + { + return false; + } + if (headerHeight != null ? !headerHeight.equals( + key.headerHeight) : key.headerHeight != null) + { + return false; + } + if (templateName != null ? !templateName.equals( + key.templateName) : key.templateName != null) + { + return false; + } + + return true; + } + + public int hashCode() + { + int result; + result = (templateName != null ? templateName.hashCode() : 0); + result = 31 * result + (headerHeight != null ? headerHeight.hashCode() : 0); + result = 31 * result + (footerHeight != null ? footerHeight.hashCode() : 0); + return result; + } + } + + // todo: Patch the page-layout ... + private static final String DEFAULT_PAGE_NAME = "Default"; + private final OfficeMasterStyles predefinedStyles; + private final AttributeNameGenerator masterPageNameGenerator; + private final Map masterPages; + private final AttributeNameGenerator pageLayoutNameGenerator; + private final Map pageLayouts; + + public MasterPageFactory(final OfficeMasterStyles predefinedStyles) + { + this.predefinedStyles = predefinedStyles; + this.masterPages = new HashMap(); + this.masterPageNameGenerator = new AttributeNameGenerator(); + this.pageLayouts = new HashMap(); + this.pageLayoutNameGenerator = new AttributeNameGenerator(); + } + + public OfficeMasterPage getMasterPage(final String template, + final String pageHeader, + final String pageFooter) + { + final MasterPageFactoryKey key = + new MasterPageFactoryKey(template, pageHeader, pageFooter); + return (OfficeMasterPage) masterPages.get(key); + } + + public boolean containsMasterPage(final String template, + final String pageHeader, + final String pageFooter) + { + final MasterPageFactoryKey key = + new MasterPageFactoryKey(template, pageHeader, pageFooter); + return masterPages.containsKey(key); + } + + public OfficeMasterPage createMasterPage(final String template, + final String pageHeader, + final String pageFooter) + { + final MasterPageFactoryKey key = + new MasterPageFactoryKey(template, pageHeader, pageFooter); + final OfficeMasterPage cached = (OfficeMasterPage) masterPages.get(key); + if (cached != null) + { + return cached; + } + + final String targetName = (masterPages.isEmpty()) ? "Standard" : template; + + OfficeMasterPage predef = predefinedStyles.getMasterPage(template); + if (predef == null) + { + // This is a 'magic' name .. + // todo: It could be that this should be called 'Standard' instead + predef = predefinedStyles.getMasterPage(MasterPageFactory.DEFAULT_PAGE_NAME); + } + + if (predef != null) + { + try + { + // derive + final OfficeMasterPage derived = (OfficeMasterPage) predef.clone(); + return setupMasterPage(derived, targetName, pageHeader, pageFooter, + key); + } + catch (CloneNotSupportedException cne) + { + throw new IllegalStateException("Implementation error: Unable to derive page"); + } + } + + final OfficeMasterPage masterPage = new OfficeMasterPage(); + masterPage.setNamespace(OfficeNamespaces.STYLE_NS); + masterPage.setType("master-page"); + return setupMasterPage(masterPage, targetName, pageHeader, pageFooter, key); + } + + private OfficeMasterPage setupMasterPage(final OfficeMasterPage derived, + final String targetName, + final String pageHeader, + final String pageFooter, + final MasterPageFactoryKey key) + { + derived.setStyleName(masterPageNameGenerator.generateName(targetName)); + masterPages.put(key, derived); + + if (pageHeader != null) + { + final Section header = new Section(); + header.setNamespace(OfficeNamespaces.STYLE_NS); + header.setType("header"); + header.addNode(new RawText(pageHeader)); + derived.addNode(header); + } + + if (pageFooter != null) + { + final Section footer = new Section(); + footer.setNamespace(OfficeNamespaces.STYLE_NS); + footer.setType("footer"); + footer.addNode(new RawText(pageFooter)); + derived.addNode(footer); + } + + return derived; + } + + public String createPageStyle(final OfficeStyles commonStyles, + final CSSNumericValue headerHeight, + final CSSNumericValue footerHeight) + { + final PageLayoutKey key = + new PageLayoutKey(null, headerHeight, footerHeight); + final PageLayout derived = new PageLayout(); + final String name = pageLayoutNameGenerator.generateName("autogenerated"); + derived.setStyleName(name); + commonStyles.addPageStyle(derived); + + if (headerHeight != null) + { + final Section headerStyle = new Section(); + headerStyle.setNamespace(OfficeNamespaces.STYLE_NS); + headerStyle.setType("header-style"); + derived.addNode(headerStyle); + MasterPageFactory.applyHeaderFooterHeight(headerStyle, headerHeight); + } + + if (footerHeight != null) + { + final Section footerStyle = new Section(); + footerStyle.setNamespace(OfficeNamespaces.STYLE_NS); + footerStyle.setType("footer-style"); + derived.addNode(footerStyle); + MasterPageFactory.applyHeaderFooterHeight(footerStyle, footerHeight); + } + pageLayouts.put(key, name); + return name; + } + + public String derivePageStyle(final String pageStyleTemplate, + final OfficeStyles predefined, + final OfficeStyles commonStyles, + final CSSNumericValue headerHeight, + final CSSNumericValue footerHeight) + throws ReportProcessingException + { + if (pageStyleTemplate == null) + { + throw new NullPointerException("A style-name must be given"); + } + + final PageLayoutKey key = + new PageLayoutKey(pageStyleTemplate, headerHeight, footerHeight); + final String pageLayoutName = (String) pageLayouts.get(key); + if (pageLayoutName != null) + { + // there's already a suitable version included. + return pageLayoutName; + } + + final PageLayout original = predefined.getPageStyle(pageStyleTemplate); + if (original == null) + { + throw new ReportProcessingException("Invalid page-layout '" + pageStyleTemplate + "', will not continue."); + } + + try + { + final PageLayout derived = (PageLayout) original.clone(); + final String name = pageLayoutNameGenerator.generateName( + pageStyleTemplate); + derived.setStyleName(name); + commonStyles.addPageStyle(derived); + + if (headerHeight != null) + { + Section headerStyle = derived.getHeaderStyle(); + if (headerStyle == null) + { + headerStyle = new Section(); + headerStyle.setNamespace(OfficeNamespaces.STYLE_NS); + headerStyle.setType("header-style"); + derived.addNode(headerStyle); + } + MasterPageFactory.applyHeaderFooterHeight(headerStyle, headerHeight); + } + + if (footerHeight != null) + { + Section footerStyle = derived.getFooterStyle(); + if (footerStyle == null) + { + footerStyle = new Section(); + footerStyle.setNamespace(OfficeNamespaces.STYLE_NS); + footerStyle.setType("footer-style"); + derived.addNode(footerStyle); + } + + MasterPageFactory.applyHeaderFooterHeight(footerStyle, footerHeight); + } + pageLayouts.put(key, name); + return name; + } + catch (CloneNotSupportedException e) + { + throw new IllegalStateException("Clone failed."); + } + } + + private static void applyHeaderFooterHeight(final Section headerFooterStyle, + final CSSNumericValue style) + { + Element headerFooterProps = headerFooterStyle.findFirstChild(OfficeNamespaces.STYLE_NS, "header-footer-properties"); + if (headerFooterProps == null) + { + headerFooterProps = new Section(); + headerFooterProps.setNamespace(OfficeNamespaces.STYLE_NS); + headerFooterProps.setType("header-footer-properties"); + headerFooterStyle.addNode(headerFooterProps); + } + headerFooterProps.setAttribute(OfficeNamespaces.SVG_NS, "height", style.getValue() + style.getType().getType()); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageBreakDefinition.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageBreakDefinition.java new file mode 100644 index 000000000000..23372228d33d --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageBreakDefinition.java @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: PageBreakDefinition.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.output.text; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 24.03.2007 + */ +public class PageBreakDefinition +{ + + private final boolean resetPageNumber; + + public PageBreakDefinition(final boolean resetPageNumber) + { + this.resetPageNumber = resetPageNumber; + } + + public boolean isResetPageNumber() + { + return resetPageNumber; + } +} 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 new file mode 100644 index 000000000000..fdd82694cae3 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageContext.java @@ -0,0 +1,239 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: PageContext.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.output.text; + +import org.jfree.layouting.input.style.values.CSSNumericValue; +import com.sun.star.report.pentaho.styles.LengthCalculator; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 24.03.2007 + */ +public class PageContext +{ + + public static final int KEEP_TOGETHER_OFF = 0; + public static final int KEEP_TOGETHER_GROUP = 1; + public static final int KEEP_TOGETHER_FIRST_DETAIL = 2; + private PageContext parent; + private String header; + private CSSNumericValue headerHeight; + private String footer; + private CSSNumericValue footerHeight; + private int keepTogether; + private Integer columnCount = null; + private boolean sectionOpen; + + public PageContext() + { + this(null); + } + + public PageContext(final PageContext parent) + { + this.parent = parent; + if (parent != null) + { + this.keepTogether = parent.getKeepTogether(); + } + } + + public int getActiveColumns() + { + PageContext pc = this; + while (pc != null) + { + // TODO: IS this code correct? Why not columnCount = pc.getColumnCount(); ? + if (columnCount != null) + { + return columnCount.intValue(); + } + pc = pc.getParent(); + } + return 1; + } + + public void setColumnCount(final Integer columnCount) + { + this.columnCount = columnCount; + } + + public Integer getColumnCount() + { + return columnCount; + } + + public String getHeader() + { + return header; + } + + public void setHeader(final String header, final CSSNumericValue height) + { + this.header = header; + this.headerHeight = height; + } + + public String getFooter() + { + return footer; + } + + public CSSNumericValue getHeaderHeight() + { + return headerHeight; + } + + public CSSNumericValue getFooterHeight() + { + return footerHeight; + } + + public void setFooter(final String footer, final CSSNumericValue height) + { + this.footer = footer; + this.footerHeight = height; + } + + public int getKeepTogether() + { + return keepTogether; + } + + public void setKeepTogether(final int keepTogether) + { + this.keepTogether = keepTogether; + } + + public PageContext getParent() + { + return parent; + } + + public CSSNumericValue getAllFooterSize() + { + if (parent == null) + { + return footerHeight; + } + + final LengthCalculator lnc = new LengthCalculator(); + PageContext pc = this; + while (pc != null) + { + lnc.add(pc.getFooterHeight()); + pc = pc.getParent(); + } + return lnc.getResult(); + } + + public CSSNumericValue getAllHeaderSize() + { + if (parent == null) + { + return headerHeight; + } + + final LengthCalculator lnc = new LengthCalculator(); + PageContext pc = this; + while (pc != null) + { + lnc.add(pc.getHeaderHeight()); + pc = pc.getParent(); + } + return lnc.getResult(); + } + + public String getPageFooterContent() + { + if (parent == null) + { + return getFooter(); + } + + final StringBuffer b = new StringBuffer(); + + PageContext pc = this; + while (pc != null) + { + final String footer_ = pc.getFooter(); + if (footer_ != null) + { + b.append(footer_); + } + pc = pc.getParent(); + } + + if (b.length() != 0) + { + return b.toString(); + } + return null; + } + + public String getPageHeaderContent() + { + if (parent == null) + { + return getHeader(); + } + + 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(); + } + + if (b.length() != 0) + { + return b.toString(); + } + return null; + } + + public boolean isSectionOpen() + { + return sectionOpen; + } + + public void setSectionOpen(final boolean sectionOpen) + { + this.sectionOpen = sectionOpen; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java new file mode 100644 index 000000000000..16374193aec8 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java @@ -0,0 +1,117 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TextRawReportProcessor.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.output.text; + +import com.sun.star.report.DataSourceFactory; +import com.sun.star.report.OutputRepository; +import com.sun.star.report.InputRepository; +import com.sun.star.report.ImageService; +import com.sun.star.report.pentaho.PentahoFormulaContext; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.data.ReportContextImpl; +import org.jfree.report.flow.ReportContext; +import org.jfree.report.flow.ReportJob; +import org.jfree.report.flow.ReportStructureRoot; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.SinglePassReportProcessor; +import org.pentaho.reporting.libraries.resourceloader.ResourceManager; + +/** + * Creation-Date: 03.07.2006, 17:08:25 + * + * @author Thomas Morgner + */ +public class TextRawReportProcessor extends SinglePassReportProcessor +{ + + private final OutputRepository outputRepository; + private final String targetName; + private final InputRepository inputRepository; + private final ImageService imageService; + private final DataSourceFactory dataSourceFactory; + + public TextRawReportProcessor(final InputRepository inputRepository, + final OutputRepository outputRepository, + final String targetName, + final ImageService imageService, + final DataSourceFactory dataSourceFactory) + { + if (inputRepository == null) + { + throw new NullPointerException(); + } + if (outputRepository == null) + { + throw new NullPointerException(); + } + if (targetName == null) + { + throw new NullPointerException(); + } + if (imageService == null) + { + throw new NullPointerException(); + } + if (dataSourceFactory == null) + { + throw new NullPointerException(); + } + + this.targetName = targetName; + this.inputRepository = inputRepository; + this.outputRepository = outputRepository; + this.imageService = imageService; + this.dataSourceFactory = dataSourceFactory; + } + + protected ReportTarget createReportTarget(final ReportJob job) + throws ReportProcessingException + { + final ReportStructureRoot report = job.getReportStructureRoot(); + final ResourceManager resourceManager = report.getResourceManager(); + + return new TextRawReportTarget(job, resourceManager, report.getBaseResource(), + inputRepository, outputRepository, targetName, imageService, dataSourceFactory); + } + + protected ReportContext createReportContext(final ReportJob job, + final ReportTarget target) + { + final ReportContext context = super.createReportContext(job, target); + if (context instanceof ReportContextImpl) + { + final ReportContextImpl impl = (ReportContextImpl) context; + impl.setFormulaContext(new PentahoFormulaContext(impl.getFormulaContext(),job.getConfiguration())); + } + return context; + } +} + + 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 new file mode 100644 index 000000000000..28999ebac793 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java @@ -0,0 +1,1517 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TextRawReportTarget.java,v $ + * $Revision: 1.9 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.output.text; + +import com.sun.star.report.DataSourceFactory; +import java.io.IOException; +import java.io.OutputStream; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.util.Iterator; +import java.util.Map; + +import com.sun.star.report.ImageService; +import com.sun.star.report.InputRepository; +import com.sun.star.report.OutputRepository; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.PentahoReportEngineMetaData; +import com.sun.star.report.pentaho.layoutprocessor.FormatValueUtility; +import com.sun.star.report.pentaho.model.OfficeMasterPage; +import com.sun.star.report.pentaho.model.OfficeMasterStyles; +import com.sun.star.report.pentaho.model.OfficeStyle; +import com.sun.star.report.pentaho.model.OfficeStyles; +import com.sun.star.report.pentaho.model.OfficeStylesCollection; +import com.sun.star.report.pentaho.model.PageSection; +import com.sun.star.report.pentaho.output.OfficeDocumentReportTarget; +import com.sun.star.report.pentaho.output.StyleUtilities; +import com.sun.star.report.pentaho.styles.LengthCalculator; +import java.util.ArrayList; +import org.jfree.layouting.input.style.values.CSSNumericValue; +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.DataSourceException; +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.flow.ReportJob; +import org.jfree.report.flow.ReportStructureRoot; +import org.jfree.report.flow.ReportTargetUtil; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; +import org.jfree.report.util.AttributeNameGenerator; +import org.jfree.report.util.IntegerCache; +import org.pentaho.reporting.libraries.base.util.FastStack; +import org.pentaho.reporting.libraries.base.util.IOUtils; +import org.pentaho.reporting.libraries.base.util.ObjectUtilities; +import org.pentaho.reporting.libraries.resourceloader.ResourceKey; +import org.pentaho.reporting.libraries.resourceloader.ResourceManager; +import org.pentaho.reporting.libraries.xmlns.common.AttributeList; +import org.pentaho.reporting.libraries.xmlns.writer.XmlWriter; +import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport; + +/** + * Creation-Date: 03.07.2006, 16:28:00 + * + * @author Thomas Morgner + */ +public class TextRawReportTarget extends OfficeDocumentReportTarget +{ + + private static final String ALWAYS = "always"; + private static final String KEEP_TOGETHER = "keep-together"; + private static final String KEEP_WITH_NEXT = "keep-with-next"; + private static final String MAY_BREAK_BETWEEN_ROWS = "may-break-between-rows"; + private static final String NAME = "name"; + private static final String NONE = "none"; + private static final String NORMAL = "normal"; + private static final String PARAGRAPH_PROPERTIES = "paragraph-properties"; + private static final String STANDARD = "Standard"; + private static final String TABLE_PROPERTIES = "table-properties"; + 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; + private static final int CP_NEXT_TABLE = 2; + + // This is the initial state of the detail-band processing. It states, that we are now waiting for a + // detail-band to be printed. + private static final int DETAIL_SECTION_WAIT = 0; + // The first detail section has started. + private static final int DETAIL_SECTION_FIRST_STARTED = 1; + // The first detail section has been printed. + private static final int DETAIL_SECTION_FIRST_PRINTED = 2; + // An other detail section has started + private static final int DETAIL_SECTION_OTHER_STARTED = 3; + // The other detail section has been printed. + private static final int DETAIL_SECTION_OTHER_PRINTED = 4; + private boolean pageFooterOnReportFooter; + private boolean pageFooterOnReportHeader; + private boolean pageHeaderOnReportFooter; + private boolean pageHeaderOnReportHeader; + private int contentProcessingState; + private OfficeMasterPage currentMasterPage; + private final FastStack activePageContext; + private MasterPageFactory masterPageFactory; + private LengthCalculator sectionHeight; + private String variables; + private PageBreakDefinition pageBreakDefinition; + private VariablesDeclarations variablesDeclarations; + private boolean columnBreakPending; + private boolean sectionKeepTogether; + private final AttributeNameGenerator sectionNames; + private int detailBandProcessingState; + private final int tableLayoutConfig; + private int expectedTableRowCount; + private boolean firstCellSeen; + private boolean cellEmpty; + + public TextRawReportTarget(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 + { + super(reportJob, resourceManager, baseResource, inputRepository, outputRepository, target, imageService, datasourcefactory); + activePageContext = new FastStack(); + this.sectionNames = new AttributeNameGenerator(); + + this.tableLayoutConfig = TABLE_LAYOUT_SINGLE_DETAIL_TABLE; + } + + protected String getTargetMimeType() + { + return "application/vnd.oasis.opendocument.text"; + } + + /** + * Checks, whether a manual page break should be inserted at the next possible location. + * + * @return true, if a pagebreak is pending, false otherwise. + */ + private boolean isPagebreakPending() + { + return pageBreakDefinition != null; + } + + private boolean isResetPageNumber() + { + if (pageBreakDefinition == null) + { + return false; + } + return pageBreakDefinition.isResetPageNumber(); + } + + /** + * Defines, whether a manual pagebreak should be inserted at the next possible location. + * + * @param pageBreakDefinition the new flag value. + */ + private void setPagebreakDefinition(final PageBreakDefinition pageBreakDefinition) + { + this.pageBreakDefinition = pageBreakDefinition; + } + + private PageBreakDefinition getPagebreakDefinition() + { + return pageBreakDefinition; + } + + // todo + private boolean isKeepTableWithNext() + { + final int keepTogetherState = getCurrentContext().getKeepTogether(); + if (keepTogetherState == PageContext.KEEP_TOGETHER_GROUP) + { + return true; + } + + final boolean keepWithNext; + if (keepTogetherState == PageContext.KEEP_TOGETHER_FIRST_DETAIL) + { + keepWithNext = (detailBandProcessingState == DETAIL_SECTION_WAIT); + } + else + { + keepWithNext = false; + } + return keepWithNext; + } + + private boolean isSectionPagebreakAfter(final AttributeMap attrs) + { + final Object forceNewPage = + attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "force-new-page"); + if ("after-section".equals(forceNewPage)) + { + return true; + } + if ("before-after-section".equals(forceNewPage)) + { + return true; + } + return false; + } + + private boolean isSectionPagebreakBefore(final AttributeMap attrs) + { + final Object forceNewPage = + attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "force-new-page"); + return "before-section".equals(forceNewPage) || "before-after-section".equals(forceNewPage); + } + + private PageContext getCurrentContext() + { + return (PageContext) activePageContext.peek(); + } + + private String createMasterPage(final boolean printHeader, + final boolean printFooter) + throws ReportProcessingException + { + // create the master page for the report-header. + // If there is a page-header or footer in the report that gets + // surpressed on the report-header, we have to insert a pagebreak + // afterwards. + + final String activePageFooter; + // Check, whether the report header can have a page-header + final PageContext context = getCurrentContext(); + if (printFooter) + { + activePageFooter = context.getPageFooterContent(); + } + else + { + activePageFooter = null; + } + final String activePageHeader; + if (printHeader) + { + // we have to insert a manual pagebreak after the report header. + activePageHeader = context.getPageHeaderContent(); + } + else + { + activePageHeader = null; + } + + final String masterPageName; + if (currentMasterPage == null || + !masterPageFactory.containsMasterPage(STANDARD, activePageHeader, activePageFooter)) + { + + final CSSNumericValue headerSize = context.getAllHeaderSize(); + final CSSNumericValue footerSize = context.getAllFooterSize(); + + + currentMasterPage = masterPageFactory.createMasterPage(STANDARD, activePageHeader, activePageFooter); + +// LOGGER.debug("Created a new master-page: " + currentMasterPage.getStyleName()); + + // todo: Store the page-layouts as well. + // The page layouts are derived from a common template, but as the + // header-heights differ, we have to derive these beasts instead + // of copying them + + final OfficeStylesCollection officeStylesCollection = getGlobalStylesCollection(); + final OfficeMasterStyles officeMasterStyles = officeStylesCollection.getMasterStyles(); + final String pageLayoutTemplate = currentMasterPage.getPageLayout(); + if (pageLayoutTemplate == null) + { + // there is no pagelayout. Create one .. + final String derivedLayout = masterPageFactory.createPageStyle(getGlobalStylesCollection().getAutomaticStyles(), headerSize, footerSize); + currentMasterPage.setPageLayout(derivedLayout); + } + else + { + final String derivedLayout = masterPageFactory.derivePageStyle(pageLayoutTemplate, + getPredefinedStylesCollection().getAutomaticStyles(), + getGlobalStylesCollection().getAutomaticStyles(), headerSize, footerSize); + currentMasterPage.setPageLayout(derivedLayout); + } + officeMasterStyles.addMasterPage(currentMasterPage); + masterPageName = currentMasterPage.getStyleName(); + } + else + { + // retrieve the master-page. + final OfficeMasterPage masterPage = masterPageFactory.getMasterPage(STANDARD, activePageHeader, activePageFooter); + if (ObjectUtilities.equal(masterPage.getStyleName(), currentMasterPage.getStyleName())) + { + // They are the same, + masterPageName = null; + } + else + { + // reuse the existing one .. + currentMasterPage = masterPage; + masterPageName = currentMasterPage.getStyleName(); + } + } + + // if either the pageheader or footer are *not* printed with the + // report header, then this implies that we have to insert a manual + // pagebreak at the end of the section. + + if ((!printHeader && context.getHeader() != null) || + (!printFooter && context.getFooter() != null)) + { + setPagebreakDefinition(new PageBreakDefinition(isResetPageNumber())); + } + + return masterPageName; + } + + private boolean isColumnBreakPending() + { + return columnBreakPending; + } + + private void setColumnBreakPending(final boolean columnBreakPending) + { + this.columnBreakPending = columnBreakPending; + } + + private Integer parseInt(final Object value) + { + if (value instanceof Number) + { + final Number n = (Number) value; + return IntegerCache.getInteger(n.intValue()); + } + if (value instanceof String) + { + try + { + return IntegerCache.getInteger(Integer.parseInt((String) value)); + } + catch (NumberFormatException nfe) + { + //return null; // ignore + } + } + return null; + } + + private BufferState applyColumnsToPageBand(final BufferState contents, + final int numberOfColumns) + throws IOException, ReportProcessingException + { + if (numberOfColumns <= 1) + { + return contents; + } + startBuffering(getGlobalStylesCollection(), true); + // derive section style .. + + // This is a rather cheap solution to the problem. In a sane world, we would have to feed the + // footer multiple times. Right now, we simply rely on the balacing, which should make sure that + // the column's content are evenly distributed. + final XmlWriter writer = getXmlWriter(); + final AttributeList attrs = new AttributeList(); + attrs.setAttribute(OfficeNamespaces.TEXT_NS, OfficeToken.STYLE_NAME, generateSectionStyle(numberOfColumns)); + attrs.setAttribute(OfficeNamespaces.TEXT_NS, NAME, sectionNames.generateName("Section")); + writer.writeTag(OfficeNamespaces.TEXT_NS, "section", attrs, XmlWriterSupport.OPEN); + for (int i = 0; i < numberOfColumns; i++) + { + writer.writeStream(contents.getXmlAsReader()); + } + + writer.writeCloseTag(); + return finishBuffering(); + } + + private String generateSectionStyle(final int columnCount) + { + final OfficeStyles automaticStyles = getStylesCollection().getAutomaticStyles(); + final String styleName = getAutoStyleNameGenerator().generateName("auto_section_style"); + + final Section sectionProperties = new Section(); + sectionProperties.setNamespace(OfficeNamespaces.STYLE_NS); + sectionProperties.setType("section-properties"); + sectionProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, "transparent"); + sectionProperties.setAttribute(OfficeNamespaces.TEXT_NS, "dont-balance-text-columns", OfficeToken.FALSE); + sectionProperties.setAttribute(OfficeNamespaces.STYLE_NS, "editable", OfficeToken.FALSE); + + if (columnCount > 1) + { + final Section columns = new Section(); + columns.setNamespace(OfficeNamespaces.STYLE_NS); + columns.setType("columns"); + columns.setAttribute(OfficeNamespaces.FO_NS, "column-count", String.valueOf(columnCount)); + columns.setAttribute(OfficeNamespaces.STYLE_NS, "column-gap", "0cm"); + sectionProperties.addNode(columns); + +// final Section columnSep = new Section(); +// columnSep.setNamespace(OfficeNamespaces.STYLE_NS); +// columnSep.setType("column-sep"); +// columnSep.setAttribute(OfficeNamespaces.STYLE_NS, "width", "0.035cm"); +// columnSep.setAttribute(OfficeNamespaces.STYLE_NS, "color", "#000000"); +// columnSep.setAttribute(OfficeNamespaces.STYLE_NS, "height", "100%"); +// columns.addNode(columnSep); + + for (int i = 0; i < columnCount; i++) + { + final Section column = new Section(); + column.setNamespace(OfficeNamespaces.STYLE_NS); + column.setType("column"); + column.setAttribute(OfficeNamespaces.STYLE_NS, "rel-width", "1*"); + column.setAttribute(OfficeNamespaces.FO_NS, "start-indent", "0cm"); + column.setAttribute(OfficeNamespaces.FO_NS, "end-indent", "0cm"); + columns.addNode(column); + } + } + + final OfficeStyle style = new OfficeStyle(); + style.setNamespace(OfficeNamespaces.STYLE_NS); + style.setType("style"); + style.setAttribute(OfficeNamespaces.STYLE_NS, NAME, styleName); + style.setAttribute(OfficeNamespaces.STYLE_NS, "family", "section"); + style.addNode(sectionProperties); + + automaticStyles.addStyle(style); + return styleName; + } + + /** + * Starts the output of a new office document. This method writes the generic 'office:document-content' tag along with + * all known namespace declarations. + * + * @param report the report object. + * @throws org.jfree.report.DataSourceException + * if there was an error accessing the datasource + * @throws org.jfree.report.ReportProcessingException + * if some other error occured. + */ + public void startReport(final ReportStructureRoot report) + throws DataSourceException, ReportProcessingException + { + super.startReport(report); + variablesDeclarations = new VariablesDeclarations(); + detailBandProcessingState = DETAIL_SECTION_WAIT; + sectionNames.reset(); + + pageFooterOnReportFooter = false; + pageFooterOnReportHeader = false; + pageHeaderOnReportFooter = false; + pageHeaderOnReportHeader = false; + contentProcessingState = TextRawReportTarget.CP_SETUP; + + activePageContext.clear(); + activePageContext.push(new PageContext()); + + final OfficeStylesCollection predefStyles = getPredefinedStylesCollection(); + masterPageFactory = new MasterPageFactory(predefStyles.getMasterStyles()); + + predefStyles.getAutomaticStyles().addStyle(createVariablesStyle(true)); + predefStyles.getAutomaticStyles().addStyle(createVariablesStyle(false)); + } + + private OfficeStyle createVariablesStyle(final boolean keepWithNext) + { + final OfficeStyle variablesSectionStyle = new OfficeStyle(); + variablesSectionStyle.setStyleFamily(OfficeToken.PARAGRAPH); + if (keepWithNext) + { + variablesSectionStyle.setStyleName(TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT); + } + else + { + variablesSectionStyle.setStyleName(TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITHOUT_KEEPWNEXT); + } + + final Section paragraphProps = new Section(); + paragraphProps.setNamespace(OfficeNamespaces.STYLE_NS); + paragraphProps.setType(PARAGRAPH_PROPERTIES); + paragraphProps.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, "transparent"); + paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "text-align", "start"); + paragraphProps.setAttribute(OfficeNamespaces.FO_NS, KEEP_WITH_NEXT, ALWAYS); + paragraphProps.setAttribute(OfficeNamespaces.FO_NS, KEEP_TOGETHER, ALWAYS); + paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "vertical-align", "top"); + variablesSectionStyle.addNode(paragraphProps); + + final Section textProps = new Section(); + textProps.setNamespace(OfficeNamespaces.STYLE_NS); + textProps.setType("text-properties"); + textProps.setAttribute(OfficeNamespaces.FO_NS, "font-variant", NORMAL); + textProps.setAttribute(OfficeNamespaces.FO_NS, "text-transform", NONE); + textProps.setAttribute(OfficeNamespaces.FO_NS, "color", "#ffffff"); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-outline", OfficeToken.FALSE); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-blinking", OfficeToken.FALSE); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-line-through-style", NONE); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-line-through-mode", "continuous"); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-position", "0% 100%"); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "font-name", "Tahoma"); + textProps.setAttribute(OfficeNamespaces.FO_NS, "font-size", "1pt"); + textProps.setAttribute(OfficeNamespaces.FO_NS, "letter-spacing", NORMAL); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "letter-kerning", OfficeToken.FALSE); + textProps.setAttribute(OfficeNamespaces.FO_NS, "font-style", NORMAL); + textProps.setAttribute(OfficeNamespaces.FO_NS, "text-shadow", NONE); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-underline-style", NONE); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-underline-mode", "continuous"); + textProps.setAttribute(OfficeNamespaces.FO_NS, "font-weight", NORMAL); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-rotation-angle", "0"); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-emphasize", NONE); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-combine", NONE); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-combine-start-char", ""); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-combine-end-char", ""); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-blinking", OfficeToken.FALSE); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-scale", "100%"); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "font-relief", NONE); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-display", NONE); + variablesSectionStyle.addNode(textProps); + return variablesSectionStyle; + } + + protected void startContent(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + final XmlWriter xmlWriter = getXmlWriter(); + xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "text", null, XmlWriterSupport.OPEN); + + // now start the buffering. We have to insert the variables declaration + // later .. + startBuffering(getStylesCollection(), true); + + final Object columnCountRaw = attrs.getAttribute(OfficeNamespaces.FO_NS, "column-count"); + final Integer colCount = parseInt(columnCountRaw); + if (colCount != null) + { + final PageContext pageContext = getCurrentContext(); + pageContext.setColumnCount(colCount); + } + + } + + protected void startOther(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs); + final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs); + + if (ObjectUtilities.equal(JFreeReportInfo.REPORT_NAMESPACE, namespace)) + { + if (ObjectUtilities.equal(OfficeToken.IMAGE, elementType)) + { + startImageProcessing(attrs); + } + else if (ObjectUtilities.equal(OfficeToken.OBJECT_OLE, elementType) && getCurrentRole() != ROLE_TEMPLATE) + { + startChartProcessing(attrs); + } + return; + } + else if (isFilteredNamespace(namespace)) + { + throw new IllegalStateException("This element should be hidden: " + + namespace + ", " + elementType); + } + + if (isTableMergeActive() && detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED && ObjectUtilities.equal(OfficeNamespaces.TABLE_NS, namespace) && ObjectUtilities.equal(OfficeToken.TABLE_COLUMNS, elementType)) + { + // Skip the columns section if the tables get merged.. + startBuffering(getStylesCollection(), true); + return; + } + else + { + openSection(); + + final boolean isTableNS = ObjectUtilities.equal(OfficeNamespaces.TABLE_NS, namespace); + if (isTableNS) + { + if (ObjectUtilities.equal(OfficeToken.TABLE, elementType)) + { + startTable(attrs); + return; + } + + if (ObjectUtilities.equal(OfficeToken.TABLE_ROW, elementType)) + { + startRow(attrs); + return; + } + } + + + if (ObjectUtilities.equal(OfficeNamespaces.TEXT_NS, namespace)) + { + if (ObjectUtilities.equal("variable-set", elementType)) + { + // update the variables-declaration thingie .. + final String varName = (String) attrs.getAttribute(OfficeNamespaces.TEXT_NS, NAME); + final String varType = (String) attrs.getAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE); + final String newVarName = variablesDeclarations.produceVariable(varName, varType); + attrs.setAttribute(OfficeNamespaces.TEXT_NS, NAME, newVarName); + } + else if (ObjectUtilities.equal("variable-get", elementType)) + { + final String varName = (String) attrs.getAttribute(OfficeNamespaces.TEXT_NS, NAME); + final String varType = (String) attrs.getAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE); + final String newVarName = variablesDeclarations.produceVariable(varName, varType); + attrs.setAttribute(OfficeNamespaces.TEXT_NS, NAME, newVarName); + // this one must not be written, as the DTD does not declare it. + // attrs.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE, null); + } + } + + if (tableLayoutConfig == TABLE_LAYOUT_VARIABLES_PARAGRAPH && variables != null) + { + // This cannot happen as long as the report sections only contain tables. But at some point in the + // future they will be made of paragraphs, and then we are prepared .. + // LOGGER.debug("Variables-Section in own paragraph " + variables); + + StyleUtilities.copyStyle(OfficeToken.PARAGRAPH, + TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(), + getGlobalStylesCollection(), getPredefinedStylesCollection()); + final XmlWriter xmlWriter = getXmlWriter(); + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME, + TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.OPEN); + xmlWriter.writeText(variables); + xmlWriter.writeCloseTag(); + variables = null; + } + + if (isTableNS && ObjectUtilities.equal(OfficeToken.TABLE_CELL, elementType)) + { + cellEmpty = true; + } + + final boolean keepTogetherOnParagraph = true; + + if (keepTogetherOnParagraph) + { + 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; + final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TEXT_NS, OfficeToken.STYLE_NAME); + if (styleName == null) + { + final boolean keep = (keepTogetherState == PageContext.KEEP_TOGETHER_GROUP || expectedTableRowCount > 0) && isParentKeepTogether(); + final ArrayList propertyNameSpaces = new ArrayList(); + final ArrayList propertyNames = new ArrayList(); + final ArrayList propertyValues = new ArrayList(); + + propertyNameSpaces.add(OfficeNamespaces.FO_NS); + propertyNameSpaces.add(OfficeNamespaces.FO_NS); + propertyNames.add(KEEP_TOGETHER); + propertyValues.add(ALWAYS); + if (keep) + { + propertyNames.add(KEEP_WITH_NEXT); + propertyValues.add(ALWAYS); + } + else + { + propertyNames.add(KEEP_WITH_NEXT); + propertyValues.add(null); + } + style = StyleUtilities.queryStyleByProperties(getStylesCollection(), OfficeToken.PARAGRAPH, PARAGRAPH_PROPERTIES, propertyNameSpaces, propertyNames, propertyValues); + } + if (style == null) + { + style = deriveStyle(OfficeToken.PARAGRAPH, styleName); + // Lets set the 'keep-together' flag.. + + Element paragraphProps = style.getParagraphProperties(); + if (paragraphProps == null) + { + paragraphProps = new Section(); + paragraphProps.setNamespace(OfficeNamespaces.STYLE_NS); + paragraphProps.setType(PARAGRAPH_PROPERTIES); + style.addNode(paragraphProps); + } + paragraphProps.setAttribute(OfficeNamespaces.FO_NS, KEEP_TOGETHER, ALWAYS); + + // We prevent pagebreaks within the two adjacent rows (this one and the next one) if + // either a group-wide keep-together is defined or if we haven't reached the end of the + // current section yet. + if ((keepTogetherState == PageContext.KEEP_TOGETHER_GROUP || expectedTableRowCount > 0) && isParentKeepTogether()) + { + paragraphProps.setAttribute(OfficeNamespaces.FO_NS, KEEP_WITH_NEXT, ALWAYS); + } + } + + attrs.setAttribute(OfficeNamespaces.TEXT_NS, OfficeToken.STYLE_NAME, style.getStyleName()); + } + } + } + + if (ObjectUtilities.equal(OfficeNamespaces.DRAWING_NS, namespace) && ObjectUtilities.equal(OfficeToken.FRAME, elementType)) + { + final String styleName = (String) attrs.getAttribute(OfficeNamespaces.DRAWING_NS, OfficeToken.STYLE_NAME); + final OfficeStyle predefAutoStyle = getPredefinedStylesCollection().getAutomaticStyles().getStyle(OfficeToken.GRAPHIC, styleName); + if (predefAutoStyle != null) + { + // special ole handling + final Element graphicProperties = predefAutoStyle.getGraphicProperties(); + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, VERTICAL_POS, "from-top"); + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, HORIZONTAL_POS, "from-left"); + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "vertical-rel", "paragraph-content"); + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "horizontal-rel", "paragraph"); + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "flow-with-text", "false"); + graphicProperties.setAttribute(OfficeNamespaces.DRAWING_NS, "ole-draw-aspect", "1"); + + // attrs.setAttribute(OfficeNamespaces.DRAWING_NS, OfficeToken.STYLE_NAME, predefAutoStyle.getStyleName()); + } + } + + // process the styles as usual + performStyleProcessing(attrs); + final XmlWriter xmlWriter = getXmlWriter(); + final AttributeList attrList = buildAttributeList(attrs); + xmlWriter.writeTag(namespace, elementType, attrList, XmlWriterSupport.OPEN); + + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TEXT_NS, OfficeToken.P, attrs)) + { + cellEmpty = false; + if (tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH && variables != null) + { + //LOGGER.debug("Variables-Section in existing cell " + variables); + xmlWriter.writeText(variables); + variables = null; + } + } + } + } + + private void startRow(final AttributeMap attrs) + throws IOException, ReportProcessingException + { + firstCellSeen = false; + expectedTableRowCount -= 1; + final String rowStyle = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); + final CSSNumericValue rowHeight = computeRowHeight(rowStyle); + // LOGGER.debug("Adding row-Style: " + rowStyle + " " + rowHeight); + sectionHeight.add(rowHeight); + +// if (expectedTableRowCount > 0) +// { +// // Some other row. Create a keep-together +// +// } +// else +// { +// // This is the last row before the section will end. +// // or (in some weird cases) There is no information when the row will end. +// // Anyway, if we are here, we do not create a keep-together style on the table-row .. +// } + // process the styles as usual + performStyleProcessing(attrs); + + final AttributeList attrList = buildAttributeList(attrs); + getXmlWriter().writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_ROW, attrList, XmlWriterSupport.OPEN); + } + + private void startTable(final AttributeMap attrs) + throws ReportProcessingException, IOException + { + final Integer trc = (Integer) attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "table-row-count"); + if (trc == null) + { + expectedTableRowCount = -1; + } + else + { + expectedTableRowCount = trc.intValue(); + } + + if (isSectionPagebreakBefore(attrs)) + { + // force a pagebreak .. + setPagebreakDefinition(new PageBreakDefinition(isResetPageNumber())); + } + + // its a table. This means, it is a root-level element + final PageBreakDefinition breakDefinition; + String masterPageName = null; + final int currentRole = getCurrentRole(); + if (contentProcessingState == TextRawReportTarget.CP_FIRST_TABLE) + { + contentProcessingState = TextRawReportTarget.CP_NEXT_TABLE; + + // Processing the report header now. + if (currentRole == OfficeDocumentReportTarget.ROLE_REPORT_HEADER) + { + breakDefinition = new PageBreakDefinition(isResetPageNumber()); + masterPageName = createMasterPage(pageHeaderOnReportHeader, pageFooterOnReportHeader); + if (masterPageName == null) + { + // we should always have a master-page ... + masterPageName = currentMasterPage.getStyleName(); + } + } + else if (currentRole == OfficeDocumentReportTarget.ROLE_REPORT_FOOTER) + { + breakDefinition = new PageBreakDefinition(isResetPageNumber()); + masterPageName = createMasterPage(pageHeaderOnReportFooter, pageFooterOnReportFooter); + if (masterPageName == null && isSectionPagebreakBefore(attrs)) + { + // If we have a manual pagebreak, then activate the current master-page again. + masterPageName = currentMasterPage.getStyleName(); + } + // But we skip this (and therefore the resulting pagebreak) if there is no manual break + // and no other condition that would force an break. + } + else if (currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER || currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER) + { + breakDefinition = null; + // no pagebreaks .. + } + else if (currentMasterPage == null || + isPagebreakPending()) + { + // Must be the first table, as we have no master-page yet. + masterPageName = createMasterPage(true, true); + setPagebreakDefinition(null); + if (masterPageName == null) + { + // we should always have a master-page ... + masterPageName = currentMasterPage.getStyleName(); + } + breakDefinition = new PageBreakDefinition(isResetPageNumber()); + } + else + { + breakDefinition = null; + } + } + else if (isPagebreakPending() && + currentRole != OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER && + currentRole != OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER) + { + // Derive an automatic style for the pagebreak. +// LOGGER.debug("Manual pagebreak (within the section): " + getCurrentRole()); + breakDefinition = getPagebreakDefinition(); + setPagebreakDefinition(null); + masterPageName = createMasterPage(true, true); + if (masterPageName == null || isSectionPagebreakBefore(attrs)) + { + // If we have a manual pagebreak, then activate the current master-page again. + masterPageName = currentMasterPage.getStyleName(); + } + } + else + { + breakDefinition = null; + } + + final XmlWriter xmlWriter = getXmlWriter(); + if (detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED && + masterPageName != null) + { + // close the last table-tag, we will open a new one + xmlWriter.writeCloseTag(); + // Reset the detail-state to 'started' so that the table's columns get printed now. + detailBandProcessingState = DETAIL_SECTION_OTHER_STARTED; + } + + if (tableLayoutConfig == TABLE_LAYOUT_VARIABLES_PARAGRAPH && variables != null) + { + if (masterPageName != null) + { + // write a paragraph that uses the VARIABLES_HIDDEN_STYLE as + // primary style. Derive that one and add the manual pagebreak. + // The predefined style already has the 'keep-together' flags set. +// LOGGER.debug("Variables-Section with new Master-Page " + variables + " " + masterPageName); + + final OfficeStyle style = deriveStyle(OfficeToken.PARAGRAPH, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT); + style.setAttribute(OfficeNamespaces.STYLE_NS, "master-page-name", masterPageName); + if (breakDefinition.isResetPageNumber()) + { + final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, PARAGRAPH_PROPERTIES); + paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "page-number", "1"); + } + if (isColumnBreakPending()) + { + final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, PARAGRAPH_PROPERTIES); + paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "break-before", "column"); + setColumnBreakPending(false); + } + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME, style.getStyleName(), XmlWriterSupport.OPEN); + + masterPageName = null; + //breakDefinition = null; + } + else if (isColumnBreakPending()) + { + setColumnBreakPending(false); + + final OfficeStyle style = deriveStyle(OfficeToken.PARAGRAPH, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT); + final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, PARAGRAPH_PROPERTIES); + paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "page-number", "1"); + + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME, style.getStyleName(), XmlWriterSupport.OPEN); + } + else + { + // Write a paragraph without adding the pagebreak. We can reuse the global style, but we have to make + // sure that the style is part of the current 'auto-style' collection. +// LOGGER.debug("Variables-Section " + variables); + + StyleUtilities.copyStyle(OfficeToken.PARAGRAPH, + TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(), + getGlobalStylesCollection(), getPredefinedStylesCollection()); + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME, + TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.OPEN); + } + xmlWriter.writeText(variables); + xmlWriter.writeCloseTag(); + variables = null; + } + + final boolean keepWithNext = isKeepTableWithNext(); + final boolean localKeepTogether = OfficeToken.TRUE.equals(attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, KEEP_TOGETHER)); + final boolean tableMergeActive = isTableMergeActive(); + if (tableMergeActive) + { + this.sectionKeepTogether = localKeepTogether; + } + else + { + this.sectionKeepTogether = false; + + } + + // Check, whether we have a reason to derive a style... + if (masterPageName != null || + (!tableMergeActive && (localKeepTogether || keepWithNext)) || isColumnBreakPending()) + { + final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); + final OfficeStyle style = deriveStyle("table", styleName); + + if (masterPageName != null) + { +// LOGGER.debug("Starting a new MasterPage: " + masterPageName); + // Patch the current styles. + // This usually only happens on Table-Styles or Paragraph-Styles + style.setAttribute(OfficeNamespaces.STYLE_NS, "master-page-name", masterPageName); + if (breakDefinition.isResetPageNumber()) + { + final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, PARAGRAPH_PROPERTIES); + paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "page-number", "1"); + } + } + if (isColumnBreakPending()) + { + final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, PARAGRAPH_PROPERTIES); + paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "break-before", "column"); + setColumnBreakPending(false); + } + + // Inhibit breaks inside the table only if it has been defined and if we do not create one single + // big detail section. In that case, this flag would be invalid and would cause layout-errors. + if (!tableMergeActive) + { + if (localKeepTogether) + { + final Element tableProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, TABLE_PROPERTIES); + tableProps.setAttribute(OfficeNamespaces.STYLE_NS, MAY_BREAK_BETWEEN_ROWS, OfficeToken.FALSE); + } + } + else + { + if (detailBandProcessingState == DETAIL_SECTION_WAIT) + { + detailBandProcessingState = DETAIL_SECTION_FIRST_STARTED; + } + else if (detailBandProcessingState == DETAIL_SECTION_FIRST_PRINTED) + { + detailBandProcessingState = DETAIL_SECTION_OTHER_STARTED; + } + } + if (keepWithNext) + { + boolean addKeepWithNext = true; + if (currentRole == ROLE_GROUP_FOOTER) + { + addKeepWithNext = isParentKeepTogether(); + } + + final Element tableProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, TABLE_PROPERTIES); + tableProps.setAttribute(OfficeNamespaces.STYLE_NS, MAY_BREAK_BETWEEN_ROWS, OfficeToken.FALSE); + if (addKeepWithNext) + { + tableProps.setAttribute(OfficeNamespaces.FO_NS, KEEP_WITH_NEXT, ALWAYS); + // A keep-with-next does not work, if the may-break-betweek rows is not set to false .. + } + } + attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName()); + // no need to copy the styles, this was done while deriving the + // style .. + } + else + { + // Check, whether we may be able to skip the table. + if (tableMergeActive) + { + if (detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED) + { + // Skip the whole thing .. + return; + } + else if (detailBandProcessingState == DETAIL_SECTION_WAIT) + { + if (keepWithNext) + { + final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); + + final OfficeStyle style = deriveStyle(OfficeToken.TABLE, styleName); + final Element tableProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, TABLE_PROPERTIES); + // A keep-with-next does not work, if the may-break-betweek rows is not set to false .. + tableProps.setAttribute(OfficeNamespaces.STYLE_NS, MAY_BREAK_BETWEEN_ROWS, OfficeToken.FALSE); + final String hasGroupFooter = (String) attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "has-group-footer"); + if (hasGroupFooter != null && hasGroupFooter.equals(OfficeToken.TRUE)) + { + tableProps.setAttribute(OfficeNamespaces.FO_NS, KEEP_WITH_NEXT, ALWAYS); + } + + attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName()); + } + detailBandProcessingState = DETAIL_SECTION_FIRST_STARTED; + } + else if (detailBandProcessingState == DETAIL_SECTION_FIRST_PRINTED) + { + detailBandProcessingState = DETAIL_SECTION_OTHER_STARTED; + } + } + + // process the styles as usual + performStyleProcessing(attrs); + } + + final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs); + final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs); + final AttributeList attrList = buildAttributeList(attrs); + xmlWriter.writeTag(namespace, elementType, attrList, XmlWriterSupport.OPEN); + } + + private boolean isParentKeepTogether() + { + PageContext context = getCurrentContext(); + if (context != null) + { + context = context.getParent(); + if (context != null) + { + return context.getKeepTogether() == PageContext.KEEP_TOGETHER_GROUP; + } + } + return false; + } + + private boolean isTableMergeActive() + { + return getCurrentRole() == ROLE_DETAIL && + tableLayoutConfig == TABLE_LAYOUT_SINGLE_DETAIL_TABLE; + } + + private void openSection() + throws IOException + { + if (isRepeatingSection()) + { + // repeating sections have other ways of defining columns .. + return; + } + if (getCurrentRole() == ROLE_TEMPLATE || + getCurrentRole() == ROLE_SPREADSHEET_PAGE_HEADER || + getCurrentRole() == ROLE_SPREADSHEET_PAGE_FOOTER) + { + // the template section would break the multi-column stuff and we dont open up sections there + // anyway .. + return; + } + + final PageContext pageContext = getCurrentContext(); + final Integer columnCount = pageContext.getColumnCount(); + if (columnCount != null && !pageContext.isSectionOpen()) + { + final AttributeList attrs = new AttributeList(); + attrs.setAttribute(OfficeNamespaces.TEXT_NS, OfficeToken.STYLE_NAME, generateSectionStyle(columnCount.intValue())); + attrs.setAttribute(OfficeNamespaces.TEXT_NS, NAME, sectionNames.generateName("Section")); + getXmlWriter().writeTag(OfficeNamespaces.TEXT_NS, "section", attrs, XmlWriterSupport.OPEN); + + pageContext.setSectionOpen(true); + } + + } + + protected void startReportSection(final AttributeMap attrs, final int role) + throws IOException, DataSourceException, ReportProcessingException + { + sectionHeight = new LengthCalculator(); + if (role == OfficeDocumentReportTarget.ROLE_TEMPLATE || + role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || + role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) + { + // Start buffering with an dummy styles-collection, so that the global styles dont get polluted .. + startBuffering(new OfficeStylesCollection(), true); + } + else if (role == OfficeDocumentReportTarget.ROLE_PAGE_HEADER) + { + startBuffering(getGlobalStylesCollection(), true); + pageHeaderOnReportHeader = PageSection.isPrintWithReportHeader(attrs); + pageHeaderOnReportFooter = PageSection.isPrintWithReportFooter(attrs); + } + else if (role == OfficeDocumentReportTarget.ROLE_PAGE_FOOTER) + { + startBuffering(getGlobalStylesCollection(), true); + pageFooterOnReportHeader = PageSection.isPrintWithReportHeader(attrs); + pageFooterOnReportFooter = PageSection.isPrintWithReportFooter(attrs); + } + else if (role == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER || role == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER) + { + startBuffering(getGlobalStylesCollection(), true); + } + else if (role == OfficeDocumentReportTarget.ROLE_VARIABLES) + { + startBuffering(getGlobalStylesCollection(), false); + } + else + { + contentProcessingState = TextRawReportTarget.CP_FIRST_TABLE; + if (role == OfficeDocumentReportTarget.ROLE_GROUP_HEADER || role == OfficeDocumentReportTarget.ROLE_GROUP_FOOTER) + { + // if we have a repeating header, then skip the first one .. + // if this is a repeating footer, skip the last one. This means, + // we have to buffer all group footers and wait for the next section.. + startBuffering(getContentStylesCollection(), true); + } + + if (role != OfficeDocumentReportTarget.ROLE_DETAIL) + { + // reset the detail-state. The flag will be updated on startTable and endOther(Table) if the + // current role is ROLE_DETAIL + detailBandProcessingState = DETAIL_SECTION_WAIT; + } + } + } + + protected void startGroup(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + super.startGroup(attrs); + final PageContext pageContext = new PageContext(getCurrentContext()); + activePageContext.push(pageContext); + + final Object resetPageNumber = attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "reset-page-number"); + if (OfficeToken.TRUE.equals(resetPageNumber)) + { + setPagebreakDefinition(new PageBreakDefinition(true)); + } + + final Object keepTogether = attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, KEEP_TOGETHER); + if ("whole-group".equals(keepTogether)) + { + pageContext.setKeepTogether(PageContext.KEEP_TOGETHER_GROUP); + } + else if ("with-first-detail".equals(keepTogether) && pageContext.getKeepTogether() != PageContext.KEEP_TOGETHER_GROUP) + { + pageContext.setKeepTogether(PageContext.KEEP_TOGETHER_FIRST_DETAIL); + } + + final Object columnCountRaw = attrs.getAttribute(OfficeNamespaces.FO_NS, "column-count"); + final Integer colCount = parseInt(columnCountRaw); + if (colCount != null) + { + pageContext.setColumnCount(colCount); + } + + final Object newColumn = attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "start-new-column"); + if (OfficeToken.TRUE.equals(newColumn)) + { + setColumnBreakPending(true); + } + } + + protected void startGroupInstance(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + if (getGroupContext().isGroupWithRepeatingSection()) + { + setPagebreakDefinition(new PageBreakDefinition(isResetPageNumber())); + } + } + + protected void endGroup(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + if (getGroupContext().isGroupWithRepeatingSection()) + { + setPagebreakDefinition(new PageBreakDefinition(isResetPageNumber())); + } + + super.endGroup(attrs); + finishSection(); + + activePageContext.pop(); + } + + private void finishSection() + throws ReportProcessingException + { + final PageContext pageContext = getCurrentContext(); + if (pageContext.isSectionOpen()) + { + pageContext.setSectionOpen(false); + try + { + getXmlWriter().writeCloseTag(); + } + catch (IOException e) + { + throw new ReportProcessingException("IOError", e); + } + } + } + + protected void endReportSection(final AttributeMap attrs, final int role) + throws IOException, DataSourceException, ReportProcessingException + { + if (role == ROLE_TEMPLATE || + role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || + role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) + { + finishBuffering(); + return; + } + + final CSSNumericValue result = sectionHeight.getResult(); + if (role == OfficeDocumentReportTarget.ROLE_PAGE_HEADER) + { + final PageContext pageContext = getCurrentContext(); + pageContext.setHeader(applyColumnsToPageBand(finishBuffering(), pageContext.getActiveColumns()).getXmlBuffer(), result); + } + else if (role == OfficeDocumentReportTarget.ROLE_PAGE_FOOTER) + { + final PageContext pageContext = getCurrentContext(); + pageContext.setFooter(applyColumnsToPageBand(finishBuffering(), pageContext.getActiveColumns()).getXmlBuffer(), result); + } + else if (role == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER) + { + final PageContext pageContext = getCurrentContext(); + pageContext.setHeader(applyColumnsToPageBand(finishBuffering(), pageContext.getActiveColumns()).getXmlBuffer(), result); + } + else if (role == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER) + { + final PageContext pageContext = getCurrentContext(); + pageContext.setFooter(applyColumnsToPageBand(finishBuffering(), pageContext.getActiveColumns()).getXmlBuffer(), result); + } + else if (role == OfficeDocumentReportTarget.ROLE_VARIABLES) + { + if (variables == null) + { + variables = finishBuffering().getXmlBuffer(); + } + else + { + variables += finishBuffering().getXmlBuffer(); + } + } + else if (role == OfficeDocumentReportTarget.ROLE_GROUP_HEADER) + { + final String headerText = finishBuffering().getXmlBuffer(); + final int iterationCount = getGroupContext().getParent().getIterationCount(); + final boolean repeat = OfficeToken.TRUE.equals(attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "repeat-section")); + if (!repeat || iterationCount > 0) + { + getXmlWriter().writeText(headerText); + } + } + else if (role == OfficeDocumentReportTarget.ROLE_GROUP_FOOTER) + { + final String footerText = finishBuffering().getXmlBuffer(); + // how do we detect whether this is the last group footer? + getXmlWriter().writeText(footerText); + } + + } + + public void endReport(final ReportStructureRoot report) + throws DataSourceException, ReportProcessingException + { + super.endReport(report); + variablesDeclarations = null; + + try + { + // Write the settings .. + final AttributeList rootAttributes = new AttributeList(); + rootAttributes.addNamespaceDeclaration("office", OfficeNamespaces.OFFICE_NS); + rootAttributes.addNamespaceDeclaration("config", OfficeNamespaces.CONFIG); + rootAttributes.addNamespaceDeclaration("ooo", OfficeNamespaces.OO2004_NS); + rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.0"); + final OutputStream outputStream = getOutputRepository().createOutputStream("settings.xml", "text/xml"); + final XmlWriter xmlWriter = new XmlWriter(new OutputStreamWriter(outputStream, "UTF-8"), createTagDescription()); + xmlWriter.setAlwaysAddNamespace(true); + xmlWriter.writeXmlDeclaration("UTF-8"); + xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "document-settings", rootAttributes, XmlWriterSupport.OPEN); + xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "settings", XmlWriterSupport.OPEN); + xmlWriter.writeTag(OfficeNamespaces.CONFIG, "config-item-set", NAME, "ooo:configuration-settings", XmlWriterSupport.OPEN); + + final AttributeList configAttributes = new AttributeList(); + configAttributes.setAttribute(OfficeNamespaces.CONFIG, NAME, "TableRowKeep"); + configAttributes.setAttribute(OfficeNamespaces.CONFIG, "type", "boolean"); + xmlWriter.writeTag(OfficeNamespaces.CONFIG, "config-item", configAttributes, XmlWriterSupport.OPEN); + xmlWriter.writeText(OfficeToken.TRUE); + xmlWriter.writeCloseTag(); + + xmlWriter.writeCloseTag(); + xmlWriter.writeCloseTag(); + xmlWriter.writeCloseTag(); + xmlWriter.close(); + + // now copy the meta.xml + if (getInputRepository().isReadable("meta.xml")) + { + final InputStream inputStream = getInputRepository().createInputStream("meta.xml"); + try + { + final OutputStream outputMetaStream = getOutputRepository().createOutputStream("meta.xml", "text/xml"); + IOUtils.getInstance().copyStreams(inputStream, outputMetaStream); + outputMetaStream.close(); + } finally + { + inputStream.close(); + } + } + } + catch (IOException ioe) + { + throw new ReportProcessingException("Failed to write settings document"); + } + } + + protected void endOther(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs); + final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs); + + final boolean isInternalNS = ObjectUtilities.equal(JFreeReportInfo.REPORT_NAMESPACE, namespace); + final boolean isTableNs = ObjectUtilities.equal(OfficeNamespaces.TABLE_NS, namespace); + if (isTableMergeActive() && detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED && isTableNs && ObjectUtilities.equal(OfficeToken.TABLE_COLUMNS, elementType)) + { + finishBuffering(); + return; + } + + if (isInternalNS && (ObjectUtilities.equal(OfficeToken.IMAGE, elementType) || + ObjectUtilities.equal(OfficeToken.OBJECT_OLE, elementType))) + { + return; + } + + final XmlWriter xmlWriter = getXmlWriter(); + if (tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH && + isTableNs && ObjectUtilities.equal(OfficeToken.TABLE_CELL, elementType)) + { + if (variables != null) + { + // This cannot happen as long as the report sections only contain tables. But at some point in the + // future they will be made of paragraphs, and then we are prepared .. + //LOGGER.debug("Variables-Section " + variables); + final String tag; + if (sectionKeepTogether && expectedTableRowCount > 0) + { + tag = TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT; + } + else + { + tag = TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITHOUT_KEEPWNEXT; + } + StyleUtilities.copyStyle(OfficeToken.PARAGRAPH, + tag, getStylesCollection(), + getGlobalStylesCollection(), getPredefinedStylesCollection()); + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME, + tag, XmlWriterSupport.OPEN); + xmlWriter.writeText(variables); + xmlWriter.writeCloseTag(); + variables = null; + } + /** + // Only generate the empty paragraph, if we have to add the keep-together .. + else if (cellEmpty && expectedTableRowCount > 0 && + sectionKeepTogether && !firstCellSeen) + { + // we have no variables .. + StyleUtilities.copyStyle(OfficeToken.PARAGRAPH, + TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(), + getGlobalStylesCollection(), getPredefinedStylesCollection()); + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME, + TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.CLOSE); + } + */ + } + + if (isTableNs && (ObjectUtilities.equal(OfficeToken.TABLE_CELL, elementType) || ObjectUtilities.equal(OfficeToken.COVERED_TABLE_CELL, elementType))) + { + firstCellSeen = true; + } + if (isTableNs && ObjectUtilities.equal(OfficeToken.TABLE, elementType)) + { + if (getCurrentRole() == ROLE_DETAIL) + { + if (!isTableMergeActive()) + { + // We do not merge the detail bands, so an ordinary close will do. + xmlWriter.writeCloseTag(); + } + else if (detailBandProcessingState == DETAIL_SECTION_FIRST_STARTED) + { + final int keepTogetherState = getCurrentContext().getKeepTogether(); + if (keepTogetherState == PageContext.KEEP_TOGETHER_FIRST_DETAIL) + { + xmlWriter.writeCloseTag(); + detailBandProcessingState = DETAIL_SECTION_FIRST_PRINTED; + } + else + { + detailBandProcessingState = DETAIL_SECTION_OTHER_PRINTED; + } + } + else if (detailBandProcessingState == DETAIL_SECTION_OTHER_STARTED) + { + detailBandProcessingState = DETAIL_SECTION_OTHER_PRINTED; + } + } + else + { + xmlWriter.writeCloseTag(); + } + if (isSectionPagebreakAfter(attrs)) + { + setPagebreakDefinition(new PageBreakDefinition(false)); + } + } + else + { + xmlWriter.writeCloseTag(); + } + } + + protected void endGroupBody(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + if (tableLayoutConfig == TABLE_LAYOUT_SINGLE_DETAIL_TABLE && detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED) + { + // closes the table .. + final XmlWriter xmlWriter = getXmlWriter(); + xmlWriter.writeCloseTag(); + detailBandProcessingState = DETAIL_SECTION_WAIT; + } + + } + + protected void endContent(final AttributeMap attrs) + throws IOException, DataSourceException, ReportProcessingException + { + finishSection(); + final BufferState bodyText = finishBuffering(); + final XmlWriter writer = getXmlWriter(); + + final Map definedMappings = variablesDeclarations.getDefinedMappings(); + if (!definedMappings.isEmpty()) + { + writer.writeTag(OfficeNamespaces.TEXT_NS, "variable-decls", XmlWriterSupport.OPEN); + final Iterator mappingsIt = definedMappings.entrySet().iterator(); + while (mappingsIt.hasNext()) + { + final Map.Entry entry = (Map.Entry) mappingsIt.next(); + final AttributeList entryList = new AttributeList(); + entryList.setAttribute(OfficeNamespaces.TEXT_NS, NAME, (String) entry.getKey()); + entryList.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE, (String) entry.getValue()); + writer.writeTag(OfficeNamespaces.TEXT_NS, "variable-decl", entryList, XmlWriterSupport.CLOSE); + } + writer.writeCloseTag(); + } + + writer.writeStream(bodyText.getXmlAsReader()); + writer.setLineEmpty(true); + writer.writeCloseTag(); + } + + public String getExportDescriptor() + { + return "raw/" + PentahoReportEngineMetaData.OPENDOCUMENT_TEXT; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/VariablesDeclarations.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/VariablesDeclarations.java new file mode 100644 index 000000000000..a348fb9b67fb --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/VariablesDeclarations.java @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: VariablesDeclarations.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.output.text; + +import java.util.HashMap; +import java.util.Map; +import java.util.Iterator; + +import org.jfree.report.util.AttributeNameGenerator; + +/** + * A collection that holds all used variables. A variable is primarily keyed by + * its original name. If a variable contains more than one type, it is also + * keyed by the type. + * + * @author Thomas Morgner + * @since 26.03.2007 + */ +public class VariablesDeclarations +{ + + private final AttributeNameGenerator nameGenerator; + private final Map variables; + + public VariablesDeclarations() + { + variables = new HashMap(); + nameGenerator = new AttributeNameGenerator(); + } + + public String produceVariable(final String name, + final String type) + { + HashMap holder = (HashMap) variables.get(name); + if (holder == null) + { + holder = new HashMap(); + variables.put(name, holder); + } + + final String mapping = (String) holder.get(type); + if (mapping != null) + { + return mapping; + } + final String result = nameGenerator.generateName(name); + if (holder.isEmpty()) + { + // create the default mapping as well.. + holder.put(null, name); + holder.put("time", name); + holder.put("date", name); + holder.put("datetime", name); + holder.put("float", name); + holder.put("string", name); + holder.put("boolean", name); + } + holder.put(type, name); + return result; + } + + public Map getDefinedMappings() + { + final HashMap mappings = new HashMap(); + final Iterator vars = variables.values().iterator(); + while (vars.hasNext()) + { + final HashMap types = (HashMap) vars.next(); + final Iterator varsByType = types.entrySet().iterator(); + while (varsByType.hasNext()) + { + final Map.Entry entry = (Map.Entry) varsByType.next(); + final String type = (String) entry.getKey(); + if (type != null) + { + final String varName = (String) entry.getValue(); + mappings.put(varName, type); + } + } + } + return mappings; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/AttributeSpecification.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/AttributeSpecification.java new file mode 100644 index 000000000000..578fc4f98716 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/AttributeSpecification.java @@ -0,0 +1,61 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: AttributeSpecification.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser; + +public final class AttributeSpecification +{ + private final String namespaceUrl; + private final String attributName; + private final String mapperImplementation; + + public AttributeSpecification (String namespaceUrl, String attributName, String mapperImplementation) + { + this.namespaceUrl = namespaceUrl; + this.attributName = attributName; + this.mapperImplementation = mapperImplementation; + } + + public String getAttributName () + { + return attributName; + } + + public String getMapperImplementation () + { + return mapperImplementation; + } + + public String getNamespaceUrl () + { + return namespaceUrl; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/ElementReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/ElementReadHandler.java new file mode 100644 index 000000000000..3bfe49fc2c27 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/ElementReadHandler.java @@ -0,0 +1,92 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ElementReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser; + +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Creation-Date: 03.07.2006, 14:22:34 + * + * @author Thomas Morgner + */ +public abstract class ElementReadHandler extends AbstractXmlReadHandler +{ + + public ElementReadHandler() + { + } + + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) throws SAXException + { + final Element element = getElement(); + copyElementType(element); + copyAttributes(attrs, element); + } + + protected void copyElementType(final Element element) + { + element.setType(getTagName()); + element.setNamespace(getUri()); + } + + protected void copyAttributes(final Attributes attrs, final Element element) + { + final int length = attrs.getLength(); + for (int i = 0; i < length; i++) + { + final String value = attrs.getValue(i); + final String namespace = attrs.getURI(i); + final String attr = attrs.getLocalName(i); + element.setAttribute(namespace, attr, value); + } + } + + /** + * Returns the object for this element or null, if this element does not + * create an object. + * + * @return the object. + */ + public Object getObject() throws SAXException + { + return getElement(); + } + + public abstract Element getElement(); +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java new file mode 100644 index 000000000000..29e316f3be4c --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java @@ -0,0 +1,56 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeDocumentXmlResourceFactory.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser; + +import com.sun.star.report.pentaho.model.OfficeDocument; +import org.jfree.report.modules.factories.report.base.JFreeReportXmlResourceFactory; + +/** + * A LibLoader resource factory for OfficeDocument objects. OfficeDocuments are + * JFreeReport instances which have some additional properties. + * + * @author Thomas Morgner + * @since 09.03.2007 + */ +public class OfficeDocumentXmlResourceFactory extends JFreeReportXmlResourceFactory +{ + + public OfficeDocumentXmlResourceFactory() + { + } + + public Class getFactoryType() + { + return OfficeDocument.class; + } + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java new file mode 100644 index 000000000000..85bbab40a1a7 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java @@ -0,0 +1,190 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeParserUtil.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser; + +import java.util.Iterator; +import java.util.Properties; +import java.util.Map; +import java.util.HashMap; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jfree.report.JFreeReportBoot; +import org.jfree.layouting.namespace.NamespaceDefinition; +import org.jfree.layouting.namespace.Namespaces; +import org.pentaho.reporting.libraries.base.config.DefaultConfiguration; +import org.pentaho.reporting.libraries.resourceloader.Resource; +import org.pentaho.reporting.libraries.resourceloader.ResourceException; +import org.pentaho.reporting.libraries.resourceloader.ResourceManager; + +public class OfficeParserUtil +{ + private static final Log LOGGER = LogFactory.getLog(OfficeParserUtil.class); + private static OfficeParserUtil instance; + private static final String NAMESPACES_PREFIX = "namespaces."; + + public static synchronized OfficeParserUtil getInstance() + { + if (instance == null) + { + instance = new OfficeParserUtil(); + } + return instance; + } + private final DefaultConfiguration props; + private final NamespaceDefinition[] namespaces; + + private OfficeParserUtil() + { + props = new DefaultConfiguration(); + + final ResourceManager resourceManager = new ResourceManager(); + resourceManager.registerDefaults(); + try + { + final Resource res = resourceManager.createDirectly("res://com/sun/star/report/pentaho/parser/selectors.properties", Properties.class); + final Properties resProps = (Properties) res.getResource(); + props.putAll(resProps); + } + catch (ResourceException e) + { + LOGGER.warn("Unable to load mapping rules. Parsing services may not be available.", e); + } + + namespaces = Namespaces.createFromConfig(JFreeReportBoot.getInstance().getGlobalConfig(), + "org.jfree.report.namespaces.", resourceManager); + } + + public NamespaceDefinition getNamespaceDeclaration(final String uri) + { + if (uri == null) + { + throw new NullPointerException("URI must not be null"); + } + + for (int i = 0; i < namespaces.length; i++) + { + final NamespaceDefinition definition = namespaces[i]; + if (uri.equals(definition.getURI())) + { + return definition; + } + } + return null; + } + + public String getGenericFont(final String officeFont) + { + return props.getProperty("font-family." + officeFont.toLowerCase(), officeFont); + } + + public String getNamespaceURI(final String namespacePrefix) + { + return props.getProperty(NAMESPACES_PREFIX + namespacePrefix); + } + + public String getNamespaceForStyleFamily(final String styleFamily) + { + return props.getProperty("style-family." + styleFamily); + } + + public Map getNamespaces() + { + final Map map = new HashMap(); + final Iterator keys = props.findPropertyKeys(NAMESPACES_PREFIX); + while (keys.hasNext()) + { + final String key = (String) keys.next(); + final String value = props.getConfigProperty(key); + map.put(key.substring(NAMESPACES_PREFIX.length()), value); + } + return map; + } + + public String getNamespacePrefix(final String namespaceURI) + { + final Iterator keys = props.findPropertyKeys(NAMESPACES_PREFIX); + while (keys.hasNext()) + { + final String key = (String) keys.next(); + final String value = props.getConfigProperty(key); + if (namespaceURI.equals(value)) + { + return key.substring(NAMESPACES_PREFIX.length()); + } + } + return null; + } + + public AttributeSpecification parseStyleAttrDefinition(final String key, final String prefix, final String tagname) + { + final String configPrefix = "attr." + prefix + "." + tagname + "."; + final String configSuffix = key.substring(configPrefix.length()); + final int dotPosition = configSuffix.indexOf('.'); + if (dotPosition == -1) + { + return null; + } + final String namespaceUri = getNamespaceURI(configSuffix.substring(0, dotPosition)); + final String attrName = configSuffix.substring(dotPosition + 1); + final String value = props.getProperty(key); + return new AttributeSpecification(namespaceUri, attrName, value); + } + + public Iterator findStylesForElement(final String prefix, + final String tagname) + { + final String configPrefix = "attr." + prefix + "." + tagname + "."; + return props.findPropertyKeys(configPrefix); + } + + public boolean isValidStyleElement(final String uri, final String tagName) + { + final String prefix = getNamespacePrefix(uri); + if (prefix == null) + { + return false; + } + + final Iterator stylesForElement = findStylesForElement(prefix, tagName); + return stylesForElement.hasNext(); + } + + public String getSelectorPattern() + { + return props.getConfigProperty("style-selector.pattern"); + } + + public static void main(final String[] args) + { + JFreeReportBoot.getInstance().start(); + System.out.print(OfficeParserUtil.getInstance().getNamespaces()); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java new file mode 100644 index 000000000000..50aaf2e0ca40 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java @@ -0,0 +1,64 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeStylesXmlResourceFactory.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser; + +import com.sun.star.report.pentaho.model.OfficeStylesCollection; +import org.jfree.report.JFreeReportBoot; +import org.pentaho.reporting.libraries.base.config.Configuration; +import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlResourceFactory; + +/** + * A LibLoader resource factory for loading an OfficeStyles-collection. This + * implementation is meant to parse the 'styles.xml' file. + * + * @author Thomas Morgner + * @since 09.03.2007 + */ +public class OfficeStylesXmlResourceFactory extends AbstractXmlResourceFactory +{ + + public OfficeStylesXmlResourceFactory() + { + } + + + protected Configuration getConfiguration() + { + return JFreeReportBoot.getInstance().getGlobalConfig(); + } + + public Class getFactoryType() + { + return OfficeStylesCollection.class; + } + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java new file mode 100644 index 000000000000..b698a73dcc8e --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StarStyleXmlFactoryModule.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.parser.office.DocumentStylesReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo; +import org.pentaho.reporting.libraries.xmlns.parser.XmlFactoryModule; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + +public class StarStyleXmlFactoryModule implements XmlFactoryModule +{ + public StarStyleXmlFactoryModule() + { + } + + public XmlReadHandler createReadHandler (final XmlDocumentInfo documentInfo) + { + return new DocumentStylesReadHandler(); + } + + public int getDocumentSupport (final XmlDocumentInfo documentInfo) + { + final String rootNamespace = documentInfo.getRootElementNameSpace(); + if (OfficeNamespaces.OFFICE_NS.equals(rootNamespace) && "document-styles".equals(documentInfo.getRootElement()) ) + { + return XmlFactoryModule.RECOGNIZED_BY_NAMESPACE; + } + return XmlFactoryModule.NOT_RECOGNIZED; + } + + public String getDefaultNamespace(final XmlDocumentInfo documentInfo) + { + return null; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java new file mode 100644 index 000000000000..261ee5a285ce --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StarXmlFactoryModule.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser; + +import com.sun.star.report.pentaho.parser.office.DocumentContentReadHandler; +import com.sun.star.report.pentaho.OfficeNamespaces; +import org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo; +import org.pentaho.reporting.libraries.xmlns.parser.XmlFactoryModule; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + +public class StarXmlFactoryModule implements XmlFactoryModule +{ + + public StarXmlFactoryModule() + { + } + + public XmlReadHandler createReadHandler(final XmlDocumentInfo documentInfo) + { + return new DocumentContentReadHandler(); + } + + public int getDocumentSupport(final XmlDocumentInfo documentInfo) + { + final String rootNamespace = documentInfo.getRootElementNameSpace(); + if (OfficeNamespaces.OFFICE_NS.equals(rootNamespace) && + ("document-content".equals(documentInfo.getRootElement()) || "document".equals(documentInfo.getRootElement()))) + { + return XmlFactoryModule.RECOGNIZED_BY_NAMESPACE; + } + return XmlFactoryModule.NOT_RECOGNIZED; + } + + public String getDefaultNamespace(final XmlDocumentInfo documentInfo) + { + return 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 new file mode 100644 index 000000000000..c3c8013b3fff --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/StyleMapper.java @@ -0,0 +1,42 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StyleMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser; + +import org.jfree.layouting.input.style.CSSDeclarationRule; + +public interface StyleMapper +{ + public 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/chart/ChartReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/chart/ChartReadHandler.java new file mode 100644 index 000000000000..5e98fe9f3622 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/chart/ChartReadHandler.java @@ -0,0 +1,112 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ChartReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.chart; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import java.util.ArrayList; + +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.parser.rpt.DetailRootTableReadHandler; +import com.sun.star.report.pentaho.parser.rpt.ReportReadHandler; +import com.sun.star.report.pentaho.parser.text.TextContentReadHandler; +import java.util.List; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * + * @author Ocke Janssen + */ +public class ChartReadHandler extends ElementReadHandler +{ + + private final Section element; + private final List children; + private final ReportReadHandler reportHandler; + + public ChartReadHandler(ReportReadHandler reportHandler) + { + this.reportHandler = reportHandler; + children = new ArrayList(); + element = new Section(); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if ("detail".equals(tagName)) + { + final DetailRootTableReadHandler detail = new DetailRootTableReadHandler(); + reportHandler.setDetail(detail); + return detail; + } + else if ("p".equals(tagName) && OfficeNamespaces.TEXT_NS.equals(uri)) + { + final TextContentReadHandler readHandler = new TextContentReadHandler(); + children.add(readHandler); + return readHandler; + } + final ChartReadHandler erh = new ChartReadHandler(reportHandler); + children.add(erh); + return erh; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException + { + for (int i = 0; i < children.size(); i++) + { + final ElementReadHandler handler = (ElementReadHandler) children.get(i); + element.addNode(handler.getElement()); + } + } + + public Element getElement() + { + return element; + } +} 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 new file mode 100644 index 000000000000..eaf6d4a2d7b8 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/data/DataStyleReadHandler.java @@ -0,0 +1,129 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: DataStyleReadHandler.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.data; + +import java.util.ArrayList; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.DataStyle; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import java.util.List; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.StaticText; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +public class DataStyleReadHandler extends ElementReadHandler +{ + + private final DataStyle dataStyle; + private final List children; + private final boolean hasCData; + + public DataStyleReadHandler(final boolean hasCData) + { + this.hasCData = hasCData; + this.dataStyle = new DataStyle(); + this.children = new ArrayList(); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.DATASTYLE_NS.equals(uri) || OfficeNamespaces.STYLE_NS.equals(uri)) + { + final DataStyleReadHandler xrh = new DataStyleReadHandler("text".equals(tagName) || "currency-symbol".equals(tagName)); + children.add(xrh); + return xrh; + } + + return null; + } + + /** + * This method is called to process the character data between element tags. + * + * @param ch the character buffer. + * @param start the start index. + * @param length the length. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + public void characters(final char[] ch, final int start, final int length) + throws SAXException + { + if (hasCData) + { + children.add(new StaticText(new String(ch, start, length))); + } + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException + { + for (int i = 0; i < children.size(); i++) + { + final Object o = children.get(i); + if (o instanceof ElementReadHandler) + { + final ElementReadHandler handler = (ElementReadHandler) o; + dataStyle.addNode(handler.getElement()); + } + else if (o instanceof StaticText) + { + dataStyle.addNode((StaticText) o); + } + } + } + + public DataStyle getDataStyle() + { + return dataStyle; + } + + public Element getElement() + { + return dataStyle; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java new file mode 100644 index 000000000000..77e28ccab6ee --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java @@ -0,0 +1,84 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ObjectOleReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.draw; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.ObjectOleElement; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import org.jfree.report.structure.Element; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * + * @author Ocke Janssen + */ +public class ObjectOleReadHandler extends ElementReadHandler +{ + + private final static String RPT_CHART_CLASS_ID = "80243D39-6741-46C5-926E-069164FF87BB"; + private final static String OOO_CHART_CLASS_ID = "12DCAE26-281F-416F-A234-C3086127382E"; + private final ObjectOleElement element; + + public ObjectOleReadHandler(final ObjectOleElement element) + { + this.element = element; + } + + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) throws SAXException + { + super.startParsing(attrs); + + final String url = attrs.getValue(OfficeNamespaces.XLINK_NS, "href"); + if (url != null) + { + element.setUrl(url); + } + + String classid = attrs.getValue(OfficeNamespaces.DRAWING_NS, "class-id"); + if (classid != null) + { + if ( classid.equalsIgnoreCase(RPT_CHART_CLASS_ID)) + classid = OOO_CHART_CLASS_ID; + element.setClassId(classid); + } + } + + public Element getElement() + { + return element; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/BodyReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/BodyReadHandler.java new file mode 100644 index 000000000000..acb6a9e5da2b --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/BodyReadHandler.java @@ -0,0 +1,91 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: BodyReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.office; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.parser.rpt.ReportReadHandler; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +public class BodyReadHandler extends ElementReadHandler +{ + + private ElementReadHandler reportReadHandler; + private final Section body; + + public BodyReadHandler() + { + body = new Section(); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.OFFICE_NS.equals(uri) && "report".equals(tagName)) + { + reportReadHandler = new ReportReadHandler(); + return reportReadHandler; + } + + return null; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException + { + if (reportReadHandler != null) + { + body.addNode(reportReadHandler.getElement()); + } + } + + public Element getElement() + { + return body; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java new file mode 100644 index 000000000000..9d1b4e1a9d14 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java @@ -0,0 +1,234 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: DocumentContentReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.office; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.OfficeDocument; +import com.sun.star.report.pentaho.model.OfficeStylesCollection; +import com.sun.star.report.pentaho.parser.style.OfficeStylesReadHandler; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jfree.report.JFreeReport; +import org.pentaho.reporting.libraries.resourceloader.Resource; +import org.pentaho.reporting.libraries.resourceloader.ResourceException; +import org.pentaho.reporting.libraries.resourceloader.ResourceKey; +import org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException; +import org.pentaho.reporting.libraries.resourceloader.ResourceManager; +import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * This is the root handler for the document context. The + * 'office:document-context' element is encountered, if the document is split + * into separate files. + *

+ * Alternativly, there is the option to keep everything in one file. The root + * element for that format is 'office:document'. + */ +public class DocumentContentReadHandler extends AbstractXmlReadHandler +{ + private static final Log LOGGER = LogFactory.getLog(DocumentContentReadHandler.class); + private OfficeDocument report; + private FontFaceDeclsReadHandler fontFaceReadHandler; + private BodyReadHandler bodyReadHandler; + private OfficeStylesCollection officeStylesCollection; + + public DocumentContentReadHandler() + { + } + + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) + throws SAXException + { + super.startParsing(attrs); + // parse the external 'styles.xml' if it exists + // parse the external 'meta.xml' if it exists + // parse the external 'settings.xml' if it exists + this.report = parseContentXml(); + this.report.setVirtual(true); + this.report.setType("document-content"); + this.report.setNamespace(OfficeNamespaces.OFFICE_NS); + this.report.setVirtual(true); + this.officeStylesCollection = parseStylesXml(); + } + + private OfficeStylesCollection parseStylesXml() + { + final ResourceKey contextKey = getRootHandler().getContext(); + final ResourceManager resourceManager = getRootHandler().getResourceManager(); + + try + { + final ResourceKey key = + resourceManager.deriveKey(contextKey, "styles.xml"); + final Resource resource = + resourceManager.create(key, contextKey, OfficeStylesCollection.class); + final OfficeStylesCollection styles = + (OfficeStylesCollection) resource.getResource(); + if (styles != null) + { + return styles; + } + } + catch (ResourceKeyCreationException e) + { + // ignore .. + LOGGER.debug("Failed to create resource-key for 'styles.xml'. Ignoring.", e); + } + catch (ResourceException e) + { + // ignore .. + LOGGER.debug("Failed to parse resource for 'styles.xml'. Ignoring.", e); + } + + return new OfficeStylesCollection(); + } + + private OfficeDocument parseContentXml() + { + // Check whether this is a content.xml. + if (!OfficeNamespaces.OFFICE_NS.equals(getUri()) || "document-content".equals(getTagName())) + { + return new OfficeDocument(); + } + + // we may have to parse an existing content.xml. + final ResourceKey contextKey = getRootHandler().getContext(); + final ResourceManager resourceManager = getRootHandler().getResourceManager(); + try + { + final ResourceKey key = + resourceManager.deriveKey(contextKey, "content.xml"); + final Resource resource = + resourceManager.create(key, contextKey, JFreeReport.class); + final OfficeDocument doc = (OfficeDocument) resource.getResource(); + if (doc != null) + { + return doc; + } + } + catch (ResourceKeyCreationException e) + { + // ignore .. + LOGGER.debug("Failed to create resource-key for 'content.xml'. Ignoring."); + } + catch (ResourceException e) + { + // ignore .. + LOGGER.debug("Failed to parse resource for 'content.xml'. Ignoring."); + } + return new OfficeDocument(); + + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.OFFICE_NS.equals(uri)) + { + if ("font-face-decls".equals(tagName)) + { + if (fontFaceReadHandler == null) + { + fontFaceReadHandler = new FontFaceDeclsReadHandler(officeStylesCollection.getFontFaceDecls()); + } + return fontFaceReadHandler; + } + else if ("automatic-styles".equals(tagName)) + { + return new OfficeStylesReadHandler(officeStylesCollection.getAutomaticStyles()); + } + else if ("styles".equals(tagName)) + { + return new OfficeStylesReadHandler(officeStylesCollection.getCommonStyles()); + } + else if ("master-styles".equals(tagName)) + { + return new MasterStylesReadHandler(officeStylesCollection.getMasterStyles()); + } + else if ("body".equals(tagName)) + { + bodyReadHandler = new BodyReadHandler(); + return bodyReadHandler; + } + } + return null; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() + throws SAXException + { + // The office-document is the only node of the report. It allows us to + // switch the layout-processing implementation later on. + + report.setStylesCollection(officeStylesCollection); + + if (bodyReadHandler != null) + { + report.addNode(bodyReadHandler.getElement()); + } + } + + /** + * Returns the object for this element or null, if this element does not + * create an object. + * + * @return the object. + */ + public Object getObject() + throws SAXException + { + return report; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java new file mode 100644 index 000000000000..33591203573f --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: DocumentStylesReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.office; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.OfficeStylesCollection; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.parser.style.OfficeStylesReadHandler; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * The root parser for a 'styles.xml' document. This generates the global + * (or common) style collection. These styles contain the named common styles + * and the page layouts. + * + * @author Thomas Morgner + * @since 08.03.2007 + */ +public class DocumentStylesReadHandler extends ElementReadHandler +{ + private final OfficeStylesCollection officeStylesCollection; + private FontFaceDeclsReadHandler fontFaceReadHandler; + + public DocumentStylesReadHandler() + { + officeStylesCollection = new OfficeStylesCollection(); + } + + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (!OfficeNamespaces.OFFICE_NS.equals(uri)) + { + return null; + } + + if ("font-face-decls".equals(tagName)) + { + if (fontFaceReadHandler == null) + { + fontFaceReadHandler = new FontFaceDeclsReadHandler + (officeStylesCollection.getFontFaceDecls()); + } + return fontFaceReadHandler; + } + else if ("automatic-styles".equals(tagName)) + { + return new OfficeStylesReadHandler(officeStylesCollection.getAutomaticStyles()); + } + else if ("styles".equals(tagName)) + { + return new OfficeStylesReadHandler(officeStylesCollection.getCommonStyles()); + } + else if ("master-styles".equals(tagName)) + { + return new MasterStylesReadHandler(officeStylesCollection.getMasterStyles()); + } + return null; + } + + + public Element getElement() + { + return officeStylesCollection; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java new file mode 100644 index 000000000000..c11bf6385bc9 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java @@ -0,0 +1,119 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FontFaceDeclsReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.office; + +import java.util.ArrayList; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.FontFaceDeclsSection; +import com.sun.star.report.pentaho.model.FontFaceElement; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.parser.style.FontFaceReadHandler; +import java.util.List; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Reads the font-face declarations section. This one can only contain + * font-face elements. + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class FontFaceDeclsReadHandler extends ElementReadHandler +{ + private final FontFaceDeclsSection fontFaceDecls; + private final List fontFaceReadHandlers; + + public FontFaceDeclsReadHandler(final FontFaceDeclsSection fontFaceDecls) + { + this.fontFaceDecls = fontFaceDecls; + this.fontFaceReadHandlers = new ArrayList(); + } + + public FontFaceDeclsSection getFontFaceDecls() + { + return fontFaceDecls; + } + + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (!OfficeNamespaces.STYLE_NS.equals(uri) ) + { + return null; + } + + if ("font-face".equals(tagName)) + { + final FontFaceReadHandler frh = new FontFaceReadHandler(); + fontFaceReadHandlers.add(frh); + return frh; + } + return null; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() + throws SAXException + { + for (int i = 0; i < fontFaceReadHandlers.size(); i++) + { + final FontFaceReadHandler handler = (FontFaceReadHandler) fontFaceReadHandlers.get(i); + fontFaceDecls.addFontFace((FontFaceElement) handler.getElement()); + } + } + + public Element getElement() + { + return fontFaceDecls; + } + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/MasterStylesReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/MasterStylesReadHandler.java new file mode 100644 index 000000000000..deed7bdc0d84 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/MasterStylesReadHandler.java @@ -0,0 +1,124 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: MasterStylesReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.office; + +import java.util.ArrayList; + +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.parser.style.StyleDefinitionReadHandler; +import com.sun.star.report.pentaho.parser.style.MasterPageReadHandler; +import com.sun.star.report.pentaho.model.OfficeMasterStyles; +import com.sun.star.report.pentaho.OfficeNamespaces; +import java.util.List; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class MasterStylesReadHandler extends ElementReadHandler +{ + + private final OfficeMasterStyles masterStyles; + private final List otherHandlers; + private final List masterPageHandlers; + + public MasterStylesReadHandler(final OfficeMasterStyles masterStyles) + { + this.masterStyles = masterStyles; + this.masterPageHandlers = new ArrayList(); + this.otherHandlers = new ArrayList(); + } + + public OfficeMasterStyles getMasterStyles() + { + return masterStyles; + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.STYLE_NS.equals(uri) && "master-page".equals(tagName)) + { + final MasterPageReadHandler mrh = new MasterPageReadHandler(); + masterPageHandlers.add(mrh); + return mrh; + } + + final StyleDefinitionReadHandler readHandler = + new StyleDefinitionReadHandler(); + otherHandlers.add(readHandler); + return readHandler; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() + throws SAXException + { + for (int i = 0; i < otherHandlers.size(); i++) + { + final ElementReadHandler handler = + (ElementReadHandler) otherHandlers.get(i); + masterStyles.getOtherNodes().addNode(handler.getElement()); + } + + for (int i = 0; i < masterPageHandlers.size(); i++) + { + final MasterPageReadHandler handler = + (MasterPageReadHandler) masterPageHandlers.get(i); + masterStyles.addMasterPage(handler.getMasterPage()); + } + } + + public Element getElement() + { + return masterStyles; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd new file mode 100644 index 000000000000..88fcc020a2e6 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd @@ -0,0 +1,418 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 000000000000..4367f4a78c1d --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ConditionalPrintExpressionReadHandler.java @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ConditionalPrintExpressionReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.rpt; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import org.jfree.report.expressions.FormulaFunction; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Handles the 'report:conditional-print-expression' element that can appear + * in all report elements and all root-level sections. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class ConditionalPrintExpressionReadHandler + extends AbstractXmlReadHandler +{ + + private final Element element; + + public ConditionalPrintExpressionReadHandler(final Element element) + { + if (element == null) + { + throw new NullPointerException(); + } + this.element = element; + } + + protected void startParsing(final Attributes attrs) throws SAXException + { + super.startParsing(attrs); + final String formula = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "formula"); + if (formula != null) + { + final FormulaFunction valueExpression = new FormulaFunction(); + valueExpression.setFormula(formula); + element.setDisplayCondition(valueExpression); + } + + } + + /** + * Returns the object for this element or null, if this element does not + * create an object. + * + * @return the object. + */ + public Object getObject() + throws SAXException + { + return element; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/DetailRootTableReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/DetailRootTableReadHandler.java new file mode 100644 index 000000000000..246e09814ee8 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/DetailRootTableReadHandler.java @@ -0,0 +1,41 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: DetailRootTableReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.rpt; + +import com.sun.star.report.pentaho.model.OfficeDetailSection; + +public class DetailRootTableReadHandler extends RootTableReadHandler +{ + + public DetailRootTableReadHandler() + { + super(new OfficeDetailSection()); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FixedContentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FixedContentReadHandler.java new file mode 100644 index 000000000000..a11d42509f14 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FixedContentReadHandler.java @@ -0,0 +1,98 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FixedContentReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.rpt; + +import com.sun.star.report.pentaho.model.FixedTextElement; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.parser.text.TextContentReadHandler; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Creation-Date: 01.10.2006, 18:48:11 + * + * @author Thomas Morgner + */ +public class FixedContentReadHandler extends ElementReadHandler +{ + + private final FixedTextElement element; + + public FixedContentReadHandler() + { + element = new FixedTextElement(); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.TEXT_NS.equals(uri) && OfficeToken.P.equals(tagName)) + { + // expect a paragraph (which will be ignored; it is a structural + // component that needs not to be printed at all. + return new TextContentReadHandler(element.getContent()); + } + + if (OfficeNamespaces.OOREPORT_NS.equals(uri)) + { + // expect a report control. The control will modifiy the current + // element (as we do not separate the elements that strictly ..) + if ("report-control".equals(tagName)) + { + return new IgnoreAnyChildReadHandler(); + } + if ("report-element".equals(tagName)) + { + return new ReportElementReadHandler(element); + } + } + return null; + } + + public Element getElement() + { + return element; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormatConditionReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormatConditionReadHandler.java new file mode 100644 index 000000000000..840027027940 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormatConditionReadHandler.java @@ -0,0 +1,100 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FormatConditionReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.rpt; + +import com.sun.star.report.pentaho.model.FormatCondition; +import com.sun.star.report.pentaho.model.ReportElement; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import org.jfree.report.expressions.FormulaExpression; +import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.ParseException; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * I'm quite sure I should parse something here. But what? + * + * @author Ocke Janssen + */ +public class FormatConditionReadHandler extends AbstractXmlReadHandler +{ + + private final ReportElement element; + + public FormatConditionReadHandler(final ReportElement element) + { + if (element == null) + { + throw new NullPointerException(); + } + this.element = element; + } + + protected void startParsing(final Attributes attrs) throws SAXException + { + super.startParsing(attrs); + + + final String formula = + attrs.getValue(OfficeNamespaces.OOREPORT_NS, "formula"); + if (formula == null) + { + throw new ParseException("Required attribute 'formula' is missing.", getLocator()); + } + final String stylename = + attrs.getValue(OfficeNamespaces.OOREPORT_NS, OfficeToken.STYLE_NAME); + if (stylename == null) + { + throw new ParseException("Required attribute 'style-name' is missing.", getLocator()); + } + final FormulaExpression valueExpression = new FormulaExpression(); + valueExpression.setFormula(formula); + + final String enabledText = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "enabled"); + final boolean enabled = (enabledText == null || OfficeToken.TRUE.equals(enabledText)); + final FormatCondition formatCondition = + new FormatCondition(valueExpression, stylename, enabled); + element.addFormatCondition(formatCondition); + + } + + /** + * Returns the object for this element or null, if this element does not + * create an object. + * + * @return the object. + */ + public Object getObject() + throws SAXException + { + return element; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java new file mode 100644 index 000000000000..60897b0d3c07 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java @@ -0,0 +1,118 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FormattedTextReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.rpt; + +import com.sun.star.report.pentaho.model.FormattedTextElement; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.OfficeNamespaces; +import org.jfree.report.expressions.FormulaExpression; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Creation-Date: 01.10.2006, 19:06:45 + * + * @author Thomas Morgner + */ +public class FormattedTextReadHandler extends ElementReadHandler +{ + + private final FormattedTextElement element; + + public FormattedTextReadHandler() + { + element = new FormattedTextElement(); + } + + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) throws SAXException + { + super.startParsing(attrs); + + final String formula = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "formula"); + if (formula != null) + { + final FormulaExpression valueExpression = new FormulaExpression(); + valueExpression.setFormula(formula); + element.setValueExpression(valueExpression); + } + + // * Print-Repeated-Values + // * Print-In-First-New-Section + // * Print-When-Group-Changes + + // * Print-When-Section-Overflows + // That property cannot be evaluated yet, as this would require us to + // have a clue about pagebreaking. We dont have that - not yet and never + // in the future, as pagebreaks are computed by OpenOffice instead + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.OOREPORT_NS.equals(uri)) + { + // expect a report control. The control will modifiy the current + // element (as we do not separate the elements that strictly ..) + if ("report-control".equals(tagName)) + { + return new IgnoreAnyChildReadHandler(); + } + if ("report-element".equals(tagName)) + { + return new ReportElementReadHandler(element); + } + } + return null; + } + + public Element getElement() + { + return element; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FunctionReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FunctionReadHandler.java new file mode 100644 index 000000000000..b5ba5a24642e --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FunctionReadHandler.java @@ -0,0 +1,116 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FunctionReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.rpt; + +import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.ParseException; +import org.jfree.report.expressions.Expression; +import org.jfree.report.expressions.FormulaFunction; +import org.jfree.report.expressions.FormulaExpression; +import org.xml.sax.SAXException; +import org.xml.sax.Attributes; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; + +/** + * Parses a named expression. These expressions are encountered on reports and + * groups and compute global values. Expressions must have an unique name. + * + * @author Thomas Morgner + */ +public class FunctionReadHandler extends AbstractXmlReadHandler +{ + + private Expression expression; + + public FunctionReadHandler() + { + } + + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) + throws SAXException + { + final String formula = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "formula"); + if (formula == null) + { + throw new ParseException("Required attribute 'formula' is missing", getLocator()); + } + + final String name = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "name"); + if (name == null) + { + throw new ParseException("Required attribute 'name' is missing", getLocator()); + } + final String initialFormula = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "initial-formula"); + final String deepTraversing = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "deep-traversing"); + + if (initialFormula != null) + { + final FormulaFunction function = new FormulaFunction(); + function.setInitial(initialFormula); + function.setFormula(formula); + this.expression = function; + } + else + { + final FormulaExpression expression = new FormulaExpression(); + expression.setFormula(formula); + this.expression = expression; + } + + expression.setName(name); + expression.setDeepTraversing(OfficeToken.TRUE.equals(deepTraversing)); + final String preEvaluated = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "pre-evaluated"); + expression.setPrecompute(OfficeToken.TRUE.equals(preEvaluated)); + } + + /** + * Returns the object for this element or null, if this element does not + * create an object. + * + * @return the object. + */ + public Object getObject() + throws SAXException + { + return getExpression(); + } + + public Expression getExpression() + { + return expression; + } +} 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 new file mode 100644 index 000000000000..2364eb212f9d --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupReadHandler.java @@ -0,0 +1,181 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: GroupReadHandler.java,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.rpt; + +import com.sun.star.report.OfficeToken; +import java.util.ArrayList; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.OfficeGroup; +import com.sun.star.report.pentaho.model.OfficeGroupInstanceSection; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import java.util.List; +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.expressions.FormulaExpression; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +public class GroupReadHandler extends ElementReadHandler +{ + + private GroupSectionReadHandler groupHeader; + private GroupSectionReadHandler groupFooter; + private GroupReadHandler childGroup; + private RootTableReadHandler detailSection; + private final OfficeGroup group; + private final OfficeGroupInstanceSection groupInstanceSection; + private final List functionHandlers; + private final ReportReadHandler rh; + + public GroupReadHandler(final ReportReadHandler _rh) + { + rh = _rh; + group = new OfficeGroup(); + groupInstanceSection = new OfficeGroupInstanceSection(); + groupInstanceSection.setNamespace(JFreeReportInfo.REPORT_NAMESPACE); + groupInstanceSection.setType("group-instance"); + group.addNode(groupInstanceSection); + functionHandlers = new ArrayList(); + } + + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) throws SAXException + { + super.startParsing(attrs); + + final String groupExpr = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "group-expression"); + if (groupExpr != null) + { + final FormulaExpression function = new FormulaExpression(); + function.setFormula(groupExpr); + groupInstanceSection.setGroupingExpression(function); + } + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (!OfficeNamespaces.OOREPORT_NS.equals(uri)) + { + return null; + } + if ("function".equals(tagName)) + { + final FunctionReadHandler erh = new FunctionReadHandler(); + functionHandlers.add(erh); + return erh; + } + if ("group-header".equals(tagName)) + { + groupHeader = new GroupSectionReadHandler(); + return groupHeader; + } + if ("group".equals(tagName)) + { + childGroup = new GroupReadHandler(rh); + return childGroup; + } + if ("detail".equals(tagName)) + { + detailSection = new DetailRootTableReadHandler(); + rh.setDetail(detailSection); + return detailSection; + } + if ("group-footer".equals(tagName)) + { + ((Element)((Section)rh.getDetail().getElement()).getNode(0)).setAttribute(JFreeReportInfo.REPORT_NAMESPACE,"has-group-footer", OfficeToken.TRUE); + groupFooter = new GroupSectionReadHandler(); + return groupFooter; + } + return null; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException + { + for (int i = 0; i < functionHandlers.size(); i++) + { + final FunctionReadHandler handler = + (FunctionReadHandler) functionHandlers.get(i); + groupInstanceSection.addExpression(handler.getExpression()); + } + + if (groupHeader != null) + { + groupInstanceSection.addNode(groupHeader.getElement()); + } + + final Section groupBody = new Section(); + groupBody.setNamespace(JFreeReportInfo.REPORT_NAMESPACE); + groupBody.setType("group-body"); + groupInstanceSection.addNode(groupBody); + // XOR: Either the detail or the group section can be set .. + if (detailSection != null) + { + groupBody.addNode(detailSection.getElement()); + } + else if (childGroup != null) + { + groupBody.addNode(childGroup.getElement()); + } + + if (groupFooter != null) + { + groupInstanceSection.addNode(groupFooter.getElement()); + } + } + + public Element getElement() + { + return group; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupSectionReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupSectionReadHandler.java new file mode 100644 index 000000000000..ae7c45f192ac --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupSectionReadHandler.java @@ -0,0 +1,41 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: GroupSectionReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.rpt; + +import com.sun.star.report.pentaho.model.OfficeGroupSection; + +public class GroupSectionReadHandler extends RootTableReadHandler +{ + + public GroupSectionReadHandler() + { + super(new OfficeGroupSection()); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ImageReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ImageReadHandler.java new file mode 100644 index 000000000000..e570a5135fca --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ImageReadHandler.java @@ -0,0 +1,141 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ImageReadHandler.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.rpt; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.model.ImageElement; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.parser.xlink.XLinkReadHandler; +import org.jfree.report.expressions.FormulaExpression; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Deals with Image-content. There are two ways to specify the image; + * as formula or as static image data. + * + * @author Thomas Morgner + */ +public class ImageReadHandler extends ElementReadHandler +{ + + private final ImageElement contentElement; + private XLinkReadHandler xLinkReadHandler; + + public ImageReadHandler() + { + contentElement = new ImageElement(); + } + + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) throws SAXException + { + super.startParsing(attrs); + final String formula = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "formula"); +// final String preserveIRI = attrs.getValue(OfficeNamespaces.OOREPORT_NS, OfficeToken.PRESERVE_IRI); + if (formula != null && formula.length() != 0) + { + // now, the evaulated content ends up in the 'content' attribute of the + // element. + final FormulaExpression valueExpression = new FormulaExpression(); + valueExpression.setFormula(formula); + contentElement.setFormula(valueExpression); + } + + contentElement.setNamespace(OfficeNamespaces.FORM_NS); + contentElement.setType(OfficeToken.IMAGE); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.DRAWING_NS.equals(uri) && OfficeToken.IMAGE_DATA.equals(tagName)) + { + xLinkReadHandler = new XLinkReadHandler(); + return xLinkReadHandler; + } + + if (OfficeNamespaces.OOREPORT_NS.equals(uri)) + { + // expect a report control. The control will modifiy the current + // element (as we do not separate the elements that strictly ..) + if ("report-control".equals(tagName)) + { + return new IgnoreAnyChildReadHandler(); + } + if ("report-element".equals(tagName)) + { + return new ReportElementReadHandler(contentElement); + } + } + return null; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException + { + // if we have static content (as well or only), that one goes into the + // alternate-content attribute right now. It is part of the output target + // and style rules to deal with them properly .. + if (xLinkReadHandler != null) + { + contentElement.setAttribute(OfficeNamespaces.OOREPORT_NS, + "alternate-content", xLinkReadHandler.getUri()); + } + } + + public Element getElement() + { + return contentElement; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java new file mode 100644 index 000000000000..a867e2e85e4c --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java @@ -0,0 +1,109 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: MasterDetailReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.rpt; + +import com.sun.star.report.pentaho.model.ObjectOleElement; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.OfficeNamespaces; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * + * @author Ocke Janssen + */ +public class MasterDetailReadHandler extends ElementReadHandler +{ + + private final ObjectOleElement element; + private final boolean parseMasterDetail; + + public MasterDetailReadHandler(final ObjectOleElement element) + { + this.element = element; + parseMasterDetail = false; + } + + public MasterDetailReadHandler(final ObjectOleElement element, final boolean parseMasterDetail) + { + this.element = element; + this.parseMasterDetail = parseMasterDetail; + } + + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) throws SAXException + { + super.startParsing(attrs); + if (parseMasterDetail) + { + final String master = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "master"); + if (master != null && master.length() > 0 ) + { + final String detail = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "detail"); + element.addMasterDetailFields(master, detail); + } + } + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.OOREPORT_NS.equals(uri) && "master-detail-field".equals(tagName)) + { + // expect a report control. The control will modifiy the current + // element (as we do not separate the elements that strictly ..) + return new MasterDetailReadHandler(element, true); + } + + return null; + } + + public Element getElement() + { + return element; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java new file mode 100644 index 000000000000..9177d66db974 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java @@ -0,0 +1,109 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportElementReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.rpt; + +import com.sun.star.report.pentaho.model.ReportElement; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +public class ReportElementReadHandler extends ElementReadHandler +{ + + private final ReportElement element; + + public ReportElementReadHandler(final ReportElement element) + { + if (element == null) + { + throw new NullPointerException(); + } + + this.element = element; + } + + public Element getElement() + { + return element; + } + + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) + throws SAXException + { + super.startParsing(attrs); + final String printWhenGroupChanges = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "print-when-group-changes"); + element.setPrintWhenGroupChanges(OfficeToken.TRUE.equals(printWhenGroupChanges)); + final String printRepeatingValues = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "print-repeated-values"); + element.setPrintRepeatedValues(printRepeatingValues == null || OfficeToken.TRUE.equals(printRepeatingValues)); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (!OfficeNamespaces.OOREPORT_NS.equals(uri)) + { + return null; + } + if ("conditional-print-expression".equals(tagName)) + { + return new ConditionalPrintExpressionReadHandler(element); + } + if ("format-condition".equals(tagName)) + { + return new FormatConditionReadHandler(element); + } + if ("report-component".equals(tagName)) + { + return new IgnoreAnyChildReadHandler(); + } + return null; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java new file mode 100644 index 000000000000..7fa0f700dada --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java @@ -0,0 +1,237 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportReadHandler.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.rpt; + +import java.util.ArrayList; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.OfficeReport; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.parser.chart.ChartReadHandler; +import java.util.List; +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +public class ReportReadHandler extends ElementReadHandler +{ + + private RootTableReadHandler pageHeader; + private RootTableReadHandler pageFooter; + private RootTableReadHandler reportHeader; + private RootTableReadHandler reportFooter; + private RootTableReadHandler detail; + + public void setDetail(final RootTableReadHandler detail) + { + this.detail = detail; + } + public final RootTableReadHandler getDetail() + { + return detail; + } + private GroupReadHandler groups; + private final OfficeReport rootSection; + private final List functionHandlers; + private final List preBodyHandlers; + private final List postBodyHandlers; + private boolean pre = true; + + public ReportReadHandler() + { + rootSection = new OfficeReport(); + rootSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "simple-report-structure", Boolean.TRUE); + functionHandlers = new ArrayList(); + preBodyHandlers = new ArrayList(); + postBodyHandlers = new ArrayList(); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + final XmlReadHandler erh; + if (OfficeNamespaces.CHART_NS.equals(uri)) + { + erh = new ChartReadHandler(this); + if (pre) + { + preBodyHandlers.add(erh); + } + else + { + postBodyHandlers.add(erh); + } + } + else if (OfficeNamespaces.OOREPORT_NS.equals(uri)) + { + if ("function".equals(tagName)) + { + erh = new FunctionReadHandler(); + functionHandlers.add(erh); + } + else if ("page-header".equals(tagName)) + { + pageHeader = new RootTableReadHandler(); + erh = pageHeader; + } + else if ("report-header".equals(tagName)) + { + reportHeader = new RootTableReadHandler(); + erh = reportHeader; + } + else if ("report-footer".equals(tagName)) + { + reportFooter = new RootTableReadHandler(); + erh = reportFooter; + } + else if ("page-footer".equals(tagName)) + { + pageFooter = new RootTableReadHandler(); + erh = pageFooter; + } + else if ("detail".equals(tagName)) + { + pre = false; + detail = new DetailRootTableReadHandler(); + erh = detail; + } + else if ("group".equals(tagName)) + { + groups = new GroupReadHandler(this); + erh = groups; + } + else + { + erh = null; + } + } + else + { + erh = null; + } + return erh; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException + { + if (pageHeader != null) + { + rootSection.setPageHeader(pageHeader.getElement()); + } + if (pageFooter != null) + { + rootSection.setPageFooter(pageFooter.getElement()); + } + if (reportHeader != null) + { + rootSection.setReportHeader(reportHeader.getElement()); + } + + final Section preBody = createSection("report-pre-body", preBodyHandlers); + if (preBody != null) + { + rootSection.setPreBodySection(preBody); + } + + final Section groupBody = new Section(); + groupBody.setNamespace(JFreeReportInfo.REPORT_NAMESPACE); + groupBody.setType("report-body"); + rootSection.setBodySection(groupBody); + + // XOR: Either the detail or the group section can be set .. + if (groups != null) + { + groupBody.addNode(groups.getElement()); + } + else if (detail != null) + { + groupBody.addNode(detail.getElement()); + } + + final Section postBody = createSection("report-post-body", postBodyHandlers); + if (postBody != null) + { + rootSection.setPostBodySection(postBody); + } + + if (reportFooter != null) + { + rootSection.setReportFooter(reportFooter.getElement()); + } + + for (int i = 0; i < functionHandlers.size(); i++) + { + final FunctionReadHandler handler = + (FunctionReadHandler) functionHandlers.get(i); + rootSection.addExpression(handler.getExpression()); + } + } + + public Element getElement() + { + return rootSection; + } + + private final Section createSection(final String name, final List handler) + { + if (!handler.isEmpty()) + { + final Section section = new Section(); + section.setNamespace(JFreeReportInfo.REPORT_NAMESPACE); + section.setType(name); + + for (int i = 0; i < handler.size(); i++) + { + final ElementReadHandler erh = (ElementReadHandler) handler.get(i); + section.addNode(erh.getElement()); + } + return section; + } + return null; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/RootTableReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/RootTableReadHandler.java new file mode 100644 index 000000000000..7f1604d0e7ea --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/RootTableReadHandler.java @@ -0,0 +1,105 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: RootTableReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.rpt; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.parser.table.TableReadHandler; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +public class RootTableReadHandler extends ElementReadHandler +{ + + private TableReadHandler sectionTableReadHandler; + private final Section section; + + public RootTableReadHandler() + { + section = new Section(); + } + + protected RootTableReadHandler(final Section section) + { + if (section == null) + { + throw new NullPointerException(); + } + this.section = section; + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.TABLE_NS.equals(uri) && "table".equals(tagName)) + { + sectionTableReadHandler = new TableReadHandler(); + return sectionTableReadHandler; + } + if (OfficeNamespaces.OOREPORT_NS.equals(uri) && "conditional-print-expression".equals(tagName)) + { + return new ConditionalPrintExpressionReadHandler(section); + } + return null; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() + throws SAXException + { + if (sectionTableReadHandler != null) + { + section.addNode(sectionTableReadHandler.getElement()); + } + } + + public Element getElement() + { + return section; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/SubDocumentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/SubDocumentReadHandler.java new file mode 100644 index 000000000000..ab635a6b095b --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/SubDocumentReadHandler.java @@ -0,0 +1,137 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: SubDocumentReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.rpt; + +import com.sun.star.report.pentaho.model.ObjectOleElement; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.parser.draw.ObjectOleReadHandler; +import com.sun.star.report.pentaho.parser.text.NoCDATATextContentReadHandler; +import org.jfree.report.structure.Section; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * + * @author Ocke Janssen + */ +public class SubDocumentReadHandler extends NoCDATATextContentReadHandler +{ + + private final ObjectOleElement element; + private boolean ignore = false; + + public SubDocumentReadHandler(final ObjectOleElement element) + { + this.element = element; + } + + public SubDocumentReadHandler(final Section section, final ObjectOleElement element) + { + super(section); + this.element = element; + } + + public SubDocumentReadHandler(final Section section) + { + this(section, new ObjectOleElement()); + ignore = true; + } + + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) throws SAXException + { + if (!ignore) + { + super.startParsing(attrs); + } + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.OOREPORT_NS.equals(uri)) + { + // expect a report control. The control will modifiy the current + // element (as we do not separate the elements that strictly ..) + if ("report-control".equals(tagName)) + { + return new IgnoreAnyChildReadHandler(); + } + if ("report-element".equals(tagName)) + { + return new ReportElementReadHandler(element); + } + if ("master-detail-fields".equals(tagName)) + { + return new MasterDetailReadHandler(element); + } + } + if (OfficeNamespaces.DRAWING_NS.equals(uri)) + { + final XmlReadHandler readHandler; + if (OfficeToken.OBJECT_OLE.equals(tagName)) + { + readHandler = new ObjectOleReadHandler(element); + } + else if ("frame".equals(tagName)) + { + readHandler = new SubDocumentReadHandler(new Section(), element); + } + else + { + readHandler = null; + } + if (readHandler != null) + { + getChildren().add(readHandler); + return readHandler; + } + } + return super.getHandlerForChild(uri, tagName, atts); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/selectors.properties b/reportbuilder/java/com/sun/star/report/pentaho/parser/selectors.properties new file mode 100644 index 000000000000..eca5a9072c9b --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/selectors.properties @@ -0,0 +1,116 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: selectors.properties,v $ +# +# $Revision: 1.3 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +# +# +# +# +# gets translated into: +# +# *[draw|style-name~="S1"] + +namespaces.draw=urn:oasis:names:tc:opendocument:xmlns:drawing:1.0 +namespaces.fo=urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0 +namespaces.style=urn:oasis:names:tc:opendocument:xmlns:style:1.0 +namespaces.table=urn:oasis:names:tc:opendocument:xmlns:table:1.0 +namespaces.chart=urn:oasis:names:tc:opendocument:xmlns:chart:1.0 +namespaces.rpt=http://openoffice.org/2005/report + +# +# maps the style family type (graphics) into a style rule of the +# common form: *[|~=""] +# +style-family.graphic=draw +style-family.graphics=draw +style-family.control=control +style-family.report-element=rpt +style-family.table-column=table +style-family.table-row=table +style-family.table-cell=table +style-family.table=table + +# Builds the selector pattern for a star-office stylesheet +# +# 0: Namespace prefix +# 1: Style-class attribute name (from the global namespace definition) +# 2: Style-class value +style-selector.pattern=*[{0}|{1}~="{2}"] + +# +# The following properties map the OpenOffice-generic font names +# into their CSS counterparts. As I dont have a clue, whats the difference +# between modern and swiss typeface, I am ignorant for now and ignore +# them. Blame me for that :) +font-family.roman=serif +font-family.swiss=sans-serif +font-family.modern=sans-serif +font-family.decorative=fantasy +font-family.script=cursive +font-family.system=monospace + + +# +# Defines the style property mapping for the resolve process from the +# OpenOffice report format into the internal LibLayout format +# +# attr.style...= +# +# Group is an selector, which corresponds to one of the sub-elements of +# the style element of the OpenDocument format. (It must match the element +# name for which the attributes are defined.) +# +# Namespace is a defined namespace prefix from this file as defined in the +# namespaces. section above +# +# AttrName is the defined attribute name for this namespace as defined by the +# opendocument standard. +attr.style.graphic-properties.draw.textarea-vertical-align=com.sun.star.report.pentaho.parser.stylemapper.draw.TextAreaVerticalAlignMapper +attr.style.section-properties.fo.background-color=com.sun.star.report.pentaho.parser.stylemapper.fo.BackgroundColorMapper +attr.style.paragraph-properties.fo.text-align=com.sun.star.report.pentaho.parser.stylemapper.fo.TextAlignMapper +attr.style.paragraph-properties.style.vertical-align=com.sun.star.report.pentaho.parser.stylemapper.style.VerticalAlignMapper +attr.style.text-properties.fo.color=com.sun.star.report.pentaho.parser.stylemapper.fo.ColorMapper +attr.style.text-properties.style.font-name=com.sun.star.report.pentaho.parser.stylemapper.style.FontNameMapper +attr.style.text-properties.fo.font-family=com.sun.star.report.pentaho.parser.stylemapper.style.FontFamilyMapper +attr.style.table-properties.fo.background-color=com.sun.star.report.pentaho.parser.stylemapper.fo.BackgroundColorMapper +#attr.style.text-properties.style.font-style-name= +attr.style.text-properties.style.font-family-generic=com.sun.star.report.pentaho.parser.stylemapper.style.FontFamilyGenericMapper +attr.style.text-properties.style.font-pitch=com.sun.star.report.pentaho.parser.stylemapper.style.FontPitchMapper +attr.style.text-properties.fo.font-size=com.sun.star.report.pentaho.parser.stylemapper.fo.FontSizeMapper +attr.style.text-properties.fo.font-style=com.sun.star.report.pentaho.parser.stylemapper.fo.FontStyleMapper +attr.style.text-properties.style.text-underline-style=com.sun.star.report.pentaho.parser.stylemapper.style.TextUnderlineStyleMapper +attr.style.text-properties.style.text-underline-width=com.sun.star.report.pentaho.parser.stylemapper.style.TextUnderlineWidthMapper +attr.style.text-properties.style.text-underline-color=com.sun.star.report.pentaho.parser.stylemapper.style.TextUnderlineColorMapper +attr.style.text-properties.fo.font-weight=com.sun.star.report.pentaho.parser.stylemapper.fo.FontWeightMapper +attr.style.text-properties.style.text-emphasize=com.sun.star.report.pentaho.parser.stylemapper.style.TextEmphasizeMapper +attr.style.text-properties.style.font-relief=com.sun.star.report.pentaho.parser.stylemapper.style.FontReliefMapper +attr.style.table-column-properties.table.column-width=com.sun.star.report.pentaho.parser.stylemapper.table.ColumnWidthMapper +attr.style.table-row-properties.table.row-height=com.sun.star.report.pentaho.parser.stylemapper.table.RowHeightMapper +attr.style.table-cell-properties.fo.border-right=com.sun.star.report.pentaho.parser.stylemapper.fo.BorderRightMapper diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style-mapping.txt b/reportbuilder/java/com/sun/star/report/pentaho/parser/style-mapping.txt new file mode 100644 index 000000000000..6b1ede5d98cf --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style-mapping.txt @@ -0,0 +1,8 @@ + + + + +gets translated into: + +*[draw|style-name~="S1"] + diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java new file mode 100644 index 000000000000..2b70a87d9d03 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java @@ -0,0 +1,59 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FontFaceReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.style; + +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.model.FontFaceElement; +import org.jfree.report.structure.Element; + +/** + * Reads a single font-face declaration. This is equal to the @font rule of + * the CSS standard. We do not interpret the attributes of the element in + * any way yet. + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class FontFaceReadHandler extends ElementReadHandler +{ + private final FontFaceElement fontFaceElement; + + public FontFaceReadHandler() + { + this.fontFaceElement = new FontFaceElement(); + } + + public Element getElement() + { + return fontFaceElement; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java new file mode 100644 index 000000000000..160feadb737f --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java @@ -0,0 +1,107 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: MasterPageReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.style; + +import java.util.ArrayList; + +import com.sun.star.report.pentaho.model.OfficeMasterPage; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import java.util.List; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class MasterPageReadHandler extends ElementReadHandler +{ + private final OfficeMasterPage masterPage; + private final List otherHandlers; + + public MasterPageReadHandler() + { + masterPage = new OfficeMasterPage(); + this.otherHandlers = new ArrayList(); + } + + public OfficeMasterPage getMasterPage() + { + return masterPage; + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + final StyleDefinitionReadHandler readHandler = + new StyleDefinitionReadHandler(); + otherHandlers.add(readHandler); + return readHandler; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() + throws SAXException + { + for (int i = 0; i < otherHandlers.size(); i++) + { + final ElementReadHandler handler = + (ElementReadHandler) otherHandlers.get(i); + masterPage.addNode(handler.getElement()); + } + } + + + public Element getElement() + { + return masterPage; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java new file mode 100644 index 000000000000..a259a16ad8da --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java @@ -0,0 +1,106 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeStyleReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.style; + +import java.util.ArrayList; + +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.model.OfficeStyle; +import java.util.List; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * This class reads a single style rule. The resulting 'office-style' element + * is added to an 'office-styles' set. + */ +public class OfficeStyleReadHandler extends ElementReadHandler +{ + private final OfficeStyle officeStyle; + private final List childs; + + public OfficeStyleReadHandler() + { + this.officeStyle = new OfficeStyle(); + this.childs = new ArrayList(); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild (final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { +// if (OfficeParserUtil.getInstance().isValidStyleElement(uri, tagName)) +// { +// } + final StyleDefinitionReadHandler readHandler = + new StyleDefinitionReadHandler(); + childs.add(readHandler); + return readHandler; + } + + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException + { + for (int i = 0; i < childs.size(); i++) + { + final ElementReadHandler handler = (ElementReadHandler) childs.get(i); + officeStyle.addNode(handler.getElement()); + } + } + + public OfficeStyle getOfficeStyle() + { + return officeStyle; + } + + public Element getElement() + { + return officeStyle; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java new file mode 100644 index 000000000000..687b7b02ce49 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java @@ -0,0 +1,143 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OfficeStylesReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.style; + +import java.util.ArrayList; +import org.jfree.report.modules.factories.report.flow.SectionReadHandler; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.OfficeStyles; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.parser.data.DataStyleReadHandler; +import java.util.List; + +public class OfficeStylesReadHandler extends ElementReadHandler +{ + private final List textStyleChilds; + private final List dataStyleChilds; + private final List otherStyleChilds; + private final List pageLayoutChilds; + private final OfficeStyles officeStyles; + + public OfficeStylesReadHandler(final OfficeStyles officeStyles) + { + this.officeStyles = officeStyles; + this.pageLayoutChilds = new ArrayList(); + this.dataStyleChilds = new ArrayList(); + this.textStyleChilds = new ArrayList(); + this.otherStyleChilds = new ArrayList(); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild (final String uri, final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.STYLE_NS.equals(uri)) + { + if ("style".equals(tagName)) + { + final OfficeStyleReadHandler xrh = new OfficeStyleReadHandler(); + textStyleChilds.add(xrh); + return xrh; + } + else if ("page-layout".equals(tagName)) + { + final PageLayoutReadHandler prh = new PageLayoutReadHandler(); + pageLayoutChilds.add(prh); + return prh; + } + } + else if (OfficeNamespaces.DATASTYLE_NS.equals(uri)) + { + final DataStyleReadHandler xrh = new DataStyleReadHandler(false); + dataStyleChilds.add(xrh); + return xrh; + } + + final SectionReadHandler genericReadHander = new SectionReadHandler(); + otherStyleChilds.add(genericReadHander); + return genericReadHander; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException + { + for (int i = 0; i < textStyleChilds.size(); i++) + { + final OfficeStyleReadHandler handler = + (OfficeStyleReadHandler) textStyleChilds.get(i); + officeStyles.addStyle(handler.getOfficeStyle()); + } + + for (int i = 0; i < pageLayoutChilds.size(); i++) + { + final PageLayoutReadHandler handler = + (PageLayoutReadHandler) pageLayoutChilds.get(i); + officeStyles.addPageStyle(handler.getPageLayout()); + } + + for (int i = 0; i < dataStyleChilds.size(); i++) + { + final DataStyleReadHandler handler = + (DataStyleReadHandler) dataStyleChilds.get(i); + officeStyles.addDataStyle(handler.getDataStyle()); + } + + for (int i = 0; i < otherStyleChilds.size(); i++) + { + final SectionReadHandler handler = + (SectionReadHandler) otherStyleChilds.get(i); + officeStyles.addOtherNode((Element) handler.getNode()); + } + } + + public Element getElement() + { + return officeStyles; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java new file mode 100644 index 000000000000..46ba378a1ce5 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java @@ -0,0 +1,105 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: PageLayoutReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.style; + +import java.util.ArrayList; + +import com.sun.star.report.pentaho.model.PageLayout; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import java.util.List; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Reads a page-layout element. + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class PageLayoutReadHandler extends ElementReadHandler +{ + private final PageLayout pageLayout; + private final List childs; + + public PageLayoutReadHandler() + { + this.pageLayout = new PageLayout(); + this.childs = new ArrayList(); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild (final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + final StyleDefinitionReadHandler readHandler = + new StyleDefinitionReadHandler(); + childs.add(readHandler); + return readHandler; + } + + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException + { + for (int i = 0; i < childs.size(); i++) + { + final ElementReadHandler handler = (ElementReadHandler) childs.get(i); + pageLayout.addNode(handler.getElement()); + } + } + + public PageLayout getPageLayout() + { + return pageLayout; + } + + public Element getElement() + { + return pageLayout; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java new file mode 100644 index 000000000000..6eb99dec3ee0 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java @@ -0,0 +1,101 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StyleDefinitionReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.style; + +import java.util.ArrayList; + +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import java.util.List; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Reads all childs of a style-definition. This simply copies everything that + * is contained in the source-file into a generic structure that can be + * written out later. + */ +public class StyleDefinitionReadHandler extends ElementReadHandler +{ + private final Section rawSection; + private final List childs; + + public StyleDefinitionReadHandler() + { + this.rawSection = new Section(); + this.childs = new ArrayList(); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + final StyleDefinitionReadHandler readHandler = + new StyleDefinitionReadHandler(); + childs.add(readHandler); + return readHandler; + } + + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() + throws SAXException + { + for (int i = 0; i < childs.size(); i++) + { + final ElementReadHandler handler = (ElementReadHandler) childs.get(i); + rawSection.addNode(handler.getElement()); + } + } + + + public Element getElement() + { + return rawSection; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java new file mode 100644 index 000000000000..7ade32271b8f --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: OneOfConstantsMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.stylemapper; + +import java.util.HashMap; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import java.util.Map; +import org.jfree.layouting.input.style.CSSDeclarationRule; +import org.jfree.layouting.input.style.StyleKey; +import org.jfree.layouting.input.style.values.CSSValue; + +public abstract class OneOfConstantsMapper implements StyleMapper +{ + + private final StyleKey styleKey; + private final Map mappings; + + protected OneOfConstantsMapper(final StyleKey styleKey) + { + this.styleKey = styleKey; + this.mappings = new HashMap(); + } + + public void addMapping (final String value, final CSSValue target) + { + mappings.put(value, target); + } + + public void updateStyle(final String uri, + final String attrName, + final String attrValue, + final CSSDeclarationRule targetRule) + { + final CSSValue value = lookupMapping(attrValue); + if (value != null) + { + targetRule.setPropertyValue(styleKey, value); + } + } + + public StyleKey getStyleKey() + { + return styleKey; + } + + protected CSSValue lookupMapping(final String attrValue) + { + return (CSSValue) mappings.get(attrValue); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java new file mode 100644 index 000000000000..f08255b615ee --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java @@ -0,0 +1,48 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TextAreaVerticalAlignMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.stylemapper.draw; + +import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; +import org.jfree.layouting.input.style.keys.box.BoxStyleKeys; +import org.jfree.layouting.input.style.values.CSSConstant; + +public class TextAreaVerticalAlignMapper extends OneOfConstantsMapper +{ + public TextAreaVerticalAlignMapper () + { + super (BoxStyleKeys.BOX_VERTICAL_ALIGN); + addMapping("top", new CSSConstant("top")); + addMapping("bottom", new CSSConstant("bottom")); + addMapping("middle", new CSSConstant("middle")); + addMapping("justify", new CSSConstant("justify")); + } +} 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 new file mode 100644 index 000000000000..a0f6c4e217ad --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/BackgroundColorMapper.java @@ -0,0 +1,56 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: BackgroundColorMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.stylemapper.fo; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; +import org.jfree.layouting.input.style.keys.border.BorderStyleKeys; +import org.jfree.layouting.input.style.values.CSSColorValue; +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, + final CSSDeclarationRule targetRule) + { + final CSSColorValue cv = (CSSColorValue) ColorUtil.parseColor(attrValue); + if (cv != null) + { + targetRule.setPropertyValue(BorderStyleKeys.BACKGROUND_COLOR, cv); + } + } +} 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 new file mode 100644 index 000000000000..b668301c3603 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/BorderRightMapper.java @@ -0,0 +1,62 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: BorderRightMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +/* + * BorderRightMapper.java + * + * Created on 16. Februar 2007, 13:00 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ +package com.sun.star.report.pentaho.parser.stylemapper.fo; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; + +/** + * + * @author oj93728 + */ +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, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValueAsString(attrName, attrValue); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/ColorMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/ColorMapper.java new file mode 100644 index 000000000000..f824646a9df4 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/ColorMapper.java @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ColorMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.stylemapper.fo; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; +import org.jfree.layouting.input.style.keys.color.ColorStyleKeys; +import org.jfree.layouting.input.style.values.CSSColorValue; +import org.jfree.layouting.util.ColorUtil; + +public class ColorMapper implements StyleMapper +{ + + public ColorMapper() + { + } + + public void updateStyle(final String uri, final String attrName, final String attrValue, + final CSSDeclarationRule targetRule) + { + final CSSColorValue cv = (CSSColorValue) ColorUtil.parseColor(attrValue); + if (cv != null) + { + targetRule.setPropertyValue(ColorStyleKeys.COLOR, cv); + } + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java new file mode 100644 index 000000000000..94c701431527 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java @@ -0,0 +1,48 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FontSizeMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.stylemapper.fo; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; +import org.jfree.layouting.input.style.keys.font.FontStyleKeys; + +public class FontSizeMapper implements StyleMapper +{ + + public FontSizeMapper() + { + } + + public void updateStyle(final String uri, final String attrName, final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValueAsString(FontStyleKeys.FONT_SIZE, attrValue); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java new file mode 100644 index 000000000000..5369dc589d32 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java @@ -0,0 +1,49 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FontStyleMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.stylemapper.fo; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; +import org.jfree.layouting.input.style.keys.font.FontStyleKeys; + +public class FontStyleMapper implements StyleMapper +{ + public FontStyleMapper () + { + } + + public void updateStyle (final String uri, final String attrName, final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValueAsString(FontStyleKeys.FONT_STYLE, attrValue); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java new file mode 100644 index 000000000000..49571efae772 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java @@ -0,0 +1,49 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FontWeightMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.stylemapper.fo; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; +import org.jfree.layouting.input.style.keys.font.FontStyleKeys; + +public class FontWeightMapper implements StyleMapper +{ + public FontWeightMapper () + { + } + + public void updateStyle (final String uri, final String attrName, final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValueAsString(FontStyleKeys.FONT_WEIGHT, attrValue); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java new file mode 100644 index 000000000000..93d1ee1d57c0 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TextAlignMapper.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.stylemapper.fo; + +import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; +import org.jfree.layouting.input.style.keys.text.TextAlign; +import org.jfree.layouting.input.style.keys.text.TextStyleKeys; + +public class TextAlignMapper extends OneOfConstantsMapper +{ + public TextAlignMapper () + { + super(TextStyleKeys.TEXT_ALIGN); + addMapping("start", TextAlign.START); + addMapping("end", TextAlign.END); + addMapping("left", TextAlign.LEFT); + addMapping("center", TextAlign.CENTER); + addMapping("right", TextAlign.RIGHT); + addMapping("justify", TextAlign.JUSTIFY); + } + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java new file mode 100644 index 000000000000..f218fc465a94 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java @@ -0,0 +1,64 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FontFamilyGenericMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.stylemapper.style; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; +import org.jfree.layouting.input.style.keys.font.FontStyleKeys; +import org.jfree.layouting.input.style.values.CSSStringValue; +import org.jfree.layouting.input.style.values.CSSStringType; +import org.jfree.layouting.input.style.values.CSSValue; +import org.jfree.layouting.input.style.values.CSSValueList; + +public class FontFamilyGenericMapper implements StyleMapper +{ + + public FontFamilyGenericMapper() + { + } + + public void updateStyle(final String uri, final String attrName, final String attrValue, + final CSSDeclarationRule targetRule) + { + final CSSValue value = targetRule.getPropertyCSSValue(FontStyleKeys.FONT_FAMILY); + if (!(value instanceof CSSValueList)) + { + final CSSStringValue cssVal = new CSSStringValue(CSSStringType.STRING, attrValue); + targetRule.setPropertyValue(FontStyleKeys.FONT_FAMILY, + new CSSValueList(new CSSValue[]{cssVal})); + } + else + { + final CSSValueList list = (CSSValueList) value; + targetRule.setPropertyValue(FontStyleKeys.FONT_FAMILY, + CSSValueList.insertLast(list, value)); + } + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java new file mode 100644 index 000000000000..019fea3182a2 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java @@ -0,0 +1,64 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FontFamilyMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.stylemapper.style; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; +import org.jfree.layouting.input.style.values.CSSStringValue; +import org.jfree.layouting.input.style.values.CSSStringType; +import org.jfree.layouting.input.style.values.CSSValue; +import org.jfree.layouting.input.style.values.CSSValueList; +import org.jfree.layouting.input.style.keys.font.FontStyleKeys; + +public class FontFamilyMapper implements StyleMapper +{ + + public FontFamilyMapper() + { + } + + public void updateStyle(final String uri, final String attrName, final String attrValue, + final CSSDeclarationRule targetRule) + { + final CSSValue value = targetRule.getPropertyCSSValue(FontStyleKeys.FONT_FAMILY); + if (!(value instanceof CSSValueList)) + { + final CSSStringValue cssVal = new CSSStringValue(CSSStringType.STRING, attrValue); + targetRule.setPropertyValue(FontStyleKeys.FONT_FAMILY, + new CSSValueList(new CSSValue[]{cssVal})); + } + else + { + final CSSValueList list = (CSSValueList) value; + targetRule.setPropertyValue(FontStyleKeys.FONT_FAMILY, + CSSValueList.insertFirst(list, value)); + } + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java new file mode 100644 index 000000000000..f9d238bfcb79 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FontNameMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.stylemapper.style; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; +import org.jfree.layouting.input.style.values.CSSStringValue; +import org.jfree.layouting.input.style.values.CSSStringType; +import org.jfree.layouting.input.style.keys.font.FontStyleKeys; + +public class FontNameMapper implements StyleMapper +{ + public FontNameMapper () + { + } + + public void updateStyle (final String uri, final String attrName, final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValue(FontStyleKeys.FONT_NAME, + new CSSStringValue(CSSStringType.STRING, attrValue)); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java new file mode 100644 index 000000000000..ae180f8fac69 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java @@ -0,0 +1,46 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FontPitchMapper.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.stylemapper.style; + +import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; +import org.jfree.layouting.input.style.keys.font.FontStyleKeys; +import org.jfree.layouting.input.style.values.CSSConstant; + +public class FontPitchMapper extends OneOfConstantsMapper +{ + public FontPitchMapper () + { + super (FontStyleKeys.FONT_PITCH); + addMapping("variable", new CSSConstant("variable")); + addMapping("fixed", new CSSConstant("fixed")); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java new file mode 100644 index 000000000000..059d01981a27 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java @@ -0,0 +1,50 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: FontReliefMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.stylemapper.style; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; +import org.jfree.layouting.input.style.keys.font.FontStyleKeys; + +public class FontReliefMapper implements StyleMapper +{ + public FontReliefMapper () + { + + } + + public void updateStyle (final String uri, final String attrName, final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValueAsString(FontStyleKeys.FONT_EFFECT, attrValue); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java new file mode 100644 index 000000000000..961e22c5eb63 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java @@ -0,0 +1,49 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TextEmphasizeMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.stylemapper.style; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; + +public class TextEmphasizeMapper implements StyleMapper +{ + public TextEmphasizeMapper () + { + + } + + public void updateStyle (final String uri, final String attrName, final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValueAsString("font-emphasize", attrValue); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java new file mode 100644 index 000000000000..e0b4e309a9bc --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TextUnderlineColorMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.stylemapper.style; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; +import org.jfree.layouting.input.style.keys.text.TextStyleKeys; +import org.jfree.layouting.input.style.values.CSSColorValue; +import org.jfree.layouting.util.ColorUtil; + +public class TextUnderlineColorMapper implements StyleMapper +{ + public TextUnderlineColorMapper () + { + } + + public void updateStyle (final String uri, + final String attrName, + final String attrValue, + final CSSDeclarationRule targetRule) + { + final CSSColorValue cv = (CSSColorValue) ColorUtil.parseColor(attrValue); + if (cv != null) + { + targetRule.setPropertyValue(TextStyleKeys.TEXT_UNDERLINE_COLOR, cv); + } + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java new file mode 100644 index 000000000000..70630674abbb --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java @@ -0,0 +1,55 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TextUnderlineStyleMapper.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.stylemapper.style; + +import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; +import org.jfree.layouting.input.style.keys.text.TextStyleKeys; +import org.jfree.layouting.input.style.keys.text.TextDecorationStyle; + +public class TextUnderlineStyleMapper extends OneOfConstantsMapper +{ + public TextUnderlineStyleMapper () + { + super(TextStyleKeys.TEXT_UNDERLINE_STYLE); + addMapping("none", TextDecorationStyle.NONE); + addMapping("solid", TextDecorationStyle.SOLID); + addMapping("dotted", TextDecorationStyle.DOTTED); + addMapping("dash", TextDecorationStyle.DASHED); + addMapping("long-dash", TextDecorationStyle.LONG_DASH); + addMapping("dot-dash", TextDecorationStyle.DOT_DASH); + addMapping("dot-dot-dash", TextDecorationStyle.DOT_DOT_DASH); + addMapping("wave", TextDecorationStyle.WAVE); + } + + + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java new file mode 100644 index 000000000000..fbc4d7498be2 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TextUnderlineWidthMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.stylemapper.style; + +import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; +import org.jfree.layouting.input.style.keys.border.BorderWidth; +import org.jfree.layouting.input.style.keys.text.TextDecorationWidth; +import org.jfree.layouting.input.style.keys.text.TextStyleKeys; +import org.jfree.layouting.input.style.values.CSSAutoValue; +import org.jfree.layouting.input.style.values.CSSValue; + +public class TextUnderlineWidthMapper extends OneOfConstantsMapper +{ + + public TextUnderlineWidthMapper() + { + super(TextStyleKeys.TEXT_UNDERLINE_WIDTH); + addMapping("auto", CSSAutoValue.getInstance()); + addMapping("normal", BorderWidth.MEDIUM); + addMapping("bold", TextDecorationWidth.BOLD); + addMapping("thin", BorderWidth.THIN); + addMapping("dash", TextDecorationWidth.DASH); + addMapping("medium", BorderWidth.MEDIUM); + addMapping("thick", BorderWidth.THICK); + } + + public void updateStyle(final String uri, + final String attrName, + final String attrValue, + final CSSDeclarationRule targetRule) + { + if (attrName == null) + { + throw new NullPointerException(); + } + + final CSSValue value = lookupMapping(attrValue); + if (value != null) + { + targetRule.setPropertyValue(getStyleKey(), value); + } + else + // percent + // positive integer + // positive length + { + targetRule.setPropertyValueAsString(getStyleKey(), attrValue); + } + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java new file mode 100644 index 000000000000..3e2d879db846 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java @@ -0,0 +1,48 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TextUnderlineWordMode.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.stylemapper.style; + +import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; +import org.jfree.layouting.input.style.keys.text.TextDecorationMode; +import org.jfree.layouting.input.style.keys.text.TextStyleKeys; + +public class TextUnderlineWordMode extends OneOfConstantsMapper +{ + public TextUnderlineWordMode () + { + super(TextStyleKeys.TEXT_UNDERLINE_MODE); + addMapping("continuous", TextDecorationMode.CONTINUOUS); + addMapping("skip-white-space", TextDecorationMode.SKIP_WHITE_SPACE); + } + + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java new file mode 100644 index 000000000000..ad9ea12ac6fb --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java @@ -0,0 +1,50 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: VerticalAlignMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.parser.stylemapper.style; + +import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; +import org.jfree.layouting.input.style.keys.line.LineStyleKeys; +import org.jfree.layouting.input.style.values.CSSAutoValue; +import org.jfree.layouting.input.style.values.CSSConstant; + +public class VerticalAlignMapper extends OneOfConstantsMapper +{ + public VerticalAlignMapper () + { + super (LineStyleKeys.VERTICAL_ALIGN); + addMapping("top", new CSSConstant("top")); + addMapping("bottom", new CSSConstant("bottom")); + addMapping("middle", new CSSConstant("middle")); + addMapping("baseline", new CSSConstant("baseline")); + addMapping("auto", CSSAutoValue.getInstance()); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java new file mode 100644 index 000000000000..fca9edd38d33 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java @@ -0,0 +1,55 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ColumnWidthMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package com.sun.star.report.pentaho.parser.stylemapper.table; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; +import org.jfree.layouting.input.style.keys.box.BoxStyleKeys; + +/** + * Creation-Date: 03.07.2006, 13:08:27 + * + * @author Thomas Morgner + */ +public class ColumnWidthMapper implements StyleMapper +{ + public ColumnWidthMapper() + { + } + + public void updateStyle(final String uri, + final String attrName, + final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValueAsString(BoxStyleKeys.WIDTH, attrValue); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java new file mode 100644 index 000000000000..c305a85a1e05 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java @@ -0,0 +1,55 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: RowHeightMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package com.sun.star.report.pentaho.parser.stylemapper.table; + +import com.sun.star.report.pentaho.parser.StyleMapper; +import org.jfree.layouting.input.style.CSSDeclarationRule; +import org.jfree.layouting.input.style.keys.box.BoxStyleKeys; + +/** + * Creation-Date: 03.07.2006, 13:08:27 + * + * @author Thomas Morgner + */ +public class RowHeightMapper implements StyleMapper +{ + public RowHeightMapper() + { + } + + public void updateStyle(final String uri, + final String attrName, + final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValueAsString(BoxStyleKeys.HEIGHT, attrValue); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/CoveredCellReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/CoveredCellReadHandler.java new file mode 100644 index 000000000000..66b11863df77 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/CoveredCellReadHandler.java @@ -0,0 +1,56 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: CoveredCellReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.table; + +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 14.03.2007 + */ +public class CoveredCellReadHandler extends ElementReadHandler +{ + + private final Element coveredCell; + + public CoveredCellReadHandler() + { + coveredCell = new Section(); + } + + public Element getElement() + { + return coveredCell; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableCellReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableCellReadHandler.java new file mode 100644 index 000000000000..7d34b5e18346 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableCellReadHandler.java @@ -0,0 +1,49 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TableCellReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.table; + +import com.sun.star.report.pentaho.model.TableCellElement; +import com.sun.star.report.pentaho.parser.text.NoCDATATextContentReadHandler; + +/** + * A read handler for table-cell contents. This is basicly a text-content + * read handler; we may extend this implementation later. + * + * @author Thomas Morgner + * @since 05.03.2007 + */ +public class TableCellReadHandler extends NoCDATATextContentReadHandler +{ + + public TableCellReadHandler() + { + super(new TableCellElement(), true); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java new file mode 100644 index 000000000000..5b9e11fcbac6 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TableColumnReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.table; + +import org.jfree.report.structure.Section; +import org.jfree.report.structure.Element; +import com.sun.star.report.pentaho.parser.ElementReadHandler; + +/** + * Creation-Date: 03.07.2006, 14:26:55 + * + * @author Thomas Morgner + */ +public class TableColumnReadHandler extends ElementReadHandler +{ + + private final Section tableColumn; + public TableColumnReadHandler() + { + tableColumn = new Section(); + } + + public Element getElement() + { + return tableColumn; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java new file mode 100644 index 000000000000..a0052dbc1a9e --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java @@ -0,0 +1,102 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TableColumnsReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.table; + +import java.util.ArrayList; + +import org.jfree.report.structure.Section; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import java.util.List; + +/** + * Creation-Date: 03.07.2006, 13:50:41 + * + * @author Thomas Morgner + */ +public class TableColumnsReadHandler extends ElementReadHandler +{ + + private final List columns; + private final Section tableColumns; + + public TableColumnsReadHandler() + { + columns = new ArrayList(); + tableColumns = new Section(); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.TABLE_NS.equals(uri) && OfficeToken.TABLE_COLUMN.equals(tagName) ) + { + final TableColumnReadHandler readHandler = new TableColumnReadHandler(); + columns.add(readHandler); + return readHandler; + } + + return null; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException + { + for (int i = 0; i < columns.size(); i++) + { + final TableColumnReadHandler handler = (TableColumnReadHandler) columns.get(i); + tableColumns.addNode(handler.getElement()); + } + } + + public Element getElement() + { + return tableColumns; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableReadHandler.java new file mode 100644 index 000000000000..365000792277 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableReadHandler.java @@ -0,0 +1,144 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TableReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.table; + +import java.util.ArrayList; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.model.OfficeTableSection; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.parser.rpt.ConditionalPrintExpressionReadHandler; +import java.util.List; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Creation-Date: 03.07.2006, 13:47:47 + * + * @author Thomas Morgner + */ +public class TableReadHandler extends ElementReadHandler +{ + + private final List children; + private final Section table; + + public TableReadHandler() + { + children = new ArrayList(); + table = new OfficeTableSection(); + } + + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) + throws SAXException + { + super.startParsing(attrs); + final String enabled = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "visible"); + if (enabled == null || OfficeToken.TRUE.equals(enabled)) + { + table.setEnabled(true); + } + else + { + table.setEnabled(false); + } + + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.OOREPORT_NS.equals(uri) && "conditional-print-expression".equals(tagName)) + { + return new ConditionalPrintExpressionReadHandler(table); + } + else if (OfficeNamespaces.TABLE_NS.equals(uri)) + { + if (OfficeToken.TABLE_COLUMNS.equals(tagName) || OfficeToken.TABLE_HEADER_COLUMNS.equals(tagName)) + { + final TableColumnsReadHandler columns = new TableColumnsReadHandler(); + children.add(columns); + return columns; + } + else if (OfficeToken.TABLE_ROW.equals(tagName)) + { + final TableRowReadHandler rowHandler = new TableRowReadHandler(); + children.add(rowHandler); + return rowHandler; + } + else if (OfficeToken.TABLE_ROWS.equals(tagName) || OfficeToken.TABLE_HEADER_ROWS.equals(tagName)) + { + final TableRowsReadHandler rowsHandler = new TableRowsReadHandler(); + children.add(rowsHandler); + return rowsHandler; + } + } + return null; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException + { + for (int i = 0; i < children.size(); i++) + { + final ElementReadHandler handler = (ElementReadHandler) children.get(i); + table.addNode(handler.getElement()); + } + } + + public Element getElement() + { + return table; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowReadHandler.java new file mode 100644 index 000000000000..14af3abf601a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowReadHandler.java @@ -0,0 +1,125 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TableRowReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.table; + +import java.util.ArrayList; + +import org.jfree.report.structure.Section; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import java.util.List; + +/** + * Creation-Date: 03.07.2006, 13:51:47 + * + * @author Thomas Morgner + */ +public class TableRowReadHandler extends ElementReadHandler +{ + + private final List tableCells; + private final Section tableRow; + + public TableRowReadHandler() + { + tableCells = new ArrayList(); + tableRow = new Section(); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + final XmlReadHandler rh; + if (OfficeNamespaces.TABLE_NS.equals(uri)) + { + if (OfficeToken.TABLE_CELL.equals(tagName)) + { + rh = new TableCellReadHandler(); + } + else if (OfficeToken.COVERED_TABLE_CELL.equals(tagName)) + { + rh = new CoveredCellReadHandler(); + } + else + { + rh = null; + } + if (rh != null) + { + tableCells.add(rh); + } + } + else + { + rh = null; + } + return rh; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException + { + for (int i = 0; i < tableCells.size(); i++) + { + final ElementReadHandler handler = (ElementReadHandler) tableCells.get(i); + tableRow.addNode(handler.getElement()); + } + } + + /** + * Returns the object for this element or null, if this element does not + * create an object. + * + * @return the object. + */ + public Element getElement() + { + return tableRow; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowsReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowsReadHandler.java new file mode 100644 index 000000000000..77db358f8165 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowsReadHandler.java @@ -0,0 +1,101 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TableRowsReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.table; + +import java.util.ArrayList; + +import org.jfree.report.structure.Section; +import org.jfree.report.structure.Element; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import java.util.List; + +/** + * + * @author Ocke Janssen + */ +public class TableRowsReadHandler extends ElementReadHandler +{ + + private final List rows; + private final Section tableRows; + + public TableRowsReadHandler() + { + rows = new ArrayList(); + tableRows = new Section(); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.TABLE_NS.equals(uri) && OfficeToken.TABLE_ROW.equals(tagName)) + { + final TableRowReadHandler readHandler = new TableRowReadHandler(); + rows.add(readHandler); + return readHandler; + } + + return null; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException + { + for (int i = 0; i < rows.size(); i++) + { + final TableRowReadHandler handler = (TableRowReadHandler) rows.get(i); + tableRows.addNode(handler.getElement()); + } + } + + public Element getElement() + { + return tableRows; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/text/NoCDATATextContentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/text/NoCDATATextContentReadHandler.java new file mode 100644 index 000000000000..dc2eee157b7d --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/text/NoCDATATextContentReadHandler.java @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2007, Your Corporation. All Rights Reserved. + */ +package com.sun.star.report.pentaho.parser.text; + +import java.util.ArrayList; + +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.parser.rpt.FixedContentReadHandler; +import com.sun.star.report.pentaho.parser.rpt.FormattedTextReadHandler; +import com.sun.star.report.pentaho.parser.rpt.ImageReadHandler; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.parser.rpt.SubDocumentReadHandler; +import java.util.List; +import org.jfree.report.structure.Section; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.StaticText; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * This is a generic implementation that accepts all input and adds special + * handlers for the report-elements. + * + * @author Thomas Morgner + */ +public class NoCDATATextContentReadHandler extends ElementReadHandler +{ + + private Section section; + private List children; + private boolean copyType; + + public NoCDATATextContentReadHandler(final Section section, + final boolean copyType) + { + this.children = new ArrayList(); + this.section = section; + this.copyType = copyType; + } + + public NoCDATATextContentReadHandler(final Section section) + { + this(section, false); + } + + public NoCDATATextContentReadHandler() + { + this(new Section(), true); + } + + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) throws SAXException + { + super.startParsing(attrs); + final Element element = getElement(); + if (copyType) + { + copyElementType(element); + } + copyAttributes(attrs, element); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (OfficeNamespaces.OOREPORT_NS.equals(uri)) + { + if ("fixed-content".equals(tagName)) + { + final FixedContentReadHandler fixedContentReadHandler = new FixedContentReadHandler(); + children.add(fixedContentReadHandler); + return fixedContentReadHandler; + } + if ("formatted-text".equals(tagName)) + { + final FormattedTextReadHandler formattedTextReadHandler = new FormattedTextReadHandler(); + children.add(formattedTextReadHandler); + return formattedTextReadHandler; + } + if (OfficeToken.IMAGE.equals(tagName)) + { + final ImageReadHandler imageReadHandler = new ImageReadHandler(); + children.add(imageReadHandler); + return imageReadHandler; + } + if ("sub-document".equals(tagName)) + { + final SubDocumentReadHandler subDocReadHandler = new SubDocumentReadHandler(section); + // children.add(subDocReadHandler); + return subDocReadHandler; + } + } + if (OfficeNamespaces.DRAWING_NS.equals(uri)) + { + final XmlReadHandler readHandler; + if (OfficeToken.IMAGE.equals(tagName)) + { + readHandler = new ImageReadHandler(); + } + else + { + readHandler = new NoCDATATextContentReadHandler(); + } + children.add(readHandler); + return readHandler; + } + else + { + final TextContentReadHandler readHandler = new TextContentReadHandler(); + children.add(readHandler); + return readHandler; + } + } + + public List getChildren() + { + return children; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException + { + for (int i = 0; i < children.size(); i++) + { + final Object o = children.get(i); + if (o instanceof ElementReadHandler) + { + final ElementReadHandler handler = (ElementReadHandler) o; + section.addNode(handler.getElement()); + } + else if (o instanceof StaticText) + { + section.addNode((StaticText) o); + } + } + } + + public Element getElement() + { + return section; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/text/TextContentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/text/TextContentReadHandler.java new file mode 100644 index 000000000000..19af5196fa2b --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/text/TextContentReadHandler.java @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TextContentReadHandler.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.text; + +import org.jfree.report.structure.Section; +import org.jfree.report.structure.StaticText; +import org.xml.sax.SAXException; + +/** + * This is a generic implementation that accepts all input and adds special + * handlers for the report-elements. + * + * @author Thomas Morgner + */ +public class TextContentReadHandler extends NoCDATATextContentReadHandler +{ + + public TextContentReadHandler(final Section section, final boolean copyType) + { + super(section, copyType); + } + + public TextContentReadHandler(final Section section) + { + super(section); + } + + public TextContentReadHandler() + { + } + + /** + * This method is called to process the character data between element tags. + * + * @param ch the character buffer. + * @param start the start index. + * @param length the length. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + public void characters(final char[] ch, final int start, final int length) + throws SAXException + { + getChildren().add(new StaticText(new String(ch, start, length))); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/xlink/XLinkReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/xlink/XLinkReadHandler.java new file mode 100644 index 000000000000..e8ff4b3f65df --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/xlink/XLinkReadHandler.java @@ -0,0 +1,98 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: XLinkReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.parser.xlink; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * An image reference. + * + * @author Thomas Morgner + */ +public class XLinkReadHandler extends AbstractXmlReadHandler +{ + + private String uri; + private String type; + private String show; + private String actuate; + + public XLinkReadHandler() + { + } + + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) throws SAXException + { + uri = attrs.getValue(OfficeNamespaces.XLINK_NS, "uri"); + type = attrs.getValue(OfficeNamespaces.XLINK_NS, "type"); + show = attrs.getValue(OfficeNamespaces.XLINK_NS, "show"); + actuate = attrs.getValue(OfficeNamespaces.XLINK_NS, "actuate"); + } + + /** + * Returns the object for this element or null, if this element does not + * create an object. + * + * @return the object. + */ + public Object getObject() throws SAXException + { + return uri; + } + + public String getUri() + { + return uri; + } + + public String getType() + { + return type; + } + + public String getShow() + { + return show; + } + + public String getActuate() + { + return actuate; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/smil.css b/reportbuilder/java/com/sun/star/report/pentaho/smil.css new file mode 100644 index 000000000000..b01076ff30ae --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/smil.css @@ -0,0 +1,5 @@ +@namespace url("urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"); + +/** + * All default styles for formating-objects elements (if there are any). + */ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/star-office.css b/reportbuilder/java/com/sun/star/report/pentaho/star-office.css new file mode 100644 index 000000000000..da515eb88df9 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/star-office.css @@ -0,0 +1,5 @@ +@namespace url("http://openoffice.org/2004/office"); + +/** + * All default styles for office elements. + */ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/star-report.css b/reportbuilder/java/com/sun/star/report/pentaho/star-report.css new file mode 100644 index 000000000000..ef4e595d8bf0 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/star-report.css @@ -0,0 +1,73 @@ +@namespace table url("urn:oasis:names:tc:opendocument:xmlns:table:1.0"); +@namespace text url("urn:oasis:names:tc:opendocument:xmlns:text:1.0"); +@namespace report url("http://openoffice.org/2005/report"); + +table|table { + display: table; +} + +table|table-columns { + display: table-column-group; +} + +table|table-column { + display: table-column; +} + +table|table-row { + display: table-row; +} + +table|table-cell { + display: table-cell; +} + +table|table-cell[number-columns-spanned], +table|table-cell[number-columns-spanned], +table|table-columns[number-columns-spanned], +table|table-column[number-columns-spanned] { + -x-liblayout-colspan: attr("table|number-columns-spanned"); +} + +table|table-cell[number-rows-spanned], +table|table-cell[number-rows-spanned] { + -x-liblayout-rowspan: attr("table|number-rows-spanned"); +} + + +/** + * Style definitions for star report. + */ +* { + vertical-align: baseline; +} + +/** + * A standard number format declaration. The number of decimal places + * and whether there is grouping is defined by the format string. + * + * The position and content of embedded text is also derived directly from + * the given format string text. + + number + scientific + text + boolean + date + currency + percentage + fraction + + */ +@format number myname { + -x-liblayout-decimal-replacement: "-"; + -x-liblayout-display-factor: 1000; + content: "'Prefix'#,##0.00'postfix'"; +} + +@format scientific anothername { + /* to be filled */ +} + + + diff --git a/reportbuilder/java/com/sun/star/report/pentaho/star-rpt.css b/reportbuilder/java/com/sun/star/report/pentaho/star-rpt.css new file mode 100644 index 000000000000..6da26872b28e --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/star-rpt.css @@ -0,0 +1,5 @@ +@namespace url("http://openoffice.org/2005/report"); + +/** + * All default styles for report elements. + */ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/LengthCalculator.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/LengthCalculator.java new file mode 100644 index 000000000000..9a0a330dbc15 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/LengthCalculator.java @@ -0,0 +1,116 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: LengthCalculator.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.styles; + +import org.jfree.layouting.input.style.values.CSSNumericType; +import org.jfree.layouting.input.style.values.CSSNumericValue; + +/** + * A helper class that sums up various CSS-length. The various unit types are + * kept separate until the final result is computed to minimize the computation + * inaccuracy. + * + * @author Thomas Morgner + * @since 15.03.2007 + */ +public class LengthCalculator +{ + // and centimeter (x10) + private double millimeter; + + // and pica (x12) and inch(x72). Px is assumed to be in 96dpi. + private double point; + + private double pixel; + + public LengthCalculator() + { + } + + public void add (final CSSNumericValue value) + { + if (value == null) + { + return; + } + + final CSSNumericType numericType = value.getType(); + if (numericType == CSSNumericType.CM) + { + millimeter += value.getValue() * 10; + } + else if (numericType == CSSNumericType.MM) + { + millimeter += value.getValue(); + } + else if (numericType == CSSNumericType.PT) + { + point += value.getValue(); + } + else if (numericType == CSSNumericType.PC) + { + point += 12 * value.getValue(); + } + else if (numericType == CSSNumericType.INCH) + { + point += 72 * value.getValue(); + } + else if (numericType == CSSNumericType.PX) + { + pixel += value.getValue(); + } + // LOGGER.debug ("Adding " + value + " [mm: " + millimeter + "] [pt: " + point + "] px: [" + pixel + "]"); + } + + public CSSNumericValue getResult () + { + if (pixel == 0 && point == 0) + { + return CSSNumericValue.createValue(CSSNumericType.MM, millimeter); + } + if (pixel == 0 && millimeter == 0) + { + return CSSNumericValue.createValue(CSSNumericType.PT, point); + } + if (point == 0 && millimeter == 0) + { + return CSSNumericValue.createValue(CSSNumericType.PX, pixel); + } + // else convert it. + + double result = point; + result += (millimeter * 10 * 72 / 254); + result += pixel * 72 / 96; + + return CSSNumericValue.createValue(CSSNumericType.PT, result); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java new file mode 100644 index 000000000000..1424d0becad6 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java @@ -0,0 +1,106 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StyleMapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.styles; + +import java.util.HashMap; + +import java.util.Map; +import org.pentaho.reporting.libraries.resourceloader.Resource; +import org.pentaho.reporting.libraries.resourceloader.ResourceException; +import org.pentaho.reporting.libraries.resourceloader.ResourceManager; + +/** + * The style-mapper holds all information about the OpenOffice style mapping + * mechanism. OpenOffice references styles by their name and context, a style + * has a style-family assigned. The style family is determined by the element + * referencing the style, and there is no easily accessible information + * available on that. + *

+ * Therefore this mapper acts as gatekeeper for this information. The style + * mapping information is read from an external definition file and can be + * maintained externally. + * + * @author Thomas Morgner + * @since 11.03.2007 + */ +public class StyleMapper +{ + private final Map backend; + + public StyleMapper() + { + this.backend = new HashMap(); + } + + public void addMapping(final StyleMappingRule rule) + { + backend.put(rule.getKey(), rule); + } + + public boolean isListOfStyles(final String elementNamespace, + final String elementTagName, + final String attributeNamespace, + final String attributeName) + { + final StyleMapperKey key = new StyleMapperKey + (elementNamespace, elementTagName, attributeNamespace, attributeName); + final StyleMappingRule rule = (StyleMappingRule) backend.get(key); + if (rule == null) + { + return false; + } + return rule.isListOfValues(); + } + + public String getStyleFamilyFor(final String elementNamespace, + final String elementTagName, + final String attributeNamespace, + final String attributeName) + { + final StyleMapperKey key = new StyleMapperKey + (elementNamespace, elementTagName, attributeNamespace, attributeName); + final StyleMappingRule rule = (StyleMappingRule) backend.get(key); + if (rule == null) + { + return null; + } + return rule.getFamily(); + } + + public static StyleMapper loadInstance (final ResourceManager resourceManager) + throws ResourceException + { + final Resource resource = resourceManager.createDirectly + ("res://com/sun/star/report/pentaho/styles/stylemapper.xml", StyleMapper.class); + return (StyleMapper) resource.getResource(); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java new file mode 100644 index 000000000000..64b50cba1197 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java @@ -0,0 +1,123 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StyleMapperKey.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.styles; + +/** + * A hash key for the stylemapper. + * + * @author Thomas Morgner + * @since 12.03.2007 + */ +public final class StyleMapperKey +{ + + private final String elementNamespace; + private final String elementName; + private final String attributeNamespace; + private final String attributeName; + private final int hashCode; + + public StyleMapperKey(final String elementNamespace, + final String elementName, + final String attributeNamespace, + final String attributeName) + { + if (elementNamespace == null) + { + throw new NullPointerException(); + } + if (elementName == null) + { + throw new NullPointerException(); + } + + this.elementNamespace = elementNamespace; + this.elementName = elementName; + this.attributeNamespace = attributeNamespace; + this.attributeName = attributeName; + this.hashCode = computeHashCode(); + } + + public String getElementNamespace() + { + return elementNamespace; + } + + public String getElementName() + { + return elementName; + } + + public String getAttributeNamespace() + { + return attributeNamespace; + } + + public String getAttributeName() + { + return attributeName; + } + + public boolean equals(final Object o) + { + if (this != o) + { + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final StyleMapperKey that = (StyleMapperKey) o; + + if ((attributeName != null ? !attributeName.equals(that.attributeName) : that.attributeName != null) || + (attributeNamespace != null ? !attributeNamespace.equals(that.attributeNamespace) : that.attributeNamespace != null) || + !elementName.equals(that.elementName) || !elementNamespace.equals(that.elementNamespace)) + { + return false; + } + } + + return true; + } + + private int computeHashCode() + { + int result = elementNamespace.hashCode(); + result = 31 * result + elementName.hashCode(); + result = 31 * result + (attributeNamespace != null ? attributeNamespace.hashCode() : 0); + result = 31 * result + (attributeName != null ? attributeName.hashCode() : 0); + return result; + } + + public int hashCode() + { + return hashCode; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java new file mode 100644 index 000000000000..0b6319af3848 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StyleMapperXmlFactoryModule.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.styles; + +import org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo; +import org.pentaho.reporting.libraries.xmlns.parser.XmlFactoryModule; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + +/** + * An XML-FactoryModule that load the style-mapper contents. + * + * @author Thomas Morgner + * @since 12.03.2007 + */ +public class StyleMapperXmlFactoryModule implements XmlFactoryModule +{ + + public static final String NAMESPACE = + "http://jfreereport.sourceforge.net/namespaces/engine/openoffice/stylemapper"; + + public StyleMapperXmlFactoryModule() + { + } + + public XmlReadHandler createReadHandler(final XmlDocumentInfo documentInfo) + { + return new StyleMappingDocumentReadHandler(); + } + + public int getDocumentSupport(final XmlDocumentInfo documentInfo) + { + final String rootNamespace = documentInfo.getRootElementNameSpace(); + if (StyleMapperXmlFactoryModule.NAMESPACE.equals(rootNamespace) && + "style-mapper-definition".equals(documentInfo.getRootElement())) + { + + return XmlFactoryModule.RECOGNIZED_BY_NAMESPACE; + } + return XmlFactoryModule.NOT_RECOGNIZED; + } + + public String getDefaultNamespace(final XmlDocumentInfo documentInfo) + { + return null; + } +} + diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java new file mode 100644 index 000000000000..4d9646303b38 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java @@ -0,0 +1,59 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StyleMapperXmlResourceFactory.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.styles; + +import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlResourceFactory; +import org.jfree.report.JFreeReportBoot; +import org.pentaho.reporting.libraries.base.config.Configuration; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 12.03.2007 + */ +public class StyleMapperXmlResourceFactory extends AbstractXmlResourceFactory +{ + public StyleMapperXmlResourceFactory() + { + } + + protected Configuration getConfiguration() + { + return JFreeReportBoot.getInstance().getGlobalConfig(); + } + + public Class getFactoryType() + { + return StyleMapper.class; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java new file mode 100644 index 000000000000..135d6667144c --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java @@ -0,0 +1,108 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StyleMappingDocumentReadHandler.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.styles; + +import java.util.ArrayList; + +import java.util.List; +import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; +import org.xml.sax.SAXException; +import org.xml.sax.Attributes; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 12.03.2007 + */ +public class StyleMappingDocumentReadHandler extends AbstractXmlReadHandler +{ + + private final StyleMapper styleMapper; + private final List mappings; + + public StyleMappingDocumentReadHandler() + { + this.mappings = new ArrayList(); + this.styleMapper = new StyleMapper(); + } + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + if (isSameNamespace(uri) && "mapping".equals(tagName)) + { + final StyleMappingReadHandler smr = new StyleMappingReadHandler(); + mappings.add(smr); + return smr; + } + return null; + } + + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() + throws SAXException + { + for (int i = 0; i < mappings.size(); i++) + { + final StyleMappingReadHandler handler = + (StyleMappingReadHandler) mappings.get(i); + styleMapper.addMapping(handler.getRule()); + } + } + + /** + * Returns the object for this element or null, if this element does not + * create an object. + * + * @return the object. + */ + public Object getObject() + throws SAXException + { + return styleMapper; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java new file mode 100644 index 000000000000..21101d847e44 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java @@ -0,0 +1,109 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StyleMappingReadHandler.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.styles; + +import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.ParseException; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 12.03.2007 + */ +public class StyleMappingReadHandler extends AbstractXmlReadHandler +{ + private StyleMappingRule rule; + + public StyleMappingReadHandler() + { + } + + + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) + throws SAXException + { + final String elementNamespace = attrs.getValue(getUri(), + "element-namespace"); + if (elementNamespace == null) + { + throw new ParseException + ("Required attribute 'element-namespace' is missing", getLocator()); + } + + final String elementName = attrs.getValue(getUri(), "element-name"); + + if (elementName == null) + { + throw new ParseException + ("Required attribute 'element-name' is missing", getLocator()); + } + + final String attributeNamespace = attrs.getValue(getUri(), + "attribute-namespace"); + final String attributeName = attrs.getValue(getUri(), "attribute-name"); + + final boolean listOfValues = + "styleNameRefs".equals(attrs.getValue(getUri(), "type")); + + final String family = attrs.getValue(getUri(), "style-family"); + final StyleMapperKey key = new StyleMapperKey + (elementNamespace, elementName, attributeNamespace, attributeName); + rule = new StyleMappingRule(key, family, listOfValues); + } + + + public StyleMappingRule getRule() + { + return rule; + } + + /** + * Returns the object for this element or null, if this element does not + * create an object. + * + * @return the object. + */ + public Object getObject() + throws SAXException + { + return rule; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java new file mode 100644 index 000000000000..742daf8ba6e5 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: StyleMappingRule.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.styles; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 12.03.2007 + */ +public class StyleMappingRule +{ + private final StyleMapperKey key; + private final String family; + private final boolean listOfValues; + + + public StyleMappingRule(final StyleMapperKey key, final String family, + final boolean listOfValues) + { + this.key = key; + this.family = family; + this.listOfValues = listOfValues; + } + + + public StyleMapperKey getKey() + { + return key; + } + + public String getFamily() + { + return family; + } + + public boolean isListOfValues() + { + return listOfValues; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xml b/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xml new file mode 100644 index 000000000000..e6fa1d089921 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xml @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xsd b/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xsd new file mode 100644 index 000000000000..905dbc8464d6 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xsd @@ -0,0 +1,95 @@ + + + + + + This schema describes the format of the stylemapper definition file. + The stylemapper declares what style-families are referenced by an element. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/reportbuilder/java/com/sun/star/report/pentaho/svg.css b/reportbuilder/java/com/sun/star/report/pentaho/svg.css new file mode 100644 index 000000000000..f715210c7c91 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/svg.css @@ -0,0 +1,5 @@ +@namespace url("urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"); + +/** + * All default styles for formating-objects elements (if there are any). + */ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/xsl-fo.css b/reportbuilder/java/com/sun/star/report/pentaho/xsl-fo.css new file mode 100644 index 000000000000..494ee66934e7 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/xsl-fo.css @@ -0,0 +1,5 @@ +@namespace url("urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"); + +/** + * All default styles for formating-objects elements (if there are any). + */ diff --git a/reportbuilder/java/com/sun/star/report/util/DefaultJobProperties.java b/reportbuilder/java/com/sun/star/report/util/DefaultJobProperties.java new file mode 100644 index 000000000000..9cd70b1c69f0 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/util/DefaultJobProperties.java @@ -0,0 +1,83 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: DefaultJobProperties.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.util; + +import java.util.HashMap; + +import com.sun.star.report.JobProperties; +import com.sun.star.report.ReportEngineMetaData; +import com.sun.star.report.JobDefinitionException; +import java.util.Map; + +public class DefaultJobProperties implements JobProperties +{ + private final ReportEngineMetaData metaData; + private final Map properties; + + public DefaultJobProperties (final ReportEngineMetaData metaData) + { + if (metaData == null) + { + throw new NullPointerException(); + } + this.properties = new HashMap(); + this.metaData = metaData; + } + + public Object getProperty (final String key) + { + return properties.get(key); + } + + public void setProperty (final String key, final Object value) + throws JobDefinitionException + { + final Class type = metaData.getParameterType(key); + if (type == null) + { + throw new JobDefinitionException("The parameter name is not known: " + key); + } + if (!type.isInstance(value)) + { + throw new JobDefinitionException("The parameter value is not understood"); + } + + this.properties.put(key, value); + } + + public JobProperties copy() + { + final DefaultJobProperties props = new DefaultJobProperties(metaData); + props.properties.putAll(properties); + return props; + } +} diff --git a/reportbuilder/java/com/sun/star/report/util/DefaultParameterMap.java b/reportbuilder/java/com/sun/star/report/util/DefaultParameterMap.java new file mode 100644 index 000000000000..29ee586d5075 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/util/DefaultParameterMap.java @@ -0,0 +1,129 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: DefaultParameterMap.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.util; + +import java.util.HashMap; + +import com.sun.star.report.ParameterMap; +import java.util.Map; + +public class DefaultParameterMap implements ParameterMap +{ + private final Map backend; + + public DefaultParameterMap () + { + backend = new HashMap(); + } + + public void clear () + { + backend.clear(); + } + + /** + * Retrieves the value stored for a key in this properties collection. + * + * @param key the property key. + * @return The stored value, or null if the key does not exist in this + * collection. + */ + public Object get (final String key) + { + if (key == null) + { + throw new NullPointerException + ("DefaultParameterMap.get (..): Parameter 'key' must not be null"); + } + return backend.get(key); + } + + /** + * Retrieves the value stored for a key in this properties collection, and returning the + * default value if the key was not stored in this properties collection. + * + * @param key the property key. + * @param defaultValue the default value to be returned when the key is not stored in + * this properties collection. + * @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) + { + if (key == null) + { + throw new NullPointerException + ("DefaultParameterMap.get (..): Parameter 'key' must not be null"); + } + final Object o = this.backend.get(key); + if (o == null) + { + return defaultValue; + } + return o; + } + + public String[] keys () + { + return (String[]) this.backend.keySet().toArray(new String[backend.size()]); + } + + /** + * Adds a property to this properties collection. If a property with the given name + * exist, the property will be replaced with the new value. If the value is null, the + * property will be removed. + * + * @param key the property key. + * @param value the property value. + */ + public void put (final String key, final Object value) + { + if (key == null) + { + throw new NullPointerException + ("ReportProperties.put (..): Parameter 'key' must not be null"); + } + if (value == null) + { + this.backend.remove(key); + } + else + { + this.backend.put(key, value); + } + } + + public int size () + { + return this.backend.size(); + } +} diff --git a/reportbuilder/java/com/sun/star/report/util/DefaultReportJobDefinition.java b/reportbuilder/java/com/sun/star/report/util/DefaultReportJobDefinition.java new file mode 100644 index 000000000000..f9e7420d600a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/util/DefaultReportJobDefinition.java @@ -0,0 +1,123 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: DefaultReportJobDefinition.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.util; + +import com.sun.star.report.DataSourceFactory; +import com.sun.star.report.InputRepository; +import com.sun.star.report.JobDefinitionException; +import com.sun.star.report.JobProperties; +import com.sun.star.report.OutputRepository; +import com.sun.star.report.ParameterMap; +import com.sun.star.report.ReportEngineMetaData; +import com.sun.star.report.ReportEngineParameterNames; +import com.sun.star.report.ReportJobDefinition; + +public class DefaultReportJobDefinition implements ReportJobDefinition +{ + public static final String OUTPUT_TYPE = "output-type"; + + private final DefaultParameterMap parameters; + private final DefaultJobProperties properties; + + public DefaultReportJobDefinition (final ReportEngineMetaData metaData) + { + this.parameters = new DefaultParameterMap(); + this.properties = new DefaultJobProperties(metaData); + } + + public void setDataSourceFactory (final DataSourceFactory dataSourceFactory) + throws JobDefinitionException + { + this.properties.setProperty(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY, dataSourceFactory); + } + + public DataSourceFactory getDataSourceFactory () + { + return (DataSourceFactory) this.properties.getProperty(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY); + } + + public InputRepository getInputRepository () + { + return (InputRepository) + this.properties.getProperty(ReportEngineParameterNames.INPUT_REPOSITORY); + } + + public void setInputRepository (final InputRepository inputRepository) + throws JobDefinitionException + { + this.properties.setProperty(ReportEngineParameterNames.INPUT_REPOSITORY, inputRepository); + } + + public OutputRepository getOutputRepository () + { + return (OutputRepository) + this.properties.getProperty(ReportEngineParameterNames.OUTPUT_REPOSITORY); + } + + public void setOutputRepository (final OutputRepository outputRepository) + throws JobDefinitionException + { + this.properties.setProperty(ReportEngineParameterNames.OUTPUT_REPOSITORY, outputRepository); + } + + /** + * The parameters of the root report definition. The parameters for the subreports are + * defined using mappings, it would not make sense to define them here. + * + * @return a map container for query parameters. + */ + public ParameterMap getQueryParameters () + { + return parameters; + } + + public void setReportDefinitionName (final String reportDefinitionName) + throws JobDefinitionException + { + this.properties.setProperty(ReportEngineParameterNames.INPUT_NAME, reportDefinitionName); + } + + /** + * The name under which we can load the report definition. + * + * @return the report definition's name. + */ + public String getReportDefinitionName () + { + return (String) this.properties.getProperty(ReportEngineParameterNames.INPUT_NAME); + } + + public JobProperties getProcessingParameters () + { + return properties; + } +} diff --git a/reportbuilder/java/com/sun/star/report/util/ManifestWriter.java b/reportbuilder/java/com/sun/star/report/util/ManifestWriter.java new file mode 100644 index 000000000000..9fab3246ae8f --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/util/ManifestWriter.java @@ -0,0 +1,122 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ManifestWriter.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package com.sun.star.report.util; + +import java.util.HashMap; +import java.util.Map; +import java.util.Iterator; +import java.io.OutputStreamWriter; +import java.io.IOException; +import java.io.OutputStream; + +import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport; +import org.pentaho.reporting.libraries.xmlns.writer.DefaultTagDescription; +import org.pentaho.reporting.libraries.xmlns.writer.XmlWriter; +import org.pentaho.reporting.libraries.xmlns.common.AttributeList; +import org.jfree.report.JFreeReportBoot; +import com.sun.star.report.OutputRepository; + +/** + * Creation-Date: 24.07.2007, 18:16:52 + * + * @author Thomas Morgner + */ +public class ManifestWriter +{ + // need this two strings other it breaks the ooo build :-( + public static final String MANIFEST_NS = "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"; + public static final String TAG_DEF_PREFIX = "com.sun.star.report.pentaho.output."; + private final Map entries; + + public ManifestWriter() + { + entries = new HashMap(); + } + + public void addEntry(final String fullPath, final String mimeType) + { + if (fullPath == null) + { + throw new NullPointerException(); + } + if (mimeType == null) + { + throw new NullPointerException(); + } + if ("META-INF/manifest.xml".equals(fullPath)) + { + return; + } + entries.put(fullPath, mimeType); + } + + public boolean isEmpty() + { + return entries.isEmpty(); + } + + public void write(final OutputRepository outputRepository) throws IOException + { + if (isEmpty()) + { + return; + } + + final DefaultTagDescription tagDescription = new DefaultTagDescription(); + tagDescription.configure(JFreeReportBoot.getInstance().getGlobalConfig(), + TAG_DEF_PREFIX); + + final OutputStream manifestOutputStream = + outputRepository.createOutputStream("META-INF/manifest.xml", "text/xml"); + + final OutputStreamWriter writer = new OutputStreamWriter(manifestOutputStream, "UTF-8"); + final XmlWriter xmlWriter = new XmlWriter(writer, tagDescription); + xmlWriter.setAlwaysAddNamespace(true); + xmlWriter.writeXmlDeclaration("UTF-8"); + + final AttributeList rootAttributes = new AttributeList(); + rootAttributes.addNamespaceDeclaration("manifest", MANIFEST_NS); + xmlWriter.writeTag(MANIFEST_NS, "manifest", rootAttributes, XmlWriterSupport.OPEN); + + final Iterator iterator = entries.entrySet().iterator(); + while (iterator.hasNext()) + { + final Map.Entry entry = (Map.Entry) iterator.next(); + final AttributeList entryAttrs = new AttributeList(); + entryAttrs.setAttribute(MANIFEST_NS, "media-type", (String) entry.getValue()); + entryAttrs.setAttribute(MANIFEST_NS, "full-path", (String) entry.getKey()); + xmlWriter.writeTag(MANIFEST_NS, "file-entry", entryAttrs, XmlWriterSupport.CLOSE); + } + + xmlWriter.writeCloseTag(); + xmlWriter.close(); + } +} diff --git a/reportbuilder/java/com/sun/star/report/util/ReportUtil.java b/reportbuilder/java/com/sun/star/report/util/ReportUtil.java new file mode 100644 index 000000000000..b82a25a7a060 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/util/ReportUtil.java @@ -0,0 +1,45 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ReportUtil.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package com.sun.star.report.util; + +import org.pentaho.reporting.libraries.base.util.ObjectUtilities; + +/** + * + * @author Ocke Janssen + */ +public class ReportUtil { + + public static boolean equalString(final String uri,final String uri2) + { + return ObjectUtilities.equal(uri, uri2); + } +} diff --git a/reportbuilder/java/com/sun/star/report/util/makefile.mk b/reportbuilder/java/com/sun/star/report/util/makefile.mk new file mode 100644 index 000000000000..5ef3f02b0a1f --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/util/makefile.mk @@ -0,0 +1,49 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.9 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ = ..$/..$/..$/..$/..$/.. +PRJNAME = reportbuilder +TARGET= rpt_java_css_util +PACKAGE = com$/sun$/star$/report$/util + +# --- Settings ----------------------------------------------------- +.INCLUDE: settings.mk +#----- compile .java files ----------------------------------------- + +.IF "$(SYSTEM_JFREEREPORT)" == "YES" +CLASSPATH!:=$(CLASSPATH)$(PATH_SEPERATOR)$(LIBBASE_JAR)$(PATH_SEPERATOR)$(LIBXML_JAR)$(PATH_SEPERATOR)$(JFREEREPORT_JAR) +.ELSE +JARFILES = libbase-1.0.0.jar libxml-1.0.0.jar flow-engine-0.9.2.jar +.ENDIF + +JAVAFILES = DefaultJobProperties.java DefaultParameterMap.java DefaultReportJobDefinition.java ManifestWriter.java +# --- Targets ------------------------------------------------------ +.INCLUDE : target.mk -- cgit From dc0c53db2abd77ae481ba30280b153cca47c3230 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Lankenau Date: Mon, 23 Mar 2009 13:41:17 +0000 Subject: CWS-TOOLING: integrate CWS rptfix06_DEV300 2009-03-19 08:14:23 +0100 rene r269715 : #i10000# 2009-03-18 23:48:16 +0100 rene r269709 : #i100334# also reportbuilder 2009-03-18 22:39:42 +0100 rene r269706 : #i100334# fix build with system apache-commons 2009-03-18 22:34:24 +0100 rene r269705 : #i100335# build libs only when needed 2009-03-17 13:24:17 +0100 rene r269600 : fix system-* for the SRB --- reportbuilder/java/com/sun/star/report/makefile.mk | 6 ++--- .../java/com/sun/star/report/pentaho/makefile.mk | 27 +++++++++++++++++----- 2 files changed, 24 insertions(+), 9 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/makefile.mk b/reportbuilder/java/com/sun/star/report/makefile.mk index 9c5c2998f5c0..5b36aff44ee8 100644 --- a/reportbuilder/java/com/sun/star/report/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/makefile.mk @@ -39,10 +39,10 @@ PACKAGE = com$/sun$/star$/report #----- compile .java files ----------------------------------------- JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar -.IF "$(SYSTEM_JFREEREPORT)" == "YES" -XCLASSPATH!:==$(XCLASSPATH)$(PATH_SEPERATOR)$(JCOMMON_JAR)$(PATH_SEPERATOR)$(COMMONS_LOGGING_JAR) +.IF "$(SYSTEM_APACHE_COMMONS)" == "YES" +XCLASSPATH!:==$(XCLASSPATH)$(PATH_SEPERATOR)$(COMMONS_LOGGING_JAR) .ELSE -JARFILES += jcommon-1.0.10.jar commons-logging-1.1.1.jar +JARFILES += commons-logging-1.1.1.jar .ENDIF JAVAFILES := DataRow.java\ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk index fc2abb55e96a..5d448a6bc2be 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk @@ -41,10 +41,19 @@ nodep=true #----- compile .java files ----------------------------------------- JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar .IF "$(SYSTEM_JFREEREPORT)" == "YES" -XCLASSPATH!:=$(XCLASSPATH)$(FLUTE_JAR)$(PATH_SEPERATOR)$(LIBBASE_JAR)$(PATH_SEPERATOR)$(LIBXML_JAR)$(PATH_SEPERATOR)$(JFREEREPORT_JAR)$(PATH_SEPERATOR)$(LIBLOADER_JAR)$(PATH_SEPERATOR)$(SAC_JAR)$(PATH_SEPERATOR)$(LIBLAYOUT_JAR)$(PATH_SEPERATOR)$(LIBSERIALIZER_JAR)$(PATH_SEPERATOR)$(LIBFONTS_JAR)$(PATH_SEPERATOR)$(LIBFORMULA_JAR)$(PATH_SEPERATOR)$(LIBREPOSITORY_JAR)$(PATH_SEPERATOR)$(COMMONS_LOGGING_JAR) -COMP=fix_system_jfreereport +XCLASSPATH!:=$(XCLASSPATH)$(FLUTE_JAR)$(PATH_SEPERATOR)$(LIBBASE_JAR)$(PATH_SEPERATOR)$(LIBXML_JAR)$(PATH_SEPERATOR)$(JFREEREPORT_JAR)$(PATH_SEPERATOR)$(LIBLOADER_JAR)$(PATH_SEPERATOR)$(SAC_JAR)$(PATH_SEPERATOR)$(LIBLAYOUT_JAR)$(PATH_SEPERATOR)$(LIBSERIALIZER_JAR)$(PATH_SEPERATOR)$(LIBFONTS_JAR)$(PATH_SEPERATOR)$(LIBFORMULA_JAR)$(PATH_SEPERATOR)$(LIBREPOSITORY_JAR) .ELSE -JARFILES += flute-1.3.0.jar libbase-1.0.0.jar libfonts-1.0.0.jar libformula-0.2.0.jar liblayout-0.2.9.jar libloader-1.0.0.jar librepository-1.0.0.jar libxml-1.0.0.jar flow-engine-0.9.2.jar sac.jar commons-logging-1.1.1.jar +JARFILES += flute-1.3.0.jar libbase-1.0.0.jar libfonts-1.0.0.jar libformula-0.2.0.jar liblayout-0.2.9.jar libloader-1.0.0.jar librepository-1.0.0.jar libxml-1.0.0.jar flow-engine-0.9.2.jar sac.jar +.ENDIF + +.IF "$(SYSTEM_APACHE_COMMONS)" == "YES" +XCLASSPATH!:=$(XCLASSPATH)$(PATH_SEPERATOR)$(COMMONS_LOGGING_JAR) +.ELSE +JARFILES += commons-logging-1.1.1.jar +.ENDIF + +.IF "$(SYSTEM_JFREEREPORT)" == "YES" || "$(SYSTEM_APACHE_COMMONS)" == "YES" +COMP=fix_system_libs .ENDIF JAVAFILES := $(shell @$(FIND) . -name "*.java") @@ -94,13 +103,19 @@ CUSTOMMANIFESTFILE = Manifest.mf $(JARTARGETN) : $(COMP) $(PROPERTYFILES) $(CSSFILES) $(XSDFILES) $(TXTFILES) $(XMLFILES) .ENDIF # "$(JARTARGETN)"!="" -fix_system_jfreereport: - @echo "Fix Java Class-Path entry for JFree JFreeReport libraries from system." +fix_system_libs: + @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 +.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)#" \ + 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 +.ENDIF $(CLASSDIR)$/$(PACKAGE)$/%.properties : %.properties @@-$(MKDIRHIER) $(@:d) -- cgit From 60b884d262229438377396d1eee614f93a3fd2fd Mon Sep 17 00:00:00 2001 From: Hans-Joachim Lankenau Date: Mon, 23 Mar 2009 15:36:37 +0000 Subject: CWS-TOOLING: integrate CWS dba31j_DEV300 2009-03-11 12:24:24 +0100 iha r269311 : #i100102# report donut charts crash on load 2009-03-11 10:44:35 +0100 oj r269302 : #i100102# export meta.xml 2009-03-11 07:35:03 +0100 oj r269296 : #i99686# not used anymore 2009-03-11 07:34:27 +0100 oj r269295 : #i99686# not used anymore 2009-03-11 07:33:57 +0100 oj r269294 : #i99686# change storage usage 2009-03-10 15:21:41 +0100 mav r269275 : #i99686# test additional scenario 2009-03-10 08:37:10 +0100 mav r269239 : #i100040# calculate the name length correctly 2009-03-10 08:25:16 +0100 mav r269236 : #i99686# workaround to prevent crash while disposing the hierarchical stream 2009-03-10 07:14:05 +0100 oj r269235 : #i99686# fix usage of storage api 2009-03-10 07:13:17 +0100 oj r269234 : #i99686# fix usage of storage api 2009-03-09 13:33:26 +0100 fs r269085 : #i100012# 2009-03-09 13:11:08 +0100 fs r269081 : #i100036# don't store sub documents which have not been touched 2009-03-09 11:21:17 +0100 fs r269070 : #i100040# don't silence errors in impl_storeToStorage_throw 2009-03-09 10:28:48 +0100 oj r269065 : #i100036# throw exception when no activeConnection exists --- .../com/sun/star/report/StorageRepository.java | 3 ++- .../star/report/pentaho/output/ImageProducer.java | 22 +++++++++------- .../pentaho/output/chart/ChartRawReportTarget.java | 30 ++++++++++++++++++++++ 3 files changed, 45 insertions(+), 10 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/StorageRepository.java b/reportbuilder/java/com/sun/star/report/StorageRepository.java index bf5687da14ae..b32bcb3dab86 100644 --- a/reportbuilder/java/com/sun/star/report/StorageRepository.java +++ b/reportbuilder/java/com/sun/star/report/StorageRepository.java @@ -70,6 +70,7 @@ public class StorageRepository implements InputRepository, OutputRepository { this.input = input; this.output = output; + } public StorageRepository(final XStorage storage, final boolean isOutput) @@ -118,7 +119,7 @@ public class StorageRepository implements InputRepository, OutputRepository } try { - final XStream stream = (XStream) UnoRuntime.queryInterface(XStream.class, output.openStreamElement(name, ElementModes.WRITE | ElementModes.TRUNCATE)); + final XStream stream = output.openStreamElement(name, ElementModes.WRITE | ElementModes.TRUNCATE); stream.getInputStream().closeInput(); if (mimeType != null) { 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 94f2d4fffad0..9866d1a41c5e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java @@ -146,7 +146,7 @@ public class ImageProducer final byte b = keyData[i]; hashValue = b + hashValue * 23; } - this.hashCode = new Integer(hashValue); + this.hashCode = Integer.valueOf(hashValue); return hashValue; } } @@ -154,7 +154,6 @@ public class ImageProducer private final InputRepository inputRepository; private final OutputRepository outputRepository; private final ImageService imageService; - private final DefaultNameGenerator nameGenerator; public ImageProducer(final InputRepository inputRepository, final OutputRepository outputRepository, @@ -177,7 +176,6 @@ public class ImageProducer this.outputRepository = outputRepository; this.imageService = imageService; this.imageCache = new HashMap(); - this.nameGenerator = new DefaultNameGenerator(outputRepository); } /** @@ -275,8 +273,10 @@ public class ImageProducer // copy the image into the local output-storage // todo: Implement data-fingerprinting so that we can detect the mime-type - final String name = nameGenerator.generateName("Pictures/image", mimeType); - final OutputStream outputStream = outputRepository.createOutputStream(name, mimeType); + final OutputRepository storage = outputRepository.openOutputRepository("Pictures", null); + final DefaultNameGenerator nameGenerator = new DefaultNameGenerator(storage); + final String name = nameGenerator.generateName("image", mimeType); + final OutputStream outputStream = storage.createOutputStream(name, mimeType); final ByteArrayInputStream bin = new ByteArrayInputStream(data); try @@ -285,11 +285,12 @@ public class ImageProducer } finally { outputStream.close(); + storage.closeOutputRepository(); } final CSSNumericValue widthVal = CSSNumericValue.createValue(CSSNumericType.MM, dims.getWidth() / 100.0); final CSSNumericValue heightVal = CSSNumericValue.createValue(CSSNumericType.MM, dims.getHeight() / 100.0); - final OfficeImage officeImage = new OfficeImage(name, widthVal, heightVal); + final OfficeImage officeImage = new OfficeImage("Pictures/" + name, widthVal, heightVal); imageCache.put(imageKey, officeImage); return officeImage; } @@ -442,8 +443,10 @@ public class ImageProducer } // copy the image into the local output-storage - final String name = nameGenerator.generateName("Pictures/image", mimeType); - final OutputStream outputStream = outputRepository.createOutputStream(name, mimeType); + final OutputRepository storage = outputRepository.openOutputRepository("Pictures", null); + final DefaultNameGenerator nameGenerator = new DefaultNameGenerator(storage); + final String name = nameGenerator.generateName("image", mimeType); + final OutputStream outputStream = storage.createOutputStream(name, mimeType); final ByteArrayInputStream bin = new ByteArrayInputStream(data); try @@ -452,7 +455,8 @@ public class ImageProducer } finally { outputStream.close(); + storage.closeOutputRepository(); } - return name; + return "Pictures/" + name; } } 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 a98b64495579..56a2c036f2e8 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 @@ -38,12 +38,16 @@ import com.sun.star.report.OfficeToken; import com.sun.star.report.pentaho.PentahoReportEngineMetaData; import com.sun.star.report.pentaho.output.OfficeDocumentReportTarget; import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataFlags; import org.jfree.report.DataSourceException; import org.jfree.report.ReportProcessingException; import org.jfree.report.flow.ReportJob; +import org.jfree.report.flow.ReportStructureRoot; import org.jfree.report.flow.ReportTargetUtil; +import org.pentaho.reporting.libraries.base.util.IOUtils; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; import org.pentaho.reporting.libraries.xmlns.common.AttributeList; @@ -253,4 +257,30 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget } super.processText(text); } + public void endReport(final ReportStructureRoot report) + throws DataSourceException, ReportProcessingException + { + super.endReport(report); + try + { + // now copy the meta.xml + if (getInputRepository().isReadable("meta.xml")) + { + final InputStream inputStream = getInputRepository().createInputStream("meta.xml"); + try + { + final OutputStream outputMetaStream = getOutputRepository().createOutputStream("meta.xml", "text/xml"); + IOUtils.getInstance().copyStreams(inputStream, outputMetaStream); + outputMetaStream.close(); + } finally + { + inputStream.close(); + } + } + } + catch (IOException ioe) + { + throw new ReportProcessingException("Failed to write settings document"); + } + } } -- cgit From 5b0e3f7887374c6eb816646b75e50ab32cb3ca60 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Fri, 24 Apr 2009 18:34:24 +0000 Subject: CWS-TOOLING: integrate CWS dba31m_DEV300 2009-04-08 21:06:02 +0200 fs r270660 : #i100956# hold the assigned events in the ModelImpl, not in the DatabaseDocument, so they survive the model being destroyed 2009-04-08 12:40:13 +0200 b_michaelsen r270635 : #i100928# Opening the Tools->Options->Improvement Program Tabpage on first start accidently activates Usage Tracking 2009-04-07 12:56:29 +0200 fs r270594 : #i100866# don't call into the StatusIndicator with our mutex locked 2009-04-07 10:31:02 +0200 fs r270581 : #i100866# impl_import_throw -> impl_import_nolck_throw 2009-04-06 22:53:10 +0200 fs r270575 : #i100866# some more mutex lock tweaking 2009-04-06 22:01:51 +0200 fs r270573 : #i100861# load the Show/Hide strings from the proper (an existing, in particular) resource 2009-04-06 12:43:16 +0200 fs r270537 : #i100866# notifyEvent: instantiate the ScriptDocument only when required. 2009-04-06 12:42:03 +0200 fs r270536 : #i100866# rework how and when it is determined whether the DBDoc or sub documents contain scripts/macros. In particular, cache this information in the ODatabaseDocument implementation, so that queryInterface does not need to lock the mutex 2009-04-03 10:21:02 +0200 oj r270465 : #i100789# surround uno call with try catch 2009-04-03 09:18:37 +0200 oj r270453 : #i100789# check token is not null --- reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java index 26a454cab9aa..1a8d02d53b64 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java @@ -220,7 +220,7 @@ public final class SOFormulaParser extends ComponentBase // error occured so all token must be bad for (int i = 0; i < tokens.size(); i++) { - if ( !found && images.get(i).equals(ex.currentToken.image) ) + if ( !found && ex.currentToken != null && images.get(i).equals(ex.currentToken.image) ) found = true; if ( found ) { -- cgit From 19ed9c3a16889a49f6d6b222de40f7b377ff3e83 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Fri, 5 Jun 2009 09:47:55 +0000 Subject: CWS-TOOLING: integrate CWS dba32b 2009-06-03 14:58:08 +0200 fs r272581 : #i102439# 2009-05-29 13:56:18 +0200 fs r272456 : remove the sub form when the 'add subform' setting changes from to , not only its controls 2009-05-29 13:19:27 +0200 fs r272454 : display '(Default)' instead of an empty string when a control has the default font 2009-05-28 20:49:18 +0200 fs r272428 : #i98162# getFirstSelectedValue: do not return reference to a temporary 2009-05-27 15:30:22 +0200 msc r272353 : #102303# 2009-05-26 13:03:06 +0200 fs r272295 : spelling 2009-05-26 12:59:54 +0200 fs r272294 : merge m48 version to get latest cygwin related fixes 2009-05-25 14:02:06 +0200 fs r272239 : remove references to local files, needed for debugging sessions only 2009-05-25 14:01:16 +0200 fs r272238 : #i102021# ensure members such as bNumberFormat are initialized before actually returning them 2009-05-25 13:10:20 +0200 fs r272236 : #i10000# reset ENABLE_EVOAB2 2009-05-22 06:44:45 +0200 oj r272167 : #i99104# add import handler for calc-sett 2009-05-22 06:42:27 +0200 oj r272166 : #i99104# impl NullDate as member 2009-05-22 06:36:22 +0200 oj r272165 : #i99104# handle nulldate from parent model 2009-05-22 06:33:13 +0200 oj r272164 : #i99104# export and import calculation-settings and nulldate 2009-05-22 06:27:50 +0200 oj r272163 : #i99104# export and import calculation-settings and nulldate 2009-05-20 13:29:58 +0200 oj r272118 : #i99911# handle invalid name 2009-05-20 13:28:49 +0200 oj r272117 : #i101261# handle different rowsets 2009-05-20 11:29:55 +0200 msc r272111 : #i100000# 2009-05-20 11:28:27 +0200 msc r272110 : merge in change from dba32a 2009-05-20 11:27:38 +0200 msc r272109 : #102082# CTRL + C does not work 2009-05-20 09:43:36 +0200 oj r272106 : clean up includes 2009-05-20 09:32:15 +0200 oj r272105 : #i99060# merge error resovled now VERTICAL_ALIGN is in both stmt 2009-05-20 08:37:21 +0200 msc r272104 : add workaround for issue #102010# 2009-05-20 08:10:12 +0200 oj r272103 : #i99104# use numberformatkey 2009-05-20 08:07:02 +0200 oj r272102 : #i99104# use column info from rowset 2009-05-20 08:04:43 +0200 oj r272101 : #i102032# use a special column type where prec and scale are the values currently set at the column 2009-05-20 08:03:04 +0200 oj r272100 : #i102032# correct type info, we have to use SQL defined type names 2009-05-19 10:27:02 +0200 oj r272061 : #i99104# export null-date 2009-05-19 08:26:53 +0200 oj r272056 : #i99104# export null-date 2009-05-18 13:15:10 +0200 msc r272014 : add issue #102019# 2009-05-18 11:33:07 +0200 msc r272005 : add issue #102019# 2009-05-18 08:59:45 +0200 msc r271996 : add workaroud for issue #102010# 2009-05-15 10:21:24 +0200 msc r271929 : #101944# 2009-05-11 21:18:30 +0200 fs r271792 : #i99914# 2009-05-08 13:52:06 +0200 oj r271715 : #i96423# remember column span 2009-05-08 11:26:19 +0200 oj r271708 : #i98605# impl new scale mode 2009-05-08 10:33:35 +0200 fs r271706 : SendUserCall: only call into the shape notification routine for UserCall types where this is necessary (performance issue) 2009-05-07 20:52:44 +0200 fs r271698 : outsource ShapeProperty from shapepropertynotifier.hxx 2009-05-07 20:43:33 +0200 fs r271697 : #i99056# use notifyShapePropertyChange, instead of getShapePropertyChangeNotifier - the latter throws if no shape exists, yet 2009-05-07 20:33:58 +0200 fs r271696 : #i99056# +notifyShapePropertyChange: allow notifying chages without checking whether there actually already exists an SvxShape 2009-05-07 16:22:15 +0200 fs r271679 : #i10000# cygwin needs quotes around the classpath 2009-05-07 16:21:37 +0200 fs r271678 : #i10000# cygwin needs quotes around the classpath 2009-05-07 16:01:11 +0200 oj r271677 : #i99914# notify parent handler 2009-05-07 15:54:54 +0200 fs r271676 : #i10000# cygwin needs some quoting 2009-05-07 14:49:48 +0200 oj r271672 : #i99277# quote alias name 2009-05-07 14:48:12 +0200 oj r271671 : #i92538# add ~ in front of type 2009-05-07 14:37:13 +0200 oj r271667 : #i99118# change type from char to varchar 2009-05-07 14:36:23 +0200 oj r271666 : #i99118# clear dest columns when changing to create new table 2009-05-07 13:35:32 +0200 oj r271657 : #i94467# handle type 0 as double as well 2009-05-07 13:20:49 +0200 oj r271655 : i99743# setNull when varchar is no text 2009-05-07 12:58:06 +0200 fs r271651 : initialize the SdrObject's property change notifier after the ctor, if necessary 2009-05-07 11:47:18 +0200 fs r271647 : #i10000# 2009-05-07 10:57:16 +0200 fs r271639 : OPropertyBrowserController::propertyChange: care for the current property state, too, and properly forward it to the UI 2009-05-07 10:18:14 +0200 fs r271636 : onNewComponent: do not ask the map for grid columns, it will throw 2009-05-07 10:09:55 +0200 fs r271634 : #i101623# 2009-05-07 09:53:44 +0200 fs r271631 : #i101622# 2009-05-06 21:55:53 +0200 fs r271615 : #i10000# 2009-05-06 21:10:42 +0200 fs r271611 : #i10000# 2009-05-06 13:11:48 +0200 fs r271583 : #i10000# 2009-05-05 22:29:31 +0200 fs r271559 : proper assertion message 2009-05-05 22:29:03 +0200 fs r271558 : diagnostics 2009-05-05 22:16:16 +0200 fs r271557 : #i10000# 2009-05-05 13:50:32 +0200 fs r271513 : #i10000# 2009-05-05 10:21:50 +0200 fs r271503 : #i10000# 2009-05-05 09:30:26 +0200 fs r271501 : why did those survive the rebase -C step? 2009-05-05 09:18:12 +0200 fs r271500 : #i10000# 2009-05-04 17:08:17 +0200 fs r271475 : CWS-TOOLING: rebase CWS dba32b to trunk@271427 (milestone: DEV300:m47) 2009-05-04 14:51:26 +0200 fs r271456 : line ends 2009-04-30 15:55:27 +0200 fs r271418 : NewURL -> PublicConnectionURL 2009-04-22 21:18:34 +0200 fs r271141 : #i100944# 2009-04-22 09:12:26 +0200 oj r271071 : #i101261# little code change 2009-04-22 09:11:43 +0200 oj r271070 : #i101261# only ask for parameters which aren't set before 2009-04-22 09:11:25 +0200 oj r271069 : #i101261# new grabage container for nodes 2009-04-22 09:11:02 +0200 oj r271068 : #i101261# new grabage container for nodes 2009-04-22 09:10:44 +0200 oj r271067 : #i101261# new grabage container for nodes 2009-04-22 09:10:21 +0200 oj r271066 : #i101261# only ask for parameters which aren't set before 2009-04-22 09:08:24 +0200 oj r271065 : #i101261# only ask for parameters which aren't set before 2009-04-22 09:07:25 +0200 oj r271064 : #i101261# only ask for parameters which aren't set before 2009-04-22 08:49:07 +0200 oj r271062 : #i77501# preview only when needed 2009-04-22 08:45:44 +0200 oj r271061 : #i101261# new prop max rows 2009-04-22 08:44:18 +0200 oj r271060 : #i101261# create dataprovider earlier to avoid the wrong legend in chart 2009-04-22 08:42:48 +0200 oj r271059 : #i101261# handle parameter 2009-04-17 21:00:23 +0200 fs r270954 : #i98350# 2009-04-17 13:54:19 +0200 fs r270942 : #i99565# 2009-04-17 13:51:34 +0200 fs r270940 : #i101153# only localize the (potentially) localizable properties when there really is support at the control model 2009-04-17 11:43:14 +0200 fs r270932 : removed superfluous include 2009-04-17 10:10:15 +0200 fs r270926 : #i10000# 2009-04-17 10:02:36 +0200 fs r270925 : #i10000# 2009-04-17 09:15:13 +0200 fs r270918 : #i99056# some more refactoring of the recently introduced property change notification mechanism for UNO shapes 2009-04-17 09:14:56 +0200 fs r270917 : #i99056# some more refactoring of the recently introduced property change notification mechanism for UNO shapes 2009-04-17 09:13:25 +0200 fs r270915 : #i99056# some more refactoring of the recently introduced property change notification mechanism for UNO shapes 2009-04-17 08:30:34 +0200 fs r270914 : removed unotools/servicehelper.hxx in favour of the (duplicated) comphelper/servicehelper.hxx 2009-04-16 21:05:25 +0200 fs r270903 : #i10000# 2009-04-16 20:43:43 +0200 fs r270902 : #i99056# shape notification outsourced to the SdrObject, this is what all other shape implementations (which only aggregate an SvxShape) have access to, too 2009-04-16 15:57:36 +0200 fs r270891 : #i99056# make SetUnoControlModel virtual 2009-04-16 15:44:02 +0200 fs r270890 : #i99056# let the ScShapeObj notify changes in its Anchor property 2009-04-16 15:36:47 +0200 fs r270889 : #i99056# enable the sheet anchor type property, too 2009-04-16 15:33:45 +0200 fs r270887 : #i99056# shape notification outsourced to the SdrObject, this is what all other shape implementations (which only aggregate an SvxShape) have access to, too 2009-04-15 14:53:13 +0200 fs r270844 : #i10000# 2009-04-15 13:08:29 +0200 fs r270836 : #i10000# 2009-04-15 12:28:14 +0200 fs r270832 : #i10000# 2009-04-15 10:59:14 +0200 fs r270827 : #i10000# 2009-04-15 09:41:08 +0200 oj r270823 : fix issues found with findbugs and pmd 2009-04-14 21:08:04 +0200 fs r270808 : #i99056# implement SheetAnchorType - now the only thing missing to enable it is the proper notification when it is modified 2009-04-14 17:09:00 +0200 fs r270799 : #i99056# implement XServiceInfo for the ScShapeObj 2009-04-14 17:07:55 +0200 fs r270798 : #i99056# implement TextAnchorType, partially implement SheetAnchorType 2009-04-14 15:54:05 +0200 fs r270786 : #i99056# SwXShape: notify changes of the AnchorType property 2009-04-14 15:47:32 +0200 fs r270785 : #i99056# deliver shapepropertynotifier.hxx 2009-04-14 15:46:54 +0200 fs r270784 : diagnostics 2009-04-14 15:08:28 +0200 fs r270781 : #i99056# outsourced the SvxShape's property change notification code into a dedicated class 2009-04-14 14:41:09 +0200 fs r270773 : #i99056# outsourced the SvxShape's property change notification code into a dedicated class 2009-04-14 14:37:23 +0200 fs r270772 : in dtor, remove the properties from the temporary component context 2009-04-14 14:36:34 +0200 fs r270771 : getWeakUnoShape made const 2009-04-14 12:23:08 +0200 oj r270757 : #i101064# add missing braces 2009-04-14 12:21:25 +0200 oj r270756 : #i101065# add braces for gcc 4.3.2 2009-04-14 12:17:45 +0200 oj r270755 : #i101059# add dep for manifest 2009-04-09 12:06:58 +0200 oj r270686 : #i93100# use OptimalSize from control to get height 2009-04-08 09:56:55 +0200 oj r270619 : #i92537# handle calculations in the select columns as well 2009-04-08 09:30:39 +0200 oj r270615 : #i96657# throw error message when the key doesn't have any columns 2009-04-07 12:08:26 +0200 oj r270592 : #i77501# impl preview of the executed report 2009-04-07 12:01:56 +0200 oj r270591 : #i77501# impl preview of the executed report 2009-04-07 11:41:03 +0200 oj r270590 : #i77501# impl preview of the executed report 2009-04-07 11:39:32 +0200 oj r270589 : #i77501# impl preview of the executed report 2009-04-07 11:29:25 +0200 oj r270588 : #i77501# convert dos to unix lineends 2009-04-07 11:28:23 +0200 oj r270587 : #i77501# impl preview of the executed report 2009-04-07 11:16:50 +0200 oj r270586 : #i77501# impl preview of the executed report 2009-04-07 11:16:00 +0200 oj r270585 : #i77501# impl preview of the executed report 2009-04-07 11:15:44 +0200 oj r270584 : #i77501# impl preview of the executed report 2009-04-07 11:15:28 +0200 oj r270583 : #i77501# impl preview of the executed report 2009-04-07 11:15:04 +0200 oj r270582 : #i77501# impl preview of the executed report 2009-04-06 15:38:54 +0200 fs r270559 : merge changes from CWS dba32a herein 2009-04-03 15:56:16 +0200 fs r270494 : ImpSvMEdit::Resize: do multiple iterations, if necessary 2009-04-03 14:35:49 +0200 fs r270487 : #i10000# 2009-04-03 13:17:16 +0200 fs r270476 : #i99056# display geometry information for controls, too 2009-04-03 13:16:37 +0200 fs r270475 : #i99056# better ordering of the geometry properties 2009-04-03 13:16:07 +0200 fs r270473 : #i99056# now that SvxShape supports property change listeners, forward add/remove requests to it 2009-04-03 13:13:18 +0200 fs r270472 : #i99056# at SvxShape, allow for PropertyChangeListeners for Size/Position 2009-04-03 09:29:27 +0200 oj r270456 : #i94571# use correct prop name 2009-04-03 09:14:54 +0200 fs r270451 : merge changes from CWS dba32a herein 2009-04-02 17:00:51 +0200 fs r270424 : better diagnostics 2009-04-02 16:35:19 +0200 fs r270421 : diagnostics 2009-04-02 16:34:50 +0200 fs r270420 : #i99056# mxUnoShape not accessible anymore, use impl_setUnoShape instead 2009-04-02 16:32:48 +0200 fs r270419 : #i99056# make getUnoShape cheaper: keep the pointer to the SvxShape all the time, so there's no need to ask for it in getUnoShape. As a consequence, we will later be able to use the pointer in scenarious where performance (potentially) matters 2009-04-02 16:31:13 +0200 fs r270417 : merge changes from CWS dba32a herein 2009-04-02 16:23:16 +0200 fs r270414 : merge changes from CWS dba32a herein 2009-04-02 14:10:35 +0200 fs r270405 : #i10000# 2009-04-02 14:06:26 +0200 fs r270404 : merge changes from CWS dba32a herein 2009-04-02 14:03:03 +0200 fs r270401 : #i10000# 2009-04-02 13:58:13 +0200 fs r270400 : #i10000# 2009-04-02 12:59:44 +0200 fs r270397 : merge changes from CWS dba32a herein 2009-04-02 12:46:30 +0200 fs r270396 : #i99056# let the form page maintain a mapping between control models and control shapes 2009-04-02 12:44:07 +0200 fs r270395 : merge changes from CWS dba32a herein 2009-04-02 12:42:06 +0200 fs r270394 : merge changes from CWS dba32a herein 2009-04-02 12:35:20 +0200 fs r270393 : #i10000# precompiled header 2009-04-02 12:05:31 +0200 fs r270392 : merge changes from CWS dba32a herein 2009-04-02 12:00:42 +0200 fs r270391 : merge changes from CWS dba32a herein 2009-04-02 11:47:26 +0200 fs r270390 : merge changes from CWS dba32a herein 2009-04-02 11:39:15 +0200 oj r270389 : #i94467# foxpro impl several new types 2009-04-02 11:35:58 +0200 fs r270387 : merge changes from CWS dba32a herein 2009-04-01 14:10:51 +0200 fs r270329 : merge changes from CWS dba32a herein 2009-03-31 17:29:50 +0200 fs r270290 : merge changes from CWS dba32a herein 2009-03-30 14:53:56 +0200 fs r270233 : #i100417# don't set grid column widths to 0, but to 2009-03-30 12:31:03 +0200 oj r270213 : #i100552# wrong orb used 2009-03-30 12:19:20 +0200 oj r270212 : #i98303# convertlike corrected to sal_Unicode 2009-03-30 11:58:25 +0200 fs r270210 : merge changes from CWS dba32a herein 2009-03-30 11:38:16 +0200 oj r270205 : remove duplicate code from merge 2009-03-30 11:02:27 +0200 fs r270202 : merge changes from CWS dba32a herein 2009-03-30 11:02:19 +0200 fs r270201 : merge changes from CWS dba32a herein 2009-03-30 10:31:26 +0200 oj r270200 : #i100665# only throw exception and do not drop table 2009-03-30 09:36:24 +0200 fs r270195 : assertion text 2009-03-28 20:21:58 +0100 fs r270187 : #ii10000# 2009-03-28 20:19:54 +0100 fs r270186 : removed unused help ids 2009-03-28 20:19:40 +0100 fs r270185 : removed unused help ids 2009-03-28 20:19:10 +0100 fs r270184 : #i100237# +DefaultState/XReset 2009-03-28 00:29:29 +0100 fs r270177 : CWS-TOOLING: rebase CWS dba32b to trunk@270033 (milestone: DEV300:m45) 2009-03-27 22:56:46 +0100 fs r270173 : #i100237# DEFAULT_CHECKED -> DEFAULT_STATE 2009-03-27 22:55:52 +0100 fs r270172 : #i100237# DefaultState property for buttons, enabled only when Toggle=Yes 2009-03-27 22:54:15 +0100 fs r270171 : #i100237# DEFAULT_CHECKED -> DEFAULT_STATE 2009-03-27 22:53:54 +0100 fs r270170 : #i100237# introduce a DefaultState property for buttons, which implies buttongs supporting XReset, which needed some refactoring 2009-03-27 13:31:41 +0100 fs r270152 : ignore output paths 2009-03-27 11:23:44 +0100 fs r270139 : tuned behavior with respect to invalid keys/values 2009-03-27 09:57:14 +0100 fs r270136 : don't allow Double.NaN 2009-03-27 09:56:16 +0100 fs r270135 : talk about Double.NaN 2009-03-26 12:14:30 +0100 fs r270067 : removed unused parameter 2009-03-26 12:14:02 +0100 fs r270066 : removed widening conversion when checking keys 2009-03-26 09:17:34 +0100 fs r270053 : separated the enumerator functionality into a dedicated interface, this way not burdening XMap with it 2009-03-26 09:17:11 +0100 fs r270052 : separated the enumerator functionality into a dedicated interface, this way not burdening XMap with it 2009-03-26 09:16:49 +0100 fs r270051 : separated the enumerator functionality into a dedicated interface, this way not burdening XMap with it 2009-03-25 21:55:20 +0100 fs r270044 : #i100541# properly calculat bNeedScrollBox 2009-03-25 12:56:17 +0100 fs r270019 : renamed the previously introduced error condition 2009-03-25 12:11:48 +0100 fs r270015 : #i100095# when the error messages contain non-trivial details (SQLState/ErrorCode), then always display the 'Details' button 2009-03-25 12:10:05 +0100 fs r270012 : renamed the previously introduced error condition 2009-03-25 12:01:04 +0100 fs r270011 : #i100095# when no address book (or respective profile) can be found, then use a dedicated ErrorCondition 2009-03-25 10:29:07 +0100 fs r270003 : add missing localization 2009-03-25 10:23:12 +0100 fs r270001 : in preparation of #i1000095#: rework the error handling, allow using css.sdb.ErrorCondition values, plus allow propagating the nsresult 2009-03-25 10:21:55 +0100 fs r270000 : in preparation of #i1000095#: rework the error handling, allow using css.sdb.ErrorCondition values, plus allow propagating the nsresult 2009-03-20 23:05:38 +0100 fs r269829 : XMap::getSize removed 2009-03-20 23:05:19 +0100 fs r269828 : changes as suggested by sb 2009-03-20 23:04:56 +0100 fs r269827 : enhanced documentation 2009-03-20 15:31:40 +0100 fs r269815 : changes as suggested by sb 2009-03-20 13:23:52 +0100 oj r269804 : #i92538# correct the zorder that fixedtext is infront of control 2009-03-20 12:59:38 +0100 oj r269801 : #i94571# paraadjust now supports BLOCK 2009-03-20 12:58:11 +0100 oj r269800 : #i94571# export style with data style 2009-03-20 12:57:05 +0100 oj r269799 : #i94571# text align is now paraadjust 2009-03-20 12:37:02 +0100 fs r269797 : enum keys only accepted if they have the exact type, not if they have *any* enum type 2009-03-20 12:28:31 +0100 fs r269794 : some changes requested by sb 2009-03-20 08:52:47 +0100 fs r269780 : doc 2009-03-20 07:37:31 +0100 oj r269779 : #i99913# only notifiy when values are different 2009-03-20 07:36:58 +0100 oj r269778 : #i99913# add undoenv as listener at the dataprovider 2009-03-19 22:52:52 +0100 fs r269771 : added comment 2009-03-19 22:40:06 +0100 fs r269770 : +testEnumeration 2009-03-19 22:39:41 +0100 fs r269769 : implemented enumeration, getKeySet, and getValues. Should be finished now. 2009-03-19 14:01:01 +0100 oj r269743 : #i99913# reset the modified state when selecting an object 2009-03-19 12:19:54 +0100 lla r269739 : #i72390# cleanups 2009-03-19 09:25:27 +0100 fs r269727 : #i10000# 2009-03-18 23:37:02 +0100 fs r269708 : extended checks for value type acceptance 2009-03-18 23:36:41 +0100 fs r269707 : fixed value type checks 2009-03-18 14:59:56 +0100 fs r269678 : initial complex test case for the new css.container.Map implementation 2009-03-18 14:59:24 +0100 fs r269677 : verifyExpectedException moved to base class (in complexlib), and renamed to assureException for consistency 2009-03-18 14:58:35 +0100 fs r269676 : removed unused imports 2009-03-18 14:58:03 +0100 fs r269675 : first implementation of the new css.container.Map service (not completed, yet) 2009-03-18 14:57:17 +0100 fs r269674 : base class for UNO components, freeing you from some repeating work 2009-03-18 14:55:53 +0100 fs r269672 : +assureException: call a given method with given parameters on a given object, ensure that a given exception is thrown by the method implementation 2009-03-18 14:54:58 +0100 fs r269671 : +getComponentContext 2009-03-18 14:54:00 +0100 fs r269670 : isEmpty returns a boolean, not a long 2009-03-18 14:14:43 +0100 oj r269663 : #i99743# now text also supports null 2009-03-18 13:54:14 +0100 oj r269660 : #i99223# remove check for 2 params 2009-03-18 13:33:35 +0100 oj r269659 : #i99060# replace text::ParagraphVertAlign with style::VerticalAlignment 2009-03-18 13:32:18 +0100 oj r269658 : #i99060# don't set void property when void isn't allowed 2009-03-18 13:31:11 +0100 oj r269657 : #i99060# handle vertical alignment 2009-03-18 13:28:28 +0100 oj r269656 : #i99060# remove unused elements from sytle 2009-03-18 09:35:42 +0100 lla r269639 : #i72390# cleanups 2009-03-18 09:31:20 +0100 lla r269638 : #i72390# add ButtonList 2009-03-18 09:30:46 +0100 lla r269637 : #i72390# renamed interface 2009-03-18 09:30:15 +0100 lla r269636 : #i72390# use ButtonList instead of ImageList 2009-03-18 09:29:05 +0100 lla r269635 : #i72390# new ButtonList, cleanups 2009-03-18 09:26:34 +0100 lla r269634 : #i72390# cleanups 2009-03-17 12:21:20 +0100 oj r269590 : #i99222# remove assertion 2009-03-17 12:17:22 +0100 oj r269589 : #i98605# impl scale mode 2009-03-17 12:10:42 +0100 oj r269588 : #i98605# impl scale mode 2009-03-17 11:40:15 +0100 oj r269584 : #i96944# doesn't create equation for shapes 2009-03-17 11:33:16 +0100 oj r269583 : #i96423# switch calc from float to long 2009-03-16 15:19:18 +0100 fs r269550 : #i41930# enable zoom for embedded/outplace documents 2009-03-16 14:25:54 +0100 oj r269542 : #i93734# remove ContextSensitive 2009-03-16 14:21:58 +0100 oj r269541 : #i99274# page header before group header 2009-03-16 14:18:23 +0100 oj r269539 : #i99110# fix value type 2009-03-16 14:14:16 +0100 fs r269537 : line ends 2009-03-16 14:11:06 +0100 fs r269535 : line ends 2009-03-16 14:08:34 +0100 fs r269534 : #i100087# (provided my np): allow for polymorphic types with more than one parameter 2009-03-16 12:30:31 +0100 oj r269521 : compile error 2009-03-16 12:19:12 +0100 oj r269519 : compile error 2009-03-16 10:39:28 +0100 oj r269511 : compile error under linux with swap 2009-03-13 10:33:04 +0100 oj r269462 : CWS-TOOLING: rebase CWS dba32b to trunk@269297 (milestone: DEV300:m43) 2009-03-12 14:37:25 +0100 fs r269416 : interface SequenceOutputStreamTest is unneeded, and pollutes the namespace here :) 2009-03-12 14:35:07 +0100 fs r269414 : not needed 2009-03-12 14:34:15 +0100 fs r269413 : preparation for multiple tests in this module 2009-03-12 14:33:02 +0100 fs r269412 : ShowTargets was moved from module integration.forms to module complexlib 2009-03-12 14:32:48 +0100 fs r269411 : helper class for projects containing multiple complex test cases (and following a certain structure) 2009-03-12 14:00:14 +0100 fs r269407 : proper module after the move 2009-03-12 13:59:10 +0100 fs r269406 : superseded by ../makefile.mk 2009-03-12 13:47:38 +0100 fs r269403 : not needed anymore 2009-03-12 13:45:46 +0100 fs r269402 : moved, in preparation of adding more test cases here, with a common infrastructure 2009-03-12 13:45:07 +0100 fs r269401 : moved from ../ 2009-03-12 13:43:59 +0100 fs r269400 : moved to ./comphelper, in preparation of adding more test cases here, with a common infrastructure 2009-03-12 13:29:47 +0100 oj r269396 : #i99914# set parent on dataprovider 2009-03-12 13:10:35 +0100 oj r269393 : #i99832# check thrown exception and show error 2009-03-12 13:08:10 +0100 fs r269392 : reorganizing tests 2009-03-12 12:52:55 +0100 oj r269390 : #i99118# convert formatkey in numberformat 2009-03-12 12:34:53 +0100 fs r269388 : new API tests 2009-03-12 12:29:05 +0100 fs r269386 : Map not yet committed 2009-03-12 12:28:36 +0100 fs r269385 : oops, forgot the SequenceInputStream during the previous refactoring 2009-03-12 12:12:39 +0100 oj r269384 : #i99104# set HasCategories prop 2009-03-12 12:12:08 +0100 oj r269383 : #i99104# check HasCategories even for internal dataprovider 2009-03-12 12:10:40 +0100 oj r269382 : #i99104# set HasCategories prop 2009-03-12 10:51:49 +0100 fs r269373 : #i10000# exception specifications 2009-03-12 10:49:18 +0100 fs r269372 : #i10000# exception specifications 2009-03-12 10:44:02 +0100 fs r269371 : #i10000# exception specifications 2009-03-12 10:30:55 +0100 fs r269368 : refactored the UNO service registration in this module, using the helper classes provided by comphelper itself, so you have less effort when extending the list of to-be-registered components 2009-03-12 10:30:37 +0100 fs r269367 : module-local includes 2009-03-12 07:05:54 +0100 oj r269357 : #i99104# database dataprovider doesn't need dataranges and diagramdata 2009-03-11 10:58:28 +0100 oj r269306 : #i99911# check if name of the report is a valid file name 2009-03-11 10:03:23 +0100 oj r269299 : #i99666# the report is new when the HierarchicalDocumentName is empty 2009-03-10 11:32:45 +0100 oj r269258 : #i99221# use fallback for language 2009-03-10 10:48:40 +0100 oj r269255 : #i99433# now use OStringBuffer 2009-03-10 10:36:21 +0100 fs r269252 : initial version of (X)Map 2009-03-10 09:52:23 +0100 oj r269246 : #i99433# now use OStringBuffer 2009-03-10 08:56:13 +0100 oj r269240 : #i99655# patch applied 2009-03-09 07:35:33 +0100 lla r269058 : #i10000# wrong variable assignment fixed 2009-03-06 17:20:40 +0100 fs r269030 : some explicit defaults 2009-03-06 17:20:30 +0100 fs r269029 : #i98600# 2009-03-06 14:40:34 +0100 fs r269009 : #i87692# during reload, prevent the document being modified just because of some control content changes ... 2009-03-06 12:52:20 +0100 lla r268997 : #i10000# ambigous problem with FontWeight fixed 2009-03-06 11:39:32 +0100 fs r268989 : #i10000# (approved by pl): use --without-t1-library configure option 2009-03-06 10:55:43 +0100 fs r268986 : #i99953# depends on xmlscript module now 2009-03-06 10:54:04 +0100 fs r268985 : #i99953# also adjust the event names found in dialogs embedded in the forms 2009-03-06 09:53:41 +0100 fs r268977 : #i10000# 2009-03-06 09:30:41 +0100 lla r268973 : #i10000# merge problems 2009-03-05 17:52:34 +0100 fs r268932 : #i98593# for sub components which are actually controlled by a DocumentDefinition (aka XComponentSupplier aka XCommandProcessor), close them by executing the 'close' command, not by suspending/closing the controller (which cannot be intercepted) 2009-03-05 11:41:56 +0100 fs r268889 : default the drop down line count for list/combo boxes to 20 2009-03-05 11:39:10 +0100 fs r268887 : do not display empty error messages 2009-03-02 10:13:57 +0100 lla r268639 : #i91541# CWS rebase m41 to m42 2009-03-02 09:06:27 +0100 lla r268635 : #i10000# add ';' to strings 2009-02-26 11:18:00 +0100 fs r268492 : reportdesign depends on REPORTBUILDER, not REPORTDESIGN 2009-02-26 10:11:38 +0100 lla r268489 : CWS-TOOLING: rebase CWS dba32b to trunk@268395 (milestone: DEV300:m42) 2009-02-26 09:04:11 +0100 lla r268488 : CWS-TOOLING: rebase CWS dba32b to trunk@268395 (milestone: DEV300:m42) 2009-02-24 12:09:13 +0100 lla r268392 : #i91541# #i91542# cleanups 2009-02-24 08:08:06 +0100 lla r268382 : merge all dba32a changes into dba32b 2009-02-24 07:14:55 +0100 lla r268381 : merge all dba32a changes into dba32b 2009-02-23 21:44:28 +0100 fs r268377 : oops ... don't tamper with m_aListSourceValues at the end of loadData 2009-02-23 20:57:05 +0100 fs r268376 : #i98162# don't hold the values as strings, but as ORowSetValue, this way preserving their type, and being agnostic to different result/rowset implementations doing different to-string-conversations 2009-02-23 20:55:44 +0100 fs r268375 : getObject: throwFunctionNotSupportedException, instead of silently returning NULL 2009-02-23 20:55:20 +0100 fs r268374 : #i98162# some more supported types 2009-02-23 20:54:43 +0100 fs r268373 : #i98162# +operator != 2009-02-20 09:35:39 +0100 fs r268306 : #i99422# for a font, display the font name, the style, and the size 2009-02-20 09:33:45 +0100 fs r268305 : #i99422# in the property browser, FONT supersedes CHARFONTNAME: the aggregated FormComponentHandler displays them more nicely now 2009-02-19 16:12:06 +0100 fs r268293 : #i99372# recognize DataType::FLOAT as numeric 2009-02-19 15:43:12 +0100 fs r268291 : #i99415# 2009-02-19 15:40:15 +0100 fs r268290 : #i99242# lcl_firstFocussableControl: take disabled controls into account 2009-02-19 15:34:36 +0100 fs r268289 : #i99396# properly decode the base name of the URL when using it as title 2009-02-19 15:19:05 +0100 fs r268287 : #i98247# --- .../java/com/sun/star/report/DataRow.java | 6 +- .../java/com/sun/star/report/DataSource.java | 8 +- .../java/com/sun/star/report/ImageService.java | 8 +- .../java/com/sun/star/report/InputRepository.java | 14 +- .../com/sun/star/report/JobProgressIndicator.java | 10 +- .../java/com/sun/star/report/JobProperties.java | 6 +- .../java/com/sun/star/report/OfficeToken.java | 3 + .../java/com/sun/star/report/OutputRepository.java | 12 +- .../java/com/sun/star/report/ParameterMap.java | 10 +- .../java/com/sun/star/report/ReportAddIn.java | 6 +- .../com/sun/star/report/ReportEngineMetaData.java | 12 +- .../star/report/ReportEngineParameterNames.java | 1 + .../java/com/sun/star/report/ReportExpression.java | 6 +- .../sun/star/report/ReportExpressionMetaData.java | 14 +- .../java/com/sun/star/report/ReportJob.java | 12 +- .../com/sun/star/report/ReportJobDefinition.java | 4 +- .../java/com/sun/star/report/ReportJobFactory.java | 2 +- .../com/sun/star/report/SDBCReportDataFactory.java | 558 +++++++++++++-------- .../java/com/sun/star/report/SOImageService.java | 2 +- .../com/sun/star/report/StorageRepository.java | 2 +- .../report/function/metadata/AuthorFunction.java | 4 - .../metadata/AuthorFunctionDescription.java | 1 - .../metadata/TitleFunctionDescription.java | 1 - .../star/report/pentaho/DefaultNameGenerator.java | 27 +- .../pentaho/PentahoReportEngineMetaData.java | 2 + .../sun/star/report/pentaho/PentahoReportJob.java | 11 +- .../star/report/pentaho/SOFormulaOpCodeMapper.java | 4 +- .../sun/star/report/pentaho/SOFormulaParser.java | 20 +- .../sun/star/report/pentaho/SOFunctionManager.java | 32 +- .../star/report/pentaho/SOReportJobFactory.java | 12 +- .../star/report/pentaho/StarFunctionCategory.java | 2 +- .../report/pentaho/StarFunctionDescription.java | 16 +- .../layoutprocessor/FormatValueUtility.java | 37 +- .../ImageElementLayoutController.java | 8 +- .../layoutprocessor/ObjectOleLayoutController.java | 1 - ...OfficeGroupInstanceSectionLayoutController.java | 2 +- .../OfficeGroupLayoutController.java | 2 +- .../layoutprocessor/TableCellLayoutController.java | 3 +- .../java/com/sun/star/report/pentaho/makefile.mk | 6 +- .../star/report/pentaho/model/ImageElement.java | 17 +- .../star/report/pentaho/output/ImageProducer.java | 33 +- .../pentaho/output/OfficeDocumentReportTarget.java | 56 ++- .../star/report/pentaho/output/OleProducer.java | 5 +- .../pentaho/output/chart/ChartRawReportTarget.java | 3 +- .../spreadsheet/SpreadsheetRawReportTarget.java | 306 ++++++----- .../pentaho/output/text/MasterPageFactory.java | 4 +- .../report/pentaho/output/text/PageContext.java | 13 +- .../pentaho/output/text/TextRawReportTarget.java | 23 +- .../star/report/pentaho/parser/StyleMapper.java | 2 +- .../rpt/ConditionalPrintExpressionReadHandler.java | 4 - .../pentaho/parser/rpt/GroupReadHandler.java | 2 +- .../stylemapper/fo/BackgroundColorMapper.java | 4 - .../parser/stylemapper/fo/BorderRightMapper.java | 5 - .../java/com/sun/star/report/util/ReportUtil.java | 10 +- 54 files changed, 798 insertions(+), 576 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/DataRow.java b/reportbuilder/java/com/sun/star/report/DataRow.java index 1875578213ed..47f471113362 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 20f83a8a7798..42d78abcc9d1 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 e0b558933703..193b97d66d58 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 5ee660f9d03a..21564d5851df 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 00dcdecc9a8d..4cda72cacb5d 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 b0fcff494b87..9d8932c1219b 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 5649abdac863..6685afe297da 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 915ca1b88324..aba5deba5f51 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 cf3aed4de598..45a5206583ed 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 null 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 6057a1e20eb2..112e182a0663 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 486a58053e51..49ef491177ae 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 4b0002ba8d8c..8c191a77d2a3 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 c544659f2c4f..5576a74205d5 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 830ae3927f44..c2caabfec78e 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 bbd02ff5e390..8caf39b9bdae 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 ff1b78b6aace..1bad0c4f0de4 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 cf8ed01ba736..fda22b4d907e 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 bc248c29bbd9..af396d415338 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 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 XConnectionTools tools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, connection); - fillOrderStatement(command, commandType, parameters, tools, rowSetProp); + final Object[] p = createRowSet(rowSetProps,parameters); + final XRowSet rowSet = (XRowSet)p[0]; - if ( command.length() != 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); + + 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 XSingleSelectQueryComposer composer = getComposer(tools, command, commandType); - if ( composer != null ) + 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 3073a52179fa..83413fe91deb 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 b32bcb3dab86..da0c7fe9e123 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 63b15fab0200..87cb540b4a94 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 fecfcd5753c1..475ce31ab9a1 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 5db1a898b04e..a8dadc17a00d 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 6cfac589b900..0f2c858d1c96 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 7285e9b897be..1f4dce14950d 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 f64c1bd7d741..e3b5b268ea43 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,11 +344,13 @@ 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); rp.processReport(job); diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java index a225c93a749d..30c9711dce05 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 1a8d02d53b64..a5fe1ab5c61f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java @@ -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++) { @@ -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; @@ -237,8 +236,7 @@ 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) @@ -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 059aed34796a..333441f8b2b5 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 cda541184968..1acf2c846bcb 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 9c98f42eb6eb..19b041715acf 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 bca8ad026b19..df19a3f06174 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/layoutprocessor/FormatValueUtility.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java index 4eea93329cb4..e6f27564b519 100755 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -43,6 +43,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 @@ -100,13 +102,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 Date ) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value)); + if ( "date".equals(valueType) ) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value)); + } + else + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", String.valueOf(HSSFDateUtil.getExcelDate((Date)value))); + } + } - else if (value instanceof Number) + else if (value instanceof Number ) { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", String.valueOf(value)); } @@ -123,7 +133,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 { 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 8cd296151005..68d1fc6351c4 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 97e4332217a9..54f4fd0b1acb 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 8a3779cebe03..d61f03eb319e 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 78180c7dc9cb..25e12d17edab 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 daacce47aa48..44117380e176 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/makefile.mk b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk index 5d448a6bc2be..36e83afac2d0 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 45e11580cd8f..195c569a3028 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 9866d1a41c5e..af34c5ed5a00 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 e9b6f8da882c..42fef8d10f45 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 cc4b466fae31..36dffa290da1 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 56a2c036f2e8..9328be4fd031 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 2b764f371fc1..3be3c523662e 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 48879bf8ce2b..0a5988a44b94 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 fdd82694cae3..88c2742c91d5 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 28999ebac793..6ce89c5c0324 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 c3c8013b3fff..f29d0b0abad5 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/rpt/ConditionalPrintExpressionReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ConditionalPrintExpressionReadHandler.java index 4367f4a78c1d..7378637bae15 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 2364eb212f9d..55ed4759c6be 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 a0f6c4e217ad..a2ca9ca9e496 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 b668301c3603..14b9f4dd5b3b 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 b82a25a7a060..e2b3602e19fb 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); } -- cgit From 0db94dbe0a0f79e1c649b681eaa3dbaa065faa64 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Mon, 6 Jul 2009 09:00:26 +0000 Subject: CWS-TOOLING: integrate CWS dba32d 2009-06-30 08:58:13 +0200 fs r273488 : merging latest changes from CWS dba32c 2009-06-29 11:40:42 +0200 oj r273459 : #i101652# fix token handling 2009-06-26 09:27:30 +0200 oj r273394 : #i101994# wrong condition checked 2009-06-22 12:09:04 +0200 fs r273210 : merging latest changes from CWS dba32c 2009-06-18 11:01:06 +0200 fs r273108 : merge latest changes from CWS dba32c 2009-06-17 14:19:33 +0200 oj r273072 : handle images at the correct position 2009-06-17 13:37:19 +0200 oj r273067 : compile error 2009-06-17 13:35:58 +0200 oj r273066 : #i102201# handle images 2009-06-17 13:27:21 +0200 oj r273065 : #i80917# disable checkbox for internal copy 2009-06-17 13:25:38 +0200 oj r273064 : #i80917# disable checkbox for internal copy 2009-06-15 12:59:16 +0200 fs r272978 : merging latest changes from CWS dba32c 2009-06-15 10:45:58 +0200 fs r272967 : CWS-TOOLING: rebase CWS dba32d to trunk@272827 (milestone: DEV300:m50) 2009-06-15 08:41:05 +0200 fs r272960 : merging changes from CWS dba32c (resulting from rebasing dba32c to m50) 2009-06-03 12:22:32 +0200 fs r272554 : merging latest changes from CWS dba32c 2009-06-03 11:11:27 +0200 fs r272549 : #i100818# special treatment for DataAwareness not needed anymore 2009-06-03 11:07:01 +0200 fs r272548 : #i10000# removed package declaration 2009-06-03 09:21:03 +0200 oj r272537 : #i93465# save window states 2009-06-03 08:56:25 +0200 oj r272535 : solve compiler warnings 2009-06-03 08:55:02 +0200 oj r272534 : #i102295# export shapes i the first cell 2009-06-03 07:35:18 +0200 oj r272533 : #i101994# check for - and + prefix 2009-06-03 06:51:38 +0200 oj r272531 : #i101463# use uncomposed table name 2009-06-03 06:33:06 +0200 oj r272530 : #i102019# word corrected 2009-06-02 14:58:28 +0200 fs r272507 : #i102443# call initializeParser from LoadFinished 2009-06-02 14:30:10 +0200 oj r272504 : #i102019# introduce static ints 2009-06-02 13:51:02 +0200 oj r272501 : #i102439# wrong method used 2009-06-02 13:44:09 +0200 fs r272500 : #i102440# when tampering with Order/GroupBy, reset the cached columns 2009-06-02 10:53:01 +0200 fs r272487 : #i102234# preserve the original filter when using a 0=1 filter 2009-06-02 10:21:21 +0200 oj r272486 : #i100535# handle time values as float 2009-06-02 10:19:07 +0200 fs r272485 : merging latest changes from CWS dba32c 2009-05-29 16:00:15 +0200 fs r272467 : merging latest changes from dba32c 2009-05-29 15:31:25 +0200 fs r272462 : merging latest changes from dba32c 2009-05-29 10:58:03 +0200 oj r272438 : #101135# export embedded-text 2009-05-29 08:17:57 +0200 oj r272431 : #i80917# make attribute not optional 2009-05-29 08:17:32 +0200 oj r272430 : remoe unused token 2009-05-29 07:17:15 +0200 oj r272429 : #i80917# make attribute not optional 2009-05-28 12:48:14 +0200 oj r272401 : #i102201# insert images in context menu 2009-05-28 12:47:44 +0200 oj r272400 : #i80917# add new attribute to handle first line 2009-05-28 12:16:12 +0200 oj r272397 : #i96134# add / to path when it doesn't exist 2009-05-28 12:11:08 +0200 oj r272390 : #i80917# add new attribute to handle first line 2009-05-28 11:33:35 +0200 oj r272388 : #i101652# add new checkbox to handle header line as column names 2009-05-28 11:30:15 +0200 oj r272387 : #i101652# add localize 2009-05-28 11:15:53 +0200 oj r272386 : merge from dba32c 2009-05-28 09:08:25 +0200 fs r272378 : merged a build fix from CWS dba32c --- .../star/report/pentaho/configuration.properties | 1 + .../layoutprocessor/FormatValueUtility.java | 47 ++++++++++++++++------ .../VariablesDeclarationLayoutController.java | 4 +- .../pentaho/parser/data/DataStyleReadHandler.java | 2 +- 4 files changed, 40 insertions(+), 14 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties b/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties index 8af708eb60c5..186b8568cb6a 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 e6f27564b519..8515b4997d53 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; @@ -58,6 +59,7 @@ public class FormatValueUtility public static final String VALUE_TYPE = "value-type"; private static SimpleDateFormat dateFormat; + private static SimpleDateFormat timeFormat; private FormatValueUtility() { @@ -66,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"); @@ -104,19 +118,20 @@ public class FormatValueUtility public static void applyValueForCell(final Object value, final AttributeMap variableSection,final String valueType) { - if (value instanceof Date ) + if (value instanceof Time) { - if ( "date".equals(valueType) ) - { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value)); - } - else - { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", String.valueOf(HSSFDateUtil.getExcelDate((Date)value))); - } - + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "time-value", formatTime((Time) value)); } - else if (value instanceof Number ) + 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)); } @@ -166,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/VariablesDeclarationLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java index 6a6b6f19d1f0..55f4f2999aab 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/parser/data/DataStyleReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/data/DataStyleReadHandler.java index eaf6d4a2d7b8..b4787ca63cb9 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; } -- cgit From 40824128b26ae5f003d579b6ff312152df9a6d9f Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Wed, 29 Jul 2009 14:46:52 +0000 Subject: CWS-TOOLING: integrate CWS dr71 2009-07-07 16:26:00 +0200 dr r273805 : #i10000# unused variables 2009-07-07 10:27:14 +0200 dr r273780 : CWS-TOOLING: rebase CWS dr71 to trunk@273468 (milestone: DEV300:m51) 2009-07-01 11:28:24 +0200 dr r273559 : #101471# special handling for XL library functions in ODF formulas (EUROCONVERT) 2009-06-29 17:48:46 +0200 dr r273478 : #i101471# typo 2009-06-29 17:35:16 +0200 dr r273477 : #i101471# import msoxl: formulas from conditional formatting and data validation 2009-06-18 13:45:17 +0200 dr r273115 : #101471# changed interface css.sheet.XFormulaParser 2009-06-18 13:44:43 +0200 dr r273114 : #101471# changed interface css.sheet.XFormulaParser 2009-06-17 17:29:23 +0200 dr r273089 : #i101471# extend the XFormulaParser interface with a ReferencePosition parameter, make rel-refs from msoxl: namespace working 2009-06-17 17:28:39 +0200 dr r273088 : #i101471# extend the XFormulaParser interface with a ReferencePosition parameter 2009-06-17 17:28:19 +0200 dr r273087 : #i101471# extend the XFormulaParser interface with a ReferencePosition parameter 2009-06-17 17:27:19 +0200 dr r273086 : #i101471# extend the XFormulaParser interface with a ReferencePosition parameter, remove that property from FormulaParser service 2009-06-17 12:52:20 +0200 dr r273059 : #i101471# import cell formulas from msoxl: namespace 2009-06-16 11:40:50 +0200 dr r273013 : #i101471# import formula namespace from xml elements 2009-06-12 18:34:13 +0200 dr r272935 : #i101471# external formula parser for oox in odf 2009-06-12 18:33:13 +0200 dr r272934 : #i101471# external formula parsers 2009-06-12 18:29:46 +0200 dr r272933 : #i101471# external formula parsers 2009-06-05 15:53:47 +0200 dr r272705 : #i101471# provide OOX formula parser as UNO service --- reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java index a5fe1ab5c61f..321acb017728 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java @@ -155,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) ) @@ -239,7 +239,7 @@ public final class SOFormulaParser extends ComponentBase 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++) -- cgit From 081fab2c4e7de3c04300e5e19e85518c04150231 Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Mon, 12 Oct 2009 12:32:19 +0000 Subject: #i105724# check tDisplayCondition --- .../pentaho/layoutprocessor/TableCellLayoutController.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'reportbuilder/java/com/sun/star') 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 44117380e176..e9025330a60f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java @@ -98,6 +98,15 @@ public class TableCellLayoutController extends SectionLayoutController { return null; } + final Expression dc = element.getDisplayCondition(); + if (dc != null) + { + final Object o = LayoutControllerUtil.evaluateExpression(getFlowController(), element, dc); + if (Boolean.FALSE.equals(o)) + { + return null; + } + } return FormatValueUtility.computeDataFlag(element, getFlowController()); } -- cgit From b23505498be71f1ccf1086abe0832234ae34ed93 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Wed, 14 Oct 2009 18:48:09 +0000 Subject: CWS-TOOLING: integrate CWS dba32h 2009-10-12 12:21:44 +0200 msc r276827 : remove warning for issue 102712 because the issue is fixed 2009-10-05 07:14:20 +0200 oj r276658 : #105585# add missing dependency for OOO_UI 2009-10-02 12:50:19 +0200 fs r276632 : #i105505# If a model is created, and is a revenant of a previous incarnation, then ensure it is properly initialized. In particular, in its ctor, set the state to "Initializing", not "Initialized", and then let the ModelImpl call attachResource. This ensures that the model is initialized completely, including firing the necessary events. 2009-10-02 12:46:12 +0200 fs r276631 : #i105505# always do an attachResource at the newly loaded model, even if it (internally) was not really loaded, but only a revenant of a previous incarnation of this document 2009-10-01 13:09:07 +0200 fs r276596 : do not rely on the name 'Standard' for the one and only form in a document 2009-10-01 12:35:56 +0200 fs r276589 : #i105509# don't rely on default form component names, use indexes 2009-10-01 11:19:18 +0200 fs r276584 : copying the fix for #i105082# into this CWS 2009-10-01 11:13:22 +0200 fs r276583 : improved logs 2009-10-01 11:10:44 +0200 fs r276581 : #i105505# 2009-10-01 08:07:57 +0200 fs r276575 : manual merge of trunk, to allow cwslocalize to run 2009-09-30 22:48:30 +0200 fs r276574 : removed that strange ONLOAD definition 2009-09-30 12:58:18 +0200 fs r276553 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS 2009-09-30 12:56:45 +0200 fs r276552 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS 2009-09-30 11:47:45 +0200 fs r276549 : #i105235# 2009-09-29 12:27:40 +0200 fs r276521 : #i105367# 2009-09-28 12:08:17 +0200 oj r276485 : #i105371# export version in manifest.xml as well 2009-09-28 12:07:02 +0200 oj r276484 : #i105371# export version in manifest.xml as well 2009-09-28 09:48:01 +0200 oj r276481 : #i105366# init drivers when not empty 2009-09-25 14:31:27 +0200 fs r276466 : CWS-TOOLING: rebase CWS dba32h to trunk@276429 (milestone: DEV300:m60) 2009-09-24 13:52:54 +0200 fs r276422 : #i105234# do not zoom the control when they view information is still uninitialized (happens at least in Writer when opening a form document) 2009-09-24 11:42:03 +0200 fs r276413 : #i105234# proper zoom handling for the nav bar 2009-09-24 11:41:40 +0200 fs r276412 : #i105234# setZoom: care for precision errors caused by implicit conversion float->double 2009-09-23 12:21:22 +0200 oj r276377 : remove dos lineends 2009-09-23 11:44:52 +0200 oj r276376 : #i105216# load config on demand 2009-09-23 11:44:19 +0200 oj r276375 : #i105216# load config on demand 2009-09-23 11:43:35 +0200 oj r276374 : #i105216# load config on demand 2009-09-21 09:13:03 +0200 oj r276307 : #i105158# use Thread support 2009-09-18 13:06:50 +0200 fs r276277 : #i105147# 2009-09-18 11:48:23 +0200 oj r276271 : #i105158# new method for thread safety 2009-09-18 10:42:56 +0200 fs r276266 : CWS-TOOLING: rebase CWS dba32h to trunk@276192 (milestone: DEV300:m59) 2009-09-18 08:30:03 +0200 oj r276263 : #i105016# load correct ldap so 2009-09-17 13:42:31 +0200 oj r276240 : change count of check boxes 2009-09-17 13:32:59 +0200 oj r276239 : revert false to true for currency 2009-09-17 09:14:46 +0200 oj r276220 : #i104901# add patch for every issue 2009-09-17 09:10:29 +0200 oj r276219 : #i104901# add patch for every issue 2009-09-11 13:47:49 +0200 oj r276060 : #i104901# fix for indentity 2009-09-11 12:14:14 +0200 fs r276056 : #i104594# allow to render controls without an SdrPageView 2009-09-11 11:49:31 +0200 fs r276055 : CWS-TOOLING: rebase CWS dba32h to trunk@276043 (milestone: DEV300:m58) 2009-09-10 08:41:40 +0200 oj r276021 : #i104911# export variable-set not for repeating sections --- .../star/report/pentaho/output/text/TextRawReportTarget.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'reportbuilder/java/com/sun/star') 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 6ce89c5c0324..cdbb36abc337 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 @@ -734,8 +734,11 @@ 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) && - tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH && variables != null) + if ( tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH + && variables != null + && !isRepeatingSection() + && ReportTargetUtil.isElementOfType(OfficeNamespaces.TEXT_NS, OfficeToken.P, attrs) + ) { //LOGGER.debug("Variables-Section in existing cell " + variables); xmlWriter.writeText(variables); @@ -1374,7 +1377,8 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget final XmlWriter xmlWriter = getXmlWriter(); if (tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH && - isTableNs && ObjectUtilities.equal(OfficeToken.TABLE_CELL, elementType)) + isTableNs && ObjectUtilities.equal(OfficeToken.TABLE_CELL, elementType) && + !isRepeatingSection() ) { if (variables != null) { -- cgit From 76e2cf337c3b5af356e64fe7072c39fbc421fc9b Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Wed, 11 Nov 2009 10:32:44 +0100 Subject: #i99049# use vanilla sources --- .../java/com/sun/star/report/pentaho/Manifest.mf | 6 +++--- .../report/pentaho/loader/InputRepositoryLoader.java | 16 ++++++++++++++++ .../java/com/sun/star/report/pentaho/makefile.mk | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf b/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf index 70f3ff695cbb..e85f2018da99 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf +++ b/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf @@ -1,7 +1,7 @@ RegistrationClassName: com.sun.star.report.pentaho.SOReportJobFactory Class-Path: reportbuilderwizard.jar - flute-1.3.0.jar libserializer-1.0.0.jar libbase-1.0.0.jar - libfonts-1.0.0.jar libformula-0.2.0.jar liblayout-0.2.9.jar - libloader-1.0.0.jar librepository-1.0.0.jar libxml-1.0.0.jar + flute-1.1.2.jar libserializer-1.1.2.jar libbase-1.1.2.jar + libfonts-1.1.2.jar libformula-1.1.2.jar liblayout-0.2.9.jar + libloader-1.1.2.jar librepository-1.1.2.jar libxml-1.1.2.jar flow-engine-0.9.2.jar sac.jar commons-logging-1.1.1.jar UNO-Type-Path: diff --git a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java index fc6021202e68..c093e5b9d8ef 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java @@ -35,6 +35,7 @@ import java.util.HashMap; import com.sun.star.report.InputRepository; import org.pentaho.reporting.libraries.resourceloader.ResourceData; +import org.pentaho.reporting.libraries.resourceloader.ResourceException; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; import org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException; import org.pentaho.reporting.libraries.resourceloader.ResourceLoader; @@ -169,4 +170,19 @@ public class InputRepositoryLoader implements ResourceLoader { return resourceManager; } + + public boolean isSupportedDeserializer(String string) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String serialize(ResourceKey rk, ResourceKey rk1) throws ResourceException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public ResourceKey deserialize(ResourceKey rk, String string) throws ResourceKeyCreationException + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk index 36e83afac2d0..4b91d0966ebe 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk @@ -43,7 +43,7 @@ JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar .IF "$(SYSTEM_JFREEREPORT)" == "YES" XCLASSPATH!:=$(XCLASSPATH)$(FLUTE_JAR)$(PATH_SEPERATOR)$(LIBBASE_JAR)$(PATH_SEPERATOR)$(LIBXML_JAR)$(PATH_SEPERATOR)$(JFREEREPORT_JAR)$(PATH_SEPERATOR)$(LIBLOADER_JAR)$(PATH_SEPERATOR)$(SAC_JAR)$(PATH_SEPERATOR)$(LIBLAYOUT_JAR)$(PATH_SEPERATOR)$(LIBSERIALIZER_JAR)$(PATH_SEPERATOR)$(LIBFONTS_JAR)$(PATH_SEPERATOR)$(LIBFORMULA_JAR)$(PATH_SEPERATOR)$(LIBREPOSITORY_JAR) .ELSE -JARFILES += flute-1.3.0.jar libbase-1.0.0.jar libfonts-1.0.0.jar libformula-0.2.0.jar liblayout-0.2.9.jar libloader-1.0.0.jar librepository-1.0.0.jar libxml-1.0.0.jar flow-engine-0.9.2.jar sac.jar +JARFILES += flute-1.1.2.jar libbase-1.1.2.jar libfonts-1.1.2.jar libformula-1.1.2.jar liblayout-0.2.9.jar libloader-1.1.2.jar librepository-1.1.2.jar libxml-1.1.2.jar flow-engine-0.9.2.jar sac.jar .ENDIF .IF "$(SYSTEM_APACHE_COMMONS)" == "YES" -- cgit From 78155803fd8f1e7d6eb9f0af390a4a928d2fb9cd Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 19 Nov 2009 09:03:57 +0100 Subject: dba33d: #i102563# use rootURL to resolve the given URI and some refactoring --- .../java/com/sun/star/report/ImageService.java | 14 +- .../java/com/sun/star/report/InputRepository.java | 6 + .../com/sun/star/report/JobProgressIndicator.java | 1 + .../java/com/sun/star/report/OfficeToken.java | 61 +- .../java/com/sun/star/report/OutputRepository.java | 1 + .../java/com/sun/star/report/ReportEngine.java | 1 + .../star/report/ReportEngineParameterNames.java | 39 +- .../sun/star/report/ReportExecutionException.java | 105 ++- .../java/com/sun/star/report/ReportExpression.java | 10 +- .../java/com/sun/star/report/ReportJob.java | 2 + .../java/com/sun/star/report/SDBCReportData.java | 12 +- .../com/sun/star/report/SDBCReportDataFactory.java | 56 +- .../java/com/sun/star/report/SOImageService.java | 14 +- .../com/sun/star/report/StorageRepository.java | 22 +- .../report/function/metadata/AuthorFunction.java | 2 +- .../metadata/AuthorFunctionDescription.java | 2 +- .../report/function/metadata/TitleFunction.java | 2 +- .../metadata/TitleFunctionDescription.java | 2 +- .../star/report/pentaho/DefaultNameGenerator.java | 4 +- .../sun/star/report/pentaho/OfficeNamespaces.java | 1 - .../star/report/pentaho/PentahoFormulaContext.java | 1 + .../sun/star/report/pentaho/PentahoReportJob.java | 25 +- .../star/report/pentaho/SOFormulaOpCodeMapper.java | 26 +- .../sun/star/report/pentaho/SOFormulaParser.java | 81 ++- .../sun/star/report/pentaho/SOFunctionManager.java | 17 +- .../star/report/pentaho/SOReportJobFactory.java | 119 ++-- .../star/report/pentaho/StarFunctionCategory.java | 23 +- .../report/pentaho/StarFunctionDescription.java | 24 +- .../star/report/pentaho/StarReportDataFactory.java | 138 ++-- .../sun/star/report/pentaho/StarReportModule.java | 41 +- .../report/pentaho/expressions/SumExpression.java | 35 +- .../pentaho/expressions/SumExpressionMetaData.java | 73 ++- .../AbstractReportElementLayoutController.java | 2 +- .../layoutprocessor/FixedTextLayoutController.java | 54 +- .../layoutprocessor/FormatValueUtility.java | 46 +- .../FormattedTextLayoutController.java | 2 + .../layoutprocessor/ImageElementContext.java | 89 ++- .../ImageElementLayoutController.java | 29 +- .../layoutprocessor/ObjectOleLayoutController.java | 4 +- .../OfficeDetailLayoutController.java | 195 +++--- ...OfficeGroupInstanceSectionLayoutController.java | 200 +++--- .../OfficeGroupLayoutController.java | 275 ++++---- .../OfficeGroupSectionLayoutController.java | 90 ++- .../OfficePageSectionLayoutController.java | 21 +- .../OfficeRepeatingStructureLayoutController.java | 6 +- .../OfficeReportLayoutController.java | 401 ++++++------ .../OfficeTableLayoutController.java | 5 +- .../OfficeTableTemplateLayoutController.java | 3 +- .../layoutprocessor/TableCellLayoutController.java | 8 +- .../layoutprocessor/VariablesCollection.java | 78 ++- .../VariablesDeclarationLayoutController.java | 234 +++---- .../loader/InputRepositoryResourceData.java | 70 +- .../report/pentaho/loader/InputResourceKey.java | 45 +- .../sun/star/report/pentaho/model/DataStyle.java | 25 +- .../report/pentaho/model/FixedTextElement.java | 23 +- .../report/pentaho/model/FontFaceDeclsSection.java | 49 +- .../star/report/pentaho/model/FontFaceElement.java | 25 +- .../star/report/pentaho/model/FormatCondition.java | 48 +- .../report/pentaho/model/FormattedTextElement.java | 26 +- .../star/report/pentaho/model/ImageElement.java | 72 ++- .../report/pentaho/model/ObjectOleElement.java | 29 +- .../report/pentaho/model/OfficeDetailSection.java | 9 +- .../star/report/pentaho/model/OfficeDocument.java | 39 +- .../sun/star/report/pentaho/model/OfficeGroup.java | 77 ++- .../pentaho/model/OfficeGroupInstanceSection.java | 7 +- .../report/pentaho/model/OfficeMasterPage.java | 42 +- .../report/pentaho/model/OfficeMasterStyles.java | 54 +- .../star/report/pentaho/model/OfficeReport.java | 60 +- .../sun/star/report/pentaho/model/OfficeStyle.java | 166 +++-- .../star/report/pentaho/model/OfficeStyles.java | 2 +- .../pentaho/model/OfficeStylesCollection.java | 115 ++-- .../report/pentaho/model/OfficeTableSection.java | 9 +- .../sun/star/report/pentaho/model/PageLayout.java | 44 +- .../com/sun/star/report/pentaho/model/RawText.java | 11 +- .../star/report/pentaho/model/ReportElement.java | 108 ++-- .../report/pentaho/model/TableCellElement.java | 8 +- .../pentaho/model/VariablesDeclarationSection.java | 12 +- .../sun/star/report/pentaho/oasis-datastyle.css | 2 +- .../com/sun/star/report/pentaho/oasis-draw.css | 2 +- .../com/sun/star/report/pentaho/oasis-form.css | 2 +- .../com/sun/star/report/pentaho/oasis-style.css | 4 +- .../com/sun/star/report/pentaho/oasis-table.css | 14 +- .../com/sun/star/report/pentaho/oasis-text.css | 4 +- .../star/report/pentaho/output/ImageProducer.java | 26 +- .../pentaho/output/OfficeDocumentReportTarget.java | 93 ++- .../star/report/pentaho/output/OleProducer.java | 43 +- .../star/report/pentaho/output/StyleUtilities.java | 24 +- .../star/report/pentaho/output/StylesWriter.java | 528 +++++++-------- .../pentaho/output/chart/ChartRawReportTarget.java | 21 +- .../spreadsheet/SpreadsheetRawReportProcessor.java | 2 +- .../spreadsheet/SpreadsheetRawReportTarget.java | 236 ++++--- .../pentaho/output/text/MasterPageFactory.java | 13 +- .../report/pentaho/output/text/PageContext.java | 2 +- .../output/text/TextRawReportProcessor.java | 2 +- .../pentaho/output/text/TextRawReportTarget.java | 134 ++-- .../pentaho/parser/AttributeSpecification.java | 45 +- .../parser/OfficeDocumentXmlResourceFactory.java | 17 +- .../report/pentaho/parser/OfficeParserUtil.java | 1 + .../parser/OfficeStylesXmlResourceFactory.java | 26 +- .../pentaho/parser/StarStyleXmlFactoryModule.java | 39 +- .../pentaho/parser/StarXmlFactoryModule.java | 3 +- .../star/report/pentaho/parser/StyleMapper.java | 11 +- .../pentaho/parser/chart/ChartReadHandler.java | 5 +- .../pentaho/parser/draw/ObjectOleReadHandler.java | 4 +- .../parser/office/DocumentContentReadHandler.java | 1 + .../parser/office/DocumentStylesReadHandler.java | 96 ++- .../parser/office/FontFaceDeclsReadHandler.java | 103 ++- .../report/pentaho/parser/rpt-schema-v1.0-os.xsd | 720 ++++++++++----------- .../parser/rpt/FormattedTextReadHandler.java | 14 +- .../pentaho/parser/rpt/GroupReadHandler.java | 4 +- .../parser/rpt/MasterDetailReadHandler.java | 2 +- .../pentaho/parser/rpt/ReportReadHandler.java | 1 + .../pentaho/parser/style/FontFaceReadHandler.java | 21 +- .../parser/style/MasterPageReadHandler.java | 96 ++- .../parser/style/OfficeStyleReadHandler.java | 94 ++- .../parser/style/OfficeStylesReadHandler.java | 165 +++-- .../parser/style/PageLayoutReadHandler.java | 92 ++- .../parser/style/StyleDefinitionReadHandler.java | 87 ++- .../parser/stylemapper/OneOfConstantsMapper.java | 2 +- .../draw/TextAreaVerticalAlignMapper.java | 19 +- .../parser/stylemapper/fo/FontStyleMapper.java | 19 +- .../parser/stylemapper/fo/FontWeightMapper.java | 19 +- .../parser/stylemapper/fo/TextAlignMapper.java | 22 +- .../stylemapper/style/FontFamilyGenericMapper.java | 5 +- .../parser/stylemapper/style/FontFamilyMapper.java | 5 +- .../parser/stylemapper/style/FontNameMapper.java | 21 +- .../parser/stylemapper/style/FontPitchMapper.java | 15 +- .../parser/stylemapper/style/FontReliefMapper.java | 18 +- .../stylemapper/style/TextEmphasizeMapper.java | 18 +- .../style/TextUnderlineColorMapper.java | 27 +- .../style/TextUnderlineStyleMapper.java | 28 +- .../stylemapper/style/TextUnderlineWordMode.java | 15 +- .../stylemapper/style/VerticalAlignMapper.java | 21 +- .../stylemapper/table/ColumnWidthMapper.java | 22 +- .../parser/stylemapper/table/RowHeightMapper.java | 22 +- .../parser/table/TableColumnReadHandler.java | 1 + .../parser/table/TableColumnsReadHandler.java | 2 +- .../java/com/sun/star/report/pentaho/smil.css | 2 +- .../com/sun/star/report/pentaho/star-office.css | 2 +- .../com/sun/star/report/pentaho/star-report.css | 28 +- .../java/com/sun/star/report/pentaho/star-rpt.css | 2 +- .../report/pentaho/styles/LengthCalculator.java | 117 ++-- .../star/report/pentaho/styles/StyleMapper.java | 76 +-- .../star/report/pentaho/styles/StyleMapperKey.java | 4 +- .../styles/StyleMapperXmlFactoryModule.java | 3 +- .../styles/StyleMapperXmlResourceFactory.java | 25 +- .../pentaho/styles/StyleMappingReadHandler.java | 98 ++- .../report/pentaho/styles/StyleMappingRule.java | 47 +- .../sun/star/report/pentaho/styles/stylemapper.xsd | 102 +-- .../java/com/sun/star/report/pentaho/svg.css | 2 +- .../java/com/sun/star/report/pentaho/xsl-fo.css | 2 +- .../sun/star/report/util/DefaultJobProperties.java | 65 +- .../sun/star/report/util/DefaultParameterMap.java | 142 ++-- .../report/util/DefaultReportJobDefinition.java | 152 +++-- .../com/sun/star/report/util/ManifestWriter.java | 104 +-- 155 files changed, 3947 insertions(+), 4003 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/ImageService.java b/reportbuilder/java/com/sun/star/report/ImageService.java index 193b97d66d58..a407164d965a 100644 --- a/reportbuilder/java/com/sun/star/report/ImageService.java +++ b/reportbuilder/java/com/sun/star/report/ImageService.java @@ -40,23 +40,33 @@ public interface ImageService { /** + * @param image * @return the mime-type of the image as string. + * @throws ReportExecutionException */ String getMimeType(final InputStream image) throws ReportExecutionException; /** + * @param image * @return the mime-type of the image as string. + * @throws ReportExecutionException */ String getMimeType(final byte[] image) throws ReportExecutionException; /** + * @param image * @returns the dimension in 100th mm. - **/ + * + * @throws ReportExecutionException + * @return*/ Dimension getImageSize(final InputStream image) throws ReportExecutionException; /** + * @param image * @returns the dimension in 100th mm. - **/ + * + * @throws ReportExecutionException + * @return*/ 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 21564d5851df..88a519cb7113 100644 --- a/reportbuilder/java/com/sun/star/report/InputRepository.java +++ b/reportbuilder/java/com/sun/star/report/InputRepository.java @@ -82,4 +82,10 @@ public interface InputRepository boolean isReadable(final String name); void closeInputRepository(); + + /** returns the URL of the database document + * + * @return the URL of the database document + */ + String getRootURL(); } diff --git a/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java b/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java index 4cda72cacb5d..585394207568 100644 --- a/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java +++ b/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java @@ -53,6 +53,7 @@ public interface JobProgressIndicator * Stopped indicators must ignore that call. * * @param string the progress description + * @param text * @param maxValue the maximum value * @see JobProgressIndicator#setText(String) */ diff --git a/reportbuilder/java/com/sun/star/report/OfficeToken.java b/reportbuilder/java/com/sun/star/report/OfficeToken.java index 6685afe297da..ceddb98f077e 100644 --- a/reportbuilder/java/com/sun/star/report/OfficeToken.java +++ b/reportbuilder/java/com/sun/star/report/OfficeToken.java @@ -27,41 +27,42 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - package com.sun.star.report; /** * * @author Ocke Janssen */ -public class OfficeToken { - public static final String GRAPHIC = "graphic"; - public static final String GRAPHICS = "Graphics"; - public static final String GRAPHIC_PROPERTIES = "graphic-properties"; - public static final String PARAGRAPH = "paragraph"; - public static final String TRUE = "true"; - public static final String FALSE = "false"; - public static final String FRAME = "frame"; - public static final String STYLE_NAME = "style-name"; - public static final String BACKGROUND_COLOR = "background-color"; - public static final String COVERED_TABLE_CELL = "covered-table-cell"; - public static final String TABLE = "table"; - public static final String TABLE_COLUMN = "table-column"; - public static final String TABLE_COLUMNS = "table-columns"; +public class OfficeToken +{ + + public static final String GRAPHIC = "graphic"; + public static final String GRAPHICS = "Graphics"; + public static final String GRAPHIC_PROPERTIES = "graphic-properties"; + public static final String PARAGRAPH = "paragraph"; + public static final String TRUE = "true"; + public static final String FALSE = "false"; + public static final String FRAME = "frame"; + public static final String STYLE_NAME = "style-name"; + public static final String BACKGROUND_COLOR = "background-color"; + public static final String COVERED_TABLE_CELL = "covered-table-cell"; + public static final String TABLE = "table"; + public static final String TABLE_COLUMN = "table-column"; + public static final String TABLE_COLUMNS = "table-columns"; public static final String TABLE_HEADER_COLUMNS = "table-header-columns"; - public static final String TABLE_HEADER_ROWS = "table-header-rows"; - public static final String TABLE_ROWS = "table-rows"; - public static final String TABLE_ROW = "table-row"; - public static final String TABLE_CELL = "table-cell"; - public static final String P = "p"; - public static final String OBJECT_OLE = "object-ole"; - public static final String IMAGE = "image"; - public static final String IMAGE_DATA = "image-data"; - public static final String PRESERVE_IRI = "preserve-IRI"; - 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"; + public static final String TABLE_HEADER_ROWS = "table-header-rows"; + public static final String TABLE_ROWS = "table-rows"; + public static final String TABLE_ROW = "table-row"; + public static final String TABLE_CELL = "table-cell"; + public static final String P = "p"; + public static final String OBJECT_OLE = "object-ole"; + public static final String IMAGE = "image"; + public static final String IMAGE_DATA = "image-data"; + public static final String PRESERVE_IRI = "preserve-IRI"; + 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 aba5deba5f51..0fd3c08f40ec 100644 --- a/reportbuilder/java/com/sun/star/report/OutputRepository.java +++ b/reportbuilder/java/com/sun/star/report/OutputRepository.java @@ -58,6 +58,7 @@ public interface OutputRepository /** allows to acces sub repositories inside this repository * * @param name describes the path to the sub repository + * @param mimeType * @return the sub repository * @throws java.io.IOException when the sub repository doesn't exist. */ diff --git a/reportbuilder/java/com/sun/star/report/ReportEngine.java b/reportbuilder/java/com/sun/star/report/ReportEngine.java index 549f5bb224c7..0e5260dff253 100644 --- a/reportbuilder/java/com/sun/star/report/ReportEngine.java +++ b/reportbuilder/java/com/sun/star/report/ReportEngine.java @@ -50,6 +50,7 @@ public interface ReportEngine /** * Open points: How to define scheduling? * + * @param definition * @return the report job definition for the job description. * @throws JobDefinitionException */ diff --git a/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java b/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java index 8c191a77d2a3..c8798d02436e 100644 --- a/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java +++ b/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report; /** @@ -37,23 +35,24 @@ package com.sun.star.report; */ public class ReportEngineParameterNames { - public static final String CONTENT_TYPE = "content-type"; - public static final String INPUT_NAME= "input.name"; - public static final String INPUT_REPOSITORY = "input.repository"; - public static final String OUTPUT_NAME= "output.name"; - public static final String OUTPUT_REPOSITORY = "output.repository"; - public static final String INPUT_DATASOURCE_FACTORY = "input.datasource-factory"; - public static final String IMAGE_SERVICE = "ImageService"; - public static final String INPUT_REPORTJOB_FACTORY = "input.reportjob-factory"; - public static final String INPUT_MASTER_COLUMNS = "input.master-columns"; - public static final String INPUT_MASTER_VALUES = "input.master-values"; - public static final String INPUT_DETAIL_COLUMNS = "input.detail-columns"; - 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 () - { - } + public static final String CONTENT_TYPE = "content-type"; + public static final String INPUT_NAME = "input.name"; + public static final String INPUT_REPOSITORY = "input.repository"; + public static final String OUTPUT_NAME = "output.name"; + public static final String OUTPUT_REPOSITORY = "output.repository"; + public static final String INPUT_DATASOURCE_FACTORY = "input.datasource-factory"; + public static final String IMAGE_SERVICE = "ImageService"; + public static final String INPUT_REPORTJOB_FACTORY = "input.reportjob-factory"; + public static final String INPUT_MASTER_COLUMNS = "input.master-columns"; + public static final String INPUT_MASTER_VALUES = "input.master-values"; + public static final String INPUT_DETAIL_COLUMNS = "input.detail-columns"; + 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/ReportExecutionException.java b/reportbuilder/java/com/sun/star/report/ReportExecutionException.java index 55ba51e4a61e..d9b0a77cbe09 100644 --- a/reportbuilder/java/com/sun/star/report/ReportExecutionException.java +++ b/reportbuilder/java/com/sun/star/report/ReportExecutionException.java @@ -27,64 +27,63 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report; public class ReportExecutionException extends Exception { - /** - * Constructs a new exception with null as its detail message. The cause is - * not initialized, and may subsequently be initialized by a call to {@link - * #initCause}. - */ - public ReportExecutionException () - { - } - /** - * Constructs a new exception with the specified cause and a detail message of - * (cause==null ? null : cause.toString()) (which typically contains the class - * and detail message of cause). This constructor is useful for exceptions that - * are little more than wrappers for other throwables (for example, {@link - * java.security.PrivilegedActionException}). - * - * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} - * method). (A null value is permitted, and indicates that the - * cause is nonexistent or unknown.) - * @since 1.4 - */ - public ReportExecutionException (Throwable cause) - { - super(cause); - } + /** + * Constructs a new exception with null as its detail message. The cause is + * not initialized, and may subsequently be initialized by a call to {@link + * #initCause}. + */ + public ReportExecutionException() + { + } + + /** + * Constructs a new exception with the specified cause and a detail message of + * (cause==null ? null : cause.toString()) (which typically contains the class + * and detail message of cause). This constructor is useful for exceptions that + * are little more than wrappers for other throwables (for example, {@link + * java.security.PrivilegedActionException}). + * + * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} + * method). (A null value is permitted, and indicates that the + * cause is nonexistent or unknown.) + * @since 1.4 + */ + public ReportExecutionException(Throwable cause) + { + super(cause); + } - /** - * Constructs a new exception with the specified detail message. The cause is not - * initialized, and may subsequently be initialized by a call to {@link #initCause}. - * - * @param message the detail message. The detail message is saved for later retrieval by - * the {@link #getMessage()} method. - */ - public ReportExecutionException (String message) - { - super(message); - } + /** + * Constructs a new exception with the specified detail message. The cause is not + * initialized, and may subsequently be initialized by a call to {@link #initCause}. + * + * @param message the detail message. The detail message is saved for later retrieval by + * the {@link #getMessage()} method. + */ + public ReportExecutionException(String message) + { + super(message); + } - /** - * Constructs a new exception with the specified detail message and cause.

Note that - * the detail message associated with cause is not automatically - * incorporated in this exception's detail message. - * - * @param message the detail message (which is saved for later retrieval by the {@link - * #getMessage()} method). - * @param cause the cause (which is saved for later retrieval by the {@link - * #getCause()} method). (A null value is permitted, and - * indicates that the cause is nonexistent or unknown.) - * @since 1.4 - */ - public ReportExecutionException (String message, Throwable cause) - { - super(message, cause); - } + /** + * Constructs a new exception with the specified detail message and cause.

Note that + * the detail message associated with cause is not automatically + * incorporated in this exception's detail message. + * + * @param message the detail message (which is saved for later retrieval by the {@link + * #getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the {@link + * #getCause()} method). (A null value is permitted, and + * indicates that the cause is nonexistent or unknown.) + * @since 1.4 + */ + public ReportExecutionException(String message, Throwable cause) + { + super(message, cause); + } } diff --git a/reportbuilder/java/com/sun/star/report/ReportExpression.java b/reportbuilder/java/com/sun/star/report/ReportExpression.java index 5576a74205d5..f26fbd6cec8b 100644 --- a/reportbuilder/java/com/sun/star/report/ReportExpression.java +++ b/reportbuilder/java/com/sun/star/report/ReportExpression.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report; /** @@ -47,8 +45,10 @@ package com.sun.star.report; */ public interface ReportExpression { - void setParameters (Object[] parameters); - Object getParameters (); - Object getValue(DataRow row); + void setParameters(Object[] parameters); + + Object getParameters(); + + Object getValue(DataRow row); } diff --git a/reportbuilder/java/com/sun/star/report/ReportJob.java b/reportbuilder/java/com/sun/star/report/ReportJob.java index 8caf39b9bdae..6f93f5db8b0c 100644 --- a/reportbuilder/java/com/sun/star/report/ReportJob.java +++ b/reportbuilder/java/com/sun/star/report/ReportJob.java @@ -62,6 +62,8 @@ public interface ReportJob * first. If we execute at once, the user either has to deal with * threading code or wont receive any progress information in single * threaded environments. + * @throws java.io.IOException + * @throws ReportExecutionException */ void execute() throws ReportExecutionException, IOException; diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportData.java b/reportbuilder/java/com/sun/star/report/SDBCReportData.java index 5107d8ebf427..610cbde2a796 100644 --- a/reportbuilder/java/com/sun/star/report/SDBCReportData.java +++ b/reportbuilder/java/com/sun/star/report/SDBCReportData.java @@ -83,7 +83,7 @@ public class SDBCReportData implements DataSource parameters = xSuppParams.getParameters(); } - final XColumnsSupplier columnsSup = (XColumnsSupplier)UnoRuntime.queryInterface(XColumnsSupplier.class, rowSet); + final XColumnsSupplier columnsSup = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, rowSet); final XNameAccess columns = columnsSup.getColumns(); final String[] columnNamesList = columns.getElementNames(); final XResultSetMetaDataSupplier sup = (XResultSetMetaDataSupplier) UnoRuntime.queryInterface(XResultSetMetaDataSupplier.class, rowSet); @@ -92,7 +92,9 @@ public class SDBCReportData implements DataSource columnCount = resultSetMetaData.getColumnCount(); firstParameterIndex = columnCount + 1; if (parameters != null) + { columnCount += parameters.getCount(); + } columnTypes = new int[columnCount]; columnNames = new String[columnCount]; @@ -111,7 +113,7 @@ public class SDBCReportData implements DataSource final XPropertySet paramColumn = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, parameters.getByIndex(i - firstParameterIndex)); columnNames[i - 1] = (String) paramColumn.getPropertyValue("Name"); - columnTypes[i - 1] = ((Integer) paramColumn.getPropertyValue("Type")).intValue(); + columnTypes[i - 1] = (Integer) paramColumn.getPropertyValue("Type"); } catch (Exception e) { @@ -151,7 +153,9 @@ public class SDBCReportData implements DataSource public boolean absolute(final int row) throws DataSourceException { if (rowSet == null) + { return false; + } try { if (row == 0) @@ -170,7 +174,9 @@ public class SDBCReportData implements DataSource public boolean next() throws DataSourceException { if (rowSet == null) + { return false; + } try { return rowSet.next(); @@ -294,7 +300,9 @@ public class SDBCReportData implements DataSource public Object getObject(final int column) throws DataSourceException { if (rowSet == null) + { return null; + } try { final boolean isParameterValue = (parameters != null) && (column >= firstParameterIndex); diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java index af396d415338..5c3032e3a7f9 100644 --- a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java +++ b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java @@ -77,6 +77,7 @@ import org.apache.commons.logging.LogFactory; */ public class SDBCReportDataFactory implements DataSourceFactory { + private static final String ESCAPEPROCESSING = "EscapeProcessing"; private class RowSetProperties @@ -97,7 +98,6 @@ public class SDBCReportDataFactory implements DataSourceFactory this.maxRows = maxRows; } - public boolean equals(Object obj) { if (obj == null) @@ -143,8 +143,10 @@ public class SDBCReportDataFactory implements DataSourceFactory return hash; } } + class ParameterDefinition { + int parameterCount = 0; private ArrayList parameterIndex = new ArrayList(); } @@ -210,14 +212,14 @@ public class SDBCReportDataFactory implements DataSourceFactory 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]; + final Object[] p = createRowSet(rowSetProps, parameters); + final XRowSet rowSet = (XRowSet) p[0]; - if (command.length() != 0 ) + if (command.length() != 0) { - final ParameterDefinition paramDef = (ParameterDefinition)p[1]; - fillParameter(parameters, rowSet,paramDef); - rowSetCreated = rowSetCreated && ( maxRows == null || maxRows.intValue() == 0); + final ParameterDefinition paramDef = (ParameterDefinition) p[1]; + fillParameter(parameters, rowSet, paramDef); + rowSetCreated = rowSetCreated && (maxRows == null || maxRows == 0); final XCompletedExecution execute = (XCompletedExecution) UnoRuntime.queryInterface(XCompletedExecution.class, rowSet); if (rowSetCreated && execute != null && paramDef.parameterCount > 0) @@ -521,7 +523,7 @@ public class SDBCReportDataFactory implements DataSourceFactory { final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, queries.getByName(command)); final Boolean escape = (Boolean) prop.getPropertyValue(ESCAPEPROCESSING); - if (escape.booleanValue()) + if (escape) { statement = (String) prop.getPropertyValue(UNO_COMMAND); final XSingleSelectQueryComposer composer = getComposer(tools, statement, CommandType.COMMAND); @@ -533,7 +535,7 @@ public class SDBCReportDataFactory implements DataSourceFactory composer.setOrder(order); } final Boolean applyFilter = (Boolean) prop.getPropertyValue(UNO_APPLY_FILTER); - if (applyFilter.booleanValue()) + if (applyFilter) { final String filter = (String) prop.getPropertyValue(UNO_FILTER); if (filter != null && filter.length() != 0) @@ -561,7 +563,7 @@ public class SDBCReportDataFactory implements DataSourceFactory } private void fillParameter(final Map parameters, - final XRowSet rowSet,final ParameterDefinition paramDef) + final XRowSet rowSet, final ParameterDefinition paramDef) throws SQLException, UnknownPropertyException, PropertyVetoException, @@ -582,19 +584,22 @@ public class SDBCReportDataFactory implements DataSourceFactory { object = ((BigDecimal) object).toString(); } - final Integer pos = (Integer)paramDef.parameterIndex.get(i); + final Integer pos = (Integer) paramDef.parameterIndex.get(i); para.setObject(pos + 1, object); } } } - private final Object[] createRowSet(final RowSetProperties rowSetProps,final Map parameters) + 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() ) + if (rowSetProperties.containsKey(rowSetProps) && detailColumns != null && !detailColumns.isEmpty()) { - return new Object[]{ rowSetProperties.get(rowSetProps),parameterMap.get(rowSetProps)}; + return new Object[] + { + rowSetProperties.get(rowSetProps), parameterMap.get(rowSetProps) + }; } rowSetCreated = true; @@ -628,7 +633,10 @@ public class SDBCReportDataFactory implements DataSourceFactory rowSetProperties.put(rowSetProps, rowSet); parameterMap.put(rowSetProps, paramDef); - return new Object[]{rowSet,paramDef}; + return new Object[] + { + rowSet, paramDef + }; } private ParameterDefinition createParameter(final Map parameters, @@ -645,7 +653,7 @@ public class SDBCReportDataFactory implements DataSourceFactory 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)) { composer.setFilter((String) rowSetProp.getPropertyValue("Filter")); } @@ -660,7 +668,7 @@ public class SDBCReportDataFactory implements DataSourceFactory { final int oldParameterCount = params.getCount(); paramDef.parameterCount = oldParameterCount; - if ( detailColumns != null ) + if (detailColumns != null) { for (int i = 0; i < oldParameterCount; i++) { @@ -672,10 +680,10 @@ public class SDBCReportDataFactory implements DataSourceFactory final String name = (String) parameter.getPropertyValue("Name"); for (int j = 0; j < detailColumns.size(); j++) { - if ( name.equals(detailColumns.get(j) ) ) + if (name.equals(detailColumns.get(j))) { handledColumns.add(name); - paramDef.parameterIndex.add(Integer.valueOf(i)); + paramDef.parameterIndex.add(i); --paramDef.parameterCount; break; } @@ -691,7 +699,7 @@ public class SDBCReportDataFactory implements DataSourceFactory } } final ArrayList masterValues = (ArrayList) parameters.get(MASTER_VALUES); - if (masterValues != null && !masterValues.isEmpty() && paramDef.parameterIndex.size() != detailColumns.size() ) + if (masterValues != null && !masterValues.isEmpty() && paramDef.parameterIndex.size() != detailColumns.size()) { // Vector masterColumns = (Vector) parameters.get("master-columns"); @@ -708,7 +716,7 @@ public class SDBCReportDataFactory implements DataSourceFactory ++newParamterCounter) { final String detail = (String) it.next(); - if ( !handledColumns.contains(detail) ) + if (!handledColumns.contains(detail)) { //String master = (String) masterIt.next(); oldFilter.append(quote); @@ -720,7 +728,7 @@ public class SDBCReportDataFactory implements DataSourceFactory { oldFilter.append(" AND "); } - paramDef.parameterIndex.add(Integer.valueOf(newParamterCounter + paramDef.parameterCount - 1)); + paramDef.parameterIndex.add(newParamterCounter + paramDef.parameterCount - 1); } } @@ -728,7 +736,7 @@ public class SDBCReportDataFactory implements DataSourceFactory final String sQuery = composer.getQuery(); rowSetProp.setPropertyValue(UNO_COMMAND, sQuery); - rowSetProp.setPropertyValue(UNO_COMMAND_TYPE,Integer.valueOf(CommandType.COMMAND)); + rowSetProp.setPropertyValue(UNO_COMMAND_TYPE, Integer.valueOf(CommandType.COMMAND)); } } return paramDef; @@ -773,7 +781,7 @@ public class SDBCReportDataFactory implements DataSourceFactory { final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, queries.getByName(command)); final Boolean escape = (Boolean) prop.getPropertyValue(ESCAPEPROCESSING); - rowSetProp.setPropertyValue( ESCAPEPROCESSING, escape); + rowSetProp.setPropertyValue(ESCAPEPROCESSING, escape); final String queryCommand = (String) prop.getPropertyValue(UNO_COMMAND); statement = "SELECT * FROM (" + queryCommand + ")"; } diff --git a/reportbuilder/java/com/sun/star/report/SOImageService.java b/reportbuilder/java/com/sun/star/report/SOImageService.java index 83413fe91deb..075981414957 100644 --- a/reportbuilder/java/com/sun/star/report/SOImageService.java +++ b/reportbuilder/java/com/sun/star/report/SOImageService.java @@ -57,6 +57,8 @@ public class SOImageService implements ImageService /** * Creates a new instance of SOImageService + * @param xCompContext + * @throws ReportExecutionException */ public SOImageService(final XComponentContext xCompContext) throws ReportExecutionException, com.sun.star.uno.Exception @@ -87,7 +89,10 @@ public class SOImageService implements ImageService final Dimension dim = new Dimension(); try { - final PropertyValue[] value = new PropertyValue[]{new PropertyValue()}; + final PropertyValue[] value = new PropertyValue[] + { + new PropertyValue() + }; // value[0] = new PropertyValue(); value[0].Name = "InputStream"; value[0].Value = image; @@ -106,7 +111,7 @@ public class SOImageService implements ImageService { imageSize = (Size) xImage.getPropertyValue("SizePixel"); final int dpi = java.awt.Toolkit.getDefaultToolkit().getScreenResolution(); - final double fac = 2540 / (double)dpi; + final double fac = 2540 / (double) dpi; dim.setSize(imageSize.Width * fac, imageSize.Height * fac); } } @@ -135,7 +140,10 @@ public class SOImageService implements ImageService { try { - final PropertyValue[] value = new PropertyValue[]{new PropertyValue()}; + final PropertyValue[] value = new PropertyValue[] + { + new PropertyValue() + }; value[0].Name = "InputStream"; value[0].Value = image; diff --git a/reportbuilder/java/com/sun/star/report/StorageRepository.java b/reportbuilder/java/com/sun/star/report/StorageRepository.java index da0c7fe9e123..b25d481ddc98 100644 --- a/reportbuilder/java/com/sun/star/report/StorageRepository.java +++ b/reportbuilder/java/com/sun/star/report/StorageRepository.java @@ -55,26 +55,31 @@ import org.apache.commons.logging.LogFactory; */ public class StorageRepository implements InputRepository, OutputRepository { + private static final Log LOGGER = LogFactory.getLog(SDBCReportDataFactory.class); private static final String REPORT_PROCESSING_FAILED = "ReportProcessing failed"; private XStorage input; private XStorage output; + private final String rootURL; /** * * @param input * @param output + * @param rootURL * @throws java.io.IOException */ - public StorageRepository(final XStorage input, final XStorage output) + public StorageRepository(final XStorage input, final XStorage output, final String rootURL) { this.input = input; this.output = output; + this.rootURL = rootURL; } - public StorageRepository(final XStorage storage, final boolean isOutput) + public StorageRepository(final XStorage storage, final boolean isOutput, final String rootURL) { + this.rootURL = rootURL; if (isOutput) { this.output = storage; @@ -150,7 +155,7 @@ public class StorageRepository implements InputRepository, OutputRepository } catch (NoSuchElementException e) { - // We expect this exception, no need to log it. + // We expect this exception, no need to log it. } return false; } @@ -204,7 +209,7 @@ public class StorageRepository implements InputRepository, OutputRepository throw new IOException(); } final XStorage storage = (XStorage) UnoRuntime.queryInterface(XStorage.class, input.openStorageElement(temp, ElementModes.READ)); - return new StorageRepository(storage, false); + return new StorageRepository(storage, false, rootURL); } catch (NoSuchElementException ex) { @@ -254,7 +259,7 @@ public class StorageRepository implements InputRepository, OutputRepository final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, storage); prop.setPropertyValue("MediaType", mimeType); } - return new StorageRepository(storage, true); + return new StorageRepository(storage, true, rootURL); } catch (UnknownPropertyException ex) { @@ -333,8 +338,13 @@ public class StorageRepository implements InputRepository, OutputRepository } catch (NoSuchElementException ex) { - // We expect this exception, no need to log it. + // We expect this exception, no need to log it. } return false; } + + public String getRootURL() + { + return rootURL; + } } 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 87cb540b4a94..1bbf417a4b8e 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java +++ b/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java @@ -50,7 +50,7 @@ public class AuthorFunction implements Function return "AUTHOR"; } - public TypeValuePair evaluate(final FormulaContext context,final ParameterCallback parameters) + public TypeValuePair evaluate(final FormulaContext context, final ParameterCallback parameters) throws EvaluationException { if (parameters.getParameterCount() != 0) 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 475ce31ab9a1..3413239388e8 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunctionDescription.java +++ b/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunctionDescription.java @@ -43,7 +43,7 @@ public class AuthorFunctionDescription extends AbstractFunctionDescription public AuthorFunctionDescription() { - super("AUTHOR","com.sun.star.report.function.metadata.Author-Function"); + super("AUTHOR", "com.sun.star.report.function.metadata.Author-Function"); } public FunctionCategory getCategory() diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java b/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java index be342dc27706..928bbaa0f0ec 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java +++ b/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java @@ -54,7 +54,7 @@ public class TitleFunction implements Function return "TITLE"; } - public TypeValuePair evaluate(final FormulaContext context,final ParameterCallback parameters) + public TypeValuePair evaluate(final FormulaContext context, final ParameterCallback parameters) throws EvaluationException { if (parameters.getParameterCount() != 0) 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 a8dadc17a00d..83e9c5de464f 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunctionDescription.java +++ b/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunctionDescription.java @@ -43,7 +43,7 @@ public class TitleFunctionDescription extends AbstractFunctionDescription public TitleFunctionDescription() { - super("TITLE","com.sun.star.report.function.metadata.Title-Function"); + super("TITLE", "com.sun.star.report.function.metadata.Title-Function"); } public FunctionCategory getCategory() diff --git a/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java b/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java index 0f2c858d1c96..d73b1c222512 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java @@ -65,7 +65,9 @@ public class DefaultNameGenerator * * @param namePrefix a user defined name for that resource. * @param mimeType the mime type of the resource to be stored in the repository. + * @param isStream * @return the generated, fully qualified name. + * @throws java.io.IOException */ private String generateName(final String namePrefix, final String mimeType, final boolean isStream) throws IOException @@ -112,7 +114,7 @@ public class DefaultNameGenerator { throw new IOException(); } - firstFileName.delete(0,firstFileName.length() ); + firstFileName.delete(0, firstFileName.length()); firstFileName.append(name); firstFileName.append(counter); if (suffix != null) diff --git a/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java b/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java index 15e364c40e8d..84fac5773588 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java @@ -62,7 +62,6 @@ public class OfficeNamespaces public static final String XSI_NS = "http://www.w3.org/2001/XMLSchema-instance"; public static final String OOREPORT_NS = "http://openoffice.org/2005/report"; public static final String CONFIG = "urn:oasis:names:tc:opendocument:xmlns:config:1.0"; - /** * @deprecated */ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java index 46d541679741..846053cd6bc4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java @@ -44,6 +44,7 @@ import org.pentaho.reporting.libraries.base.config.Configuration; */ public class PentahoFormulaContext implements FormulaContext { + final private FormulaContext backend; final private Configuration config; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java index e3b5b268ea43..fbfa211e112c 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java @@ -30,7 +30,7 @@ package com.sun.star.report.pentaho; import java.io.IOException; -import java.util.ArrayList; +import java.lang.Integer;import java.util.ArrayList; import com.sun.star.report.DataSourceFactory; import com.sun.star.report.InputRepository; @@ -79,6 +79,7 @@ import org.pentaho.reporting.libraries.resourceloader.ResourceManager; */ public class PentahoReportJob implements ReportJob { + private static final Log LOGGER = LogFactory.getLog(PentahoReportJob.class); private boolean finished; private final List listeners; @@ -93,7 +94,6 @@ public class PentahoReportJob implements ReportJob private final ReportJobDefinition definition; private final List masterValues; private final List detailColumns; - private final Integer maxRows; public ReportJobDefinition getDefinition() { @@ -145,7 +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); + Integer maxRows=(Integer) jobProperties.getProperty(ReportEngineParameterNames.MAXROWS); this.resourceManager = new ResourceManager(); this.resourceManager.registerDefaults(); @@ -197,7 +197,7 @@ public class PentahoReportJob implements ReportJob */ public void interrupt() { - // hey, not yet .. + // hey, not yet .. } /** @@ -240,14 +240,18 @@ public class PentahoReportJob implements ReportJob { final OfficeGroup group = (OfficeGroup) node; final FormulaExpression exp = (FormulaExpression) group.getGroupingExpression(); - if ( exp == null ) + if (exp == null) + { continue; + } try { final String expression = exp.getFormulaExpression(); - if ( expression == null) + if (expression == null) + { continue; + } final FormulaFunction function = (FormulaFunction) parser.parse(expression); final LValue[] parameters = function.getChildValues(); if (parameters.length > 0) @@ -261,7 +265,7 @@ public class PentahoReportJob implements ReportJob if (reportExp.getName().equals(name)) { - final LValue val = (LValue) parser.parse(reportExp.getFormulaExpression()); + final LValue val = parser.parse(reportExp.getFormulaExpression()); if (val instanceof FormulaFunction) { final FormulaFunction reportFunction = (FormulaFunction) val; @@ -308,6 +312,7 @@ public class PentahoReportJob implements ReportJob job.getConfiguration().setConfigProperty(ReportEngineParameterNames.AUTHOR, (String) jobProperties.getProperty(ReportEngineParameterNames.AUTHOR)); job.getConfiguration().setConfigProperty(ReportEngineParameterNames.TITLE, (String) jobProperties.getProperty(ReportEngineParameterNames.TITLE)); } + /** * Although we might want to run the job as soon as it has been created, sometimes it is * wiser to let the user add some listeners first. If we execute at once, the user @@ -344,7 +349,7 @@ 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,Boolean.valueOf(!("false".equals(escapeProcessing)))); + parameters.put(SDBCReportDataFactory.ESCAPE_PROCESSING, !("false".equals(escapeProcessing))); final String filter = (String) officeReport.getAttribute(OfficeNamespaces.OOREPORT_NS, "filter"); parameters.put(SDBCReportDataFactory.UNO_FILTER, filter); @@ -361,8 +366,10 @@ public class PentahoReportJob implements ReportJob catch (final Exception e) { String message = e.getMessage(); - if ( message.length() == 0 ) + if (message.length() == 0) + { message = "Failed to process the report"; + } throw new ReportExecutionException(message, e); } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java index 30c9711dce05..7a25d05c593f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java @@ -55,7 +55,6 @@ public final class SOFormulaOpCodeMapper extends WeakBase this.parser = parser; } - // com.sun.star.sheet.XFormulaOpCodeMapper: public int getOpCodeExternal() { @@ -69,13 +68,15 @@ public final class SOFormulaOpCodeMapper extends WeakBase public com.sun.star.sheet.FormulaToken[] getMappings(String[] Names, int Language) throws com.sun.star.lang.IllegalArgumentException { - if ( Language != FormulaLanguage.ODFF ) + if (Language != FormulaLanguage.ODFF) + { throw new IllegalArgumentException(); + } final ArrayList token = new ArrayList(); final Map parserNames = parser.getNames(); for (int i = 0; i < Names.length; i++) { - if ( parserNames.containsKey(Names[i]) ) + if (parserNames.containsKey(Names[i])) { token.add(((FormulaOpCodeMapEntry) parserNames.get(Names[i])).Token); } @@ -86,36 +87,38 @@ public final class SOFormulaOpCodeMapper extends WeakBase public com.sun.star.sheet.FormulaOpCodeMapEntry[] getAvailableMappings(int Language, int Groups) throws com.sun.star.lang.IllegalArgumentException { - if ( Language != FormulaLanguage.ODFF ) + if (Language != FormulaLanguage.ODFF) + { throw new IllegalArgumentException(); + } final ArrayList token = new ArrayList(); - if ( Groups == FormulaMapGroup.SPECIAL ) + if (Groups == FormulaMapGroup.SPECIAL) { return (com.sun.star.sheet.FormulaOpCodeMapEntry[]) parser.getSpecialOpCodes().toArray(new FormulaOpCodeMapEntry[parser.getSpecialOpCodes().size()]); } else { - if ( (Groups & FormulaMapGroup.ARRAY_SEPARATORS) != 0 ) + if ((Groups & FormulaMapGroup.ARRAY_SEPARATORS) != 0) { token.addAll(parser.getGroup(SOFormulaParser.ARRAY_SEPARATORS).values()); } - if ( (Groups & FormulaMapGroup.SEPARATORS) != 0 ) + if ((Groups & FormulaMapGroup.SEPARATORS) != 0) { token.addAll(parser.getGroup(SOFormulaParser.SEPARATORS).values()); } - if ( (Groups & FormulaMapGroup.ARRAY_SEPARATORS) != 0 ) + if ((Groups & FormulaMapGroup.ARRAY_SEPARATORS) != 0) { token.addAll(parser.getGroup(SOFormulaParser.ARRAY_SEPARATORS).values()); } - if ( (Groups & FormulaMapGroup.UNARY_OPERATORS) != 0 ) + if ((Groups & FormulaMapGroup.UNARY_OPERATORS) != 0) { token.addAll(parser.getGroup(SOFormulaParser.UNARY_OPERATORS).values()); } - if ( (Groups & FormulaMapGroup.BINARY_OPERATORS) != 0 ) + if ((Groups & FormulaMapGroup.BINARY_OPERATORS) != 0) { token.addAll(parser.getGroup(SOFormulaParser.BINARY_OPERATORS).values()); } - if ( (Groups & FormulaMapGroup.FUNCTIONS) != 0 ) + if ((Groups & FormulaMapGroup.FUNCTIONS) != 0) { token.addAll(parser.getGroup(SOFormulaParser.FUNCTIONS).values()); } @@ -142,6 +145,7 @@ public final class SOFormulaOpCodeMapper extends WeakBase /** * This method is a simple helper function to used in the static component initialisation functions as well as * in getSupportedServiceNames. + * @return */ public static String[] getServiceNames() { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java index 321acb017728..4ef8a43f954a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java @@ -75,7 +75,6 @@ public final class SOFormulaParser extends ComponentBase private final PropertySetMixin m_prophlp; private static final String __serviceName = "com.sun.star.report.meta.FormulaParser"; private static final String OPERATORS = "org.pentaho.reporting.libraries.formula.operators."; - // attributes final private List m_OpCodeMap = new ArrayList(); private XFormulaOpCodeMapper formulaOpCodeMapper = null; @@ -119,7 +118,7 @@ public final class SOFormulaParser extends ComponentBase for (int i = 0; i < names.length; i++) { final String token = names[i]; - if ( token != null && token.length() > 0 && token.charAt(0) == '"' ) + if (token != null && token.length() > 0 && token.charAt(0) == '"') { names[i] = token.substring(1, token.length() - 1); } @@ -138,8 +137,9 @@ public final class SOFormulaParser extends ComponentBase parserAllOpCodes.put(opCode.Token.OpCode, opCode); specialOpCodes.add(opCode); } - // addOpCodes(names, opCodes,SPECIAL,false); - } catch ( Exception ex ) + // addOpCodes(names, opCodes,SPECIAL,false); + } + catch (Exception ex) { ex.printStackTrace(); } @@ -150,21 +150,24 @@ public final class SOFormulaParser extends ComponentBase // of the PropertySetMixin helper for further information. // Ensure that your attributes are initialized correctly! m_prophlp = new PropertySetMixin(m_xContext, this, - new Type(com.sun.star.report.meta.XFormulaParser.class), null); + new Type(com.sun.star.report.meta.XFormulaParser.class), null); } - ; // com.sun.star.sheet.XFormulaParser: public com.sun.star.sheet.FormulaToken[] parseFormula(String aFormula, com.sun.star.table.CellAddress aReferencePos) { final ArrayList tokens = new ArrayList(); - if ( !"=".equals(aFormula) ) + if (!"=".equals(aFormula)) { String formula; - if ( aFormula.charAt(0) == '=' ) + if (aFormula.charAt(0) == '=') + { formula = aFormula.substring(1); + } else + { formula = aFormula; + } final ArrayList images = new ArrayList(); try { @@ -176,16 +179,20 @@ public final class SOFormulaParser extends ComponentBase final FormulaToken formulaToken; images.add(token.image); final String upper = token.image.toUpperCase(); - if ( parserNames.containsKey(upper) ) + if (parserNames.containsKey(upper)) { - if ( "(".equals(token.image)) + if ("(".equals(token.image)) + { brackets++; - else if ( ")".equals(token.image)) + } + else if (")".equals(token.image)) + { --brackets; + } final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(upper); formulaToken = opCode.Token; } - else if ( token.kind == GeneratedFormulaParserConstants.WHITESPACE ) + else if (token.kind == GeneratedFormulaParserConstants.WHITESPACE) { final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) specialOpCodes.get(FormulaMapGroupSpecialOffset.SPACES); formulaToken = opCode.Token; @@ -200,10 +207,10 @@ public final class SOFormulaParser extends ComponentBase tokens.add(formulaToken); token = tokenParser.getNextToken(); } - if ( brackets > 0 ) + if (brackets > 0) { final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(")"); - while ( brackets-- != 0 ) + while (brackets-- != 0) { formula = formula.concat(")"); images.add(")"); @@ -213,15 +220,18 @@ public final class SOFormulaParser extends ComponentBase } parser.parse(formula); - } catch ( ParseException ex ) + } + catch (ParseException ex) { boolean found = false; // error occured so all token must be bad for (int i = 0; i < tokens.size(); i++) { - if ( !found && ex.currentToken != null && images.get(i).equals(ex.currentToken.image) ) + if (!found && ex.currentToken != null && images.get(i).equals(ex.currentToken.image)) + { found = true; - if ( found ) + } + if (found) { final FormulaToken dest = new FormulaToken(); dest.OpCode = ((FormulaOpCodeMapEntry) specialOpCodes.get(FormulaMapGroupSpecialOffset.BAD)).Token.OpCode; @@ -230,9 +240,11 @@ public final class SOFormulaParser extends ComponentBase tokens.add(i, dest); } } - } catch ( java.lang.Exception e ) + } + catch (java.lang.Exception e) { - } catch ( TokenMgrError e ) + } + catch (TokenMgrError e) { } } @@ -245,17 +257,21 @@ public final class SOFormulaParser extends ComponentBase for (int i = 0; i < aTokens.length; i++) { final FormulaToken formulaToken = aTokens[i]; - if ( formulaToken.OpCode == opCodePush.Token.OpCode && !formulaToken.Data.equals(Any.VOID) ) + if (formulaToken.OpCode == opCodePush.Token.OpCode && !formulaToken.Data.equals(Any.VOID)) { ret.append(formulaToken.Data); } - else if ( parserAllOpCodes.containsKey(formulaToken.OpCode) ) + else if (parserAllOpCodes.containsKey(formulaToken.OpCode)) { final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserAllOpCodes.get(formulaToken.OpCode); - if ( opCode.Name.length() > 0 ) + if (opCode.Name.length() > 0) + { ret.append(opCode.Name); - else if ( !formulaToken.Data.equals(Any.VOID) ) + } + else if (!formulaToken.Data.equals(Any.VOID)) + { ret.append(formulaToken.Data); + } } } return ret.toString(); @@ -330,6 +346,7 @@ public final class SOFormulaParser extends ComponentBase /** * This method is a simple helper function to used in the static component initialisation functions as well as * in getSupportedServiceNames. + * @return */ public static String[] getServiceNames() { @@ -341,7 +358,7 @@ public final class SOFormulaParser extends ComponentBase public XFormulaOpCodeMapper getFormulaOpCodeMapper() { - if ( formulaOpCodeMapper == null ) + if (formulaOpCodeMapper == null) { formulaOpCodeMapper = new SOFormulaOpCodeMapper(this); } @@ -364,15 +381,17 @@ public final class SOFormulaParser extends ComponentBase for (; i < opCodes.length; i++) { opCode = opCodes[i]; - if ( names[j].equals(opCode.Name) ) + if (names[j].equals(opCode.Name)) { break; } } - if ( i >= opCodes.length ) + if (i >= opCodes.length) { - if ( !add ) + if (!add) + { continue; + } final FormulaToken token = new FormulaToken(ownTokenCounter++, Any.VOID); opCode = new FormulaOpCodeMapEntry(names[j], token); } @@ -400,22 +419,22 @@ public final class SOFormulaParser extends ComponentBase while (iter.hasNext()) { final String configKey = (String) iter.next(); - if ( configKey.endsWith(".class") == false ) + if (!configKey.endsWith(".class")) { continue; } final String operatorClass = configuration.getConfigProperty(configKey); - if ( operatorClass == null ) + if (operatorClass == null) { continue; } - if ( operatorClass.length() == 0 ) + if (operatorClass.length() == 0) { continue; } final String tokenKey = configKey.substring(0, configKey.length() - ".class".length()) + ".token"; final String token = configuration.getConfigProperty(tokenKey); - if ( token == null ) + if (token == null) { continue; } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java index 333441f8b2b5..3b890b940c6f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java @@ -85,6 +85,7 @@ public final class SOFunctionManager extends ComponentBase implements XFunctionM /** * This method is a simple helper function to used in the static component initialisation functions as well as * in getSupportedServiceNames. + * @return */ public static String[] getServiceNames() { @@ -140,27 +141,33 @@ public final class SOFunctionManager extends ComponentBase implements XFunctionM // com.sun.star.report.meta.XFunctionManager: public com.sun.star.report.meta.XFunctionCategory getCategory(int position) throws com.sun.star.lang.IndexOutOfBoundsException, com.sun.star.lang.WrappedTargetException { - if ( position >= categories.length ) + if (position >= categories.length) + { throw new com.sun.star.lang.IndexOutOfBoundsException(); - return new StarFunctionCategory(defaultContext,m_xContext, functionRegistry, position, categories[position]); + } + return new StarFunctionCategory(defaultContext, m_xContext, functionRegistry, position, categories[position]); } public XFunctionDescription getFunctionByName(String arg0) throws NoSuchElementException { final FunctionDescription func = functionRegistry.getMetaData(arg0); - if ( func == null ) + if (func == null) + { throw new NoSuchElementException(); + } int i = 0; for (; i < categories.length; i++) { - if ( categories[i] == func.getCategory() ) + if (categories[i] == func.getCategory()) + { break; + } } try { return new StarFunctionDescription(defaultContext, m_xContext, getCategory(i), func); } - catch ( Exception ex ) + catch (Exception ex) { } return null; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java index 1acf2c846bcb..b1f886d664c5 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java @@ -35,7 +35,9 @@ import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.PropertyVetoException; import com.sun.star.beans.XPropertyChangeListener; import com.sun.star.beans.XVetoableChangeListener; +import com.sun.star.container.XChild; import com.sun.star.embed.XStorage; +import com.sun.star.frame.XModel; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.XInitialization; import com.sun.star.lang.XServiceInfo; @@ -60,6 +62,7 @@ import com.sun.star.report.SOImageService; import com.sun.star.report.StorageRepository; import com.sun.star.report.XReportDefinition; import com.sun.star.report.pentaho.SOReportJobFactory._SOReportJobFactory; +import com.sun.star.sdb.XDocumentDataSource; import com.sun.star.sdbc.XConnection; import com.sun.star.sdbc.XRowSet; import com.sun.star.task.XJob; @@ -92,7 +95,7 @@ public class SOReportJobFactory * The service name, that must be used to get an instance of this service. */ private static final String __serviceName = - "com.sun.star.report.pentaho.SOReportJobFactory"; + "com.sun.star.report.pentaho.SOReportJobFactory"; private final PropertySetMixin m_prophlp; /** * The initial component contextr, that gives access to the service manager, supported singletons, ... It's @@ -106,8 +109,8 @@ public class SOReportJobFactory { m_cmpCtx = xCompContext; m_prophlp = new PropertySetMixin(m_cmpCtx, this, - new Type(XJob.class), - null); // no optionals + new Type(XJob.class), + null); // no optionals } /** @@ -117,7 +120,7 @@ public class SOReportJobFactory * @throws Exception Every exception will not be handled, but will be passed to the caller. */ public void initialize(final Object[] object) - throws com.sun.star.uno.Exception + throws com.sun.star.uno.Exception { /* The component describes what arguments its expected and in which * order!At this point you can read the objects and can intialize @@ -138,13 +141,14 @@ public class SOReportJobFactory /** * This method is a simple helper function to used in the static component initialisation functions as well as * in getSupportedServiceNames. + * @return */ public static String[] getServiceNames() { return new String[] - { - __serviceName - }; + { + __serviceName + }; } /** @@ -177,20 +181,20 @@ public class SOReportJobFactory final XRegistryKey xRegistryRootKey = simpleReg.getRootKey(); // read locale final XRegistryKey locale = xRegistryRootKey.openKey(value); - if ( locale != null ) + if (locale != null) { final String newLocale = locale.getStringValue(); - if ( newLocale != null ) + if (newLocale != null) { currentLocale = newLocale.replace('-', '_'); } } } - catch ( InvalidValueException ex ) + catch (InvalidValueException ex) { Logger.getLogger(SOReportJobFactory.class.getName()).log(Level.SEVERE, null, ex); } - catch ( InvalidRegistryException ex ) + catch (InvalidRegistryException ex) { Logger.getLogger(SOReportJobFactory.class.getName()).log(Level.SEVERE, null, ex); } @@ -199,32 +203,34 @@ public class SOReportJobFactory } public Object execute(final NamedValue[] namedValue) - throws com.sun.star.lang.IllegalArgumentException, com.sun.star.uno.Exception + throws com.sun.star.lang.IllegalArgumentException, com.sun.star.uno.Exception { final ClassLoader cl = java.lang.Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); try { final XSimpleRegistry simpleReg = (XSimpleRegistry) UnoRuntime.queryInterface(XSimpleRegistry.class, - m_cmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.configuration.ConfigurationRegistry", m_cmpCtx)); + m_cmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.configuration.ConfigurationRegistry", m_cmpCtx)); - String currentLocale = getLocaleFromRegistry(simpleReg,"org.openoffice.Setup","L10N/ooSetupSystemLocale"); - if ( currentLocale == null || "".equals(currentLocale) ) + String currentLocale = getLocaleFromRegistry(simpleReg, "org.openoffice.Setup", "L10N/ooSetupSystemLocale"); + if (currentLocale == null || "".equals(currentLocale)) { - currentLocale = getLocaleFromRegistry(simpleReg,"org.openoffice.Office.Linguistic","General/DefaultLocale"); + currentLocale = getLocaleFromRegistry(simpleReg, "org.openoffice.Office.Linguistic", "General/DefaultLocale"); } - if ( currentLocale != null && !"".equals(currentLocale) ) + if (currentLocale != null && !"".equals(currentLocale)) + { System.setProperty("org.pentaho.reporting.libraries.formula.locale", currentLocale); + } final ReportJob job = createReportJob(namedValue); job.execute(); } - catch ( java.lang.Exception e ) + catch (java.lang.Exception e) { LOGGER.error("ReportProcessing failed", e); throw new com.sun.star.lang.WrappedTargetException(e.getMessage(), this, null); } - catch ( java.lang.IncompatibleClassChangeError e2 ) + catch (java.lang.IncompatibleClassChangeError e2) { LOGGER.error("Detected an IncompatibleClassChangeError"); throw new com.sun.star.lang.WrappedTargetException("caught a " + e2.getClass().getName(), this, new com.sun.star.uno.Exception(e2.getLocalizedMessage())); @@ -244,55 +250,55 @@ public class SOReportJobFactory String title = null; Integer maxRows = null; - for ( int i = 0; i < namedValue.length; ++i ) + for (int i = 0; i < namedValue.length; ++i) { final NamedValue aProps = namedValue[i]; - if ( "ActiveConnection".equalsIgnoreCase(aProps.Name) ) + if ("ActiveConnection".equalsIgnoreCase(aProps.Name)) { activeConnection = (XConnection) UnoRuntime.queryInterface(XConnection.class, aProps.Value); } - else if ( "ReportDefinition".equalsIgnoreCase(aProps.Name) ) + else if ("ReportDefinition".equalsIgnoreCase(aProps.Name)) { report = (XReportDefinition) UnoRuntime.queryInterface(XReportDefinition.class, aProps.Value); } - else if ( "InputStorage".equalsIgnoreCase(aProps.Name) ) + else if ("InputStorage".equalsIgnoreCase(aProps.Name)) { input = (XStorage) UnoRuntime.queryInterface(XStorage.class, aProps.Value); } - else if ( "OutputStorage".equalsIgnoreCase(aProps.Name) ) + else if ("OutputStorage".equalsIgnoreCase(aProps.Name)) { output = (XStorage) UnoRuntime.queryInterface(XStorage.class, aProps.Value); } - else if ( "RowSet".equalsIgnoreCase(aProps.Name) ) + else if ("RowSet".equalsIgnoreCase(aProps.Name)) { rowSet = (XRowSet) UnoRuntime.queryInterface(XRowSet.class, aProps.Value); } - else if ( "mimetype".equalsIgnoreCase(aProps.Name) ) + else if ("mimetype".equalsIgnoreCase(aProps.Name)) { mimetype = (String) aProps.Value; } - else if ( "MaxRows".equalsIgnoreCase(aProps.Name) ) + else if ("MaxRows".equalsIgnoreCase(aProps.Name)) { maxRows = (Integer) aProps.Value; } - else if ( ReportEngineParameterNames.AUTHOR.equalsIgnoreCase(aProps.Name) ) + else if (ReportEngineParameterNames.AUTHOR.equalsIgnoreCase(aProps.Name)) { author = (String) aProps.Value; } - else if ( ReportEngineParameterNames.TITLE.equalsIgnoreCase(aProps.Name) ) + else if (ReportEngineParameterNames.TITLE.equalsIgnoreCase(aProps.Name)) { title = (String) aProps.Value; } } - if ( input == null || output == null ) + if (input == null || output == null) { throw new com.sun.star.lang.IllegalArgumentException(); } - if ( rowSet == null ) + if (rowSet == null) { - if ( report == null || activeConnection == null ) + if (report == null || activeConnection == null) { throw new com.sun.star.lang.IllegalArgumentException(); } @@ -301,19 +307,22 @@ public class SOReportJobFactory else { final XPropertySet set = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, rowSet); - if ( set == null ) + if (set == null) { throw new com.sun.star.lang.IllegalArgumentException(); } activeConnection = (XConnection) UnoRuntime.queryInterface(XConnection.class, set.getPropertyValue("ActiveConnection")); } - if ( mimetype == null ) + if (mimetype == null) { mimetype = PentahoReportEngineMetaData.OPENDOCUMENT_TEXT; } + final XChild child = UnoRuntime.queryInterface(XChild.class, activeConnection); + final XDocumentDataSource docSource = UnoRuntime.queryInterface(XDocumentDataSource.class, child.getParent()); + final XModel model = UnoRuntime.queryInterface(XModel.class, docSource.getDatabaseDocument()); final DataSourceFactory dataFactory = new SDBCReportDataFactory(m_cmpCtx, activeConnection); - final StorageRepository storageRepository = new StorageRepository(input, output); + final StorageRepository storageRepository = new StorageRepository(input, output, model.getURL()); final String inputName = "content.xml"; final String outputName = "content.xml"; @@ -330,11 +339,11 @@ public class SOReportJobFactory procParms.setProperty(ReportEngineParameterNames.IMAGE_SERVICE, new SOImageService(m_cmpCtx)); procParms.setProperty(ReportEngineParameterNames.INPUT_REPORTJOB_FACTORY, this); procParms.setProperty(ReportEngineParameterNames.MAXROWS, maxRows); - if ( author != null ) + if (author != null) { procParms.setProperty(ReportEngineParameterNames.AUTHOR, author); } - if ( title != null ) + if (title != null) { procParms.setProperty(ReportEngineParameterNames.TITLE, title); } @@ -349,38 +358,38 @@ public class SOReportJobFactory } public void setPropertyValue(final String aPropertyName, final Object aValue) - throws UnknownPropertyException, PropertyVetoException, com.sun.star.lang.IllegalArgumentException, - WrappedTargetException + throws UnknownPropertyException, PropertyVetoException, com.sun.star.lang.IllegalArgumentException, + WrappedTargetException { m_prophlp.setPropertyValue(aPropertyName, aValue); } public Object getPropertyValue(final String aPropertyName) - throws UnknownPropertyException, WrappedTargetException + throws UnknownPropertyException, WrappedTargetException { return m_prophlp.getPropertyValue(aPropertyName); } public void addPropertyChangeListener(final String aPropertyName, final XPropertyChangeListener xListener) - throws UnknownPropertyException, WrappedTargetException + throws UnknownPropertyException, WrappedTargetException { m_prophlp.addPropertyChangeListener(aPropertyName, xListener); } public void removePropertyChangeListener(final String aPropertyName, final XPropertyChangeListener xListener) - throws UnknownPropertyException, WrappedTargetException + throws UnknownPropertyException, WrappedTargetException { m_prophlp.removePropertyChangeListener(aPropertyName, xListener); } public void addVetoableChangeListener(final String aPropertyName, final XVetoableChangeListener xListener) - throws UnknownPropertyException, WrappedTargetException + throws UnknownPropertyException, WrappedTargetException { m_prophlp.addVetoableChangeListener(aPropertyName, xListener); } public void removeVetoableChangeListener(final String aPropertyName, final XVetoableChangeListener xListener) - throws UnknownPropertyException, WrappedTargetException + throws UnknownPropertyException, WrappedTargetException { m_prophlp.removeVetoableChangeListener(aPropertyName, xListener); } @@ -400,20 +409,20 @@ public class SOReportJobFactory try { - if ( sImplName.equals(_SOReportJobFactory.class.getName()) ) + if (sImplName.equals(_SOReportJobFactory.class.getName())) { xFactory = Factory.createComponentFactory(_SOReportJobFactory.class, _SOReportJobFactory.getServiceNames()); } - else if ( sImplName.equals(SOFunctionManager.class.getName()) ) + else if (sImplName.equals(SOFunctionManager.class.getName())) { xFactory = Factory.createComponentFactory(SOFunctionManager.class, SOFunctionManager.getServiceNames()); } - else if ( sImplName.equals(SOFormulaParser.class.getName()) ) + else if (sImplName.equals(SOFormulaParser.class.getName())) { xFactory = Factory.createComponentFactory(SOFormulaParser.class, SOFormulaParser.getServiceNames()); } } - catch ( java.lang.IncompatibleClassChangeError e2 ) + catch (java.lang.IncompatibleClassChangeError e2) { } @@ -431,13 +440,11 @@ public class SOReportJobFactory public static boolean __writeRegistryServiceInfo(final XRegistryKey regKey) { return Factory.writeRegistryServiceInfo(SOFunctionManager.class.getName(), - SOFunctionManager.getServiceNames(), - regKey) && - Factory.writeRegistryServiceInfo(_SOReportJobFactory.class.getName(), - _SOReportJobFactory.getServiceNames(), - regKey) && - Factory.writeRegistryServiceInfo(SOFormulaParser.class.getName(), - SOFormulaParser.getServiceNames(), - regKey); + SOFunctionManager.getServiceNames(), + regKey) && Factory.writeRegistryServiceInfo(_SOReportJobFactory.class.getName(), + _SOReportJobFactory.getServiceNames(), + regKey) && Factory.writeRegistryServiceInfo(SOFormulaParser.class.getName(), + SOFormulaParser.getServiceNames(), + regKey); } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java index 19b041715acf..2c8b9d9f8786 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java @@ -41,10 +41,10 @@ import org.pentaho.reporting.libraries.formula.DefaultFormulaContext; import org.pentaho.reporting.libraries.formula.function.FunctionCategory; import org.pentaho.reporting.libraries.formula.function.FunctionRegistry; - public final class StarFunctionCategory extends WeakBase - implements com.sun.star.report.meta.XFunctionCategory + implements com.sun.star.report.meta.XFunctionCategory { + private final XComponentContext m_xContext; private final PropertySetMixin m_prophlp; // attributes @@ -55,7 +55,7 @@ public final class StarFunctionCategory extends WeakBase private final DefaultFormulaContext defaultContext; private final Locale defaultLocale; - public StarFunctionCategory( DefaultFormulaContext defaultContext,final XComponentContext context,final FunctionRegistry functionRegistry,final int _number,final FunctionCategory category ) + public StarFunctionCategory(DefaultFormulaContext defaultContext, final XComponentContext context, final FunctionRegistry functionRegistry, final int _number, final FunctionCategory category) { this.defaultContext = defaultContext; m_xContext = context; @@ -68,7 +68,7 @@ public final class StarFunctionCategory extends WeakBase category.getDisplayName(defaultContext.getLocalizationContext().getLocale()); locale = defaultContext.getLocalizationContext().getLocale(); } - catch(MissingResourceException e) + catch (MissingResourceException e) { locale = Locale.ENGLISH; } @@ -80,8 +80,8 @@ public final class StarFunctionCategory extends WeakBase // of the PropertySetMixin helper for further information. // Ensure that your attributes are initialized correctly! m_prophlp = new PropertySetMixin(m_xContext, this, - new Type(com.sun.star.report.meta.XFunctionCategory.class), null); - }; + new Type(com.sun.star.report.meta.XFunctionCategory.class), null); + } // com.sun.star.beans.XPropertySet: public com.sun.star.beans.XPropertySetInfo getPropertySetInfo() @@ -89,7 +89,7 @@ public final class StarFunctionCategory extends WeakBase return m_prophlp.getPropertySetInfo(); } - public void setPropertyValue(String aPropertyName, Object aValue) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.beans.PropertyVetoException, com.sun.star.lang.IllegalArgumentException,com.sun.star.lang.WrappedTargetException + public void setPropertyValue(String aPropertyName, Object aValue) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.beans.PropertyVetoException, com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException { m_prophlp.setPropertyValue(aPropertyName, aValue); } @@ -117,7 +117,7 @@ public final class StarFunctionCategory extends WeakBase public void removeVetoableChangeListener(String aPropertyName, com.sun.star.beans.XVetoableChangeListener xListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException { m_prophlp.removeVetoableChangeListener(aPropertyName, xListener); - } + } // com.sun.star.container.XElementAccess: public com.sun.star.uno.Type getElementType() @@ -154,9 +154,10 @@ public final class StarFunctionCategory extends WeakBase public com.sun.star.report.meta.XFunctionDescription getFunction(int position) throws com.sun.star.lang.IndexOutOfBoundsException, com.sun.star.lang.WrappedTargetException { - if ( position >= functions.length ) + if (position >= functions.length) + { throw new IndexOutOfBoundsException(); - return new StarFunctionDescription(defaultContext,m_xContext,this,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 df19a3f06174..da84dc57746f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java @@ -63,7 +63,8 @@ public final class StarFunctionDescription extends WeakBase { functionDescription.getDisplayName(defaultContext.getLocalizationContext().getLocale()); locale = defaultContext.getLocalizationContext().getLocale(); - } catch ( MissingResourceException e ) + } + catch (MissingResourceException e) { locale = Locale.ENGLISH; } @@ -75,9 +76,8 @@ public final class StarFunctionDescription extends WeakBase // of the PropertySetMixin helper for further information. // Ensure that your attributes are initialized correctly! m_prophlp = new PropertySetMixin(m_xContext, this, - new Type(com.sun.star.report.meta.XFunctionDescription.class), null); + new Type(com.sun.star.report.meta.XFunctionDescription.class), null); } - ; // com.sun.star.beans.XPropertySet: public com.sun.star.beans.XPropertySetInfo getPropertySetInfo() @@ -139,8 +139,10 @@ public final class StarFunctionDescription extends WeakBase for (int i = 0; i < count; i++) { signature.append(functionDescription.getParameterDisplayName(i, defaultLocale)); - if ( i != (count - 1) ) + if (i != (count - 1)) + { signature.append(';'); + } } signature.append(')'); return signature.toString(); @@ -150,7 +152,7 @@ public final class StarFunctionDescription extends WeakBase { int count = functionDescription.getParameterCount(); final boolean infinite = functionDescription.isInfiniteParameterCount(); - if ( infinite ) + if (infinite) { count = 30; } @@ -170,18 +172,24 @@ public final class StarFunctionDescription extends WeakBase { final boolean infinite = functionDescription.isInfiniteParameterCount(); final int count = functionDescription.getParameterCount(); - if ( !infinite && arguments.length > count ) + if (!infinite && arguments.length > count) + { throw new com.sun.star.lang.IllegalArgumentException(); + } final StringBuffer formula = new StringBuffer(getName()); formula.append('('); for (int i = 0; i < arguments.length; ++i) { - if ( arguments[i].length() == 0 ) + if (arguments[i].length() == 0) + { break; + } formula.append(arguments[i]); - if ( i < (arguments.length - 1) && arguments[i+1].length() != 0 ) + if (i < (arguments.length - 1) && arguments[i + 1].length() != 0) + { formula.append(';'); + } } formula.append(')'); return formula.toString(); diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java index 2a3600213d6c..07359dc33452 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho; import java.util.HashMap; @@ -42,85 +40,87 @@ import com.sun.star.report.DataSourceFactory; public class StarReportDataFactory implements ReportDataFactory, Cloneable { - private final DataSourceFactory backend; - public StarReportDataFactory (DataSourceFactory backend) - { - this.backend = backend; - } + private final DataSourceFactory backend; - /** - * Queries a datasource. The string 'query' defines the name of the query. The - * Parameterset given here may contain more data than actually needed. - *

- * The dataset may change between two calls, do not assume anything! - * - * @param query - * @param parameters - * @return - */ - public ReportData queryData (final String query, final DataSet parameters) - throws ReportDataFactoryException - { - try + public StarReportDataFactory(DataSourceFactory backend) { - final HashMap map = new HashMap(); - final int count = parameters.getColumnCount(); - for (int i = 0; i < count; i++) - { - final Object o = parameters.get(i); - map.put (parameters.getColumnName(i), o); - } - return new StarReportData(backend.queryData(query, map)); + this.backend = backend; } - catch(DataSourceException dse) + + /** + * Queries a datasource. The string 'query' defines the name of the query. The + * Parameterset given here may contain more data than actually needed. + *

+ * The dataset may change between two calls, do not assume anything! + * + * @param query + * @param parameters + * @return + */ + public ReportData queryData(final String query, final DataSet parameters) + throws ReportDataFactoryException { - String message = dse.getMessage(); - if ( message.length() == 0 ) - message = "Failed to create report data wrapper"; - throw new ReportDataFactoryException(message,dse); + try + { + final HashMap map = new HashMap(); + final int count = parameters.getColumnCount(); + for (int i = 0; i < count; i++) + { + final Object o = parameters.get(i); + map.put(parameters.getColumnName(i), o); + } + return new StarReportData(backend.queryData(query, map)); + } + catch (DataSourceException dse) + { + String message = dse.getMessage(); + if (message.length() == 0) + { + message = "Failed to create report data wrapper"; + } + throw new ReportDataFactoryException(message, dse); + } + catch (org.jfree.report.DataSourceException e) + { + String message = e.getMessage(); + if (message.length() == 0) + { + message = "Failed to query data"; + } + throw new ReportDataFactoryException(message); + } } - catch (org.jfree.report.DataSourceException e) + + public void open() { - String message = e.getMessage(); - if ( message.length() == 0 ) - message = "Failed to query data"; - throw new ReportDataFactoryException(message); } - } - - public void open() - { - - } - public void close() - { - - } - - - /** - * Derives a freshly initialized report data factory, which is independend of - * the original data factory. Opening or Closing one data factory must not - * affect the other factories. - * - * @return - */ - public ReportDataFactory derive() - { - try + public void close() { - return (ReportDataFactory) clone(); } - catch (CloneNotSupportedException e) + + /** + * Derives a freshly initialized report data factory, which is independend of + * the original data factory. Opening or Closing one data factory must not + * affect the other factories. + * + * @return + */ + public ReportDataFactory derive() { - throw new IllegalStateException("Clone failed?"); + try + { + return (ReportDataFactory) clone(); + } + catch (CloneNotSupportedException e) + { + throw new IllegalStateException("Clone failed?"); + } } - } - public Object clone () throws CloneNotSupportedException - { - return super.clone(); - } + public Object clone() throws CloneNotSupportedException + { + return super.clone(); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarReportModule.java b/reportbuilder/java/com/sun/star/report/pentaho/StarReportModule.java index e39de6fb2f00..6558e30db9f4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/StarReportModule.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarReportModule.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho; import org.pentaho.reporting.libraries.base.boot.AbstractModule; @@ -37,26 +35,25 @@ import org.pentaho.reporting.libraries.base.boot.SubSystem; public class StarReportModule extends AbstractModule { - public StarReportModule () - throws ModuleInitializeException - { - loadModuleInfo(); - } - - /** - * Initializes the module. Use this method to perform all initial setup operations. This - * method is called only once in a modules lifetime. If the initializing cannot be - * completed, throw a ModuleInitializeException to indicate the error,. The module will - * not be available to the system. - * - * @param subSystem the subSystem. - * @throws org.jfree.base.modules.ModuleInitializeException - * if an error ocurred while initializing the module. - */ - public void initialize (final SubSystem subSystem) - throws ModuleInitializeException - { + public StarReportModule() + throws ModuleInitializeException + { + loadModuleInfo(); + } - } + /** + * Initializes the module. Use this method to perform all initial setup operations. This + * method is called only once in a modules lifetime. If the initializing cannot be + * completed, throw a ModuleInitializeException to indicate the error,. The module will + * not be available to the system. + * + * @param subSystem the subSystem. + * @throws org.jfree.base.modules.ModuleInitializeException + * if an error ocurred while initializing the module. + */ + public void initialize(final SubSystem subSystem) + throws ModuleInitializeException + { + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java index e1259d168b44..2e4f9f396088 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.expressions; import com.sun.star.report.ReportExpression; @@ -36,25 +34,26 @@ import com.sun.star.report.DataRow; public class SumExpression implements ReportExpression { - private Object[] parameters; - public SumExpression () - { - } + private Object[] parameters; + + public SumExpression() + { + } - public Object getParameters () - { - return parameters; - } + public Object getParameters() + { + return parameters; + } - public Object getValue (final DataRow row) - { + public Object getValue(final DataRow row) + { - return null; - } + return null; + } - public void setParameters (final Object[] parameters) - { - this.parameters = parameters; - } + public void setParameters(final Object[] parameters) + { + this.parameters = parameters; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java index 8e2d395c8493..b29b4ebb7ddb 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.expressions; import java.util.Locale; @@ -37,45 +35,46 @@ import com.sun.star.report.ReportExpressionMetaData; public class SumExpressionMetaData implements ReportExpressionMetaData { - public String getDescription (final Locale l) - { - // todo implement me - return null; - } - public String getDisplayName (final Locale l) - { - // todo implement me - return null; - } + public String getDescription(final Locale l) + { + // todo implement me + return null; + } + + public String getDisplayName(final Locale l) + { + // todo implement me + return null; + } - public String getName () - { - // todo implement me - return null; - } + public String getName() + { + // todo implement me + return null; + } - public int getParameterCount () - { - // todo implement me - return 0; - } + public int getParameterCount() + { + // todo implement me + return 0; + } - public String getParameterDescription (final int param,final Locale locale) - { - // todo implement me - return null; - } + public String getParameterDescription(final int param, final Locale locale) + { + // todo implement me + return null; + } - public String getParameterDisplayName (final int param,final Locale locale) - { - // todo implement me - return null; - } + public String getParameterDisplayName(final int param, final Locale locale) + { + // todo implement me + return null; + } - public String getParameterName (final int param) - { - // todo implement me - return null; - } + public String getParameterName(final int param) + { + // todo implement me + return null; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java index 3f7245bf12c9..622699aa89d6 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java @@ -242,7 +242,7 @@ public abstract class AbstractReportElementLayoutController } catch (DataSourceException e) { - // ignore .. assume that the reference has not changed. + // ignore .. assume that the reference has not changed. } } final LValue[] childValues = lValue.getChildValues(); diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java index 9ced56ef7ac4..7a96eabbb6b5 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.layoutprocessor; import org.jfree.report.flow.layoutprocessor.LayoutController; @@ -55,37 +53,35 @@ import com.sun.star.report.pentaho.model.FixedTextElement; * @since 05.03.2007 */ public class FixedTextLayoutController - extends AbstractReportElementLayoutController + extends AbstractReportElementLayoutController { - public FixedTextLayoutController() - { - } - + public FixedTextLayoutController() + { + } - protected boolean isValueChanged() - { - final FlowController controller = getFlowController(); - final GlobalMasterRow masterRow = controller.getMasterRow(); - final ReportDataRow reportDataRow = masterRow.getReportDataRow(); - return reportDataRow.getCursor() == 0; - } + protected boolean isValueChanged() + { + final FlowController controller = getFlowController(); + final GlobalMasterRow masterRow = controller.getMasterRow(); + final ReportDataRow reportDataRow = masterRow.getReportDataRow(); + return reportDataRow.getCursor() == 0; + } - protected LayoutController delegateContentGeneration - (final ReportTarget target) - throws ReportProcessingException, ReportDataFactoryException, - DataSourceException - { - final FixedTextElement fte = (FixedTextElement) getNode(); - final Section content = fte.getContent(); + protected LayoutController delegateContentGeneration(final ReportTarget target) + throws ReportProcessingException, ReportDataFactoryException, + DataSourceException + { + final FixedTextElement fte = (FixedTextElement) getNode(); + final Section content = fte.getContent(); - final FlowController flowController = getFlowController(); - final ReportContext reportContext = flowController.getReportContext(); - final LayoutControllerFactory layoutControllerFactory = - reportContext.getLayoutControllerFactory(); + final FlowController flowController = getFlowController(); + final ReportContext reportContext = flowController.getReportContext(); + final LayoutControllerFactory layoutControllerFactory = + reportContext.getLayoutControllerFactory(); - final FixedTextLayoutController flc = (FixedTextLayoutController) clone(); - flc.setState(AbstractReportElementLayoutController.FINISHED); - return layoutControllerFactory.create(flowController, content, flc); - } + final FixedTextLayoutController flc = (FixedTextLayoutController) clone(); + flc.setState(AbstractReportElementLayoutController.FINISHED); + return layoutControllerFactory.create(flowController, content, flc); + } } 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 8515b4997d53..405fe4a2815b 100755 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -27,7 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - package com.sun.star.report.pentaho.layoutprocessor; import java.text.SimpleDateFormat; @@ -54,10 +53,11 @@ import org.pentaho.reporting.libraries.formula.util.HSSFDateUtil; */ public class FormatValueUtility { + private static final String BOOLEAN_VALUE = "boolean-value"; private static final String STRING_VALUE = "string-value"; - public static final String VALUE_TYPE = "value-type"; + private static final String VALUE = "value"; private static SimpleDateFormat dateFormat; private static SimpleDateFormat timeFormat; @@ -74,7 +74,7 @@ public class FormatValueUtility ret = formatTime((Time) value); variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "time-value", ret); } - else if (value instanceof java.sql.Date ) + else if (value instanceof java.sql.Date) { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "date"); ret = formatDate((Date) value); @@ -83,67 +83,67 @@ public class FormatValueUtility 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); + 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"); - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", String.valueOf(value)); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); } else if (value instanceof Boolean) { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "boolean"); if (Boolean.TRUE.equals(value)) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,BOOLEAN_VALUE, OfficeToken.TRUE); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.TRUE); } else { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,BOOLEAN_VALUE, OfficeToken.FALSE); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.FALSE); } } else if (value != null) { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "string"); - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,STRING_VALUE, String.valueOf(value)); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, STRING_VALUE, String.valueOf(value)); } else { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "string"); - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,STRING_VALUE, ""); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, STRING_VALUE, ""); } return ret; } - public static void applyValueForCell(final Object value, final AttributeMap variableSection,final String valueType) + public static void applyValueForCell(final Object value, final AttributeMap variableSection, final String valueType) { if (value instanceof Time) { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "time-value", formatTime((Time) value)); } - else if (value instanceof java.sql.Date ) + 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()); + 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)); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); } else if (value instanceof Boolean) { if (Boolean.TRUE.equals(value)) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,BOOLEAN_VALUE, OfficeToken.TRUE); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.TRUE); } else { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,BOOLEAN_VALUE, OfficeToken.FALSE); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.FALSE); } } else if (value != null) @@ -151,25 +151,24 @@ public class FormatValueUtility try { final Float number = Float.valueOf(String.valueOf(value)); - applyValueForCell(number,variableSection,valueType); + applyValueForCell(number, variableSection, valueType); return; } - catch(NumberFormatException e) + catch (NumberFormatException e) { - } - if ( !"string".equals(valueType)) + if (!"string".equals(valueType)) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", String.valueOf(value)); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); } else { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,STRING_VALUE, String.valueOf(value)); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, STRING_VALUE, String.valueOf(value)); } } else { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS,STRING_VALUE, ""); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, STRING_VALUE, ""); } } @@ -181,6 +180,7 @@ public class FormatValueUtility } return dateFormat.format(date); } + private static synchronized String formatTime(final Date date) { if (timeFormat == null) diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java index c5c69d24716b..e33171840430 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java @@ -59,7 +59,9 @@ import org.jfree.layouting.util.AttributeMap; public class FormattedTextLayoutController extends AbstractReportElementLayoutController { + private static final Log LOGGER = LogFactory.getLog(FormattedTextLayoutController.class); + public FormattedTextLayoutController() { } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementContext.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementContext.java index 4f5ffbdcf35e..7b9624ed6e4a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementContext.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementContext.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.layoutprocessor; /** @@ -39,56 +37,57 @@ package com.sun.star.report.pentaho.layoutprocessor; */ public class ImageElementContext { - private final int colSpan; - private final int rowSpan; - private String[] rowStyles; - private String[] colStyles; - public ImageElementContext(final int colSpan, final int rowSpan) - { - this.colSpan = colSpan; - this.rowSpan = rowSpan; - this.colStyles = new String[colSpan]; - this.rowStyles = new String[rowSpan]; - } + private final int colSpan; + private final int rowSpan; + private String[] rowStyles; + private String[] colStyles; + + public ImageElementContext(final int colSpan, final int rowSpan) + { + this.colSpan = colSpan; + this.rowSpan = rowSpan; + this.colStyles = new String[colSpan]; + this.rowStyles = new String[rowSpan]; + } - public int getColSpan() - { - return colSpan; - } + public int getColSpan() + { + return colSpan; + } - public int getRowSpan() - { - return rowSpan; - } + public int getRowSpan() + { + return rowSpan; + } - public String[] getRowStyles() - { - return rowStyles; - } + public String[] getRowStyles() + { + return rowStyles; + } - public String[] getColStyles() - { - return colStyles; - } + public String[] getColStyles() + { + return colStyles; + } - public void setRowStyle (final int pos, final String styleName) - { - rowStyles[pos] = styleName; - } + public void setRowStyle(final int pos, final String styleName) + { + rowStyles[pos] = styleName; + } - public void setColStyle (final int pos, final String styleName) - { - colStyles[pos] = styleName; - } + public void setColStyle(final int pos, final String styleName) + { + colStyles[pos] = styleName; + } - public String getRowStyle (final int pos) - { - return rowStyles[pos]; - } + public String getRowStyle(final int pos) + { + return rowStyles[pos]; + } - public String getColStyle (final int pos) - { - return colStyles[pos]; - } + public String getColStyle(final int pos) + { + return colStyles[pos]; + } } 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 68d1fc6351c4..81e17b73e276 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java @@ -67,6 +67,7 @@ import org.pentaho.reporting.libraries.base.util.ObjectUtilities; public class ImageElementLayoutController extends AbstractReportElementLayoutController { + private static final Log LOGGER = LogFactory.getLog(ImageElementLayoutController.class); private ImageElementContext context; @@ -184,7 +185,7 @@ public class ImageElementLayoutController return null; } - addRowStyles(context, table,rowPos,rowSpan); + addRowStyles(context, table, rowPos, rowSpan); this.context = context; } return this.context; @@ -198,9 +199,8 @@ public class ImageElementLayoutController final Node[] nodes = tableRow.getNodeArray(); final String namespace = tableCell.getNamespace(); final String type = tableCell.getType(); - for (int i = 0; i < nodes.length; i++) + for (final Node node : nodes) { - final Node node = nodes[i]; if (!(node instanceof Element)) { continue; @@ -211,8 +211,7 @@ public class ImageElementLayoutController (ObjectUtilities.equal(child.getNamespace(), namespace) == false || ObjectUtilities.equal(child.getType(), type) == false)) */ - if (!ObjectUtilities.equal(child.getNamespace(), namespace) || - (!ObjectUtilities.equal(child.getType(), type) && (secondType == null || !ObjectUtilities.equal(child.getType(), secondType)))) + if (!ObjectUtilities.equal(child.getNamespace(), namespace) || (!ObjectUtilities.equal(child.getType(), type) && (secondType == null || !ObjectUtilities.equal(child.getType(), secondType)))) { continue; } @@ -254,11 +253,7 @@ public class ImageElementLayoutController final FlowController controller = getFlowController(); final GlobalMasterRow masterRow = controller.getMasterRow(); final ReportDataRow reportDataRow = masterRow.getReportDataRow(); - if (reportDataRow.getCursor() == 0) - { - return true; - } - return false; + return reportDataRow.getCursor() == 0; } try @@ -277,12 +272,11 @@ public class ImageElementLayoutController { final Node[] columnDefs = columns.getNodeArray(); int columnCounter = 0; - for (int i = 0; i < columnDefs.length; i++) + for (Node columnDef : columnDefs) { - final Element column = (Element) columnDefs[i]; + final Element column = (Element) columnDef; - if (!ObjectUtilities.equal(column.getNamespace(), OfficeNamespaces.TABLE_NS) || - !ObjectUtilities.equal(column.getType(), OfficeToken.TABLE_COLUMN)) + if (!ObjectUtilities.equal(column.getNamespace(), OfficeNamespaces.TABLE_NS) || !ObjectUtilities.equal(column.getType(), OfficeToken.TABLE_COLUMN)) { continue; } @@ -306,12 +300,11 @@ public class ImageElementLayoutController { final Node[] rows = table.getNodeArray(); int rowCounter = 0; - for (int i = 0; i < rows.length; i++) + for (Node row1 : rows) { - final Element row = (Element) rows[i]; + final Element row = (Element) row1; - if (!ObjectUtilities.equal(row.getNamespace(), OfficeNamespaces.TABLE_NS) || - !ObjectUtilities.equal(row.getType(), OfficeToken.TABLE_ROW)) + if (!ObjectUtilities.equal(row.getNamespace(), OfficeNamespaces.TABLE_NS) || !ObjectUtilities.equal(row.getType(), OfficeToken.TABLE_ROW)) { continue; } 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 54f4fd0b1acb..b0de84bda31e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java @@ -75,7 +75,7 @@ public class ObjectOleLayoutController extends AbstractReportElementLayoutContro } catch (DataSourceException e) { - // ignore .. assume that the reference has not changed. + // ignore .. assume that the reference has not changed. } } return false; @@ -108,7 +108,7 @@ public class ObjectOleLayoutController extends AbstractReportElementLayoutContro } catch (DataSourceException e) { - // ignore .. assume that the reference has not changed. + // ignore .. assume that the reference has not changed. } } ole.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, SDBCReportDataFactory.MASTER_COLUMNS, masterfields); diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java index 9060ed64981d..9358e62a8590 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.layoutprocessor; import com.sun.star.report.pentaho.model.VariablesDeclarationSection; @@ -51,114 +49,113 @@ import org.jfree.report.flow.layoutprocessor.SectionLayoutController; */ public class OfficeDetailLayoutController extends SectionLayoutController { - public static final int STATE_PROCESS_VARIABLES = 2; - public static final int STATE_PROCESS_NORMAL_FLOW = 3; - - private boolean waitForJoin; - private int state; - public OfficeDetailLayoutController() - { - } + public static final int STATE_PROCESS_VARIABLES = 2; + public static final int STATE_PROCESS_NORMAL_FLOW = 3; + private boolean waitForJoin; + private int state; - /** - * Initializes the layout controller. This method is called exactly once. It - * is the creators responsibility to call this method. - *

- * Calling initialize after the first advance must result in a - * IllegalStateException. - * - * @param node the currently processed object or layout node. - * @param flowController the current flow controller. - * @param parent the parent layout controller that was responsible for - * instantiating this controller. - * @throws org.jfree.report.DataSourceException - * if there was a problem reading data from the datasource. - * @throws org.jfree.report.ReportProcessingException - * if there was a general problem during the report processing. - * @throws org.jfree.report.ReportDataFactoryException - * if a query failed. - */ - public void initialize(final Object node, - final FlowController flowController, - final LayoutController parent) - throws DataSourceException, ReportDataFactoryException, - ReportProcessingException - { - super.initialize(node, flowController, parent); - state = OfficeDetailLayoutController.STATE_PROCESS_VARIABLES; - } - - /** - * This method is called for each newly instantiated layout controller. The returned layout controller instance should - * have a processing state of either 'OPEN' or 'FINISHING' depending on whether there is any content or any child - * nodes to process. - * - * @param target the report target that receives generated events. - * @return the new layout controller instance representing the new state. - * @throws org.jfree.report.DataSourceException - * if there was a problem reading data from the datasource. - * @throws org.jfree.report.ReportProcessingException - * if there was a general problem during the report processing. - * @throws org.jfree.report.ReportDataFactoryException - * if a query failed. - */ - protected LayoutController startElement(final ReportTarget target) - throws DataSourceException, ReportProcessingException, ReportDataFactoryException - { - final FlowController fc = getFlowController(); - final GlobalMasterRow masterRow = fc.getMasterRow(); - final ReportDataRow reportDataRow = masterRow.getReportDataRow(); - final ReportData reportData = reportDataRow.getReportData(); - if (!reportData.isReadable()) + public OfficeDetailLayoutController() { - reportData.isReadable(); - // If this report has no data, then do not print the detail section. The detail section - // is the only section that behaves this way, and for now this is only done in the OO-implementation - final SectionLayoutController derived = (SectionLayoutController) clone(); - derived.setProcessingState(ElementLayoutController.FINISHED); - derived.setFlowController(fc); - return derived; } - if (state == OfficeDetailLayoutController.STATE_PROCESS_VARIABLES) + /** + * Initializes the layout controller. This method is called exactly once. It + * is the creators responsibility to call this method. + *

+ * Calling initialize after the first advance must result in a + * IllegalStateException. + * + * @param node the currently processed object or layout node. + * @param flowController the current flow controller. + * @param parent the parent layout controller that was responsible for + * instantiating this controller. + * @throws org.jfree.report.DataSourceException + * if there was a problem reading data from the datasource. + * @throws org.jfree.report.ReportProcessingException + * if there was a general problem during the report processing. + * @throws org.jfree.report.ReportDataFactoryException + * if a query failed. + */ + public void initialize(final Object node, + final FlowController flowController, + final LayoutController parent) + throws DataSourceException, ReportDataFactoryException, + ReportProcessingException { - final VariablesDeclarationSection variables = new VariablesDeclarationSection(); - final OfficeDetailLayoutController controller = (OfficeDetailLayoutController) clone(); - controller.state = OfficeDetailLayoutController.STATE_PROCESS_NORMAL_FLOW; - controller.waitForJoin = true; - return processChild(controller, variables, fc); + super.initialize(node, flowController, parent); + state = OfficeDetailLayoutController.STATE_PROCESS_VARIABLES; } - return super.startElement(target); - } + /** + * This method is called for each newly instantiated layout controller. The returned layout controller instance should + * have a processing state of either 'OPEN' or 'FINISHING' depending on whether there is any content or any child + * nodes to process. + * + * @param target the report target that receives generated events. + * @return the new layout controller instance representing the new state. + * @throws org.jfree.report.DataSourceException + * if there was a problem reading data from the datasource. + * @throws org.jfree.report.ReportProcessingException + * if there was a general problem during the report processing. + * @throws org.jfree.report.ReportDataFactoryException + * if a query failed. + */ + protected LayoutController startElement(final ReportTarget target) + throws DataSourceException, ReportProcessingException, ReportDataFactoryException + { + final FlowController fc = getFlowController(); + final GlobalMasterRow masterRow = fc.getMasterRow(); + final ReportDataRow reportDataRow = masterRow.getReportDataRow(); + final ReportData reportData = reportDataRow.getReportData(); + if (!reportData.isReadable()) + { + reportData.isReadable(); + // If this report has no data, then do not print the detail section. The detail section + // is the only section that behaves this way, and for now this is only done in the OO-implementation + final SectionLayoutController derived = (SectionLayoutController) clone(); + derived.setProcessingState(ElementLayoutController.FINISHED); + derived.setFlowController(fc); + return derived; + } - protected void resetSectionForRepeat() - { - super.resetSectionForRepeat(); - state = STATE_PROCESS_VARIABLES; - } + if (state == OfficeDetailLayoutController.STATE_PROCESS_VARIABLES) + { + final VariablesDeclarationSection variables = new VariablesDeclarationSection(); + final OfficeDetailLayoutController controller = (OfficeDetailLayoutController) clone(); + controller.state = OfficeDetailLayoutController.STATE_PROCESS_NORMAL_FLOW; + controller.waitForJoin = true; + return processChild(controller, variables, fc); + } - /** - * Joins with a delegated process flow. This is generally called from a child - * flow and should *not* (I mean it!) be called from outside. If you do, - * you'll suffer. - * - * @param flowController the flow controller of the parent. - * @return the joined layout controller that incorperates all changes from the - * delegate. - */ - public LayoutController join(final FlowController flowController) - { - if (waitForJoin) + return super.startElement(target); + } + + protected void resetSectionForRepeat() { - final OfficeDetailLayoutController derived = (OfficeDetailLayoutController) clone(); - derived.setProcessingState(ElementLayoutController.NOT_STARTED); - derived.setFlowController(flowController); - derived.waitForJoin = false; - return derived; + super.resetSectionForRepeat(); + state = STATE_PROCESS_VARIABLES; } - return super.join(flowController); - } + /** + * Joins with a delegated process flow. This is generally called from a child + * flow and should *not* (I mean it!) be called from outside. If you do, + * you'll suffer. + * + * @param flowController the flow controller of the parent. + * @return the joined layout controller that incorperates all changes from the + * delegate. + */ + public LayoutController join(final FlowController flowController) + { + if (waitForJoin) + { + final OfficeDetailLayoutController derived = (OfficeDetailLayoutController) clone(); + derived.setProcessingState(ElementLayoutController.NOT_STARTED); + derived.setFlowController(flowController); + derived.waitForJoin = false; + return derived; + } + return super.join(flowController); + } } 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 d61f03eb319e..047e46f2e07a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupInstanceSectionLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupInstanceSectionLayoutController.java @@ -26,135 +26,127 @@ import org.jfree.report.JFreeReportInfo; */ public class OfficeGroupInstanceSectionLayoutController extends SectionLayoutController { - public static final int STATE_PROCESS_VARIABLES = 2; - public static final int STATE_PROCESS_NORMAL_FLOW = 3; - private int state; - private boolean waitForJoin; - public OfficeGroupInstanceSectionLayoutController() - { - } + public static final int STATE_PROCESS_VARIABLES = 2; + public static final int STATE_PROCESS_NORMAL_FLOW = 3; + private int state; + private boolean waitForJoin; - public void initialize(final Object node, final FlowController flowController, final LayoutController parent) - throws DataSourceException, ReportDataFactoryException, ReportProcessingException - { - super.initialize(node, flowController, parent); - state = STATE_PROCESS_VARIABLES; - } - - protected LayoutController processContent(final ReportTarget target) - throws DataSourceException, ReportProcessingException, ReportDataFactoryException - { - if (state == OfficeGroupInstanceSectionLayoutController.STATE_PROCESS_VARIABLES) + public OfficeGroupInstanceSectionLayoutController() { - // todo: Fill the variables section with something sensible .. - final VariablesDeclarationSection variables = new VariablesDeclarationSection(); - final OfficeGroupInstanceSectionLayoutController controller = - (OfficeGroupInstanceSectionLayoutController) clone(); - controller.state = - OfficeGroupLayoutController.STATE_PROCESS_NORMAL_FLOW; - controller.waitForJoin = true; - return processChild(controller, variables, getFlowController()); } - return super.processContent(target); - } - // isDisplayable is private in version 0.9.1, so until the upgrade we keep this copy of the method - // todo: Delete it unce the sun-cvs contains version 0.9.2. - protected LayoutController processChild(final SectionLayoutController derived, - final Node node, - final FlowController flowController) - throws DataSourceException, ReportProcessingException, - ReportDataFactoryException - { - final ReportContext reportContext = flowController.getReportContext(); - final LayoutControllerFactory layoutControllerFactory = reportContext.getLayoutControllerFactory(); - if (isDisplayable(node)) + public void initialize(final Object node, final FlowController flowController, final LayoutController parent) + throws DataSourceException, ReportDataFactoryException, ReportProcessingException { - derived.setProcessingState(ElementLayoutController.WAITING_FOR_JOIN); - return layoutControllerFactory.create(flowController, node, derived); + super.initialize(node, flowController, parent); + state = STATE_PROCESS_VARIABLES; } - else + + protected LayoutController processContent(final ReportTarget target) + throws DataSourceException, ReportProcessingException, ReportDataFactoryException { - derived.setProcessingState(ElementLayoutController.WAITING_FOR_JOIN); - final LayoutController childLc = layoutControllerFactory.create(flowController, node, derived); - return LayoutControllerUtil.skipInvisibleElement(childLc); + if (state == OfficeGroupInstanceSectionLayoutController.STATE_PROCESS_VARIABLES) + { + // todo: Fill the variables section with something sensible .. + final VariablesDeclarationSection variables = new VariablesDeclarationSection(); + final OfficeGroupInstanceSectionLayoutController controller = + (OfficeGroupInstanceSectionLayoutController) clone(); + controller.state = + OfficeGroupLayoutController.STATE_PROCESS_NORMAL_FLOW; + controller.waitForJoin = true; + return processChild(controller, variables, getFlowController()); + } + return super.processContent(target); } - } - protected boolean isDisplayable(final Node node) throws DataSourceException - { - if (! (node instanceof OfficeGroupSection) ) + // isDisplayable is private in version 0.9.1, so until the upgrade we keep this copy of the method + // todo: Delete it unce the sun-cvs contains version 0.9.2. + protected LayoutController processChild(final SectionLayoutController derived, + final Node node, + final FlowController flowController) + throws DataSourceException, ReportProcessingException, + ReportDataFactoryException { - return _isDisplayable(node); + final ReportContext reportContext = flowController.getReportContext(); + final LayoutControllerFactory layoutControllerFactory = reportContext.getLayoutControllerFactory(); + if (isDisplayable(node)) + { + derived.setProcessingState(ElementLayoutController.WAITING_FOR_JOIN); + return layoutControllerFactory.create(flowController, node, derived); + } + else + { + derived.setProcessingState(ElementLayoutController.WAITING_FOR_JOIN); + final LayoutController childLc = layoutControllerFactory.create(flowController, node, derived); + return LayoutControllerUtil.skipInvisibleElement(childLc); + } } - final OfficeGroupSection section = (OfficeGroupSection) node; - if (section.isRepeatSection()) + protected boolean isDisplayable(final Node node) throws DataSourceException { - return false; + if (!(node instanceof OfficeGroupSection)) + { + return _isDisplayable(node); + } + + final OfficeGroupSection section = (OfficeGroupSection) node; + return !section.isRepeatSection() && _isDisplayable(node); } - return _isDisplayable(node); - } - protected boolean _isDisplayable(final Node node) - throws DataSourceException - { - // temp method until the pending upgrade to 0.9.2. Later we just call super.isDisplayable(..) instead. - if (!node.isEnabled()) + protected boolean _isDisplayable(final Node node) + throws DataSourceException { - return false; + // temp method until the pending upgrade to 0.9.2. Later we just call super.isDisplayable(..) instead. + if (!node.isEnabled()) + { + return false; + } + + final Expression expression = node.getDisplayCondition(); + if (expression == null) + { + return true; + } + + final Object result = LayoutControllerUtil.evaluateExpression(getFlowController(), node, expression); + return Boolean.TRUE.equals(result); } - final Expression expression = node.getDisplayCondition(); - if (expression == null) + protected void resetSectionForRepeat() { - return true; + super.resetSectionForRepeat(); + state = STATE_PROCESS_VARIABLES; } - final Object result = LayoutControllerUtil.evaluateExpression(getFlowController(), node, expression); - if (Boolean.TRUE.equals(result)) + /** + * Joins with a delegated process flow. This is generally called from a child + * flow and should *not* (I mean it!) be called from outside. If you do, + * you'll suffer. + * + * @param flowController the flow controller of the parent. + * @return the joined layout controller that incorperates all changes from the + * delegate. + */ + public LayoutController join(final FlowController flowController) { - return true; + if (waitForJoin) + { + final OfficeGroupInstanceSectionLayoutController derived = (OfficeGroupInstanceSectionLayoutController) clone(); + derived.setProcessingState(ElementLayoutController.OPENED); + derived.setFlowController(flowController); + derived.waitForJoin = false; + return derived; + } + return super.join(flowController); } - return false; - } - - protected void resetSectionForRepeat() - { - super.resetSectionForRepeat(); - state = STATE_PROCESS_VARIABLES; - } - /** - * Joins with a delegated process flow. This is generally called from a child - * flow and should *not* (I mean it!) be called from outside. If you do, - * you'll suffer. - * - * @param flowController the flow controller of the parent. - * @return the joined layout controller that incorperates all changes from the - * delegate. - */ - public LayoutController join(final FlowController flowController) - { - if (waitForJoin) + protected AttributeMap computeAttributes(final FlowController fc, final Element element, final ReportTarget target) + throws DataSourceException { - final OfficeGroupInstanceSectionLayoutController derived = (OfficeGroupInstanceSectionLayoutController) clone(); - derived.setProcessingState(ElementLayoutController.OPENED); - derived.setFlowController(flowController); - derived.waitForJoin = false; - return derived; + final AttributeMap map = new AttributeMap(super.computeAttributes(fc, element, target)); + map.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "iteration-count", getIterationCount()); + map.makeReadOnly(); + return map; } - return super.join(flowController); - } - - protected AttributeMap computeAttributes(final FlowController fc, final Element element, final ReportTarget target) - throws DataSourceException - { - final AttributeMap map = new AttributeMap( super.computeAttributes(fc, element, target) ); - 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 25e12d17edab..12604e931238 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.layoutprocessor; import com.sun.star.report.pentaho.model.OfficeGroup; @@ -52,158 +50,157 @@ import org.jfree.report.structure.Element; * @since 15.03.2007 */ public class OfficeGroupLayoutController extends SectionLayoutController - implements OfficeRepeatingStructureLayoutController + implements OfficeRepeatingStructureLayoutController { - public static final int STATE_PROCESS_REPEATING_HEADER = 0; - public static final int STATE_PROCESS_REPEATING_FOOTER = 1; - public static final int STATE_PROCESS_NORMAL_FLOW = 3; - private boolean waitForJoin; - private int state; - private VariablesCollection variablesCollection; - private boolean repeatHeader; - private boolean repeatFooter; - - public OfficeGroupLayoutController() - { - } - - - /** - * Initializes the layout controller. This method is called exactly once. It - * is the creators responsibility to call this method. - *

- * Calling initialize after the first advance must result in a - * IllegalStateException. - * - * @param node the currently processed object or layout node. - * @param flowController the current flow controller. - * @param parent the parent layout controller that was responsible for - * instantiating this controller. - * @throws org.jfree.report.DataSourceException - * if there was a problem reading data from the datasource. - * @throws org.jfree.report.ReportProcessingException - * if there was a general problem during the report processing. - * @throws org.jfree.report.ReportDataFactoryException - * if a query failed. - */ - public void initialize(final Object node, - final FlowController flowController, - final LayoutController parent) - throws DataSourceException, ReportDataFactoryException, - ReportProcessingException - { - super.initialize(node, flowController, parent); - state = OfficeGroupLayoutController.STATE_PROCESS_REPEATING_HEADER; - variablesCollection = new VariablesCollection(computeVariablesPrefix()); - - - final OfficeGroup group = (OfficeGroup) getElement(); - final OfficeGroupSection header = group.getHeader(); - repeatHeader = (header != null && header.isRepeatSection()); - - final OfficeGroupSection footer = group.getFooter(); - repeatFooter = (footer != null && footer.isRepeatSection()); - } - - - protected LayoutController processContent(final ReportTarget target) - throws DataSourceException, ReportProcessingException, - ReportDataFactoryException - { - if (state == OfficeGroupLayoutController.STATE_PROCESS_REPEATING_HEADER) + + public static final int STATE_PROCESS_REPEATING_HEADER = 0; + public static final int STATE_PROCESS_REPEATING_FOOTER = 1; + public static final int STATE_PROCESS_NORMAL_FLOW = 3; + private boolean waitForJoin; + private int state; + private VariablesCollection variablesCollection; + private boolean repeatHeader; + private boolean repeatFooter; + + public OfficeGroupLayoutController() + { + } + + /** + * Initializes the layout controller. This method is called exactly once. It + * is the creators responsibility to call this method. + *

+ * Calling initialize after the first advance must result in a + * IllegalStateException. + * + * @param node the currently processed object or layout node. + * @param flowController the current flow controller. + * @param parent the parent layout controller that was responsible for + * instantiating this controller. + * @throws org.jfree.report.DataSourceException + * if there was a problem reading data from the datasource. + * @throws org.jfree.report.ReportProcessingException + * if there was a general problem during the report processing. + * @throws org.jfree.report.ReportDataFactoryException + * if a query failed. + */ + public void initialize(final Object node, + final FlowController flowController, + final LayoutController parent) + throws DataSourceException, ReportDataFactoryException, + ReportProcessingException { + super.initialize(node, flowController, parent); + state = OfficeGroupLayoutController.STATE_PROCESS_REPEATING_HEADER; + variablesCollection = new VariablesCollection(computeVariablesPrefix()); - final OfficeGroupLayoutController controller = - (OfficeGroupLayoutController) clone(); - controller.state = - OfficeGroupLayoutController.STATE_PROCESS_REPEATING_FOOTER; - if (!repeatHeader) - { - return controller; - } + final OfficeGroup group = (OfficeGroup) getElement(); + final OfficeGroupSection header = group.getHeader(); + repeatHeader = (header != null && header.isRepeatSection()); - final OfficeGroup group = (OfficeGroup) getElement(); - final OfficeGroupSection header = group.getHeader(); - controller.waitForJoin = true; - return processChild(controller, header, getFlowController()); + final OfficeGroupSection footer = group.getFooter(); + repeatFooter = (footer != null && footer.isRepeatSection()); } - if (state == OfficeGroupLayoutController.STATE_PROCESS_REPEATING_FOOTER) + protected LayoutController processContent(final ReportTarget target) + throws DataSourceException, ReportProcessingException, + ReportDataFactoryException { + if (state == OfficeGroupLayoutController.STATE_PROCESS_REPEATING_HEADER) + { + + final OfficeGroupLayoutController controller = + (OfficeGroupLayoutController) clone(); + controller.state = + OfficeGroupLayoutController.STATE_PROCESS_REPEATING_FOOTER; + + if (!repeatHeader) + { + return controller; + } + + final OfficeGroup group = (OfficeGroup) getElement(); + final OfficeGroupSection header = group.getHeader(); + controller.waitForJoin = true; + return processChild(controller, header, getFlowController()); + } + + if (state == OfficeGroupLayoutController.STATE_PROCESS_REPEATING_FOOTER) + { + + final OfficeGroupLayoutController controller = + (OfficeGroupLayoutController) clone(); + controller.state = OfficeGroupLayoutController.STATE_PROCESS_NORMAL_FLOW; + + if (!repeatFooter) + { + return controller; + } + + final OfficeGroup group = (OfficeGroup) getElement(); + final OfficeGroupSection footer = group.getFooter(); + controller.waitForJoin = true; + return processChild(controller, footer, getFlowController()); + } + + return super.processContent(target); + } - final OfficeGroupLayoutController controller = - (OfficeGroupLayoutController) clone(); - controller.state = OfficeGroupLayoutController.STATE_PROCESS_NORMAL_FLOW; + /** + * Joins with a delegated process flow. This is generally called from a child + * flow and should *not* (I mean it!) be called from outside. If you do, + * you'll suffer. + * + * @param flowController the flow controller of the parent. + * @return the joined layout controller that incorperates all changes from the + * delegate. + */ + public LayoutController join(final FlowController flowController) + { + if (waitForJoin) + { + final OfficeGroupLayoutController derived = (OfficeGroupLayoutController) clone(); + derived.setProcessingState(ElementLayoutController.OPENED); + derived.setFlowController(flowController); + derived.waitForJoin = false; + return derived; + } + return super.join(flowController); + } - if (!repeatFooter) - { - return controller; - } + public boolean isNormalFlowProcessing() + { + return state == OfficeGroupLayoutController.STATE_PROCESS_NORMAL_FLOW; + } - final OfficeGroup group = (OfficeGroup) getElement(); - final OfficeGroupSection footer = group.getFooter(); - controller.waitForJoin = true; - return processChild(controller, footer, getFlowController()); + private String computeVariablesPrefix() + { + int count = 0; + LayoutController lc = this; + while (lc != null) + { + if (lc instanceof OfficeGroupLayoutController) + { + count++; + } + lc = lc.getParent(); + } + return "auto_group_" + count + "_"; } - return super.processContent(target); - } - - /** - * Joins with a delegated process flow. This is generally called from a child - * flow and should *not* (I mean it!) be called from outside. If you do, - * you'll suffer. - * - * @param flowController the flow controller of the parent. - * @return the joined layout controller that incorperates all changes from the - * delegate. - */ - public LayoutController join(final FlowController flowController) - { - if (waitForJoin) + public VariablesCollection getVariablesCollection() { - final OfficeGroupLayoutController derived = (OfficeGroupLayoutController) clone(); - derived.setProcessingState(ElementLayoutController.OPENED); - derived.setFlowController(flowController); - derived.waitForJoin = false; - return derived; + return variablesCollection; } - return super.join(flowController); - } - - public boolean isNormalFlowProcessing () - { - return state == OfficeGroupLayoutController.STATE_PROCESS_NORMAL_FLOW; - } - - private String computeVariablesPrefix() - { - int count = 0; - LayoutController lc = this; - while (lc != null) + + protected AttributeMap computeAttributes(final FlowController fc, final Element element, final ReportTarget target) + throws DataSourceException { - if (lc instanceof OfficeGroupLayoutController) - { - count++; - } - lc = lc.getParent(); + final AttributeMap map = new AttributeMap(super.computeAttributes(fc, element, target)); + final String value = String.valueOf(repeatHeader || repeatFooter); + map.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeating-header-or-footer", value); + map.makeReadOnly(); + return map; } - return "auto_group_" + count + "_"; - } - - public VariablesCollection getVariablesCollection() - { - return variablesCollection; - } - - protected AttributeMap computeAttributes(final FlowController fc, final Element element, final ReportTarget target) - throws DataSourceException - { - final AttributeMap map = new AttributeMap( super.computeAttributes(fc, element, target) ); - final String value = String.valueOf(repeatHeader || repeatFooter); - map.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeating-header-or-footer", value); - map.makeReadOnly(); - return map; - } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java index 496ccd841e46..4eb40749e3fe 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.layoutprocessor; import org.jfree.report.flow.layoutprocessor.SectionLayoutController; @@ -58,58 +56,56 @@ import org.jfree.report.JFreeReportInfo; public class OfficeGroupSectionLayoutController extends SectionLayoutController { - public OfficeGroupSectionLayoutController() - { - } - - protected LayoutController startElement(final ReportTarget target) - throws DataSourceException, ReportProcessingException, ReportDataFactoryException - { - final OfficeGroupSection section = (OfficeGroupSection) getElement(); - if (!section.isRepeatSection()) + public OfficeGroupSectionLayoutController() { - return super.startElement(target); } - final LayoutController controller = getParent(); - if (!(controller instanceof OfficeGroupLayoutController)) + protected LayoutController startElement(final ReportTarget target) + throws DataSourceException, ReportProcessingException, ReportDataFactoryException { - return super.startElement(target); - } - final OfficeGroupLayoutController oglc = (OfficeGroupLayoutController) controller; - if (!oglc.isNormalFlowProcessing()) - { - return super.startElement(target); - } + final OfficeGroupSection section = (OfficeGroupSection) getElement(); + if (!section.isRepeatSection()) + { + return super.startElement(target); + } - // Skip the processing if the section is a repeating header or footer and we are processing the normal flow .. - final ElementLayoutController clone = (ElementLayoutController) this.clone(); - clone.setProcessingState(ElementLayoutController.FINISHED); - return clone; - } + final LayoutController controller = getParent(); + if (!(controller instanceof OfficeGroupLayoutController)) + { + return super.startElement(target); + } + final OfficeGroupLayoutController oglc = (OfficeGroupLayoutController) controller; + if (!oglc.isNormalFlowProcessing()) + { + return super.startElement(target); + } - protected AttributeMap computeAttributes(final FlowController fc, - final Element element, - final ReportTarget target) - throws DataSourceException - { - final AttributeMap attrs = super.computeAttributes(fc, element, target); - final LayoutController controller = getParent(); - if (!(controller instanceof OfficeGroupLayoutController)) - { - return attrs; - } - final OfficeGroupLayoutController oglc = (OfficeGroupLayoutController) controller; - if (oglc.isNormalFlowProcessing()) - { - return attrs; + // Skip the processing if the section is a repeating header or footer and we are processing the normal flow .. + final ElementLayoutController clone = (ElementLayoutController) this.clone(); + clone.setProcessingState(ElementLayoutController.FINISHED); + return clone; } - final AttributeMap retval = new AttributeMap(attrs); - retval.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeated-section", OfficeToken.TRUE); - retval.makeReadOnly(); - return retval; - } - + protected AttributeMap computeAttributes(final FlowController fc, + final Element element, + final ReportTarget target) + throws DataSourceException + { + final AttributeMap attrs = super.computeAttributes(fc, element, target); + final LayoutController controller = getParent(); + if (!(controller instanceof OfficeGroupLayoutController)) + { + return attrs; + } + final OfficeGroupLayoutController oglc = (OfficeGroupLayoutController) controller; + if (oglc.isNormalFlowProcessing()) + { + return attrs; + } + final AttributeMap retval = new AttributeMap(attrs); + retval.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeated-section", OfficeToken.TRUE); + retval.makeReadOnly(); + return retval; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficePageSectionLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficePageSectionLayoutController.java index 9189cb06f9a5..b98db5f34479 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficePageSectionLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficePageSectionLayoutController.java @@ -15,15 +15,16 @@ import org.jfree.report.JFreeReportInfo; */ public class OfficePageSectionLayoutController extends SectionLayoutController { - public OfficePageSectionLayoutController() - { - } - protected AttributeMap computeAttributes(final FlowController flowController, final Element element, final ReportTarget reportTarget) throws DataSourceException - { - final AttributeMap map = new AttributeMap( super.computeAttributes(flowController, element, reportTarget)); - map.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "role", "spreadsheet-section"); - map.makeReadOnly(); - return map; - } + public OfficePageSectionLayoutController() + { + } + + protected AttributeMap computeAttributes(final FlowController flowController, final Element element, final ReportTarget reportTarget) throws DataSourceException + { + final AttributeMap map = new AttributeMap(super.computeAttributes(flowController, element, reportTarget)); + map.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "role", "spreadsheet-section"); + map.makeReadOnly(); + return map; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeRepeatingStructureLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeRepeatingStructureLayoutController.java index 47a1daa1b7fa..1ccf6b634bcf 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeRepeatingStructureLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeRepeatingStructureLayoutController.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.layoutprocessor; import org.jfree.report.flow.layoutprocessor.LayoutController; @@ -41,8 +39,8 @@ import org.jfree.report.flow.layoutprocessor.LayoutController; */ public interface OfficeRepeatingStructureLayoutController extends LayoutController { - public boolean isNormalFlowProcessing(); - public VariablesCollection getVariablesCollection(); + public boolean isNormalFlowProcessing(); + public VariablesCollection getVariablesCollection(); } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java index 20816814e11c..5baffc4c346b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.layoutprocessor; import com.sun.star.report.pentaho.model.OfficeReport; @@ -51,227 +49,224 @@ import org.jfree.report.structure.Node; * @since 06.03.2007 */ public class OfficeReportLayoutController extends ElementLayoutController - implements OfficeRepeatingStructureLayoutController + implements OfficeRepeatingStructureLayoutController { - private static final int STATE_NOT_STARTED = 0; - private static final int STATE_TEMPLATES = 1; - private static final int STATE_PAGE_HEADER_DONE = 2; - private static final int STATE_PAGE_FOOTER_DONE = 3; - private static final int STATE_SPREADSHEET_PAGE_HEADER_DONE = 4; - private static final int STATE_SPREADSHEET_PAGE_FOOTER_DONE = 5; - private static final int STATE_COLUMN_HEADER_DONE = 6; - private static final int STATE_COLUMN_FOOTER_DONE = 7; - private static final int STATE_INITIAL_VARIABLES_DONE = 8; - private static final int STATE_REPORT_HEADER_DONE = 9; - private static final int STATE_REPORT_BODY_DONE = 10; - private static final int STATE_REPORT_FOOTER_VARIABLES = 11; - private static final int STATE_REPORT_FOOTER_DONE = 12; - private int state; - private VariablesCollection variablesCollection; + private static final int STATE_NOT_STARTED = 0; + private static final int STATE_TEMPLATES = 1; + private static final int STATE_PAGE_HEADER_DONE = 2; + private static final int STATE_PAGE_FOOTER_DONE = 3; + private static final int STATE_SPREADSHEET_PAGE_HEADER_DONE = 4; + private static final int STATE_SPREADSHEET_PAGE_FOOTER_DONE = 5; + private static final int STATE_COLUMN_HEADER_DONE = 6; + private static final int STATE_COLUMN_FOOTER_DONE = 7; + private static final int STATE_INITIAL_VARIABLES_DONE = 8; + private static final int STATE_REPORT_HEADER_DONE = 9; + private static final int STATE_REPORT_BODY_DONE = 10; + private static final int STATE_REPORT_FOOTER_VARIABLES = 11; + private static final int STATE_REPORT_FOOTER_DONE = 12; + private int state; + private VariablesCollection variablesCollection; - public OfficeReportLayoutController() - { - } + public OfficeReportLayoutController() + { + } + /** + * Initializes the layout controller. This method is called exactly once. It + * is the creators responsibility to call this method. + *

+ * Calling initialize after the first advance must result in a + * IllegalStateException. + * + * @param node the currently processed object or layout node. + * @param flowController the current flow controller. + * @param parent the parent layout controller that was responsible for + * instantiating this controller. + * @throws org.jfree.report.DataSourceException + * if there was a problem reading data from the datasource. + * @throws org.jfree.report.ReportProcessingException + * if there was a general problem during the report processing. + * @throws org.jfree.report.ReportDataFactoryException + * if a query failed. + */ + public void initialize(final Object node, final FlowController flowController, + final LayoutController parent) + throws DataSourceException, ReportDataFactoryException, + ReportProcessingException + { + super.initialize(node, flowController, parent); + variablesCollection = new VariablesCollection("auto_report_"); + } - /** - * Initializes the layout controller. This method is called exactly once. It - * is the creators responsibility to call this method. - *

- * Calling initialize after the first advance must result in a - * IllegalStateException. - * - * @param node the currently processed object or layout node. - * @param flowController the current flow controller. - * @param parent the parent layout controller that was responsible for - * instantiating this controller. - * @throws org.jfree.report.DataSourceException - * if there was a problem reading data from the datasource. - * @throws org.jfree.report.ReportProcessingException - * if there was a general problem during the report processing. - * @throws org.jfree.report.ReportDataFactoryException - * if a query failed. - */ - public void initialize(final Object node, final FlowController flowController, - final LayoutController parent) - throws DataSourceException, ReportDataFactoryException, - ReportProcessingException - { - super.initialize(node, flowController, parent); - variablesCollection = new VariablesCollection("auto_report_"); - } + /** + * Processes any content in this element. This method is called when the + * processing state is 'OPENED'. The returned layout controller will retain + * the 'OPENED' state as long as there is more content available. Once all + * content has been processed, the returned layout controller should carry a + * 'FINISHED' state. + * + * @param target the report target that receives generated events. + * @return the new layout controller instance representing the new state. + * + * @throws org.jfree.report.DataSourceException + * if there was a problem reading data from the datasource. + * @throws org.jfree.report.ReportProcessingException + * if there was a general problem during the report processing. + * @throws org.jfree.report.ReportDataFactoryException + * if a query failed. + */ + protected LayoutController processContent(final ReportTarget target) + throws DataSourceException, ReportProcessingException, + ReportDataFactoryException + { + final OfficeReport or = (OfficeReport) getElement(); - /** - * Processes any content in this element. This method is called when the - * processing state is 'OPENED'. The returned layout controller will retain - * the 'OPENED' state as long as there is more content available. Once all - * content has been processed, the returned layout controller should carry a - * 'FINISHED' state. - * - * @param target the report target that receives generated events. - * @return the new layout controller instance representing the new state. - * - * @throws org.jfree.report.DataSourceException - * if there was a problem reading data from the datasource. - * @throws org.jfree.report.ReportProcessingException - * if there was a general problem during the report processing. - * @throws org.jfree.report.ReportDataFactoryException - * if a query failed. - */ - protected LayoutController processContent(final ReportTarget target) - throws DataSourceException, ReportProcessingException, - ReportDataFactoryException - { - final OfficeReport or = (OfficeReport) getElement(); + switch (state) + { + case OfficeReportLayoutController.STATE_NOT_STARTED: + { + return delegateToTemplates(OfficeReportLayoutController.STATE_TEMPLATES); + } + case OfficeReportLayoutController.STATE_TEMPLATES: + { + return delegateSection(or.getPageHeader(), + OfficeReportLayoutController.STATE_PAGE_HEADER_DONE); + } + case OfficeReportLayoutController.STATE_PAGE_HEADER_DONE: + { + return delegateSpreadsheetSection(or.getPageHeader(), + OfficeReportLayoutController.STATE_SPREADSHEET_PAGE_HEADER_DONE); + } + case OfficeReportLayoutController.STATE_SPREADSHEET_PAGE_HEADER_DONE: + { + return delegateSection(or.getPageFooter(), + OfficeReportLayoutController.STATE_PAGE_FOOTER_DONE); + } + case OfficeReportLayoutController.STATE_PAGE_FOOTER_DONE: + { + return delegateSection(or.getColumnHeader(), + OfficeReportLayoutController.STATE_COLUMN_HEADER_DONE); + } + case OfficeReportLayoutController.STATE_COLUMN_HEADER_DONE: + { + return delegateSection(or.getColumnFooter(), + OfficeReportLayoutController.STATE_COLUMN_FOOTER_DONE); + } + case OfficeReportLayoutController.STATE_COLUMN_FOOTER_DONE: + { + return delegateSection(new VariablesDeclarationSection(), + OfficeReportLayoutController.STATE_INITIAL_VARIABLES_DONE); + } + case OfficeReportLayoutController.STATE_INITIAL_VARIABLES_DONE: + { + return delegateSection(or.getReportHeader(), + OfficeReportLayoutController.STATE_REPORT_HEADER_DONE); + } + case OfficeReportLayoutController.STATE_REPORT_HEADER_DONE: + { + return delegateSection(or.getBodySection(), + OfficeReportLayoutController.STATE_REPORT_BODY_DONE); + } + case OfficeReportLayoutController.STATE_REPORT_BODY_DONE: + { + return delegateSection(new VariablesDeclarationSection(), + OfficeReportLayoutController.STATE_REPORT_FOOTER_VARIABLES); + } + case OfficeReportLayoutController.STATE_REPORT_FOOTER_VARIABLES: + { + return delegateSection(or.getReportFooter(), + OfficeReportLayoutController.STATE_REPORT_FOOTER_DONE); + } + case OfficeReportLayoutController.STATE_REPORT_FOOTER_DONE: + { + return delegateSpreadsheetSection(or.getPageFooter(), + OfficeReportLayoutController.STATE_SPREADSHEET_PAGE_FOOTER_DONE); + } + case OfficeReportLayoutController.STATE_SPREADSHEET_PAGE_FOOTER_DONE: + { + final OfficeReportLayoutController olc = (OfficeReportLayoutController) clone(); + olc.setProcessingState(ElementLayoutController.FINISHING); + return olc; + } + default: + { + throw new IllegalStateException("Invalid processing state encountered."); + } + } + } - switch (state) + private LayoutController delegateSpreadsheetSection(final Node node, final int nextState) + throws DataSourceException, ReportProcessingException, ReportDataFactoryException { - case OfficeReportLayoutController.STATE_NOT_STARTED: - { - return delegateToTemplates(OfficeReportLayoutController.STATE_TEMPLATES); - } - case OfficeReportLayoutController.STATE_TEMPLATES: - { - return delegateSection(or.getPageHeader(), - OfficeReportLayoutController.STATE_PAGE_HEADER_DONE); - } - case OfficeReportLayoutController.STATE_PAGE_HEADER_DONE: - { - return delegateSpreadsheetSection(or.getPageHeader(), - OfficeReportLayoutController.STATE_SPREADSHEET_PAGE_HEADER_DONE); - } - case OfficeReportLayoutController.STATE_SPREADSHEET_PAGE_HEADER_DONE: - { - return delegateSection(or.getPageFooter(), - OfficeReportLayoutController.STATE_PAGE_FOOTER_DONE); - } - case OfficeReportLayoutController.STATE_PAGE_FOOTER_DONE: - { - return delegateSection(or.getColumnHeader(), - OfficeReportLayoutController.STATE_COLUMN_HEADER_DONE); - } - case OfficeReportLayoutController.STATE_COLUMN_HEADER_DONE: - { - return delegateSection(or.getColumnFooter(), - OfficeReportLayoutController.STATE_COLUMN_FOOTER_DONE); - } - case OfficeReportLayoutController.STATE_COLUMN_FOOTER_DONE: - { - return delegateSection(new VariablesDeclarationSection(), - OfficeReportLayoutController.STATE_INITIAL_VARIABLES_DONE); - } - case OfficeReportLayoutController.STATE_INITIAL_VARIABLES_DONE: - { - return delegateSection(or.getReportHeader(), - OfficeReportLayoutController.STATE_REPORT_HEADER_DONE); - } - case OfficeReportLayoutController.STATE_REPORT_HEADER_DONE: - { - return delegateSection(or.getBodySection(), - OfficeReportLayoutController.STATE_REPORT_BODY_DONE); - } - case OfficeReportLayoutController.STATE_REPORT_BODY_DONE: - { - return delegateSection(new VariablesDeclarationSection(), - OfficeReportLayoutController.STATE_REPORT_FOOTER_VARIABLES); - } - case OfficeReportLayoutController.STATE_REPORT_FOOTER_VARIABLES: - { - return delegateSection(or.getReportFooter(), - OfficeReportLayoutController.STATE_REPORT_FOOTER_DONE); - } - case OfficeReportLayoutController.STATE_REPORT_FOOTER_DONE: - { - return delegateSpreadsheetSection(or.getPageFooter(), - OfficeReportLayoutController.STATE_SPREADSHEET_PAGE_FOOTER_DONE); - } - case OfficeReportLayoutController.STATE_SPREADSHEET_PAGE_FOOTER_DONE: - { final OfficeReportLayoutController olc = (OfficeReportLayoutController) clone(); - olc.setProcessingState(ElementLayoutController.FINISHING); - return olc; - } - default: - { - throw new IllegalStateException("Invalid processing state encountered."); - } - } - } + olc.state = nextState; - private LayoutController delegateSpreadsheetSection(final Node node, final int nextState) - throws DataSourceException, ReportProcessingException, ReportDataFactoryException - { - final OfficeReportLayoutController olc = (OfficeReportLayoutController) clone(); - olc.state = nextState; + if (node == null) + { + return olc; + } - if (node == null) - { - return olc; + final OfficePageSectionLayoutController templateLc = new OfficePageSectionLayoutController(); + templateLc.initialize(node, getFlowController(), olc); + return templateLc; } - final OfficePageSectionLayoutController templateLc = new OfficePageSectionLayoutController(); - templateLc.initialize(node, getFlowController(), olc); - return templateLc; - } - - private LayoutController delegateToTemplates(final int nextState) - throws ReportProcessingException, ReportDataFactoryException, - DataSourceException - { - final OfficeReportLayoutController olc = (OfficeReportLayoutController) clone(); - olc.state = nextState; - - final OfficeTableTemplateLayoutController templateLc = new OfficeTableTemplateLayoutController(); - templateLc.initialize(getElement(), getFlowController(), olc); - return templateLc; + private LayoutController delegateToTemplates(final int nextState) + throws ReportProcessingException, ReportDataFactoryException, + DataSourceException + { + final OfficeReportLayoutController olc = (OfficeReportLayoutController) clone(); + olc.state = nextState; - } + final OfficeTableTemplateLayoutController templateLc = new OfficeTableTemplateLayoutController(); + templateLc.initialize(getElement(), getFlowController(), olc); + return templateLc; - private LayoutController delegateSection(final Node n, final int nextState) - throws ReportProcessingException, ReportDataFactoryException, - DataSourceException - { - final OfficeReportLayoutController olc = (OfficeReportLayoutController) clone(); - olc.state = nextState; - if (n == null) - { - return olc; } - final FlowController flowController = getFlowController(); - final ReportContext reportContext = flowController.getReportContext(); - final LayoutControllerFactory layoutControllerFactory = - reportContext.getLayoutControllerFactory(); - return layoutControllerFactory.create(flowController, n, olc); + private LayoutController delegateSection(final Node n, final int nextState) + throws ReportProcessingException, ReportDataFactoryException, + DataSourceException + { + final OfficeReportLayoutController olc = (OfficeReportLayoutController) clone(); + olc.state = nextState; + if (n == null) + { + return olc; + } - } + final FlowController flowController = getFlowController(); + final ReportContext reportContext = flowController.getReportContext(); + final LayoutControllerFactory layoutControllerFactory = + reportContext.getLayoutControllerFactory(); + return layoutControllerFactory.create(flowController, n, olc); + } - /** - * Joins with a delegated process flow. This is generally called from a child - * flow and should *not* (I mean it!) be called from outside. If you do, - * you'll suffer. - * - * @param flowController the flow controller of the parent. - * @return the joined layout controller that incorperates all changes from the - * delegate. - */ - public LayoutController join(final FlowController flowController) - { - final OfficeReportLayoutController derived = (OfficeReportLayoutController) clone(); - derived.setFlowController(flowController); - return derived; - } + /** + * Joins with a delegated process flow. This is generally called from a child + * flow and should *not* (I mean it!) be called from outside. If you do, + * you'll suffer. + * + * @param flowController the flow controller of the parent. + * @return the joined layout controller that incorperates all changes from the + * delegate. + */ + public LayoutController join(final FlowController flowController) + { + final OfficeReportLayoutController derived = (OfficeReportLayoutController) clone(); + derived.setFlowController(flowController); + return derived; + } - public boolean isNormalFlowProcessing() - { - return state != OfficeReportLayoutController.STATE_PAGE_HEADER_DONE && - state != OfficeReportLayoutController.STATE_PAGE_FOOTER_DONE; - } + public boolean isNormalFlowProcessing() + { + return state != OfficeReportLayoutController.STATE_PAGE_HEADER_DONE && state != OfficeReportLayoutController.STATE_PAGE_FOOTER_DONE; + } - public VariablesCollection getVariablesCollection() - { - return variablesCollection; - } + public VariablesCollection getVariablesCollection() + { + return variablesCollection; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java index d83ebb63957d..f8c9a1111a8d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java @@ -57,7 +57,7 @@ public class OfficeTableLayoutController extends SectionLayoutController protected AttributeMap computeAttributes(final FlowController fc, final Element element, final ReportTarget target) throws DataSourceException { - final AttributeMap attributeMap = new AttributeMap( super.computeAttributes(fc, element, target) ); + final AttributeMap attributeMap = new AttributeMap(super.computeAttributes(fc, element, target)); final Section s = (Section) element; int rowCount = 0; final Node[] nodeArray = s.getNodeArray(); @@ -67,8 +67,7 @@ public class OfficeTableLayoutController extends SectionLayoutController if (node instanceof Element) { final Element child = (Element) node; - if (OfficeNamespaces.TABLE_NS.equals(child.getNamespace()) && - OfficeToken.TABLE_ROW.equals(child.getType())) + if (OfficeNamespaces.TABLE_NS.equals(child.getNamespace()) && OfficeToken.TABLE_ROW.equals(child.getType())) { rowCount += 1; } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java index f3a7f776db5c..738ccb4f07f4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java @@ -175,8 +175,7 @@ public class OfficeTableTemplateLayoutController extends SectionLayoutController if (node instanceof Element) { final Element element = (Element) node; - if (OfficeNamespaces.TABLE_NS.equals(element.getNamespace()) && - "table".equals(element.getType())) + if (OfficeNamespaces.TABLE_NS.equals(element.getNamespace()) && "table".equals(element.getType())) { tables.add(element); } 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 44117380e176..27d3f47c9fc0 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java @@ -78,12 +78,12 @@ public class TableCellLayoutController extends SectionLayoutController final DataFlags value = computeValue(); if (value != null) { - FormatValueUtility.applyValueForCell(value.getValue(), attributeMap,valueType); + FormatValueUtility.applyValueForCell(value.getValue(), attributeMap, valueType); } } catch (Exception e) { - // ignore .. + // ignore .. } attributeMap.makeReadOnly(); return attributeMap; @@ -152,7 +152,7 @@ public class TableCellLayoutController extends SectionLayoutController } catch (DataSourceException e) { - // ignore silently .. + // ignore silently .. } } @@ -172,7 +172,7 @@ public class TableCellLayoutController extends SectionLayoutController } catch (DataSourceException e) { - // ignore silently .. + // ignore silently .. } } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java index ee9bfd442bca..ca8687541545 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.layoutprocessor; import java.util.ArrayList; @@ -50,54 +48,52 @@ import java.util.List; */ public class VariablesCollection { - private VariablesCollection parent; - private String namePrefix; - private List variables; - public VariablesCollection(final String namePrefix) - { - this(namePrefix, null); - } + private VariablesCollection parent; + private String namePrefix; + private List variables; - public VariablesCollection(final String namePrefix, final VariablesCollection parent) - { - if (namePrefix == null) + public VariablesCollection(final String namePrefix) { - throw new NullPointerException("NamePrefix cannot be null"); + this(namePrefix, null); } - this.namePrefix = namePrefix; - this.parent = parent; - this.variables = new ArrayList(); - } - - public VariablesCollection getParent() - { - return parent; - } + public VariablesCollection(final String namePrefix, final VariablesCollection parent) + { + if (namePrefix == null) + { + throw new NullPointerException("NamePrefix cannot be null"); + } - public String getNamePrefix() - { - return namePrefix; - } + this.namePrefix = namePrefix; + this.parent = parent; + this.variables = new ArrayList(); + } - public String addVariable (final FormattedTextElement element) - { - variables.add(element); - final int size = variables.size(); - return namePrefix + size; - } + public VariablesCollection getParent() + { + return parent; + } - public FormattedTextElement[] getVariables () - { - return (FormattedTextElement[]) - variables.toArray(new FormattedTextElement[variables.size()]); - } + public String getNamePrefix() + { + return namePrefix; + } - public int getVariablesCount () - { - return variables.size(); - } + public String addVariable(final FormattedTextElement element) + { + variables.add(element); + final int size = variables.size(); + return namePrefix + size; + } + public FormattedTextElement[] getVariables() + { + return (FormattedTextElement[]) variables.toArray(new FormattedTextElement[variables.size()]); + } + public int getVariablesCount() + { + return variables.size(); + } } 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 55f4f2999aab..e59a699109f4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.layoutprocessor; import com.sun.star.report.pentaho.OfficeNamespaces; @@ -56,137 +54,139 @@ import java.text.SimpleDateFormat; * @since 20.03.2007 */ public class VariablesDeclarationLayoutController - extends AbstractLayoutController + extends AbstractLayoutController { - private boolean processed; - public VariablesDeclarationLayoutController() - { - } + private boolean processed; - private OfficeRepeatingStructureLayoutController getRepeatingParent() - { - LayoutController parent = getParent(); - while (parent != null) + public VariablesDeclarationLayoutController() { - if (parent instanceof OfficeRepeatingStructureLayoutController) - { - return (OfficeRepeatingStructureLayoutController) parent; - } - parent = parent.getParent(); } - return null; - } - - /** - * Advances the processing position. - * - * @param target the report target that receives generated events. - * @return the new layout controller instance representing the new state. - * - * @throws org.jfree.report.DataSourceException - * if there was a problem reading data from the datasource. - * @throws org.jfree.report.ReportProcessingException - * if there was a general problem during the report processing. - * @throws org.jfree.report.ReportDataFactoryException - * if a query failed. - */ - public LayoutController advance(final ReportTarget target) - throws DataSourceException, ReportDataFactoryException, - ReportProcessingException - { - if (processed) + + private OfficeRepeatingStructureLayoutController getRepeatingParent() { - throw new IllegalStateException("Already processed."); + LayoutController parent = getParent(); + while (parent != null) + { + if (parent instanceof OfficeRepeatingStructureLayoutController) + { + return (OfficeRepeatingStructureLayoutController) parent; + } + parent = parent.getParent(); + } + return null; } - final VariablesDeclarationLayoutController vlc = - (VariablesDeclarationLayoutController) clone(); - vlc.processed = true; - - final OfficeRepeatingStructureLayoutController orslc = getRepeatingParent(); - if (orslc == null) + /** + * Advances the processing position. + * + * @param target the report target that receives generated events. + * @return the new layout controller instance representing the new state. + * + * @throws org.jfree.report.DataSourceException + * if there was a problem reading data from the datasource. + * @throws org.jfree.report.ReportProcessingException + * if there was a general problem during the report processing. + * @throws org.jfree.report.ReportDataFactoryException + * if a query failed. + */ + public LayoutController advance(final ReportTarget target) + throws DataSourceException, ReportDataFactoryException, + ReportProcessingException { - // There is no repeating parent. What the heck are we doing here .. - return vlc; + if (processed) + { + throw new IllegalStateException("Already processed."); + } + + final VariablesDeclarationLayoutController vlc = + (VariablesDeclarationLayoutController) clone(); + vlc.processed = true; + + final OfficeRepeatingStructureLayoutController orslc = getRepeatingParent(); + if (orslc == null) + { + // There is no repeating parent. What the heck are we doing here .. + return vlc; + } + + final VariablesCollection collection = orslc.getVariablesCollection(); + if (collection.getVariablesCount() == 0) + { + // no processing necessary, as the header or footer contain no variables at all .. + return vlc; + } + + + final Element node = (Element) getNode(); + final AttributeMap vdSection = node.getAttributeMap(); + target.startElement(vdSection); + + final FormattedTextElement[] variables = collection.getVariables(); + for (int i = 0; i < variables.length; i++) + { + final FormattedTextElement variable = variables[i]; + final String varName = collection.getNamePrefix() + (i + 1); + final AttributeMap map = generateVariableSetSection(variable); + map.setAttribute(OfficeNamespaces.TEXT_NS, "name", varName); + target.startElement(map); + target.endElement(map); + + } + target.endElement(vdSection); + return vlc; } - final VariablesCollection collection = orslc.getVariablesCollection(); - if (collection.getVariablesCount() == 0) + private AttributeMap generateVariableSetSection(final FormattedTextElement variable) + throws DataSourceException { - // no processing necessary, as the header or footer contain no variables at all .. - return vlc; + final AttributeMap variableSection = new AttributeMap(); + variableSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.NAMESPACE_ATTRIBUTE, OfficeNamespaces.TEXT_NS); + variableSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.TYPE_ATTRIBUTE, "variable-set"); + variableSection.setAttribute(OfficeNamespaces.TEXT_NS, "display", "none"); + + final FormulaExpression valueExpression = variable.getValueExpression(); + final Object value = LayoutControllerUtil.evaluateExpression(getFlowController(), variable, valueExpression); + String formula = FormatValueUtility.applyValueForVariable(value, variableSection); + if (formula == null) + { + formula = "" + value; + } + 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; } - - final Element node = (Element) getNode(); - final AttributeMap vdSection = node.getAttributeMap(); - target.startElement(vdSection); - - final FormattedTextElement[] variables = collection.getVariables(); - for (int i = 0; i < variables.length; i++) + /** + * Checks, whether the layout controller would be advanceable. If this method + * returns true, it is generally safe to call the 'advance()' method. + * + * @return true, if the layout controller is advanceable, false otherwise. + */ + public boolean isAdvanceable() { - final FormattedTextElement variable = variables[i]; - final String varName = collection.getNamePrefix() + (i + 1); - final AttributeMap map = generateVariableSetSection(variable); - map.setAttribute(OfficeNamespaces.TEXT_NS, "name", varName); - target.startElement(map); - target.endElement(map); - + return !processed; } - target.endElement(vdSection); - return vlc; - } - - private AttributeMap generateVariableSetSection(final FormattedTextElement variable) - throws DataSourceException - { - final AttributeMap variableSection = new AttributeMap(); - variableSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.NAMESPACE_ATTRIBUTE, OfficeNamespaces.TEXT_NS); - variableSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.TYPE_ATTRIBUTE, "variable-set"); - variableSection.setAttribute(OfficeNamespaces.TEXT_NS, "display", "none"); - - final FormulaExpression valueExpression = variable.getValueExpression(); - final Object value = LayoutControllerUtil.evaluateExpression(getFlowController(), variable, valueExpression); - String formula = FormatValueUtility.applyValueForVariable(value, variableSection); - if ( formula == null ) - formula = "" + value; - if (value instanceof java.sql.Date) + + /** + * Joins with a delegated process flow. This is generally called from a child + * flow and should *not* (I mean it!) be called from outside. If you do, + * you'll suffer. + * + * @param flowController the flow controller of the parent. + * @return the joined layout controller that incorperates all changes from the + * delegate. + */ + public LayoutController join(final FlowController flowController) + throws DataSourceException, ReportDataFactoryException, + ReportProcessingException { - final Date date = (Date)value; - final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy;MM;dd"); - formula = "Date(" + dateFormat.format(date) + ")"; + throw new UnsupportedOperationException("Join is not supported in this layout controller"); } - variableSection.setAttribute(OfficeNamespaces.TEXT_NS, "formula", "ooow:" + formula); - - return variableSection; - } - - /** - * Checks, whether the layout controller would be advanceable. If this method - * returns true, it is generally safe to call the 'advance()' method. - * - * @return true, if the layout controller is advanceable, false otherwise. - */ - public boolean isAdvanceable() - { - return !processed; - } - - /** - * Joins with a delegated process flow. This is generally called from a child - * flow and should *not* (I mean it!) be called from outside. If you do, - * you'll suffer. - * - * @param flowController the flow controller of the parent. - * @return the joined layout controller that incorperates all changes from the - * delegate. - */ - public LayoutController join(final FlowController flowController) - throws DataSourceException, ReportDataFactoryException, - ReportProcessingException - { - throw new UnsupportedOperationException - ("Join is not supported in this layout controller"); - } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java index 14a437f4bb57..798f11d18194 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.loader; import java.io.IOException; @@ -42,47 +40,47 @@ import org.pentaho.reporting.libraries.resourceloader.loader.AbstractResourceDat public class InputRepositoryResourceData extends AbstractResourceData { - private final InputRepository inputRepository; - private final ResourceKey key; - private final String resourceIdentifer; - public InputRepositoryResourceData (final ResourceKey key, - final InputRepository repository) - { - this.key = key; - this.inputRepository = repository; - final InputResourceKey rkey = (InputResourceKey) key.getIdentifier(); - final String identifier = rkey.getPath(); - this.resourceIdentifer = identifier.substring("sun:oo://".length()); - } + private final InputRepository inputRepository; + private final ResourceKey key; + private final String resourceIdentifer; - public Object getAttribute (final String key) - { - // we dont support attributes here .. - return null; - } + public InputRepositoryResourceData(final ResourceKey key, + final InputRepository repository) + { + this.key = key; + this.inputRepository = repository; + final InputResourceKey rkey = (InputResourceKey) key.getIdentifier(); + final String identifier = rkey.getPath(); + this.resourceIdentifer = identifier.substring("sun:oo://".length()); + } - public ResourceKey getKey () - { - return key; - } + public Object getAttribute(final String key) + { + // we dont support attributes here .. + return null; + } - public InputStream getResourceAsStream (final ResourceManager caller) - throws ResourceLoadingException - { - try + public ResourceKey getKey() { - return inputRepository.createInputStream(resourceIdentifer); + return key; } - catch (IOException e) + + public InputStream getResourceAsStream(final ResourceManager caller) + throws ResourceLoadingException { - throw new ResourceLoadingException - ("Failed to create input stream for " + resourceIdentifer, e); + try + { + return inputRepository.createInputStream(resourceIdentifer); + } + catch (IOException e) + { + throw new ResourceLoadingException("Failed to create input stream for " + resourceIdentifer, e); + } } - } - public long getVersion (final ResourceManager caller) - { - return inputRepository.getVersion(resourceIdentifer); - } + public long getVersion(final ResourceManager caller) + { + return inputRepository.getVersion(resourceIdentifer); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputResourceKey.java b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputResourceKey.java index a4f2f1ca4553..4fd3787dd676 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputResourceKey.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputResourceKey.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.loader; import java.io.Serializable; @@ -40,32 +38,29 @@ import java.io.Serializable; */ public class InputResourceKey implements Serializable { - private static final long serialVersionUID = 2819901838705793075L; - private final Object inputRepositoryId; - private final String path; + private static final long serialVersionUID = 2819901838705793075L; + private final Object inputRepositoryId; + private final String path; - public InputResourceKey(final Object inputRepositoryId, final String path) - { - this.inputRepositoryId = inputRepositoryId; - this.path = path; - } + public InputResourceKey(final Object inputRepositoryId, final String path) + { + this.inputRepositoryId = inputRepositoryId; + this.path = path; + } - public Object getInputRepositoryId() - { - return inputRepositoryId; - } + public Object getInputRepositoryId() + { + return inputRepositoryId; + } - public String getPath() - { - return path; - } + public String getPath() + { + return path; + } - public String toString() - { - return "InputResourceKey{" + - "inputRepositoryId=" + inputRepositoryId + - ", path='" + path + '\'' + - '}'; - } + public String toString() + { + return "InputResourceKey{" + "inputRepositoryId=" + inputRepositoryId + ", path='" + path + '\'' + '}'; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java b/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java index efef723425da..37ffed4ecd8d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import org.jfree.report.structure.Section; @@ -42,19 +40,18 @@ import com.sun.star.report.pentaho.OfficeNamespaces; */ public class DataStyle extends Section { - public DataStyle() - { - } - - public String getStyleName() - { - return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); - } - public void setStyleName(final String name) - { - setAttribute(OfficeNamespaces.STYLE_NS, "name", name); - } + public DataStyle() + { + } + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java index 7632ee1fd650..c216f6aad214 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import org.jfree.report.structure.Section; @@ -41,16 +39,17 @@ import org.jfree.report.structure.Section; */ public class FixedTextElement extends ReportElement { - private final Section content; - public FixedTextElement() - { - content = new Section(); - content.setVirtual(true); - } + private final Section content; + + public FixedTextElement() + { + content = new Section(); + content.setVirtual(true); + } - public Section getContent() - { - return content; - } + public Section getContent() + { + return content; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java index 9b509b0b0157..96e9eed7c2fe 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import java.util.HashMap; @@ -45,34 +43,33 @@ import org.jfree.report.structure.Element; */ public class FontFaceDeclsSection extends Element { - private final Map fontFaces; - public FontFaceDeclsSection() - { - fontFaces = new HashMap(); - setType("font-face-decls"); - setNamespace(OfficeNamespaces.OFFICE_NS); - } + private final Map fontFaces; - public void addFontFace(final FontFaceElement style) - { - fontFaces.put (style.getStyleName(), style); - } + public FontFaceDeclsSection() + { + fontFaces = new HashMap(); + setType("font-face-decls"); + setNamespace(OfficeNamespaces.OFFICE_NS); + } - public FontFaceElement getFontFace (final String name) - { - return (FontFaceElement) fontFaces.get(name); - } + public void addFontFace(final FontFaceElement style) + { + fontFaces.put(style.getStyleName(), style); + } - public FontFaceElement[] getAllFontFaces() - { - return (FontFaceElement[]) fontFaces.values().toArray - (new FontFaceElement[fontFaces.size()]); - } + public FontFaceElement getFontFace(final String name) + { + return (FontFaceElement) fontFaces.get(name); + } + public FontFaceElement[] getAllFontFaces() + { + return (FontFaceElement[]) fontFaces.values().toArray(new FontFaceElement[fontFaces.size()]); + } - public boolean containsFont(final String fontName) - { - return fontFaces.containsKey(fontName); - } + public boolean containsFont(final String fontName) + { + return fontFaces.containsKey(fontName); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java index 48abe9e1f088..46516557f97a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import org.jfree.report.structure.Section; @@ -42,19 +40,18 @@ import com.sun.star.report.pentaho.OfficeNamespaces; */ public class FontFaceElement extends Section { - public FontFaceElement() - { - } - - public String getStyleName() - { - return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); - } - public void setStyleName(final String name) - { - setAttribute(OfficeNamespaces.STYLE_NS, "name", name); - } + public FontFaceElement() + { + } + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java index 43e84abc4651..2f4d459229d6 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import org.jfree.report.expressions.FormulaExpression; @@ -41,32 +39,32 @@ import org.jfree.report.expressions.FormulaExpression; */ public class FormatCondition { - private final FormulaExpression formula; - private final String styleName; - private final boolean enabled; - public FormatCondition(final FormulaExpression formula, - final String styleName, - final boolean enabled) - { - this.formula = formula; - this.styleName = styleName; - this.enabled = enabled; - } + private final FormulaExpression formula; + private final String styleName; + private final boolean enabled; + public FormatCondition(final FormulaExpression formula, + final String styleName, + final boolean enabled) + { + this.formula = formula; + this.styleName = styleName; + this.enabled = enabled; + } - public FormulaExpression getFormula() - { - return formula; - } + public FormulaExpression getFormula() + { + return formula; + } - public String getStyleName() - { - return styleName; - } + public String getStyleName() + { + return styleName; + } - public boolean isEnabled() - { - return enabled; - } + public boolean isEnabled() + { + return enabled; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FormattedTextElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FormattedTextElement.java index f902cae1a346..3852cdabb86a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/FormattedTextElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FormattedTextElement.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import org.jfree.report.expressions.FormulaExpression; @@ -44,20 +42,20 @@ import org.jfree.report.expressions.FormulaExpression; */ public class FormattedTextElement extends ReportElement { - private FormulaExpression valueExpression; - public FormattedTextElement() - { - } + private FormulaExpression valueExpression; + public FormattedTextElement() + { + } - public FormulaExpression getValueExpression() - { - return valueExpression; - } + public FormulaExpression getValueExpression() + { + return valueExpression; + } - public void setValueExpression(final FormulaExpression valueExpression) - { - this.valueExpression = valueExpression; - } + public void setValueExpression(final FormulaExpression valueExpression) + { + this.valueExpression = valueExpression; + } } 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 195c569a3028..f7832a9618c7 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import org.jfree.report.expressions.FormulaExpression; @@ -43,45 +41,49 @@ import com.sun.star.report.OfficeToken; */ public class ImageElement extends ReportElement { - private FormulaExpression formula; - public ImageElement() - { - } + private FormulaExpression formula; - public FormulaExpression getFormula() - { - return formula; - } + public ImageElement() + { + } - public void setFormula(final FormulaExpression formula) - { - this.formula = formula; - } + public FormulaExpression getFormula() + { + return formula; + } + public void setFormula(final FormulaExpression formula) + { + this.formula = formula; + } - 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 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() - { - return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.PRESERVE_IRI)); - } + public boolean isPreserveIRI() + { + return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.PRESERVE_IRI)); + } - public void setPreserveIRI(final boolean preserveIRI) - { - setAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.PRESERVE_IRI, String.valueOf(preserveIRI)); - } + public void setPreserveIRI(final boolean preserveIRI) + { + setAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.PRESERVE_IRI, String.valueOf(preserveIRI)); + } - public String getImageData() - { - return (String) getAttribute(OfficeNamespaces.FORM_NS, OfficeToken.IMAGE_DATA); - } + public String getImageData() + { + return (String) getAttribute(OfficeNamespaces.FORM_NS, OfficeToken.IMAGE_DATA); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java index c31c3ae8497a..2950e1c8d2ff 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java @@ -36,22 +36,26 @@ import java.util.List; * * @author Ocke Janssen */ -public class ObjectOleElement extends ReportElement{ +public class ObjectOleElement extends ReportElement +{ private String url; private final List masterfields; private final List detailfields; private String classid; - public String getClassid() { + public String getClassid() + { return classid; } - public List getDetailfields() { + public List getDetailfields() + { return detailfields; } - public List getMasterfields() { + public List getMasterfields() + { return masterfields; } @@ -61,22 +65,27 @@ public class ObjectOleElement extends ReportElement{ detailfields = new ArrayList(); } - public String getUrl() { + public String getUrl() + { return url; } - public void setClassId(final String classid) { + public void setClassId(final String classid) + { this.classid = classid; } - public void setUrl(final String _url ){ + + public void setUrl(final String _url) + { url = _url; } - public void addMasterDetailFields(final String master,final String detail){ - if ( master != null ){ + public void addMasterDetailFields(final String master, final String detail) + { + if (master != null) + { masterfields.add(master); detailfields.add(detail == null ? master : detail); } } - } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDetailSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDetailSection.java index d66c17c29132..a31f66a805b6 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDetailSection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDetailSection.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import org.jfree.report.structure.DetailSection; @@ -41,7 +39,8 @@ import org.jfree.report.structure.DetailSection; */ public class OfficeDetailSection extends DetailSection { - public OfficeDetailSection() - { - } + + public OfficeDetailSection() + { + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java index 02727c2b9d2a..41cc7aaa68d4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import com.sun.star.report.JobProperties; @@ -43,32 +41,35 @@ import org.jfree.report.JFreeReport; */ public class OfficeDocument extends JFreeReport { - private OfficeStylesCollection stylesCollection; - private JobProperties jobProperties; - public JobProperties getJobProperties() { + private OfficeStylesCollection stylesCollection; + private JobProperties jobProperties; + + public JobProperties getJobProperties() + { return jobProperties; } - public void setJobProperties(final JobProperties jobProperties) { + public void setJobProperties(final JobProperties jobProperties) + { this.jobProperties = jobProperties; } - public OfficeDocument() - { - } + public OfficeDocument() + { + } - public OfficeStylesCollection getStylesCollection() - { - return stylesCollection; - } + public OfficeStylesCollection getStylesCollection() + { + return stylesCollection; + } - public void setStylesCollection(final OfficeStylesCollection stylesCollection) - { - if (stylesCollection == null) + public void setStylesCollection(final OfficeStylesCollection stylesCollection) { - throw new NullPointerException(); + if (stylesCollection == null) + { + throw new NullPointerException(); + } + this.stylesCollection = stylesCollection; } - this.stylesCollection = stylesCollection; - } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java index 2717eadea602..eca3f20fe0ef 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import com.sun.star.report.pentaho.OfficeNamespaces; @@ -46,54 +44,53 @@ import org.jfree.report.structure.Section; */ public class OfficeGroup extends Section { - public OfficeGroup() - { - } - public boolean isStartNewColumn () - { - return OfficeToken.TRUE.equals - (getAttribute(OfficeNamespaces.OOREPORT_NS, "start-new-column")); - } + public OfficeGroup() + { + } - public boolean isResetPageNumber () - { - return OfficeToken.TRUE.equals - (getAttribute(OfficeNamespaces.OOREPORT_NS, "reset-page-number")); - } + public boolean isStartNewColumn() + { + return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, "start-new-column")); + } - public OfficeGroupSection getHeader() - { - final OfficeGroupInstanceSection instanceSection = - (OfficeGroupInstanceSection) findFirstChild(JFreeReportInfo.REPORT_NAMESPACE, "group-instance"); - if (instanceSection == null) + public boolean isResetPageNumber() { - return null; + return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, "reset-page-number")); } - return (OfficeGroupSection) instanceSection.findFirstChild - (OfficeNamespaces.OOREPORT_NS, "group-header"); - } + public OfficeGroupSection getHeader() + { + final OfficeGroupInstanceSection instanceSection = + (OfficeGroupInstanceSection) findFirstChild(JFreeReportInfo.REPORT_NAMESPACE, "group-instance"); + if (instanceSection == null) + { + return null; + } + return (OfficeGroupSection) instanceSection.findFirstChild(OfficeNamespaces.OOREPORT_NS, "group-header"); - public OfficeGroupSection getFooter() - { - final OfficeGroupInstanceSection instanceSection = - (OfficeGroupInstanceSection) findFirstChild(JFreeReportInfo.REPORT_NAMESPACE, "group-instance"); - if (instanceSection == null) + } + + public OfficeGroupSection getFooter() { - return null; + final OfficeGroupInstanceSection instanceSection = + (OfficeGroupInstanceSection) findFirstChild(JFreeReportInfo.REPORT_NAMESPACE, "group-instance"); + if (instanceSection == null) + { + return null; + } + return (OfficeGroupSection) instanceSection.findFirstChild(OfficeNamespaces.OOREPORT_NS, "group-footer"); + } - return (OfficeGroupSection) instanceSection.findFirstChild - (OfficeNamespaces.OOREPORT_NS, "group-footer"); - } - public Expression getGroupingExpression(){ - final OfficeGroupInstanceSection instanceSection = - (OfficeGroupInstanceSection) findFirstChild(JFreeReportInfo.REPORT_NAMESPACE, "group-instance"); - if (instanceSection == null) + public Expression getGroupingExpression() { - return null; + final OfficeGroupInstanceSection instanceSection = + (OfficeGroupInstanceSection) findFirstChild(JFreeReportInfo.REPORT_NAMESPACE, "group-instance"); + if (instanceSection == null) + { + return null; + } + return instanceSection.getGroupingExpression(); } - return instanceSection.getGroupingExpression(); - } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupInstanceSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupInstanceSection.java index 26ec1d8f9c6d..478cc1b73f6d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupInstanceSection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupInstanceSection.java @@ -9,7 +9,8 @@ import org.jfree.report.structure.Group; */ public class OfficeGroupInstanceSection extends Group { - public OfficeGroupInstanceSection() - { - } + + public OfficeGroupInstanceSection() + { + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java index 6dca280618cc..209f0866271a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import org.jfree.report.structure.Section; @@ -44,29 +42,27 @@ import com.sun.star.report.pentaho.OfficeNamespaces; public class OfficeMasterPage extends Section { - public OfficeMasterPage() - { - } - - public String getStyleName() - { - return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); - } - - public void setStyleName(final String name) - { - setAttribute(OfficeNamespaces.STYLE_NS, "name", name); - } + public OfficeMasterPage() + { + } - public String getPageLayout() - { - return (String) getAttribute(OfficeNamespaces.STYLE_NS, "page-layout-name"); - } + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } - public void setPageLayout(final String name) - { - setAttribute(OfficeNamespaces.STYLE_NS, "page-layout-name", name); - } + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } + public String getPageLayout() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "page-layout-name"); + } + public void setPageLayout(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "page-layout-name", name); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java index fed1f04db958..866a604c3f9f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import java.util.HashMap; @@ -51,37 +49,37 @@ import org.jfree.report.structure.Section; */ public class OfficeMasterStyles extends Element { - private final Map masterPages; - private final Section otherNodes; - public OfficeMasterStyles() - { - masterPages = new HashMap(); - otherNodes = new Section(); - } + private final Map masterPages; + private final Section otherNodes; - public void addMasterPage (final OfficeMasterPage masterPage) - { - if (masterPage == null) + public OfficeMasterStyles() { - throw new NullPointerException(); + masterPages = new HashMap(); + otherNodes = new Section(); } - this.masterPages.put(masterPage.getStyleName(), masterPage); - } - public OfficeMasterPage getMasterPage (final String name) - { - return (OfficeMasterPage) masterPages.get (name); - } + public void addMasterPage(final OfficeMasterPage masterPage) + { + if (masterPage == null) + { + throw new NullPointerException(); + } + this.masterPages.put(masterPage.getStyleName(), masterPage); + } - public OfficeMasterPage[] getAllMasterPages() - { - return (OfficeMasterPage[]) masterPages.values().toArray - (new OfficeMasterPage[masterPages.size()]); - } + public OfficeMasterPage getMasterPage(final String name) + { + return (OfficeMasterPage) masterPages.get(name); + } - public Section getOtherNodes() - { - return otherNodes; - } + public OfficeMasterPage[] getAllMasterPages() + { + return (OfficeMasterPage[]) masterPages.values().toArray(new OfficeMasterPage[masterPages.size()]); + } + + public Section getOtherNodes() + { + return otherNodes; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java index 74afacbc4026..5804396b36be 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java @@ -42,7 +42,8 @@ import org.jfree.report.structure.Node; * @author Thomas Morgner * @since 02.03.2007 */ -public class OfficeReport extends Element { +public class OfficeReport extends Element +{ private Node pageHeader; private Node pageFooter; @@ -54,78 +55,97 @@ public class OfficeReport extends Element { private Node preBodySection; private Node postBodySection; - public Node getPostBodySection() { + public Node getPostBodySection() + { return postBodySection; } - public void setPostBodySection(final Node postBodySection) { + public void setPostBodySection(final Node postBodySection) + { this.postBodySection = postBodySection; } - public Node getPreBodySection() { + public Node getPreBodySection() + { return preBodySection; } - public void setPreBodySection(final Node preBodySection) { + public void setPreBodySection(final Node preBodySection) + { this.preBodySection = preBodySection; } - public OfficeReport() { + public OfficeReport() + { } - public Node getPageHeader() { + public Node getPageHeader() + { return pageHeader; } - public void setPageHeader(final Node pageHeader) { + public void setPageHeader(final Node pageHeader) + { this.pageHeader = pageHeader; } - public Node getPageFooter() { + public Node getPageFooter() + { return pageFooter; } - public void setPageFooter(final Node pageFooter) { + public void setPageFooter(final Node pageFooter) + { this.pageFooter = pageFooter; } - public Node getColumnHeader() { + public Node getColumnHeader() + { return columnHeader; } - public void setColumnHeader(final Node columnHeader) { + public void setColumnHeader(final Node columnHeader) + { this.columnHeader = columnHeader; } - public Node getColumnFooter() { + public Node getColumnFooter() + { return columnFooter; } - public void setColumnFooter(final Node columnFooter) { + public void setColumnFooter(final Node columnFooter) + { this.columnFooter = columnFooter; } - public Node getReportHeader() { + public Node getReportHeader() + { return reportHeader; } - public void setReportHeader(final Node reportHeader) { + public void setReportHeader(final Node reportHeader) + { this.reportHeader = reportHeader; } - public Node getReportFooter() { + public Node getReportFooter() + { return reportFooter; } - public void setReportFooter(final Node reportFooter) { + public void setReportFooter(final Node reportFooter) + { this.reportFooter = reportFooter; } - public Node getBodySection() { + public Node getBodySection() + { return bodySection; } - public void setBodySection(final Node bodySection) { + public void setBodySection(final Node bodySection) + { this.bodySection = bodySection; } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java index 5f6bef8f1492..acb4b88359d0 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import com.sun.star.report.OfficeToken; @@ -44,91 +42,91 @@ import org.jfree.report.structure.Section; */ public class OfficeStyle extends Section { - public OfficeStyle() - { - setNamespace(OfficeNamespaces.STYLE_NS); - setType("style"); - } - - public String getStyleName() - { - return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); - } - - public void setStyleName(final String name) - { - setAttribute(OfficeNamespaces.STYLE_NS, "name", name); - } - - /** - * A parent style name must be a common style (it cannot be an automatic - * style) and has to exist. If no parent style is given, an implementation - * specific default style is used. - * - * @return - */ - public String getStyleParent() - { - return (String) getAttribute(OfficeNamespaces.STYLE_NS, "parent-style-name"); - } - - public void setStyleParent(final String parentName) - { - setAttribute(OfficeNamespaces.STYLE_NS, "parent-style-name", parentName); - } - - public String getStyleFamily() - { - return (String) getAttribute(OfficeNamespaces.STYLE_NS, "family"); - } - - public void setStyleFamily(final String family) - { - setAttribute(OfficeNamespaces.STYLE_NS, "family", family); - } + + public OfficeStyle() + { + setNamespace(OfficeNamespaces.STYLE_NS); + setType("style"); + } + + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } + + /** + * A parent style name must be a common style (it cannot be an automatic + * style) and has to exist. If no parent style is given, an implementation + * specific default style is used. + * + * @return + */ + public String getStyleParent() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "parent-style-name"); + } + + public void setStyleParent(final String parentName) + { + setAttribute(OfficeNamespaces.STYLE_NS, "parent-style-name", parentName); + } + + public String getStyleFamily() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "family"); + } + + public void setStyleFamily(final String family) + { + setAttribute(OfficeNamespaces.STYLE_NS, "family", family); + } // public String getMasterPageName() // { // return (String) getAttribute(OfficeNamespaces.STYLE_NS, "master-page-name"); // } - - public Element getParagraphProperties () - { - return findFirstChild(OfficeNamespaces.STYLE_NS, "paragraph-properties"); - } - - public Element getTextProperties () - { - return findFirstChild(OfficeNamespaces.STYLE_NS, "text-properties"); - } - - public Element getTableRowProperties () - { - return findFirstChild(OfficeNamespaces.STYLE_NS, "table-row-properties"); - } - - public Element getTableProperties () - { - return findFirstChild(OfficeNamespaces.STYLE_NS, "table-properties"); - } - - public Element getTableColumnProperties () - { - return findFirstChild(OfficeNamespaces.STYLE_NS, "table-column-properties"); - } - - public Element getSectionProperties () - { - return findFirstChild(OfficeNamespaces.STYLE_NS, "section-properties"); - } - - public Element getTableCellProperties () - { - return findFirstChild(OfficeNamespaces.STYLE_NS, "table-cell-properties"); - } - - public Element getGraphicProperties () - { - return findFirstChild(OfficeNamespaces.STYLE_NS, OfficeToken.GRAPHIC_PROPERTIES); - } + public Element getParagraphProperties() + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "paragraph-properties"); + } + + public Element getTextProperties() + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "text-properties"); + } + + public Element getTableRowProperties() + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "table-row-properties"); + } + + public Element getTableProperties() + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "table-properties"); + } + + public Element getTableColumnProperties() + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "table-column-properties"); + } + + public Element getSectionProperties() + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "section-properties"); + } + + public Element getTableCellProperties() + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "table-cell-properties"); + } + + public Element getGraphicProperties() + { + return findFirstChild(OfficeNamespaces.STYLE_NS, OfficeToken.GRAPHIC_PROPERTIES); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java index 29f2a923dae3..aa08f75e38a4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java @@ -91,7 +91,7 @@ public class OfficeStyles extends Element final StyleKey styleKey = (StyleKey) obj; - if (!family.equals(styleKey.family) || ( name != null ? !name.equals(styleKey.name) : styleKey.name != null) ) + if (!family.equals(styleKey.family) || (name != null ? !name.equals(styleKey.name) : styleKey.name != null)) { return false; } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java index 58e6d4639add..a4a4d4b544ab 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import com.sun.star.report.pentaho.OfficeNamespaces; @@ -54,73 +52,74 @@ import org.jfree.report.structure.Element; */ public class OfficeStylesCollection extends Element { - // Font-face declarations are copied as is. We simply merge them by adding - // them all in one set. This may result in duplicate entries, but as the - // fileformat does not forbid that, it therefore must be ok. - private final FontFaceDeclsSection fontFaceDecls; - private final OfficeStyles automaticStyles; - private final OfficeStyles commonStyles; - private final OfficeMasterStyles masterStyles; + // Font-face declarations are copied as is. We simply merge them by adding + // them all in one set. This may result in duplicate entries, but as the + // fileformat does not forbid that, it therefore must be ok. - public OfficeStylesCollection() - { - fontFaceDecls = new FontFaceDeclsSection(); + private final FontFaceDeclsSection fontFaceDecls; + private final OfficeStyles automaticStyles; + private final OfficeStyles commonStyles; + private final OfficeMasterStyles masterStyles; - automaticStyles = new OfficeStyles(); - automaticStyles.setType("automatic-styles"); - automaticStyles.setNamespace(OfficeNamespaces.OFFICE_NS); + public OfficeStylesCollection() + { + fontFaceDecls = new FontFaceDeclsSection(); - commonStyles = new OfficeStyles(); - commonStyles.setType("styles"); - commonStyles.setNamespace(OfficeNamespaces.OFFICE_NS); + automaticStyles = new OfficeStyles(); + automaticStyles.setType("automatic-styles"); + automaticStyles.setNamespace(OfficeNamespaces.OFFICE_NS); - masterStyles = new OfficeMasterStyles(); - masterStyles.setType("master-styles"); - masterStyles.setNamespace(OfficeNamespaces.OFFICE_NS); - } + commonStyles = new OfficeStyles(); + commonStyles.setType("styles"); + commonStyles.setNamespace(OfficeNamespaces.OFFICE_NS); - public OfficeStyle getStyle(final String family, final String name) - { - final OfficeStyle commonStyle = commonStyles.getStyle(family, name); - if (commonStyle != null) - { - return commonStyle; + masterStyles = new OfficeMasterStyles(); + masterStyles.setType("master-styles"); + masterStyles.setNamespace(OfficeNamespaces.OFFICE_NS); } - final OfficeStyle autoStyle = automaticStyles.getStyle(family, name); - if (autoStyle != null) + + public OfficeStyle getStyle(final String family, final String name) { - return autoStyle; - } + final OfficeStyle commonStyle = commonStyles.getStyle(family, name); + if (commonStyle != null) + { + return commonStyle; + } + final OfficeStyle autoStyle = automaticStyles.getStyle(family, name); + if (autoStyle != null) + { + return autoStyle; + } - // And later: Autogenerate one of the default styles. - // However, at this moment, we dont have a clue about the default styles - // at all. Maybe we should add them to make this implementation more robust - // against invalid documents. - return null; - } + // And later: Autogenerate one of the default styles. + // However, at this moment, we dont have a clue about the default styles + // at all. Maybe we should add them to make this implementation more robust + // against invalid documents. + return null; + } - public boolean containsStyle (final String family, final String name) - { - return (getStyle(family, name) != null); - } + public boolean containsStyle(final String family, final String name) + { + return (getStyle(family, name) != null); + } - public OfficeStyles getAutomaticStyles() - { - return automaticStyles; - } + public OfficeStyles getAutomaticStyles() + { + return automaticStyles; + } - public OfficeStyles getCommonStyles() - { - return commonStyles; - } + public OfficeStyles getCommonStyles() + { + return commonStyles; + } - public OfficeMasterStyles getMasterStyles() - { - return masterStyles; - } + public OfficeMasterStyles getMasterStyles() + { + return masterStyles; + } - public FontFaceDeclsSection getFontFaceDecls() - { - return fontFaceDecls; - } + public FontFaceDeclsSection getFontFaceDecls() + { + return fontFaceDecls; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeTableSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeTableSection.java index 96d6a4dd7e9e..bf77ebcd1253 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeTableSection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeTableSection.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import org.jfree.report.structure.Section; @@ -40,7 +38,8 @@ import org.jfree.report.structure.Section; */ public class OfficeTableSection extends Section { - public OfficeTableSection() - { - } + + public OfficeTableSection() + { + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java b/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java index 29b916778ab7..9499d0557f29 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import org.jfree.report.structure.Section; @@ -44,29 +42,29 @@ import com.sun.star.report.pentaho.OfficeNamespaces; public class PageLayout extends Section { - public PageLayout() - { - setNamespace(OfficeNamespaces.STYLE_NS); - setType("page-layout"); - } + public PageLayout() + { + setNamespace(OfficeNamespaces.STYLE_NS); + setType("page-layout"); + } - public String getStyleName() - { - return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); - } + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } - public void setStyleName(final String name) - { - setAttribute(OfficeNamespaces.STYLE_NS, "name", name); - } + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } - public Section getHeaderStyle () - { - return (Section) findFirstChild(OfficeNamespaces.STYLE_NS, "header-style"); - } + public Section getHeaderStyle() + { + return (Section) findFirstChild(OfficeNamespaces.STYLE_NS, "header-style"); + } - public Section getFooterStyle () - { - return (Section) findFirstChild(OfficeNamespaces.STYLE_NS, "footer-style"); - } + public Section getFooterStyle() + { + return (Section) findFirstChild(OfficeNamespaces.STYLE_NS, "footer-style"); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java b/reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java index 679dd30fdff3..8dd1dcf7430d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import org.jfree.report.structure.StaticText; @@ -43,8 +41,9 @@ import org.jfree.report.structure.StaticText; */ public class RawText extends StaticText { - public RawText(final String text) - { - super(text); - } + + public RawText(final String text) + { + super(text); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java index df1de0154e6a..a3c9838be19d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import java.util.ArrayList; @@ -47,69 +45,67 @@ import java.util.List; */ public abstract class ReportElement extends Element { - private final List formatConditions; - protected ReportElement() - { - formatConditions = new ArrayList(); - } + private final List formatConditions; - /** - * Checks the current group and prints this element only if the current row is - * the first row for that particular group. - * - * @return true, if the element should only be printed in the first row of the - * current group, false otherwise. - */ - public boolean isPrintWhenGroupChanges() - { - return OfficeToken.TRUE.equals(getAttribute - (OfficeNamespaces.OOREPORT_NS, "print-when-group-changes")); - } + protected ReportElement() + { + formatConditions = new ArrayList(); + } - public void setPrintWhenGroupChanges(final boolean printWhenGroupChanges) - { - setAttribute(OfficeNamespaces.OOREPORT_NS, "print-when-group-changes", - String.valueOf(printWhenGroupChanges)); - } + /** + * Checks the current group and prints this element only if the current row is + * the first row for that particular group. + * + * @return true, if the element should only be printed in the first row of the + * current group, false otherwise. + */ + public boolean isPrintWhenGroupChanges() + { + return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, "print-when-group-changes")); + } - /** - * Checks, whether the printed value has been changed since the last run. The - * element will only be printed, if there was at least one change. - * - * @return true, if repeated values should be printed, false if repeated - * values should be surpressed. - */ - public boolean isPrintRepeatedValues() - { - return OfficeToken.TRUE.equals(getAttribute - (OfficeNamespaces.OOREPORT_NS, "print-repeated-values")); - } + public void setPrintWhenGroupChanges(final boolean printWhenGroupChanges) + { + setAttribute(OfficeNamespaces.OOREPORT_NS, "print-when-group-changes", + String.valueOf(printWhenGroupChanges)); + } - public void setPrintRepeatedValues(final boolean printRepeatedValues) - { - setAttribute(OfficeNamespaces.OOREPORT_NS, "print-repeated-values", - String.valueOf(printRepeatedValues)); - } + /** + * Checks, whether the printed value has been changed since the last run. The + * element will only be printed, if there was at least one change. + * + * @return true, if repeated values should be printed, false if repeated + * values should be surpressed. + */ + public boolean isPrintRepeatedValues() + { + return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, "print-repeated-values")); + } - public void addFormatCondition(final FormatCondition formatCondition) - { - if (formatCondition == null) + public void setPrintRepeatedValues(final boolean printRepeatedValues) { - throw new NullPointerException(); + setAttribute(OfficeNamespaces.OOREPORT_NS, "print-repeated-values", + String.valueOf(printRepeatedValues)); } - this.formatConditions.add(formatCondition); - } + public void addFormatCondition(final FormatCondition formatCondition) + { + if (formatCondition == null) + { + throw new NullPointerException(); + } + + this.formatConditions.add(formatCondition); + } - public FormatCondition[] getFormatConditions () - { - return (FormatCondition[]) this.formatConditions.toArray - (new FormatCondition[this.formatConditions.size()]); - } + public FormatCondition[] getFormatConditions() + { + return (FormatCondition[]) this.formatConditions.toArray(new FormatCondition[this.formatConditions.size()]); + } - public int getFormatConditionCount () - { - return formatConditions.size(); - } + public int getFormatConditionCount() + { + return formatConditions.size(); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java index 74334dc11c52..501a8dbe8131 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import org.jfree.report.structure.Section; @@ -42,7 +40,7 @@ import org.jfree.report.structure.Section; public class TableCellElement extends Section { - public TableCellElement() - { - } + public TableCellElement() + { + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java index 3dcdc302ef7a..fc03e863ff64 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.model; import org.jfree.report.JFreeReportInfo; @@ -49,9 +47,9 @@ import org.jfree.report.structure.Section; public class VariablesDeclarationSection extends Section { - public VariablesDeclarationSection() - { - setNamespace(JFreeReportInfo.REPORT_NAMESPACE); - setType("variables-section"); - } + public VariablesDeclarationSection() + { + setNamespace(JFreeReportInfo.REPORT_NAMESPACE); + setType("variables-section"); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/oasis-datastyle.css b/reportbuilder/java/com/sun/star/report/pentaho/oasis-datastyle.css index 01fa9d16fe03..427537005d39 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/oasis-datastyle.css +++ b/reportbuilder/java/com/sun/star/report/pentaho/oasis-datastyle.css @@ -2,4 +2,4 @@ /** * All default styles for data-styles elements. - */ +*/ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/oasis-draw.css b/reportbuilder/java/com/sun/star/report/pentaho/oasis-draw.css index 87fe338294e2..341f44ec550e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/oasis-draw.css +++ b/reportbuilder/java/com/sun/star/report/pentaho/oasis-draw.css @@ -2,4 +2,4 @@ /** * All default styles for draw elements. - */ +*/ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/oasis-form.css b/reportbuilder/java/com/sun/star/report/pentaho/oasis-form.css index b9f4967eaa1b..7c8c43008435 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/oasis-form.css +++ b/reportbuilder/java/com/sun/star/report/pentaho/oasis-form.css @@ -2,4 +2,4 @@ /** * All default styles for form elements. - */ +*/ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/oasis-style.css b/reportbuilder/java/com/sun/star/report/pentaho/oasis-style.css index 6e5f9c8f51c5..47777f4fb7e4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/oasis-style.css +++ b/reportbuilder/java/com/sun/star/report/pentaho/oasis-style.css @@ -3,8 +3,8 @@ /** * All default styles for style elements. (They should not be visible anyway, * but better be complete than be sorry afterwards.) - */ +*/ raw-styles { - display:none; + display:none; } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/oasis-table.css b/reportbuilder/java/com/sun/star/report/pentaho/oasis-table.css index efddd2919966..91bedcd97573 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/oasis-table.css +++ b/reportbuilder/java/com/sun/star/report/pentaho/oasis-table.css @@ -1,35 +1,35 @@ @namespace url("urn:oasis:names:tc:opendocument:xmlns:table:1.0"); table { - display: table; + display: table; } table-columns { - display: table-column-group; + display: table-column-group; } table-column { - display: table-column; + display: table-column; } table-row { - display: table-row; + display: table-row; } table-cell { - display: table-cell; + display: table-cell; } table-cell[number-cols-spanned], table-cell[number-cols-spanned], table-columns[number-cols-spanned], table-column[number-cols-spanned] { - -x-liblayout-colspan: attr(number-cols-spanned); + -x-liblayout-colspan: attr(number-cols-spanned); } table-cell[number-rows-spanned], table-cell[number-rows-spanned] { - -x-liblayout-rowspan: attr(number-rows-spanned); + -x-liblayout-rowspan: attr(number-rows-spanned); } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/oasis-text.css b/reportbuilder/java/com/sun/star/report/pentaho/oasis-text.css index c8b6acc03d94..ccc000e9c82d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/oasis-text.css +++ b/reportbuilder/java/com/sun/star/report/pentaho/oasis-text.css @@ -2,8 +2,8 @@ /** * All default styles for form elements. - */ +*/ p { - display: block; + display: block; } 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 af34c5ed5a00..ac98c9a97953 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java @@ -71,7 +71,9 @@ import org.pentaho.reporting.libraries.base.util.WaitingImageObserver; */ public class ImageProducer { + private static final Log LOGGER = LogFactory.getLog(ImageProducer.class); + public static class OfficeImage { @@ -140,7 +142,7 @@ public class ImageProducer { if (hashCode != null) { - return hashCode.intValue(); + return hashCode; } final int length = Math.min(keyData.length, 512); @@ -150,7 +152,7 @@ public class ImageProducer final byte b = keyData[i]; hashValue = b + hashValue * 23; } - this.hashCode = Integer.valueOf(hashValue); + this.hashCode = hashValue; return hashValue; } } @@ -320,7 +322,7 @@ public class ImageProducer } catch (MalformedURLException e) { - // ignore .. but we had to try this .. + // ignore .. but we had to try this .. } final OfficeImage o = (OfficeImage) imageCache.get(source); @@ -365,6 +367,22 @@ public class ImageProducer LOGGER.warn("Failed to create image from local input-repository", e); } } + else + { + try + { + URI rootURI = new URI(inputRepository.getRootURL()); + final URI uri = rootURI.resolve(source); + return produceFromURL(uri.toURL(), preserveIRI); + } + catch (URISyntaxException ex) + { + } + catch (MalformedURLException e) + { + // ignore .. but we had to try this .. + } + } // Return the image as broken image instead .. final OfficeImage officeImage = new OfficeImage(source, null, null); @@ -381,7 +399,7 @@ public class ImageProducer { uri = new URI(urlString); } - catch ( URISyntaxException ex ) + catch (URISyntaxException ex) { Logger.getLogger(ImageProducer.class.getName()).log(Level.SEVERE, null, ex); } 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 42fef8d10f45..3892944eb1f2 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java @@ -104,6 +104,7 @@ import org.w3c.css.sac.LexicalUnit; */ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget { + protected static final Log LOGGER = LogFactory.getLog(OfficeDocumentReportTarget.class); public static final String HORIZONTAL_POS = "horizontal-pos"; public static final String TAG_DEF_PREFIX = "com.sun.star.report.pentaho.output."; @@ -228,11 +229,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget public String toString() { - return "GroupContext{" + - "parent=" + parent + - ", iterationCount=" + iterationCount + - ", groupWithRepeatingSection=" + groupWithRepeatingSection + - '}'; + return "GroupContext{" + "parent=" + parent + ", iterationCount=" + iterationCount + ", groupWithRepeatingSection=" + groupWithRepeatingSection + '}'; } } private final FastStack states; @@ -301,7 +298,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,(Integer)reportJob.getParameters().get(ReportEngineParameterNames.MAXROWS)); + this.oleProducer = new OleProducer(inputRepository, outputRepository, imageService, datasourcefactory, (Integer) reportJob.getParameters().get(ReportEngineParameterNames.MAXROWS)); try { @@ -489,7 +486,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget throw new IllegalStateException(); } final Integer o = (Integer) states.peek(); - return o.intValue(); + return o; } /** @@ -507,9 +504,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget // todo if (DEBUG_ELEMENTS) { - LOGGER.debug("Starting " + getCurrentState() + '/' + states.size() + ' ' + - ReportTargetUtil.getNamespaceFromAttribute(attrs) + " -> " + - ReportTargetUtil.getElemenTypeFromAttribute(attrs)); + LOGGER.debug("Starting " + getCurrentState() + '/' + states.size() + ' ' + ReportTargetUtil.getNamespaceFromAttribute(attrs) + " -> " + ReportTargetUtil.getElemenTypeFromAttribute(attrs)); } try { @@ -599,8 +594,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget } else { - throw new IllegalStateException("Expected either 'template', 'report-body', " + - "'report-header', 'report-footer', 'variables-section', 'page-header' or 'page-footer'"); + throw new IllegalStateException("Expected either 'template', 'report-body', " + "'report-header', 'report-footer', 'variables-section', 'page-header' or 'page-footer'"); } startReportSection(attrs, currentRole); } @@ -648,20 +642,17 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget { // repeating group header/footer, but *no* variables section states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_SECTION)); - if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group-header", attrs) && - OfficeToken.TRUE.equals(attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeated-section"))) + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group-header", attrs) && OfficeToken.TRUE.equals(attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeated-section"))) { currentRole = OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER; } - else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group-footer", attrs) && - OfficeToken.TRUE.equals(attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeated-section"))) + else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group-footer", attrs) && OfficeToken.TRUE.equals(attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeated-section"))) { currentRole = OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER; } else { - throw new IllegalStateException("Expected either 'group-instance', " + - "'repeating group-header' or 'repeating group-footer'"); + throw new IllegalStateException("Expected either 'group-instance', " + "'repeating group-header' or 'repeating group-footer'"); } startReportSection(attrs, currentRole); } @@ -788,9 +779,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget private final boolean allowBuffering(final int role) { - return (role == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER || - role == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER || - role == OfficeDocumentReportTarget.ROLE_TEMPLATE); + return (role == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER || role == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER || role == OfficeDocumentReportTarget.ROLE_TEMPLATE); } protected void startReportSection(final AttributeMap attrs, final int role) @@ -845,12 +834,12 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget String line = br.readLine(); while (line != null) { - xmlWriter.writeTextNormalized(line, false); - line = br.readLine(); - if (line != null) - { - xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "line-break", XmlWriterSupport.CLOSE); - } + xmlWriter.writeTextNormalized(line, false); + line = br.readLine(); + if (line != null) + { + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "line-break", XmlWriterSupport.CLOSE); + } } } catch (IOException e) @@ -989,9 +978,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget if (DEBUG_ELEMENTS) { - LOGGER.debug("Finished " + getCurrentState() + "/" + states.size() + " " + - ReportTargetUtil.getNamespaceFromAttribute(attrs) + ":" + - ReportTargetUtil.getElemenTypeFromAttribute(attrs)); + LOGGER.debug("Finished " + getCurrentState() + "/" + states.size() + " " + ReportTargetUtil.getNamespaceFromAttribute(attrs) + ":" + ReportTargetUtil.getElemenTypeFromAttribute(attrs)); } } @@ -1122,7 +1109,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget } catch (IOException ioe) { - throw new ReportProcessingException("Unable to create the buffer",ioe); + throw new ReportProcessingException("Unable to create the buffer", ioe); } } @@ -1172,17 +1159,14 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget { final Map.Entry entry = (Map.Entry) entries.next(); final String key = String.valueOf(entry.getKey()); - if (OfficeNamespaces.TABLE_NS.equals(attrNamespace) && - "name".equals(key)) + if (OfficeNamespaces.TABLE_NS.equals(attrNamespace) && "name".equals(key)) { final String tableName = String.valueOf(entry.getValue()); final String saneName = sanitizeName(tableName); attrList.setAttribute(attrNamespace, key, tableNameGenerator.generateName(saneName)); } - else if (OfficeNamespaces.DRAWING_NS.equals(attrNamespace) && - "name".equals(key) && - !"equation".equals(elementType) ) + else if (OfficeNamespaces.DRAWING_NS.equals(attrNamespace) && "name".equals(key) && !"equation".equals(elementType)) { final String objectName = String.valueOf(entry.getValue()); attrList.setAttribute(attrNamespace, key, @@ -1243,11 +1227,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget protected boolean isRepeatingSection() { - return (currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER || - currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER || - currentRole == OfficeDocumentReportTarget.ROLE_PAGE_FOOTER || - currentRole == OfficeDocumentReportTarget.ROLE_PAGE_HEADER || - currentRole == OfficeDocumentReportTarget.ROLE_VARIABLES); + return (currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER || currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER || currentRole == OfficeDocumentReportTarget.ROLE_PAGE_FOOTER || currentRole == OfficeDocumentReportTarget.ROLE_PAGE_HEADER || currentRole == OfficeDocumentReportTarget.ROLE_VARIABLES); } @@ -1309,8 +1289,8 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget final CSSNumericValue normalizedImageHeight = CSSValueResolverUtility.convertLength(height, imageAreaHeightVal.getType()); - final String scale = (String)attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.SCALE); - if ( OfficeToken.NONE.equals(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(); @@ -1379,24 +1359,23 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget imageAreaHeightVal = normalizedImageHeight; } } - else if ( OfficeToken.ISOTROPIC.equals(scale) ) + else if (OfficeToken.ISOTROPIC.equals(scale)) { - final double[] ret = calcPaintSize(imageAreaWidthVal,imageAreaHeightVal,normalizedImageWidth,normalizedImageHeight); + 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); + 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]); + 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 .. + // If we do scale, then we simply use the given image-area-size as valid image size and dont + // care about the image itself .. } else { - LOGGER.debug("There is no image-context, so we have to rely on the image's natural bounds. " + - "This may go awfully wrong."); + LOGGER.debug("There is no image-context, so we have to rely on the image's natural bounds. " + "This may go awfully wrong."); imageAreaWidthVal = image.getWidth(); imageAreaHeightVal = image.getHeight(); } @@ -1653,19 +1632,21 @@ 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) + + 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 ); + 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 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 36dffa290da1..66b0a0435b17 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java @@ -49,7 +49,8 @@ import org.apache.commons.logging.LogFactory; * * @author Ocke Janssen */ -public class OleProducer { +public class OleProducer +{ private static final Log LOGGER = LogFactory.getLog(OleProducer.class); private final InputRepository inputRepository; @@ -59,13 +60,15 @@ public class OleProducer { private final ImageService imageService; private final Integer maxRows; - public OleProducer(final InputRepository inputRepository, - final OutputRepository outputRepository,final ImageService imageService,final DataSourceFactory dataSourceFactory,final Integer maxRows) { - if (inputRepository == null) { + final OutputRepository outputRepository, final ImageService imageService, final DataSourceFactory dataSourceFactory, final Integer maxRows) + { + if (inputRepository == null) + { throw new NullPointerException(); } - if (outputRepository == null) { + if (outputRepository == null) + { throw new NullPointerException(); } @@ -77,15 +80,18 @@ public class OleProducer { this.maxRows = maxRows; } - String produceOle(final String source,final List masterColumns,final List masterValues,final List detailColumns) { + String produceOle(final String source, final List masterColumns, final List masterValues, final List detailColumns) + { InputRepository subInputRepository = null; OutputRepository subOutputRepository = null; String output = ""; - try { + try + { subInputRepository = inputRepository.openInputRepository(source); output = nameGenerator.generateStorageName("Object", null); subOutputRepository = outputRepository.openOutputRepository(output, PentahoReportEngineMetaData.OPENDOCUMENT_CHART); - try { + try + { final PentahoReportEngine engine = new PentahoReportEngine(); final ReportJobDefinition definition = engine.createJobDefinition(); @@ -104,18 +110,27 @@ public class OleProducer { procParms.setProperty(ReportEngineParameterNames.MAXROWS, maxRows); engine.createJob(definition).execute(); - } catch (ReportExecutionException ex) { + } + catch (ReportExecutionException ex) + { LOGGER.error("ReportProcessing failed", ex); - } catch (IOException ex) { + } + catch (IOException ex) + { LOGGER.error("ReportProcessing failed", ex); } - } catch (IOException ex) { + } + catch (IOException ex) + { LOGGER.error("ReportProcessing failed", ex); - } finally { - if (subInputRepository != null) { + } finally + { + if (subInputRepository != null) + { subInputRepository.closeInputRepository(); } - if (subOutputRepository != null) { + if (subOutputRepository != null) + { subOutputRepository.closeOutputRepository(); } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java b/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java index 948e140f76ff..4bccca1e9612 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java @@ -55,6 +55,7 @@ import org.apache.commons.logging.LogFactory; */ public class StyleUtilities { + private static final Log LOGGER = LogFactory.getLog(StyleUtilities.class); private static final String STYLE = "style"; @@ -117,8 +118,7 @@ public class StyleUtilities } inheritanceTracker.add(styleName); - if (stylesCollection.containsStyle(styleFamily, styleName) || - commonCollection.getCommonStyles().containsStyle(styleFamily, styleName)) + if (stylesCollection.containsStyle(styleFamily, styleName) || commonCollection.getCommonStyles().containsStyle(styleFamily, styleName)) { // fine, there's already a copy of the stylesheet. return; @@ -193,7 +193,8 @@ public class StyleUtilities LOGGER.warn("Inconsistent styles: " + styleFamily + ":" + styleParent + " does not exist."); } return preStyle; - } catch (CloneNotSupportedException e) + } + catch (CloneNotSupportedException e) { throw new ReportProcessingException("Failed to derive a stylesheet", e); } @@ -248,7 +249,8 @@ public class StyleUtilities currentFonts.addFontFace((FontFaceElement) element.clone()); } } - } catch (CloneNotSupportedException e) + } + catch (CloneNotSupportedException e) { throw new ReportProcessingException("Failed to clone font-face element"); } @@ -264,12 +266,13 @@ public class StyleUtilities { try { - final Section styleMap = (Section) derivedStyle.findFirstChild(OfficeNamespaces.STYLE_NS,"map"); + final Section styleMap = (Section) derivedStyle.findFirstChild(OfficeNamespaces.STYLE_NS, "map"); if (styleMap != null) { performDataStyleProcessing(styleMap, stylesCollection, predefCollection, "apply-style-name"); } - } catch (Exception e) + } + catch (Exception e) { } } @@ -286,8 +289,7 @@ public class StyleUtilities if (attribute != null) { final String styleName = String.valueOf(attribute); - if (!stylesCollection.getAutomaticStyles().containsDataStyle(styleName) && - !stylesCollection.getCommonStyles().containsDataStyle(styleName)) + if (!stylesCollection.getAutomaticStyles().containsDataStyle(styleName) && !stylesCollection.getCommonStyles().containsDataStyle(styleName)) { try { @@ -313,7 +315,8 @@ public class StyleUtilities derivedStyle = null; } } - } catch (CloneNotSupportedException e) + } + catch (CloneNotSupportedException e) { throw new ReportProcessingException("Failed to copy style. This should not have happened."); } @@ -508,7 +511,8 @@ public class StyleUtilities predefCollection); } return autostyle; - } catch (CloneNotSupportedException e) + } + catch (CloneNotSupportedException e) { throw new ReportProcessingException( "Deriving the style failed. Clone error: ", e); diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java index 4300d44defd3..24fb64d3b95e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.output; import java.io.IOException; @@ -70,305 +68,319 @@ import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport; */ public class StylesWriter { - private final XmlWriter xmlWriter; - private final boolean writeOpeningTag; - - public StylesWriter(final Writer writer) - { - final DefaultTagDescription tagDescription = new DefaultTagDescription(); - tagDescription.configure (JFreeReportBoot.getInstance().getGlobalConfig(), - OfficeDocumentReportTarget.TAG_DEF_PREFIX); - - this.xmlWriter = new XmlWriter(writer, tagDescription); - this.xmlWriter.setAlwaysAddNamespace(true); - this.writeOpeningTag = true; - } - - public StylesWriter(final XmlWriter xmlWriter) - { - this.xmlWriter = xmlWriter; - this.writeOpeningTag = false; - } - - public void writeContentStyles (final OfficeStylesCollection predefined, - final OfficeStylesCollection globals) - throws IOException, ReportProcessingException - { - writeFontFaces(new OfficeStylesCollection[] { globals }); - writeAutomaticStylesSection(new OfficeStylesCollection[] { globals }); - } - - public void writeGlobalStyles (final OfficeStylesCollection predefined, - final OfficeStylesCollection globals) - throws IOException, ReportProcessingException - { - if (writeOpeningTag) - { - performWriteRootTag(); - } - writeFontFaces(new OfficeStylesCollection[] { globals }); - writeAutomaticStylesSection(new OfficeStylesCollection[] { globals }); - writeCommonStylesSection(new OfficeStylesCollection[] { globals }); - writeMasterStylesSection(new OfficeStylesCollection[] { globals }); + private final XmlWriter xmlWriter; + private final boolean writeOpeningTag; - if (writeOpeningTag) + public StylesWriter(final Writer writer) { - xmlWriter.writeCloseTag(); + final DefaultTagDescription tagDescription = new DefaultTagDescription(); + tagDescription.configure(JFreeReportBoot.getInstance().getGlobalConfig(), + OfficeDocumentReportTarget.TAG_DEF_PREFIX); + + this.xmlWriter = new XmlWriter(writer, tagDescription); + this.xmlWriter.setAlwaysAddNamespace(true); + this.writeOpeningTag = true; } - } - - private void writeMasterStylesSection(final OfficeStylesCollection[] osc) - throws IOException - { - xmlWriter.writeTag - (OfficeNamespaces.OFFICE_NS, "master-styles", XmlWriterSupport.OPEN); - for (int sci = 0; sci < osc.length; sci++) + + public StylesWriter(final XmlWriter xmlWriter) { - final OfficeStylesCollection collection = osc[sci]; - final OfficeMasterStyles officeStyles = collection.getMasterStyles(); - final OfficeMasterPage[] officeMasterPages = officeStyles.getAllMasterPages(); - for (int i = 0; i < officeMasterPages.length; i++) - { - final OfficeMasterPage masterPage = officeMasterPages[i]; - writeSection(masterPage); - } - - writeSectionChilds(officeStyles.getOtherNodes().getNodeArray()); + this.xmlWriter = xmlWriter; + this.writeOpeningTag = false; } - xmlWriter.writeCloseTag(); - } - - private void writeCommonStylesSection(final OfficeStylesCollection[] osc) - throws IOException - { - xmlWriter.writeTag - (OfficeNamespaces.OFFICE_NS, "styles", XmlWriterSupport.OPEN); - - for (int sci = 0; sci < osc.length; sci++) + public void writeContentStyles(final OfficeStylesCollection predefined, + final OfficeStylesCollection globals) + throws IOException, ReportProcessingException { - final OfficeStylesCollection collection = osc[sci]; - final OfficeStyles officeStyles = collection.getCommonStyles(); - writeStyles(officeStyles); + writeFontFaces(new OfficeStylesCollection[] + { + globals + }); + writeAutomaticStylesSection(new OfficeStylesCollection[] + { + globals + }); } - xmlWriter.writeCloseTag(); - } - - private void writeAutomaticStylesSection(final OfficeStylesCollection[] osc) - throws IOException - { - xmlWriter.writeTag - (OfficeNamespaces.OFFICE_NS, "automatic-styles", XmlWriterSupport.OPEN); - for (int sci = 0; sci < osc.length; sci++) + public void writeGlobalStyles(final OfficeStylesCollection predefined, + final OfficeStylesCollection globals) + throws IOException, ReportProcessingException { - final OfficeStylesCollection collection = osc[sci]; - final OfficeStyles officeStyles = collection.getAutomaticStyles(); - writeStyles(officeStyles); + if (writeOpeningTag) + { + performWriteRootTag(); + } + + writeFontFaces(new OfficeStylesCollection[] + { + globals + }); + writeAutomaticStylesSection(new OfficeStylesCollection[] + { + globals + }); + writeCommonStylesSection(new OfficeStylesCollection[] + { + globals + }); + writeMasterStylesSection(new OfficeStylesCollection[] + { + globals + }); + + if (writeOpeningTag) + { + xmlWriter.writeCloseTag(); + } } - xmlWriter.writeCloseTag(); - } - - private void writeFontFaces(final OfficeStylesCollection[] osc) - throws IOException - { - xmlWriter.writeTag - (OfficeNamespaces.OFFICE_NS, "font-face-decls", XmlWriterSupport.OPEN); - - final TreeMap fontFaces = new TreeMap(); - for (int sci = 0; sci < osc.length; sci++) + private void writeMasterStylesSection(final OfficeStylesCollection[] osc) + throws IOException { - final OfficeStylesCollection collection = osc[sci]; - final FontFaceDeclsSection fontFaceDecls = collection.getFontFaceDecls(); - final FontFaceElement[] fontFaceElements = fontFaceDecls.getAllFontFaces(); - for (int i = 0; i < fontFaceElements.length; i++) - { - final FontFaceElement element = fontFaceElements[i]; - fontFaces.put (element.getStyleName(), element); - } + xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "master-styles", XmlWriterSupport.OPEN); + for (int sci = 0; sci < osc.length; sci++) + { + final OfficeStylesCollection collection = osc[sci]; + final OfficeMasterStyles officeStyles = collection.getMasterStyles(); + final OfficeMasterPage[] officeMasterPages = officeStyles.getAllMasterPages(); + for (int i = 0; i < officeMasterPages.length; i++) + { + final OfficeMasterPage masterPage = officeMasterPages[i]; + writeSection(masterPage); + } + + writeSectionChilds(officeStyles.getOtherNodes().getNodeArray()); + } + + xmlWriter.writeCloseTag(); } - final Iterator values = fontFaces.values().iterator(); - while (values.hasNext()) + private void writeCommonStylesSection(final OfficeStylesCollection[] osc) + throws IOException { - final FontFaceElement element = (FontFaceElement) values.next(); - writeElement(element); - } + xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "styles", XmlWriterSupport.OPEN); - xmlWriter.writeCloseTag(); - } + for (int sci = 0; sci < osc.length; sci++) + { + final OfficeStylesCollection collection = osc[sci]; + final OfficeStyles officeStyles = collection.getCommonStyles(); + writeStyles(officeStyles); + } - private void writeStyles (final OfficeStyles styles) - throws IOException - { - final OfficeStyle[] allStyles = styles.getAllStyles(); - for (int i = 0; i < allStyles.length; i++) - { - final OfficeStyle style = allStyles[i]; - writeSection(style); + xmlWriter.writeCloseTag(); } - final DataStyle[] allDataStyles = styles.getAllDataStyles(); - for (int i = 0; i < allDataStyles.length; i++) + private void writeAutomaticStylesSection(final OfficeStylesCollection[] osc) + throws IOException { - final DataStyle style = allDataStyles[i]; - writeSection(style); + xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "automatic-styles", XmlWriterSupport.OPEN); + for (int sci = 0; sci < osc.length; sci++) + { + final OfficeStylesCollection collection = osc[sci]; + final OfficeStyles officeStyles = collection.getAutomaticStyles(); + writeStyles(officeStyles); + } + + xmlWriter.writeCloseTag(); } - final PageLayout[] allPageStyles = styles.getAllPageStyles(); - for (int i = 0; i < allPageStyles.length; i++) + private void writeFontFaces(final OfficeStylesCollection[] osc) + throws IOException { - final PageLayout style = allPageStyles[i]; - writeSection(style); + xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "font-face-decls", XmlWriterSupport.OPEN); + + final TreeMap fontFaces = new TreeMap(); + for (int sci = 0; sci < osc.length; sci++) + { + final OfficeStylesCollection collection = osc[sci]; + final FontFaceDeclsSection fontFaceDecls = collection.getFontFaceDecls(); + final FontFaceElement[] fontFaceElements = fontFaceDecls.getAllFontFaces(); + for (int i = 0; i < fontFaceElements.length; i++) + { + final FontFaceElement element = fontFaceElements[i]; + fontFaces.put(element.getStyleName(), element); + } + } + + final Iterator values = fontFaces.values().iterator(); + while (values.hasNext()) + { + final FontFaceElement element = (FontFaceElement) values.next(); + writeElement(element); + } + + xmlWriter.writeCloseTag(); } - writeSectionChilds(styles.getOtherStyles()); - } - - private void writeElement (final Element element) - throws IOException - { - final String type = element.getType(); - final String namespace = element.getNamespace(); - final AttributeList attrList = buildAttributeList(element.getAttributeMap()); - xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.CLOSE); - } - - private void writeSection (final Section section) - throws IOException - { - final String type = section.getType(); - final String namespace = section.getNamespace(); - final AttributeList attrList = buildAttributeList(section.getAttributeMap()); - if (section.getNodeCount() == 0) + private void writeStyles(final OfficeStyles styles) + throws IOException { - xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.CLOSE); - return; + final OfficeStyle[] allStyles = styles.getAllStyles(); + for (int i = 0; i < allStyles.length; i++) + { + final OfficeStyle style = allStyles[i]; + writeSection(style); + } + + final DataStyle[] allDataStyles = styles.getAllDataStyles(); + for (int i = 0; i < allDataStyles.length; i++) + { + final DataStyle style = allDataStyles[i]; + writeSection(style); + } + + final PageLayout[] allPageStyles = styles.getAllPageStyles(); + for (int i = 0; i < allPageStyles.length; i++) + { + final PageLayout style = allPageStyles[i]; + writeSection(style); + } + + writeSectionChilds(styles.getOtherStyles()); } - xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.OPEN); - writeSectionChilds(section.getNodeArray()); - - xmlWriter.writeCloseTag(); - } - - private void writeSectionChilds(final Node[] nodes) - throws IOException - { - for (int i = 0; i < nodes.length; i++) + private void writeElement(final Element element) + throws IOException { - final Node node = nodes[i]; - if (node instanceof Section) - { - writeSection((Section) node); - } - else if (node instanceof Element) - { - writeElement((Element) node); - } - else if (node instanceof RawText) - { - final RawText text = (RawText) node; - xmlWriter.writeText(text.getText()); - } - else if (node instanceof StaticText) - { - final StaticText text = (StaticText) node; - xmlWriter.writeTextNormalized(text.getText(), false); - } + final String type = element.getType(); + final String namespace = element.getNamespace(); + final AttributeList attrList = buildAttributeList(element.getAttributeMap()); + xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.CLOSE); } - } - protected AttributeList buildAttributeList(final AttributeMap attrs) - { - final AttributeList attrList = new AttributeList(); - final String[] namespaces = attrs.getNameSpaces(); - for (int i = 0; i < namespaces.length; i++) + private void writeSection(final Section section) + throws IOException { - final String attrNamespace = namespaces[i]; - if (isFilteredNamespace(attrNamespace)) - { - continue; - } - - final Map localAttributes = attrs.getAttributes(attrNamespace); - final Iterator entries = localAttributes.entrySet().iterator(); - while (entries.hasNext()) - { - final Map.Entry entry = (Map.Entry) entries.next(); - final String key = String.valueOf(entry.getKey()); - attrList.setAttribute(attrNamespace, key, String.valueOf(entry.getValue())); - } + final String type = section.getType(); + final String namespace = section.getNamespace(); + final AttributeList attrList = buildAttributeList(section.getAttributeMap()); + if (section.getNodeCount() == 0) + { + xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.CLOSE); + return; + } + + xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.OPEN); + writeSectionChilds(section.getNodeArray()); + + xmlWriter.writeCloseTag(); } - return attrList; - } - protected boolean isFilteredNamespace(final String namespace) - { - if (Namespaces.LIBLAYOUT_NAMESPACE.equals(namespace)) + private void writeSectionChilds(final Node[] nodes) + throws IOException { - return true; + for (int i = 0; i < nodes.length; i++) + { + final Node node = nodes[i]; + if (node instanceof Section) + { + writeSection((Section) node); + } + else if (node instanceof Element) + { + writeElement((Element) node); + } + else if (node instanceof RawText) + { + final RawText text = (RawText) node; + xmlWriter.writeText(text.getText()); + } + else if (node instanceof StaticText) + { + final StaticText text = (StaticText) node; + xmlWriter.writeTextNormalized(text.getText(), false); + } + } } - if (JFreeReportInfo.REPORT_NAMESPACE.equals(namespace)) + + protected AttributeList buildAttributeList(final AttributeMap attrs) { - return true; + final AttributeList attrList = new AttributeList(); + final String[] namespaces = attrs.getNameSpaces(); + for (int i = 0; i < namespaces.length; i++) + { + final String attrNamespace = namespaces[i]; + if (isFilteredNamespace(attrNamespace)) + { + continue; + } + + final Map localAttributes = attrs.getAttributes(attrNamespace); + final Iterator entries = localAttributes.entrySet().iterator(); + while (entries.hasNext()) + { + final Map.Entry entry = (Map.Entry) entries.next(); + final String key = String.valueOf(entry.getKey()); + attrList.setAttribute(attrNamespace, key, String.valueOf(entry.getValue())); + } + } + return attrList; } - if (JFreeReportInfo.COMPATIBILITY_NAMESPACE.equals(namespace)) + + protected boolean isFilteredNamespace(final String namespace) { - return true; + if (Namespaces.LIBLAYOUT_NAMESPACE.equals(namespace)) + { + return true; + } + if (JFreeReportInfo.REPORT_NAMESPACE.equals(namespace)) + { + return true; + } + if (JFreeReportInfo.COMPATIBILITY_NAMESPACE.equals(namespace)) + { + return true; + } + if (OfficeNamespaces.OOREPORT_NS.equals(namespace)) + { + return true; + } + return false; } - if (OfficeNamespaces.OOREPORT_NS.equals(namespace)) + + private void performWriteRootTag() + throws IOException { - return true; + final AttributeList rootAttributes = new AttributeList(); + rootAttributes.addNamespaceDeclaration("office", + OfficeNamespaces.OFFICE_NS); + rootAttributes.addNamespaceDeclaration("style", OfficeNamespaces.STYLE_NS); + rootAttributes.addNamespaceDeclaration("text", OfficeNamespaces.TEXT_NS); + rootAttributes.addNamespaceDeclaration("table", OfficeNamespaces.TABLE_NS); + rootAttributes.addNamespaceDeclaration("draw", OfficeNamespaces.DRAWING_NS); + rootAttributes.addNamespaceDeclaration("fo", OfficeNamespaces.FO_NS); + rootAttributes.addNamespaceDeclaration("xlink", OfficeNamespaces.XLINK_NS); + rootAttributes.addNamespaceDeclaration("dc", OfficeNamespaces.PURL_NS); + rootAttributes.addNamespaceDeclaration("meta", OfficeNamespaces.META_NS); + rootAttributes.addNamespaceDeclaration("number", + OfficeNamespaces.DATASTYLE_NS); + rootAttributes.addNamespaceDeclaration("svg", OfficeNamespaces.SVG_NS); + rootAttributes.addNamespaceDeclaration("chart", OfficeNamespaces.CHART_NS); + rootAttributes.addNamespaceDeclaration("dr3d", OfficeNamespaces.DR3D_NS); + rootAttributes.addNamespaceDeclaration("math", OfficeNamespaces.MATHML_NS); + rootAttributes.addNamespaceDeclaration("form", OfficeNamespaces.FORM_NS); + rootAttributes.addNamespaceDeclaration("script", + OfficeNamespaces.SCRIPT_NS); + rootAttributes.addNamespaceDeclaration("ooo", OfficeNamespaces.OO2004_NS); + rootAttributes.addNamespaceDeclaration("ooow", OfficeNamespaces.OOW2004_NS); + rootAttributes.addNamespaceDeclaration("oooc", OfficeNamespaces.OOC2004_NS); + rootAttributes.addNamespaceDeclaration("dom", + OfficeNamespaces.XML_EVENT_NS); + rootAttributes.addNamespaceDeclaration("xforms", + OfficeNamespaces.XFORMS_NS); + rootAttributes.addNamespaceDeclaration("xsd", OfficeNamespaces.XSD_NS); + rootAttributes.addNamespaceDeclaration("xsi", OfficeNamespaces.XSI_NS); + rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.0"); + + this.xmlWriter.writeXmlDeclaration("UTF-8"); + this.xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, + "document-content", rootAttributes, XmlWriterSupport.OPEN); } - return false; - } - - private void performWriteRootTag() - throws IOException - { - final AttributeList rootAttributes = new AttributeList(); - rootAttributes.addNamespaceDeclaration("office", - OfficeNamespaces.OFFICE_NS); - rootAttributes.addNamespaceDeclaration("style", OfficeNamespaces.STYLE_NS); - rootAttributes.addNamespaceDeclaration("text", OfficeNamespaces.TEXT_NS); - rootAttributes.addNamespaceDeclaration("table", OfficeNamespaces.TABLE_NS); - rootAttributes.addNamespaceDeclaration("draw", OfficeNamespaces.DRAWING_NS); - rootAttributes.addNamespaceDeclaration("fo", OfficeNamespaces.FO_NS); - rootAttributes.addNamespaceDeclaration("xlink", OfficeNamespaces.XLINK_NS); - rootAttributes.addNamespaceDeclaration("dc", OfficeNamespaces.PURL_NS); - rootAttributes.addNamespaceDeclaration("meta", OfficeNamespaces.META_NS); - rootAttributes.addNamespaceDeclaration("number", - OfficeNamespaces.DATASTYLE_NS); - rootAttributes.addNamespaceDeclaration("svg", OfficeNamespaces.SVG_NS); - rootAttributes.addNamespaceDeclaration("chart", OfficeNamespaces.CHART_NS); - rootAttributes.addNamespaceDeclaration("dr3d", OfficeNamespaces.DR3D_NS); - rootAttributes.addNamespaceDeclaration("math", OfficeNamespaces.MATHML_NS); - rootAttributes.addNamespaceDeclaration("form", OfficeNamespaces.FORM_NS); - rootAttributes.addNamespaceDeclaration("script", - OfficeNamespaces.SCRIPT_NS); - rootAttributes.addNamespaceDeclaration("ooo", OfficeNamespaces.OO2004_NS); - rootAttributes.addNamespaceDeclaration("ooow", OfficeNamespaces.OOW2004_NS); - rootAttributes.addNamespaceDeclaration("oooc", OfficeNamespaces.OOC2004_NS); - rootAttributes.addNamespaceDeclaration("dom", - OfficeNamespaces.XML_EVENT_NS); - rootAttributes.addNamespaceDeclaration("xforms", - OfficeNamespaces.XFORMS_NS); - rootAttributes.addNamespaceDeclaration("xsd", OfficeNamespaces.XSD_NS); - rootAttributes.addNamespaceDeclaration("xsi", OfficeNamespaces.XSI_NS); - rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.0"); - - this.xmlWriter.writeXmlDeclaration("UTF-8"); - this.xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, - "document-content", rootAttributes, XmlWriterSupport.OPEN); - } - - public void close() - throws IOException - { - xmlWriter.close(); - } + public void close() + throws IOException + { + xmlWriter.close(); + } } 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 9328be4fd031..05e70d1e49e2 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 @@ -138,21 +138,19 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget } catch (IOException e) { - throw new ReportProcessingException("Failed", e); + throw new ReportProcessingException(OfficeDocumentReportTarget.FAILED, e); } } } private boolean isFiltered(final String elementType) { - return OfficeToken.TABLE_HEADER_COLUMNS.equals(elementType) || - OfficeToken.TABLE_HEADER_ROWS.equals(elementType) || - OfficeToken.TABLE_COLUMNS.equals(elementType); + return OfficeToken.TABLE_HEADER_COLUMNS.equals(elementType) || OfficeToken.TABLE_HEADER_ROWS.equals(elementType) || OfficeToken.TABLE_COLUMNS.equals(elementType); } protected void endOther(final AttributeMap attrs) throws IOException, DataSourceException, ReportProcessingException { - if ( tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE) + if (tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE) { return; } @@ -163,8 +161,7 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget // if this is the report namespace, write out a table definition .. if (OfficeNamespaces.TABLE_NS.equals(namespace)) { - if (OfficeToken.TABLE.equals(elementType) || - OfficeToken.TABLE_ROWS.equals(elementType)) + if (OfficeToken.TABLE.equals(elementType) || OfficeToken.TABLE_ROWS.equals(elementType)) { return; } @@ -194,7 +191,7 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget public void processContent(final DataFlags value) throws DataSourceException, ReportProcessingException { - if ( !(tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE)) + if (!(tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE)) { super.processContent(value); } @@ -203,7 +200,7 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget private void processElement(final AttributeMap attrs, final String namespace, final String elementType) throws IOException, ReportProcessingException { - if ( tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE) + if (tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE) { return; } @@ -247,9 +244,10 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget final XmlWriter xmlWriter = getXmlWriter(); xmlWriter.writeTag(namespace, elementType, attrList, XmlWriter.OPEN); ++closeTags; - // System.out.println("elementType = " + elementType); + // System.out.println("elementType = " + elementType); } // ///////////////////////////////////////////////////////////////////////// + public void processText(final String text) throws DataSourceException, ReportProcessingException { if (inFilterElements && tableCount > 1) @@ -258,6 +256,7 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget } super.processText(text); } + public void endReport(final ReportStructureRoot report) throws DataSourceException, ReportProcessingException { @@ -281,7 +280,7 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget } catch (IOException ioe) { - throw new ReportProcessingException("Failed to write settings document",ioe); + throw new ReportProcessingException("Failed to write settings document", ioe); } } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java index 268450de3b08..ddc644d52ef3 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java @@ -115,7 +115,7 @@ public class SpreadsheetRawReportProcessor extends AbstractReportProcessor if (context instanceof ReportContextImpl) { final ReportContextImpl impl = (ReportContextImpl) context; - impl.setFormulaContext(new PentahoFormulaContext(impl.getFormulaContext(),job.getConfiguration())); + impl.setFormulaContext(new PentahoFormulaContext(impl.getFormulaContext(), job.getConfiguration())); } return context; } 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 3be3c523662e..01e5135c3613 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 @@ -130,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; } @@ -150,11 +150,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget public boolean equals(final Object obj) { - if ( obj instanceof ColumnBoundary ) - { - return ((ColumnBoundary) obj).boundary == boundary; - } - return false; + return obj instanceof ColumnBoundary && ((ColumnBoundary) obj).boundary == boundary; } public int hashCode() @@ -164,7 +160,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget } } 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; @@ -181,14 +177,14 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget 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(); @@ -201,9 +197,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); } @@ -211,24 +207,24 @@ 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(); @@ -239,7 +235,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(); @@ -249,9 +245,9 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget } return; } - if ( oleHandled ) + if (oleHandled) { - if ( isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE ) + if (isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE) { ole.add(attrs); } @@ -259,14 +255,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); } @@ -277,19 +273,16 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget { processElement(attrs, namespace, elementType); } - catch ( IOException e ) + catch (IOException e) { - throw new ReportProcessingException("Failed", e); + throw new ReportProcessingException(OfficeDocumentReportTarget.FAILED, e); } } } 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); } @@ -301,10 +294,7 @@ 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(); } @@ -316,7 +306,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget private void handleParagraph() { - if ( paragraphFound ) + if (paragraphFound) { try { @@ -325,7 +315,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget paragraphHandled = true; paragraphFound = false; } - catch ( IOException ex ) + catch (IOException ex) { LOGGER.error("ReportProcessing failed", ex); } @@ -333,25 +323,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(); - 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; } @@ -363,29 +353,28 @@ 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); } @@ -393,17 +382,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); @@ -414,7 +403,7 @@ 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); } @@ -422,33 +411,33 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget 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 Section textProperties = (Section) cellStyle.getTextProperties(); - if ( textProperties != null ) + if (textProperties != null) { - for ( String i : FOPROPS ) + for (String i : FOPROPS) { textProperties.setAttribute(OfficeNamespaces.FO_NS, i, null); } textProperties.setAttribute(OfficeNamespaces.TEXT_NS, "display", null); - for ( String i : STYLEPROPS ) + for (String i : STYLEPROPS) { textProperties.setAttribute(OfficeNamespaces.STYLE_NS, i, null); } } final Section props = (Section) cellStyle.getTableCellProperties(); - if ( props != null ) + if (props != null) { final Object raw = props.getAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR); - if ( TRANSPARENT.equals(raw) ) + if (TRANSPARENT.equals(raw)) { props.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, null); // cellStyle.removeNode(props); @@ -458,15 +447,15 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, styleName); } - final String numColSpanStr = (String) attrs.getAttribute(namespace,NUMBERCOLUMNSSPANNED); + 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; @@ -486,9 +475,9 @@ 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) { - attrs.setAttribute(namespace,NUMBERCOLUMNSSPANNED, "" + span); + attrs.setAttribute(namespace, NUMBERCOLUMNSSPANNED, "" + span); currentSpan = span; } // we must also generate "covered-table-cell" elements for each column spanned @@ -506,22 +495,22 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget 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; @@ -535,7 +524,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget ColumnBoundary currentRowBoundary = new ColumnBoundary(getCurrentRowBoundaryMarker()); final List columnBoundaryList_ = getColumnBoundaryList(); final int idx = columnBoundaryList_.indexOf(currentRowBoundary); - if ( idx == -1 ) + if (idx == -1) { columnBoundaryList_.add(currentRowBoundary); } @@ -549,9 +538,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; @@ -559,10 +548,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; } @@ -574,7 +563,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget private void createTableShapes() throws ReportProcessingException { - if ( !shapes.isEmpty() ) + if (!shapes.isEmpty()) { try { @@ -587,7 +576,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); @@ -599,9 +588,9 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget } xmlWriter.writeCloseTag(); } - catch ( IOException e ) + catch (IOException e) { - throw new ReportProcessingException("Failed", e); + throw new ReportProcessingException(OfficeDocumentReportTarget.FAILED, e); } } } @@ -622,11 +611,11 @@ 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(); } @@ -644,54 +633,51 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget } xmlWriter.writeCloseTag(); } - catch ( IOException e ) + catch (IOException e) { - throw new ReportProcessingException("Failed", e); + throw new ReportProcessingException(OfficeDocumentReportTarget.FAILED, e); } } 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; } @@ -706,15 +692,15 @@ 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); + throw new ReportProcessingException(OfficeDocumentReportTarget.FAILED, e); } } 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; } @@ -725,7 +711,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget // final int span = TextUtilities.parseInt((String) attribute, 0); final int span = currentSpan; currentSpan = 0; - for ( int i = 1; i < span; i++ ) + for (int i = 1; i < span; i++) { xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.COVERED_TABLE_CELL, null, XmlWriter.CLOSE); } @@ -739,7 +725,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); @@ -748,7 +734,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); @@ -761,9 +747,9 @@ 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); @@ -788,7 +774,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(); @@ -797,7 +783,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"; @@ -808,13 +794,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); @@ -823,8 +809,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); } @@ -840,10 +826,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(); @@ -871,10 +857,10 @@ 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); + sortedBoundaryArray = (ColumnBoundary[]) getColumnBoundaryList().toArray(new ColumnBoundary[getColumnBoundaryList().size()]); Arrays.sort(sortedBoundaryArray); } return sortedBoundaryArray; @@ -907,19 +893,19 @@ 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); } } - boundariesForTableArray = (ColumnBoundary[]) boundariesForTable.toArray(EMPTY_COLBOUNDS); + boundariesForTableArray = (ColumnBoundary[]) boundariesForTable.toArray(new ColumnBoundary[boundariesForTable.size()]); Arrays.sort(boundariesForTableArray); } return boundariesForTableArray; @@ -935,12 +921,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); @@ -950,21 +936,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 0a5988a44b94..ca3047a16c16 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 @@ -178,13 +178,9 @@ public class MasterPageFactory { return false; } - if (templateName != null ? !templateName.equals( - key.templateName) : key.templateName != null) - { - return false; - } + return !(templateName != null ? !templateName.equals( + key.templateName) : key.templateName != null); - return true; } public int hashCode() @@ -196,7 +192,6 @@ public class MasterPageFactory return result; } } - // todo: Patch the page-layout ... private static final String DEFAULT_PAGE_NAME = "Default"; private final OfficeMasterStyles predefinedStyles; @@ -265,7 +260,7 @@ public class MasterPageFactory } catch (CloneNotSupportedException cne) { - throw new IllegalStateException("Implementation error: Unable to derive page",cne); + throw new IllegalStateException("Implementation error: Unable to derive page", cne); } } @@ -403,7 +398,7 @@ public class MasterPageFactory } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Clone failed.",e); + 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 88c2742c91d5..740582c9b347 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 @@ -75,7 +75,7 @@ public class PageContext // TODO: IS this code correct? Why not columnCount = pc.getColumnCount(); ? if (columnCount != null) { - return columnCount.intValue(); + return columnCount; } pc = pc.getParent(); } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java index 16374193aec8..3b23ffb4c3df 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java @@ -108,7 +108,7 @@ public class TextRawReportProcessor extends SinglePassReportProcessor if (context instanceof ReportContextImpl) { final ReportContextImpl impl = (ReportContextImpl) context; - impl.setFormulaContext(new PentahoFormulaContext(impl.getFormulaContext(),job.getConfiguration())); + impl.setFormulaContext(new PentahoFormulaContext(impl.getFormulaContext(), job.getConfiguration())); } return context; } 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 cdbb36abc337..947087a17c11 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 @@ -100,7 +100,6 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget private static final int CP_SETUP = 0; private static final int CP_FIRST_TABLE = 1; private static final int CP_NEXT_TABLE = 2; - // This is the initial state of the detail-band processing. It states, that we are now waiting for a // detail-band to be printed. private static final int DETAIL_SECTION_WAIT = 0; @@ -166,11 +165,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget private boolean isResetPageNumber() { - if (pageBreakDefinition == null) - { - return false; - } - return pageBreakDefinition.isResetPageNumber(); + return pageBreakDefinition != null && pageBreakDefinition.isResetPageNumber(); } /** @@ -198,14 +193,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget } final boolean keepWithNext; - if (keepTogetherState == PageContext.KEEP_TOGETHER_FIRST_DETAIL) - { - keepWithNext = (detailBandProcessingState == DETAIL_SECTION_WAIT); - } - else - { - keepWithNext = false; - } + keepWithNext = keepTogetherState == PageContext.KEEP_TOGETHER_FIRST_DETAIL && (detailBandProcessingState == DETAIL_SECTION_WAIT); return keepWithNext; } @@ -213,15 +201,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget { final Object forceNewPage = attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "force-new-page"); - if ("after-section".equals(forceNewPage)) - { - return true; - } - if ("before-after-section".equals(forceNewPage)) - { - return true; - } - return false; + return "after-section".equals(forceNewPage) || "before-after-section".equals(forceNewPage); } private boolean isSectionPagebreakBefore(final AttributeMap attrs) @@ -268,8 +248,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget } final String masterPageName; - if (currentMasterPage == null || - !masterPageFactory.containsMasterPage(STANDARD, activePageHeader, activePageFooter)) + if (currentMasterPage == null || !masterPageFactory.containsMasterPage(STANDARD, activePageHeader, activePageFooter)) { final CSSNumericValue headerSize = context.getAllHeaderSize(); @@ -325,8 +304,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget // report header, then this implies that we have to insert a manual // pagebreak at the end of the section. - if ((!printHeader && context.getHeader() != null) || - (!printFooter && context.getFooter() != null)) + if ((!printHeader && context.getHeader() != null) || (!printFooter && context.getFooter() != null)) { setPagebreakDefinition(new PageBreakDefinition(isResetPageNumber())); } @@ -577,15 +555,13 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget } else if (isFilteredNamespace(namespace)) { - throw new IllegalStateException("This element should be hidden: " + - namespace + ", " + elementType); + throw new IllegalStateException("This element should be hidden: " + namespace + ", " + elementType); } if (isTableMergeActive() && detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED && ObjectUtilities.equal(OfficeNamespaces.TABLE_NS, namespace) && ObjectUtilities.equal(OfficeToken.TABLE_COLUMNS, elementType)) { // Skip the columns section if the tables get merged.. startBuffering(getStylesCollection(), true); - return; } else { @@ -624,8 +600,8 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget final String varType = (String) attrs.getAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE); final String newVarName = variablesDeclarations.produceVariable(varName, varType); attrs.setAttribute(OfficeNamespaces.TEXT_NS, NAME, newVarName); - // this one must not be written, as the DTD does not declare it. - // attrs.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE, null); + // this one must not be written, as the DTD does not declare it. + // attrs.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE, null); } } @@ -724,7 +700,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "flow-with-text", "false"); graphicProperties.setAttribute(OfficeNamespaces.DRAWING_NS, "ole-draw-aspect", "1"); - // attrs.setAttribute(OfficeNamespaces.DRAWING_NS, OfficeToken.STYLE_NAME, predefAutoStyle.getStyleName()); + // attrs.setAttribute(OfficeNamespaces.DRAWING_NS, OfficeToken.STYLE_NAME, predefAutoStyle.getStyleName()); } } @@ -734,11 +710,10 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget final AttributeList attrList = buildAttributeList(attrs); xmlWriter.writeTag(namespace, elementType, attrList, XmlWriterSupport.OPEN); - if ( tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH + if (tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH && variables != null && !isRepeatingSection() - && ReportTargetUtil.isElementOfType(OfficeNamespaces.TEXT_NS, OfficeToken.P, attrs) - ) + && ReportTargetUtil.isElementOfType(OfficeNamespaces.TEXT_NS, OfficeToken.P, attrs)) { //LOGGER.debug("Variables-Section in existing cell " + variables); xmlWriter.writeText(variables); @@ -785,7 +760,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget } else { - expectedTableRowCount = trc.intValue(); + expectedTableRowCount = trc; } if (isSectionPagebreakBefore(attrs)) @@ -822,16 +797,15 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget // If we have a manual pagebreak, then activate the current master-page again. masterPageName = currentMasterPage.getStyleName(); } - // But we skip this (and therefore the resulting pagebreak) if there is no manual break - // and no other condition that would force an break. + // But we skip this (and therefore the resulting pagebreak) if there is no manual break + // and no other condition that would force an break. } else if (currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER || currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER) { breakDefinition = null; - // no pagebreaks .. + // no pagebreaks .. } - else if (currentMasterPage == null || - isPagebreakPending()) + else if (currentMasterPage == null || isPagebreakPending()) { // Must be the first table, as we have no master-page yet. masterPageName = createMasterPage(true, true); @@ -848,9 +822,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget breakDefinition = null; } } - else if (isPagebreakPending() && - currentRole != OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER && - currentRole != OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER) + else if (isPagebreakPending() && currentRole != OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER && currentRole != OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER) { // Derive an automatic style for the pagebreak. // LOGGER.debug("Manual pagebreak (within the section): " + getCurrentRole()); @@ -869,8 +841,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget } final XmlWriter xmlWriter = getXmlWriter(); - if (detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED && - masterPageName != null) + if (detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED && masterPageName != null) { // close the last table-tag, we will open a new one xmlWriter.writeCloseTag(); @@ -903,7 +874,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME, style.getStyleName(), XmlWriterSupport.OPEN); masterPageName = null; - //breakDefinition = null; + //breakDefinition = null; } else if (isColumnBreakPending()) { @@ -935,19 +906,10 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget final boolean keepWithNext = isKeepTableWithNext(); final boolean localKeepTogether = OfficeToken.TRUE.equals(attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, KEEP_TOGETHER)); final boolean tableMergeActive = isTableMergeActive(); - if (tableMergeActive) - { - this.sectionKeepTogether = localKeepTogether; - } - else - { - this.sectionKeepTogether = false; - - } + this.sectionKeepTogether = tableMergeActive && localKeepTogether; // Check, whether we have a reason to derive a style... - if (masterPageName != null || - (!tableMergeActive && (localKeepTogether || keepWithNext)) || isColumnBreakPending()) + if (masterPageName != null || (!tableMergeActive && (localKeepTogether || keepWithNext)) || isColumnBreakPending()) { final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); final OfficeStyle style = deriveStyle("table", styleName); @@ -1009,8 +971,8 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget } } attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName()); - // no need to copy the styles, this was done while deriving the - // style .. + // no need to copy the styles, this was done while deriving the + // style .. } else { @@ -1074,8 +1036,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget private boolean isTableMergeActive() { - return getCurrentRole() == ROLE_DETAIL && - tableLayoutConfig == TABLE_LAYOUT_SINGLE_DETAIL_TABLE; + return getCurrentRole() == ROLE_DETAIL && tableLayoutConfig == TABLE_LAYOUT_SINGLE_DETAIL_TABLE; } private void openSection() @@ -1086,9 +1047,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget // repeating sections have other ways of defining columns .. return; } - if (getCurrentRole() == ROLE_TEMPLATE || - getCurrentRole() == ROLE_SPREADSHEET_PAGE_HEADER || - getCurrentRole() == ROLE_SPREADSHEET_PAGE_FOOTER) + if (getCurrentRole() == ROLE_TEMPLATE || getCurrentRole() == ROLE_SPREADSHEET_PAGE_HEADER || getCurrentRole() == ROLE_SPREADSHEET_PAGE_FOOTER) { // the template section would break the multi-column stuff and we dont open up sections there // anyway .. @@ -1100,7 +1059,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget if (columnCount != null && !pageContext.isSectionOpen()) { final AttributeList attrs = new AttributeList(); - attrs.setAttribute(OfficeNamespaces.TEXT_NS, OfficeToken.STYLE_NAME, generateSectionStyle(columnCount.intValue())); + attrs.setAttribute(OfficeNamespaces.TEXT_NS, OfficeToken.STYLE_NAME, generateSectionStyle(columnCount)); attrs.setAttribute(OfficeNamespaces.TEXT_NS, NAME, sectionNames.generateName("Section")); getXmlWriter().writeTag(OfficeNamespaces.TEXT_NS, "section", attrs, XmlWriterSupport.OPEN); @@ -1113,9 +1072,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget throws IOException, DataSourceException, ReportProcessingException { sectionHeight = new LengthCalculator(); - if (role == OfficeDocumentReportTarget.ROLE_TEMPLATE || - role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || - role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) + if (role == OfficeDocumentReportTarget.ROLE_TEMPLATE || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) { // Start buffering with an dummy styles-collection, so that the global styles dont get polluted .. startBuffering(new OfficeStylesCollection(), true); @@ -1241,9 +1198,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget protected void endReportSection(final AttributeMap attrs, final int role) throws IOException, DataSourceException, ReportProcessingException { - if (role == ROLE_TEMPLATE || - role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || - role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) + if (role == ROLE_TEMPLATE || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) { finishBuffering(); return; @@ -1369,16 +1324,13 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget return; } - if (isInternalNS && (ObjectUtilities.equal(OfficeToken.IMAGE, elementType) || - ObjectUtilities.equal(OfficeToken.OBJECT_OLE, elementType))) + if (isInternalNS && (ObjectUtilities.equal(OfficeToken.IMAGE, elementType) || ObjectUtilities.equal(OfficeToken.OBJECT_OLE, elementType))) { return; } final XmlWriter xmlWriter = getXmlWriter(); - if (tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH && - isTableNs && ObjectUtilities.equal(OfficeToken.TABLE_CELL, elementType) && - !isRepeatingSection() ) + if (tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH && isTableNs && ObjectUtilities.equal(OfficeToken.TABLE_CELL, elementType) && !isRepeatingSection()) { if (variables != null) { @@ -1403,19 +1355,19 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget xmlWriter.writeCloseTag(); variables = null; } - /** - // Only generate the empty paragraph, if we have to add the keep-together .. - else if (cellEmpty && expectedTableRowCount > 0 && - sectionKeepTogether && !firstCellSeen) - { - // we have no variables .. - StyleUtilities.copyStyle(OfficeToken.PARAGRAPH, - TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(), - getGlobalStylesCollection(), getPredefinedStylesCollection()); - xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME, - TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.CLOSE); - } - */ + /** + // Only generate the empty paragraph, if we have to add the keep-together .. + else if (cellEmpty && expectedTableRowCount > 0 && + sectionKeepTogether && !firstCellSeen) + { + // we have no variables .. + StyleUtilities.copyStyle(OfficeToken.PARAGRAPH, + TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(), + getGlobalStylesCollection(), getPredefinedStylesCollection()); + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME, + TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.CLOSE); + } + */ } if (isTableNs && (ObjectUtilities.equal(OfficeToken.TABLE_CELL, elementType) || ObjectUtilities.equal(OfficeToken.COVERED_TABLE_CELL, elementType))) diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/AttributeSpecification.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/AttributeSpecification.java index 578fc4f98716..e4f6e121c277 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/AttributeSpecification.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/AttributeSpecification.java @@ -27,35 +27,34 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser; public final class AttributeSpecification { - private final String namespaceUrl; - private final String attributName; - private final String mapperImplementation; - public AttributeSpecification (String namespaceUrl, String attributName, String mapperImplementation) - { - this.namespaceUrl = namespaceUrl; - this.attributName = attributName; - this.mapperImplementation = mapperImplementation; - } + private final String namespaceUrl; + private final String attributName; + private final String mapperImplementation; + + public AttributeSpecification(String namespaceUrl, String attributName, String mapperImplementation) + { + this.namespaceUrl = namespaceUrl; + this.attributName = attributName; + this.mapperImplementation = mapperImplementation; + } - public String getAttributName () - { - return attributName; - } + public String getAttributName() + { + return attributName; + } - public String getMapperImplementation () - { - return mapperImplementation; - } + public String getMapperImplementation() + { + return mapperImplementation; + } - public String getNamespaceUrl () - { - return namespaceUrl; - } + public String getNamespaceUrl() + { + return namespaceUrl; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java index 29e316f3be4c..e3b8f7374d43 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser; import com.sun.star.report.pentaho.model.OfficeDocument; @@ -44,13 +42,12 @@ import org.jfree.report.modules.factories.report.base.JFreeReportXmlResourceFact public class OfficeDocumentXmlResourceFactory extends JFreeReportXmlResourceFactory { - public OfficeDocumentXmlResourceFactory() - { - } - - public Class getFactoryType() - { - return OfficeDocument.class; - } + public OfficeDocumentXmlResourceFactory() + { + } + public Class getFactoryType() + { + return OfficeDocument.class; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java index 85bbab40a1a7..266cfa529d5a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java @@ -46,6 +46,7 @@ import org.pentaho.reporting.libraries.resourceloader.ResourceManager; public class OfficeParserUtil { + private static final Log LOGGER = LogFactory.getLog(OfficeParserUtil.class); private static OfficeParserUtil instance; private static final String NAMESPACES_PREFIX = "namespaces."; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java index 50aaf2e0ca40..6971eb857a20 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser; import com.sun.star.report.pentaho.model.OfficeStylesCollection; @@ -46,19 +44,17 @@ import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlResourceFactory; public class OfficeStylesXmlResourceFactory extends AbstractXmlResourceFactory { - public OfficeStylesXmlResourceFactory() - { - } - - - protected Configuration getConfiguration() - { - return JFreeReportBoot.getInstance().getGlobalConfig(); - } + public OfficeStylesXmlResourceFactory() + { + } - public Class getFactoryType() - { - return OfficeStylesCollection.class; - } + protected Configuration getConfiguration() + { + return JFreeReportBoot.getInstance().getGlobalConfig(); + } + public Class getFactoryType() + { + return OfficeStylesCollection.class; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java index b698a73dcc8e..ff3dfc494436 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser; import com.sun.star.report.pentaho.OfficeNamespaces; @@ -39,27 +37,28 @@ import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; public class StarStyleXmlFactoryModule implements XmlFactoryModule { - public StarStyleXmlFactoryModule() - { - } - public XmlReadHandler createReadHandler (final XmlDocumentInfo documentInfo) - { - return new DocumentStylesReadHandler(); - } + public StarStyleXmlFactoryModule() + { + } - public int getDocumentSupport (final XmlDocumentInfo documentInfo) - { - final String rootNamespace = documentInfo.getRootElementNameSpace(); - if (OfficeNamespaces.OFFICE_NS.equals(rootNamespace) && "document-styles".equals(documentInfo.getRootElement()) ) + public XmlReadHandler createReadHandler(final XmlDocumentInfo documentInfo) { - return XmlFactoryModule.RECOGNIZED_BY_NAMESPACE; + return new DocumentStylesReadHandler(); } - return XmlFactoryModule.NOT_RECOGNIZED; - } - public String getDefaultNamespace(final XmlDocumentInfo documentInfo) - { - return null; - } + public int getDocumentSupport(final XmlDocumentInfo documentInfo) + { + final String rootNamespace = documentInfo.getRootElementNameSpace(); + if (OfficeNamespaces.OFFICE_NS.equals(rootNamespace) && "document-styles".equals(documentInfo.getRootElement())) + { + return XmlFactoryModule.RECOGNIZED_BY_NAMESPACE; + } + return XmlFactoryModule.NOT_RECOGNIZED; + } + + public String getDefaultNamespace(final XmlDocumentInfo documentInfo) + { + return null; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java index 261ee5a285ce..e69df1b60bbe 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java @@ -50,8 +50,7 @@ public class StarXmlFactoryModule implements XmlFactoryModule public int getDocumentSupport(final XmlDocumentInfo documentInfo) { final String rootNamespace = documentInfo.getRootElementNameSpace(); - if (OfficeNamespaces.OFFICE_NS.equals(rootNamespace) && - ("document-content".equals(documentInfo.getRootElement()) || "document".equals(documentInfo.getRootElement()))) + if (OfficeNamespaces.OFFICE_NS.equals(rootNamespace) && ("document-content".equals(documentInfo.getRootElement()) || "document".equals(documentInfo.getRootElement()))) { return XmlFactoryModule.RECOGNIZED_BY_NAMESPACE; } 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 f29d0b0abad5..81f92f7ebaea 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/StyleMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/StyleMapper.java @@ -27,16 +27,15 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser; import org.jfree.layouting.input.style.CSSDeclarationRule; public interface StyleMapper { - void updateStyle (final String uri, - final String attrName, - final String attrValue, - final CSSDeclarationRule targetRule); + + 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/chart/ChartReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/chart/ChartReadHandler.java index 5e98fe9f3622..820a8fee65e6 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/chart/ChartReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/chart/ChartReadHandler.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.chart; import com.sun.star.report.pentaho.OfficeNamespaces; +import java.lang.Object; import java.util.ArrayList; import com.sun.star.report.pentaho.parser.ElementReadHandler; @@ -98,9 +99,9 @@ public class ChartReadHandler extends ElementReadHandler */ protected void doneParsing() throws SAXException { - for (int i = 0; i < children.size(); i++) + for (Object aChildren : children) { - final ElementReadHandler handler = (ElementReadHandler) children.get(i); + final ElementReadHandler handler = (ElementReadHandler) aChildren; element.addNode(handler.getElement()); } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java index 77e28ccab6ee..6630d1e73962 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java @@ -71,8 +71,10 @@ public class ObjectOleReadHandler extends ElementReadHandler String classid = attrs.getValue(OfficeNamespaces.DRAWING_NS, "class-id"); if (classid != null) { - if ( classid.equalsIgnoreCase(RPT_CHART_CLASS_ID)) + if (classid.equalsIgnoreCase(RPT_CHART_CLASS_ID)) + { classid = OOO_CHART_CLASS_ID; + } element.setClassId(classid); } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java index 9d1b4e1a9d14..64255c2ae373 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java @@ -56,6 +56,7 @@ import org.xml.sax.SAXException; */ public class DocumentContentReadHandler extends AbstractXmlReadHandler { + private static final Log LOGGER = LogFactory.getLog(DocumentContentReadHandler.class); private OfficeDocument report; private FontFaceDeclsReadHandler fontFaceReadHandler; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java index 33591203573f..32f7c54fa08a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.office; import com.sun.star.report.pentaho.OfficeNamespaces; @@ -50,61 +48,59 @@ import org.xml.sax.SAXException; */ public class DocumentStylesReadHandler extends ElementReadHandler { - private final OfficeStylesCollection officeStylesCollection; - private FontFaceDeclsReadHandler fontFaceReadHandler; - - public DocumentStylesReadHandler() - { - officeStylesCollection = new OfficeStylesCollection(); - } + private final OfficeStylesCollection officeStylesCollection; + private FontFaceDeclsReadHandler fontFaceReadHandler; - /** - * Returns the handler for a child element. - * - * @param tagName the tag name. - * @param atts the attributes. - * @return the handler or null, if the tagname is invalid. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected XmlReadHandler getHandlerForChild(final String uri, - final String tagName, - final Attributes atts) - throws SAXException - { - if (!OfficeNamespaces.OFFICE_NS.equals(uri)) + public DocumentStylesReadHandler() { - return null; + officeStylesCollection = new OfficeStylesCollection(); } - if ("font-face-decls".equals(tagName)) + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException { - if (fontFaceReadHandler == null) - { - fontFaceReadHandler = new FontFaceDeclsReadHandler - (officeStylesCollection.getFontFaceDecls()); - } - return fontFaceReadHandler; - } - else if ("automatic-styles".equals(tagName)) - { - return new OfficeStylesReadHandler(officeStylesCollection.getAutomaticStyles()); - } - else if ("styles".equals(tagName)) - { - return new OfficeStylesReadHandler(officeStylesCollection.getCommonStyles()); + if (!OfficeNamespaces.OFFICE_NS.equals(uri)) + { + return null; + } + + if ("font-face-decls".equals(tagName)) + { + if (fontFaceReadHandler == null) + { + fontFaceReadHandler = new FontFaceDeclsReadHandler(officeStylesCollection.getFontFaceDecls()); + } + return fontFaceReadHandler; + } + else if ("automatic-styles".equals(tagName)) + { + return new OfficeStylesReadHandler(officeStylesCollection.getAutomaticStyles()); + } + else if ("styles".equals(tagName)) + { + return new OfficeStylesReadHandler(officeStylesCollection.getCommonStyles()); + } + else if ("master-styles".equals(tagName)) + { + return new MasterStylesReadHandler(officeStylesCollection.getMasterStyles()); + } + return null; } - else if ("master-styles".equals(tagName)) + + public Element getElement() { - return new MasterStylesReadHandler(officeStylesCollection.getMasterStyles()); + return officeStylesCollection; } - return null; - } - - - public Element getElement() - { - return officeStylesCollection; - } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java index c11bf6385bc9..7e40681faee3 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.office; import java.util.ArrayList; @@ -53,67 +51,66 @@ import org.xml.sax.SAXException; */ public class FontFaceDeclsReadHandler extends ElementReadHandler { - private final FontFaceDeclsSection fontFaceDecls; - private final List fontFaceReadHandlers; - - public FontFaceDeclsReadHandler(final FontFaceDeclsSection fontFaceDecls) - { - this.fontFaceDecls = fontFaceDecls; - this.fontFaceReadHandlers = new ArrayList(); - } - public FontFaceDeclsSection getFontFaceDecls() - { - return fontFaceDecls; - } + private final FontFaceDeclsSection fontFaceDecls; + private final List fontFaceReadHandlers; - - /** - * Returns the handler for a child element. - * - * @param tagName the tag name. - * @param atts the attributes. - * @return the handler or null, if the tagname is invalid. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected XmlReadHandler getHandlerForChild(final String uri, - final String tagName, - final Attributes atts) - throws SAXException - { - if (!OfficeNamespaces.STYLE_NS.equals(uri) ) + public FontFaceDeclsReadHandler(final FontFaceDeclsSection fontFaceDecls) { - return null; + this.fontFaceDecls = fontFaceDecls; + this.fontFaceReadHandlers = new ArrayList(); } - if ("font-face".equals(tagName)) + public FontFaceDeclsSection getFontFaceDecls() { - final FontFaceReadHandler frh = new FontFaceReadHandler(); - fontFaceReadHandlers.add(frh); - return frh; + return fontFaceDecls; } - return null; - } - /** - * Done parsing. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected void doneParsing() - throws SAXException - { - for (int i = 0; i < fontFaceReadHandlers.size(); i++) + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException { - final FontFaceReadHandler handler = (FontFaceReadHandler) fontFaceReadHandlers.get(i); - fontFaceDecls.addFontFace((FontFaceElement) handler.getElement()); + if (!OfficeNamespaces.STYLE_NS.equals(uri)) + { + return null; + } + + if ("font-face".equals(tagName)) + { + final FontFaceReadHandler frh = new FontFaceReadHandler(); + fontFaceReadHandlers.add(frh); + return frh; + } + return null; } - } - public Element getElement() - { - return fontFaceDecls; - } + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() + throws SAXException + { + for (int i = 0; i < fontFaceReadHandlers.size(); i++) + { + final FontFaceReadHandler handler = (FontFaceReadHandler) fontFaceReadHandlers.get(i); + fontFaceDecls.addFontFace((FontFaceElement) handler.getElement()); + } + } + public Element getElement() + { + return fontFaceDecls; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd index 88fcc020a2e6..f65b34149429 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd @@ -55,364 +55,364 @@ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java index 60897b0d3c07..7f98e3f79f6a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java @@ -72,14 +72,14 @@ public class FormattedTextReadHandler extends ElementReadHandler element.setValueExpression(valueExpression); } - // * Print-Repeated-Values - // * Print-In-First-New-Section - // * Print-When-Group-Changes + // * Print-Repeated-Values + // * Print-In-First-New-Section + // * Print-When-Group-Changes - // * Print-When-Section-Overflows - // That property cannot be evaluated yet, as this would require us to - // have a clue about pagebreaking. We dont have that - not yet and never - // in the future, as pagebreaks are computed by OpenOffice instead + // * Print-When-Section-Overflows + // That property cannot be evaluated yet, as this would require us to + // have a clue about pagebreaking. We dont have that - not yet and never + // in the future, as pagebreaks are computed by OpenOffice instead } /** 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 55ed4759c6be..b9c6cb42d77e 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 && !"".equals(groupExpr) ) + if (groupExpr != null && !"".equals(groupExpr)) { final FormulaExpression function = new FormulaExpression(); function.setFormula(groupExpr); @@ -128,7 +128,7 @@ public class GroupReadHandler extends ElementReadHandler } if ("group-footer".equals(tagName)) { - ((Element)((Section)rh.getDetail().getElement()).getNode(0)).setAttribute(JFreeReportInfo.REPORT_NAMESPACE,"has-group-footer", OfficeToken.TRUE); + ((Element) ((Section) rh.getDetail().getElement()).getNode(0)).setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "has-group-footer", OfficeToken.TRUE); groupFooter = new GroupSectionReadHandler(); return groupFooter; } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java index a867e2e85e4c..e9b1d8959333 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java @@ -71,7 +71,7 @@ public class MasterDetailReadHandler extends ElementReadHandler if (parseMasterDetail) { final String master = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "master"); - if (master != null && master.length() > 0 ) + if (master != null && master.length() > 0) { final String detail = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "detail"); element.addMasterDetailFields(master, detail); diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java index 7fa0f700dada..1d0acf709161 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java @@ -56,6 +56,7 @@ public class ReportReadHandler extends ElementReadHandler { this.detail = detail; } + public final RootTableReadHandler getDetail() { return detail; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java index 2b70a87d9d03..0c7b8747c9d5 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.style; import com.sun.star.report.pentaho.parser.ElementReadHandler; @@ -45,15 +43,16 @@ import org.jfree.report.structure.Element; */ public class FontFaceReadHandler extends ElementReadHandler { - private final FontFaceElement fontFaceElement; - public FontFaceReadHandler() - { - this.fontFaceElement = new FontFaceElement(); - } + private final FontFaceElement fontFaceElement; + + public FontFaceReadHandler() + { + this.fontFaceElement = new FontFaceElement(); + } - public Element getElement() - { - return fontFaceElement; - } + public Element getElement() + { + return fontFaceElement; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java index 160feadb737f..75773988cf76 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.style; import java.util.ArrayList; @@ -49,59 +47,59 @@ import org.xml.sax.SAXException; */ public class MasterPageReadHandler extends ElementReadHandler { - private final OfficeMasterPage masterPage; - private final List otherHandlers; - public MasterPageReadHandler() - { - masterPage = new OfficeMasterPage(); - this.otherHandlers = new ArrayList(); - } + private final OfficeMasterPage masterPage; + private final List otherHandlers; - public OfficeMasterPage getMasterPage() - { - return masterPage; - } + public MasterPageReadHandler() + { + masterPage = new OfficeMasterPage(); + this.otherHandlers = new ArrayList(); + } - /** - * Returns the handler for a child element. - * - * @param tagName the tag name. - * @param atts the attributes. - * @return the handler or null, if the tagname is invalid. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected XmlReadHandler getHandlerForChild(final String uri, - final String tagName, - final Attributes atts) - throws SAXException - { - final StyleDefinitionReadHandler readHandler = - new StyleDefinitionReadHandler(); - otherHandlers.add(readHandler); - return readHandler; - } + public OfficeMasterPage getMasterPage() + { + return masterPage; + } - /** - * Done parsing. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected void doneParsing() - throws SAXException - { - for (int i = 0; i < otherHandlers.size(); i++) + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException { - final ElementReadHandler handler = - (ElementReadHandler) otherHandlers.get(i); - masterPage.addNode(handler.getElement()); + final StyleDefinitionReadHandler readHandler = + new StyleDefinitionReadHandler(); + otherHandlers.add(readHandler); + return readHandler; } - } + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() + throws SAXException + { + for (int i = 0; i < otherHandlers.size(); i++) + { + final ElementReadHandler handler = + (ElementReadHandler) otherHandlers.get(i); + masterPage.addNode(handler.getElement()); + } + } - public Element getElement() - { - return masterPage; - } + public Element getElement() + { + return masterPage; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java index a259a16ad8da..0a541495c8dd 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.style; import java.util.ArrayList; @@ -47,60 +45,60 @@ import org.xml.sax.SAXException; */ public class OfficeStyleReadHandler extends ElementReadHandler { - private final OfficeStyle officeStyle; - private final List childs; - public OfficeStyleReadHandler() - { - this.officeStyle = new OfficeStyle(); - this.childs = new ArrayList(); - } + private final OfficeStyle officeStyle; + private final List childs; + + public OfficeStyleReadHandler() + { + this.officeStyle = new OfficeStyle(); + this.childs = new ArrayList(); + } - /** - * Returns the handler for a child element. - * - * @param tagName the tag name. - * @param atts the attributes. - * @return the handler or null, if the tagname is invalid. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected XmlReadHandler getHandlerForChild (final String uri, - final String tagName, - final Attributes atts) - throws SAXException - { + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { // if (OfficeParserUtil.getInstance().isValidStyleElement(uri, tagName)) // { // } - final StyleDefinitionReadHandler readHandler = - new StyleDefinitionReadHandler(); - childs.add(readHandler); - return readHandler; - } - + final StyleDefinitionReadHandler readHandler = + new StyleDefinitionReadHandler(); + childs.add(readHandler); + return readHandler; + } - /** - * Done parsing. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected void doneParsing() throws SAXException - { - for (int i = 0; i < childs.size(); i++) + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException { - final ElementReadHandler handler = (ElementReadHandler) childs.get(i); - officeStyle.addNode(handler.getElement()); + for (int i = 0; i < childs.size(); i++) + { + final ElementReadHandler handler = (ElementReadHandler) childs.get(i); + officeStyle.addNode(handler.getElement()); + } } - } - public OfficeStyle getOfficeStyle() - { - return officeStyle; - } + public OfficeStyle getOfficeStyle() + { + return officeStyle; + } - public Element getElement() - { - return officeStyle; - } + public Element getElement() + { + return officeStyle; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java index 687b7b02ce49..4c4a2e80d19a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.style; import java.util.ArrayList; @@ -45,99 +43,100 @@ import java.util.List; public class OfficeStylesReadHandler extends ElementReadHandler { - private final List textStyleChilds; - private final List dataStyleChilds; - private final List otherStyleChilds; - private final List pageLayoutChilds; - private final OfficeStyles officeStyles; - public OfficeStylesReadHandler(final OfficeStyles officeStyles) - { - this.officeStyles = officeStyles; - this.pageLayoutChilds = new ArrayList(); - this.dataStyleChilds = new ArrayList(); - this.textStyleChilds = new ArrayList(); - this.otherStyleChilds = new ArrayList(); - } + private final List textStyleChilds; + private final List dataStyleChilds; + private final List otherStyleChilds; + private final List pageLayoutChilds; + private final OfficeStyles officeStyles; - /** - * Returns the handler for a child element. - * - * @param tagName the tag name. - * @param atts the attributes. - * @return the handler or null, if the tagname is invalid. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected XmlReadHandler getHandlerForChild (final String uri, final String tagName, - final Attributes atts) - throws SAXException - { - if (OfficeNamespaces.STYLE_NS.equals(uri)) - { - if ("style".equals(tagName)) - { - final OfficeStyleReadHandler xrh = new OfficeStyleReadHandler(); - textStyleChilds.add(xrh); - return xrh; - } - else if ("page-layout".equals(tagName)) - { - final PageLayoutReadHandler prh = new PageLayoutReadHandler(); - pageLayoutChilds.add(prh); - return prh; - } - } - else if (OfficeNamespaces.DATASTYLE_NS.equals(uri)) + public OfficeStylesReadHandler(final OfficeStyles officeStyles) { - final DataStyleReadHandler xrh = new DataStyleReadHandler(false); - dataStyleChilds.add(xrh); - return xrh; + this.officeStyles = officeStyles; + this.pageLayoutChilds = new ArrayList(); + this.dataStyleChilds = new ArrayList(); + this.textStyleChilds = new ArrayList(); + this.otherStyleChilds = new ArrayList(); } - final SectionReadHandler genericReadHander = new SectionReadHandler(); - otherStyleChilds.add(genericReadHander); - return genericReadHander; - } - - /** - * Done parsing. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected void doneParsing() throws SAXException - { - for (int i = 0; i < textStyleChilds.size(); i++) + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, final String tagName, + final Attributes atts) + throws SAXException { - final OfficeStyleReadHandler handler = - (OfficeStyleReadHandler) textStyleChilds.get(i); - officeStyles.addStyle(handler.getOfficeStyle()); - } + if (OfficeNamespaces.STYLE_NS.equals(uri)) + { + if ("style".equals(tagName)) + { + final OfficeStyleReadHandler xrh = new OfficeStyleReadHandler(); + textStyleChilds.add(xrh); + return xrh; + } + else if ("page-layout".equals(tagName)) + { + final PageLayoutReadHandler prh = new PageLayoutReadHandler(); + pageLayoutChilds.add(prh); + return prh; + } + } + else if (OfficeNamespaces.DATASTYLE_NS.equals(uri)) + { + final DataStyleReadHandler xrh = new DataStyleReadHandler(false); + dataStyleChilds.add(xrh); + return xrh; + } - for (int i = 0; i < pageLayoutChilds.size(); i++) - { - final PageLayoutReadHandler handler = - (PageLayoutReadHandler) pageLayoutChilds.get(i); - officeStyles.addPageStyle(handler.getPageLayout()); + final SectionReadHandler genericReadHander = new SectionReadHandler(); + otherStyleChilds.add(genericReadHander); + return genericReadHander; } - for (int i = 0; i < dataStyleChilds.size(); i++) + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException { - final DataStyleReadHandler handler = - (DataStyleReadHandler) dataStyleChilds.get(i); - officeStyles.addDataStyle(handler.getDataStyle()); + for (int i = 0; i < textStyleChilds.size(); i++) + { + final OfficeStyleReadHandler handler = + (OfficeStyleReadHandler) textStyleChilds.get(i); + officeStyles.addStyle(handler.getOfficeStyle()); + } + + for (int i = 0; i < pageLayoutChilds.size(); i++) + { + final PageLayoutReadHandler handler = + (PageLayoutReadHandler) pageLayoutChilds.get(i); + officeStyles.addPageStyle(handler.getPageLayout()); + } + + for (int i = 0; i < dataStyleChilds.size(); i++) + { + final DataStyleReadHandler handler = + (DataStyleReadHandler) dataStyleChilds.get(i); + officeStyles.addDataStyle(handler.getDataStyle()); + } + + for (int i = 0; i < otherStyleChilds.size(); i++) + { + final SectionReadHandler handler = + (SectionReadHandler) otherStyleChilds.get(i); + officeStyles.addOtherNode((Element) handler.getNode()); + } } - for (int i = 0; i < otherStyleChilds.size(); i++) + public Element getElement() { - final SectionReadHandler handler = - (SectionReadHandler) otherStyleChilds.get(i); - officeStyles.addOtherNode((Element) handler.getNode()); + return officeStyles; } - } - - public Element getElement() - { - return officeStyles; - } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java index 46ba378a1ce5..5ee10d2b936b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.style; import java.util.ArrayList; @@ -49,57 +47,57 @@ import org.xml.sax.SAXException; */ public class PageLayoutReadHandler extends ElementReadHandler { - private final PageLayout pageLayout; - private final List childs; - public PageLayoutReadHandler() - { - this.pageLayout = new PageLayout(); - this.childs = new ArrayList(); - } + private final PageLayout pageLayout; + private final List childs; - /** - * Returns the handler for a child element. - * - * @param tagName the tag name. - * @param atts the attributes. - * @return the handler or null, if the tagname is invalid. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected XmlReadHandler getHandlerForChild (final String uri, - final String tagName, - final Attributes atts) - throws SAXException - { - final StyleDefinitionReadHandler readHandler = - new StyleDefinitionReadHandler(); - childs.add(readHandler); - return readHandler; - } + public PageLayoutReadHandler() + { + this.pageLayout = new PageLayout(); + this.childs = new ArrayList(); + } + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException + { + final StyleDefinitionReadHandler readHandler = + new StyleDefinitionReadHandler(); + childs.add(readHandler); + return readHandler; + } - /** - * Done parsing. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected void doneParsing() throws SAXException - { - for (int i = 0; i < childs.size(); i++) + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() throws SAXException { - final ElementReadHandler handler = (ElementReadHandler) childs.get(i); - pageLayout.addNode(handler.getElement()); + for (int i = 0; i < childs.size(); i++) + { + final ElementReadHandler handler = (ElementReadHandler) childs.get(i); + pageLayout.addNode(handler.getElement()); + } } - } - public PageLayout getPageLayout() - { - return pageLayout; - } + public PageLayout getPageLayout() + { + return pageLayout; + } - public Element getElement() - { - return pageLayout; - } + public Element getElement() + { + return pageLayout; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java index 6eb99dec3ee0..0fd0655d4e22 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.style; import java.util.ArrayList; @@ -48,54 +46,53 @@ import org.xml.sax.SAXException; */ public class StyleDefinitionReadHandler extends ElementReadHandler { - private final Section rawSection; - private final List childs; - - public StyleDefinitionReadHandler() - { - this.rawSection = new Section(); - this.childs = new ArrayList(); - } - /** - * Returns the handler for a child element. - * - * @param tagName the tag name. - * @param atts the attributes. - * @return the handler or null, if the tagname is invalid. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected XmlReadHandler getHandlerForChild(final String uri, - final String tagName, - final Attributes atts) - throws SAXException - { - final StyleDefinitionReadHandler readHandler = - new StyleDefinitionReadHandler(); - childs.add(readHandler); - return readHandler; - } + private final Section rawSection; + private final List childs; + public StyleDefinitionReadHandler() + { + this.rawSection = new Section(); + this.childs = new ArrayList(); + } - /** - * Done parsing. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected void doneParsing() - throws SAXException - { - for (int i = 0; i < childs.size(); i++) + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException { - final ElementReadHandler handler = (ElementReadHandler) childs.get(i); - rawSection.addNode(handler.getElement()); + final StyleDefinitionReadHandler readHandler = + new StyleDefinitionReadHandler(); + childs.add(readHandler); + return readHandler; } - } + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() + throws SAXException + { + for (int i = 0; i < childs.size(); i++) + { + final ElementReadHandler handler = (ElementReadHandler) childs.get(i); + rawSection.addNode(handler.getElement()); + } + } - public Element getElement() - { - return rawSection; - } + public Element getElement() + { + return rawSection; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java index 7ade32271b8f..8e385f2ba859 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java @@ -49,7 +49,7 @@ public abstract class OneOfConstantsMapper implements StyleMapper this.mappings = new HashMap(); } - public void addMapping (final String value, final CSSValue target) + public void addMapping(final String value, final CSSValue target) { mappings.put(value, target); } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java index f08255b615ee..8418815f3b7d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.stylemapper.draw; import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; @@ -37,12 +35,13 @@ import org.jfree.layouting.input.style.values.CSSConstant; public class TextAreaVerticalAlignMapper extends OneOfConstantsMapper { - public TextAreaVerticalAlignMapper () - { - super (BoxStyleKeys.BOX_VERTICAL_ALIGN); - addMapping("top", new CSSConstant("top")); - addMapping("bottom", new CSSConstant("bottom")); - addMapping("middle", new CSSConstant("middle")); - addMapping("justify", new CSSConstant("justify")); - } + + public TextAreaVerticalAlignMapper() + { + super(BoxStyleKeys.BOX_VERTICAL_ALIGN); + addMapping("top", new CSSConstant("top")); + addMapping("bottom", new CSSConstant("bottom")); + addMapping("middle", new CSSConstant("middle")); + addMapping("justify", new CSSConstant("justify")); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java index 5369dc589d32..5c6111c1f55a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.stylemapper.fo; import com.sun.star.report.pentaho.parser.StyleMapper; @@ -37,13 +35,14 @@ import org.jfree.layouting.input.style.keys.font.FontStyleKeys; public class FontStyleMapper implements StyleMapper { - public FontStyleMapper () - { - } - public void updateStyle (final String uri, final String attrName, final String attrValue, - final CSSDeclarationRule targetRule) - { - targetRule.setPropertyValueAsString(FontStyleKeys.FONT_STYLE, attrValue); - } + public FontStyleMapper() + { + } + + public void updateStyle(final String uri, final String attrName, final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValueAsString(FontStyleKeys.FONT_STYLE, attrValue); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java index 49571efae772..ec73596462e5 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.stylemapper.fo; import com.sun.star.report.pentaho.parser.StyleMapper; @@ -37,13 +35,14 @@ import org.jfree.layouting.input.style.keys.font.FontStyleKeys; public class FontWeightMapper implements StyleMapper { - public FontWeightMapper () - { - } - public void updateStyle (final String uri, final String attrName, final String attrValue, - final CSSDeclarationRule targetRule) - { - targetRule.setPropertyValueAsString(FontStyleKeys.FONT_WEIGHT, attrValue); - } + public FontWeightMapper() + { + } + + public void updateStyle(final String uri, final String attrName, final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValueAsString(FontStyleKeys.FONT_WEIGHT, attrValue); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java index 93d1ee1d57c0..b619442076b6 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.stylemapper.fo; import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; @@ -37,15 +35,15 @@ import org.jfree.layouting.input.style.keys.text.TextStyleKeys; public class TextAlignMapper extends OneOfConstantsMapper { - public TextAlignMapper () - { - super(TextStyleKeys.TEXT_ALIGN); - addMapping("start", TextAlign.START); - addMapping("end", TextAlign.END); - addMapping("left", TextAlign.LEFT); - addMapping("center", TextAlign.CENTER); - addMapping("right", TextAlign.RIGHT); - addMapping("justify", TextAlign.JUSTIFY); - } + public TextAlignMapper() + { + super(TextStyleKeys.TEXT_ALIGN); + addMapping("start", TextAlign.START); + addMapping("end", TextAlign.END); + addMapping("left", TextAlign.LEFT); + addMapping("center", TextAlign.CENTER); + addMapping("right", TextAlign.RIGHT); + addMapping("justify", TextAlign.JUSTIFY); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java index f218fc465a94..fce338d5688b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java @@ -52,7 +52,10 @@ public class FontFamilyGenericMapper implements StyleMapper { final CSSStringValue cssVal = new CSSStringValue(CSSStringType.STRING, attrValue); targetRule.setPropertyValue(FontStyleKeys.FONT_FAMILY, - new CSSValueList(new CSSValue[]{cssVal})); + new CSSValueList(new CSSValue[] + { + cssVal + })); } else { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java index 019fea3182a2..696fb557bdde 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java @@ -52,7 +52,10 @@ public class FontFamilyMapper implements StyleMapper { final CSSStringValue cssVal = new CSSStringValue(CSSStringType.STRING, attrValue); targetRule.setPropertyValue(FontStyleKeys.FONT_FAMILY, - new CSSValueList(new CSSValue[]{cssVal})); + new CSSValueList(new CSSValue[] + { + cssVal + })); } else { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java index f9d238bfcb79..cc6cd926f7c7 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.StyleMapper; @@ -39,14 +37,15 @@ import org.jfree.layouting.input.style.keys.font.FontStyleKeys; public class FontNameMapper implements StyleMapper { - public FontNameMapper () - { - } - public void updateStyle (final String uri, final String attrName, final String attrValue, - final CSSDeclarationRule targetRule) - { - targetRule.setPropertyValue(FontStyleKeys.FONT_NAME, - new CSSStringValue(CSSStringType.STRING, attrValue)); - } + public FontNameMapper() + { + } + + public void updateStyle(final String uri, final String attrName, final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValue(FontStyleKeys.FONT_NAME, + new CSSStringValue(CSSStringType.STRING, attrValue)); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java index ae180f8fac69..79dceddb88c6 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; @@ -37,10 +35,11 @@ import org.jfree.layouting.input.style.values.CSSConstant; public class FontPitchMapper extends OneOfConstantsMapper { - public FontPitchMapper () - { - super (FontStyleKeys.FONT_PITCH); - addMapping("variable", new CSSConstant("variable")); - addMapping("fixed", new CSSConstant("fixed")); - } + + public FontPitchMapper() + { + super(FontStyleKeys.FONT_PITCH); + addMapping("variable", new CSSConstant("variable")); + addMapping("fixed", new CSSConstant("fixed")); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java index 059d01981a27..a9c18a8f7dc4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.StyleMapper; @@ -37,14 +35,14 @@ import org.jfree.layouting.input.style.keys.font.FontStyleKeys; public class FontReliefMapper implements StyleMapper { - public FontReliefMapper () - { - } + public FontReliefMapper() + { + } - public void updateStyle (final String uri, final String attrName, final String attrValue, - final CSSDeclarationRule targetRule) - { - targetRule.setPropertyValueAsString(FontStyleKeys.FONT_EFFECT, attrValue); - } + public void updateStyle(final String uri, final String attrName, final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValueAsString(FontStyleKeys.FONT_EFFECT, attrValue); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java index 961e22c5eb63..e465e7da1527 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.StyleMapper; @@ -36,14 +34,14 @@ import org.jfree.layouting.input.style.CSSDeclarationRule; public class TextEmphasizeMapper implements StyleMapper { - public TextEmphasizeMapper () - { - } + public TextEmphasizeMapper() + { + } - public void updateStyle (final String uri, final String attrName, final String attrValue, - final CSSDeclarationRule targetRule) - { - targetRule.setPropertyValueAsString("font-emphasize", attrValue); - } + public void updateStyle(final String uri, final String attrName, final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValueAsString("font-emphasize", attrValue); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java index e0b4e309a9bc..b6b3812a834e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.StyleMapper; @@ -39,19 +37,20 @@ import org.jfree.layouting.util.ColorUtil; public class TextUnderlineColorMapper implements StyleMapper { - public TextUnderlineColorMapper () - { - } - public void updateStyle (final String uri, - final String attrName, - final String attrValue, - final CSSDeclarationRule targetRule) - { - final CSSColorValue cv = (CSSColorValue) ColorUtil.parseColor(attrValue); - if (cv != null) + public TextUnderlineColorMapper() + { + } + + public void updateStyle(final String uri, + final String attrName, + final String attrValue, + final CSSDeclarationRule targetRule) { - targetRule.setPropertyValue(TextStyleKeys.TEXT_UNDERLINE_COLOR, cv); + final CSSColorValue cv = (CSSColorValue) ColorUtil.parseColor(attrValue); + if (cv != null) + { + targetRule.setPropertyValue(TextStyleKeys.TEXT_UNDERLINE_COLOR, cv); + } } - } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java index 70630674abbb..fcc4e8cc6a7a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; @@ -37,19 +35,17 @@ import org.jfree.layouting.input.style.keys.text.TextDecorationStyle; public class TextUnderlineStyleMapper extends OneOfConstantsMapper { - public TextUnderlineStyleMapper () - { - super(TextStyleKeys.TEXT_UNDERLINE_STYLE); - addMapping("none", TextDecorationStyle.NONE); - addMapping("solid", TextDecorationStyle.SOLID); - addMapping("dotted", TextDecorationStyle.DOTTED); - addMapping("dash", TextDecorationStyle.DASHED); - addMapping("long-dash", TextDecorationStyle.LONG_DASH); - addMapping("dot-dash", TextDecorationStyle.DOT_DASH); - addMapping("dot-dot-dash", TextDecorationStyle.DOT_DOT_DASH); - addMapping("wave", TextDecorationStyle.WAVE); - } - - + public TextUnderlineStyleMapper() + { + super(TextStyleKeys.TEXT_UNDERLINE_STYLE); + addMapping("none", TextDecorationStyle.NONE); + addMapping("solid", TextDecorationStyle.SOLID); + addMapping("dotted", TextDecorationStyle.DOTTED); + addMapping("dash", TextDecorationStyle.DASHED); + addMapping("long-dash", TextDecorationStyle.LONG_DASH); + addMapping("dot-dash", TextDecorationStyle.DOT_DASH); + addMapping("dot-dot-dash", TextDecorationStyle.DOT_DOT_DASH); + addMapping("wave", TextDecorationStyle.WAVE); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java index 3e2d879db846..aa23d66b131f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; @@ -37,12 +35,11 @@ import org.jfree.layouting.input.style.keys.text.TextStyleKeys; public class TextUnderlineWordMode extends OneOfConstantsMapper { - public TextUnderlineWordMode () - { - super(TextStyleKeys.TEXT_UNDERLINE_MODE); - addMapping("continuous", TextDecorationMode.CONTINUOUS); - addMapping("skip-white-space", TextDecorationMode.SKIP_WHITE_SPACE); - } - + public TextUnderlineWordMode() + { + super(TextStyleKeys.TEXT_UNDERLINE_MODE); + addMapping("continuous", TextDecorationMode.CONTINUOUS); + addMapping("skip-white-space", TextDecorationMode.SKIP_WHITE_SPACE); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java index ad9ea12ac6fb..9b56b1ae14be 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; @@ -38,13 +36,14 @@ import org.jfree.layouting.input.style.values.CSSConstant; public class VerticalAlignMapper extends OneOfConstantsMapper { - public VerticalAlignMapper () - { - super (LineStyleKeys.VERTICAL_ALIGN); - addMapping("top", new CSSConstant("top")); - addMapping("bottom", new CSSConstant("bottom")); - addMapping("middle", new CSSConstant("middle")); - addMapping("baseline", new CSSConstant("baseline")); - addMapping("auto", CSSAutoValue.getInstance()); - } + + public VerticalAlignMapper() + { + super(LineStyleKeys.VERTICAL_ALIGN); + addMapping("top", new CSSConstant("top")); + addMapping("bottom", new CSSConstant("bottom")); + addMapping("middle", new CSSConstant("middle")); + addMapping("baseline", new CSSConstant("baseline")); + addMapping("auto", CSSAutoValue.getInstance()); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java index fca9edd38d33..82adc828982c 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java @@ -27,7 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - package com.sun.star.report.pentaho.parser.stylemapper.table; import com.sun.star.report.pentaho.parser.StyleMapper; @@ -41,15 +40,16 @@ import org.jfree.layouting.input.style.keys.box.BoxStyleKeys; */ public class ColumnWidthMapper implements StyleMapper { - public ColumnWidthMapper() - { - } - public void updateStyle(final String uri, - final String attrName, - final String attrValue, - final CSSDeclarationRule targetRule) - { - targetRule.setPropertyValueAsString(BoxStyleKeys.WIDTH, attrValue); - } + public ColumnWidthMapper() + { + } + + public void updateStyle(final String uri, + final String attrName, + final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValueAsString(BoxStyleKeys.WIDTH, attrValue); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java index c305a85a1e05..57e4dcd9c559 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java @@ -27,7 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - package com.sun.star.report.pentaho.parser.stylemapper.table; import com.sun.star.report.pentaho.parser.StyleMapper; @@ -41,15 +40,16 @@ import org.jfree.layouting.input.style.keys.box.BoxStyleKeys; */ public class RowHeightMapper implements StyleMapper { - public RowHeightMapper() - { - } - public void updateStyle(final String uri, - final String attrName, - final String attrValue, - final CSSDeclarationRule targetRule) - { - targetRule.setPropertyValueAsString(BoxStyleKeys.HEIGHT, attrValue); - } + public RowHeightMapper() + { + } + + public void updateStyle(final String uri, + final String attrName, + final String attrValue, + final CSSDeclarationRule targetRule) + { + targetRule.setPropertyValueAsString(BoxStyleKeys.HEIGHT, attrValue); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java index 5b9e11fcbac6..172e8b475459 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java @@ -42,6 +42,7 @@ public class TableColumnReadHandler extends ElementReadHandler { private final Section tableColumn; + public TableColumnReadHandler() { tableColumn = new Section(); diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java index a0052dbc1a9e..a72a5249af4c 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java @@ -71,7 +71,7 @@ public class TableColumnsReadHandler extends ElementReadHandler final Attributes atts) throws SAXException { - if (OfficeNamespaces.TABLE_NS.equals(uri) && OfficeToken.TABLE_COLUMN.equals(tagName) ) + if (OfficeNamespaces.TABLE_NS.equals(uri) && OfficeToken.TABLE_COLUMN.equals(tagName)) { final TableColumnReadHandler readHandler = new TableColumnReadHandler(); columns.add(readHandler); diff --git a/reportbuilder/java/com/sun/star/report/pentaho/smil.css b/reportbuilder/java/com/sun/star/report/pentaho/smil.css index b01076ff30ae..54d59ac828e2 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/smil.css +++ b/reportbuilder/java/com/sun/star/report/pentaho/smil.css @@ -2,4 +2,4 @@ /** * All default styles for formating-objects elements (if there are any). - */ +*/ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/star-office.css b/reportbuilder/java/com/sun/star/report/pentaho/star-office.css index da515eb88df9..22d57ca05a18 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/star-office.css +++ b/reportbuilder/java/com/sun/star/report/pentaho/star-office.css @@ -2,4 +2,4 @@ /** * All default styles for office elements. - */ +*/ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/star-report.css b/reportbuilder/java/com/sun/star/report/pentaho/star-report.css index ef4e595d8bf0..56f98506cf40 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/star-report.css +++ b/reportbuilder/java/com/sun/star/report/pentaho/star-report.css @@ -3,43 +3,43 @@ @namespace report url("http://openoffice.org/2005/report"); table|table { - display: table; + display: table; } table|table-columns { - display: table-column-group; + display: table-column-group; } table|table-column { - display: table-column; + display: table-column; } table|table-row { - display: table-row; + display: table-row; } table|table-cell { - display: table-cell; + display: table-cell; } table|table-cell[number-columns-spanned], table|table-cell[number-columns-spanned], table|table-columns[number-columns-spanned], table|table-column[number-columns-spanned] { - -x-liblayout-colspan: attr("table|number-columns-spanned"); + -x-liblayout-colspan: attr("table|number-columns-spanned"); } table|table-cell[number-rows-spanned], table|table-cell[number-rows-spanned] { - -x-liblayout-rowspan: attr("table|number-rows-spanned"); + -x-liblayout-rowspan: attr("table|number-rows-spanned"); } /** * Style definitions for star report. - */ +*/ * { - vertical-align: baseline; + vertical-align: baseline; } /** @@ -58,15 +58,15 @@ table|table-cell[number-rows-spanned] { percentage fraction - */ +*/ @format number myname { - -x-liblayout-decimal-replacement: "-"; - -x-liblayout-display-factor: 1000; - content: "'Prefix'#,##0.00'postfix'"; + -x-liblayout-decimal-replacement: "-"; + -x-liblayout-display-factor: 1000; + content: "'Prefix'#,##0.00'postfix'"; } @format scientific anothername { - /* to be filled */ + /* to be filled */ } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/star-rpt.css b/reportbuilder/java/com/sun/star/report/pentaho/star-rpt.css index 6da26872b28e..47b6aca74d00 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/star-rpt.css +++ b/reportbuilder/java/com/sun/star/report/pentaho/star-rpt.css @@ -2,4 +2,4 @@ /** * All default styles for report elements. - */ +*/ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/LengthCalculator.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/LengthCalculator.java index 9a0a330dbc15..1e041d6bce8d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/LengthCalculator.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/LengthCalculator.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.styles; import org.jfree.layouting.input.style.values.CSSNumericType; @@ -44,73 +42,72 @@ import org.jfree.layouting.input.style.values.CSSNumericValue; */ public class LengthCalculator { - // and centimeter (x10) - private double millimeter; - - // and pica (x12) and inch(x72). Px is assumed to be in 96dpi. - private double point; + // and centimeter (x10) - private double pixel; + private double millimeter; + // and pica (x12) and inch(x72). Px is assumed to be in 96dpi. + private double point; + private double pixel; - public LengthCalculator() - { - } - - public void add (final CSSNumericValue value) - { - if (value == null) + public LengthCalculator() { - return; } - final CSSNumericType numericType = value.getType(); - if (numericType == CSSNumericType.CM) - { - millimeter += value.getValue() * 10; - } - else if (numericType == CSSNumericType.MM) + public void add(final CSSNumericValue value) { - millimeter += value.getValue(); - } - else if (numericType == CSSNumericType.PT) - { - point += value.getValue(); - } - else if (numericType == CSSNumericType.PC) - { - point += 12 * value.getValue(); - } - else if (numericType == CSSNumericType.INCH) - { - point += 72 * value.getValue(); - } - else if (numericType == CSSNumericType.PX) - { - pixel += value.getValue(); - } - // LOGGER.debug ("Adding " + value + " [mm: " + millimeter + "] [pt: " + point + "] px: [" + pixel + "]"); - } + if (value == null) + { + return; + } - public CSSNumericValue getResult () - { - if (pixel == 0 && point == 0) - { - return CSSNumericValue.createValue(CSSNumericType.MM, millimeter); + final CSSNumericType numericType = value.getType(); + if (numericType == CSSNumericType.CM) + { + millimeter += value.getValue() * 10; + } + else if (numericType == CSSNumericType.MM) + { + millimeter += value.getValue(); + } + else if (numericType == CSSNumericType.PT) + { + point += value.getValue(); + } + else if (numericType == CSSNumericType.PC) + { + point += 12 * value.getValue(); + } + else if (numericType == CSSNumericType.INCH) + { + point += 72 * value.getValue(); + } + else if (numericType == CSSNumericType.PX) + { + pixel += value.getValue(); + } + // LOGGER.debug ("Adding " + value + " [mm: " + millimeter + "] [pt: " + point + "] px: [" + pixel + "]"); } - if (pixel == 0 && millimeter == 0) - { - return CSSNumericValue.createValue(CSSNumericType.PT, point); - } - if (point == 0 && millimeter == 0) + + public CSSNumericValue getResult() { - return CSSNumericValue.createValue(CSSNumericType.PX, pixel); - } - // else convert it. + if (pixel == 0 && point == 0) + { + return CSSNumericValue.createValue(CSSNumericType.MM, millimeter); + } + if (pixel == 0 && millimeter == 0) + { + return CSSNumericValue.createValue(CSSNumericType.PT, point); + } + if (point == 0 && millimeter == 0) + { + return CSSNumericValue.createValue(CSSNumericType.PX, pixel); + } + // else convert it. - double result = point; - result += (millimeter * 10 * 72 / 254); - result += pixel * 72 / 96; + double result = point; + result += (millimeter * 10 * 72 / 254); + result += pixel * 72 / 96; - return CSSNumericValue.createValue(CSSNumericType.PT, result); - } + return CSSNumericValue.createValue(CSSNumericType.PT, result); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java index 1424d0becad6..6cb6add68697 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.styles; import java.util.HashMap; @@ -54,53 +52,47 @@ import org.pentaho.reporting.libraries.resourceloader.ResourceManager; */ public class StyleMapper { - private final Map backend; - public StyleMapper() - { - this.backend = new HashMap(); - } + private final Map backend; - public void addMapping(final StyleMappingRule rule) - { - backend.put(rule.getKey(), rule); - } + public StyleMapper() + { + this.backend = new HashMap(); + } - public boolean isListOfStyles(final String elementNamespace, - final String elementTagName, - final String attributeNamespace, - final String attributeName) - { - final StyleMapperKey key = new StyleMapperKey - (elementNamespace, elementTagName, attributeNamespace, attributeName); - final StyleMappingRule rule = (StyleMappingRule) backend.get(key); - if (rule == null) + public void addMapping(final StyleMappingRule rule) { - return false; + backend.put(rule.getKey(), rule); } - return rule.isListOfValues(); - } - public String getStyleFamilyFor(final String elementNamespace, - final String elementTagName, - final String attributeNamespace, - final String attributeName) - { - final StyleMapperKey key = new StyleMapperKey - (elementNamespace, elementTagName, attributeNamespace, attributeName); - final StyleMappingRule rule = (StyleMappingRule) backend.get(key); - if (rule == null) + public boolean isListOfStyles(final String elementNamespace, + final String elementTagName, + final String attributeNamespace, + final String attributeName) { - return null; + final StyleMapperKey key = new StyleMapperKey(elementNamespace, elementTagName, attributeNamespace, attributeName); + final StyleMappingRule rule = (StyleMappingRule) backend.get(key); + return rule != null && rule.isListOfValues(); } - return rule.getFamily(); - } - public static StyleMapper loadInstance (final ResourceManager resourceManager) - throws ResourceException - { - final Resource resource = resourceManager.createDirectly - ("res://com/sun/star/report/pentaho/styles/stylemapper.xml", StyleMapper.class); - return (StyleMapper) resource.getResource(); - } + public String getStyleFamilyFor(final String elementNamespace, + final String elementTagName, + final String attributeNamespace, + final String attributeName) + { + final StyleMapperKey key = new StyleMapperKey(elementNamespace, elementTagName, attributeNamespace, attributeName); + final StyleMappingRule rule = (StyleMappingRule) backend.get(key); + if (rule == null) + { + return null; + } + return rule.getFamily(); + } + + public static StyleMapper loadInstance(final ResourceManager resourceManager) + throws ResourceException + { + final Resource resource = resourceManager.createDirectly("res://com/sun/star/report/pentaho/styles/stylemapper.xml", StyleMapper.class); + return (StyleMapper) resource.getResource(); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java index 64b50cba1197..496bfd23387f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java @@ -96,9 +96,7 @@ public final class StyleMapperKey final StyleMapperKey that = (StyleMapperKey) o; - if ((attributeName != null ? !attributeName.equals(that.attributeName) : that.attributeName != null) || - (attributeNamespace != null ? !attributeNamespace.equals(that.attributeNamespace) : that.attributeNamespace != null) || - !elementName.equals(that.elementName) || !elementNamespace.equals(that.elementNamespace)) + if ((attributeName != null ? !attributeName.equals(that.attributeName) : that.attributeName != null) || (attributeNamespace != null ? !attributeNamespace.equals(that.attributeNamespace) : that.attributeNamespace != null) || !elementName.equals(that.elementName) || !elementNamespace.equals(that.elementNamespace)) { return false; } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java index 0b6319af3848..09802517e0a2 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java @@ -57,8 +57,7 @@ public class StyleMapperXmlFactoryModule implements XmlFactoryModule public int getDocumentSupport(final XmlDocumentInfo documentInfo) { final String rootNamespace = documentInfo.getRootElementNameSpace(); - if (StyleMapperXmlFactoryModule.NAMESPACE.equals(rootNamespace) && - "style-mapper-definition".equals(documentInfo.getRootElement())) + if (StyleMapperXmlFactoryModule.NAMESPACE.equals(rootNamespace) && "style-mapper-definition".equals(documentInfo.getRootElement())) { return XmlFactoryModule.RECOGNIZED_BY_NAMESPACE; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java index 4d9646303b38..5574bf022353 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.styles; import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlResourceFactory; @@ -43,17 +41,18 @@ import org.pentaho.reporting.libraries.base.config.Configuration; */ public class StyleMapperXmlResourceFactory extends AbstractXmlResourceFactory { - public StyleMapperXmlResourceFactory() - { - } - protected Configuration getConfiguration() - { - return JFreeReportBoot.getInstance().getGlobalConfig(); - } + public StyleMapperXmlResourceFactory() + { + } + + protected Configuration getConfiguration() + { + return JFreeReportBoot.getInstance().getGlobalConfig(); + } - public Class getFactoryType() - { - return StyleMapper.class; - } + public Class getFactoryType() + { + return StyleMapper.class; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java index 21101d847e44..7db04ffc5d93 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.styles; import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; @@ -44,66 +42,62 @@ import org.xml.sax.SAXException; */ public class StyleMappingReadHandler extends AbstractXmlReadHandler { - private StyleMappingRule rule; - - public StyleMappingReadHandler() - { - } + private StyleMappingRule rule; - /** - * Starts parsing. - * - * @param attrs the attributes. - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected void startParsing(final Attributes attrs) - throws SAXException - { - final String elementNamespace = attrs.getValue(getUri(), - "element-namespace"); - if (elementNamespace == null) + public StyleMappingReadHandler() { - throw new ParseException - ("Required attribute 'element-namespace' is missing", getLocator()); } - final String elementName = attrs.getValue(getUri(), "element-name"); - - if (elementName == null) + /** + * Starts parsing. + * + * @param attrs the attributes. + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void startParsing(final Attributes attrs) + throws SAXException { - throw new ParseException - ("Required attribute 'element-name' is missing", getLocator()); - } + final String elementNamespace = attrs.getValue(getUri(), + "element-namespace"); + if (elementNamespace == null) + { + throw new ParseException("Required attribute 'element-namespace' is missing", getLocator()); + } - final String attributeNamespace = attrs.getValue(getUri(), - "attribute-namespace"); - final String attributeName = attrs.getValue(getUri(), "attribute-name"); + final String elementName = attrs.getValue(getUri(), "element-name"); - final boolean listOfValues = - "styleNameRefs".equals(attrs.getValue(getUri(), "type")); + if (elementName == null) + { + throw new ParseException("Required attribute 'element-name' is missing", getLocator()); + } - final String family = attrs.getValue(getUri(), "style-family"); - final StyleMapperKey key = new StyleMapperKey - (elementNamespace, elementName, attributeNamespace, attributeName); - rule = new StyleMappingRule(key, family, listOfValues); - } + final String attributeNamespace = attrs.getValue(getUri(), + "attribute-namespace"); + final String attributeName = attrs.getValue(getUri(), "attribute-name"); + final boolean listOfValues = + "styleNameRefs".equals(attrs.getValue(getUri(), "type")); - public StyleMappingRule getRule() - { - return rule; - } + final String family = attrs.getValue(getUri(), "style-family"); + final StyleMapperKey key = new StyleMapperKey(elementNamespace, elementName, attributeNamespace, attributeName); + rule = new StyleMappingRule(key, family, listOfValues); + } - /** - * Returns the object for this element or null, if this element does not - * create an object. - * - * @return the object. - */ - public Object getObject() - throws SAXException - { - return rule; - } + public StyleMappingRule getRule() + { + return rule; + } + + /** + * Returns the object for this element or null, if this element does not + * create an object. + * + * @return the object. + */ + public Object getObject() + throws SAXException + { + return rule; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java index 742daf8ba6e5..e0fbd62a77d8 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.styles; /** @@ -39,32 +37,31 @@ package com.sun.star.report.pentaho.styles; */ public class StyleMappingRule { - private final StyleMapperKey key; - private final String family; - private final boolean listOfValues; - - public StyleMappingRule(final StyleMapperKey key, final String family, - final boolean listOfValues) - { - this.key = key; - this.family = family; - this.listOfValues = listOfValues; - } + private final StyleMapperKey key; + private final String family; + private final boolean listOfValues; + public StyleMappingRule(final StyleMapperKey key, final String family, + final boolean listOfValues) + { + this.key = key; + this.family = family; + this.listOfValues = listOfValues; + } - public StyleMapperKey getKey() - { - return key; - } + public StyleMapperKey getKey() + { + return key; + } - public String getFamily() - { - return family; - } + public String getFamily() + { + return family; + } - public boolean isListOfValues() - { - return listOfValues; - } + public boolean isListOfValues() + { + return listOfValues; + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xsd b/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xsd index 905dbc8464d6..93392a6f0ea1 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xsd +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xsd @@ -34,62 +34,62 @@ xmlns="http://jfreereport.sourceforge.net/namespaces/engine/openoffice/stylemapper" targetNamespace="http://jfreereport.sourceforge.net/namespaces/engine/openoffice/stylemapper" attributeFormDefault="unqualified"> - - + + This schema describes the format of the stylemapper definition file. The stylemapper declares what style-families are referenced by an element. - - + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + diff --git a/reportbuilder/java/com/sun/star/report/pentaho/svg.css b/reportbuilder/java/com/sun/star/report/pentaho/svg.css index f715210c7c91..ebe16e30b115 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/svg.css +++ b/reportbuilder/java/com/sun/star/report/pentaho/svg.css @@ -2,4 +2,4 @@ /** * All default styles for formating-objects elements (if there are any). - */ +*/ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/xsl-fo.css b/reportbuilder/java/com/sun/star/report/pentaho/xsl-fo.css index 494ee66934e7..f030a3872481 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/xsl-fo.css +++ b/reportbuilder/java/com/sun/star/report/pentaho/xsl-fo.css @@ -2,4 +2,4 @@ /** * All default styles for formating-objects elements (if there are any). - */ +*/ diff --git a/reportbuilder/java/com/sun/star/report/util/DefaultJobProperties.java b/reportbuilder/java/com/sun/star/report/util/DefaultJobProperties.java index 9cd70b1c69f0..096882a29c02 100644 --- a/reportbuilder/java/com/sun/star/report/util/DefaultJobProperties.java +++ b/reportbuilder/java/com/sun/star/report/util/DefaultJobProperties.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.util; import java.util.HashMap; @@ -40,44 +38,45 @@ import java.util.Map; public class DefaultJobProperties implements JobProperties { - private final ReportEngineMetaData metaData; - private final Map properties; - public DefaultJobProperties (final ReportEngineMetaData metaData) - { - if (metaData == null) + private final ReportEngineMetaData metaData; + private final Map properties; + + public DefaultJobProperties(final ReportEngineMetaData metaData) { - throw new NullPointerException(); + if (metaData == null) + { + throw new NullPointerException(); + } + this.properties = new HashMap(); + this.metaData = metaData; } - this.properties = new HashMap(); - this.metaData = metaData; - } - public Object getProperty (final String key) - { - return properties.get(key); - } - - public void setProperty (final String key, final Object value) - throws JobDefinitionException - { - final Class type = metaData.getParameterType(key); - if (type == null) + public Object getProperty(final String key) { - throw new JobDefinitionException("The parameter name is not known: " + key); + return properties.get(key); } - if (!type.isInstance(value)) + + public void setProperty(final String key, final Object value) + throws JobDefinitionException { - throw new JobDefinitionException("The parameter value is not understood"); - } + final Class type = metaData.getParameterType(key); + if (type == null) + { + throw new JobDefinitionException("The parameter name is not known: " + key); + } + if (!type.isInstance(value)) + { + throw new JobDefinitionException("The parameter value is not understood"); + } - this.properties.put(key, value); - } + this.properties.put(key, value); + } - public JobProperties copy() - { - final DefaultJobProperties props = new DefaultJobProperties(metaData); - props.properties.putAll(properties); - return props; - } + public JobProperties copy() + { + final DefaultJobProperties props = new DefaultJobProperties(metaData); + props.properties.putAll(properties); + return props; + } } diff --git a/reportbuilder/java/com/sun/star/report/util/DefaultParameterMap.java b/reportbuilder/java/com/sun/star/report/util/DefaultParameterMap.java index 29ee586d5075..f6766a53f1a9 100644 --- a/reportbuilder/java/com/sun/star/report/util/DefaultParameterMap.java +++ b/reportbuilder/java/com/sun/star/report/util/DefaultParameterMap.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.util; import java.util.HashMap; @@ -38,92 +36,90 @@ import java.util.Map; public class DefaultParameterMap implements ParameterMap { - private final Map backend; - - public DefaultParameterMap () - { - backend = new HashMap(); - } - public void clear () - { - backend.clear(); - } + private final Map backend; - /** - * Retrieves the value stored for a key in this properties collection. - * - * @param key the property key. - * @return The stored value, or null if the key does not exist in this - * collection. - */ - public Object get (final String key) - { - if (key == null) + public DefaultParameterMap() { - throw new NullPointerException - ("DefaultParameterMap.get (..): Parameter 'key' must not be null"); + backend = new HashMap(); } - return backend.get(key); - } - /** - * Retrieves the value stored for a key in this properties collection, and returning the - * default value if the key was not stored in this properties collection. - * - * @param key the property key. - * @param defaultValue the default value to be returned when the key is not stored in - * this properties collection. - * @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) - { - if (key == null) + public void clear() { - throw new NullPointerException - ("DefaultParameterMap.get (..): Parameter 'key' must not be null"); + backend.clear(); } - final Object o = this.backend.get(key); - if (o == null) + + /** + * Retrieves the value stored for a key in this properties collection. + * + * @param key the property key. + * @return The stored value, or null if the key does not exist in this + * collection. + */ + public Object get(final String key) { - return defaultValue; + if (key == null) + { + throw new NullPointerException("DefaultParameterMap.get (..): Parameter 'key' must not be null"); + } + return backend.get(key); } - return o; - } - - public String[] keys () - { - return (String[]) this.backend.keySet().toArray(new String[backend.size()]); - } - /** - * Adds a property to this properties collection. If a property with the given name - * exist, the property will be replaced with the new value. If the value is null, the - * property will be removed. - * - * @param key the property key. - * @param value the property value. - */ - public void put (final String key, final Object value) - { - if (key == null) + /** + * Retrieves the value stored for a key in this properties collection, and returning the + * default value if the key was not stored in this properties collection. + * + * @param key the property key. + * @param defaultValue the default value to be returned when the key is not stored in + * this properties collection. + * @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) { - throw new NullPointerException - ("ReportProperties.put (..): Parameter 'key' must not be null"); + if (key == null) + { + throw new NullPointerException("DefaultParameterMap.get (..): Parameter 'key' must not be null"); + } + final Object o = this.backend.get(key); + if (o == null) + { + return defaultValue; + } + return o; } - if (value == null) + + public String[] keys() { - this.backend.remove(key); + return (String[]) this.backend.keySet().toArray(new String[backend.size()]); } - else + + /** + * Adds a property to this properties collection. If a property with the given name + * exist, the property will be replaced with the new value. If the value is null, the + * property will be removed. + * + * @param key the property key. + * @param value the property value. + */ + public void put(final String key, final Object value) { - this.backend.put(key, value); + if (key == null) + { + throw new NullPointerException("ReportProperties.put (..): Parameter 'key' must not be null"); + } + if (value == null) + { + this.backend.remove(key); + } + else + { + this.backend.put(key, value); + } } - } - public int size () - { - return this.backend.size(); - } + public int size() + { + return this.backend.size(); + } } diff --git a/reportbuilder/java/com/sun/star/report/util/DefaultReportJobDefinition.java b/reportbuilder/java/com/sun/star/report/util/DefaultReportJobDefinition.java index f9e7420d600a..83ea4eb0eedc 100644 --- a/reportbuilder/java/com/sun/star/report/util/DefaultReportJobDefinition.java +++ b/reportbuilder/java/com/sun/star/report/util/DefaultReportJobDefinition.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.util; import com.sun.star.report.DataSourceFactory; @@ -43,81 +41,79 @@ import com.sun.star.report.ReportJobDefinition; public class DefaultReportJobDefinition implements ReportJobDefinition { - public static final String OUTPUT_TYPE = "output-type"; - - private final DefaultParameterMap parameters; - private final DefaultJobProperties properties; - - public DefaultReportJobDefinition (final ReportEngineMetaData metaData) - { - this.parameters = new DefaultParameterMap(); - this.properties = new DefaultJobProperties(metaData); - } - - public void setDataSourceFactory (final DataSourceFactory dataSourceFactory) - throws JobDefinitionException - { - this.properties.setProperty(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY, dataSourceFactory); - } - - public DataSourceFactory getDataSourceFactory () - { - return (DataSourceFactory) this.properties.getProperty(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY); - } - - public InputRepository getInputRepository () - { - return (InputRepository) - this.properties.getProperty(ReportEngineParameterNames.INPUT_REPOSITORY); - } - - public void setInputRepository (final InputRepository inputRepository) - throws JobDefinitionException - { - this.properties.setProperty(ReportEngineParameterNames.INPUT_REPOSITORY, inputRepository); - } - - public OutputRepository getOutputRepository () - { - return (OutputRepository) - this.properties.getProperty(ReportEngineParameterNames.OUTPUT_REPOSITORY); - } - - public void setOutputRepository (final OutputRepository outputRepository) - throws JobDefinitionException - { - this.properties.setProperty(ReportEngineParameterNames.OUTPUT_REPOSITORY, outputRepository); - } - - /** - * The parameters of the root report definition. The parameters for the subreports are - * defined using mappings, it would not make sense to define them here. - * - * @return a map container for query parameters. - */ - public ParameterMap getQueryParameters () - { - return parameters; - } - - public void setReportDefinitionName (final String reportDefinitionName) - throws JobDefinitionException - { - this.properties.setProperty(ReportEngineParameterNames.INPUT_NAME, reportDefinitionName); - } - - /** - * The name under which we can load the report definition. - * - * @return the report definition's name. - */ - public String getReportDefinitionName () - { - return (String) this.properties.getProperty(ReportEngineParameterNames.INPUT_NAME); - } - public JobProperties getProcessingParameters () - { - return properties; - } + public static final String OUTPUT_TYPE = "output-type"; + private final DefaultParameterMap parameters; + private final DefaultJobProperties properties; + + public DefaultReportJobDefinition(final ReportEngineMetaData metaData) + { + this.parameters = new DefaultParameterMap(); + this.properties = new DefaultJobProperties(metaData); + } + + public void setDataSourceFactory(final DataSourceFactory dataSourceFactory) + throws JobDefinitionException + { + this.properties.setProperty(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY, dataSourceFactory); + } + + public DataSourceFactory getDataSourceFactory() + { + return (DataSourceFactory) this.properties.getProperty(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY); + } + + public InputRepository getInputRepository() + { + return (InputRepository) this.properties.getProperty(ReportEngineParameterNames.INPUT_REPOSITORY); + } + + public void setInputRepository(final InputRepository inputRepository) + throws JobDefinitionException + { + this.properties.setProperty(ReportEngineParameterNames.INPUT_REPOSITORY, inputRepository); + } + + public OutputRepository getOutputRepository() + { + return (OutputRepository) this.properties.getProperty(ReportEngineParameterNames.OUTPUT_REPOSITORY); + } + + public void setOutputRepository(final OutputRepository outputRepository) + throws JobDefinitionException + { + this.properties.setProperty(ReportEngineParameterNames.OUTPUT_REPOSITORY, outputRepository); + } + + /** + * The parameters of the root report definition. The parameters for the subreports are + * defined using mappings, it would not make sense to define them here. + * + * @return a map container for query parameters. + */ + public ParameterMap getQueryParameters() + { + return parameters; + } + + public void setReportDefinitionName(final String reportDefinitionName) + throws JobDefinitionException + { + this.properties.setProperty(ReportEngineParameterNames.INPUT_NAME, reportDefinitionName); + } + + /** + * The name under which we can load the report definition. + * + * @return the report definition's name. + */ + public String getReportDefinitionName() + { + return (String) this.properties.getProperty(ReportEngineParameterNames.INPUT_NAME); + } + + public JobProperties getProcessingParameters() + { + return properties; + } } diff --git a/reportbuilder/java/com/sun/star/report/util/ManifestWriter.java b/reportbuilder/java/com/sun/star/report/util/ManifestWriter.java index 9fab3246ae8f..c07e7ae0e262 100644 --- a/reportbuilder/java/com/sun/star/report/util/ManifestWriter.java +++ b/reportbuilder/java/com/sun/star/report/util/ManifestWriter.java @@ -27,7 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - package com.sun.star.report.util; import java.util.HashMap; @@ -52,71 +51,72 @@ import com.sun.star.report.OutputRepository; public class ManifestWriter { // need this two strings other it breaks the ooo build :-( - public static final String MANIFEST_NS = "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"; - public static final String TAG_DEF_PREFIX = "com.sun.star.report.pentaho.output."; - private final Map entries; - public ManifestWriter() - { - entries = new HashMap(); - } + public static final String MANIFEST_NS = "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"; + public static final String TAG_DEF_PREFIX = "com.sun.star.report.pentaho.output."; + private final Map entries; - public void addEntry(final String fullPath, final String mimeType) - { - if (fullPath == null) + public ManifestWriter() { - throw new NullPointerException(); + entries = new HashMap(); } - if (mimeType == null) + + public void addEntry(final String fullPath, final String mimeType) { - throw new NullPointerException(); + if (fullPath == null) + { + throw new NullPointerException(); + } + if (mimeType == null) + { + throw new NullPointerException(); + } + if ("META-INF/manifest.xml".equals(fullPath)) + { + return; + } + entries.put(fullPath, mimeType); } - if ("META-INF/manifest.xml".equals(fullPath)) + + public boolean isEmpty() { - return; + return entries.isEmpty(); } - entries.put(fullPath, mimeType); - } - - public boolean isEmpty() - { - return entries.isEmpty(); - } - public void write(final OutputRepository outputRepository) throws IOException - { - if (isEmpty()) + public void write(final OutputRepository outputRepository) throws IOException { - return; - } + if (isEmpty()) + { + return; + } - final DefaultTagDescription tagDescription = new DefaultTagDescription(); - tagDescription.configure(JFreeReportBoot.getInstance().getGlobalConfig(), - TAG_DEF_PREFIX); + final DefaultTagDescription tagDescription = new DefaultTagDescription(); + tagDescription.configure(JFreeReportBoot.getInstance().getGlobalConfig(), + TAG_DEF_PREFIX); - final OutputStream manifestOutputStream = - outputRepository.createOutputStream("META-INF/manifest.xml", "text/xml"); + final OutputStream manifestOutputStream = + outputRepository.createOutputStream("META-INF/manifest.xml", "text/xml"); - final OutputStreamWriter writer = new OutputStreamWriter(manifestOutputStream, "UTF-8"); - final XmlWriter xmlWriter = new XmlWriter(writer, tagDescription); - xmlWriter.setAlwaysAddNamespace(true); - xmlWriter.writeXmlDeclaration("UTF-8"); + final OutputStreamWriter writer = new OutputStreamWriter(manifestOutputStream, "UTF-8"); + final XmlWriter xmlWriter = new XmlWriter(writer, tagDescription); + xmlWriter.setAlwaysAddNamespace(true); + xmlWriter.writeXmlDeclaration("UTF-8"); - final AttributeList rootAttributes = new AttributeList(); - rootAttributes.addNamespaceDeclaration("manifest", MANIFEST_NS); - xmlWriter.writeTag(MANIFEST_NS, "manifest", rootAttributes, XmlWriterSupport.OPEN); + final AttributeList rootAttributes = new AttributeList(); + rootAttributes.addNamespaceDeclaration("manifest", MANIFEST_NS); + xmlWriter.writeTag(MANIFEST_NS, "manifest", rootAttributes, XmlWriterSupport.OPEN); - final Iterator iterator = entries.entrySet().iterator(); - while (iterator.hasNext()) - { - final Map.Entry entry = (Map.Entry) iterator.next(); - final AttributeList entryAttrs = new AttributeList(); - entryAttrs.setAttribute(MANIFEST_NS, "media-type", (String) entry.getValue()); - entryAttrs.setAttribute(MANIFEST_NS, "full-path", (String) entry.getKey()); - xmlWriter.writeTag(MANIFEST_NS, "file-entry", entryAttrs, XmlWriterSupport.CLOSE); - } + final Iterator iterator = entries.entrySet().iterator(); + while (iterator.hasNext()) + { + final Map.Entry entry = (Map.Entry) iterator.next(); + final AttributeList entryAttrs = new AttributeList(); + entryAttrs.setAttribute(MANIFEST_NS, "media-type", (String) entry.getValue()); + entryAttrs.setAttribute(MANIFEST_NS, "full-path", (String) entry.getKey()); + xmlWriter.writeTag(MANIFEST_NS, "file-entry", entryAttrs, XmlWriterSupport.CLOSE); + } - xmlWriter.writeCloseTag(); - xmlWriter.close(); - } + xmlWriter.writeCloseTag(); + xmlWriter.close(); + } } -- cgit From b5c8e3b6159c0874a284ae6181b3b7b8c5fb0dd3 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Tue, 24 Nov 2009 11:34:17 +0100 Subject: dba33d: #i104949# show cell value when set field text nodes exits --- .../report/pentaho/layoutprocessor/FormattedTextLayoutController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java index e33171840430..16bc355f8b77 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java @@ -135,9 +135,8 @@ public class FormattedTextLayoutController } else { - final DataFlags df = FormatValueUtility.computeDataFlag(element, getFlowController()); - if (df != null) + if (df != null && df.getValue() instanceof String ) { target.processContent(df); } -- cgit From 510361e19b2e8f0955795a6007c0baf8cbafc9cd Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 25 Nov 2009 10:12:45 +0100 Subject: dba33d: #i104712# qurtal expression fixed --- .../sun/star/report/pentaho/PentahoReportJob.java | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java index fbfa211e112c..23f959e05943 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java @@ -265,18 +265,22 @@ public class PentahoReportJob implements ReportJob if (reportExp.getName().equals(name)) { - final LValue val = parser.parse(reportExp.getFormulaExpression()); - if (val instanceof FormulaFunction) + LValue val = parser.parse(reportExp.getFormulaExpression()); + while( !(val instanceof ContextLookup)) { - final FormulaFunction reportFunction = (FormulaFunction) val; - - final ContextLookup context = (ContextLookup) reportFunction.getChildValues()[0]; - name = context.getName(); + if (val instanceof Term) + { + val = ((Term)val).getHeadValue(); + } + else if (val instanceof FormulaFunction) + { + final FormulaFunction reportFunction = (FormulaFunction) val; + val = reportFunction.getChildValues()[0]; + } } - else if (val instanceof Term) + if (val instanceof ContextLookup) { - final Term term = (Term) val; - final ContextLookup context = (ContextLookup) term.getHeadValue().getChildValues()[0]; + final ContextLookup context = (ContextLookup) val; name = context.getName(); } break; -- cgit From 96c967926ea1c35f6a5c187324565812aed3d681 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 3 Dec 2009 08:59:14 +0100 Subject: srb1: #i99049# add new lib from pentaho --- reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf | 8 ++++---- reportbuilder/java/com/sun/star/report/pentaho/makefile.mk | 14 +++++++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf b/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf index e85f2018da99..ac543733876b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf +++ b/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf @@ -1,7 +1,7 @@ RegistrationClassName: com.sun.star.report.pentaho.SOReportJobFactory Class-Path: reportbuilderwizard.jar - flute-1.1.2.jar libserializer-1.1.2.jar libbase-1.1.2.jar - libfonts-1.1.2.jar libformula-1.1.2.jar liblayout-0.2.9.jar - libloader-1.1.2.jar librepository-1.1.2.jar libxml-1.1.2.jar - flow-engine-0.9.2.jar sac.jar commons-logging-1.1.1.jar + flute-1.1.2.jar libserializer-1.1.3.jar libbase-1.1.3.jar + libfonts-1.1.3.jar libformula-1.1.3.jar liblayout-0.2.10.jar + libloader-1.1.3.jar librepository-1.1.3.jar libxml-1.1.3.jar + flow-engine-0.9.4.jar sac.jar commons-logging-1.1.1.jar UNO-Type-Path: diff --git a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk index 4b91d0966ebe..a26c4fde3ad8 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk @@ -37,13 +37,25 @@ PACKAGE = com$/sun$/star$/report$/pentaho nodep=true # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk +.INCLUDE : $(SOLARBINDIR)/jfreereport_version.mk #----- compile .java files ----------------------------------------- JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar .IF "$(SYSTEM_JFREEREPORT)" == "YES" XCLASSPATH!:=$(XCLASSPATH)$(FLUTE_JAR)$(PATH_SEPERATOR)$(LIBBASE_JAR)$(PATH_SEPERATOR)$(LIBXML_JAR)$(PATH_SEPERATOR)$(JFREEREPORT_JAR)$(PATH_SEPERATOR)$(LIBLOADER_JAR)$(PATH_SEPERATOR)$(SAC_JAR)$(PATH_SEPERATOR)$(LIBLAYOUT_JAR)$(PATH_SEPERATOR)$(LIBSERIALIZER_JAR)$(PATH_SEPERATOR)$(LIBFONTS_JAR)$(PATH_SEPERATOR)$(LIBFORMULA_JAR)$(PATH_SEPERATOR)$(LIBREPOSITORY_JAR) .ELSE -JARFILES += flute-1.1.2.jar libbase-1.1.2.jar libfonts-1.1.2.jar libformula-1.1.2.jar liblayout-0.2.9.jar libloader-1.1.2.jar librepository-1.1.2.jar libxml-1.1.2.jar flow-engine-0.9.2.jar sac.jar +JARFILES += \ + flute-$(FLUTE_VERSION).jar \ + libserializer-$(LIBSERIALIZER_VERSION).jar \ + libbase-$(LIBBASE_VERSION).jar \ + libfonts-$(LIBFONTS_VERSION).jar \ + libformula-$(LIBFORMULA_VERSION).jar \ + liblayout-$(LIBLAYOUT_VERSION).jar \ + libloader-$(LIBLOADER_VERSION).jar \ + librepository-$(LIBREPOSITORY_VERSION).jar \ + libxml-$(LIBXML_VERSION).jar \ + flow-engine-$(FLOW_ENGINE_VERSION).jar \ + sac.jar .ENDIF .IF "$(SYSTEM_APACHE_COMMONS)" == "YES" -- cgit From 21adfcda8071a0df2ae7c72cdf42a28c32bdaef8 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 7 Dec 2009 09:18:27 +0100 Subject: srb1: #i99049# use version include --- .../java/com/sun/star/report/function/metadata/makefile.mk | 5 ++++- reportbuilder/java/com/sun/star/report/util/makefile.mk | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk index 1025bcea7cb7..90060e44db32 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk @@ -36,12 +36,15 @@ PACKAGE = com$/sun$/star$/report$/function$/metadata # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk +.INCLUDE : $(SOLARBINDIR)/jfreereport_version.mk #----- compile .java files ----------------------------------------- .IF "$(SYSTEM_JFREEREPORT)" == "YES" CLASSPATH!:==$(CLASSPATH)$(PATH_SEPERATOR)$(LIBBASE_JAR)$(PATH_SEPERATOR)$(LIBFORMULA_JAR) .ELSE -JARFILES += libbase-1.0.0.jar libformula-0.2.0.jar +JARFILES += \ + libbase-$(LIBBASE_VERSION).jar \ + libformula-$(LIBFORMULA_VERSION).jar .ENDIF JAVAFILES := AuthorFunction.java \ diff --git a/reportbuilder/java/com/sun/star/report/util/makefile.mk b/reportbuilder/java/com/sun/star/report/util/makefile.mk index 5ef3f02b0a1f..8962f3f69e12 100644 --- a/reportbuilder/java/com/sun/star/report/util/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/util/makefile.mk @@ -36,12 +36,16 @@ PACKAGE = com$/sun$/star$/report$/util # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk +.INCLUDE : $(SOLARBINDIR)/jfreereport_version.mk #----- compile .java files ----------------------------------------- .IF "$(SYSTEM_JFREEREPORT)" == "YES" CLASSPATH!:=$(CLASSPATH)$(PATH_SEPERATOR)$(LIBBASE_JAR)$(PATH_SEPERATOR)$(LIBXML_JAR)$(PATH_SEPERATOR)$(JFREEREPORT_JAR) .ELSE -JARFILES = libbase-1.0.0.jar libxml-1.0.0.jar flow-engine-0.9.2.jar +JARFILES += \ + libbase-$(LIBBASE_VERSION).jar \ + libxml-$(LIBXML_VERSION).jar \ + flow-engine-$(FLOW_ENGINE_VERSION).jar .ENDIF JAVAFILES = DefaultJobProperties.java DefaultParameterMap.java DefaultReportJobDefinition.java ManifestWriter.java -- cgit From 8aa99f59a4ab4fba762c072b210620aa9f6a8ddd Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 7 Jan 2010 09:16:59 +0100 Subject: check already quoted expression --- reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java | 4 ++-- reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java index 5c3032e3a7f9..cbd215220bc9 100644 --- a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java +++ b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java @@ -210,7 +210,7 @@ public class SDBCReportDataFactory implements DataSourceFactory 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 RowSetProperties rowSetProps = new RowSetProperties(escapeProcessing, commandType, command, filter, maxRows); final Object[] p = createRowSet(rowSetProps, parameters); final XRowSet rowSet = (XRowSet) p[0]; @@ -260,7 +260,7 @@ public class SDBCReportDataFactory implements DataSourceFactory final Object[] pair = (Object[]) groupExpressions.get(i); String expression = (String) pair[0]; - if (columns.hasByName(expression)) + if (!expression.startsWith(quote) && columns.hasByName(expression)) { expression = quote + expression + quote; } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java index 23f959e05943..6641092ca6ee 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java @@ -257,6 +257,11 @@ public class PentahoReportJob implements ReportJob if (parameters.length > 0) { String name = parameters[0].toString(); + if (parameters[0] instanceof ContextLookup) + { + final ContextLookup context = (ContextLookup) parameters[0]; + name = context.getName(); + } for (int j = 0; j < reportFunctions.length; j++) { if (reportFunctions[j] instanceof FormulaExpression) -- cgit From 1ddcd1caed5fa7b63df12385839f6f4c15b883ed Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 8 Jan 2010 09:23:27 +0100 Subject: dba33e: #i107472# correct class param for ConnectionTools --- .../com/sun/star/report/SDBCReportDataFactory.java | 268 ++------------------- .../sun/star/report/pentaho/PentahoReportJob.java | 2 +- 2 files changed, 27 insertions(+), 243 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java index cbd215220bc9..8653d0ba6e3d 100644 --- a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java +++ b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java @@ -254,33 +254,35 @@ public class SDBCReportDataFactory implements DataSourceFactory final String quote = connection.getMetaData().getIdentifierQuoteString(); final XComponent[] hold = new XComponent[1]; final XNameAccess columns = getFieldsByCommandDescriptor(commandType, command, hold); - - for (int i = 0; i < count; i++) + if (columns != null) { - final Object[] pair = (Object[]) groupExpressions.get(i); - String expression = (String) pair[0]; - - if (!expression.startsWith(quote) && columns.hasByName(expression)) + for (int i = 0; i < count; i++) { - expression = quote + expression + quote; - } - expression = expression.trim(); // Trim away white spaces + final Object[] pair = (Object[]) groupExpressions.get(i); + String expression = (String) pair[0]; - if (expression.length() > 0) - { - order.append(expression); - if (order.length() > 0) + if (!expression.startsWith(quote) && columns.hasByName(expression)) { - order.append(' '); + expression = quote + expression + quote; } - final String sorting = (String) pair[1]; - if (sorting == null || sorting.equals(OfficeToken.FALSE)) - { - order.append("DESC"); - } - if ((i + 1) < count) + expression = expression.trim(); // Trim away white spaces + + if (expression.length() > 0) { - order.append(", "); + order.append(expression); + if (order.length() > 0) + { + order.append(' '); + } + final String sorting = (String) pair[1]; + if (sorting == null || sorting.equals(OfficeToken.FALSE)) + { + order.append("DESC"); + } + if ((i + 1) < count) + { + order.append(", "); + } } } } @@ -296,7 +298,7 @@ public class SDBCReportDataFactory implements DataSourceFactory private XNameAccess getFieldsByCommandDescriptor(final int commandType, final String command, final XComponent[] out) throws SQLException { final Class[] parameter = new Class[3]; - parameter[0] = Integer.class; + parameter[0] = int.class; parameter[1] = String.class; parameter[2] = out.getClass(); final XConnectionTools tools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, connection); @@ -309,171 +311,7 @@ public class SDBCReportDataFactory implements DataSourceFactory { } - XNameAccess xFields = null; - // some kind of state machine to ease the sharing of code - int eState = FAILED; - switch (commandType) - { - case CommandType.TABLE: - eState = HANDLE_TABLE; - break; - case CommandType.QUERY: - eState = HANDLE_QUERY; - break; - case CommandType.COMMAND: - eState = HANDLE_SQL; - break; - } - - // needed in various states: - XNameAccess xObjectCollection = null; - XColumnsSupplier xSupplyColumns = null; - - try - { - // go! - while ((DONE != eState) && (FAILED != eState)) - { - switch (eState) - { - case HANDLE_TABLE: - { - // 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(); - // if something went wrong 'til here, then this will be handled in the next state - - // next state: get the object - } - eState = RETRIEVE_OBJECT; - } - break; - - case HANDLE_QUERY: - { - // 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(); - // if something went wrong 'til here, then this will be handled in the next state - - // next state: get the object - } - eState = RETRIEVE_OBJECT; - } - break; - - case RETRIEVE_OBJECT: - // here we should have an object (aka query or table) collection, and are going - // to retrieve the desired object - - // next state: default to FAILED - eState = FAILED; - - if (xObjectCollection != null && xObjectCollection.hasByName(command)) - { - xSupplyColumns = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xObjectCollection.getByName(command)); - - // next: go for the columns - eState = RETRIEVE_COLUMNS; - } - break; - - case RETRIEVE_COLUMNS: - // next state: default to FAILED - eState = FAILED; - - if (xSupplyColumns != null) - { - xFields = xSupplyColumns.getColumns(); - // that's it - eState = DONE; - } - break; - - case HANDLE_SQL: - { - 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. - - try - { - final XMultiServiceFactory xComposerFac = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, connection); - - if (xComposerFac != null) - { - final XSingleSelectQueryComposer xComposer = (XSingleSelectQueryComposer) UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, xComposerFac.createInstance("com.sun.star.sdb.SingleSelectQueryComposer")); - if (xComposer != null) - { - xComposer.setQuery(sStatementToExecute); - - // Now set the filter to a dummy restriction which will result in an empty - // result set. - xComposer.setFilter("0=1"); - - 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 - } - - // 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", 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 - - // so the next state is to get the columns - eState = RETRIEVE_COLUMNS; - } - break; - default: - eState = FAILED; - } - } - } - catch (com.sun.star.uno.Exception ex) - { - } - return xFields; + throw new SQLException(); } private XSingleSelectQueryComposer getComposer(final XConnectionTools tools, @@ -504,61 +342,7 @@ public class SDBCReportDataFactory implements DataSourceFactory // should not happen // assert False } - try - { - final XMultiServiceFactory factory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, connection); - 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) - { - 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 XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, queries.getByName(command)); - final Boolean escape = (Boolean) prop.getPropertyValue(ESCAPEPROCESSING); - if (escape) - { - 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) - { - composer.setOrder(order); - } - final Boolean applyFilter = (Boolean) prop.getPropertyValue(UNO_APPLY_FILTER); - if (applyFilter) - { - final String filter = (String) prop.getPropertyValue(UNO_FILTER); - if (filter != null && filter.length() != 0) - { - composer.setFilter(filter); - } - } - statement = composer.getQuery(); - } - } - } - break; - } - case CommandType.COMMAND: - statement = command; - break; - } - out.setElementaryQuery(statement); - return out; - } - catch (Exception e) - { - } + return null; } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java index 6641092ca6ee..6889e3100f92 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java @@ -375,7 +375,7 @@ public class PentahoReportJob implements ReportJob catch (final Exception e) { String message = e.getMessage(); - if (message.length() == 0) + if (message == null || message.length() == 0) { message = "Failed to process the report"; } -- cgit From ed6a92553b678c64d7c6c0f8b3259e014a4851b3 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 8 Jan 2010 10:16:56 +0100 Subject: dba33e: #i108092# set NAN when double value is NULL --- .../sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java | 2 +- .../report/pentaho/layoutprocessor/TableCellLayoutController.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'reportbuilder/java/com/sun/star') 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 405fe4a2815b..79c946c9643d 100755 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -57,7 +57,7 @@ public class FormatValueUtility private static final String BOOLEAN_VALUE = "boolean-value"; private static final String STRING_VALUE = "string-value"; public static final String VALUE_TYPE = "value-type"; - private static final String VALUE = "value"; + public static final String VALUE = "value"; private static SimpleDateFormat dateFormat; private static SimpleDateFormat timeFormat; 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 5393a5e13a15..baba6c9aafe5 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java @@ -80,6 +80,10 @@ public class TableCellLayoutController extends SectionLayoutController { FormatValueUtility.applyValueForCell(value.getValue(), attributeMap, valueType); } + else if ( "float".equals(valueType)) + { + attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE, "1.#NAN"); + } } catch (Exception e) { -- cgit From f321b0bed8021ff22714095371db907897cfba35 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 11 Feb 2010 11:07:17 +0100 Subject: sb118: #i109112# re-purpose EXTRAJARFILES --- reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk | 4 ++-- reportbuilder/java/com/sun/star/report/makefile.mk | 2 +- reportbuilder/java/com/sun/star/report/pentaho/makefile.mk | 4 ++-- reportbuilder/java/com/sun/star/report/util/makefile.mk | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk index 1025bcea7cb7..13f49bbce493 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk @@ -39,9 +39,9 @@ PACKAGE = com$/sun$/star$/report$/function$/metadata #----- compile .java files ----------------------------------------- .IF "$(SYSTEM_JFREEREPORT)" == "YES" -CLASSPATH!:==$(CLASSPATH)$(PATH_SEPERATOR)$(LIBBASE_JAR)$(PATH_SEPERATOR)$(LIBFORMULA_JAR) +EXTRAJARFILES = $(LIBBASE_JAR) $(LIBFORMULA_JAR) .ELSE -JARFILES += libbase-1.0.0.jar libformula-0.2.0.jar +JARFILES = libbase-1.0.0.jar libformula-0.2.0.jar .ENDIF JAVAFILES := AuthorFunction.java \ diff --git a/reportbuilder/java/com/sun/star/report/makefile.mk b/reportbuilder/java/com/sun/star/report/makefile.mk index 5b36aff44ee8..5706d62e2ecd 100644 --- a/reportbuilder/java/com/sun/star/report/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/makefile.mk @@ -40,7 +40,7 @@ PACKAGE = com$/sun$/star$/report JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar .IF "$(SYSTEM_APACHE_COMMONS)" == "YES" -XCLASSPATH!:==$(XCLASSPATH)$(PATH_SEPERATOR)$(COMMONS_LOGGING_JAR) +EXTRAJARFILES = $(COMMONS_LOGGING_JAR) .ELSE JARFILES += commons-logging-1.1.1.jar .ENDIF diff --git a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk index 36e83afac2d0..d2f8b11d427f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk @@ -41,13 +41,13 @@ nodep=true #----- compile .java files ----------------------------------------- JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar .IF "$(SYSTEM_JFREEREPORT)" == "YES" -XCLASSPATH!:=$(XCLASSPATH)$(FLUTE_JAR)$(PATH_SEPERATOR)$(LIBBASE_JAR)$(PATH_SEPERATOR)$(LIBXML_JAR)$(PATH_SEPERATOR)$(JFREEREPORT_JAR)$(PATH_SEPERATOR)$(LIBLOADER_JAR)$(PATH_SEPERATOR)$(SAC_JAR)$(PATH_SEPERATOR)$(LIBLAYOUT_JAR)$(PATH_SEPERATOR)$(LIBSERIALIZER_JAR)$(PATH_SEPERATOR)$(LIBFONTS_JAR)$(PATH_SEPERATOR)$(LIBFORMULA_JAR)$(PATH_SEPERATOR)$(LIBREPOSITORY_JAR) +EXTRAJARFILES += $(FLUTE_JAR) $(LIBBASE_JAR) $(LIBXML_JAR) $(JFREEREPORT_JAR) $(LIBLOADER_JAR) $(SAC_JAR) $(LIBLAYOUT_JAR) $(LIBSERIALIZER_JAR) $(LIBFONTS_JAR) $(LIBFORMULA_JAR) $(LIBREPOSITORY_JAR) .ELSE JARFILES += flute-1.3.0.jar libbase-1.0.0.jar libfonts-1.0.0.jar libformula-0.2.0.jar liblayout-0.2.9.jar libloader-1.0.0.jar librepository-1.0.0.jar libxml-1.0.0.jar flow-engine-0.9.2.jar sac.jar .ENDIF .IF "$(SYSTEM_APACHE_COMMONS)" == "YES" -XCLASSPATH!:=$(XCLASSPATH)$(PATH_SEPERATOR)$(COMMONS_LOGGING_JAR) +EXTRAJARFILES += $(COMMONS_LOGGING_JAR) .ELSE JARFILES += commons-logging-1.1.1.jar .ENDIF diff --git a/reportbuilder/java/com/sun/star/report/util/makefile.mk b/reportbuilder/java/com/sun/star/report/util/makefile.mk index 5ef3f02b0a1f..8460afa14c48 100644 --- a/reportbuilder/java/com/sun/star/report/util/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/util/makefile.mk @@ -39,7 +39,7 @@ PACKAGE = com$/sun$/star$/report$/util #----- compile .java files ----------------------------------------- .IF "$(SYSTEM_JFREEREPORT)" == "YES" -CLASSPATH!:=$(CLASSPATH)$(PATH_SEPERATOR)$(LIBBASE_JAR)$(PATH_SEPERATOR)$(LIBXML_JAR)$(PATH_SEPERATOR)$(JFREEREPORT_JAR) +EXTRAJARFILES = $(LIBBASE_JAR) $(LIBXML_JAR) $(JFREEREPORT_JAR) .ELSE JARFILES = libbase-1.0.0.jar libxml-1.0.0.jar flow-engine-0.9.2.jar .ENDIF -- cgit From 4326ef06febe54729620f31d18505fd9f847a7f1 Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Fri, 12 Feb 2010 15:01:35 +0100 Subject: changefileheader2: #i109125#: change source file copyright notice from Sun Microsystems to Oracle; remove CVS style keywords (RCSfile, Revision) --- reportbuilder/java/com/sun/star/report/DataRow.java | 5 +---- reportbuilder/java/com/sun/star/report/DataSource.java | 5 +---- reportbuilder/java/com/sun/star/report/DataSourceException.java | 5 +---- reportbuilder/java/com/sun/star/report/DataSourceFactory.java | 5 +---- reportbuilder/java/com/sun/star/report/ImageService.java | 5 +---- reportbuilder/java/com/sun/star/report/InputRepository.java | 5 +---- .../java/com/sun/star/report/JobDefinitionException.java | 5 +---- reportbuilder/java/com/sun/star/report/JobProgressIndicator.java | 5 +---- reportbuilder/java/com/sun/star/report/JobProperties.java | 5 +---- reportbuilder/java/com/sun/star/report/OfficeToken.java | 5 +---- reportbuilder/java/com/sun/star/report/OutputRepository.java | 5 +---- reportbuilder/java/com/sun/star/report/ParameterMap.java | 5 +---- reportbuilder/java/com/sun/star/report/ReportAddIn.java | 5 +---- reportbuilder/java/com/sun/star/report/ReportEngine.java | 5 +---- reportbuilder/java/com/sun/star/report/ReportEngineMetaData.java | 5 +---- .../java/com/sun/star/report/ReportEngineParameterNames.java | 5 +---- .../java/com/sun/star/report/ReportExecutionException.java | 5 +---- reportbuilder/java/com/sun/star/report/ReportExpression.java | 5 +---- .../java/com/sun/star/report/ReportExpressionMetaData.java | 5 +---- reportbuilder/java/com/sun/star/report/ReportFunction.java | 5 +---- reportbuilder/java/com/sun/star/report/ReportJob.java | 5 +---- reportbuilder/java/com/sun/star/report/ReportJobDefinition.java | 5 +---- reportbuilder/java/com/sun/star/report/ReportJobFactory.java | 5 +---- reportbuilder/java/com/sun/star/report/SDBCReportData.java | 5 +---- reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java | 5 +---- reportbuilder/java/com/sun/star/report/SOImageService.java | 5 +---- reportbuilder/java/com/sun/star/report/StorageRepository.java | 5 +---- .../sun/star/report/function/metadata/Author-Function.properties | 8 ++------ .../report/function/metadata/Author-Function_en_US.properties | 8 ++------ .../com/sun/star/report/function/metadata/AuthorFunction.java | 5 +---- .../star/report/function/metadata/AuthorFunctionDescription.java | 5 +---- .../star/report/function/metadata/MetaDataFunctionCategory.java | 5 +---- .../sun/star/report/function/metadata/Title-Function.properties | 8 ++------ .../star/report/function/metadata/Title-Function_en_US.properties | 8 ++------ .../java/com/sun/star/report/function/metadata/TitleFunction.java | 5 +---- .../star/report/function/metadata/TitleFunctionDescription.java | 5 +---- .../com/sun/star/report/function/metadata/category.properties | 6 +----- .../sun/star/report/function/metadata/category_en_US.properties | 8 ++------ .../java/com/sun/star/report/function/metadata/makefile.mk | 6 +----- reportbuilder/java/com/sun/star/report/makefile.mk | 6 +----- .../java/com/sun/star/report/pentaho/DefaultNameGenerator.java | 5 +---- .../java/com/sun/star/report/pentaho/OfficeNamespaces.java | 5 +---- .../java/com/sun/star/report/pentaho/PentahoFormulaContext.java | 5 +---- .../java/com/sun/star/report/pentaho/PentahoReportAddIn.java | 5 +---- .../java/com/sun/star/report/pentaho/PentahoReportEngine.java | 5 +---- .../com/sun/star/report/pentaho/PentahoReportEngineMetaData.java | 5 +---- .../java/com/sun/star/report/pentaho/PentahoReportJob.java | 5 +---- .../java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java | 6 +----- .../java/com/sun/star/report/pentaho/SOFormulaParser.java | 6 +----- .../java/com/sun/star/report/pentaho/SOFunctionManager.java | 6 +----- .../java/com/sun/star/report/pentaho/SOReportJobFactory.java | 5 +---- .../java/com/sun/star/report/pentaho/StarFunctionCategory.java | 6 +----- .../java/com/sun/star/report/pentaho/StarFunctionDescription.java | 6 +----- .../java/com/sun/star/report/pentaho/StarReportData.java | 5 +---- .../java/com/sun/star/report/pentaho/StarReportDataFactory.java | 5 +---- .../java/com/sun/star/report/pentaho/StarReportModule.java | 5 +---- .../java/com/sun/star/report/pentaho/configuration.properties | 6 +----- .../com/sun/star/report/pentaho/expressions/SumExpression.java | 5 +---- .../star/report/pentaho/expressions/SumExpressionMetaData.java | 5 +---- .../layoutprocessor/AbstractReportElementLayoutController.java | 5 +---- .../report/pentaho/layoutprocessor/FixedTextLayoutController.java | 5 +---- .../star/report/pentaho/layoutprocessor/FormatValueUtility.java | 5 +---- .../pentaho/layoutprocessor/FormattedTextLayoutController.java | 5 +---- .../star/report/pentaho/layoutprocessor/ImageElementContext.java | 5 +---- .../pentaho/layoutprocessor/ImageElementLayoutController.java | 5 +---- .../report/pentaho/layoutprocessor/ObjectOleLayoutController.java | 5 +---- .../pentaho/layoutprocessor/OfficeDetailLayoutController.java | 5 +---- .../pentaho/layoutprocessor/OfficeGroupLayoutController.java | 5 +---- .../layoutprocessor/OfficeGroupSectionLayoutController.java | 5 +---- .../layoutprocessor/OfficeRepeatingStructureLayoutController.java | 5 +---- .../pentaho/layoutprocessor/OfficeReportLayoutController.java | 5 +---- .../pentaho/layoutprocessor/OfficeTableLayoutController.java | 5 +---- .../layoutprocessor/OfficeTableTemplateLayoutController.java | 5 +---- .../report/pentaho/layoutprocessor/TableCellLayoutController.java | 5 +---- .../star/report/pentaho/layoutprocessor/VariablesCollection.java | 5 +---- .../layoutprocessor/VariablesDeclarationLayoutController.java | 5 +---- .../com/sun/star/report/pentaho/loader/InputRepositoryLoader.java | 5 +---- .../star/report/pentaho/loader/InputRepositoryResourceData.java | 5 +---- .../java/com/sun/star/report/pentaho/loader/InputResourceKey.java | 5 +---- reportbuilder/java/com/sun/star/report/pentaho/makefile.mk | 6 +----- .../java/com/sun/star/report/pentaho/model/DataStyle.java | 5 +---- .../java/com/sun/star/report/pentaho/model/FixedTextElement.java | 5 +---- .../com/sun/star/report/pentaho/model/FontFaceDeclsSection.java | 5 +---- .../java/com/sun/star/report/pentaho/model/FontFaceElement.java | 5 +---- .../java/com/sun/star/report/pentaho/model/FormatCondition.java | 5 +---- .../com/sun/star/report/pentaho/model/FormattedTextElement.java | 5 +---- .../java/com/sun/star/report/pentaho/model/ImageElement.java | 5 +---- .../java/com/sun/star/report/pentaho/model/ObjectOleElement.java | 5 +---- .../com/sun/star/report/pentaho/model/OfficeDetailSection.java | 5 +---- .../java/com/sun/star/report/pentaho/model/OfficeDocument.java | 5 +---- .../java/com/sun/star/report/pentaho/model/OfficeGroup.java | 5 +---- .../com/sun/star/report/pentaho/model/OfficeGroupSection.java | 5 +---- .../java/com/sun/star/report/pentaho/model/OfficeMasterPage.java | 5 +---- .../com/sun/star/report/pentaho/model/OfficeMasterStyles.java | 5 +---- .../java/com/sun/star/report/pentaho/model/OfficeReport.java | 5 +---- .../java/com/sun/star/report/pentaho/model/OfficeStyle.java | 5 +---- .../java/com/sun/star/report/pentaho/model/OfficeStyles.java | 5 +---- .../com/sun/star/report/pentaho/model/OfficeStylesCollection.java | 5 +---- .../com/sun/star/report/pentaho/model/OfficeTableSection.java | 5 +---- .../java/com/sun/star/report/pentaho/model/PageLayout.java | 5 +---- .../java/com/sun/star/report/pentaho/model/PageSection.java | 5 +---- reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java | 5 +---- .../java/com/sun/star/report/pentaho/model/ReportElement.java | 5 +---- .../java/com/sun/star/report/pentaho/model/TableCellElement.java | 5 +---- .../star/report/pentaho/model/VariablesDeclarationSection.java | 5 +---- reportbuilder/java/com/sun/star/report/pentaho/module.properties | 6 +----- .../java/com/sun/star/report/pentaho/output/ImageProducer.java | 5 +---- .../star/report/pentaho/output/OfficeDocumentReportTarget.java | 5 +---- .../java/com/sun/star/report/pentaho/output/OleProducer.java | 5 +---- .../java/com/sun/star/report/pentaho/output/StyleUtilities.java | 5 +---- .../java/com/sun/star/report/pentaho/output/StylesWriter.java | 5 +---- .../star/report/pentaho/output/chart/ChartRawReportProcessor.java | 5 +---- .../star/report/pentaho/output/chart/ChartRawReportTarget.java | 5 +---- .../pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java | 5 +---- .../pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java | 5 +---- .../sun/star/report/pentaho/output/text/MasterPageFactory.java | 5 +---- .../sun/star/report/pentaho/output/text/PageBreakDefinition.java | 5 +---- .../java/com/sun/star/report/pentaho/output/text/PageContext.java | 5 +---- .../star/report/pentaho/output/text/TextRawReportProcessor.java | 5 +---- .../sun/star/report/pentaho/output/text/TextRawReportTarget.java | 5 +---- .../star/report/pentaho/output/text/VariablesDeclarations.java | 5 +---- .../sun/star/report/pentaho/parser/AttributeSpecification.java | 5 +---- .../com/sun/star/report/pentaho/parser/ElementReadHandler.java | 5 +---- .../report/pentaho/parser/OfficeDocumentXmlResourceFactory.java | 5 +---- .../java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java | 5 +---- .../report/pentaho/parser/OfficeStylesXmlResourceFactory.java | 5 +---- .../sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java | 5 +---- .../com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java | 5 +---- .../java/com/sun/star/report/pentaho/parser/StyleMapper.java | 5 +---- .../sun/star/report/pentaho/parser/chart/ChartReadHandler.java | 5 +---- .../sun/star/report/pentaho/parser/data/DataStyleReadHandler.java | 5 +---- .../sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java | 5 +---- .../sun/star/report/pentaho/parser/office/BodyReadHandler.java | 5 +---- .../report/pentaho/parser/office/DocumentContentReadHandler.java | 5 +---- .../report/pentaho/parser/office/DocumentStylesReadHandler.java | 5 +---- .../report/pentaho/parser/office/FontFaceDeclsReadHandler.java | 5 +---- .../report/pentaho/parser/office/MasterStylesReadHandler.java | 5 +---- .../com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd | 8 ++------ .../pentaho/parser/rpt/ConditionalPrintExpressionReadHandler.java | 5 +---- .../report/pentaho/parser/rpt/DetailRootTableReadHandler.java | 5 +---- .../star/report/pentaho/parser/rpt/FixedContentReadHandler.java | 5 +---- .../report/pentaho/parser/rpt/FormatConditionReadHandler.java | 5 +---- .../star/report/pentaho/parser/rpt/FormattedTextReadHandler.java | 5 +---- .../sun/star/report/pentaho/parser/rpt/FunctionReadHandler.java | 5 +---- .../com/sun/star/report/pentaho/parser/rpt/GroupReadHandler.java | 5 +---- .../star/report/pentaho/parser/rpt/GroupSectionReadHandler.java | 5 +---- .../com/sun/star/report/pentaho/parser/rpt/ImageReadHandler.java | 5 +---- .../star/report/pentaho/parser/rpt/MasterDetailReadHandler.java | 5 +---- .../star/report/pentaho/parser/rpt/ReportElementReadHandler.java | 5 +---- .../com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java | 5 +---- .../sun/star/report/pentaho/parser/rpt/RootTableReadHandler.java | 5 +---- .../star/report/pentaho/parser/rpt/SubDocumentReadHandler.java | 5 +---- .../java/com/sun/star/report/pentaho/parser/selectors.properties | 6 +----- .../sun/star/report/pentaho/parser/style/FontFaceReadHandler.java | 5 +---- .../star/report/pentaho/parser/style/MasterPageReadHandler.java | 5 +---- .../star/report/pentaho/parser/style/OfficeStyleReadHandler.java | 5 +---- .../star/report/pentaho/parser/style/OfficeStylesReadHandler.java | 5 +---- .../star/report/pentaho/parser/style/PageLayoutReadHandler.java | 5 +---- .../report/pentaho/parser/style/StyleDefinitionReadHandler.java | 5 +---- .../report/pentaho/parser/stylemapper/OneOfConstantsMapper.java | 5 +---- .../parser/stylemapper/draw/TextAreaVerticalAlignMapper.java | 5 +---- .../pentaho/parser/stylemapper/fo/BackgroundColorMapper.java | 5 +---- .../report/pentaho/parser/stylemapper/fo/BorderRightMapper.java | 5 +---- .../star/report/pentaho/parser/stylemapper/fo/ColorMapper.java | 5 +---- .../star/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java | 5 +---- .../report/pentaho/parser/stylemapper/fo/FontStyleMapper.java | 5 +---- .../report/pentaho/parser/stylemapper/fo/FontWeightMapper.java | 5 +---- .../report/pentaho/parser/stylemapper/fo/TextAlignMapper.java | 5 +---- .../pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java | 5 +---- .../report/pentaho/parser/stylemapper/style/FontFamilyMapper.java | 5 +---- .../report/pentaho/parser/stylemapper/style/FontNameMapper.java | 5 +---- .../report/pentaho/parser/stylemapper/style/FontPitchMapper.java | 5 +---- .../report/pentaho/parser/stylemapper/style/FontReliefMapper.java | 5 +---- .../pentaho/parser/stylemapper/style/TextEmphasizeMapper.java | 5 +---- .../parser/stylemapper/style/TextUnderlineColorMapper.java | 5 +---- .../parser/stylemapper/style/TextUnderlineStyleMapper.java | 5 +---- .../parser/stylemapper/style/TextUnderlineWidthMapper.java | 5 +---- .../pentaho/parser/stylemapper/style/TextUnderlineWordMode.java | 5 +---- .../pentaho/parser/stylemapper/style/VerticalAlignMapper.java | 5 +---- .../pentaho/parser/stylemapper/table/ColumnWidthMapper.java | 5 +---- .../report/pentaho/parser/stylemapper/table/RowHeightMapper.java | 5 +---- .../star/report/pentaho/parser/table/CoveredCellReadHandler.java | 5 +---- .../star/report/pentaho/parser/table/TableCellReadHandler.java | 5 +---- .../star/report/pentaho/parser/table/TableColumnReadHandler.java | 5 +---- .../star/report/pentaho/parser/table/TableColumnsReadHandler.java | 5 +---- .../sun/star/report/pentaho/parser/table/TableReadHandler.java | 5 +---- .../sun/star/report/pentaho/parser/table/TableRowReadHandler.java | 5 +---- .../star/report/pentaho/parser/table/TableRowsReadHandler.java | 5 +---- .../star/report/pentaho/parser/text/TextContentReadHandler.java | 5 +---- .../sun/star/report/pentaho/parser/xlink/XLinkReadHandler.java | 5 +---- .../java/com/sun/star/report/pentaho/styles/LengthCalculator.java | 5 +---- .../java/com/sun/star/report/pentaho/styles/StyleMapper.java | 5 +---- .../java/com/sun/star/report/pentaho/styles/StyleMapperKey.java | 5 +---- .../star/report/pentaho/styles/StyleMapperXmlFactoryModule.java | 5 +---- .../star/report/pentaho/styles/StyleMapperXmlResourceFactory.java | 5 +---- .../report/pentaho/styles/StyleMappingDocumentReadHandler.java | 5 +---- .../sun/star/report/pentaho/styles/StyleMappingReadHandler.java | 5 +---- .../java/com/sun/star/report/pentaho/styles/StyleMappingRule.java | 5 +---- .../java/com/sun/star/report/pentaho/styles/stylemapper.xml | 6 +----- .../java/com/sun/star/report/pentaho/styles/stylemapper.xsd | 8 ++------ .../java/com/sun/star/report/util/DefaultJobProperties.java | 5 +---- .../java/com/sun/star/report/util/DefaultParameterMap.java | 5 +---- .../java/com/sun/star/report/util/DefaultReportJobDefinition.java | 5 +---- reportbuilder/java/com/sun/star/report/util/ManifestWriter.java | 5 +---- reportbuilder/java/com/sun/star/report/util/ReportUtil.java | 5 +---- reportbuilder/java/com/sun/star/report/util/makefile.mk | 6 +----- 206 files changed, 213 insertions(+), 852 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/DataRow.java b/reportbuilder/java/com/sun/star/report/DataRow.java index 47f471113362..8d255a516217 100644 --- a/reportbuilder/java/com/sun/star/report/DataRow.java +++ b/reportbuilder/java/com/sun/star/report/DataRow.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DataRow.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/DataSource.java b/reportbuilder/java/com/sun/star/report/DataSource.java index 42d78abcc9d1..c786b8b6d5c4 100644 --- a/reportbuilder/java/com/sun/star/report/DataSource.java +++ b/reportbuilder/java/com/sun/star/report/DataSource.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DataSource.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/DataSourceException.java b/reportbuilder/java/com/sun/star/report/DataSourceException.java index cbb6b394f914..c513dd9344b5 100644 --- a/reportbuilder/java/com/sun/star/report/DataSourceException.java +++ b/reportbuilder/java/com/sun/star/report/DataSourceException.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DataSourceException.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/DataSourceFactory.java b/reportbuilder/java/com/sun/star/report/DataSourceFactory.java index 01a64436e7c0..36b794a3599a 100644 --- a/reportbuilder/java/com/sun/star/report/DataSourceFactory.java +++ b/reportbuilder/java/com/sun/star/report/DataSourceFactory.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DataSourceFactory.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/ImageService.java b/reportbuilder/java/com/sun/star/report/ImageService.java index a407164d965a..3160fac1f718 100644 --- a/reportbuilder/java/com/sun/star/report/ImageService.java +++ b/reportbuilder/java/com/sun/star/report/ImageService.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ImageService.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/InputRepository.java b/reportbuilder/java/com/sun/star/report/InputRepository.java index 88a519cb7113..aefed0461831 100644 --- a/reportbuilder/java/com/sun/star/report/InputRepository.java +++ b/reportbuilder/java/com/sun/star/report/InputRepository.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: InputRepository.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/JobDefinitionException.java b/reportbuilder/java/com/sun/star/report/JobDefinitionException.java index 74a33077fcf8..5623caf3d1a1 100644 --- a/reportbuilder/java/com/sun/star/report/JobDefinitionException.java +++ b/reportbuilder/java/com/sun/star/report/JobDefinitionException.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: JobDefinitionException.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java b/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java index 585394207568..06066a2ab757 100644 --- a/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java +++ b/reportbuilder/java/com/sun/star/report/JobProgressIndicator.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: JobProgressIndicator.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/JobProperties.java b/reportbuilder/java/com/sun/star/report/JobProperties.java index 9d8932c1219b..c934451dfbac 100644 --- a/reportbuilder/java/com/sun/star/report/JobProperties.java +++ b/reportbuilder/java/com/sun/star/report/JobProperties.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: JobProperties.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/OfficeToken.java b/reportbuilder/java/com/sun/star/report/OfficeToken.java index ceddb98f077e..2c25942f3762 100644 --- a/reportbuilder/java/com/sun/star/report/OfficeToken.java +++ b/reportbuilder/java/com/sun/star/report/OfficeToken.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeToken.java,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/OutputRepository.java b/reportbuilder/java/com/sun/star/report/OutputRepository.java index 0fd3c08f40ec..3dd0823762d0 100644 --- a/reportbuilder/java/com/sun/star/report/OutputRepository.java +++ b/reportbuilder/java/com/sun/star/report/OutputRepository.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OutputRepository.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/ParameterMap.java b/reportbuilder/java/com/sun/star/report/ParameterMap.java index 45a5206583ed..0a5dfce9317b 100644 --- a/reportbuilder/java/com/sun/star/report/ParameterMap.java +++ b/reportbuilder/java/com/sun/star/report/ParameterMap.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ParameterMap.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/ReportAddIn.java b/reportbuilder/java/com/sun/star/report/ReportAddIn.java index 112e182a0663..620955c98db7 100644 --- a/reportbuilder/java/com/sun/star/report/ReportAddIn.java +++ b/reportbuilder/java/com/sun/star/report/ReportAddIn.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ReportAddIn.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/ReportEngine.java b/reportbuilder/java/com/sun/star/report/ReportEngine.java index 0e5260dff253..2518cb1742f0 100644 --- a/reportbuilder/java/com/sun/star/report/ReportEngine.java +++ b/reportbuilder/java/com/sun/star/report/ReportEngine.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ReportEngine.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/ReportEngineMetaData.java b/reportbuilder/java/com/sun/star/report/ReportEngineMetaData.java index 49ef491177ae..25d39b732448 100644 --- a/reportbuilder/java/com/sun/star/report/ReportEngineMetaData.java +++ b/reportbuilder/java/com/sun/star/report/ReportEngineMetaData.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ReportEngineMetaData.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java b/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java index c8798d02436e..2796537f758a 100644 --- a/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java +++ b/reportbuilder/java/com/sun/star/report/ReportEngineParameterNames.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ReportEngineParameterNames.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/ReportExecutionException.java b/reportbuilder/java/com/sun/star/report/ReportExecutionException.java index d9b0a77cbe09..6fc8fb1ac29f 100644 --- a/reportbuilder/java/com/sun/star/report/ReportExecutionException.java +++ b/reportbuilder/java/com/sun/star/report/ReportExecutionException.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ReportExecutionException.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/ReportExpression.java b/reportbuilder/java/com/sun/star/report/ReportExpression.java index f26fbd6cec8b..a828ee6ddba4 100644 --- a/reportbuilder/java/com/sun/star/report/ReportExpression.java +++ b/reportbuilder/java/com/sun/star/report/ReportExpression.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ReportExpression.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/ReportExpressionMetaData.java b/reportbuilder/java/com/sun/star/report/ReportExpressionMetaData.java index c2caabfec78e..3223044d2270 100644 --- a/reportbuilder/java/com/sun/star/report/ReportExpressionMetaData.java +++ b/reportbuilder/java/com/sun/star/report/ReportExpressionMetaData.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ReportExpressionMetaData.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/ReportFunction.java b/reportbuilder/java/com/sun/star/report/ReportFunction.java index e7127552cb39..24be767c1a71 100644 --- a/reportbuilder/java/com/sun/star/report/ReportFunction.java +++ b/reportbuilder/java/com/sun/star/report/ReportFunction.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ReportFunction.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/ReportJob.java b/reportbuilder/java/com/sun/star/report/ReportJob.java index 6f93f5db8b0c..9bda7926f7d4 100644 --- a/reportbuilder/java/com/sun/star/report/ReportJob.java +++ b/reportbuilder/java/com/sun/star/report/ReportJob.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ReportJob.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/ReportJobDefinition.java b/reportbuilder/java/com/sun/star/report/ReportJobDefinition.java index 1bad0c4f0de4..89724ec20fe5 100644 --- a/reportbuilder/java/com/sun/star/report/ReportJobDefinition.java +++ b/reportbuilder/java/com/sun/star/report/ReportJobDefinition.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ReportJobDefinition.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/ReportJobFactory.java b/reportbuilder/java/com/sun/star/report/ReportJobFactory.java index fda22b4d907e..1771f0bedb22 100644 --- a/reportbuilder/java/com/sun/star/report/ReportJobFactory.java +++ b/reportbuilder/java/com/sun/star/report/ReportJobFactory.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ReportJobFactory.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportData.java b/reportbuilder/java/com/sun/star/report/SDBCReportData.java index 610cbde2a796..67d662de261f 100644 --- a/reportbuilder/java/com/sun/star/report/SDBCReportData.java +++ b/reportbuilder/java/com/sun/star/report/SDBCReportData.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SDBCReportData.java,v $ - * $Revision: 1.6.32.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java index 5c3032e3a7f9..79d37c6fcd45 100644 --- a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java +++ b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SDBCReportDataFactory.java,v $ - * $Revision: 1.9.18.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/SOImageService.java b/reportbuilder/java/com/sun/star/report/SOImageService.java index 075981414957..86dfde5d6043 100644 --- a/reportbuilder/java/com/sun/star/report/SOImageService.java +++ b/reportbuilder/java/com/sun/star/report/SOImageService.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SOImageService.java,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/StorageRepository.java b/reportbuilder/java/com/sun/star/report/StorageRepository.java index b25d481ddc98..d448a71ece2f 100644 --- a/reportbuilder/java/com/sun/star/report/StorageRepository.java +++ b/reportbuilder/java/com/sun/star/report/StorageRepository.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StorageRepository.java,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function.properties b/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function.properties index 4dfc3e01f0be..a8313094932f 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function.properties +++ b/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function.properties @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: Author-Function.properties,v $ -# -# $Revision: 1.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -30,4 +26,4 @@ #************************************************************************* display-name=AUTHOR -description=Returns the author of the report. \ No newline at end of file +description=Returns the author of the report. diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function_en_US.properties b/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function_en_US.properties index 4dfc3e01f0be..a8313094932f 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function_en_US.properties +++ b/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function_en_US.properties @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: Author-Function.properties,v $ -# -# $Revision: 1.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -30,4 +26,4 @@ #************************************************************************* display-name=AUTHOR -description=Returns the author of the report. \ No newline at end of file +description=Returns the author of the report. 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 1bbf417a4b8e..fa40e3d9dd10 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java +++ b/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: AuthorFunction.java,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 3413239388e8..f8c1032bfb16 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunctionDescription.java +++ b/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunctionDescription.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: AuthorFunctionDescription.java,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/MetaDataFunctionCategory.java b/reportbuilder/java/com/sun/star/report/function/metadata/MetaDataFunctionCategory.java index 2e47bafaceca..8fa0e5d80ac5 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/MetaDataFunctionCategory.java +++ b/reportbuilder/java/com/sun/star/report/function/metadata/MetaDataFunctionCategory.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: MetaDataFunctionCategory.java,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function.properties b/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function.properties index ef678be150da..6c9ab290bc69 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function.properties +++ b/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function.properties @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: Title-Function.properties,v $ -# -# $Revision: 1.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -30,4 +26,4 @@ #************************************************************************* display-name=TITLE -description=Returns the title of the report. \ No newline at end of file +description=Returns the title of the report. diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function_en_US.properties b/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function_en_US.properties index ef678be150da..6c9ab290bc69 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function_en_US.properties +++ b/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function_en_US.properties @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: Title-Function.properties,v $ -# -# $Revision: 1.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -30,4 +26,4 @@ #************************************************************************* display-name=TITLE -description=Returns the title of the report. \ No newline at end of file +description=Returns the title of the report. diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java b/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java index 928bbaa0f0ec..64e17dfbdfa9 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java +++ b/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TitleFunction.java,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 83e9c5de464f..7ed8a61bd06a 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunctionDescription.java +++ b/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunctionDescription.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TitleFunctionDescription.java,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/category.properties b/reportbuilder/java/com/sun/star/report/function/metadata/category.properties index c193c5c7374a..504df7f45b3f 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/category.properties +++ b/reportbuilder/java/com/sun/star/report/function/metadata/category.properties @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: category.properties,v $ -# -# $Revision: 1.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/category_en_US.properties b/reportbuilder/java/com/sun/star/report/function/metadata/category_en_US.properties index 44b7ed1d5e9b..b380d19cc640 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/category_en_US.properties +++ b/reportbuilder/java/com/sun/star/report/function/metadata/category_en_US.properties @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: category.properties,v $ -# -# $Revision: 1.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -30,4 +26,4 @@ #************************************************************************* display-name=MetaData -description=Contains functions about meta data \ No newline at end of file +description=Contains functions about meta data diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk index 1025bcea7cb7..99c80bd919b7 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.3.22.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/makefile.mk b/reportbuilder/java/com/sun/star/report/makefile.mk index 5b36aff44ee8..f72daadb2f57 100644 --- a/reportbuilder/java/com/sun/star/report/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.8.46.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java b/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java index d73b1c222512..a364aeca1119 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DefaultNameGenerator.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java b/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java index 84fac5773588..45e5f64c4670 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeNamespaces.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java index 846053cd6bc4..c2cf31ef24bd 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: PentahoFormulaContext.java,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportAddIn.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportAddIn.java index db8ad9e4409e..a4222fdaa3b3 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportAddIn.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportAddIn.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: PentahoReportAddIn.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngine.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngine.java index d114edf34f71..024486071685 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngine.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngine.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: PentahoReportEngine.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java index 1f4dce14950d..911840e6d2bd 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: PentahoReportEngineMetaData.java,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java index 23f959e05943..032ccb67d965 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: PentahoReportJob.java,v $ - * $Revision: 1.8.16.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java index 7a25d05c593f..516bf508e698 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java @@ -2,14 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SOFormulaOpCodeMapper.java,v $ - * - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java index 4ef8a43f954a..06ede8903733 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java @@ -2,14 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SOFormulaParser.java,v $ - * - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java index 3b890b940c6f..c6a7a8117dc3 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java @@ -2,14 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: XFunctionManager.java,v $ - * - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java index b1f886d664c5..0d03edb1555e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SOReportJobFactory.java,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java index 2c8b9d9f8786..5dcfa9514700 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java @@ -2,14 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StarFunctionCategory.java,v $ - * - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java index da84dc57746f..640aa27e46ac 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java @@ -2,14 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StarFunctionDescription.java,v $ - * - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarReportData.java b/reportbuilder/java/com/sun/star/report/pentaho/StarReportData.java index 7d65f881ec6c..0edb8c197054 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/StarReportData.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarReportData.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StarReportData.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java index 07359dc33452..f021e9c186bd 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StarReportDataFactory.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarReportModule.java b/reportbuilder/java/com/sun/star/report/pentaho/StarReportModule.java index 6558e30db9f4..b3497fc51377 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/StarReportModule.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarReportModule.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StarReportModule.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties b/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties index 186b8568cb6a..1b0cafb0909b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties +++ b/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: configuration.properties,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java index 2e4f9f396088..43e85d41a9f9 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SumExpression.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java index b29b4ebb7ddb..92450f7d97cf 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SumExpressionMetaData.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java index 622699aa89d6..385c0457bf2f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: AbstractReportElementLayoutController.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java index 7a96eabbb6b5..90292e93657a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FixedTextLayoutController.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 405fe4a2815b..d5f3d7386114 100755 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FormatValueUtility.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java index 16bc355f8b77..e6995cfcc876 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FormattedTextLayoutController.java,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementContext.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementContext.java index 7b9624ed6e4a..9a2def45d32c 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementContext.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementContext.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ImageElementContext.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 81e17b73e276..80ebbcc5f118 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ImageElementLayoutController.java,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 b0de84bda31e..08ab0ae0d792 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ObjectOleLayoutController.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java index 9358e62a8590..83d8686e8bf6 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeDetailLayoutController.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 12604e931238..fa7852fbc156 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeGroupLayoutController.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java index 4eb40749e3fe..f89d3c047d15 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeGroupSectionLayoutController.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeRepeatingStructureLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeRepeatingStructureLayoutController.java index 1ccf6b634bcf..790d18527f14 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeRepeatingStructureLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeRepeatingStructureLayoutController.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeRepeatingStructureLayoutController.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java index 5baffc4c346b..119c277bcf36 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeReportLayoutController.java,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java index f8c9a1111a8d..5c0e95a190ec 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeTableLayoutController.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java index 738ccb4f07f4..7b83c6976fea 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeTableTemplateLayoutController.java,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 5393a5e13a15..de718e8fc700 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TableCellLayoutController.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java index ca8687541545..e5a9eb60e4f8 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: VariablesCollection.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 e59a699109f4..e00255ed824a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: VariablesDeclarationLayoutController.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java index fc6021202e68..9f0c9ca61aac 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: InputRepositoryLoader.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java index 798f11d18194..25ad7f232126 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: InputRepositoryResourceData.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputResourceKey.java b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputResourceKey.java index 4fd3787dd676..b9491fc3dec6 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputResourceKey.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputResourceKey.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: InputResourceKey.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk index 36e83afac2d0..2927967886a6 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.7.58.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java b/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java index 37ffed4ecd8d..1a5635f0c492 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DataStyle.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java index c216f6aad214..124fc5e13827 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FixedTextElement.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java index 96e9eed7c2fe..615ef535d9bb 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FontFaceDeclsSection.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java index 46516557f97a..76c6efcd82a7 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FontFaceElement.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java index 2f4d459229d6..471c383466a9 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FormatCondition.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FormattedTextElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FormattedTextElement.java index 3852cdabb86a..182f6a998681 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/FormattedTextElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FormattedTextElement.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FormattedTextElement.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 f7832a9618c7..95cbaeeb2b63 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ImageElement.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java index 2950e1c8d2ff..84f41523c79a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ObjectOleElement.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDetailSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDetailSection.java index a31f66a805b6..14614b2548e0 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDetailSection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDetailSection.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeDetailSection.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java index 41cc7aaa68d4..c3166709337e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeDocument.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java index eca3f20fe0ef..12ab01c318f3 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeGroup.java,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java index 72c8e97ddb6a..2429d3798224 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeGroupSection.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java index 209f0866271a..60b294e62ae8 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeMasterPage.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java index 866a604c3f9f..f0e44618334a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeMasterStyles.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java index 5804396b36be..cf873b9452d5 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeReport.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java index acb4b88359d0..79a824bbcc45 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeStyle.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java index aa08f75e38a4..c809eec1b485 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeStyles.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java index a4a4d4b544ab..f1a958217067 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeStylesCollection.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeTableSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeTableSection.java index bf77ebcd1253..9df11ff0156c 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeTableSection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeTableSection.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeTableSection.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java b/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java index 9499d0557f29..5d89e203ac05 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: PageLayout.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/PageSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/PageSection.java index 537a1cc3af42..fc3532ca70a4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/PageSection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/PageSection.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: PageSection.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java b/reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java index 8dd1dcf7430d..47b275a0a5b7 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: RawText.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java index a3c9838be19d..8bab74072f3b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ReportElement.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java index 501a8dbe8131..bbe2c7dadf78 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TableCellElement.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java index fc03e863ff64..d50935f837fb 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: VariablesDeclarationSection.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/module.properties b/reportbuilder/java/com/sun/star/report/pentaho/module.properties index a2f9f7f4222b..7038a47a410c 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/module.properties +++ b/reportbuilder/java/com/sun/star/report/pentaho/module.properties @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: module.properties,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify 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 ac98c9a97953..d307fe1726f4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ImageProducer.java,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 3892944eb1f2..23e65b569a29 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeDocumentReportTarget.java,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 66b0a0435b17..7194e456a351 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OleProducer.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java b/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java index 4bccca1e9612..d901d15fad16 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StyleUtilities.java,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java index 24fb64d3b95e..bf68c10f4b9d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StylesWriter.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportProcessor.java b/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportProcessor.java index 1845fc59a78f..5bf338dedf3c 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportProcessor.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportProcessor.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ChartRawReportProcessor.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 05e70d1e49e2..edf914733067 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 @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ChartRawReportTarget.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java index ddc644d52ef3..61cd7f56c270 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SpreadsheetRawReportProcessor.java,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 01e5135c3613..90101412d0ad 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 @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SpreadsheetRawReportTarget.java,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 ca3047a16c16..6abc2096c624 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 @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: MasterPageFactory.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageBreakDefinition.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageBreakDefinition.java index 23372228d33d..4632d81b8970 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageBreakDefinition.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageBreakDefinition.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: PageBreakDefinition.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 740582c9b347..8ac38e4e43ea 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 @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: PageContext.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java index 3b23ffb4c3df..01ab1a72dbd5 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TextRawReportProcessor.java,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 947087a17c11..a5fc3a0ad4db 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 @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TextRawReportTarget.java,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/VariablesDeclarations.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/VariablesDeclarations.java index a348fb9b67fb..6e7534df735e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/text/VariablesDeclarations.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/VariablesDeclarations.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: VariablesDeclarations.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/AttributeSpecification.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/AttributeSpecification.java index e4f6e121c277..98a47a23aae7 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/AttributeSpecification.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/AttributeSpecification.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: AttributeSpecification.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/ElementReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/ElementReadHandler.java index 3bfe49fc2c27..81efe8fbd073 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/ElementReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/ElementReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ElementReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java index e3b8f7374d43..2bcf3a824737 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeDocumentXmlResourceFactory.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java index 266cfa529d5a..ce34affe7d80 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeParserUtil.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java index 6971eb857a20..33108e0dc438 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeStylesXmlResourceFactory.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java index ff3dfc494436..1e57df98ee51 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StarStyleXmlFactoryModule.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java index e69df1b60bbe..695bf52428cf 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StarXmlFactoryModule.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 81f92f7ebaea..aaae0b7795b5 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/StyleMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/StyleMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StyleMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/chart/ChartReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/chart/ChartReadHandler.java index 820a8fee65e6..9ec31aa498cc 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/chart/ChartReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/chart/ChartReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ChartReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 b4787ca63cb9..61069584c3bb 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 @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DataStyleReadHandler.java,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java index 6630d1e73962..6774c4374507 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ObjectOleReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/BodyReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/BodyReadHandler.java index acb6a9e5da2b..1f08dd533220 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/BodyReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/BodyReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: BodyReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java index 64255c2ae373..61208e765052 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DocumentContentReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java index 32f7c54fa08a..f3665f967c11 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DocumentStylesReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java index 7e40681faee3..058aca7bec32 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FontFaceDeclsReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/MasterStylesReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/MasterStylesReadHandler.java index deed7bdc0d84..52854a57af40 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/MasterStylesReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/MasterStylesReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: MasterStylesReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd index f65b34149429..82984c73afe2 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt-schema-v1.0-os.xsd @@ -2,14 +2,10 @@ 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 7378637bae15..77ac9622a44e 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 @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ConditionalPrintExpressionReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/DetailRootTableReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/DetailRootTableReadHandler.java index 246e09814ee8..a8252667ff1f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/DetailRootTableReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/DetailRootTableReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DetailRootTableReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FixedContentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FixedContentReadHandler.java index a11d42509f14..f414fc680bc1 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FixedContentReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FixedContentReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FixedContentReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormatConditionReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormatConditionReadHandler.java index 840027027940..2409c9aca053 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormatConditionReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormatConditionReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FormatConditionReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java index 7f98e3f79f6a..8b312aa80ba7 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FormattedTextReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FunctionReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FunctionReadHandler.java index b5ba5a24642e..67c8bb133920 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FunctionReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FunctionReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FunctionReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 b9c6cb42d77e..108157fcfc64 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 @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: GroupReadHandler.java,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupSectionReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupSectionReadHandler.java index ae7c45f192ac..99a34abc1d42 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupSectionReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/GroupSectionReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: GroupSectionReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ImageReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ImageReadHandler.java index e570a5135fca..50d52818159d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ImageReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ImageReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ImageReadHandler.java,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java index e9b1d8959333..b1093f0957e0 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: MasterDetailReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java index 9177d66db974..e683fba93116 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ReportElementReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java index 1d0acf709161..53e0bd247144 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ReportReadHandler.java,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/RootTableReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/RootTableReadHandler.java index 7f1604d0e7ea..f6ca4e955ec2 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/RootTableReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/RootTableReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: RootTableReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/SubDocumentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/SubDocumentReadHandler.java index ab635a6b095b..945ed1a35cc0 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/SubDocumentReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/SubDocumentReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SubDocumentReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/selectors.properties b/reportbuilder/java/com/sun/star/report/pentaho/parser/selectors.properties index eca5a9072c9b..a8f0ad275941 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/selectors.properties +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/selectors.properties @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: selectors.properties,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java index 0c7b8747c9d5..035c4db1cdfc 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FontFaceReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java index 75773988cf76..481042588854 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: MasterPageReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java index 0a541495c8dd..a25155b28310 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeStyleReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java index 4c4a2e80d19a..cf68aa1f0e00 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OfficeStylesReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java index 5ee10d2b936b..162b58884f27 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: PageLayoutReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java index 0fd0655d4e22..bf63a72c64c7 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StyleDefinitionReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java index 8e385f2ba859..3cdecbcba2fb 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: OneOfConstantsMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java index 8418815f3b7d..4a42e58b1ad5 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TextAreaVerticalAlignMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 a2ca9ca9e496..e81d0d126f20 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 @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: BackgroundColorMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify 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 14b9f4dd5b3b..7dd84ebf21f8 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 @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: BorderRightMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/ColorMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/ColorMapper.java index f824646a9df4..e4d595bcf719 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/ColorMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/ColorMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ColorMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java index 94c701431527..ecc5e084b459 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FontSizeMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java index 5c6111c1f55a..0003be5618fd 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FontStyleMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java index ec73596462e5..2a3f4109903d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FontWeightMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java index b619442076b6..817dfb956380 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TextAlignMapper.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java index fce338d5688b..4d61bc9ff871 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FontFamilyGenericMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java index 696fb557bdde..bde78e2ed0bf 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FontFamilyMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java index cc6cd926f7c7..2e8ed93c7f3b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FontNameMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java index 79dceddb88c6..93de4f494104 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FontPitchMapper.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java index a9c18a8f7dc4..8d5070ab59e9 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: FontReliefMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java index e465e7da1527..83f2e576bcea 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TextEmphasizeMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java index b6b3812a834e..091ae5f57286 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TextUnderlineColorMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java index fcc4e8cc6a7a..16f31d192e92 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TextUnderlineStyleMapper.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java index fbc4d7498be2..92846ba947e8 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TextUnderlineWidthMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java index aa23d66b131f..f11dc31a3c37 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TextUnderlineWordMode.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java index 9b56b1ae14be..aff90e41ee11 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: VerticalAlignMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java index 82adc828982c..6f53d9a49733 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ColumnWidthMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java index 57e4dcd9c559..c1aeb5f9494e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: RowHeightMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/CoveredCellReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/CoveredCellReadHandler.java index 66b11863df77..8a9ca1077485 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/CoveredCellReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/CoveredCellReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: CoveredCellReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableCellReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableCellReadHandler.java index 7d34b5e18346..9d963fd46326 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableCellReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableCellReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TableCellReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java index 172e8b475459..491ea24697cd 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TableColumnReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java index a72a5249af4c..7de47122e4ef 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TableColumnsReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableReadHandler.java index 365000792277..00b858755338 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TableReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowReadHandler.java index 14af3abf601a..c62511958de5 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TableRowReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowsReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowsReadHandler.java index 77db358f8165..1e5750a2a0da 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowsReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowsReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TableRowsReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/text/TextContentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/text/TextContentReadHandler.java index 19af5196fa2b..98303dffe6db 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/text/TextContentReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/text/TextContentReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TextContentReadHandler.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/xlink/XLinkReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/xlink/XLinkReadHandler.java index e8ff4b3f65df..a11d0c30e812 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/xlink/XLinkReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/xlink/XLinkReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: XLinkReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/LengthCalculator.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/LengthCalculator.java index 1e041d6bce8d..0665066f2a9f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/LengthCalculator.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/LengthCalculator.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: LengthCalculator.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java index 6cb6add68697..eaf2b24043ee 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StyleMapper.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java index 496bfd23387f..447a0b958fd8 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StyleMapperKey.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java index 09802517e0a2..95f8322de730 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StyleMapperXmlFactoryModule.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java index 5574bf022353..48baade4ebc0 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StyleMapperXmlResourceFactory.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java index 135d6667144c..07491b3fa4e3 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StyleMappingDocumentReadHandler.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java index 7db04ffc5d93..a6acb33e14e4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StyleMappingReadHandler.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java index e0fbd62a77d8..9698e73ce67b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: StyleMappingRule.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xml b/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xml index e6fa1d089921..11ca5fcd8ae4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xml +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xml @@ -3,14 +3,10 @@ Date: Mon, 15 Feb 2010 10:17:22 +0100 Subject: dba33f: fix import order --- .../java/com/sun/star/report/ImageService.java | 3 +- .../java/com/sun/star/report/InputRepository.java | 2 +- .../java/com/sun/star/report/OutputRepository.java | 2 +- .../java/com/sun/star/report/SDBCReportData.java | 5 +-- .../com/sun/star/report/SDBCReportDataFactory.java | 21 ++++++------ .../java/com/sun/star/report/SOImageService.java | 8 +++-- .../com/sun/star/report/StorageRepository.java | 14 +++++--- .../report/function/metadata/AuthorFunction.java | 1 + .../report/function/metadata/TitleFunction.java | 1 + .../star/report/pentaho/DefaultNameGenerator.java | 3 +- .../star/report/pentaho/PentahoFormulaContext.java | 2 +- .../star/report/pentaho/PentahoReportEngine.java | 1 + .../pentaho/PentahoReportEngineMetaData.java | 12 ++++--- .../sun/star/report/pentaho/PentahoReportJob.java | 33 ++++++++++-------- .../star/report/pentaho/SOFormulaOpCodeMapper.java | 2 +- .../sun/star/report/pentaho/SOFormulaParser.java | 16 +++++---- .../sun/star/report/pentaho/SOFunctionManager.java | 5 +-- .../star/report/pentaho/SOReportJobFactory.java | 9 ++--- .../star/report/pentaho/StarFunctionCategory.java | 8 +++-- .../report/pentaho/StarFunctionDescription.java | 9 ++--- .../sun/star/report/pentaho/StarReportData.java | 1 + .../star/report/pentaho/StarReportDataFactory.java | 10 +++--- .../report/pentaho/expressions/SumExpression.java | 2 +- .../pentaho/expressions/SumExpressionMetaData.java | 3 +- .../AbstractReportElementLayoutController.java | 14 ++++---- .../layoutprocessor/FixedTextLayoutController.java | 19 ++++++----- .../layoutprocessor/FormatValueUtility.java | 14 +++++--- .../FormattedTextLayoutController.java | 17 ++++++---- .../ImageElementLayoutController.java | 19 ++++++----- .../layoutprocessor/ObjectOleLayoutController.java | 12 ++++--- .../OfficeDetailLayoutController.java | 3 +- ...OfficeGroupInstanceSectionLayoutController.java | 25 +++++++------- .../OfficeGroupLayoutController.java | 1 + .../OfficeGroupSectionLayoutController.java | 21 ++++++------ .../OfficePageSectionLayoutController.java | 8 ++--- .../OfficeReportLayoutController.java | 1 + .../OfficeTableLayoutController.java | 15 +++++---- .../OfficeTableTemplateLayoutController.java | 6 ++-- .../layoutprocessor/TableCellLayoutController.java | 6 ++-- .../layoutprocessor/VariablesCollection.java | 5 +-- .../VariablesDeclarationLayoutController.java | 8 +++-- .../pentaho/loader/InputRepositoryLoader.java | 7 ++-- .../loader/InputRepositoryResourceData.java | 4 ++- .../sun/star/report/pentaho/model/DataStyle.java | 3 +- .../report/pentaho/model/FontFaceDeclsSection.java | 6 ++-- .../star/report/pentaho/model/FontFaceElement.java | 3 +- .../star/report/pentaho/model/ImageElement.java | 5 +-- .../star/report/pentaho/model/OfficeDocument.java | 1 + .../sun/star/report/pentaho/model/OfficeGroup.java | 3 +- .../report/pentaho/model/OfficeGroupSection.java | 5 +-- .../report/pentaho/model/OfficeMasterPage.java | 3 +- .../report/pentaho/model/OfficeMasterStyles.java | 3 +- .../sun/star/report/pentaho/model/OfficeStyle.java | 1 + .../star/report/pentaho/model/OfficeStyles.java | 4 ++- .../pentaho/model/OfficeStylesCollection.java | 1 + .../sun/star/report/pentaho/model/PageLayout.java | 3 +- .../sun/star/report/pentaho/model/PageSection.java | 5 +-- .../star/report/pentaho/model/ReportElement.java | 8 +++-- .../star/report/pentaho/output/ImageProducer.java | 26 ++++++++++----- .../pentaho/output/OfficeDocumentReportTarget.java | 39 +++++++++++++--------- .../star/report/pentaho/output/OleProducer.java | 3 ++ .../star/report/pentaho/output/StyleUtilities.java | 11 +++--- .../star/report/pentaho/output/StylesWriter.java | 22 +++++++----- .../output/chart/ChartRawReportProcessor.java | 2 ++ .../pentaho/output/chart/ChartRawReportTarget.java | 5 ++- .../spreadsheet/SpreadsheetRawReportProcessor.java | 14 ++++---- .../spreadsheet/SpreadsheetRawReportTarget.java | 31 +++++++++-------- .../pentaho/output/text/MasterPageFactory.java | 12 ++++--- .../report/pentaho/output/text/PageContext.java | 3 +- .../output/text/TextRawReportProcessor.java | 6 ++-- .../pentaho/output/text/TextRawReportTarget.java | 20 ++++++----- .../pentaho/output/text/VariablesDeclarations.java | 3 +- .../report/pentaho/parser/ElementReadHandler.java | 2 ++ .../parser/OfficeDocumentXmlResourceFactory.java | 1 + .../report/pentaho/parser/OfficeParserUtil.java | 9 +++-- .../parser/OfficeStylesXmlResourceFactory.java | 2 ++ .../pentaho/parser/StarStyleXmlFactoryModule.java | 1 + .../pentaho/parser/StarXmlFactoryModule.java | 3 +- .../pentaho/parser/chart/ChartReadHandler.java | 11 ++++-- .../pentaho/parser/data/DataStyleReadHandler.java | 8 +++-- .../pentaho/parser/draw/ObjectOleReadHandler.java | 2 ++ .../pentaho/parser/office/BodyReadHandler.java | 3 ++ .../parser/office/DocumentContentReadHandler.java | 4 +++ .../parser/office/DocumentStylesReadHandler.java | 3 ++ .../parser/office/FontFaceDeclsReadHandler.java | 8 +++-- .../parser/office/MasterStylesReadHandler.java | 14 +++++--- .../rpt/ConditionalPrintExpressionReadHandler.java | 3 ++ .../parser/rpt/FixedContentReadHandler.java | 7 ++-- .../parser/rpt/FormatConditionReadHandler.java | 7 ++-- .../parser/rpt/FormattedTextReadHandler.java | 7 ++-- .../pentaho/parser/rpt/FunctionReadHandler.java | 15 +++++---- .../pentaho/parser/rpt/GroupReadHandler.java | 8 +++-- .../pentaho/parser/rpt/ImageReadHandler.java | 5 ++- .../parser/rpt/MasterDetailReadHandler.java | 5 ++- .../parser/rpt/ReportElementReadHandler.java | 9 +++-- .../pentaho/parser/rpt/ReportReadHandler.java | 8 +++-- .../pentaho/parser/rpt/RootTableReadHandler.java | 3 ++ .../pentaho/parser/rpt/SubDocumentReadHandler.java | 9 +++-- .../pentaho/parser/style/FontFaceReadHandler.java | 3 +- .../parser/style/MasterPageReadHandler.java | 8 +++-- .../parser/style/OfficeStyleReadHandler.java | 10 ++++-- .../parser/style/OfficeStylesReadHandler.java | 14 +++++--- .../parser/style/PageLayoutReadHandler.java | 8 +++-- .../parser/style/StyleDefinitionReadHandler.java | 8 +++-- .../parser/stylemapper/OneOfConstantsMapper.java | 6 ++-- .../draw/TextAreaVerticalAlignMapper.java | 1 + .../stylemapper/fo/BackgroundColorMapper.java | 1 + .../parser/stylemapper/fo/BorderRightMapper.java | 1 + .../pentaho/parser/stylemapper/fo/ColorMapper.java | 1 + .../parser/stylemapper/fo/FontSizeMapper.java | 1 + .../parser/stylemapper/fo/FontStyleMapper.java | 1 + .../parser/stylemapper/fo/FontWeightMapper.java | 1 + .../parser/stylemapper/fo/TextAlignMapper.java | 1 + .../stylemapper/style/FontFamilyGenericMapper.java | 3 +- .../parser/stylemapper/style/FontFamilyMapper.java | 5 +-- .../parser/stylemapper/style/FontNameMapper.java | 5 +-- .../parser/stylemapper/style/FontPitchMapper.java | 1 + .../parser/stylemapper/style/FontReliefMapper.java | 1 + .../stylemapper/style/TextEmphasizeMapper.java | 1 + .../style/TextUnderlineColorMapper.java | 1 + .../style/TextUnderlineStyleMapper.java | 3 +- .../style/TextUnderlineWidthMapper.java | 1 + .../stylemapper/style/TextUnderlineWordMode.java | 1 + .../stylemapper/style/VerticalAlignMapper.java | 1 + .../stylemapper/table/ColumnWidthMapper.java | 1 + .../parser/stylemapper/table/RowHeightMapper.java | 1 + .../parser/table/CoveredCellReadHandler.java | 1 + .../parser/table/TableColumnReadHandler.java | 5 +-- .../parser/table/TableColumnsReadHandler.java | 14 +++++--- .../pentaho/parser/table/TableReadHandler.java | 10 ++++-- .../pentaho/parser/table/TableRowReadHandler.java | 14 +++++--- .../pentaho/parser/table/TableRowsReadHandler.java | 14 +++++--- .../parser/text/NoCDATATextContentReadHandler.java | 14 +++++--- .../parser/text/TextContentReadHandler.java | 1 + .../pentaho/parser/xlink/XLinkReadHandler.java | 2 ++ .../star/report/pentaho/styles/StyleMapper.java | 3 +- .../styles/StyleMapperXmlResourceFactory.java | 3 +- .../styles/StyleMappingDocumentReadHandler.java | 6 ++-- .../pentaho/styles/StyleMappingReadHandler.java | 1 + .../sun/star/report/util/DefaultJobProperties.java | 7 ++-- .../sun/star/report/util/DefaultParameterMap.java | 5 +-- .../com/sun/star/report/util/ManifestWriter.java | 20 ++++++----- 142 files changed, 642 insertions(+), 354 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/ImageService.java b/reportbuilder/java/com/sun/star/report/ImageService.java index a407164d965a..0b73b3761383 100644 --- a/reportbuilder/java/com/sun/star/report/ImageService.java +++ b/reportbuilder/java/com/sun/star/report/ImageService.java @@ -29,9 +29,10 @@ ************************************************************************/ package com.sun.star.report; -import java.io.InputStream; import java.awt.Dimension; +import java.io.InputStream; + /** * * @author oj93728 diff --git a/reportbuilder/java/com/sun/star/report/InputRepository.java b/reportbuilder/java/com/sun/star/report/InputRepository.java index 88a519cb7113..1f2aa610c3c8 100644 --- a/reportbuilder/java/com/sun/star/report/InputRepository.java +++ b/reportbuilder/java/com/sun/star/report/InputRepository.java @@ -29,8 +29,8 @@ ************************************************************************/ package com.sun.star.report; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; /** * This allows the job processor to load data from a repository. It is assumed, diff --git a/reportbuilder/java/com/sun/star/report/OutputRepository.java b/reportbuilder/java/com/sun/star/report/OutputRepository.java index 0fd3c08f40ec..5f7f9694d964 100644 --- a/reportbuilder/java/com/sun/star/report/OutputRepository.java +++ b/reportbuilder/java/com/sun/star/report/OutputRepository.java @@ -29,8 +29,8 @@ ************************************************************************/ package com.sun.star.report; -import java.io.OutputStream; import java.io.IOException; +import java.io.OutputStream; /** * A repository for writing. Providing a repository always assumes, diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportData.java b/reportbuilder/java/com/sun/star/report/SDBCReportData.java index 610cbde2a796..8812941a90f3 100644 --- a/reportbuilder/java/com/sun/star/report/SDBCReportData.java +++ b/reportbuilder/java/com/sun/star/report/SDBCReportData.java @@ -36,8 +36,6 @@ import com.sun.star.container.XNameAccess; import com.sun.star.lang.IndexOutOfBoundsException; import com.sun.star.lang.WrappedTargetException; import com.sun.star.sdb.XParametersSupplier; -import java.sql.Timestamp; - import com.sun.star.sdbc.DataType; import com.sun.star.sdbc.SQLException; import com.sun.star.sdbc.XResultSetMetaData; @@ -50,6 +48,9 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.util.DateTime; import com.sun.star.util.Time; +import java.sql.Timestamp; + + public class SDBCReportData implements DataSource { diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java index 8653d0ba6e3d..1a7818e2a7e5 100644 --- a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java +++ b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java @@ -34,43 +34,42 @@ import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; import com.sun.star.container.NoSuchElementException; import com.sun.star.container.XIndexAccess; +import com.sun.star.container.XNameAccess; 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; import com.sun.star.lang.XComponent; -import com.sun.star.lang.XMultiServiceFactory; 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.XConnection; 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; -import com.sun.star.sdbcx.XColumnsSupplier; -import com.sun.star.sdbcx.XTablesSupplier; import com.sun.star.task.XInteractionHandler; +import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; + import java.lang.reflect.Method; + import java.math.BigDecimal; + import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +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; + /** * Very primitive implementation, just to show how this could be used ... * diff --git a/reportbuilder/java/com/sun/star/report/SOImageService.java b/reportbuilder/java/com/sun/star/report/SOImageService.java index 075981414957..a9edaf9633c6 100644 --- a/reportbuilder/java/com/sun/star/report/SOImageService.java +++ b/reportbuilder/java/com/sun/star/report/SOImageService.java @@ -29,9 +29,6 @@ ************************************************************************/ package com.sun.star.report; -import java.awt.Dimension; -import java.io.InputStream; - import com.sun.star.awt.Size; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.UnknownPropertyException; @@ -47,6 +44,11 @@ import com.sun.star.lib.uno.adapter.InputStreamToXInputStreamAdapter; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; +import java.awt.Dimension; + +import java.io.InputStream; + + /** * @author oj93728 */ diff --git a/reportbuilder/java/com/sun/star/report/StorageRepository.java b/reportbuilder/java/com/sun/star/report/StorageRepository.java index b25d481ddc98..e7d85884b36a 100644 --- a/reportbuilder/java/com/sun/star/report/StorageRepository.java +++ b/reportbuilder/java/com/sun/star/report/StorageRepository.java @@ -35,15 +35,21 @@ import com.sun.star.beans.XPropertySet; import com.sun.star.container.NoSuchElementException; import com.sun.star.embed.ElementModes; import com.sun.star.embed.InvalidStorageException; -import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.lang.WrappedTargetException; -import java.io.*; import com.sun.star.embed.XStorage; import com.sun.star.embed.XTransactedObject; -import com.sun.star.uno.UnoRuntime; import com.sun.star.io.XStream; +import com.sun.star.lang.IllegalArgumentException; +import com.sun.star.lang.WrappedTargetException; import com.sun.star.lib.uno.adapter.XInputStreamToInputStreamAdapter; import com.sun.star.lib.uno.adapter.XOutputStreamToOutputStreamAdapter; +import com.sun.star.uno.UnoRuntime; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; 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 1bbf417a4b8e..717a7e89ac61 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java +++ b/reportbuilder/java/com/sun/star/report/function/metadata/AuthorFunction.java @@ -30,6 +30,7 @@ package com.sun.star.report.function.metadata; import com.sun.star.report.ReportEngineParameterNames; + import org.pentaho.reporting.libraries.formula.EvaluationException; import org.pentaho.reporting.libraries.formula.FormulaContext; import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java b/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java index 928bbaa0f0ec..93fa6f29a136 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java +++ b/reportbuilder/java/com/sun/star/report/function/metadata/TitleFunction.java @@ -30,6 +30,7 @@ package com.sun.star.report.function.metadata; import com.sun.star.report.ReportEngineParameterNames; + import org.pentaho.reporting.libraries.formula.EvaluationException; import org.pentaho.reporting.libraries.formula.FormulaContext; import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java b/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java index d73b1c222512..d8f535a19da1 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/DefaultNameGenerator.java @@ -29,9 +29,10 @@ ************************************************************************/ package com.sun.star.report.pentaho; +import com.sun.star.report.OutputRepository; + import java.io.IOException; -import com.sun.star.report.OutputRepository; public class DefaultNameGenerator { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java index 846053cd6bc4..8951fa2c8f19 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoFormulaContext.java @@ -29,6 +29,7 @@ ************************************************************************/ package com.sun.star.report.pentaho; +import org.pentaho.reporting.libraries.base.config.Configuration; import org.pentaho.reporting.libraries.formula.ContextEvaluationException; import org.pentaho.reporting.libraries.formula.FormulaContext; import org.pentaho.reporting.libraries.formula.LocalizationContext; @@ -36,7 +37,6 @@ import org.pentaho.reporting.libraries.formula.function.FunctionRegistry; import org.pentaho.reporting.libraries.formula.operators.OperatorFactory; import org.pentaho.reporting.libraries.formula.typing.Type; import org.pentaho.reporting.libraries.formula.typing.TypeRegistry; -import org.pentaho.reporting.libraries.base.config.Configuration; /** * diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngine.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngine.java index d114edf34f71..ce95b35a66db 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngine.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngine.java @@ -35,6 +35,7 @@ import com.sun.star.report.ReportEngineMetaData; import com.sun.star.report.ReportJob; import com.sun.star.report.ReportJobDefinition; import com.sun.star.report.util.DefaultReportJobDefinition; + import org.jfree.report.JFreeReportBoot; public class PentahoReportEngine implements ReportEngine diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java index 1f4dce14950d..a7c8d533e192 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportEngineMetaData.java @@ -29,21 +29,23 @@ ************************************************************************/ package com.sun.star.report.pentaho; -import com.sun.star.report.ReportJobFactory; -import java.util.HashMap; -import java.util.HashSet; - import com.sun.star.report.DataSourceFactory; +import com.sun.star.report.ImageService; import com.sun.star.report.InputRepository; import com.sun.star.report.OutputRepository; import com.sun.star.report.ReportEngineMetaData; import com.sun.star.report.ReportEngineParameterNames; -import com.sun.star.report.ImageService; +import com.sun.star.report.ReportJobFactory; + +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; + import org.pentaho.reporting.libraries.base.util.HashNMap; + public class PentahoReportEngineMetaData implements ReportEngineMetaData { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java index 6889e3100f92..210fa9e0b561 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java @@ -29,10 +29,8 @@ ************************************************************************/ package com.sun.star.report.pentaho; -import java.io.IOException; -import java.lang.Integer;import java.util.ArrayList; - import com.sun.star.report.DataSourceFactory; +import com.sun.star.report.ImageService; import com.sun.star.report.InputRepository; import com.sun.star.report.JobDefinitionException; import com.sun.star.report.JobProgressIndicator; @@ -43,7 +41,6 @@ import com.sun.star.report.ReportEngineParameterNames; import com.sun.star.report.ReportExecutionException; import com.sun.star.report.ReportJob; import com.sun.star.report.ReportJobDefinition; -import com.sun.star.report.ImageService; import com.sun.star.report.SDBCReportDataFactory; import com.sun.star.report.pentaho.loader.InputRepositoryLoader; import com.sun.star.report.pentaho.model.OfficeDetailSection; @@ -51,15 +48,19 @@ import com.sun.star.report.pentaho.model.OfficeDocument; import com.sun.star.report.pentaho.model.OfficeGroup; import com.sun.star.report.pentaho.model.OfficeReport; import com.sun.star.report.pentaho.output.chart.ChartRawReportProcessor; -import com.sun.star.report.pentaho.output.text.TextRawReportProcessor; import com.sun.star.report.pentaho.output.spreadsheet.SpreadsheetRawReportProcessor; +import com.sun.star.report.pentaho.output.text.TextRawReportProcessor; + +import java.io.IOException; + +import java.lang.Integer; + +import java.util.ArrayList; import java.util.List; -import org.pentaho.reporting.libraries.formula.lvalues.ContextLookup; -import org.pentaho.reporting.libraries.formula.lvalues.FormulaFunction; -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.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.jfree.report.expressions.Expression; import org.jfree.report.expressions.FormulaExpression; import org.jfree.report.flow.DefaultReportJob; @@ -68,12 +69,18 @@ import org.jfree.report.flow.raw.XmlPrintReportProcessor; import org.jfree.report.structure.Node; import org.jfree.report.structure.Section; import org.jfree.report.util.ReportParameters; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; + +import org.pentaho.reporting.libraries.formula.lvalues.ContextLookup; +import org.pentaho.reporting.libraries.formula.lvalues.FormulaFunction; +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.resourceloader.Resource; import org.pentaho.reporting.libraries.resourceloader.ResourceException; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; + /** * ToDo: Allow interrupting of jobs and report the report progress */ diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java index 7a25d05c593f..bc00149189bb 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaOpCodeMapper.java @@ -31,12 +31,12 @@ package com.sun.star.report.pentaho; import com.sun.star.lang.XServiceInfo; -import com.sun.star.uno.XComponentContext; import com.sun.star.lib.uno.helper.WeakBase; import com.sun.star.sheet.FormulaLanguage; import com.sun.star.sheet.FormulaMapGroup; import com.sun.star.sheet.FormulaOpCodeMapEntry; import com.sun.star.sheet.FormulaToken; + import java.util.ArrayList; import java.util.Map; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java index 4ef8a43f954a..466ab82bdc76 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java @@ -30,27 +30,31 @@ ************************************************************************/ package com.sun.star.report.pentaho; + import com.sun.star.lang.XServiceInfo; -import com.sun.star.sheet.XFormulaOpCodeMapper; -import com.sun.star.uno.Exception; -import com.sun.star.uno.XComponentContext; import com.sun.star.lib.uno.helper.ComponentBase; -import com.sun.star.uno.Type; import com.sun.star.lib.uno.helper.PropertySetMixin; import com.sun.star.sheet.FormulaLanguage; import com.sun.star.sheet.FormulaMapGroup; import com.sun.star.sheet.FormulaMapGroupSpecialOffset; import com.sun.star.sheet.FormulaOpCodeMapEntry; import com.sun.star.sheet.FormulaToken; +import com.sun.star.sheet.XFormulaOpCodeMapper; import com.sun.star.uno.Any; +import com.sun.star.uno.Exception; +import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; + import java.io.StringReader; + import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Vector; + +import org.pentaho.reporting.libraries.base.config.Configuration; import org.pentaho.reporting.libraries.formula.DefaultFormulaContext; import org.pentaho.reporting.libraries.formula.function.FunctionRegistry; import org.pentaho.reporting.libraries.formula.parser.FormulaParser; @@ -60,7 +64,7 @@ import org.pentaho.reporting.libraries.formula.parser.JavaCharStream; import org.pentaho.reporting.libraries.formula.parser.ParseException; import org.pentaho.reporting.libraries.formula.parser.Token; import org.pentaho.reporting.libraries.formula.parser.TokenMgrError; -import org.pentaho.reporting.libraries.base.config.Configuration; + public final class SOFormulaParser extends ComponentBase implements com.sun.star.report.meta.XFormulaParser, XServiceInfo diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java index 3b890b940c6f..92aec7fc5343 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFunctionManager.java @@ -32,11 +32,12 @@ package com.sun.star.report.pentaho; import com.sun.star.container.NoSuchElementException; import com.sun.star.lang.XServiceInfo; -import com.sun.star.report.meta.XFunctionDescription; -import com.sun.star.uno.XComponentContext; import com.sun.star.lib.uno.helper.ComponentBase; import com.sun.star.report.meta.XFunctionCategory; +import com.sun.star.report.meta.XFunctionDescription; import com.sun.star.report.meta.XFunctionManager; +import com.sun.star.uno.XComponentContext; + import org.pentaho.reporting.libraries.formula.DefaultFormulaContext; import org.pentaho.reporting.libraries.formula.function.FunctionCategory; import org.pentaho.reporting.libraries.formula.function.FunctionDescription; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java index b1f886d664c5..610bbb6a5877 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/SOReportJobFactory.java @@ -30,18 +30,18 @@ package com.sun.star.report.pentaho; import com.sun.star.beans.NamedValue; -import com.sun.star.beans.XPropertySet; -import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.PropertyVetoException; +import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertyChangeListener; +import com.sun.star.beans.XPropertySet; import com.sun.star.beans.XVetoableChangeListener; import com.sun.star.container.XChild; import com.sun.star.embed.XStorage; import com.sun.star.frame.XModel; import com.sun.star.lang.IllegalArgumentException; +import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XInitialization; import com.sun.star.lang.XServiceInfo; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XSingleComponentFactory; import com.sun.star.lib.uno.helper.Factory; import com.sun.star.lib.uno.helper.PropertySetMixin; @@ -61,7 +61,6 @@ import com.sun.star.report.SDBCReportDataFactory; import com.sun.star.report.SOImageService; import com.sun.star.report.StorageRepository; import com.sun.star.report.XReportDefinition; -import com.sun.star.report.pentaho.SOReportJobFactory._SOReportJobFactory; import com.sun.star.sdb.XDocumentDataSource; import com.sun.star.sdbc.XConnection; import com.sun.star.sdbc.XRowSet; @@ -70,8 +69,10 @@ import com.sun.star.uno.Exception; import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; + import java.util.logging.Level; import java.util.logging.Logger; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java index 2c8b9d9f8786..56069ea2be9f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionCategory.java @@ -30,13 +30,15 @@ ************************************************************************/ package com.sun.star.report.pentaho; -import com.sun.star.uno.XComponentContext; -import com.sun.star.lib.uno.helper.WeakBase; -import com.sun.star.uno.Type; import com.sun.star.lib.uno.helper.PropertySetMixin; +import com.sun.star.lib.uno.helper.WeakBase; import com.sun.star.report.meta.XFunctionDescription; +import com.sun.star.uno.Type; +import com.sun.star.uno.XComponentContext; + import java.util.Locale; import java.util.MissingResourceException; + import org.pentaho.reporting.libraries.formula.DefaultFormulaContext; import org.pentaho.reporting.libraries.formula.function.FunctionCategory; import org.pentaho.reporting.libraries.formula.function.FunctionRegistry; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java index da84dc57746f..82c1c241fbce 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarFunctionDescription.java @@ -30,17 +30,18 @@ ************************************************************************/ package com.sun.star.report.pentaho; -import com.sun.star.uno.XComponentContext; -import com.sun.star.lib.uno.helper.WeakBase; -import com.sun.star.uno.Type; import com.sun.star.lib.uno.helper.PropertySetMixin; +import com.sun.star.lib.uno.helper.WeakBase; import com.sun.star.report.meta.XFunctionCategory; import com.sun.star.sheet.FunctionArgument; +import com.sun.star.uno.Type; +import com.sun.star.uno.XComponentContext; + import java.util.Locale; import java.util.MissingResourceException; + import org.pentaho.reporting.libraries.formula.DefaultFormulaContext; import org.pentaho.reporting.libraries.formula.function.FunctionDescription; -import org.pentaho.reporting.libraries.formula.function.FunctionRegistry; public final class StarFunctionDescription extends WeakBase implements com.sun.star.report.meta.XFunctionDescription diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarReportData.java b/reportbuilder/java/com/sun/star/report/pentaho/StarReportData.java index 7d65f881ec6c..f39168982ed8 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/StarReportData.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarReportData.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho; import com.sun.star.report.DataSource; + import org.jfree.report.DataSourceException; import org.jfree.report.ReportData; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java index 07359dc33452..d67f07a89a74 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/StarReportDataFactory.java @@ -29,14 +29,16 @@ ************************************************************************/ package com.sun.star.report.pentaho; +import com.sun.star.report.DataSourceException; +import com.sun.star.report.DataSourceFactory; + import java.util.HashMap; -import org.jfree.report.ReportDataFactory; -import org.jfree.report.ReportData; import org.jfree.report.DataSet; +import org.jfree.report.ReportData; +import org.jfree.report.ReportDataFactory; import org.jfree.report.ReportDataFactoryException; -import com.sun.star.report.DataSourceException; -import com.sun.star.report.DataSourceFactory; + public class StarReportDataFactory implements ReportDataFactory, Cloneable { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java index 2e4f9f396088..21d5a35f3b36 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpression.java @@ -29,8 +29,8 @@ ************************************************************************/ package com.sun.star.report.pentaho.expressions; -import com.sun.star.report.ReportExpression; import com.sun.star.report.DataRow; +import com.sun.star.report.ReportExpression; public class SumExpression implements ReportExpression { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java index b29b4ebb7ddb..10b82b4d0eb8 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/expressions/SumExpressionMetaData.java @@ -29,9 +29,10 @@ ************************************************************************/ package com.sun.star.report.pentaho.expressions; +import com.sun.star.report.ReportExpressionMetaData; + import java.util.Locale; -import com.sun.star.report.ReportExpressionMetaData; public class SumExpressionMetaData implements ReportExpressionMetaData { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java index 622699aa89d6..66a2a28e14ec 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/AbstractReportElementLayoutController.java @@ -29,15 +29,14 @@ ************************************************************************/ package com.sun.star.report.pentaho.layoutprocessor; -import com.sun.star.report.pentaho.model.ReportElement; import com.sun.star.report.pentaho.model.OfficeGroupSection; +import com.sun.star.report.pentaho.model.ReportElement; + +import org.jfree.report.DataFlags; +import org.jfree.report.DataRow; import org.jfree.report.DataSourceException; import org.jfree.report.ReportDataFactoryException; import org.jfree.report.ReportProcessingException; -import org.jfree.report.DataRow; -import org.jfree.report.DataFlags; -import org.jfree.report.structure.Element; -import org.jfree.report.structure.Group; import org.jfree.report.expressions.Expression; import org.jfree.report.flow.FlowController; import org.jfree.report.flow.ReportTarget; @@ -45,8 +44,11 @@ import org.jfree.report.flow.layoutprocessor.AbstractLayoutController; import org.jfree.report.flow.layoutprocessor.LayoutController; import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil; import org.jfree.report.flow.layoutprocessor.SectionLayoutController; -import org.pentaho.reporting.libraries.formula.lvalues.LValue; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Group; + import org.pentaho.reporting.libraries.formula.lvalues.ContextLookup; +import org.pentaho.reporting.libraries.formula.lvalues.LValue; /** * Todo: Document me! diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java index 7a96eabbb6b5..203f11934c92 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FixedTextLayoutController.java @@ -29,18 +29,19 @@ ************************************************************************/ package com.sun.star.report.pentaho.layoutprocessor; -import org.jfree.report.flow.layoutprocessor.LayoutController; -import org.jfree.report.flow.layoutprocessor.LayoutControllerFactory; -import org.jfree.report.flow.ReportTarget; -import org.jfree.report.flow.FlowController; -import org.jfree.report.flow.ReportContext; +import com.sun.star.report.pentaho.model.FixedTextElement; + +import org.jfree.report.DataSourceException; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.ReportProcessingException; import org.jfree.report.data.GlobalMasterRow; import org.jfree.report.data.ReportDataRow; +import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.ReportContext; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.layoutprocessor.LayoutController; +import org.jfree.report.flow.layoutprocessor.LayoutControllerFactory; import org.jfree.report.structure.Section; -import org.jfree.report.ReportProcessingException; -import org.jfree.report.ReportDataFactoryException; -import org.jfree.report.DataSourceException; -import com.sun.star.report.pentaho.model.FixedTextElement; /** * Processes a fixed-text element of the OpenOffice reporting specifciation. 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 79c946c9643d..2eeb57383997 100755 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -29,13 +29,16 @@ ************************************************************************/ package com.sun.star.report.pentaho.layoutprocessor; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.FormattedTextElement; + +import java.sql.Time; + 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; -import com.sun.star.report.pentaho.model.FormattedTextElement; import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataFlags; import org.jfree.report.DataSourceException; @@ -43,9 +46,10 @@ 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 * diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java index 16bc355f8b77..2c7d14b07052 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java @@ -29,14 +29,16 @@ ************************************************************************/ package com.sun.star.report.pentaho.layoutprocessor; -import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.FormattedTextElement; import com.sun.star.report.pentaho.model.OfficeDocument; import com.sun.star.report.pentaho.model.OfficeStyle; -import org.pentaho.reporting.libraries.formula.Formula; -import org.pentaho.reporting.libraries.formula.lvalues.LValue; -import org.pentaho.reporting.libraries.formula.parser.ParseException; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataFlags; import org.jfree.report.DataSourceException; import org.jfree.report.JFreeReportInfo; @@ -46,9 +48,10 @@ import org.jfree.report.expressions.FormulaExpression; import org.jfree.report.flow.ReportTarget; import org.jfree.report.flow.layoutprocessor.LayoutController; import org.jfree.report.structure.Element; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jfree.layouting.util.AttributeMap; + +import org.pentaho.reporting.libraries.formula.Formula; +import org.pentaho.reporting.libraries.formula.lvalues.LValue; +import org.pentaho.reporting.libraries.formula.parser.ParseException; /** * Todo: Document me! 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 81e17b73e276..a9580156d78b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ImageElementLayoutController.java @@ -29,18 +29,18 @@ ************************************************************************/ package com.sun.star.report.pentaho.layoutprocessor; -import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.ImageElement; -import org.pentaho.reporting.libraries.formula.Formula; -import org.pentaho.reporting.libraries.formula.lvalues.LValue; -import org.pentaho.reporting.libraries.formula.parser.ParseException; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataSourceException; import org.jfree.report.JFreeReportInfo; import org.jfree.report.ReportDataFactoryException; import org.jfree.report.ReportProcessingException; -import org.jfree.report.util.TextUtilities; import org.jfree.report.data.GlobalMasterRow; import org.jfree.report.data.ReportDataRow; import org.jfree.report.expressions.FormulaExpression; @@ -49,11 +49,14 @@ import org.jfree.report.flow.ReportTarget; import org.jfree.report.flow.layoutprocessor.LayoutController; import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil; import org.jfree.report.structure.Element; -import org.jfree.report.structure.Section; import org.jfree.report.structure.Node; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.jfree.report.structure.Section; +import org.jfree.report.util.TextUtilities; + import org.pentaho.reporting.libraries.base.util.ObjectUtilities; +import org.pentaho.reporting.libraries.formula.Formula; +import org.pentaho.reporting.libraries.formula.lvalues.LValue; +import org.pentaho.reporting.libraries.formula.parser.ParseException; /** * Produces an image. The image-structures itself (draw:frame and so on) are not generated here. This element produces a 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 b0de84bda31e..2d84ea31718e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/ObjectOleLayoutController.java @@ -29,21 +29,23 @@ ************************************************************************/ package com.sun.star.report.pentaho.layoutprocessor; -import com.sun.star.report.SDBCReportDataFactory; import com.sun.star.report.OfficeToken; +import com.sun.star.report.SDBCReportDataFactory; import com.sun.star.report.pentaho.model.ObjectOleElement; + import java.util.ArrayList; import java.util.Iterator; import java.util.List; + +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.DataFlags; +import org.jfree.report.DataRow; import org.jfree.report.DataSourceException; +import org.jfree.report.JFreeReportInfo; import org.jfree.report.ReportDataFactoryException; import org.jfree.report.ReportProcessingException; import org.jfree.report.flow.ReportTarget; import org.jfree.report.flow.layoutprocessor.LayoutController; -import org.jfree.layouting.util.AttributeMap; -import org.jfree.report.DataFlags; -import org.jfree.report.DataRow; -import org.jfree.report.JFreeReportInfo; import org.jfree.report.structure.Element; /** diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java index 9358e62a8590..28a2878d8513 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeDetailLayoutController.java @@ -30,10 +30,11 @@ package com.sun.star.report.pentaho.layoutprocessor; import com.sun.star.report.pentaho.model.VariablesDeclarationSection; + import org.jfree.report.DataSourceException; +import org.jfree.report.ReportData; import org.jfree.report.ReportDataFactoryException; import org.jfree.report.ReportProcessingException; -import org.jfree.report.ReportData; import org.jfree.report.data.GlobalMasterRow; import org.jfree.report.data.ReportDataRow; import org.jfree.report.flow.FlowController; 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 047e46f2e07a..1be93d70d7d1 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupInstanceSectionLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupInstanceSectionLayoutController.java @@ -1,23 +1,24 @@ package com.sun.star.report.pentaho.layoutprocessor; -import org.jfree.report.flow.layoutprocessor.SectionLayoutController; -import org.jfree.report.flow.layoutprocessor.LayoutController; -import org.jfree.report.flow.layoutprocessor.ElementLayoutController; -import org.jfree.report.flow.layoutprocessor.LayoutControllerFactory; -import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil; -import org.jfree.report.flow.FlowController; -import org.jfree.report.flow.ReportTarget; -import org.jfree.report.flow.ReportContext; +import com.sun.star.report.pentaho.model.OfficeGroupSection; +import com.sun.star.report.pentaho.model.VariablesDeclarationSection; + +import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataSourceException; +import org.jfree.report.JFreeReportInfo; import org.jfree.report.ReportDataFactoryException; import org.jfree.report.ReportProcessingException; import org.jfree.report.expressions.Expression; +import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.ReportContext; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.layoutprocessor.ElementLayoutController; +import org.jfree.report.flow.layoutprocessor.LayoutController; +import org.jfree.report.flow.layoutprocessor.LayoutControllerFactory; +import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil; +import org.jfree.report.flow.layoutprocessor.SectionLayoutController; import org.jfree.report.structure.Element; import org.jfree.report.structure.Node; -import org.jfree.layouting.util.AttributeMap; -import com.sun.star.report.pentaho.model.VariablesDeclarationSection; -import com.sun.star.report.pentaho.model.OfficeGroupSection; -import org.jfree.report.JFreeReportInfo; /** * Creation-Date: 25.07.2007, 14:50:45 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 12604e931238..c5e6ca83545d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupLayoutController.java @@ -31,6 +31,7 @@ package com.sun.star.report.pentaho.layoutprocessor; import com.sun.star.report.pentaho.model.OfficeGroup; import com.sun.star.report.pentaho.model.OfficeGroupSection; + import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataSourceException; import org.jfree.report.JFreeReportInfo; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java index 4eb40749e3fe..20ef9e8e1f0b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeGroupSectionLayoutController.java @@ -29,19 +29,20 @@ ************************************************************************/ package com.sun.star.report.pentaho.layoutprocessor; -import org.jfree.report.flow.layoutprocessor.SectionLayoutController; -import org.jfree.report.flow.layoutprocessor.LayoutController; -import org.jfree.report.flow.layoutprocessor.ElementLayoutController; -import org.jfree.report.flow.FlowController; -import org.jfree.report.flow.ReportTarget; -import org.jfree.report.structure.Element; -import org.jfree.report.DataSourceException; -import org.jfree.report.ReportProcessingException; -import org.jfree.report.ReportDataFactoryException; -import org.jfree.layouting.util.AttributeMap; import com.sun.star.report.OfficeToken; import com.sun.star.report.pentaho.model.OfficeGroupSection; + +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.DataSourceException; import org.jfree.report.JFreeReportInfo; +import org.jfree.report.ReportDataFactoryException; +import org.jfree.report.ReportProcessingException; +import org.jfree.report.flow.FlowController; +import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.layoutprocessor.ElementLayoutController; +import org.jfree.report.flow.layoutprocessor.LayoutController; +import org.jfree.report.flow.layoutprocessor.SectionLayoutController; +import org.jfree.report.structure.Element; /** * This layoutcontroller simply checks, whether the parent layout controller diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficePageSectionLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficePageSectionLayoutController.java index b98db5f34479..2eb3dd363f91 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficePageSectionLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficePageSectionLayoutController.java @@ -1,12 +1,12 @@ package com.sun.star.report.pentaho.layoutprocessor; -import org.jfree.report.flow.layoutprocessor.SectionLayoutController; +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.DataSourceException; +import org.jfree.report.JFreeReportInfo; import org.jfree.report.flow.FlowController; import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.layoutprocessor.SectionLayoutController; import org.jfree.report.structure.Element; -import org.jfree.report.DataSourceException; -import org.jfree.layouting.util.AttributeMap; -import org.jfree.report.JFreeReportInfo; /** * Todo: Document Me diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java index 5baffc4c346b..f3eb8b91041e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeReportLayoutController.java @@ -31,6 +31,7 @@ package com.sun.star.report.pentaho.layoutprocessor; import com.sun.star.report.pentaho.model.OfficeReport; import com.sun.star.report.pentaho.model.VariablesDeclarationSection; + import org.jfree.report.DataSourceException; import org.jfree.report.ReportDataFactoryException; import org.jfree.report.ReportProcessingException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java index f8c9a1111a8d..610aa41db039 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableLayoutController.java @@ -29,18 +29,19 @@ ************************************************************************/ package com.sun.star.report.pentaho.layoutprocessor; -import org.jfree.report.flow.layoutprocessor.SectionLayoutController; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; + +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.DataSourceException; +import org.jfree.report.JFreeReportInfo; import org.jfree.report.flow.FlowController; import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.layoutprocessor.SectionLayoutController; import org.jfree.report.structure.Element; -import org.jfree.report.structure.Section; import org.jfree.report.structure.Node; -import org.jfree.report.DataSourceException; +import org.jfree.report.structure.Section; import org.jfree.report.util.IntegerCache; -import org.jfree.layouting.util.AttributeMap; -import com.sun.star.report.pentaho.OfficeNamespaces; -import com.sun.star.report.OfficeToken; -import org.jfree.report.JFreeReportInfo; /** * Creation-Date: 24.04.2007, 14:40:20 diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java index 738ccb4f07f4..83f06249e914 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/OfficeTableTemplateLayoutController.java @@ -29,12 +29,13 @@ ************************************************************************/ package com.sun.star.report.pentaho.layoutprocessor; -import java.util.ArrayList; - import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.OfficeGroup; import com.sun.star.report.pentaho.model.OfficeReport; + +import java.util.ArrayList; import java.util.List; + import org.jfree.report.DataSourceException; import org.jfree.report.JFreeReportInfo; import org.jfree.report.ReportDataFactoryException; @@ -46,6 +47,7 @@ import org.jfree.report.structure.Element; import org.jfree.report.structure.Node; import org.jfree.report.structure.Section; + /** * Creation-Date: 24.04.2007, 16:06:52 * 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 baba6c9aafe5..fbc142b33477 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java @@ -29,14 +29,15 @@ ************************************************************************/ package com.sun.star.report.pentaho.layoutprocessor; -import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.FormatCondition; import com.sun.star.report.pentaho.model.FormattedTextElement; import com.sun.star.report.pentaho.model.ReportElement; + import org.jfree.layouting.util.AttributeMap; -import org.jfree.report.DataSourceException; import org.jfree.report.DataFlags; +import org.jfree.report.DataSourceException; import org.jfree.report.expressions.Expression; import org.jfree.report.flow.FlowController; import org.jfree.report.flow.ReportTarget; @@ -45,6 +46,7 @@ import org.jfree.report.flow.layoutprocessor.SectionLayoutController; import org.jfree.report.structure.Element; import org.jfree.report.structure.Node; import org.jfree.report.structure.Section; + import org.pentaho.reporting.libraries.base.util.ObjectUtilities; /** diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java index ca8687541545..441c8e4ac0a5 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesCollection.java @@ -29,11 +29,12 @@ ************************************************************************/ package com.sun.star.report.pentaho.layoutprocessor; -import java.util.ArrayList; - import com.sun.star.report.pentaho.model.FormattedTextElement; + +import java.util.ArrayList; import java.util.List; + /** * A variables collection is used to collect all FormattedTextElement objects * of a repeated header or footer. Later, for each of these elements a variable 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 e59a699109f4..b6c65ec8cb6a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java @@ -31,6 +31,11 @@ package com.sun.star.report.pentaho.layoutprocessor; import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.FormattedTextElement; + +import java.text.SimpleDateFormat; + +import java.util.Date; + import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataSourceException; import org.jfree.report.JFreeReportInfo; @@ -42,10 +47,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; /** * Writes a full variables-declaration section. diff --git a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java index fc6021202e68..723582670176 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java @@ -29,11 +29,13 @@ ************************************************************************/ package com.sun.star.report.pentaho.loader; +import com.sun.star.report.InputRepository; + import java.net.URL; -import java.util.Map; + import java.util.HashMap; +import java.util.Map; -import com.sun.star.report.InputRepository; import org.pentaho.reporting.libraries.resourceloader.ResourceData; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; import org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException; @@ -42,6 +44,7 @@ import org.pentaho.reporting.libraries.resourceloader.ResourceLoadingException; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; import org.pentaho.reporting.libraries.resourceloader.loader.LoaderUtils; + public class InputRepositoryLoader implements ResourceLoader { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java index 798f11d18194..26f38f93b8fa 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryResourceData.java @@ -29,15 +29,17 @@ ************************************************************************/ package com.sun.star.report.pentaho.loader; +import com.sun.star.report.InputRepository; + import java.io.IOException; import java.io.InputStream; -import com.sun.star.report.InputRepository; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; import org.pentaho.reporting.libraries.resourceloader.ResourceLoadingException; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; import org.pentaho.reporting.libraries.resourceloader.loader.AbstractResourceData; + public class InputRepositoryResourceData extends AbstractResourceData { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java b/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java index 37ffed4ecd8d..5f62a5a6621b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java @@ -29,9 +29,10 @@ ************************************************************************/ package com.sun.star.report.pentaho.model; -import org.jfree.report.structure.Section; import com.sun.star.report.pentaho.OfficeNamespaces; +import org.jfree.report.structure.Section; + /** * Represents an automatic or manual data style definition. * diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java index 96e9eed7c2fe..f55c5772c153 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java @@ -29,12 +29,14 @@ ************************************************************************/ package com.sun.star.report.pentaho.model; -import java.util.HashMap; - import com.sun.star.report.pentaho.OfficeNamespaces; + +import java.util.HashMap; import java.util.Map; + import org.jfree.report.structure.Element; + /** * Todo: Document me! * diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java index 46516557f97a..d35c2070aae6 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java @@ -29,9 +29,10 @@ ************************************************************************/ package com.sun.star.report.pentaho.model; -import org.jfree.report.structure.Section; import com.sun.star.report.pentaho.OfficeNamespaces; +import org.jfree.report.structure.Section; + /** * Represents an automatic or manual data style definition. * 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 f7832a9618c7..0fc87c489ff1 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java @@ -29,9 +29,10 @@ ************************************************************************/ package com.sun.star.report.pentaho.model; -import org.jfree.report.expressions.FormulaExpression; -import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; + +import org.jfree.report.expressions.FormulaExpression; /** * Todo: Document me! diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java index 41cc7aaa68d4..da9417bd5736 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.model; import com.sun.star.report.JobProperties; + import org.jfree.report.JFreeReport; /** diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java index eca3f20fe0ef..f846a158e98c 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java @@ -29,8 +29,9 @@ ************************************************************************/ package com.sun.star.report.pentaho.model; -import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; + import org.jfree.report.JFreeReportInfo; import org.jfree.report.expressions.Expression; import org.jfree.report.structure.Section; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java index 72c8e97ddb6a..af7449cbec92 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java @@ -29,9 +29,10 @@ ************************************************************************/ package com.sun.star.report.pentaho.model; -import org.jfree.report.structure.Section; -import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; + +import org.jfree.report.structure.Section; /** * A group header or footer. If such a section is marked as sticky, it will be diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java index 209f0866271a..bb6309fbfd26 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java @@ -29,9 +29,10 @@ ************************************************************************/ package com.sun.star.report.pentaho.model; -import org.jfree.report.structure.Section; import com.sun.star.report.pentaho.OfficeNamespaces; +import org.jfree.report.structure.Section; + /** * A master page. A master page can contain header and footer and is linked * to a page-layout. diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java index 866a604c3f9f..ee6ad942f643 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java @@ -30,11 +30,12 @@ package com.sun.star.report.pentaho.model; import java.util.HashMap; - import java.util.Map; + import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; + /** * The master-styles section can have either a master-page, handout-master * or draw-layer-set. (The latter ones are ignored for the reporting purposes, diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java index acb4b88359d0..b7be775450b4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java @@ -31,6 +31,7 @@ package com.sun.star.report.pentaho.model; import com.sun.star.report.OfficeToken; import com.sun.star.report.pentaho.OfficeNamespaces; + import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java index aa08f75e38a4..604e2ef49e09 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java @@ -30,13 +30,15 @@ package com.sun.star.report.pentaho.model; import java.io.Serializable; + import java.util.ArrayList; import java.util.HashMap; - import java.util.List; import java.util.Map; + import org.jfree.report.structure.Element; + /** * Holds one style type, either an automatic, common or master style. This is a * marker container that defines the nature of the styles contained within this diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java index a4a4d4b544ab..a45edad705fc 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.model; import com.sun.star.report.pentaho.OfficeNamespaces; + import org.jfree.report.structure.Element; /** diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java b/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java index 9499d0557f29..14f1df0dd232 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java @@ -29,9 +29,10 @@ ************************************************************************/ package com.sun.star.report.pentaho.model; -import org.jfree.report.structure.Section; import com.sun.star.report.pentaho.OfficeNamespaces; +import org.jfree.report.structure.Section; + /** * A page layout describes the physical properties of a page. It is equal to * an @page rule in CSS. diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/PageSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/PageSection.java index 537a1cc3af42..ba6a4ef523d6 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/PageSection.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/PageSection.java @@ -29,10 +29,11 @@ ************************************************************************/ package com.sun.star.report.pentaho.model; -import org.jfree.report.structure.Section; -import org.jfree.layouting.util.AttributeMap; import com.sun.star.report.pentaho.OfficeNamespaces; +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.structure.Section; + /** * This represents either a page header or page footer. * diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java index a3c9838be19d..c79abaf0dc9c 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java @@ -29,12 +29,14 @@ ************************************************************************/ package com.sun.star.report.pentaho.model; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; + import java.util.ArrayList; +import java.util.List; import org.jfree.report.structure.Element; -import com.sun.star.report.pentaho.OfficeNamespaces; -import com.sun.star.report.OfficeToken; -import java.util.List; + /** * A report element is the base class for all content generating elements in a 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 ac98c9a97953..12213c543b0b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java @@ -29,40 +29,48 @@ ************************************************************************/ package com.sun.star.report.pentaho.output; -import java.awt.Image; +import com.sun.star.report.ImageService; +import com.sun.star.report.InputRepository; +import com.sun.star.report.OutputRepository; +import com.sun.star.report.ReportExecutionException; +import com.sun.star.report.pentaho.DefaultNameGenerator; + import java.awt.Dimension; +import java.awt.Image; + import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; + import java.net.MalformedURLException; +import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; + import java.sql.Blob; import java.sql.SQLException; -import java.util.HashMap; -import java.util.Arrays; -import com.sun.star.report.InputRepository; -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.Arrays; +import java.util.HashMap; 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; import org.jfree.layouting.input.style.values.CSSNumericValue; + import org.pentaho.reporting.libraries.base.util.IOUtils; import org.pentaho.reporting.libraries.base.util.PngEncoder; import org.pentaho.reporting.libraries.base.util.WaitingImageObserver; + /** * This class manages the images embedded in a report. * 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 3892944eb1f2..07118decf5bd 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java @@ -30,26 +30,13 @@ package com.sun.star.report.pentaho.output; import com.sun.star.report.DataSourceFactory; -import java.awt.Image; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Reader; -import java.io.StringWriter; -import java.io.Writer; -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.OfficeToken; import com.sun.star.report.OutputRepository; +import com.sun.star.report.ReportEngineParameterNames; 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.layoutprocessor.ImageElementContext; import com.sun.star.report.pentaho.model.OfficeDocument; import com.sun.star.report.pentaho.model.OfficeStyle; @@ -57,15 +44,33 @@ import com.sun.star.report.pentaho.model.OfficeStyles; import com.sun.star.report.pentaho.model.OfficeStylesCollection; import com.sun.star.report.pentaho.styles.LengthCalculator; import com.sun.star.report.pentaho.styles.StyleMapper; + +import java.awt.Image; + import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Reader; import java.io.StringReader; +import java.io.StringWriter; +import java.io.Writer; + import java.util.ArrayList; +import java.util.Iterator; +import java.util.Map; +import java.util.zip.DeflaterOutputStream; +import java.util.zip.InflaterInputStream; + import org.apache.commons.logging.Log; 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.input.style.values.CSSNumericValue; import org.jfree.layouting.layouter.style.CSSValueResolverUtility; import org.jfree.layouting.namespace.NamespaceDefinition; import org.jfree.layouting.namespace.Namespaces; @@ -85,6 +90,7 @@ import org.jfree.report.structure.Section; import org.jfree.report.util.AttributeNameGenerator; import org.jfree.report.util.IntegerCache; import org.jfree.report.util.MemoryByteArrayOutputStream; + import org.pentaho.reporting.libraries.base.util.FastStack; import org.pentaho.reporting.libraries.base.util.IOUtils; import org.pentaho.reporting.libraries.resourceloader.ResourceException; @@ -94,6 +100,7 @@ import org.pentaho.reporting.libraries.xmlns.common.AttributeList; import org.pentaho.reporting.libraries.xmlns.writer.DefaultTagDescription; import org.pentaho.reporting.libraries.xmlns.writer.XmlWriter; import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport; + import org.w3c.css.sac.LexicalUnit; /** 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 66b0a0435b17..0216685e3646 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java @@ -40,8 +40,11 @@ import com.sun.star.report.ReportJobDefinition; import com.sun.star.report.pentaho.DefaultNameGenerator; import com.sun.star.report.pentaho.PentahoReportEngine; import com.sun.star.report.pentaho.PentahoReportEngineMetaData; + import java.io.IOException; + import java.util.List; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java b/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java index 4bccca1e9612..0fe5c9d16230 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java @@ -29,8 +29,6 @@ ************************************************************************/ package com.sun.star.report.pentaho.output; -import java.util.HashSet; - import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.DataStyle; import com.sun.star.report.pentaho.model.FontFaceDeclsSection; @@ -38,14 +36,19 @@ import com.sun.star.report.pentaho.model.FontFaceElement; import com.sun.star.report.pentaho.model.OfficeStyle; import com.sun.star.report.pentaho.model.OfficeStyles; import com.sun.star.report.pentaho.model.OfficeStylesCollection; + import java.util.ArrayList; +import java.util.HashSet; import java.util.Set; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.jfree.report.ReportProcessingException; import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; import org.jfree.report.util.AttributeNameGenerator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; + /** * Todo: Document me! diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java index 24fb64d3b95e..ad77f6819796 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java @@ -29,23 +29,25 @@ ************************************************************************/ package com.sun.star.report.pentaho.output; -import java.io.IOException; -import java.io.Writer; -import java.util.Iterator; -import java.util.Map; -import java.util.TreeMap; - import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.DataStyle; import com.sun.star.report.pentaho.model.FontFaceDeclsSection; import com.sun.star.report.pentaho.model.FontFaceElement; +import com.sun.star.report.pentaho.model.OfficeMasterPage; +import com.sun.star.report.pentaho.model.OfficeMasterStyles; import com.sun.star.report.pentaho.model.OfficeStyle; import com.sun.star.report.pentaho.model.OfficeStyles; import com.sun.star.report.pentaho.model.OfficeStylesCollection; -import com.sun.star.report.pentaho.model.OfficeMasterStyles; -import com.sun.star.report.pentaho.model.OfficeMasterPage; -import com.sun.star.report.pentaho.model.DataStyle; import com.sun.star.report.pentaho.model.PageLayout; import com.sun.star.report.pentaho.model.RawText; + +import java.io.IOException; +import java.io.Writer; + +import java.util.Iterator; +import java.util.Map; +import java.util.TreeMap; + import org.jfree.layouting.namespace.Namespaces; import org.jfree.layouting.util.AttributeMap; import org.jfree.report.JFreeReportBoot; @@ -55,11 +57,13 @@ import org.jfree.report.structure.Element; import org.jfree.report.structure.Node; import org.jfree.report.structure.Section; import org.jfree.report.structure.StaticText; + import org.pentaho.reporting.libraries.xmlns.common.AttributeList; import org.pentaho.reporting.libraries.xmlns.writer.DefaultTagDescription; import org.pentaho.reporting.libraries.xmlns.writer.XmlWriter; import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport; + /** * This class writes the style collection into a 'styles.xml' document. * diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportProcessor.java b/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportProcessor.java index 1845fc59a78f..04ec8094955d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportProcessor.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportProcessor.java @@ -33,6 +33,7 @@ import com.sun.star.report.DataSourceFactory; import com.sun.star.report.ImageService; import com.sun.star.report.InputRepository; import com.sun.star.report.OutputRepository; + import org.jfree.report.DataSourceException; import org.jfree.report.ReportDataFactoryException; import org.jfree.report.ReportProcessingException; @@ -40,6 +41,7 @@ import org.jfree.report.flow.ReportJob; import org.jfree.report.flow.ReportStructureRoot; import org.jfree.report.flow.ReportTarget; import org.jfree.report.flow.SinglePassReportProcessor; + import org.pentaho.reporting.libraries.resourceloader.ResourceManager; /** 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 05e70d1e49e2..4f411850bafa 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 @@ -32,14 +32,16 @@ package com.sun.star.report.pentaho.output.chart; import com.sun.star.report.DataSourceFactory; import com.sun.star.report.ImageService; import com.sun.star.report.InputRepository; +import com.sun.star.report.OfficeToken; import com.sun.star.report.OutputRepository; import com.sun.star.report.pentaho.OfficeNamespaces; -import com.sun.star.report.OfficeToken; import com.sun.star.report.pentaho.PentahoReportEngineMetaData; import com.sun.star.report.pentaho.output.OfficeDocumentReportTarget; + import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; + import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataFlags; import org.jfree.report.DataSourceException; @@ -47,6 +49,7 @@ import org.jfree.report.ReportProcessingException; import org.jfree.report.flow.ReportJob; import org.jfree.report.flow.ReportStructureRoot; import org.jfree.report.flow.ReportTargetUtil; + import org.pentaho.reporting.libraries.base.util.IOUtils; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java index ddc644d52ef3..2ec1d6057369 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java @@ -30,19 +30,21 @@ package com.sun.star.report.pentaho.output.spreadsheet; import com.sun.star.report.DataSourceFactory; +import com.sun.star.report.ImageService; +import com.sun.star.report.InputRepository; +import com.sun.star.report.OutputRepository; +import com.sun.star.report.pentaho.PentahoFormulaContext; + import org.jfree.report.DataSourceException; import org.jfree.report.ReportDataFactoryException; import org.jfree.report.ReportProcessingException; +import org.jfree.report.data.ReportContextImpl; import org.jfree.report.flow.AbstractReportProcessor; +import org.jfree.report.flow.ReportContext; import org.jfree.report.flow.ReportJob; import org.jfree.report.flow.ReportStructureRoot; import org.jfree.report.flow.ReportTarget; -import com.sun.star.report.OutputRepository; -import com.sun.star.report.InputRepository; -import com.sun.star.report.ImageService; -import com.sun.star.report.pentaho.PentahoFormulaContext; -import org.jfree.report.data.ReportContextImpl; -import org.jfree.report.flow.ReportContext; + import org.pentaho.reporting.libraries.resourceloader.ResourceManager; /** 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 01e5135c3613..b4a4f7c6870f 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 @@ -30,49 +30,52 @@ package com.sun.star.report.pentaho.output.spreadsheet; import com.sun.star.report.DataSourceFactory; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; - +import com.sun.star.report.ImageService; import com.sun.star.report.InputRepository; +import com.sun.star.report.OfficeToken; import com.sun.star.report.OutputRepository; -import com.sun.star.report.ImageService; import com.sun.star.report.pentaho.OfficeNamespaces; -import com.sun.star.report.OfficeToken; import com.sun.star.report.pentaho.PentahoReportEngineMetaData; +import com.sun.star.report.pentaho.model.OfficeMasterPage; +import com.sun.star.report.pentaho.model.OfficeMasterStyles; import com.sun.star.report.pentaho.model.OfficeStyle; import com.sun.star.report.pentaho.model.OfficeStyles; import com.sun.star.report.pentaho.model.OfficeStylesCollection; -import com.sun.star.report.pentaho.model.OfficeMasterPage; -import com.sun.star.report.pentaho.model.OfficeMasterStyles; import com.sun.star.report.pentaho.model.PageSection; import com.sun.star.report.pentaho.output.OfficeDocumentReportTarget; import com.sun.star.report.pentaho.output.StyleUtilities; import com.sun.star.report.pentaho.output.text.MasterPageFactory; import com.sun.star.report.pentaho.styles.LengthCalculator; + +import java.io.IOException; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; import java.util.Set; -import org.jfree.layouting.util.AttributeMap; -import org.jfree.layouting.input.style.values.CSSNumericValue; + import org.jfree.layouting.input.style.values.CSSNumericType; +import org.jfree.layouting.input.style.values.CSSNumericValue; +import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataFlags; import org.jfree.report.DataSourceException; -import org.jfree.report.ReportProcessingException; import org.jfree.report.JFreeReportInfo; +import org.jfree.report.ReportProcessingException; import org.jfree.report.flow.ReportJob; import org.jfree.report.flow.ReportStructureRoot; import org.jfree.report.flow.ReportTargetUtil; import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; import org.jfree.report.util.IntegerCache; -import org.jfree.report.util.TextUtilities; + import org.pentaho.reporting.libraries.resourceloader.ResourceKey; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; import org.pentaho.reporting.libraries.xmlns.common.AttributeList; import org.pentaho.reporting.libraries.xmlns.writer.XmlWriter; import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport; + /** * Creation-Date: 03.11.2007 * 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 ca3047a16c16..9dabe6505167 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 @@ -29,20 +29,22 @@ ************************************************************************/ package com.sun.star.report.pentaho.output.text; -import java.util.HashMap; - import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.OfficeMasterPage; import com.sun.star.report.pentaho.model.OfficeMasterStyles; -import com.sun.star.report.pentaho.model.RawText; import com.sun.star.report.pentaho.model.OfficeStyles; import com.sun.star.report.pentaho.model.PageLayout; +import com.sun.star.report.pentaho.model.RawText; + +import java.util.HashMap; import java.util.Map; + import org.jfree.layouting.input.style.values.CSSNumericValue; -import org.jfree.report.structure.Section; +import org.jfree.report.ReportProcessingException; import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; import org.jfree.report.util.AttributeNameGenerator; -import org.jfree.report.ReportProcessingException; + /** * Todo: Document me! 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 740582c9b347..130cbb40dbdf 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 @@ -29,9 +29,10 @@ ************************************************************************/ package com.sun.star.report.pentaho.output.text; -import org.jfree.layouting.input.style.values.CSSNumericValue; import com.sun.star.report.pentaho.styles.LengthCalculator; +import org.jfree.layouting.input.style.values.CSSNumericValue; + /** * Todo: Document me! * diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java index 3b23ffb4c3df..57fc56bd094f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java @@ -30,10 +30,11 @@ package com.sun.star.report.pentaho.output.text; import com.sun.star.report.DataSourceFactory; -import com.sun.star.report.OutputRepository; -import com.sun.star.report.InputRepository; import com.sun.star.report.ImageService; +import com.sun.star.report.InputRepository; +import com.sun.star.report.OutputRepository; import com.sun.star.report.pentaho.PentahoFormulaContext; + import org.jfree.report.ReportProcessingException; import org.jfree.report.data.ReportContextImpl; import org.jfree.report.flow.ReportContext; @@ -41,6 +42,7 @@ import org.jfree.report.flow.ReportJob; import org.jfree.report.flow.ReportStructureRoot; import org.jfree.report.flow.ReportTarget; import org.jfree.report.flow.SinglePassReportProcessor; + import org.pentaho.reporting.libraries.resourceloader.ResourceManager; /** 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 947087a17c11..c70a5a4ed3f4 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 @@ -30,18 +30,11 @@ package com.sun.star.report.pentaho.output.text; import com.sun.star.report.DataSourceFactory; -import java.io.IOException; -import java.io.OutputStream; -import java.io.InputStream; -import java.io.OutputStreamWriter; -import java.util.Iterator; -import java.util.Map; - import com.sun.star.report.ImageService; import com.sun.star.report.InputRepository; +import com.sun.star.report.OfficeToken; import com.sun.star.report.OutputRepository; import com.sun.star.report.pentaho.OfficeNamespaces; -import com.sun.star.report.OfficeToken; import com.sun.star.report.pentaho.PentahoReportEngineMetaData; import com.sun.star.report.pentaho.layoutprocessor.FormatValueUtility; import com.sun.star.report.pentaho.model.OfficeMasterPage; @@ -53,7 +46,16 @@ import com.sun.star.report.pentaho.model.PageSection; import com.sun.star.report.pentaho.output.OfficeDocumentReportTarget; import com.sun.star.report.pentaho.output.StyleUtilities; import com.sun.star.report.pentaho.styles.LengthCalculator; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; + import java.util.ArrayList; +import java.util.Iterator; +import java.util.Map; + import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataSourceException; @@ -66,6 +68,7 @@ import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; import org.jfree.report.util.AttributeNameGenerator; import org.jfree.report.util.IntegerCache; + import org.pentaho.reporting.libraries.base.util.FastStack; import org.pentaho.reporting.libraries.base.util.IOUtils; import org.pentaho.reporting.libraries.base.util.ObjectUtilities; @@ -75,6 +78,7 @@ import org.pentaho.reporting.libraries.xmlns.common.AttributeList; import org.pentaho.reporting.libraries.xmlns.writer.XmlWriter; import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport; + /** * Creation-Date: 03.07.2006, 16:28:00 * diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/VariablesDeclarations.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/VariablesDeclarations.java index a348fb9b67fb..e06df0255c11 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/text/VariablesDeclarations.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/VariablesDeclarations.java @@ -30,11 +30,12 @@ package com.sun.star.report.pentaho.output.text; import java.util.HashMap; -import java.util.Map; import java.util.Iterator; +import java.util.Map; import org.jfree.report.util.AttributeNameGenerator; + /** * A collection that holds all used variables. A variable is primarily keyed by * its original name. If a variable contains more than one type, it is also diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/ElementReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/ElementReadHandler.java index 3bfe49fc2c27..2cd983245b3a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/ElementReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/ElementReadHandler.java @@ -30,7 +30,9 @@ package com.sun.star.report.pentaho.parser; import org.jfree.report.structure.Element; + import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java index e3b8f7374d43..fd7de9f7015e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser; import com.sun.star.report.pentaho.model.OfficeDocument; + import org.jfree.report.modules.factories.report.base.JFreeReportXmlResourceFactory; /** diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java index 266cfa529d5a..d09022b1e0d4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java @@ -29,21 +29,24 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser; +import java.util.HashMap; import java.util.Iterator; -import java.util.Properties; import java.util.Map; -import java.util.HashMap; +import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.jfree.report.JFreeReportBoot; + import org.jfree.layouting.namespace.NamespaceDefinition; import org.jfree.layouting.namespace.Namespaces; +import org.jfree.report.JFreeReportBoot; + import org.pentaho.reporting.libraries.base.config.DefaultConfiguration; import org.pentaho.reporting.libraries.resourceloader.Resource; import org.pentaho.reporting.libraries.resourceloader.ResourceException; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; + public class OfficeParserUtil { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java index 6971eb857a20..a832f060c63f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/OfficeStylesXmlResourceFactory.java @@ -30,7 +30,9 @@ package com.sun.star.report.pentaho.parser; import com.sun.star.report.pentaho.model.OfficeStylesCollection; + import org.jfree.report.JFreeReportBoot; + import org.pentaho.reporting.libraries.base.config.Configuration; import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlResourceFactory; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java index ff3dfc494436..397c1742ebc3 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarStyleXmlFactoryModule.java @@ -31,6 +31,7 @@ package com.sun.star.report.pentaho.parser; import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.parser.office.DocumentStylesReadHandler; + import org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo; import org.pentaho.reporting.libraries.xmlns.parser.XmlFactoryModule; import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java index e69df1b60bbe..8ae5ee477e8d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/StarXmlFactoryModule.java @@ -29,8 +29,9 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser; -import com.sun.star.report.pentaho.parser.office.DocumentContentReadHandler; import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.parser.office.DocumentContentReadHandler; + import org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo; import org.pentaho.reporting.libraries.xmlns.parser.XmlFactoryModule; import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/chart/ChartReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/chart/ChartReadHandler.java index 820a8fee65e6..4f0f3f7d170d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/chart/ChartReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/chart/ChartReadHandler.java @@ -30,20 +30,25 @@ package com.sun.star.report.pentaho.parser.chart; import com.sun.star.report.pentaho.OfficeNamespaces; -import java.lang.Object; -import java.util.ArrayList; - import com.sun.star.report.pentaho.parser.ElementReadHandler; import com.sun.star.report.pentaho.parser.rpt.DetailRootTableReadHandler; import com.sun.star.report.pentaho.parser.rpt.ReportReadHandler; import com.sun.star.report.pentaho.parser.text.TextContentReadHandler; + +import java.lang.Object; + +import java.util.ArrayList; import java.util.List; + import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; + /** * * @author Ocke Janssen 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 b4787ca63cb9..53d0e85708e6 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 @@ -29,18 +29,22 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.data; -import java.util.ArrayList; - import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.DataStyle; import com.sun.star.report.pentaho.parser.ElementReadHandler; + +import java.util.ArrayList; import java.util.List; + import org.jfree.report.structure.Element; import org.jfree.report.structure.StaticText; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; + public class DataStyleReadHandler extends ElementReadHandler { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java index 6630d1e73962..4dc0c39d9223 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java @@ -32,7 +32,9 @@ package com.sun.star.report.pentaho.parser.draw; import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.ObjectOleElement; import com.sun.star.report.pentaho.parser.ElementReadHandler; + import org.jfree.report.structure.Element; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/BodyReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/BodyReadHandler.java index acb6a9e5da2b..13b2e6a23a04 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/BodyReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/BodyReadHandler.java @@ -32,9 +32,12 @@ package com.sun.star.report.pentaho.parser.office; import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.parser.ElementReadHandler; import com.sun.star.report.pentaho.parser.rpt.ReportReadHandler; + import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java index 64255c2ae373..a460bdd1d0ab 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentContentReadHandler.java @@ -33,9 +33,12 @@ import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.OfficeDocument; import com.sun.star.report.pentaho.model.OfficeStylesCollection; import com.sun.star.report.pentaho.parser.style.OfficeStylesReadHandler; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.jfree.report.JFreeReport; + import org.pentaho.reporting.libraries.resourceloader.Resource; import org.pentaho.reporting.libraries.resourceloader.ResourceException; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; @@ -43,6 +46,7 @@ import org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationExcepti import org.pentaho.reporting.libraries.resourceloader.ResourceManager; import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java index 32f7c54fa08a..6ce132fafafb 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/DocumentStylesReadHandler.java @@ -33,8 +33,11 @@ import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.OfficeStylesCollection; import com.sun.star.report.pentaho.parser.ElementReadHandler; import com.sun.star.report.pentaho.parser.style.OfficeStylesReadHandler; + import org.jfree.report.structure.Element; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java index 7e40681faee3..f423746ecc84 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/FontFaceDeclsReadHandler.java @@ -29,19 +29,23 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.office; -import java.util.ArrayList; - import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.FontFaceDeclsSection; import com.sun.star.report.pentaho.model.FontFaceElement; import com.sun.star.report.pentaho.parser.ElementReadHandler; import com.sun.star.report.pentaho.parser.style.FontFaceReadHandler; + +import java.util.ArrayList; import java.util.List; + import org.jfree.report.structure.Element; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; + /** * Reads the font-face declarations section. This one can only contain * font-face elements. diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/MasterStylesReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/MasterStylesReadHandler.java index deed7bdc0d84..e1e08100e4e7 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/office/MasterStylesReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/office/MasterStylesReadHandler.java @@ -29,19 +29,23 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.office; -import java.util.ArrayList; - +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.OfficeMasterStyles; import com.sun.star.report.pentaho.parser.ElementReadHandler; -import com.sun.star.report.pentaho.parser.style.StyleDefinitionReadHandler; import com.sun.star.report.pentaho.parser.style.MasterPageReadHandler; -import com.sun.star.report.pentaho.model.OfficeMasterStyles; -import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.parser.style.StyleDefinitionReadHandler; + +import java.util.ArrayList; import java.util.List; + import org.jfree.report.structure.Element; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; + /** * Todo: Document me! * 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 7378637bae15..b91e1c02069d 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 @@ -30,9 +30,12 @@ package com.sun.star.report.pentaho.parser.rpt; import com.sun.star.report.pentaho.OfficeNamespaces; + import org.jfree.report.expressions.FormulaFunction; import org.jfree.report.structure.Element; + import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FixedContentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FixedContentReadHandler.java index a11d42509f14..73efed40de58 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FixedContentReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FixedContentReadHandler.java @@ -29,14 +29,17 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.rpt; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.FixedTextElement; import com.sun.star.report.pentaho.parser.ElementReadHandler; import com.sun.star.report.pentaho.parser.text.TextContentReadHandler; -import com.sun.star.report.pentaho.OfficeNamespaces; -import com.sun.star.report.OfficeToken; + import org.jfree.report.structure.Element; + import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler; import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormatConditionReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormatConditionReadHandler.java index 840027027940..9af1be74a952 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormatConditionReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormatConditionReadHandler.java @@ -29,13 +29,16 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.rpt; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.FormatCondition; import com.sun.star.report.pentaho.model.ReportElement; -import com.sun.star.report.pentaho.OfficeNamespaces; -import com.sun.star.report.OfficeToken; + import org.jfree.report.expressions.FormulaExpression; + import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; import org.pentaho.reporting.libraries.xmlns.parser.ParseException; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java index 7f98e3f79f6a..94d2a934e6da 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FormattedTextReadHandler.java @@ -29,13 +29,16 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.rpt; +import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.FormattedTextElement; import com.sun.star.report.pentaho.parser.ElementReadHandler; -import com.sun.star.report.pentaho.OfficeNamespaces; + import org.jfree.report.expressions.FormulaExpression; import org.jfree.report.structure.Element; -import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FunctionReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FunctionReadHandler.java index b5ba5a24642e..93027fb5fb35 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FunctionReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/FunctionReadHandler.java @@ -29,15 +29,18 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.rpt; -import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; -import org.pentaho.reporting.libraries.xmlns.parser.ParseException; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; + import org.jfree.report.expressions.Expression; -import org.jfree.report.expressions.FormulaFunction; import org.jfree.report.expressions.FormulaExpression; -import org.xml.sax.SAXException; +import org.jfree.report.expressions.FormulaFunction; + +import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.ParseException; + import org.xml.sax.Attributes; -import com.sun.star.report.pentaho.OfficeNamespaces; -import com.sun.star.report.OfficeToken; +import org.xml.sax.SAXException; /** * Parses a named expression. These expressions are encountered on reports and 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 b9c6cb42d77e..88991a5fa1c6 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 @@ -30,21 +30,25 @@ package com.sun.star.report.pentaho.parser.rpt; import com.sun.star.report.OfficeToken; -import java.util.ArrayList; - import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.OfficeGroup; import com.sun.star.report.pentaho.model.OfficeGroupInstanceSection; import com.sun.star.report.pentaho.parser.ElementReadHandler; + +import java.util.ArrayList; import java.util.List; + import org.jfree.report.JFreeReportInfo; import org.jfree.report.expressions.FormulaExpression; import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; + public class GroupReadHandler extends ElementReadHandler { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ImageReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ImageReadHandler.java index e570a5135fca..40d5aeba6c67 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ImageReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ImageReadHandler.java @@ -29,15 +29,18 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.rpt; -import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.ImageElement; import com.sun.star.report.pentaho.parser.ElementReadHandler; import com.sun.star.report.pentaho.parser.xlink.XLinkReadHandler; + import org.jfree.report.expressions.FormulaExpression; import org.jfree.report.structure.Element; + import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler; import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java index e9b1d8959333..f254ac54093e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/MasterDetailReadHandler.java @@ -29,11 +29,14 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.rpt; +import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.ObjectOleElement; import com.sun.star.report.pentaho.parser.ElementReadHandler; -import com.sun.star.report.pentaho.OfficeNamespaces; + import org.jfree.report.structure.Element; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java index 9177d66db974..5a91e9ce8260 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportElementReadHandler.java @@ -29,13 +29,16 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.rpt; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.ReportElement; import com.sun.star.report.pentaho.parser.ElementReadHandler; -import com.sun.star.report.pentaho.OfficeNamespaces; -import com.sun.star.report.OfficeToken; + import org.jfree.report.structure.Element; -import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java index 1d0acf709161..2fa1e950f4b1 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/ReportReadHandler.java @@ -29,20 +29,24 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.rpt; -import java.util.ArrayList; - import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.OfficeReport; import com.sun.star.report.pentaho.parser.ElementReadHandler; import com.sun.star.report.pentaho.parser.chart.ChartReadHandler; + +import java.util.ArrayList; import java.util.List; + import org.jfree.report.JFreeReportInfo; import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; + public class ReportReadHandler extends ElementReadHandler { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/RootTableReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/RootTableReadHandler.java index 7f1604d0e7ea..82dc318a3aee 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/RootTableReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/RootTableReadHandler.java @@ -32,9 +32,12 @@ package com.sun.star.report.pentaho.parser.rpt; import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.parser.ElementReadHandler; import com.sun.star.report.pentaho.parser.table.TableReadHandler; + import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/SubDocumentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/SubDocumentReadHandler.java index ab635a6b095b..328685461970 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/SubDocumentReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/rpt/SubDocumentReadHandler.java @@ -29,14 +29,17 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.rpt; -import com.sun.star.report.pentaho.model.ObjectOleElement; -import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.ObjectOleElement; import com.sun.star.report.pentaho.parser.draw.ObjectOleReadHandler; import com.sun.star.report.pentaho.parser.text.NoCDATATextContentReadHandler; + import org.jfree.report.structure.Section; -import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler; +import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java index 0c7b8747c9d5..71ba531847aa 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/FontFaceReadHandler.java @@ -29,8 +29,9 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.style; -import com.sun.star.report.pentaho.parser.ElementReadHandler; import com.sun.star.report.pentaho.model.FontFaceElement; +import com.sun.star.report.pentaho.parser.ElementReadHandler; + import org.jfree.report.structure.Element; /** diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java index 75773988cf76..10c4aa5067bd 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/MasterPageReadHandler.java @@ -29,16 +29,20 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.style; -import java.util.ArrayList; - import com.sun.star.report.pentaho.model.OfficeMasterPage; import com.sun.star.report.pentaho.parser.ElementReadHandler; + +import java.util.ArrayList; import java.util.List; + import org.jfree.report.structure.Element; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; + /** * Todo: Document me! * diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java index 0a541495c8dd..4fda1d371679 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStyleReadHandler.java @@ -29,16 +29,20 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.style; -import java.util.ArrayList; - -import com.sun.star.report.pentaho.parser.ElementReadHandler; import com.sun.star.report.pentaho.model.OfficeStyle; +import com.sun.star.report.pentaho.parser.ElementReadHandler; + +import java.util.ArrayList; import java.util.List; + import org.jfree.report.structure.Element; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; + /** * This class reads a single style rule. The resulting 'office-style' element * is added to an 'office-styles' set. diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java index 4c4a2e80d19a..2f7255feeae0 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/OfficeStylesReadHandler.java @@ -29,17 +29,21 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.style; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.OfficeStyles; +import com.sun.star.report.pentaho.parser.ElementReadHandler; +import com.sun.star.report.pentaho.parser.data.DataStyleReadHandler; + import java.util.ArrayList; +import java.util.List; + import org.jfree.report.modules.factories.report.flow.SectionReadHandler; import org.jfree.report.structure.Element; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; -import com.sun.star.report.pentaho.OfficeNamespaces; -import com.sun.star.report.pentaho.model.OfficeStyles; -import com.sun.star.report.pentaho.parser.ElementReadHandler; -import com.sun.star.report.pentaho.parser.data.DataStyleReadHandler; -import java.util.List; public class OfficeStylesReadHandler extends ElementReadHandler { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java index 5ee10d2b936b..758f8fb7a259 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/PageLayoutReadHandler.java @@ -29,16 +29,20 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.style; -import java.util.ArrayList; - import com.sun.star.report.pentaho.model.PageLayout; import com.sun.star.report.pentaho.parser.ElementReadHandler; + +import java.util.ArrayList; import java.util.List; + import org.jfree.report.structure.Element; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; + /** * Reads a page-layout element. * diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java index 0fd0655d4e22..624c61dc5cb0 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/style/StyleDefinitionReadHandler.java @@ -29,16 +29,20 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.style; -import java.util.ArrayList; - import com.sun.star.report.pentaho.parser.ElementReadHandler; + +import java.util.ArrayList; import java.util.List; + import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; + /** * Reads all childs of a style-definition. This simply copies everything that * is contained in the source-file into a generic structure that can be diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java index 8e385f2ba859..7640ba7ecf77 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java @@ -29,14 +29,16 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.stylemapper; -import java.util.HashMap; - import com.sun.star.report.pentaho.parser.StyleMapper; + +import java.util.HashMap; import java.util.Map; + import org.jfree.layouting.input.style.CSSDeclarationRule; import org.jfree.layouting.input.style.StyleKey; import org.jfree.layouting.input.style.values.CSSValue; + public abstract class OneOfConstantsMapper implements StyleMapper { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java index 8418815f3b7d..a32bedc13ee7 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.draw; import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; + import org.jfree.layouting.input.style.keys.box.BoxStyleKeys; import org.jfree.layouting.input.style.values.CSSConstant; 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 a2ca9ca9e496..ac9fac7f1764 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 @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.fo; import com.sun.star.report.pentaho.parser.StyleMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; import org.jfree.layouting.input.style.keys.border.BorderStyleKeys; import org.jfree.layouting.input.style.values.CSSColorValue; 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 14b9f4dd5b3b..5e1a21e40f82 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 @@ -38,6 +38,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.fo; import com.sun.star.report.pentaho.parser.StyleMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; /** diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/ColorMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/ColorMapper.java index f824646a9df4..4c7ed5740f4f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/ColorMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/ColorMapper.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.fo; import com.sun.star.report.pentaho.parser.StyleMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; import org.jfree.layouting.input.style.keys.color.ColorStyleKeys; import org.jfree.layouting.input.style.values.CSSColorValue; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java index 94c701431527..2c01ae58e8fa 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.fo; import com.sun.star.report.pentaho.parser.StyleMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java index 5c6111c1f55a..02cc1fd95b97 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.fo; import com.sun.star.report.pentaho.parser.StyleMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java index ec73596462e5..b5554cae2461 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.fo; import com.sun.star.report.pentaho.parser.StyleMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java index b619442076b6..f9d67a44b6df 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.fo; import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; + import org.jfree.layouting.input.style.keys.text.TextAlign; import org.jfree.layouting.input.style.keys.text.TextStyleKeys; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java index fce338d5688b..f0456212cdb0 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java @@ -30,10 +30,11 @@ package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.StyleMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; -import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSStringType; +import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValueList; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java index 696fb557bdde..a50a82e453c4 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java @@ -30,12 +30,13 @@ package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.StyleMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; -import org.jfree.layouting.input.style.values.CSSStringValue; +import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.values.CSSStringType; +import org.jfree.layouting.input.style.values.CSSStringValue; import org.jfree.layouting.input.style.values.CSSValue; import org.jfree.layouting.input.style.values.CSSValueList; -import org.jfree.layouting.input.style.keys.font.FontStyleKeys; public class FontFamilyMapper implements StyleMapper { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java index cc6cd926f7c7..dbf659f0bd47 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontNameMapper.java @@ -30,10 +30,11 @@ package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.StyleMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; -import org.jfree.layouting.input.style.values.CSSStringValue; -import org.jfree.layouting.input.style.values.CSSStringType; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; +import org.jfree.layouting.input.style.values.CSSStringType; +import org.jfree.layouting.input.style.values.CSSStringValue; public class FontNameMapper implements StyleMapper { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java index 79dceddb88c6..a1b91263123c 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontPitchMapper.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; + import org.jfree.layouting.input.style.keys.font.FontStyleKeys; import org.jfree.layouting.input.style.values.CSSConstant; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java index a9c18a8f7dc4..bbbe5379aef6 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/FontReliefMapper.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.StyleMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; import org.jfree.layouting.input.style.keys.font.FontStyleKeys; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java index e465e7da1527..a9fe6dd229a0 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.StyleMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; public class TextEmphasizeMapper implements StyleMapper diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java index b6b3812a834e..8488686946e5 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.StyleMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; import org.jfree.layouting.input.style.keys.text.TextStyleKeys; import org.jfree.layouting.input.style.values.CSSColorValue; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java index fcc4e8cc6a7a..6b33950e0a40 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java @@ -30,8 +30,9 @@ package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; -import org.jfree.layouting.input.style.keys.text.TextStyleKeys; + import org.jfree.layouting.input.style.keys.text.TextDecorationStyle; +import org.jfree.layouting.input.style.keys.text.TextStyleKeys; public class TextUnderlineStyleMapper extends OneOfConstantsMapper { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java index fbc4d7498be2..9088fb501d59 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; import org.jfree.layouting.input.style.keys.border.BorderWidth; import org.jfree.layouting.input.style.keys.text.TextDecorationWidth; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java index aa23d66b131f..0e73ca396e43 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; + import org.jfree.layouting.input.style.keys.text.TextDecorationMode; import org.jfree.layouting.input.style.keys.text.TextStyleKeys; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java index 9b56b1ae14be..8c579bb638c2 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.style; import com.sun.star.report.pentaho.parser.stylemapper.OneOfConstantsMapper; + import org.jfree.layouting.input.style.keys.line.LineStyleKeys; import org.jfree.layouting.input.style.values.CSSAutoValue; import org.jfree.layouting.input.style.values.CSSConstant; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java index 82adc828982c..3f31e62a416d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.table; import com.sun.star.report.pentaho.parser.StyleMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; import org.jfree.layouting.input.style.keys.box.BoxStyleKeys; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java index 57e4dcd9c559..90746407d188 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/stylemapper/table/RowHeightMapper.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.stylemapper.table; import com.sun.star.report.pentaho.parser.StyleMapper; + import org.jfree.layouting.input.style.CSSDeclarationRule; import org.jfree.layouting.input.style.keys.box.BoxStyleKeys; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/CoveredCellReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/CoveredCellReadHandler.java index 66b11863df77..2aec16b0c260 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/CoveredCellReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/CoveredCellReadHandler.java @@ -30,6 +30,7 @@ package com.sun.star.report.pentaho.parser.table; import com.sun.star.report.pentaho.parser.ElementReadHandler; + import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java index 172e8b475459..ee0a8663ddb9 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnReadHandler.java @@ -29,10 +29,11 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.table; -import org.jfree.report.structure.Section; -import org.jfree.report.structure.Element; import com.sun.star.report.pentaho.parser.ElementReadHandler; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; + /** * Creation-Date: 03.07.2006, 14:26:55 * diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java index a72a5249af4c..ef93b3cd408e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableColumnsReadHandler.java @@ -29,17 +29,21 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.table; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.parser.ElementReadHandler; + import java.util.ArrayList; +import java.util.List; -import org.jfree.report.structure.Section; import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; -import com.sun.star.report.pentaho.parser.ElementReadHandler; -import com.sun.star.report.pentaho.OfficeNamespaces; -import com.sun.star.report.OfficeToken; -import java.util.List; + /** * Creation-Date: 03.07.2006, 13:50:41 diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableReadHandler.java index 365000792277..ff1115100cf2 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableReadHandler.java @@ -29,20 +29,24 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.table; -import java.util.ArrayList; - -import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.OfficeTableSection; import com.sun.star.report.pentaho.parser.ElementReadHandler; import com.sun.star.report.pentaho.parser.rpt.ConditionalPrintExpressionReadHandler; + +import java.util.ArrayList; import java.util.List; + import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; + /** * Creation-Date: 03.07.2006, 13:47:47 * diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowReadHandler.java index 14af3abf601a..9fe7e9888e12 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowReadHandler.java @@ -29,17 +29,21 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.table; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.parser.ElementReadHandler; + import java.util.ArrayList; +import java.util.List; -import org.jfree.report.structure.Section; import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; -import com.sun.star.report.pentaho.parser.ElementReadHandler; -import com.sun.star.report.pentaho.OfficeNamespaces; -import com.sun.star.report.OfficeToken; -import java.util.List; + /** * Creation-Date: 03.07.2006, 13:51:47 diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowsReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowsReadHandler.java index 77db358f8165..e285656711b9 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowsReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/table/TableRowsReadHandler.java @@ -29,17 +29,21 @@ ************************************************************************/ package com.sun.star.report.pentaho.parser.table; +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.parser.ElementReadHandler; + import java.util.ArrayList; +import java.util.List; -import org.jfree.report.structure.Section; import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; -import com.sun.star.report.pentaho.parser.ElementReadHandler; -import com.sun.star.report.pentaho.OfficeNamespaces; -import com.sun.star.report.OfficeToken; -import java.util.List; + /** * diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/text/NoCDATATextContentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/text/NoCDATATextContentReadHandler.java index dc2eee157b7d..95ba86623639 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/text/NoCDATATextContentReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/text/NoCDATATextContentReadHandler.java @@ -3,23 +3,27 @@ */ package com.sun.star.report.pentaho.parser.text; -import java.util.ArrayList; - +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.parser.ElementReadHandler; import com.sun.star.report.pentaho.parser.rpt.FixedContentReadHandler; import com.sun.star.report.pentaho.parser.rpt.FormattedTextReadHandler; import com.sun.star.report.pentaho.parser.rpt.ImageReadHandler; -import com.sun.star.report.pentaho.OfficeNamespaces; -import com.sun.star.report.OfficeToken; import com.sun.star.report.pentaho.parser.rpt.SubDocumentReadHandler; + +import java.util.ArrayList; import java.util.List; -import org.jfree.report.structure.Section; + import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; import org.jfree.report.structure.StaticText; + import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; + /** * This is a generic implementation that accepts all input and adds special * handlers for the report-elements. diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/text/TextContentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/text/TextContentReadHandler.java index 19af5196fa2b..62c279962f84 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/text/TextContentReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/text/TextContentReadHandler.java @@ -31,6 +31,7 @@ package com.sun.star.report.pentaho.parser.text; import org.jfree.report.structure.Section; import org.jfree.report.structure.StaticText; + import org.xml.sax.SAXException; /** diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/xlink/XLinkReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/xlink/XLinkReadHandler.java index e8ff4b3f65df..22332af178cd 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/xlink/XLinkReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/xlink/XLinkReadHandler.java @@ -30,7 +30,9 @@ package com.sun.star.report.pentaho.parser.xlink; import com.sun.star.report.pentaho.OfficeNamespaces; + import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java index 6cb6add68697..5d8c8c8cdc6c 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapper.java @@ -30,12 +30,13 @@ package com.sun.star.report.pentaho.styles; import java.util.HashMap; - import java.util.Map; + import org.pentaho.reporting.libraries.resourceloader.Resource; import org.pentaho.reporting.libraries.resourceloader.ResourceException; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; + /** * The style-mapper holds all information about the OpenOffice style mapping * mechanism. OpenOffice references styles by their name and context, a style diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java index 5574bf022353..67ef1ec3a902 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMapperXmlResourceFactory.java @@ -29,9 +29,10 @@ ************************************************************************/ package com.sun.star.report.pentaho.styles; -import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlResourceFactory; import org.jfree.report.JFreeReportBoot; + import org.pentaho.reporting.libraries.base.config.Configuration; +import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlResourceFactory; /** * Todo: Document me! diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java index 135d6667144c..f056af713c48 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java @@ -30,12 +30,14 @@ package com.sun.star.report.pentaho.styles; import java.util.ArrayList; - import java.util.List; + import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler; -import org.xml.sax.SAXException; + import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + /** * Todo: Document me! diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java index 7db04ffc5d93..da6d886c45e7 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/StyleMappingReadHandler.java @@ -31,6 +31,7 @@ package com.sun.star.report.pentaho.styles; import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler; import org.pentaho.reporting.libraries.xmlns.parser.ParseException; + import org.xml.sax.Attributes; import org.xml.sax.SAXException; diff --git a/reportbuilder/java/com/sun/star/report/util/DefaultJobProperties.java b/reportbuilder/java/com/sun/star/report/util/DefaultJobProperties.java index 096882a29c02..73eb3b781a56 100644 --- a/reportbuilder/java/com/sun/star/report/util/DefaultJobProperties.java +++ b/reportbuilder/java/com/sun/star/report/util/DefaultJobProperties.java @@ -29,13 +29,14 @@ ************************************************************************/ package com.sun.star.report.util; -import java.util.HashMap; - +import com.sun.star.report.JobDefinitionException; import com.sun.star.report.JobProperties; import com.sun.star.report.ReportEngineMetaData; -import com.sun.star.report.JobDefinitionException; + +import java.util.HashMap; import java.util.Map; + public class DefaultJobProperties implements JobProperties { diff --git a/reportbuilder/java/com/sun/star/report/util/DefaultParameterMap.java b/reportbuilder/java/com/sun/star/report/util/DefaultParameterMap.java index f6766a53f1a9..6250e4f6771c 100644 --- a/reportbuilder/java/com/sun/star/report/util/DefaultParameterMap.java +++ b/reportbuilder/java/com/sun/star/report/util/DefaultParameterMap.java @@ -29,11 +29,12 @@ ************************************************************************/ package com.sun.star.report.util; -import java.util.HashMap; - import com.sun.star.report.ParameterMap; + +import java.util.HashMap; import java.util.Map; + public class DefaultParameterMap implements ParameterMap { diff --git a/reportbuilder/java/com/sun/star/report/util/ManifestWriter.java b/reportbuilder/java/com/sun/star/report/util/ManifestWriter.java index c07e7ae0e262..f57556dfbd3d 100644 --- a/reportbuilder/java/com/sun/star/report/util/ManifestWriter.java +++ b/reportbuilder/java/com/sun/star/report/util/ManifestWriter.java @@ -29,19 +29,23 @@ ************************************************************************/ package com.sun.star.report.util; -import java.util.HashMap; -import java.util.Map; -import java.util.Iterator; -import java.io.OutputStreamWriter; +import com.sun.star.report.OutputRepository; + import java.io.IOException; import java.io.OutputStream; +import java.io.OutputStreamWriter; -import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.jfree.report.JFreeReportBoot; + +import org.pentaho.reporting.libraries.xmlns.common.AttributeList; import org.pentaho.reporting.libraries.xmlns.writer.DefaultTagDescription; import org.pentaho.reporting.libraries.xmlns.writer.XmlWriter; -import org.pentaho.reporting.libraries.xmlns.common.AttributeList; -import org.jfree.report.JFreeReportBoot; -import com.sun.star.report.OutputRepository; +import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport; + /** * Creation-Date: 24.07.2007, 18:16:52 -- cgit From 2ac38c25e70ee3a2635e31163211acc1c8ce5333 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 16 Jun 2010 14:30:12 +0200 Subject: jpropenable: #i112445# exclude this file from l10n process --- .../com/sun/star/report/function/metadata/Author-Function.properties | 1 + .../sun/star/report/function/metadata/Author-Function_en_US.properties | 1 + .../java/com/sun/star/report/function/metadata/Title-Function.properties | 1 + .../sun/star/report/function/metadata/Title-Function_en_US.properties | 1 + .../java/com/sun/star/report/function/metadata/category.properties | 1 + .../java/com/sun/star/report/function/metadata/category_en_US.properties | 1 + reportbuilder/java/com/sun/star/report/pentaho/configuration.properties | 1 + reportbuilder/java/com/sun/star/report/pentaho/module.properties | 1 + .../java/com/sun/star/report/pentaho/parser/selectors.properties | 1 + 9 files changed, 9 insertions(+) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function.properties b/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function.properties index a8313094932f..287c7155e5ed 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function.properties +++ b/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function.properties @@ -24,6 +24,7 @@ # for a copy of the LGPLv3 License. # #************************************************************************* +# x-no-translate display-name=AUTHOR description=Returns the author of the report. diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function_en_US.properties b/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function_en_US.properties index a8313094932f..287c7155e5ed 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function_en_US.properties +++ b/reportbuilder/java/com/sun/star/report/function/metadata/Author-Function_en_US.properties @@ -24,6 +24,7 @@ # for a copy of the LGPLv3 License. # #************************************************************************* +# x-no-translate display-name=AUTHOR description=Returns the author of the report. diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function.properties b/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function.properties index 6c9ab290bc69..aa0e5bdbd2a5 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function.properties +++ b/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function.properties @@ -24,6 +24,7 @@ # for a copy of the LGPLv3 License. # #************************************************************************* +# x-no-translate display-name=TITLE description=Returns the title of the report. diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function_en_US.properties b/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function_en_US.properties index 6c9ab290bc69..aa0e5bdbd2a5 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function_en_US.properties +++ b/reportbuilder/java/com/sun/star/report/function/metadata/Title-Function_en_US.properties @@ -24,6 +24,7 @@ # for a copy of the LGPLv3 License. # #************************************************************************* +# x-no-translate display-name=TITLE description=Returns the title of the report. diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/category.properties b/reportbuilder/java/com/sun/star/report/function/metadata/category.properties index 504df7f45b3f..9192d2fecf7c 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/category.properties +++ b/reportbuilder/java/com/sun/star/report/function/metadata/category.properties @@ -24,6 +24,7 @@ # for a copy of the LGPLv3 License. # #************************************************************************* +# x-no-translate display-name=Document Information description=Contains functions to access document information. diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/category_en_US.properties b/reportbuilder/java/com/sun/star/report/function/metadata/category_en_US.properties index b380d19cc640..5de2933bb2ab 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/category_en_US.properties +++ b/reportbuilder/java/com/sun/star/report/function/metadata/category_en_US.properties @@ -24,6 +24,7 @@ # for a copy of the LGPLv3 License. # #************************************************************************* +# x-no-translate display-name=MetaData description=Contains functions about meta data diff --git a/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties b/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties index 1b0cafb0909b..26e8548a9566 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties +++ b/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties @@ -24,6 +24,7 @@ # for a copy of the LGPLv3 License. # #************************************************************************* +# x-no-translate ## diff --git a/reportbuilder/java/com/sun/star/report/pentaho/module.properties b/reportbuilder/java/com/sun/star/report/pentaho/module.properties index 7038a47a410c..b3c538048426 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/module.properties +++ b/reportbuilder/java/com/sun/star/report/pentaho/module.properties @@ -24,6 +24,7 @@ # for a copy of the LGPLv3 License. # #************************************************************************* +# x-no-translate module-info: diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/selectors.properties b/reportbuilder/java/com/sun/star/report/pentaho/parser/selectors.properties index a8f0ad275941..19ba06839e62 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/parser/selectors.properties +++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/selectors.properties @@ -24,6 +24,7 @@ # for a copy of the LGPLv3 License. # #************************************************************************* +# x-no-translate # # -- cgit From bdf82ea8ffc6c0d8f5bb3f4ff176ac21af3250cf Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Tue, 22 Jun 2010 16:52:33 +0200 Subject: srb1: change version --- reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf b/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf index ac543733876b..5d27005f2d65 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf +++ b/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf @@ -1,7 +1,7 @@ RegistrationClassName: com.sun.star.report.pentaho.SOReportJobFactory Class-Path: reportbuilderwizard.jar - flute-1.1.2.jar libserializer-1.1.3.jar libbase-1.1.3.jar - libfonts-1.1.3.jar libformula-1.1.3.jar liblayout-0.2.10.jar - libloader-1.1.3.jar librepository-1.1.3.jar libxml-1.1.3.jar + flute-1.1.6.jar libserializer-1.1.6.jar libbase-1.1.6.jar + libfonts-1.1.6.jar libformula-1.1.7.jar liblayout-0.2.10.jar + libloader-1.1.6.jar librepository-1.1.6.jar libxml-1.1.7.jar flow-engine-0.9.4.jar sac.jar commons-logging-1.1.1.jar UNO-Type-Path: -- cgit From ec88ba28a7fe69927c23700261ff064b79df8654 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 7 Jul 2010 12:40:38 +0200 Subject: dba33g: #i112620# add new namespace for chartooo --- reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java | 2 ++ .../sun/star/report/pentaho/output/OfficeDocumentReportTarget.java | 4 +++- .../java/com/sun/star/report/pentaho/output/StylesWriter.java | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java b/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java index 45e5f64c4670..823bf6540f47 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/OfficeNamespaces.java @@ -46,6 +46,7 @@ public class OfficeNamespaces public static final String DATASTYLE_NS = "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"; public static final String SVG_NS = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"; public static final String CHART_NS = "urn:oasis:names:tc:opendocument:xmlns:chart:1.0"; + public static final String CHARTOOO_NS = "http://openoffice.org/2010/chart"; public static final String DR3D_NS = "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"; public static final String MATHML_NS = "http://www.w3.org/1998/Math/MathML"; public static final String FORM_NS = "urn:oasis:names:tc:opendocument:xmlns:form:1.0"; @@ -58,6 +59,7 @@ public class OfficeNamespaces public static final String XSD_NS = "http://www.w3.org/2001/XMLSchema"; public static final String XSI_NS = "http://www.w3.org/2001/XMLSchema-instance"; public static final String OOREPORT_NS = "http://openoffice.org/2005/report"; + public static final String GRDDL_NS = "http://www.w3.org/2003/g/data-view#"; public static final String CONFIG = "urn:oasis:names:tc:opendocument:xmlns:config:1.0"; /** * @deprecated 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 a3a54f119847..d4046424e07d 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java @@ -363,6 +363,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget rootAttributes.addNamespaceDeclaration("number", OfficeNamespaces.DATASTYLE_NS); rootAttributes.addNamespaceDeclaration("svg", OfficeNamespaces.SVG_NS); rootAttributes.addNamespaceDeclaration("chart", OfficeNamespaces.CHART_NS); + rootAttributes.addNamespaceDeclaration("chartooo", OfficeNamespaces.CHARTOOO_NS); rootAttributes.addNamespaceDeclaration("dr3d", OfficeNamespaces.DR3D_NS); rootAttributes.addNamespaceDeclaration("math", OfficeNamespaces.MATHML_NS); rootAttributes.addNamespaceDeclaration("form", OfficeNamespaces.FORM_NS); @@ -374,7 +375,8 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget rootAttributes.addNamespaceDeclaration("xforms", OfficeNamespaces.XFORMS_NS); rootAttributes.addNamespaceDeclaration("xsd", OfficeNamespaces.XSD_NS); rootAttributes.addNamespaceDeclaration("xsi", OfficeNamespaces.XSI_NS); - rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.0"); + rootAttributes.addNamespaceDeclaration("grddl", OfficeNamespaces.GRDDL_NS); + rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.2"); this.rootXmlWriter.writeXmlDeclaration("UTF-8"); this.rootXmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "document-content", rootAttributes, XmlWriterSupport.OPEN); diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java index b931ec80820c..9b2e6b33b5f7 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java @@ -358,6 +358,7 @@ public class StylesWriter OfficeNamespaces.DATASTYLE_NS); rootAttributes.addNamespaceDeclaration("svg", OfficeNamespaces.SVG_NS); rootAttributes.addNamespaceDeclaration("chart", OfficeNamespaces.CHART_NS); + rootAttributes.addNamespaceDeclaration("chartooo", OfficeNamespaces.CHARTOOO_NS); rootAttributes.addNamespaceDeclaration("dr3d", OfficeNamespaces.DR3D_NS); rootAttributes.addNamespaceDeclaration("math", OfficeNamespaces.MATHML_NS); rootAttributes.addNamespaceDeclaration("form", OfficeNamespaces.FORM_NS); @@ -372,7 +373,8 @@ public class StylesWriter OfficeNamespaces.XFORMS_NS); rootAttributes.addNamespaceDeclaration("xsd", OfficeNamespaces.XSD_NS); rootAttributes.addNamespaceDeclaration("xsi", OfficeNamespaces.XSI_NS); - rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.0"); + rootAttributes.addNamespaceDeclaration("grddl", OfficeNamespaces.GRDDL_NS); + rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.2"); this.xmlWriter.writeXmlDeclaration("UTF-8"); this.xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, -- cgit From 50fbc78991abce50a5dfa3e933f0adb6e0a75fc5 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 8 Jul 2010 15:27:58 +0200 Subject: dba33g: #i108954# handle value for string and date like value-type is defined --- .../pentaho/layoutprocessor/FormatValueUtility.java | 7 ++++++- .../layoutprocessor/FormattedTextLayoutController.java | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'reportbuilder/java/com/sun/star') 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 c8c98692a7a0..fc1baaa8c9a3 100755 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -125,7 +125,12 @@ public class FormatValueUtility } else if (value instanceof java.sql.Date) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value)); + if ( "float".equals(valueType))//@see http://qa.openoffice.org/issues/show_bug.cgi?id=108954 + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 2).toString()); + } + else + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value)); } else if (value instanceof Date) { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java index 7a0a496ffb26..5a6b8f948372 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java @@ -136,9 +136,20 @@ public class FormattedTextLayoutController else { final DataFlags df = FormatValueUtility.computeDataFlag(element, getFlowController()); - if (df != null && df.getValue() instanceof String ) + if (df != null) { - target.processContent(df); + if (df.getValue() instanceof String) + { + target.processContent(df); + } + else //@see http://qa.openoffice.org/issues/show_bug.cgi?id=108954 + { + Element cell = getParentTableCell(); + if (cell != null && "string".equals(cell.getAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE))) + { + target.processContent(df); + } + } } } -- cgit From 9bd142499eb4254cbb413caaad31105da3b95eea Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 8 Jul 2010 16:14:22 +0200 Subject: dba33g: #i110535# add order with realname and table name --- .../java/com/sun/star/report/SDBCReportDataFactory.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java index ba652f14c209..78ac17a7ba08 100644 --- a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java +++ b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java @@ -259,7 +259,17 @@ public class SDBCReportDataFactory implements DataSourceFactory if (!expression.startsWith(quote) && columns.hasByName(expression)) { - expression = quote + expression + quote; + XPropertySet column; + try + { + column = UnoRuntime.queryInterface(XPropertySet.class, columns.getByName(expression)); + expression = quote + column.getPropertyValue("TableName") + quote + "." + quote + expression + quote; + } + catch (Exception ex) + { + Logger.getLogger(SDBCReportDataFactory.class.getName()).log(Level.SEVERE, null, ex); + expression = quote + expression + quote; + } } expression = expression.trim(); // Trim away white spaces -- cgit From 2a44c3167e5f24b5e8fa620be479c506c8a607be Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 27 Aug 2010 12:23:43 +0200 Subject: dba33h: #i112652#: reportbuilder: write XMLSchema-2 conformant NaN --- .../star/report/pentaho/layoutprocessor/TableCellLayoutController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'reportbuilder/java/com/sun/star') 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 74fe1728fc5f..506ea6347d4a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java @@ -81,7 +81,8 @@ public class TableCellLayoutController extends SectionLayoutController } else if ( "float".equals(valueType)) { - attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE, "1.#NAN"); + attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS, + FormatValueUtility.VALUE, "NaN"); } } catch (Exception e) -- cgit From 2ba3b618bea27646eec902ac33f0b713eddf47a3 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 30 Aug 2010 11:26:49 +0200 Subject: dba33h: #i114105# fix version number --- .../sun/star/report/pentaho/output/OfficeDocumentReportTarget.java | 7 ++++++- .../java/com/sun/star/report/pentaho/output/StylesWriter.java | 3 ++- .../sun/star/report/pentaho/output/text/TextRawReportTarget.java | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'reportbuilder/java/com/sun/star') 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 d4046424e07d..b41252a17089 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java @@ -138,6 +138,10 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget public static final String VERTICAL_POS = "vertical-pos"; private static final String ZERO_CM = "0cm"; + /** the verison of the ODF specification to which generated documents + * shall conform. */ + public static final String ODF_VERSION = "1.2"; + protected static class BufferState { @@ -376,7 +380,8 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget rootAttributes.addNamespaceDeclaration("xsd", OfficeNamespaces.XSD_NS); rootAttributes.addNamespaceDeclaration("xsi", OfficeNamespaces.XSI_NS); rootAttributes.addNamespaceDeclaration("grddl", OfficeNamespaces.GRDDL_NS); - rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.2"); + rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", + ODF_VERSION); this.rootXmlWriter.writeXmlDeclaration("UTF-8"); this.rootXmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "document-content", rootAttributes, XmlWriterSupport.OPEN); diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java index 9b2e6b33b5f7..7c2671921d3f 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java @@ -374,7 +374,8 @@ public class StylesWriter rootAttributes.addNamespaceDeclaration("xsd", OfficeNamespaces.XSD_NS); rootAttributes.addNamespaceDeclaration("xsi", OfficeNamespaces.XSI_NS); rootAttributes.addNamespaceDeclaration("grddl", OfficeNamespaces.GRDDL_NS); - rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.2"); + rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", + OfficeDocumentReportTarget.ODF_VERSION); this.xmlWriter.writeXmlDeclaration("UTF-8"); this.xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, 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 7c90bf1fd0ec..9f3746086b87 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 @@ -1269,7 +1269,8 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget rootAttributes.addNamespaceDeclaration("office", OfficeNamespaces.OFFICE_NS); rootAttributes.addNamespaceDeclaration("config", OfficeNamespaces.CONFIG); rootAttributes.addNamespaceDeclaration("ooo", OfficeNamespaces.OO2004_NS); - rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.0"); + rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", + OfficeDocumentReportTarget.ODF_VERSION); final OutputStream outputStream = getOutputRepository().createOutputStream("settings.xml", "text/xml"); final XmlWriter xmlWriter = new XmlWriter(new OutputStreamWriter(outputStream, "UTF-8"), createTagDescription()); xmlWriter.setAlwaysAddNamespace(true); -- cgit From 2d9f7d9a9104a0679fb303e58b24a973f8a0a0ad Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 30 Aug 2010 11:28:34 +0200 Subject: dba33h: #i114106# fix invalid root element for styles --- .../java/com/sun/star/report/pentaho/output/StylesWriter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java index 7c2671921d3f..54b7d0d0159c 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java @@ -117,11 +117,11 @@ public class StylesWriter { globals }); - writeAutomaticStylesSection(new OfficeStylesCollection[] + writeCommonStylesSection(new OfficeStylesCollection[] { globals }); - writeCommonStylesSection(new OfficeStylesCollection[] + writeAutomaticStylesSection(new OfficeStylesCollection[] { globals }); @@ -379,7 +379,7 @@ public class StylesWriter this.xmlWriter.writeXmlDeclaration("UTF-8"); this.xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, - "document-content", rootAttributes, XmlWriterSupport.OPEN); + "document-styles", rootAttributes, XmlWriterSupport.OPEN); } public void close() -- cgit From 42af84d9127d16c33e1efdb8b3cb9dc02b9364b3 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 30 Aug 2010 11:31:28 +0200 Subject: dba33h: #i114106# fix missing value-type --- .../report/pentaho/layoutprocessor/TableCellLayoutController.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'reportbuilder/java/com/sun/star') 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 506ea6347d4a..f3c5ef383057 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java @@ -84,6 +84,13 @@ public class TableCellLayoutController extends SectionLayoutController attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE, "NaN"); } + // #i114108#: except on form elements, the only value-type that can + // occur without an accomanying value attribute is "string" + else if (!"string".equals(valueType)) + { + attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS, + FormatValueUtility.VALUE_TYPE, "string"); + } } catch (Exception e) { -- cgit From 18d1017ba00291e4ab938f2456fd2a4afb9889f4 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 30 Aug 2010 11:33:41 +0200 Subject: dba3h: #i114111#: reportbuilder: do not use Double.toString() when writing the 2 column-width attribute, it may write an exponent, which is invalid.. --- .../report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'reportbuilder/java/com/sun/star') 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 11351b656ea1..d2c4ebd96e3c 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 @@ -624,7 +624,9 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget final Section tableColumnProperties = new Section(); tableColumnProperties.setType("table-column-properties"); tableColumnProperties.setNamespace(style.getNamespace()); - tableColumnProperties.setAttribute(style.getNamespace(), "column-width", columnWidth + getUnitsOfMeasure(null)); + final String width = String.format("%f", columnWidth); + tableColumnProperties.setAttribute(style.getNamespace(), + "column-width", width + getUnitsOfMeasure(null)); style.addNode(tableColumnProperties); final AttributeList myAttrList = new AttributeList(); -- cgit From 665e762b93dd9e9c6d12d7c775b2f43ead9ee267 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 5 Oct 2010 10:39:44 +0100 Subject: allow building against later pentaho libraries --- .../report/pentaho/loader/InputRepositoryLoader.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java index fc637001d766..f8e2b4294feb 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java @@ -35,6 +35,7 @@ import java.util.Map; import org.pentaho.reporting.libraries.resourceloader.ResourceData; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; +import org.pentaho.reporting.libraries.resourceloader.ResourceException; import org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException; import org.pentaho.reporting.libraries.resourceloader.ResourceLoader; import org.pentaho.reporting.libraries.resourceloader.ResourceLoadingException; @@ -169,4 +170,19 @@ public class InputRepositoryLoader implements ResourceLoader { return resourceManager; } + + public boolean isSupportedDeserializer(String string) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String serialize(ResourceKey rk, ResourceKey rk1) throws ResourceException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public ResourceKey deserialize(ResourceKey rk, String string) throws ResourceKeyCreationException + { + throw new UnsupportedOperationException("Not supported yet."); + } } -- cgit From 0d57cd758e98f54529d50447112ddae0835f0394 Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Thu, 4 Nov 2010 12:25:08 +0100 Subject: dba34b: #i115145# catch numberformatexception when creating bigdecimal --- reportbuilder/java/com/sun/star/report/SDBCReportData.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportData.java b/reportbuilder/java/com/sun/star/report/SDBCReportData.java index 769657aa6bf5..a759b1712fe9 100644 --- a/reportbuilder/java/com/sun/star/report/SDBCReportData.java +++ b/reportbuilder/java/com/sun/star/report/SDBCReportData.java @@ -47,7 +47,6 @@ import com.sun.star.util.Time; import java.sql.Timestamp; - public class SDBCReportData implements DataSource { @@ -349,7 +348,7 @@ public class SDBCReportData implements DataSource private Object convertObject(final int type, final Object obj) { - final Object ret; + Object ret; switch (type) { case DataType.DATE: @@ -365,7 +364,14 @@ public class SDBCReportData implements DataSource case DataType.NUMERIC: if (!(obj instanceof Any)) { - ret = new java.math.BigDecimal((String) obj); + try + { + ret = new java.math.BigDecimal(String.valueOf(obj)); + } + catch (NumberFormatException ex) + { + ret = obj; + } } else { -- cgit From 2d24f7dc9b7455d178d0ad0060f6077086f6d1af Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Thu, 4 Nov 2010 13:10:42 +0100 Subject: dba34b: #i114109# change creator in meta.xml --- .../pentaho/output/OfficeDocumentReportTarget.java | 63 +++++++++++++++++++++- .../pentaho/output/chart/ChartRawReportTarget.java | 22 +------- .../spreadsheet/SpreadsheetRawReportTarget.java | 1 + .../pentaho/output/text/TextRawReportTarget.java | 22 ++------ 4 files changed, 68 insertions(+), 40 deletions(-) (limited to 'reportbuilder/java/com/sun/star') 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 b41252a17089..cdc8eae1b73b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java @@ -41,6 +41,18 @@ import com.sun.star.report.pentaho.model.OfficeStyles; import com.sun.star.report.pentaho.model.OfficeStylesCollection; import com.sun.star.report.pentaho.styles.LengthCalculator; import com.sun.star.report.pentaho.styles.StyleMapper; +import com.sun.org.apache.xerces.internal.parsers.DOMParser; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; import java.awt.Image; @@ -54,6 +66,7 @@ import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; +import java.io.InputStream; import java.util.ArrayList; import java.util.Iterator; @@ -137,7 +150,6 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget public static final String FAILED = "Failed"; public static final String VERTICAL_POS = "vertical-pos"; private static final String ZERO_CM = "0cm"; - /** the verison of the ODF specification to which generated documents * shall conform. */ public static final String ODF_VERSION = "1.2"; @@ -381,7 +393,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget rootAttributes.addNamespaceDeclaration("xsi", OfficeNamespaces.XSI_NS); rootAttributes.addNamespaceDeclaration("grddl", OfficeNamespaces.GRDDL_NS); rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", - ODF_VERSION); + ODF_VERSION); this.rootXmlWriter.writeXmlDeclaration("UTF-8"); this.rootXmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "document-content", rootAttributes, XmlWriterSupport.OPEN); @@ -1037,6 +1049,53 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget getXmlWriter().writeCloseTag(); } + public void copyMeta() + { + // now copy the meta.xml + if (getInputRepository().isReadable("meta.xml")) + { + InputStream inputStream = null; + try + { + inputStream = getInputRepository().createInputStream("meta.xml"); + DOMParser dOMParser = new DOMParser(); + dOMParser.parse(new InputSource(inputStream)); + Document document = dOMParser.getDocument(); + NodeList nl = document.getElementsByTagName("document-meta/meta/generator"); + Node node = document.getFirstChild().getFirstChild().getFirstChild().getFirstChild(); + String creator = node.getNodeValue(); + node.setNodeValue(creator + "/report_builder"); + Transformer transformer = TransformerFactory.newInstance().newTransformer(); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + + final OutputStream outputMetaStream = getOutputRepository().createOutputStream("meta.xml", "text/xml"); + StreamResult result = new StreamResult(outputMetaStream); + DOMSource source = new DOMSource(document); + transformer.transform(source, result); + + //IOUtils.getInstance().copyStreams(inputStream, outputMetaStream); + outputMetaStream.flush(); + outputMetaStream.close(); + } + catch (java.lang.Exception ex) + { + } finally + { + if (inputStream != null) + { + try + { + inputStream.close(); + } + catch (IOException ex) + { + Logger.getLogger(OfficeDocumentReportTarget.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + } + } + public void endReport(final ReportStructureRoot report) throws DataSourceException, ReportProcessingException { 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 f76d43bb807a..2013b1c492ff 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 @@ -261,26 +261,6 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget throws DataSourceException, ReportProcessingException { super.endReport(report); - try - { - // now copy the meta.xml - if (getInputRepository().isReadable("meta.xml")) - { - final InputStream inputStream = getInputRepository().createInputStream("meta.xml"); - try - { - final OutputStream outputMetaStream = getOutputRepository().createOutputStream("meta.xml", "text/xml"); - IOUtils.getInstance().copyStreams(inputStream, outputMetaStream); - outputMetaStream.close(); - } finally - { - inputStream.close(); - } - } - } - catch (IOException ioe) - { - throw new ReportProcessingException("Failed to write settings document", ioe); - } + copyMeta(); } } 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 d2c4ebd96e3c..baa43e687ccb 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 @@ -845,6 +845,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget setElementBoundaryCollectionPass(false); resetTableCounter(); columnCounter = 0; + copyMeta(); } private boolean isElementBoundaryCollectionPass() 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 9f3746086b87..a66f3e8b6c4d 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 @@ -26,6 +26,7 @@ ************************************************************************/ package com.sun.star.report.pentaho.output.text; + import com.sun.star.report.DataSourceFactory; import com.sun.star.report.ImageService; import com.sun.star.report.InputRepository; @@ -45,7 +46,7 @@ import com.sun.star.report.pentaho.output.StyleUtilities; import com.sun.star.report.pentaho.styles.LengthCalculator; import java.io.IOException; -import java.io.InputStream; + import java.io.OutputStream; import java.io.OutputStreamWriter; @@ -53,6 +54,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.Map; + import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataSourceException; @@ -67,7 +69,6 @@ import org.jfree.report.util.AttributeNameGenerator; import org.jfree.report.util.IntegerCache; import org.pentaho.reporting.libraries.base.util.FastStack; -import org.pentaho.reporting.libraries.base.util.IOUtils; import org.pentaho.reporting.libraries.base.util.ObjectUtilities; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; import org.pentaho.reporting.libraries.resourceloader.ResourceManager; @@ -1270,7 +1271,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget rootAttributes.addNamespaceDeclaration("config", OfficeNamespaces.CONFIG); rootAttributes.addNamespaceDeclaration("ooo", OfficeNamespaces.OO2004_NS); rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", - OfficeDocumentReportTarget.ODF_VERSION); + OfficeDocumentReportTarget.ODF_VERSION); final OutputStream outputStream = getOutputRepository().createOutputStream("settings.xml", "text/xml"); final XmlWriter xmlWriter = new XmlWriter(new OutputStreamWriter(outputStream, "UTF-8"), createTagDescription()); xmlWriter.setAlwaysAddNamespace(true); @@ -1291,20 +1292,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget xmlWriter.writeCloseTag(); xmlWriter.close(); - // now copy the meta.xml - if (getInputRepository().isReadable("meta.xml")) - { - final InputStream inputStream = getInputRepository().createInputStream("meta.xml"); - try - { - final OutputStream outputMetaStream = getOutputRepository().createOutputStream("meta.xml", "text/xml"); - IOUtils.getInstance().copyStreams(inputStream, outputMetaStream); - outputMetaStream.close(); - } finally - { - inputStream.close(); - } - } + copyMeta(); } catch (IOException ioe) { -- cgit From 441418b2bf99fff8a96e3774e296a964f530a3b7 Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Wed, 24 Nov 2010 09:15:49 +0100 Subject: dba34b: #i115219# add missing style-name elements --- .../sun/star/report/pentaho/styles/stylemapper.xml | 786 ++++++++++++++++++--- 1 file changed, 695 insertions(+), 91 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xml b/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xml index 11ca5fcd8ae4..fa350df051ce 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xml +++ b/reportbuilder/java/com/sun/star/report/pentaho/styles/stylemapper.xml @@ -27,142 +27,746 @@ --> - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - + + - + + + + + + + + + + + + + + + + + + - + + - + + + - - - - - - + + + + + + + + + + + + + + -- cgit From 68b50b6d1d8258ea13a5781c033c52fbbc914e85 Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Wed, 24 Nov 2010 09:58:37 +0100 Subject: dba34b: localize properties --- .../java/com/sun/star/report/function/metadata/makefile.mk | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk index d68a2f8cedc8..e67713a518d4 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk @@ -48,11 +48,12 @@ JAVAFILES := AuthorFunction.java \ # PROPERTYFILES := $(shell @$(FIND) . -name "*.properties") PROPERTYFILES := $(CLASSDIR)$/$(PACKAGE)$/category.properties \ - $(CLASSDIR)$/$(PACKAGE)$/category_en_US.properties \ - $(CLASSDIR)$/$(PACKAGE)$/Author-Function.properties \ - $(CLASSDIR)$/$(PACKAGE)$/Author-Function_en_US.properties \ - $(CLASSDIR)$/$(PACKAGE)$/Title-Function.properties \ - $(CLASSDIR)$/$(PACKAGE)$/Title-Function_en_US.properties + $(CLASSDIR)$/$(PACKAGE)$/Title-Function.properties + +L10NPROPERTYFILES := $(CLASSDIR)$/$(PACKAGE)$/category_en_US.properties \ + $(CLASSDIR)$/$(PACKAGE)$/Author-Function.properties \ + $(CLASSDIR)$/$(PACKAGE)$/Author-Function_en_US.properties \ + $(CLASSDIR)$/$(PACKAGE)$/Title-Function_en_US.properties # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -- cgit From bd10afb420d904be737b977eba7024ee12c697b7 Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Wed, 24 Nov 2010 10:12:13 +0100 Subject: dba34b: localize properties --- .../com/sun/star/report/function/metadata/makefile.mk | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk index e67713a518d4..04b24bb49514 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk @@ -47,19 +47,20 @@ JAVAFILES := AuthorFunction.java \ MetaDataFunctionCategory.java # PROPERTYFILES := $(shell @$(FIND) . -name "*.properties") -PROPERTYFILES := $(CLASSDIR)$/$(PACKAGE)$/category.properties \ - $(CLASSDIR)$/$(PACKAGE)$/Title-Function.properties - -L10NPROPERTYFILES := $(CLASSDIR)$/$(PACKAGE)$/category_en_US.properties \ +PROPERTYFILES:=$(CLASSDIR)$/$(PACKAGE)$/category.properties \ + $(CLASSDIR)$/$(PACKAGE)$/Title-Function.properties\ + $(CLASSDIR)$/$(PACKAGE)$/category_en_US.properties \ $(CLASSDIR)$/$(PACKAGE)$/Author-Function.properties \ $(CLASSDIR)$/$(PACKAGE)$/Author-Function_en_US.properties \ $(CLASSDIR)$/$(PACKAGE)$/Title-Function_en_US.properties +L10NPROPERTYFILES = $(PROPERTYFILES) +ALLTAR : $(PROPERTYFILES) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -ALLTAR : $(PROPERTYFILES) - -$(CLASSDIR)$/$(PACKAGE)$/%.properties : %.properties +.IF "$(WITH_LANG)"=="" +$(CLASSDIR)/$(PACKAGE)/%.properties : %.properties @@-$(MKDIRHIER) $(@:d) - $(COPY) $< $@ + $(COMMAND_ECHO)$(COPY) $< $@ +.ENDIF -- cgit From 656c73c2e4138f110f1b08f60482ae66f8f843ef Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 7 Jan 2011 08:37:24 +0100 Subject: dba34c: #i108590# convert number to date --- .../pentaho/layoutprocessor/FormatValueUtility.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'reportbuilder/java/com/sun/star') 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 fc1baaa8c9a3..707c2de1c8ab 100755 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -29,6 +29,7 @@ package com.sun.star.report.pentaho.layoutprocessor; import com.sun.star.report.OfficeToken; import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.FormattedTextElement; +import java.math.BigDecimal; import java.sql.Time; @@ -46,7 +47,6 @@ import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil; import org.pentaho.reporting.libraries.formula.util.HSSFDateUtil; - /** * Creation-Date: 06.06.2007, 17:03:30 * @@ -125,18 +125,31 @@ public class FormatValueUtility } else if (value instanceof java.sql.Date) { - if ( "float".equals(valueType))//@see http://qa.openoffice.org/issues/show_bug.cgi?id=108954 + if ("float".equals(valueType))//@see http://qa.openoffice.org/issues/show_bug.cgi?id=108954 { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 2).toString()); } else + { 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 BigDecimal) + { + if ("date".equals(valueType)) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate(HSSFDateUtil.getJavaDate((BigDecimal)value, false, 0))); + } + else + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); + } + } else if (value instanceof Number) { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); -- cgit From 1b46f8da574d7c3dfe469f91821f63f9017300bb Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Mon, 17 Jan 2011 12:32:14 +0100 Subject: dba34d: #i116463# fix string and NaN --- .../layoutprocessor/FormatValueUtility.java | 24 ++++++++++++++-------- .../layoutprocessor/TableCellLayoutController.java | 8 +++++--- 2 files changed, 20 insertions(+), 12 deletions(-) (limited to 'reportbuilder/java/com/sun/star') 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 707c2de1c8ab..76ee85b52aba 100755 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -143,7 +143,7 @@ public class FormatValueUtility { if ("date".equals(valueType)) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate(HSSFDateUtil.getJavaDate((BigDecimal)value, false, 0))); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate(HSSFDateUtil.getJavaDate((BigDecimal) value, false, 0))); } else { @@ -156,13 +156,21 @@ public class FormatValueUtility } else if (value instanceof Boolean) { - if (Boolean.TRUE.equals(value)) + if ("float".equals(valueType)) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.TRUE); + float fvalue = Boolean.TRUE.equals(value) ? 1 : 0; + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(fvalue)); } else { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.FALSE); + if (Boolean.TRUE.equals(value)) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.TRUE); + } + else + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.FALSE); + } } } else if (value != null) @@ -178,12 +186,10 @@ public class FormatValueUtility } if (!"string".equals(valueType)) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); - } - else - { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, STRING_VALUE, String.valueOf(value)); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "string"); + //variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); } + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, STRING_VALUE, String.valueOf(value)); } else { 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 f3c5ef383057..e575831ebf2a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java @@ -69,12 +69,12 @@ 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 { - final DataFlags value = computeValue(); + final DataFlags value = computeValue(attributeMap); + final String valueType = (String) attributeMap.getAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE); if (value != null) { FormatValueUtility.applyValueForCell(value.getValue(), attributeMap, valueType); @@ -100,7 +100,7 @@ public class TableCellLayoutController extends SectionLayoutController return attributeMap; } - private DataFlags computeValue() throws DataSourceException + private DataFlags computeValue(final AttributeMap attributeMap) throws DataSourceException { // Search for the first FormattedTextElement final Section cell = (Section) getElement(); @@ -115,6 +115,8 @@ public class TableCellLayoutController extends SectionLayoutController final Object o = LayoutControllerUtil.evaluateExpression(getFlowController(), element, dc); if (Boolean.FALSE.equals(o)) { + attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS, + FormatValueUtility.VALUE_TYPE, "string"); return null; } } -- cgit From 6bd54fca68e01fb4178fd157822e7d64e79815cb Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane Date: Thu, 20 Jan 2011 11:54:23 +0200 Subject: Use more reliable SQL syntax Give a derived table (subquery) an alias (name). From fdo#32960. Signed-off-by: Tor Lillqvist --- reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java index 78ac17a7ba08..58ae07410da8 100644 --- a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java +++ b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java @@ -573,13 +573,13 @@ public class SDBCReportDataFactory implements DataSourceFactory final Boolean escape = (Boolean) prop.getPropertyValue(ESCAPEPROCESSING); rowSetProp.setPropertyValue(ESCAPEPROCESSING, escape); final String queryCommand = (String) prop.getPropertyValue(UNO_COMMAND); - statement = "SELECT * FROM (" + queryCommand + ")"; + statement = "SELECT * FROM (" + queryCommand + ") AS \"__LibreOffice_report_result\""; } } else { - statement = "SELECT * FROM (" + command + ")"; + statement = "SELECT * FROM (" + command + ") AS \"__LibreOffice_report_result\""; } } rowSetProp.setPropertyValue(UNO_COMMAND, statement); -- cgit From 97cf2b8dd8c1b4c3f6e926521999a0dca208b227 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Tue, 29 Mar 2011 17:32:13 +0200 Subject: fix build with system jfreereport --- reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk | 2 +- reportbuilder/java/com/sun/star/report/pentaho/makefile.mk | 2 +- reportbuilder/java/com/sun/star/report/util/makefile.mk | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk index 9ba0c026c224..11501b16437e 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk @@ -32,12 +32,12 @@ PACKAGE = com$/sun$/star$/report$/function$/metadata # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk -.INCLUDE : $(SOLARBINDIR)/jfreereport_version.mk #----- compile .java files ----------------------------------------- .IF "$(SYSTEM_JFREEREPORT)" == "YES" EXTRAJARFILES = $(LIBBASE_JAR) $(LIBFORMULA_JAR) .ELSE +.INCLUDE : $(SOLARBINDIR)/jfreereport_version.mk JARFILES += \ libbase-$(LIBBASE_VERSION).jar \ libformula-$(LIBFORMULA_VERSION).jar diff --git a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk index d309e1da8385..1f1aeb59b213 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk @@ -33,13 +33,13 @@ PACKAGE = com$/sun$/star$/report$/pentaho nodep=true # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk -.INCLUDE : $(SOLARBINDIR)/jfreereport_version.mk #----- compile .java files ----------------------------------------- JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar .IF "$(SYSTEM_JFREEREPORT)" == "YES" EXTRAJARFILES += $(FLUTE_JAR) $(LIBBASE_JAR) $(LIBXML_JAR) $(JFREEREPORT_JAR) $(LIBLOADER_JAR) $(SAC_JAR) $(LIBLAYOUT_JAR) $(LIBSERIALIZER_JAR) $(LIBFONTS_JAR) $(LIBFORMULA_JAR) $(LIBREPOSITORY_JAR) .ELSE +.INCLUDE : $(SOLARBINDIR)/jfreereport_version.mk JARFILES += \ flute-$(FLUTE_VERSION).jar \ libserializer-$(LIBSERIALIZER_VERSION).jar \ diff --git a/reportbuilder/java/com/sun/star/report/util/makefile.mk b/reportbuilder/java/com/sun/star/report/util/makefile.mk index 70e290e4884e..6cc9a14e524d 100644 --- a/reportbuilder/java/com/sun/star/report/util/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/util/makefile.mk @@ -32,12 +32,12 @@ PACKAGE = com$/sun$/star$/report$/util # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk -.INCLUDE : $(SOLARBINDIR)/jfreereport_version.mk #----- compile .java files ----------------------------------------- .IF "$(SYSTEM_JFREEREPORT)" == "YES" EXTRAJARFILES = $(LIBBASE_JAR) $(LIBXML_JAR) $(JFREEREPORT_JAR) .ELSE +.INCLUDE : $(SOLARBINDIR)/jfreereport_version.mk JARFILES += \ libbase-$(LIBBASE_VERSION).jar \ libxml-$(LIBXML_VERSION).jar \ -- cgit From 55bed7a505dae776c8781c5aeca2f04d98469ab6 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 4 Apr 2011 13:05:38 +0200 Subject: masterfix DEV300: #i10000# build fix --- .../java/com/sun/star/report/function/metadata/makefile.mk | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk index 9ba0c026c224..937114c4be35 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk @@ -49,21 +49,17 @@ JAVAFILES := AuthorFunction.java \ TitleFunctionDescription.java \ MetaDataFunctionCategory.java -# PROPERTYFILES := $(shell @$(FIND) . -name "*.properties") -PROPERTYFILES:=$(CLASSDIR)$/$(PACKAGE)$/category.properties \ +COPYFILES := $(CLASSDIR)$/$(PACKAGE)$/category.properties \ $(CLASSDIR)$/$(PACKAGE)$/Title-Function.properties\ $(CLASSDIR)$/$(PACKAGE)$/category_en_US.properties \ $(CLASSDIR)$/$(PACKAGE)$/Author-Function.properties \ $(CLASSDIR)$/$(PACKAGE)$/Author-Function_en_US.properties \ $(CLASSDIR)$/$(PACKAGE)$/Title-Function_en_US.properties -L10NPROPERTYFILES = $(PROPERTYFILES) -ALLTAR : $(PROPERTYFILES) +ALLTAR : $(COPYFILES) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.IF "$(WITH_LANG)"=="" -$(CLASSDIR)/$(PACKAGE)/%.properties : %.properties - @@-$(MKDIRHIER) $(@:d) - $(COMMAND_ECHO)$(COPY) $< $@ -.ENDIF +$(COPYFILES): $$(@:f) + +$(COPY) $< $@ + -- cgit From d36b7a5f861f5eac28a854a8e75c8299203859ce Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 4 Apr 2011 14:10:39 +0200 Subject: masterfix DEV300: #i10000# added mkdir --- reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'reportbuilder/java/com/sun/star') diff --git a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk index 937114c4be35..8694dec7c155 100644 --- a/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/function/metadata/makefile.mk @@ -61,5 +61,6 @@ ALLTAR : $(COPYFILES) .INCLUDE : target.mk $(COPYFILES): $$(@:f) + +$(MKDIRHIER) $(CLASSDIR)$/$(PACKAGE) +$(COPY) $< $@ -- cgit