diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/script/JSPartitionScanner.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/script/JSPartitionScanner.java index 741beda551..479748d3b7 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/script/JSPartitionScanner.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/script/JSPartitionScanner.java @@ -176,7 +176,11 @@ protected void addWords(WordRule rule, String[] tokens, IToken token) { * syntax highlights */ private void fetchJSCommonObjectsMethods() { + this.globalObjectTokens.add("_jsContext"); //$NON-NLS-1$ + this.globalObjectTokens.add("_statusHandle"); //$NON-NLS-1$ + this.globalObjectTokens.add("report"); //$NON-NLS-1$ this.globalObjectTokens.add("reportContext"); //$NON-NLS-1$ + this.globalObjectTokens.add("config"); //$NON-NLS-1$ this.globalObjectTokens.add("params"); //$NON-NLS-1$ this.globalObjectTokens.add("vars"); //$NON-NLS-1$ this.globalObjectTokens.add("row"); //$NON-NLS-1$ @@ -190,6 +194,7 @@ private void fetchJSCommonObjectsMethods() { this.keywordMethods.add("value"); //$NON-NLS-1$ this.keywordMethods.add("data"); //$NON-NLS-1$ this.keywordMethods.add("displayText"); //$NON-NLS-1$ + this.keywordMethods.add("currentPage"); //$NON-NLS-1$ this.keywordMethods.add("pageNumber"); //$NON-NLS-1$ this.keywordMethods.add("totalPage"); //$NON-NLS-1$ diff --git a/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/DocxEmitterImpl.java b/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/DocxEmitterImpl.java index bf8740f214..fc6efa0c73 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/DocxEmitterImpl.java +++ b/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/DocxEmitterImpl.java @@ -72,8 +72,7 @@ public void initialize(IEmitterServices service) throws EngineException { this.embedHtml = (Boolean) value; } - wordWriter = new DocxWriter(out, tempFileDir, getCompressionMode(service).getValue(), getWordVersion(), - wrappedTableHeaderFooter); + wordWriter = new DocxWriter(out, tempFileDir, getCompressionMode(service).getValue(), getWordVersion()); } private CompressionMode getCompressionMode(IEmitterServices service) { diff --git a/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/BasicComponent.java b/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/BasicComponent.java index 8509d8decb..ad175ac2b8 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/BasicComponent.java +++ b/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/BasicComponent.java @@ -107,8 +107,6 @@ public abstract class BasicComponent extends AbstractWordXmlWriter { protected boolean wrappedTable = true; - protected boolean wrappedTableHeaderFooter = true; - protected BasicComponent(IPart part) throws IOException { this.part = part; this.imageManager = (ImageManager) part.getPackage().getExtensionData(); @@ -327,17 +325,18 @@ protected void writeForeign(IForeignContent foreignContent, boolean wrappedTable } protected void writeForeign(IForeignContent foreignContent) { - if (foreignContent.getRawValue() != null) { - String uri = "mhtText" + getMhtTextId() + ".mht"; - MimeType type = MimeType.MHT; - String relationshipType = RelationshipTypes.AFCHUNK; - IPart mhtPart = part.getPart(uri, type, relationshipType); - handle = foreignContent.getReportContent().getDesign().getReportDesign(); - writeMhtPart(mhtPart, foreignContent); - writer.openTag("w:altChunk"); - writer.attribute("r:id", mhtPart.getRelationshipId()); - writer.closeTag("w:altChunk"); - } + if (foreignContent.getRawValue() == null) + foreignContent.setRawValue(new String("")); + + String uri = "mhtText" + getMhtTextId() + ".mht"; + MimeType type = MimeType.MHT; + String relationshipType = RelationshipTypes.AFCHUNK; + IPart mhtPart = part.getPart(uri, type, relationshipType); + handle = foreignContent.getReportContent().getDesign().getReportDesign(); + writeMhtPart(mhtPart, foreignContent); + writer.openTag("w:altChunk"); + writer.attribute("r:id", mhtPart.getRelationshipId()); + writer.closeTag("w:altChunk"); } private void writeMhtPart(IPart mhtPart, IForeignContent foreignContent) { @@ -1175,16 +1174,4 @@ private void getCorrectFontSize(Node nodeTag, HashMap cssStyles) { } } - protected void startHeaderFooterContainer(int headerHeight, int headerWidth, boolean writeColumns) { - if (wrappedTableHeaderFooter) { - super.startHeaderFooterContainer(headerHeight, headerWidth, writeColumns); - } - } - - @Override - protected void endHeaderFooterContainer() { - if (wrappedTableHeaderFooter) { - super.endHeaderFooterContainer(); - } - } } diff --git a/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/Document.java b/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/Document.java index e9ada89da5..8d6f19d05f 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/Document.java +++ b/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/Document.java @@ -311,20 +311,20 @@ void writeFooterReference(BasicComponent footer) { writer.closeTag("w:footerReference"); } - Header createHeader(int headerHeight, int headerWidth) throws IOException { + Header createHeader(int headerHeight, int headerWidth, boolean wrapHeader) throws IOException { String uri = "header" + getHeaderID() + ".xml"; String type = ContentTypes.WORD_HEADER; String relationshipType = RelationshipTypes.HEADER; IPart headerPart = part.getPart(uri, type, relationshipType); - return new Header(headerPart, this, headerHeight, headerWidth); + return new Header(headerPart, this, headerHeight, headerWidth, wrapHeader); } - Footer createFooter(int footerHeight, int footerWidth) throws IOException { + Footer createFooter(int footerHeight, int footerWidth, boolean wrapHeader) throws IOException { String uri = "footer" + getFooterID() + ".xml"; String type = ContentTypes.WORD_FOOTER; String relationshipType = RelationshipTypes.FOOTER; IPart footerPart = part.getPart(uri, type, relationshipType); - return new Footer(footerPart, this, footerHeight, footerWidth); + return new Footer(footerPart, this, footerHeight, footerWidth, wrapHeader); } private int getHeaderID() { diff --git a/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/DocxWriter.java b/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/DocxWriter.java index 5efd7ee497..ce638de7ff 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/DocxWriter.java +++ b/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/DocxWriter.java @@ -66,12 +66,10 @@ public class DocxWriter implements IWordWriter { * @param compressionMode compression mode * @param wordVersion word version */ - public DocxWriter(OutputStream out, String tempFileDir, int compressionMode, int wordVersion, - boolean wrappedTableHeaderFooter) { + public DocxWriter(OutputStream out, String tempFileDir, int compressionMode, int wordVersion) { pkg = Package.createInstance(out, tempFileDir, compressionMode); pkg.setExtensionData(new ImageManager()); this.wordVersion = wordVersion; - this.wrappedTableHeaderFooter = wrappedTableHeaderFooter; } @Override @@ -137,7 +135,6 @@ private void initializeDocumentPart(String backgroundColor, String backgroundIma rtl, wordVersion, this.getDocumentLanguage()); document.start(); currentComponent = document; - currentComponent.wrappedTableHeaderFooter = this.wrappedTableHeaderFooter; } @Override @@ -162,7 +159,7 @@ public void endSection() { @Override public void startHeader(boolean showHeaderOnFirst, int headerHeight, int headerWidth) throws IOException { - currentComponent = document.createHeader(headerHeight, headerWidth); + currentComponent = document.createHeader(headerHeight, headerWidth, this.wrappedTableHeaderFooter); currentComponent.start(); this.showHeaderOnFirst = showHeaderOnFirst; } @@ -176,7 +173,7 @@ public void endHeader() { @Override public void startFooter(int footerHeight, int footerWidth) throws IOException { - currentComponent = document.createFooter(footerHeight, footerWidth); + currentComponent = document.createFooter(footerHeight, footerWidth, this.wrappedTableHeaderFooter); currentComponent.start(); } @@ -368,4 +365,13 @@ public String getDocumentLanguage() { return this.documentLanguage; } + @Override + public void setWrappedTableHeaderFooter(boolean useWrappedTable) { + this.wrappedTableHeaderFooter = useWrappedTable; + } + + @Override + public boolean getWrappedTableHeaderFooter() { + return this.wrappedTableHeaderFooter; + } } diff --git a/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/Footer.java b/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/Footer.java index 42b8544cd4..f0c6dccd0f 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/Footer.java +++ b/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/Footer.java @@ -1,15 +1,16 @@ /******************************************************************************* - * Copyright (c) 2013 Actuate Corporation. - * + * Copyright (c) 2013, 2024 Actuate Corporation and others + * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * https://www.eclipse.org/legal/epl-2.0/. - * + * * SPDX-License-Identifier: EPL-2.0 - * + * * * Contributors: - * Actuate Corporation - initial API and implementation + * Actuate Corporation - initial API and implementation + * Thomas Gutmann - add option to handle footer wrapper *******************************************************************************/ package org.eclipse.birt.report.engine.emitter.docx.writer; @@ -23,12 +24,24 @@ public class Footer extends BasicComponent { Document document; int footerHeight; int footerWidth; + boolean wrapFooter; + /** + * Constructor 1 + */ Footer(IPart part, Document document, int footerHeight, int footerWidth) throws IOException { + this(part, document, footerHeight, footerWidth, true); + } + + /** + * Constructor 2 + */ + Footer(IPart part, Document document, int footerHeight, int footerWidth, boolean wrapFooter) throws IOException { super(part); this.document = document; this.footerHeight = footerHeight; this.footerWidth = footerWidth; + this.wrapFooter = wrapFooter; } @Override @@ -36,12 +49,14 @@ void start() { writer.startWriter(); writer.openTag("w:ftr"); writeXmlns(); - startHeaderFooterContainer(footerHeight, footerWidth); + if (this.wrapFooter) + startHeaderFooterContainer(footerHeight, footerWidth); } @Override void end() { - endHeaderFooterContainer(); + if (wrapFooter) + endHeaderFooterContainer(); writer.closeTag("w:ftr"); writer.endWriter(); writer.close(); diff --git a/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/Header.java b/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/Header.java index 26e509e823..5c332e4bcb 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/Header.java +++ b/engine/org.eclipse.birt.report.engine.emitter.docx/src/org/eclipse/birt/report/engine/emitter/docx/writer/Header.java @@ -1,15 +1,16 @@ /******************************************************************************* - * Copyright (c) 2013 Actuate Corporation. - * + * Copyright (c) 2013, 2024 Actuate Corporation. + * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * https://www.eclipse.org/legal/epl-2.0/. - * + * * SPDX-License-Identifier: EPL-2.0 - * + * * * Contributors: - * Actuate Corporation - initial API and implementation + * Actuate Corporation - initial API and implementation + * Thomas Gutmann - add option to handle header wrapper *******************************************************************************/ package org.eclipse.birt.report.engine.emitter.docx.writer; @@ -32,12 +33,24 @@ public class Header extends BasicComponent { Document document; int headerHeight; int headerWidth; + boolean wrapHeader; + /** + * Constructor 1 + */ Header(IPart part, Document document, int headerHeight, int headerWidth) throws IOException { + this(part, document, headerHeight, headerWidth, true); + } + + /** + * Constructor 2 + */ + Header(IPart part, Document document, int headerHeight, int headerWidth, boolean wrapHeader) throws IOException { super(part); this.document = document; this.headerHeight = headerHeight; this.headerWidth = headerWidth; + this.wrapHeader = wrapHeader; } @Override @@ -45,12 +58,14 @@ void start() { writer.startWriter(); writer.openTag("w:hdr"); writeXmlns(); - startHeaderFooterContainer(headerHeight, headerWidth, true); + if (this.wrapHeader) + startHeaderFooterContainer(headerHeight, headerWidth, true); } @Override void end() { - endHeaderFooterContainer(); + if (this.wrapHeader) + endHeaderFooterContainer(); writer.closeTag("w:hdr"); writer.endWriter(); writer.close(); diff --git a/engine/org.eclipse.birt.report.engine.emitter.prototype.excel/src/org/eclipse/birt/report/engine/emitter/excel/ExcelUtil.java b/engine/org.eclipse.birt.report.engine.emitter.prototype.excel/src/org/eclipse/birt/report/engine/emitter/excel/ExcelUtil.java index fd3e4a387b..f0f21061f7 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.prototype.excel/src/org/eclipse/birt/report/engine/emitter/excel/ExcelUtil.java +++ b/engine/org.eclipse.birt.report.engine.emitter.prototype.excel/src/org/eclipse/birt/report/engine/emitter/excel/ExcelUtil.java @@ -479,7 +479,7 @@ public static int convertToPt(String size) { } else if (size.endsWith("cm")) { return (int) (s / 2.54 * 72); } else if (size.endsWith("mm")) { - return (int) (s * 10 / 2.54 * 72); + return (int) (s / 10 / 2.54 * 72); } else if (size.endsWith("pc")) { return s; } else { diff --git a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/AbstractEmitterImpl.java b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/AbstractEmitterImpl.java index f737899fd5..2e6acb3599 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/AbstractEmitterImpl.java +++ b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/AbstractEmitterImpl.java @@ -24,7 +24,6 @@ import java.util.HashSet; import java.util.List; import java.util.Locale; -import java.util.Map; import java.util.Set; import java.util.Stack; import java.util.logging.Level; @@ -347,9 +346,10 @@ public void start(IReportContent report) { // header & footer: wrap header and footer with table if (EmitterServices.booleanOption(null, report, DocEmitter.WORD_HEADER_FOOTER_WRAPPED_TABLE, false)) { wrappedTableHeaderFooter = true; + wordWriter.setWrappedTableHeaderFooter(wrappedTableHeaderFooter); } // foreign text: add empty paragraph to wrapper table cell - if (EmitterServices.booleanOption(null, report, DocEmitter.WORD_ADD_EMPTY_PARAGRAPH_FOR_ALL_CELLS, wrappedTableForMarginPadding)) { + if (wrappedTableForMarginPadding || EmitterServices.booleanOption(null, report, DocEmitter.WORD_ADD_EMPTY_PARAGRAPH_FOR_ALL_CELLS, false)) { addEmptyParagraphToForAllCells = true; } diff --git a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/EmitterServices.java b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/EmitterServices.java index 7ed49bc7cf..da4878b6e0 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/EmitterServices.java +++ b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/EmitterServices.java @@ -405,12 +405,18 @@ protected static Object getUserProperty(IContent birtContent, String propName) { private static Object getReportDesignConfiguration(IReportContent reportContent, String name) { Object value = null; - // TODO: implementation of designer options if (name.equalsIgnoreCase(DocEmitter.WORD_MARGIN_PADDING_WRAPPED_TABLE)) { - // value = reportContent.getDesign().getReportDesign().getWordWrappedTable(); + value = reportContent.getDesign().getReportDesign().getWordWrapTableForMarginPadding(); } else if (name.equalsIgnoreCase(DocEmitter.WORD_MARGIN_PADDING_COMBINE)) { - // value = reportContent.getDesign().getReportDesign().getWordMarginPaddingCombined(); + value = reportContent.getDesign().getReportDesign().getWordCombineMarginPadding(); + + } else if (name.equalsIgnoreCase(DocEmitter.WORD_HEADER_FOOTER_WRAPPED_TABLE)) { + value = reportContent.getDesign().getReportDesign().getWordWrapTableForHeaderFooter(); + + } else if (name.equalsIgnoreCase(DocEmitter.WORD_ADD_EMPTY_PARAGRAPH_FOR_LIST_CELL)) { + value = reportContent.getDesign().getReportDesign().getWordListCellAddEmptyPara(); + } return value; } diff --git a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/IWordWriter.java b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/IWordWriter.java index 11437e98bf..29db2db1be 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/IWordWriter.java +++ b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/IWordWriter.java @@ -377,4 +377,23 @@ void writeContent(int type, String txt, IStyle style, IStyle inlineStyle, String * End page */ void endPage(); + + /** + * Set the layout attribute for header and footer wrapping + * + * @param useWrappedTable use layout grid to wrap header and footer + */ + default void setWrappedTableHeaderFooter(boolean useWrappedTable) { + // do nothing + } + + /** + * Get the configuration of layout-grid usage for header and footer + * + * @return the configuration of layout-grid usage for header and footer + */ + default boolean getWrappedTableHeaderFooter() { + return true; + } + } diff --git a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/README.md b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/README.md index 79e0e165a6..2de1223e40 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/README.md +++ b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/README.md @@ -22,6 +22,7 @@ The following list get an overview of all supported user properties, the content false, margin will be used for text indent (without padding) Default true Since 4.18 + Designer 4.18 **WordEmitter.AddEmptyParagraphForAllCells** @@ -34,6 +35,7 @@ The following list get an overview of all supported user properties, the content true, if wrappedTableForMarginPadding is set to true Relation WordEmitter.WrappedTableForMarginPadding Since 4.18 + Designer 4.18 **WordEmitter.AddEmptyParagraphForListCell** @@ -44,6 +46,7 @@ The following list get an overview of all supported user properties, the content false, avoid empty paragraph at list table cell end Default false Since 4.18 + Designer 4.18 **WordEmitter.WrappedTableForMarginPadding** @@ -55,6 +58,7 @@ The following list get an overview of all supported user properties, the content Default false Relation WordEmitter.AddEmptyParagraphForAllCells Since 4.18 + Designer 4.18 **WordEmitter.WrappedTableHeaderFooter** @@ -66,3 +70,5 @@ The following list get an overview of all supported user properties, the content false, use optimized handling and avoid wrapper layout table for page header and footer Default false Since 4.18 + Designer 4.18 + \ No newline at end of file diff --git a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/WordUtil.java b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/WordUtil.java index ee7a7c06af..fd3657a4bc 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/WordUtil.java +++ b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/WordUtil.java @@ -414,7 +414,7 @@ public static int convertToPt(String size) { } else if (size.endsWith("cm")) { return (int) (s / 2.54 * 72); } else if (size.endsWith("mm")) { - return (int) (s * 10 / 2.54 * 72); + return (int) (s / 10 / 2.54 * 72); } else if (size.endsWith("pc")) { return s; } else { diff --git a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/writer/AbstractWordXmlWriter.java b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/writer/AbstractWordXmlWriter.java index b0252e87dc..7ef7ca578b 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/writer/AbstractWordXmlWriter.java +++ b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/writer/AbstractWordXmlWriter.java @@ -50,6 +50,8 @@ public abstract class AbstractWordXmlWriter { protected boolean combineMarginPadding = true; + protected boolean wrappedTableHeaderFooter = false; + /** constant property: space */ public static final char SPACE = ' '; @@ -1457,4 +1459,12 @@ private void drawLine(double width, String style, String color, Line line) { private int getLineId() { return lineId++; } + + public void setWrappedTableHeaderFooter(boolean useWrappedTable) { + this.wrappedTableHeaderFooter = useWrappedTable; + } + + public boolean getWrappedTableHeaderFooter() { + return this.wrappedTableHeaderFooter; + } } diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ReportDesignHandleImpl.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ReportDesignHandleImpl.java index 7275ab1581..640b81e4a2 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ReportDesignHandleImpl.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ReportDesignHandleImpl.java @@ -1867,8 +1867,87 @@ public String getPdfAEmbedTitle() { * @param embedTitle embed title * @throws SemanticException */ - public void setPdfAEmbedTitle(String embedTitle) throws SemanticException { - setStringProperty(PDFA_DOCUMENT_EMBED_TITLE, embedTitle); + public void setPdfAEmbedTitle(boolean embedTitle) throws SemanticException { + setBooleanProperty(PDFA_DOCUMENT_EMBED_TITLE, embedTitle); + } + + /** + * Get the configuration to the combined usage of margin & padding for spacing + * + * @return the configuration to use the combined calculation of margin & padding + */ + public boolean getWordCombineMarginPadding() { + return getBooleanProperty(WORD_COMBINE_MARGIN_PADDING); + } + + /** + * Set the configuration to the combined usage of margin & padding for spacing + * + * @param combineMarginPadding use combination of margin & padding for spacing + * @throws SemanticException + */ + public void setWordCombineMarginPadding(boolean combineMarginPadding) throws SemanticException { + setBooleanProperty(WORD_COMBINE_MARGIN_PADDING, combineMarginPadding); + } + + /** + * Get the configuration if an empty paragraph is to use at the end of a list + * cell + * + * @return the configuration if an empty paragraph is to use at the end of a + * list cell + */ + public boolean getWordListCellAddEmptyPara() { + return getBooleanProperty(WORD_LIST_CELL_ADD_EMPTY_PARA); + } + + /** + * Set the configuration if an empty paragraph is to use at the end of a list + * cell + * + * @param addEmptyPara add empty paragraph + * @throws SemanticException + */ + public void setWordListCellAddEmptyPara(boolean addEmptyPara) throws SemanticException { + setBooleanProperty(WORD_LIST_CELL_ADD_EMPTY_PARA, addEmptyPara); + } + + /** + * Get the configuration to use a wrapping table for margin and padding + * + * @return the configuration to use a wrapping table for margin and padding + */ + public boolean getWordWrapTableForMarginPadding() { + return getBooleanProperty(WORD_WRAP_TABLE_FOR_MARGIN_PADDING); + } + + /** + * Set the configuration to use a wrapping table for margin and padding + * + * @param wrapTable wrap table for margin and padding + * @throws SemanticException + */ + public void setWordWrapTableForMarginPadding(boolean wrapTable) throws SemanticException { + setBooleanProperty(WORD_WRAP_TABLE_FOR_MARGIN_PADDING, wrapTable); + } + + /** + * Get the configuration to use a layout table for header and footer + * + * @return the configuration to use a layout table for header and footer + */ + public boolean getWordWrapTableForHeaderFooter() { + return getBooleanProperty(WORD_WRAP_TABLE_FOR_HEADER_FOOTER); + } + + /** + * Set the configuration to use a layout table for header and footer + * + * @param wrapTable layout table for header and footer + * @throws SemanticException + */ + public void setWordWrapTableForHeaderFooter(boolean wrapTable) throws SemanticException { + setBooleanProperty(WORD_WRAP_TABLE_FOR_HEADER_FOOTER, wrapTable); } } diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/core/DesignElement.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/core/DesignElement.java index 2b9bfca31a..1ece8d8305 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/core/DesignElement.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/core/DesignElement.java @@ -949,14 +949,14 @@ public Object getProperty(Module module, String propName) { ElementPropertyDefn prop = getPropertyDefn(propName); // If the property is not found, then the value is null. - if (prop == null) { return null; } if (ODA_PASSWORD.contentEquals(propName) && prop.isEncryptable() && getEncryptionID(prop) != null && JavaScriptExecutionStatus.isExecuting()) { - throw new RuntimeException("Invalid operation: Can not access encrypted password from script"); + // throw new RuntimeException("Invalid operation: Can not access encrypted password from script"); + return null; } return getProperty(module, prop); @@ -2317,7 +2317,7 @@ public boolean canEdit(Module module) { public boolean canDrop(Module module) { // if the root of element is included by report/library. Do not allow // drop; if module is read-only, forbid drop too - + // Can not change the structure of child element or a virtual element( // inside the child ). @@ -3032,7 +3032,7 @@ protected Object baseClone() throws CloneNotSupportedException { String key = iter.next(); ElementPropertyDefn propDefn = getPropertyDefn(key); Object value = propValues.get(key); - + // if the property is element type, then set-up the container // relationship diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IInternalReportDesignModel.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IInternalReportDesignModel.java index fbc56df8c3..a1050cd748 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IInternalReportDesignModel.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IInternalReportDesignModel.java @@ -337,4 +337,20 @@ public interface IInternalReportDesignModel { */ String PDFA_DOCUMENT_EMBED_TITLE = "pdfaDocumentTitleEmbed"; //$NON-NLS-1$ + /** + * Word option, use margin & padding for spacing (only without layout-grid) + */ + String WORD_COMBINE_MARGIN_PADDING = "wordCombineMarginPadding"; //$NON-NLS-1$ + /** + * Word option, list element, add empty line of cell end + */ + String WORD_LIST_CELL_ADD_EMPTY_PARA = "wordAddEmptyParagraphForListCell"; //$NON-NLS-1$ + /** + * Word option, text element, use layout-grid for margin & padding + */ + String WORD_WRAP_TABLE_FOR_MARGIN_PADDING = "wordWrappedTableForMarginPadding"; //$NON-NLS-1$ + /** + * Word option, page header & footer, use layout-grid + */ + String WORD_WRAP_TABLE_FOR_HEADER_FOOTER = "wordWrappedTableHeaderFooter"; //$NON-NLS-1$ } diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/rom.def b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/rom.def index c5aa8b015f..514d1fc45f 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/rom.def +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/rom.def @@ -1993,6 +1993,24 @@ + + + + true + + + + false + + + + false + + + + false + + diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/i18n/Messages.properties b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/i18n/Messages.properties index e74119b618..5aaac4ec44 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/i18n/Messages.properties +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/i18n/Messages.properties @@ -2677,7 +2677,11 @@ Element.ReportDesign.Emitter.pdf.document.append=PDF, document(s) append Element.ReportDesign.Emitter.pdfa.font.fallback=PDF/A, fallback font (full qualified file name) Element.ReportDesign.Emitter.pdfa.font.cid.embed=PDF/A, include the CIDSet font stream Element.ReportDesign.Emitter.pdfa.document.title.embed=PDF/A, embed title - +Element.ReportDesign.Emitter.word=Emitter Word configuration +Element.ReportDesign.Emitter.word.combineMarginPadding=Use margin & padding for spacing (only without layout-grid) +Element.ReportDesign.Emitter.word.addEmptyParagraphForListCell=List element, add empty line of cell end +Element.ReportDesign.Emitter.word.wrappedTableForMarginPadding=Text element, use layout-grid for margin & padding +Element.ReportDesign.Emitter.word.wrappedTableHeaderFooter=Page header & footer, use layout-grid #2. Report Element ( Prefix = Element.ReportElement ) Element.ReportElement.displayName=Display name diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/writer/DesignWriterImpl.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/writer/DesignWriterImpl.java index b000630ef6..32db5af108 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/writer/DesignWriterImpl.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/writer/DesignWriterImpl.java @@ -151,6 +151,11 @@ protected void writeSimpleProperties(ReportDesign obj) { property(obj, IInternalReportDesignModel.PDF_FONT_CID_SET); property(obj, IInternalReportDesignModel.PDFA_DOCUMENT_EMBED_TITLE); + property(obj, IInternalReportDesignModel.WORD_COMBINE_MARGIN_PADDING); + property(obj, IInternalReportDesignModel.WORD_LIST_CELL_ADD_EMPTY_PARA); + property(obj, IInternalReportDesignModel.WORD_WRAP_TABLE_FOR_MARGIN_PADDING); + property(obj, IInternalReportDesignModel.WORD_WRAP_TABLE_FOR_HEADER_FOOTER); + // include libraries and scripts writeStructureList(obj, IModuleModel.LIBRARIES_PROP);