From 0ba002b4088b080a226fb7d929be0d8cdc838f27 Mon Sep 17 00:00:00 2001 From: Thomas Gutmann Date: Tue, 10 Jan 2023 15:20:56 +0100 Subject: [PATCH 01/12] bgi image embedded - discussion #1175 --- .../editparts/ReportElementEditPart.java | 26 +++++++++++++-- .../engine/nLayout/area/impl/PageArea.java | 33 ++++++++++++++++--- .../area/style/BackgroundImageInfo.java | 23 +++++++++++++ 3 files changed, 76 insertions(+), 6 deletions(-) diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java index 0e8c8474006..6c2e00948d3 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java @@ -625,6 +625,16 @@ protected Image getBackImage(DesignElementHandle handle) { image = null; } + // Try to get Embedded Image! + if (image == null) { + try { + image = ImageManager.getInstance().getEmbeddedImage(getModelAdapter().getModuleHandle(), + backGroundImage); + } catch (SWTException e) { + // Should not be ExceptionHandler.handle(e), see SCR#73730 + image = null; + } + } return image; } @@ -650,6 +660,17 @@ protected void refreshBackgroundImage(DesignElementHandle handle) { image = null; } + // Try to get Embedded Image! + if (image == null) { + try { + image = ImageManager.getInstance().getEmbeddedImage(getModelAdapter().getModuleHandle(), + backGroundImage); + } catch (SWTException e) { + // Should not be ExceptionHandler.handle(e), see SCR#73730 + image = null; + } + } + if (image == null) { figure.setImage(null); return; @@ -712,8 +733,9 @@ private int getImageDPI(String backGroundImage) { } else { temp = ImageManager.getInstance().generateURL(model.getModuleHandle(), backGroundImage); } - - in = temp.openStream(); + if (temp != null) { + in = temp.openStream(); + } } catch (IOException e) { in = null; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/PageArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/PageArea.java index 52992e592ab..a20bd5a797c 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/PageArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/PageArea.java @@ -39,6 +39,11 @@ import org.eclipse.birt.report.engine.nLayout.area.style.BoxStyle; import org.eclipse.birt.report.engine.util.ResourceLocatorWrapper; import org.eclipse.birt.report.model.api.ReportDesignHandle; +import org.eclipse.birt.report.model.api.elements.structures.EmbeddedImage; +import org.eclipse.birt.report.model.core.Module; +import org.eclipse.birt.report.model.metadata.MetaDataDictionary; +import org.eclipse.birt.report.model.metadata.StructureDefn; +import org.eclipse.birt.report.model.util.StructureRefUtil; import com.lowagie.text.Image; @@ -199,7 +204,8 @@ public void initialize() throws BirtException { boxStyle = new BoxStyle(); boxStyle.setBackgroundColor(backgroundColor); if (imageUrl != null) { - boxStyle.setBackgroundImage(createBackgroundImage(imageUrl)); + boxStyle.setBackgroundImage(createBackgroundImage(imageUrl, designHandle.getModule())); + // boxStyle.setBackgroundImage(createBackgroundImage(imageUrl)); } } context.setMaxHeight(root.getHeight()); @@ -222,15 +228,34 @@ public void initialize() throws BirtException { context.resetUnresolvedRowHints(); } - protected BackgroundImageInfo createBackgroundImage(String url) { + public byte[] loadAsEmbeddedImage(String url, Module module) { + StructureDefn defn = (StructureDefn) MetaDataDictionary.getInstance() + .getStructure(EmbeddedImage.EMBEDDED_IMAGE_STRUCT); + byte[] imageData = null; + try { + EmbeddedImage ei = (EmbeddedImage) StructureRefUtil.findStructure(module, defn, url); + imageData = ei.getData(module); + } catch (Exception te) { + imageData = null; + } + return imageData; + } + + protected BackgroundImageInfo createBackgroundImage(String url, Module module) { ResourceLocatorWrapper rl = null; ExecutionContext exeContext = ((ReportContent) content.getReportContent()).getExecutionContext(); if (exeContext != null) { rl = exeContext.getResourceLocator(); } IStyle cs = pageContent.getComputedStyle(); - BackgroundImageInfo backgroundImage = new BackgroundImageInfo(url, - cs.getProperty(IStyle.STYLE_BACKGROUND_REPEAT), 0, 0, 0, 0, rl); + BackgroundImageInfo backgroundImage = null; + byte[] imageData = loadAsEmbeddedImage( url, module ); + if ( imageData != null ) { + backgroundImage = new BackgroundImageInfo( url, cs.getProperty( IStyle.STYLE_BACKGROUND_REPEAT ), 0, 0, 0, 0, rl, imageData); + } else { + backgroundImage = new BackgroundImageInfo( url, cs.getProperty( IStyle.STYLE_BACKGROUND_REPEAT ), 0, 0, 0, 0, rl ); + } +// BackgroundImageInfo backgroundImage = new BackgroundImageInfo(url, cs.getProperty(IStyle.STYLE_BACKGROUND_REPEAT), 0, 0, 0, 0, rl); Image img = backgroundImage.getImageInstance(); IStyle style = pageContent.getStyle(); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java index 1d9f85ef2c1..a5f4afea639 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java @@ -52,6 +52,23 @@ public BackgroundImageInfo(String url, int repeatedMode, int xOffset, int yOffse prepareImageByteArray(); } + public BackgroundImageInfo(String url, int repeatedMode, int xOffset, int yOffset, int height, int width, + ResourceLocatorWrapper rl, byte[] imageData) { + this.xOffset = xOffset; + this.yOffset = yOffset; + this.repeatedMode = repeatedMode; + this.width = width; + this.height = height; + this.url = url; + this.rl = rl; + this.imageData = imageData; + try { + this.image = Image.getInstance(imageData); + } catch (Exception e) { + prepareImageByteArray(); + } + } + public BackgroundImageInfo(BackgroundImageInfo bgi) { this.xOffset = bgi.xOffset; this.yOffset = bgi.yOffset; @@ -69,6 +86,12 @@ public BackgroundImageInfo(String url, CSSValue mode, int xOffset, int yOffset, this(url, mode != null ? repeatMap.get(mode) : REPEAT, xOffset, yOffset, height, width, rl); } + public BackgroundImageInfo(String url, CSSValue mode, int xOffset, int yOffset, int height, int width, + ResourceLocatorWrapper rl, byte[] imageData) { + this(url, mode != null ? repeatMap.get(mode) : REPEAT, xOffset, yOffset, height, width, rl, imageData); + + } + public BackgroundImageInfo(String url, int height, int width, ResourceLocatorWrapper rl) { this(url, 0, 0, 0, height, width, rl); } From 01e154a3966efc752c2b148e97b6f1100caddd94 Mon Sep 17 00:00:00 2001 From: Thomas Gutmann Date: Fri, 13 Jan 2023 14:59:28 +0100 Subject: [PATCH 02/12] enhancement of background images with embedded images (discussion #1175) --- .../report/designer/util/ImageManager.java | 193 +++++++-- .../editparts/ReportDesignEditPart.java | 18 +- .../editparts/ReportElementEditPart.java | 266 +++++++----- .../META-INF/MANIFEST.MF | 1 + .../engine/emitter/html/AttributeBuilder.java | 2 +- .../emitter/html/HTMLReportEmitter.java | 70 ++- .../engine/BIRTPropertyManagerFactory.java | 3 + .../report/engine/css/engine/PerfectHash.java | 10 +- .../engine/css/engine/StyleConstants.java | 3 +- .../engine/value/css/BackgroundImageType.java | 63 +++ .../css/engine/value/css/CSSConstants.java | 3 + .../engine/value/css/CSSValueConstants.java | 6 + .../engine/nLayout/area/impl/PageArea.java | 40 +- .../nLayout/area/style/AreaConstants.java | 8 + .../area/style/BackgroundImageInfo.java | 404 ++++++++++++++++-- .../report/engine/parser/EngineIRVisitor.java | 7 +- .../engine/parser/StylePropertyMapping.java | 2 + .../birt/report/engine/parser/StyleUtil.java | 1 + 18 files changed, 868 insertions(+), 232 deletions(-) create mode 100644 engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java diff --git a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java index fda759d3e2a..5dd3572b082 100644 --- a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java +++ b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java @@ -24,6 +24,7 @@ import java.net.URI; import java.net.URL; import java.util.ArrayList; +import java.util.Base64.Decoder; import java.util.List; import org.apache.batik.transcoder.TranscoderException; @@ -50,9 +51,11 @@ public class ImageManager { private static final String EMBEDDED_SUFFIX = ".Embedded."; //$NON-NLS-1$ + private static final String DATA_PROTOCOL = "data:"; + private static final ImageManager instance = new ImageManager(); - private List invalidUrlList = new ArrayList(); + private List invalidUrlList = new ArrayList(); private String resourcesRootPath = ""; @@ -73,7 +76,7 @@ public static ImageManager getInstance() { * * @param handle * @param uri - * @return + * @return Return the image */ public Image getImage(ModuleHandle handle, String uri) { return getImage(handle, uri, false); @@ -85,15 +88,20 @@ public Image getImage(ModuleHandle handle, String uri) { * @param handle * @param uri * @param refresh - * @return + * @return Return the image */ public Image getImage(ModuleHandle handle, String uri, boolean refresh) { Image image = null; URL url = null; try { - url = generateURL(handle, uri); - image = getImageFromURL(url, refresh); + + if (uri.contains(DATA_PROTOCOL)) { + image = getEmbeddedImageDataURL(uri, refresh); + } else { + url = generateURL(handle, uri); + image = getImageFromURL(url, refresh); + } } catch (Exception e) { if (url != null && !invalidUrlList.contains(url.toString())) { invalidUrlList.add(url.toString()); @@ -107,10 +115,20 @@ private Image getImageFromURL(URL url, boolean refresh) throws IOException { return null; } String key = url.toString(); - Image image = getImageRegistry().get(key); - if (image == null) { - image = loadImage(url); - } + Image image = null; + /* + * + * if (key.contentEquals(DATA_PROTOCOL)) { String[] imageDataArray = + * key.split(";base64,"); String imageDataBase64 = key.split(";base64,")[1]; + * Decoder decoder = java.util.Base64.getDecoder(); image = new Image(); + * .getInstance(decoder.decode(imageDataBase64)); } else { + * + */ + image = getImageRegistry().get(key); + if (image == null) { + image = loadImage(url); + } +// } if (image == null) { if (!invalidUrlList.contains(url.toString())) { invalidUrlList.add(url.toString()); @@ -124,7 +142,8 @@ private Image getImageFromURL(URL url, boolean refresh) throws IOException { /** * Gets the image by the given URI * - * @param uri the url of the image file + * @param uri the url of the image file + * @param refresh mark if refresh necessary * * @return Returns the image,or null if the url is invalid or the file format is * unsupported. @@ -146,9 +165,10 @@ public Image getImage(String uri) { /** * Gets the embedded image * - * @param embeddedImage the embedded image data + * @param handle handel of the design + * @param name name the image * - * @return Returns the image,or null if the embedded image doesn't exist. + * @return Returns the image or null if the embedded image doesn't exist. */ public Image getEmbeddedImage(ModuleHandle handle, String name) { String key = generateKey(handle, name); @@ -169,7 +189,7 @@ public Image getEmbeddedImage(ModuleHandle handle, String name) { // convert svg image to JPEG image bytes JPEGTranscoder transcoder = new JPEGTranscoder(); // set the transcoding hints - transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.8)); + transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, .8f); // create the transcoder input TranscoderInput input = new TranscoderInput( new ByteArrayInputStream(embeddedImage.getData(handle.getModule()))); @@ -228,6 +248,85 @@ public Image getEmbeddedImage(ModuleHandle handle, String name) { return image; } + public Image getEmbeddedImageDataURL(String url, boolean refresh) throws IOException { + if ((url == null) || (!refresh && invalidUrlList.contains(url))) { + return null; + } + String key = url; + Image image = null; + if (!refresh) { + image = getImageRegistry().get(key); + if (image != null) { + return image; + } + } else { + removeCachedImage(key); + } + InputStream in = null; + String[] imageDataArray = key.split(";base64,"); + String imageDataBase64 = imageDataArray[1]; + Decoder decoder = java.util.Base64.getDecoder(); + + try { + if (url.toLowerCase().contains("svg+xml")) //$NON-NLS-1$ + { + // convert svg image to JPEG image bytes + JPEGTranscoder transcoder = new JPEGTranscoder(); + // set the transcoding hints + transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, .8f); + // create the transcoder input + String svgURI = url; + TranscoderInput input = new TranscoderInput(svgURI); + // create the transcoder output + ByteArrayOutputStream ostream = new ByteArrayOutputStream(); + TranscoderOutput output = new TranscoderOutput(ostream); + try { + transcoder.transcode(input, output); + } catch (TranscoderException e) { + } + // flush the stream + ostream.flush(); + // use the outputstream as Image input stream. + in = new ByteArrayInputStream(ostream.toByteArray()); + } else { + in = new ByteArrayInputStream(decoder.decode(imageDataBase64)); + } + ImageData[] datas = new ImageLoader().load(in); + if (datas != null && datas.length != 0) { + ImageData cur; + int index = 0; + for (int i = 0; i < datas.length; i++) { + ImageData temp = datas[i]; + if (temp.width * temp.height > datas[index].width * datas[index].height) { + index = i; + } + } + cur = datas[index]; + image = new Image(null, cur); + } + } catch (IOException e) { + throw e; + } catch (Exception ee) { + // do nothing + } finally { + if (in != null) { + in.close(); + } + } + if (image != null) { + getImageRegistry().put(key, image); + } + + if (image == null) { + if (!invalidUrlList.contains(url)) { + invalidUrlList.add(url); + } + } else { + invalidUrlList.remove(url); + } + return image; + } + /** * Remove cached image from map * @@ -243,7 +342,8 @@ public void removeCachedImage(String key) { /** * Loads the image into the image registry by the given URI * - * @param uri the URI of the image to load + * @param designHandle handle of report design + * @param uri the URI of the image to load * @return Returns the image if it loaded correctly * @throws IOException */ @@ -258,9 +358,9 @@ public Image loadImage(ModuleHandle designHandle, String uri) throws IOException /** * Reload the image, refresh the cache. * - * @param designHandle - * @param uri - * @return + * @param designHandle handle of report design + * @param uri the URI of the image to load + * @return Reload the image * @throws IOException */ public Image rloadImage(ModuleHandle designHandle, String uri) throws IOException { @@ -271,18 +371,32 @@ public Image rloadImage(ModuleHandle designHandle, String uri) throws IOExceptio return loadImage(url, true); } + /** + * Load the image based on URI + * + * @param uri the image URI + * @return Return the loaded image + * @throws IOException + */ public Image loadImage(String uri) throws IOException { return loadImage(null, uri); } + /** + * Load the image based on URI + * + * @param url the image URL + * @return Return the loaded image + * @throws IOException + */ public Image loadImage(URL url) throws IOException { return loadImage(url, false); } /** - * @param url - * @param reload - * @return + * @param url the image URL + * @param reload image should be refreshed or used from cache + * @return Return the loaded image * @throws IOException */ public Image loadImage(URL url, boolean reload) throws IOException { @@ -304,7 +418,7 @@ public Image loadImage(URL url, boolean reload) throws IOException { // convert svg image to JPEG image bytes JPEGTranscoder transcoder = new JPEGTranscoder(); // set the transcoding hints - transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.8)); + transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, .8f); // create the transcoder input String svgURI = url.toString(); TranscoderInput input = new TranscoderInput(svgURI); @@ -325,10 +439,6 @@ public Image loadImage(URL url, boolean reload) throws IOException { ImageData[] datas = new ImageLoader().load(in); if (datas != null && datas.length != 0) { ImageData cur; - // if (datas.length == 1) - // { - // cur = datas[0]; - // } int index = 0; for (int i = 0; i < datas.length; i++) { ImageData temp = datas[i]; @@ -358,6 +468,14 @@ private ImageRegistry getImageRegistry() { return CorePlugin.getDefault().getImageRegistry(); } + /** + * Generate the image URL + * + * @param designHandle + * @param uri of the image + * @return Return the URL of the image + * @throws MalformedURLException + */ public URL generateURL(ModuleHandle designHandle, String uri) throws MalformedURLException { try { return new URL(uri); @@ -379,7 +497,7 @@ public URL generateURL(ModuleHandle designHandle, String uri) throws MalformedUR /** * Generate hash key. * - * @param reportDesignHandle Moudle handle + * @param reportDesignHandle Module handle * @param name Name * @return key string */ @@ -390,9 +508,9 @@ public String generateKey(ModuleHandle reportDesignHandle, String name) { /** * Reload the URI image, refresh the cache. * - * @param moduleHandel - * @param uri - * @return + * @param moduleHandel Module handle + * @param uri uri of the image + * @return Return the reloaded image */ public Image reloadURIImage(ModuleHandle moduleHandel, String uri) { URL url = createURIURL(uri); @@ -417,6 +535,12 @@ public Image reloadURIImage(ModuleHandle moduleHandel, String uri) { return image; } + /** + * Create the URL based on URI + * + * @param uri uri string + * @return Return the URL based on URI + */ public URL createURIURL(String uri) { URL url = null; try { @@ -440,9 +564,9 @@ public URL createURIURL(String uri) { /** * Get image from URI * - * @param moduleHandel - * @param uri - * @return + * @param moduleHandel Module handle + * @param uri URI of the image + * @return Return the image based on URI */ // bugzilla 245641 public Image getURIImage(ModuleHandle moduleHandel, String uri) { @@ -458,6 +582,11 @@ public Image getURIImage(ModuleHandle moduleHandel, String uri) { return image; } + /** + * Set the URI root path + * + * @param rootPath Root path of the URI + */ public void setURIRootPath(String rootPath) { this.resourcesRootPath = rootPath; } diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportDesignEditPart.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportDesignEditPart.java index d8927a2c320..fb63fd155db 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportDesignEditPart.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportDesignEditPart.java @@ -34,12 +34,14 @@ import org.eclipse.birt.report.designer.internal.ui.util.UIUtil; import org.eclipse.birt.report.designer.ui.IReportGraphicConstants; import org.eclipse.birt.report.designer.util.DEUtil; +import org.eclipse.birt.report.model.api.DesignElementHandle; import org.eclipse.birt.report.model.api.MasterPageHandle; import org.eclipse.birt.report.model.api.ModuleHandle; import org.eclipse.birt.report.model.api.ReportDesignHandle; import org.eclipse.birt.report.model.api.SimpleMasterPageHandle; import org.eclipse.birt.report.model.api.SlotHandle; import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; +import org.eclipse.birt.report.model.elements.interfaces.IInternalReportDesignModel; import org.eclipse.birt.report.model.elements.interfaces.IMasterPageModel; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.geometry.Dimension; @@ -124,7 +126,7 @@ protected void createEditPolicies() { * getModelChildren() */ @Override - protected List getModelChildren() { + protected List getModelChildren() { return HandleAdapterFactory.getInstance().getReportDesignHandleAdapter(getModel()).getChildren(); } @@ -201,7 +203,7 @@ public void refreshMarginBorder(ReportDesignMarginBorder border) { private SimpleMasterPageHandle getSimpleMasterPageHandle() { SlotHandle slotHandle = ((ModuleHandle) getModel()).getMasterPages(); - Iterator iter = slotHandle.iterator(); + Iterator iter = slotHandle.iterator(); SimpleMasterPageHandle masterPageHandle = (SimpleMasterPageHandle) iter.next(); return masterPageHandle; } @@ -267,8 +269,8 @@ protected void propertyChange(Map info) { * Bidi-specific behavior is addressed only if Bidi support is enabled */ - if (info.get(ReportDesignHandle.BIDI_ORIENTATION_PROP) instanceof ReportDesignHandle) { - String newOrientation = ((ReportDesignHandle) info.get(ReportDesignHandle.BIDI_ORIENTATION_PROP)) + if (info.get(IInternalReportDesignModel.BIDI_ORIENTATION_PROP) instanceof ReportDesignHandle) { + String newOrientation = ((ReportDesignHandle) info.get(IInternalReportDesignModel.BIDI_ORIENTATION_PROP)) .getBidiOrientation(); UIUtil.processOrientationChange(newOrientation, getViewer()); @@ -277,10 +279,10 @@ protected void propertyChange(Map info) { } super.propertyChange(info); - if (info.get(ReportDesignHandle.LAYOUT_PREFERENCE_PROP) != null) { - if (info.get(ReportDesignHandle.LAYOUT_PREFERENCE_PROP) instanceof ReportDesignHandle) { + if (info.get(IInternalReportDesignModel.LAYOUT_PREFERENCE_PROP) != null) { + if (info.get(IInternalReportDesignModel.LAYOUT_PREFERENCE_PROP) instanceof ReportDesignHandle) { getViewer().setProperty(IReportGraphicConstants.REPORT_LAYOUT_PROPERTY, - ((ReportDesignHandle) info.get(ReportDesignHandle.LAYOUT_PREFERENCE_PROP)) + ((ReportDesignHandle) info.get(IInternalReportDesignModel.LAYOUT_PREFERENCE_PROP)) .getLayoutPreference()); // invalidate = true; @@ -303,7 +305,7 @@ protected void propertyChange(Map info) { || info.get(IMasterPageModel.HEIGHT_PROP) != null || info.get(IMasterPageModel.ORIENTATION_PROP) != null) { SlotHandle slotHandle = ((ModuleHandle) getModel()).getMasterPages(); - Iterator iter = slotHandle.iterator(); + Iterator iter = slotHandle.iterator(); SimpleMasterPageHandle masterPageHandle = (SimpleMasterPageHandle) iter.next(); Dimension size = getMasterPageSize(masterPageHandle); diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java index 6c2e00948d3..3d2dc44a515 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java @@ -29,7 +29,7 @@ import org.eclipse.birt.report.designer.core.model.ReportDesignHandleAdapter; import org.eclipse.birt.report.designer.core.model.ReportItemtHandleAdapter; import org.eclipse.birt.report.designer.core.model.schematic.HandleAdapterFactory; -import org.eclipse.birt.report.designer.core.util.mediator.request.ReportRequest; +import org.eclipse.birt.report.designer.core.util.mediator.request.ReportRequestConstants; import org.eclipse.birt.report.designer.internal.ui.editors.parts.DeferredGraphicalViewer; import org.eclipse.birt.report.designer.internal.ui.editors.schematic.border.BaseBorder; import org.eclipse.birt.report.designer.internal.ui.editors.schematic.editpolicies.ReportElementResizablePolicy; @@ -45,17 +45,18 @@ import org.eclipse.birt.report.designer.util.ColorManager; import org.eclipse.birt.report.designer.util.DEUtil; import org.eclipse.birt.report.designer.util.ImageManager; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.model.api.DesignElementHandle; import org.eclipse.birt.report.model.api.MasterPageHandle; import org.eclipse.birt.report.model.api.ModuleHandle; import org.eclipse.birt.report.model.api.ReportDesignHandle; import org.eclipse.birt.report.model.api.ReportItemHandle; -import org.eclipse.birt.report.model.api.StyleHandle; import org.eclipse.birt.report.model.api.activity.SemanticException; import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; import org.eclipse.birt.report.model.api.metadata.DimensionValue; import org.eclipse.birt.report.model.api.util.ColorUtil; import org.eclipse.birt.report.model.api.util.URIUtil; +import org.eclipse.birt.report.model.elements.interfaces.IStyleModel; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.MouseEvent; import org.eclipse.draw2d.MouseMotionListener; @@ -124,7 +125,9 @@ public void setModel(Object model) { } /** - * @return + * Create the design handle adapter + * + * @return Return the design handle adapter */ public DesignElementHandleAdapter creatDesignElementHandleAdapter() { HandleAdapterFactory.getInstance().remove(getModel()); @@ -140,7 +143,7 @@ public void performRequest(Request request) { return; } if (RequestConstants.REQ_OPEN.equals(request.getType()) - || ReportRequest.CREATE_ELEMENT.equals(request.getType())) { + || ReportRequestConstants.CREATE_ELEMENT.equals(request.getType())) { if (isEdited()) { return; } @@ -154,6 +157,9 @@ public void performRequest(Request request) { } } + /** + * Perform the direct edit (currently nothing will be done) + */ public void performDirectEdit() { // do nothing } @@ -169,7 +175,7 @@ protected void setEdited(boolean isEdited) { /** * Creates the guide handle, default get from parent. * - * @return + * @return Return the guide handle */ protected AbstractGuideHandle createGuideHandle() { EditPart part = getParent(); @@ -217,7 +223,7 @@ public void addGuideFeedBack() { private AbstractGuideHandle findHandle() { IFigure layer = getHandleLayer(); - List list = layer.getChildren(); + List list = layer.getChildren(); int size = list.size(); for (int i = 0; i < size; i++) { @@ -232,20 +238,20 @@ private AbstractGuideHandle findHandle() { protected void clearGuideHandle() { IFigure layer = getHandleLayer(); - List list = layer.getChildren(); - List temp = new ArrayList(); + List list = layer.getChildren(); + List temp = new ArrayList(); int size = list.size(); for (int i = 0; i < size; i++) { Object obj = list.get(i); if (obj instanceof AbstractGuideHandle) { - temp.add(obj); + temp.add((IFigure) obj); } } size = temp.size(); for (int i = 0; i < size; i++) { - IFigure figure = (IFigure) temp.get(i); + IFigure figure = temp.get(i); layer.remove(figure); } } @@ -382,10 +388,10 @@ public void run() { // { // needRefresh = true; // } - if (isPercentageValue(handle.getProperty(StyleHandle.MARGIN_LEFT_PROP))) { + if (isPercentageValue(handle.getProperty(IStyleModel.MARGIN_LEFT_PROP))) { needRefresh = true; } - if (isPercentageValue(handle.getProperty(StyleHandle.MARGIN_RIGHT_PROP))) { + if (isPercentageValue(handle.getProperty(IStyleModel.MARGIN_RIGHT_PROP))) { needRefresh = true; } @@ -467,7 +473,7 @@ public void setBounds(Rectangle r) { /** * Gets location * - * @return + * @return Return the location point */ public Point getLocation() { return getReportElementHandleAdapt().getLocation(); @@ -547,8 +553,13 @@ public void refreshChildren() { super.refreshChildren(); } + /** + * Refresh the report children + * + * @param parent parent like starting point of refresh + */ public void refreshReportChildren(ReportElementEditPart parent) { - List list = parent.getChildren(); + List list = parent.getChildren(); for (int i = 0; i < list.size(); i++) { Object part = list.get(i); if (part instanceof ReportElementEditPart) { @@ -561,6 +572,9 @@ public void refreshReportChildren(ReportElementEditPart parent) { } } + /** + * + */ public abstract void refreshFigure(); /** @@ -591,7 +605,7 @@ protected void refreshBackground(DesignElementHandle handle) { * */ protected void refreshBackgroundColor(DesignElementHandle handle) { - Object obj = handle.getProperty(StyleHandle.BACKGROUND_COLOR_PROP); + Object obj = handle.getProperty(IStyleModel.BACKGROUND_COLOR_PROP); if (handle instanceof MasterPageHandle) { getFigure().setOpaque(true); @@ -616,28 +630,36 @@ protected Image getBackImage(DesignElementHandle handle) { if (backGroundImage == null) { return null; - } else { - Image image = null; + } + Object obj = handle.getProperty(IStyleModel.BACKGROUND_IMAGE_TYPE_PROP); + String imageSourceType = CSSValueConstants.URL_VALUE.getCssText(); + if (obj instanceof String) { + imageSourceType = obj.toString(); + } + + Image image = null; + + // URL image + if (imageSourceType.equalsIgnoreCase(CSSValueConstants.URL_VALUE.getCssText())) { try { image = ImageManager.getInstance().getImage(getModelAdapter().getModuleHandle(), backGroundImage); } catch (SWTException e) { // Should not be ExceptionHandler.handle(e), see SCR#73730 image = null; } + } - // Try to get Embedded Image! - if (image == null) { - try { - image = ImageManager.getInstance().getEmbeddedImage(getModelAdapter().getModuleHandle(), - backGroundImage); - } catch (SWTException e) { - // Should not be ExceptionHandler.handle(e), see SCR#73730 - image = null; - } + // embedded image + if (imageSourceType.equalsIgnoreCase(CSSValueConstants.EMBED_VALUE.getCssText())) { + try { + image = ImageManager.getInstance().getEmbeddedImage(getModelAdapter().getModuleHandle(), + backGroundImage); + } catch (SWTException e) { + // Should not be ExceptionHandler.handle(e), see SCR#73730 + image = null; } - return image; } - + return image; } /* @@ -651,71 +673,71 @@ protected void refreshBackgroundImage(DesignElementHandle handle) { if (backGroundImage == null) { figure.setImage(null); - } else { - Image image = null; + } + + Image image = null; + // URL image + try { + image = ImageManager.getInstance().getImage(getModelAdapter().getModuleHandle(), backGroundImage); + } catch (SWTException e) { + // Should not be ExceptionHandler.handle(e), see SCR#73730 + image = null; + } + + // embedded image + if (image == null) { try { - image = ImageManager.getInstance().getImage(getModelAdapter().getModuleHandle(), backGroundImage); + image = ImageManager.getInstance().getEmbeddedImage(getModelAdapter().getModuleHandle(), + backGroundImage); } catch (SWTException e) { // Should not be ExceptionHandler.handle(e), see SCR#73730 image = null; } + } - // Try to get Embedded Image! - if (image == null) { - try { - image = ImageManager.getInstance().getEmbeddedImage(getModelAdapter().getModuleHandle(), - backGroundImage); - } catch (SWTException e) { - // Should not be ExceptionHandler.handle(e), see SCR#73730 - image = null; - } - } - - if (image == null) { - figure.setImage(null); - return; - } - int dpi = getImageDPI(backGroundImage); - if (figure instanceof ReportElementFigure) { - ((ReportElementFigure) figure).setBackgroundImageDPI(dpi); - } - figure.setImage(image); - - Object[] backGroundPosition = getBackgroundPosition(handle); - int backGroundRepeat = getBackgroundRepeat(handle); - - figure.setRepeat(backGroundRepeat); - - Object xPosition = backGroundPosition[0]; - Object yPosition = backGroundPosition[1]; - Rectangle area = getFigure().getClientArea(); - org.eclipse.swt.graphics.Rectangle imageArea = image.getBounds(); - Point position = new Point(-1, -1); - int alignment = 0; - - if (xPosition instanceof Integer) { - position.x = ((Integer) xPosition).intValue(); - } else if (xPosition instanceof DimensionValue) { - int percentX = (int) ((DimensionValue) xPosition).getMeasure(); - - position.x = (area.width - imageArea.width) * percentX / 100; - } else if (xPosition instanceof String) { - alignment |= DesignElementHandleAdapter.getPosition((String) xPosition); - } - - if (yPosition instanceof Integer) { - position.y = ((Integer) yPosition).intValue(); - } else if (yPosition instanceof DimensionValue) { - int percentY = (int) ((DimensionValue) yPosition).getMeasure(); + if (image == null) { + figure.setImage(null); + return; + } + int dpi = getImageDPI(backGroundImage); - position.y = (area.width - imageArea.width) * percentY / 100; - } else if (yPosition instanceof String) { - alignment |= DesignElementHandleAdapter.getPosition((String) yPosition); - } + if (figure instanceof ReportElementFigure) { + ((ReportElementFigure) figure).setBackgroundImageDPI(dpi); + } + figure.setImage(image); + + Object[] backGroundPosition = getBackgroundPosition(handle); + int backGroundRepeat = getBackgroundRepeat(handle); + + figure.setRepeat(backGroundRepeat); + + Object xPosition = backGroundPosition[0]; + Object yPosition = backGroundPosition[1]; + Rectangle area = getFigure().getClientArea(); + org.eclipse.swt.graphics.Rectangle imageArea = image.getBounds(); + Point position = new Point(-1, -1); + int alignment = 0; + + if (xPosition instanceof Integer) { + position.x = ((Integer) xPosition).intValue(); + } else if (xPosition instanceof DimensionValue) { + int percentX = (int) ((DimensionValue) xPosition).getMeasure(); + position.x = (area.width - imageArea.width) * percentX / 100; + } else if (xPosition instanceof String) { + alignment |= DesignElementHandleAdapter.getPosition((String) xPosition); + } - figure.setAlignment(alignment); - figure.setPosition(position); + if (yPosition instanceof Integer) { + position.y = ((Integer) yPosition).intValue(); + } else if (yPosition instanceof DimensionValue) { + int percentY = (int) ((DimensionValue) yPosition).getMeasure(); + position.y = (area.width - imageArea.width) * percentY / 100; + } else if (yPosition instanceof String) { + alignment |= DesignElementHandleAdapter.getPosition((String) yPosition); } + + figure.setAlignment(alignment); + figure.setPosition(position); } private int getImageDPI(String backGroundImage) { @@ -736,6 +758,7 @@ private int getImageDPI(String backGroundImage) { if (temp != null) { in = temp.openStream(); } + } catch (IOException e) { in = null; } @@ -755,7 +778,6 @@ private int getImageDPI(String backGroundImage) { * Marks edit part dirty * * @param bool - * @param notifyParent */ @Override public void markDirty(boolean bool) { @@ -824,28 +846,28 @@ protected void updateBaseBorder(DesignElementHandle handle, BaseBorder border) { } protected void updateBottomBorder(DesignElementHandle handle, BaseBorder border) { - border.bottomColor = handle.getPropertyHandle(StyleHandle.BORDER_BOTTOM_COLOR_PROP).getIntValue(); - border.bottomStyle = handle.getPropertyHandle(StyleHandle.BORDER_BOTTOM_STYLE_PROP).getStringValue(); - border.bottomWidth = handle.getPropertyHandle(StyleHandle.BORDER_BOTTOM_WIDTH_PROP).getStringValue(); + border.bottomColor = handle.getPropertyHandle(IStyleModel.BORDER_BOTTOM_COLOR_PROP).getIntValue(); + border.bottomStyle = handle.getPropertyHandle(IStyleModel.BORDER_BOTTOM_STYLE_PROP).getStringValue(); + border.bottomWidth = handle.getPropertyHandle(IStyleModel.BORDER_BOTTOM_WIDTH_PROP).getStringValue(); } protected void updateTopBorder(DesignElementHandle handle, BaseBorder border) { - border.topColor = handle.getPropertyHandle(StyleHandle.BORDER_TOP_COLOR_PROP).getIntValue(); - border.topStyle = handle.getPropertyHandle(StyleHandle.BORDER_TOP_STYLE_PROP).getStringValue(); - border.topWidth = handle.getPropertyHandle(StyleHandle.BORDER_TOP_WIDTH_PROP).getStringValue(); + border.topColor = handle.getPropertyHandle(IStyleModel.BORDER_TOP_COLOR_PROP).getIntValue(); + border.topStyle = handle.getPropertyHandle(IStyleModel.BORDER_TOP_STYLE_PROP).getStringValue(); + border.topWidth = handle.getPropertyHandle(IStyleModel.BORDER_TOP_WIDTH_PROP).getStringValue(); } protected void updateLeftBorder(DesignElementHandle handle, BaseBorder border) { - border.leftColor = handle.getPropertyHandle(StyleHandle.BORDER_LEFT_COLOR_PROP).getIntValue(); - border.leftStyle = handle.getPropertyHandle(StyleHandle.BORDER_LEFT_STYLE_PROP).getStringValue(); - border.leftWidth = handle.getPropertyHandle(StyleHandle.BORDER_LEFT_WIDTH_PROP).getStringValue(); + border.leftColor = handle.getPropertyHandle(IStyleModel.BORDER_LEFT_COLOR_PROP).getIntValue(); + border.leftStyle = handle.getPropertyHandle(IStyleModel.BORDER_LEFT_STYLE_PROP).getStringValue(); + border.leftWidth = handle.getPropertyHandle(IStyleModel.BORDER_LEFT_WIDTH_PROP).getStringValue(); } protected void updateRightBorder(DesignElementHandle handle, BaseBorder border) { - border.rightColor = handle.getPropertyHandle(StyleHandle.BORDER_RIGHT_COLOR_PROP).getIntValue(); - border.rightStyle = handle.getPropertyHandle(StyleHandle.BORDER_RIGHT_STYLE_PROP).getStringValue(); - border.rightWidth = handle.getPropertyHandle(StyleHandle.BORDER_RIGHT_WIDTH_PROP).getStringValue(); + border.rightColor = handle.getPropertyHandle(IStyleModel.BORDER_RIGHT_COLOR_PROP).getIntValue(); + border.rightStyle = handle.getPropertyHandle(IStyleModel.BORDER_RIGHT_STYLE_PROP).getStringValue(); + border.rightWidth = handle.getPropertyHandle(IStyleModel.BORDER_RIGHT_WIDTH_PROP).getStringValue(); } protected void refreshBorder(DesignElementHandle handle, BaseBorder border) { @@ -896,8 +918,10 @@ protected boolean isFigureLeft(Request request) { return center.x >= p.x; } - /* - * (non-Javadoc) + /** + * Verify if the element is deleted + * + * @return Return if the element is deleted * * @see org.eclipse.gef.EditPart#isActive() */ @@ -912,6 +936,9 @@ public boolean isDelete() { return bool; } + /** + * Notify the model change + */ public void notifyModelChange() { if (getParent() != null && getParent() instanceof ReportElementEditPart) { ((ReportElementEditPart) getParent()).notifyModelChange(); @@ -919,23 +946,29 @@ public void notifyModelChange() { } /** + * Refresh after content change * + * @param info Map of changed content elements */ - protected void contentChange(Map info) { + protected void contentChange(Map info) { markDirty(true); refresh(); } /** - * @param focus + * Refresh after property change + * + * @param info Map of changed element properties */ - protected void propertyChange(Map info) { + protected void propertyChange(Map info) { refreshVisuals(); } /** - * @param model - * @return + * Compare of the current model with the requested model + * + * @param model Module to validate + * @return Return the compare result */ public boolean isinterest(Object model) { return getModel().equals(model); @@ -943,15 +976,17 @@ public boolean isinterest(Object model) { /** * @param object - * @return + * @return false */ public boolean isinterestSelection(Object object) { return false; } /** + * Get the resize policy object + * * @param parentPolice - * @return + * @return Return the resize edit policy */ public EditPolicy getResizePolice(EditPolicy parentPolice) { ReportElementResizablePolicy policy = new ReportElementResizablePolicy(); @@ -970,12 +1005,19 @@ public void removeChild(EditPart child) { super.removeChild(child); } + /** + * Get guide label + * + * @return Return empty guide label + */ public String getGuideLabel() { return ""; //$NON-NLS-1$ } /** - * @return + * Get the direction of the text + * + * @return Return the text direction */ protected String getTextDirection() { DesignElementHandle handle = (DesignElementHandle) getModel(); @@ -983,8 +1025,10 @@ protected String getTextDirection() { } /** - * @param handle - * @return + * Get the direction of the text + * + * @param handle design handle to be used + * @return Return the text direction */ protected String getTextDirection(DesignElementHandle handle) { return handle.isDirectionRTL() ? DesignChoiceConstants.BIDI_DIRECTION_RTL @@ -1009,7 +1053,9 @@ protected void updateLayoutPreference() { } /** - * @return + * Verify if the layout is fixed + * + * @return Return the information of fixed layout */ public boolean isFixLayout() { return DEUtil.isFixLayout(getModel()); diff --git a/engine/org.eclipse.birt.report.engine.emitter.html/META-INF/MANIFEST.MF b/engine/org.eclipse.birt.report.engine.emitter.html/META-INF/MANIFEST.MF index 4fbac940f9e..62afb69f1d0 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.html/META-INF/MANIFEST.MF +++ b/engine/org.eclipse.birt.report.engine.emitter.html/META-INF/MANIFEST.MF @@ -15,4 +15,5 @@ Require-Bundle: org.eclipse.birt.core;bundle-version="[2.1.0,5.0.0)", Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.eclipse.birt.report.engine.emitter.html +Import-Package: com.lowagie.text diff --git a/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/AttributeBuilder.java b/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/AttributeBuilder.java index 3bea3123f65..3d358a15f7d 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/AttributeBuilder.java +++ b/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/AttributeBuilder.java @@ -101,7 +101,7 @@ public static void buildBackground(StringBuffer styleBuffer, IStyle style, HTMLR return; } - image = emitter.handleStyleImage(image, true); + image = emitter.handleStyleImage(image, true, style); if (image != null && image.length() > 0) { buildURLProperty(styleBuffer, HTMLTags.ATTR_BACKGROUND_IMAGE, image); buildProperty(styleBuffer, HTMLTags.ATTR_BACKGROUND_REPEAT, style.getBackgroundRepeat()); diff --git a/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java b/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java index 91bbea0c871..3d29eac3158 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java +++ b/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java @@ -65,6 +65,7 @@ import org.eclipse.birt.report.engine.content.ITableContent; import org.eclipse.birt.report.engine.content.ITableGroupContent; import org.eclipse.birt.report.engine.content.ITextContent; +import org.eclipse.birt.report.engine.content.impl.ReportContent; import org.eclipse.birt.report.engine.css.engine.value.css.CSSConstants; import org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter; import org.eclipse.birt.report.engine.emitter.EmitterUtil; @@ -73,6 +74,7 @@ import org.eclipse.birt.report.engine.emitter.IEmitterServices; import org.eclipse.birt.report.engine.emitter.html.util.DiagonalLineImage; import org.eclipse.birt.report.engine.emitter.html.util.HTMLEmitterUtil; +import org.eclipse.birt.report.engine.executor.ExecutionContext; import org.eclipse.birt.report.engine.executor.ExecutionContext.ElementExceptionInfo; import org.eclipse.birt.report.engine.executor.css.HTMLProcessor; import org.eclipse.birt.report.engine.i18n.EngineResourceHandle; @@ -84,8 +86,10 @@ import org.eclipse.birt.report.engine.ir.StyledElementDesign; import org.eclipse.birt.report.engine.ir.TemplateDesign; import org.eclipse.birt.report.engine.layout.pdf.util.PropertyUtil; +import org.eclipse.birt.report.engine.nLayout.area.style.BackgroundImageInfo; import org.eclipse.birt.report.engine.parser.TextParser; import org.eclipse.birt.report.engine.presentation.ContentEmitterVisitor; +import org.eclipse.birt.report.engine.util.ResourceLocatorWrapper; import org.eclipse.birt.report.model.api.DesignElementHandle; import org.eclipse.birt.report.model.api.IResourceLocator; import org.eclipse.birt.report.model.api.IncludedCssStyleSheetHandle; @@ -95,6 +99,7 @@ import org.eclipse.birt.report.model.api.metadata.DimensionValue; import org.eclipse.birt.report.model.api.util.DimensionUtil; import org.eclipse.birt.report.model.api.util.StringUtil; +import org.eclipse.birt.report.model.core.Module; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -3092,7 +3097,29 @@ protected String validate(IHyperlinkAction action) { * @return */ public String handleStyleImage(String uri) { - return handleStyleImage(uri, false); + return handleStyleImage(uri, false, null); + } + + /** + * handle style image + * + * @param uri uri in style image + * @param isBackground Is this image a used for a background? + * @return + */ + public String handleStyleImage(String uri, boolean isBackground) { + return handleStyleImage(uri, isBackground, null); + } + + /** + * handle style image + * + * @param style Is the style object of the image include uri. + * @param isBackground Is this image a used for a background? + * @return + */ + public String handleStyleImage(IStyle style, boolean isBackground) { + return handleStyleImage(null, isBackground, style); } // FIXME: code review: this function needs be handled in the ENGINE( after @@ -3106,11 +3133,39 @@ public String handleStyleImage(String uri) { * @param isBackground Is this image a used for a background? * @return */ - public String handleStyleImage(String uri, boolean isBackground) { +// public String handleStyleImage(String uri, boolean isBackground) { + public String handleStyleImage(String uri, boolean isBackground, IStyle imageStyle) { + String sourceType = "url"; + String dataProtocol = "data:"; + ReportDesignHandle design = (ReportDesignHandle) runnable.getDesignHandle(); URL url = design.findResource(uri, IResourceLocator.IMAGE, reportContext.getAppContext()); String fileExtension = null; - if (uri != null && uri.contains(".")) { + + Module module = null; + BackgroundImageInfo backgroundImage = null; + + if (isBackground && imageStyle != null) { + module = design.getModule(); + ResourceLocatorWrapper rl = null; + ExecutionContext exeContext = ((ReportContent) this.report).getExecutionContext(); + if (exeContext != null) { + rl = exeContext.getResourceLocator(); + } + + String uriString = EmitterUtil.getBackgroundImageUrl(imageStyle, design, + this.report.getReportContext() == null ? null : this.report.getReportContext().getAppContext()); + + backgroundImage = new BackgroundImageInfo(uriString, imageStyle.getProperty(IStyle.STYLE_BACKGROUND_REPEAT), + 0, 0, 0, 0, rl, module, imageStyle.getProperty(IStyle.STYLE_BACKGROUND_IMAGE_TYPE)); + + if (backgroundImage.getSourceType().equalsIgnoreCase(IStyle.CSS_EMBED_VALUE)) { + uri = backgroundImage.getDataUrl(); + } + fileExtension = backgroundImage.getFileExtension(); + } + + if (fileExtension == null && uri != null && uri.contains(".")) { fileExtension = uri.substring(uri.lastIndexOf(".") + 1); } if (url == null) { @@ -3120,8 +3175,9 @@ public String handleStyleImage(String uri, boolean isBackground) { Image image = null; if (isBackground) { try { - byte[] buffer = EmitterUtil.getImageData(uri); - image = new Image(buffer, uri, ".jpg"); + byte[] buffer = backgroundImage.getImageData(); + image = new Image(buffer, uri, "." + backgroundImage.getFileExtension()); + image.setMimeType(backgroundImage.getMimeType()); } catch (Exception e) { image = new Image(uri); } @@ -3130,9 +3186,11 @@ public String handleStyleImage(String uri, boolean isBackground) { } image.setReportRunnable(runnable); image.setRenderOption(renderOption); - if (fileExtension != null) { + if (image.getMimeType() == null && fileExtension != null) { image.setMimeType("image/" + fileExtension); } + +// var test = image.getMimeType(); TGGGGG; String imgUri = null; if (imageHandler != null) { switch (image.getSource()) { diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/BIRTPropertyManagerFactory.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/BIRTPropertyManagerFactory.java index efa09423677..47c2c760628 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/BIRTPropertyManagerFactory.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/BIRTPropertyManagerFactory.java @@ -21,6 +21,7 @@ import org.eclipse.birt.report.engine.css.engine.value.birt.DataFormatManager; import org.eclipse.birt.report.engine.css.engine.value.birt.VisibleFormatManager; import org.eclipse.birt.report.engine.css.engine.value.css.BackgroundAttachmentManager; +import org.eclipse.birt.report.engine.css.engine.value.css.BackgroundImageType; import org.eclipse.birt.report.engine.css.engine.value.css.BackgroundRepeatManager; import org.eclipse.birt.report.engine.css.engine.value.css.BackgroundSizeManager; import org.eclipse.birt.report.engine.css.engine.value.css.BorderColorManager; @@ -180,6 +181,8 @@ public BIRTPropertyManagerFactory() { CSSValueConstants.NUMBER_0); vms[StyleConstants.STYLE_WIDTH] = new LengthManager(CSSConstants.CSS_WIDTH_PROPERTY, false, CSSValueConstants.NUMBER_0); + vms[StyleConstants.STYLE_BACKGROUND_IMAGE_TYPE] = new BackgroundImageType(); + } @Override diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/PerfectHash.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/PerfectHash.java index b593b56aaec..59dec0cddf4 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/PerfectHash.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/PerfectHash.java @@ -18,7 +18,7 @@ public class PerfectHash { // bidi_hcg: Aligned with generated token.cpp after the "direction" keyword // was added. - final static int TOTAL_KEYWORDS = 61; + final static int TOTAL_KEYWORDS = 62; final static int MIN_WORD_LENGTH = 5; @@ -35,7 +35,7 @@ public class PerfectHash { 112, 112, 112, 112, 112, 112, 112, 45, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 52, 5, 0, 0, 15, 40, 20, 0, - 40, 112, 15, 0, 20, 5, 0, 5, 112, 5, 40, 0, 112, 15, 45, 30, 36, 112, 112, 112, 112, 112, 112 }; + 40, 112, 15, 0, 20, 5, 0, 5, 112, 5, 40, 0, 112, 15, 45, 30, 36, 112, 112, 112, 112, 112, 112, 112 }; public static int hash(String str) { int hashValue = str.length(); @@ -62,7 +62,7 @@ public static int hash(String str) { static int lengthtable[] = { 5, 11, 11, 12, 13, 9, 11, 17, 16, 17, 18, 19, 10, 16, 18, 19, 11, 12, 14, 10, 11, 18, 19, 10, 6, 12, 5, 16, 7, 11, 12, 13, 21, 17, 13, 14, 16, 21, 8, 9, 10, 16, 17, 13, 14, 16, 17, 21, 14, 16, - 7, 11, 17, 14, 6, 11, 17, 16, 14, 12, 11 }; + 7, 11, 17, 14, 6, 11, 17, 16, 14, 12, 11, 21 }; static String wordlist[] = { "color" /* hash value = 10, index = 0 */, "data-format" /* hash value = 11, index = 1 */, "line-height" /* hash value = 16, index = 2 */, "padding-left" /* hash value = 17, index = 3 */, "padding-right" /* hash value = 18, index = 4 */, @@ -97,14 +97,14 @@ public static int hash(String str) { "widows" /* hash value = 91, index = 54 */, "font-family" /* hash value = 92, index = 55 */, "page-break-inside" /* hash value = 97, index = 56 */, "page-break-after" /* hash value = 98, index = 57 */, "text-underline" /* hash value = 99, index = 58 */, "word-spacing" /* hash value = 102, index = 59 */, - "white-space" /* hash value = 111, index = 60 */ + "white-space" /* hash value = 111, index = 60 */, "background-image-type" /* hash value = ??, index = 61 */ }; static short lookup[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, -1, -1, -1, -1, 2, 3, 4, 5, -1, 6, 7, -1, -1, -1, 8, 9, 10, 11, 12, 13, -1, 14, 15, -1, 16, 17, -1, 18, 19, 20, -1, 21, 22, 23, 24, 25, -1, -1, 26, 27, 28, -1, -1, -1, 29, 30, 31, -1, -1, 32, 33, 34, 35, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, -1, 45, 46, 47, 48, -1, 49, -1, 50, -1, -1, 51, 52, -1, 53, -1, 54, 55, -1, -1, -1, -1, 56, 57, 58, -1, -1, 59, -1, -1, - -1, -1, -1, -1, -1, -1, 60 }; + -1, -1, -1, -1, -1, -1, 60, -1 }; public static int in_word_set(String str) { int len = str.length(); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/StyleConstants.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/StyleConstants.java index 4dba2004172..9a7e9b12461 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/StyleConstants.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/StyleConstants.java @@ -78,6 +78,7 @@ public interface StyleConstants { int STYLE_TEXT_UNDERLINE = 58; int STYLE_WORD_SPACING = 59; int STYLE_WHITE_SPACE = 60; + int STYLE_BACKGROUND_IMAGE_TYPE = 61; - int NUMBER_OF_STYLE = 61; + int NUMBER_OF_STYLE = 62; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java new file mode 100644 index 00000000000..accca0097e6 --- /dev/null +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2004 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 + *******************************************************************************/ +package org.eclipse.birt.report.engine.css.engine.value.css; + +import org.eclipse.birt.report.engine.css.engine.value.IdentifierManager; +import org.eclipse.birt.report.engine.css.engine.value.StringMap; +import org.eclipse.birt.report.engine.css.engine.value.Value; + +/** + * class to handle the CSS properties of background image type + * + * @since 3.3 + * + */ +public class BackgroundImageType extends IdentifierManager { + + /** + * The identifier values. + */ + protected final static StringMap values = new StringMap(); + static { + // CSSConstants.CSS_BACKGROUND_IMAGE_TYPE_PROPERTY + values.put(CSSConstants.CSS_URL_VALUE, CSSValueConstants.URL_VALUE); + values.put(CSSConstants.CSS_EMBED_VALUE, CSSValueConstants.EMBED_VALUE); + } + + @Override + public StringMap getIdentifiers() { + return values; + } + + /** + * constructor of the new identifier manager of the backround image type + */ + public BackgroundImageType() { + } + + @Override + public String getPropertyName() { + return CSSConstants.CSS_BACKGROUND_IMAGE_TYPE_PROPERTY; + } + + @Override + public boolean isInheritedProperty() { + return false; + } + + @Override + public Value getDefaultValue() { + return CSSValueConstants.URL_VALUE; + } +} diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSConstants.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSConstants.java index 1defb4d3325..55f958a4a11 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSConstants.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSConstants.java @@ -26,6 +26,7 @@ public interface CSSConstants { String CSS_BACKGROUND_ATTACHMENT_PROPERTY = "background-attachment"; String CSS_BACKGROUND_COLOR_PROPERTY = "background-color"; String CSS_BACKGROUND_IMAGE_PROPERTY = "background-image"; + String CSS_BACKGROUND_IMAGE_TYPE_PROPERTY = "background-image-type"; String CSS_BACKGROUND_REPEAT_PROPERTY = "background-repeat"; String CSS_BACKGROUND_REPEAT_X_PROPERTY = "background-repeat-x"; String CSS_BACKGROUND_REPEAT_Y_PROPERTY = "background-repeat-y"; @@ -345,4 +346,6 @@ public interface CSSConstants { String CSS_HEIGHT_PROPERTY = "height"; String CSS_WIDTH_PROPERTY = "width"; + String CSS_URL_VALUE = "url"; + } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSValueConstants.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSValueConstants.java index e4376d6671b..649ce4bcad1 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSValueConstants.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSValueConstants.java @@ -931,4 +931,10 @@ public interface CSSValueConstants { * the "hidden" value for overflow */ Value OVERFLOW_HIDDEN_VALUE = new StringValue(CSSPrimitiveValue.CSS_IDENT, CSSConstants.CSS_OVERFLOW_HIDDEN_VALUE); + + /** + * The 'url' keyword. + */ + Value URL_VALUE = new StringValue(CSSPrimitiveValue.CSS_IDENT, CSSConstants.CSS_URL_VALUE); + } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/PageArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/PageArea.java index a20bd5a797c..c2753ecc961 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/PageArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/PageArea.java @@ -39,11 +39,7 @@ import org.eclipse.birt.report.engine.nLayout.area.style.BoxStyle; import org.eclipse.birt.report.engine.util.ResourceLocatorWrapper; import org.eclipse.birt.report.model.api.ReportDesignHandle; -import org.eclipse.birt.report.model.api.elements.structures.EmbeddedImage; import org.eclipse.birt.report.model.core.Module; -import org.eclipse.birt.report.model.metadata.MetaDataDictionary; -import org.eclipse.birt.report.model.metadata.StructureDefn; -import org.eclipse.birt.report.model.util.StructureRefUtil; import com.lowagie.text.Image; @@ -200,12 +196,12 @@ public void initialize() throws BirtException { String imageUrl = EmitterUtil.getBackgroundImageUrl(style, designHandle, pageContent.getReportContent().getReportContext() == null ? null : pageContent.getReportContent().getReportContext().getAppContext()); + if (backgroundColor != null || imageUrl != null) { boxStyle = new BoxStyle(); boxStyle.setBackgroundColor(backgroundColor); if (imageUrl != null) { boxStyle.setBackgroundImage(createBackgroundImage(imageUrl, designHandle.getModule())); - // boxStyle.setBackgroundImage(createBackgroundImage(imageUrl)); } } context.setMaxHeight(root.getHeight()); @@ -228,34 +224,28 @@ public void initialize() throws BirtException { context.resetUnresolvedRowHints(); } - public byte[] loadAsEmbeddedImage(String url, Module module) { - StructureDefn defn = (StructureDefn) MetaDataDictionary.getInstance() - .getStructure(EmbeddedImage.EMBEDDED_IMAGE_STRUCT); - byte[] imageData = null; - try { - EmbeddedImage ei = (EmbeddedImage) StructureRefUtil.findStructure(module, defn, url); - imageData = ei.getData(module); - } catch (Exception te) { - imageData = null; - } - return imageData; - } - + /* + * + * + * public byte[] loadAsEmbeddedImage(String url, Module module) { StructureDefn + * defn = (StructureDefn) MetaDataDictionary.getInstance() + * .getStructure(EmbeddedImage.EMBEDDED_IMAGE_STRUCT); byte[] imageData = null; + * try { EmbeddedImage ei = (EmbeddedImage) + * StructureRefUtil.findStructure(module, defn, url); imageData = + * ei.getData(module); } catch (Exception te) { imageData = null; } return + * imageData; } + */ protected BackgroundImageInfo createBackgroundImage(String url, Module module) { ResourceLocatorWrapper rl = null; ExecutionContext exeContext = ((ReportContent) content.getReportContent()).getExecutionContext(); if (exeContext != null) { rl = exeContext.getResourceLocator(); } + IStyle cs = pageContent.getComputedStyle(); BackgroundImageInfo backgroundImage = null; - byte[] imageData = loadAsEmbeddedImage( url, module ); - if ( imageData != null ) { - backgroundImage = new BackgroundImageInfo( url, cs.getProperty( IStyle.STYLE_BACKGROUND_REPEAT ), 0, 0, 0, 0, rl, imageData); - } else { - backgroundImage = new BackgroundImageInfo( url, cs.getProperty( IStyle.STYLE_BACKGROUND_REPEAT ), 0, 0, 0, 0, rl ); - } -// BackgroundImageInfo backgroundImage = new BackgroundImageInfo(url, cs.getProperty(IStyle.STYLE_BACKGROUND_REPEAT), 0, 0, 0, 0, rl); + backgroundImage = new BackgroundImageInfo(url, cs.getProperty(IStyle.STYLE_BACKGROUND_REPEAT), 0, 0, 0, 0, rl, + module, cs.getProperty(IStyle.STYLE_BACKGROUND_IMAGE_TYPE)); Image img = backgroundImage.getImageInstance(); IStyle style = pageContent.getStyle(); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/AreaConstants.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/AreaConstants.java index d5c5d468a46..91f120e99f9 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/AreaConstants.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/AreaConstants.java @@ -22,8 +22,11 @@ public abstract class AreaConstants { public final static int REPEAT_X = 1; public final static int REPEAT_Y = 2; public final static int REPEAT = 3; + public final static String URL = "url"; + public final static String EMBED = "embed"; public static HashMap repeatMap = new HashMap<>(); + public static HashMap bgiSourceTypeMap = new HashMap<>(); static { repeatMap.put(IStyle.NO_REPEAT_VALUE, NO_REPEAT); @@ -32,6 +35,11 @@ public abstract class AreaConstants { repeatMap.put(IStyle.REPEAT_VALUE, REPEAT); } + static { + bgiSourceTypeMap.put(IStyle.URL_VALUE, URL); + bgiSourceTypeMap.put(IStyle.EMBED_VALUE, EMBED); + } + /** * the "dotted" value */ diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java index a5f4afea639..644aa18849c 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java @@ -20,13 +20,29 @@ import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.util.Base64.Decoder; +import java.util.Base64.Encoder; +import org.eclipse.birt.report.engine.content.IStyle; import org.eclipse.birt.report.engine.util.ResourceLocatorWrapper; import org.eclipse.birt.report.engine.util.SvgFile; +import org.eclipse.birt.report.model.api.elements.structures.EmbeddedImage; +import org.eclipse.birt.report.model.core.Module; +import org.eclipse.birt.report.model.metadata.MetaDataDictionary; +import org.eclipse.birt.report.model.metadata.StructureDefn; +import org.eclipse.birt.report.model.util.StructureRefUtil; import org.w3c.dom.css.CSSValue; import com.lowagie.text.Image; +/** + * Representation of the background image information includes attributes and + * image data to build the images + * + * @since 3.3 + * + */ public class BackgroundImageInfo extends AreaConstants { protected int xOffset = 0; protected int yOffset = 0; @@ -34,14 +50,45 @@ public class BackgroundImageInfo extends AreaConstants { protected int width = 0; protected int height = 0; protected String url; + protected String dataUrl; protected byte[] imageData; + protected String sourceType; + protected String mimeType; + protected String fileExtension; + + private final static String DATA_PROTOCOL = "data:"; + + // mapping based on image extension: to MIME-type to default extension + private final static String[][] SUPPORTED_MIME_TYPES = { { ".jpg", "image/jpeg", "jpg" }, + { ".jpe", "image/jpeg", "jpg" }, { ".jpeg", "image/jpeg", "jpg" }, { ".tiff", "image/tiff", "tiff" }, + { ".svg", "image/svg+xml", "svg" }, { ".png", "image/png", "png" }, { ".gif", "image/gif", "gif" } }; + /** + * Roter Punkt + */ + protected final static String BGI_SOURCE_TYPE_DEFAULT = "url"; + + private Module module = null; - private Image image; + private Image image = null; private ResourceLocatorWrapper rl = null; + /** + * constructor 01 of background image + * + * @param url + * @param repeatedMode + * @param xOffset + * @param yOffset + * @param height + * @param width + * @param rl + * @param sourceType + */ public BackgroundImageInfo(String url, int repeatedMode, int xOffset, int yOffset, int height, int width, - ResourceLocatorWrapper rl) { + ResourceLocatorWrapper rl, String sourceType) { this.xOffset = xOffset; this.yOffset = yOffset; this.repeatedMode = repeatedMode; @@ -49,11 +96,29 @@ public BackgroundImageInfo(String url, int repeatedMode, int xOffset, int yOffse this.height = height; this.url = url; this.rl = rl; + if (sourceType != null) { + this.sourceType = sourceType; + } else { + this.sourceType = BGI_SOURCE_TYPE_DEFAULT; + } prepareImageByteArray(); } + /** + * constructor 02 of background image + * + * @param url + * @param repeatedMode + * @param xOffset + * @param yOffset + * @param height + * @param width + * @param rl + * @param module + * @param sourceType + */ public BackgroundImageInfo(String url, int repeatedMode, int xOffset, int yOffset, int height, int width, - ResourceLocatorWrapper rl, byte[] imageData) { + ResourceLocatorWrapper rl, Module module, String sourceType) { this.xOffset = xOffset; this.yOffset = yOffset; this.repeatedMode = repeatedMode; @@ -61,14 +126,24 @@ public BackgroundImageInfo(String url, int repeatedMode, int xOffset, int yOffse this.height = height; this.url = url; this.rl = rl; - this.imageData = imageData; - try { - this.image = Image.getInstance(imageData); - } catch (Exception e) { - prepareImageByteArray(); + this.module = module; + if (sourceType != null) { + this.sourceType = sourceType; + } else { + this.sourceType = BGI_SOURCE_TYPE_DEFAULT; } + prepareImageByteArray(); + /* + * this.imageData = imageData; try { this.image = Image.getInstance(imageData); + * } catch (Exception e) { prepareImageByteArray(); } + */ } + /** + * constructor 03 of background image + * + * @param bgi + */ public BackgroundImageInfo(BackgroundImageInfo bgi) { this.xOffset = bgi.xOffset; this.yOffset = bgi.yOffset; @@ -79,32 +154,170 @@ public BackgroundImageInfo(BackgroundImageInfo bgi) { this.imageData = bgi.imageData; this.image = bgi.image; this.rl = bgi.rl; + if (bgi.sourceType != null) { + this.sourceType = bgi.sourceType; + } else { + this.sourceType = BGI_SOURCE_TYPE_DEFAULT; + } } + /** + * constructor 04 of background image + * + * @param url + * @param mode + * @param xOffset + * @param yOffset + * @param height + * @param width + * @param rl + */ public BackgroundImageInfo(String url, CSSValue mode, int xOffset, int yOffset, int height, int width, ResourceLocatorWrapper rl) { - this(url, mode != null ? repeatMap.get(mode) : REPEAT, xOffset, yOffset, height, width, rl); + this(url, mode != null ? repeatMap.get(mode) : REPEAT, xOffset, yOffset, height, width, rl, + BGI_SOURCE_TYPE_DEFAULT); + } + + /** + * constructor 05 of background image + * + * @param url + * @param height + * @param width + * @param rl + */ + public BackgroundImageInfo(String url, int height, int width, ResourceLocatorWrapper rl) { + this(url, 0, 0, 0, height, width, rl, BGI_SOURCE_TYPE_DEFAULT); } + /** + * constructor 06 of background image + * + * @param url + * @param mode + * @param xOffset + * @param yOffset + * @param height + * @param width + * @param rl + * @param module + */ public BackgroundImageInfo(String url, CSSValue mode, int xOffset, int yOffset, int height, int width, - ResourceLocatorWrapper rl, byte[] imageData) { - this(url, mode != null ? repeatMap.get(mode) : REPEAT, xOffset, yOffset, height, width, rl, imageData); + ResourceLocatorWrapper rl, Module module) { + this(url, mode != null ? repeatMap.get(mode) : REPEAT, xOffset, yOffset, height, width, rl, module, + BGI_SOURCE_TYPE_DEFAULT); + } + /** + * constructor 07 of background image + * + * @param url + * @param mode + * @param xOffset + * @param yOffset + * @param height + * @param width + * @param rl + * @param sourceType + */ + public BackgroundImageInfo(String url, CSSValue mode, int xOffset, int yOffset, int height, int width, + ResourceLocatorWrapper rl, String sourceType) { + this(url, mode != null ? repeatMap.get(mode) : REPEAT, xOffset, yOffset, height, width, rl, sourceType); } - public BackgroundImageInfo(String url, int height, int width, ResourceLocatorWrapper rl) { - this(url, 0, 0, 0, height, width, rl); + /** + * constructor 08 of background image + * + * @param url + * @param mode + * @param xOffset + * @param yOffset + * @param height + * @param width + * @param rl + * @param module + * @param sourceType + */ + public BackgroundImageInfo(String url, CSSValue mode, int xOffset, int yOffset, int height, int width, + ResourceLocatorWrapper rl, Module module, CSSValue sourceType) { + this(url, mode != null ? repeatMap.get(mode) : REPEAT, xOffset, yOffset, height, width, rl, module, + sourceType.toString()); } + /** + * Set the resource locator + * + * @param rl set the resource locator + */ public void setResourceLocator(ResourceLocatorWrapper rl) { this.rl = rl; } + private void createDataUrl() { + + if (this.url != null && this.url.contains(DATA_PROTOCOL)) { + this.dataUrl = this.url; + + } else if (this.imageData != null) { + Encoder encoder = java.util.Base64.getEncoder(); + this.dataUrl = DATA_PROTOCOL + this.mimeType + ";base64," + + (new String(encoder.encode(this.imageData), StandardCharsets.UTF_8)); + } + } + + /** + * Get the data url of the image + * + * @return Return the data url of the image + */ + public String getDataUrl() { + return this.dataUrl; + } + + private void setMimeType(String mimeType) { + + if (mimeType != null) { + this.mimeType = mimeType; + + } else if (this.url.contains(DATA_PROTOCOL)) { + String partMimeType = url.split(";")[1]; + this.mimeType = partMimeType.split(DATA_PROTOCOL)[0]; + + } else { + for (int index = 0; index < SUPPORTED_MIME_TYPES.length; index++) { + if (this.url.toLowerCase().contains(SUPPORTED_MIME_TYPES[index][0])) { + this.mimeType = SUPPORTED_MIME_TYPES[index][1]; + this.fileExtension = SUPPORTED_MIME_TYPES[index][2]; + break; + } + } + } + } + private void prepareImageByteArray() { - if (rl == null) { + String mimeType = null; + + // get embedded image on report level + if (this.sourceType.equals(IStyle.EMBED_VALUE.getCssText()) && !this.url.contains(DATA_PROTOCOL)) { + StructureDefn defn = (StructureDefn) MetaDataDictionary.getInstance() + .getStructure(EmbeddedImage.EMBEDDED_IMAGE_STRUCT); + byte[] imageData = null; + try { + EmbeddedImage ei = (EmbeddedImage) StructureRefUtil.findStructure(this.module, defn, this.url); + imageData = ei.getData(this.module); + mimeType = ei.getType(this.module); + } catch (Exception te) { + this.imageData = null; + this.image = null; + this.mimeType = null; + return; + } + this.imageData = imageData; + + } else if (this.rl == null) { InputStream in = null; try { - in = new URL(url).openStream(); + in = new URL(this.url).openStream(); ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int size = in.read(buffer); @@ -112,11 +325,12 @@ private void prepareImageByteArray() { out.write(buffer, 0, size); size = in.read(buffer); } - imageData = out.toByteArray(); + this.imageData = out.toByteArray(); out.close(); } catch (IOException ioe) { - imageData = null; - image = null; + this.imageData = null; + this.image = null; + this.mimeType = null; return; } finally { if (in != null) { @@ -126,77 +340,185 @@ private void prepareImageByteArray() { } } } + } else { - try { - imageData = rl.findResource(new URL(url)); - } catch (MalformedURLException mue) { - imageData = null; - image = null; - return; + if (this.url.contains(DATA_PROTOCOL)) { + String[] imageDataArray = this.url.split(";base64,"); + String imageDataBase64 = imageDataArray[1]; + Decoder decoder = java.util.Base64.getDecoder(); + this.imageData = decoder.decode(imageDataBase64); + this.mimeType = this.url.split(";base64,")[0].split(DATA_PROTOCOL)[1]; + } else { + try { + this.imageData = this.rl.findResource(new URL(this.url)); + } catch (MalformedURLException mue) { + this.imageData = null; + this.image = null; + this.mimeType = null; + } } } - - try { - - image = Image.getInstance(imageData); - } catch (Exception e) { + if (this.imageData != null) { try { - imageData = SvgFile.transSvgToArray(new ByteArrayInputStream(imageData)); - image = Image.getInstance(imageData); - } catch (Exception te) { - imageData = null; - image = null; + this.image = Image.getInstance(this.imageData); + } catch (Exception e) { + try { + this.imageData = SvgFile.transSvgToArray(new ByteArrayInputStream(this.imageData)); + this.image = Image.getInstance(this.imageData); + } catch (Exception te) { + this.imageData = null; + this.image = null; + this.mimeType = null; + } } } - + this.setMimeType(mimeType); + this.createDataUrl(); } +// setMIMEType + /** + * Get the image instance + * + * @return Return the image instance + */ public Image getImageInstance() { return image; } + /** + * Get the background image offset position X + * + * @return Return the background image offset position X + */ public int getXOffset() { return xOffset; } - public void setYOffset(int y) { - this.yOffset = y; - } - + /** + * Set the background image offset position X + * + * @param x set the background image offset position X + */ public void setXOffset(int x) { this.xOffset = x; } + /** + * Get the background image offset position Y + * + * @return Return the background image offset position Y + */ public int getYOffset() { return yOffset; } + /** + * Set the background image offset position Y + * + * @param y set the background image offset position Y + */ + public void setYOffset(int y) { + this.yOffset = y; + } + + /** + * Get the background image height + * + * @return Return the background image height + */ public int getHeight() { return height; } + /** + * Set the background image height + * + * @param height height of the background image + */ public void setHeight(int height) { this.height = height; } + /** + * Get the background image width + * + * @return Return the background image width + */ public int getWidth() { return width; } + /** + * Set the background image width + * + * @param width width of the background image + */ public void setWidth(int width) { this.width = width; } + /** + * Get the background image repeat mode + * + * @return Return the background image repeat mode + */ public int getRepeatedMode() { return repeatedMode; } + /** + * Set the source type of the background image + * + * @param sourceType String of the image source type + */ + public void setSourceType(String sourceType) { + this.sourceType = bgiSourceTypeMap.get(sourceType); + } + + /** + * Get the source type of the background image + * + * @return Returned the source type of the image + */ + public String getSourceType() { + return this.sourceType; + } + + /** + * Get the extension of the image file + * + * @return Returned the extension of the image file + */ + public String getFileExtension() { + return this.fileExtension; + } + + /** + * Get the image mime type + * + * @return Returned the image mime type + */ + public String getMimeType() { + return this.mimeType; + } + + /** + * Get the url string + * + * @return Return the url string + */ public String getUrl() { - return url; + return this.url; } + /** + * Get the image byte array + * + * @return Return the image data ByteArray + */ public byte[] getImageData() { - return imageData; + return this.imageData; } } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/EngineIRVisitor.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/EngineIRVisitor.java index 5a95b491903..3f90c0b09ae 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/EngineIRVisitor.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/EngineIRVisitor.java @@ -2079,10 +2079,10 @@ private void populateElementProperty(ReportElementHandle handle, StyledElementDe String propertyName) { boolean isColorProperty = StyleUtil.colorProperties.contains(propertyName); String elementProperty = getElementProperty(handle, propertyName, isColorProperty); - populateStyle(design, style, propertyName, elementProperty); + populateStyle(style, propertyName, elementProperty); } - private void populateStyle(StyledElementDesign design, IStyle style, String propertyName, String elementProperty) { + private void populateStyle(IStyle style, String propertyName, String elementProperty) { int propertyIndex = StyleUtil.styleName2Index.get(propertyName); // TODO need support the expression style // if ( elementProperty.isExpression( ) ) @@ -2182,7 +2182,7 @@ private void populateHighlightStyle(StyledElementDesign design, StructureHandle String propertyName) { Module module = design.getHandle().getModule(); String property = getMemberProperty(module, highlight, propertyName); - populateStyle(design, style, propertyName, property); + populateStyle(style, propertyName, property); } protected DimensionType createDimension(DimensionHandle handle, boolean useDefault) { @@ -2262,6 +2262,7 @@ protected void createReportDefaultStyles(ReportDesignHandle reportDesignHandle) addReportDefaultPropertyValue(Style.BACKGROUND_POSITION_X_PROP, handle); addReportDefaultPropertyValue(Style.BACKGROUND_POSITION_Y_PROP, handle); addReportDefaultPropertyValue(Style.BACKGROUND_REPEAT_PROP, handle); + addReportDefaultPropertyValue(Style.BACKGROUND_IMAGE_TYPE_PROP, handle); // bidi_hcg: Bidi related. addReportDefaultPropertyValue(Style.TEXT_DIRECTION_PROP, handle); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/StylePropertyMapping.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/StylePropertyMapping.java index 335377774a6..d7d751dce8a 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/StylePropertyMapping.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/StylePropertyMapping.java @@ -44,6 +44,8 @@ public class StylePropertyMapping { nameMapping.put(IStyleModel.COLOR_PROP, Integer.valueOf(StyleConstants.STYLE_COLOR)); nameMapping.put(IStyleModel.BACKGROUND_COLOR_PROP, Integer.valueOf(StyleConstants.STYLE_BACKGROUND_COLOR)); nameMapping.put(IStyleModel.BACKGROUND_IMAGE_PROP, Integer.valueOf(StyleConstants.STYLE_BACKGROUND_IMAGE)); + nameMapping.put(IStyleModel.BACKGROUND_IMAGE_TYPE_PROP, + Integer.valueOf(StyleConstants.STYLE_BACKGROUND_IMAGE_TYPE)); nameMapping.put(IStyleModel.BACKGROUND_REPEAT_PROP, Integer.valueOf(StyleConstants.STYLE_BACKGROUND_REPEAT)); nameMapping.put(IStyleModel.BACKGROUND_ATTACHMENT_PROP, Integer.valueOf(StyleConstants.STYLE_BACKGROUND_ATTACHMENT)); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/StyleUtil.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/StyleUtil.java index 84d58893643..500f5db0991 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/StyleUtil.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/StyleUtil.java @@ -46,6 +46,7 @@ public static void main(String[] args) { styleName2Index.put(Style.BACKGROUND_ATTACHMENT_PROP, StyleConstants.STYLE_BACKGROUND_ATTACHMENT); styleName2Index.put(Style.BACKGROUND_COLOR_PROP, StyleConstants.STYLE_BACKGROUND_COLOR); styleName2Index.put(Style.BACKGROUND_IMAGE_PROP, StyleConstants.STYLE_BACKGROUND_IMAGE); + styleName2Index.put(Style.BACKGROUND_IMAGE_TYPE_PROP, StyleConstants.STYLE_BACKGROUND_IMAGE_TYPE); styleName2Index.put(Style.BACKGROUND_SIZE_HEIGHT, StyleConstants.STYLE_BACKGROUND_HEIGHT); styleName2Index.put(Style.BACKGROUND_SIZE_WIDTH, StyleConstants.STYLE_BACKGROUND_WIDTH); styleName2Index.put(Style.BACKGROUND_POSITION_X_PROP, StyleConstants.STYLE_BACKGROUND_POSITION_X); From 98ab629146cb621a0f6fa92a37d3f974f2ecce86 Mon Sep 17 00:00:00 2001 From: Thomas Gutmann Date: Mon, 16 Jan 2023 22:14:08 +0100 Subject: [PATCH 03/12] enhancement of background images with embedded images (discussion #1175) --- .../report/designer/util/ImageManager.java | 16 +- .../editparts/ReportElementEditPart.java | 58 +- .../schematic/layer/TableGridLayer.java | 57 +- .../reportitem/ui/ChartReportItemUIUtil.java | 27 +- .../META-INF/MANIFEST.MF | 2 - .../engine/emitter/html/AttributeBuilder.java | 39 +- .../emitter/html/HTMLReportEmitter.java | 253 +-- .../report/engine/emitter/pdf/PDFPage.java | 92 +- .../birt/report/engine/api/IRenderOption.java | 95 +- .../birt/report/engine/api/ITaskOption.java | 12 +- .../birt/report/engine/api/RenderOption.java | 16 +- .../birt/report/engine/api/TOCStyle.java | 357 +++- .../birt/report/engine/api/TaskOption.java | 21 +- .../api/script/instance/IScriptStyle.java | 220 ++- .../birt/report/engine/content/IStyle.java | 234 +++ .../report/engine/css/dom/AbstractStyle.java | 63 +- .../engine/css/dom/StyleDeclaration.java | 16 + .../engine/css/engine/StyleConstants.java | 131 ++ .../css/engine/value/birt/BIRTConstants.java | 54 + .../engine/value/css/BackgroundImageType.java | 3 +- .../css/engine/value/css/CSSConstants.java | 1468 +++++++++++++---- .../engine/value/css/CSSValueConstants.java | 6 + .../layout/emitter/PageDeviceRender.java | 164 +- .../engine/layout/pdf/util/PropertyUtil.java | 214 ++- .../nLayout/area/impl/AbstractArea.java | 126 +- .../nLayout/area/impl/BlockContainerArea.java | 120 +- .../engine/nLayout/area/impl/CellArea.java | 105 +- .../nLayout/area/impl/ContainerArea.java | 490 ++++-- .../area/impl/ForeignHtmlRegionArea.java | 28 +- .../nLayout/area/impl/HtmlRegionArea.java | 17 +- .../nLayout/area/impl/InlineStackingArea.java | 63 +- .../engine/nLayout/area/impl/LineArea.java | 58 +- .../engine/nLayout/area/impl/PageArea.java | 157 +- .../engine/nLayout/area/impl/RegionArea.java | 11 +- .../nLayout/area/impl/RepeatableArea.java | 52 +- .../engine/nLayout/area/impl/RootArea.java | 18 + .../engine/nLayout/area/impl/RowArea.java | 123 +- .../engine/nLayout/area/impl/TableArea.java | 170 +- .../nLayout/area/impl/TextLineArea.java | 28 +- .../nLayout/area/style/AreaConstants.java | 110 +- .../area/style/BackgroundImageInfo.java | 248 ++- .../engine/nLayout/area/style/BoxStyle.java | 137 ++ .../internal/instance/StyleInstance.java | 31 + .../api/elements/DesignChoiceConstants.java | 1269 +++++++++++++- .../report/model/api/simpleapi/IStyle.java | 22 +- .../elements/interfaces/IStyleModel.java | 213 ++- .../birt/report/model/simpleapi/Style.java | 45 + .../core/script/internal/StyleInstance.java | 29 + 48 files changed, 6007 insertions(+), 1281 deletions(-) diff --git a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java index 5dd3572b082..bc36e32048f 100644 --- a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java +++ b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java @@ -78,7 +78,7 @@ public static ImageManager getInstance() { * @param uri * @return Return the image */ - public Image getImage(ModuleHandle handle, String uri) { + public Image getImage(ModuleHandle handle, String uri) { // TG, Module model) { return getImage(handle, uri, false); } @@ -95,7 +95,6 @@ public Image getImage(ModuleHandle handle, String uri, boolean refresh) { URL url = null; try { - if (uri.contains(DATA_PROTOCOL)) { image = getEmbeddedImageDataURL(uri, refresh); } else { @@ -142,10 +141,10 @@ private Image getImageFromURL(URL url, boolean refresh) throws IOException { /** * Gets the image by the given URI * - * @param uri the url of the image file + * @param uri the uri of the image file * @param refresh mark if refresh necessary * - * @return Returns the image,or null if the url is invalid or the file format is + * @return Returns the image or null if the uri is invalid or the file format is * unsupported. */ public Image getImage(String uri, boolean refresh) { @@ -248,6 +247,14 @@ public Image getEmbeddedImage(ModuleHandle handle, String name) { return image; } + /** + * Get the embedded image of the data URL + * + * @param url data URL of the image + * @param refresh refresh the image data or use image cache + * @return Return the embedded image + * @throws IOException + */ public Image getEmbeddedImageDataURL(String url, boolean refresh) throws IOException { if ((url == null) || (!refresh && invalidUrlList.contains(url))) { return null; @@ -481,7 +488,6 @@ public URL generateURL(ModuleHandle designHandle, String uri) throws MalformedUR return new URL(uri); } catch (MalformedURLException e) { String path = URIUtil.getLocalPath(uri); - if (designHandle == null) { designHandle = SessionHandleAdapter.getInstance().getReportDesignHandle(); } diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java index 3d2dc44a515..ee5154d8a1c 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java @@ -625,40 +625,36 @@ protected void refreshBackgroundColor(DesignElementHandle handle) { } } + /* + * Get background image + * + */ protected Image getBackImage(DesignElementHandle handle) { String backGroundImage = getBackgroundImage(handle); if (backGroundImage == null) { return null; } + Image image = null; + + String imageSourceType = DesignChoiceConstants.IMAGE_REF_TYPE_EMBED; Object obj = handle.getProperty(IStyleModel.BACKGROUND_IMAGE_TYPE_PROP); - String imageSourceType = CSSValueConstants.URL_VALUE.getCssText(); if (obj instanceof String) { imageSourceType = obj.toString(); } - - Image image = null; - - // URL image - if (imageSourceType.equalsIgnoreCase(CSSValueConstants.URL_VALUE.getCssText())) { - try { + try { + if (imageSourceType.equalsIgnoreCase(CSSValueConstants.URL_VALUE.getCssText())) { image = ImageManager.getInstance().getImage(getModelAdapter().getModuleHandle(), backGroundImage); - } catch (SWTException e) { - // Should not be ExceptionHandler.handle(e), see SCR#73730 - image = null; } - } - - // embedded image - if (imageSourceType.equalsIgnoreCase(CSSValueConstants.EMBED_VALUE.getCssText())) { - try { + if (imageSourceType.equalsIgnoreCase(CSSValueConstants.EMBED_VALUE.getCssText()) || image == null) { image = ImageManager.getInstance().getEmbeddedImage(getModelAdapter().getModuleHandle(), backGroundImage); - } catch (SWTException e) { - // Should not be ExceptionHandler.handle(e), see SCR#73730 - image = null; } + } catch (SWTException e) { + // Should not be ExceptionHandler.handle(e), see SCR#73730 + image = null; } + return image; } @@ -675,24 +671,24 @@ protected void refreshBackgroundImage(DesignElementHandle handle) { figure.setImage(null); } - Image image = null; - // URL image - try { - image = ImageManager.getInstance().getImage(getModelAdapter().getModuleHandle(), backGroundImage); - } catch (SWTException e) { - // Should not be ExceptionHandler.handle(e), see SCR#73730 - image = null; + Object obj = handle.getProperty(IStyleModel.BACKGROUND_IMAGE_TYPE_PROP); + String imageSourceType = CSSValueConstants.URL_VALUE.getCssText(); + if (obj instanceof String) { + imageSourceType = obj.toString(); } + Image image = null; - // embedded image - if (image == null) { - try { + try { + if (imageSourceType.equalsIgnoreCase(CSSValueConstants.URL_VALUE.getCssText())) { + image = ImageManager.getInstance().getImage(getModelAdapter().getModuleHandle(), backGroundImage); + } + if (imageSourceType.equalsIgnoreCase(CSSValueConstants.EMBED_VALUE.getCssText()) || image == null) { image = ImageManager.getInstance().getEmbeddedImage(getModelAdapter().getModuleHandle(), backGroundImage); - } catch (SWTException e) { - // Should not be ExceptionHandler.handle(e), see SCR#73730 - image = null; } + } catch (SWTException e) { + // Should not be ExceptionHandler.handle(e), see SCR#73730 + image = null; } if (image == null) { diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/layer/TableGridLayer.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/layer/TableGridLayer.java index 826951d5fe9..beef475ca9b 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/layer/TableGridLayer.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/layer/TableGridLayer.java @@ -31,8 +31,9 @@ import org.eclipse.birt.report.model.api.ColumnHandle; import org.eclipse.birt.report.model.api.DesignElementHandle; import org.eclipse.birt.report.model.api.RowHandle; -import org.eclipse.birt.report.model.api.StyleHandle; +import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; import org.eclipse.birt.report.model.api.metadata.DimensionValue; +import org.eclipse.birt.report.model.elements.interfaces.IStyleModel; import org.eclipse.draw2d.Graphics; import org.eclipse.draw2d.PositionConstants; import org.eclipse.draw2d.geometry.Dimension; @@ -53,8 +54,7 @@ public class TableGridLayer extends GridLayer { /** * Constructor * - * @param rows - * @param cells + * @param source */ public TableGridLayer(TableEditPart source) { super(); @@ -62,16 +62,20 @@ public TableGridLayer(TableEditPart source) { } /** + * Get the rows of the table + * * @return rows */ - public List getRows() { + public List getRows() { return source.getRows(); } /** + * Get the columns of the table + * * @return columns */ - public List getColumns() { + public List getColumns() { return source.getColumns(); } @@ -99,7 +103,7 @@ protected void paintGrid(Graphics g) { protected void drawRows(Graphics g) { Rectangle clip = g.getClip(Rectangle.SINGLETON); - List rows = getRows(); + List rows = getRows(); int size = rows.size(); int height = 0; for (int i = 0; i < size; i++) { @@ -124,10 +128,25 @@ private void drawBackgroudImage(DesignElementHandle handle, Graphics g, int x, i if (backGroundImage != null) { Image image = null; + String imageSourceType = DesignChoiceConstants.IMAGE_REF_TYPE_EMBED; + + // TODO: columns of table & grid missing the background image type property + Object obj = handle.getProperty(IStyleModel.BACKGROUND_IMAGE_TYPE_PROP); + if (obj instanceof String) { + imageSourceType = obj.toString(); + } try { - image = ImageManager.getInstance().getImage(this.source.getTableAdapter().getModuleHandle(), - backGroundImage); + if (imageSourceType.equalsIgnoreCase(DesignChoiceConstants.IMAGE_REF_TYPE_EMBED)) { + // embedded image + image = ImageManager.getInstance().getEmbeddedImage(this.source.getTableAdapter().getModuleHandle(), + backGroundImage); + } else { + // URL image + image = ImageManager.getInstance().getImage(this.source.getTableAdapter().getModuleHandle(), + backGroundImage); + } } catch (SWTException e) { + // Should not be ExceptionHandler.handle(e), see SCR#73730 image = null; } @@ -202,14 +221,14 @@ private void drawBackgroudImage(DesignElementHandle handle, Graphics g, int x, i } } - ArrayList xyList = createImageList(tx, ty, size, repeat, rectangle); + ArrayList xyList = createImageList(tx, ty, size, repeat, rectangle); - Iterator iter = xyList.iterator(); + Iterator iter = xyList.iterator(); Rectangle rect = new Rectangle(); g.getClip(rect); g.setClip(rectangle); while (iter.hasNext()) { - Point point = (Point) iter.next(); + Point point = iter.next(); g.drawImage(image, point); } g.setClip(rect); @@ -228,10 +247,10 @@ private void drawBackgroudImage(DesignElementHandle handle, Graphics g, int x, i * @param rectangle * @return the list of all the images to be displayed. */ - private ArrayList createImageList(int x, int y, Dimension size, int repeat, Rectangle rectangle) { + private ArrayList createImageList(int x, int y, Dimension size, int repeat, Rectangle rectangle) { Rectangle area = rectangle; - ArrayList yList = new ArrayList(); + ArrayList yList = new ArrayList(); if ((repeat & ImageConstants.REPEAT_Y) == 0) { yList.add(new Point(x, y)); @@ -249,11 +268,11 @@ private ArrayList createImageList(int x, int y, Dimension size, int repeat, Rect } } - ArrayList xyList = new ArrayList(); + ArrayList xyList = new ArrayList(); - Iterator iter = yList.iterator(); + Iterator iter = yList.iterator(); while (iter.hasNext()) { - Point point = (Point) iter.next(); + Point point = iter.next(); if ((repeat & ImageConstants.REPEAT_X) == 0) { xyList.add(point); @@ -323,7 +342,7 @@ private int getBackgroundRepeat(DesignElementHandle handle) { protected void drawColumns(Graphics g) { g.setBackgroundColor(ReportColorConstants.greyFillColor); Rectangle clip = g.getClip(Rectangle.SINGLETON); - List columns = getColumns(); + List columns = getColumns(); int size = columns.size(); int width = 0; for (int i = 0; i < size; i++) { @@ -358,7 +377,7 @@ private void drawBackgroud(Object model, Graphics g, int x, int y, int width, in assert model instanceof DesignElementHandle; DesignElementHandle handle = (DesignElementHandle) model; - Object obj = handle.getProperty(StyleHandle.BACKGROUND_COLOR_PROP); + Object obj = handle.getProperty(IStyleModel.BACKGROUND_COLOR_PROP); if (obj != null) { Rectangle rect = new Rectangle(x, y, width, height); @@ -372,7 +391,7 @@ private void drawBackgroud(Object model, Graphics g, int x, int y, int width, in // { // color = ( (Integer) obj ).intValue( ); // } - color = handle.getPropertyHandle(StyleHandle.BACKGROUND_COLOR_PROP).getIntValue(); + color = handle.getPropertyHandle(IStyleModel.BACKGROUND_COLOR_PROP).getIntValue(); g.setBackgroundColor(ColorManager.getColor(color)); g.fillRectangle(rect); } diff --git a/chart/org.eclipse.birt.chart.reportitem.ui/src/org/eclipse/birt/chart/reportitem/ui/ChartReportItemUIUtil.java b/chart/org.eclipse.birt.chart.reportitem.ui/src/org/eclipse/birt/chart/reportitem/ui/ChartReportItemUIUtil.java index cb54a88f37c..470d377f2d6 100644 --- a/chart/org.eclipse.birt.chart.reportitem.ui/src/org/eclipse/birt/chart/reportitem/ui/ChartReportItemUIUtil.java +++ b/chart/org.eclipse.birt.chart.reportitem.ui/src/org/eclipse/birt/chart/reportitem/ui/ChartReportItemUIUtil.java @@ -35,7 +35,6 @@ import org.eclipse.birt.report.model.api.ReportItemHandle; import org.eclipse.birt.report.model.api.ResultSetColumnHandle; import org.eclipse.birt.report.model.api.StructureFactory; -import org.eclipse.birt.report.model.api.StyleHandle; import org.eclipse.birt.report.model.api.activity.SemanticException; import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; import org.eclipse.birt.report.model.api.elements.structures.ComputedColumn; @@ -43,6 +42,7 @@ import org.eclipse.birt.report.model.api.extension.IReportItem; import org.eclipse.birt.report.model.api.metadata.DimensionValue; import org.eclipse.birt.report.model.api.util.ColorUtil; +import org.eclipse.birt.report.model.elements.interfaces.IStyleModel; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.Rectangle; @@ -144,7 +144,7 @@ public static int getExpressionBuilderStyle(int builderCommand) { * @return background image */ public static String getBackgroundImage(DesignElementHandle handle) { - return handle.getStringProperty(StyleHandle.BACKGROUND_IMAGE_PROP); + return handle.getStringProperty(IStyleModel.BACKGROUND_IMAGE_PROP); } /** @@ -158,8 +158,8 @@ public static Object[] getBackgroundPosition(DesignElementHandle handle) { Object y = null; if (handle != null) { - Object px = handle.getProperty(StyleHandle.BACKGROUND_POSITION_X_PROP); - Object py = handle.getProperty(StyleHandle.BACKGROUND_POSITION_Y_PROP); + Object px = handle.getProperty(IStyleModel.BACKGROUND_POSITION_X_PROP); + Object py = handle.getProperty(IStyleModel.BACKGROUND_POSITION_Y_PROP); if (px instanceof String) { x = px; @@ -195,7 +195,7 @@ public static Object[] getBackgroundPosition(DesignElementHandle handle) { * @return background repeat property */ public static int getBackgroundRepeat(DesignElementHandle handle) { - return getRepeat(handle.getStringProperty(StyleHandle.BACKGROUND_REPEAT_PROP)); + return getRepeat(handle.getStringProperty(IStyleModel.BACKGROUND_REPEAT_PROP)); } /** @@ -219,9 +219,11 @@ public static int getRepeat(String repeat) { * Generate computed columns for the given report item with the closest data set * available. * + * @param handle * @param dataSetHandle Data Set. No aggregation created. * * @return true if succeed,or fail if no column generated. + * @throws SemanticException * @see DataUtil#generateComputedColumns(ReportItemHandle) * */ @@ -273,8 +275,19 @@ public static void refreshBackgroundImage(ExtendedItemHandle handle, ReportEleme figure.setImage(null); } else { Image image = null; + String imageSourceType = DesignChoiceConstants.IMAGE_REF_TYPE_EMBED; + Object obj = handle.getProperty(IStyleModel.BACKGROUND_IMAGE_TYPE_PROP); + if (obj instanceof String) { + imageSourceType = obj.toString(); + } try { - image = ImageManager.getInstance().getImage(handle.getModuleHandle(), backGroundImage); + if (imageSourceType.equalsIgnoreCase(DesignChoiceConstants.IMAGE_REF_TYPE_EMBED)) { + // embedded image + image = ImageManager.getInstance().getEmbeddedImage(handle.getModuleHandle(), backGroundImage); + } else { + // URL image + image = ImageManager.getInstance().getImage(handle.getModuleHandle(), backGroundImage); + } } catch (SWTException e) { // Should not be ExceptionHandler.handle(e), see SCR#73730 image = null; @@ -331,7 +344,7 @@ public static void refreshBackgroundImage(ExtendedItemHandle handle, ReportEleme * @param figure Figure */ public static void refreshBackgroundColor(ExtendedItemHandle handle, IFigure figure) { - Object obj = handle.getProperty(StyleHandle.BACKGROUND_COLOR_PROP); + Object obj = handle.getProperty(IStyleModel.BACKGROUND_COLOR_PROP); figure.setOpaque(false); diff --git a/engine/org.eclipse.birt.report.engine.emitter.html/META-INF/MANIFEST.MF b/engine/org.eclipse.birt.report.engine.emitter.html/META-INF/MANIFEST.MF index 62afb69f1d0..f3fc047a450 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.html/META-INF/MANIFEST.MF +++ b/engine/org.eclipse.birt.report.engine.emitter.html/META-INF/MANIFEST.MF @@ -15,5 +15,3 @@ Require-Bundle: org.eclipse.birt.core;bundle-version="[2.1.0,5.0.0)", Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-11 Automatic-Module-Name: org.eclipse.birt.report.engine.emitter.html -Import-Package: com.lowagie.text - diff --git a/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/AttributeBuilder.java b/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/AttributeBuilder.java index 3d358a15f7d..27b2007a9f0 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/AttributeBuilder.java +++ b/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/AttributeBuilder.java @@ -15,6 +15,9 @@ package org.eclipse.birt.report.engine.emitter.html; import org.eclipse.birt.report.engine.content.IStyle; +import org.eclipse.birt.report.engine.css.engine.StyleConstants; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSConstants; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.emitter.HTMLTags; import org.eclipse.birt.report.engine.ir.DimensionType; import org.w3c.dom.css.CSSValue; @@ -30,6 +33,12 @@ public class AttributeBuilder { /** * Build the relative position of a component. This method is obsolete. + * + * @param x + * @param y + * @param width + * @param height + * @return Return the content string */ public static String buildPos(DimensionType x, DimensionType y, DimensionType width, DimensionType height) { StringBuffer content = new StringBuffer(); @@ -124,6 +133,13 @@ public static void buildBackground(StringBuffer styleBuffer, IStyle style, HTMLR } } + /** + * Build the background color + * + * @param styleBuffer + * @param style + * @param emitter + */ public static void buildBackgroundColor(StringBuffer styleBuffer, IStyle style, HTMLReportEmitter emitter) { buildProperty(styleBuffer, HTMLTags.ATTR_BACKGROUND_COLOR, style.getBackgroundColor()); } @@ -302,7 +318,6 @@ public static void buildBorders(StringBuffer styleBuffer, IStyle style) { * @param styleBuffer The StringBuffer to which the result is * output. * @param style The style object. - * @param bContainer true: shouldn't output the text-decoration. */ public static void buildText(StringBuffer styleBuffer, IStyle style) { buildProperty(styleBuffer, HTMLTags.ATTR_TEXT_INDENT, style.getTextIndent()); @@ -349,25 +364,23 @@ public static void buildFont(StringBuffer styleBuffer, IStyle style) { * * @param styleBuffer The StringBuffer to which the result is * output. - * @param linethrough The line-through value. - * @param underline The underline value. - * @param overline The overline value. + * @param style The style of the text decoration. */ public static void buildTextDecoration(StringBuffer styleBuffer, IStyle style) { - CSSValue linethrough = style.getProperty(IStyle.STYLE_TEXT_LINETHROUGH); - CSSValue underline = style.getProperty(IStyle.STYLE_TEXT_UNDERLINE); - CSSValue overline = style.getProperty(IStyle.STYLE_TEXT_OVERLINE); + CSSValue linethrough = style.getProperty(StyleConstants.STYLE_TEXT_LINETHROUGH); + CSSValue underline = style.getProperty(StyleConstants.STYLE_TEXT_UNDERLINE); + CSSValue overline = style.getProperty(StyleConstants.STYLE_TEXT_OVERLINE); - if (linethrough == IStyle.LINE_THROUGH_VALUE || underline == IStyle.UNDERLINE_VALUE - || overline == IStyle.OVERLINE_VALUE) { + if (linethrough == CSSValueConstants.LINE_THROUGH_VALUE || underline == CSSValueConstants.UNDERLINE_VALUE + || overline == CSSValueConstants.OVERLINE_VALUE) { styleBuffer.append(" text-decoration:"); //$NON-NLS-1$ - if (IStyle.LINE_THROUGH_VALUE == linethrough) { + if (CSSValueConstants.LINE_THROUGH_VALUE == linethrough) { addPropValue(styleBuffer, "line-through"); } - if (IStyle.UNDERLINE_VALUE == underline) { + if (CSSValueConstants.UNDERLINE_VALUE == underline) { addPropValue(styleBuffer, "underline"); } - if (IStyle.OVERLINE_VALUE == overline) { + if (CSSValueConstants.OVERLINE_VALUE == overline) { addPropValue(styleBuffer, "overline"); } styleBuffer.append(';'); @@ -538,7 +551,7 @@ public static void buildBidiDirection(StringBuffer styleBuffer, IStyle style) { if (style != null) { String direction = style.getDirection(); if (direction != null) { - buildProperty(styleBuffer, IStyle.CSS_DIRECTION_PROPERTY, direction); + buildProperty(styleBuffer, CSSConstants.CSS_DIRECTION_PROPERTY, direction); } } } diff --git a/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java b/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java index 3d29eac3158..a2ec05697fc 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java +++ b/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java @@ -33,10 +33,10 @@ import org.eclipse.birt.core.exception.BirtException; import org.eclipse.birt.report.engine.api.EngineConstants; import org.eclipse.birt.report.engine.api.EngineException; -import org.eclipse.birt.report.engine.api.HTMLEmitterConfig; import org.eclipse.birt.report.engine.api.HTMLRenderOption; import org.eclipse.birt.report.engine.api.IHTMLActionHandler; import org.eclipse.birt.report.engine.api.IHTMLImageHandler; +import org.eclipse.birt.report.engine.api.IHTMLRenderOption; import org.eclipse.birt.report.engine.api.IImage; import org.eclipse.birt.report.engine.api.IMetadataFilter; import org.eclipse.birt.report.engine.api.IRenderOption; @@ -44,6 +44,7 @@ import org.eclipse.birt.report.engine.api.impl.Action; import org.eclipse.birt.report.engine.api.impl.Image; import org.eclipse.birt.report.engine.api.script.IReportContext; +import org.eclipse.birt.report.engine.content.IBandContent; import org.eclipse.birt.report.engine.content.ICellContent; import org.eclipse.birt.report.engine.content.IColumn; import org.eclipse.birt.report.engine.content.IContainerContent; @@ -66,7 +67,10 @@ import org.eclipse.birt.report.engine.content.ITableGroupContent; import org.eclipse.birt.report.engine.content.ITextContent; import org.eclipse.birt.report.engine.content.impl.ReportContent; +import org.eclipse.birt.report.engine.css.engine.StyleConstants; +import org.eclipse.birt.report.engine.css.engine.value.birt.BIRTValueConstants; import org.eclipse.birt.report.engine.css.engine.value.css.CSSConstants; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter; import org.eclipse.birt.report.engine.emitter.EmitterUtil; import org.eclipse.birt.report.engine.emitter.HTMLTags; @@ -94,12 +98,12 @@ import org.eclipse.birt.report.model.api.IResourceLocator; import org.eclipse.birt.report.model.api.IncludedCssStyleSheetHandle; import org.eclipse.birt.report.model.api.ReportDesignHandle; -import org.eclipse.birt.report.model.api.ReportItemHandle; import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; import org.eclipse.birt.report.model.api.metadata.DimensionValue; import org.eclipse.birt.report.model.api.util.DimensionUtil; import org.eclipse.birt.report.model.api.util.StringUtil; import org.eclipse.birt.report.model.core.Module; +import org.eclipse.birt.report.model.elements.interfaces.IStyledElementModel; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -185,6 +189,9 @@ public class HTMLReportEmitter extends ContentEmitterAdapter { */ public static final String IMAGE_FOLDER = "image"; //$NON-NLS-1$ + /** + * the html client script property + */ public static final String EXTENSION_HTML_CLIENT_SCRIPTS = "html.clientScripts"; //$NON-NLS-1$ /** @@ -231,7 +238,7 @@ public class HTMLReportEmitter extends ContentEmitterAdapter { protected boolean enableMetadata = false; - protected List ouputInstanceIDs = null; + protected List ouputInstanceIDs = null; /** * specified the current page number, starting from 0 @@ -251,9 +258,9 @@ public class HTMLReportEmitter extends ContentEmitterAdapter { /** * indicates that the styled element is hidden or not */ - protected Stack stack = new Stack(); + protected Stack stack = new Stack(); - HashMap diagonalCellImageMap = new HashMap(); + HashMap diagonalCellImageMap = new HashMap(); /** * An Log object that HTMLReportEmitter use to log the error, @@ -332,13 +339,13 @@ public class HTMLReportEmitter extends ContentEmitterAdapter { protected int imageDpi = -1; protected HTMLEmitter htmlEmitter; - protected Stack tableDIVWrapedFlagStack = new Stack(); + protected Stack tableDIVWrapedFlagStack = new Stack(); protected Stack fixedRowHeightStack = new Stack<>(); /** * This set is used to store the style class which has been outputted. */ - protected Set outputtedStyles = new HashSet(); + protected Set outputtedStyles = new HashSet(); protected boolean needFixTransparentPNG = false; protected ITableContent cachedStartTable = null; @@ -366,18 +373,20 @@ public void initialize(IEmitterServices services) throws EngineException { this.out = EmitterUtil.getOuputStream(services, REPORT_FILE); // FIXME: code review: solve the deprecated problem. - Object emitterConfig = services.getEmitterConfig().get("html"); //$NON-NLS-1$ - if (emitterConfig instanceof HTMLEmitterConfig) { - imageHandler = ((HTMLEmitterConfig) emitterConfig).getImageHandler(); - actionHandler = ((HTMLEmitterConfig) emitterConfig).getActionHandler(); - } + /* + * Object emitterConfig = services.getEmitterConfig().get("html"); //$NON-NLS-1$ + * if (emitterConfig instanceof HTMLEmitterConfig) { imageHandler = + * ((HTMLEmitterConfig) emitterConfig).getImageHandler(); actionHandler = + * ((HTMLEmitterConfig) emitterConfig).getActionHandler(); } + */ - Object im = services.getOption(HTMLRenderOption.IMAGE_HANDLER); + // usage of HTMLRenderOption instead of deprecated HTMLEmitterConfig + Object im = services.getOption(IRenderOption.IMAGE_HANDLER); if (im instanceof IHTMLImageHandler) { imageHandler = (IHTMLImageHandler) im; } - Object ac = services.getOption(HTMLRenderOption.ACTION_HANDLER); + Object ac = services.getOption(IRenderOption.ACTION_HANDLER); if (ac instanceof IHTMLActionHandler) { actionHandler = (IHTMLActionHandler) ac; } @@ -390,12 +399,15 @@ public void initialize(IEmitterServices services) throws EngineException { if (renderOption != null) { HTMLRenderOption htmlOption = new HTMLRenderOption(renderOption); isEmbeddable = htmlOption.getEmbeddable(); - Map options = renderOption.getOutputSetting(); + // Map options = renderOption.getOutputSetting(); + Map options = renderOption.getOptions(); + if (options != null) { - urlEncoding = (String) options.get(HTMLRenderOption.URL_ENCODING); + urlEncoding = (String) options.get(IHTMLRenderOption.URL_ENCODING); } outputMasterPageContent = htmlOption.getMasterPageContent(); - IHTMLActionHandler actHandler = htmlOption.getActionHandle(); + // IHTMLActionHandler actHandler = htmlOption.getActionHandle(); + IHTMLActionHandler actHandler = htmlOption.getActionHandler(); if (ac != null) { actionHandler = actHandler; } @@ -627,7 +639,7 @@ public void start(IReportContent report) { designHandle = reportDesign.getReportDesign(); // Get dpi. - Map appContext = reportContext.getAppContext(); + Map appContext = reportContext.getAppContext(); if (appContext != null) { Object tmp = appContext.get(EngineConstants.APPCONTEXT_CHART_RESOLUTION); if (tmp instanceof Number) { @@ -648,15 +660,15 @@ public void start(IReportContent report) { if (designHandle != null) { String reportLayoutPreference = designHandle.getLayoutPreference(); if (DesignChoiceConstants.REPORT_LAYOUT_PREFERENCE_FIXED_LAYOUT.equals(reportLayoutPreference)) { - layoutPreference = HTMLRenderOption.LAYOUT_PREFERENCE_FIXED; + layoutPreference = IHTMLRenderOption.LAYOUT_PREFERENCE_FIXED; fixedReport = true; } else if (DesignChoiceConstants.REPORT_LAYOUT_PREFERENCE_AUTO_LAYOUT.equals(reportLayoutPreference)) { - layoutPreference = HTMLRenderOption.LAYOUT_PREFERENCE_AUTO; + layoutPreference = IHTMLRenderOption.LAYOUT_PREFERENCE_AUTO; fixedReport = false; } } } else { - fixedReport = HTMLRenderOption.LAYOUT_PREFERENCE_FIXED.equals(layoutPreference); + fixedReport = IHTMLRenderOption.LAYOUT_PREFERENCE_FIXED.equals(layoutPreference); } if (enableAgentStyleEngine) { htmlEmitter = new HTMLPerformanceOptimize(this, writer, fixedReport, enableInlineStyle, browserVersion); @@ -885,8 +897,8 @@ private void outputCSSStyles(Report reportDesign, ReportDesignHandle designHandl styleNamePrefix = "."; } String defaultStyleName = reportDesign.getRootStyleName(); - Map styles = reportDesign.getStyles(); - Iterator iter = styles.entrySet().iterator(); + Map styles = reportDesign.getStyles(); + Iterator iter = styles.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); String styleName = (String) entry.getKey(); @@ -910,11 +922,11 @@ private void outputCSSStyles(Report reportDesign, ReportDesignHandle designHandl // export the CSS links in the HTML if (designHandle != null) { - List externalCsses = designHandle.getAllExternalIncludedCsses(); + List externalCsses = designHandle.getAllExternalIncludedCsses(); if (null != externalCsses) { - Iterator iter = externalCsses.iterator(); + Iterator iter = externalCsses.iterator(); while (iter.hasNext()) { - IncludedCssStyleSheetHandle cssStyleSheetHandle = (IncludedCssStyleSheetHandle) iter.next(); + IncludedCssStyleSheetHandle cssStyleSheetHandle = iter.next(); String href = cssStyleSheetHandle.getExternalCssURI(); if (cssStyleSheetHandle.isUseExternalCss() || href != null) { hasCsslinks = true; @@ -954,8 +966,8 @@ private void appendErrorMessage(EngineResourceHandle rc, int index, ElementExcep } writer.writeCode("");//$NON-NLS-1$ - ArrayList errorList = info.getErrorList(); - ArrayList countList = info.getCountList(); + ArrayList errorList = info.getErrorList(); + ArrayList countList = info.getCountList(); for (int i = 0; i < errorList.size(); i++) { String errorId = "document.getElementById('error_detail" + index + "_" + i + "')"; String errorIcon = "document.getElementById('error_icon" + index + "_" + i + "')"; @@ -1002,7 +1014,7 @@ private String getDetailMessage(Throwable t) { return out.getBuffer().toString(); } - protected boolean outputErrors(List errors) { + protected boolean outputErrors(List errors) { // Outputs the error message at the end of the report if (errors != null && !errors.isEmpty()) { writer.writeCode("
"); @@ -1017,7 +1029,7 @@ protected boolean outputErrors(List errors) { writer.writeCode("");//$NON-NLS-1$ writer.writeCode("
");//$NON-NLS-1$ - Iterator it = errors.iterator(); + Iterator it = errors.iterator(); int index = 0; while (it.hasNext()) { appendErrorMessage(rc, index++, (ElementExceptionInfo) it.next()); @@ -1039,7 +1051,7 @@ protected boolean outputErrors(List errors) { public void end(IReportContent report) { logger.log(Level.FINEST, "[HTMLReportEmitter] End body."); //$NON-NLS-1$ if (report != null) { - List errors = report.getErrors(); + List errors = report.getErrors(); if (errors != null && !errors.isEmpty()) { outputErrors(errors); } @@ -1461,13 +1473,12 @@ private void startBackgroundContainer(IStyle style, DimensionType pageWidth, Dim String backgroundWidth = parseBackgroundSize(style.getBackgroundWidth(), pageWidth); if (backgroundHeight == null && backgroundWidth == null) { return; - } else { - if (backgroundHeight == null) { - backgroundHeight = "auto"; - } - if (backgroundWidth == null) { - backgroundWidth = "auto"; - } + } + if (backgroundHeight == null) { + backgroundHeight = "auto"; + } + if (backgroundWidth == null) { + backgroundWidth = "auto"; } String image = style.getBackgroundImage(); @@ -1584,8 +1595,8 @@ protected void doStartTable(ITableContent table) { // inline-block by themselves. // implement the inline table for old version browser if (!browserSupportsInlineBlock) { - CSSValue display = style.getProperty(IStyle.STYLE_DISPLAY); - if (IStyle.INLINE_VALUE == display || IStyle.INLINE_BLOCK_VALUE == display) { + CSSValue display = style.getProperty(StyleConstants.STYLE_DISPLAY); + if (CSSValueConstants.INLINE_VALUE == display || CSSValueConstants.INLINE_BLOCK_VALUE == display) { if (!DIVWrap) { writer.openTag(HTMLTags.TAG_DIV); DIVWrap = true; @@ -1715,7 +1726,7 @@ public void endTable(ITableContent table) { metadataEmitter.endWrapTable(table); } - boolean DIVWrap = ((Boolean) tableDIVWrapedFlagStack.pop()).booleanValue(); + boolean DIVWrap = tableDIVWrapedFlagStack.pop().booleanValue(); if (DIVWrap) { writer.closeTag(HTMLTags.TAG_DIV); } @@ -1728,7 +1739,7 @@ public void endTable(ITableContent table) { * align according to the page box. * * @param table - * @return + * @return Return the information about align of the table */ protected boolean needImplementAlignTable(ITableContent table) { // the table should be the top level. @@ -1738,30 +1749,30 @@ protected boolean needImplementAlignTable(ITableContent table) { if (null != width && !"100%".equals(width.toString())) { // The table must be a block table. IStyle style = table.getStyle(); - CSSValue display = style.getProperty(IStyle.STYLE_DISPLAY); - if (null == display || IStyle.BLOCK_VALUE == display) { + CSSValue display = style.getProperty(StyleConstants.STYLE_DISPLAY); + if (null == display || CSSValueConstants.BLOCK_VALUE == display) { // The text-align value must be center or right. - CSSValue align = style.getProperty(IStyle.STYLE_TEXT_ALIGN); + CSSValue align = style.getProperty(StyleConstants.STYLE_TEXT_ALIGN); // bidi_hcg start // If alignment is inconsistent with direction we need to // be explicit for non-center alignment (i.e. alignment // left and dir is RTL or alignment right and dir is LTR. - if (IStyle.CENTER_VALUE.equals(align)) + if (CSSValueConstants.CENTER_VALUE.equals(align)) // XXX Is justify here applicable? // || IStyle.JUSTIFY_VALUE.equals( align ) ) { return true; } - CSSValue direction = style.getProperty(IStyle.STYLE_DIRECTION); - if (IStyle.RTL_VALUE.equals(direction)) { - if (!IStyle.RIGHT_VALUE.equals(align)) { + CSSValue direction = style.getProperty(StyleConstants.STYLE_DIRECTION); + if (CSSValueConstants.RTL_VALUE.equals(direction)) { + if (!CSSValueConstants.RIGHT_VALUE.equals(align)) { return true; } } else // bidi_hcg end - if ( /* IStyle.CENTER_VALUE == align || */IStyle.RIGHT_VALUE == align) { + if ( /* IStyle.CENTER_VALUE == align || */CSSValueConstants.RIGHT_VALUE == align) { return true; } } @@ -1777,6 +1788,11 @@ protected boolean needImplementAlignTable(ITableContent table) { * org.eclipse.birt.report.engine.emitter.IContentEmitter#startTableHeader(org. * eclipse.birt.report.engine.content.ITableBandContent) */ + /** + * Write the table header start + * + * @param band + */ public void startTableHeader(ITableBandContent band) { writer.openTag(HTMLTags.TAG_THEAD); } @@ -1788,6 +1804,11 @@ public void startTableHeader(ITableBandContent band) { * org.eclipse.birt.report.engine.emitter.IContentEmitter#endTableHeader(org. * eclipse.birt.report.engine.content.ITableBandContent) */ + /** + * Write table header end + * + * @param band + */ public void endTableHeader(ITableBandContent band) { writer.closeTag(HTMLTags.TAG_THEAD); } @@ -1799,6 +1820,11 @@ public void endTableHeader(ITableBandContent band) { * org.eclipse.birt.report.engine.emitter.IContentEmitter#startTableBody(org. * eclipse.birt.report.engine.content.ITableBandContent) */ + /** + * Write table body start + * + * @param band + */ public void startTableBody(ITableBandContent band) { writer.openTag(HTMLTags.TAG_TBODY); } @@ -1809,6 +1835,11 @@ public void startTableBody(ITableBandContent band) { * @see org.eclipse.birt.report.engine.emitter.IContentEmitter#endTableBody(org. * eclipse.birt.report.engine.content.ITableBandContent) */ + /** + * Write table body end + * + * @param band + */ public void endTableBody(ITableBandContent band) { writer.closeTag(HTMLTags.TAG_TBODY); } @@ -1820,6 +1851,11 @@ public void endTableBody(ITableBandContent band) { * org.eclipse.birt.report.engine.emitter.IContentEmitter#startTableFooter(org. * eclipse.birt.report.engine.content.ITableBandContent) */ + /** + * Write the table footer start + * + * @param band + */ public void startTableFooter(ITableBandContent band) { writer.openTag(HTMLTags.TAG_TFOOT); } @@ -1831,6 +1867,11 @@ public void startTableFooter(ITableBandContent band) { * org.eclipse.birt.report.engine.emitter.IContentEmitter#endTableFooter(org. * eclipse.birt.report.engine.content.ITableBandContent) */ + /** + * Write the table footer end + * + * @param band + */ public void endTableFooter(ITableBandContent band) { writer.closeTag(HTMLTags.TAG_TFOOT); } @@ -1873,7 +1914,7 @@ public void startRow(IRowContent row) { htmlEmitter.handleRowAlign(row); if (!startedGroups.isEmpty()) { - IGroupContent group = (IGroupContent) startedGroups.firstElement(); + IGroupContent group = startedGroups.firstElement(); String bookmark = group.getBookmark(); if (bookmark == null) { bookmark = idGenerator.generateUniqueID(); @@ -1924,7 +1965,7 @@ protected boolean isCellInHead(ICellContent cell) { IElement tableBand = row.getParent(); if (tableBand instanceof ITableBandContent) { int type = ((ITableBandContent) tableBand).getBandType(); - if (type == ITableBandContent.BAND_HEADER) { + if (type == IBandContent.BAND_HEADER) { // is the table head return true; } @@ -2002,7 +2043,7 @@ public void startCell(ICellContent cell) { if (!startedGroups.isEmpty()) { if (!bookmarkOutput) { - IGroupContent group = (IGroupContent) startedGroups.firstElement(); + IGroupContent group = startedGroups.firstElement(); String bookmark = group.getBookmark(); if (bookmark == null) { bookmark = idGenerator.generateUniqueID(); @@ -2012,9 +2053,9 @@ public void startCell(ICellContent cell) { startedGroups.remove(group); } - Iterator iter = startedGroups.iterator(); + Iterator iter = startedGroups.iterator(); while (iter.hasNext()) { - IGroupContent group = (IGroupContent) iter.next(); + IGroupContent group = iter.next(); outputBookmark(group); } startedGroups.clear(); @@ -2023,7 +2064,7 @@ public void startCell(ICellContent cell) { if (fixedCellHeight) { writer.openTag(HTMLTags.TAG_DIV); writer.attribute(HTMLTags.ATTR_STYLE, "position: relative; height: 100%;"); - DimensionType cellHeight = (DimensionType) fixedRowHeightStack.peek(); + DimensionType cellHeight = fixedRowHeightStack.peek(); if (cell.hasDiagonalLine()) { outputDiagonalImage(cell, cellHeight); } @@ -2452,7 +2493,7 @@ protected void outputHtmlText(IForeignContent foreign) { Document doc = new TextParser().parse(text, TextParser.TEXT_TYPE_HTML); HTMLProcessor htmlProcessor = new HTMLProcessor(design, reportContext.getAppContext()); - HashMap styleMap = new HashMap(); + HashMap styleMap = new HashMap<>(); Element body = null; if (doc != null) { @@ -2475,7 +2516,7 @@ protected void outputHtmlText(IForeignContent foreign) { * @param visitor the ITextNodeVisitor instance * @param ele the specific node */ - private void processNodes(Element ele, HashMap cssStyles) { + private void processNodes(Element ele, HashMap cssStyles) { for (Node node = ele.getFirstChild(); node != null; node = node.getNextSibling()) { // At present we only deal with the text, comment and element nodes short nodeType = node.getNodeType(); @@ -2528,9 +2569,13 @@ private boolean isScriptText(Node node) { return false; } - public void startNode(Node node, HashMap cssStyles) { + /** + * @param node + * @param cssStyles + */ + public void startNode(Node node, HashMap cssStyles) { String nodeName = node.getNodeName(); - HashMap cssStyle = (HashMap) cssStyles.get(node); + HashMap cssStyle = (HashMap) cssStyles.get(node); writer.openTag(nodeName); NamedNodeMap attributes = node.getAttributes(); if (attributes != null) { @@ -2552,7 +2597,7 @@ public void startNode(Node node, HashMap cssStyles) { } if (cssStyle != null) { StringBuilder buffer = new StringBuilder(); - Iterator ite = cssStyle.entrySet().iterator(); + Iterator ite = cssStyle.entrySet().iterator(); while (ite.hasNext()) { Map.Entry entry = (Map.Entry) ite.next(); Object keyObj = entry.getKey(); @@ -2583,6 +2628,11 @@ public void startNode(Node node, HashMap cssStyles) { } } + /** + * Write the end node + * + * @param node + */ public void endNode(Node node) { writer.closeTag(node.getNodeName()); } @@ -2930,7 +2980,7 @@ protected void setStyleName(String styleName, IContent content) { if (genBy instanceof StyledElementDesign) { DesignElementHandle handle = ((StyledElementDesign) genBy).getHandle(); if (handle != null) { - String name = handle.getStringProperty(ReportItemHandle.STYLE_PROP); + String name = handle.getStringProperty(IStyledElementModel.STYLE_PROP); if (name != null) { if (classBuffer.length() != 0) { classBuffer.append(" " + name); @@ -2952,6 +3002,14 @@ protected void outputBookmark(IContent content, String tagName) { outputBookmark(writer, tagName, htmlIDNamespace, bookmark); } + /** + * Set bookmark to output + * + * @param writer + * @param tagName + * @param htmlIDNamespace + * @param bookmark + */ public void outputBookmark(HTMLWriter writer, String tagName, String htmlIDNamespace, String bookmark) { HTMLEmitterUtil.setBookmark(writer, tagName, htmlIDNamespace, bookmark); } @@ -2969,8 +3027,6 @@ public void outputBookmark(HTMLWriter writer, String tagName, String htmlIDNames * @param y Specifies how far an absolutely positioned box's top * margin edge is offset below the top edge of the box's * containing block. - * @param width The width of the element. - * @param height The height of the element. * @param style The IStyle object. * @param styleBuffer The StringBuffer object that returns 'style' * content. @@ -2991,6 +3047,16 @@ protected int checkElementType(DimensionType x, DimensionType y, DimensionType w return getElementType(x, y, width, height, style); } + /** + * Get element by type + * + * @param x + * @param y + * @param width + * @param height + * @param style + * @return Return the HTML element + */ public int getElementType(DimensionType x, DimensionType y, DimensionType width, DimensionType height, IStyle style) { return htmlEmitter.getElementType(x, y, width, height, style); @@ -3041,10 +3107,11 @@ protected boolean handleAction(IHyperlinkAction action) { } /** + * Verify handle action * * @param action * @param url - * @return + * @return true, handle is valid */ protected boolean handleAction(IHyperlinkAction action, String url) { if (url != null) { @@ -3069,7 +3136,7 @@ protected void outputAction(IHyperlinkAction action, String url) { * Judges if a hyperlink is valid. * * @param action the hyperlink action - * @return + * @return true, the hyperlink is valid */ protected String validate(IHyperlinkAction action) { if (action == null) { @@ -3091,32 +3158,32 @@ protected String validate(IHyperlinkAction action) { } /** - * handle style image + * Handle style image * * @param uri uri in style image - * @return + * @return Return the image URI */ public String handleStyleImage(String uri) { return handleStyleImage(uri, false, null); } /** - * handle style image + * Handle style image * * @param uri uri in style image * @param isBackground Is this image a used for a background? - * @return + * @return Return the image URI */ public String handleStyleImage(String uri, boolean isBackground) { return handleStyleImage(uri, isBackground, null); } /** - * handle style image + * Handle style image * * @param style Is the style object of the image include uri. * @param isBackground Is this image a used for a background? - * @return + * @return Return the image URI */ public String handleStyleImage(IStyle style, boolean isBackground) { return handleStyleImage(null, isBackground, style); @@ -3127,16 +3194,14 @@ public String handleStyleImage(IStyle style, boolean isBackground) { // part and put the imgUri into the image style. Then we can use the imagUri // directly here /** - * handle style image + * Handle the style of image * * @param uri uri in style image * @param isBackground Is this image a used for a background? - * @return + * @param imageStyle Style of the image + * @return Return the image URI */ -// public String handleStyleImage(String uri, boolean isBackground) { public String handleStyleImage(String uri, boolean isBackground, IStyle imageStyle) { - String sourceType = "url"; - String dataProtocol = "data:"; ReportDesignHandle design = (ReportDesignHandle) runnable.getDesignHandle(); URL url = design.findResource(uri, IResourceLocator.IMAGE, reportContext.getAppContext()); @@ -3156,10 +3221,11 @@ public String handleStyleImage(String uri, boolean isBackground, IStyle imageSty String uriString = EmitterUtil.getBackgroundImageUrl(imageStyle, design, this.report.getReportContext() == null ? null : this.report.getReportContext().getAppContext()); - backgroundImage = new BackgroundImageInfo(uriString, imageStyle.getProperty(IStyle.STYLE_BACKGROUND_REPEAT), - 0, 0, 0, 0, rl, module, imageStyle.getProperty(IStyle.STYLE_BACKGROUND_IMAGE_TYPE)); + backgroundImage = new BackgroundImageInfo(uriString, + imageStyle.getProperty(StyleConstants.STYLE_BACKGROUND_REPEAT), 0, 0, 0, 0, rl, module, + imageStyle.getProperty(StyleConstants.STYLE_BACKGROUND_IMAGE_TYPE)); - if (backgroundImage.getSourceType().equalsIgnoreCase(IStyle.CSS_EMBED_VALUE)) { + if (backgroundImage.getSourceType().equalsIgnoreCase(CSSConstants.CSS_EMBED_VALUE)) { uri = backgroundImage.getDataUrl(); } fileExtension = backgroundImage.getFileExtension(); @@ -3190,7 +3256,6 @@ public String handleStyleImage(String uri, boolean isBackground, IStyle imageSty image.setMimeType("image/" + fileExtension); } -// var test = image.getMimeType(); TGGGGG; String imgUri = null; if (imageHandler != null) { switch (image.getSource()) { @@ -3240,20 +3305,20 @@ protected void setupTemplateElement(TemplateDesign template, IContent content) { if ("ExtendedItem".equals(allowedType)) { // Resize chart template element IStyle style = content.getStyle(); - style.setProperty(IStyle.STYLE_CAN_SHRINK, IStyle.FALSE_VALUE); + style.setProperty(StyleConstants.STYLE_CAN_SHRINK, BIRTValueConstants.FALSE_VALUE); content.setWidth(new DimensionType(3, DimensionType.UNITS_IN)); content.setHeight(new DimensionType(3, DimensionType.UNITS_IN)); } else if ("Table".equals(allowedType)) { // Resize table template element IStyle style = content.getStyle(); - style.setProperty(IStyle.STYLE_CAN_SHRINK, IStyle.FALSE_VALUE); + style.setProperty(StyleConstants.STYLE_CAN_SHRINK, BIRTValueConstants.FALSE_VALUE); content.setWidth(new DimensionType(5, DimensionType.UNITS_IN)); // set lines to dotted lines - style.setProperty(IStyle.STYLE_BORDER_TOP_STYLE, IStyle.DOTTED_VALUE); - style.setProperty(IStyle.STYLE_BORDER_BOTTOM_STYLE, IStyle.DOTTED_VALUE); - style.setProperty(IStyle.STYLE_BORDER_LEFT_STYLE, IStyle.DOTTED_VALUE); - style.setProperty(IStyle.STYLE_BORDER_RIGHT_STYLE, IStyle.DOTTED_VALUE); - style.setProperty(IStyle.STYLE_FONT_FAMILY, IStyle.SANS_SERIF_VALUE); + style.setProperty(StyleConstants.STYLE_BORDER_TOP_STYLE, CSSValueConstants.DOTTED_VALUE); + style.setProperty(StyleConstants.STYLE_BORDER_BOTTOM_STYLE, CSSValueConstants.DOTTED_VALUE); + style.setProperty(StyleConstants.STYLE_BORDER_LEFT_STYLE, CSSValueConstants.DOTTED_VALUE); + style.setProperty(StyleConstants.STYLE_BORDER_RIGHT_STYLE, CSSValueConstants.DOTTED_VALUE); + style.setProperty(StyleConstants.STYLE_FONT_FAMILY, CSSValueConstants.SANS_SERIF_VALUE); } } @@ -3340,7 +3405,8 @@ public void startListBand(IListBandContent listBand) { * @see {@link #startTableGroup(ITableGroupContent)} * @see {@link #startListGroup(IListGroupContent)} */ - protected Stack startedGroups = new Stack(); + @SuppressWarnings("javadoc") + protected Stack startedGroups = new Stack(); /* * (non-Javadoc) @@ -3401,7 +3467,6 @@ protected void writeBidiFlag() { /** * Figures out the RTL rendering option. * - * @param htmlOption * @author bidi_hcg */ protected void retrieveRtLFlag() { @@ -3529,7 +3594,7 @@ protected void startTable(ITableContent tableContent) { columnHiddens = new boolean[columnCount]; for (int i = 0; i < columnCount; i++) { IColumn column = tableContent.getColumn(i); - boolean isHidden = column.getComputedStyle().getProperty(IStyle.STYLE_DISPLAY) == IStyle.NONE_VALUE; + boolean isHidden = column.getComputedStyle().getProperty(StyleConstants.STYLE_DISPLAY) == CSSValueConstants.NONE_VALUE; columnHiddens[i] = isHidden; if (isHidden) { hasHiddenColumn = true; @@ -3588,7 +3653,7 @@ protected void startCell(ICellContent cell) { if (hiddenColumnCount != 0) { if (colSpan == hiddenColumnCount) { // the whole element are hidden, change the display to none. - cell.getStyle().setProperty(IStyle.STYLE_DISPLAY, IStyle.NONE_VALUE); + cell.getStyle().setProperty(StyleConstants.STYLE_DISPLAY, CSSValueConstants.NONE_VALUE); } else { // fill hidden cells for invisible columns addNoneCell(column, column + hiddenColumnCount, cell); @@ -3597,7 +3662,7 @@ protected void startCell(ICellContent cell) { cell.setColSpan(colSpan - hiddenColumnCount); // as we don't define tablecell display constant, so use block // here. The value itself won't used by output code. - cell.getStyle().setProperty(IStyle.STYLE_DISPLAY, IStyle.BLOCK_VALUE); + cell.getStyle().setProperty(StyleConstants.STYLE_DISPLAY, CSSValueConstants.BLOCK_VALUE); } } } @@ -3690,7 +3755,7 @@ protected void addNoneCell(int startCol, int endCol, ICellContent cell) { if (startCol < endCol) { ICellContent newCell = newCell(cell, startCol, endCol); IStyle cellStyle = newCell.getStyle(); - cellStyle.setProperty(IStyle.STYLE_DISPLAY, IStyle.NONE_VALUE); + cellStyle.setProperty(StyleConstants.STYLE_DISPLAY, CSSValueConstants.NONE_VALUE); // set the invisible cell, so it won't be handled by following start cell. insertNoneCell = newCell; emitter.startCell(newCell); diff --git a/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPage.java b/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPage.java index 8013e6d1ca1..f60b8167408 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPage.java +++ b/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPage.java @@ -30,12 +30,11 @@ import org.apache.batik.transcoder.TranscoderInput; import org.apache.batik.transcoder.print.PrintTranscoder; import org.eclipse.birt.report.engine.content.IHyperlinkAction; -import org.eclipse.birt.report.engine.content.IStyle; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.emitter.EmitterUtil; import org.eclipse.birt.report.engine.layout.emitter.AbstractPage; import org.eclipse.birt.report.engine.layout.pdf.font.FontInfo; -import org.eclipse.birt.report.engine.nLayout.area.style.BackgroundImageInfo; -import org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo; +import org.eclipse.birt.report.engine.nLayout.area.style.AreaConstants; import org.eclipse.birt.report.engine.nLayout.area.style.TextStyle; import org.eclipse.birt.report.engine.util.FlashFile; import org.eclipse.birt.report.engine.util.SvgFile; @@ -57,6 +56,12 @@ import com.lowagie.text.pdf.PdfTextArray; import com.lowagie.text.pdf.PdfWriter; +/** + * Definition of the PDF page + * + * @since 3.3 + * + */ public class PDFPage extends AbstractPage { /** @@ -84,6 +89,15 @@ public class PDFPage extends AbstractPage { private static Pattern PAGE_LINK_PATTERN = Pattern .compile("^((([a-zA-Z]:))(/(\\w[\\w ]*.*))+\\.(pdf|PDF))+#page=(\\d+)$"); + /** + * Constructor of the PDF page + * + * @param pageWidth + * @param pageHeight + * @param document + * @param writer + * @param pageDevice + */ public PDFPage(int pageWidth, int pageHeight, Document document, PdfWriter writer, PDFPageDevice pageDevice) { super(pageWidth, pageHeight); this.writer = writer; @@ -168,8 +182,8 @@ protected void drawBackgroundImage(float x, float y, float width, float height, } } - boolean xExtended = (repeat & BackgroundImageInfo.REPEAT_X) == BackgroundImageInfo.REPEAT_X; - boolean yExtended = (repeat & BackgroundImageInfo.REPEAT_Y) == BackgroundImageInfo.REPEAT_Y; + boolean xExtended = (repeat & AreaConstants.REPEAT_X) == AreaConstants.REPEAT_X; + boolean yExtended = (repeat & AreaConstants.REPEAT_Y) == AreaConstants.REPEAT_Y; imageWidth = image.getWidth(); imageHeight = image.getHeight(); @@ -270,23 +284,23 @@ protected void drawLine(float startX, float startY, float endX, float endY, floa int lineStyle) { // if the border does NOT have color or the line width of the border is // zero or the lineStyle is "none", just return. - if (null == color || 0f == width || BorderInfo.BORDER_STYLE_NONE == lineStyle) // $NON-NLS-1$ + if (null == color || 0f == width || AreaConstants.BORDER_STYLE_NONE == lineStyle) // $NON-NLS-1$ { return; } contentByte.saveState(); - if (BorderInfo.BORDER_STYLE_SOLID == lineStyle) // $NON-NLS-1$ + if (AreaConstants.BORDER_STYLE_SOLID == lineStyle) // $NON-NLS-1$ { drawRawLine(startX, startY, endX, endY, width, color, contentByte); - } else if (BorderInfo.BORDER_STYLE_DASHED == lineStyle) // $NON-NLS-1$ + } else if (AreaConstants.BORDER_STYLE_DASHED == lineStyle) // $NON-NLS-1$ { contentByte.setLineDash(3 * width, 2 * width, 0f); drawRawLine(startX, startY, endX, endY, width, color, contentByte); - } else if (BorderInfo.BORDER_STYLE_DOTTED == lineStyle) // $NON-NLS-1$ + } else if (AreaConstants.BORDER_STYLE_DOTTED == lineStyle) // $NON-NLS-1$ { contentByte.setLineDash(width, width, 0f); drawRawLine(startX, startY, endX, endY, width, color, contentByte); - } else if (BorderInfo.BORDER_STYLE_DOUBLE == lineStyle) // $NON-NLS-1$ + } else if (AreaConstants.BORDER_STYLE_DOUBLE == lineStyle) // $NON-NLS-1$ { return; } @@ -302,10 +316,9 @@ protected void drawLine(float startX, float startY, float endX, float endY, floa @Override protected void drawText(String text, float textX, float textY, float baseline, float width, float height, TextStyle textStyle) { - drawText(text, textX, textY + baseline, width, height, textStyle.getFontInfo(), + drawText1(text, textX, textY + baseline, textStyle.getFontInfo(), convertToPoint(textStyle.getLetterSpacing()), convertToPoint(textStyle.getWordSpacing()), - textStyle.getColor(), textStyle.isLinethrough(), textStyle.isOverline(), textStyle.isUnderline(), - textStyle.getAlign()); + textStyle.getColor(), textStyle.getAlign()); if (textStyle.isHasHyperlink()) { FontInfo fontInfo = textStyle.getFontInfo(); float lineWidth = fontInfo.getLineWidth(); @@ -314,12 +327,22 @@ protected void drawText(String text, float textX, float textY, float baseline, f } } - private void drawText(String text, float textX, float textY, float width, float height, FontInfo fontInfo, - float characterSpacing, float wordSpacing, Color color, boolean linethrough, boolean overline, - boolean underline, CSSValue align) { + private void drawText1(String text, float textX, float textY, FontInfo fontInfo, + float characterSpacing, float wordSpacing, Color color, CSSValue align) { drawText(text, textX, textY, fontInfo, characterSpacing, wordSpacing, color, align); } + /** + * Draw the total page + * + * @param text + * @param textX + * @param textY + * @param width + * @param height + * @param textInfo + * @param scale + */ public void drawTotalPage(String text, int textX, int textY, int width, int height, TextStyle textInfo, float scale) { PdfTemplate template = pageDevice.getPDFTemplate(scale); @@ -333,14 +356,35 @@ public void drawTotalPage(String text, int textX, int textY, int width, int heig } } + /** + * Create the bookmarks + * + * @param bookmark + * @param x + * @param y + * @param width + * @param height + */ public void createBookmark(String bookmark, int x, int y, int width, int height) { - createBookmark(bookmark, convertToPoint(x), convertToPoint(y), convertToPoint(width), convertToPoint(height)); + createBookmark(bookmark, convertToPoint(y)); } - private void createBookmark(String bookmark, float x, float y, float width, float height) { + private void createBookmark(String bookmark, float y) { contentByte.localDestination(bookmark, new PdfDestination(PdfDestination.XYZ, -1, transformY(y), 0)); } + /** + * Create the hyperlinks + * + * @param hyperlink + * @param bookmark + * @param targetWindow + * @param type + * @param x + * @param y + * @param width + * @param height + */ public void createHyperlink(String hyperlink, String bookmark, String targetWindow, int type, int x, int y, int width, int height) { createHyperlink(hyperlink, bookmark, targetWindow, type, convertToPoint(x), convertToPoint(y), @@ -354,6 +398,15 @@ private void createHyperlink(String hyperlink, String bookmark, String targetWin createPdfAction(hyperlink, bookmark, targetWindow, type))); } + /** + * Create the total page template + * + * @param x + * @param y + * @param width + * @param height + * @param scale + */ public void createTotalPageTemplate(int x, int y, int width, int height, float scale) { createTotalPageTemplate(convertToPoint(x), convertToPoint(y), convertToPoint(width), convertToPoint(height), scale); @@ -426,7 +479,8 @@ private void drawText(String text, float textX, float textY, FontInfo fontInfo, contentByte.setWordSpacing(wordSpacing); } setTextMatrix(contentByte, fontInfo, textX, transformY(textY, 0, containerHeight)); - if ((font.getFontType() == BaseFont.FONT_TYPE_TTUNI) && IStyle.JUSTIFY_VALUE.equals(align) && wordSpacing > 0) { + if ((font.getFontType() == BaseFont.FONT_TYPE_TTUNI) && CSSValueConstants.JUSTIFY_VALUE.equals(align) + && wordSpacing > 0) { int idx = text.indexOf(' '); if (idx >= 0) { float spaceCorrection = -wordSpacing * 1000 / fontSize; diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/IRenderOption.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/IRenderOption.java index 32891c8dfef..89388faa65a 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/IRenderOption.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/IRenderOption.java @@ -22,20 +22,63 @@ */ public interface IRenderOption extends ITaskOption { + /** + * Property of format + */ String OUTPUT_FORMAT = "Format"; //$NON-NLS-1$ + + /** + * Property of output format HTML + */ String OUTPUT_FORMAT_HTML = "html"; //$NON-NLS-1$ + + /** + * Property of output format PDF + */ String OUTPUT_FORMAT_PDF = "pdf"; //$NON-NLS-1$ + + /** + * Property of output format FO + */ String OUTPUT_FORMAT_FO = "fo"; //$NON-NLS-1$ + + /** + * Property of emitter id HTML + */ String OUTPUT_EMITTERID_HTML = "org.eclipse.birt.report.engine.emitter.html"; + + /** + * Property of emitter id PDF + */ String OUTPUT_EMITTERID_PDF = "org.eclipse.birt.report.engine.emitter.pdf"; + + /** + * Property of emitter id + */ String EMITTER_ID = "emitterID"; //$NON-NLS-1$ + /** + * Property of output file + */ String OUTPUT_FILE_NAME = "outputFile"; //$NON-NLS-1$ + /** + * Property of output stream + */ String OUTPUT_STREAM = "outputStream"; //$NON-NLS-1$ + /** + * Property of image handler + */ String IMAGE_HANDLER = "imageHandler"; //$NON-NLS-1$ + + /** + * Property of action handler + */ String ACTION_HANDLER = "actionHandler"; //$NON-NLS-1$ + /** + * Property for local + */ String LOCALE = "locale"; //$NON-NLS-1$ /** The DPI which layout engine uses to convert pixel to an abstract length */ @@ -44,8 +87,14 @@ public interface IRenderOption extends ITaskOption { /** The DPI which chart engine uses to generate charts */ String CHART_DPI = "ChartDpi"; + /** + * Supported image formats + */ String SUPPORTED_IMAGE_FORMATS = "supportedImageFormats"; + /** + * Property of base URL + */ String BASE_URL = "baseUrl"; /** @@ -59,6 +108,9 @@ public interface IRenderOption extends ITaskOption { */ String APP_BASE_URL = BASE_URL; // $NON-NLS-1$ + /** + * Property to set output display to none + */ String OUTPUT_DISPLAY_NONE = "org.eclipse.birt.report.engine.api.IRenderOption.outputDisplayNone"; /** @@ -73,14 +125,19 @@ public interface IRenderOption extends ITaskOption { */ String CLOSE_OUTPUTSTREAM_ON_EXIT = "closeOutputStreamOnExit"; + /** + * Property for report size + */ String REPORTLET_SIZE = "reportletSize"; /** - * @return + * Get the output settings + * * @deprecated use getOptions instead + * @return Return the output settings */ @Deprecated - Map getOutputSetting(); + Map getOutputSetting(); /** * Set output format. @@ -92,7 +149,7 @@ public interface IRenderOption extends ITaskOption { /** * Get output format. * - * @return + * @return Return the output format */ String getOutputFormat(); @@ -163,39 +220,67 @@ public interface IRenderOption extends ITaskOption { void setAppBaseURL(String appBaseURL); /** + * Set the action handler + * * @deprecated * @param handler */ @Deprecated void setActionHandle(IHTMLActionHandler handler); + /** + * Set the action handler + * + * @param handler + */ void setActionHandler(IHTMLActionHandler handler); /** + * Get the action handler + * * @deprecated - * @return + * @return Return the action handler */ @Deprecated IHTMLActionHandler getActionHandle(); + /** + * Get the action handler + * + * @return Return the action handler + */ IHTMLActionHandler getActionHandler(); /** + * Set the image handler + * * @deprecated * @param handler */ @Deprecated void setImageHandle(IHTMLImageHandler handler); + /** + * Set the image handler + * + * @param handler + */ void setImageHandler(IHTMLImageHandler handler); /** + * Get the image handler + * * @deprecated - * @return + * @return Return the image handler */ @Deprecated IHTMLImageHandler getImageHandle(); + /** + * Get the image handler + * + * @return Return the image handler + */ IHTMLImageHandler getImageHandler(); /** diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/ITaskOption.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/ITaskOption.java index 2bf9e24d09b..88e40409a9f 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/ITaskOption.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/ITaskOption.java @@ -16,14 +16,20 @@ import java.util.Map; +/** + * Define the interface of task options + * + * @since 3.3 + * + */ public interface ITaskOption { /** - * get all the options defined in this object + * Get all the options defined in this object * - * @return + * @return Return the task options */ - Map getOptions(); + Map getOptions(); /** * set the option value. diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/RenderOption.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/RenderOption.java index 5cc1bd5b640..12d7718c366 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/RenderOption.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/RenderOption.java @@ -40,7 +40,7 @@ public RenderOption() { * * @param options */ - public RenderOption(Map options) { + public RenderOption(Map options) { super(options); } @@ -61,7 +61,7 @@ public RenderOption(IRenderOption options) { */ @Deprecated @Override - public Map getOutputSetting() { + public Map getOutputSetting() { return options; } @@ -200,7 +200,7 @@ public String getAppBaseURL() { /** * Set app base url * - * @param appBaseURL the app base url + * @param appBaseUrl the app base url */ @Override public void setAppBaseURL(String appBaseUrl) { @@ -223,8 +223,10 @@ public void setActionHandler(IHTMLActionHandler handler) { } /** + * Get the action handler + * * @deprecated - * @return + * @return Return the action handler */ @Deprecated @Override @@ -257,8 +259,10 @@ public void setImageHandler(IHTMLImageHandler handler) { } /** + * Get the image handler + * * @deprecated - * @return + * @return Return the image handler */ @Deprecated @Override @@ -277,6 +281,8 @@ public IHTMLImageHandler getImageHandler() { /** * If the output stream needs to be closed on exit. + * + * @return true, output stream must be closed on exit */ public boolean needCloseOutputStreamOnExit() { return getBooleanOption(CLOSE_OUTPUTSTREAM_ON_EXIT, true); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/TOCStyle.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/TOCStyle.java index 16ea213f8a7..447e2d7d7c8 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/TOCStyle.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/TOCStyle.java @@ -19,80 +19,270 @@ import java.util.Iterator; import java.util.Map; -import org.eclipse.birt.report.engine.api.script.ScriptException; import org.eclipse.birt.report.engine.api.script.instance.IScriptStyle; +/** + * Definition of the TOC styles + * + * @since 3.3 + * + */ public class TOCStyle implements IScriptStyle, Serializable { /** - * + * constant of serial version UID */ private static final long serialVersionUID = 1L; + /** + * Style property: background-attachment + */ public static final String BACKGROUND_ATTACHMENT = "background-attachment"; + /** + * Style property: background-color + */ public static final String BACKGROUND_COLOR = "background-color"; + /** + * Style property: background-image + */ public static final String BACKGROUND_IMAGE = "background-image"; + /** + * Style property: background-image-type + */ + public static final String BACKGROUND_IMAGE_TYPE = "background-image-type"; + /** + * Style property: background-position-x + */ public static final String BACKGROUND_POSITION_X = "background-position-x"; + /** + * Style property: background-position-y + */ public static final String BACKGROUND_POSITION_Y = "background-position-y"; + /** + * Style property: background-repeat + */ public static final String BACKGROUND_REPEAT = "background-repeat"; + /** + * Style property: border-bottom-color + */ public static final String BORDER_BOTTOM_COLOR = "border-bottom-color"; + /** + * Style property: border-top-color + */ public static final String BORDER_TOP_COLOR = "border-top-color"; + /** + * Style property: border-left-color + */ public static final String BORDER_LEFT_COLOR = "border-left-color"; + /** + * Style property: border-right-color + */ public static final String BORDER_RIGHT_COLOR = "border-right-color"; + /** + * Style property: border-bottom-width + */ public static final String BORDER_BOTTOM_WIDTH = "border-bottom-width"; + /** + * Style property: border-top-width + */ public static final String BORDER_TOP_WIDTH = "border-top-width"; + /** + * Style property: border-left-width + */ public static final String BORDER_LEFT_WIDTH = "border-left-width"; + /** + * Style property: border-right-width + */ public static final String BORDER_RIGHT_WIDTH = "border-right-width"; + /** + * Style property: border-bottom-style + */ public static final String BORDER_BOTTOM_STYLE = "border-bottom-style"; + /** + * Style property: border-top-style + */ public static final String BORDER_TOP_STYLE = "border-top-style"; + /** + * Style property: border-left-style + */ public static final String BORDER_LEFT_STYLE = "border-left-style"; + /** + * Style property: border-right-style + */ public static final String BORDER_RIGHT_STYLE = "border-right-style"; + + /** + * Style property: can-shrink + */ public static final String CAN_SHRINK = "can-shrink"; + /** + * Style property: color + */ public static final String COLOR = "color"; + /** + * Style property: date-format + */ public static final String DATE_FORMAT = "date-format"; + /** + * Style property: direction + */ public static final String DIRECTION = "direction"; // bidi_hcg + /** + * Style property: display + */ public static final String DISPLAY = "display"; + + /** + * Style property: font-family + */ public static final String FONT_FAMILY = "font-family"; + /** + * Style property: font-size + */ public static final String FONT_SIZE = "font-size"; + /** + * Style property: font-style + */ public static final String FONT_STYLE = "font-style"; + /** + * Style property: font-variant + */ public static final String FONT_VARIANT = "font-variant"; + /** + * Style property: font-weight + */ public static final String FONT_WEIGHT = "font-weight"; + /** + * Style property: letter-spacing + */ public static final String LETTER_SPACING = "letter-spacing"; + /** + * Style property: line-height + */ public static final String LINE_HEIGHT = "line-height"; + + /** + * Style property: margin-bottom + */ public static final String MARGIN_BOTTOM = "margin-bottom"; + /** + * Style property: margin-left + */ public static final String MARGIN_LEFT = "margin-left"; + /** + * Style property: margin-right + */ public static final String MARGIN_RIGHT = "margin-right"; + /** + * Style property: margin-top + */ public static final String MARGIN_TOP = "margin-top"; + /** + * Style property: margin-page + */ public static final String MASTER_PAGE = "master-page"; + + /** + * Style property: number-format + */ public static final String NUMBER_FORMAT = "number-format"; + /** + * Style property: padding-bottom + */ public static final String PADDING_BOTTOM = "padding-bottom"; + /** + * Style property: padding-left + */ public static final String PADDING_LEFT = "padding-left"; + /** + * Style property: padding-right + */ public static final String PADDING_RIGHT = "padding-right"; + /** + * Style property: padding-top + */ public static final String PADDING_TOP = "padding-top"; + + /** + * Style property: page-break-after + */ public static final String PAGE_BREAK_AFTER = "page-break-after"; + /** + * Style property: page-break-before + */ public static final String PAGE_BREAK_BEFORE = "page-break-before"; + /** + * Style property: page-break-inside + */ public static final String PAGE_BREAK_INSIDE = "page-break-inside"; + /** + * Style property: show-if-blank + */ public static final String SHOW_IF_BLANK = "show-if-blank"; + /** + * Style property: string-format + */ public static final String STRING_FORMAT = "string-format"; + + /** + * Style property: text-align + */ public static final String TEXT_ALIGN = "text-align"; + /** + * Style property: text-indent + */ public static final String TEXT_INDENT = "text-indent"; + /** + * Style property: text-line-through + */ public static final String TEXT_LINE_THROUGH = "text-line-through"; + /** + * Style property: text-overline + */ public static final String TEXT_OVERLINE = "text-overline"; + /** + * Style property: text-transform + */ public static final String TEXT_TRANSFORM = "text-transform"; + /** + * Style property: text-underline + */ public static final String TEXT_UNDERLINE = "text-underline"; + + /** + * Style property: vertical-align + */ public static final String VERTICAL_ALIGN = "vertical-align"; + /** + * Style property: visible-format + */ public static final String VISIBLE_FORMAT = "visible-format"; + /** + * Style property: white-space + */ public static final String WHITE_SPACE = "white-space"; + /** + * Style property: word-spacing + */ public static final String WORD_SPACING = "word-spacing"; + /** + * Style property: date-local + */ public static final String DATE_LOCALE = "date-locale"; + /** + * Style property: number-local + */ public static final String NUMBER_LOCALE = "number-locale"; + /** + * Style property: string-local + */ public static final String STRING_LOCALE = "string-locale"; private HashMap properties = new HashMap<>(); @Override public String getBackgroundAttachement() { - return (String) properties.get(BACKGROUND_ATTACHMENT); + return properties.get(BACKGROUND_ATTACHMENT); } /** @@ -100,7 +290,7 @@ public String getBackgroundAttachement() { */ @Override public String getBackgroundAttachment() { - return (String) properties.get(BACKGROUND_ATTACHMENT); + return properties.get(BACKGROUND_ATTACHMENT); } /** @@ -108,7 +298,7 @@ public String getBackgroundAttachment() { */ @Override public String getBackgroundColor() { - return (String) properties.get(BACKGROUND_COLOR); + return properties.get(BACKGROUND_COLOR); } /** @@ -116,7 +306,15 @@ public String getBackgroundColor() { */ @Override public String getBackgroundImage() { - return (String) properties.get(BACKGROUND_IMAGE); + return properties.get(BACKGROUND_IMAGE); + } + + /** + * Get the background image source type + */ + @Override + public String getBackgroundImageType() { + return properties.get(BACKGROUND_IMAGE_TYPE); } /** @@ -125,7 +323,7 @@ public String getBackgroundImage() { */ @Override public String getBackgroundPositionX() { - return (String) properties.get(BACKGROUND_POSITION_X); + return properties.get(BACKGROUND_POSITION_X); } /** @@ -134,7 +332,7 @@ public String getBackgroundPositionX() { */ @Override public String getBackgroundPositionY() { - return (String) properties.get(BACKGROUND_POSITION_Y); + return properties.get(BACKGROUND_POSITION_Y); } /** @@ -143,7 +341,7 @@ public String getBackgroundPositionY() { */ @Override public String getBackgroundRepeat() { - return (String) properties.get(BACKGROUND_REPEAT); + return properties.get(BACKGROUND_REPEAT); } /** @@ -151,7 +349,7 @@ public String getBackgroundRepeat() { */ @Override public String getBorderBottomColor() { - return (String) properties.get(BORDER_BOTTOM_COLOR); + return properties.get(BORDER_BOTTOM_COLOR); } /** @@ -160,7 +358,7 @@ public String getBorderBottomColor() { */ @Override public String getBorderBottomStyle() { - return (String) properties.get(BORDER_BOTTOM_STYLE); + return properties.get(BORDER_BOTTOM_STYLE); } /** @@ -168,7 +366,7 @@ public String getBorderBottomStyle() { */ @Override public String getBorderBottomWidth() { - return (String) properties.get(BORDER_BOTTOM_WIDTH); + return properties.get(BORDER_BOTTOM_WIDTH); } /** @@ -176,7 +374,7 @@ public String getBorderBottomWidth() { */ @Override public String getBorderLeftColor() { - return (String) properties.get(BORDER_LEFT_COLOR); + return properties.get(BORDER_LEFT_COLOR); } /** @@ -185,7 +383,7 @@ public String getBorderLeftColor() { */ @Override public String getBorderLeftStyle() { - return (String) properties.get(BORDER_LEFT_STYLE); + return properties.get(BORDER_LEFT_STYLE); } /** @@ -193,7 +391,7 @@ public String getBorderLeftStyle() { */ @Override public String getBorderLeftWidth() { - return (String) properties.get(BORDER_LEFT_WIDTH); + return properties.get(BORDER_LEFT_WIDTH); } /** @@ -201,7 +399,7 @@ public String getBorderLeftWidth() { */ @Override public String getBorderRightColor() { - return (String) properties.get(BORDER_RIGHT_COLOR); + return properties.get(BORDER_RIGHT_COLOR); } /** @@ -210,7 +408,7 @@ public String getBorderRightColor() { */ @Override public String getBorderRightStyle() { - return (String) properties.get(BORDER_RIGHT_STYLE); + return properties.get(BORDER_RIGHT_STYLE); } /** @@ -218,7 +416,7 @@ public String getBorderRightStyle() { */ @Override public String getBorderRightWidth() { - return (String) properties.get(BORDER_RIGHT_WIDTH); + return properties.get(BORDER_RIGHT_WIDTH); } /** @@ -226,7 +424,7 @@ public String getBorderRightWidth() { */ @Override public String getBorderTopColor() { - return (String) properties.get(BORDER_TOP_COLOR); + return properties.get(BORDER_TOP_COLOR); } /** @@ -235,7 +433,7 @@ public String getBorderTopColor() { */ @Override public String getBorderTopStyle() { - return (String) properties.get(BORDER_TOP_STYLE); + return properties.get(BORDER_TOP_STYLE); } /** @@ -243,7 +441,7 @@ public String getBorderTopStyle() { */ @Override public String getBorderTopWidth() { - return (String) properties.get(BORDER_TOP_WIDTH); + return properties.get(BORDER_TOP_WIDTH); } /** @@ -251,7 +449,7 @@ public String getBorderTopWidth() { */ @Override public String getCanShrink() { - return (String) properties.get(CAN_SHRINK); + return properties.get(CAN_SHRINK); } /** @@ -259,7 +457,7 @@ public String getCanShrink() { */ @Override public String getColor() { - return (String) properties.get(COLOR); + return properties.get(COLOR); } /** @@ -269,11 +467,16 @@ public String getColor() { */ @Override public String getDateFormat() { - return (String) properties.get(DATE_FORMAT); + return properties.get(DATE_FORMAT); } + /** + * Get the direction + * + * @return Return the direction + */ public String getDirection() { - return (String) properties.get(DIRECTION); + return properties.get(DIRECTION); } /** @@ -281,7 +484,7 @@ public String getDirection() { */ @Override public String getDisplay() { - return (String) properties.get(DISPLAY); + return properties.get(DISPLAY); } /** @@ -290,7 +493,7 @@ public String getDisplay() { */ @Override public String getFontFamily() { - return (String) properties.get(FONT_FAMILY); + return properties.get(FONT_FAMILY); } /** @@ -299,7 +502,7 @@ public String getFontFamily() { */ @Override public String getFontSize() { - return (String) properties.get(FONT_SIZE); + return properties.get(FONT_SIZE); } /** @@ -308,7 +511,7 @@ public String getFontSize() { */ @Override public String getFontStyle() { - return (String) properties.get(FONT_STYLE); + return properties.get(FONT_STYLE); } /** @@ -317,7 +520,7 @@ public String getFontStyle() { */ @Override public String getFontVariant() { - return (String) properties.get(FONT_VARIANT); + return properties.get(FONT_VARIANT); } /** @@ -326,7 +529,7 @@ public String getFontVariant() { */ @Override public String getFontWeight() { - return (String) properties.get(FONT_WEIGHT); + return properties.get(FONT_WEIGHT); } /** @@ -334,7 +537,7 @@ public String getFontWeight() { */ @Override public String getLetterSpacing() { - return (String) properties.get(LETTER_SPACING); + return properties.get(LETTER_SPACING); } /** @@ -342,7 +545,7 @@ public String getLetterSpacing() { */ @Override public String getLineHeight() { - return (String) properties.get(LINE_HEIGHT); + return properties.get(LINE_HEIGHT); } /** @@ -350,7 +553,7 @@ public String getLineHeight() { */ @Override public String getMarginBottom() { - return (String) properties.get(MARGIN_BOTTOM); + return properties.get(MARGIN_BOTTOM); } /** @@ -358,7 +561,7 @@ public String getMarginBottom() { */ @Override public String getMarginLeft() { - return (String) properties.get(MARGIN_LEFT); + return properties.get(MARGIN_LEFT); } /** @@ -366,7 +569,7 @@ public String getMarginLeft() { */ @Override public String getMarginRight() { - return (String) properties.get(MARGIN_RIGHT); + return properties.get(MARGIN_RIGHT); } /** @@ -374,7 +577,7 @@ public String getMarginRight() { */ @Override public String getMarginTop() { - return (String) properties.get(MARGIN_TOP); + return properties.get(MARGIN_TOP); } /** @@ -382,7 +585,7 @@ public String getMarginTop() { */ @Override public String getMasterPage() { - return (String) properties.get(MASTER_PAGE); + return properties.get(MASTER_PAGE); } /** @@ -392,7 +595,7 @@ public String getMasterPage() { */ @Override public String getNumberFormat() { - return (String) properties.get(NUMBER_FORMAT); + return properties.get(NUMBER_FORMAT); } /** @@ -400,7 +603,7 @@ public String getNumberFormat() { */ @Override public String getPaddingBottom() { - return (String) properties.get(PADDING_BOTTOM); + return properties.get(PADDING_BOTTOM); } /** @@ -408,7 +611,7 @@ public String getPaddingBottom() { */ @Override public String getPaddingLeft() { - return (String) properties.get(PADDING_LEFT); + return properties.get(PADDING_LEFT); } /** @@ -416,7 +619,7 @@ public String getPaddingLeft() { */ @Override public String getPaddingRight() { - return (String) properties.get(PADDING_RIGHT); + return properties.get(PADDING_RIGHT); } /** @@ -424,7 +627,7 @@ public String getPaddingRight() { */ @Override public String getPaddingTop() { - return (String) properties.get(PADDING_TOP); + return properties.get(PADDING_TOP); } /** @@ -432,7 +635,7 @@ public String getPaddingTop() { */ @Override public String getPageBreakAfter() { - return (String) properties.get(PAGE_BREAK_AFTER); + return properties.get(PAGE_BREAK_AFTER); } /** @@ -440,7 +643,7 @@ public String getPageBreakAfter() { */ @Override public String getPageBreakBefore() { - return (String) properties.get(PAGE_BREAK_BEFORE); + return properties.get(PAGE_BREAK_BEFORE); } /** @@ -448,7 +651,7 @@ public String getPageBreakBefore() { */ @Override public String getPageBreakInside() { - return (String) properties.get(PAGE_BREAK_INSIDE); + return properties.get(PAGE_BREAK_INSIDE); } /** @@ -456,7 +659,7 @@ public String getPageBreakInside() { */ @Override public String getShowIfBlank() { - return (String) properties.get(SHOW_IF_BLANK); + return properties.get(SHOW_IF_BLANK); } /** @@ -466,7 +669,7 @@ public String getShowIfBlank() { */ @Override public String getStringFormat() { - return (String) properties.get(STRING_FORMAT); + return properties.get(STRING_FORMAT); } /** @@ -475,7 +678,7 @@ public String getStringFormat() { */ @Override public String getTextAlign() { - return (String) properties.get(TEXT_ALIGN); + return properties.get(TEXT_ALIGN); } /** @@ -483,7 +686,7 @@ public String getTextAlign() { */ @Override public String getTextIndent() { - return (String) properties.get(TEXT_INDENT); + return properties.get(TEXT_INDENT); } /** @@ -491,7 +694,7 @@ public String getTextIndent() { */ @Override public String getTextLineThrough() { - return (String) properties.get(TEXT_LINE_THROUGH); + return properties.get(TEXT_LINE_THROUGH); } /** @@ -499,7 +702,7 @@ public String getTextLineThrough() { */ @Override public String getTextOverline() { - return (String) properties.get(TEXT_OVERLINE); + return properties.get(TEXT_OVERLINE); } /** @@ -508,7 +711,7 @@ public String getTextOverline() { */ @Override public String getTextTransform() { - return (String) properties.get(TEXT_TRANSFORM); + return properties.get(TEXT_TRANSFORM); } /** @@ -516,7 +719,7 @@ public String getTextTransform() { */ @Override public String getTextUnderline() { - return (String) properties.get(TEXT_UNDERLINE); + return properties.get(TEXT_UNDERLINE); } /** @@ -525,7 +728,7 @@ public String getTextUnderline() { */ @Override public String getVerticalAlign() { - return (String) properties.get(VERTICAL_ALIGN); + return properties.get(VERTICAL_ALIGN); } /** @@ -544,7 +747,7 @@ public String getVerticalAlign() { */ @Override public String getVisibleFormat() { - return (String) properties.get(VISIBLE_FORMAT); + return properties.get(VISIBLE_FORMAT); } /** @@ -552,7 +755,7 @@ public String getVisibleFormat() { */ @Override public String getWhiteSpace() { - return (String) properties.get(WHITE_SPACE); + return properties.get(WHITE_SPACE); } /** @@ -560,7 +763,7 @@ public String getWhiteSpace() { */ @Override public String getWordSpacing() { - return (String) properties.get(WORD_SPACING); + return properties.get(WORD_SPACING); } @Override @@ -592,12 +795,20 @@ public void setBackgroundImage(String imageURI) { setProperty(BACKGROUND_IMAGE, imageURI); } + /** + * Set the background image source type + */ + @Override + public void setBackgroundImageType(String imageSourceType) { + setProperty(BACKGROUND_IMAGE_TYPE, imageSourceType); + } + /** * Set the X (horizontal) position of the background image * */ @Override - public void setBackgroundPositionX(String x) throws ScriptException { + public void setBackgroundPositionX(String x) { setProperty(BACKGROUND_POSITION_X, x); } @@ -606,7 +817,7 @@ public void setBackgroundPositionX(String x) throws ScriptException { * */ @Override - public void setBackgroundPositionY(String y) throws ScriptException { + public void setBackgroundPositionY(String y) { setProperty(BACKGROUND_POSITION_Y, y); } @@ -745,6 +956,11 @@ public void setDateFormat(String dateTimeFormat) { setProperty(DATE_FORMAT, dateTimeFormat); } + /** + * Set direction + * + * @param direction + */ public void setDirection(String direction) { setProperty(DIRECTION, direction); } @@ -963,7 +1179,7 @@ public void setTextIndent(String indent) { * Set the text line through */ @Override - public void setTextLineThrough(String through) throws ScriptException { + public void setTextLineThrough(String through) { setProperty(TEXT_LINE_THROUGH, through); } @@ -971,7 +1187,7 @@ public void setTextLineThrough(String through) throws ScriptException { * Set the text overline */ @Override - public void setTextOverline(String overline) throws ScriptException { + public void setTextOverline(String overline) { setProperty(TEXT_OVERLINE, overline); } @@ -988,7 +1204,7 @@ public void setTextTransform(String transform) { * Set the text underline */ @Override - public void setTextUnderline(String underline) throws ScriptException { + public void setTextUnderline(String underline) { setProperty(TEXT_UNDERLINE, underline); } @@ -1040,7 +1256,7 @@ public void setWordSpacing(String wordspacing) { @Override public String getDateLocale() { - return (String) properties.get(DATE_LOCALE); + return properties.get(DATE_LOCALE); } @Override @@ -1050,7 +1266,7 @@ public void setDateLocale(String locale) { @Override public String getNumberLocale() { - return (String) properties.get(NUMBER_LOCALE); + return properties.get(NUMBER_LOCALE); } @Override @@ -1060,7 +1276,7 @@ public void setNumberLocale(String locale) { @Override public String getStringLocale() { - return (String) properties.get(STRING_LOCALE); + return properties.get(STRING_LOCALE); } @Override @@ -1070,6 +1286,9 @@ public void setStringLocale(String locale) { /** * Set property. + * + * @param name + * @param value */ public void setProperty(String name, String value) { if (value != null) { @@ -1080,9 +1299,11 @@ public void setProperty(String name, String value) { } /** - * Get property. + * Get properties. + * + * @return Return properties */ - public Map getProperties() { + public Map getProperties() { return properties; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/TaskOption.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/TaskOption.java index 4adca58fe92..92fb548baba 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/TaskOption.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/TaskOption.java @@ -17,17 +17,23 @@ import java.util.HashMap; import java.util.Map; +/** + * Define the class of task options + * + * @since 3.3 + * + */ public class TaskOption implements ITaskOption { /** * a hash map that stores the rendering options */ - protected Map options; + protected Map options; /** * constructor */ public TaskOption() { - options = new HashMap(); + options = new HashMap(); } /** @@ -35,7 +41,7 @@ public TaskOption() { * * @param options */ - public TaskOption(Map options) { + public TaskOption(Map options) { this.options = options; } @@ -75,7 +81,7 @@ public boolean hasOption(String name) { * @return options */ @Override - public Map getOptions() { + public Map getOptions() { return options; } @@ -110,6 +116,13 @@ public boolean getBooleanOption(String name, boolean defaultValue) { return defaultValue; } + /** + * Get the options int based + * + * @param name + * @param defaultValue + * @return Return the options int based + */ public int getIntOption(String name, int defaultValue) { Object value = options.get(name); if (value instanceof Integer) { diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/instance/IScriptStyle.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/instance/IScriptStyle.java index 4e9c5e7d516..4ffa87deee1 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/instance/IScriptStyle.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/instance/IScriptStyle.java @@ -14,6 +14,12 @@ import org.eclipse.birt.report.engine.api.script.ScriptException; +/** + * Definition of the script style methods + * + * @since 3.3 + * + */ public interface IScriptStyle { /** @@ -29,6 +35,8 @@ public interface IScriptStyle { * org.eclipse.birt.report.model.api.elements.DesignChoiceConstants.FORMAT_TYPE_WORD * org.eclipse.birt.report.model.api.elements.DesignChoiceConstants.FORMAT_TYPE_POWERPOINT * + * @return Return format to hide in. Should be one of + * */ String getVisibleFormat(); @@ -52,103 +60,141 @@ public interface IScriptStyle { /** * Get the letter spacing + * + * @return Return the letter spacing */ String getLetterSpacing(); /** * Set the letter spacing + * + * @param spacing */ void setLetterSpacing(String spacing); /** * Get the line height + * + * @return Return the line height */ String getLineHeight(); /** * Set the line height + * + * @param lineHeight */ void setLineHeight(String lineHeight); /** * Get the text alignment. Valid return types are LEFT, RIGHT, CENTER and * JUSTIFY. + * + * @return Return the text alignment */ String getTextAlign(); /** * Set the text alignment. Valid return types are LEFT, RIGHT, CENTER and * JUSTIFY. + * + * @param align */ void setTextAlign(String align); /** * Get the text indent + * + * @return Return the text indent */ String getTextIndent(); /** * Set text indent + * + * @param indent */ void setTextIndent(String indent); /** * Get the text transform. Valid return values are NONE, CAPITALIZE, UPPERCASE * and LOWERCASE. + * + * @return Return the text transform */ String getTextTransform(); /** * Set the text transform. Valid transform values are NONE, CAPITALIZE, * UPPERCASE and LOWERCASE. + * + * @param transform */ void setTextTransform(String transform); /** * Get the vertical alignment. Valid return values are BASELINE, SUB, SUPER, * TOP, TEXT_TOP, MIDDLE, BOTTOM and TEXT_BOTTOM + * + * @return Return the vertical alignment */ String getVerticalAlign(); /** * Set the vertical alignment. Valid values are BASELINE, SUB, SUPER, TOP, * TEXT_TOP, MIDDLE, BOTTOM and TEXT_BOTTOM + * + * @param valign */ void setVerticalAlign(String valign); /** * Get the whitespace. Valid return values are NORMAL, PRE and NOWRAP + * + * @return Return the whitespace option */ String getWhiteSpace(); /** * Set the whitespace. The values retruned can be NORMAL, PRE and NOWRAP + * + * @param whitespace */ void setWhiteSpace(String whitespace); /** * Get the word spacing + * + * @return Return the word spacing */ String getWordSpacing(); /** * Set the word spacing + * + * @param wordspacing */ void setWordSpacing(String wordspacing); /** * Get the font color + * + * @return Return the font color */ String getColor(); /** * Set the font color + * + * @param color */ void setColor(String color); /** * Get the attachement type (either SCROLL or FIXED) * + * @return Return the attachment type + * * @deprecated replaced by getBackgroundAttachment() */ @Deprecated @@ -157,6 +203,8 @@ public interface IScriptStyle { /** * Set the attachement type (either SCROLL or FIXED) * + * @param attachement + * * @deprecated replaced by setBackgroundAttachment( String attachment ) */ @Deprecated @@ -164,321 +212,458 @@ public interface IScriptStyle { /** * Get the attachment type (either SCROLL or FIXED) + * + * @return Return the attachement type */ String getBackgroundAttachment(); /** * Set the attachment type (either SCROLL or FIXED) + * + * @param attachment */ void setBackgroundAttachment(String attachment); /** * Get the background color + * + * @return Return the background color */ String getBackgroundColor(); /** * Set the background color + * + * @param color */ void setBackgroundColor(String color); /** * Get the background image URI + * + * @return Return the background image URI */ String getBackgroundImage(); /** * Set the background image URI + * + * @param imageURI */ void setBackgroundImage(String imageURI); + /** + * Get the background image source type + * + * @return Return the background image source type + */ + String getBackgroundImageType(); + + /** + * Set the background image source type + * + * @param imageSourceType + */ + void setBackgroundImageType(String imageSourceType); + /** * Get the background repeat type (valid types are REPEAT, REPEAT_X, REPEAT_Y * and NO_REPEAT) + * + * @return Return the background repeat */ String getBackgroundRepeat(); /** * Set the background repeat type (valid types are REPEAT, REPEAT_X, REPEAT_Y * and NO_REPEAT) + * + * @param repeat */ void setBackgroundRepeat(String repeat); /** * Get the bottom border color + * + * @return Return the bottom border color */ String getBorderBottomColor(); /** * Set the bottom border color + * + * @param color */ void setBorderBottomColor(String color); /** * Get the top border color + * + * @return Return the top border color */ String getBorderTopColor(); /** * Set the top border color + * + * @param color */ void setBorderTopColor(String color); /** * Get the right border color + * + * @return Return the right border color */ String getBorderRightColor(); /** * Set the right border color + * + * @param color */ void setBorderRightColor(String color); /** * Get the left border color + * + * @return Return the left border color */ String getBorderLeftColor(); /** * Set the left border color + * + * @param color */ void setBorderLeftColor(String color); /** * Get the bottom border style. Valid styles are NONE, SOLID, DOTTED, DASHED, * DOUBLE, GROVE, RIDGE, INSET and OUTSET. + * + * @return Return the bottom border style. */ String getBorderBottomStyle(); /** * Set the bottom border style. Valid styles are NONE, SOLID, DOTTED, DASHED, * DOUBLE, GROVE, RIDGE, INSET and OUTSET. + * + * @param borderstyle */ void setBorderBottomStyle(String borderstyle); /** * Get the top border style. Valid styles are NONE, SOLID, DOTTED, DASHED, * DOUBLE, GROVE, RIDGE, INSET and OUTSET. + * + * @return Return the top border style. */ String getBorderTopStyle(); /** * Set the top border style. Valid styles are NONE, SOLID, DOTTED, DASHED, * DOUBLE, GROVE, RIDGE, INSET and OUTSET. + * + * @param borderstyle */ void setBorderTopStyle(String borderstyle); /** * Get the left border style. Valid styles are NONE, SOLID, DOTTED, DASHED, * DOUBLE, GROVE, RIDGE, INSET and OUTSET. + * + * @return Return the left border style. */ String getBorderLeftStyle(); /** * Set the left border style. Valid styles are NONE, SOLID, DOTTED, DASHED, * DOUBLE, GROVE, RIDGE, INSET and OUTSET. + * + * @param borderstyle */ void setBorderLeftStyle(String borderstyle); /** * Get the right border style. Valid styles are NONE, SOLID, DOTTED, DASHED, * DOUBLE, GROVE, RIDGE, INSET and OUTSET. + * + * @return Return the right border style. */ String getBorderRightStyle(); /** * Set the right border style. Valid styles are NONE, SOLID, DOTTED, DASHED, * DOUBLE, GROVE, RIDGE, INSET and OUTSET. + * + * @param borderstyle */ void setBorderRightStyle(String borderstyle); /** * Get the bottom border width. + * @return Return the bottom border width. */ String getBorderBottomWidth(); /** * Set the bottom border width. + * + * @param width */ void setBorderBottomWidth(String width); /** * Get the top border width. + * + * @return Return the top border width. */ String getBorderTopWidth(); /** * Set the top border width. + * + * @param width */ void setBorderTopWidth(String width); /** * Get the left border width. + * + * @return Return the left border width. */ String getBorderLeftWidth(); /** * Set the left border width. + * + * @param width */ void setBorderLeftWidth(String width); /** - * Get the right border width. + * Get the left border width. + * + * @return Return the left border width. */ String getBorderRightWidth(); /** * Set the right border width. + * + * @param width */ void setBorderRightWidth(String width); /** * Get the bottom margin + * + * @return Return the bottom margin */ String getMarginBottom(); /** * Set the bottom margin + * + * @param margin */ void setMarginBottom(String margin); /** * Get the top margin + * + * @return Return the top margin */ String getMarginTop(); /** * Set the top margin + * + * @param margin */ void setMarginTop(String margin); /** * Get the left margin + * + * @return Return the left margin */ String getMarginLeft(); /** * Set the left margin + * + * @param margin */ void setMarginLeft(String margin); /** * Get the right margin + * + * @return Return the right margin */ String getMarginRight(); /** * Set the right margin + * + * @param margin */ void setMarginRight(String margin); /** * Get the bottom padding. + * + * @return Return the bottom padding. */ String getPaddingBottom(); /** * Set the bottom padding. + * + * @param padding */ void setPaddingBottom(String padding); /** * Get the top padding. + * + * @return Return the top padding. */ String getPaddingTop(); /** * Set the top padding. + * + * @param padding */ void setPaddingTop(String padding); /** * Get the left padding. + * + * @return Return the left padding. */ String getPaddingLeft(); /** * Set the left padding. + * + * @param padding */ void setPaddingLeft(String padding); /** * Get the right padding. + * + * @return Return the right padding. */ String getPaddingRight(); /** * Set the right padding. + * + * @param padding */ void setPaddingRight(String padding); /** * Get the display type (valid types are BLOCK, INLINE and NONE) + * + * @return Return the display type (valid types are BLOCK, INLINE and NONE) */ String getDisplay(); /** * Set the display type (valid types are BLOCK, INLINE and NONE) + * + * @param display */ void setDisplay(String display); /** * Get the master page + * + * @return Return the master page */ String getMasterPage(); /** * Set the master page + * + * @param masterPage */ void setMasterPage(String masterPage); /** * Get the page break before. + * + * @return Return the page break before. */ String getPageBreakBefore(); /** * Set the page break before + * + * @param pageBreak */ void setPageBreakBefore(String pageBreak); /** * Get the page break after. + * + * @return Return the page break after. */ String getPageBreakAfter(); /** * Set the page break after + * + * @param pageBreak */ void setPageBreakAfter(String pageBreak); /** * Get the page break inside. + * + * @return Return the page break inside. */ String getPageBreakInside(); /** * Set the page break inside + * + * @param pageBreak */ void setPageBreakInside(String pageBreak); /** * Show if blank? + * + * @return Show if blank? */ String getShowIfBlank(); /** * Set show if blank + * + * @param showIfBlank */ void setShowIfBlank(String showIfBlank); /** * Can this element shrink? + * + * @return Can this element shrink? */ String getCanShrink(); /** * Can this element shrink? + * + * @param canShrink */ void setCanShrink(String canShrink); @@ -569,114 +754,147 @@ public interface IScriptStyle { /** * Get the font family * + * @return Return the font family */ String getFontFamily(); /** * Set the font family * + * @param fontFamily + * */ void setFontFamily(String fontFamily); /** * Get the font style * + * @return Return the font style */ String getFontStyle(); /** * Set the font style * + * @param fontStyle + * */ void setFontStyle(String fontStyle); /** * Get the font variant * + * @return Return the font variant */ String getFontVariant(); /** * Set the font variant * + * @param fontVariant */ void setFontVariant(String fontVariant); /** * Get the font weight * + * @return Return the font weight */ String getFontWeight(); /** * Set the font weight * + * @param fontWeight */ void setFontWeight(String fontWeight); /** * Get the font size * + * @return Return the font size */ String getFontSize(); /** * Set the font size * + * @param fontSize */ void setFontSize(String fontSize); /** * Get the text underline + * + * @return Return the text underline */ String getTextUnderline(); /** * Set the text underline + * + * @param underline + * @throws ScriptException */ void setTextUnderline(String underline) throws ScriptException; /** * Get the text overline + * + * @return Return the text overline */ String getTextOverline(); /** * Set the text overline + * + * @param overline + * @throws ScriptException */ void setTextOverline(String overline) throws ScriptException; /** * Get the text line through + * + * @return Return the text line through */ String getTextLineThrough(); /** * Set the text line through + * + * @param through + * @throws ScriptException */ void setTextLineThrough(String through) throws ScriptException; /** * Get the X (horizontal) position of the background image * + * @return Return the X (horizontal) position of the background image */ String getBackgroundPositionX(); /** * Set the X (horizontal) position of the background image * + * @param x + * @throws ScriptException */ void setBackgroundPositionX(String x) throws ScriptException; /** * Get the Y (vertical) position of the background image * + * @return Return the Y (vertical) position of the background image */ String getBackgroundPositionY(); /** * Set the Y (vertical) position of the background image * + * @param y + * @throws ScriptException */ void setBackgroundPositionY(String y) throws ScriptException; diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/IStyle.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/IStyle.java index 469d69c0740..83a3183542c 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/IStyle.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/IStyle.java @@ -38,83 +38,317 @@ public interface IStyle extends CSSStyleDeclaration, StyleConstants, CSS2Properties, CSSConstants, CSSValueConstants, BIRTConstants, BIRTValueConstants { + /** + * Get the background position X + * + * @return Return the background position X + */ String getBackgroundPositionX(); + /** + * Get the background position Y + * + * @return Return the background position Y + */ String getBackgroundPositionY(); + /** + * Get the text underline + * + * @return Return the text underline + */ String getTextUnderline(); + /** + * Get the text overline + * + * @return Return the text overline + */ String getTextOverline(); + /** + * Get the text line through + * + * @return Return the text line through + */ String getTextLineThrough(); + /** + * Get the master page + * + * @return Return the master page + */ String getMasterPage(); + /** + * Get the option show if blank + * + * @return Return the option show if blank + */ String getShowIfBlank(); + /** + * Get the option can shrink + * + * @return Return the option can shrink + */ String getCanShrink(); + /** + * Get the string format + * + * @return Return the string format + */ String getStringFormat(); + /** + * Get the number format + * + * @return Return the number format + */ String getNumberFormat(); + /** + * Get the date format + * + * @return Return the date format + */ String getDateFormat(); + /** + * Get the date time format + * + * @return Return the date time format + */ String getDateTimeFormat(); + /** + * Get the time format + * + * @return Return the time format + */ String getTimeFormat(); + /** + * Get the number align + * + * @return Return the number align + */ String getNumberAlign(); + /** + * Get the visible format + * + * @return Return the visible format + */ String getVisibleFormat(); + /** + * Set the background position X + * + * @param x + * @throws DOMException + */ void setBackgroundPositionX(String x) throws DOMException; + /** + * Set the background position Y + * + * @param y + * @throws DOMException + */ void setBackgroundPositionY(String y) throws DOMException; + /** + * Set the text underline + * + * @param underline + * @throws DOMException + */ void setTextUnderline(String underline) throws DOMException; + /** + * Set the text overline + * + * @param overline + * @throws DOMException + */ void setTextOverline(String overline) throws DOMException; + /** + * Set the text line through + * + * @param through + * @throws DOMException + */ void setTextLineThrough(String through) throws DOMException; + /** + * Set the master page + * + * @param page + * @throws DOMException + */ void setMasterPage(String page) throws DOMException; + /** + * Set the show if blank + * + * @param blank + * @throws DOMException + */ void setShowIfBlank(String blank) throws DOMException; + /** + * Set the option can shrink + * + * @param shrink + * @throws DOMException + */ void setCanShrink(String shrink) throws DOMException; + /** + * Set the string format + * + * @param format + * @throws DOMException + */ void setStringFormat(String format) throws DOMException; + /** + * Set the number format + * + * @param format + * @throws DOMException + */ void setNumberFormat(String format) throws DOMException; + /** + * Set the date format + * + * @param format + * @throws DOMException + */ void setDateFormat(String format) throws DOMException; + /** + * Set the number align + * + * @param align + * @throws DOMException + */ void setNumberAlign(String align) throws DOMException; + /** + * Set visible format + * + * @param visibility + * @throws DOMException + */ void setVisibleFormat(String visibility) throws DOMException; + /** + * Get the property value + * + * @param index + * @return Return the property value + */ CSSValue getProperty(int index); + /** + * Set the property value + * + * @param index + * @param value + */ void setProperty(int index, CSSValue value); + /** + * Set the properties style based + * + * @param style + */ void setProperties(IStyle style); + /** + * Get the CSS text + * + * @param index + * @return Return the CSS text + */ String getCssText(int index); + /** + * Set the CSS text + * + * @param index + * @param value + * @throws DOMException + */ void setCssText(int index, String value) throws DOMException; + /** + * Is empty + * + * @return true, is empty + */ boolean isEmpty(); + /** + * Write the report ROM stream + * + * @param out + * @throws IOException + */ void write(DataOutputStream out) throws IOException; + /** + * Read the report ROM stream + * + * @param in + * @throws IOException + */ void read(DataInputStream in) throws IOException; + /** + * Get the background image height + * + * @return Return the background image height + */ String getBackgroundHeight(); + /** + * Get the background image width + * + * @return Return the background image width + */ String getBackgroundWidth(); + /** + * Get the date format + * + * @return Return the date format + */ DataFormatValue getDataFormat(); + /** + * Set the date format + * + * @param value + */ void setDataFormat(DataFormatValue value); + + /** + * Get the background image source type + * + * @return Return the background image source type + */ + String getBackgroundImageType(); + + /** + * Set the image background type + * + * @param imageType + */ + void setBackgroundImageType(String imageType); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java index 6285dc3bb45..4181ccf05c8 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java @@ -23,19 +23,36 @@ import org.eclipse.birt.report.engine.css.engine.CSSEngine; import org.eclipse.birt.report.engine.css.engine.StyleConstants; import org.eclipse.birt.report.engine.css.engine.value.DataFormatValue; +import org.eclipse.birt.report.engine.css.engine.value.birt.BIRTConstants; import org.w3c.dom.DOMException; import org.w3c.dom.css.CSSPrimitiveValue; import org.w3c.dom.css.CSSRule; import org.w3c.dom.css.CSSValue; +/** + * Definition of the abstract style class + * + * @since 3.3 + * + */ abstract public class AbstractStyle implements IStyle { protected CSSEngine engine; + /** + * Consructor + * + * @param engine + */ public AbstractStyle(CSSEngine engine) { this.engine = engine; } + /** + * Get the CSS engine + * + * @return Return the CSS engine + */ public CSSEngine getCSSEngine() { return this.engine; } @@ -58,7 +75,7 @@ public String getCssText() { // we don't return the format in css as the format // is a complex object which can't be represented as // css string. - if (i == IStyle.STYLE_DATA_FORMAT) { + if (i == StyleConstants.STYLE_DATA_FORMAT) { continue; } CSSValue value = getProperty(i); @@ -108,7 +125,7 @@ protected String getCssText(CSSValue value) { @Override public void setCssText(String cssText) throws DOMException { IStyle style = (IStyle) engine.parseStyleDeclaration(cssText); - for (int i = 0; i < IStyle.NUMBER_OF_STYLE; i++) { + for (int i = 0; i < StyleConstants.NUMBER_OF_STYLE; i++) { CSSValue value = style.getProperty(i); if (value != null) { setProperty(i, value); @@ -234,6 +251,11 @@ public String getBackgroundImage() { return getCssText(STYLE_BACKGROUND_IMAGE); } + @Override + public String getBackgroundImageType() { + return getCssText(STYLE_BACKGROUND_IMAGE_TYPE); + } + @Override public String getBackgroundHeight() { return getCssText(STYLE_BACKGROUND_HEIGHT); @@ -493,6 +515,14 @@ public void setBackgroundImage(String backgroundImage) { setCssText(STYLE_BACKGROUND_IMAGE, backgroundImage); } + /** + * @param backgroundImageSourceType The backgroundImage to set. + */ + @Override + public void setBackgroundImageType(String backgroundImageSourceType) { + setCssText(STYLE_BACKGROUND_IMAGE_TYPE, backgroundImageSourceType); + } + /** * @param backgroundPositionX The backgroundPositionX to set. */ @@ -909,12 +939,24 @@ public void setDateFormat(String format) throws DOMException { newValue.setDateFormat(format, value == null ? null : value.getDateLocale()); } + /** + * Set the date time format + * + * @param format + * @throws DOMException + */ public void setDateTimeFormat(String format) throws DOMException { DataFormatValue value = getDataFormat(); DataFormatValue newValue = copyDataFormat(value); newValue.setDateTimeFormat(format, value == null ? null : value.getDateTimeLocale()); } + /** + * Set the time format + * + * @param format + * @throws DOMException + */ public void setTimeFormat(String format) throws DOMException { DataFormatValue value = getDataFormat(); DataFormatValue newValue = copyDataFormat(value); @@ -1861,16 +1903,23 @@ public void read(DataInputStream in) throws IOException { int index = getPropertyIndex(propertyName); if (index == -1) { String propertyCssText = IOUtil.readString(in); - if (IStyle.BIRT_STRING_FORMAT_PROPERTY.equalsIgnoreCase(propertyName)) { + if (propertyName == "background-image-type") { + + var test = 1; + test = test + 61; + } + if (BIRTConstants.BIRT_STRING_FORMAT_PROPERTY.equalsIgnoreCase(propertyName)) { this.setStringFormat(propertyCssText); - } else if (IStyle.BIRT_NUMBER_FORMAT_PROPERTY.equalsIgnoreCase(propertyName)) { + } else if (BIRTConstants.BIRT_NUMBER_FORMAT_PROPERTY.equalsIgnoreCase(propertyName)) { this.setNumberFormat(propertyCssText); - } else if (IStyle.BIRT_DATE_FORMAT_PROPERTY.equalsIgnoreCase(propertyName)) { + } else if (BIRTConstants.BIRT_DATE_FORMAT_PROPERTY.equalsIgnoreCase(propertyName)) { this.setDateFormat(propertyCssText); - } else if (IStyle.BIRT_TIME_FORMAT_PROPERTY.equalsIgnoreCase(propertyName)) { + } else if (BIRTConstants.BIRT_TIME_FORMAT_PROPERTY.equalsIgnoreCase(propertyName)) { this.setTimeFormat(propertyCssText); - } else if (IStyle.BIRT_DATE_TIME_FORMAT_PROPERTY.equalsIgnoreCase(propertyName)) { + } else if (BIRTConstants.BIRT_DATE_TIME_FORMAT_PROPERTY.equalsIgnoreCase(propertyName)) { this.setDateTimeFormat(propertyCssText); + } else if (BIRTConstants.BIRT_BACKGROUND_IMAGE_TYPE.equalsIgnoreCase(propertyName)) { + this.setBackgroundImageType(propertyCssText); } else { throw new IOException(propertyName + " not valid"); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/StyleDeclaration.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/StyleDeclaration.java index 5f1a9e0d28a..ba3ee07cc5a 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/StyleDeclaration.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/StyleDeclaration.java @@ -21,6 +21,12 @@ import org.eclipse.birt.report.engine.css.engine.CSSEngine; import org.w3c.dom.css.CSSValue; +/** + * Definition of the style declarations + * + * @since 3.3 + * + */ public class StyleDeclaration extends AbstractStyle { protected CSSValue[] values; protected boolean shared; @@ -54,6 +60,11 @@ public CSSValue getProperty(int index) { return values[index]; } + /** + * Constructor of style declaration based on style declaration + * + * @param style + */ public StyleDeclaration(StyleDeclaration style) { super(style.engine); this.values = style.values; @@ -61,6 +72,11 @@ public StyleDeclaration(StyleDeclaration style) { this.shared = true; } + /** + * Constructor of style declaration based on CSS engine + * + * @param engine + */ public StyleDeclaration(CSSEngine engine) { super(engine); this.values = new CSSValue[NUMBER_OF_STYLE]; diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/StyleConstants.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/StyleConstants.java index 9a7e9b12461..d691cc20c03 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/StyleConstants.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/StyleConstants.java @@ -13,72 +13,203 @@ *******************************************************************************/ package org.eclipse.birt.report.engine.css.engine; +/** + * Definition of the style constants index based + * + * @since 3.3 + * + */ public interface StyleConstants { // bidi_hcg: As a result of a new style added ("direction"), align the // constants with org.eclipse.birt.report.engine.css.engine.PerfectHash + /** style property: color */ int STYLE_COLOR = 0; + + /** style property: data format */ int STYLE_DATA_FORMAT = 1; + + /** style property: line height */ int STYLE_LINE_HEIGHT = 2; + + /** style property: padding left */ int STYLE_PADDING_LEFT = 3; + + /** style property: padding right */ int STYLE_PADDING_RIGHT = 4; + + /** style property: direction */ int STYLE_DIRECTION = 5; + + /** style property: padding top */ int STYLE_PADDING_TOP = 6; + + /** style property: background height */ int STYLE_BACKGROUND_HEIGHT = 7; + + /** style property: background color */ int STYLE_BACKGROUND_COLOR = 8; + + /** style property: background repeat */ int STYLE_BACKGROUND_REPEAT = 9; + + /** style property: border right width */ int STYLE_BORDER_RIGHT_WIDTH = 10; + + /** style property: border bottom width */ int STYLE_BORDER_BOTTOM_WIDTH = 11; + + /** style property: can shrink */ int STYLE_CAN_SHRINK = 12; + + /** style property: border top color */ int STYLE_BORDER_TOP_COLOR = 13; + + /** style property: border right color */ int STYLE_BORDER_RIGHT_COLOR = 14; + + /** style property: border bottom color */ int STYLE_BORDER_BOTTOM_COLOR = 15; + + /** style property: margin left */ int STYLE_MARGIN_LEFT = 16; + + /** style property: margin right */ int STYLE_MARGIN_RIGHT = 17; + + /** style property: padding bottom */ int STYLE_PADDING_BOTTOM = 18; + + /** style property: margin top */ int STYLE_MARGIN_TOP = 19; + + /** style property: text indent */ int STYLE_TEXT_INDENT = 20; + + /** style property: border right style */ int STYLE_BORDER_RIGHT_STYLE = 21; + + /** style property: border bottom style */ int STYLE_BORDER_BOTTOM_STYLE = 22; + + /** style property: text align */ int STYLE_TEXT_ALIGN = 23; + + /** style property: height */ int STYLE_HEIGHT = 24; + + /** style property: number align */ int STYLE_NUMBER_ALIGN = 25; + + /** style property: width */ int STYLE_WIDTH = 26; + + /** style property: text linethrough */ int STYLE_TEXT_LINETHROUGH = 27; + + /** style property: orphans */ int STYLE_ORPHANS = 28; + + /** style property: font weight */ int STYLE_FONT_WEIGHT = 29; + + /** style property: font variant */ int STYLE_FONT_VARIANT = 30; + + /** style property: margin bottom */ int STYLE_MARGIN_BOTTOM = 31; + + /** style property: background position x */ int STYLE_BACKGROUND_POSITION_X = 32; + + /** style property: page break before */ int STYLE_PAGE_BREAK_BEFORE = 33; + + /** style property: text overline */ int STYLE_TEXT_OVERLINE = 34; + + /** style property: text transform */ int STYLE_TEXT_TRANSFORM = 35; + + /** style property: background width */ int STYLE_BACKGROUND_WIDTH = 36; + + /** style property: background position y */ int STYLE_BACKGROUND_POSITION_Y = 37; + + /** style property: overflow */ int STYLE_OVERFLOW = 38; + + /** style property: font size */ int STYLE_FONT_SIZE = 39; + + /** style property: font style */ int STYLE_FONT_STYLE = 40; + + /** style property: border top width */ int STYLE_BORDER_TOP_WIDTH = 41; + + /** style property: border left width */ int STYLE_BORDER_LEFT_WIDTH = 42; + + /** style property: show if blank */ int STYLE_SHOW_IF_BLANK = 43; + + /** style property: letter spacing */ int STYLE_LETTER_SPACING = 44; + + /** style property: background image */ int STYLE_BACKGROUND_IMAGE = 45; + + /** style property: border left color */ int STYLE_BORDER_LEFT_COLOR = 46; + + /** style property: background attachment */ int STYLE_BACKGROUND_ATTACHMENT = 47; + + /** style property: vertical align */ int STYLE_VERTICAL_ALIGN = 48; + + /** style property: border top style */ int STYLE_BORDER_TOP_STYLE = 49; + + /** style property: display */ int STYLE_DISPLAY = 50; + + /** style property: master page */ int STYLE_MASTER_PAGE = 51; + + /** style property: border left style */ int STYLE_BORDER_LEFT_STYLE = 52; + + /** style property: visible format */ int STYLE_VISIBLE_FORMAT = 53; + + /** style property: widows */ int STYLE_WIDOWS = 54; + + /** style property: font family */ int STYLE_FONT_FAMILY = 55; + + /** style property: page break inside */ int STYLE_PAGE_BREAK_INSIDE = 56; + + /** style property: page break after */ int STYLE_PAGE_BREAK_AFTER = 57; + + /** style property: text underline */ int STYLE_TEXT_UNDERLINE = 58; + + /** style property: word spacing */ int STYLE_WORD_SPACING = 59; + + /** style property: white space */ int STYLE_WHITE_SPACE = 60; + + /** style property: background image type */ int STYLE_BACKGROUND_IMAGE_TYPE = 61; + + /** number (count) of style constants */ int NUMBER_OF_STYLE = 62; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/birt/BIRTConstants.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/birt/BIRTConstants.java index 1ee1298552a..4faa7c6d2a4 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/birt/BIRTConstants.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/birt/BIRTConstants.java @@ -24,33 +24,87 @@ public interface BIRTConstants extends CSSConstants { ///////////////////////////////////////////////////////////////////////// // BIRT attributes ///////////////////////////////////////////////////////////////////////// + /** + * BIRT property: background image type + */ + String BIRT_BACKGROUND_IMAGE_TYPE = "background-image-type"; + /** + * BIRT property: background position X + */ String BIRT_BACKGROUND_POSITION_X_PROPERTY = "background-position-x"; + /** + * BIRT property: background position Y + */ String BIRT_BACKGROUND_POSITION_Y_PROPERTY = "background-position-y"; + /** + * BIRT property: can shrink + */ String BIRT_CAN_SHRINK_PROPERTY = "can-shrink"; //$NON-NLS-1$ + /** + * BIRT property: master-page + */ String BIRT_MASTER_PAGE_PROPERTY = "master-page"; //$NON-NLS-1$ + /** + * BIRT property: number-align + */ String BIRT_NUMBER_ALIGN_PROPERTY = "number-align"; + /** + * BIRT property: show-if-blank + */ String BIRT_SHOW_IF_BLANK_PROPERTY = "show-if-blank"; //$NON-NLS-1$ + /** + * BIRT property: text underline + */ String BIRT_TEXT_UNDERLINE_PROPERTY = "text-underline"; //$NON-NLS-1$ + /** + * BIRT property: text overline + */ String BIRT_TEXT_OVERLINE_PROPERTY = "text-overline"; //$NON-NLS-1$ + /** + * BIRT property: text linethrough + */ String BIRT_TEXT_LINETHROUGH_PROPERTY = "text-linethrough"; //$NON-NLS-1$ + /** + * BIRT property: visible format + */ String BIRT_VISIBLE_FORMAT_PROPERTY = "visible-format"; + /** + * BIRT property: data format + */ String BIRT_STYLE_DATA_FORMAT = "data-format"; /////////////////////////////////////////////////////////////////////// // Deprecated format constants, they are replaced by data-format ////////////////////////////////////////////////////////////////////// + /** BIRT property: date format */ String BIRT_DATE_TIME_FORMAT_PROPERTY = "date-format"; //$NON-NLS-1$ + /** BIRT property: sql time format */ String BIRT_TIME_FORMAT_PROPERTY = "sql-time-format"; //$NON-NLS-1$ + /** BIRT property: sql date format */ String BIRT_DATE_FORMAT_PROPERTY = "sql-date-format"; //$NON-NLS-1$ + /** BIRT property: number format */ String BIRT_NUMBER_FORMAT_PROPERTY = "number-format"; //$NON-NLS-1$ + /** BIRT property: string format */ String BIRT_STRING_FORMAT_PROPERTY = "string-format"; //$NON-NLS-1$ ///////////////////////////////////////////////////////////////////////// // BIRT attribute value ///////////////////////////////////////////////////////////////////////// + /** + * BIRT attribute value: true + */ String BIRT_TRUE_VALUE = "true"; + /** + * BIRT attribute value: false + */ String BIRT_FALSE_VALUE = "false"; + /** + * BIRT attribute value: all + */ String BIRT_ALL_VALUE = "all"; + /** + * BIRT attribute value: soft + */ String BIRT_SOFT_VALUE = "soft"; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java index accca0097e6..58ff3183e76 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java @@ -16,6 +16,7 @@ import org.eclipse.birt.report.engine.css.engine.value.IdentifierManager; import org.eclipse.birt.report.engine.css.engine.value.StringMap; import org.eclipse.birt.report.engine.css.engine.value.Value; +import org.eclipse.birt.report.engine.css.engine.value.birt.BIRTConstants; /** * class to handle the CSS properties of background image type @@ -48,7 +49,7 @@ public BackgroundImageType() { @Override public String getPropertyName() { - return CSSConstants.CSS_BACKGROUND_IMAGE_TYPE_PROPERTY; + return BIRTConstants.BIRT_BACKGROUND_IMAGE_TYPE; } @Override diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSConstants.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSConstants.java index 55f958a4a11..badaa22162d 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSConstants.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSConstants.java @@ -21,331 +21,1199 @@ public interface CSSConstants { // - // The CSS property names. + // The CSS property. // - String CSS_BACKGROUND_ATTACHMENT_PROPERTY = "background-attachment"; - String CSS_BACKGROUND_COLOR_PROPERTY = "background-color"; - String CSS_BACKGROUND_IMAGE_PROPERTY = "background-image"; - String CSS_BACKGROUND_IMAGE_TYPE_PROPERTY = "background-image-type"; - String CSS_BACKGROUND_REPEAT_PROPERTY = "background-repeat"; - String CSS_BACKGROUND_REPEAT_X_PROPERTY = "background-repeat-x"; - String CSS_BACKGROUND_REPEAT_Y_PROPERTY = "background-repeat-y"; - String CSS_BACKGROUND_HEIGHT_PROPERTY = "background-height"; - String CSS_BACKGROUND_WIDTH_PROPERTY = "background-width"; - - String CSS_BORDER_TOP_COLOR_PROPERTY = "border-top-color"; - String CSS_BORDER_RIGHT_COLOR_PROPERTY = "border-right-color"; - String CSS_BORDER_BOTTOM_COLOR_PROPERTY = "border-bottom-color"; - String CSS_BORDER_LEFT_COLOR_PROPERTY = "border-left-color"; - String CSS_BORDER_TOP_STYLE_PROPERTY = "border-top-style"; - String CSS_BORDER_RIGHT_STYLE_PROPERTY = "border-right-style"; - String CSS_BORDER_BOTTOM_STYLE_PROPERTY = "border-bottom-style"; - String CSS_BORDER_LEFT_STYLE_PROPERTY = "border-left-style"; - String CSS_BORDER_TOP_WIDTH_PROPERTY = "border-top-width"; - String CSS_BORDER_RIGHT_WIDTH_PROPERTY = "border-right-width"; - String CSS_BORDER_BOTTOM_WIDTH_PROPERTY = "border-bottom-width"; - String CSS_BORDER_LEFT_WIDTH_PROPERTY = "border-left-width"; - String CSS_COLOR_PROPERTY = "color"; - String CSS_DISPLAY_PROPERTY = "display"; - String CSS_FONT_FAMILY_PROPERTY = "font-family"; - String CSS_FONT_SIZE_PROPERTY = "font-size"; - String CSS_FONT_STYLE_PROPERTY = "font-style"; - String CSS_FONT_VARIANT_PROPERTY = "font-variant"; - String CSS_FONT_WEIGHT_PROPERTY = "font-weight"; - String CSS_LETTER_SPACING_PROPERTY = "letter-spacing"; - String CSS_LINE_HEIGHT_PROPERTY = "line-height"; - String CSS_MARGIN_RIGHT_PROPERTY = "margin-right"; - String CSS_MARGIN_LEFT_PROPERTY = "margin-left"; - String CSS_MARGIN_TOP_PROPERTY = "margin-top"; - String CSS_MARGIN_BOTTOM_PROPERTY = "margin-bottom"; - String CSS_ORPHANS_PROPERTY = "orphans"; - String CSS_PADDING_TOP_PROPERTY = "padding-top"; - String CSS_PADDING_RIGHT_PROPERTY = "padding-right"; - String CSS_PADDING_BOTTOM_PROPERTY = "padding-bottom"; - String CSS_PADDING_LEFT_PROPERTY = "padding-left"; - String CSS_PAGE_BREAK_AFTER_PROPERTY = "page-break-after"; - String CSS_PAGE_BREAK_BEFORE_PROPERTY = "page-break-before"; - String CSS_PAGE_BREAK_INSIDE_PROPERTY = "page-break-inside"; - String CSS_TEXT_ALIGN_PROPERTY = "text-align"; - String CSS_TEXT_INDENT_PROPERTY = "text-indent"; - String CSS_TEXT_TRANSFORM_PROPERTY = "text-transform"; - String CSS_VERTICAL_ALIGN_PROPERTY = "vertical-align"; - String CSS_WHITE_SPACE_PROPERTY = "white-space"; - String CSS_WIDOWS_PROPERTY = "widows"; - String CSS_WORD_SPACING_PROPERTY = "word-spacing"; + + /** + * CSS property: background-attachment + */ + public final static String CSS_BACKGROUND_ATTACHMENT_PROPERTY = "background-attachment"; + /** + * CSS property: background-color + */ + public final static String CSS_BACKGROUND_COLOR_PROPERTY = "background-color"; + /** + * CSS property: background-image + */ + public final static String CSS_BACKGROUND_IMAGE_PROPERTY = "background-image"; + /** + * CSS property: background-repeat + */ + public final static String CSS_BACKGROUND_REPEAT_PROPERTY = "background-repeat"; + /** + * CSS property: background-repeat-x + */ + public final static String CSS_BACKGROUND_REPEAT_X_PROPERTY = "background-repeat-x"; + /** + * CSS property: background-repeat-y + */ + public final static String CSS_BACKGROUND_REPEAT_Y_PROPERTY = "background-repeat-y"; + /** + * CSS property: background-height + */ + public final static String CSS_BACKGROUND_HEIGHT_PROPERTY = "background-height"; + /** + * CSS property: background-width + */ + public final static String CSS_BACKGROUND_WIDTH_PROPERTY = "background-width"; + + /** + * CSS property: border-top-color + */ + public final static String CSS_BORDER_TOP_COLOR_PROPERTY = "border-top-color"; + /** + * CSS property: border-top-color + */ + public final static String CSS_BORDER_RIGHT_COLOR_PROPERTY = "border-right-color"; + /** + * CSS property: border-right-color + */ + public final static String CSS_BORDER_BOTTOM_COLOR_PROPERTY = "border-bottom-color"; + /** + * CSS property: border-left-color + */ + public final static String CSS_BORDER_LEFT_COLOR_PROPERTY = "border-left-color"; + /** + * CSS property: border-top-style + */ + public final static String CSS_BORDER_TOP_STYLE_PROPERTY = "border-top-style"; + /** + * CSS property: border-right-style + */ + public final static String CSS_BORDER_RIGHT_STYLE_PROPERTY = "border-right-style"; + /** + * CSS property: border-bottom-style + */ + public final static String CSS_BORDER_BOTTOM_STYLE_PROPERTY = "border-bottom-style"; + /** + * CSS property: border-left-style + */ + public final static String CSS_BORDER_LEFT_STYLE_PROPERTY = "border-left-style"; + + /** + * CSS property: border-top-width + */ + public final static String CSS_BORDER_TOP_WIDTH_PROPERTY = "border-top-width"; + /** + * CSS property: border-right-width + */ + public final static String CSS_BORDER_RIGHT_WIDTH_PROPERTY = "border-right-width"; + /** + * CSS property: border-bottom-width + */ + public final static String CSS_BORDER_BOTTOM_WIDTH_PROPERTY = "border-bottom-width"; + /** + * CSS property: border-left-width + */ + public final static String CSS_BORDER_LEFT_WIDTH_PROPERTY = "border-left-width"; + + /** + * CSS property: color + */ + public final static String CSS_COLOR_PROPERTY = "color"; + /** + * CSS property: display + */ + public final static String CSS_DISPLAY_PROPERTY = "display"; + /** + * CSS property: font-family + */ + public final static String CSS_FONT_FAMILY_PROPERTY = "font-family"; + /** + * CSS property: font-size + */ + public final static String CSS_FONT_SIZE_PROPERTY = "font-size"; + /** + * CSS property: font-style + */ + public final static String CSS_FONT_STYLE_PROPERTY = "font-style"; + /** + * CSS property: font-variant + */ + public final static String CSS_FONT_VARIANT_PROPERTY = "font-variant"; + /** + * CSS property: font-weight + */ + public final static String CSS_FONT_WEIGHT_PROPERTY = "font-weight"; + /** + * CSS property: letter-spacing + */ + public final static String CSS_LETTER_SPACING_PROPERTY = "letter-spacing"; + /** + * CSS property: line-height + */ + public final static String CSS_LINE_HEIGHT_PROPERTY = "line-height"; + /** + * CSS property: margin-right + */ + public final static String CSS_MARGIN_RIGHT_PROPERTY = "margin-right"; + /** + * CSS property: margin-left + */ + public final static String CSS_MARGIN_LEFT_PROPERTY = "margin-left"; + /** + * CSS property: margin-top + */ + public final static String CSS_MARGIN_TOP_PROPERTY = "margin-top"; + /** + * CSS property: margin-bottom + */ + public final static String CSS_MARGIN_BOTTOM_PROPERTY = "margin-bottom"; + /** + * CSS property: orphans + */ + public final static String CSS_ORPHANS_PROPERTY = "orphans"; + /** + * CSS property: padding-top + */ + public final static String CSS_PADDING_TOP_PROPERTY = "padding-top"; + /** + * CSS property: padding-right + */ + public final static String CSS_PADDING_RIGHT_PROPERTY = "padding-right"; + /** + * CSS property: padding-bottom + */ + public final static String CSS_PADDING_BOTTOM_PROPERTY = "padding-bottom"; + /** + * CSS property: padding-left + */ + public final static String CSS_PADDING_LEFT_PROPERTY = "padding-left"; + /** + * CSS property: page-break-after + */ + public final static String CSS_PAGE_BREAK_AFTER_PROPERTY = "page-break-after"; + /** + * CSS property: page-break-before + */ + public final static String CSS_PAGE_BREAK_BEFORE_PROPERTY = "page-break-before"; + /** + * CSS property: page-break-inside + */ + public final static String CSS_PAGE_BREAK_INSIDE_PROPERTY = "page-break-inside"; + /** + * CSS property: text-align + */ + public final static String CSS_TEXT_ALIGN_PROPERTY = "text-align"; + /** + * CSS property: text-indent + */ + public final static String CSS_TEXT_INDENT_PROPERTY = "text-indent"; + /** + * CSS property: text-transform + */ + public final static String CSS_TEXT_TRANSFORM_PROPERTY = "text-transform"; + /** + * CSS property: text-transform + */ + public final static String CSS_VERTICAL_ALIGN_PROPERTY = "vertical-align"; + /** + * CSS property: white-space + */ + public final static String CSS_WHITE_SPACE_PROPERTY = "white-space"; + /** + * CSS property: widows + */ + public final static String CSS_WIDOWS_PROPERTY = "widows"; + /** + * CSS property: word-spacing + */ + public final static String CSS_WORD_SPACING_PROPERTY = "word-spacing"; + // // The CSS property values. // - // background attachment - String CSS_SCROLL_VALUE = "scroll"; - String CSS_FIXED_VALUE = "fixed"; - - // background color - String CSS_TRANSPARENT_VALUE = "transparent"; - - // background position - String CSS_CENTER_VALUE = "center"; - String CSS_LEFT_VALUE = "left"; - String CSS_BOTTOM_VALUE = "bottom"; - - // background size - String CSS_CONTAIN_VALUE = "contain"; - String CSS_COVER_VALUE = "cover"; - - String CSS_100_VALUE = "100"; - String CSS_200_VALUE = "200"; - String CSS_300_VALUE = "300"; - String CSS_400_VALUE = "400"; - String CSS_500_VALUE = "500"; - String CSS_600_VALUE = "600"; - String CSS_700_VALUE = "700"; - String CSS_800_VALUE = "800"; - String CSS_900_VALUE = "900"; - String CSS_ABOVE_VALUE = "above"; - String CSS_ABSOLUTE_VALUE = "absolute"; - String CSS_ALWAYS_VALUE = "always"; - String CSS_ARMENIAN_VALUE = "armenian"; - String CSS_ATTR_VALUE = "attr()"; - String CSS_AUTO_VALUE = "auto"; - String CSS_AVOID_VALUE = "avoid"; - String CSS_BASELINE_VALUE = "baseline"; - String CSS_BEHIND_VALUE = "behind"; - String CSS_BELOW_VALUE = "below"; - String CSS_BIDI_OVERRIDE_VALUE = "bidi-override"; - String CSS_BLINK_VALUE = "blink"; - String CSS_BLOCK_VALUE = "block"; - String CSS_BOLD_VALUE = "bold"; - String CSS_BOLDER_VALUE = "bolder"; - String CSS_BOTH_VALUE = "both"; - String CSS_CAPITALIZE_VALUE = "capitalize"; - String CSS_CAPTION_VALUE = "caption"; - String CSS_CENTER_LEFT_VALUE = "center-left"; - String CSS_CENTER_RIGHT_VALUE = "center-right"; - String CSS_CIRCLE_VALUE = "circle"; - String CSS_CLOSE_QUOTE_VALUE = "close-quote"; - String CSS_CODE_VALUE = "code"; - String CSS_COLLAPSE_VALUE = "collapse"; - String CSS_CONTINUOUS_VALUE = "continuous"; - String CSS_CROSSHAIR_VALUE = "crosshair"; - String CSS_DECIMAL_VALUE = "decimal"; - String CSS_DECIMAL_LEADING_ZERO_VALUE = "decimal-leading-zero"; - String CSS_DEFAULT_VALUE = "default"; - String CSS_DIGITS_VALUE = "digits"; - String CSS_DISC_VALUE = "disc"; - String CSS_EMBED_VALUE = "embed"; - String CSS_E_RESIZE_VALUE = "e-resize"; - String CSS_FAR_LEFT_VALUE = "far-left"; - String CSS_FAR_RIGHT_VALUE = "far-right"; - String CSS_FAST_VALUE = "fast"; - String CSS_FASTER_VALUE = "faster"; - String CSS_GEORGIAN_VALUE = "georgian"; - String CSS_HELP_VALUE = "help"; - String CSS_HIDDEN_VALUE = "hidden"; - String CSS_HIDE_VALUE = "hide"; - String CSS_HIGH_VALUE = "high"; - String CSS_HIGHER_VALUE = "higher"; - String CSS_ICON_VALUE = "icon"; - String CSS_INHERIT_VALUE = "inherit"; - String CSS_INLINE_VALUE = "inline"; - String CSS_INLINE_BLOCK_VALUE = "inline-block"; - String CSS_INLINE_TABLE_VALUE = "inline-table"; - String CSS_INSIDE_VALUE = "inside"; - String CSS_INVERT_VALUE = "invert"; - String CSS_ITALIC_VALUE = "italic"; - String CSS_JUSTIFY_VALUE = "justify"; - String CSS_LEFT_SIDE_VALUE = "left-side"; - String CSS_LEFTWARDS_VALUE = "leftwards"; - String CSS_LEVEL_VALUE = "level"; - String CSS_LIGHTER_VALUE = "lighter"; - String CSS_LINE_THROUGH_VALUE = "line-through"; - String CSS_LIST_ITEM_VALUE = "list-item"; - String CSS_LOUD_VALUE = "loud"; - String CSS_LOW_VALUE = "low"; - String CSS_LOWER_VALUE = "lower"; - String CSS_LOWER_ALPHA_VALUE = "lower-alpha"; - String CSS_LOWERCASE_VALUE = "lowercase"; - String CSS_LOWER_GREEK_VALUE = "lower-greek"; - String CSS_LOWER_LATIN_VALUE = "lower-latin"; - String CSS_LOWER_ROMAN_VALUE = "lower-roman"; - String CSS_LTR_VALUE = "ltr"; - String CSS_MEDIUM_VALUE = "medium"; - String CSS_MENU_VALUE = "menu"; - String CSS_MESSAGE_BOX_VALUE = "message-box"; - String CSS_MIDDLE_VALUE = "middle"; - String CSS_MIX_VALUE = "mix"; - String CSS_MOVE_VALUE = "move"; - String CSS_NE_RESIZE_VALUE = "ne-resize"; - String CSS_NO_CLOSE_QUOTE_VALUE = "no-close-quote"; - String CSS_NONE_VALUE = "none"; - String CSS_NO_OPEN_QUOTE_VALUE = "no-open-quote"; - String CSS_NO_REPEAT_VALUE = "no-repeat"; - String CSS_NORMAL_VALUE = "normal"; - String CSS_NOWRAP_VALUE = "nowrap"; - String CSS_N_RESIZE_VALUE = "n-resize"; - String CSS_NW_RESIZE_VALUE = "nw-resize"; - String CSS_OBLIQUE_VALUE = "oblique"; - String CSS_ONCE_VALUE = "once"; - String CSS_OPEN_QUOTE_VALUE = "open-quote"; - String CSS_OUTSIDE_VALUE = "outside"; - String CSS_OVERLINE_VALUE = "overline"; - String CSS_POINTER_VALUE = "pointer"; - String CSS_PRE_VALUE = "pre"; - String CSS_PRE_LINE_VALUE = "pre-line"; - String CSS_PRE_WRAP_VALUE = "pre-wrap"; - String CSS_PROGRESS_VALUE = "progress"; - String CSS_RELATIVE_VALUE = "relative"; - String CSS_REPEAT_VALUE = "repeat"; - String CSS_REPEAT_X_VALUE = "repeat-x"; - String CSS_REPEAT_Y_VALUE = "repeat-y"; - String CSS_RIGHT_VALUE = "right"; - String CSS_RIGHT_SIDE_VALUE = "right-side"; - String CSS_RIGHTWARDS_VALUE = "rightwards"; - String CSS_RTL_VALUE = "rtl"; - String CSS_RUN_IN_VALUE = "run-in"; - String CSS_SEPARATE_VALUE = "separate"; - String CSS_SE_RESIZE_VALUE = "se-resize"; - String CSS_SHOW_VALUE = "show"; - String CSS_SILENT_VALUE = "silent"; - String CSS_SLOW_VALUE = "slow"; - String CSS_SLOWER_VALUE = "slower"; - String CSS_SMALL_CAPS_VALUE = "small-caps"; - String CSS_SMALL_CAPTION_VALUE = "small-caption"; - String CSS_SOFT_VALUE = "soft"; - String CSS_SPELL_OUT_VALUE = "spell-out"; - String CSS_SQUARE_VALUE = "square"; - String CSS_S_RESIZE_VALUE = "s-resize"; - String CSS_STATIC_VALUE = "static"; - String CSS_STATUS_BAR_VALUE = "status-bar"; - String CSS_SUB_VALUE = "sub"; - String CSS_SUPER_VALUE = "super"; - String CSS_SW_RESIZE_VALUE = "sw-resize"; - String CSS_TABLE_VALUE = "table"; - String CSS_TABLE_CAPTION_VALUE = "table-caption"; - String CSS_TABLE_CELL_VALUE = "table-cell"; - String CSS_TABLE_COLUMN_VALUE = "table-column"; - String CSS_TABLE_COLUMN_GROUP_VALUE = "table-column-group"; - String CSS_TABLE_FOOTER_GROUP_VALUE = "table-footer-group"; - String CSS_TABLE_HEADER_GROUP_VALUE = "table-header-group"; - String CSS_TABLE_ROW_VALUE = "table-row"; - String CSS_TABLE_ROW_GROUP_VALUE = "table-row-group"; - String CSS_TEXT_VALUE = "text"; - String CSS_TEXT_BOTTOM_VALUE = "text-bottom"; - String CSS_TEXT_TOP_VALUE = "text-top"; - String CSS_TOP_VALUE = "top"; - String CSS_UNDERLINE_VALUE = "underline"; - String CSS_UPPER_ALPHA_VALUE = "upper-alpha"; - String CSS_UPPERCASE_VALUE = "uppercase"; - String CSS_UPPER_LATIN_VALUE = "upper-latin"; - String CSS_UPPER_ROMAN_VALUE = "upper-roman"; - String CSS_VISIBLE_VALUE = "visible"; - String CSS_WAIT_VALUE = "wait"; - String CSS_W_RESIZE_VALUE = "w-resize"; - String CSS_X_FAST_VALUE = "x-fast"; - String CSS_X_HIGH_VALUE = "x-high"; - String CSS_X_LOUD_VALUE = "x-loud"; - String CSS_X_LOW_VALUE = "x-low"; - String CSS_X_SLOW_VALUE = "x-slow"; - String CSS_X_SOFT_VALUE = "x-soft"; + /** + * CSS property value, background attachment: scroll + */ + public final static String CSS_SCROLL_VALUE = "scroll"; + /** + * CSS property value, background attachment: fixed + */ + public final static String CSS_FIXED_VALUE = "fixed"; + + /** + * CSS property value, background color: transparent + */ + public final static String CSS_TRANSPARENT_VALUE = "transparent"; + + /** + * CSS property value, background position: center + */ + public final static String CSS_CENTER_VALUE = "center"; + /** + * CSS property value, background position: left + */ + public final static String CSS_LEFT_VALUE = "left"; + /** + * CSS property value, background position: bottom + */ + public final static String CSS_BOTTOM_VALUE = "bottom"; + + + /** + * CSS property value, background size: contain + */ + public final static String CSS_CONTAIN_VALUE = "contain"; + /** + * CSS property value, background size: cover + */ + public final static String CSS_COVER_VALUE = "cover"; + + /** + * CSS property value: 100 + */ + public final static String CSS_100_VALUE = "100"; + /** + * CSS property value: 200 + */ + public final static String CSS_200_VALUE = "200"; + /** + * CSS property value: 300 + */ + public final static String CSS_300_VALUE = "300"; + /** + * CSS property value: 400 + */ + public final static String CSS_400_VALUE = "400"; + /** + * CSS property value: 500 + */ + public final static String CSS_500_VALUE = "500"; + /** + * CSS property value: 600 + */ + public final static String CSS_600_VALUE = "600"; + /** + * CSS property value: 700 + */ + public final static String CSS_700_VALUE = "700"; + /** + * CSS property value: 800 + */ + public final static String CSS_800_VALUE = "800"; + /** + * CSS property value: 900 + */ + public final static String CSS_900_VALUE = "900"; + /** + * CSS property value: above + */ + public final static String CSS_ABOVE_VALUE = "above"; + /** + * CSS property value: absolute + */ + public final static String CSS_ABSOLUTE_VALUE = "absolute"; + /** + * CSS property value: always + */ + public final static String CSS_ALWAYS_VALUE = "always"; + /** + * CSS property value: armenian + */ + public final static String CSS_ARMENIAN_VALUE = "armenian"; + /** + * CSS property value: attr() + */ + public final static String CSS_ATTR_VALUE = "attr()"; + + /** + * CSS property value: auto + */ + public final static String CSS_AUTO_VALUE = "auto"; + /** + * CSS property value: avoid + */ + public final static String CSS_AVOID_VALUE = "avoid"; + /** + * CSS property value: baseline + */ + public final static String CSS_BASELINE_VALUE = "baseline"; + /** + * CSS property value: behind + */ + public final static String CSS_BEHIND_VALUE = "behind"; + /** + * CSS property value: below + */ + public final static String CSS_BELOW_VALUE = "below"; + /** + * CSS property value:bidi-override + */ + public final static String CSS_BIDI_OVERRIDE_VALUE = "bidi-override"; + /** + * CSS property value: blink + */ + public final static String CSS_BLINK_VALUE = "blink"; + /** + * CSS property value: block + */ + public final static String CSS_BLOCK_VALUE = "block"; + /** + * CSS property value: bold + */ + public final static String CSS_BOLD_VALUE = "bold"; + /** + * CSS property value: bolder + */ + public final static String CSS_BOLDER_VALUE = "bolder"; + /** + * CSS property value: both + */ + public final static String CSS_BOTH_VALUE = "both"; + /** + * CSS property value: capitalize + */ + public final static String CSS_CAPITALIZE_VALUE = "capitalize"; + /** + * CSS property value: caption + */ + public final static String CSS_CAPTION_VALUE = "caption"; + /** + * CSS property value: center-left + */ + public final static String CSS_CENTER_LEFT_VALUE = "center-left"; + /** + * CSS property value: center-right + */ + public final static String CSS_CENTER_RIGHT_VALUE = "center-right"; + /** + * CSS property value: circle + */ + public final static String CSS_CIRCLE_VALUE = "circle"; + /** + * CSS property value: close-quote + */ + public final static String CSS_CLOSE_QUOTE_VALUE = "close-quote"; + /** + * CSS property value: code + */ + public final static String CSS_CODE_VALUE = "code"; + /** + * CSS property value: collapse + */ + public final static String CSS_COLLAPSE_VALUE = "collapse"; + /** + * CSS property value: continuous + */ + public final static String CSS_CONTINUOUS_VALUE = "continuous"; + /** + * CSS property value: crosshair + */ + public final static String CSS_CROSSHAIR_VALUE = "crosshair"; + /** + * CSS property value: decimal + */ + public final static String CSS_DECIMAL_VALUE = "decimal"; + /** + * CSS property value: decimal-leading-zero + */ + public final static String CSS_DECIMAL_LEADING_ZERO_VALUE = "decimal-leading-zero"; + /** + * CSS property value: default + */ + public final static String CSS_DEFAULT_VALUE = "default"; + /** + * CSS property value: digits + */ + public final static String CSS_DIGITS_VALUE = "digits"; + /** + * CSS property value: disc + */ + public final static String CSS_DISC_VALUE = "disc"; + /** + * CSS property value: embed + */ + public final static String CSS_EMBED_VALUE = "embed"; + /** + * CSS property value: e-resize + */ + public final static String CSS_E_RESIZE_VALUE = "e-resize"; + /** + * CSS property value: far-left + */ + public final static String CSS_FAR_LEFT_VALUE = "far-left"; + /** + * CSS property value: far-right + */ + public final static String CSS_FAR_RIGHT_VALUE = "far-right"; + /** + * CSS property value: fast + */ + public final static String CSS_FAST_VALUE = "fast"; + /** + * CSS property value: faster + */ + public final static String CSS_FASTER_VALUE = "faster"; + /** + * CSS property value: georgian + */ + public final static String CSS_GEORGIAN_VALUE = "georgian"; + /** + * CSS property value: help + */ + public final static String CSS_HELP_VALUE = "help"; + /** + * CSS property value: hidden + */ + public final static String CSS_HIDDEN_VALUE = "hidden"; + /** + * CSS property value: hide + */ + public final static String CSS_HIDE_VALUE = "hide"; + /** + * CSS property value: high + */ + public final static String CSS_HIGH_VALUE = "high"; + /** + * CSS property value: higher + */ + public final static String CSS_HIGHER_VALUE = "higher"; + /** + * CSS property value: icon + */ + public final static String CSS_ICON_VALUE = "icon"; + /** + * CSS property value: inherit + */ + public final static String CSS_INHERIT_VALUE = "inherit"; + /** + * CSS property value: inline + */ + public final static String CSS_INLINE_VALUE = "inline"; + /** + * CSS property value: inline-block + */ + public final static String CSS_INLINE_BLOCK_VALUE = "inline-block"; + /** + * CSS property value: inline-table + */ + public final static String CSS_INLINE_TABLE_VALUE = "inline-table"; + /** + * CSS property value: inside + */ + public final static String CSS_INSIDE_VALUE = "inside"; + /** + * CSS property value: invert + */ + public final static String CSS_INVERT_VALUE = "invert"; + /** + * CSS property value: italic + */ + public final static String CSS_ITALIC_VALUE = "italic"; + /** + * CSS property value: justify + */ + public final static String CSS_JUSTIFY_VALUE = "justify"; + /** + * CSS property value: left-side + */ + public final static String CSS_LEFT_SIDE_VALUE = "left-side"; + /** + * CSS property value: leftwards + */ + public final static String CSS_LEFTWARDS_VALUE = "leftwards"; + /** + * CSS property value: level + */ + public final static String CSS_LEVEL_VALUE = "level"; + /** + * CSS property value: lighter + */ + public final static String CSS_LIGHTER_VALUE = "lighter"; + /** + * CSS property value: line-through + */ + public final static String CSS_LINE_THROUGH_VALUE = "line-through"; + /** + * CSS property value: list-item + */ + public final static String CSS_LIST_ITEM_VALUE = "list-item"; + /** + * CSS property value: loud + */ + public final static String CSS_LOUD_VALUE = "loud"; + /** + * CSS property value: low + */ + public final static String CSS_LOW_VALUE = "low"; + /** + * CSS property value: lower + */ + public final static String CSS_LOWER_VALUE = "lower"; + /** + * CSS property value: lower-alpha + */ + public final static String CSS_LOWER_ALPHA_VALUE = "lower-alpha"; + /** + * CSS property value: lowercase + */ + public final static String CSS_LOWERCASE_VALUE = "lowercase"; + /** + * CSS property value: lower-greek + */ + public final static String CSS_LOWER_GREEK_VALUE = "lower-greek"; + /** + * CSS property value: lower-latin + */ + public final static String CSS_LOWER_LATIN_VALUE = "lower-latin"; + /** + * CSS property value: lower-roman + */ + public final static String CSS_LOWER_ROMAN_VALUE = "lower-roman"; + /** + * CSS property value: ltr + */ + public final static String CSS_LTR_VALUE = "ltr"; + /** + * CSS property value: medium + */ + public final static String CSS_MEDIUM_VALUE = "medium"; + /** + * CSS property value: menu + */ + public final static String CSS_MENU_VALUE = "menu"; + /** + * CSS property value: message-box + */ + public final static String CSS_MESSAGE_BOX_VALUE = "message-box"; + /** + * CSS property value: middle + */ + public final static String CSS_MIDDLE_VALUE = "middle"; + /** + * CSS property value: mix + */ + public final static String CSS_MIX_VALUE = "mix"; + /** + * CSS property value: move + */ + public final static String CSS_MOVE_VALUE = "move"; + /** + * CSS property value: ne-resize + */ + public final static String CSS_NE_RESIZE_VALUE = "ne-resize"; + /** + * CSS property value: no-close-quote + */ + public final static String CSS_NO_CLOSE_QUOTE_VALUE = "no-close-quote"; + /** + * CSS property value: none + */ + public final static String CSS_NONE_VALUE = "none"; + /** + * CSS property value: no-open-quote + */ + public final static String CSS_NO_OPEN_QUOTE_VALUE = "no-open-quote"; + /** + * CSS property value: no-repeat + */ + public final static String CSS_NO_REPEAT_VALUE = "no-repeat"; + /** + * CSS property value: normal + */ + public final static String CSS_NORMAL_VALUE = "normal"; + /** + * CSS property value: nowrap + */ + public final static String CSS_NOWRAP_VALUE = "nowrap"; + /** + * CSS property value: n-resize + */ + public final static String CSS_N_RESIZE_VALUE = "n-resize"; + /** + * CSS property value: nw-resize + */ + public final static String CSS_NW_RESIZE_VALUE = "nw-resize"; + /** + * CSS property value: oblique + */ + public final static String CSS_OBLIQUE_VALUE = "oblique"; + /** + * CSS property value: once + */ + public final static String CSS_ONCE_VALUE = "once"; + /** + * CSS property value: open-quote + */ + public final static String CSS_OPEN_QUOTE_VALUE = "open-quote"; + /** + * CSS property value: outside + */ + public final static String CSS_OUTSIDE_VALUE = "outside"; + /** + * CSS property value: overline + */ + public final static String CSS_OVERLINE_VALUE = "overline"; + /** + * CSS property value: pointer + */ + public final static String CSS_POINTER_VALUE = "pointer"; + /** + * CSS property value: pre + */ + public final static String CSS_PRE_VALUE = "pre"; + /** + * CSS property value: pre-line + */ + public final static String CSS_PRE_LINE_VALUE = "pre-line"; + /** + * CSS property value: pre-wrap + */ + public final static String CSS_PRE_WRAP_VALUE = "pre-wrap"; + /** + * CSS property value: progress + */ + public final static String CSS_PROGRESS_VALUE = "progress"; + /** + * CSS property value: relative + */ + public final static String CSS_RELATIVE_VALUE = "relative"; + /** + * CSS property value: repeat + */ + public final static String CSS_REPEAT_VALUE = "repeat"; + /** + * CSS property value: repeat-x + */ + public final static String CSS_REPEAT_X_VALUE = "repeat-x"; + /** + * CSS property value: repeat-y + */ + public final static String CSS_REPEAT_Y_VALUE = "repeat-y"; + /** + * CSS property value: right + */ + public final static String CSS_RIGHT_VALUE = "right"; + /** + * CSS property value: right-side + */ + public final static String CSS_RIGHT_SIDE_VALUE = "right-side"; + /** + * CSS property value: rightwards + */ + public final static String CSS_RIGHTWARDS_VALUE = "rightwards"; + /** + * CSS property value: rtl + */ + public final static String CSS_RTL_VALUE = "rtl"; + /** + * CSS property value: run-in + */ + public final static String CSS_RUN_IN_VALUE = "run-in"; + /** + * CSS property value: separate + */ + public final static String CSS_SEPARATE_VALUE = "separate"; + /** + * CSS property value: se-resize + */ + public final static String CSS_SE_RESIZE_VALUE = "se-resize"; + /** + * CSS property value: show + */ + public final static String CSS_SHOW_VALUE = "show"; + /** + * CSS property value: silent + */ + public final static String CSS_SILENT_VALUE = "silent"; + /** + * CSS property value: slow + */ + public final static String CSS_SLOW_VALUE = "slow"; + /** + * CSS property value: slower + */ + public final static String CSS_SLOWER_VALUE = "slower"; + /** + * CSS property value: small-caps + */ + public final static String CSS_SMALL_CAPS_VALUE = "small-caps"; + /** + * CSS property value: small-caption + */ + public final static String CSS_SMALL_CAPTION_VALUE = "small-caption"; + /** + * CSS property value: soft + */ + public final static String CSS_SOFT_VALUE = "soft"; + /** + * CSS property value: spell-out + */ + public final static String CSS_SPELL_OUT_VALUE = "spell-out"; + /** + * CSS property value: square + */ + public final static String CSS_SQUARE_VALUE = "square"; + /** + * CSS property value: s-resize + */ + public final static String CSS_S_RESIZE_VALUE = "s-resize"; + /** + * CSS property value: static + */ + public final static String CSS_STATIC_VALUE = "static"; + /** + * CSS property value: status-bar + */ + public final static String CSS_STATUS_BAR_VALUE = "status-bar"; + /** + * CSS property value: sub + */ + public final static String CSS_SUB_VALUE = "sub"; + /** + * CSS property value: super + */ + public final static String CSS_SUPER_VALUE = "super"; + /** + * CSS property value: sw-resize + */ + public final static String CSS_SW_RESIZE_VALUE = "sw-resize"; + /** + * CSS property value: table + */ + public final static String CSS_TABLE_VALUE = "table"; + /** + * CSS property value: table-caption + */ + public final static String CSS_TABLE_CAPTION_VALUE = "table-caption"; + /** + * CSS property value: table-cell + */ + public final static String CSS_TABLE_CELL_VALUE = "table-cell"; + /** + * CSS property value: table-column + */ + public final static String CSS_TABLE_COLUMN_VALUE = "table-column"; + /** + * CSS property value: table-column-group + */ + public final static String CSS_TABLE_COLUMN_GROUP_VALUE = "table-column-group"; + /** + * CSS property value: table-footer-group + */ + public final static String CSS_TABLE_FOOTER_GROUP_VALUE = "table-footer-group"; + /** + * CSS property value: table-header-group + */ + public final static String CSS_TABLE_HEADER_GROUP_VALUE = "table-header-group"; + /** + * CSS property value: table-row + */ + public final static String CSS_TABLE_ROW_VALUE = "table-row"; + /** + * CSS property value: table-row-group + */ + public final static String CSS_TABLE_ROW_GROUP_VALUE = "table-row-group"; + /** + * CSS property value: text + */ + public final static String CSS_TEXT_VALUE = "text"; + /** + * CSS property value: text-bottom + */ + public final static String CSS_TEXT_BOTTOM_VALUE = "text-bottom"; + /** + * CSS property value: text-top + */ + public final static String CSS_TEXT_TOP_VALUE = "text-top"; + /** + * CSS property value: top + */ + public final static String CSS_TOP_VALUE = "top"; + /** + * CSS property value: underline + */ + public final static String CSS_UNDERLINE_VALUE = "underline"; + /** + * CSS property value: upper-alpha + */ + public final static String CSS_UPPER_ALPHA_VALUE = "upper-alpha"; + /** + * CSS property value: uppercase + */ + public final static String CSS_UPPERCASE_VALUE = "uppercase"; + /** + * CSS property value: upper-latin + */ + public final static String CSS_UPPER_LATIN_VALUE = "upper-latin"; + /** + * CSS property value: upper-roman + */ + public final static String CSS_UPPER_ROMAN_VALUE = "upper-roman"; + /** + * CSS property value: visible + */ + public final static String CSS_VISIBLE_VALUE = "visible"; + /** + * CSS property value: wait + */ + public final static String CSS_WAIT_VALUE = "wait"; + /** + * CSS property value: w-resize + */ + public final static String CSS_W_RESIZE_VALUE = "w-resize"; + /** + * CSS property value: x-fast + */ + public final static String CSS_X_FAST_VALUE = "x-fast"; + /** + * CSS property value: x-high + */ + public final static String CSS_X_HIGH_VALUE = "x-high"; + /** + * CSS property value: x-loud + */ + public final static String CSS_X_LOUD_VALUE = "x-loud"; + /** + * CSS property value: x-low + */ + public final static String CSS_X_LOW_VALUE = "x-low"; + /** + * CSS property value: x-slow + */ + public final static String CSS_X_SLOW_VALUE = "x-slow"; + /** + * CSS property value: x-soft + */ + public final static String CSS_X_SOFT_VALUE = "x-soft"; // absolute fone size - String CSS_X_SMALL_VALUE = "x-small"; - String CSS_XX_SMALL_VALUE = "xx-small"; - String CSS_SMALL_VALUE = "small"; - String CSS_LARGE_VALUE = "large"; - String CSS_X_LARGE_VALUE = "x-large"; - String CSS_XX_LARGE_VALUE = "xx-large"; + /** + * CSS property value: x-small + */ + public final static String CSS_X_SMALL_VALUE = "x-small"; + /** + * CSS property value: xx-small + */ + public final static String CSS_XX_SMALL_VALUE = "xx-small"; + /** + * CSS property value: small + */ + public final static String CSS_SMALL_VALUE = "small"; + /** + * CSS property value: large + */ + public final static String CSS_LARGE_VALUE = "large"; + /** + * CSS property value: x-large + */ + public final static String CSS_X_LARGE_VALUE = "x-large"; + /** + * CSS property value: xx-large + */ + public final static String CSS_XX_LARGE_VALUE = "xx-large"; // relative font size - String CSS_LARGER_VALUE = "larger"; - String CSS_SMALLER_VALUE = "smaller"; + /** + * CSS property value: larger + */ + public final static String CSS_LARGER_VALUE = "larger"; + /** + * CSS property value: smaller + */ + public final static String CSS_SMALLER_VALUE = "smaller"; // genric font family - String CSS_SERIF_VALUE = "serif"; - String CSS_SANS_SERIF_VALUE = "sans-serif"; - String CSS_CURSIVE_VALUE = "cursive"; - String CSS_FANTASY_VALUE = "fantasy"; - String CSS_MONOSPACE_VALUE = "monospace"; + /** + * CSS property value: serif + */ + public final static String CSS_SERIF_VALUE = "serif"; + /** + * CSS property value: sans-serif + */ + public final static String CSS_SANS_SERIF_VALUE = "sans-serif"; + /** + * CSS property value: cursive + */ + public final static String CSS_CURSIVE_VALUE = "cursive"; + /** + * CSS property value: fantasy + */ + public final static String CSS_FANTASY_VALUE = "fantasy"; + /** + * CSS property value: monospace + */ + public final static String CSS_MONOSPACE_VALUE = "monospace"; + // color - String CSS_AQUA_VALUE = "aqua"; - String CSS_BLACK_VALUE = "black"; - String CSS_BLUE_VALUE = "blue"; - String CSS_FUCHSIA_VALUE = "fuchsia"; - String CSS_GRAY_VALUE = "gray"; - String CSS_GREEN_VALUE = "green"; - String CSS_LIME_VALUE = "lime"; - String CSS_MAROON_VALUE = "maroon"; - String CSS_NAVY_VALUE = "navy"; - String CSS_OLIVE_VALUE = "olive"; - String CSS_ORANGE_VALUE = "orange"; - String CSS_PURPLE_VALUE = "purple"; - String CSS_RED_VALUE = "red"; - String CSS_SILVER_VALUE = "silver"; - String CSS_TEAL_VALUE = "teal"; - String CSS_WHITE_VALUE = "white"; - String CSS_YELLOW_VALUE = "yellow"; + /** + * CSS property value: aqua + */ + public final static String CSS_AQUA_VALUE = "aqua"; + /** + * CSS property value: black + */ + public final static String CSS_BLACK_VALUE = "black"; + /** + * CSS property value: blue + */ + public final static String CSS_BLUE_VALUE = "blue"; + /** + * CSS property value: fuchsia + */ + public final static String CSS_FUCHSIA_VALUE = "fuchsia"; + /** + * CSS property value: gray + */ + public final static String CSS_GRAY_VALUE = "gray"; + /** + * CSS property value: green + */ + public final static String CSS_GREEN_VALUE = "green"; + /** + * CSS property value: lime + */ + public final static String CSS_LIME_VALUE = "lime"; + /** + * CSS property value: maroon + */ + public final static String CSS_MAROON_VALUE = "maroon"; + /** + * CSS property value: navy + */ + public final static String CSS_NAVY_VALUE = "navy"; + /** + * CSS property value: olive + */ + public final static String CSS_OLIVE_VALUE = "olive"; + /** + * CSS property value: orange + */ + public final static String CSS_ORANGE_VALUE = "orange"; + /** + * CSS property value: purple + */ + public final static String CSS_PURPLE_VALUE = "purple"; + /** + * CSS property value: red + */ + public final static String CSS_RED_VALUE = "red"; + /** + * CSS property value: silver + */ + public final static String CSS_SILVER_VALUE = "silver"; + /** + * CSS property value: teal + */ + public final static String CSS_TEAL_VALUE = "teal"; + /** + * CSS property value: white + */ + public final static String CSS_WHITE_VALUE = "white"; + /** + * CSS property value: yellow + */ + public final static String CSS_YELLOW_VALUE = "yellow"; + // System defined color - String CSS_ACTIVEBORDER_VALUE = "ActiveBorder"; - String CSS_ACTIVECAPTION_VALUE = "ActiveCaption"; - String CSS_APPWORKSPACE_VALUE = "AppWorkspace"; - String CSS_BACKGROUND_VALUE = "Background"; - String CSS_BUTTONFACE_VALUE = "ButtonFace"; - String CSS_BUTTONHIGHLIGHT_VALUE = "ButtonHighlight"; - String CSS_BUTTONSHADOW_VALUE = "ButtonShadow"; - String CSS_BUTTONTEXT_VALUE = "ButtonText"; - String CSS_CAPTIONTEXT_VALUE = "CaptionText"; - String CSS_GRAYTEXT_VALUE = "GrayText"; - String CSS_HIGHLIGHT_VALUE = "Highlight"; - String CSS_HIGHLIGHTTEXT_VALUE = "HighlightText"; - String CSS_INACTIVEBORDER_VALUE = "InactiveBorder"; - String CSS_INACTIVECAPTION_VALUE = "InactiveCaption"; - String CSS_INACTIVECAPTIONTEXT_VALUE = "InactiveCaptionText"; - String CSS_INFOBACKGROUND_VALUE = "InfoBackground"; - String CSS_INFOTEXT_VALUE = "InfoText"; + /** + * CSS property value: ActiveBorder + */ + public final static String CSS_ACTIVEBORDER_VALUE = "ActiveBorder"; + /** + * CSS property value: ActiveCaption + */ + public final static String CSS_ACTIVECAPTION_VALUE = "ActiveCaption"; + /** + * CSS property value: AppWorkspace + */ + public final static String CSS_APPWORKSPACE_VALUE = "AppWorkspace"; + /** + * CSS property value: Background + */ + public final static String CSS_BACKGROUND_VALUE = "Background"; + /** + * CSS property value: ButtonFace + */ + public final static String CSS_BUTTONFACE_VALUE = "ButtonFace"; + /** + * CSS property value: ButtonHighlight + */ + public final static String CSS_BUTTONHIGHLIGHT_VALUE = "ButtonHighlight"; + /** + * CSS property value: ButtonShadow + */ + public final static String CSS_BUTTONSHADOW_VALUE = "ButtonShadow"; + /** + * CSS property value: ButtonText + */ + public final static String CSS_BUTTONTEXT_VALUE = "ButtonText"; + /** + * CSS property value: CaptionText + */ + public final static String CSS_CAPTIONTEXT_VALUE = "CaptionText"; + /** + * CSS property value: GrayText + */ + public final static String CSS_GRAYTEXT_VALUE = "GrayText"; + /** + * CSS property value: Highlight + */ + public final static String CSS_HIGHLIGHT_VALUE = "Highlight"; + /** + * CSS property value: HighlightText + */ + public final static String CSS_HIGHLIGHTTEXT_VALUE = "HighlightText"; + /** + * CSS property value: InactiveBorder + */ + public final static String CSS_INACTIVEBORDER_VALUE = "InactiveBorder"; + /** + * CSS property value: InactiveCaption + */ + public final static String CSS_INACTIVECAPTION_VALUE = "InactiveCaption"; + /** + * CSS property value: InactiveCaptionText + */ + public final static String CSS_INACTIVECAPTIONTEXT_VALUE = "InactiveCaptionText"; + /** + * CSS property value: InfoBackground + */ + public final static String CSS_INFOBACKGROUND_VALUE = "InfoBackground"; + /** + * CSS property value: InfoText + */ + public final static String CSS_INFOTEXT_VALUE = "InfoText"; + + // String CSS_MENU_VALUE = "Menu"; - String CSS_MENUTEXT_VALUE = "MenuText"; - String CSS_SCROLLBAR_VALUE = "Scrollbar"; - String CSS_THREEDDARKSHADOW_VALUE = "ThreeDDarkShadow"; - String CSS_THREEDFACE_VALUE = "ThreeDFace"; - String CSS_THREEDHIGHLIGHT_VALUE = "ThreeDHighlight"; - String CSS_THREEDLIGHTSHADOW_VALUE = "ThreeDLightShadow"; - String CSS_THREEDSHADOW_VALUE = "ThreeDShadow"; - String CSS_WINDOW_VALUE = "Window"; - String CSS_WINDOWFRAME_VALUE = "WindowFrame"; - String CSS_WINDOWTEXT_VALUE = "WindowText"; - - String CSS_DOTTED_VALUE = "dotted"; - String CSS_DASHED_VALUE = "dashed"; - String CSS_SOLID_VALUE = "solid"; - String CSS_DOUBLE_VALUE = "double"; - String CSS_GROOVE_VALUE = "groove"; - String CSS_RIDGE_VALUE = "ridge"; - String CSS_INSET_VALUE = "inset"; - String CSS_OUTSET_VALUE = "outset"; - - String CSS_THIN_VALUE = "thin"; + /** + * CSS property value: MenuText + */ + public final static String CSS_MENUTEXT_VALUE = "MenuText"; + /** + * CSS property value: Scrollbar + */ + public final static String CSS_SCROLLBAR_VALUE = "Scrollbar"; + /** + * CSS property value: ThreeDDarkShadow + */ + public final static String CSS_THREEDDARKSHADOW_VALUE = "ThreeDDarkShadow"; + /** + * CSS property value: ThreeDFace + */ + public final static String CSS_THREEDFACE_VALUE = "ThreeDFace"; + /** + * CSS property value: ThreeDHighlight + */ + public final static String CSS_THREEDHIGHLIGHT_VALUE = "ThreeDHighlight"; + /** + * CSS property value: ThreeDLightShadow + */ + public final static String CSS_THREEDLIGHTSHADOW_VALUE = "ThreeDLightShadow"; + /** + * CSS property value: ThreeDShadow + */ + public final static String CSS_THREEDSHADOW_VALUE = "ThreeDShadow"; + /** + * CSS property value: Window + */ + public final static String CSS_WINDOW_VALUE = "Window"; + /** + * CSS property value: WindowFrame + */ + public final static String CSS_WINDOWFRAME_VALUE = "WindowFrame"; + /** + * CSS property value: WindowText + */ + public final static String CSS_WINDOWTEXT_VALUE = "WindowText"; + + // line property value + /** + * CSS property value: dotted + */ + public final static String CSS_DOTTED_VALUE = "dotted"; + /** + * CSS property value: dashed + */ + public final static String CSS_DASHED_VALUE = "dashed"; + /** + * CSS property value: solid + */ + public final static String CSS_SOLID_VALUE = "solid"; + /** + * CSS property value: double + */ + public final static String CSS_DOUBLE_VALUE = "double"; + /** + * CSS property value: groove + */ + public final static String CSS_GROOVE_VALUE = "groove"; + /** + * CSS property value: ridge + */ + public final static String CSS_RIDGE_VALUE = "ridge"; + /** + * CSS property value: inset + */ + public final static String CSS_INSET_VALUE = "inset"; + /** + * CSS property value: outset + */ + public final static String CSS_OUTSET_VALUE = "outset"; + + /** + * CSS property value: thin + */ + public final static String CSS_THIN_VALUE = "thin"; + // String CSS_MEDIUM_VALUE = "medium"; - String CSS_THICK_VALUE = "thick"; + /** + * CSS property value: thick + */ + public final static String CSS_THICK_VALUE = "thick"; - String CSS_OVERFLOW_AUTO_VALUE = "auto"; - String CSS_OVERFLOW_VISIBLE_VALUE = "visible"; - String CSS_OVERFLOW_SCROLL_VALUE = "scroll"; - String CSS_OVERFLOW_HIDDEN_VALUE = "hidden"; + /** + * CSS property value: auto + */ + public final static String CSS_OVERFLOW_AUTO_VALUE = "auto"; + /** + * CSS property value: visible + */ + public final static String CSS_OVERFLOW_VISIBLE_VALUE = "visible"; + /** + * CSS property value: scroll + */ + public final static String CSS_OVERFLOW_SCROLL_VALUE = "scroll"; + /** + * CSS property value: hidden + */ + public final static String CSS_OVERFLOW_HIDDEN_VALUE = "hidden"; // bidi_hcg: Bidi related // "rtl" and "ltr" values are already specified above. // We preserve here the name for direction defined in CSS specs. - String CSS_DIRECTION_PROPERTY = "direction"; + /** + * CSS property value: direction + */ + public final static String CSS_DIRECTION_PROPERTY = "direction"; // overflow property: auto, visible, scroll, hidden - String CSS_OVERFLOW_PROPERTY = "overflow"; - - String CSS_HEIGHT_PROPERTY = "height"; - String CSS_WIDTH_PROPERTY = "width"; + /** + * CSS property value: overflow + */ + public final static String CSS_OVERFLOW_PROPERTY = "overflow"; - String CSS_URL_VALUE = "url"; + /** + * CSS property value: height + */ + public final static String CSS_HEIGHT_PROPERTY = "height"; + /** + * CSS property value: width + */ + public final static String CSS_WIDTH_PROPERTY = "width"; + /** + * CSS property value: url + */ + public final static String CSS_URL_VALUE = "url"; + /** + * CSS property value: independent + */ + public final static String CSS_INDEPENDENT_VALUE = "independent"; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSValueConstants.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSValueConstants.java index 649ce4bcad1..0105444aa45 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSValueConstants.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSValueConstants.java @@ -762,8 +762,14 @@ public interface CSSValueConstants { */ Value JUSTIFY_VALUE = new StringValue(CSSPrimitiveValue.CSS_IDENT, CSSConstants.CSS_JUSTIFY_VALUE); + /** + * the "contain" value + */ Value CONTAIN_VALUE = new StringValue(CSSPrimitiveValue.CSS_IDENT, CSSConstants.CSS_CONTAIN_VALUE); + /** + * the "cover" value + */ Value COVER_VALUE = new StringValue(CSSPrimitiveValue.CSS_IDENT, CSSConstants.CSS_COVER_VALUE); /** diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/layout/emitter/PageDeviceRender.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/layout/emitter/PageDeviceRender.java index 022a9c6b357..1f5f48e61da 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/layout/emitter/PageDeviceRender.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/layout/emitter/PageDeviceRender.java @@ -41,6 +41,7 @@ import org.eclipse.birt.report.engine.nLayout.area.impl.RowArea; import org.eclipse.birt.report.engine.nLayout.area.impl.TableArea; import org.eclipse.birt.report.engine.nLayout.area.impl.TextArea; +import org.eclipse.birt.report.engine.nLayout.area.style.AreaConstants; import org.eclipse.birt.report.engine.nLayout.area.style.BackgroundImageInfo; import org.eclipse.birt.report.engine.nLayout.area.style.BoxStyle; import org.eclipse.birt.report.engine.nLayout.area.style.DiagonalInfo; @@ -48,16 +49,31 @@ import org.eclipse.birt.report.engine.util.FlashFile; import org.eclipse.birt.report.model.api.ReportDesignHandle; +/** + * Definition of the page device renderer + * + * @since 3.3 + * + */ public abstract class PageDeviceRender implements IAreaVisitor { /** * The default image folder */ public static final String IMAGE_FOLDER = "image"; //$NON-NLS-1$ + /** + * The value of "horizontal text space" + */ public static final int H_TEXT_SPACE = 30; + /** + * The value of "vertical text space" + */ public static final int V_TEXT_SPACE = 100; + /** + * The value of "ignore overflow" + */ public static final int ignoredOverflow = 3000; protected float scale; @@ -73,7 +89,7 @@ public abstract class PageDeviceRender implements IAreaVisitor { protected int currentX; protected int currentY; - protected Stack rowStyleStack = new Stack(); + protected Stack rowStyleStack = new Stack(); /** * for any (x,y) in the ContainerArea, if x iter = container.getChildren(); while (iter.hasNext()) { - IArea child = (IArea) iter.next(); + IArea child = iter.next(); child.accept(this); } } @@ -194,7 +227,7 @@ private int getActualPageBodySize(PageArea page, int direction) { if (body == null) { return 0; } - Iterator iter = page.getBody().getChildren(); + Iterator iter = page.getBody().getChildren(); while (iter.hasNext()) { AbstractArea area = (AbstractArea) iter.next(); if (direction == BODY_HEIGHT) { @@ -242,8 +275,8 @@ protected void drawCellDiagonal(CellArea cell) { int dw = diagonalInfo.getDiagonalWidth(); int ds = diagonalInfo.getDiagonalStyle(); // support double style, use solid style instead. - if (ds == DiagonalInfo.BORDER_STYLE_DOUBLE) { - ds = DiagonalInfo.BORDER_STYLE_SOLID; + if (ds == AreaConstants.BORDER_STYLE_DOUBLE) { + ds = AreaConstants.BORDER_STYLE_SOLID; } switch (diagonalInfo.getDiagonalNumber()) { case 2: @@ -302,7 +335,7 @@ protected void drawCell(CellArea container) { BoxStyle rowStyle = null; // get the style of the row if (rowStyleStack.size() > 0) { - rowStyle = (BoxStyle) rowStyleStack.peek(); + rowStyle = rowStyleStack.peek(); if (rowStyle != null) { rowbc = rowStyle.getBackgroundColor(); rowbi = rowStyle.getBackgroundImage(); @@ -501,9 +534,21 @@ protected void newPage(IContainerArea page) { } private int extendDirection = EXTEND_NONE; + /** + * the page extend "none" + */ public static final int EXTEND_NONE = 0; + /** + * the page extend "horizontal" + */ public static final int EXTEND_ON_HORIZONTAL = 1; + /** + * the page extend "vertical" + */ public static final int EXTEND_ON_VERTICAL = 2; + /** + * the page extend "horizontal" & "vertical + */ public static final int EXTEND_ON_HORIZONTAL_AND_VERTICAL = 3; protected int getExtendDirection() { @@ -518,6 +563,11 @@ protected void addExtendDirection(int direction) { this.extendDirection |= direction; } + /** + * Start the area cliping + * + * @param area + */ public void startClip(IArea area) { int startX = currentX + getX(area); int startY = currentY + getY(area); @@ -533,12 +583,11 @@ private void endClip() { /** * draw background image for the container * - * @param containerStyle the style of the container we draw background image for - * @param imageUrl the url of background image - * @param startX the absolute horizontal position of the container - * @param startY the absolute vertical position of the container - * @param width container width - * @param height container height + * @param bi background information object of the background image + * @param startX the absolute horizontal position of the container + * @param startY the absolute vertical position of the container + * @param width container width + * @param height container height */ public void drawBackgroundImage(BackgroundImageInfo bi, int startX, int startY, int width, int height) { try { @@ -573,6 +622,7 @@ protected void drawContainer(IContainerArea container) { int startX = currentX + getX(container); int startY = currentY + getY(container); + // the dimension of the container int width = getWidth(container); int height = getHeight(container); @@ -621,6 +671,12 @@ private BorderInfo[] cacheCellBorder(CellArea container) { return null; } + /** + * Cache border info + * + * @param container + * @return Return array with border info + */ public BorderInfo[] cacheBorderInfo(IContainerArea container) { // get the style of the container BoxStyle style = container.getBoxStyle(); @@ -690,7 +746,7 @@ protected void drawText(ITextArea text) { TextArea ta = (TextArea) text; if ((ta.getRunLevel() & 1) != 0) { style = new TextStyle(style); - style.setDirection(TextStyle.DIRECTION_RTL); + style.setDirection(AreaConstants.DIRECTION_RTL); } } drawTextAt(text, x, y, getWidth(text), getHeight(text), style); @@ -750,7 +806,7 @@ private void drawBorder(TableBorder tb) { tb.findBreakPoints(); Border border = null; // draw column borders - for (Iterator i = tb.columnBorders.keySet().iterator(); i.hasNext();) { + for (Iterator i = tb.columnBorders.keySet().iterator(); i.hasNext();) { Integer pos = (Integer) i.next(); if (pos == tb.tableLRX) { continue; @@ -807,7 +863,7 @@ private void drawBorder(TableBorder tb) { } // draw row borders - for (Iterator i = tb.rowBorders.keySet().iterator(); i.hasNext();) { + for (Iterator i = tb.rowBorders.keySet().iterator(); i.hasNext();) { Integer pos = (Integer) i.next(); if (pos == tb.tableLRY) { continue; @@ -885,67 +941,67 @@ public void drawBorder(BorderInfo[] borders) { return; } // double>solid>dashed>dotted>none - ArrayList dbl = null; - ArrayList solid = null; - ArrayList dashed = null; - ArrayList dotted = null; + ArrayList dbl = null; + ArrayList solid = null; + ArrayList dashed = null; + ArrayList dotted = null; for (int i = 0; i < borders.length; i++) { switch (borders[i].borderStyle) { - case org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo.BORDER_STYLE_DOUBLE: + case AreaConstants.BORDER_STYLE_DOUBLE: if (null == dbl) { - dbl = new ArrayList(); + dbl = new ArrayList(); } dbl.add(borders[i]); break; - case org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo.BORDER_STYLE_DASHED: + case AreaConstants.BORDER_STYLE_DASHED: if (null == dashed) { - dashed = new ArrayList(); + dashed = new ArrayList(); } dashed.add(borders[i]); break; - case org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo.BORDER_STYLE_DOTTED: + case AreaConstants.BORDER_STYLE_DOTTED: if (null == dotted) { - dotted = new ArrayList(); + dotted = new ArrayList(); } dotted.add(borders[i]); break; default: if (null == solid) { - solid = new ArrayList(); + solid = new ArrayList(); } solid.add(borders[i]); break; } } if (null != dotted) { - for (Iterator it = dotted.iterator(); it.hasNext();) { - BorderInfo bi = (BorderInfo) it.next(); + for (Iterator it = dotted.iterator(); it.hasNext();) { + BorderInfo bi = it.next(); drawBorder(bi); } } if (null != dashed) { - for (Iterator it = dashed.iterator(); it.hasNext();) { - BorderInfo bi = (BorderInfo) it.next(); + for (Iterator it = dashed.iterator(); it.hasNext();) { + BorderInfo bi = it.next(); drawBorder(bi); } } if (null != solid) { - for (Iterator it = solid.iterator(); it.hasNext();) { - BorderInfo bi = (BorderInfo) it.next(); + for (Iterator it = solid.iterator(); it.hasNext();) { + BorderInfo bi = it.next(); drawBorder(bi); } } if (null != dbl) { - for (Iterator it = dbl.iterator(); it.hasNext();) { - BorderInfo bi = (BorderInfo) it.next(); + for (Iterator it = dbl.iterator(); it.hasNext();) { + BorderInfo bi = it.next(); drawDoubleBorder(bi); } } } private void drawBorder(BorderInfo bi) { - if (org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo.BORDER_STYLE_DOUBLE == bi.borderStyle) { + if (AreaConstants.BORDER_STYLE_DOUBLE == bi.borderStyle) { drawDoubleBorder(bi); } else { pageGraphic.drawLine(bi.startX, bi.startY, bi.endX, bi.endY, bi.borderWidth, bi.borderColor, @@ -968,34 +1024,34 @@ private void drawDoubleBorder(BorderInfo bi) { case BorderInfo.TOP_BORDER: pageGraphic.drawLine(startX, startY - borderWidth / 2 + outerBorderWidth / 2, endX, endY - borderWidth / 2 + outerBorderWidth / 2, outerBorderWidth, borderColor, - org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo.BORDER_STYLE_SOLID); // $NON-NLS-1$ + AreaConstants.BORDER_STYLE_SOLID); // $NON-NLS-1$ pageGraphic.drawLine(startX, startY + borderWidth / 2 - innerBorderWidth / 2, endX, endY + borderWidth / 2 - innerBorderWidth / 2, innerBorderWidth, borderColor, - org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo.BORDER_STYLE_SOLID); // $NON-NLS-1$ + AreaConstants.BORDER_STYLE_SOLID); // $NON-NLS-1$ break; case BorderInfo.RIGHT_BORDER: pageGraphic.drawLine(startX + borderWidth / 2 - outerBorderWidth / 2, startY, endX + borderWidth / 2 - outerBorderWidth / 2, endY, outerBorderWidth, borderColor, - org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo.BORDER_STYLE_SOLID); // $NON-NLS-1$ + AreaConstants.BORDER_STYLE_SOLID); // $NON-NLS-1$ pageGraphic.drawLine(startX - borderWidth / 2 + innerBorderWidth / 2, startY, endX - borderWidth / 2 + innerBorderWidth / 2, endY, innerBorderWidth, borderColor, - org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo.BORDER_STYLE_SOLID); // $NON-NLS-1$ + AreaConstants.BORDER_STYLE_SOLID); // $NON-NLS-1$ break; case BorderInfo.BOTTOM_BORDER: pageGraphic.drawLine(startX, startY + borderWidth / 2 - outerBorderWidth / 2, endX, endY + borderWidth / 2 - outerBorderWidth / 2, outerBorderWidth, borderColor, - org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo.BORDER_STYLE_SOLID); // $NON-NLS-1$ + AreaConstants.BORDER_STYLE_SOLID); // $NON-NLS-1$ pageGraphic.drawLine(startX, startY - borderWidth / 2 + innerBorderWidth / 2, endX, endY - borderWidth / 2 + innerBorderWidth / 2, innerBorderWidth, borderColor, - org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo.BORDER_STYLE_SOLID); // $NON-NLS-1$ + AreaConstants.BORDER_STYLE_SOLID); // $NON-NLS-1$ break; case BorderInfo.LEFT_BORDER: pageGraphic.drawLine(startX - borderWidth / 2 + outerBorderWidth / 2, startY, endX - borderWidth / 2 + outerBorderWidth / 2, endY, outerBorderWidth, borderColor, - org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo.BORDER_STYLE_SOLID); // $NON-NLS-1$ + AreaConstants.BORDER_STYLE_SOLID); // $NON-NLS-1$ pageGraphic.drawLine(startX + borderWidth / 2 - innerBorderWidth / 2, startY, endX + borderWidth / 2 - innerBorderWidth / 2, endY, innerBorderWidth, borderColor, - org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo.BORDER_STYLE_SOLID); // $NON-NLS-1$ + AreaConstants.BORDER_STYLE_SOLID); // $NON-NLS-1$ break; } } @@ -1020,11 +1076,11 @@ protected int getScaledValue(int value) { return (int) (value * scale); } -// private int getScaledValue( CSSValue cssValue ) -// { -// return getScaledValue( PropertyUtil.getDimensionValue( cssValue ) ); -// } - + /** + * Draw table border + * + * @param table + */ public void drawTableBorder(TableArea table) { TableBorder tb = new TableBorder(table.getX(), table.getY()); traverseRows(tb, table, tb.tableX, tb.tableY); @@ -1032,8 +1088,8 @@ public void drawTableBorder(TableArea table) { } private void traverseRows(TableBorder tb, IContainerArea container, int offsetX, int offsetY) { - for (Iterator i = container.getChildren(); i.hasNext();) { - IArea area = (IArea) i.next(); + for (Iterator i = container.getChildren(); i.hasNext();) { + IArea area = i.next(); if (area instanceof IContainerArea) { offsetX += area.getX(); offsetY += area.getY(); @@ -1049,7 +1105,7 @@ private void traverseRows(TableBorder tb, IContainerArea container, int offsetX, } private void handleBorderInRow(TableBorder tb, RowArea row, int offsetX, int offsetY) { - for (Iterator ri = row.getChildren(); ri.hasNext();) { + for (Iterator ri = row.getChildren(); ri.hasNext();) { IArea area = (IArea) ri.next(); if (!(area instanceof CellArea)) { continue; diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/layout/pdf/util/PropertyUtil.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/layout/pdf/util/PropertyUtil.java index 494c4092ade..3f4f69de29b 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/layout/pdf/util/PropertyUtil.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/layout/pdf/util/PropertyUtil.java @@ -28,20 +28,28 @@ import org.eclipse.birt.report.engine.content.IPageContent; import org.eclipse.birt.report.engine.content.IReportContent; import org.eclipse.birt.report.engine.content.IStyle; +import org.eclipse.birt.report.engine.css.engine.StyleConstants; import org.eclipse.birt.report.engine.css.engine.value.FloatValue; import org.eclipse.birt.report.engine.css.engine.value.RGBColorValue; import org.eclipse.birt.report.engine.css.engine.value.StringValue; import org.eclipse.birt.report.engine.css.engine.value.Value; import org.eclipse.birt.report.engine.css.engine.value.css.CSSConstants; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.ir.DimensionType; -import org.eclipse.birt.report.engine.ir.EngineIRConstants; import org.eclipse.birt.report.model.api.ReportDesignHandle; +import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; import org.w3c.dom.Element; import org.w3c.dom.css.CSSPrimitiveValue; import org.w3c.dom.css.CSSValue; import com.lowagie.text.Font; +/** + * Utility class of properties + * + * @since 3.3 + * + */ public class PropertyUtil { private static Logger logger = Logger.getLogger(PropertyUtil.class.getName()); @@ -50,26 +58,26 @@ public class PropertyUtil { private static HashMap fontWeightMap = new HashMap<>(); static { - fontWeightMap.put(IStyle.LIGHTER_VALUE, 200); - fontWeightMap.put(IStyle.NORMAL_VALUE, 400); - fontWeightMap.put(IStyle.BOLD_VALUE, 700); - fontWeightMap.put(IStyle.BOLDER_VALUE, 900); - - fontWeightMap.put(IStyle.NUMBER_100, 100); - fontWeightMap.put(IStyle.NUMBER_200, 200); - fontWeightMap.put(IStyle.NUMBER_300, 300); - fontWeightMap.put(IStyle.NUMBER_400, 400); - fontWeightMap.put(IStyle.NUMBER_500, 500); - fontWeightMap.put(IStyle.NUMBER_600, 600); - fontWeightMap.put(IStyle.NUMBER_700, 700); - fontWeightMap.put(IStyle.NUMBER_800, 800); - fontWeightMap.put(IStyle.NUMBER_900, 900); + fontWeightMap.put(CSSValueConstants.LIGHTER_VALUE, 200); + fontWeightMap.put(CSSValueConstants.NORMAL_VALUE, 400); + fontWeightMap.put(CSSValueConstants.BOLD_VALUE, 700); + fontWeightMap.put(CSSValueConstants.BOLDER_VALUE, 900); + + fontWeightMap.put(CSSValueConstants.NUMBER_100, 100); + fontWeightMap.put(CSSValueConstants.NUMBER_200, 200); + fontWeightMap.put(CSSValueConstants.NUMBER_300, 300); + fontWeightMap.put(CSSValueConstants.NUMBER_400, 400); + fontWeightMap.put(CSSValueConstants.NUMBER_500, 500); + fontWeightMap.put(CSSValueConstants.NUMBER_600, 600); + fontWeightMap.put(CSSValueConstants.NUMBER_700, 700); + fontWeightMap.put(CSSValueConstants.NUMBER_800, 800); + fontWeightMap.put(CSSValueConstants.NUMBER_900, 900); } /** * Checks if the font is bold * - * @param value the CSSValue + * @param fontWeight * @return true if the font is bold false if not */ public static boolean isBoldFont(int fontWeight) { @@ -79,33 +87,56 @@ public static boolean isBoldFont(int fontWeight) { return false; } + /** + * Parse font weight + * + * @param value + * @return get font weight + */ public static int parseFontWeight(CSSValue value) { if (fontWeightMap.containsKey(value)) { return fontWeightMap.get(value); - } else { - return 400; // Normal } + return 400; // Normal } + /** + * Is display none + * + * @param content + * @return true, display is none + */ public static boolean isDisplayNone(IContent content) { IStyle style = content.getStyle(); if (style != null) { - return IStyle.NONE_VALUE.equals(style.getProperty(IStyle.STYLE_DISPLAY)); + return CSSValueConstants.NONE_VALUE.equals(style.getProperty(StyleConstants.STYLE_DISPLAY)); } return false; } + /** + * Is inline element + * + * @param content + * @return true, is inline element + */ public static boolean isInlineElement(IContent content) { if (content instanceof IPageContent) { return false; } IStyle style = content.getStyle(); if (style != null) { - return IStyle.INLINE_VALUE.equals(style.getProperty(IStyle.STYLE_DISPLAY)); + return CSSValueConstants.INLINE_VALUE.equals(style.getProperty(StyleConstants.STYLE_DISPLAY)); } return false; } + /** + * Get the line height + * + * @param lineHeight + * @return Return line height + */ public static int getLineHeight(String lineHeight) { try { if (lineHeight.equalsIgnoreCase("normal")) //$NON-NLS-1$ @@ -122,6 +153,12 @@ public static int getLineHeight(String lineHeight) { } } + /** + * Get the color + * + * @param value + * @return Return the color + */ public static Color getColor(CSSValue value) { if (value instanceof RGBColorValue) { RGBColorValue color = (RGBColorValue) value; @@ -218,6 +255,13 @@ static final Color hexToColor(String value) { return c; } + /** + * Get font style + * + * @param fontStyle + * @param fontWeight + * @return Return the font style + */ public static int getFontStyle(String fontStyle, String fontWeight) { int styleValue = Font.NORMAL; @@ -233,6 +277,12 @@ public static int getFontStyle(String fontStyle, String fontWeight) { return styleValue; } + /** + * Get the background image + * + * @param value + * @return Return the background image + */ public static String getBackgroundImage(CSSValue value) { if (value instanceof StringValue) { String strValue = ((StringValue) value).getStringValue(); @@ -243,6 +293,14 @@ public static String getBackgroundImage(CSSValue value) { return null; } + /** + * Get the image dpi + * + * @param content + * @param imageFileDpi + * @param renderOptionDpi + * @return Return the image dpi + */ public static int getImageDpi(IImageContent content, int imageFileDpi, int renderOptionDpi) { // The DPI resolution of the image. // the preference of the DPI setting is: @@ -262,7 +320,7 @@ public static int getImageDpi(IImageContent content, int imageFileDpi, int rende * * @param content * @param renderOptionDpi - * @return + * @return Return the render dpi */ public static int getRenderDpi(IReportContent content, int renderOptionDpi) { int resolution = renderOptionDpi; @@ -279,6 +337,13 @@ public static int getRenderDpi(IReportContent content, int renderOptionDpi) { return resolution; } + /** + * Get the render dpi + * + * @param content + * @param renderOptionDpi + * @return Return the render dpi + */ public static int getRenderDpi(IContent content, int renderOptionDpi) { return getRenderDpi(content.getReportContent(), renderOptionDpi); } @@ -305,11 +370,22 @@ private static int getScreenDpi() { return screenDpi; } + /** + * Get dimension value + * + * @param value + * @return Return the dimension value + */ public static int getDimensionValue(CSSValue value) { return getDimensionValue(value, 96, 0); } /** + * Get dimension value + * + * @param value + * @param referenceLength + * @return Return the dimension value * @deprecated keep for backward compatibility. */ @Deprecated @@ -317,6 +393,13 @@ public static int getDimensionValue(CSSValue value, int referenceLength) { return getDimensionValue(value, 96, referenceLength); } + /** + * Get dimension value with consideration of dpi + * + * @param value + * @param content + * @return Return the dimension value + */ public static int getDimensionValueConsiderDpi(CSSValue value, IContent content) { if (value != null && (value instanceof FloatValue)) { FloatValue fv = (FloatValue) value; @@ -385,6 +468,13 @@ private static int getDimensionValue(CSSValue value, int dpi, int referenceLengt return 0; } + /** + * Get dimension value + * + * @param content + * @param d + * @return Return the dimension value + */ public static int getDimensionValue(IContent content, DimensionType d) { return getDimensionValue(content, d, 0, 0); } @@ -393,25 +483,25 @@ protected static int _getDimensionValue(IContent content, DimensionType d, int r int referenceLength) { if (d.getValueType() == DimensionType.TYPE_DIMENSION) { String units = d.getUnits(); - if (units.equals(EngineIRConstants.UNITS_PT) || units.equals(EngineIRConstants.UNITS_CM) - || units.equals(EngineIRConstants.UNITS_MM) || units.equals(EngineIRConstants.UNITS_PC) - || units.equals(EngineIRConstants.UNITS_IN)) { - double point = d.convertTo(EngineIRConstants.UNITS_PT) * 1000; + if (units.equals(DesignChoiceConstants.UNITS_PT) || units.equals(DesignChoiceConstants.UNITS_CM) + || units.equals(DesignChoiceConstants.UNITS_MM) || units.equals(DesignChoiceConstants.UNITS_PC) + || units.equals(DesignChoiceConstants.UNITS_IN)) { + double point = d.convertTo(DesignChoiceConstants.UNITS_PT) * 1000; return (int) point; - } else if (units.equals(EngineIRConstants.UNITS_PX)) { + } else if (units.equals(DesignChoiceConstants.UNITS_PX)) { double point = d.getMeasure() / getRenderDpi(content, renderOptionDpi) * 72000d; return (int) point; - } else if (units.equals(EngineIRConstants.UNITS_PERCENTAGE)) { + } else if (units.equals(DesignChoiceConstants.UNITS_PERCENTAGE)) { if (referenceLength < 0) { return -1; } double point = referenceLength * d.getMeasure() / 100.0; return (int) point; - } else if (units.equals(EngineIRConstants.UNITS_EM) || units.equals(EngineIRConstants.UNITS_EX)) { + } else if (units.equals(DesignChoiceConstants.UNITS_EM) || units.equals(DesignChoiceConstants.UNITS_EX)) { int size = 9000; if (content != null) { IStyle style = content.getComputedStyle(); - CSSValue fontSize = style.getProperty(IStyle.STYLE_FONT_SIZE); + CSSValue fontSize = style.getProperty(StyleConstants.STYLE_FONT_SIZE); size = getDimensionValue(fontSize); } double point = size * d.getMeasure(); @@ -419,17 +509,26 @@ protected static int _getDimensionValue(IContent content, DimensionType d, int r } } else if (d.getValueType() == DimensionType.TYPE_CHOICE) { String choice = d.getChoice(); - if (IStyle.CSS_MEDIUM_VALUE.equals(choice)) { + if (CSSConstants.CSS_MEDIUM_VALUE.equals(choice)) { return 3000; - } else if (IStyle.CSS_THIN_VALUE.equals(choice)) { + } else if (CSSConstants.CSS_THIN_VALUE.equals(choice)) { return 1000; - } else if (IStyle.CSS_THICK_VALUE.equals(choice)) { + } else if (CSSConstants.CSS_THICK_VALUE.equals(choice)) { return 5000; } } return 0; } + /** + * Get the image dimension value + * + * @param content + * @param d + * @param renderOptionDpi + * @param referenceLength + * @return Return image dimension value + */ public static int getImageDimensionValue(IContent content, DimensionType d, int renderOptionDpi, int referenceLength) { if (d == null) { @@ -443,6 +542,15 @@ public static int getImageDimensionValue(IContent content, DimensionType d, int } } + /** + * Get the dimension value + * + * @param content + * @param d + * @param dpi + * @param referenceLength + * @return Return the dimension value + */ public static int getDimensionValue(IContent content, DimensionType d, int dpi, int referenceLength) { if (d == null) { return 0; @@ -455,10 +563,25 @@ public static int getDimensionValue(IContent content, DimensionType d, int dpi, } } + /** + * Get the dimension value + * + * @param content + * @param d + * @param referenceLength + * @return Return the dimension value + */ public static int getDimensionValue(IContent content, DimensionType d, int referenceLength) { return getDimensionValue(content, d, 0, referenceLength); } + /** + * Get int from attribute + * + * @param element + * @param attribute + * @return Return int of attribute + */ public static int getIntAttribute(Element element, String attribute) { String value = element.getAttribute(attribute); int result = 1; @@ -468,6 +591,13 @@ public static int getIntAttribute(Element element, String attribute) { return result; } + /** + * Get dimension type from attribute + * + * @param ele + * @param attribute + * @return Return dimension tye + */ public static DimensionType getDimensionAttribute(Element ele, String attribute) { String value = ele.getAttribute(attribute); if (value == null || 0 == value.length()) { @@ -476,6 +606,12 @@ public static DimensionType getDimensionAttribute(Element ele, String attribute) return DimensionType.parserUnit(value, DimensionType.UNITS_PX); } + /** + * Get int value + * + * @param value + * @return Return int value + */ public static int getIntValue(CSSValue value) { if (value != null && (value instanceof FloatValue)) { FloatValue fv = (FloatValue) value; @@ -484,6 +620,12 @@ public static int getIntValue(CSSValue value) { return 0; } + /** + * Get percentage value + * + * @param value + * @return Return percentage value + */ public static float getPercentageValue(CSSValue value) { if (value != null && (value instanceof FloatValue)) { FloatValue fv = (FloatValue) value; @@ -495,8 +637,14 @@ public static float getPercentageValue(CSSValue value) { return 0.0f; } + /** + * Is white space no wrap + * + * @param value + * @return true, white space no wrap + */ public static boolean isWhiteSpaceNoWrap(CSSValue value) { - return IStyle.CSS_NOWRAP_VALUE.equals(value.getCssText()); + return CSSConstants.CSS_NOWRAP_VALUE.equals(value.getCssText()); } } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/AbstractArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/AbstractArea.java index 8d6be961c4d..df913e0a15e 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/AbstractArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/AbstractArea.java @@ -81,18 +81,38 @@ public abstract class AbstractArea implements IArea { this.isDummy = area.isDummy; } + /** + * Get the parent container + * + * @return Return the parent container + */ public ContainerArea getParent() { return parent; } + /** + * Set parent container + * + * @param parent + */ public void setParent(ContainerArea parent) { this.parent = parent; } + /** + * Get the vertical align at container + * + * @return Return the vertical align at container + */ public CSSValue getVerticalAlign() { return vAlign; } + /** + * Set vertical align of the container + * + * @param vAlign + */ public void setVerticalAlign(CSSValue vAlign) { this.vAlign = vAlign; } @@ -106,6 +126,11 @@ public String getBookmark() { return bookmark; } + /** + * Set the bookmark of the container + * + * @param bookmark + */ public void setBookmark(String bookmark) { this.bookmark = bookmark; } @@ -115,20 +140,40 @@ public IHyperlinkAction getAction() { return action; } + /** + * Set the hyperlink action of the container + * + * @param action + */ public void setAction(IHyperlinkAction action) { this.action = action; } + /** + * Set the position X of the container + * + * @param x X position of the container + */ public void setX(int x) { this.x = x; } + /** + * Set the position Y of the container + * + * @param y Y position of the container + */ public void setY(int y) { this.y = y; } protected IHyperlinkAction action = null; + /** + * Set scale factor of the container + * + * @param scale scale factor of the container + */ public void setScale(float scale) { this.scale = scale; } @@ -154,20 +199,42 @@ public int getY() { return y; } + /** + * Set the position of the container + * + * @param x X position of the container + * @param y Y position of the container + */ public void setPosition(int x, int y) { this.x = x; this.y = y; } + /** + * Set the allocated position of the container + * + * @param x X position of the container + * @param y Y position of the container + */ public void setAllocatedPosition(int x, int y) { this.x = x; this.y = y; } + /** + * Set the allocated position Y of the container + * + * @param ay allocated position Y of the container + */ public void setAllocatedY(int ay) { y = ay; } + /** + * Set the allocated position X of the container + * + * @param ax allocated position X of the container + */ public void setAllocatedX(int ax) { x = ax; } @@ -206,10 +273,20 @@ public void setHeight(int height) { this.height = height; } + /** + * Get the allocated width + * + * @return Return the allocated width + */ public int getAllocatedWidth() { return width; } + /** + * Get the allocated height + * + * @return Return the allocated height + */ public int getAllocatedHeight() { return height; } @@ -231,34 +308,67 @@ public void setBaseLine(int baseLine) { public int getBaseLine() { if (baseLine == 0) { return height; - } else { - return baseLine; } - + return baseLine; } + /** + * Get the abstract area + * + * @return Return the abstract area + */ public abstract AbstractArea cloneArea(); + /** + * Create a deep clone of the area + * + * @return Return the deep clone of the area + */ public AbstractArea deepClone() { return cloneArea(); } + /** + * Get the allocated position X + * + * @return Return the allocated position X + */ public int getAllocatedX() { return x; } + /** + * Get the allocated position Y + * + * @return Return the allocated position Y + */ public int getAllocatedY() { return y; } + /** + * Verify the reordering whether it is to ignore + * + * @return true, ignore reordering + */ public boolean isIgnoreReordering() { return ignoreReordering; } + /** + * Set the reordering ignore flag (true: ignore) + * + * @param ignoreReordering + */ public void setIgnoreReordering(boolean ignoreReordering) { this.ignoreReordering = ignoreReordering; } + /** + * Print debug information + * + * @param area + */ public static void debugPrint(IArea area) { if (area instanceof IContainerArea) { System.out.print(area.getClass() + "||"); @@ -273,6 +383,11 @@ public static void debugPrint(IArea area) { } } + /** + * Print debug information of visuals + * + * @param area + */ public static void debugPrintVisual(IArea area) { if (area instanceof ITextArea) { System.out.println(((ITextArea) area).getText()); @@ -283,6 +398,11 @@ public static void debugPrintVisual(IArea area) { } } + /** + * Print debug information of with computed position X, Y + * + * @param area + */ public static void debugPrintWithComputedXY(IArea area) { debugPrint(area, 0, 0); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/BlockContainerArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/BlockContainerArea.java index 5f0583094ba..4010cf1580e 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/BlockContainerArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/BlockContainerArea.java @@ -23,6 +23,8 @@ import org.eclipse.birt.core.exception.BirtException; import org.eclipse.birt.report.engine.content.IContent; import org.eclipse.birt.report.engine.content.IStyle; +import org.eclipse.birt.report.engine.css.engine.StyleConstants; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.nLayout.LayoutContext; import org.eclipse.birt.report.engine.nLayout.area.IArea; import org.eclipse.birt.report.engine.nLayout.area.IContainerArea; @@ -30,8 +32,21 @@ import org.eclipse.birt.report.engine.util.BidiAlignmentResolver; import org.w3c.dom.css.CSSValue; +/** + * Implementation of block container area + * + * @since 3.3 + * + */ public class BlockContainerArea extends ContainerArea implements IContainerArea { + /** + * Constuctor + * + * @param parent + * @param context + * @param content + */ public BlockContainerArea(ContainerArea parent, LayoutContext context, IContent content) { super(parent, context, content); if (parent == null) { @@ -41,6 +56,9 @@ public BlockContainerArea(ContainerArea parent, LayoutContext context, IContent } } + /** + * Constructor + */ public BlockContainerArea() { super(); } @@ -74,16 +92,16 @@ public void close() throws BirtException { if (specifiedHeight > height) { - if (IStyle.BOTTOM_VALUE.equals(vAlign)) { + if (CSSValueConstants.BOTTOM_VALUE.equals(vAlign)) { int offset = specifiedHeight - height; Iterator iter = getChildren(); while (iter.hasNext()) { AbstractArea child = (AbstractArea) iter.next(); child.setY(offset + child.getY()); } - } else if (IStyle.MIDDLE_VALUE.equals(vAlign)) { + } else if (CSSValueConstants.MIDDLE_VALUE.equals(vAlign)) { int offset = (specifiedHeight - height) / 2; - Iterator iter = getChildren(); + Iterator iter = getChildren(); while (iter.hasNext()) { AbstractArea child = (AbstractArea) iter.next(); child.setY(child.getY() + offset); @@ -150,7 +168,7 @@ public void initialize() throws BirtException { } maxAvaWidth = getContentWidth(); } - textAlign = content.getComputedStyle().getProperty(IStyle.STYLE_TEXT_ALIGN); + textAlign = content.getComputedStyle().getProperty(StyleConstants.STYLE_TEXT_ALIGN); this.bookmark = content.getBookmark(); this.action = content.getHyperlinkAction(); parent.add(this); @@ -166,15 +184,13 @@ public SplitResult splitLines(int lineCount) throws BirtException { if (isPageBreakInsideAvoid()) { if (isPageBreakBeforeAvoid()) { return SplitResult.BEFORE_AVOID_WITH_NULL; - } else { - return SplitResult.SUCCEED_WITH_NULL; } + return SplitResult.SUCCEED_WITH_NULL; } int contentHeight = getContentHeight(); - LinkedList result = new LinkedList(); + LinkedList result = new LinkedList(); int size = children.size(); SplitResult childSplit = null; - int status = SplitResult.SPLIT_BEFORE_AVOID_WITH_NULL; for (int i = size - 1; i >= 0; i--) { ContainerArea child = (ContainerArea) children.get(i); int ah = child.getAllocatedHeight(); @@ -189,23 +205,22 @@ public SplitResult splitLines(int lineCount) throws BirtException { ContainerArea preChild = (ContainerArea) children.get(i - 1); if (preChild.isPageBreakAfterAvoid()) { continue; - } else { - status = SplitResult.SPLIT_SUCCEED_WITH_PART; - contentHeight = contentHeight - ah + child.getAllocatedHeight(); - BlockContainerArea newContainer = cloneArea(); - newContainer.updateContentHeight(contentHeight); - Iterator iter = children.iterator(); - while (iter.hasNext()) { - ContainerArea childArea = (ContainerArea) iter.next(); - if (!result.contains(childArea)) { - iter.remove(); - newContainer.addChild(childArea); - newContainer.setParent(newContainer); - } + } + contentHeight = contentHeight - ah + child.getAllocatedHeight(); + BlockContainerArea newContainer = cloneArea(); + newContainer.updateContentHeight(contentHeight); + Iterator iter = children.iterator(); + while (iter.hasNext()) { + ContainerArea childArea = (ContainerArea) iter.next(); + if (!result.contains(childArea)) { + iter.remove(); + newContainer.addChild(childArea); + newContainer.setParent(newContainer); } - updateChildrenPosition(); - return new SplitResult(newContainer, SplitResult.SPLIT_SUCCEED_WITH_PART); } + updateChildrenPosition(); + return new SplitResult(newContainer, SplitResult.SPLIT_SUCCEED_WITH_PART); + } else if (isPageBreakBeforeAvoid()) { return SplitResult.BEFORE_AVOID_WITH_NULL; } else { @@ -217,7 +232,7 @@ public SplitResult splitLines(int lineCount) throws BirtException { contentHeight = contentHeight - ah + splitChildArea.getAllocatedHeight(); BlockContainerArea newContainer = cloneArea(); newContainer.updateContentHeight(contentHeight); - Iterator iter = children.iterator(); + Iterator iter = children.iterator(); while (iter.hasNext()) { ContainerArea childArea = (ContainerArea) iter.next(); if (!result.contains(childArea)) { @@ -242,9 +257,8 @@ public SplitResult split(int height, boolean force) throws BirtException { } else if (isPageBreakInsideAvoid()) { if (isPageBreakBeforeAvoid()) { return SplitResult.BEFORE_AVOID_WITH_NULL; - } else { - return SplitResult.SUCCEED_WITH_NULL; } + return SplitResult.SUCCEED_WITH_NULL; } else { return _split(height, false); } @@ -255,17 +269,16 @@ protected SplitResult _split(int height, boolean force) throws BirtException { if (isPageBreakBeforeAvoid() && !force) { updateChildrenPosition(); return SplitResult.BEFORE_AVOID_WITH_NULL; - } else { - updateChildrenPosition(); - return SplitResult.SUCCEED_WITH_NULL; } + updateChildrenPosition(); + return SplitResult.SUCCEED_WITH_NULL; } BlockContainerArea newContainer = null; int status = SplitResult.SPLIT_BEFORE_AVOID_WITH_NULL; int cheight = getContentHeight(height); - ListIterator iter = children.listIterator(); + ListIterator iter = children.listIterator(); int contentHeight = 0; - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList(); ContainerArea current = null; ContainerArea previous = null; while (iter.hasNext()) { @@ -276,7 +289,7 @@ protected SplitResult _split(int height, boolean force) throws BirtException { if (contentHeight <= cheight && current.finished) { result.add(current); continue; - } else { + } contentHeight -= ah; int childSplitHeight = cheight - contentHeight; SplitResult splitResult = current.split(childSplitHeight, force && !isValidResult(result)); @@ -298,15 +311,13 @@ protected SplitResult _split(int height, boolean force) throws BirtException { if (force) { status = SplitResult.SPLIT_SUCCEED_WITH_PART; break; - } else { - if (previous.isPageBreakAfterAvoid()) { - status = SplitResult.SPLIT_BEFORE_AVOID_WITH_NULL; - break; - } else { - status = SplitResult.SPLIT_SUCCEED_WITH_PART; - break; - } } + if (previous.isPageBreakAfterAvoid()) { + status = SplitResult.SPLIT_BEFORE_AVOID_WITH_NULL; + break; + } + status = SplitResult.SPLIT_SUCCEED_WITH_PART; + break; } else if (force) { // error status status = SplitResult.SPLIT_SUCCEED_WITH_PART; @@ -314,12 +325,10 @@ protected SplitResult _split(int height, boolean force) throws BirtException { } else { if (isPageBreakBeforeAvoid()) { return SplitResult.BEFORE_AVOID_WITH_NULL; - } else { - return SplitResult.SUCCEED_WITH_NULL; } + return SplitResult.SUCCEED_WITH_NULL; } } - } } // split height is larger than content height.(cell) if (result.size() == children.size()) { @@ -355,10 +364,9 @@ protected SplitResult _split(int height, boolean force) throws BirtException { ContainerArea prev = (ContainerArea) children.get(preIndex); if (prev.isPageBreakAfterAvoid()) { continue; - } else { - status = SplitResult.SPLIT_SUCCEED_WITH_PART; - break; } + status = SplitResult.SPLIT_SUCCEED_WITH_PART; + break; } else if (isPageBreakBeforeAvoid()) { return SplitResult.BEFORE_AVOID_WITH_NULL; } else { @@ -391,12 +399,12 @@ protected SplitResult _split(int height, boolean force) throws BirtException { * * @param ablatedChildren the children which is split off the original area. * @param newHeight the new content height - * @return + * @return Return the block container area */ - protected BlockContainerArea getSplitArea(ArrayList ablatedChildren, int newHeight) { + protected BlockContainerArea getSplitArea(ArrayList ablatedChildren, int newHeight) { BlockContainerArea newContainer = cloneArea(); for (int i = 0; i < ablatedChildren.size(); i++) { - ContainerArea child = (ContainerArea) ablatedChildren.get(i); + ContainerArea child = ablatedChildren.get(i); child.setParent(newContainer); newContainer.addChild(child); children.remove(child); @@ -415,22 +423,22 @@ private void applyAlignment(BlockContainerArea area) { if (content == null) { return; } - CSSValue align = content.getComputedStyle().getProperty(IStyle.STYLE_TEXT_ALIGN); + CSSValue align = content.getComputedStyle().getProperty(StyleConstants.STYLE_TEXT_ALIGN); // bidi_hcg: handle empty or justify align in RTL direction as right // alignment boolean isRightAligned = BidiAlignmentResolver.isRightAligned(content, align, false); // single line - if (isRightAligned || IStyle.CENTER_VALUE.equals(align)) { - Iterator iter = area.getChildren(); + if (isRightAligned || CSSValueConstants.CENTER_VALUE.equals(align)) { + Iterator iter = area.getChildren(); while (iter.hasNext()) { AbstractArea child = (AbstractArea) iter.next(); int spacing = area.getContentWidth() - child.getAllocatedWidth(); if (spacing > 0) { if (isRightAligned) { child.setAllocatedX(spacing + area.getOffsetX()); - } else if (IStyle.CENTER_VALUE.equals(align)) { + } else if (CSSValueConstants.CENTER_VALUE.equals(align)) { child.setAllocatedX(spacing / 2 + area.getOffsetX()); } } @@ -442,7 +450,7 @@ protected void addRepeatedItem() throws BirtException { } - protected boolean isValidResult(List result) { + protected boolean isValidResult(List result) { return result.size() > 0; } @@ -469,11 +477,11 @@ public boolean isPageBreakInsideAvoid() { } @Override - public void updateChildrenPosition() throws BirtException { + public void updateChildrenPosition() { first = false; currentBP = 0; if (children.size() > 0) { - Iterator iter = children.iterator(); + Iterator iter = children.iterator(); int y = getOffsetY(); int h = 0; while (iter.hasNext()) { diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/CellArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/CellArea.java index 3f962fc1d9e..4f41ded0592 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/CellArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/CellArea.java @@ -21,6 +21,7 @@ import org.eclipse.birt.report.engine.content.IContent; import org.eclipse.birt.report.engine.content.IStyle; import org.eclipse.birt.report.engine.content.impl.ReportContent; +import org.eclipse.birt.report.engine.css.engine.StyleConstants; import org.eclipse.birt.report.engine.executor.ExecutionContext; import org.eclipse.birt.report.engine.layout.pdf.util.PropertyUtil; import org.eclipse.birt.report.engine.nLayout.LayoutContext; @@ -31,6 +32,12 @@ import org.eclipse.birt.report.engine.util.ResourceLocatorWrapper; import org.w3c.dom.css.CSSValue; +/** + * Definition of the table cell area + * + * @since 3.3 + * + */ public class CellArea extends BlockContainerArea implements IContainerArea { static int DEFAULT_PADDING = 1500; @@ -49,15 +56,30 @@ public class CellArea extends BlockContainerArea implements IContainerArea { CELL_DEFAULT.setPaddingLeft(DEFAULT_PADDING); } + /** + * Consructor container based + * + * @param parent + * @param context + * @param content + */ public CellArea(ContainerArea parent, LayoutContext context, IContent content) { super(parent, context, content); } + /** + * Constructor (default) + */ public CellArea() { super(); localProperties = CELL_DEFAULT; } + /** + * Constructor cell based + * + * @param cell + */ public CellArea(CellArea cell) { super(cell); rowSpan = cell.rowSpan; @@ -67,42 +89,92 @@ public CellArea(CellArea cell) { diagonalInfo = cell.diagonalInfo; } + /** + * Get the diagonal info + * + * @return Return the diagonal info + */ public DiagonalInfo getDiagonalInfo() { return diagonalInfo; } + /** + * Set the diagonal info + * + * @param diagonalInfo + */ public void setDiagonalInfo(DiagonalInfo diagonalInfo) { this.diagonalInfo = diagonalInfo; } + /** + * Get column id + * + * @return Return column id + */ public int getColumnID() { return columnID; } + /** + * Set the column id + * + * @param columnID + */ public void setColumnID(int columnID) { this.columnID = columnID; } + /** + * Get row id + * + * @return Return row id + */ public int getRowID() { return rowID; } + /** + * Set row id + * + * @param rowID + */ public void setRowID(int rowID) { this.rowID = rowID; } + /** + * Get colspan + * + * @return Return colspan + */ public int getColSpan() { return colSpan; } + /** + * Set colspan + * + * @param colSpan + */ public void setColSpan(int colSpan) { this.colSpan = colSpan; } + /** + * Get rowspan + * + * @return Return rowspan + */ public int getRowSpan() { return rowSpan; } + /** + * Set rowspan + * + * @param rowSpan + */ public void setRowSpan(int rowSpan) { this.rowSpan = rowSpan; } @@ -120,7 +192,7 @@ public void close() throws BirtException { } @Override - public void initialize() throws BirtException { + public void initialize() { ICellContent cellContent = (ICellContent) content; rowSpan = cellContent.getRowSpan(); columnID = cellContent.getColumn(); @@ -154,7 +226,7 @@ protected void buildDiagonalInfo() { if (diagonalNumber > 0 && diagonalWidth > 0 && diagonalStyle != null) { Color dc = PropertyUtil.getColor(cellContent.getDiagonalColor()); if (dc == null) { - dc = PropertyUtil.getColor(cellContent.getComputedStyle().getProperty(IStyle.STYLE_COLOR)); + dc = PropertyUtil.getColor(cellContent.getComputedStyle().getProperty(StyleConstants.STYLE_COLOR)); } diagonalInfo = new DiagonalInfo(); diagonalInfo.setDiagonal(diagonalNumber, diagonalStyle, diagonalWidth, dc); @@ -169,7 +241,7 @@ protected void buildDiagonalInfo() { } Color adc = PropertyUtil.getColor(cellContent.getAntidiagonalColor()); if (adc == null) { - adc = PropertyUtil.getColor(cellContent.getComputedStyle().getProperty(IStyle.STYLE_COLOR)); + adc = PropertyUtil.getColor(cellContent.getComputedStyle().getProperty(StyleConstants.STYLE_COLOR)); } diagonalInfo.setAntiDiagonal(antidiagonalNumber, antidiagonalStyle, antidiagonalWidth, adc); @@ -181,7 +253,7 @@ protected void buildDiagonalInfo() { protected void buildProperties(IContent content, LayoutContext context) { IStyle style = content.getComputedStyle(); boxStyle = new BoxStyle(); - Color color = PropertyUtil.getColor(style.getProperty(IStyle.STYLE_BACKGROUND_COLOR)); + Color color = PropertyUtil.getColor(style.getProperty(StyleConstants.STYLE_BACKGROUND_COLOR)); if (color != null) { boxStyle.setBackgroundColor(color); } @@ -193,36 +265,41 @@ protected void buildProperties(IContent content, LayoutContext context) { rl = exeContext.getResourceLocator(); } BackgroundImageInfo backgroundImage = new BackgroundImageInfo(getImageUrl(url), - style.getProperty(IStyle.STYLE_BACKGROUND_REPEAT), 0, 0, 0, 0, rl); + style.getProperty(StyleConstants.STYLE_BACKGROUND_REPEAT), 0, 0, 0, 0, rl, this.getCurrentModule(), + style.getProperty(StyleConstants.STYLE_BACKGROUND_IMAGE_TYPE)); boxStyle.setBackgroundImage(backgroundImage); } localProperties = new LocalProperties(); IStyle cs = content.getStyle(); - CSSValue padding = cs.getProperty(IStyle.STYLE_PADDING_TOP); + CSSValue padding = cs.getProperty(StyleConstants.STYLE_PADDING_TOP); if (padding == null) { localProperties.setPaddingTop(DEFAULT_PADDING); } else { - localProperties.setPaddingTop(getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_TOP), width)); + localProperties + .setPaddingTop(getDimensionValue(style.getProperty(StyleConstants.STYLE_PADDING_TOP), width)); } - padding = cs.getProperty(IStyle.STYLE_PADDING_BOTTOM); + padding = cs.getProperty(StyleConstants.STYLE_PADDING_BOTTOM); if (padding == null) { localProperties.setPaddingBottom(DEFAULT_PADDING); } else { - localProperties.setPaddingBottom(getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_BOTTOM), width)); + localProperties + .setPaddingBottom(getDimensionValue(style.getProperty(StyleConstants.STYLE_PADDING_BOTTOM), width)); } - padding = cs.getProperty(IStyle.STYLE_PADDING_LEFT); + padding = cs.getProperty(StyleConstants.STYLE_PADDING_LEFT); if (padding == null) { localProperties.setPaddingLeft(DEFAULT_PADDING); } else { - localProperties.setPaddingLeft(getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_LEFT), width)); + localProperties + .setPaddingLeft(getDimensionValue(style.getProperty(StyleConstants.STYLE_PADDING_LEFT), width)); } - padding = cs.getProperty(IStyle.STYLE_PADDING_RIGHT); + padding = cs.getProperty(StyleConstants.STYLE_PADDING_RIGHT); if (padding == null) { localProperties.setPaddingRight(DEFAULT_PADDING); } else { - localProperties.setPaddingRight(getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_RIGHT), width)); + localProperties + .setPaddingRight(getDimensionValue(style.getProperty(StyleConstants.STYLE_PADDING_RIGHT), width)); } - textAlign = content.getComputedStyle().getProperty(IStyle.STYLE_TEXT_ALIGN); + textAlign = content.getComputedStyle().getProperty(StyleConstants.STYLE_TEXT_ALIGN); } @Override diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/ContainerArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/ContainerArea.java index 0bfb36e4730..73b77e4c5ca 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/ContainerArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/ContainerArea.java @@ -24,10 +24,11 @@ import org.eclipse.birt.report.engine.content.IContent; import org.eclipse.birt.report.engine.content.IStyle; import org.eclipse.birt.report.engine.content.impl.ReportContent; +import org.eclipse.birt.report.engine.css.engine.StyleConstants; import org.eclipse.birt.report.engine.css.engine.value.FloatValue; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.executor.ExecutionContext; import org.eclipse.birt.report.engine.ir.DimensionType; -import org.eclipse.birt.report.engine.ir.EngineIRConstants; import org.eclipse.birt.report.engine.layout.PDFConstants; import org.eclipse.birt.report.engine.layout.pdf.util.PropertyUtil; import org.eclipse.birt.report.engine.nLayout.LayoutContext; @@ -40,11 +41,20 @@ import org.eclipse.birt.report.engine.util.ResourceLocatorWrapper; import org.eclipse.birt.report.model.api.IResourceLocator; import org.eclipse.birt.report.model.api.ReportDesignHandle; +import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; +import org.eclipse.birt.report.model.core.Module; import org.w3c.dom.css.CSSPrimitiveValue; import org.w3c.dom.css.CSSValue; import com.lowagie.text.Image; +/** + * + * Define the container area + * + * @since 3.3 + * + */ public abstract class ContainerArea extends AbstractArea implements IContainerArea { protected transient LocalProperties localProperties = LocalProperties.DEFAULT; @@ -98,6 +108,13 @@ public abstract class ContainerArea extends AbstractArea implements IContainerAr protected boolean isChildrenRemoved = false; + /** + * Constructor + * + * @param parent + * @param context + * @param content + */ public ContainerArea(ContainerArea parent, LayoutContext context, IContent content) { this.parent = parent; this.context = context; @@ -123,6 +140,12 @@ public ContainerArea(ContainerArea parent, LayoutContext context, IContent conte this.specifiedWidth = area.specifiedWidth; } + /** + * Get the enabling of automated page break + * + * @return Return the enabling of automated page break + * @throws BirtException + */ public boolean autoPageBreak() throws BirtException { if (context.isFixedLayout() && specifiedHeight > 0 && specifiedHeight + parent.getAbsoluteBP() <= context.getMaxBP()) { @@ -134,6 +157,11 @@ public boolean autoPageBreak() throws BirtException { return false; } + /** + * Get the vertical position calculated from content + * + * @return Return the vertical position calculated from content + */ public int getAbsoluteBP() { if (parent != null) { return currentBP + getOffsetY() + parent.getAbsoluteBP(); @@ -141,66 +169,140 @@ public int getAbsoluteBP() { return currentBP; } + /** + * Get the maximum height + * + * @return Return the maximum height + */ public int getMaxAvaHeight() { if (parent != null) { return getContentHeight(parent.getMaxAvaHeight()); - } else { - return context.getMaxBP(); } + return context.getMaxBP(); } + /** + * Get the current vertical position + * + * @return Return the current vertical position + */ public int getCurrentBP() { return this.currentBP; } + /** + * Set the current vertical position + * + * @param currentBP the current vertical position + */ public void setCurrentBP(int currentBP) { this.currentBP = currentBP; } + /** + * Set the current horizontal position + * + * @param currentIP the current horizontal position + */ public void setCurrentIP(int currentIP) { this.currentIP = currentIP; } + /** + * Get the current horizontal position + * + * @return Return the horizontal vertical position + */ public int getCurrentIP() { return this.currentIP; } + /** + * Set the maximum width + * + * @param maxAvaWidth maximum width + */ public void setMaxAvaWidth(int maxAvaWidth) { this.maxAvaWidth = maxAvaWidth; } + /** + * Get the maximum width + * + * @return Return the maximum width + */ public int getMaxAvaWidth() { return maxAvaWidth; } + /** + * Get the current content + * + * @return Return the current content + */ public IContent getContent() { return content; } + /** + * Get the specific height + * + * @return Return the specific height + */ public int getSpecifiedHeight() { return specifiedHeight; } + /** + * Get the specific width + * + * @return Return the specific width + */ public int getSpecifiedWidth() { return specifiedWidth; } + /** + * Get the shrink option + * + * @return Return the shrink option + */ public boolean isCanShrink() { return canShrink; } + /** + * Get the text align + * + * @return Return the text align + */ public CSSValue getTextAlign() { return textAlign; } + /** + * Get the text indent + * + * @return Return the text indent + */ public int getTextIndent() { return textIndent; } + /** + * Set the inline stacking option + * + * @param isInlineStacking the inline stacking option + */ public void setInlineStacking(boolean isInlineStacking) { this.isInlineStacking = isInlineStacking; } + /** + * Get the inline stacking option + * + * @return Return the inline stacking option + */ public boolean isInlineStacking() { return isInlineStacking; } @@ -216,6 +318,12 @@ public void addChild(IArea area) { } + /** + * Get the container child index based + * + * @param index index value of the child + * @return Return the container children + */ public IArea getChild(int index) { if (index >= 0 && index < children.size()) { return children.get(index); @@ -223,18 +331,38 @@ public IArea getChild(int index) { return null; } + /** + * Add an area to the container + * + * @param index position of the area + * @param area area element + */ public void addChild(int index, IArea area) { children.add(index, area); } + /** + * Verify the area like child at the container + * + * @param area to be searched area like child + * @return Return the index of an area + */ public int indexOf(IArea area) { return children.indexOf(area); } + /** + * Remove all child elements from the container + */ public void removeAll() { children.clear(); } + /** + * Remove a specific element from the container + * + * @param area element which is to remove + */ public void removeChild(IArea area) { children.remove(area); } @@ -264,42 +392,105 @@ public BoxStyle getBoxStyle() { return boxStyle; } + /** + * Set the style of the container box + * + * @param boxStyle style object + */ public void setBoxStyle(BoxStyle boxStyle) { this.boxStyle = boxStyle; } + /** + * Get the page break after option + * + * @return Return the page break after option + */ public CSSValue getPageBreakAfter() { return pageBreakAfter; } + /** + * Set the page break after option + * + * @param pageBreakAfter the page break after option + */ public void setPageBreakAfter(CSSValue pageBreakAfter) { this.pageBreakAfter = pageBreakAfter; } + /** + * Get the page break before option + * + * @return Return the page break before option + */ public CSSValue getPageBreakBefore() { return pageBreakBefore; } + /** + * Set the page break before option + * + * @param pageBreakBefore the page break before option + */ public void setPageBreakBefore(CSSValue pageBreakBefore) { this.pageBreakBefore = pageBreakBefore; } + /** + * Get the page break inside option + * + * @return Return the page break inside option + */ public CSSValue getPageBreakInside() { return pageBreakInside; } + /** + * Set the page break inside option + * + * @param pageBreakInside the page break inside option + */ public void setPageBreakInside(CSSValue pageBreakInside) { this.pageBreakInside = pageBreakInside; } + /** + * Close the container area + * + * @throws BirtException + */ public abstract void close() throws BirtException; + /** + * Initialize the container area + * + * @throws BirtException + */ public abstract void initialize() throws BirtException; + /** + * Split container lines + * + * @param lineCount + * @return Return the splitted results + * @throws BirtException + */ public abstract SplitResult splitLines(int lineCount) throws BirtException; + /** + * Split container lines + * + * @param height + * @param force + * @return Return the splitted results + * @throws BirtException + */ public abstract SplitResult split(int height, boolean force) throws BirtException; + /** + * Relayout the container area + */ public void relayout() { // FIXME to implement } @@ -328,9 +519,9 @@ protected void updateBackgroundImage() { float imageHeight = img.getPlainHeight() / resolutionY * 72; if (content != null) { IStyle style = content.getComputedStyle(); - int ox = getDimensionValue(style.getProperty(IStyle.STYLE_BACKGROUND_POSITION_X), + int ox = getDimensionValue(style.getProperty(StyleConstants.STYLE_BACKGROUND_POSITION_X), (width - (int) (imageWidth * PDFConstants.LAYOUT_TO_PDF_RATIO))); - int oy = getDimensionValue(style.getProperty(IStyle.STYLE_BACKGROUND_POSITION_Y), + int oy = getDimensionValue(style.getProperty(StyleConstants.STYLE_BACKGROUND_POSITION_Y), (height - (int) (imageHeight * PDFConstants.LAYOUT_TO_PDF_RATIO))); bgi.setXOffset(ox); bgi.setYOffset(oy); @@ -339,10 +530,15 @@ protected void updateBackgroundImage() { } } + /** + * Get line height + * + * @return Return the line height + */ public int getLineHeight() { if (content != null) { IStyle contentStyle = content.getComputedStyle(); - return PropertyUtil.getDimensionValueConsiderDpi(contentStyle.getProperty(IStyle.STYLE_LINE_HEIGHT), + return PropertyUtil.getDimensionValueConsiderDpi(contentStyle.getProperty(StyleConstants.STYLE_LINE_HEIGHT), content); } return 0; @@ -420,16 +616,26 @@ public void setAllocatedHeight(int aHeight) { } } + /** + * Get content height + * + * @param allocatedHeight + * @return Return the content height + */ public int getContentHeight(int allocatedHeight) { if (hasStyle) { return allocatedHeight - localProperties.getPaddingBottom() - localProperties.getPaddingTop() - localProperties.getMarginTop() - localProperties.getMarginBottom() - boxStyle.getBottomBorderWidth() - boxStyle.getTopBorderWidth(); - } else { - return allocatedHeight; } + return allocatedHeight; } + /** + * Get the content position Y + * + * @return Return the content position Y + */ public int getContentY() { if (hasStyle) { return localProperties.getPaddingTop() + boxStyle.getTopBorderWidth(); @@ -437,6 +643,11 @@ public int getContentY() { return 0; } + /** + * Get the content position X + * + * @return Return the content position X + */ public int getContentX() { if (hasStyle) { return localProperties.getPaddingLeft() + boxStyle.getLeftBorderWidth(); @@ -444,6 +655,11 @@ public int getContentX() { return 0; } + /** + * Get the maximum Y position + * + * @return Return the maximum Y position + */ public int getMaxYPosition() { if (hasStyle) { return y + height + localProperties.getMarginBottom(); @@ -451,6 +667,11 @@ public int getMaxYPosition() { return y + height; } + /** + * Get the minimum Y position + * + * @return Return the minimum Y position + */ public int getMinYPosition() { return y + height; } @@ -475,6 +696,11 @@ public void setAllocatedWidth(int aWidth) { } } + /** + * Set the content height + * + * @param cHeight + */ public void setContentHeight(int cHeight) { if (hasStyle) { height = cHeight + localProperties.getPaddingBottom() + localProperties.getPaddingTop() @@ -484,6 +710,11 @@ public void setContentHeight(int cHeight) { } } + /** + * Set the content width + * + * @param cWidth + */ public void setContentWidth(int cWidth) { if (hasStyle) { width = cWidth + localProperties.getPaddingLeft() + localProperties.getPaddingRight() @@ -496,35 +727,33 @@ public void setContentWidth(int cWidth) { /** * set allocated X position * - * @return + * @return Return the allocated position X */ @Override public int getAllocatedX() { if (hasStyle) { return x - localProperties.getMarginLeft(); - } else { - return x; } + return x; } /** * set allocated Y position * - * @return + * @return Return the allocated position Y */ @Override public int getAllocatedY() { if (hasStyle) { return y - localProperties.getMarginTop(); - } else { - return y; } + return y; } /** - * get content width + * Get content width * - * @return + * @return Return the content width */ public int getContentWidth() { if (hasStyle) { @@ -534,66 +763,82 @@ public int getContentWidth() { localProperties.setPaddingLeft(0); localProperties.setPaddingRight(0); return width - totalBorderWidth; - } else { - return width - totalPaddngWidth - totalBorderWidth; } - } else { - return width; + return width - totalPaddngWidth - totalBorderWidth; } + return width; } /** - * get content height + * Get content height * - * @return + * @return Return the content height */ public int getContentHeight() { if (hasStyle) { return height - boxStyle.getTopBorderWidth() - boxStyle.getBottomBorderWidth() - localProperties.getPaddingBottom() - localProperties.getPaddingTop(); - } else { - return height; } + return height; } /** - * get allocated width + * Get allocated width * - * @return + * @return Return allocated width */ @Override public int getAllocatedWidth() { if (hasStyle) { return width + localProperties.getMarginLeft() + localProperties.getMarginRight(); - } else { - return width; } + return width; } /** - * get allocated height + * Get allocated height * - * @return + * @return Return allocated height */ @Override public int getAllocatedHeight() { if (hasStyle) { return height + localProperties.getMarginBottom() + localProperties.getMarginTop(); - } else { - return height; } + return height; } + /** + * Get the maximum content width currently + * + * @return Return the maximum content width currently + */ public int getCurrentMaxContentWidth() { return maxAvaWidth - currentIP; } + /** + * Verify whether the container is empty + * + * @return Validation result of empty children + */ public boolean isEmpty() { return children.size() == 0; } + /** + * Update the child area of the container area + * + * @param area + * @throws BirtException + */ public abstract void update(AbstractArea area) throws BirtException; + /** + * Add a child area to the container area + * + * @param area + */ public abstract void add(AbstractArea area); protected boolean checkPageBreak() throws BirtException { @@ -614,6 +859,11 @@ protected boolean checkPageBreak() throws BirtException { return ret; } + /** + * Get the offset content position X + * + * @return Return the offset content position X + */ public int getOffsetX() { if (hasStyle) { return localProperties.getPaddingLeft() + boxStyle.getLeftBorderWidth(); @@ -621,6 +871,11 @@ public int getOffsetX() { return 0; } + /** + * Get the offset content position Y + * + * @return Return the offset content position Y + */ public int getOffsetY() { if (hasStyle) { return localProperties.getPaddingTop() + boxStyle.getTopBorderWidth(); @@ -646,25 +901,25 @@ protected int getDimensionValue(IContent content, DimensionType d, int dpi, int } try { String units = d.getUnits(); - if (units.equals(EngineIRConstants.UNITS_PT) || units.equals(EngineIRConstants.UNITS_CM) - || units.equals(EngineIRConstants.UNITS_MM) || units.equals(EngineIRConstants.UNITS_PC) - || units.equals(EngineIRConstants.UNITS_IN)) { - double point = d.convertTo(EngineIRConstants.UNITS_PT) * 1000; + if (units.equals(DesignChoiceConstants.UNITS_PT) || units.equals(DesignChoiceConstants.UNITS_CM) + || units.equals(DesignChoiceConstants.UNITS_MM) || units.equals(DesignChoiceConstants.UNITS_PC) + || units.equals(DesignChoiceConstants.UNITS_IN)) { + double point = d.convertTo(DesignChoiceConstants.UNITS_PT) * 1000; return (int) point; - } else if (units.equals(EngineIRConstants.UNITS_PX)) { + } else if (units.equals(DesignChoiceConstants.UNITS_PX)) { if (dpi == 0) { dpi = getResolution(); } double point = d.getMeasure() / dpi * 72000d; return (int) point; - } else if (units.equals(EngineIRConstants.UNITS_PERCENTAGE)) { + } else if (units.equals(DesignChoiceConstants.UNITS_PERCENTAGE)) { double point = referenceLength * d.getMeasure() / 100.0; return (int) point; - } else if (units.equals(EngineIRConstants.UNITS_EM) || units.equals(EngineIRConstants.UNITS_EX)) { + } else if (units.equals(DesignChoiceConstants.UNITS_EM) || units.equals(DesignChoiceConstants.UNITS_EX)) { int size = 9000; if (content != null) { IStyle style = content.getComputedStyle(); - CSSValue fontSize = style.getProperty(IStyle.STYLE_FONT_SIZE); + CSSValue fontSize = style.getProperty(StyleConstants.STYLE_FONT_SIZE); size = getDimensionValue(fontSize); } double point = size * d.getMeasure(); @@ -717,30 +972,36 @@ protected int getDimensionValue(CSSValue value, int referenceLength) { protected void validateBoxProperty(IStyle style, int maxWidth, int maxHeight) { // support negative margin - int leftMargin = getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_LEFT), maxWidth); - int rightMargin = getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_RIGHT), maxWidth); - int topMargin = getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_TOP), maxWidth); - int bottomMargin = getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_BOTTOM), maxWidth); + int leftMargin = getDimensionValue(style.getProperty(StyleConstants.STYLE_MARGIN_LEFT), maxWidth); + int rightMargin = getDimensionValue(style.getProperty(StyleConstants.STYLE_MARGIN_RIGHT), maxWidth); + int topMargin = getDimensionValue(style.getProperty(StyleConstants.STYLE_MARGIN_TOP), maxWidth); + int bottomMargin = getDimensionValue(style.getProperty(StyleConstants.STYLE_MARGIN_BOTTOM), maxWidth); // do not support negative paddding - int leftPadding = Math.max(0, getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_LEFT), maxWidth)); - int rightPadding = Math.max(0, getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_RIGHT), maxWidth)); - int topPadding = Math.max(0, getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_TOP), maxWidth)); - int bottomPadding = Math.max(0, getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_BOTTOM), maxWidth)); + int leftPadding = Math.max(0, + getDimensionValue(style.getProperty(StyleConstants.STYLE_PADDING_LEFT), maxWidth)); + int rightPadding = Math.max(0, + getDimensionValue(style.getProperty(StyleConstants.STYLE_PADDING_RIGHT), maxWidth)); + int topPadding = Math.max(0, getDimensionValue(style.getProperty(StyleConstants.STYLE_PADDING_TOP), maxWidth)); + int bottomPadding = Math.max(0, + getDimensionValue(style.getProperty(StyleConstants.STYLE_PADDING_BOTTOM), maxWidth)); // border does not support negative value, do not support pencentage // dimension - int leftBorder = Math.max(0, getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_LEFT_WIDTH), 0)); - int rightBorder = Math.max(0, getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_RIGHT_WIDTH), 0)); - int topBorder = Math.max(0, getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_TOP_WIDTH), 0)); - int bottomBorder = Math.max(0, getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_BOTTOM_WIDTH), 0)); - - int[] vsStyle = { IStyle.STYLE_MARGIN_RIGHT, IStyle.STYLE_MARGIN_LEFT, IStyle.STYLE_PADDING_RIGHT, - IStyle.STYLE_PADDING_LEFT, IStyle.STYLE_BORDER_RIGHT_WIDTH, IStyle.STYLE_BORDER_LEFT_WIDTH }; + int leftBorder = Math.max(0, getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_LEFT_WIDTH), 0)); + int rightBorder = Math.max(0, getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_RIGHT_WIDTH), 0)); + int topBorder = Math.max(0, getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_TOP_WIDTH), 0)); + int bottomBorder = Math.max(0, + getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_WIDTH), 0)); + + int[] vsStyle = { StyleConstants.STYLE_MARGIN_RIGHT, StyleConstants.STYLE_MARGIN_LEFT, + StyleConstants.STYLE_PADDING_RIGHT, StyleConstants.STYLE_PADDING_LEFT, + StyleConstants.STYLE_BORDER_RIGHT_WIDTH, StyleConstants.STYLE_BORDER_LEFT_WIDTH }; int[] vs = { rightMargin, leftMargin, rightPadding, leftPadding, rightBorder, leftBorder }; boolean[] vsConflicted = resolveBoxConflict(vs, maxWidth); - int[] hsStyle = { IStyle.STYLE_MARGIN_BOTTOM, IStyle.STYLE_MARGIN_TOP, IStyle.STYLE_PADDING_BOTTOM, - IStyle.STYLE_PADDING_TOP, IStyle.STYLE_BORDER_BOTTOM_WIDTH, IStyle.STYLE_BORDER_TOP_WIDTH }; + int[] hsStyle = { StyleConstants.STYLE_MARGIN_BOTTOM, StyleConstants.STYLE_MARGIN_TOP, + StyleConstants.STYLE_PADDING_BOTTOM, StyleConstants.STYLE_PADDING_TOP, + StyleConstants.STYLE_BORDER_BOTTOM_WIDTH, StyleConstants.STYLE_BORDER_TOP_WIDTH }; int[] hs = { bottomMargin, topMargin, bottomPadding, topPadding, bottomBorder, topBorder }; boolean[] hsConflicted = resolveBoxConflict(hs, maxHeight); @@ -800,6 +1061,14 @@ protected boolean[] resolveBoxConflict(int[] vs, int max) { return conflicted; } + protected ReportDesignHandle getCurrentDesignHandle() { + return content.getReportContent().getDesign().getReportDesign(); + } + + protected Module getCurrentModule() { + return getCurrentDesignHandle().getModule(); + } + protected void buildProperties(IContent content, LayoutContext context) { // FIXME cache the LocalProperties and BoxStyle // FIXME validate box properties @@ -807,65 +1076,67 @@ protected void buildProperties(IContent content, LayoutContext context) { localProperties = new LocalProperties(); int maw = parent.getMaxAvaWidth(); - localProperties.setMarginBottom(getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_BOTTOM), maw)); - localProperties.setMarginLeft(getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_LEFT), maw)); - localProperties.setMarginTop(getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_TOP), maw)); - localProperties.setMarginRight(getDimensionValue(style.getProperty(IStyle.STYLE_MARGIN_RIGHT), maw)); + localProperties.setMarginBottom(getDimensionValue(style.getProperty(StyleConstants.STYLE_MARGIN_BOTTOM), maw)); + localProperties.setMarginLeft(getDimensionValue(style.getProperty(StyleConstants.STYLE_MARGIN_LEFT), maw)); + localProperties.setMarginTop(getDimensionValue(style.getProperty(StyleConstants.STYLE_MARGIN_TOP), maw)); + localProperties.setMarginRight(getDimensionValue(style.getProperty(StyleConstants.STYLE_MARGIN_RIGHT), maw)); - localProperties.setPaddingBottom(getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_BOTTOM), maw)); - localProperties.setPaddingLeft(getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_LEFT), maw)); - localProperties.setPaddingTop(getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_TOP), maw)); - localProperties.setPaddingRight(getDimensionValue(style.getProperty(IStyle.STYLE_PADDING_RIGHT), maw)); + localProperties + .setPaddingBottom(getDimensionValue(style.getProperty(StyleConstants.STYLE_PADDING_BOTTOM), maw)); + localProperties.setPaddingLeft(getDimensionValue(style.getProperty(StyleConstants.STYLE_PADDING_LEFT), maw)); + localProperties.setPaddingTop(getDimensionValue(style.getProperty(StyleConstants.STYLE_PADDING_TOP), maw)); + localProperties.setPaddingRight(getDimensionValue(style.getProperty(StyleConstants.STYLE_PADDING_RIGHT), maw)); if (!isInlineStacking) { - pageBreakAfter = style.getProperty(IStyle.STYLE_PAGE_BREAK_AFTER); + pageBreakAfter = style.getProperty(StyleConstants.STYLE_PAGE_BREAK_AFTER); if (pageBreakInside == null) { - pageBreakInside = style.getProperty(IStyle.STYLE_PAGE_BREAK_INSIDE); + pageBreakInside = style.getProperty(StyleConstants.STYLE_PAGE_BREAK_INSIDE); } - pageBreakBefore = style.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE); + pageBreakBefore = style.getProperty(StyleConstants.STYLE_PAGE_BREAK_BEFORE); } this.boxStyle = new BoxStyle(); - int borderWidth = getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_LEFT_WIDTH), maw); + int borderWidth = getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_LEFT_WIDTH), maw); if (borderWidth > 0) { - boxStyle.setLeftBorder(new BorderInfo(style.getProperty(IStyle.STYLE_BORDER_LEFT_COLOR), - style.getProperty(IStyle.STYLE_BORDER_LEFT_STYLE), borderWidth)); + boxStyle.setLeftBorder(new BorderInfo(style.getProperty(StyleConstants.STYLE_BORDER_LEFT_COLOR), + style.getProperty(StyleConstants.STYLE_BORDER_LEFT_STYLE), borderWidth)); } - borderWidth = getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_RIGHT_WIDTH), maw); + borderWidth = getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_RIGHT_WIDTH), maw); if (borderWidth > 0) { - boxStyle.setRightBorder(new BorderInfo(style.getProperty(IStyle.STYLE_BORDER_RIGHT_COLOR), - style.getProperty(IStyle.STYLE_BORDER_RIGHT_STYLE), borderWidth)); + boxStyle.setRightBorder(new BorderInfo(style.getProperty(StyleConstants.STYLE_BORDER_RIGHT_COLOR), + style.getProperty(StyleConstants.STYLE_BORDER_RIGHT_STYLE), borderWidth)); } - borderWidth = getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_TOP_WIDTH), maw); + borderWidth = getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_TOP_WIDTH), maw); if (borderWidth > 0) { - boxStyle.setTopBorder(new BorderInfo(style.getProperty(IStyle.STYLE_BORDER_TOP_COLOR), - style.getProperty(IStyle.STYLE_BORDER_TOP_STYLE), borderWidth)); + boxStyle.setTopBorder(new BorderInfo(style.getProperty(StyleConstants.STYLE_BORDER_TOP_COLOR), + style.getProperty(StyleConstants.STYLE_BORDER_TOP_STYLE), borderWidth)); } - borderWidth = getDimensionValue(style.getProperty(IStyle.STYLE_BORDER_BOTTOM_WIDTH), maw); + borderWidth = getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_WIDTH), maw); if (borderWidth > 0) { - boxStyle.setBottomBorder(new BorderInfo(style.getProperty(IStyle.STYLE_BORDER_BOTTOM_COLOR), - style.getProperty(IStyle.STYLE_BORDER_BOTTOM_STYLE), borderWidth)); + boxStyle.setBottomBorder(new BorderInfo(style.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_COLOR), + style.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_STYLE), borderWidth)); } - Color color = PropertyUtil.getColor(style.getProperty(IStyle.STYLE_BACKGROUND_COLOR)); + Color color = PropertyUtil.getColor(style.getProperty(StyleConstants.STYLE_BACKGROUND_COLOR)); if (color != null) { boxStyle.setBackgroundColor(color); } - CSSValue url = style.getProperty(IStyle.STYLE_BACKGROUND_IMAGE); - if (!IStyle.NONE_VALUE.equals(style.getProperty(IStyle.STYLE_BACKGROUND_IMAGE))) { + CSSValue url = style.getProperty(StyleConstants.STYLE_BACKGROUND_IMAGE); + if (!CSSValueConstants.NONE_VALUE.equals(style.getProperty(StyleConstants.STYLE_BACKGROUND_IMAGE))) { ResourceLocatorWrapper rl = null; ExecutionContext exeContext = ((ReportContent) content.getReportContent()).getExecutionContext(); if (exeContext != null) { rl = exeContext.getResourceLocator(); } BackgroundImageInfo backgroundImage = new BackgroundImageInfo(getImageUrl(url.getCssText()), - style.getProperty(IStyle.STYLE_BACKGROUND_REPEAT), 0, 0, 0, 0, rl); + style.getProperty(StyleConstants.STYLE_BACKGROUND_REPEAT), 0, 0, 0, 0, rl, this.getCurrentModule(), + style.getProperty(StyleConstants.STYLE_BACKGROUND_IMAGE_TYPE)); boxStyle.setBackgroundImage(backgroundImage); } @@ -873,12 +1144,12 @@ protected void buildProperties(IContent content, LayoutContext context) { bookmark = content.getBookmark(); } - protected void buildLogicContainerProperties(IContent content, LayoutContext context) { + protected void buildLogicContainerProperties(IContent content) { IStyle style = content.getStyle(); if (style != null && !style.isEmpty()) { boxStyle = new BoxStyle(); IStyle cs = content.getComputedStyle(); - Color color = PropertyUtil.getColor(cs.getProperty(IStyle.STYLE_BACKGROUND_COLOR)); + Color color = PropertyUtil.getColor(cs.getProperty(StyleConstants.STYLE_BACKGROUND_COLOR)); if (color != null) { boxStyle.setBackgroundColor(color); @@ -892,15 +1163,16 @@ protected void buildLogicContainerProperties(IContent content, LayoutContext con rl = exeContext.getResourceLocator(); } BackgroundImageInfo backgroundImage = new BackgroundImageInfo(getImageUrl(url), - cs.getProperty(IStyle.STYLE_BACKGROUND_REPEAT), 0, 0, 0, 0, rl); + cs.getProperty(StyleConstants.STYLE_BACKGROUND_REPEAT), 0, 0, 0, 0, rl, this.getCurrentModule(), + cs.getProperty(StyleConstants.STYLE_BACKGROUND_IMAGE_TYPE)); boxStyle.setBackgroundImage(backgroundImage); } if (!isInlineStacking) { - pageBreakAfter = cs.getProperty(IStyle.STYLE_PAGE_BREAK_AFTER); + pageBreakAfter = cs.getProperty(StyleConstants.STYLE_PAGE_BREAK_AFTER); if (pageBreakInside == null) { - pageBreakInside = cs.getProperty(IStyle.STYLE_PAGE_BREAK_INSIDE); + pageBreakInside = cs.getProperty(StyleConstants.STYLE_PAGE_BREAK_INSIDE); } - pageBreakBefore = cs.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE); + pageBreakBefore = cs.getProperty(StyleConstants.STYLE_PAGE_BREAK_BEFORE); } } else { @@ -912,7 +1184,10 @@ protected void buildLogicContainerProperties(IContent content, LayoutContext con action = content.getHyperlinkAction(); } - public abstract void updateChildrenPosition() throws BirtException; + /** + * Update children position + */ + public abstract void updateChildrenPosition(); protected TableArea getTable() { ContainerArea p = parent; @@ -925,7 +1200,7 @@ protected TableArea getTable() { @Override public ContainerArea deepClone() { ContainerArea result = (ContainerArea) cloneArea(); - Iterator iter = children.iterator(); + Iterator iter = children.iterator(); while (iter.hasNext()) { AbstractArea child = (AbstractArea) iter.next(); AbstractArea cloneChild = child.deepClone(); @@ -935,9 +1210,14 @@ public ContainerArea deepClone() { return result; } + /** + * Get option to avoid the page break inside + * + * @return Return the option to avoid the page break inside + */ public boolean isPageBreakInsideAvoid() { if (pageBreakInside != null) { - return (IStyle.AVOID_VALUE == pageBreakInside); + return (CSSValueConstants.AVOID_VALUE == pageBreakInside); } return false; } @@ -956,9 +1236,14 @@ protected String getImageUrl(String imageUri) { return imageUrl; } + /** + * Get the option to avoid the page break after + * + * @return Return the option to avoid the page break after + */ public boolean isPageBreakAfterAvoid() { if (localProperties != null) { - if (IStyle.AVOID_VALUE == pageBreakAfter) { + if (CSSValueConstants.AVOID_VALUE == pageBreakAfter) { return true; } } @@ -972,9 +1257,14 @@ public boolean isPageBreakAfterAvoid() { return false; } + /** + * Get the option to avoid the page break before + * + * @return Return the option to avoid the page break before + */ public boolean isPageBreakBeforeAvoid() { if (localProperties != null) { - if (IStyle.AVOID_VALUE == pageBreakBefore) { + if (CSSValueConstants.AVOID_VALUE == pageBreakBefore) { return true; } } @@ -988,6 +1278,11 @@ public boolean isPageBreakBeforeAvoid() { return false; } + /** + * Get the last child area of the container + * + * @return Return the last child area of the container + */ public IArea getLastChild() { int size = children.size(); if (size > 0) { @@ -996,6 +1291,11 @@ public IArea getLastChild() { return null; } + /** + * Get the first child area of the container + * + * @return Return the first child area of the container + */ public IArea getFirstChild() { int size = children.size(); if (size > 0) { diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/ForeignHtmlRegionArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/ForeignHtmlRegionArea.java index 2363b1f823e..6170f789eb3 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/ForeignHtmlRegionArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/ForeignHtmlRegionArea.java @@ -16,21 +16,36 @@ import org.eclipse.birt.core.exception.BirtException; import org.eclipse.birt.report.engine.content.IForeignContent; -import org.eclipse.birt.report.engine.content.IStyle; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.nLayout.LayoutContext; import org.eclipse.birt.report.engine.nLayout.area.IContainerArea; +/** + * Definition of foreign HTML region area + * + * @since 3.3 + * + */ public class ForeignHtmlRegionArea extends RegionArea implements IContainerArea { + /** + * Constructor (default) + */ public ForeignHtmlRegionArea() { super(); } + /** + * Constructor content based + * + * @param content + * @param context + */ public ForeignHtmlRegionArea(IForeignContent content, LayoutContext context) { super(); this.context = context; this.content = content; - this.setPageBreakInside(IStyle.AVOID_VALUE); + this.setPageBreakInside(CSSValueConstants.AVOID_VALUE); } ForeignHtmlRegionArea(ForeignHtmlRegionArea area) { @@ -45,7 +60,7 @@ public void initialize() throws BirtException { } @Override - public void close() throws BirtException { + public void close() { finished = true; if (specifiedHeight > 0) { height = specifiedHeight; @@ -74,7 +89,7 @@ public SplitResult split(int height, boolean force) throws BirtException { } @Override - public void update(AbstractArea area) throws BirtException { + public void update(AbstractArea area) { // throws BirtException { int aHeight = area.getAllocatedHeight(); currentBP += aHeight; if (currentIP + area.getAllocatedWidth() > maxAvaWidth) { @@ -82,6 +97,11 @@ public void update(AbstractArea area) throws BirtException { } } + /** + * Is the foreign HTML region finished + * + * @return true, foreign HTML region is finished + */ public boolean isFinished() { return finished; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/HtmlRegionArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/HtmlRegionArea.java index 22457e22ed6..e4f934d9818 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/HtmlRegionArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/HtmlRegionArea.java @@ -17,7 +17,17 @@ import org.eclipse.birt.core.exception.BirtException; import org.eclipse.birt.report.engine.nLayout.area.IContainerArea; +/** + * Definition of the HTML region area + * + * @since 3.3 + * + */ public class HtmlRegionArea extends RegionArea implements IContainerArea { + + /** + * Constructor + */ public HtmlRegionArea() { super(); } @@ -27,7 +37,7 @@ public HtmlRegionArea() { } @Override - public void close() throws BirtException { + public void close() { if (specifiedHeight >= currentBP) { finished = true; } else { @@ -45,6 +55,11 @@ public void update(AbstractArea area) throws BirtException { } } + /** + * Verify if the HTML region is finished + * + * @return true, HTML region is finished + */ public boolean isFinished() { return finished; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/InlineStackingArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/InlineStackingArea.java index a50f89d1b4e..c0d73cf024a 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/InlineStackingArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/InlineStackingArea.java @@ -17,26 +17,61 @@ import org.eclipse.birt.core.exception.BirtException; import org.eclipse.birt.report.engine.content.IContent; -import org.eclipse.birt.report.engine.content.IStyle; import org.eclipse.birt.report.engine.content.ITextContent; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.nLayout.LayoutContext; +import org.eclipse.birt.report.engine.nLayout.area.IArea; import org.w3c.dom.css.CSSValue; +/** + * Definition of the inline stacking area + * + * @since 3.3 + * + */ public abstract class InlineStackingArea extends ContainerArea { + /** + * Constructor container based + * + * @param parent + * @param context + * @param content + */ public InlineStackingArea(ContainerArea parent, LayoutContext context, IContent content) { super(parent, context, content); this.isInlineStacking = true; } + /** + * Constructor area based + * + * @param area + */ public InlineStackingArea(InlineStackingArea area) { super(area); } + /** + * End the line + * + * @param endParagraph + * @throws BirtException + */ public abstract void endLine(boolean endParagraph) throws BirtException; + /** + * Is the line empty + * + * @return true, line is empty + */ public abstract boolean isEmptyLine(); + /** + * Get the maximum line width + * + * @return Return maximum line width + */ public abstract int getMaxLineWidth(); @Override @@ -54,7 +89,7 @@ public void add(AbstractArea area) { @Override public int getBaseLine() { if (baseLine == 0 && children.size() > 0) { - Iterator iter = children.iterator(); + Iterator iter = children.iterator(); while (iter.hasNext()) { AbstractArea child = (AbstractArea) iter.next(); baseLine = Math.max(baseLine, child.getY() + child.getBaseLine()); @@ -64,11 +99,11 @@ public int getBaseLine() { } @Override - public void updateChildrenPosition() throws BirtException { + public void updateChildrenPosition() { first = false; currentIP = 0; if (children.size() > 0) { - Iterator iter = children.iterator(); + Iterator iter = children.iterator(); int x = getOffsetX(); int w = 0; while (iter.hasNext()) { @@ -91,17 +126,17 @@ public void updateChildrenPosition() throws BirtException { } protected void verticalAlign() { - Iterator iter = getChildren(); + Iterator iter = getChildren(); while (iter.hasNext()) { AbstractArea child = (AbstractArea) iter.next(); CSSValue vAlign = child.getVerticalAlign(); - if (IStyle.TOP_VALUE.equals(vAlign)) { + if (CSSValueConstants.TOP_VALUE.equals(vAlign)) { continue; } int spacing = getContentHeight() - child.getAllocatedHeight(); - if ((vAlign == null && !isImageContainer(child)) || IStyle.BASELINE_VALUE.equals(vAlign)) { - // FIXME to implement basline alignment + if ((vAlign == null && !isImageContainer(child)) || CSSValueConstants.BASELINE_VALUE.equals(vAlign)) { + // FIXME to implement baseline alignment int lineHeight = parent.getLineHeight(); if (lineHeight > 0) { // align to middle, fix issue 164072 @@ -109,9 +144,9 @@ protected void verticalAlign() { } else { child.setPosition(child.getX(), getBaseLine() - child.getBaseLine()); } - } else if (IStyle.BOTTOM_VALUE.equals(vAlign)) { + } else if (CSSValueConstants.BOTTOM_VALUE.equals(vAlign)) { child.setPosition(child.getX(), child.getY() + spacing); - } else if (IStyle.MIDDLE_VALUE.equals(vAlign)) { + } else if (CSSValueConstants.MIDDLE_VALUE.equals(vAlign)) { child.setPosition(child.getX(), child.getY() + spacing / 2); } } @@ -120,11 +155,15 @@ protected void verticalAlign() { private boolean isImageContainer(AbstractArea area) { if (area instanceof ImageInlineContainer || area instanceof ImageBlockContainer) { return true; - } else { - return false; } + return false; } + /** + * Set the text indent + * + * @param content + */ public abstract void setTextIndent(ITextContent content); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/LineArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/LineArea.java index 27ef4fd49d0..f3a133601b2 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/LineArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/LineArea.java @@ -21,6 +21,7 @@ import org.eclipse.birt.report.engine.content.IStyle; import org.eclipse.birt.report.engine.content.ITextContent; import org.eclipse.birt.report.engine.css.engine.StyleConstants; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.layout.pdf.util.PropertyUtil; import org.eclipse.birt.report.engine.nLayout.LayoutContext; import org.eclipse.birt.report.engine.nLayout.area.IArea; @@ -31,18 +32,35 @@ import com.ibm.icu.text.Bidi; +/** + * Definition of line area + * + * @since 3.3 + * + */ public class LineArea extends InlineStackingArea { protected byte baseLevel = Bidi.DIRECTION_LEFT_TO_RIGHT; protected boolean setIndent = false; + /** + * Constructor container absed + * + * @param parent + * @param context + */ public LineArea(ContainerArea parent, LayoutContext context) { super(parent, context, null); assert (parent != null); isInInlineStacking = parent.isInInlineStacking; } + /** + * Constructor area based + * + * @param area + */ public LineArea(LineArea area) { super(area); this.baseLevel = area.baseLevel; @@ -50,6 +68,11 @@ public LineArea(LineArea area) { this.isInInlineStacking = area.isInInlineStacking; } + /** + * Set base level + * + * @param baseLevel + */ public void setBaseLevel(byte baseLevel) { this.baseLevel = baseLevel; } @@ -80,6 +103,12 @@ public void setTextIndent(ITextContent content) { } } + /** + * Generate alignment of context + * + * @param endParagraph + * @param context + */ public void align(boolean endParagraph, LayoutContext context) { assert (parent instanceof BlockContainerArea); CSSValue align = ((BlockContainerArea) parent).getTextAlign(); @@ -89,9 +118,9 @@ public void align(boolean endParagraph, LayoutContext context) { boolean isRightAligned = BidiAlignmentResolver.isRightAligned(parent.content, align, endParagraph); // single line - if ((isRightAligned || IStyle.CENTER_VALUE.equals(align))) { + if ((isRightAligned || CSSValueConstants.CENTER_VALUE.equals(align))) { int spacing = width - currentIP; - Iterator iter = getChildren(); + Iterator iter = getChildren(); while (iter.hasNext()) { AbstractArea area = (AbstractArea) iter.next(); @@ -101,12 +130,12 @@ public void align(boolean endParagraph, LayoutContext context) { } else { area.setPosition(spacing + area.getX() + ignoreRightMostWhiteSpace(), area.getY()); } - } else if (IStyle.CENTER_VALUE.equals(align)) { + } else if (CSSValueConstants.CENTER_VALUE.equals(align)) { area.setPosition(spacing / 2 + area.getX(), area.getY()); } } - } else if (IStyle.JUSTIFY_VALUE.equals(align) && !endParagraph) { + } else if (CSSValueConstants.JUSTIFY_VALUE.equals(align) && !endParagraph) { justify(); } if (context.getBidiProcessing()) { @@ -118,7 +147,7 @@ public void align(boolean endParagraph, LayoutContext context) { private int ignoreRightMostWhiteSpace() { AbstractArea area = this; while (area instanceof ContainerArea) { - ArrayList children = ((ContainerArea) area).children; + ArrayList children = ((ContainerArea) area).children; if (children != null && children.size() > 0) { area = (AbstractArea) children.get(children.size() - 1); } else { @@ -145,7 +174,7 @@ private int adjustWordSpacing(int wordSpacing, ContainerArea area) { if (wordSpacing == 0) { return 0; } - Iterator iter = area.getChildren(); + Iterator iter = area.getChildren(); int delta = 0; while (iter.hasNext()) { AbstractArea child = (AbstractArea) iter.next(); @@ -175,7 +204,7 @@ private int adjustWordSpacing(int wordSpacing, ContainerArea area) { } private int adjustLetterSpacing(int letterSpacing, ContainerArea area) { - Iterator iter = area.getChildren(); + Iterator iter = area.getChildren(); int delta = 0; while (iter.hasNext()) { AbstractArea child = (AbstractArea) iter.next(); @@ -246,7 +275,7 @@ private int getWhiteSpaceNumber(LineArea line) { */ private int getWhiteSpaceRawNumber(ContainerArea area) { int count = 0; - Iterator iter = area.getChildren(); + Iterator iter = area.getChildren(); while (iter.hasNext()) { AbstractArea child = (AbstractArea) iter.next(); if (child instanceof TextArea) { @@ -269,7 +298,7 @@ private int getWhiteSpaceRawNumber(ContainerArea area) { private int getLetterNumber(ContainerArea area) { int count = 0; - Iterator iter = area.getChildren(); + Iterator iter = area.getChildren(); while (iter.hasNext()) { AbstractArea child = (AbstractArea) iter.next(); if (child instanceof TextArea) { @@ -406,12 +435,12 @@ protected void close(boolean isLastLine, boolean endParagraph) throws BirtExcept area.children = children; area.context = context; area.setParent(parent); - Iterator iter = area.getChildren(); + Iterator iter = area.getChildren(); while (iter.hasNext()) { AbstractArea child = (AbstractArea) iter.next(); child.setParent(area); } - children = new ArrayList(); + children = new ArrayList(); parent.add(area); area.checkPageBreak(); parent.update(area); @@ -450,7 +479,7 @@ public void initialize() throws BirtException { public SplitResult split(int height, boolean force) throws BirtException { assert (height < this.height); LineArea result = null; - Iterator iter = children.iterator(); + Iterator iter = children.iterator(); while (iter.hasNext()) { ContainerArea child = (ContainerArea) iter.next(); @@ -498,9 +527,8 @@ public SplitResult split(int height, boolean force) throws BirtException { } if (result != null) { return new SplitResult(result, SplitResult.SPLIT_SUCCEED_WITH_PART); - } else { - return SplitResult.SUCCEED_WITH_NULL; } + return SplitResult.SUCCEED_WITH_NULL; } @Override @@ -509,7 +537,7 @@ public LineArea cloneArea() { } @Override - public SplitResult splitLines(int lineCount) throws BirtException { + public SplitResult splitLines(int lineCount) { return SplitResult.SUCCEED_WITH_NULL; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/PageArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/PageArea.java index c2753ecc961..71fafa87b3a 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/PageArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/PageArea.java @@ -33,6 +33,7 @@ import org.eclipse.birt.report.engine.layout.pdf.util.PropertyUtil; import org.eclipse.birt.report.engine.nLayout.LayoutContext; import org.eclipse.birt.report.engine.nLayout.RegionLayoutEngine; +import org.eclipse.birt.report.engine.nLayout.area.IArea; import org.eclipse.birt.report.engine.nLayout.area.IContainerArea; import org.eclipse.birt.report.engine.nLayout.area.style.BackgroundImageInfo; import org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo; @@ -43,6 +44,12 @@ import com.lowagie.text.Image; +/** + * Definition of the page area + * + * @since 3.3 + * + */ public class PageArea extends BlockContainerArea { final static int DEFAULT_PAGE_WIDTH = 595275; @@ -68,51 +75,104 @@ public class PageArea extends BlockContainerArea { private transient int rootLeft; private transient int rootTop; + /** + * Constructor context based + * + * @param context + * @param content + * @param emitter + */ public PageArea(LayoutContext context, IContent content, LayoutEmitterAdapter emitter) { super(null, context, content); this.emitter = emitter; pageContent = (IPageContent) content; } + /** + * Constructor page area based + * + * @param area + */ public PageArea(PageArea area) { super(area); } + /** + * Get the header + * + * @return Return the header area + */ public IContainerArea getHeader() { return header; } + /** + * Verify to use multiple pages + * + * @return true, extend to multiple pages + */ public boolean isExtendToMultiplePages() { return extendToMultiplePages; } + /** + * Remove header from page + */ public void removeHeader() { - ((ContainerArea) root).removeChild(header); + root.removeChild(header); header = null; } + /** + * Remove footer from page + */ public void removeFooter() { - ((ContainerArea) root).removeChild(footer); + root.removeChild(footer); footer = null; } + /** + * Get the page footer + * + * @return Return page footer + */ public IContainerArea getFooter() { return footer; } + /** + * Get the page body + * + * @return Return page body + */ public IContainerArea getBody() { return body; } + /** + * Get the page root + * + * @return Return page root + */ public IContainerArea getRoot() { return root; } + /** + * Set the page root + * + * @param root + */ public void setRoot(ContainerArea root) { this.root = root; this.children.add(root); } + /** + * Set the page body + * + * @param body + */ public void setBody(ContainerArea body) { if (this.body != null) { body.setPosition(this.body.getX(), this.body.getY()); @@ -123,23 +183,46 @@ public void setBody(ContainerArea body) { this.body = body; } + /** + * Remove page body + */ public void removeBody() { root.children.remove(body); this.body = null; } + /** + * Set page header + * + * @param header + */ public void setHeader(RegionArea header) { this.header = header; } + /** + * Set page footer + * + * @param footer + */ public void setFooter(RegionArea footer) { this.footer = footer; } + /** + * Verify if the page enlarging is enabled + * + * @return true, enlarge page size is used + */ public boolean isEnlargePageSize() { return enlargePageSize; } + /** + * Set the option to enlarge the page size + * + * @param enlargePageSize + */ public void setEnlargePageSize(boolean enlargePageSize) { this.enlargePageSize = enlargePageSize; } @@ -155,34 +238,34 @@ protected BoxStyle buildRootStyle() { if ((style != null) && !style.isEmpty()) { BoxStyle boxStyle = new BoxStyle(); IStyle cs = pageContent.getComputedStyle(); - int borderWidth = getDimensionValue(cs.getProperty(IStyle.STYLE_BORDER_LEFT_WIDTH), width); + int borderWidth = getDimensionValue(cs.getProperty(StyleConstants.STYLE_BORDER_LEFT_WIDTH), width); if (borderWidth > 0) { - boxStyle.setLeftBorder(new BorderInfo(cs.getProperty(IStyle.STYLE_BORDER_LEFT_COLOR), - cs.getProperty(IStyle.STYLE_BORDER_LEFT_STYLE), borderWidth)); + boxStyle.setLeftBorder(new BorderInfo(cs.getProperty(StyleConstants.STYLE_BORDER_LEFT_COLOR), + cs.getProperty(StyleConstants.STYLE_BORDER_LEFT_STYLE), borderWidth)); } - borderWidth = getDimensionValue(cs.getProperty(IStyle.STYLE_BORDER_RIGHT_WIDTH), width); + borderWidth = getDimensionValue(cs.getProperty(StyleConstants.STYLE_BORDER_RIGHT_WIDTH), width); if (borderWidth > 0) { - boxStyle.setRightBorder(new BorderInfo(cs.getProperty(IStyle.STYLE_BORDER_RIGHT_COLOR), - cs.getProperty(IStyle.STYLE_BORDER_RIGHT_STYLE), borderWidth)); + boxStyle.setRightBorder(new BorderInfo(cs.getProperty(StyleConstants.STYLE_BORDER_RIGHT_COLOR), + cs.getProperty(StyleConstants.STYLE_BORDER_RIGHT_STYLE), borderWidth)); } - borderWidth = getDimensionValue(cs.getProperty(IStyle.STYLE_BORDER_TOP_WIDTH), width); + borderWidth = getDimensionValue(cs.getProperty(StyleConstants.STYLE_BORDER_TOP_WIDTH), width); if (borderWidth > 0) { - boxStyle.setTopBorder(new BorderInfo(cs.getProperty(IStyle.STYLE_BORDER_TOP_COLOR), - cs.getProperty(IStyle.STYLE_BORDER_TOP_STYLE), borderWidth)); + boxStyle.setTopBorder(new BorderInfo(cs.getProperty(StyleConstants.STYLE_BORDER_TOP_COLOR), + cs.getProperty(StyleConstants.STYLE_BORDER_TOP_STYLE), borderWidth)); } - borderWidth = getDimensionValue(cs.getProperty(IStyle.STYLE_BORDER_BOTTOM_WIDTH), width); + borderWidth = getDimensionValue(cs.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_WIDTH), width); if (borderWidth > 0) { - boxStyle.setBottomBorder(new BorderInfo(cs.getProperty(IStyle.STYLE_BORDER_BOTTOM_COLOR), - cs.getProperty(IStyle.STYLE_BORDER_BOTTOM_STYLE), borderWidth)); + boxStyle.setBottomBorder(new BorderInfo(cs.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_COLOR), + cs.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_STYLE), borderWidth)); } return boxStyle; } - return boxStyle.DEFAULT; + return BoxStyle.DEFAULT; } @Override @@ -224,17 +307,6 @@ public void initialize() throws BirtException { context.resetUnresolvedRowHints(); } - /* - * - * - * public byte[] loadAsEmbeddedImage(String url, Module module) { StructureDefn - * defn = (StructureDefn) MetaDataDictionary.getInstance() - * .getStructure(EmbeddedImage.EMBEDDED_IMAGE_STRUCT); byte[] imageData = null; - * try { EmbeddedImage ei = (EmbeddedImage) - * StructureRefUtil.findStructure(module, defn, url); imageData = - * ei.getData(module); } catch (Exception te) { imageData = null; } return - * imageData; } - */ protected BackgroundImageInfo createBackgroundImage(String url, Module module) { ResourceLocatorWrapper rl = null; ExecutionContext exeContext = ((ReportContent) content.getReportContent()).getExecutionContext(); @@ -244,8 +316,8 @@ protected BackgroundImageInfo createBackgroundImage(String url, Module module) { IStyle cs = pageContent.getComputedStyle(); BackgroundImageInfo backgroundImage = null; - backgroundImage = new BackgroundImageInfo(url, cs.getProperty(IStyle.STYLE_BACKGROUND_REPEAT), 0, 0, 0, 0, rl, - module, cs.getProperty(IStyle.STYLE_BACKGROUND_IMAGE_TYPE)); + backgroundImage = new BackgroundImageInfo(url, cs.getProperty(StyleConstants.STYLE_BACKGROUND_REPEAT), 0, 0, 0, + 0, rl, module, cs.getProperty(StyleConstants.STYLE_BACKGROUND_IMAGE_TYPE)); Image img = backgroundImage.getImageInstance(); IStyle style = pageContent.getStyle(); @@ -311,9 +383,10 @@ protected BackgroundImageInfo createBackgroundImage(String url, Module module) { } backgroundImage.setXOffset( - getDimensionValue(cs.getProperty(IStyle.STYLE_BACKGROUND_POSITION_X), width - actualWidth)); + getDimensionValue(cs.getProperty(StyleConstants.STYLE_BACKGROUND_POSITION_X), width - actualWidth)); backgroundImage.setYOffset( - getDimensionValue(cs.getProperty(IStyle.STYLE_BACKGROUND_POSITION_Y), height - actualHeight)); + getDimensionValue(cs.getProperty(StyleConstants.STYLE_BACKGROUND_POSITION_Y), + height - actualHeight)); backgroundImage.setHeight(actualHeight); backgroundImage.setWidth(actualWidth); return backgroundImage; @@ -322,9 +395,7 @@ protected BackgroundImageInfo createBackgroundImage(String url, Module module) { } /** - * support body auto resize, remove invalid header and footer - * - * @param page + * Support body auto resize, remove invalid header and footer */ protected void updateBodySize() { if (header != null && header.getHeight() >= root.getHeight()) { @@ -401,6 +472,11 @@ protected void layoutFooter() { } } + /** + * Floating footer + * + * @param page + */ public void floatingFooter(PageArea page) { ContainerArea footer = (ContainerArea) page.getFooter(); IContainerArea body = page.getBody(); @@ -555,6 +631,11 @@ public void close() throws BirtException { finished = true; } + /** + * Verify if the page is empty + * + * @return true, the page is empty + */ public boolean isPageEmpty() { if (body.getChildrenCount() > 0) { return false; @@ -562,6 +643,12 @@ public boolean isPageEmpty() { return true; } + /** + * Genereate the output page + * + * @param page + * @throws BirtException + */ public void outputPage(IPageContent page) throws BirtException { FixedLayoutPageHintGenerator gen = context.getPageHintGenerator(); if (null != gen) { @@ -578,7 +665,7 @@ private float calculatePageScale(PageArea page) { int maxHeight = context.getMaxHeight(); int prefWidth = context.getPreferenceWidth(); int prefHeight = body.getHeight(); - Iterator iter = page.getBody().getChildren(); + Iterator iter = page.getBody().getChildren(); while (iter.hasNext()) { AbstractArea area = (AbstractArea) iter.next(); prefWidth = Math.max(prefWidth, area.getAllocatedX() + area.getAllocatedWidth()); @@ -612,7 +699,7 @@ protected void updatePageDimension(PageArea page) { int maxHeight = context.getMaxHeight(); int prefWidth = context.getPreferenceWidth(); // 0 int prefHeight = page.getBody().getHeight(); - Iterator iter = page.getBody().getChildren(); + Iterator iter = page.getBody().getChildren(); while (iter.hasNext()) { AbstractArea area = (AbstractArea) iter.next(); prefWidth = Math.max(prefWidth, area.getAllocatedX() + area.getAllocatedWidth()); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RegionArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RegionArea.java index ea659b41ee6..0a6b1e20371 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RegionArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RegionArea.java @@ -19,7 +19,16 @@ import org.eclipse.birt.report.engine.ir.DimensionType; import org.eclipse.birt.report.engine.nLayout.area.IContainerArea; +/** + * Definition of region area + * + * @since 3.3 + * + */ public class RegionArea extends BlockContainerArea implements IContainerArea { + /** + * + */ public RegionArea() { super(); } @@ -48,7 +57,7 @@ protected void calculateSpecifiedHeight(IContent content) { } @Override - public void close() throws BirtException { + public void close() { if (context.isFixedLayout()) { setContentHeight(specifiedHeight); } else { diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RepeatableArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RepeatableArea.java index 298d95832a0..d9be596f9ca 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RepeatableArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RepeatableArea.java @@ -23,25 +23,44 @@ import org.eclipse.birt.report.engine.content.IContent; import org.eclipse.birt.report.engine.content.IElement; import org.eclipse.birt.report.engine.content.IRowContent; -import org.eclipse.birt.report.engine.content.IStyle; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.ir.RowDesign; import org.eclipse.birt.report.engine.nLayout.LayoutContext; +import org.eclipse.birt.report.engine.nLayout.area.IArea; +/** + * Class to define repeatable container area + * + * @since 3.3 + * + */ public abstract class RepeatableArea extends BlockContainerArea { - protected List repeatList = null; + protected List repeatList = null; protected int repeatHeight = 0; protected boolean inHeaderBand = false; + /** + * Constructor + * + * @param parent + * @param context + * @param content + */ public RepeatableArea(ContainerArea parent, LayoutContext context, IContent content) { super(parent, context, content); if (needRepeat()) { - repeatList = new ArrayList(); + repeatList = new ArrayList(); } } + /** + * Set the flag of header band + * + * @param inHeaderBand + */ public void setInHeaderBand(boolean inHeaderBand) { this.inHeaderBand = inHeaderBand; } @@ -54,7 +73,6 @@ protected boolean isFirstChildInHeaderBand() { if (isInRepeatHeader(first)) { return true; } - } return false; } @@ -97,7 +115,7 @@ protected int getRepeatedHeight() { return repeatHeight; } else if (repeatList != null) { for (int i = 0; i < repeatList.size(); i++) { - AbstractArea area = (AbstractArea) repeatList.get(i); + AbstractArea area = repeatList.get(i); repeatHeight += area.getAllocatedHeight(); } return repeatHeight; @@ -109,17 +127,17 @@ protected int getRepeatedHeight() { public SplitResult split(int height, boolean force) throws BirtException { // repeat header can not be split. if (!force && repeatList != null && repeatList.size() > 0) { - Iterator i = children.iterator(); + Iterator i = children.iterator(); boolean firstHeaderRow = true; while (i.hasNext()) { ContainerArea area = (ContainerArea) i.next(); if (isInRepeatHeader(area)) { if (firstHeaderRow) { - area.setPageBreakInside(IStyle.AVOID_VALUE); + area.setPageBreakInside(CSSValueConstants.AVOID_VALUE); firstHeaderRow = false; } else { - area.setPageBreakInside(IStyle.AVOID_VALUE); - area.setPageBreakBefore(IStyle.AVOID_VALUE); + area.setPageBreakInside(CSSValueConstants.AVOID_VALUE); + area.setPageBreakBefore(CSSValueConstants.AVOID_VALUE); } } } @@ -128,16 +146,15 @@ public SplitResult split(int height, boolean force) throws BirtException { } @Override - protected boolean isValidResult(List result) { + protected boolean isValidResult(List result) { assert result != null; if (repeatList != null && !repeatList.isEmpty()) { if (result.size() > repeatList.size()) { return true; - } else { - int index = result.indexOf(repeatList.get(repeatList.size() - 1)); - if (index != -1 && result.size() - 1 > index) { - return true; - } + } + int index = result.indexOf(repeatList.get(repeatList.size() - 1)); + if (index != -1 && result.size() - 1 > index) { + return true; } return false; } @@ -146,6 +163,11 @@ protected boolean isValidResult(List result) { protected abstract boolean needRepeat(); + /** + * Constructor + * + * @param area + */ public RepeatableArea(RepeatableArea area) { super(area); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RootArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RootArea.java index 701b0810a39..5ad05b570f9 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RootArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RootArea.java @@ -31,17 +31,35 @@ import com.ibm.icu.util.ULocale; +/** + * Definition of the root area + * + * @since 3.3 + * + */ public class RootArea extends BlockContainerArea { protected transient LayoutEmitterAdapter emitter; protected PageArea page; + /** + * Constructor context based + * + * @param context + * @param content + * @param emitter + */ public RootArea(LayoutContext context, IContent content, LayoutEmitterAdapter emitter) { super(null, context, content); this.emitter = emitter; } + /** + * Constructor based on root area + * + * @param area + */ public RootArea(RootArea area) { super(area); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RowArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RowArea.java index 25cde525d66..2c5df51162b 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RowArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/RowArea.java @@ -20,9 +20,17 @@ import org.eclipse.birt.core.exception.BirtException; import org.eclipse.birt.report.engine.content.IContent; import org.eclipse.birt.report.engine.content.IStyle; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSConstants; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.nLayout.LayoutContext; import org.eclipse.birt.report.engine.nLayout.area.IArea; +/** + * Definition of the table row area + * + * @since 3.3 + * + */ public class RowArea extends ContainerArea { protected transient CellArea[] cells; @@ -33,6 +41,13 @@ public class RowArea extends ContainerArea { protected boolean needResolveBorder = false; + /** + * Constructor + * + * @param parent + * @param context + * @param content + */ public RowArea(ContainerArea parent, LayoutContext context, IContent content) { super(parent, context, content); cells = new CellArea[getTable().getColumnCount()]; @@ -50,6 +65,11 @@ public RowArea(ContainerArea parent, LayoutContext context, IContent content) { this.cells = new CellArea[row.getColumnCount()]; } + /** + * Get the column count + * + * @return Return the column count + */ public int getColumnCount() { TableArea table = getTableArea(); if (table != null) { @@ -61,6 +81,11 @@ public int getColumnCount() { return 0; } + /** + * Set the cell object based on cell column id + * + * @param cell + */ public void setCell(CellArea cell) { int col = cell.getColumnID(); int colSpan = cell.getColSpan(); @@ -69,6 +94,12 @@ public void setCell(CellArea cell) { } } + /** + * Get the row cell based on the column id + * + * @param columnID + * @return Return the cell + */ public CellArea getCell(int columnID) { if (columnID >= 0 && columnID < cells.length) { return cells[columnID]; @@ -76,6 +107,12 @@ public CellArea getCell(int columnID) { return null; } + /** + * Replace an cell through new cell + * + * @param origin original cell (to be replaced) + * @param dest new cell (to placed) + */ public void replace(CellArea origin, CellArea dest) { int index = children.indexOf(origin); if (index >= 0) { @@ -85,10 +122,20 @@ public void replace(CellArea origin, CellArea dest) { } } + /** + * Set the row id + * + * @param rowID + */ public void setRowID(int rowID) { this.rowID = rowID; } + /** + * Get the row id + * + * @return Return row id + */ public int getRowID() { return rowID; } @@ -100,11 +147,11 @@ public RowArea cloneArea() { @Override public RowArea deepClone() { - RowArea result = (RowArea) cloneArea(); - Iterator iter = children.iterator(); + RowArea result = cloneArea(); + Iterator iter = children.iterator(); while (iter.hasNext()) { CellArea child = (CellArea) iter.next(); - CellArea cloneChild = (CellArea) child.deepClone(); + CellArea cloneChild = child.deepClone(); result.children.add(cloneChild); cloneChild.setParent(result); result.setCell(cloneChild); @@ -135,16 +182,16 @@ public void close() throws BirtException { } @Override - public void initialize() throws BirtException { + public void initialize() { calculateSpecifiedHeight(content); width = parent.getMaxAvaWidth(); - buildLogicContainerProperties(content, context); + buildLogicContainerProperties(content); parent.add(this); } protected boolean isRowEmpty() { - Iterator iter = getChildren(); + Iterator iter = getChildren(); while (iter.hasNext()) { ContainerArea area = (ContainerArea) iter.next(); if (area.getChildrenCount() > 0) { @@ -155,7 +202,7 @@ protected boolean isRowEmpty() { } @Override - public void update(AbstractArea area) throws BirtException { + public void update(AbstractArea area) { CellArea cArea = (CellArea) area; int columnID = cArea.getColumnID(); // Retrieve direction from the top-level content. @@ -191,6 +238,11 @@ public void addChild(IArea area) { this.setCell((CellArea) area); } + /** + * Add cell area to row based on column id + * + * @param cell + */ public void addChildByColumnId(CellArea cell) { int columnId = cell.getColumnID(); int index = 0; @@ -214,14 +266,12 @@ public SplitResult split(int height, boolean force) throws BirtException { } else if (isPageBreakInsideAvoid()) { if (isPageBreakBeforeAvoid()) { return SplitResult.BEFORE_AVOID_WITH_NULL; - } else { - _splitSpanCell(height, force); - needResolveBorder = true; - return SplitResult.SUCCEED_WITH_NULL; } - } else { - return _split(height, force); + _splitSpanCell(height, force); + needResolveBorder = true; + return SplitResult.SUCCEED_WITH_NULL; } + return _split(height, force); } protected void _splitSpanCell(int height, boolean force) throws BirtException { @@ -245,7 +295,7 @@ protected void _splitSpanCell(int height, boolean force) throws BirtException { CellArea cell = (CellArea) splitCell.getResult(); if (cell != null) { CellArea oc = ((DummyCell) cells[i]).getCell(); - ArrayList temp = cell.children; + ArrayList temp = cell.children; cell.children = oc.children; oc.children = temp; oc.updateChildrenPosition(); @@ -290,7 +340,7 @@ protected SplitResult _split(int height, boolean force) throws BirtException { CellArea cell = (CellArea) splitCell.getResult(); if (cell != null) { CellArea oc = ((DummyCell) cells[i]).getCell(); - ArrayList temp = cell.children; + ArrayList temp = cell.children; cell.children = oc.children; oc.children = temp; oc.updateChildrenPosition(); @@ -330,11 +380,10 @@ protected SplitResult _split(int height, boolean force) throws BirtException { updateRow(); needResolveBorder = true; return new SplitResult(result, SplitResult.SPLIT_SUCCEED_WITH_PART); - } else { - updateRow(); - needResolveBorder = true; - return SplitResult.SUCCEED_WITH_NULL; } + updateRow(); + needResolveBorder = true; + return SplitResult.SUCCEED_WITH_NULL; } protected void updateRow() { @@ -351,9 +400,14 @@ protected void updateRow() { } } + /** + * Update the row + * + * @param original row to be updated + */ public void updateRow(RowArea original) { int height = 0; - Iterator iter = children.iterator(); + Iterator iter = children.iterator(); while (iter.hasNext()) { CellArea cell = (CellArea) iter.next(); height = Math.max(height, cell.getHeight()); @@ -379,25 +433,24 @@ public void updateRow(RowArea original) { public boolean isPageBreakInsideAvoid() { if (getTableArea().isGridDesign()) { return super.isPageBreakInsideAvoid(); - } else { - // resolve 289645. Repeated row area may be set as page-break-inside: avoid. - if (IStyle.AVOID_VALUE == pageBreakInside) { - return true; - } - if (content != null) { - IStyle style = content.getStyle(); - String pb = style.getPageBreakInside(); - // auto value is set - if (IStyle.CSS_AUTO_VALUE.equals(pb)) { - return false; - } - } + } + // resolve 289645. Repeated row area may be set as page-break-inside: avoid. + if (CSSValueConstants.AVOID_VALUE == pageBreakInside) { return true; } + if (content != null) { + IStyle style = content.getStyle(); + String pb = style.getPageBreakInside(); + // auto value is set + if (CSSConstants.CSS_AUTO_VALUE.equals(pb)) { + return false; + } + } + return true; } @Override - public SplitResult splitLines(int lineCount) throws BirtException { + public SplitResult splitLines(int lineCount) { if (isPageBreakBeforeAvoid()) { return SplitResult.BEFORE_AVOID_WITH_NULL; } @@ -405,7 +458,7 @@ public SplitResult splitLines(int lineCount) throws BirtException { } @Override - public void updateChildrenPosition() throws BirtException { + public void updateChildrenPosition() { } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TableArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TableArea.java index ddf3471d42f..aae6b9656aa 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TableArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TableArea.java @@ -34,9 +34,9 @@ import org.eclipse.birt.report.engine.content.impl.ReportContent; import org.eclipse.birt.report.engine.css.dom.StyleDeclaration; import org.eclipse.birt.report.engine.css.engine.StyleConstants; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.executor.ExecutionContext; import org.eclipse.birt.report.engine.ir.DimensionType; -import org.eclipse.birt.report.engine.ir.EngineIRConstants; import org.eclipse.birt.report.engine.ir.GridItemDesign; import org.eclipse.birt.report.engine.layout.LayoutUtil; import org.eclipse.birt.report.engine.layout.pdf.util.PropertyUtil; @@ -46,7 +46,14 @@ import org.eclipse.birt.report.engine.nLayout.area.style.BoxStyle; import org.eclipse.birt.report.engine.presentation.UnresolvedRowHint; import org.eclipse.birt.report.engine.util.ResourceLocatorWrapper; +import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; +/** + * Definition of the table area + * + * @since 3.3 + * + */ public class TableArea extends RepeatableArea { protected transient TableLayoutInfo layoutInfo; @@ -58,6 +65,13 @@ public class TableArea extends RepeatableArea { protected int startCol; protected int endCol; + /** + * Constructor container based + * + * @param parent + * @param context + * @param content + */ public TableArea(ContainerArea parent, LayoutContext context, IContent content) { super(parent, context, content); } @@ -68,16 +82,32 @@ public TableArea(ContainerArea parent, LayoutContext context, IContent content) layoutInfo = table.layoutInfo; } + /** + * Verify if the row exists at the table + * + * @param row + * @return true, row exists + */ public boolean contains(RowArea row) { return children.contains(row); } + /** + * Add row to the table + * + * @param row new row + */ public void addRow(RowArea row) { if (layout != null) { layout.addRow(row, context.isFixedLayout()); } } + /** + * Get column count + * + * @return Return column count + */ public int getColumnCount() { if (content != null) { return ((ITableContent) content).getColumnCount(); @@ -99,6 +129,12 @@ public TableArea cloneArea() { return new TableArea(this); } + /** + * Get the position X from the layout based on column id + * + * @param columnID + * @return Return the position X from the layout + */ public int getXPos(int columnID) { if (layoutInfo != null) { return layoutInfo.getXPosition(columnID); @@ -106,6 +142,11 @@ public int getXPos(int columnID) { return 0; } + /** + * Verify if the table use grid design (without data) + * + * @return true, table is grid design + */ public boolean isGridDesign() { if (content != null) { Object gen = content.getGenerateBy(); @@ -120,7 +161,7 @@ protected void buildProperties(IContent content, LayoutContext context) { if (style != null && !style.isEmpty()) { boxStyle = new BoxStyle(); IStyle cs = content.getComputedStyle(); - Color color = PropertyUtil.getColor(cs.getProperty(IStyle.STYLE_BACKGROUND_COLOR)); + Color color = PropertyUtil.getColor(cs.getProperty(StyleConstants.STYLE_BACKGROUND_COLOR)); if (color != null) { boxStyle.setBackgroundColor(color); @@ -134,20 +175,21 @@ protected void buildProperties(IContent content, LayoutContext context) { rl = exeContext.getResourceLocator(); } BackgroundImageInfo backgroundImage = new BackgroundImageInfo(getImageUrl(url), - style.getProperty(IStyle.STYLE_BACKGROUND_REPEAT), 0, 0, 0, 0, rl); + style.getProperty(StyleConstants.STYLE_BACKGROUND_REPEAT), 0, 0, 0, 0, rl, + this.getCurrentModule(), style.getProperty(StyleConstants.STYLE_BACKGROUND_IMAGE_TYPE)); boxStyle.setBackgroundImage(backgroundImage); } localProperties = new LocalProperties(); int maw = parent.getMaxAvaWidth(); - localProperties.setMarginBottom(getDimensionValue(cs.getProperty(IStyle.STYLE_MARGIN_BOTTOM), maw)); - localProperties.setMarginLeft(getDimensionValue(cs.getProperty(IStyle.STYLE_MARGIN_LEFT), maw)); - localProperties.setMarginTop(getDimensionValue(cs.getProperty(IStyle.STYLE_MARGIN_TOP), maw)); - localProperties.setMarginRight(getDimensionValue(cs.getProperty(IStyle.STYLE_MARGIN_RIGHT), maw)); + localProperties.setMarginBottom(getDimensionValue(cs.getProperty(StyleConstants.STYLE_MARGIN_BOTTOM), maw)); + localProperties.setMarginLeft(getDimensionValue(cs.getProperty(StyleConstants.STYLE_MARGIN_LEFT), maw)); + localProperties.setMarginTop(getDimensionValue(cs.getProperty(StyleConstants.STYLE_MARGIN_TOP), maw)); + localProperties.setMarginRight(getDimensionValue(cs.getProperty(StyleConstants.STYLE_MARGIN_RIGHT), maw)); if (!isInlineStacking) { - pageBreakAfter = cs.getProperty(IStyle.STYLE_PAGE_BREAK_AFTER); - pageBreakInside = cs.getProperty(IStyle.STYLE_PAGE_BREAK_INSIDE); - pageBreakBefore = cs.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE); + pageBreakAfter = cs.getProperty(StyleConstants.STYLE_PAGE_BREAK_AFTER); + pageBreakInside = cs.getProperty(StyleConstants.STYLE_PAGE_BREAK_INSIDE); + pageBreakBefore = cs.getProperty(StyleConstants.STYLE_PAGE_BREAK_BEFORE); } } else { hasStyle = false; @@ -189,16 +231,16 @@ protected void addCaption(String caption) throws BirtException { cell.setColSpan(getColumnCount()); cell.setColumn(0); StyleDeclaration cstyle = new StyleDeclaration(report.getCSSEngine()); - cstyle.setProperty(IStyle.STYLE_BORDER_TOP_STYLE, IStyle.HIDDEN_VALUE); - cstyle.setProperty(IStyle.STYLE_BORDER_LEFT_STYLE, IStyle.HIDDEN_VALUE); - cstyle.setProperty(IStyle.STYLE_BORDER_RIGHT_STYLE, IStyle.HIDDEN_VALUE); + cstyle.setProperty(StyleConstants.STYLE_BORDER_TOP_STYLE, CSSValueConstants.HIDDEN_VALUE); + cstyle.setProperty(StyleConstants.STYLE_BORDER_LEFT_STYLE, CSSValueConstants.HIDDEN_VALUE); + cstyle.setProperty(StyleConstants.STYLE_BORDER_RIGHT_STYLE, CSSValueConstants.HIDDEN_VALUE); cell.setInlineStyle(cstyle); cell.setParent(row); ILabelContent captionLabel = report.createLabelContent(); captionLabel.setParent(cell); captionLabel.setText(caption); StyleDeclaration style = new StyleDeclaration(report.getCSSEngine()); - style.setProperty(IStyle.STYLE_TEXT_ALIGN, IStyle.CENTER_VALUE); + style.setProperty(StyleConstants.STYLE_TEXT_ALIGN, CSSValueConstants.CENTER_VALUE); captionLabel.setInlineStyle(style); RowArea captionRow = new RowArea(this, context, row); captionRow.isDummy = true; @@ -221,7 +263,7 @@ protected void addCaption(String caption) throws BirtException { captionRow.finished = true; add(captionRow); if (repeatList == null) { - repeatList = new ArrayList(); + repeatList = new ArrayList(); } repeatList.add(captionRow); update(captionRow); @@ -335,6 +377,9 @@ protected RowArea getLastRow() { return getLastRow(this); } + /** + * Resolve the bottom border of the table + */ public void resolveBottomBorder() { RowArea lastRow = getLastRow(); if (lastRow != null) { @@ -385,6 +430,11 @@ protected void setUnresolvedRow() { } } + /** + * Relayout the children of the table area + * + * @throws BirtException + */ public void relayoutChildren() throws BirtException { String nextRowId = null; if (unresolvedRow != null) { @@ -548,6 +598,13 @@ public void close() throws BirtException { checkDisplayNone(); } + /** + * Get the cell width + * + * @param startColumn + * @param endColumn + * @return Return the cell width + */ public int getCellWidth(int startColumn, int endColumn) { if (layoutInfo != null) { return layoutInfo.getCellWidth(startColumn, endColumn); @@ -555,6 +612,12 @@ public int getCellWidth(int startColumn, int endColumn) { return 0; } + /** + * Resolve the border conflict + * + * @param cellArea + * @param isFirst + */ public void resolveBorderConflict(CellArea cellArea, boolean isFirst) { if (layout != null) { layout.resolveBorderConflict(cellArea, isFirst); @@ -611,20 +674,20 @@ public ColumnWidthResolver(ITableContent table) { * @return each column width in point. */ protected int[] formalize(DimensionType[] columns, int tableWidth, boolean isTableWidthDefined) { - ArrayList percentageList = new ArrayList(); - ArrayList unsetList = new ArrayList(); - ArrayList preFixedList = new ArrayList(); + ArrayList percentageList = new ArrayList(); + ArrayList unsetList = new ArrayList(); + ArrayList preFixedList = new ArrayList(); int[] resolvedColumnWidth = new int[columns.length]; double total = 0.0f; int fixedLength = 0; for (int i = 0; i < columns.length; i++) { if (columns[i] == null) { unsetList.add(Integer.valueOf(i)); - } else if (EngineIRConstants.UNITS_PERCENTAGE.equals(columns[i].getUnits())) { + } else if (DesignChoiceConstants.UNITS_PERCENTAGE.equals(columns[i].getUnits())) { percentageList.add(Integer.valueOf(i)); total += columns[i].getMeasure(); - } else if (EngineIRConstants.UNITS_EM.equals(columns[i].getUnits()) - || EngineIRConstants.UNITS_EX.equals(columns[i].getUnits())) { + } else if (DesignChoiceConstants.UNITS_EM.equals(columns[i].getUnits()) + || DesignChoiceConstants.UNITS_EX.equals(columns[i].getUnits())) { int len = getDimensionValue(table, columns[i], getDimensionValue(table.getComputedStyle().getProperty(StyleConstants.STYLE_FONT_SIZE))); resolvedColumnWidth[i] = len; @@ -644,11 +707,11 @@ protected int[] formalize(DimensionType[] columns, int tableWidth, boolean isTab if (fixedLength >= tableWidth) { for (int i = 0; i < unsetList.size(); i++) { - Integer index = (Integer) unsetList.get(i); + Integer index = unsetList.get(i); resolvedColumnWidth[index.intValue()] = 0; } for (int i = 0; i < percentageList.size(); i++) { - Integer index = (Integer) percentageList.get(i); + Integer index = percentageList.get(i); resolvedColumnWidth[index.intValue()] = 0; } return resolvedColumnWidth; @@ -660,7 +723,7 @@ protected int[] formalize(DimensionType[] columns, int tableWidth, boolean isTab if (!preFixedList.isEmpty()) { int delta = left / preFixedList.size(); for (int i = 0; i < preFixedList.size(); i++) { - Integer index = (Integer) preFixedList.get(i); + Integer index = preFixedList.get(i); resolvedColumnWidth[index.intValue()] += delta; } } @@ -668,7 +731,7 @@ protected int[] formalize(DimensionType[] columns, int tableWidth, boolean isTab float leftPercentage = (((float) (tableWidth - fixedLength)) / tableWidth) * 100.0f; double ratio = leftPercentage / total; for (int i = 0; i < percentageList.size(); i++) { - Integer index = (Integer) percentageList.get(i); + Integer index = percentageList.get(i); columns[index.intValue()] = new DimensionType(columns[index.intValue()].getMeasure() * ratio, columns[index.intValue()].getUnits()); resolvedColumnWidth[index.intValue()] = getDimensionValue(table, columns[index.intValue()], @@ -679,7 +742,7 @@ protected int[] formalize(DimensionType[] columns, int tableWidth, boolean isTab int left = tableWidth - fixedLength; int eachWidth = left / unsetList.size(); for (int i = 0; i < unsetList.size(); i++) { - Integer index = (Integer) unsetList.get(i); + Integer index = unsetList.get(i); resolvedColumnWidth[index.intValue()] = eachWidth; } } else { @@ -687,11 +750,11 @@ protected int[] formalize(DimensionType[] columns, int tableWidth, boolean isTab if (leftPercentage <= total) { double ratio = leftPercentage / total; for (int i = 0; i < unsetList.size(); i++) { - Integer index = (Integer) unsetList.get(i); + Integer index = unsetList.get(i); resolvedColumnWidth[index.intValue()] = 0; } for (int i = 0; i < percentageList.size(); i++) { - Integer index = (Integer) percentageList.get(i); + Integer index = percentageList.get(i); columns[index.intValue()] = new DimensionType(columns[index.intValue()].getMeasure() * ratio, columns[index.intValue()].getUnits()); resolvedColumnWidth[index.intValue()] = getDimensionValue(table, columns[index.intValue()], @@ -700,7 +763,7 @@ protected int[] formalize(DimensionType[] columns, int tableWidth, boolean isTab } else { int usedLength = fixedLength; for (int i = 0; i < percentageList.size(); i++) { - Integer index = (Integer) percentageList.get(i); + Integer index = percentageList.get(i); int width = getDimensionValue(table, columns[index.intValue()], tableWidth); usedLength += width; resolvedColumnWidth[index.intValue()] = width; @@ -709,7 +772,7 @@ protected int[] formalize(DimensionType[] columns, int tableWidth, boolean isTab int left = tableWidth - usedLength; int eachWidth = left / unsetList.size(); for (int i = 0; i < unsetList.size(); i++) { - Integer index = (Integer) unsetList.get(i); + Integer index = unsetList.get(i); resolvedColumnWidth[index.intValue()] = eachWidth; } } @@ -756,32 +819,26 @@ public int[] resolveFixedLayout(int maxWidth) { return formalize(columns, tableWidth, isTableWidthDefined); } - private void redistributeWidth(int cols[], int delta, int sum, int currentSum) { - int avaWidth = sum / cols.length; - for (int i = 0; i < cols.length; i++) { - if (cols[i] < 0) { - cols[i] = avaWidth; - } else { - cols[i] -= (int) (((float) cols[i]) * delta / currentSum); - } - } - - } - - private void distributeLeftWidth(int cols[], int avaWidth) { - for (int i = 0; i < cols.length; i++) { - if (cols[i] < 0) { - cols[i] = avaWidth; - } - } - } } + /** + * Definition of table layout info + * + * @since 3.3 + * + */ public static class TableLayoutInfo { ITableContent tableContent; LayoutContext context; + /** + * Constructor + * + * @param tableContent + * @param context + * @param colWidth + */ public TableLayoutInfo(ITableContent tableContent, LayoutContext context, int[] colWidth) { this.tableContent = tableContent; this.context = context; @@ -796,20 +853,31 @@ public TableLayoutInfo(ITableContent tableContent, LayoutContext context, int[] } } + /** + * Get the table width + * + * @return Return the table width + */ public int getTableWidth() { return this.tableWidth; } + /** + * Get the position X + * + * @param index + * @return Return the position X + */ public int getXPosition(int index) { return xPositions[index]; } /** - * get cell width + * Get cell width * * @param startColumn * @param endColumn - * @return + * @return Return the cell width */ public int getCellWidth(int startColumn, int endColumn) { assert (startColumn < endColumn); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TextLineArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TextLineArea.java index a0ae9bfc457..8cf70c197b9 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TextLineArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/TextLineArea.java @@ -13,18 +13,34 @@ ***********************************************************************/ package org.eclipse.birt.report.engine.nLayout.area.impl; -import org.eclipse.birt.core.exception.BirtException; -import org.eclipse.birt.report.engine.content.IStyle; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.nLayout.LayoutContext; +/** + * Definition of text line area + * + * @since 3.3 + * + */ public class TextLineArea extends LineArea { + /** + * Constructor container based + * + * @param parent + * @param context + */ public TextLineArea(ContainerArea parent, LayoutContext context) { super(parent, context); // support widow and orphans, do not auto-pagebreak in textlineArea isInInlineStacking = true; } + /** + * Constructor area based + * + * @param area + */ public TextLineArea(TextLineArea area) { super(area); } @@ -35,15 +51,15 @@ public TextLineArea cloneArea() { } @Override - public SplitResult splitLines(int lineCount) throws BirtException { - if (pageBreakBefore == IStyle.AVOID_VALUE) { + public SplitResult splitLines(int lineCount) { + if (pageBreakBefore == CSSValueConstants.AVOID_VALUE) { return SplitResult.BEFORE_AVOID_WITH_NULL; } return SplitResult.SUCCEED_WITH_NULL; } @Override - public SplitResult split(int height, boolean force) throws BirtException { + public SplitResult split(int height, boolean force) { if (force) { TextLineArea newArea = cloneArea(); newArea.children.addAll(children); @@ -51,7 +67,7 @@ public SplitResult split(int height, boolean force) throws BirtException { this.height = 0; return new SplitResult(newArea, SplitResult.SPLIT_SUCCEED_WITH_PART); } - if (pageBreakBefore == IStyle.AVOID_VALUE) { + if (pageBreakBefore == CSSValueConstants.AVOID_VALUE) { return SplitResult.BEFORE_AVOID_WITH_NULL; } return SplitResult.SUCCEED_WITH_NULL; diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/AreaConstants.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/AreaConstants.java index 91f120e99f9..707b117980a 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/AreaConstants.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/AreaConstants.java @@ -14,30 +14,68 @@ import java.util.HashMap; -import org.eclipse.birt.report.engine.content.IStyle; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSConstants; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.w3c.dom.css.CSSValue; +/** + * Definition of area constants + * + * @since 3.3 + * + */ public abstract class AreaConstants { + + /** + * repeat background image "none" + */ public final static int NO_REPEAT = 0; + + /** + * repeat background image "horizontal" + */ public final static int REPEAT_X = 1; + + /** + * repeat background image "vertical" + */ public final static int REPEAT_Y = 2; + + /** + * repeat background image "horizontal" & "vertical" + */ public final static int REPEAT = 3; - public final static String URL = "url"; - public final static String EMBED = "embed"; + /** + * source type of background images "URL" + */ + public final static String BGI_SRC_TYPE_URL = "url"; + + /** + * source type of background images "EMBED" + */ + public final static String BGI_SRC_TYPE_EMBED = "embed"; + + /** + * mapping list of repeat values + */ public static HashMap repeatMap = new HashMap<>(); + + /** + * mapping list of bgi source type values + */ public static HashMap bgiSourceTypeMap = new HashMap<>(); static { - repeatMap.put(IStyle.NO_REPEAT_VALUE, NO_REPEAT); - repeatMap.put(IStyle.REPEAT_X_VALUE, REPEAT_X); - repeatMap.put(IStyle.REPEAT_Y_VALUE, REPEAT_Y); - repeatMap.put(IStyle.REPEAT_VALUE, REPEAT); + repeatMap.put(CSSValueConstants.NO_REPEAT_VALUE, NO_REPEAT); + repeatMap.put(CSSValueConstants.REPEAT_X_VALUE, REPEAT_X); + repeatMap.put(CSSValueConstants.REPEAT_Y_VALUE, REPEAT_Y); + repeatMap.put(CSSValueConstants.REPEAT_VALUE, REPEAT); } static { - bgiSourceTypeMap.put(IStyle.URL_VALUE, URL); - bgiSourceTypeMap.put(IStyle.EMBED_VALUE, EMBED); + bgiSourceTypeMap.put(CSSValueConstants.URL_VALUE, BGI_SRC_TYPE_URL); + bgiSourceTypeMap.put(CSSValueConstants.EMBED_VALUE, BGI_SRC_TYPE_EMBED); } /** @@ -83,37 +121,49 @@ public abstract class AreaConstants { */ public final static int BORDER_STYLE_HIDDEN = 29; + /** + * Mapping from CCS value to area constants + */ public static HashMap valueStyleMap = new HashMap<>(); static { - valueStyleMap.put(IStyle.DOTTED_VALUE, BORDER_STYLE_DOTTED); - valueStyleMap.put(IStyle.SOLID_VALUE, BORDER_STYLE_SOLID); - valueStyleMap.put(IStyle.DASHED_VALUE, BORDER_STYLE_DASHED); - valueStyleMap.put(IStyle.DOUBLE_VALUE, BORDER_STYLE_DOUBLE); - valueStyleMap.put(IStyle.GROOVE_VALUE, BORDER_STYLE_GROOVE); - valueStyleMap.put(IStyle.RIDGE_VALUE, BORDER_STYLE_RIDGE); - valueStyleMap.put(IStyle.INSET_VALUE, BORDER_STYLE_INSET); - valueStyleMap.put(IStyle.OUTSET_VALUE, BORDER_STYLE_OUTSET); - valueStyleMap.put(IStyle.NONE_VALUE, BORDER_STYLE_NONE); - valueStyleMap.put(IStyle.HIDDEN_VALUE, BORDER_STYLE_HIDDEN); + valueStyleMap.put(CSSValueConstants.DOTTED_VALUE, AreaConstants.BORDER_STYLE_DOTTED); + valueStyleMap.put(CSSValueConstants.SOLID_VALUE, AreaConstants.BORDER_STYLE_SOLID); + valueStyleMap.put(CSSValueConstants.DASHED_VALUE, AreaConstants.BORDER_STYLE_DASHED); + valueStyleMap.put(CSSValueConstants.DOUBLE_VALUE, AreaConstants.BORDER_STYLE_DOUBLE); + valueStyleMap.put(CSSValueConstants.GROOVE_VALUE, AreaConstants.BORDER_STYLE_GROOVE); + valueStyleMap.put(CSSValueConstants.RIDGE_VALUE, AreaConstants.BORDER_STYLE_RIDGE); + valueStyleMap.put(CSSValueConstants.INSET_VALUE, AreaConstants.BORDER_STYLE_INSET); + valueStyleMap.put(CSSValueConstants.OUTSET_VALUE, AreaConstants.BORDER_STYLE_OUTSET); + valueStyleMap.put(CSSValueConstants.NONE_VALUE, AreaConstants.BORDER_STYLE_NONE); + valueStyleMap.put(CSSValueConstants.HIDDEN_VALUE, AreaConstants.BORDER_STYLE_HIDDEN); } + /** + * Mapping from CCS style to area constants + */ public static HashMap stringStyleMap = new HashMap<>(); static { - stringStyleMap.put(IStyle.CSS_DOTTED_VALUE, BORDER_STYLE_DOTTED); - stringStyleMap.put(IStyle.CSS_SOLID_VALUE, BORDER_STYLE_SOLID); - stringStyleMap.put(IStyle.CSS_DASHED_VALUE, BORDER_STYLE_DASHED); - stringStyleMap.put(IStyle.CSS_DOUBLE_VALUE, BORDER_STYLE_DOUBLE); - stringStyleMap.put(IStyle.CSS_GROOVE_VALUE, BORDER_STYLE_GROOVE); - stringStyleMap.put(IStyle.CSS_RIDGE_VALUE, BORDER_STYLE_RIDGE); - stringStyleMap.put(IStyle.CSS_INSET_VALUE, BORDER_STYLE_INSET); - stringStyleMap.put(IStyle.CSS_OUTSET_VALUE, BORDER_STYLE_OUTSET); - stringStyleMap.put(IStyle.CSS_NONE_VALUE, BORDER_STYLE_NONE); - stringStyleMap.put(IStyle.CSS_HIDDEN_VALUE, BORDER_STYLE_HIDDEN); - + stringStyleMap.put(CSSConstants.CSS_DOTTED_VALUE, AreaConstants.BORDER_STYLE_DOTTED); + stringStyleMap.put(CSSConstants.CSS_SOLID_VALUE, AreaConstants.BORDER_STYLE_SOLID); + stringStyleMap.put(CSSConstants.CSS_DASHED_VALUE, AreaConstants.BORDER_STYLE_DASHED); + stringStyleMap.put(CSSConstants.CSS_DOUBLE_VALUE, AreaConstants.BORDER_STYLE_DOUBLE); + stringStyleMap.put(CSSConstants.CSS_GROOVE_VALUE, AreaConstants.BORDER_STYLE_GROOVE); + stringStyleMap.put(CSSConstants.CSS_RIDGE_VALUE, AreaConstants.BORDER_STYLE_RIDGE); + stringStyleMap.put(CSSConstants.CSS_INSET_VALUE, AreaConstants.BORDER_STYLE_INSET); + stringStyleMap.put(CSSConstants.CSS_OUTSET_VALUE, AreaConstants.BORDER_STYLE_OUTSET); + stringStyleMap.put(CSSConstants.CSS_NONE_VALUE, AreaConstants.BORDER_STYLE_NONE); + stringStyleMap.put(CSSConstants.CSS_HIDDEN_VALUE, AreaConstants.BORDER_STYLE_HIDDEN); } + /** + * The value of direction left-to-right "LTR" + */ public final static int DIRECTION_LTR = 40; + + /** + * The value of direction right-to-left "RTL" + */ public final static int DIRECTION_RTL = 41; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java index 644aa18849c..c96a71240ab 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java @@ -24,7 +24,6 @@ import java.util.Base64.Decoder; import java.util.Base64.Encoder; -import org.eclipse.birt.report.engine.content.IStyle; import org.eclipse.birt.report.engine.util.ResourceLocatorWrapper; import org.eclipse.birt.report.engine.util.SvgFile; import org.eclipse.birt.report.model.api.elements.structures.EmbeddedImage; @@ -58,16 +57,14 @@ public class BackgroundImageInfo extends AreaConstants { private final static String DATA_PROTOCOL = "data:"; + private final static String DATA_URL_BASE64 = ";base64,"; + // mapping based on image extension: to MIME-type to default extension private final static String[][] SUPPORTED_MIME_TYPES = { { ".jpg", "image/jpeg", "jpg" }, { ".jpe", "image/jpeg", "jpg" }, { ".jpeg", "image/jpeg", "jpg" }, { ".tiff", "image/tiff", "tiff" }, { ".svg", "image/svg+xml", "svg" }, { ".png", "image/png", "png" }, { ".gif", "image/gif", "gif" } }; - /** - * Roter Punkt - */ - protected final static String BGI_SOURCE_TYPE_DEFAULT = "url"; + + protected final static String BGI_SRC_TYPE_DEFAULT = BGI_SRC_TYPE_URL; private Module module = null; @@ -85,35 +82,6 @@ public class BackgroundImageInfo extends AreaConstants { * @param height * @param width * @param rl - * @param sourceType - */ - public BackgroundImageInfo(String url, int repeatedMode, int xOffset, int yOffset, int height, int width, - ResourceLocatorWrapper rl, String sourceType) { - this.xOffset = xOffset; - this.yOffset = yOffset; - this.repeatedMode = repeatedMode; - this.width = width; - this.height = height; - this.url = url; - this.rl = rl; - if (sourceType != null) { - this.sourceType = sourceType; - } else { - this.sourceType = BGI_SOURCE_TYPE_DEFAULT; - } - prepareImageByteArray(); - } - - /** - * constructor 02 of background image - * - * @param url - * @param repeatedMode - * @param xOffset - * @param yOffset - * @param height - * @param width - * @param rl * @param module * @param sourceType */ @@ -130,17 +98,13 @@ public BackgroundImageInfo(String url, int repeatedMode, int xOffset, int yOffse if (sourceType != null) { this.sourceType = sourceType; } else { - this.sourceType = BGI_SOURCE_TYPE_DEFAULT; + this.sourceType = BGI_SRC_TYPE_DEFAULT; } prepareImageByteArray(); - /* - * this.imageData = imageData; try { this.image = Image.getInstance(imageData); - * } catch (Exception e) { prepareImageByteArray(); } - */ } /** - * constructor 03 of background image + * constructor 02 of background image * * @param bgi */ @@ -157,41 +121,12 @@ public BackgroundImageInfo(BackgroundImageInfo bgi) { if (bgi.sourceType != null) { this.sourceType = bgi.sourceType; } else { - this.sourceType = BGI_SOURCE_TYPE_DEFAULT; + this.sourceType = BGI_SRC_TYPE_DEFAULT; } } /** - * constructor 04 of background image - * - * @param url - * @param mode - * @param xOffset - * @param yOffset - * @param height - * @param width - * @param rl - */ - public BackgroundImageInfo(String url, CSSValue mode, int xOffset, int yOffset, int height, int width, - ResourceLocatorWrapper rl) { - this(url, mode != null ? repeatMap.get(mode) : REPEAT, xOffset, yOffset, height, width, rl, - BGI_SOURCE_TYPE_DEFAULT); - } - - /** - * constructor 05 of background image - * - * @param url - * @param height - * @param width - * @param rl - */ - public BackgroundImageInfo(String url, int height, int width, ResourceLocatorWrapper rl) { - this(url, 0, 0, 0, height, width, rl, BGI_SOURCE_TYPE_DEFAULT); - } - - /** - * constructor 06 of background image + * constructor 03 of background image * * @param url * @param mode @@ -205,28 +140,11 @@ public BackgroundImageInfo(String url, int height, int width, ResourceLocatorWra public BackgroundImageInfo(String url, CSSValue mode, int xOffset, int yOffset, int height, int width, ResourceLocatorWrapper rl, Module module) { this(url, mode != null ? repeatMap.get(mode) : REPEAT, xOffset, yOffset, height, width, rl, module, - BGI_SOURCE_TYPE_DEFAULT); + BGI_SRC_TYPE_DEFAULT); } /** - * constructor 07 of background image - * - * @param url - * @param mode - * @param xOffset - * @param yOffset - * @param height - * @param width - * @param rl - * @param sourceType - */ - public BackgroundImageInfo(String url, CSSValue mode, int xOffset, int yOffset, int height, int width, - ResourceLocatorWrapper rl, String sourceType) { - this(url, mode != null ? repeatMap.get(mode) : REPEAT, xOffset, yOffset, height, width, rl, sourceType); - } - - /** - * constructor 08 of background image + * constructor 04 of background image * * @param url * @param mode @@ -241,7 +159,8 @@ public BackgroundImageInfo(String url, CSSValue mode, int xOffset, int yOffset, public BackgroundImageInfo(String url, CSSValue mode, int xOffset, int yOffset, int height, int width, ResourceLocatorWrapper rl, Module module, CSSValue sourceType) { this(url, mode != null ? repeatMap.get(mode) : REPEAT, xOffset, yOffset, height, width, rl, module, - sourceType.toString()); + sourceType != null ? bgiSourceTypeMap.get(sourceType) + : BGI_SRC_TYPE_URL); } /** @@ -253,6 +172,9 @@ public void setResourceLocator(ResourceLocatorWrapper rl) { this.rl = rl; } + /** + * Create the data URL of the image + */ private void createDataUrl() { if (this.url != null && this.url.contains(DATA_PROTOCOL)) { @@ -260,29 +182,39 @@ private void createDataUrl() { } else if (this.imageData != null) { Encoder encoder = java.util.Base64.getEncoder(); - this.dataUrl = DATA_PROTOCOL + this.mimeType + ";base64," + this.dataUrl = DATA_PROTOCOL + this.mimeType + DATA_URL_BASE64 + (new String(encoder.encode(this.imageData), StandardCharsets.UTF_8)); } } /** - * Get the data url of the image + * Get the data URL of the image * - * @return Return the data url of the image + * @return Return the data URL of the image */ public String getDataUrl() { return this.dataUrl; } + /** + * Set the image mime type + * + * @param mimeType + */ private void setMimeType(String mimeType) { if (mimeType != null) { this.mimeType = mimeType; } else if (this.url.contains(DATA_PROTOCOL)) { - String partMimeType = url.split(";")[1]; - this.mimeType = partMimeType.split(DATA_PROTOCOL)[0]; - + try { + if (url.contains(";") && url.contains(DATA_PROTOCOL)) { + String partMimeType = url.split(";")[1]; + this.mimeType = partMimeType.split(DATA_PROTOCOL)[0]; + } + } catch (IndexOutOfBoundsException ioobe) { + this.mimeType = null; + } } else { for (int index = 0; index < SUPPORTED_MIME_TYPES.length; index++) { if (this.url.toLowerCase().contains(SUPPORTED_MIME_TYPES[index][0])) { @@ -294,70 +226,91 @@ private void setMimeType(String mimeType) { } } + /** + * Create the image byte data of the image + */ private void prepareImageByteArray() { String mimeType = null; - // get embedded image on report level - if (this.sourceType.equals(IStyle.EMBED_VALUE.getCssText()) && !this.url.contains(DATA_PROTOCOL)) { + // get image URL based or from data-URL + if (this.sourceType.equals(BGI_SRC_TYPE_URL)) { + + if (this.url.contains(DATA_PROTOCOL)) { + String[] imageDataArray = this.url.split(DATA_URL_BASE64); + if (imageDataArray.length == 2 && this.url.contains(DATA_PROTOCOL)) { + try { + String imageDataBase64 = imageDataArray[1]; + Decoder decoder = java.util.Base64.getDecoder(); + this.imageData = decoder.decode(imageDataBase64); + this.mimeType = imageDataArray[0].split(DATA_PROTOCOL)[1]; + } catch (IndexOutOfBoundsException ioobe) { + this.imageData = null; + this.image = null; + this.mimeType = null; + } + } else { + this.imageData = null; + this.image = null; + this.mimeType = null; + } + } else { + if (this.rl == null) { + InputStream in = null; + try { + in = new URL(this.url).openStream(); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int size = in.read(buffer); + while (size != -1) { + out.write(buffer, 0, size); + size = in.read(buffer); + } + this.imageData = out.toByteArray(); + out.close(); + } catch (IOException ioe) { + this.imageData = null; + this.image = null; + this.mimeType = null; + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException e) { + } + } + } + } else { + try { + this.imageData = this.rl.findResource(new URL(this.url)); + } catch (MalformedURLException mue) { + this.imageData = null; + this.image = null; + this.mimeType = null; + } + } + } + } + + // get embedded image from report + if (this.sourceType.equals(BGI_SRC_TYPE_EMBED) || this.imageData == null) { StructureDefn defn = (StructureDefn) MetaDataDictionary.getInstance() .getStructure(EmbeddedImage.EMBEDDED_IMAGE_STRUCT); + byte[] imageData = null; try { EmbeddedImage ei = (EmbeddedImage) StructureRefUtil.findStructure(this.module, defn, this.url); imageData = ei.getData(this.module); mimeType = ei.getType(this.module); + if (this.sourceType.equals(BGI_SRC_TYPE_URL)) + this.sourceType = BGI_SRC_TYPE_EMBED; } catch (Exception te) { this.imageData = null; this.image = null; this.mimeType = null; - return; } this.imageData = imageData; - - } else if (this.rl == null) { - InputStream in = null; - try { - in = new URL(this.url).openStream(); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - byte[] buffer = new byte[1024]; - int size = in.read(buffer); - while (size != -1) { - out.write(buffer, 0, size); - size = in.read(buffer); - } - this.imageData = out.toByteArray(); - out.close(); - } catch (IOException ioe) { - this.imageData = null; - this.image = null; - this.mimeType = null; - return; - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - } - } - } - - } else { - if (this.url.contains(DATA_PROTOCOL)) { - String[] imageDataArray = this.url.split(";base64,"); - String imageDataBase64 = imageDataArray[1]; - Decoder decoder = java.util.Base64.getDecoder(); - this.imageData = decoder.decode(imageDataBase64); - this.mimeType = this.url.split(";base64,")[0].split(DATA_PROTOCOL)[1]; - } else { - try { - this.imageData = this.rl.findResource(new URL(this.url)); - } catch (MalformedURLException mue) { - this.imageData = null; - this.image = null; - this.mimeType = null; - } - } } + if (this.imageData != null) { try { this.image = Image.getInstance(this.imageData); @@ -375,7 +328,6 @@ private void prepareImageByteArray() { this.setMimeType(mimeType); this.createDataUrl(); } -// setMIMEType /** * Get the image instance @@ -473,7 +425,7 @@ public int getRepeatedMode() { * @param sourceType String of the image source type */ public void setSourceType(String sourceType) { - this.sourceType = bgiSourceTypeMap.get(sourceType); + this.sourceType = sourceType; } /** diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BoxStyle.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BoxStyle.java index 8d91df999d6..e081d9f6f6c 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BoxStyle.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BoxStyle.java @@ -16,6 +16,12 @@ import java.awt.Color; +/** + * Define class of box style + * + * @since 3.3 + * + */ public class BoxStyle extends AreaConstants { /** @@ -47,10 +53,18 @@ public class BoxStyle extends AreaConstants { protected BorderInfo bottomBorder = null; + /** + * Get Background color + * + * @return Return the background color + */ public Color getBackgroundColor() { return backgroundColor; } + /** + * Constructor + */ public BoxStyle() { } @@ -87,6 +101,11 @@ public void setTopBorder(BorderInfo topBorder) { } } + /** + * Constructor with box style (border info) + * + * @param bs + */ public BoxStyle(BoxStyle bs) { this.backgroundColor = bs.backgroundColor; if (bs.topBorder != null) { @@ -106,6 +125,9 @@ public BoxStyle(BoxStyle bs) { } } + /** + * CLear the border + */ public void clearBorder() { topBorder = null; leftBorder = null; @@ -113,26 +135,56 @@ public void clearBorder() { bottomBorder = null; } + /** + * Get the background image info + * + * @return Return the background image info + */ public BackgroundImageInfo getBackgroundImage() { return backgroundImage; } + /** + * Get the top border info + * + * @return Return the top border info + */ public BorderInfo getTopBorder() { return topBorder; } + /** + * Get the left border info + * + * @return Return the left border info + */ public BorderInfo getLeftBorder() { return leftBorder; } + /** + * Get the right border info + * + * @return Return the right border info + */ public BorderInfo getRightBorder() { return rightBorder; } + /** + * Get the bottom border info + * + * @return Return the bottm border info + */ public BorderInfo getBottomBorder() { return bottomBorder; } + /** + * Get the left border width + * + * @return Return the left border width + */ public int getLeftBorderWidth() { if (leftBorder != null) { return leftBorder.getWidth(); @@ -140,6 +192,11 @@ public int getLeftBorderWidth() { return 0; } + /** + * Get the right border width + * + * @return Return the right border width + */ public int getRightBorderWidth() { if (rightBorder != null) { return rightBorder.getWidth(); @@ -147,6 +204,11 @@ public int getRightBorderWidth() { return 0; } + /** + * Get the top border width + * + * @return Return the top border width + */ public int getTopBorderWidth() { if (topBorder != null) { return topBorder.getWidth(); @@ -154,6 +216,11 @@ public int getTopBorderWidth() { return 0; } + /** + * Get the bottom border width + * + * @return Return the bottom border width + */ public int getBottomBorderWidth() { if (bottomBorder != null) { return bottomBorder.getWidth(); @@ -161,6 +228,11 @@ public int getBottomBorderWidth() { return 0; } + /** + * Get the left border color + * + * @return Return the left border color + */ public Color getLeftBorderColor() { if (leftBorder != null) { return leftBorder.getColor(); @@ -168,6 +240,11 @@ public Color getLeftBorderColor() { return null; } + /** + * Get the right border color + * + * @return Return the right border color + */ public Color getRightBorderColor() { if (rightBorder != null) { return rightBorder.getColor(); @@ -175,6 +252,11 @@ public Color getRightBorderColor() { return null; } + /** + * Get the top border color + * + * @return Return the top border color + */ public Color getTopBorderColor() { if (topBorder != null) { return topBorder.getColor(); @@ -182,6 +264,11 @@ public Color getTopBorderColor() { return null; } + /** + * Get the bottom border color + * + * @return Return the bottom border color + */ public Color getBottomBorderColor() { if (bottomBorder != null) { return bottomBorder.getColor(); @@ -189,6 +276,11 @@ public Color getBottomBorderColor() { return null; } + /** + * Get the left border style + * + * @return Return the left border style + */ public int getLeftBorderStyle() { if (leftBorder != null) { return leftBorder.getStyle(); @@ -196,6 +288,11 @@ public int getLeftBorderStyle() { return 0; } + /** + * Get the right border style + * + * @return Return the right border style + */ public int getRightBorderStyle() { if (rightBorder != null) { return rightBorder.getStyle(); @@ -203,6 +300,11 @@ public int getRightBorderStyle() { return 0; } + /** + * Get the top border style + * + * @return Return the top border style + */ public int getTopBorderStyle() { if (topBorder != null) { return topBorder.getStyle(); @@ -210,6 +312,11 @@ public int getTopBorderStyle() { return 0; } + /** + * Get the bottom border style + * + * @return Return the bottom border style + */ public int getBottomBorderStyle() { if (bottomBorder != null) { return bottomBorder.getStyle(); @@ -217,26 +324,56 @@ public int getBottomBorderStyle() { return 0; } + /** + * Set the background color + * + * @param backgroundColor + */ public void setBackgroundColor(Color backgroundColor) { this.backgroundColor = backgroundColor; } + /** + * Set the background image + * + * @param backgroundImage + */ public void setBackgroundImage(BackgroundImageInfo backgroundImage) { this.backgroundImage = backgroundImage; } + /** + * Set the top border + * + * @param topBorder + */ public void setTopBorder(BorderInfo topBorder) { this.topBorder = topBorder; } + /** + * Set the left border + * + * @param leftBorder + */ public void setLeftBorder(BorderInfo leftBorder) { this.leftBorder = leftBorder; } + /** + * Set the right border + * + * @param rightBorder + */ public void setRightBorder(BorderInfo rightBorder) { this.rightBorder = rightBorder; } + /** + * Set the bottom border + * + * @param bottomBorder + */ public void setBottomBorder(BorderInfo bottomBorder) { this.bottomBorder = bottomBorder; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/script/internal/instance/StyleInstance.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/script/internal/instance/StyleInstance.java index f814eca0e2f..f66f652916d 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/script/internal/instance/StyleInstance.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/script/internal/instance/StyleInstance.java @@ -29,6 +29,12 @@ public class StyleInstance implements IScriptStyle { private IStyle style; private RunningState runningState; + /** + * Constructor + * + * @param style + * @param runningState + */ public StyleInstance(IStyle style, RunningState runningState) { this.style = style; this.runningState = runningState; @@ -277,6 +283,23 @@ public void setBackgroundImage(String imageURI) { style.setBackgroundImage(imageURI); } + /** + * Get the background image URI + */ + @Override + public String getBackgroundImageType() { + return style.getBackgroundImage(); + } + + /** + * Set the background image URI + */ + @Override + public void setBackgroundImageType(String imageType) { + checkWritable(); + style.setBackgroundImageType(imageType); + } + /** * Get the background repeat type (valid types are REPEAT, REPEAT_X, REPEAT_Y * and NO_REPEAT) @@ -1016,6 +1039,12 @@ public void setBackgroundPositionY(String y) throws ScriptException { } } + /** + * Get the CSS value of property + * + * @param index + * @return Return the CSS value of property + */ public CSSValue getProperty(int index) { return style.getProperty(index); } @@ -1024,6 +1053,7 @@ public CSSValue getProperty(int index) { * Get the text direction. Valid return types are LTR and RTL. * * @author bidi_hcg + * @return Return the text direction */ public String getDirection() { return style.getDirection(); @@ -1033,6 +1063,7 @@ public String getDirection() { * Set the text direction. Valid return types are LTR and RTL. * * @author bidi_hcg + * @param dir */ public void setDirection(String dir) { checkWritable(); diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/elements/DesignChoiceConstants.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/elements/DesignChoiceConstants.java index 01e83931afd..39aaaf5f9f7 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/elements/DesignChoiceConstants.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/elements/DesignChoiceConstants.java @@ -24,525 +24,1068 @@ public interface DesignChoiceConstants { // fontFamily - + /** design constant: choice font family */ String CHOICE_FONT_FAMILY = "fontFamily"; //$NON-NLS-1$ + + /** design constant: font family serif */ String FONT_FAMILY_SERIF = "serif"; //$NON-NLS-1$ + + /** design constant: font family sans serif */ String FONT_FAMILY_SANS_SERIF = "sans-serif"; //$NON-NLS-1$ + + /** design constant: font family cursive */ String FONT_FAMILY_CURSIVE = "cursive"; //$NON-NLS-1$ + + /** design constant: font family fantasy */ String FONT_FAMILY_FANTASY = "fantasy"; //$NON-NLS-1$ + + /** design constant: font family monospace */ String FONT_FAMILY_MONOSPACE = "monospace"; //$NON-NLS-1$ - // fontStyle + // fontStyle + /** design constant: choice font style */ String CHOICE_FONT_STYLE = "fontStyle"; //$NON-NLS-1$ + + /** design constant: font style normal */ String FONT_STYLE_NORMAL = "normal"; //$NON-NLS-1$ + + /** design constant: font style italic */ String FONT_STYLE_ITALIC = "italic"; //$NON-NLS-1$ + + /** design constant: font style oblique */ String FONT_STYLE_OBLIQUE = "oblique"; //$NON-NLS-1$ - // fontWeight + // fontWeight + /** design constant: choice font weight */ String CHOICE_FONT_WEIGHT = "fontWeight"; //$NON-NLS-1$ + + /** design constant: font weight normal */ String FONT_WEIGHT_NORMAL = "normal"; //$NON-NLS-1$ + + /** design constant: font weight bold */ String FONT_WEIGHT_BOLD = "bold"; //$NON-NLS-1$ + + /** design constant: font weight bolder */ String FONT_WEIGHT_BOLDER = "bolder"; //$NON-NLS-1$ + + /** design constant: font weight lighter */ String FONT_WEIGHT_LIGHTER = "lighter"; //$NON-NLS-1$ + + /** design constant: font weight 100 */ String FONT_WEIGHT_100 = "100"; //$NON-NLS-1$ + + /** design constant: font weight 200 */ String FONT_WEIGHT_200 = "200"; //$NON-NLS-1$ + + /** design constant: font weight 300 */ String FONT_WEIGHT_300 = "300"; //$NON-NLS-1$ + + /** design constant: font weight 400 */ String FONT_WEIGHT_400 = "400"; //$NON-NLS-1$ + + /** design constant: font weight 500 */ String FONT_WEIGHT_500 = "500"; //$NON-NLS-1$ + + /** design constant: font weight 600 */ String FONT_WEIGHT_600 = "600"; //$NON-NLS-1$ + + /** design constant: font weight 700 */ String FONT_WEIGHT_700 = "700"; //$NON-NLS-1$ + + /** design constant: font weight 800 */ String FONT_WEIGHT_800 = "800"; //$NON-NLS-1$ + + /** design constant: font weight 900 */ String FONT_WEIGHT_900 = "900"; //$NON-NLS-1$ - // fontSize + // fontSize + /** design constant: choice font size */ String CHOICE_FONT_SIZE = "fontSize"; //$NON-NLS-1$ + + /** design constant: font size xx small */ String FONT_SIZE_XX_SMALL = "xx-small"; //$NON-NLS-1$ + + /** design constant: font size x small */ String FONT_SIZE_X_SMALL = "x-small"; //$NON-NLS-1$ + + /** design constant: font size small */ String FONT_SIZE_SMALL = "small"; //$NON-NLS-1$ + + /** design constant: font size medium */ String FONT_SIZE_MEDIUM = "medium"; //$NON-NLS-1$ + + /** design constant: font size large */ String FONT_SIZE_LARGE = "large"; //$NON-NLS-1$ + + /** design constant: font size x large */ String FONT_SIZE_X_LARGE = "x-large"; //$NON-NLS-1$ + + /** design constant: font size xx large */ String FONT_SIZE_XX_LARGE = "xx-large"; //$NON-NLS-1$ + + /** design constant: font size larger */ String FONT_SIZE_LARGER = "larger"; //$NON-NLS-1$ + + /** design constant: font size smaller */ String FONT_SIZE_SMALLER = "smaller"; //$NON-NLS-1$ - // fontVariant + // fontVariant + /** design constant: choice font variant */ String CHOICE_FONT_VARIANT = "fontVariant"; //$NON-NLS-1$ + + /** design constant: font variant normal */ String FONT_VARIANT_NORMAL = "normal"; //$NON-NLS-1$ + + /** design constant: font variant small caps */ String FONT_VARIANT_SMALL_CAPS = "small-caps"; //$NON-NLS-1$ - // backgroundRepeat + // backgroundRepeat + /** design constant: choice background repeat */ String CHOICE_BACKGROUND_REPEAT = "backgroundRepeat"; //$NON-NLS-1$ + + /** design constant: background repeat repeat */ String BACKGROUND_REPEAT_REPEAT = "repeat"; //$NON-NLS-1$ + + /** design constant: background repeat repeat x */ String BACKGROUND_REPEAT_REPEAT_X = "repeat-x"; //$NON-NLS-1$ + + /** design constant: background repeat repeat y */ String BACKGROUND_REPEAT_REPEAT_Y = "repeat-y"; //$NON-NLS-1$ + + /** design constant: background repeat no repeat */ String BACKGROUND_REPEAT_NO_REPEAT = "no-repeat"; //$NON-NLS-1$ - // backgroundAttachment + // backgroundAttachment + /** design constant: choice background attachment */ String CHOICE_BACKGROUND_ATTACHMENT = "backgroundAttachment"; //$NON-NLS-1$ + + /** design constant: background attachment scroll */ String BACKGROUND_ATTACHMENT_SCROLL = "scroll"; //$NON-NLS-1$ + + /** design constant: background attachment fixed */ String BACKGROUND_ATTACHMENT_FIXED = "fixed"; //$NON-NLS-1$ - // backgroundPositionX + // backgroundPositionX + /** design constant: choice background position x */ String CHOICE_BACKGROUND_POSITION_X = "backgroundPositionX"; //$NON-NLS-1$ + + /** design constant: background position left */ String BACKGROUND_POSITION_LEFT = "left"; //$NON-NLS-1$ + + /** design constant: background position right */ String BACKGROUND_POSITION_RIGHT = "right"; //$NON-NLS-1$ + + /** design constant: background position center */ String BACKGROUND_POSITION_CENTER = "center"; //$NON-NLS-1$ // backgroundPositionY(BACKGROUND_POSITION_CENTER is already defined) + /** design constant: choice background position y */ String CHOICE_BACKGROUND_POSITION_Y = "backgroundPositionY"; //$NON-NLS-1$ + /** design constant: background position top */ String BACKGROUND_POSITION_TOP = "top"; //$NON-NLS-1$ + + /** design constant: background position bottom */ String BACKGROUND_POSITION_BOTTOM = "bottom"; //$NON-NLS-1$ + // backgroundSize + /** design constant: choice background size */ String CHOICE_BACKGROUND_SIZE = "backgroundSize"; //$NON-NLS-1$ + + /** design constant: background size auto */ String BACKGROUND_SIZE_AUTO = "auto"; //$NON-NLS-1$ + + /** design constant: background size contain */ String BACKGROUND_SIZE_CONTAIN = "contain"; //$NON-NLS-1$ + + /** design constant: background size cover */ String BACKGROUND_SIZE_COVER = "cover"; //$NON-NLS-1$ - // transform + // transform + /** design constant: choice transform */ String CHOICE_TRANSFORM = "transform"; //$NON-NLS-1$ + + /** design constant: transform capitalize */ String TRANSFORM_CAPITALIZE = "capitalize"; //$NON-NLS-1$ + + /** design constant: transform uppercase */ String TRANSFORM_UPPERCASE = "uppercase"; //$NON-NLS-1$ + + /** design constant: transform lowercase */ String TRANSFORM_LOWERCASE = "lowercase"; //$NON-NLS-1$ + + /** design constant: transform none */ String TRANSFORM_NONE = "none"; //$NON-NLS-1$ - // normal + // normal + /** design constant: choice normal */ String CHOICE_NORMAL = "normal"; //$NON-NLS-1$ + + /** design constant: normal normal */ String NORMAL_NORMAL = "normal"; //$NON-NLS-1$ - // verticalAlign + // verticalAlign + /** design constant: choice vertical align */ String CHOICE_VERTICAL_ALIGN = "verticalAlign"; //$NON-NLS-1$ + /** * @deprecated Now Engine is not support it. */ - @Deprecated + /** design constant: vertical align baseline */ String VERTICAL_ALIGN_BASELINE = "baseline"; //$NON-NLS-1$ + /** * @deprecated Now Engine is not support it. */ - @Deprecated + /** design constant: vertical align sub */ String VERTICAL_ALIGN_SUB = "sub"; //$NON-NLS-1$ + /** * @deprecated Now Engine is not support it. */ - @Deprecated + /** design constant: vertical align super */ String VERTICAL_ALIGN_SUPER = "super"; //$NON-NLS-1$ + + /** design constant: vertical align top */ String VERTICAL_ALIGN_TOP = "top"; //$NON-NLS-1$ + /** * @deprecated Now Engine is not support it. */ - @Deprecated + /** design constant: vertical align text top */ String VERTICAL_ALIGN_TEXT_TOP = "text-top"; //$NON-NLS-1$ + + /** design constant: vertical align middle */ String VERTICAL_ALIGN_MIDDLE = "middle"; //$NON-NLS-1$ + + /** design constant: vertical align bottom */ String VERTICAL_ALIGN_BOTTOM = "bottom"; //$NON-NLS-1$ + /** * @deprecated Now Engine is not support it. */ - @Deprecated + /** design constant: vertical align text bottom */ String VERTICAL_ALIGN_TEXT_BOTTOM = "text-bottom"; //$NON-NLS-1$ - // whiteSpace + // whiteSpace + /** design constant: choice white space */ String CHOICE_WHITE_SPACE = "whiteSpace"; //$NON-NLS-1$ + + /** design constant: white space normal */ String WHITE_SPACE_NORMAL = "normal"; //$NON-NLS-1$ + + /** design constant: white space pre */ String WHITE_SPACE_PRE = "pre"; //$NON-NLS-1$ + + /** design constant: white space nowrap */ String WHITE_SPACE_NOWRAP = "nowrap"; //$NON-NLS-1$ - // display + // display + /** design constant: choice display */ String CHOICE_DISPLAY = "display"; //$NON-NLS-1$ + + /** design constant: display block */ String DISPLAY_BLOCK = "block"; //$NON-NLS-1$ + + /** design constant: display inline */ String DISPLAY_INLINE = "inline"; //$NON-NLS-1$ + + /** design constant: display none */ String DISPLAY_NONE = "none"; //$NON-NLS-1$ - // pageBreakAfter + // pageBreakAfter + /** design constant: choice page break after */ String CHOICE_PAGE_BREAK_AFTER = "pageBreakAfter"; //$NON-NLS-1$ + + /** design constant: page break after auto */ String PAGE_BREAK_AFTER_AUTO = "auto"; //$NON-NLS-1$ + + /** design constant: page break after always */ String PAGE_BREAK_AFTER_ALWAYS = "always"; //$NON-NLS-1$ + + /** design constant: page break after avoid */ String PAGE_BREAK_AFTER_AVOID = "avoid"; //$NON-NLS-1$ + + /** design constant: page break after always excluding last */ String PAGE_BREAK_AFTER_ALWAYS_EXCLUDING_LAST = "always-excluding-last"; //$NON-NLS-1$ - // pageBreakBefore + // pageBreakBefore + /** design constant: choice page break before */ String CHOICE_PAGE_BREAK_BEFORE = "pageBreakBefore"; //$NON-NLS-1$ + + /** design constant: page break before auto */ String PAGE_BREAK_BEFORE_AUTO = "auto"; //$NON-NLS-1$ + + /** design constant: page break before always */ String PAGE_BREAK_BEFORE_ALWAYS = "always"; //$NON-NLS-1$ + + /** design constant: page break before avoid */ String PAGE_BREAK_BEFORE_AVOID = "avoid"; //$NON-NLS-1$ + + /** design constant: page break before always excluding first */ String PAGE_BREAK_BEFORE_ALWAYS_EXCLUDING_FIRST = "always-excluding-first"; //$NON-NLS-1$ - // pageBreakInside + // pageBreakInside + /** design constant: choice page break inside */ String CHOICE_PAGE_BREAK_INSIDE = "pageBreakInside"; //$NON-NLS-1$ + + /** design constant: page break inside avoid */ String PAGE_BREAK_INSIDE_AVOID = "avoid"; //$NON-NLS-1$ + + /** design constant: page break inside auto */ String PAGE_BREAK_INSIDE_AUTO = "auto"; //$NON-NLS-1$ - // margin + // margin + /** design constant: choice margin */ String CHOICE_MARGIN = "margin"; //$NON-NLS-1$ + /** design constant: margin auto */ String MARGIN_AUTO = "auto"; //$NON-NLS-1$ // textUnderline - + /** design constant: choice text underline */ String CHOICE_TEXT_UNDERLINE = "textUnderline"; //$NON-NLS-1$ + + /** design constant: text underline none */ String TEXT_UNDERLINE_NONE = "none"; //$NON-NLS-1$ + + /** design constant: text underline underline */ String TEXT_UNDERLINE_UNDERLINE = "underline"; //$NON-NLS-1$ - // textOverline + // textOverline + /** design constant: choice text overline */ String CHOICE_TEXT_OVERLINE = "textOverline"; //$NON-NLS-1$ + + /** design constant: text overline none */ String TEXT_OVERLINE_NONE = "none"; //$NON-NLS-1$ + + /** design constant: text overline overline */ String TEXT_OVERLINE_OVERLINE = "overline"; //$NON-NLS-1$ - // textLineThrough + // textLineThrough + /** design constant: choice text line through */ String CHOICE_TEXT_LINE_THROUGH = "textLineThrough"; //$NON-NLS-1$ + + /** design constant: text line through none */ String TEXT_LINE_THROUGH_NONE = "none"; //$NON-NLS-1$ + + /** design constant: text line through line through */ String TEXT_LINE_THROUGH_LINE_THROUGH = "line-through"; //$NON-NLS-1$ - // lineWidth + // lineWidth + /** design constant: choice line width */ String CHOICE_LINE_WIDTH = "lineWidth"; //$NON-NLS-1$ + + /** design constant: line width thin */ String LINE_WIDTH_THIN = "thin"; //$NON-NLS-1$ + + /** design constant: line width medium */ String LINE_WIDTH_MEDIUM = "medium"; //$NON-NLS-1$ + + /** design constant: line width thick */ String LINE_WIDTH_THICK = "thick"; //$NON-NLS-1$ - // lineStyle + // lineStyle + /** design constant: choice line style */ String CHOICE_LINE_STYLE = "lineStyle"; //$NON-NLS-1$ + + /** design constant: line style none */ String LINE_STYLE_NONE = "none"; //$NON-NLS-1$ + + /** design constant: line style solid */ String LINE_STYLE_SOLID = "solid"; //$NON-NLS-1$ + + /** design constant: line style dotted */ String LINE_STYLE_DOTTED = "dotted"; //$NON-NLS-1$ + + /** design constant: line style dashed */ String LINE_STYLE_DASHED = "dashed"; //$NON-NLS-1$ + + /** design constant: line style double */ String LINE_STYLE_DOUBLE = "double"; //$NON-NLS-1$ + + /** design constant: line style groove */ String LINE_STYLE_GROOVE = "groove"; //$NON-NLS-1$ + + /** design constant: line style ridge */ String LINE_STYLE_RIDGE = "ridge"; //$NON-NLS-1$ + + /** design constant: line style inset */ String LINE_STYLE_INSET = "inset"; //$NON-NLS-1$ + + /** design constant: line style outset */ String LINE_STYLE_OUTSET = "outset"; //$NON-NLS-1$ // units - + /** design constant: choice units */ String CHOICE_UNITS = "units"; //$NON-NLS-1$ + + /** design constant: units in */ String UNITS_IN = "in"; //$NON-NLS-1$ + + /** design constant: units cm */ String UNITS_CM = "cm"; //$NON-NLS-1$ + + /** design constant: units mm */ String UNITS_MM = "mm"; //$NON-NLS-1$ + + /** design constant: units pt */ String UNITS_PT = "pt"; //$NON-NLS-1$ + + /** design constant: units pc */ String UNITS_PC = "pc"; //$NON-NLS-1$ + + /** design constant: units em */ String UNITS_EM = "em"; //$NON-NLS-1$ + + /** design constant: units ex */ String UNITS_EX = "ex"; //$NON-NLS-1$ + + /** design constant: units px */ String UNITS_PX = "px"; //$NON-NLS-1$ + + /** design constant: units percentage */ String UNITS_PERCENTAGE = "%"; //$NON-NLS-1$ - // paramType + // paramType + /** design constant: choice param type */ String CHOICE_PARAM_TYPE = "paramType"; //$NON-NLS-1$ + + /** design constant: param type string */ String PARAM_TYPE_STRING = "string"; //$NON-NLS-1$ + + /** design constant: param type float */ String PARAM_TYPE_FLOAT = "float"; //$NON-NLS-1$ + + /** design constant: param type decimal */ String PARAM_TYPE_DECIMAL = "decimal"; //$NON-NLS-1$ + + /** design constant: param type datetime */ String PARAM_TYPE_DATETIME = "dateTime"; //$NON-NLS-1$ + + /** design constant: param type boolean */ String PARAM_TYPE_BOOLEAN = "boolean"; //$NON-NLS-1$ + + /** design constant: param type integer */ String PARAM_TYPE_INTEGER = "integer"; //$NON-NLS-1$ + + /** design constant: param type java object */ String PARAM_TYPE_JAVA_OBJECT = "javaObject"; //$NON-NLS-1$ + /** * @deprecated Now any is not supported. */ @Deprecated + /** design constant: param type any */ String PARAM_TYPE_ANY = "any"; //$NON-NLS-1$ + + /** design constant: param type date */ String PARAM_TYPE_DATE = "date"; //$NON-NLS-1$ + + /** design constant: param type time */ String PARAM_TYPE_TIME = "time"; //$NON-NLS-1$ // paramValueType - + /** design constant: choice param value type */ String CHOICE_PARAM_VALUE_TYPE = "paramType"; //$NON-NLS-1$ + + /** design constant: param value type static */ String PARAM_VALUE_TYPE_STATIC = "static"; //$NON-NLS-1$ + + /** design constant: param value type dynamic */ String PARAM_VALUE_TYPE_DYNAMIC = "dynamic"; //$NON-NLS-1$ - // paramControl + // paramControl + /** design constant: choice param control */ String CHOICE_PARAM_CONTROL = "paramControl"; //$NON-NLS-1$ + + /** design constant: param control text box */ String PARAM_CONTROL_TEXT_BOX = "text-box"; //$NON-NLS-1$ + + /** design constant: param control list box */ String PARAM_CONTROL_LIST_BOX = "list-box"; //$NON-NLS-1$ + + /** design constant: param control radio button */ String PARAM_CONTROL_RADIO_BUTTON = "radio-button"; //$NON-NLS-1$ + + /** design constant: param control check box */ String PARAM_CONTROL_CHECK_BOX = "check-box"; //$NON-NLS-1$ + + /** design constant: param control auto suggest */ String PARAM_CONTROL_AUTO_SUGGEST = "auto-suggest"; //$NON-NLS-1$ - // textAlign + // textAlign + /** design constant: choice text align */ String CHOICE_TEXT_ALIGN = "textAlign"; //$NON-NLS-1$ + + /** design constant: text align left */ String TEXT_ALIGN_LEFT = "left"; //$NON-NLS-1$ + + /** design constant: text align center */ String TEXT_ALIGN_CENTER = "center"; //$NON-NLS-1$ + + /** design constant: text align right */ String TEXT_ALIGN_RIGHT = "right"; //$NON-NLS-1$ + + /** design constant: text align justify */ String TEXT_ALIGN_JUSTIFY = "justify"; //$NON-NLS-1$ - // pageSize + // pageSize + /** design constant: choice page size */ String CHOICE_PAGE_SIZE = "pageSize"; //$NON-NLS-1$ + + /** design constant: page size custom */ String PAGE_SIZE_CUSTOM = "custom"; //$NON-NLS-1$ + + /** design constant: page size us letter */ String PAGE_SIZE_US_LETTER = "us-letter"; //$NON-NLS-1$ + + /** design constant: page size us legal */ String PAGE_SIZE_US_LEGAL = "us-legal"; //$NON-NLS-1$ + + /** design constant: page size a4 */ String PAGE_SIZE_A4 = "a4"; //$NON-NLS-1$ + + /** design constant: page size a3 */ String PAGE_SIZE_A3 = "a3"; //$NON-NLS-1$ + + /** design constant: page size a5 */ String PAGE_SIZE_A5 = "a5"; //$NON-NLS-1$ + + /** design constant: page size us ledger */ String PAGE_SIZE_US_LEDGER = "us-ledger"; //$NON-NLS-1$ + + /** design constant: page size us super b */ String PAGE_SIZE_US_SUPER_B = "us-super-b"; //$NON-NLS-1$ - // pageOrientation + // pageOrientation + /** design constant: choice page orientation */ String CHOICE_PAGE_ORIENTATION = "pageOrientation"; //$NON-NLS-1$ + + /** design constant: page orientation auto */ String PAGE_ORIENTATION_AUTO = "auto"; //$NON-NLS-1$ + + /** design constant: page orientation portrait */ String PAGE_ORIENTATION_PORTRAIT = "portrait"; //$NON-NLS-1$ + + /** design constant: page orientation landscape */ String PAGE_ORIENTATION_LANDSCAPE = "landscape"; //$NON-NLS-1$ - // interval + // interval + /** design constant: choice interval */ String CHOICE_INTERVAL = "interval"; //$NON-NLS-1$ + + /** design constant: interval none */ String INTERVAL_NONE = "none"; //$NON-NLS-1$ + + /** design constant: interval prefix */ String INTERVAL_PREFIX = "prefix"; //$NON-NLS-1$ + + /** design constant: interval year */ String INTERVAL_YEAR = "year"; //$NON-NLS-1$ + + /** design constant: interval quarter */ String INTERVAL_QUARTER = "quarter"; //$NON-NLS-1$ + + /** design constant: interval month */ String INTERVAL_MONTH = "month"; //$NON-NLS-1$ + + /** design constant: interval week */ String INTERVAL_WEEK = "week"; //$NON-NLS-1$ + + /** design constant: interval day */ String INTERVAL_DAY = "day"; //$NON-NLS-1$ + + /** design constant: interval hour */ String INTERVAL_HOUR = "hour"; //$NON-NLS-1$ + + /** design constant: interval minute */ String INTERVAL_MINUTE = "minute"; //$NON-NLS-1$ + + /** design constant: interval second */ String INTERVAL_SECOND = "second"; //$NON-NLS-1$ + + /** design constant: interval interval */ String INTERVAL_INTERVAL = "interval"; //$NON-NLS-1$ - // intervalType + // intervalType + /** design constant: choice interval type */ String CHOICE_INTERVAL_TYPE = "intervalType"; //$NON-NLS-1$ + + /** design constant: interval type none */ String INTERVAL_TYPE_NONE = "none"; //$NON-NLS-1$ + + /** design constant: interval type prefix */ String INTERVAL_TYPE_PREFIX = "prefix"; //$NON-NLS-1$ + + /** design constant: interval type interval */ String INTERVAL_TYPE_INTERVAL = "interval"; //$NON-NLS-1$ - // sortDirection + // sortDirection + /** design constant: choice sort direction */ String CHOICE_SORT_DIRECTION = "sortDirection"; //$NON-NLS-1$ + + /** design constant: sort direction asc */ String SORT_DIRECTION_ASC = "asc"; //$NON-NLS-1$ + + /** design constant: sort direction desc */ String SORT_DIRECTION_DESC = "desc"; //$NON-NLS-1$ - // mapOperator + // mapOperator + /** design constant: choice map operator */ String CHOICE_MAP_OPERATOR = "mapOperator"; //$NON-NLS-1$ + + /** design constant: map operator eq */ String MAP_OPERATOR_EQ = "eq"; //$NON-NLS-1$ + + /** design constant: map operator ne */ String MAP_OPERATOR_NE = "ne"; //$NON-NLS-1$ + + /** design constant: map operator lt */ String MAP_OPERATOR_LT = "lt"; //$NON-NLS-1$ + + /** design constant: map operator le */ String MAP_OPERATOR_LE = "le"; //$NON-NLS-1$ + + /** design constant: map operator ge */ String MAP_OPERATOR_GE = "ge"; //$NON-NLS-1$ + + /** design constant: map operator gt */ String MAP_OPERATOR_GT = "gt"; //$NON-NLS-1$ + + /** design constant: map operator between */ String MAP_OPERATOR_BETWEEN = "between"; //$NON-NLS-1$ + + /** design constant: map operator not between */ String MAP_OPERATOR_NOT_BETWEEN = "not-between"; //$NON-NLS-1$ + + /** design constant: map operator null */ String MAP_OPERATOR_NULL = "is-null"; //$NON-NLS-1$ + + /** design constant: map operator not null */ String MAP_OPERATOR_NOT_NULL = "is-not-null"; //$NON-NLS-1$ + + /** design constant: map operator true */ String MAP_OPERATOR_TRUE = "is-true"; //$NON-NLS-1$ + + /** design constant: map operator false */ String MAP_OPERATOR_FALSE = "is-false"; //$NON-NLS-1$ + + /** design constant: map operator like */ String MAP_OPERATOR_LIKE = "like"; //$NON-NLS-1$ + + /** design constant: map operator match */ String MAP_OPERATOR_MATCH = "match"; //$NON-NLS-1$ + + /** design constant: map operator top n */ String MAP_OPERATOR_TOP_N = "top-n"; //$NON-NLS-1$ + + /** design constant: map operator bottom n */ String MAP_OPERATOR_BOTTOM_N = "bottom-n"; //$NON-NLS-1$ + + /** design constant: map operator top percent */ String MAP_OPERATOR_TOP_PERCENT = "top-percent"; //$NON-NLS-1$ + + /** design constant: map operator bottom percent */ String MAP_OPERATOR_BOTTOM_PERCENT = "bottom-percent"; //$NON-NLS-1$ + + /** design constant: map operator not like */ String MAP_OPERATOR_NOT_LIKE = "not-like"; //$NON-NLS-1$ + + /** design constant: map operator not match */ String MAP_OPERATOR_NOT_MATCH = "not-match"; //$NON-NLS-1$ + /** design constant: map operator any */ String MAP_OPERATOR_ANY = "any"; //$NON-NLS-1$ + + /** design constant: map operator not in */ String MAP_OPERATOR_NOT_IN = "not-in"; //$NON-NLS-1$ + + /** design constant: map operator in */ String MAP_OPERATOR_IN = "in"; //$NON-NLS-1$ - // imageSize + // imageSize + /** design constant: choice image size */ String CHOICE_IMAGE_SIZE = "imageSize"; //$NON-NLS-1$ + + /** design constant: image size size to image */ String IMAGE_SIZE_SIZE_TO_IMAGE = "size-to-image"; //$NON-NLS-1$ + + /** design constant: image size scale to item */ String IMAGE_SIZE_SCALE_TO_ITEM = "scale-to-item"; //$NON-NLS-1$ + + /** design constant: image size clip */ String IMAGE_SIZE_CLIP = "clip"; //$NON-NLS-1$ - // lineOrientation + // lineOrientation + /** design constant: choice line orientation */ String CHOICE_LINE_ORIENTATION = "lineOrientation"; //$NON-NLS-1$ + + /** design constant: line orientation horizontal */ String LINE_ORIENTATION_HORIZONTAL = "horizontal"; //$NON-NLS-1$ + + /** design constant: line orientation vertical */ String LINE_ORIENTATION_VERTICAL = "vertical"; //$NON-NLS-1$ - // sectionAlign + // sectionAlign + /** design constant: choice section align */ String CHOICE_SECTION_ALIGN = "sectionAlign"; //$NON-NLS-1$ + + /** design constant: section align left */ String SECTION_ALIGN_LEFT = "left"; //$NON-NLS-1$ + + /** design constant: section align center */ String SECTION_ALIGN_CENTER = "center"; //$NON-NLS-1$ + + /** design constant: section align right */ String SECTION_ALIGN_RIGHT = "right"; //$NON-NLS-1$ - // dropType + // dropType + /** design constant: choice drop type */ String CHOICE_DROP_TYPE = "dropType"; //$NON-NLS-1$ + + /** design constant: drop type none */ String DROP_TYPE_NONE = "none"; //$NON-NLS-1$ + + /** design constant: drop type detail */ String DROP_TYPE_DETAIL = "detail"; //$NON-NLS-1$ + + /** design constant: drop type all */ String DROP_TYPE_ALL = "all"; //$NON-NLS-1$ - // imageType + // imageType + /** design constant: choice image type */ String CHOICE_IMAGE_TYPE = "imageType"; //$NON-NLS-1$ + + /** design constant: image type image bmp */ String IMAGE_TYPE_IMAGE_BMP = "image/bmp"; //$NON-NLS-1$ + + /** design constant: image type image gif */ String IMAGE_TYPE_IMAGE_GIF = "image/gif"; //$NON-NLS-1$ + + /** design constant: image type image png */ String IMAGE_TYPE_IMAGE_PNG = "image/png"; //$NON-NLS-1$ + + /** design constant: image type image x png */ String IMAGE_TYPE_IMAGE_X_PNG = "image/x-png"; //$NON-NLS-1$ + + /** design constant: image type image jpeg */ String IMAGE_TYPE_IMAGE_JPEG = "image/jpeg"; //$NON-NLS-1$ + + /** design constant: image type image ico */ String IMAGE_TYPE_IMAGE_ICO = "image/ico"; //$NON-NLS-1$ + + /** design constant: image type image tiff */ String IMAGE_TYPE_IMAGE_TIFF = "image/tiff"; //$NON-NLS-1$ + + /** design constant: image type image svg */ String IMAGE_TYPE_IMAGE_SVG = "image/svg+xml"; //$NON-NLS-1$ + + /** design constant: image type image x icon */ String IMAGE_TYPE_IMAGE_X_ICON = "image/x-icon"; //$NON-NLS-1$ - // lineSpacing + // lineSpacing + /** design constant: choice line spacing */ String CHOICE_LINE_SPACING = "lineSpacing"; //$NON-NLS-1$ + + /** design constant: line spacing lines */ String LINE_SPACING_LINES = "lines"; //$NON-NLS-1$ + + /** design constant: line spacing exact */ String LINE_SPACING_EXACT = "exact"; //$NON-NLS-1$ - // actionLinkTyp + // actionLinkTyp + /** design constant: choice action link type */ String CHOICE_ACTION_LINK_TYPE = "actionLinkType"; //$NON-NLS-1$ + + /** design constant: action link type none */ String ACTION_LINK_TYPE_NONE = "none"; //$NON-NLS-1$ + + /** design constant: action link type hyperlink */ String ACTION_LINK_TYPE_HYPERLINK = "hyperlink"; //$NON-NLS-1$ + + /** design constant: action link type drill through */ String ACTION_LINK_TYPE_DRILL_THROUGH = "drill-through"; //$NON-NLS-1$ + + /** design constant: action link type bookmark link */ String ACTION_LINK_TYPE_BOOKMARK_LINK = "bookmark-link"; //$NON-NLS-1$ - // actionFormatType + // actionFormatType + /** design constant: choice action format type */ String CHOICE_ACTION_FORMAT_TYPE = "actionFormatType"; //$NON-NLS-1$ + + /** design constant: action format type html */ String ACTION_FORMAT_TYPE_HTML = "html"; //$NON-NLS-1$ + + /** design constant: action format type pdf */ String ACTION_FORMAT_TYPE_PDF = "pdf"; //$NON-NLS-1$ - // ContentType for TextItem + // ContentType for TextItem + /** design constant: choice text content type */ String CHOICE_TEXT_CONTENT_TYPE = "textContentType"; //$NON-NLS-1$ + + /** design constant: text content type auto */ String TEXT_CONTENT_TYPE_AUTO = "auto"; //$NON-NLS-1$ + + /** design constant: text content type plain */ String TEXT_CONTENT_TYPE_PLAIN = "plain"; //$NON-NLS-1$ + + /** design constant: text content type html */ String TEXT_CONTENT_TYPE_HTML = "html"; //$NON-NLS-1$ + + /** design constant: text content type rtf */ String TEXT_CONTENT_TYPE_RTF = "rtf"; //$NON-NLS-1$ - // ContentType for TextDataItem + // ContentType for TextDataItem + /** design constant: choice text data content type */ String CHOICE_TEXT_DATA_CONTENT_TYPE = "textDataContentType"; //$NON-NLS-1$ + + /** design constant: text data content type auto */ String TEXT_DATA_CONTENT_TYPE_AUTO = "auto"; //$NON-NLS-1$ + + /** design constant: text data content type plain */ String TEXT_DATA_CONTENT_TYPE_PLAIN = "plain"; //$NON-NLS-1$ + + /** design constant: text data content type html */ String TEXT_DATA_CONTENT_TYPE_HTML = "html"; //$NON-NLS-1$ + + /** design constant: text data content type rtf */ String TEXT_DATA_CONTENT_TYPE_RTF = "rtf"; //$NON-NLS-1$ - // Pagination orphans + // Pagination orphans + /** design constant: choice oprhans */ String CHOICE_OPRHANS = "orphans"; //$NON-NLS-1$ + + /** design constant: orphans inherit */ String ORPHANS_INHERIT = "inherit"; //$NON-NLS-1$ - // Pagination widows + // Pagination widows + /** design constant: choice widows */ String CHOICE_WIDOWS = "widows"; //$NON-NLS-1$ + + /** design constant: widows inherit */ String WIDOWS_INHERIT = "inherit"; //$NON-NLS-1$ + /** * FormatType -- The target output format. The first constant is the name of * FormatType choice. The followed constants are valid choice values of * FormatType. */ - + /** design constant: choice format type */ String CHOICE_FORMAT_TYPE = "formatType"; //$NON-NLS-1$ + + /** design constant: format type all */ String FORMAT_TYPE_ALL = "all"; //$NON-NLS-1$ + + /** design constant: format type viewer */ String FORMAT_TYPE_VIEWER = "viewer"; //$NON-NLS-1$ + + /** design constant: format type email */ String FORMAT_TYPE_EMAIL = "email"; //$NON-NLS-1$ + + /** design constant: format type print */ String FORMAT_TYPE_PRINT = "print"; //$NON-NLS-1$ + + /** design constant: format type pdf */ String FORMAT_TYPE_PDF = "pdf"; //$NON-NLS-1$ + + /** design constant: format type rtf */ String FORMAT_TYPE_RTF = "rtf"; //$NON-NLS-1$ + + /** design constant: format type reportlet */ String FORMAT_TYPE_REPORTLET = "reportlet"; //$NON-NLS-1$ + + /** design constant: format type excel */ String FORMAT_TYPE_EXCEL = "excel"; //$NON-NLS-1$ + + /** design constant: format type word */ String FORMAT_TYPE_WORD = "word"; //$NON-NLS-1$ + + /** design constant: format type powerpoint */ String FORMAT_TYPE_POWERPOINT = "powerpoint"; //$NON-NLS-1$ + + /** design constant: format type doc */ String FORMAT_TYPE_DOC = "doc"; //$NON-NLS-1$ + + /** * ImageRefType -- The image reference type. The first constant is the name of * ImageRefType choice. The followed constants are valid choice values of * ImageRefType. */ - + /** design constant: choice image ref type */ String CHOICE_IMAGE_REF_TYPE = "imageRefType"; //$NON-NLS-1$ + + /** design constant: image ref type none */ String IMAGE_REF_TYPE_NONE = "none"; //$NON-NLS-1$ + + /** design constant: image ref type file */ String IMAGE_REF_TYPE_FILE = "file"; //$NON-NLS-1$ + + /** design constant: image ref type url */ String IMAGE_REF_TYPE_URL = "url"; //$NON-NLS-1$ + + /** design constant: image ref type expr */ String IMAGE_REF_TYPE_EXPR = "expr"; //$NON-NLS-1$ + + /** design constant: image ref type embed */ String IMAGE_REF_TYPE_EMBED = "embed"; //$NON-NLS-1$ + /** * propertyMaskType -- The choice for the property mask. The first constant is * the name of propertyMaskType choice. The followed constants are valid choice * values of propertyMaskType. */ - + /** design constant: choice property mask type */ String CHOICE_PROPERTY_MASK_TYPE = "propertyMaskType"; //$NON-NLS-1$ + + /** design constant: property mask type change */ String PROPERTY_MASK_TYPE_CHANGE = "change"; //$NON-NLS-1$ + + /** design constant: property mask type lock */ String PROPERTY_MASK_TYPE_LOCK = "lock"; //$NON-NLS-1$ + + /** design constant: property mask type hide */ String PROPERTY_MASK_TYPE_HIDE = "hide"; //$NON-NLS-1$ + /** * scalarParamAlign -- The choice for the scalarParamter alignment. The first * constant is the name of scalarParamAlign choice. The followed constants are * valid choice values of scalarParamAlign. */ - + /** design constant: choice scalar param align */ String CHOICE_SCALAR_PARAM_ALIGN = "scalarParamAlign"; //$NON-NLS-1$ + + /** design constant: scalar param align auto */ String SCALAR_PARAM_ALIGN_AUTO = "auto"; //$NON-NLS-1$ + + /** design constant: scalar param align left */ String SCALAR_PARAM_ALIGN_LEFT = "left"; //$NON-NLS-1$ + + /** design constant: scalar param align center */ String SCALAR_PARAM_ALIGN_CENTER = "center"; //$NON-NLS-1$ + + /** design constant: scalar param align right */ String SCALAR_PARAM_ALIGN_RIGHT = "right"; //$NON-NLS-1$ + /* + * * columnDataType -- The column data type The first constant is the name of * columnDataType choice. The followed constants are valid choice values of * columnDataType. + * */ - + /** design constant: choice column data type */ String CHOICE_COLUMN_DATA_TYPE = "columnDataType"; //$NON-NLS-1$ + /** * @deprecated this choice is removed since 2.3 */ @Deprecated + /** design constant: column data type any */ String COLUMN_DATA_TYPE_ANY = "any"; //$NON-NLS-1$ + + /** design constant: column data type integer */ String COLUMN_DATA_TYPE_INTEGER = "integer"; //$NON-NLS-1$ + + /** design constant: column data type string */ String COLUMN_DATA_TYPE_STRING = "string"; //$NON-NLS-1$ + + /** design constant: column data type datetime */ String COLUMN_DATA_TYPE_DATETIME = "date-time"; //$NON-NLS-1$ + + /** design constant: column data type decimal */ String COLUMN_DATA_TYPE_DECIMAL = "decimal"; //$NON-NLS-1$ + + /** design constant: column data type float */ String COLUMN_DATA_TYPE_FLOAT = "float"; //$NON-NLS-1$ + + /** design constant: column data type boolean */ String COLUMN_DATA_TYPE_BOOLEAN = "boolean"; //$NON-NLS-1$ + + /** design constant: column data type date */ String COLUMN_DATA_TYPE_DATE = "date";//$NON-NLS-1$ + + /** design constant: column data type time */ String COLUMN_DATA_TYPE_TIME = "time";//$NON-NLS-1$ + + /** design constant: column data type blob */ String COLUMN_DATA_TYPE_BLOB = "blob";//$NON-NLS-1$ + + /** design constant: column data type java object */ String COLUMN_DATA_TYPE_JAVA_OBJECT = "javaObject";//$NON-NLS-1$ + /** * searchType -- The search type for column hint The first constant is the name * of searchType choice. The followed constants are valid choice values of * searchType. */ - + /** design constant: choice search type */ String CHOICE_SEARCH_TYPE = "searchType"; //$NON-NLS-1$ + + /** design constant: search type any */ String SEARCH_TYPE_ANY = "any"; //$NON-NLS-1$ + + /** design constant: search type indexed */ String SEARCH_TYPE_INDEXED = "indexed"; //$NON-NLS-1$ + + /** design constant: search type none */ String SEARCH_TYPE_NONE = "none"; //$NON-NLS-1$ /** @@ -550,85 +1093,158 @@ public interface DesignChoiceConstants { * of exportType choice. The followed constants are valid choice values of * exportType. */ - + /** design constant: choice export type */ String CHOICE_EXPORT_TYPE = "exportType"; //$NON-NLS-1$ + + /** design constant: export type none */ String EXPORT_TYPE_NONE = "none"; //$NON-NLS-1$ + + /** design constant: export type if realized */ String EXPORT_TYPE_IF_REALIZED = "if-realized"; //$NON-NLS-1$ + + /** design constant: export type always */ String EXPORT_TYPE_ALWAYS = "always"; //$NON-NLS-1$ + /** * analysisType -- The analysis type for column hint The first constant is the * name of analysisType choice. The followed constants are valid choice values * of analysisType. */ - + /** design constant: choice analysis type */ String CHOICE_ANALYSIS_TYPE = "analysisType"; //$NON-NLS-1$ + /** * @deprecated in 2.5.1: this choice is not supported */ @Deprecated + /** design constant: analysis type auto */ String ANALYSIS_TYPE_AUTO = "auto"; //$NON-NLS-1$ + + /** design constant: analysis type dimension */ String ANALYSIS_TYPE_DIMENSION = "dimension"; //$NON-NLS-1$ + + /** design constant: analysis type attribute */ String ANALYSIS_TYPE_ATTRIBUTE = "attribute"; //$NON-NLS-1$ + + /** design constant: analysis type measure */ String ANALYSIS_TYPE_MEASURE = "measure"; //$NON-NLS-1$ + /** * @deprecated in 2.5.1: this choice is not supported */ @Deprecated + /** design constant: analysis type detail */ String ANALYSIS_TYPE_DETAIL = "detail"; //$NON-NLS-1$ + + /** * @deprecated in 2.5.1: this choice is not supported */ @Deprecated + /** design constant: analysis type none */ String ANALYSIS_TYPE_NONE = "none"; //$NON-NLS-1$ + /** * filterOperator -- The filter operator for filter condition The first constant * is the name of filterOperator choice. The followed constants are valid choice * values of filterOperator. */ - + /** design constant: choice filter operator */ String CHOICE_FILTER_OPERATOR = "filterOperator"; //$NON-NLS-1$ + + /** design constant: filter operator eq */ String FILTER_OPERATOR_EQ = "eq"; //$NON-NLS-1$ + + /** design constant: filter operator ne */ String FILTER_OPERATOR_NE = "ne"; //$NON-NLS-1$ + + /** design constant: filter operator lt */ String FILTER_OPERATOR_LT = "lt"; //$NON-NLS-1$ + + /** design constant: filter operator le */ String FILTER_OPERATOR_LE = "le"; //$NON-NLS-1$ + + /** design constant: filter operator ge */ String FILTER_OPERATOR_GE = "ge"; //$NON-NLS-1$ + + /** design constant: filter operator gt */ String FILTER_OPERATOR_GT = "gt"; //$NON-NLS-1$ + + /** design constant: filter operator between */ String FILTER_OPERATOR_BETWEEN = "between"; //$NON-NLS-1$ + + /** design constant: filter operator not between */ String FILTER_OPERATOR_NOT_BETWEEN = "not-between"; //$NON-NLS-1$ + + /** design constant: filter operator null */ String FILTER_OPERATOR_NULL = "is-null"; //$NON-NLS-1$ + + /** design constant: filter operator not null */ String FILTER_OPERATOR_NOT_NULL = "is-not-null"; //$NON-NLS-1$ + + /** design constant: filter operator true */ String FILTER_OPERATOR_TRUE = "is-true"; //$NON-NLS-1$ + + /** design constant: filter operator false */ String FILTER_OPERATOR_FALSE = "is-false"; //$NON-NLS-1$ + + /** design constant: filter operator like */ String FILTER_OPERATOR_LIKE = "like"; //$NON-NLS-1$ + + /** design constant: filter operator top n */ String FILTER_OPERATOR_TOP_N = "top-n"; //$NON-NLS-1$ + + /** design constant: filter operator bottom n */ String FILTER_OPERATOR_BOTTOM_N = "bottom-n"; //$NON-NLS-1$ + + /** design constant: filter operator top percent */ String FILTER_OPERATOR_TOP_PERCENT = "top-percent"; //$NON-NLS-1$ + + /** design constant: filter operator bottom percent */ String FILTER_OPERATOR_BOTTOM_PERCENT = "bottom-percent"; //$NON-NLS-1$ + + /** design constant: filter operator not in */ String FILTER_OPERATOR_NOT_IN = "not-in"; //$NON-NLS-1$ + /** * @deprecated in BIRT 2.1. This operator is not supported. */ - @Deprecated + /** design constant: filter operator any */ String FILTER_OPERATOR_ANY = "any"; //$NON-NLS-1$ + + /** design constant: filter operator match */ String FILTER_OPERATOR_MATCH = "match"; //$NON-NLS-1$ + + /** design constant: filter operator not like */ String FILTER_OPERATOR_NOT_LIKE = "not-like"; //$NON-NLS-1$ + + /** design constant: filter operator not match */ String FILTER_OPERATOR_NOT_MATCH = "not-match"; //$NON-NLS-1$ + + /** design constant: filter operator in */ String FILTER_OPERATOR_IN = "in"; //$NON-NLS-1$ + /** * columnAlign -- The column alignment The first constant is the name of * columnAlign choice. The followed constants are valid choice values of * columnAlign. */ - + /** design constant: choice column align */ String CHOICE_COLUMN_ALIGN = "columnAlign"; //$NON-NLS-1$ + + /** design constant: column align left */ String COLUMN_ALIGN_LEFT = "left"; //$NON-NLS-1$ + + /** design constant: column align center */ String COLUMN_ALIGN_CENTER = "center"; //$NON-NLS-1$ + + /** design constant: column align right */ String COLUMN_ALIGN_RIGHT = "right"; //$NON-NLS-1$ /** @@ -636,30 +1252,55 @@ public interface DesignChoiceConstants { * queryFrom choice. The followed constants are valid choice values of * queryFrom. */ - + /** design constant: choice query choice type */ String CHOICE_QUERY_CHOICE_TYPE = "queryChoiceType"; //$NON-NLS-1$ + + /** design constant: query choice type none */ String QUERY_CHOICE_TYPE_NONE = "none"; //$NON-NLS-1$ + + /** design constant: query choice type text */ String QUERY_CHOICE_TYPE_TEXT = "text"; //$NON-NLS-1$ + + /** design constant: query choice type script */ String QUERY_CHOICE_TYPE_SCRIPT = "script"; //$NON-NLS-1$ /** * Common format type "Custom" */ + /** design constant: value format type custom */ String VALUE_FORMAT_TYPE_CUSTOM = "Custom"; //$NON-NLS-1$ + + /** * numberFormat -- the number format The first constant is the name of * numberFormat choice. The followed constants are valid choice values of * numberFormat. */ - + /** design constant: choice number format type */ String CHOICE_NUMBER_FORMAT_TYPE = "numberFormat"; //$NON-NLS-1$ + + /** design constant: number format type unformatted */ String NUMBER_FORMAT_TYPE_UNFORMATTED = "Unformatted"; //$NON-NLS-1$ + + /** design constant: number format type general number */ String NUMBER_FORMAT_TYPE_GENERAL_NUMBER = "General Number"; //$NON-NLS-1$ + + /** design constant: number format type currency */ String NUMBER_FORMAT_TYPE_CURRENCY = "Currency"; //$NON-NLS-1$ + + /** design constant: number format type fixed */ String NUMBER_FORMAT_TYPE_FIXED = "Fixed"; //$NON-NLS-1$ + + /** design constant: number format type percent */ String NUMBER_FORMAT_TYPE_PERCENT = "Percent"; //$NON-NLS-1$ + + /** design constant: number format type scientific */ String NUMBER_FORMAT_TYPE_SCIENTIFIC = "Scientific"; //$NON-NLS-1$ + + /** design constant: number format type standard */ String NUMBER_FORMAT_TYPE_STANDARD = "Standard"; //$NON-NLS-1$ + + /** design constant: number format type custom */ String NUMBER_FORMAT_TYPE_CUSTOM = VALUE_FORMAT_TYPE_CUSTOM; /** @@ -667,434 +1308,896 @@ public interface DesignChoiceConstants { * dateTimeFormat choice. The followed constants are valid choice values of * dateTimeFormat. */ - + /** design constant: choice datetime format type */ String CHOICE_DATETIME_FORMAT_TYPE = "dateTimeFormat"; //$NON-NLS-1$ + + /** design constant: datetiem format type unformatted */ String DATETIEM_FORMAT_TYPE_UNFORMATTED = "Unformatted"; //$NON-NLS-1$ + + /** design constant: datetiem format type general date */ String DATETIEM_FORMAT_TYPE_GENERAL_DATE = "General Date"; //$NON-NLS-1$ + + /** design constant: datetiem format type long date */ String DATETIEM_FORMAT_TYPE_LONG_DATE = "Long Date"; //$NON-NLS-1$ + + /** design constant: datetiem format type mudium date */ String DATETIEM_FORMAT_TYPE_MUDIUM_DATE = "Medium Date"; //$NON-NLS-1$ + + /** design constant: datetiem format type short date */ String DATETIEM_FORMAT_TYPE_SHORT_DATE = "Short Date"; //$NON-NLS-1$ + + /** design constant: datetiem format type long time */ String DATETIEM_FORMAT_TYPE_LONG_TIME = "Long Time"; //$NON-NLS-1$ + + /** design constant: datetiem format type medium time */ String DATETIEM_FORMAT_TYPE_MEDIUM_TIME = "Medium Time"; //$NON-NLS-1$ + + /** design constant: datetiem format type short time */ String DATETIEM_FORMAT_TYPE_SHORT_TIME = "Short Time"; //$NON-NLS-1$ + + /** design constant: datetiem format type custom */ String DATETIEM_FORMAT_TYPE_CUSTOM = VALUE_FORMAT_TYPE_CUSTOM; + /** * dateFormat choice. */ - + /** design constant: choice date format type */ String CHOICE_DATE_FORMAT_TYPE = "dateFormat"; //$NON-NLS-1$ + + /** design constant: date format type unformatted */ String DATE_FORMAT_TYPE_UNFORMATTED = "Unformatted"; //$NON-NLS-1$ + + /** design constant: date format type general date */ String DATE_FORMAT_TYPE_GENERAL_DATE = "General Date"; //$NON-NLS-1$ + + /** design constant: date format type long date */ String DATE_FORMAT_TYPE_LONG_DATE = "Long Date"; //$NON-NLS-1$ + + /** design constant: date format type mudium date */ String DATE_FORMAT_TYPE_MUDIUM_DATE = "Medium Date"; //$NON-NLS-1$ + + /** design constant: date format type short date */ String DATE_FORMAT_TYPE_SHORT_DATE = "Short Date"; //$NON-NLS-1$ + + /** design constant: date format type custom */ String DATE_FORMAT_TYPE_CUSTOM = VALUE_FORMAT_TYPE_CUSTOM; + /** * timeFormat choice */ - + /** design constant: choice time format type */ String CHOICE_TIME_FORMAT_TYPE = "timeFormat"; //$NON-NLS-1$ + + /** design constant: time format type long time */ String TIME_FORMAT_TYPE_LONG_TIME = "Long Time"; //$NON-NLS-1$ + + /** design constant: time format type medium time */ String TIME_FORMAT_TYPE_MEDIUM_TIME = "Medium Time"; //$NON-NLS-1$ + + /** design constant: time format type short time */ String TIME_FORMAT_TYPE_SHORT_TIME = "Short Time"; //$NON-NLS-1$ + + /** design constant: time format type custom */ String TIME_FORMAT_TYPE_CUSTOM = VALUE_FORMAT_TYPE_CUSTOM; + /** * stringFormat -- the string format The first constant is the name of * stringFormat choice. The followed constants are valid choice values of * stringFormat. */ - + /** design constant: choice string format type */ String CHOICE_STRING_FORMAT_TYPE = "stringFormat"; //$NON-NLS-1$ + + /** design constant: string format type unformatted */ String STRING_FORMAT_TYPE_UNFORMATTED = "Unformatted"; //$NON-NLS-1$ + + /** design constant: string format type uppercase */ String STRING_FORMAT_TYPE_UPPERCASE = ">"; //$NON-NLS-1$ + + /** design constant: string format type lowercase */ String STRING_FORMAT_TYPE_LOWERCASE = "<"; //$NON-NLS-1$ + + /** design constant: string format type custom */ String STRING_FORMAT_TYPE_CUSTOM = VALUE_FORMAT_TYPE_CUSTOM; + + /** design constant: string format type zip code */ String STRING_FORMAT_TYPE_ZIP_CODE = "Zip Code"; //$NON-NLS-1$ + + /** design constant: string format type zip code 4 */ String STRING_FORMAT_TYPE_ZIP_CODE_4 = "Zip Code + 4"; //$NON-NLS-1$ + + /** design constant: string format type phone number */ String STRING_FORMAT_TYPE_PHONE_NUMBER = "Phone Number"; //$NON-NLS-1$ + + /** design constant: string format type social security number */ String STRING_FORMAT_TYPE_SOCIAL_SECURITY_NUMBER = "Social Security Number"; //$NON-NLS-1$ - // targetNames + // targetNames + /** design constant: choice target names type */ String CHOICE_TARGET_NAMES_TYPE = "targetNames"; //$NON-NLS-1$ + + /** design constant: target names type blank */ String TARGET_NAMES_TYPE_BLANK = "_blank"; //$NON-NLS-1$ + + /** design constant: target names type self */ String TARGET_NAMES_TYPE_SELF = "_self"; //$NON-NLS-1$ + + /** design constant: target names type parent */ String TARGET_NAMES_TYPE_PARENT = "_parent"; //$NON-NLS-1$ + + /** design constant: target names type top */ String TARGET_NAMES_TYPE_TOP = "_top"; //$NON-NLS-1$ + /** * templateElementType -- the template element type The first constant is the * name of the templateElementType choice set. The followed constants are valid * choice values of the templateElementType. */ - + /** design constant: choice template element type */ String CHOICE_TEMPLATE_ELEMENT_TYPE = "templateElementType"; //$NON-NLS-1$ + + /** design constant: template element type table */ String TEMPLATE_ELEMENT_TYPE_TABLE = "Table"; //$NON-NLS-1$ + + /** design constant: template element type freeform */ String TEMPLATE_ELEMENT_TYPE_FREEFORM = "FreeForm"; //$NON-NLS-1$ + + /** design constant: template element type data */ String TEMPLATE_ELEMENT_TYPE_DATA = "Data"; //$NON-NLS-1$ + + /** design constant: template element type grid */ String TEMPLATE_ELEMENT_TYPE_GRID = "Grid"; //$NON-NLS-1$ + + /** design constant: template element type image */ String TEMPLATE_ELEMENT_TYPE_IMAGE = "Image"; //$NON-NLS-1$ + + /** design constant: template element type label */ String TEMPLATE_ELEMENT_TYPE_LABEL = "Label"; //$NON-NLS-1$ + + /** design constant: template element type list */ String TEMPLATE_ELEMENT_TYPE_LIST = "List"; //$NON-NLS-1$ + + /** design constant: template element type text */ String TEMPLATE_ELEMENT_TYPE_TEXT = "Text"; //$NON-NLS-1$ + + /** design constant: template element type extended item */ String TEMPLATE_ELEMENT_TYPE_EXTENDED_ITEM = "ExtendedItem"; //$NON-NLS-1$ + + /** design constant: template element type text data */ String TEMPLATE_ELEMENT_TYPE_TEXT_DATA = "TextData"; //$NON-NLS-1$ + + /** design constant: template element type data set */ String TEMPLATE_ELEMENT_TYPE_DATA_SET = "DataSet"; //$NON-NLS-1$ + /** * sortType -- the sort type. The first constant is the name of the sortType * choice set. The followed constants are valid choice values of the sortType. */ - + /** design constant: choice sort type */ String CHOICE_SORT_TYPE = "sortType"; //$NON-NLS-1$ + + /** design constant: sort type none */ String SORT_TYPE_NONE = "none"; //$NON-NLS-1$ + + /** design constant: sort type sort on group key */ String SORT_TYPE_SORT_ON_GROUP_KEY = "sort-on-group-key"; //$NON-NLS-1$ + + /** design constant: sort type complex sort */ String SORT_TYPE_COMPLEX_SORT = "complex-sort"; //$NON-NLS-1$ + /** * joinType -- join type of join condition. */ - + /** design constant: choice join type */ String CHOICE_JOIN_TYPE = "joinType"; //$NON-NLS-1$ + + /** design constant: join type inner */ String JOIN_TYPE_INNER = "inner"; //$NON-NLS-1$ + + /** design constant: join type left out */ String JOIN_TYPE_LEFT_OUT = "left-out"; //$NON-NLS-1$ + + /** design constant: join type right out */ String JOIN_TYPE_RIGHT_OUT = "right-out"; //$NON-NLS-1$ + + /** design constant: join type full out */ String JOIN_TYPE_FULL_OUT = "full-out"; //$NON-NLS-1$ + /** * joinOperator -- join operator of join condition. */ - + /** design constant: choice join operator */ String CHOICE_JOIN_OPERATOR = "joinOperator"; //$NON-NLS-1$ + + /** design constant: join operator eqals */ String JOIN_OPERATOR_EQALS = "eq"; //$NON-NLS-1$ + /** * actionTargetFileType -- target type of the linked file */ - + /** design constant: choice action target file type */ String CHOICE_ACTION_TARGET_FILE_TYPE = "actionTargetFileType"; //$NON-NLS-1$ + + /** design constant: action target file type report design */ String ACTION_TARGET_FILE_TYPE_REPORT_DESIGN = "report-design"; //$NON-NLS-1$ + + /** design constant: action target file type report document */ String ACTION_TARGET_FILE_TYPE_REPORT_DOCUMENT = "report-document"; //$NON-NLS-1$ + /** * actionBookmarkType -- target bookmark type */ - + /** design constant: choice action bookmark type */ String CHOICE_ACTION_BOOKMARK_TYPE = "actionBookmarkType"; //$NON-NLS-1$ + + /** design constant: action bookmark type bookmark */ String ACTION_BOOKMARK_TYPE_BOOKMARK = "bookmark"; //$NON-NLS-1$ + + /** design constant: action bookmark type toc */ String ACTION_BOOKMARK_TYPE_TOC = "toc"; //$NON-NLS-1$ + /** * autotextType -- type of auto text */ - + /** design constant: choice auto text type */ String CHOICE_AUTO_TEXT_TYPE = "autoTextType"; //$NON-NLS-1$ + + /** design constant: auto text page number */ String AUTO_TEXT_PAGE_NUMBER = "page-number"; //$NON-NLS-1$ + + /** design constant: auto text total page */ String AUTO_TEXT_TOTAL_PAGE = "total-page"; //$NON-NLS-1$ + + /** design constant: auto text page number unfiltered */ String AUTO_TEXT_PAGE_NUMBER_UNFILTERED = "page-number-unfiltered"; //$NON-NLS-1$ + + /** design constant: auto text total page unfiltered */ String AUTO_TEXT_TOTAL_PAGE_UNFILTERED = "total-page-unfiltered"; //$NON-NLS-1$ + + /** design constant: auto text page variable */ String AUTO_TEXT_PAGE_VARIABLE = "page-variable"; //$NON-NLS-1$ + /** * dataSetMode -- the mode to support data sets. Can be single data set and */ - + /** design constant: choice data set mode type */ String CHOICE_DATA_SET_MODE_TYPE = "dataSetMode"; //$NON-NLS-1$ + + /** design constant: data set mode single */ String DATA_SET_MODE_SINGLE = "single"; //$NON-NLS-1$ + + /** design constant: data set mode multiple */ String DATA_SET_MODE_MULTIPLE = "multiple"; //$NON-NLS-1$ + /** * filterTarget -- filter target type. */ - + /** design constant: choice filter target */ String CHOICE_FILTER_TARGET = "filterTarget"; //$NON-NLS-1$ + + /** design constant: filter target data set */ String FILTER_TARGET_DATA_SET = "DataSet"; //$NON-NLS-1$ + + /** design constant: filter target result set */ String FILTER_TARGET_RESULT_SET = "ResultSet"; //$NON-NLS-1$ + /** * View action --view action type. */ - + /** design constant: choice view action */ String CHOICE_VIEW_ACTION = "viewAction"; //$NON-NLS-1$ + + /** design constant: view action no change */ String VIEW_ACTION_NO_CHANGE = "NoChange"; //$NON-NLS-1$ + + /** design constant: view action changed */ String VIEW_ACTION_CHANGED = "Changed"; //$NON-NLS-1$ + + /** design constant: view action added */ String VIEW_ACTION_ADDED = "Added"; //$NON-NLS-1$ + + /** design constant: view action deleted */ String VIEW_ACTION_DELETED = "Deleted"; //$NON-NLS-1$ + /** * measure Function -- measure function type. */ - + /** design constant: choice aggregation function */ String CHOICE_AGGREGATION_FUNCTION = "aggregationFunction"; //$NON-NLS-1$ + + /** design constant: aggregation function sum */ String AGGREGATION_FUNCTION_SUM = "sum"; //$NON-NLS-1$ + + /** design constant: aggregation function count */ String AGGREGATION_FUNCTION_COUNT = "count"; //$NON-NLS-1$ + + /** design constant: aggregation function min */ String AGGREGATION_FUNCTION_MIN = "min"; //$NON-NLS-1$ + + /** design constant: aggregation function max */ String AGGREGATION_FUNCTION_MAX = "max"; //$NON-NLS-1$ + + /** design constant: aggregation function average */ String AGGREGATION_FUNCTION_AVERAGE = "average"; //$NON-NLS-1$ + + /** design constant: aggregation function weightedavg */ String AGGREGATION_FUNCTION_WEIGHTEDAVG = "weighted-avg"; //$NON-NLS-1$ + + /** design constant: aggregation function stddev */ String AGGREGATION_FUNCTION_STDDEV = "stddev"; //$NON-NLS-1$ + + /** design constant: aggregation function first */ String AGGREGATION_FUNCTION_FIRST = "first"; //$NON-NLS-1$ + + /** design constant: aggregation function last */ String AGGREGATION_FUNCTION_LAST = "last"; //$NON-NLS-1$ + + /** design constant: aggregation function mode */ String AGGREGATION_FUNCTION_MODE = "mode"; //$NON-NLS-1$ + + /** design constant: aggregation function movingave */ String AGGREGATION_FUNCTION_MOVINGAVE = "moving-ave"; //$NON-NLS-1$ + + /** design constant: aggregation function median */ String AGGREGATION_FUNCTION_MEDIAN = "median"; //$NON-NLS-1$ + + /** design constant: aggregation function variance */ String AGGREGATION_FUNCTION_VARIANCE = "variance"; //$NON-NLS-1$ + + /** design constant: aggregation function runningsum */ String AGGREGATION_FUNCTION_RUNNINGSUM = "running-sum"; //$NON-NLS-1$ + + /** design constant: aggregation function irr */ String AGGREGATION_FUNCTION_IRR = "irr"; //$NON-NLS-1$ + + /** design constant: aggregation function mirr */ String AGGREGATION_FUNCTION_MIRR = "mirr"; //$NON-NLS-1$ + + /** design constant: aggregation function npv */ String AGGREGATION_FUNCTION_NPV = "npv"; //$NON-NLS-1$ + + /** design constant: aggregation function runningnpv */ String AGGREGATION_FUNCTION_RUNNINGNPV = "running-npv"; //$NON-NLS-1$ + + /** design constant: aggregation function countdistinct */ String AGGREGATION_FUNCTION_COUNTDISTINCT = "count-distinct"; //$NON-NLS-1$ + + /** design constant: aggregation function runningcount */ String AGGREGATION_FUNCTION_RUNNINGCOUNT = "running-count"; //$NON-NLS-1$ + + /** design constant: aggregation function is top n */ String AGGREGATION_FUNCTION_IS_TOP_N = "is-top-n"; //$NON-NLS-1$ + + /** design constant: aggregation function is bottom n */ String AGGREGATION_FUNCTION_IS_BOTTOM_N = "is-bottom-n"; //$NON-NLS-1$ + + /** design constant: aggregation function is top n percent */ String AGGREGATION_FUNCTION_IS_TOP_N_PERCENT = "is-top-n-percent"; //$NON-NLS-1$ + + /** design constant: aggregation function is bottom n percent */ String AGGREGATION_FUNCTION_IS_BOTTOM_N_PERCENT = "is-bottom-n-percent"; //$NON-NLS-1$ + + /** design constant: aggregation function percent rank */ String AGGREGATION_FUNCTION_PERCENT_RANK = "percent-rank"; //$NON-NLS-1$ + + /** design constant: aggregation function percentile */ String AGGREGATION_FUNCTION_PERCENTILE = "percentile"; //$NON-NLS-1$ + + /** design constant: aggregation function top quartile */ String AGGREGATION_FUNCTION_TOP_QUARTILE = "quartile"; //$NON-NLS-1$ + + /** design constant: aggregation function percent sum */ String AGGREGATION_FUNCTION_PERCENT_SUM = "percent-sum"; //$NON-NLS-1$ + + /** design constant: aggregation function rank */ String AGGREGATION_FUNCTION_RANK = "rank"; //$NON-NLS-1$ + /** * measure Function -- measure function type. */ - + /** design constant: choice measure function */ String CHOICE_MEASURE_FUNCTION = "measureFunction"; //$NON-NLS-1$ + + /** design constant: measure function sum */ String MEASURE_FUNCTION_SUM = AGGREGATION_FUNCTION_SUM; + + /** design constant: measure function count */ String MEASURE_FUNCTION_COUNT = AGGREGATION_FUNCTION_COUNT; + + /** design constant: measure function min */ String MEASURE_FUNCTION_MIN = AGGREGATION_FUNCTION_MIN; + + /** design constant: measure function max */ String MEASURE_FUNCTION_MAX = AGGREGATION_FUNCTION_MAX; + + /** design constant: measure function average */ String MEASURE_FUNCTION_AVERAGE = AGGREGATION_FUNCTION_AVERAGE; + + /** design constant: measure function weightedavg */ String MEASURE_FUNCTION_WEIGHTEDAVG = AGGREGATION_FUNCTION_WEIGHTEDAVG; + + /** design constant: measure function stddev */ String MEASURE_FUNCTION_STDDEV = AGGREGATION_FUNCTION_STDDEV; + + /** design constant: measure function first */ String MEASURE_FUNCTION_FIRST = AGGREGATION_FUNCTION_FIRST; + + /** design constant: measure function last */ String MEASURE_FUNCTION_LAST = AGGREGATION_FUNCTION_LAST; + + /** design constant: measure function mode */ String MEASURE_FUNCTION_MODE = AGGREGATION_FUNCTION_MODE; + + /** design constant: measure function movingave */ String MEASURE_FUNCTION_MOVINGAVE = AGGREGATION_FUNCTION_MOVINGAVE; + + /** design constant: measure function median */ String MEASURE_FUNCTION_MEDIAN = AGGREGATION_FUNCTION_MOVINGAVE; + + /** design constant: measure function variance */ String MEASURE_FUNCTION_VARIANCE = AGGREGATION_FUNCTION_VARIANCE; + + /** design constant: measure function runningsum */ String MEASURE_FUNCTION_RUNNINGSUM = AGGREGATION_FUNCTION_RUNNINGSUM; + + /** design constant: measure function irr */ String MEASURE_FUNCTION_IRR = AGGREGATION_FUNCTION_IRR; + + /** design constant: measure function mirr */ String MEASURE_FUNCTION_MIRR = AGGREGATION_FUNCTION_IRR; + + /** design constant: measure function npv */ String MEASURE_FUNCTION_NPV = AGGREGATION_FUNCTION_NPV; + + /** design constant: measure function runningnpv */ String MEASURE_FUNCTION_RUNNINGNPV = AGGREGATION_FUNCTION_RUNNINGNPV; + + /** design constant: measure function countdistinct */ String MEASURE_FUNCTION_COUNTDISTINCT = AGGREGATION_FUNCTION_COUNTDISTINCT; + + /** design constant: measure function runningcount */ String MEASURE_FUNCTION_RUNNINGCOUNT = AGGREGATION_FUNCTION_RUNNINGCOUNT; + /** * Level type constants. */ + /** design constant: choice level type */ String CHOICE_LEVEL_TYPE = "levelType"; //$NON-NLS-1$ + + /** design constant: level type dynamic */ String LEVEL_TYPE_DYNAMIC = "dynamic"; //$NON-NLS-1$ + + /** design constant: level type mirrored */ String LEVEL_TYPE_MIRRORED = "mirrored"; //$NON-NLS-1$ + /** * measure Function -- measure function type. */ - + /** design constant: choice access permission */ String CHOICE_ACCESS_PERMISSION = "accessPermission"; //$NON-NLS-1$ + + /** design constant: access permission allow */ String ACCESS_PERMISSION_ALLOW = "allow"; //$NON-NLS-1$ + + /** design constant: access permission disallow */ String ACCESS_PERMISSION_DISALLOW = "disallow"; //$NON-NLS-1$ + /** * Parameter sort values -- can be value or display text. */ - + /** design constant: choice param sort values */ String CHOICE_PARAM_SORT_VALUES = "paramSortValues"; //$NON-NLS-1$ + + /** design constant: param sort values value */ String PARAM_SORT_VALUES_VALUE = "value"; //$NON-NLS-1$ + + /** design constant: param sort values label */ String PARAM_SORT_VALUES_LABEL = "label"; //$NON-NLS-1$ + /** * Report layout preference -- layout type for report design. */ + /** design constant: choice report layout preference */ String CHOICE_REPORT_LAYOUT_PREFERENCE = "reportLayoutPreference"; //$NON-NLS-1$ + + /** design constant: report layout preference fixed layout */ String REPORT_LAYOUT_PREFERENCE_FIXED_LAYOUT = "fixed layout"; //$NON-NLS-1$ + + /** design constant: report layout preference auto layout */ String REPORT_LAYOUT_PREFERENCE_AUTO_LAYOUT = "auto layout"; //$NON-NLS-1$ + /** * Date time level type -- type for date-time cube level. */ + /** design constant: choice date time level type */ String CHOICE_DATE_TIME_LEVEL_TYPE = "dateTimeLevelType"; //$NON-NLS-1$ + + /** design constant: date time level type year */ String DATE_TIME_LEVEL_TYPE_YEAR = "year"; //$NON-NLS-1$ + + /** design constant: date time level type month */ String DATE_TIME_LEVEL_TYPE_MONTH = "month"; //$NON-NLS-1$ + + /** design constant: date time level type quarter */ String DATE_TIME_LEVEL_TYPE_QUARTER = "quarter"; //$NON-NLS-1$ + + /** design constant: date time level type week of year */ String DATE_TIME_LEVEL_TYPE_WEEK_OF_YEAR = "week-of-year"; //$NON-NLS-1$ + + /** design constant: date time level type week of quarter */ String DATE_TIME_LEVEL_TYPE_WEEK_OF_QUARTER = "week-of-quarter"; //$NON-NLS-1$ + + /** design constant: date time level type week of month */ String DATE_TIME_LEVEL_TYPE_WEEK_OF_MONTH = "week-of-month"; //$NON-NLS-1$ + + /** design constant: date time level type day of year */ String DATE_TIME_LEVEL_TYPE_DAY_OF_YEAR = "day-of-year"; //$NON-NLS-1$ + + /** design constant: date time level type day of quarter */ String DATE_TIME_LEVEL_TYPE_DAY_OF_QUARTER = "day-of-quarter"; //$NON-NLS-1$ + + /** design constant: date time level type day of month */ String DATE_TIME_LEVEL_TYPE_DAY_OF_MONTH = "day-of-month"; //$NON-NLS-1$ + + /** design constant: date time level type day of week */ String DATE_TIME_LEVEL_TYPE_DAY_OF_WEEK = "day-of-week"; //$NON-NLS-1$ + + /** design constant: date time level type hour */ String DATE_TIME_LEVEL_TYPE_HOUR = "hour"; //$NON-NLS-1$ + + /** design constant: date time level type minute */ String DATE_TIME_LEVEL_TYPE_MINUTE = "minute"; //$NON-NLS-1$ + + /** design constant: date time level type second */ String DATE_TIME_LEVEL_TYPE_SECOND = "second"; //$NON-NLS-1$ + + /** * @deprecated This is replaced by DATE_TIME_LEVEL_TYPE_WEEK_OF_YEAR and * DATE_TIME_LEVEL_TYPE_WEEK_OF_MONTH, and not used anymore. */ @Deprecated + /** design constant: date time level type week */ String DATE_TIME_LEVEL_TYPE_WEEK = "week"; //$NON-NLS-1$ + + /** * @deprecated This is replaced by DATE_TIME_LEVEL_TYPE_DAY_OF_YEAR, * DATE_TIME_LEVEL_TYPE_DAY_OF_MONTH and * DATE_TIME_LEVEL_TYPE_DAY_OF_WEEK, and not used anymore. */ @Deprecated + /** design constant: date time level type day */ String DATE_TIME_LEVEL_TYPE_DAY = "day"; //$NON-NLS-1$ + /** * Scalar parameter type. */ + /** design constant: choice scalar param type */ String CHOICE_SCALAR_PARAM_TYPE = "scalarParamType"; //$NON-NLS-1$ + + /** design constant: scalar param type simple */ String SCALAR_PARAM_TYPE_SIMPLE = "simple"; //$NON-NLS-1$ + + /** design constant: scalar param type multi value */ String SCALAR_PARAM_TYPE_MULTI_VALUE = "multi-value"; //$NON-NLS-1$ + + /** design constant: scalar param type ad hoc */ String SCALAR_PARAM_TYPE_AD_HOC = "ad-hoc"; //$NON-NLS-1$ + /** * Choice constants for direction and orientation */ + /** design constant: choice bidi direction */ String CHOICE_BIDI_DIRECTION = "bidiDirection"; //$NON-NLS-1$ + + /** design constant: bidi direction rtl */ String BIDI_DIRECTION_RTL = "rtl"; //$NON-NLS-1$ + + /** design constant: bidi direction ltr */ String BIDI_DIRECTION_LTR = "ltr"; //$NON-NLS-1$ + /** * Choice constants for scope type. */ + /** design constant: choice scope type */ String CHOICE_SCOPE_TYPE = "scopeType"; //$NON-NLS-1$ + + /** design constant: scope type row */ String SCOPE_TYPE_ROW = "row"; //$NON-NLS-1$ + + /** design constant: scope type col */ String SCOPE_TYPE_COL = "col"; //$NON-NLS-1$ + + /** design constant: scope type rowgroup */ String SCOPE_TYPE_ROWGROUP = "rowgroup"; //$NON-NLS-1$ + + /** design constant: scope type colgroup */ String SCOPE_TYPE_COLGROUP = "colgroup"; //$NON-NLS-1$ + // dynamic filter + /** design constant: choice dynamic filter */ String CHOICE_DYNAMIC_FILTER = "dynamicFilterChoice"; //$NON-NLS-1$ + + /** design constant: dynamic filter simple */ String DYNAMIC_FILTER_SIMPLE = "simple"; //$NON-NLS-1$ + + /** design constant: dynamic filter advanced */ String DYNAMIC_FILTER_ADVANCED = "advanced"; //$NON-NLS-1$ + /** * Choice constants for workMode. - * */ + /** design constant: choice variable type */ String CHOICE_VARIABLE_TYPE = "variableType"; //$NON-NLS-1$ + + /** design constant: variable type report */ String VARIABLE_TYPE_REPORT = "report"; //$NON-NLS-1$ + + /** design constant: variable type page */ String VARIABLE_TYPE_PAGE = "page"; //$NON-NLS-1$ + /** * Choice constants for nullValueOrderingType. */ + /** design constant: choice null value ordering type */ String CHOICE_NULL_VALUE_ORDERING_TYPE = "nullValueOrderingType"; //$NON-NLS-1$ + + /** design constant: null value ordering type unknown */ String NULL_VALUE_ORDERING_TYPE_UNKNOWN = "unknown"; //$NON-NLS-1$ + + /** design constant: null value ordering type nullisfirst */ String NULL_VALUE_ORDERING_TYPE_NULLISFIRST = "nullIsFirst"; //$NON-NLS-1$ + + /** design constant: null value ordering type nullislast */ String NULL_VALUE_ORDERING_TYPE_NULLISLAST = "nullIsLast"; //$NON-NLS-1$ + /** * Choice constants for dataVersion. */ + /** design constant: choice data version */ String CHOICE_DATA_VERSION = "dataVersion"; //$NON-NLS-1$ + + /** design constant: data version transient */ String DATA_VERSION_TRANSIENT = "transient"; //$NON-NLS-1$ + + /** design constant: data version latest */ String DATA_VERSION_LATEST = "latest"; //$NON-NLS-1$ + /** * Choice constants for dataSelector type. */ + /** design constant: choice data selector type */ String CHOICE_DATA_SELECTOR_TYPE = "selectorType"; //$NON-NLS-1$ + + /** design constant: data selector type list */ String DATA_SELECTOR_TYPE_LIST = "list"; //$NON-NLS-1$ + + /** design constant: data selector type dropdown */ String DATA_SELECTOR_TYPE_DROPDOWN = "dropdown";//$NON-NLS-1$ + + /** design constant: data selector type slider */ String DATA_SELECTOR_TYPE_SLIDER = "slider"; //$NON-NLS-1$ + + /** design constant: data selector type check box */ String DATA_SELECTOR_TYPE_CHECK_BOX = "checkBox";//$NON-NLS-1$ + + /** design constant: data selector type radio button */ String DATA_SELECTOR_TYPE_RADIO_BUTTON = "radioButton";//$NON-NLS-1$ + + /** design constant: data selector type text box */ String DATA_SELECTOR_TYPE_TEXT_BOX = "textBox";//$NON-NLS-1$ + + /** design constant: data selector type calendar */ String DATA_SELECTOR_TYPE_CALENDAR = "calendar";//$NON-NLS-1$ + + /** design constant: data selector type current selections */ String DATA_SELECTOR_TYPE_CURRENT_SELECTIONS = "currentSelections";//$NON-NLS-1$ + + /** design constant: data selector type list group */ String DATA_SELECTOR_TYPE_LIST_GROUP = "listGroup";//$NON-NLS-1$ + + /** design constant: data selector type checkboxtree group */ String DATA_SELECTOR_TYPE_CHECKBOXTREE_GROUP = "checkboxtreeGroup";//$NON-NLS-1$ + + /** design constant: data selector type dropdown group */ String DATA_SELECTOR_TYPE_DROPDOWN_GROUP = "dropdownGroup";//$NON-NLS-1$ + /** * Choice constants for thumb type. */ + /** design constant: choice thumb type */ String CHOICE_THUMB_TYPE = "thumbType"; //$NON-NLS-1$ + + /** design constant: thumb type single */ String THUMB_TYPE_SINGLE = "single"; //$NON-NLS-1$ + + /** design constant: thumb type dual */ String THUMB_TYPE_DUAL = "dual";//$NON-NLS-1$ + /** * Choice constants for access type. */ + /** design constant: choice access type */ String CHOICE_ACCESS_TYPE = "accessType"; //$NON-NLS-1$ + + /** design constant: access type transient */ String ACCESS_TYPE_TRANSIENT = "transient"; //$NON-NLS-1$ + + /** design constant: access type specific version */ String ACCESS_TYPE_SPECIFIC_VERSION = "specificVersion"; //$NON-NLS-1$ + + /** design constant: access type latest */ String ACCESS_TYPE_LATEST = "latest"; //$NON-NLS-1$ + /** * Choice constants for overflow. */ + /** design constant: choice overflow */ String CHOICE_OVERFLOW = "overflow"; //$NON-NLS-1$ + + /** design constant: overflow visible */ String OVERFLOW_VISIBLE = "visible"; //$NON-NLS-1$ + + /** design constant: overflow hidden */ String OVERFLOW_HIDDEN = "hidden"; //$NON-NLS-1$ + + /** design constant: overflow scroll */ String OVERFLOW_SCROLL = "scroll"; //$NON-NLS-1$ + + /** design constant: overflow auto */ String OVERFLOW_AUTO = "auto"; //$NON-NLS-1$ + /** * @deprecated Use CHOICE_GADGET_CONTENT_TYPE instead. */ @Deprecated + /** design constant: choice html gadget content type */ String CHOICE_HTML_GADGET_CONTENT_TYPE = "HTMLGadgetContentType"; //$NON-NLS-1$ + + /** * @deprecated Use GADGET_CONTENT_TYPE_HTML instead. */ @Deprecated + /** design constant: html gadget content type html */ String HTML_GADGET_CONTENT_TYPE_HTML = "html"; //$NON-NLS-1$ + + /** * @deprecated Use GADGET_CONTENT_TYPE_URL instead. */ @Deprecated + /** design constant: html gadget content type url */ String HTML_GADGET_CONTENT_TYPE_URL = "url"; //$NON-NLS-1$ + /** design constant: choice gadget content type */ String CHOICE_GADGET_CONTENT_TYPE = "GadgetContentType"; //$NON-NLS-1$ + + /** design constant: gadget content type html */ String GADGET_CONTENT_TYPE_HTML = "html"; //$NON-NLS-1$ + + /** design constant: gadget content type url */ String GADGET_CONTENT_TYPE_URL = "url"; //$NON-NLS-1$ + + /** design constant: gadget content type video */ String GADGET_CONTENT_TYPE_VIDEO = "video"; //$NON-NLS-1$ + + /** design constant: gadget content type videourl */ String GADGET_CONTENT_TYPE_VIDEOURL = "videourl"; //$NON-NLS-1$ + + /** design constant: gadget content type text */ String GADGET_CONTENT_TYPE_TEXT = "text"; //$NON-NLS-1$ + + /** design constant: gadget content type image */ String GADGET_CONTENT_TYPE_IMAGE = "image"; //$NON-NLS-1$ + /** design constant: choice window status */ String CHOICE_WINDOW_STATUS = "windowStatus"; //$NON-NLS-1$ + + /** design constant: window status normal */ String WINDOW_STATUS_NORMAL = "normal"; //$NON-NLS-1$ + + /** design constant: window status maximized */ String WINDOW_STATUS_MAXIMIZED = "maximized"; //$NON-NLS-1$ + /** * Choice constants for reportItemThemeType. */ + /** design constant: choice report item theme type */ String CHOICE_REPORT_ITEM_THEME_TYPE = "reportItemThemeType"; //$NON-NLS-1$ + + /** design constant: report item theme type table */ String REPORT_ITEM_THEME_TYPE_TABLE = "Table"; //$NON-NLS-1$ + + /** design constant: report item theme type list */ String REPORT_ITEM_THEME_TYPE_LIST = "List"; //$NON-NLS-1$ + + /** design constant: report item theme type grid */ String REPORT_ITEM_THEME_TYPE_GRID = "Grid"; //$NON-NLS-1$ + /** * Choice constants for nullsOrdering. */ + /** design constant: choice nulls ordering */ String CHOICE_NULLS_ORDERING = "nullsOrdering"; //$NON-NLS-1$ + + /** design constant: nulls ordering nulls lowest */ String NULLS_ORDERING_NULLS_LOWEST = "nulls lowest"; //$NON-NLS-1$ + + /** design constant: nulls ordering nulls highest */ String NULLS_ORDERING_NULLS_HIGHEST = "nulls highest"; //$NON-NLS-1$ + + /** design constant: nulls ordering exclude nulls */ String NULLS_ORDERING_EXCLUDE_NULLS = "exclude nulls"; //$NON-NLS-1$ + /** design constant: choice filter condition type */ String CHOICE_FILTER_CONDITION_TYPE = "filterConditionType"; //$NON-NLS-1$ + + /** design constant: filter condition type slicer */ String FILTER_CONDITION_TYPE_SLICER = "slicer"; //$NON-NLS-1$ + + /** design constant: filter condition type simple */ String FILTER_CONDITION_TYPE_SIMPLE = "simple"; //$NON-NLS-1$ + /** design constant: choice flyout position */ String CHOICE_FLYOUT_POSITION = "flyoutPosition"; //$NON-NLS-1$ + + /** design constant: flyout position left */ String FLYOUT_POSITION_LEFT = "left"; //$NON-NLS-1$ + + /** design constant: flyout position right */ String FLYOUT_POSITION_RIGHT = "right"; //$NON-NLS-1$ + /** * Choice constants for reference date type. */ + /** design constant: choice reference date type */ String CHOICE_REFERENCE_DATE_TYPE = "referenceDateType"; //$NON-NLS-1$ + + /** design constant: reference date type today */ String REFERENCE_DATE_TYPE_TODAY = "today"; //$NON-NLS-1$ + + /** design constant: reference date type fixed date */ String REFERENCE_DATE_TYPE_FIXED_DATE = "fixedDate"; //$NON-NLS-1$ + + /** design constant: reference date type ending date in dimension */ String REFERENCE_DATE_TYPE_ENDING_DATE_IN_DIMENSION = "endingDateInDimension"; //$NON-NLS-1$ + } diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/simpleapi/IStyle.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/simpleapi/IStyle.java index 3d25391ffaf..4d1bc9df2cc 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/simpleapi/IStyle.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/simpleapi/IStyle.java @@ -54,7 +54,6 @@ public interface IStyle { * * @return the address of the background image as a string */ - String getBackgroundImage(); /** @@ -63,9 +62,24 @@ public interface IStyle { * @param value the new background image address * @throws SemanticException if the property is locked */ - void setBackgroundImage(String value) throws SemanticException; + /** + * Returns the source type of the background image. + * + * @return the source type of the background image as a string + */ + String getBackgroundImageType(); + + /** + * Sets the source type of the background image. The value is a "url" or + * "embed". + * + * @param value the new background image type + * @throws SemanticException if the property is locked + */ + void setBackgroundImageType(String value) throws SemanticException; + /** * Returns the pattern of the repeat for a background image. The return value is * defined in DesignChoiceConstants and can be one of: @@ -1418,7 +1432,7 @@ public interface IStyle { /** * Sets the value of height property. * - * @param value the new height value + * @param height the new height value * @throws SemanticException */ void setHeight(String height) throws SemanticException; @@ -1433,7 +1447,7 @@ public interface IStyle { /** * Sets the value of width property. * - * @param value the new width value + * @param width the new width value * @throws SemanticException */ void setWidth(String width) throws SemanticException; diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IStyleModel.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IStyleModel.java index a6fd82d629d..b4a4627441c 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IStyleModel.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IStyleModel.java @@ -15,83 +15,292 @@ package org.eclipse.birt.report.model.elements.interfaces; /** - * The interface for style element to store the constants. + * The interface for style element to store the constants. The constants + * represents the ROM property names. */ public interface IStyleModel { // Property names: 58 + /** + * Property name: background attachment + */ String BACKGROUND_ATTACHMENT_PROP = "backgroundAttachment"; //$NON-NLS-1$ + /** + * Property name: background color + */ String BACKGROUND_COLOR_PROP = "backgroundColor"; //$NON-NLS-1$ + /** + * Property name: background image + */ String BACKGROUND_IMAGE_PROP = "backgroundImage"; //$NON-NLS-1$ + /** + * Property name: background image source type + */ String BACKGROUND_IMAGE_TYPE_PROP = "backgroundImageType"; //$NON-NLS-1$ + /** + * Property name: background position X + */ String BACKGROUND_POSITION_X_PROP = "backgroundPositionX"; //$NON-NLS-1$ + /** + * Property name: background position Y + */ String BACKGROUND_POSITION_Y_PROP = "backgroundPositionY"; //$NON-NLS-1$ + /** + * Property name: background repeat + */ String BACKGROUND_REPEAT_PROP = "backgroundRepeat"; //$NON-NLS-1$ + /** + * Property name: background size width + */ String BACKGROUND_SIZE_WIDTH = "backgroundSizeWidth"; //$NON-NLS-1$ + /** + * Property name: background size height + */ String BACKGROUND_SIZE_HEIGHT = "backgroundSizeHeight"; //$NON-NLS-1$ + /** + * Property name: border bottom color + */ String BORDER_BOTTOM_COLOR_PROP = "borderBottomColor"; //$NON-NLS-1$ + /** + * Property name: border bottom style + */ String BORDER_BOTTOM_STYLE_PROP = "borderBottomStyle"; //$NON-NLS-1$ + /** + * Property name: border bottom width + */ String BORDER_BOTTOM_WIDTH_PROP = "borderBottomWidth"; //$NON-NLS-1$ + /** + * Property name: border left color + */ String BORDER_LEFT_COLOR_PROP = "borderLeftColor"; //$NON-NLS-1$ + /** + * Property name: border left style + */ String BORDER_LEFT_STYLE_PROP = "borderLeftStyle"; //$NON-NLS-1$ + /** + * Property name: border left width + */ String BORDER_LEFT_WIDTH_PROP = "borderLeftWidth"; //$NON-NLS-1$ + /** + * Property name: border right color + */ String BORDER_RIGHT_COLOR_PROP = "borderRightColor"; //$NON-NLS-1$ + /** + * Property name: border right style + */ String BORDER_RIGHT_STYLE_PROP = "borderRightStyle"; //$NON-NLS-1$ + /** + * Property name: border right width + */ String BORDER_RIGHT_WIDTH_PROP = "borderRightWidth"; //$NON-NLS-1$ + /** + * Property name: border top color + */ String BORDER_TOP_COLOR_PROP = "borderTopColor"; //$NON-NLS-1$ + /** + * Property name: border top style + */ String BORDER_TOP_STYLE_PROP = "borderTopStyle"; //$NON-NLS-1$ + /** + * Property name: border top width + */ String BORDER_TOP_WIDTH_PROP = "borderTopWidth"; //$NON-NLS-1$ + + /** + * Property name: margin bottom + */ String MARGIN_BOTTOM_PROP = "marginBottom"; //$NON-NLS-1$ + /** + * Property name: margin left + */ String MARGIN_LEFT_PROP = "marginLeft"; //$NON-NLS-1$ + /** + * Property name: margin right + */ String MARGIN_RIGHT_PROP = "marginRight"; //$NON-NLS-1$ + /** + * Property name: margin top + */ String MARGIN_TOP_PROP = "marginTop"; //$NON-NLS-1$ + + /** + * Property name: padding top + */ String PADDING_TOP_PROP = "paddingTop"; //$NON-NLS-1$ + /** + * Property name: padding left + */ String PADDING_LEFT_PROP = "paddingLeft"; //$NON-NLS-1$ + /** + * Property name: padding bottom + */ String PADDING_BOTTOM_PROP = "paddingBottom"; //$NON-NLS-1$ + /** + * Property name: padding right + */ String PADDING_RIGHT_PROP = "paddingRight"; //$NON-NLS-1$ + + /** + * Property name: can shrink + */ String CAN_SHRINK_PROP = "canShrink"; //$NON-NLS-1$ + /** + * Property name: color + */ String COLOR_PROP = "color"; //$NON-NLS-1$ + + /** + * Property name: format date time + */ String DATE_TIME_FORMAT_PROP = "dateTimeFormat"; //$NON-NLS-1$ + /** + * Property name: format date + */ String DATE_FORMAT_PROP = "dateFormat"; //$NON-NLS-1$ + /** + * Property name: format time + */ String TIME_FORMAT_PROP = "timeFormat"; //$NON-NLS-1$ + + /** + * Property name: font family + */ String FONT_FAMILY_PROP = "fontFamily"; //$NON-NLS-1$ + /** + * Property name: font size + */ String FONT_SIZE_PROP = "fontSize"; //$NON-NLS-1$ + /** + * Property name: font style + */ String FONT_STYLE_PROP = "fontStyle"; //$NON-NLS-1$ + /** + * Property name: font weight + */ String FONT_WEIGHT_PROP = "fontWeight"; //$NON-NLS-1$ + /** + * Property name: font variant + */ String FONT_VARIANT_PROP = "fontVariant"; //$NON-NLS-1$ + + /** + * Property name: text underline + */ String TEXT_UNDERLINE_PROP = "textUnderline"; //$NON-NLS-1$ + /** + * Property name: text overline + */ String TEXT_OVERLINE_PROP = "textOverline"; //$NON-NLS-1$ + /** + * Property name: text line through + */ String TEXT_LINE_THROUGH_PROP = "textLineThrough"; //$NON-NLS-1$ // public static final String HIGHLIGHT_TEST_EXPR_PROP = // "highlightTestExpr"; //$NON-NLS-1$ + + /** + * Property name: highlight rules + */ String HIGHLIGHT_RULES_PROP = "highlightRules"; //$NON-NLS-1$ + /** + * Property name: map rules + */ String MAP_RULES_PROP = "mapRules"; //$NON-NLS-1$ + /** + * Property name: number format + */ String NUMBER_FORMAT_PROP = "numberFormat"; //$NON-NLS-1$ + /** + * Property name: number align + */ String NUMBER_ALIGN_PROP = "numberAlign"; //$NON-NLS-1$ + /** + * Property name: display + */ String DISPLAY_PROP = "display"; //$NON-NLS-1$ + /** + * Property name: master page + */ String MASTER_PAGE_PROP = "masterPage"; //$NON-NLS-1$ + + /** + * Property name: page break before + */ String PAGE_BREAK_BEFORE_PROP = "pageBreakBefore"; //$NON-NLS-1$ + /** + * Property name: page break after + */ String PAGE_BREAK_AFTER_PROP = "pageBreakAfter"; //$NON-NLS-1$ + /** + * Property name: page break inside + */ String PAGE_BREAK_INSIDE_PROP = "pageBreakInside"; //$NON-NLS-1$ + + /** + * Property name: show if blank + */ String SHOW_IF_BLANK_PROP = "showIfBlank"; //$NON-NLS-1$ + /** + * Property name: string format + */ String STRING_FORMAT_PROP = "stringFormat"; //$NON-NLS-1$ + /** + * Property name: text align + */ String TEXT_ALIGN_PROP = "textAlign"; //$NON-NLS-1$ + /** + * Property name: text indent + */ String TEXT_INDENT_PROP = "textIndent"; //$NON-NLS-1$ + /** + * Property name: letter spacing + */ String LETTER_SPACING_PROP = "letterSpacing"; //$NON-NLS-1$ + /** + * Property name: line height + */ String LINE_HEIGHT_PROP = "lineHeight"; //$NON-NLS-1$ + /** + * Property name: orphans + */ String ORPHANS_PROP = "orphans"; //$NON-NLS-1$ + /** + * Property name: text transform + */ String TEXT_TRANSFORM_PROP = "textTransform"; //$NON-NLS-1$ + /** + * Property name: vertical align + */ String VERTICAL_ALIGN_PROP = "verticalAlign"; //$NON-NLS-1$ + /** + * Property name: white space + */ String WHITE_SPACE_PROP = "whiteSpace"; //$NON-NLS-1$ + /** + * Property name: widows + */ String WIDOWS_PROP = "widows"; //$NON-NLS-1$ + /** + * Property name: word spacing + */ String WORD_SPACING_PROP = "wordSpacing"; //$NON-NLS-1$ - /* + + /** * Bidi text direction property */ String TEXT_DIRECTION_PROP = "bidiTextDirection"; //$NON-NLS-1$ + /** + * Property name: overfow + */ String OVERFLOW_PROP = "overflow"; //$NON-NLS-1$ + /** + * Property name: height + */ String HEIGHT_PROP = "height"; //$NON-NLS-1$ + /** + * Property name: width + */ String WIDTH_PROP = "width"; //$NON-NLS-1$ } diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/simpleapi/Style.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/simpleapi/Style.java index 26a7cb29eda..157a5970faa 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/simpleapi/Style.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/simpleapi/Style.java @@ -19,10 +19,21 @@ import org.eclipse.birt.report.model.api.activity.SemanticException; import org.eclipse.birt.report.model.api.simpleapi.IStyle; +/** + * Definition of the model style + * + * @since 3.3 + * + */ public class Style implements IStyle { private StyleHandle style; + /** + * Constructor + * + * @param style + */ public Style(StyleHandle style) { this.style = style; } @@ -97,6 +108,40 @@ public void setBackgroundImage(String value) throws SemanticException { cmdStack.commit(); } + /* + * (non-Javadoc) + * + * @see org.eclipse.birt.report.engine.script.element.IStyleDesign# + * getBackgroundImageType() + */ + + @Override + public String getBackgroundImageType() { + return style.getBackgroundImageType(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.birt.report.engine.script.element.IStyleDesign# + * setBackgroundImageType(java.lang.String) + */ + + @Override + public void setBackgroundImageType(String value) throws SemanticException { + ActivityStack cmdStack = style.getModule().getActivityStack(); + + cmdStack.startNonUndoableTrans(null); + try { + style.setBackgroundImageType(value); + } catch (SemanticException e) { + cmdStack.rollback(); + throw e; + } + + cmdStack.commit(); + } + /* * (non-Javadoc) * diff --git a/xtab/org.eclipse.birt.report.item.crosstab.core/src/org/eclipse/birt/report/item/crosstab/core/script/internal/StyleInstance.java b/xtab/org.eclipse.birt.report.item.crosstab.core/src/org/eclipse/birt/report/item/crosstab/core/script/internal/StyleInstance.java index b525abc411f..96f562aebf5 100644 --- a/xtab/org.eclipse.birt.report.item.crosstab.core/src/org/eclipse/birt/report/item/crosstab/core/script/internal/StyleInstance.java +++ b/xtab/org.eclipse.birt.report.item.crosstab.core/src/org/eclipse/birt/report/item/crosstab/core/script/internal/StyleInstance.java @@ -28,6 +28,11 @@ public class StyleInstance implements IScriptStyle { private IStyle style; + /** + * Constructor + * + * @param style + */ public StyleInstance(IStyle style) { this.style = style; } @@ -262,6 +267,22 @@ public void setBackgroundImage(String imageURI) { style.setBackgroundImage(imageURI); } + /** + * Get the background image source type + */ + @Override + public String getBackgroundImageType() { + return style.getBackgroundImage(); + } + + /** + * Set the background image source type + */ + @Override + public void setBackgroundImageType(String imageSourceType) { + style.setBackgroundImage(imageSourceType); + } + /** * Get the background repeat type (valid types are REPEAT, REPEAT_X, REPEAT_Y * and NO_REPEAT) @@ -900,6 +921,12 @@ public void setBackgroundPositionY(String y) throws ScriptException { } } + /** + * Get the property + * + * @param index + * @return Return the property + */ public CSSValue getProperty(int index) { return style.getProperty(index); } @@ -908,6 +935,7 @@ public CSSValue getProperty(int index) { * Get the text direction. Valid return types are LTR and RTL. * * @author bidi_hcg + * @return Return the text direction. */ public String getDirection() { return style.getDirection(); @@ -917,6 +945,7 @@ public String getDirection() { * Set the text direction. Valid return types are LTR and RTL. * * @author bidi_hcg + * @param dir */ public void setDirection(String dir) { style.setDirection(dir); From c3b6eb48bdee9f4a1c20cb11bd2af433da73fb06 Mon Sep 17 00:00:00 2001 From: Thomas Gutmann Date: Sun, 22 Jan 2023 18:11:21 +0100 Subject: [PATCH 04/12] Comments added and test comments removed (#1175) --- .../report/designer/util/ImageManager.java | 20 ++++++------------- .../report/engine/css/dom/AbstractStyle.java | 5 ----- .../engine/value/css/BackgroundImageType.java | 2 +- .../nLayout/area/impl/ContainerArea.java | 16 +++++++++++++++ .../area/style/BackgroundImageInfo.java | 8 ++++++++ 5 files changed, 31 insertions(+), 20 deletions(-) diff --git a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java index bc36e32048f..bb513a4a1e6 100644 --- a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java +++ b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java @@ -78,7 +78,7 @@ public static ImageManager getInstance() { * @param uri * @return Return the image */ - public Image getImage(ModuleHandle handle, String uri) { // TG, Module model) { + public Image getImage(ModuleHandle handle, String uri) { return getImage(handle, uri, false); } @@ -115,19 +115,11 @@ private Image getImageFromURL(URL url, boolean refresh) throws IOException { } String key = url.toString(); Image image = null; - /* - * - * if (key.contentEquals(DATA_PROTOCOL)) { String[] imageDataArray = - * key.split(";base64,"); String imageDataBase64 = key.split(";base64,")[1]; - * Decoder decoder = java.util.Base64.getDecoder(); image = new Image(); - * .getInstance(decoder.decode(imageDataBase64)); } else { - * - */ - image = getImageRegistry().get(key); - if (image == null) { - image = loadImage(url); - } -// } + + image = getImageRegistry().get(key); + if (image == null) { + image = loadImage(url); + } if (image == null) { if (!invalidUrlList.contains(url.toString())) { invalidUrlList.add(url.toString()); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java index 4181ccf05c8..63601e78135 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java @@ -1903,11 +1903,6 @@ public void read(DataInputStream in) throws IOException { int index = getPropertyIndex(propertyName); if (index == -1) { String propertyCssText = IOUtil.readString(in); - if (propertyName == "background-image-type") { - - var test = 1; - test = test + 61; - } if (BIRTConstants.BIRT_STRING_FORMAT_PROPERTY.equalsIgnoreCase(propertyName)) { this.setStringFormat(propertyCssText); } else if (BIRTConstants.BIRT_NUMBER_FORMAT_PROPERTY.equalsIgnoreCase(propertyName)) { diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java index 58ff3183e76..51b0a75dd62 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java @@ -21,7 +21,7 @@ /** * class to handle the CSS properties of background image type * - * @since 3.3 + * @since 4.13 * */ public class BackgroundImageType extends IdentifierManager { diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/ContainerArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/ContainerArea.java index 73b77e4c5ca..eb9389eb4d8 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/ContainerArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/ContainerArea.java @@ -1061,10 +1061,26 @@ protected boolean[] resolveBoxConflict(int[] vs, int max) { return conflicted; } + /* + * Get the current design handle + * + * Return the current design handle + * + * @since 4.13 + * + */ protected ReportDesignHandle getCurrentDesignHandle() { return content.getReportContent().getDesign().getReportDesign(); } + /* + * Get the current container module + * + * Return the current container module + * + * @since 4.13 + * + */ protected Module getCurrentModule() { return getCurrentDesignHandle().getModule(); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java index c96a71240ab..5a5b68c37b4 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/style/BackgroundImageInfo.java @@ -84,6 +84,8 @@ public class BackgroundImageInfo extends AreaConstants { * @param rl * @param module * @param sourceType + * + * @since 4.13 */ public BackgroundImageInfo(String url, int repeatedMode, int xOffset, int yOffset, int height, int width, ResourceLocatorWrapper rl, Module module, String sourceType) { @@ -174,6 +176,8 @@ public void setResourceLocator(ResourceLocatorWrapper rl) { /** * Create the data URL of the image + * + * @since 4.13 */ private void createDataUrl() { @@ -423,6 +427,7 @@ public int getRepeatedMode() { * Set the source type of the background image * * @param sourceType String of the image source type + * @since 4.13 */ public void setSourceType(String sourceType) { this.sourceType = sourceType; @@ -432,6 +437,7 @@ public void setSourceType(String sourceType) { * Get the source type of the background image * * @return Returned the source type of the image + * @since 4.13 */ public String getSourceType() { return this.sourceType; @@ -440,6 +446,7 @@ public String getSourceType() { /** * Get the extension of the image file * + * @since 4.13 * @return Returned the extension of the image file */ public String getFileExtension() { @@ -450,6 +457,7 @@ public String getFileExtension() { * Get the image mime type * * @return Returned the image mime type + * @since 4.13 */ public String getMimeType() { return this.mimeType; From 924fb298f6e514e3e80e917c2644719856d64f0c Mon Sep 17 00:00:00 2001 From: Thomas Gutmann Date: Mon, 23 Jan 2023 20:54:44 +0100 Subject: [PATCH 05/12] Correction of comments and typo (#1175) --- .../engine/value/css/BackgroundImageType.java | 4 +- .../nLayout/area/impl/BlockContainerArea.java | 2 +- .../birt/report/model/simpleapi/Style.java | 42 +++++++------------ 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java index 51b0a75dd62..8294679bdf3 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/BackgroundImageType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 Actuate Corporation. + * Copyright (c) 2023 Thomas Gutmann. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -9,7 +9,7 @@ * * * Contributors: - * Actuate Corporation - initial API and implementation + * Thomas Gutmann - initial API and implementation *******************************************************************************/ package org.eclipse.birt.report.engine.css.engine.value.css; diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/BlockContainerArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/BlockContainerArea.java index 4010cf1580e..4246a2a7b19 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/BlockContainerArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/BlockContainerArea.java @@ -41,7 +41,7 @@ public class BlockContainerArea extends ContainerArea implements IContainerArea { /** - * Constuctor + * Constructor * * @param parent * @param context diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/simpleapi/Style.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/simpleapi/Style.java index 157a5970faa..e215cd09070 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/simpleapi/Style.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/simpleapi/Style.java @@ -50,13 +50,11 @@ public String getBackgroundAttachment() { return style.getBackgroundAttachment(); } - /* - * (non-Javadoc) + /** + * Set the attachment handling of the background * - * @seeorg.eclipse.birt.report.engine.script.element.IStyleDesign# - * setBackgroundAttachment(java.lang.String) + * @param value */ - @Override public void setBackgroundAttachment(String value) throws SemanticException { ActivityStack cmdStack = style.getModule().getActivityStack(); @@ -72,27 +70,21 @@ public void setBackgroundAttachment(String value) throws SemanticException { cmdStack.commit(); } - /* - * (non-Javadoc) + /** + * Get the background image source * - * @see - * org.eclipse.birt.report.engine.script.element.IStyleDesign#getBackgroundImage - * () + * @return Return the background image source */ - @Override public String getBackgroundImage() { return style.getBackgroundImage(); } - /* - * (non-Javadoc) + /** + * Set the background image source property * - * @see - * org.eclipse.birt.report.engine.script.element.IStyleDesign#setBackgroundImage - * (java.lang.String) + * @param value */ - @Override public void setBackgroundImage(String value) throws SemanticException { ActivityStack cmdStack = style.getModule().getActivityStack(); @@ -108,25 +100,21 @@ public void setBackgroundImage(String value) throws SemanticException { cmdStack.commit(); } - /* - * (non-Javadoc) + /** + * Get the background image type * - * @see org.eclipse.birt.report.engine.script.element.IStyleDesign# - * getBackgroundImageType() + * @return Return the background image type */ - @Override public String getBackgroundImageType() { return style.getBackgroundImageType(); } - /* - * (non-Javadoc) + /** + * Set the background image type * - * @see org.eclipse.birt.report.engine.script.element.IStyleDesign# - * setBackgroundImageType(java.lang.String) + * @param value */ - @Override public void setBackgroundImageType(String value) throws SemanticException { ActivityStack cmdStack = style.getModule().getActivityStack(); From e031e5322d93734b886caf81b0574c8772cd7105 Mon Sep 17 00:00:00 2001 From: Thomas Gutmann Date: Thu, 2 Mar 2023 22:03:21 +0100 Subject: [PATCH 06/12] Enhancement to add diagonal and antidiagonal to the BIRT border options (#996) --- .../report/designer/nls/messages.properties | 2 + .../util/TableBorderCollisionArbiter.java | 9 + .../ui/views/attributes/page/BordersPage.java | 38 ++- .../BorderColorDescriptorProvider.java | 59 +++-- .../provider/BorderDescriptorProvider.java | 39 +-- .../BorderToggleDescriptorProvider.java | 60 +++++ .../widget/BorderPropertyDescriptor.java | 27 +- .../icons/obj16/border_antidiagonal.gif | Bin 0 -> 106 bytes .../icons/obj16/border_diagonal.gif | Bin 0 -> 106 bytes .../editors/schematic/border/BaseBorder.java | 130 +++++++++- .../editors/schematic/border/BorderUtil.java | 87 ++++++- .../schematic/border/TableBorderHelper.java | 69 ++++- .../editparts/ReportElementEditPart.java | 52 ++++ .../schematic/layer/TableBorderLayer.java | 131 ++++++++-- .../internal/ui/swt/custom/BorderCanvas.java | 118 ++++++++- .../ui/swt/custom/BorderInfomation.java | 2 + .../designer/ui/IReportGraphicConstants.java | 8 + .../designer/ui/ReportPlatformUIImages.java | 9 + .../BIRT all-in-one-MAC.launch | 20 +- .../BIRT all-in-one.launch | 2 +- .../engine/emitter/docx/DocxEmitterImpl.java | 8 +- .../emitter/docx/writer/DocxWriter.java | 10 +- .../emitter/html/HTMLReportEmitter.java | 159 ++++++++---- .../emitter/html/util/DiagonalLineImage.java | 135 ++++++---- .../report/engine/emitter/odp/OdpWriter.java | 19 +- .../report/engine/emitter/ppt/PPTWriter.java | 93 +++++-- .../engine/emitter/pptx/PPTXCanvas.java | 4 +- .../engine/emitter/pptx/TableWriter.java | 42 ++- .../emitter/wpml/AbstractEmitterImpl.java | 161 +++++++++++- .../engine/emitter/wpml/DiagonalLineInfo.java | 189 ++++++++++++-- .../engine/emitter/wpml/DocEmitterImpl.java | 2 +- .../engine/emitter/wpml/IWordWriter.java | 12 +- .../wpml/writer/AbstractWordXmlWriter.java | 104 ++++++-- .../birt/report/engine/api/TOCStyle.java | 115 +++++++++ .../api/script/instance/IScriptStyle.java | 111 ++++++++ .../birt/report/engine/content/IStyle.java | 113 ++++++++ .../engine/content/impl/CellContent.java | 69 +++-- .../report/engine/css/dom/AbstractStyle.java | 98 +++++++ .../engine/BIRTPropertyManagerFactory.java | 19 ++ .../report/engine/css/engine/PerfectHash.java | 21 +- .../engine/css/engine/StyleConstants.java | 26 +- .../css/engine/value/birt/BIRTConstants.java | 34 +++ .../css/engine/value/css/CSSConstants.java | 52 ++++ .../engine/value/css/CSSValueConstants.java | 5 + .../birt/report/engine/ir/CellDesign.java | 17 +- .../layout/emitter/PageDeviceRender.java | 61 ++--- .../engine/nLayout/area/impl/CellArea.java | 5 +- .../report/engine/parser/EngineIRVisitor.java | 8 +- .../internal/instance/StyleInstance.java | 81 ++++++ .../birt/emitters/excel/AreaBorders.java | 77 ++++-- .../birt/emitters/excel/BirtStyle.java | 18 +- .../birt/emitters/excel/StyleManager.java | 135 ++++++---- .../emitters/excel/StyleManagerHUtils.java | 12 +- .../emitters/excel/StyleManagerUtils.java | 78 +++++- .../emitters/excel/StyleManagerXUtils.java | 243 ++++++++++++++---- .../excel/XSSFCellBorderExtended.java | 183 +++++++++++++ .../handlers/AbstractRealTableHandler.java | 9 +- .../handlers/AbstractRealTableRowHandler.java | 9 +- .../excel/handlers/CellContentHandler.java | 39 ++- .../elements/interfaces/IStyleModel.java | 34 ++- .../birt/report/model/elements/rom.def | 54 ++-- .../core/script/internal/StyleInstance.java | 83 +++++- 62 files changed, 3038 insertions(+), 571 deletions(-) create mode 100644 UI/org.eclipse.birt.report.designer.ui/icons/obj16/border_antidiagonal.gif create mode 100644 UI/org.eclipse.birt.report.designer.ui/icons/obj16/border_diagonal.gif create mode 100644 engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/XSSFCellBorderExtended.java diff --git a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/nls/messages.properties b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/nls/messages.properties index 9bbbf0e581f..171d0848842 100644 --- a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/nls/messages.properties +++ b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/nls/messages.properties @@ -312,6 +312,8 @@ BordersPage.Tooltip.Left=Left Border BordersPage.Tooltip.None=None BordersPage.Tooltip.Right=Right Border BordersPage.Tooltip.Top=Top Border +BordersPage.Tooltip.Diagonal=Diagonal +BordersPage.Tooltip.Antidiagonal=Antidiagonal BordersPage.text.Preview=Preview: BordersPage.Trans.SelectBorder=Select Border BordersPage.Trans.UnSelectBorder=Unselect Border diff --git a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/TableBorderCollisionArbiter.java b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/TableBorderCollisionArbiter.java index 4cab9245c0f..7f033491925 100644 --- a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/TableBorderCollisionArbiter.java +++ b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/TableBorderCollisionArbiter.java @@ -39,6 +39,15 @@ public static void refreshBorderData(int[] data, int style, int width, int color * always lose; then compare the width, greater win; if width is equal, compare * the style, less win; or keep the original. This is the part 1 of the * algorithm. + * + * @param data border data array + * @param style border style of cell + * @param width border width of cell + * @param color border color of cell + * @param rowIndex row index cell + * @param colIndex column index of cell + * @param type 0, 1 type of bottom-, top-attribute from row or cell (0: row, + * 1: cell) */ public static void refreshBorderData(int[] data, int style, int width, int color, int rowIndex, int colIndex, int type) { diff --git a/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/page/BordersPage.java b/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/page/BordersPage.java index 499f4805336..ac3a611fbd4 100644 --- a/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/page/BordersPage.java +++ b/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/page/BordersPage.java @@ -14,14 +14,17 @@ package org.eclipse.birt.report.designer.internal.ui.views.attributes.page; +import java.util.List; + import org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.BorderColorDescriptorProvider; import org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.BorderStyleDescriptorProvider; import org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.BorderToggleDescriptorProvider; import org.eclipse.birt.report.designer.internal.ui.views.attributes.provider.BorderWidthDescriptorProvider; import org.eclipse.birt.report.designer.internal.ui.views.attributes.section.BorderSection; import org.eclipse.birt.report.designer.nls.Messages; -import org.eclipse.birt.report.model.api.StyleHandle; +import org.eclipse.birt.report.model.api.CellHandle; import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; +import org.eclipse.birt.report.model.elements.interfaces.IStyleModel; import org.eclipse.swt.widgets.Composite; /** @@ -41,7 +44,7 @@ public class BordersPage extends ResetAttributePage { @Override public void buildUI(Composite parent) { super.buildUI(parent); - container.setLayout(WidgetUtil.createGridLayout(1, 15)); + container.setLayout(org.eclipse.birt.report.designer.internal.ui.util.WidgetUtil.createGridLayout(1, 15)); // BorderStyleDescriptorProvider styleProvider = new // BorderStyleDescriptorProvider( ); @@ -86,18 +89,25 @@ public void buildUI(Composite parent) { // BorderDescriptorProvider[]{ // styleProvider, colorProvider, widthProvider // }; - // - providers = new BorderToggleDescriptorProvider[] { - new BorderToggleDescriptorProvider(StyleHandle.BORDER_TOP_STYLE_PROP), - new BorderToggleDescriptorProvider(StyleHandle.BORDER_BOTTOM_STYLE_PROP), - new BorderToggleDescriptorProvider(StyleHandle.BORDER_LEFT_STYLE_PROP), - new BorderToggleDescriptorProvider(StyleHandle.BORDER_RIGHT_STYLE_PROP) }; - // - // TogglesSection borderSection = new TogglesSection( container, - // LABEL_BORDER ); - // borderSection.setProviders( providers ); - // borderSection.setGridPlaceholder( 4, true ); - // addSection( PageSectionId.BORDERS_BORDER_STYLE, borderSection ); + + // diagonal and antidiagonal buttons only added on cell object (cell handle) + if (input != null && ((List) input).size() >= 1 && ((List) input).get(0) instanceof CellHandle) { + providers = new BorderToggleDescriptorProvider[] { + new BorderToggleDescriptorProvider(IStyleModel.BORDER_TOP_STYLE_PROP), + new BorderToggleDescriptorProvider(IStyleModel.BORDER_BOTTOM_STYLE_PROP), + new BorderToggleDescriptorProvider(IStyleModel.BORDER_LEFT_STYLE_PROP), + new BorderToggleDescriptorProvider(IStyleModel.BORDER_RIGHT_STYLE_PROP), + new BorderToggleDescriptorProvider(IStyleModel.BORDER_DIAGONAL_STYLE_PROP), + new BorderToggleDescriptorProvider(IStyleModel.BORDER_ANTIDIAGONAL_STYLE_PROP) + }; + + } else { + providers = new BorderToggleDescriptorProvider[] { + new BorderToggleDescriptorProvider(IStyleModel.BORDER_TOP_STYLE_PROP), + new BorderToggleDescriptorProvider(IStyleModel.BORDER_BOTTOM_STYLE_PROP), + new BorderToggleDescriptorProvider(IStyleModel.BORDER_LEFT_STYLE_PROP), + new BorderToggleDescriptorProvider(IStyleModel.BORDER_RIGHT_STYLE_PROP) }; + } borderSection = new BorderSection(LABEL_BORDER, container, true); BorderStyleDescriptorProvider styleProvider = new BorderStyleDescriptorProvider(); diff --git a/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/provider/BorderColorDescriptorProvider.java b/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/provider/BorderColorDescriptorProvider.java index a8205102d14..d9e6f4cf32f 100644 --- a/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/provider/BorderColorDescriptorProvider.java +++ b/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/provider/BorderColorDescriptorProvider.java @@ -19,6 +19,7 @@ import org.eclipse.birt.report.model.api.activity.SemanticException; import org.eclipse.birt.report.model.api.elements.ReportDesignConstants; import org.eclipse.birt.report.model.api.metadata.IChoiceSet; +import org.eclipse.birt.report.model.elements.interfaces.IStyleModel; public class BorderColorDescriptorProvider extends BorderDescriptorProvider { @@ -40,28 +41,42 @@ public String getDisplayName() { @Override public Object load() { - String value = getLocalStringValue(StyleHandle.BORDER_LEFT_COLOR_PROP); + String value = getLocalStringValue(IStyleModel.BORDER_LEFT_COLOR_PROP); if (!"".equals(value)) //$NON-NLS-1$ { this.indexText = value; return value; } - value = getLocalStringValue(StyleHandle.BORDER_RIGHT_COLOR_PROP); + value = getLocalStringValue(IStyleModel.BORDER_RIGHT_COLOR_PROP); if (!"".equals(value)) //$NON-NLS-1$ { this.indexText = value; return value; } - value = getLocalStringValue(StyleHandle.BORDER_TOP_COLOR_PROP); + value = getLocalStringValue(IStyleModel.BORDER_TOP_COLOR_PROP); if (!"".equals(value)) //$NON-NLS-1$ { this.indexText = value; return value; } - value = getLocalStringValue(StyleHandle.BORDER_BOTTOM_COLOR_PROP); + value = getLocalStringValue(IStyleModel.BORDER_BOTTOM_COLOR_PROP); + if (!"".equals(value)) //$NON-NLS-1$ + { + this.indexText = value; + return value; + } + + value = getLocalStringValue(IStyleModel.BORDER_DIAGONAL_COLOR_PROP); + if (!"".equals(value)) //$NON-NLS-1$ + { + this.indexText = value; + return value; + } + + value = getLocalStringValue(IStyleModel.BORDER_ANTIDIAGONAL_COLOR_PROP); if (!"".equals(value)) //$NON-NLS-1$ { this.indexText = value; @@ -79,28 +94,40 @@ public void setIndex(Object index) { @Override public void save(Object value) throws SemanticException { this.indexText = value == null ? "" : value; //$NON-NLS-1$ - if (((Boolean) styleMap.get(StyleHandle.BORDER_TOP_STYLE_PROP)).booleanValue()) { - save(StyleHandle.BORDER_TOP_COLOR_PROP, value); + if ((styleMap.get(IStyleModel.BORDER_TOP_STYLE_PROP)).booleanValue()) { + save(IStyleModel.BORDER_TOP_COLOR_PROP, value); + } else { + save(IStyleModel.BORDER_TOP_COLOR_PROP, null); + } + + if ((styleMap.get(IStyleModel.BORDER_BOTTOM_STYLE_PROP)).booleanValue()) { + save(IStyleModel.BORDER_BOTTOM_COLOR_PROP, value); + } else { + save(IStyleModel.BORDER_BOTTOM_COLOR_PROP, null); + } + + if ((styleMap.get(IStyleModel.BORDER_LEFT_STYLE_PROP)).booleanValue()) { + save(IStyleModel.BORDER_LEFT_COLOR_PROP, value); } else { - save(StyleHandle.BORDER_TOP_COLOR_PROP, null); + save(IStyleModel.BORDER_LEFT_COLOR_PROP, null); } - if (((Boolean) styleMap.get(StyleHandle.BORDER_BOTTOM_STYLE_PROP)).booleanValue()) { - save(StyleHandle.BORDER_BOTTOM_COLOR_PROP, value); + if ((styleMap.get(IStyleModel.BORDER_RIGHT_STYLE_PROP)).booleanValue()) { + save(IStyleModel.BORDER_RIGHT_COLOR_PROP, value); } else { - save(StyleHandle.BORDER_BOTTOM_COLOR_PROP, null); + save(IStyleModel.BORDER_RIGHT_COLOR_PROP, null); } - if (((Boolean) styleMap.get(StyleHandle.BORDER_LEFT_STYLE_PROP)).booleanValue()) { - save(StyleHandle.BORDER_LEFT_COLOR_PROP, value); + if ((styleMap.get(IStyleModel.BORDER_DIAGONAL_STYLE_PROP)).booleanValue()) { + save(IStyleModel.BORDER_DIAGONAL_COLOR_PROP, value); } else { - save(StyleHandle.BORDER_LEFT_COLOR_PROP, null); + save(IStyleModel.BORDER_DIAGONAL_COLOR_PROP, null); } - if (((Boolean) styleMap.get(StyleHandle.BORDER_RIGHT_STYLE_PROP)).booleanValue()) { - save(StyleHandle.BORDER_RIGHT_COLOR_PROP, value); + if (styleMap.get(IStyleModel.BORDER_ANTIDIAGONAL_STYLE_PROP).booleanValue()) { + save(IStyleModel.BORDER_ANTIDIAGONAL_COLOR_PROP, value); } else { - save(StyleHandle.BORDER_RIGHT_COLOR_PROP, null); + save(IStyleModel.BORDER_ANTIDIAGONAL_COLOR_PROP, null); } } diff --git a/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/provider/BorderDescriptorProvider.java b/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/provider/BorderDescriptorProvider.java index 8b6b864d724..719f0f783d7 100644 --- a/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/provider/BorderDescriptorProvider.java +++ b/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/provider/BorderDescriptorProvider.java @@ -19,20 +19,22 @@ import org.eclipse.birt.report.designer.util.DEUtil; import org.eclipse.birt.report.model.api.GroupElementHandle; import org.eclipse.birt.report.model.api.GroupPropertyHandle; -import org.eclipse.birt.report.model.api.StyleHandle; import org.eclipse.birt.report.model.api.activity.SemanticException; +import org.eclipse.birt.report.model.elements.interfaces.IStyleModel; public abstract class BorderDescriptorProvider extends AbstractDescriptorProvider { protected Object input; - protected HashMap styleMap = new HashMap(); + protected HashMap styleMap = new HashMap(); public BorderDescriptorProvider() { - styleMap.put(StyleHandle.BORDER_LEFT_STYLE_PROP, Boolean.FALSE); - styleMap.put(StyleHandle.BORDER_RIGHT_STYLE_PROP, Boolean.FALSE); - styleMap.put(StyleHandle.BORDER_TOP_STYLE_PROP, Boolean.FALSE); - styleMap.put(StyleHandle.BORDER_BOTTOM_STYLE_PROP, Boolean.FALSE); + styleMap.put(IStyleModel.BORDER_LEFT_STYLE_PROP, Boolean.FALSE); + styleMap.put(IStyleModel.BORDER_RIGHT_STYLE_PROP, Boolean.FALSE); + styleMap.put(IStyleModel.BORDER_TOP_STYLE_PROP, Boolean.FALSE); + styleMap.put(IStyleModel.BORDER_BOTTOM_STYLE_PROP, Boolean.FALSE); + styleMap.put(IStyleModel.BORDER_DIAGONAL_STYLE_PROP, Boolean.FALSE); + styleMap.put(IStyleModel.BORDER_ANTIDIAGONAL_STYLE_PROP, Boolean.FALSE); } public void setStyleProperty(String style, Boolean value) { @@ -47,7 +49,7 @@ public void setInput(Object input) { protected String getLocalStringValue(String property) { GroupElementHandle handle = null; if (input instanceof List) { - handle = DEUtil.getGroupElementHandle((List) input); + handle = DEUtil.getGroupElementHandle((List) input); } if (handle == null) { return ""; //$NON-NLS-1$ @@ -64,7 +66,7 @@ protected String getLocalStringValue(String property) { protected String getStringValue(String property) { GroupElementHandle handle = null; if (input instanceof List) { - handle = DEUtil.getGroupElementHandle((List) input); + handle = DEUtil.getGroupElementHandle((List) input); } if (handle == null) { return ""; //$NON-NLS-1$ @@ -81,26 +83,28 @@ protected String getStringValue(String property) { protected String getDisplayValue(String property) { GroupElementHandle handle = null; if (input instanceof List) { - handle = DEUtil.getGroupElementHandle((List) input); + handle = DEUtil.getGroupElementHandle((List) input); } if (handle == null) { return ""; //$NON-NLS-1$ } if (getLocalStringValue(property).equals("")) { - String value = handle.getPropertyHandle(property).getStringValue(); - if (value == null) { - value = ""; //$NON-NLS-1$ + String value = ""; + if (handle.getPropertyHandle(property) != null) { + value = handle.getPropertyHandle(property).getStringValue(); + if (value == null) { + value = ""; //$NON-NLS-1$ + } } return value; - } else { - return ""; //$NON-NLS-1$ } + return ""; //$NON-NLS-1$ } protected String getDefaultStringValue(String property) { GroupElementHandle handle = null; if (input instanceof List) { - handle = DEUtil.getGroupElementHandle((List) input); + handle = DEUtil.getGroupElementHandle((List) input); } if (handle == null) { return ""; //$NON-NLS-1$ @@ -113,9 +117,8 @@ protected String getDefaultStringValue(String property) { value = ""; //$NON-NLS-1$ } return value; - } else { - return ""; //$NON-NLS-1$ } + return ""; //$NON-NLS-1$ } protected void save(String property, Object value) throws SemanticException { @@ -124,7 +127,7 @@ protected void save(String property, Object value) throws SemanticException { if (input instanceof GroupElementHandle) { groupElementHandle = (GroupElementHandle) input; } else if (input instanceof List) { - groupElementHandle = DEUtil.getGroupElementHandle((List) input); + groupElementHandle = DEUtil.getGroupElementHandle((List) input); } if (groupElementHandle != null) { diff --git a/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/provider/BorderToggleDescriptorProvider.java b/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/provider/BorderToggleDescriptorProvider.java index 820e9cb5643..df27d7e0057 100644 --- a/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/provider/BorderToggleDescriptorProvider.java +++ b/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/provider/BorderToggleDescriptorProvider.java @@ -38,6 +38,12 @@ public String getPosition() { if (property.equals(StyleHandle.BORDER_BOTTOM_STYLE_PROP)) { return BorderInfomation.BORDER_BOTTOM; } + if (property.equals(StyleHandle.BORDER_DIAGONAL_STYLE_PROP)) { + return BorderInfomation.BORDER_DIAGONAL; + } + if (property.equals(StyleHandle.BORDER_ANTIDIAGONAL_STYLE_PROP)) { + return BorderInfomation.BORDER_ANTIDIAGONAL; + } return null; } @@ -59,6 +65,12 @@ public String getImageName() { if (property.equals(StyleHandle.BORDER_BOTTOM_STYLE_PROP)) { return IReportGraphicConstants.ICON_ATTRIBUTE_BORDER_BOTTOM; } + if (property.equals(StyleHandle.BORDER_DIAGONAL_STYLE_PROP)) { + return IReportGraphicConstants.ICON_ATTRIBUTE_BORDER_DIAGONAL; + } + if (property.equals(StyleHandle.BORDER_ANTIDIAGONAL_STYLE_PROP)) { + return IReportGraphicConstants.ICON_ATTRIBUTE_BORDER_ANTIDIAGONAL; + } return ""; //$NON-NLS-1$ } @@ -81,6 +93,12 @@ public String getTooltipText() { if (property.equals(StyleHandle.BORDER_BOTTOM_STYLE_PROP)) { return Messages.getString("BordersPage.Tooltip.Bottom"); //$NON-NLS-1$ } + if (property.equals(StyleHandle.BORDER_DIAGONAL_STYLE_PROP)) { + return Messages.getString("BordersPage.Tooltip.Diagonal"); //$NON-NLS-1$ + } + if (property.equals(StyleHandle.BORDER_ANTIDIAGONAL_STYLE_PROP)) { + return Messages.getString("BordersPage.Tooltip.Antidiagonal"); //$NON-NLS-1$ + } return ""; //$NON-NLS-1$ } @@ -113,6 +131,7 @@ public Object load() { info.setInheritedStyle(getDisplayValue(StyleHandle.BORDER_LEFT_STYLE_PROP)); info.setInheritedWidth(getDisplayValue(StyleHandle.BORDER_LEFT_WIDTH_PROP)); info.setInheritedColor(convertToRGB(getDisplayValue(StyleHandle.BORDER_LEFT_COLOR_PROP))); + } else if (property.equals(StyleHandle.BORDER_RIGHT_STYLE_PROP)) { info.setPosition(BorderInfomation.BORDER_RIGHT); info.setStyle(getLocalStringValue(StyleHandle.BORDER_RIGHT_STYLE_PROP)); @@ -136,6 +155,7 @@ public Object load() { info.setInheritedStyle(getDisplayValue(StyleHandle.BORDER_TOP_STYLE_PROP)); info.setInheritedWidth(getDisplayValue(StyleHandle.BORDER_TOP_WIDTH_PROP)); info.setInheritedColor(convertToRGB(getDisplayValue(StyleHandle.BORDER_TOP_COLOR_PROP))); + } else if (property.equals(StyleHandle.BORDER_BOTTOM_STYLE_PROP)) { info.setPosition(BorderInfomation.BORDER_BOTTOM); info.setStyle(getLocalStringValue(StyleHandle.BORDER_BOTTOM_STYLE_PROP)); @@ -147,6 +167,30 @@ public Object load() { info.setInheritedStyle(getDisplayValue(StyleHandle.BORDER_BOTTOM_STYLE_PROP)); info.setInheritedWidth(getDisplayValue(StyleHandle.BORDER_BOTTOM_WIDTH_PROP)); info.setInheritedColor(convertToRGB(getDisplayValue(StyleHandle.BORDER_BOTTOM_COLOR_PROP))); + + } else if (property.equals(StyleHandle.BORDER_DIAGONAL_STYLE_PROP)) { + info.setPosition(BorderInfomation.BORDER_DIAGONAL); + info.setStyle(getLocalStringValue(StyleHandle.BORDER_DIAGONAL_STYLE_PROP)); + info.setWidth(getLocalStringValue(StyleHandle.BORDER_DIAGONAL_WIDTH_PROP)); + info.setColor(convertToRGB(getLocalStringValue(StyleHandle.BORDER_DIAGONAL_COLOR_PROP))); + info.setDefaultStyle(getDefaultStringValue(StyleHandle.BORDER_DIAGONAL_STYLE_PROP)); + info.setDefaultWidth(getDefaultStringValue(StyleHandle.BORDER_DIAGONAL_WIDTH_PROP)); + info.setDefaultColor(convertToRGB(getDefaultStringValue(StyleHandle.BORDER_DIAGONAL_COLOR_PROP))); + info.setInheritedStyle(getDisplayValue(StyleHandle.BORDER_DIAGONAL_STYLE_PROP)); + info.setInheritedWidth(getDisplayValue(StyleHandle.BORDER_DIAGONAL_WIDTH_PROP)); + info.setInheritedColor(convertToRGB(getDisplayValue(StyleHandle.BORDER_DIAGONAL_COLOR_PROP))); + + } else if (property.equals(StyleHandle.BORDER_ANTIDIAGONAL_STYLE_PROP)) { + info.setPosition(BorderInfomation.BORDER_ANTIDIAGONAL); + info.setStyle(getLocalStringValue(StyleHandle.BORDER_ANTIDIAGONAL_STYLE_PROP)); + info.setWidth(getLocalStringValue(StyleHandle.BORDER_ANTIDIAGONAL_WIDTH_PROP)); + info.setColor(convertToRGB(getLocalStringValue(StyleHandle.BORDER_ANTIDIAGONAL_COLOR_PROP))); + info.setDefaultStyle(getDefaultStringValue(StyleHandle.BORDER_ANTIDIAGONAL_STYLE_PROP)); + info.setDefaultWidth(getDefaultStringValue(StyleHandle.BORDER_ANTIDIAGONAL_WIDTH_PROP)); + info.setDefaultColor(convertToRGB(getDefaultStringValue(StyleHandle.BORDER_ANTIDIAGONAL_COLOR_PROP))); + info.setInheritedStyle(getDisplayValue(StyleHandle.BORDER_ANTIDIAGONAL_STYLE_PROP)); + info.setInheritedWidth(getDisplayValue(StyleHandle.BORDER_ANTIDIAGONAL_WIDTH_PROP)); + info.setInheritedColor(convertToRGB(getDisplayValue(StyleHandle.BORDER_ANTIDIAGONAL_COLOR_PROP))); } return info; } @@ -181,6 +225,14 @@ public void save(Object value) throws SemanticException { save(StyleHandle.BORDER_RIGHT_STYLE_PROP, info.getOriginStyle()); save(StyleHandle.BORDER_RIGHT_COLOR_PROP, color); save(StyleHandle.BORDER_RIGHT_WIDTH_PROP, info.getOriginWidth()); + } else if (info.getPosition().equals(BorderInfomation.BORDER_DIAGONAL)) { + save(StyleHandle.BORDER_DIAGONAL_STYLE_PROP, info.getOriginStyle()); + save(StyleHandle.BORDER_DIAGONAL_COLOR_PROP, color); + save(StyleHandle.BORDER_DIAGONAL_WIDTH_PROP, info.getOriginWidth()); + } else if (info.getPosition().equals(BorderInfomation.BORDER_ANTIDIAGONAL)) { + save(StyleHandle.BORDER_ANTIDIAGONAL_STYLE_PROP, info.getOriginStyle()); + save(StyleHandle.BORDER_ANTIDIAGONAL_COLOR_PROP, color); + save(StyleHandle.BORDER_ANTIDIAGONAL_WIDTH_PROP, info.getOriginWidth()); } } @@ -209,6 +261,14 @@ public void reset() throws SemanticException { save(StyleHandle.BORDER_RIGHT_STYLE_PROP, null); save(StyleHandle.BORDER_RIGHT_COLOR_PROP, null); save(StyleHandle.BORDER_RIGHT_WIDTH_PROP, null); + } else if (getPosition().equals(BorderInfomation.BORDER_DIAGONAL)) { + save(StyleHandle.BORDER_DIAGONAL_STYLE_PROP, null); + save(StyleHandle.BORDER_DIAGONAL_COLOR_PROP, null); + save(StyleHandle.BORDER_DIAGONAL_WIDTH_PROP, null); + } else if (getPosition().equals(BorderInfomation.BORDER_ANTIDIAGONAL)) { + save(StyleHandle.BORDER_ANTIDIAGONAL_STYLE_PROP, null); + save(StyleHandle.BORDER_ANTIDIAGONAL_COLOR_PROP, null); + save(StyleHandle.BORDER_ANTIDIAGONAL_WIDTH_PROP, null); } } diff --git a/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/widget/BorderPropertyDescriptor.java b/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/widget/BorderPropertyDescriptor.java index 8743c904109..69510c98316 100644 --- a/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/widget/BorderPropertyDescriptor.java +++ b/UI/org.eclipse.birt.report.designer.ui.views/src/org/eclipse/birt/report/designer/internal/ui/views/attributes/widget/BorderPropertyDescriptor.java @@ -201,6 +201,11 @@ public void widgetSelected(SelectionEvent e) { // } for (int i = 0; i < toggleProviders.length; i++) { BorderInfomation oldInfo = (BorderInfomation) toggleProviders[i].load(); + + if (oldInfo.getPosition().equals(BorderInfomation.BORDER_DIAGONAL) + || oldInfo.getPosition().equals(BorderInfomation.BORDER_ANTIDIAGONAL)) { + continue; + } BorderInfomation information = new BorderInfomation(); information.setPosition(toggleProviders[i].getPosition()); information.setColor(selectedColor); @@ -230,6 +235,11 @@ public void widgetSelected(SelectionEvent e) { boolean reset = true; for (int i = 0; i < toggleProviders.length; i++) { BorderInfomation info = (BorderInfomation) toggleProviders[i].load(); + if (info.getPosition().equals(BorderInfomation.BORDER_DIAGONAL) + || info.getPosition().equals(BorderInfomation.BORDER_ANTIDIAGONAL)) { + continue; + } + oldColor = info.getOriginColor(); selectedColor = builder.getRGB(); // if ( oldColor == null ) @@ -270,6 +280,10 @@ public void widgetSelected(SelectionEvent e) { for (int i = 0; i < toggleProviders.length; i++) { BorderInfomation oldInfo = (BorderInfomation) toggleProviders[i].load(); + if (oldInfo.getPosition().equals(BorderInfomation.BORDER_DIAGONAL) + || oldInfo.getPosition().equals(BorderInfomation.BORDER_ANTIDIAGONAL)) { + continue; + } BorderInfomation information = new BorderInfomation(); information.setPosition(toggleProviders[i].getPosition()); information.setColor(builder.getRGB()); @@ -407,15 +421,16 @@ public void refreshColor(RGB rgb) { @Override public void load() { - // for ( int i = toggleProviders.length - 1; i >= 0; i-- ) for (int i = 0; i < toggleProviders.length; i++) { BorderInfomation info = (BorderInfomation) toggleProviders[i].load(); previewCanvas.setBorderInfomation(info); - if (!info.getStyle().equals("") && !DesignChoiceConstants.LINE_STYLE_NONE.equals(info.getStyle())) //$NON-NLS-1$ - { - toggles[i].setSelection(true); - } else { - toggles[i].setSelection(false); + if (info.getStyle() != null) { + if (!info.getStyle().equals("") && !DesignChoiceConstants.LINE_STYLE_NONE.equals(info.getStyle())) //$NON-NLS-1$ + { + toggles[i].setSelection(true); + } else { + toggles[i].setSelection(false); + } } } previewCanvas.redraw(); diff --git a/UI/org.eclipse.birt.report.designer.ui/icons/obj16/border_antidiagonal.gif b/UI/org.eclipse.birt.report.designer.ui/icons/obj16/border_antidiagonal.gif new file mode 100644 index 0000000000000000000000000000000000000000..d8fc97ca3edd41854902bc211a91123e3a62bd1b GIT binary patch literal 106 zcmZ?wbhEHb6krfw_{74%pq*wMnwHiuGp*qa0}@dD$->IOz`~#d5(BAaVAl88b;pY3 ylt=S!7K6sl*13yJ6OuJ!%&lG)>7{Otd%D}w_}ERA$>s7)=^9H~`cAMgSOWkk;vKaB literal 0 HcmV?d00001 diff --git a/UI/org.eclipse.birt.report.designer.ui/icons/obj16/border_diagonal.gif b/UI/org.eclipse.birt.report.designer.ui/icons/obj16/border_diagonal.gif new file mode 100644 index 0000000000000000000000000000000000000000..963687516c7d6489141ae2cb0898ed3b2c7737c2 GIT binary patch literal 106 zcmZ?wbhEHb6krfw_{7R!tewUXnr0lDmew#ct>Fv<3@H9&VP#-oWzYc$fYdTD>qqRm zqt$vuQ=41Qf5GX3h~+h0&pjenEbQJnVb-k!J*Uey6`9NEo{~SAzC%#5zm styleMap = new HashMap<>(); private static final HashMap widthMap = new HashMap<>(); @@ -227,7 +261,7 @@ protected int getBorderWidth(Object obj) { /** * Convenient method to return the specified border style directly. * - * @return + * @return Return the specified border style directly. */ public int getLeftBorderStyle() { return getBorderStyle(leftStyle); @@ -236,7 +270,7 @@ public int getLeftBorderStyle() { /** * Convenient method to return the specified border style directly. * - * @return + * @return Return the specified border style directly. */ public int getRightBorderStyle() { return getBorderStyle(rightStyle); @@ -245,7 +279,7 @@ public int getRightBorderStyle() { /** * Convenient method to return the specified border style directly. * - * @return + * @return Return the specified border style directly. */ public int getTopBorderStyle() { return getBorderStyle(topStyle); @@ -254,7 +288,7 @@ public int getTopBorderStyle() { /** * Convenient method to return the specified border style directly. * - * @return + * @return Return the specified border style directly. */ public int getBottomBorderStyle() { return getBorderStyle(bottomStyle); @@ -263,7 +297,7 @@ public int getBottomBorderStyle() { /** * Convenient method to return the specified border width directly. * - * @return + * @return Return the specified border width directly. */ public int getLeftBorderWidth() { return getBorderWidth(leftWidth); @@ -272,7 +306,7 @@ public int getLeftBorderWidth() { /** * Convenient method to return the specified border width directly. * - * @return + * @return Return the specified border width directly. */ public int getRightBorderWidth() { return getBorderWidth(rightWidth); @@ -281,7 +315,7 @@ public int getRightBorderWidth() { /** * Convenient method to return the specified border width directly. * - * @return + * @return Return the specified border width directly. */ public int getTopBorderWidth() { return getBorderWidth(topWidth); @@ -290,7 +324,7 @@ public int getTopBorderWidth() { /** * Convenient method to return the specified border width directly. * - * @return + * @return Return the specified border width directly. */ public int getBottomBorderWidth() { return getBorderWidth(bottomWidth); @@ -299,7 +333,7 @@ public int getBottomBorderWidth() { /** * Convenient method to return the specified border color directly. * - * @return + * @return Return the specified border color directly. */ public int getLeftBorderColor() { // return ColorUtil.parseColor( leftColor ); @@ -309,7 +343,7 @@ public int getLeftBorderColor() { /** * Convenient method to return the specified border color directly. * - * @return + * @return Return the specified border color directly. */ public int getRightBorderColor() { // return ColorUtil.parseColor( rightColor ); @@ -319,7 +353,7 @@ public int getRightBorderColor() { /** * Convenient method to return the specified border color directly. * - * @return + * @return Return the specified border color directly. */ public int getTopBorderColor() { // return ColorUtil.parseColor( topColor ); @@ -329,11 +363,83 @@ public int getTopBorderColor() { /** * Convenient method to return the specified border color directly. * - * @return + * @return Return the specified border color directly. */ public int getBottomBorderColor() { // return ColorUtil.parseColor( bottomColor ); return bottomColor; } + /** + * Convenient method to return the specified border style directly. + * + * @return Return the specified border style directly. + */ + public int getDiagonalNumber() { + return diagonalNumber; + } + + /** + * Convenient method to return the specified border style directly. + * + * @return Return the specified border style directly. + */ + public int getDiagonalStyle() { + return getBorderStyle(diagonalStyle); + } + + /** + * Convenient method to return the specified border width directly. + * + * @return Return the specified border width directly. + */ + public int getDiagonalWidth() { + return getBorderWidth(diagonalWidth); + } + + /** + * Convenient method to return the specified border color directly. + * + * @return Return the specified border color directly. + */ + public int getDiagonalColor() { + return diagonalColor; + } + + /** + * Convenient method to return the specified border style directly. + * + * @return Return the specified border style directly. + */ + public int getAntidiagonalNumber() { + return antidiagonalNumber; + } + + /** + * Convenient method to return the specified border style directly. + * + * @return Return the specified border style directly. + */ + public int getAntidiagonalStyle() { + return getBorderStyle(antidiagonalStyle); + } + + /** + * Convenient method to return the specified border width directly. + * + * @return Return the specified border width directly. + */ + public int getAntidiagonalWidth() { + return getBorderWidth(antidiagonalWidth); + } + + /** + * Convenient method to return the specified border color directly. + * + * @return Return the specified border color directly. + */ + public int getAntidiagonalColor() { + return antidiagonalColor; + } + } diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/border/BorderUtil.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/border/BorderUtil.java index 17e298cb9e4..fff3cc7f610 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/border/BorderUtil.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/border/BorderUtil.java @@ -44,6 +44,14 @@ public class BorderUtil { * Position constant for Right border. */ public static final int RIGHT = 3; + /** + * Position constant for Diagonal. + */ + public static final int DIAGONAL = 4; + /** + * Position constant for Antidiagonal. + */ + public static final int ANTIDIAGONAL = 5; /** * Width constant for default border line. @@ -72,7 +80,6 @@ private static int getGap(int x, int y, int i) { /** * Draws a double style line. * - * @param figure * @param g * @param side * @param width the border width array, arranged by {top, bottom, left, right}; @@ -114,7 +121,6 @@ public static void drawDoubleLine(Graphics g, int side, int[] width, Rectangle r /** * Draws a default grayed line. * - * @param figure * @param g * @param side * @param r @@ -126,7 +132,6 @@ public static void drawDefaultLine(Graphics g, int side, Rectangle r) { /** * Convenient version, set actualWidth=-1, startPos=0. * - * @param figure * @param g * @param side * @param style @@ -140,7 +145,6 @@ public static void drawSingleLine(Graphics g, int side, int style, int[] width, /** * Draws a single style line. * - * @param figure * @param g * @param side * @param style @@ -154,6 +158,11 @@ public static void drawSingleLine(Graphics g, int side, int style, int[] width, */ private static void drawSingleLine(Graphics g, int side, int style, int[] width, int actualWidth, int startPos, Rectangle r) { + + // diagonal & antidiagonal: double line unsupported, set style to solid + if ((side == DIAGONAL || side == ANTIDIAGONAL) && style < 0) { + style = 1; + } g.setLineStyle(style); Rectangle oldClip = g.getClip(new Rectangle()); @@ -234,6 +243,76 @@ private static void drawSingleLine(Graphics g, int side, int style, int[] width, g.setClip(oldClip); } break; + case DIAGONAL: + if (actualWidth < 0) { + actualWidth = width[0]; + } + g.setLineWidth(actualWidth); + + clip.width = 0; + clip.height = 0; + clip.x = r.x - 10 + 10; + clip.y = r.y; + p2.x = r.x + r.width + 20 - 20; + p2.y = r.y + r.height; + // gap correction + if (actualWidth >= 6) { + p2.x = p2.x - 2; + p2.y = p2.y - 2; + } + clip.union(p2); + g.clipRect(clip); + + int dP1x = clip.x; + int dP1y = clip.y; + int dP2x = p2.x; + int dP2y = p2.y; + // default corrections + dP1x = dP1x + 0; + dP1y = dP1y + 1; // - 1 + dP2x = dP2x - 2; + if (actualWidth >= 6) { + dP2y = dP2y + 1; + } else { + dP2y = dP2y - 2; + } + g.drawLine(dP1x, dP1y, dP2x, dP2y); + g.setClip(oldClip); + + break; + case ANTIDIAGONAL: + if (actualWidth < 0) { + actualWidth = width[0]; + } + g.setLineWidth(actualWidth); + clip.width = 0; + clip.height = 0; + clip.x = r.x; + clip.y = r.y; + p2.x = r.x + r.width; + p2.y = r.y + r.height; + // gap correction + if (actualWidth >= 6) { + p2.x = p2.x - 2; + p2.y = p2.y + 2; + } else { + p2.y = p2.y + 3; + } + clip.union(p2); + g.clipRect(clip); + + int adP1x = r.x; + int adP1y = r.y + r.height; + int adP2x = p2.x; + int adP2y = p2.y - r.height;// + 2; + // default corrections + adP1x = adP1x + 0; + adP1y = adP1y - 2; + adP2x = adP2x + 0; + adP2y = adP2y - 2; + g.drawLine(adP1x, adP1y, adP2x, adP2y); + g.setClip(oldClip); + break; } g.setClip(oldClip); diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/border/TableBorderHelper.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/border/TableBorderHelper.java index 9433cf93565..03d88f6a5ea 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/border/TableBorderHelper.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/border/TableBorderHelper.java @@ -14,6 +14,7 @@ package org.eclipse.birt.report.designer.internal.ui.editors.schematic.border; +import java.util.HashMap; import java.util.Iterator; import org.eclipse.birt.report.designer.internal.ui.layout.ITableLayoutCell; @@ -33,11 +34,16 @@ public class TableBorderHelper { /** * Use to store all actual border drawing data, array size: - * [2*colCount*rowCount+colCount+rowCount][5], the last dimension arranged as: - * [style][width][color][rowIndex][colIndex], index is Zero-based. + * [2*colCount*rowCount+colCount+rowCount][7], the last dimension arranged as: + * [style][width][color][rowIndex][colIndex][type][diagonals], index is + * Zero-based. */ private int[][] borderData; + private HashMap diagonalData = new HashMap<>(); + + private HashMap antidiagonalData = new HashMap<>(); + /** * The constructor. * @@ -57,7 +63,7 @@ private void initialize() { heights = new int[colCount][rowCount + 1]; widths = new int[rowCount][colCount + 1]; - borderData = new int[2 * colCount * rowCount + colCount + rowCount][6]; + borderData = new int[2 * colCount * rowCount + colCount + rowCount][7]; // initialize all index data as -1. for (int i = 0; i < rowCount; i++) { @@ -99,7 +105,7 @@ private void initialize() { } // initialize all other border data. - for (Iterator itr = owner.getChildren().iterator(); itr.hasNext();) { + for (Iterator itr = owner.getChildren().iterator(); itr.hasNext();) { ITableLayoutCell cellPart = (ITableLayoutCell) itr.next(); int rowIndex = cellPart.getRowNumber(); @@ -128,14 +134,30 @@ private void initialize() { int rightWidth = border.getRightBorderWidth(); int rightColor = border.getRightBorderColor(); + int diagonaltNumber = border.getDiagonalNumber(); + int diagonaltStyle = border.getDiagonalStyle(); + int diagonalWidth = border.getDiagonalWidth(); + int diagonalColor = border.getDiagonalColor(); + + int antidiagonaltNumber = border.getAntidiagonalNumber(); + int antidiagonaltStyle = border.getAntidiagonalStyle(); + int antidiagonalWidth = border.getAntidiagonalWidth(); + int antidiagonalColor = border.getAntidiagonalColor(); + + // diagonal, antidiagonal: line data + int[] diagonal = { diagonaltNumber, diagonaltStyle, diagonalWidth, diagonalColor }; + int[] antidiagonal = { antidiagonaltNumber, antidiagonaltStyle, antidiagonalWidth, antidiagonalColor }; + for (int i = 0; i < colSpan; i++) { // update border data using collision arbiter. + int topIndex = (rowIndex - 1) * (2 * colCount + 1) + colIndex - 1 + i; TableBorderCollisionArbiter.refreshBorderData( - borderData[(rowIndex - 1) * (2 * colCount + 1) + colIndex - 1 + i], topStyle, topWidth, + borderData[topIndex], topStyle, topWidth, topColor, rowIndex - 1, colIndex - 1 + i, topFrom); + int bottomIndex = (rowIndex + rowSpan - 1) * (2 * colCount + 1) + colIndex - 1 + i; TableBorderCollisionArbiter.refreshBorderData( - borderData[(rowIndex + rowSpan - 1) * (2 * colCount + 1) + colIndex - 1 + i], bottomStyle, + borderData[bottomIndex], bottomStyle, bottomWidth, bottomColor, rowIndex - 1 + rowSpan - 1, colIndex - 1 + i, bottomFrom); // update border insets data. @@ -146,12 +168,18 @@ private void initialize() { for (int i = 0; i < rowSpan; i++) { // update border data using collision arbiter. + int leftIndex = (rowIndex - 1 + i) * (2 * colCount + 1) + colCount + colIndex - 1; TableBorderCollisionArbiter.refreshBorderData( - borderData[(rowIndex - 1 + i) * (2 * colCount + 1) + colCount + colIndex - 1], leftStyle, + borderData[leftIndex], leftStyle, leftWidth, leftColor, rowIndex - 1 + i, colIndex - 1); + // left index to be used like key of diagonal list + diagonalData.put(leftIndex, diagonal); + antidiagonalData.put(leftIndex, antidiagonal); + + int rightIndex = (rowIndex - 1 + i) * (2 * colCount + 1) + colCount + colIndex + colSpan - 1; TableBorderCollisionArbiter.refreshBorderData( - borderData[(rowIndex - 1 + i) * (2 * colCount + 1) + colCount + colIndex + colSpan - 1], + borderData[rightIndex], rightStyle, rightWidth, rightColor, rowIndex - 1 + i, colIndex - 1 + colSpan - 1); // update border insets data. @@ -231,7 +259,7 @@ public void updateCellBorderInsets() { int rowCount = owner.getRowCount(); int colCount = owner.getColumnCount(); - for (Iterator itr = owner.getChildren().iterator(); itr.hasNext();) { + for (Iterator itr = owner.getChildren().iterator(); itr.hasNext();) { ITableLayoutCell cellPart = (ITableLayoutCell) itr.next(); int rowIndex = cellPart.getRowNumber(); @@ -384,7 +412,8 @@ public void updateCellBorderInsets() { /** * Returns the actual border drawing data. especially for TableBorderLayer. * - * @return + * @return Returns the actual border drawing data. especially for + * TableBorderLayer */ public int[][] getBorderData() { if (borderData == null) { @@ -394,4 +423,24 @@ public int[][] getBorderData() { return borderData; } + /** + * Returns the diagonal drawing data. especially for TableBorderLayer. + * + * @return Returns the diagonal drawing data. especially for TableBorderLayer. + * @sine 4.13 + */ + public HashMap getDiagonalData() { + return diagonalData; + } + + /** + * Returns the antidiagonal drawing data. especially for TableBorderLayer. + * + * @return Returns the antidiagonal drawing data. especially for + * TableBorderLayer. + * @sine 4.13 + */ + public HashMap getAntidiagonalData() { + return antidiagonalData; + } } diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java index ee5154d8a1c..234b96432df 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/ReportElementEditPart.java @@ -839,6 +839,8 @@ protected void updateBaseBorder(DesignElementHandle handle, BaseBorder border) { updateTopBorder(handle, border); updateLeftBorder(handle, border); updateRightBorder(handle, border); + updateDiagonalBorder(handle, border); + updateAntidiagonalBorder(handle, border); } protected void updateBottomBorder(DesignElementHandle handle, BaseBorder border) { @@ -866,6 +868,56 @@ protected void updateRightBorder(DesignElementHandle handle, BaseBorder border) border.rightWidth = handle.getPropertyHandle(IStyleModel.BORDER_RIGHT_WIDTH_PROP).getStringValue(); } + protected void updateDiagonalBorder(DesignElementHandle handle, BaseBorder border) { + border.diagonalNumber = 0; + border.diagonalColor = 0; + border.diagonalStyle = null; + border.diagonalWidth = null; + + if (handle.getPropertyHandle(IStyleModel.BORDER_DIAGONAL_NUMBER_PROP) != null) { + border.diagonalNumber = handle.getPropertyHandle(IStyleModel.BORDER_DIAGONAL_NUMBER_PROP).getIntValue(); + } + if (border.diagonalNumber > 0) { + if (handle.getPropertyHandle(IStyleModel.BORDER_DIAGONAL_COLOR_PROP) != null) { + border.diagonalColor = handle.getPropertyHandle(IStyleModel.BORDER_DIAGONAL_COLOR_PROP).getIntValue(); + } + if (handle.getPropertyHandle(IStyleModel.BORDER_DIAGONAL_STYLE_PROP) != null) { + border.diagonalStyle = handle.getPropertyHandle(IStyleModel.BORDER_DIAGONAL_STYLE_PROP) + .getStringValue(); + } + if (handle.getPropertyHandle(IStyleModel.BORDER_DIAGONAL_WIDTH_PROP) != null) { + border.diagonalWidth = handle.getPropertyHandle(IStyleModel.BORDER_DIAGONAL_WIDTH_PROP) + .getStringValue(); + } + } + } + + protected void updateAntidiagonalBorder(DesignElementHandle handle, BaseBorder border) { + border.antidiagonalNumber = 0; + border.antidiagonalColor = 0; + border.antidiagonalStyle = null; + border.antidiagonalWidth = null; + + if (handle.getPropertyHandle(IStyleModel.BORDER_ANTIDIAGONAL_NUMBER_PROP) != null) { + border.antidiagonalNumber = handle.getPropertyHandle(IStyleModel.BORDER_ANTIDIAGONAL_NUMBER_PROP) + .getIntValue(); + } + if (border.antidiagonalNumber > 0) { + if (handle.getPropertyHandle(IStyleModel.BORDER_ANTIDIAGONAL_COLOR_PROP) != null) { + border.antidiagonalColor = handle.getPropertyHandle(IStyleModel.BORDER_ANTIDIAGONAL_COLOR_PROP) + .getIntValue(); + } + if (handle.getPropertyHandle(IStyleModel.BORDER_ANTIDIAGONAL_STYLE_PROP) != null) { + border.antidiagonalStyle = handle.getPropertyHandle(IStyleModel.BORDER_ANTIDIAGONAL_STYLE_PROP) + .getStringValue(); + } + if (handle.getPropertyHandle(IStyleModel.BORDER_ANTIDIAGONAL_WIDTH_PROP) != null) { + border.antidiagonalWidth = handle.getPropertyHandle(IStyleModel.BORDER_ANTIDIAGONAL_WIDTH_PROP) + .getStringValue(); + } + } + } + protected void refreshBorder(DesignElementHandle handle, BaseBorder border) { updateBaseBorder(handle, border); diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/layer/TableBorderLayer.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/layer/TableBorderLayer.java index c7df608c7c0..49778081c27 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/layer/TableBorderLayer.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/layer/TableBorderLayer.java @@ -14,6 +14,8 @@ package org.eclipse.birt.report.designer.internal.ui.editors.schematic.layer; +import java.util.HashMap; + import org.eclipse.birt.report.designer.internal.ui.editors.ReportColorConstants; import org.eclipse.birt.report.designer.internal.ui.editors.schematic.border.BorderUtil; import org.eclipse.birt.report.designer.internal.ui.editors.schematic.border.TableBorderHelper; @@ -45,6 +47,10 @@ public class TableBorderLayer extends FreeformLayer { */ private int[][] borderData; + private HashMap diagonalData; + + private HashMap antidiagonalData; + /** * The constructor. * @@ -72,8 +78,20 @@ protected void paintFigure(Graphics graphics) { return; } + /** + * store all actual border drawing data, array size: + * [2*colCount*rowCount+colCount+rowCount][6], the last dimension arranged as: + * [style][width][color][rowIndex][colIndex][type] + */ borderData = helper.getBorderData(); + /** + * store all diagonal drawing data, array size: [style][width][color] + */ + diagonalData = helper.getDiagonalData(); + antidiagonalData = helper.getAntidiagonalData(); + rowCount = source.getRowCount(); colCount = source.getColumnCount(); @@ -97,9 +115,15 @@ protected void paintFigure(Graphics graphics) { // Only need to draw the right/bottom edge for single line // pattern. + // systematic of parameters + // graphics, i = rowIndex, j = colIndex, x = colPos-Left, y = rowPos-Top + // w = visWidth, h = visHeight, borderData = border information + + int[] diagonal = diagonalData.get(leftIndex); + int[] antidiagonal = antidiagonalData.get(leftIndex); // if ( j < colCount - 1 ) if (j == 0) { - drawLeft(graphics, i, j, x, y, w, h, borderData[leftIndex]); + drawLeft(graphics, i, j, x, y, h, borderData[leftIndex]); } drawRight(graphics, i, j, x, y, w, h, borderData[rightIndex]); @@ -111,10 +135,60 @@ protected void paintFigure(Graphics graphics) { drawBottom(graphics, i, j, x, y, w, h, borderData[bottomIndex]); + if (diagonal != null && diagonal[0] > 0) { + Rectangle rDiagonal = new Rectangle(x, y, w, h); + drawDiagonal(graphics, rDiagonal, diagonal); + } + + if (antidiagonal != null && antidiagonal[0] > 0) { + Rectangle rAntidiagonal = new Rectangle(x, y, w, h); + drawAntidiagonal(graphics, rAntidiagonal, antidiagonal); + } } } } + /** + * Draw the diagonal line of the designer cell + * + * @param g graphic object to be used for drawing + * @param rLeft drawn rectangle of left border for calculation base + * @param rTop drawn rectangle of top border for calculation base + * @param data [number][style][width][color] + * @sine 4.13 + */ + private void drawDiagonal(Graphics g, Rectangle rDiagonal, int[] data) { + // data: number, style, width, color + int style = data[1]; + int[] widths = { data[2] }; + + if (data[1] != 0) { + g.setForegroundColor(ColorManager.getColor(data[3])); + BorderUtil.drawSingleLine(g, BorderUtil.DIAGONAL, style, widths, rDiagonal); + } + } + + /** + * Draw the antidiagonal line of the designer cell + * + * @param g graphic object to be used for drawing + * @param rLeft drawn rectangle of left border for calculation base + * @param rTop drawn rectangle of top border for calculation base + * @param data [number][style][width][color] + * + * @sine 4.13 + */ + private void drawAntidiagonal(Graphics g, Rectangle antidiagonal, int[] data) { + // data: number, style, width, color + int style = data[1]; + int[] widths = { data[2] }; + + if (data[1] != 0) { + g.setForegroundColor(ColorManager.getColor(data[3])); + BorderUtil.drawSingleLine(g, BorderUtil.ANTIDIAGONAL, style, widths, antidiagonal); + } + } + private int caleVisualWidth(int columnIndex) { IFigure figure = source.getLayer(LayerConstants.PRIMARY_LAYER); TableLayout.WorkingData data = (TableLayout.WorkingData) figure.getLayoutManager().getConstraint(figure); @@ -150,9 +224,9 @@ private int caleVisualHeight(int rowIndex) { * @param colIndex * @param data [style][width][color][rowIndex][colIndex]. */ - private void drawBottom(Graphics g, int rowIndex, int colIndex, int x, int y, int w, int h, int[] data) { + private Rectangle drawBottom(Graphics g, int rowIndex, int colIndex, int x, int y, int w, int h, int[] data) { if (data[0] == 0 && data[1] == 0) { - return; + return null; } int nLeftWidth = 0; @@ -325,6 +399,7 @@ private void drawBottom(Graphics g, int rowIndex, int colIndex, int x, int y, in g.setForegroundColor(ReportColorConstants.ShadowLineColor); BorderUtil.drawDefaultLine(g, direction, r); } + return r; } /** @@ -333,9 +408,9 @@ private void drawBottom(Graphics g, int rowIndex, int colIndex, int x, int y, in * @param colIndex * @param data [style][width][color][rowIndex][colIndex]. */ - private void drawRight(Graphics g, int rowIndex, int colIndex, int x, int y, int w, int h, int[] data) { + private Rectangle drawRight(Graphics g, int rowIndex, int colIndex, int x, int y, int w, int h, int[] data) { if (data[0] == 0 && data[1] == 0) { - return; + return null; } int nTopWidth = 0; @@ -508,6 +583,7 @@ private void drawRight(Graphics g, int rowIndex, int colIndex, int x, int y, int g.setForegroundColor(ReportColorConstants.ShadowLineColor); BorderUtil.drawDefaultLine(g, direction, r); } + return r; } /** @@ -516,9 +592,9 @@ private void drawRight(Graphics g, int rowIndex, int colIndex, int x, int y, int * @param colIndex * @param data [style][width][color][rowIndex][colIndex]. */ - private void drawTop(Graphics g, int rowIndex, int colIndex, int x, int y, int w, int h, int[] data) { + private Rectangle drawTop(Graphics g, int rowIndex, int colIndex, int x, int y, int w, int h, int[] data) { if (data[0] == 0 && data[1] == 0) { - return; + return null; } int nLeftWidth = 0; @@ -683,25 +759,29 @@ private void drawTop(Graphics g, int rowIndex, int colIndex, int x, int y, int w r.y = y; } - if (data[0] != 0) { - g.setForegroundColor(ColorManager.getColor(data[2])); - BorderUtil.drawBorderLine(g, direction, data[0], widths, r); - } else if (data[1] > 0) { - // draw default border; - g.setForegroundColor(ReportColorConstants.ShadowLineColor); - BorderUtil.drawDefaultLine(g, direction, r); + if (g != null) { + if (data[0] != 0) { + g.setForegroundColor(ColorManager.getColor(data[2])); + // graphic, direction TBLR-DA, style, width, rectangle + BorderUtil.drawBorderLine(g, direction, data[0], widths, r); + } else if (data[1] > 0) { + // draw default border; + g.setForegroundColor(ReportColorConstants.ShadowLineColor); + BorderUtil.drawDefaultLine(g, direction, r); + } } + return r; } /** * @param g * @param rowIndex * @param colIndex - * @param data [style][width][color][rowIndex][colIndex]. + * @param data [style][width][color][rowIndex][colIndex][type] */ - private void drawLeft(Graphics g, int rowIndex, int colIndex, int x, int y, int w, int h, int[] data) { + private Rectangle drawLeft(Graphics g, int rowIndex, int colIndex, int x, int y, int h, int[] data) { if (data[0] == 0 && data[1] == 0) { - return; + return null; } int nTopWidth = 0; @@ -866,13 +946,16 @@ private void drawLeft(Graphics g, int rowIndex, int colIndex, int x, int y, int r.x = x; } - if (data[0] != 0) { - g.setForegroundColor(ColorManager.getColor(data[2])); - BorderUtil.drawBorderLine(g, direction, data[0], widths, r); - } else if (data[1] > 0) { - // draw default border; - g.setForegroundColor(ReportColorConstants.ShadowLineColor); - BorderUtil.drawDefaultLine(g, direction, r); + if (g != null) { + if (data[0] != 0) { + g.setForegroundColor(ColorManager.getColor(data[2])); + BorderUtil.drawBorderLine(g, direction, data[0], widths, r); + } else if (data[1] > 0) { + // draw default border; + g.setForegroundColor(ReportColorConstants.ShadowLineColor); + BorderUtil.drawDefaultLine(g, direction, r); + } } + return r; } } diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/swt/custom/BorderCanvas.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/swt/custom/BorderCanvas.java index af2cddd6e38..93b70a64a2c 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/swt/custom/BorderCanvas.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/swt/custom/BorderCanvas.java @@ -18,7 +18,7 @@ import org.eclipse.birt.report.designer.nls.Messages; import org.eclipse.birt.report.designer.util.ColorManager; import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; -import org.eclipse.birt.report.model.api.metadata.DimensionValue; +import org.eclipse.birt.report.model.api.util.StringUtil; import org.eclipse.draw2d.ColorConstants; import org.eclipse.swt.SWT; import org.eclipse.swt.events.MouseAdapter; @@ -37,12 +37,24 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; +/** + * Class to draw the border preview canvas + * + * @since 3.3 + * + */ public class BorderCanvas extends Canvas { private static final String INHERITED = Messages.getString("BorderCanvas.Label.Inherited"); //$NON-NLS-1$ private boolean mouseIn = false; private int mouseInArea = SWT.NONE; + /** + * Constructore of border canvas + * + * @param parent container to be used for the canvas + * @param style styling of the canvas + */ public BorderCanvas(Composite parent, int style) { super(parent, SWT.NONE); @@ -117,6 +129,11 @@ public void mouseUp(MouseEvent e) { private SortMap borderInfoMap = new SortMap(); + /** + * Set the border information for the preview + * + * @param info object with border information + */ public void setBorderInfomation(BorderInfomation info) { borderInfoMap.put(info.getPosition(), info); } @@ -184,8 +201,8 @@ protected void paintControl(PaintEvent e) { && !DesignChoiceConstants.LINE_WIDTH_THICK.equals(infoWidth) && infoWidth != null) // $NON-NLS-1$ { try { - customWidth = (int) DimensionValue.parse(infoWidth).getMeasure(); - if (DimensionValue.parse(infoWidth).getUnits().equals(DesignChoiceConstants.UNITS_PX)) { + customWidth = (int) StringUtil.parse(infoWidth).getMeasure(); + if (StringUtil.parse(infoWidth).getUnits().equals(DesignChoiceConstants.UNITS_PX)) { if (customWidth % 3 == 0) { gcWidth = gcSeperator = gcInnerWidth = customWidth / 3; } else if (customWidth % 3 == 1) { @@ -220,6 +237,14 @@ protected void paintControl(PaintEvent e) { gc.drawLine((width - 100) / 2, (height - 100) / 2 + 100 - gc.getLineWidth() / 2 + 1, (width - 100) / 2 + 100 + 1, (height - 100) / 2 + 100 - gc.getLineWidth() / 2 + 1); + } else if (info.getPosition().equals(BorderInfomation.BORDER_DIAGONAL)) { + gc.drawLine((width - 100) / 2, (height - 100) / 2 + gc.getLineWidth() / 2, + (width - 100) / 2 + 100 + 1, (height - 100) / 2 + 100 - gc.getLineWidth() / 2 + 1); + + } else if (info.getPosition().equals(BorderInfomation.BORDER_ANTIDIAGONAL)) { + gc.drawLine((width - 100) / 2, (height - 100) / 2 + 100 - gc.getLineWidth() / 2 + 1, + (width - 100) / 2 + 100 + 1, (height - 100) / 2 + gc.getLineWidth() / 2); + } gc.setLineWidth(gcInnerWidth); @@ -247,8 +272,19 @@ protected void paintControl(PaintEvent e) { (width - 100) / 2 + 100 - (gcWidth + gcSeperator), (height - 100) / 2 + 100 - (gcWidth + gcSeperator) - gc.getLineWidth() / 2); - } + } else if (info.getPosition().equals(BorderInfomation.BORDER_DIAGONAL)) { + gc.drawLine((width - 100) / 2 + (gcWidth + gcSeperator), + (height - 100) / 2 + (gcWidth + gcSeperator) + gc.getLineWidth() / 2, + (width - 100) / 2 + 100 - (gcWidth + gcSeperator), + (height - 100) / 2 + 100 - (gcWidth + gcSeperator) - gc.getLineWidth() / 2); + + } else if (info.getPosition().equals(BorderInfomation.BORDER_ANTIDIAGONAL)) { + gc.drawLine((width - 100) / 2 + (gcWidth + gcSeperator), + (height - 100) / 2 + 100 - (gcWidth + gcSeperator) - gc.getLineWidth() / 2, + (width - 100) / 2 + 100 - (gcWidth + gcSeperator), + (height - 100) / 2 + (gcWidth + gcSeperator) + gc.getLineWidth() / 2); + } } else if (customWidth == 3 || DesignChoiceConstants.LINE_WIDTH_THICK.equals(info.getWidth())) { gc.setLineWidth(1); @@ -278,6 +314,19 @@ protected void paintControl(PaintEvent e) { gc.drawLine((width - 100) / 2 + 2, (height - 100) / 2 + 100 - 2, (width - 100) / 2 + 100 - 2, (height - 100) / 2 + 100 - 2); + } else if (info.getPosition().equals(BorderInfomation.BORDER_DIAGONAL)) { + gc.drawLine((width - 100) / 2, (height - 100) / 2, (width - 100) / 2 + 100, + (height - 100) / 2 + 100); + + gc.drawLine((width - 100) / 2 + 2, (height - 100) / 2 + 2, (width - 100) / 2 + 100 - 2, + (height - 100) / 2 + 100 - 2); + + } else if (info.getPosition().equals(BorderInfomation.BORDER_ANTIDIAGONAL)) { + gc.drawLine((width - 100) / 2, (height - 100) / 2 + 100, (width - 100) / 2 + 100, (height - 100) / 2); + + gc.drawLine((width - 100) / 2 + 2, (height - 100) / 2 + 100 - 2, (width - 100) / 2 + 100 - 2, + (height - 100) / 2 + 2); + } } else { gc.setLineStyle(SWT.LINE_SOLID); @@ -300,8 +349,8 @@ private void drawLine(GC gc, int width, int height, BorderInfomation info, boole try { if (infoWidth != null) // $NON-NLS-1$ { - int customWidth = (int) DimensionValue.parse(infoWidth).getMeasure(); - if (DimensionValue.parse(infoWidth).getUnits().equals(DesignChoiceConstants.UNITS_PX)) { + int customWidth = (int) StringUtil.parse(infoWidth).getMeasure(); + if (StringUtil.parse(infoWidth).getUnits().equals(DesignChoiceConstants.UNITS_PX)) { gc.setLineWidth(customWidth); } } @@ -386,6 +435,48 @@ private void drawLine(GC gc, int width, int height, BorderInfomation info, boole gc.drawText(INHERITED, (width - size.x) / 2, (height - 100) / 2 + 100 + 1); font.dispose(); } + } else if (info.getPosition().equals(BorderInfomation.BORDER_DIAGONAL)) { + if (drawLine) { + // preview line correction depended on the line width + int x1Shift = 0; + int y1Shift = 0; + int x2Shift = 0; + int y2Shift = 0; + if (gc.getLineWidth() >= 4 && gc.getLineWidth() <= 7) { + x1Shift = -1; + y1Shift = 1; + x2Shift = -1; + y2Shift = 1; + } else if (gc.getLineWidth() >= 8) { + x1Shift = -2; + y1Shift = 2; + x2Shift = -2; + y2Shift = 2; + } + gc.drawLine((width - 100) / 2 + gc.getLineWidth() / 2 + x1Shift, (height - 100) / 2 + y1Shift, + (width - 100) / 2 + 100 + x2Shift, (height - 100) / 2 + 100 - gc.getLineWidth() / 2 + y2Shift); + } + } else if (info.getPosition().equals(BorderInfomation.BORDER_ANTIDIAGONAL)) { + if (drawLine) { + // preview line correction depended on the line width + int x1Shift = 0; + int y1Shift = 0; + int x2Shift = 0; + int y2Shift = 0; + if (gc.getLineWidth() >= 4 && gc.getLineWidth() <= 7) { + x1Shift = 0; + y1Shift = 1; + x2Shift = 0; + y2Shift = -1; + } else if (gc.getLineWidth() >= 8) { + x1Shift = 0; + y1Shift = 4; + x2Shift = 0; + y2Shift = -4; + } + gc.drawLine((width - 100) / 2 + x1Shift, (height - 100) / 2 + 100 - gc.getLineWidth() / 2 + y1Shift, + (width - 100) / 2 + 100 + x2Shift, (height - 100) / 2 + gc.getLineWidth() / 2 + y2Shift); + } } } @@ -393,14 +484,29 @@ protected boolean isInheritedInfo(BorderInfomation info) { return info.isInheritedColor() && info.isInheritedStyle() && info.isInheritedWidth(); } + /** + * Remove the border information from preview + * + * @param position position of the removable entry + */ public void removeBorderInfomation(String position) { borderInfoMap.remove(position); } + /** + * Get the preview listener + * + * @return Return the preview listener + */ public Listener getListener() { return listener; } + /** + * Set the preview listener + * + * @param listener listener of the preview + */ public void setListener(Listener listener) { this.listener = listener; } diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/swt/custom/BorderInfomation.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/swt/custom/BorderInfomation.java index c1154af38cc..93f5322f614 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/swt/custom/BorderInfomation.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/swt/custom/BorderInfomation.java @@ -21,6 +21,8 @@ public class BorderInfomation { public static final String BORDER_TOP = "top"; //$NON-NLS-1$ public static final String BORDER_RIGHT = "right"; //$NON-NLS-1$ public static final String BORDER_BOTTOM = "bottom"; //$NON-NLS-1$ + public static final String BORDER_DIAGONAL = "diagonal"; //$NON-NLS-1$ + public static final String BORDER_ANTIDIAGONAL = "antidiagonal"; //$NON-NLS-1$ public static String getBorderBottom() { return BORDER_BOTTOM; diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/IReportGraphicConstants.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/IReportGraphicConstants.java index ca8201a7d23..61957c52112 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/IReportGraphicConstants.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/IReportGraphicConstants.java @@ -277,6 +277,10 @@ public interface IReportGraphicConstants { String ICON_BORDER_TOP = "Top border"; //$NON-NLS-1$ + String ICON_BORDER_DIAGONAL = "Diagonal border"; //$NON-NLS-1$ + + String ICON_BORDER_ANTIDIAGONAL = "Antidiagonal border"; //$NON-NLS-1$ + // missing image icon String ICON_MISSING_IMG = "Missing image"; //$NON-NLS-1$ @@ -379,6 +383,10 @@ public interface IReportGraphicConstants { String ICON_ATTRIBUTE_BORDER_BOTTOM = "BORDER_BOTTOM";//$NON-NLS-1$ + String ICON_ATTRIBUTE_BORDER_DIAGONAL = "BORDER_DIAGONAL";//$NON-NLS-1$ + + String ICON_ATTRIBUTE_BORDER_ANTIDIAGONAL = "BORDER_ANTIDIAGONAL";//$NON-NLS-1$ + String ICON_ATTRIBUTE_TEXT_ALIGN_CENTER = DesignChoiceConstants.TEXT_ALIGN_CENTER; String ICON_ATTRIBUTE_TEXT_ALIGN_JUSTIFY = DesignChoiceConstants.TEXT_ALIGN_JUSTIFY; diff --git a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/ReportPlatformUIImages.java b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/ReportPlatformUIImages.java index 6a2ae94b52c..809cde0d0f4 100644 --- a/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/ReportPlatformUIImages.java +++ b/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/ui/ReportPlatformUIImages.java @@ -367,6 +367,11 @@ private final static void declareImages() { declareImage(IReportGraphicConstants.ICON_BORDER_RIGHT, ICONS_PATH + OBJ16_PATH + "border_right.gif"); //$NON-NLS-1$ + declareImage(IReportGraphicConstants.ICON_BORDER_DIAGONAL, ICONS_PATH + OBJ16_PATH + "border_diagonal.gif"); //$NON-NLS-1$ + + declareImage(IReportGraphicConstants.ICON_BORDER_ANTIDIAGONAL, + ICONS_PATH + OBJ16_PATH + "border_antidiagonal.gif"); //$NON-NLS-1$ + declareImage(IReportGraphicConstants.ICON_BORDER_NOBORDER, ICONS_PATH + OBJ16_PATH + "border_none.gif"); //$NON-NLS-1$ // missing image icons @@ -450,6 +455,10 @@ private final static void declareImages() { declareImage(IReportGraphicConstants.ICON_ATTRIBUTE_BORDER_TOP, ICONS_PATH + OBJ16_PATH + "border_top.gif"); //$NON-NLS-1$ declareImage(IReportGraphicConstants.ICON_ATTRIBUTE_BORDER_BOTTOM, ICONS_PATH + OBJ16_PATH + "border_bottom.gif"); //$NON-NLS-1$ + declareImage(IReportGraphicConstants.ICON_ATTRIBUTE_BORDER_DIAGONAL, + ICONS_PATH + OBJ16_PATH + "border_diagonal.gif"); //$NON-NLS-1$ + declareImage(IReportGraphicConstants.ICON_ATTRIBUTE_BORDER_ANTIDIAGONAL, + ICONS_PATH + OBJ16_PATH + "border_antidiagonal.gif"); //$NON-NLS-1$ declareImage(IReportGraphicConstants.ICON_ATTRIBUTE_TEXT_ALIGN_CENTER, ICONS_PATH + OBJ16_PATH + "center_align.gif"); //$NON-NLS-1$ declareImage(IReportGraphicConstants.ICON_ATTRIBUTE_TEXT_ALIGN_CENTER + IReportGraphicConstants.DIS, diff --git a/build/org.eclipse.birt.target/BIRT all-in-one-MAC.launch b/build/org.eclipse.birt.target/BIRT all-in-one-MAC.launch index b825030bb24..6a2e73b5a37 100644 --- a/build/org.eclipse.birt.target/BIRT all-in-one-MAC.launch +++ b/build/org.eclipse.birt.target/BIRT all-in-one-MAC.launch @@ -15,6 +15,7 @@ + @@ -51,7 +52,6 @@ - @@ -81,9 +81,9 @@ + - @@ -114,7 +114,6 @@ - @@ -378,8 +377,6 @@ - - @@ -490,7 +487,6 @@ - @@ -500,9 +496,7 @@ - - @@ -653,13 +647,11 @@ - - - - - - + + + + diff --git a/build/org.eclipse.birt.target/BIRT all-in-one.launch b/build/org.eclipse.birt.target/BIRT all-in-one.launch index 8dc2a6829a7..b1c6efe58ca 100644 --- a/build/org.eclipse.birt.target/BIRT all-in-one.launch +++ b/build/org.eclipse.birt.target/BIRT all-in-one.launch @@ -97,9 +97,9 @@ + - 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 ceaebed8dfb..3b66de1718c 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 @@ -1,12 +1,12 @@ /******************************************************************************* * Copyright (c) 2013 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 @@ -97,7 +97,7 @@ public void startForeign(IForeignContent foreign) throws BirtException { width = Math.min(width, context.getCurrentWidth()); wordWriter.startTable(foreign.getComputedStyle(), width, true); wordWriter.startTableRow(-1); - wordWriter.startTableCell(width, foreign.getComputedStyle(), null); + wordWriter.startTableCell(width, foreign.getComputedStyle(), null, null); // TODO:need text paser for foreign raw value wordWriter.writeForeign(foreign); if (isInSpannedCell(foreign)) { 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 5c90ef34d6b..4af474b6b99 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 @@ -1,12 +1,12 @@ /******************************************************************************* * Copyright (c) 2013 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 @@ -214,8 +214,8 @@ public void endTableRow() { } @Override - public void startTableCell(int width, IStyle style, SpanInfo info) { - currentComponent.startTableCell(width, style, info); + public void startTableCell(int width, IStyle style, SpanInfo info, DiagonalLineInfo diagonalLineInfo) { + currentComponent.startTableCell(width, style, info, diagonalLineInfo); } @Override diff --git a/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java b/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java index a2ec05697fc..450c68d2627 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java +++ b/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java @@ -27,6 +27,7 @@ import java.util.Map; import java.util.Set; import java.util.Stack; +import java.util.UUID; import java.util.logging.Level; import java.util.logging.Logger; @@ -260,7 +261,7 @@ public class HTMLReportEmitter extends ContentEmitterAdapter { */ protected Stack stack = new Stack(); - HashMap diagonalCellImageMap = new HashMap(); + HashMap diagonalCellImageMap = new HashMap(); /** * An Log object that HTMLReportEmitter use to log the error, @@ -352,6 +353,15 @@ public class HTMLReportEmitter extends ContentEmitterAdapter { protected TableLayout tableLayout = new TableLayout(this); + /** + * Default image pixel width. + */ + private static int DEFAULT_IMAGE_PX_WIDTH = 200; + /** + * Default image pixel height. + */ + private static int DEFAULT_IMAGE_PX_HEIGHT = 200; + /** * the constructor */ @@ -567,6 +577,32 @@ protected void loadBirtJs(String birtJsUrl) { writer.writeCode(""); //$NON-NLS-1$ } + protected void addCellDiagonalSpecial() { + writer.writeCode(""); //$NON-NLS-1$ + } + protected void outputBirtJs() { writer.writeCode(""); //$NON-NLS-1$ } @@ -677,6 +712,8 @@ public void start(IReportContent report) { htmlEmitter = new HTMLVisionOptimize(this, writer, fixedReport, enableInlineStyle, htmlRtLFlag, browserVersion); } + // diagonal & antidiagonal special function + addCellDiagonalSpecial(); if (isEmbeddable) { outputCSSStyles(reportDesign, designHandle); @@ -2024,17 +2061,52 @@ public void startCell(ICellContent cell) { boolean fixedCellHeight = useFixedCellHeight(cell); StringBuffer styleBuffer = new StringBuffer(); + + // handling of diagonal lines + String tdDiagonalUriCaller = ""; + String tdDiagonalUUID = ""; + Boolean tdDiagonalSpecial = false; + if (cell.hasDiagonalLine()) { + DimensionType cellHeight = null; + if (fixedCellHeight) { + cellHeight = fixedRowHeightStack.peek(); + } else { + cellHeight = getCellHeight(cell); + } + tdDiagonalUUID = "bg-img-diag-" + UUID.randomUUID().toString(); + writer.attribute(HTMLTags.ATTR_ID, tdDiagonalUUID); + String imgUri = "url(" + outputDiagonalImageUri(cell, cellHeight) + ")"; + if (imgUri != null) { + // line image direct on td-cell level + if (cell.getStyle().getBackgroundImage() == null) { + styleBuffer.append("background-image:" + imgUri + " ;"); + styleBuffer.append("background-repeat:no-repeat;"); + styleBuffer.append("background-position:center;"); + styleBuffer.append("background-size:100% 100%;"); + } else { + tdDiagonalUriCaller = "combineBgImageAndDiagonal('" + tdDiagonalUUID + "','" + imgUri + "');"; + tdDiagonalSpecial = true; + } + } + } htmlEmitter.buildCellStyle(cell, styleBuffer, isHead, fixedCellHeight); writer.attribute(HTMLTags.ATTR_STYLE, styleBuffer.toString()); htmlEmitter.handleCellAlign(cell); if (fixedCellHeight) { - // Fixed cell height requires the vertical aline must be top. + // Fixed cell height requires the vertical align must be top. writer.attribute(HTMLTags.ATTR_VALIGN, "top"); } else { htmlEmitter.handleCellVAlign(cell); } + // CSS function necessary on diagonal and background image at same time + if (tdDiagonalSpecial) { + writer.openTag(HTMLTags.TAG_SCRIPT); + writer.cdata(tdDiagonalUriCaller); + writer.closeTag(HTMLTags.TAG_SCRIPT); + } + boolean bookmarkOutput = false; if (metadataFilter != null) { bookmarkOutput = metadataEmitter.outputMetadataProperty( @@ -2065,9 +2137,6 @@ public void startCell(ICellContent cell) { writer.openTag(HTMLTags.TAG_DIV); writer.attribute(HTMLTags.ATTR_STYLE, "position: relative; height: 100%;"); DimensionType cellHeight = fixedRowHeightStack.peek(); - if (cell.hasDiagonalLine()) { - outputDiagonalImage(cell, cellHeight); - } writer.openTag(HTMLTags.TAG_DIV); styleBuffer.setLength(0); styleBuffer.append(" height: "); @@ -2075,13 +2144,6 @@ public void startCell(ICellContent cell) { styleBuffer.append("; width: 100%; position: absolute; left: 0px;"); HTMLEmitterUtil.buildOverflowStyle(styleBuffer, cell.getStyle(), true); writer.attribute(HTMLTags.ATTR_STYLE, styleBuffer.toString()); - } else if (cell.hasDiagonalLine()) { - DimensionType cellHeight = getCellHeight(cell); - if (cellHeight != null && !"%".equals(cellHeight.getUnits())) { - writer.openTag(HTMLTags.TAG_DIV); - writer.attribute(HTMLTags.ATTR_STYLE, "position: relative; height: 100%;"); - outputDiagonalImage(cell, cellHeight); - } } if (enableMetadata) { @@ -2099,7 +2161,7 @@ protected boolean useFixedCellHeight(ICellContent cell) { if (style != null) { String overflow = style.getOverflow(); if (CSSConstants.CSS_OVERFLOW_SCROLL_VALUE.equals(overflow)) { - DimensionType cellHeight = (DimensionType) fixedRowHeightStack.peek(); + DimensionType cellHeight = fixedRowHeightStack.peek(); if (cellHeight != null) { return true; } @@ -2109,10 +2171,38 @@ protected boolean useFixedCellHeight(ICellContent cell) { return false; } - protected void outputDiagonalImage(ICellContent cell, DimensionType cellHeight) { - String imgUri = diagonalCellImageMap.get(cell.getInstanceID().getComponentID()); + /** + * Create the uri of the diagonal line image + * + * @param cell context of cell + * @param cellHeight height of the cell element + * @return Return the uri of the diagonal line image + * @since 4.13 + */ + protected String outputDiagonalImageUri(ICellContent cell, DimensionType cellHeight) { + + String componentPropertyId = ""; + // componend id with property value key parts + componentPropertyId += "ciidcid:" + cell.getInstanceID().getComponentID() + ";"; + componentPropertyId += "cdn:" + cell.getDiagonalNumber() + ";cds:" + cell.getDiagonalStyle() + ";"; + componentPropertyId += "cdw:" + cell.getDiagonalWidth() + ";cdc:" + cell.getDiagonalColor() + ";"; + componentPropertyId += "cadn:" + cell.getAntidiagonalNumber() + ";cads:" + cell.getAntidiagonalStyle() + ";"; + componentPropertyId += "cadw:" + cell.getAntidiagonalWidth() + ";cadc:" + cell.getAntidiagonalColor() + ";"; + + String imgUri = diagonalCellImageMap.get(componentPropertyId); + if (imgUri == null) { - // prepare to get the diagnal line image. + + // prepare width and height of diagonal image + DimensionType cellWidth = cell.getWidth(); + if (cellWidth == null || cellWidth.getMeasure() == 0.0d) { + cellWidth = new DimensionType(DEFAULT_IMAGE_PX_WIDTH, "px"); + } + if (cellHeight == null || cellHeight.getMeasure() == 0.0d) { + cellHeight = new DimensionType(DEFAULT_IMAGE_PX_HEIGHT, "px"); + } + + // prepare to get the diagonal line image. DiagonalLineImage imageCreater = new DiagonalLineImage(); imageCreater.setDiagonalLine(cell.getDiagonalNumber(), cell.getDiagonalStyle(), cell.getDiagonalWidth(), cell.getDiagonalColor()); @@ -2125,7 +2215,7 @@ protected void outputDiagonalImage(ICellContent cell, DimensionType cellHeight) imageCreater.setColor(PropertyUtil.getColor(strColor)); byte[] imageByteArray = null; try { - // draw the diagnal line image. + // draw the diagonal & antidiagonal line image. imageByteArray = imageCreater.drawImage(); } catch (IOException e) { logger.log(Level.WARNING, e.getMessage(), e); @@ -2138,33 +2228,11 @@ protected void outputDiagonalImage(ICellContent cell, DimensionType cellHeight) imgUri = imageHandler.onCustomImage(image, reportContext); if (imgUri != null) { // Cache the image URI. - diagonalCellImageMap.put(cell.getInstanceID().getComponentID(), imgUri); + diagonalCellImageMap.put(componentPropertyId, imgUri); } } } - - // FIXME: We should continue to improve the HTML source of how to output - // the diagonal line image. - // FIXME: We still need to solve the confilct between the cell's - // background and the diagonal line imag. - if (imgUri != null) { - writer.openTag(HTMLTags.TAG_IMAGE); - writer.attributeAllowEmpty(HTMLTags.ATTR_ALT, ""); - writer.attribute(HTMLTags.ATTR_SRC, imgUri); - StringBuilder styleBuffer = new StringBuilder(); - styleBuffer.append(" min-height: "); - styleBuffer.append(cellHeight.toString()); - styleBuffer.append("; height: 100%; width: 100%; position: absolute; z-index: auto; left: 0px;"); - writer.attribute(HTMLTags.ATTR_STYLE, styleBuffer.toString()); - if (needFixTransparentPNG) { - if (null == htmlIDNamespace) { - writer.attribute(HTMLTags.ATTR_ONLOAD, "fixPNG(this)"); //$NON-NLS-1$ - } else { - writer.attribute(HTMLTags.ATTR_ONLOAD, htmlIDNamespace + "fixPNG(this)"); //$NON-NLS-1$ - } - } - writer.closeTag(HTMLTags.TAG_IMAGE); - } + return imgUri; } protected DimensionType getCellWidth(ICellContent cell) { @@ -2201,11 +2269,6 @@ public void endCell(ICellContent cell) { if (useFixedCellHeight(cell)) { writer.closeTag(HTMLTags.TAG_DIV); writer.closeTag(HTMLTags.TAG_DIV); - } else if (cell.hasDiagonalLine()) { - DimensionType cellHeight = getCellHeight(cell); - if (cellHeight != null && !"%".equals(cellHeight.getUnits())) { - writer.closeTag(HTMLTags.TAG_DIV); - } } if (isCellInHead(cell)) { @@ -2299,7 +2362,6 @@ public void startText(ITextContent text) { textValue = " "; //$NON-NLS-1$ isBlank = true; } - int display = htmlEmitter.getTextElementType(x, y, width, height, mergedStyle); // bidi_hcg: fix for bug 307327. If text content is Bidi, treat it as // a inline-block element @@ -3278,7 +3340,6 @@ public String handleStyleImage(String uri, boolean isBackground, IStyle imageSty default: assert (false); } - // imgUri = imgUri.replace( File.separatorChar, '/' ); } return imgUri; } diff --git a/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/util/DiagonalLineImage.java b/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/util/DiagonalLineImage.java index 7cb0c8efa5d..af68146e15d 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/util/DiagonalLineImage.java +++ b/engine/org.eclipse.birt.report.engine.emitter.html/src/org/eclipse/birt/report/engine/emitter/html/util/DiagonalLineImage.java @@ -45,18 +45,26 @@ public class DiagonalLineImage { * The width of the diagonal line. */ private DimensionType diagonalWidth = null; + /** + * The color of the diagonal line. + */ + private String diagonalColor = null; /** * The number of the antidiagonal line. */ private int antidiagonalNumber = -1; /** - * The color of the diagonal line. + * The style of the antidiagonal line. */ - private String diagonalColor = null; + private String antidiagonalStyle = null; /** * The width of the antidiagonal line. */ private DimensionType antidiagonalWidth = null; + /** + * The color of the antidiagonal line. + */ + private String antidiagonalColor = null; /** * The font color. Default value is black; */ @@ -100,7 +108,9 @@ public void setDiagonalLine(int diagonalNumber, String diagonalStyle, DimensionT public void setAntidiagonalLine(int antidiagonalNumber, String antidiagonalStyle, DimensionType antidiagonalWidth, String antidiagonalColor) { this.antidiagonalNumber = antidiagonalNumber; + this.antidiagonalStyle = antidiagonalStyle; this.antidiagonalWidth = antidiagonalWidth; + this.antidiagonalColor = antidiagonalColor; } public void setColor(Color color) { @@ -215,57 +225,76 @@ public byte[] drawImage() throws IOException { } } } - /* - * if ( antidiagonalStyle != null && !"none".equalsIgnoreCase( antidiagonalStyle - * ) ) { // set color Color lineColor = PropertyUtil.getColor( antidiagonalColor - * ); if ( lineColor == null ) { lineColor = color; } if ( lineColor != null ) { - * g2d.setColor( lineColor ); } - * - * // Draw antidiagonal line. // FIXME continue: Double style hasn't been - * implemented yet, and // it // will be treated as solid style. The double - * style should be // implemented in the future. - * - * // if ( "double".equalsIgnoreCase( antidiagonalStyle ) && ( // - * antidiagonalPXWidth > 2 ) ) { // Double line has the same // effect with the - * solid line when the // line width equal 1px // or 2px. // FIXME continue: - * implement the left double part. } // else if ( "dotted".equalsIgnoreCase( - * antidiagonalStyle ) ) - * - * if ( "dotted".equalsIgnoreCase( antidiagonalStyle ) ) { float dash[] = { 1, ( - * antidiagonalPXWidth * 2 ) - 1 + ( antidiagonalPXWidth % 2 ) }; Stroke stroke - * = new BasicStroke( antidiagonalPXWidth, BasicStroke.CAP_ROUND, - * BasicStroke.JOIN_ROUND, 10.0f, dash, ( antidiagonalPXWidth * 2 ) - ( - * antidiagonalPXWidth / 2 ) ); g2d.setStroke( stroke ); - * - * if ( antidiagonalNumber == 1 ) { g2d.drawLine( imagePXWidth - 1, - * antidiagonalPXWidth / 2, 0, imagePXHeight - 1 + ( antidiagonalPXWidth / 2 ) - * ); } else if ( antidiagonalNumber == 2 ) { g2d.drawLine( ( imagePXWidth * 2 / - * 3 ) - 1, antidiagonalPXWidth / 2, 0, imagePXHeight - 1 + ( - * antidiagonalPXWidth / 2 ) ); g2d.drawLine( imagePXWidth - 1, ( imagePXHeight - * / 3 ) - 1 + ( antidiagonalPXWidth / 2 ), 0, imagePXHeight - 1 + ( - * antidiagonalPXWidth / 2 ) ); } else if ( antidiagonalNumber >= 3 ) { - * g2d.drawLine( ( imagePXWidth / 2 ) - 1, antidiagonalPXWidth / 2, 0, - * imagePXHeight - 1 + ( antidiagonalPXWidth / 2 ) ); g2d.drawLine( imagePXWidth - * - 1, antidiagonalPXWidth / 2, 0, imagePXHeight - 1 + ( antidiagonalPXWidth / - * 2 ) ); g2d.drawLine( imagePXWidth - 1, ( imagePXHeight / 2 ) - 1 + ( - * antidiagonalPXWidth / 2 ), 0, imagePXHeight - 1 + ( antidiagonalPXWidth / 2 ) - * ); } } else { if ( "dashed".equalsIgnoreCase( antidiagonalStyle ) ) { float - * dash[] = { 3 * antidiagonalPXWidth }; Stroke stroke = new BasicStroke( - * antidiagonalPXWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, - * dash, 0.0f ); g2d.setStroke( stroke ); } else { // Solid is the default value - * if ( antidiagonalPXWidth > 1 ) { g2d.setStroke( new BasicStroke( - * antidiagonalPXWidth ) ); } else { // Use the default stroke when the - * diagonalPXWidth // is 1. g2d.setStroke( originStroke ); } } - * - * if ( antidiagonalNumber == 1 ) { g2d.drawLine( imagePXWidth - 1, 0, 0, - * imagePXHeight - 1 ); } else if ( antidiagonalNumber == 2 ) { g2d.drawLine( ( - * imagePXWidth * 2 / 3 ) - 1, 0, 0, imagePXHeight - 1 ); g2d.drawLine( - * imagePXWidth - 1, ( imagePXHeight / 3 ) - 1, 0, imagePXHeight - 1 ); } else - * if ( antidiagonalNumber >= 3 ) { g2d.drawLine( ( imagePXWidth / 2 ) - 1, 0, - * 0, imagePXHeight - 1 ); g2d.drawLine( imagePXWidth - 1, 0, 0, imagePXHeight - - * 1 ); g2d.drawLine( imagePXWidth - 1, ( imagePXHeight / 2 ) - 1, 0, - * imagePXHeight - 1 ); } } } - */ + + if ( antidiagonalStyle != null && !"none".equalsIgnoreCase( antidiagonalStyle ) ) { + // set color + Color lineColor = PropertyUtil.getColor( antidiagonalColor); + if ( lineColor == null ) { + lineColor = color; + } + if ( lineColor != null ) { + g2d.setColor( lineColor ); + } + + // Draw antidiagonal line. // FIXME continue: Double style hasn't been + // implemented yet, and // it // will be treated as solid style. The double + // style should be // implemented in the future. + + // if ( "double".equalsIgnoreCase( antidiagonalStyle ) && ( // + // antidiagonalPXWidth > 2 ) ) { // Double line has the same // effect with the + // solid line when the // line width equal 1px // or 2px. // FIXME continue: + // implement the left double part. } // else if ( "dotted".equalsIgnoreCase( + // antidiagonalStyle ) ) + + if ("dotted".equalsIgnoreCase(antidiagonalStyle)) { + float dash[] = { 1, (antidiagonalPXWidth * 2) - 1 + (antidiagonalPXWidth % 2) }; + Stroke stroke = new BasicStroke(antidiagonalPXWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, + 10.0f, dash, (antidiagonalPXWidth * 2) - (antidiagonalPXWidth / 2)); + g2d.setStroke(stroke); + + if (antidiagonalNumber == 1) { + g2d.drawLine(imagePXWidth - 1, antidiagonalPXWidth / 2, 0, + imagePXHeight - 1 + (antidiagonalPXWidth / 2)); + } else if (antidiagonalNumber == 2) { + g2d.drawLine((imagePXWidth * 2 / 3) - 1, antidiagonalPXWidth / 2, 0, + imagePXHeight - 1 + (antidiagonalPXWidth / 2)); + g2d.drawLine(imagePXWidth - 1, (imagePXHeight / 3) - 1 + (antidiagonalPXWidth / 2), 0, + imagePXHeight - 1 + (antidiagonalPXWidth / 2)); + } else if (antidiagonalNumber >= 3) { + g2d.drawLine((imagePXWidth / 2) - 1, antidiagonalPXWidth / 2, 0, + imagePXHeight - 1 + (antidiagonalPXWidth / 2)); + g2d.drawLine(imagePXWidth - 1, antidiagonalPXWidth / 2, 0, + imagePXHeight - 1 + (antidiagonalPXWidth / 2)); + g2d.drawLine(imagePXWidth - 1, (imagePXHeight / 2) - 1 + (antidiagonalPXWidth / 2), 0, + imagePXHeight - 1 + (antidiagonalPXWidth / 2)); + } + } else { + if ("dashed".equalsIgnoreCase(antidiagonalStyle)) { + float dash[] = { 3 * antidiagonalPXWidth }; + Stroke stroke = new BasicStroke(antidiagonalPXWidth, BasicStroke.CAP_BUTT, + BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f); + g2d.setStroke(stroke); + } else { + // Solid is the default value + if (antidiagonalPXWidth > 1) { + g2d.setStroke(new BasicStroke(antidiagonalPXWidth)); + } else { + // Use the default stroke when the diagonalPXWidth // is 1. + g2d.setStroke(originStroke); + } + } + if (antidiagonalNumber == 1) { + g2d.drawLine(imagePXWidth - 1, 0, 0, imagePXHeight - 1); + } else if (antidiagonalNumber == 2) { + g2d.drawLine((imagePXWidth * 2 / 3) - 1, 0, 0, imagePXHeight - 1); + g2d.drawLine(imagePXWidth - 1, (imagePXHeight / 3) - 1, 0, imagePXHeight - 1); + } else if (antidiagonalNumber >= 3) { + g2d.drawLine((imagePXWidth / 2) - 1, 0, 0, imagePXHeight - 1); + g2d.drawLine(imagePXWidth - 1, 0, 0, imagePXHeight - 1); + g2d.drawLine(imagePXWidth - 1, (imagePXHeight / 2) - 1, 0, imagePXHeight - 1); + } + } + } } finally { // Graphics context no longer needed so dispose it g2d.dispose(); diff --git a/engine/org.eclipse.birt.report.engine.emitter.odp/src/org/eclipse/birt/report/engine/emitter/odp/OdpWriter.java b/engine/org.eclipse.birt.report.engine.emitter.odp/src/org/eclipse/birt/report/engine/emitter/odp/OdpWriter.java index f29d167a031..ea01acd3dae 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.odp/src/org/eclipse/birt/report/engine/emitter/odp/OdpWriter.java +++ b/engine/org.eclipse.birt.report.engine.emitter.odp/src/org/eclipse/birt/report/engine/emitter/odp/OdpWriter.java @@ -196,10 +196,6 @@ public void drawLine(double startX, double startY, double endX, double endY, Sty * @param color the color of the line */ private void drawRawLine(double startX, double startY, double endX, double endY, StyleEntry lineStyle) { - boolean needflip = false; - if (endX > startX && endY < startY || endX < startX && endY > startY) { - needflip = true; - } writer.openTag("draw:line"); writer.attribute("draw:layer", "layout"); @@ -212,17 +208,10 @@ private void drawRawLine(double startX, double startY, double endX, double endY, endX /= OdfUtil.INCH_PT; endY /= OdfUtil.INCH_PT; - if (needflip) { - writer.attribute("svg:x1", startX + "in"); - writer.attribute("svg:y1", endY + "in"); - writer.attribute("svg:x2", endX + "in"); - writer.attribute("svg:y2", startY + "in"); - } else { - writer.attribute("svg:x1", startX + "in"); - writer.attribute("svg:y1", startY + "in"); - writer.attribute("svg:x2", endX + "in"); - writer.attribute("svg:y2", endY + "in"); - } + writer.attribute("svg:x1", startX + "in"); + writer.attribute("svg:y1", startY + "in"); + writer.attribute("svg:x2", endX + "in"); + writer.attribute("svg:y2", endY + "in"); writer.closeTag("draw:line"); } diff --git a/engine/org.eclipse.birt.report.engine.emitter.ppt/src/org/eclipse/birt/report/engine/emitter/ppt/PPTWriter.java b/engine/org.eclipse.birt.report.engine.emitter.ppt/src/org/eclipse/birt/report/engine/emitter/ppt/PPTWriter.java index a0c0209e7e3..37d6338bf5b 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.ppt/src/org/eclipse/birt/report/engine/emitter/ppt/PPTWriter.java +++ b/engine/org.eclipse.birt.report.engine.emitter.ppt/src/org/eclipse/birt/report/engine/emitter/ppt/PPTWriter.java @@ -39,7 +39,7 @@ import org.eclipse.birt.report.engine.layout.emitter.util.BackgroundImageLayout; import org.eclipse.birt.report.engine.layout.emitter.util.Position; import org.eclipse.birt.report.engine.layout.pdf.font.FontInfo; -import org.eclipse.birt.report.engine.nLayout.area.style.BorderInfo; +import org.eclipse.birt.report.engine.nLayout.area.style.AreaConstants; import org.eclipse.birt.report.engine.nLayout.area.style.TextStyle; import com.ibm.icu.lang.UCharacter; @@ -47,6 +47,12 @@ import com.lowagie.text.Font; import com.lowagie.text.pdf.BaseFont; +/** + * Class to create PPT file + * + * @since 3.3 + * + */ public class PPTWriter { protected static Logger logger = Logger.getLogger(PPTRender.class.getName()); @@ -68,6 +74,11 @@ public class PPTWriter { private QuotedPrintableCodec quotedPrintableCodec; + /** + * Constructor of PPT + * + * @param output + */ public PPTWriter(OutputStream output) { try { writer = new PrintWriter(new OutputStreamWriter(output, "UTF-8"), false); @@ -81,6 +92,8 @@ public PPTWriter(OutputStream output) { * * @param author * @param title + * @param description + * @param subject * */ public void start(String title, String author, String description, String subject) { @@ -185,6 +198,9 @@ public void end() { writer = null; } + /** + * End page + */ public void endPage() { try { // Write out the image bytes @@ -219,7 +235,9 @@ private void generateImageBytes(String imageTitle, byte[] imageData) throws IOEx /** * Creates a new page. * - * @param page the PageArea specified from layout + * @param pageWidth page width + * @param pageHeight page height + * @param backgroundColor page background color */ public void newPage(float pageWidth, float pageHeight, Color backgroundColor) { currentPageNum++; @@ -368,6 +386,20 @@ private void appendComponent(StringBuffer buffer, int component) { buffer.append(hex); } + /** + * Draw the imgae + * + * @param imageId image ID + * @param imageData image data + * @param extension file extension + * @param imageX image start point X + * @param imageY image start point Y + * @param height image height + * @param width image widt + * @param helpText help text + * @param link link at image object + * @throws Exception + */ public void drawImage(String imageId, byte[] imageData, String extension, float imageX, float imageY, float height, float width, String helpText, HyperlinkDef link) throws Exception { ImageInfo imageInfo = getImageInfo(imageId, imageData, extension); @@ -541,18 +573,18 @@ public void drawLine(double startX, double startY, double endX, double endY, dou // if the border does NOT have color or the line width of the border // is zero // or the lineStyle is "none", just return. - if (null == color || 0f == width || lineStyle == BorderInfo.BORDER_STYLE_NONE) // $NON-NLS-1$ + if (null == color || 0f == width || lineStyle == AreaConstants.BORDER_STYLE_NONE) // $NON-NLS-1$ { return; } - if (lineStyle == BorderInfo.BORDER_STYLE_SOLID || lineStyle == BorderInfo.BORDER_STYLE_DASHED - || lineStyle == BorderInfo.BORDER_STYLE_DOTTED || lineStyle == BorderInfo.BORDER_STYLE_DOUBLE) { + if (lineStyle == AreaConstants.BORDER_STYLE_SOLID || lineStyle == AreaConstants.BORDER_STYLE_DASHED + || lineStyle == AreaConstants.BORDER_STYLE_DOTTED || lineStyle == AreaConstants.BORDER_STYLE_DOUBLE) { drawRawLine(startX, startY, endX, endY, width, color, lineStyle); } else { // the other line styles, e.g. 'ridge', 'outset', 'groove', 'insert' // is NOT supported now. // We look it as the default line style -- 'solid' - drawRawLine(startX, startY, endX, endY, width, color, BorderInfo.BORDER_STYLE_SOLID); + drawRawLine(startX, startY, endX, endY, width, color, AreaConstants.BORDER_STYLE_SOLID); } } @@ -571,29 +603,23 @@ public void drawLine(double startX, double startY, double endX, double endY, dou */ private void drawRawLine(double startX, double startY, double endX, double endY, double width, Color color, int lineStyle) { - boolean needflip = false; - if (endX > startX && endY < startY || endX < startX && endY > startY) { - needflip = true; - } + print(""); println(""); - } else if (lineStyle == BorderInfo.BORDER_STYLE_DOTTED) { + } else if (lineStyle == AreaConstants.BORDER_STYLE_DOTTED) { println(">"); println(""); - } else if (lineStyle == BorderInfo.BORDER_STYLE_DOUBLE) { + } else if (lineStyle == AreaConstants.BORDER_STYLE_DOUBLE) { println(">"); println(""); } else { @@ -628,17 +654,18 @@ public void drawBackgroundColor(Color color, double x, double y, double width, d * offset * * @param imageURI the URI referring the image + * @param imageData * @param x the start X coordinate at the PPT where the image is * positioned * @param y the start Y coordinate at the PPT where the image is * positioned * @param width the width of the background dimension * @param height the height of the background dimension + * @param iWidth + * @param iHeight * @param positionX the offset X percentage relating to start X * @param positionY the offset Y percentage relating to start Y * @param repeat the background-repeat property - * @param xMode whether the horizontal position is a percentage value or not - * @param yMode whether the vertical position is a percentage value or not */ public void drawBackgroundImage(String imageURI, byte[] imageData, float x, float y, float width, float height, float iWidth, float iHeight, float positionX, float positionY, int repeat) { @@ -663,8 +690,8 @@ public void drawBackgroundImage(String imageURI, byte[] imageData, float x, floa Position imagePosition = new Position(x + positionX, y + positionY); Position imageSize = new Position(imageWidth, imageHeight); BackgroundImageLayout layout = new BackgroundImageLayout(areaPosition, areaSize, imagePosition, imageSize); - Collection positions = layout.getImagePositions(repeat); - Iterator iterator = positions.iterator(); + Collection positions = layout.getImagePositions(repeat); + Iterator iterator = positions.iterator(); while (iterator.hasNext()) { Position position = (Position) iterator.next(); exportImageDefn(imageInfo.imageName, imageInfo.imageId, imageWidth, imageHeight, position.getX(), @@ -757,10 +784,9 @@ private String buildI18nAttributes(String text, boolean rtl) { // If no actual RTL content was found (e.g. in case the text // consists of sheer neutral characters), indicate Arabic language return " dir=3D'rtl' lang=3D'AR-DZ'"; //$NON-NLS-1$ - } else { - // XXX Other language attributes can be addressed as needed - return " dir=3D'ltr' lang=3D'EN-US'"; //$NON-NLS-1$ } + // XXX Other language attributes can be addressed as needed + return " dir=3D'ltr' lang=3D'EN-US'"; //$NON-NLS-1$ } private Stack clipStack = new Stack<>(); @@ -777,6 +803,14 @@ private class ClipArea { } } + /** + * Clip the stacked area + * + * @param startX start point + * @param startY end point + * @param width width of area + * @param height height of area + */ public void clip(float startX, float startY, float width, float height) { if (clipStack.isEmpty()) { clipStack.push(new ClipArea(startX, startY, width, height)); @@ -790,6 +824,9 @@ public void clip(float startX, float startY, float width, float height) { } } + /** + * End the clip + */ public void clipEnd() { clipStack.pop(); diff --git a/engine/org.eclipse.birt.report.engine.emitter.pptx/src/org/eclipse/birt/report/engine/emitter/pptx/PPTXCanvas.java b/engine/org.eclipse.birt.report.engine.emitter.pptx/src/org/eclipse/birt/report/engine/emitter/pptx/PPTXCanvas.java index 4c2b5d3e995..f177b037a5b 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.pptx/src/org/eclipse/birt/report/engine/emitter/pptx/PPTXCanvas.java +++ b/engine/org.eclipse.birt.report.engine.emitter.pptx/src/org/eclipse/birt/report/engine/emitter/pptx/PPTXCanvas.java @@ -352,8 +352,8 @@ public void drawBackgroundImage(int x, int y, int width, int height, int imageWi Position imagePosition = new Position(x + offsetX, y + offsetY); Position imageSize = new Position(originalImageWidth, originalImageHeight); BackgroundImageLayout layout = new BackgroundImageLayout(areaPosition, areaSize, imagePosition, imageSize); - Collection positions = layout.getImagePositions(repeat); - Iterator iterator = positions.iterator(); + Collection positions = layout.getImagePositions(repeat); + Iterator iterator = positions.iterator(); while (iterator.hasNext()) { Position position = (Position) iterator.next(); fillRectangleWithImage(imagePartInfo, (int) OOXmlUtil.convertPointerToEmus(position.getX()), diff --git a/engine/org.eclipse.birt.report.engine.emitter.pptx/src/org/eclipse/birt/report/engine/emitter/pptx/TableWriter.java b/engine/org.eclipse.birt.report.engine.emitter.pptx/src/org/eclipse/birt/report/engine/emitter/pptx/TableWriter.java index 5450781fb77..f893b652e6a 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.pptx/src/org/eclipse/birt/report/engine/emitter/pptx/TableWriter.java +++ b/engine/org.eclipse.birt.report.engine.emitter.pptx/src/org/eclipse/birt/report/engine/emitter/pptx/TableWriter.java @@ -385,7 +385,7 @@ protected void drawCell(CellArea cell) { private void startCell(CellArea cell) { writer.openTag("a:tc"); - int colspan = cell.getColSpan(); + colspan = cell.getColSpan(); if (colspan > 1) { writer.attribute("gridSpan", colspan); } @@ -597,6 +597,7 @@ private boolean childneedclip(ContainerArea container) { protected void drawCellBox(CellArea cell) { drawBorders(cell); drawCellDiagonal(cell); + drawCellAntidiagonal(cell); BoxStyle style = cell.getBoxStyle(); Color backgroundcolor = style.getBackgroundColor(); @@ -639,9 +640,9 @@ protected void drawCellBox(CellArea cell) { protected void drawCellDiagonal(CellArea cell) { DiagonalInfo diagonalInfo = cell.getDiagonalInfo(); - if (diagonalInfo != null && diagonalInfo.getDiagonalNumber() == 1) {// only support single line : width should - // be the same as borders - + if (diagonalInfo != null && diagonalInfo.getDiagonalNumber() >= 1 + && diagonalInfo.getDiagonalStyle() != BoxStyle.BORDER_STYLE_NONE) { + // only support single line : width should be the same as borders writer.openTag("a:lnTlToBr"); int width = PPTXUtil.convertToEnums(diagonalInfo.getDiagonalWidth()); writer.attribute("w", width); @@ -667,6 +668,36 @@ protected void drawCellDiagonal(CellArea cell) { } } + protected void drawCellAntidiagonal(CellArea cell) { + DiagonalInfo diagonalInfo = cell.getDiagonalInfo(); + // only support single line : width should be the same as borders + if (diagonalInfo != null && diagonalInfo.getAntidiagonalNumber() >= 1 + && diagonalInfo.getAntidiagonalStyle() != BoxStyle.BORDER_STYLE_NONE) { + writer.openTag("a:lnBlToTr"); + int width = PPTXUtil.convertToEnums(diagonalInfo.getAntidiagonalWidth()); + writer.attribute("w", width); + writer.attribute("cap", "flat"); + writer.attribute("algn", "ctr"); + canvas.setBackgroundColor(diagonalInfo.getAntidiagonalColor()); + writer.openTag("a:prstDash"); + writer.attribute("val", PPTXUtil.parseStyle(diagonalInfo.getAntidiagonalStyle())); + writer.closeTag("a:prstDash"); + writer.openTag("a:round"); + writer.closeTag("a:round"); + writer.openTag("a:headEnd"); + writer.attribute("type", "none"); + writer.attribute("w", "med"); + writer.attribute("len", "med"); + writer.closeTag("a:headEnd"); + writer.openTag("a:tailEnd"); + writer.attribute("type", "none"); + writer.attribute("w", "med"); + writer.attribute("len", "med"); + writer.closeTag("a:tailEnd"); + writer.closeTag("a:lnBlToTr"); + } + } + /** * assume leftborder is always draw * @@ -684,7 +715,8 @@ protected void drawBorders(CellArea container) { if (additionalColSpan != null) { additionalcol = additionalColSpan; } - CellArea nextcell = ((RowArea) container.getParent()).getCell(drawcurrentcolid + colspan + additionalcol); + int cellIdx = drawcurrentcolid + colspan + additionalcol + 1; + CellArea nextcell = ((RowArea) container.getParent()).getCell(cellIdx); if (!isRTL) {// normal flow writeSingleBorder(LEFTBORDERLINE, style.getLeftBorder()); 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 53c447d3d60..203adb0d4d6 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 @@ -115,6 +115,14 @@ public enum TextFlag { nonInherityStyles.add(IStyle.STYLE_BORDER_RIGHT_COLOR); nonInherityStyles.add(IStyle.STYLE_BORDER_RIGHT_STYLE); nonInherityStyles.add(IStyle.STYLE_BORDER_RIGHT_WIDTH); + nonInherityStyles.add(IStyle.STYLE_BORDER_DIAGONAL_NUMBER); + nonInherityStyles.add(IStyle.STYLE_BORDER_DIAGONAL_COLOR); + nonInherityStyles.add(IStyle.STYLE_BORDER_DIAGONAL_STYLE); + nonInherityStyles.add(IStyle.STYLE_BORDER_DIAGONAL_WIDTH); + nonInherityStyles.add(IStyle.STYLE_BORDER_ANTIDIAGONAL_NUMBER); + nonInherityStyles.add(IStyle.STYLE_BORDER_ANTIDIAGONAL_COLOR); + nonInherityStyles.add(IStyle.STYLE_BORDER_ANTIDIAGONAL_STYLE); + nonInherityStyles.add(IStyle.STYLE_BORDER_ANTIDIAGONAL_WIDTH); } private static final HashMap genericFontMapping = new HashMap<>(); @@ -399,7 +407,7 @@ public void startList(IListContent list) { context.startCell(); wordWriter.startTableRow(-1); IStyle style = computeStyle(list.getComputedStyle()); - wordWriter.startTableCell(context.getCurrentWidth(), style, null); + wordWriter.startTableCell(context.getCurrentWidth(), style, null, null); writeTableToc(); } @@ -450,25 +458,157 @@ public void startCell(ICellContent cell) { int rowSpan = cell.getRowSpan(); int cellWidth = context.getCellWidth(columnId, columnSpan); - IStyle style = computeStyle(cell.getComputedStyle()); -// style.get + IStyle cellStyle = computeStyle(cell.getComputedStyle()); + Boolean[] inheritedStyleFromRow = inheritCellStyle(cell); if (rowSpan > 1) { - context.addSpan(columnId, columnSpan, cellWidth, rowSpan, style); + context.addSpan(columnId, columnSpan, cellWidth, rowSpan, cellStyle); } SpanInfo info = null; if (columnSpan > 1 || rowSpan > 1) { - info = new SpanInfo(columnId, columnSpan, cellWidth, true, style); + info = new SpanInfo(columnId, columnSpan, cellWidth, true, cellStyle); } - wordWriter.startTableCell(cellWidth, style, info); - context.addWidth(getCellWidth(cellWidth, style)); + DiagonalLineInfo diagonalLineInfo = createDiagonalLineInfo(cell, WordUtil.twipToPt(cellWidth)); + wordWriter.startTableCell(cellWidth, cellStyle, info, diagonalLineInfo); + context.addWidth(getCellWidth(cellWidth, cellStyle)); writeTableToc(); - if (cell.getDiagonalNumber() != 0 && cell.getDiagonalStyle() != null + + resetInheritedStyle(cellStyle, inheritedStyleFromRow); + } + + private void resetInheritedStyle(IStyle cellStyle, Boolean[] inheritedStyleFromRow) { + + // border style top + if (inheritedStyleFromRow[0]) { + cellStyle.setBorderTopStyle(null); + cellStyle.setBorderTopColor(null); + cellStyle.setBorderTopWidth(null); + } + // border style bottom + if (inheritedStyleFromRow[1]) { + cellStyle.setBorderBottomStyle(null); + cellStyle.setBorderBottomColor(null); + cellStyle.setBorderBottomWidth(null); + } + // border style left + if (inheritedStyleFromRow[2]) { + cellStyle.setBorderLeftStyle(null); + cellStyle.setBorderLeftColor(null); + cellStyle.setBorderLeftWidth(null); + } + // border style right + if (inheritedStyleFromRow[3]) { + cellStyle.setBorderRightStyle(null); + cellStyle.setBorderRightColor(null); + cellStyle.setBorderRightWidth(null); + } + } + + private Boolean[] inheritCellStyle(ICellContent cell) { + + // cell border inherited from row, order: top, bottom, left, right + Boolean[] inheritedStyleFromRow = { false, false, false, false }; + + IRowContent row = (IRowContent) cell.getParent(); + IStyle rowStyle = row.getComputedStyle(); + IStyle cellStyle = computeStyle(cell.getComputedStyle()); + + // border top: inherited from the row line top + if ("none".equals(cellStyle.getBorderTopStyle())) { + cellStyle.setBorderTopStyle(rowStyle.getBorderTopStyle()); + cellStyle.setBorderTopWidth(rowStyle.getBorderTopWidth()); + cellStyle.setBorderTopColor(rowStyle.getBorderTopColor()); + inheritedStyleFromRow[0] = true; + } + // border bottom: inherited from the row line bottom + if ("none".equals(cellStyle.getBorderBottomStyle())) { + cellStyle.setBorderBottomStyle(rowStyle.getBorderBottomStyle()); + cellStyle.setBorderBottomWidth(rowStyle.getBorderBottomWidth()); + cellStyle.setBorderBottomColor(rowStyle.getBorderBottomColor()); + inheritedStyleFromRow[1] = true; + } + // 1st cell of row: inherited left border style if cell style is "none" + if (cell.getColumn() == 0 && "none".equals(cellStyle.getBorderLeftStyle())) { + cellStyle.setBorderLeftStyle(rowStyle.getBorderLeftStyle()); + cellStyle.setBorderLeftWidth(rowStyle.getBorderLeftWidth()); + cellStyle.setBorderLeftColor(rowStyle.getBorderLeftColor()); + inheritedStyleFromRow[2] = true; + } + // last cell of row: inherited left border style if cell style is "none" + if (cell.isLastChild() && "none".equals(cellStyle.getBorderRightStyle())) { + cellStyle.setBorderRightStyle(rowStyle.getBorderRightStyle()); + cellStyle.setBorderRightWidth(rowStyle.getBorderRightWidth()); + cellStyle.setBorderRightColor(rowStyle.getBorderRightColor()); + inheritedStyleFromRow[3] = true; + } + return inheritedStyleFromRow; + } + + private DiagonalLineInfo createDiagonalLineInfo(ICellContent cell, double cellWidth) { + int cellHeight = WordUtil.convertTo(getCellHeight(cell), 0, reportDpi) / 20; + + int diagonalSourceType = 0; + int antidiagonalSourceType = 0; + + if (cell.getDiagonalNumber() > 0 && cell.getDiagonalStyle() != null && !"none".equalsIgnoreCase(cell.getDiagonalStyle())) { - drawDiagonalLine(cell, WordUtil.twipToPt(cellWidth)); + diagonalSourceType = 1; + } + if (cell.getAntidiagonalNumber() > 0 && cell.getAntidiagonalStyle() != null + && !"none".equalsIgnoreCase(cell.getAntidiagonalStyle())) { + antidiagonalSourceType = 1; + } + + if (diagonalSourceType == 0 && antidiagonalSourceType == 0) + return null; + + DiagonalLineInfo diagonalLineInfo = new DiagonalLineInfo(); + + int cellDiagonalNumber = 0; + DimensionType cellDiagonalWidth = null; + String cellDiagonalStyle = null; + String cellDiagonalColor = null; + + if (diagonalSourceType == 1) { + cellDiagonalNumber = cell.getDiagonalNumber(); + cellDiagonalStyle = cell.getDiagonalStyle(); + cellDiagonalWidth = cell.getDiagonalWidth(); + if (cell.getDiagonalColor() != null) { + cellDiagonalColor = cell.getDiagonalColor(); + } else { + cellDiagonalColor = WordUtil.parseColor(cell.getDiagonalColor()); + } + diagonalLineInfo.setDiagonalColor(cellDiagonalColor); } + + int cellAntidiagonalNumber = 0; + DimensionType cellAntidiagonalWidth = null; + String cellAntidiagonalStyle = null; + String cellAntidiagonalColor = null; + + if (antidiagonalSourceType == 1) { + cellAntidiagonalNumber = cell.getAntidiagonalNumber(); + cellAntidiagonalStyle = cell.getAntidiagonalStyle(); + cellAntidiagonalWidth = cell.getAntidiagonalWidth(); + if (cell.getAntidiagonalColor() != null) { + cellAntidiagonalColor = cell.getAntidiagonalColor(); + } else { + cellAntidiagonalColor = WordUtil.parseColor(cell.getAntidiagonalColor()); + } + diagonalLineInfo.setAntidiagonalColor(cellAntidiagonalColor); + } + + int diagonalWidth = PropertyUtil.getDimensionValue(cell, cellDiagonalWidth, (int) cellWidth) / 1000; + diagonalLineInfo.setDiagonalLine(cellDiagonalNumber, cellDiagonalStyle, diagonalWidth); + + int antidiagonalWidth = PropertyUtil.getDimensionValue(cell, cellAntidiagonalWidth, (int) cellWidth) / 1000; + diagonalLineInfo.setAntidiagonalLine(cellAntidiagonalNumber, cellAntidiagonalStyle, antidiagonalWidth); + + diagonalLineInfo.setCoordinateSize(cellWidth, cellHeight); + + return diagonalLineInfo; } private void drawDiagonalLine(ICellContent cell, double cellWidth) { @@ -479,9 +619,10 @@ private void drawDiagonalLine(ICellContent cell, double cellWidth) { if (cellHeight == 0) { return; } + DimensionType cellDiagonalWidth = cell.getDiagonalWidth(); DiagonalLineInfo diagonalLineInfo = new DiagonalLineInfo(); - int diagonalWidth = PropertyUtil.getDimensionValue(cell, cell.getDiagonalWidth(), (int) cellWidth) / 1000; + int diagonalWidth = PropertyUtil.getDimensionValue(cell, cellDiagonalWidth, (int) cellWidth) / 1000; diagonalLineInfo.setDiagonalLine(cell.getDiagonalNumber(), cell.getDiagonalStyle(), diagonalWidth); diagonalLineInfo.setAntidiagonalLine(0, null, 0); diagonalLineInfo.setCoordinateSize(cellWidth, cellHeight); diff --git a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/DiagonalLineInfo.java b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/DiagonalLineInfo.java index a2f29009add..fc0b16bc401 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/DiagonalLineInfo.java +++ b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/DiagonalLineInfo.java @@ -16,6 +16,12 @@ import java.util.ArrayList; +/** + * Information class of the diagonal line information + * + * @since 3.3 + * + */ public class DiagonalLineInfo { private static final double CELL_MARGIN_COMPENSATION = 5.4; @@ -23,10 +29,14 @@ public class DiagonalLineInfo { private String diagonalStyle = null; // unit:point private int diagonalWidth = 0; - private int antiDiagonalCount = -1; - private String antiDiagonalStyle = null; + private String diagonalColor = null; + + private int antidiagonalCount = -1; + private String antidiagonalStyle = null; // unit:point - private int antiDiagonalWidth = 0; + private int antidiagonalWidth = 0; + private String antidiagonalColor = null; + private String color = null; // unit:point @@ -37,6 +47,13 @@ public class DiagonalLineInfo { private double coordoriginX = 0; private double coordoriginY = 0; + /** + * Set the diagonal line details + * + * @param diagonalCount count of diagonal lines + * @param diagonalStyle style of the diagonal line + * @param diagonalWidth width of the diagonal line + */ public void setDiagonalLine(int diagonalCount, String diagonalStyle, int diagonalWidth) { if (diagonalCount > 3) { this.diagonalCount = 3; @@ -47,12 +64,30 @@ public void setDiagonalLine(int diagonalCount, String diagonalStyle, int diagona this.diagonalWidth = diagonalWidth; } + /** + * Set the antidiagonal line details + * + * @param antidiagonalCount count of diagonal lines + * @param antidiagonalStyle style of the antidiagonal line + * @param antidiagonalWidth width of the antidiagonal line + * @since 4.13 + */ public void setAntidiagonalLine(int antidiagonalCount, String antidiagonalStyle, int antidiagonalWidth) { - this.antiDiagonalCount = antidiagonalCount; - this.antiDiagonalStyle = antidiagonalStyle; - this.antiDiagonalWidth = antidiagonalWidth; + if (antidiagonalCount > 3) { + this.antidiagonalCount = 3; + } else { + this.antidiagonalCount = antidiagonalCount; + } + this.antidiagonalStyle = antidiagonalStyle; + this.antidiagonalWidth = antidiagonalWidth; } + /** + * Set the coordination size + * + * @param coordinateSizeX + * @param coordinateSizeY + */ public void setCoordinateSize(double coordinateSizeX, double coordinateSizeY) { if (coordinateSizeX != 0) { this.width = coordinateSizeX; @@ -62,19 +97,80 @@ public void setCoordinateSize(double coordinateSizeX, double coordinateSizeY) { } } + /** + * Set the coordination origin + * + * @param coordinateOriginX + * @param coordinateOriginY + */ public void setCoordinateOrigin(int coordinateOriginX, int coordinateOriginY) { this.coordoriginX = coordinateOriginX; this.coordoriginY = coordinateOriginY; } + /** + * Set the color + * + * @param color + */ public void setColor(String color) { this.color = color; } + /** + * Get the color + * + * @return Return the color + */ public String getColor() { return color; } + /** + * Set the diagonal color of line + * + * @param color Set the diagonal color of the line + * @since 4.13 + */ + public void setDiagonalColor(String color) { + this.diagonalColor = color; + } + + /** + * Get the diagonal color of line + * + * @return Return the diagonal color of the line + * @since 4.13 + */ + public String getDiagonalColor() { + return diagonalColor; + } + + /** + * Set the anti-diagonal color of line + * + * @param color Set the anti-diagonal color of the line + * @since 4.13 + */ + public void setAntidiagonalColor(String color) { + this.antidiagonalColor = color; + } + + /** + * Get the anti-diagonal color of line + * + * @return Return the anti-diagonal color of the line + * @since 4.13 + */ + public String getAntidiagonalColor() { + return this.antidiagonalColor; + } + + /** + * Get the diagonal lines + * + * @return Return the diagonal lines + */ public ArrayList getDiagonalLine() { ArrayList diagonalLine = new ArrayList<>(); int num = diagonalCount >> 1; @@ -94,12 +190,17 @@ public ArrayList getDiagonalLine() { return diagonalLine; } + /** + * Get the antidiagonal lines + * + * @return Return the antidiagonal lines + */ public ArrayList getAntidiagonalLine() { ArrayList antiDiagonalLine = new ArrayList<>(); - int num = antiDiagonalCount >> 1; - double x = 2d / (antiDiagonalCount + 1) * width; - double y = 2d / (antiDiagonalCount + 1) * height; - if ((antiDiagonalCount & 1) == 1) { + int num = antidiagonalCount >> 1; + double x = 2d / (antidiagonalCount + 1) * width; + double y = 2d / (antidiagonalCount + 1) * height; + if ((antidiagonalCount & 1) == 1) { antiDiagonalLine.add(new Line(coordoriginX - CELL_MARGIN_COMPENSATION, coordoriginY + height, coordoriginX + width - CELL_MARGIN_COMPENSATION, coordoriginY)); } @@ -112,30 +213,66 @@ public ArrayList getAntidiagonalLine() { return antiDiagonalLine; } + /** + * Get the diagonal number count + * + * @return Return the diagonal number count + */ public int getDiagonalNumber() { return diagonalCount; } - public int getAntiDiagonalNumber() { - return antiDiagonalCount; + /** + * Get the antidiagonal number count + * + * @return Return the antidiagonal number count + */ + public int getAntidiagonalNumber() { + return antidiagonalCount; } + /** + * Get the diagonal style + * + * @return Return the diagonal style + */ public String getDiagonalStyle() { return diagonalStyle; } - public String getAntiDiagonalStyle() { - return antiDiagonalStyle; + /** + * Get the antidiagonal style + * + * @return Return the antidiagonal style + */ + public String getAntidiagonalStyle() { + return antidiagonalStyle; } + /** + * Get the diagonal line width + * + * @return Return the diagonal line width + */ public double getDiagonalLineWidth() { return diagonalWidth; } - public double getAntiDiagonalLineWidth() { - return antiDiagonalWidth; + /** + * Get the antidiagonal line width + * + * @return Return the antidiagonal line width + */ + public double getAntidiagonalLineWidth() { + return antidiagonalWidth; } + /** + * Static class the represent the line of diagonals + * + * @since 3.3 + * + */ public static class Line { double xCoordinateFrom; @@ -150,18 +287,38 @@ public static class Line { yCoordinateTo = yTo; } + /** + * Get the x coordinate from + * + * @return Return the x coordinate from + */ public double getXCoordinateFrom() { return xCoordinateFrom; } + /** + * Get the y coordinate from + * + * @return Return the y coordinate from + */ public double getYCoordinateFrom() { return yCoordinateFrom; } + /** + * Get the x coordinate to + * + * @return Return the x coordinate to + */ public double getXCoordinateTo() { return xCoordinateTo; } + /** + * Get the y coordinate to + * + * @return Return the y coordinate to + */ public double getYCoordinateTo() { return yCoordinateTo; } diff --git a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/DocEmitterImpl.java b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/DocEmitterImpl.java index 13a85528800..32f24033329 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/DocEmitterImpl.java +++ b/engine/org.eclipse.birt.report.engine.emitter.wpml/src/org/eclipse/birt/report/engine/emitter/wpml/DocEmitterImpl.java @@ -150,7 +150,7 @@ public void startForeign(IForeignContent foreign) throws BirtException { width = Math.min(width, context.getCurrentWidth()); wordWriter.startTable(foreign.getComputedStyle(), width, inForeign); wordWriter.startTableRow(-1); - wordWriter.startTableCell(width, foreign.getComputedStyle(), null); + wordWriter.startTableCell(width, foreign.getComputedStyle(), null, null); writeBookmark(foreign); writeToc(foreign); contentVisitor.visitChildren(foreign, null); 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 64e7cbe262d..ea0cae6991a 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 @@ -60,7 +60,17 @@ void writePageProperties(int pageHeight, int pageWidth, int headerHeight, int fo void endTableRow(); - void startTableCell(int width, IStyle style, SpanInfo info); + // void startTableCell(int width, IStyle style, SpanInfo info); + + /** + * Create the table start tag of cell element + * + * @param width + * @param style + * @param info + * @param diagonalLineInfo + */ + void startTableCell(int width, IStyle style, SpanInfo info, DiagonalLineInfo diagonalLineInfo); void endTableCell(boolean needEmptyP); 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 307c1e60ecb..d67ea968ac3 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 @@ -318,18 +318,47 @@ protected void writeBorders(IStyle style, int bottomMargin, int topMargin, int l writeSingleBorder(RIGHT, borderStyle, style.getBorderRightColor(), style.getProperty(StyleConstants.STYLE_BORDER_RIGHT_WIDTH), rightMargin); } + + } + + /** + * Writer of the diagonal attribute + * + * @param borderStyle style of the diagonal + * @param color color of the diagonal + * @param width width of the diagonal + */ + private void writeDiagonalBorder(String borderStyle, String color, double width) { + writer.openTag("w:tl2br"); + int borderSize = (int) width * 9; + writeBorderProperty(borderStyle, color, borderSize, 0); + writer.closeTag("w:tl2br"); + } + + /** + * Writer of the antidiagonal attribute + * + * @param borderStyle style of the diagonal + * @param color color of the diagonal + * @param width width of the diagonal + */ + private void writeAntidiagonalBorder(String borderStyle, String color, double width) { + writer.openTag("w:tr2bl"); + int borderSize = (int) width * 9; + writeBorderProperty(borderStyle, color, borderSize, 0); + writer.closeTag("w:tr2bl"); } private void writeSingleBorder(String type, String borderStyle, String color, CSSValue width, int margin) { writer.openTag("w:" + type); - writeBorderProperty(borderStyle, color, width, margin); + int borderSize = WordUtil.parseBorderSize(PropertyUtil.getDimensionValue(width)); + writeBorderProperty(borderStyle, color, borderSize, margin); writer.closeTag("w:" + type); } - private void writeBorderProperty(String style, String color, CSSValue width, int margin) { + private void writeBorderProperty(String style, String color, int width, int margin) { writer.attribute("w:val", WordUtil.parseBorderStyle(style)); - int borderSize = WordUtil.parseBorderSize(PropertyUtil.getDimensionValue(width)); - writer.attribute("w:sz", "double".equals(style) ? borderSize / 3 : borderSize); + writer.attribute("w:sz", "double".equals(style) ? width / 3 : width); writer.attribute("w:space", validateBorderSpace(margin)); writer.attribute("w:color", WordUtil.parseColor(color)); } @@ -425,7 +454,8 @@ private boolean hasBorder(String borderStyle) { private void writeRunBorder(String borderStyle, String color, CSSValue borderWidth) { writer.openTag("w:bdr"); - writeBorderProperty(borderStyle, color, borderWidth, 0); + int borderSize = WordUtil.parseBorderSize(PropertyUtil.getDimensionValue(borderWidth)); + writeBorderProperty(borderStyle, color, borderSize, 0); writer.closeTag("w:bdr"); } @@ -690,7 +720,15 @@ public void endTableRow() { writer.closeTag("w:tr"); } - public void startTableCell(int width, IStyle style, SpanInfo spanInfo) { + /** + * Create the table tag of cell element + * + * @param width of the cell element + * @param style of the cell element + * @param spanInfo of the cell element + * @param diagonalLineInfo of the cell element + */ + public void startTableCell(int width, IStyle style, SpanInfo spanInfo, DiagonalLineInfo diagonalLineInfo) { writer.openTag("w:tc"); writer.openTag("w:tcPr"); writeCellWidth(width); @@ -698,7 +736,7 @@ public void startTableCell(int width, IStyle style, SpanInfo spanInfo) { writeGridSpan(spanInfo); writeVmerge(spanInfo); } - writeCellProperties(style); + writeCellProperties(style, diagonalLineInfo); writer.closeTag("w:tcPr"); String align = style.getTextAlign(); @@ -736,7 +774,7 @@ public void writeSpanCell(SpanInfo info) { writeCellWidth(info.getCellWidth()); writeGridSpan(info); writeVmerge(info); - writeCellProperties(info.getStyle()); + writeCellProperties(info.getStyle(), null); writer.closeTag("w:tcPr"); insertEmptyParagraph(); writer.closeTag("w:tc"); @@ -821,7 +859,7 @@ public void writeCaption(String txt) { * * @param style this cell style */ - private void writeCellProperties(IStyle style) { + private void writeCellProperties(IStyle style, DiagonalLineInfo diagonalLineInfo) { // A cell background color may inherit from row background, // so we should get the row background color here, // if the cell background is transparent @@ -829,7 +867,7 @@ private void writeCellProperties(IStyle style) { return; } writeBackgroundColor(style.getBackgroundColor()); - writeCellBorders(style); + writeCellBorders(style, diagonalLineInfo); writeCellPadding(style); String verticalAlign = style.getVerticalAlign(); if (verticalAlign != null) { @@ -839,9 +877,22 @@ private void writeCellProperties(IStyle style) { writeAttrTag("w:noWrap", noWrap); } - private void writeCellBorders(IStyle style) { + private void writeCellBorders(IStyle style, DiagonalLineInfo diagonalLineInfo) { writer.openTag("w:tcBorders"); writeBorders(style, 0, 0, 0, 0); + + if (diagonalLineInfo != null) { + if (diagonalLineInfo.getDiagonalNumber() > 0 + && !"none".equals(diagonalLineInfo.getDiagonalStyle())) { + writeDiagonalBorder(diagonalLineInfo.getDiagonalStyle(), diagonalLineInfo.getDiagonalColor(), + diagonalLineInfo.getDiagonalLineWidth()); + } + if (diagonalLineInfo.getAntidiagonalNumber() > 0 + && !"none".equals(diagonalLineInfo.getAntidiagonalStyle())) { + writeAntidiagonalBorder(diagonalLineInfo.getAntidiagonalStyle(), + diagonalLineInfo.getAntidiagonalColor(), diagonalLineInfo.getAntidiagonalLineWidth()); + } + } writer.closeTag("w:tcBorders"); } @@ -1181,23 +1232,36 @@ protected void endHeaderFooterContainer() { writer.closeTag("w:tbl"); } + /** + * Draw the diagonal line + * + * @param diagonalLineInfo information object of the diagonal + */ public void drawDiagonalLine(DiagonalLineInfo diagonalLineInfo) { - if (diagonalLineInfo.getDiagonalNumber() <= 0 && diagonalLineInfo.getAntiDiagonalNumber() <= 0) { + if (diagonalLineInfo.getDiagonalNumber() <= 0 && diagonalLineInfo.getAntidiagonalNumber() <= 0 + || "NONE".equals(diagonalLineInfo.getDiagonalStyle()) + && "NONE".equals(diagonalLineInfo.getAntidiagonalStyle())) { return; } writer.openTag("w:p"); writer.openTag("w:r"); writer.openTag("w:pict"); - double diagonalLineWidth = diagonalLineInfo.getDiagonalLineWidth(); - String diagonalLineStyle = diagonalLineInfo.getDiagonalStyle(); - double antidiagonalLineWidth = diagonalLineInfo.getAntiDiagonalLineWidth(); - String antidiagonalLineStyle = diagonalLineInfo.getAntiDiagonalStyle(); String lineColor = diagonalLineInfo.getColor(); - for (Line line : diagonalLineInfo.getDiagonalLine()) { - drawLine(diagonalLineWidth, diagonalLineStyle, lineColor, line); + + if (diagonalLineInfo.getDiagonalNumber() > 0 && !"NONE".equals(diagonalLineInfo.getDiagonalStyle())) { + double diagonalLineWidth = diagonalLineInfo.getDiagonalLineWidth(); + String diagonalLineStyle = diagonalLineInfo.getDiagonalStyle(); + + for (Line line : diagonalLineInfo.getDiagonalLine()) { + drawLine(diagonalLineWidth, diagonalLineStyle, lineColor, line); + } } - for (Line antiLine : diagonalLineInfo.getAntidiagonalLine()) { - drawLine(antidiagonalLineWidth, antidiagonalLineStyle, lineColor, antiLine); + if (diagonalLineInfo.getAntidiagonalNumber() > 0 && !"NONE".equals(diagonalLineInfo.getAntidiagonalStyle())) { + double antidiagonalLineWidth = diagonalLineInfo.getAntidiagonalLineWidth(); + String antidiagonalLineStyle = diagonalLineInfo.getAntidiagonalStyle(); + for (Line antiLine : diagonalLineInfo.getAntidiagonalLine()) { + drawLine(antidiagonalLineWidth, antidiagonalLineStyle, lineColor, antiLine); + } } writer.closeTag("w:pict"); writer.closeTag("w:r"); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/TOCStyle.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/TOCStyle.java index 447e2d7d7c8..9cd055821c5 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/TOCStyle.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/TOCStyle.java @@ -111,6 +111,40 @@ public class TOCStyle implements IScriptStyle, Serializable { */ public static final String BORDER_RIGHT_STYLE = "border-right-style"; + /** + * Style property: border-diagonal-number + */ + public static final String BORDER_DIAGONAL_NUMBER = "border-diagonal-number"; + /** + * Style property: border-diagonal-style + */ + public static final String BORDER_DIAGONAL_STYLE = "border-diagonal-style"; + /** + * Style property: border-diagonal-width + */ + public static final String BORDER_DIAGONAL_WIDTH = "border-diagonal-width"; + /** + * Style property: border-diagonal-color + */ + public static final String BORDER_DIAGONAL_COLOR = "border-diagonal-color"; + + /** + * Style property: border-antidiagonal-number + */ + public static final String BORDER_ANTIDIAGONAL_NUMBER = "border-antidiagonal-number"; + /** + * Style property: border-antidiagonal-style + */ + public static final String BORDER_ANTIDIAGONAL_STYLE = "border-antidiagonal-style"; + /** + * Style property: border-antidiagonal-width + */ + public static final String BORDER_ANTIDIAGONAL_WIDTH = "border-antidiagonal-width"; + /** + * Style property: border-antidiagonal-color + */ + public static final String BORDER_ANTIDIAGONAL_COLOR = "border-antidiagonal-color"; + /** * Style property: can-shrink */ @@ -1320,4 +1354,85 @@ public String toString() { } return sb.toString(); } + + @Override + public int getDiagonalNumber() { + return Integer.parseInt(properties.get(BORDER_DIAGONAL_NUMBER)); + } + + @Override + public void setDiagonalNumber(int number) { + setProperty(BORDER_DIAGONAL_NUMBER, Integer.toString(number).toString()); + } + + @Override + public String getDiagonalStyle() { + return properties.get(BORDER_DIAGONAL_STYLE); + } + + @Override + public void setDiagonalStyle(String style) { + setProperty(BORDER_DIAGONAL_STYLE, style); + } + + @Override + public String getDiagonalWidth() { + return properties.get(BORDER_DIAGONAL_WIDTH); + } + + @Override + public void setDiagonalWidth(String width) { + setProperty(BORDER_DIAGONAL_WIDTH, width); + } + + @Override + public String getDiagonalColor() { + return properties.get(BORDER_DIAGONAL_COLOR); + } + + @Override + public void setDiagonalColor(String color) { + setProperty(BORDER_DIAGONAL_COLOR, color); + } + + @Override + public int getAntidiagonalNumber() { + return Integer.parseInt(properties.get(BORDER_ANTIDIAGONAL_NUMBER)); + } + + @Override + public void setAntidiagonalNumber(int number) { + setProperty(BORDER_ANTIDIAGONAL_NUMBER, Integer.toString(number).toString()); + } + + @Override + public String getAntidiagonalStyle() { + return properties.get(BORDER_ANTIDIAGONAL_STYLE); + } + + @Override + public void setAntidiagonalStyle(String style) { + setProperty(BORDER_ANTIDIAGONAL_STYLE, style); + } + + @Override + public String getAntidiagonalWidth() { + return properties.get(BORDER_ANTIDIAGONAL_WIDTH); + } + + @Override + public void setAntidiagonalWidth(String width) { + setProperty(BORDER_ANTIDIAGONAL_WIDTH, width); + } + + @Override + public String getAntidiagonalColor() { + return properties.get(BORDER_ANTIDIAGONAL_COLOR); + } + + @Override + public void setAntidiagonalColor(String color) { + setProperty(BORDER_ANTIDIAGONAL_COLOR, color); + } + } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/instance/IScriptStyle.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/instance/IScriptStyle.java index 4ffa87deee1..87432a451b1 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/instance/IScriptStyle.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/script/instance/IScriptStyle.java @@ -898,4 +898,115 @@ public interface IScriptStyle { */ void setBackgroundPositionY(String y) throws ScriptException; + /** + * Get the diagonal line number + * + * @return Return the diagonal line number + */ + int getDiagonalNumber(); + + /** + * Set the diagonal line number + * + * @param number + */ + void setDiagonalNumber(int number); + + /** + * Get the diagonal color + * + * @return Return the diagonal color + */ + String getDiagonalColor(); + + /** + * Set the diagonal color + * + * @param color + */ + void setDiagonalColor(String color); + + /** + * Get the diagonal style + * + * @return Return the diagonal style + */ + String getDiagonalStyle(); + + /** + * Set the diagonal style + * + * @param style + */ + void setDiagonalStyle(String style); + + /** + * Get the diagonal width + * + * @return Return the diagonal width + */ + String getDiagonalWidth(); + + /** + * Set the diagonal width + * + * @param width + */ + void setDiagonalWidth(String width); + + /** + * Get the antidiagonal line number + * + * @return Return the antidiagonal line number + */ + int getAntidiagonalNumber(); + + /** + * Set the antidiagonal line number + * + * @param number + */ + void setAntidiagonalNumber(int number); + + /** + * Get the antidiagonal color + * + * @return Return the antidiagonal color + */ + String getAntidiagonalColor(); + + /** + * Set the antidiagonal color + * + * @param color + */ + void setAntidiagonalColor(String color); + + /** + * Get the antidiagonal style + * + * @return Return the antidiagonal style + */ + String getAntidiagonalStyle(); + + /** + * Set the antidiagonal style + * + * @param style + */ + void setAntidiagonalStyle(String style); + + /** + * Get the antidiagonal width + * + * @return Return the antidiagonal width + */ + String getAntidiagonalWidth(); + + /** + * Set the antidiagonal width + * + * @param width + */ + void setAntidiagonalWidth(String width); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/IStyle.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/IStyle.java index 83a3183542c..029a2d9b874 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/IStyle.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/IStyle.java @@ -351,4 +351,117 @@ public interface IStyle extends CSSStyleDeclaration, StyleConstants, CSS2Propert * @param imageType */ void setBackgroundImageType(String imageType); + + /** + * Get the diagonal line number + * + * @return Return the diagonal line number + */ + int getDiagonalNumber(); + + /** + * Set the diagonal line number + * + * @param number + */ + void setDiagonalNumber(Integer number); + + /** + * Get the diagonal style + * + * @return Return the diagonal style + */ + String getDiagonalStyle(); + + /** + * Set the diagonal style + * + * @param style + */ + void setDiagonalStyle(String style); + + /** + * Get the diagonal width + * + * @return Return the diagonal width + */ + String getDiagonalWidth(); + + /** + * Set the diagonal width + * + * @param width + */ + void setDiagonalWidth(String width); + + /** + * Get the diagonal color + * + * @return Return the diagonal color + */ + String getDiagonalColor(); + + /** + * Set the diagonal color + * + * @param color + */ + void setDiagonalColor(String color); + + /** + * Get the antidiagonal line number + * + * @return Return the antidiagonal line number + */ + int getAntidiagonalNumber(); + + /** + * Set the antidiagonal line number + * + * @param number + */ + void setAntidiagonalNumber(Integer number); + + /** + * Get the antidiagonal style + * + * @return Return the antidiagonal style + */ + String getAntidiagonalStyle(); + + /** + * Set the antidiagonal style + * + * @param style + */ + void setAntidiagonalStyle(String style); + + /** + * Get the antidiagonal width + * + * @return Return the diagonal width + */ + String getAntidiagonalWidth(); + + /** + * Set the antidiagonal width + * + * @param width + */ + void setAntidiagonalWidth(String width); + + /** + * Get the antidiagonal color + * + * @return Return the diagonal color + */ + String getAntidiagonalColor(); + + /** + * Set the antidiagonal color + * + * @param color + */ + void setAntidiagonalColor(String color); + } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/impl/CellContent.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/impl/CellContent.java index c8cc56c562b..534352e1858 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/impl/CellContent.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/impl/CellContent.java @@ -460,10 +460,25 @@ protected IContent cloneContent() { @Override public boolean hasDiagonalLine() { + IStyle cellStyle = this.getComputedStyle(); + if (cellStyle.getDiagonalNumber() > 0 && cellStyle.getDiagonalStyle() != null + && !"none".equals(cellStyle.getDiagonalStyle()) + || cellStyle.getAntidiagonalNumber() > 0 && cellStyle.getAntidiagonalStyle() != null + && !"none".equals(cellStyle.getAntidiagonalStyle())) { + hasDiagonalLine = Boolean.TRUE; + + } else if (getDiagonalNumber() > 0 && getDiagonalStyle() != null && !"none".equals(getDiagonalStyle()) + || getAntidiagonalNumber() > 0 && getAntidiagonalStyle() != null + && !"none".equals(getAntidiagonalStyle())) { + hasDiagonalLine = Boolean.TRUE; + + } else if (cellDesign != null) { + hasDiagonalLine = cellDesign.hasDiagonalLine(); + + } + if (hasDiagonalLine != null) { return hasDiagonalLine.booleanValue(); - } else if (cellDesign != null) { - return cellDesign.hasDiagonalLine(); } return false; } @@ -471,16 +486,14 @@ public boolean hasDiagonalLine() { @Override public void setDiagonalNumber(int diagonalNumber) { this.diagonalNumber = diagonalNumber; - if (getDiagonalNumber() > 0 || getAntidiagonalNumber() > 0) { - hasDiagonalLine = Boolean.TRUE; - } else { - hasDiagonalLine = Boolean.FALSE; - } } @Override public int getDiagonalNumber() { - if (diagonalNumber >= 0) { + IStyle cellStyle = this.getComputedStyle(); + if (cellStyle.getDiagonalNumber() >= 1) { + return cellStyle.getDiagonalNumber(); + } else if (diagonalNumber > 1) { return diagonalNumber; } else if (cellDesign != null) { return cellDesign.getDiagonalNumber(); @@ -495,7 +508,10 @@ public void setDiagonalStyle(String diagonalStyle) { @Override public String getDiagonalStyle() { - if (diagonalStyle != null) { + IStyle cellStyle = this.getComputedStyle(); + if (cellStyle.getDiagonalStyle() != null && !"none".equals(cellStyle.getDiagonalStyle())) { + return cellStyle.getDiagonalStyle(); + } else if (diagonalStyle != null) { return diagonalStyle; } else if (cellDesign != null) { return cellDesign.getDiagonalStyle(); @@ -510,7 +526,10 @@ public void setDiagonalWidth(DimensionType diagonalWidth) { @Override public DimensionType getDiagonalWidth() { - if (diagonalWidth != null) { + IStyle cellStyle = this.getComputedStyle(); + if (cellStyle.getDiagonalWidth() != null && !"none".equals(cellStyle.getDiagonalStyle())) { + return DimensionType.parserUnit(cellStyle.getDiagonalWidth()); + } else if (diagonalWidth != null) { return diagonalWidth; } else if (cellDesign != null) { return cellDesign.getDiagonalWidth(); @@ -525,7 +544,10 @@ public void setDiagonalColor(String diagonalColor) { @Override public String getDiagonalColor() { - if (diagonalColor != null) { + IStyle cellStyle = this.getComputedStyle(); + if (cellStyle.getDiagonalColor() != null && !"none".equals(cellStyle.getDiagonalStyle())) { + return cellStyle.getDiagonalColor(); + } else if (diagonalColor != null) { return diagonalColor; } else if (cellDesign != null) { return cellDesign.getDiagonalColor(); @@ -536,16 +558,14 @@ public String getDiagonalColor() { @Override public void setAntidiagonalNumber(int antidiagonalNumber) { this.antidiagonalNumber = antidiagonalNumber; - if (getDiagonalNumber() > 0 || getAntidiagonalNumber() > 0) { - hasDiagonalLine = Boolean.TRUE; - } else { - hasDiagonalLine = Boolean.FALSE; - } } @Override public int getAntidiagonalNumber() { - if (antidiagonalNumber >= 0) { + IStyle cellStyle = this.getComputedStyle(); + if (cellStyle.getAntidiagonalNumber() >= 1) { + return cellStyle.getAntidiagonalNumber(); + } else if (antidiagonalNumber >= 1) { return antidiagonalNumber; } else if (cellDesign != null) { return cellDesign.getAntidiagonalNumber(); @@ -560,7 +580,10 @@ public void setAntidiagonalStyle(String antidiagonalStyle) { @Override public String getAntidiagonalStyle() { - if (antidiagonalStyle != null) { + IStyle cellStyle = this.getComputedStyle(); + if (cellStyle.getAntidiagonalStyle() != null && !"none".equals(cellStyle.getAntidiagonalStyle())) { + return cellStyle.getAntidiagonalStyle(); + } else if (antidiagonalStyle != null) { return antidiagonalStyle; } else if (cellDesign != null) { return cellDesign.getAntidiagonalStyle(); @@ -575,7 +598,10 @@ public void setAntidiagonalWidth(DimensionType antidiagonalWidth) { @Override public DimensionType getAntidiagonalWidth() { - if (antidiagonalWidth != null) { + IStyle cellStyle = this.getComputedStyle(); + if (cellStyle.getAntidiagonalWidth() != null && !"none".equals(cellStyle.getAntidiagonalStyle())) { + return DimensionType.parserUnit(cellStyle.getAntidiagonalWidth()); + } else if (antidiagonalWidth != null) { return antidiagonalWidth; } else if (cellDesign != null) { return cellDesign.getAntidiagonalWidth(); @@ -590,7 +616,10 @@ public void setAntidiagonalColor(String antidiagonalColor) { @Override public String getAntidiagonalColor() { - if (antidiagonalColor != null) { + IStyle cellStyle = this.getComputedStyle(); + if (cellStyle.getAntidiagonalColor() != null && !"none".equals(cellStyle.getAntidiagonalStyle())) { + return cellStyle.getAntidiagonalColor(); + } else if (antidiagonalColor != null) { return antidiagonalColor; } else if (cellDesign != null) { return cellDesign.getAntidiagonalColor(); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java index 63601e78135..eab43252e1f 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java @@ -1915,6 +1915,24 @@ public void read(DataInputStream in) throws IOException { this.setDateTimeFormat(propertyCssText); } else if (BIRTConstants.BIRT_BACKGROUND_IMAGE_TYPE.equalsIgnoreCase(propertyName)) { this.setBackgroundImageType(propertyCssText); + // diagonal line + } else if (BIRTConstants.BIRT_BORDER_DIAGONAL_NUMBER.equalsIgnoreCase(propertyName)) { + this.setDiagonalNumber(Integer.parseInt(propertyCssText)); + } else if (BIRTConstants.BIRT_BORDER_DIAGONAL_STYLE.equalsIgnoreCase(propertyName)) { + this.setDiagonalStyle(propertyCssText); + } else if (BIRTConstants.BIRT_BORDER_DIAGONAL_WIDTH.equalsIgnoreCase(propertyName)) { + this.setDiagonalWidth(propertyCssText); + } else if (BIRTConstants.BIRT_BORDER_DIAGONAL_COLOR.equalsIgnoreCase(propertyName)) { + this.setDiagonalColor(propertyCssText); + // antidiagonal line + } else if (BIRTConstants.BIRT_BORDER_ANTIDIAGONAL_NUMBER.equalsIgnoreCase(propertyName)) { + this.setAntidiagonalNumber(Integer.parseInt(propertyCssText)); + } else if (BIRTConstants.BIRT_BORDER_ANTIDIAGONAL_STYLE.equalsIgnoreCase(propertyName)) { + this.setAntidiagonalStyle(propertyCssText); + } else if (BIRTConstants.BIRT_BORDER_ANTIDIAGONAL_WIDTH.equalsIgnoreCase(propertyName)) { + this.setAntidiagonalWidth(propertyCssText); + } else if (BIRTConstants.BIRT_BORDER_ANTIDIAGONAL_COLOR.equalsIgnoreCase(propertyName)) { + this.setAntidiagonalColor(propertyCssText); } else { throw new IOException(propertyName + " not valid"); } @@ -1937,4 +1955,84 @@ public DataFormatValue getDataFormat() { public void setDataFormat(DataFormatValue value) { setProperty(StyleConstants.STYLE_DATA_FORMAT, value); } + + @Override + public int getDiagonalNumber() { + return Integer.parseInt(getCssText(STYLE_BORDER_DIAGONAL_NUMBER)); + } + + @Override + public void setDiagonalNumber(Integer number) { + setCssText(StyleConstants.STYLE_BORDER_DIAGONAL_NUMBER, number.toString()); + } + + @Override + public String getDiagonalStyle() { + return getCssText(StyleConstants.STYLE_BORDER_DIAGONAL_STYLE); + } + + @Override + public void setDiagonalStyle(String style) { + setCssText(StyleConstants.STYLE_BORDER_DIAGONAL_STYLE, style); + } + + @Override + public String getDiagonalWidth() { + return getCssText(StyleConstants.STYLE_BORDER_DIAGONAL_WIDTH); + } + + @Override + public void setDiagonalWidth(String width) { + setCssText(StyleConstants.STYLE_BORDER_DIAGONAL_WIDTH, width); + } + + @Override + public String getDiagonalColor() { + return getCssText(StyleConstants.STYLE_BORDER_DIAGONAL_COLOR); + } + + @Override + public void setDiagonalColor(String color) { + setCssText(StyleConstants.STYLE_BORDER_DIAGONAL_COLOR, color); + } + + @Override + public int getAntidiagonalNumber() { + return Integer.parseInt(this.getProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_NUMBER).toString()); + } + + @Override + public void setAntidiagonalNumber(Integer number) { + setCssText(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_NUMBER, number.toString()); + } + + @Override + public String getAntidiagonalStyle() { + return getCssText(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_STYLE); + } + + @Override + public void setAntidiagonalStyle(String style) { + setCssText(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_STYLE, style); + } + + @Override + public String getAntidiagonalWidth() { + return getCssText(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_WIDTH); + } + + @Override + public void setAntidiagonalWidth(String width) { + setCssText(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_WIDTH, width); + } + + @Override + public String getAntidiagonalColor() { + return getCssText(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_COLOR); + } + + @Override + public void setAntidiagonalColor(String color) { + setCssText(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_COLOR, color); + } } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/BIRTPropertyManagerFactory.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/BIRTPropertyManagerFactory.java index 47c2c760628..db3b19eb295 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/BIRTPropertyManagerFactory.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/BIRTPropertyManagerFactory.java @@ -183,6 +183,25 @@ public BIRTPropertyManagerFactory() { CSSValueConstants.NUMBER_0); vms[StyleConstants.STYLE_BACKGROUND_IMAGE_TYPE] = new BackgroundImageType(); + vms[StyleConstants.STYLE_BORDER_DIAGONAL_NUMBER] = new IntegerManager( + CSSConstants.CSS_BORDER_DIAGONAL_NUMBER_PROPERTY, false, 1); + + vms[StyleConstants.STYLE_BORDER_DIAGONAL_WIDTH] = new BorderWidthManager( + CSSConstants.CSS_BORDER_DIAGONAL_WIDTH_PROPERTY); + vms[StyleConstants.STYLE_BORDER_DIAGONAL_COLOR] = new BorderColorManager( + CSSConstants.CSS_BORDER_DIAGONAL_COLOR_PROPERTY); + vms[StyleConstants.STYLE_BORDER_DIAGONAL_STYLE] = new BorderStyleManager( + CSSConstants.CSS_BORDER_DIAGONAL_STYLE_PROPERTY); + + vms[StyleConstants.STYLE_BORDER_ANTIDIAGONAL_NUMBER] = new IntegerManager( + CSSConstants.CSS_BORDER_DIAGONAL_NUMBER_PROPERTY, false, 1); + + vms[StyleConstants.STYLE_BORDER_ANTIDIAGONAL_WIDTH] = new BorderWidthManager( + CSSConstants.CSS_BORDER_ANTIDIAGONAL_WIDTH_PROPERTY); + vms[StyleConstants.STYLE_BORDER_ANTIDIAGONAL_COLOR] = new BorderColorManager( + CSSConstants.CSS_BORDER_ANTIDIAGONAL_COLOR_PROPERTY); + vms[StyleConstants.STYLE_BORDER_ANTIDIAGONAL_STYLE] = new BorderStyleManager( + CSSConstants.CSS_BORDER_ANTIDIAGONAL_STYLE_PROPERTY); } @Override diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/PerfectHash.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/PerfectHash.java index 59dec0cddf4..31516eac12c 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/PerfectHash.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/PerfectHash.java @@ -18,11 +18,11 @@ public class PerfectHash { // bidi_hcg: Aligned with generated token.cpp after the "direction" keyword // was added. - final static int TOTAL_KEYWORDS = 62; + final static int TOTAL_KEYWORDS = 70; final static int MIN_WORD_LENGTH = 5; - final static int MAX_WORD_LENGTH = 21; + final static int MAX_WORD_LENGTH = 25; final static int MIN_HASH_VALUE = 10; @@ -35,7 +35,8 @@ public class PerfectHash { 112, 112, 112, 112, 112, 112, 112, 45, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 52, 5, 0, 0, 15, 40, 20, 0, - 40, 112, 15, 0, 20, 5, 0, 5, 112, 5, 40, 0, 112, 15, 45, 30, 36, 112, 112, 112, 112, 112, 112, 112 }; + 40, 112, 15, 0, 20, 5, 0, 5, 112, 5, 40, 0, 112, 15, 45, 30, 36, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112 }; public static int hash(String str) { int hashValue = str.length(); @@ -62,7 +63,7 @@ public static int hash(String str) { static int lengthtable[] = { 5, 11, 11, 12, 13, 9, 11, 17, 16, 17, 18, 19, 10, 16, 18, 19, 11, 12, 14, 10, 11, 18, 19, 10, 6, 12, 5, 16, 7, 11, 12, 13, 21, 17, 13, 14, 16, 21, 8, 9, 10, 16, 17, 13, 14, 16, 17, 21, 14, 16, - 7, 11, 17, 14, 6, 11, 17, 16, 14, 12, 11, 21 }; + 7, 11, 17, 14, 6, 11, 17, 16, 14, 12, 11, 21, 22, 21, 21, 21, 26, 25, 25, 25 }; static String wordlist[] = { "color" /* hash value = 10, index = 0 */, "data-format" /* hash value = 11, index = 1 */, "line-height" /* hash value = 16, index = 2 */, "padding-left" /* hash value = 17, index = 3 */, "padding-right" /* hash value = 18, index = 4 */, @@ -97,14 +98,22 @@ public static int hash(String str) { "widows" /* hash value = 91, index = 54 */, "font-family" /* hash value = 92, index = 55 */, "page-break-inside" /* hash value = 97, index = 56 */, "page-break-after" /* hash value = 98, index = 57 */, "text-underline" /* hash value = 99, index = 58 */, "word-spacing" /* hash value = 102, index = 59 */, - "white-space" /* hash value = 111, index = 60 */, "background-image-type" /* hash value = ??, index = 61 */ + "white-space" /* hash value = 111, index = 60 */, "background-image-type" /* hash value = ??, index = 61 */, + "border-diagonal-number" /* hash value = ??, index = 62 */, + "border-diagonal-width" /* hash value = ??, index = 63 */, + "border-diagonal-color" /* hash value = ??, index = 64 */, + "border-diagonal-style" /* hash value = ??, index = 65 */, + "border-antidiagonal-number" /* hash value = ??, index = 66 */, + "border-antidiagonal-width" /* hash value = ??, index = 67 */, + "border-antidiagonal-color" /* hash value = ??, index = 68 */, + "border-antidiagonal-style" /* hash value = ??, index = 69 */ }; static short lookup[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, -1, -1, -1, -1, 2, 3, 4, 5, -1, 6, 7, -1, -1, -1, 8, 9, 10, 11, 12, 13, -1, 14, 15, -1, 16, 17, -1, 18, 19, 20, -1, 21, 22, 23, 24, 25, -1, -1, 26, 27, 28, -1, -1, -1, 29, 30, 31, -1, -1, 32, 33, 34, 35, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, -1, 45, 46, 47, 48, -1, 49, -1, 50, -1, -1, 51, 52, -1, 53, -1, 54, 55, -1, -1, -1, -1, 56, 57, 58, -1, -1, 59, -1, -1, - -1, -1, -1, -1, -1, -1, 60, -1 }; + -1, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; public static int in_word_set(String str) { int len = str.length(); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/StyleConstants.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/StyleConstants.java index d691cc20c03..c1c61b93b37 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/StyleConstants.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/StyleConstants.java @@ -209,7 +209,31 @@ public interface StyleConstants { /** style property: background image type */ int STYLE_BACKGROUND_IMAGE_TYPE = 61; + /** style property: border diagonal number */ + int STYLE_BORDER_DIAGONAL_NUMBER = 62; + + /** style property: border diagonal style */ + int STYLE_BORDER_DIAGONAL_STYLE = 63; + + /** style property: border diagonal width */ + int STYLE_BORDER_DIAGONAL_WIDTH = 64; + + /** style property: border diagonal color */ + int STYLE_BORDER_DIAGONAL_COLOR = 65; + + + /** style property: border antidiagonal number */ + int STYLE_BORDER_ANTIDIAGONAL_NUMBER = 66; + + /** style property: border antidiagonal style */ + int STYLE_BORDER_ANTIDIAGONAL_STYLE = 67; + + /** style property: border antidiagonal width */ + int STYLE_BORDER_ANTIDIAGONAL_WIDTH = 68; + + /** style property: border antidiagonal color */ + int STYLE_BORDER_ANTIDIAGONAL_COLOR = 69; /** number (count) of style constants */ - int NUMBER_OF_STYLE = 62; + int NUMBER_OF_STYLE = 70; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/birt/BIRTConstants.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/birt/BIRTConstants.java index 4faa7c6d2a4..7d4917fa7a2 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/birt/BIRTConstants.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/birt/BIRTConstants.java @@ -73,6 +73,40 @@ public interface BIRTConstants extends CSSConstants { */ String BIRT_STYLE_DATA_FORMAT = "data-format"; + /** + * BIRT property: border-diagonal-number + */ + String BIRT_BORDER_DIAGONAL_NUMBER = "border-diagonal-number"; + /** + * BIRT property: border-diagonal-style + */ + String BIRT_BORDER_DIAGONAL_STYLE = "border-diagonal-style"; + /** + * BIRT property: border-diagonal-width + */ + String BIRT_BORDER_DIAGONAL_WIDTH = "border-diagonal-width"; + /** + * BIRT property: border-diagonal-color + */ + String BIRT_BORDER_DIAGONAL_COLOR = "border-diagonal-color"; + + /** + * BIRT property: border-antidiagonal-number + */ + String BIRT_BORDER_ANTIDIAGONAL_NUMBER = "border-antidiagonal-number"; + /** + * BIRT property: border-antidiagonal-style + */ + String BIRT_BORDER_ANTIDIAGONAL_STYLE = "border-antidiagonal-style"; + /** + * BIRT property: border-antidiagonal-width + */ + String BIRT_BORDER_ANTIDIAGONAL_WIDTH = "border-antidiagonal-width"; + /** + * BIRT property: border-antidiagonal-color + */ + String BIRT_BORDER_ANTIDIAGONAL_COLOR = "border-antidiagonal-color"; + /////////////////////////////////////////////////////////////////////// // Deprecated format constants, they are replaced by data-format ////////////////////////////////////////////////////////////////////// diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSConstants.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSConstants.java index badaa22162d..2970d8115d5 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSConstants.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSConstants.java @@ -1216,4 +1216,56 @@ public interface CSSConstants { * CSS property value: independent */ public final static String CSS_INDEPENDENT_VALUE = "independent"; + + /** + * CSS property value: cell border diagonal usage + */ + public final static String CSS_BORDER_DIAGONAL = "border-diagonal"; + /** + * CSS property value: cell border diagonal number + */ + public final static String CSS_BORDER_DIAGONAL_NUMBER_PROPERTY = "border-diagonal-number"; + /** + * CSS property value: cell border diagonal width + */ + public final static String CSS_BORDER_DIAGONAL_WIDTH_PROPERTY = "border-diagonal-width"; + /** + * CSS property value: cell border diagonal color + */ + public final static String CSS_BORDER_DIAGONAL_COLOR_PROPERTY = "border-diagonal-color"; + /** + * CSS property value: cell border diagonal style + */ + public final static String CSS_BORDER_DIAGONAL_STYLE_PROPERTY = "border-diagonal-style"; + + /** + * CSS property value: cell border diagonal usage + */ + public final static String CSS_BORDER_ANTIDIAGONAL = "border-antidiagonal"; + /** + * CSS property value: cell border diagonal number + */ + public final static String CSS_BORDER_ANTIDIAGONAL_NUMBER_PROPERTY = "border-antidiagonal-number"; + /** + * CSS property value: cell border antidiagonal width + */ + public final static String CSS_BORDER_ANTIDIAGONAL_WIDTH_PROPERTY = "border-antidiagonal-width"; + /** + * CSS property value: cell border antidiagonal color + */ + public final static String CSS_BORDER_ANTIDIAGONAL_COLOR_PROPERTY = "border-antidiagonal-color"; + /** + * CSS property value: cell border antidiagonal style + */ + public final static String CSS_BORDER_ANTIDIAGONAL_STYLE_PROPERTY = "border-antidiagonal-style"; + + /** + * CSS property value: cell border cross-diagonal usage + */ + public final static String CSS_BORDER_CROSS_DIAGONAL_XLSX = "border-cross-diagonal"; + + /** + * CSS property value: cell border diagonal line number + */ + public final static String CSS_BORDER_DIAGONAL_LINE_NUMBER_VALUE = "1"; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSValueConstants.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSValueConstants.java index 0105444aa45..7f89ad775e4 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSValueConstants.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/CSSValueConstants.java @@ -943,4 +943,9 @@ public interface CSSValueConstants { */ Value URL_VALUE = new StringValue(CSSPrimitiveValue.CSS_IDENT, CSSConstants.CSS_URL_VALUE); + /** + * The 'diagonal line number' keyword. + */ + Value DIAGONAL_LINE_NUMBER_VALUE = new StringValue(CSSPrimitiveValue.CSS_IDENT, + CSSConstants.CSS_BORDER_DIAGONAL_LINE_NUMBER_VALUE); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/CellDesign.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/CellDesign.java index 39de1175071..b4073f2e4c2 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/CellDesign.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/CellDesign.java @@ -199,16 +199,18 @@ public boolean getDisplayGroupIcon() { } public boolean hasDiagonalLine() { + if (getDiagonalNumber() > 0 && getDiagonalStyle() != null && !"none".equals(getDiagonalStyle()) + || getAntidiagonalNumber() > 0 && getAntidiagonalStyle() != null + && !"none".equals(getAntidiagonalStyle())) { + hasDiagonalLine = true; + } else { + hasDiagonalLine = false; + } return hasDiagonalLine; } public void setDiagonalNumber(int diagonalNumber) { this.diagonalNumber = diagonalNumber; - if (this.diagonalNumber > 0 || this.antidiagonalNumber > 0) { - hasDiagonalLine = true; - } else { - hasDiagonalLine = false; - } } public int getDiagonalNumber() { @@ -241,11 +243,6 @@ public String getDiagonalColor() { public void setAntidiagonalNumber(int antidiagonalNumber) { this.antidiagonalNumber = antidiagonalNumber; - if (this.diagonalNumber > 0 || this.antidiagonalNumber > 0) { - hasDiagonalLine = true; - } else { - hasDiagonalLine = false; - } } public int getAntidiagonalNumber() { diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/layout/emitter/PageDeviceRender.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/layout/emitter/PageDeviceRender.java index 1f5f48e61da..6f2ca07f153 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/layout/emitter/PageDeviceRender.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/layout/emitter/PageDeviceRender.java @@ -274,7 +274,7 @@ protected void drawCellDiagonal(CellArea cell) { int height = getHeight(cell); int dw = diagonalInfo.getDiagonalWidth(); int ds = diagonalInfo.getDiagonalStyle(); - // support double style, use solid style instead. + // unsupported double line style, use solid style instead if (ds == AreaConstants.BORDER_STYLE_DOUBLE) { ds = AreaConstants.BORDER_STYLE_SOLID; } @@ -299,37 +299,39 @@ protected void drawCellDiagonal(CellArea cell) { getScaledValue(dw), diagonalInfo.getDiagonalColor(), ds); break; } - // currently only support diagonal line, do not support antidiagonal line - /* - * dw = diagonalInfo.getAntidiagonalWidth( ); ds = - * diagonalInfo.getAntidiagonalStyle( ); // support double style, use solid - * style instead. if ( ds == DiagonalInfo.BORDER_STYLE_DOUBLE ) { ds = - * DiagonalInfo.BORDER_STYLE_SOLID; } switch ( - * diagonalInfo.getAntidiagonalNumber( ) ) { - * - * case 2 : pageGraphic .drawLine( startX, startY + height - dw / 2, startX + - * width / 2, startY + dw / 2, getScaledValue( diagonalInfo - * .getAntidiagonalWidth( ) ), diagonalInfo.getColor( ), ds ); pageGraphic - * .drawLine( startX, startY + height - dw / 2, startX + width, startY + height - * / 2, getScaledValue( diagonalInfo .getAntidiagonalWidth( ) ), - * diagonalInfo.getColor( ), ds ); break; case 3 : pageGraphic .drawLine( - * startX, startY + height - dw / 2, startX + width / 2, startY + dw / 2, - * getScaledValue( diagonalInfo .getAntidiagonalWidth( ) ), - * diagonalInfo.getColor( ), ds ); pageGraphic .drawLine( startX, startY + - * height - dw / 2, startX + width, startY + height / 2, getScaledValue( - * diagonalInfo .getAntidiagonalWidth( ) ), diagonalInfo.getColor( ), ds ); - * pageGraphic .drawLine( startX, startY + height - dw / 2, startX + width, - * startY + dw / 2, getScaledValue( diagonalInfo .getAntidiagonalWidth( ) ), - * diagonalInfo.getColor( ), ds ); break; default : pageGraphic .drawLine( - * startX, startY + height - dw / 2, startX + width, startY + dw / 2, - * getScaledValue( diagonalInfo .getAntidiagonalWidth( ) ), - * diagonalInfo.getColor( ), ds ); break; } - */ + + // support diagonal line and antidiagonal line + int adw = diagonalInfo.getAntidiagonalWidth(); + int ads = diagonalInfo.getAntidiagonalStyle(); + Color adc = diagonalInfo.getAntidiagonalColor(); + // unsupport double style, use solid style instead + if (ads == DiagonalInfo.BORDER_STYLE_DOUBLE) { + ads = DiagonalInfo.BORDER_STYLE_SOLID; + } + switch (diagonalInfo.getAntidiagonalNumber()) { + case 2: + pageGraphic.drawLine(startX, startY + height - dw / 2, startX + width / 2, startY + dw / 2, + getScaledValue(adw), adc, ads); + pageGraphic.drawLine(startX, startY + height - dw / 2, startX + width, startY + height / 2, + getScaledValue(adw), adc, ads); + break; + case 3: + pageGraphic.drawLine(startX, startY + height - dw / 2, startX + width / 2, startY + dw / 2, + getScaledValue(adw), adc, ads); + pageGraphic.drawLine(startX, startY + height - dw / 2, startX + width, startY + height / 2, + getScaledValue(adw), adc, ads); + pageGraphic.drawLine(startX, startY + height - dw / 2, startX + width, startY + dw / 2, + getScaledValue(adw), adc, ads); + break; + default: + pageGraphic.drawLine(startX + 100, startY + height - dw / 2, startX + width, startY + dw / 2, + getScaledValue(adw), adc, ads); + break; + } } } protected void drawCell(CellArea container) { - drawCellDiagonal(container); Color rowbc = null; BackgroundImageInfo rowbi = null; BoxStyle rowStyle = null; @@ -374,7 +376,8 @@ protected void drawCell(CellArea container) { drawBackgroundImage(bi, startX, startY, width, height); } } - + // print diagonal like overlay + drawCellDiagonal(container); } /** diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/CellArea.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/CellArea.java index 4f41ded0592..7456abb6bc9 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/CellArea.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/nLayout/area/impl/CellArea.java @@ -223,7 +223,7 @@ protected void buildDiagonalInfo() { int diagonalNumber = cellContent.getDiagonalNumber(); int diagonalWidth = PropertyUtil.getDimensionValue(cellContent, cellContent.getDiagonalWidth(), width); String diagonalStyle = cellContent.getDiagonalStyle(); - if (diagonalNumber > 0 && diagonalWidth > 0 && diagonalStyle != null) { + if (diagonalNumber > 0 && diagonalWidth > 0 && diagonalStyle != null && !"none".equals(diagonalStyle)) { Color dc = PropertyUtil.getColor(cellContent.getDiagonalColor()); if (dc == null) { dc = PropertyUtil.getColor(cellContent.getComputedStyle().getProperty(StyleConstants.STYLE_COLOR)); @@ -235,7 +235,8 @@ protected void buildDiagonalInfo() { int antidiagonalWidth = PropertyUtil.getDimensionValue(cellContent, cellContent.getAntidiagonalWidth(), width); String antidiagonalStyle = cellContent.getAntidiagonalStyle(); - if (antidiagonalNumber > 0 && antidiagonalWidth > 0 && antidiagonalStyle != null) { + if (antidiagonalNumber > 0 && antidiagonalWidth > 0 && antidiagonalStyle != null + && !"none".equals(antidiagonalStyle)) { if (diagonalInfo == null) { diagonalInfo = new DiagonalInfo(); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/EngineIRVisitor.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/EngineIRVisitor.java index 3f90c0b09ae..f633c678221 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/EngineIRVisitor.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/EngineIRVisitor.java @@ -1260,8 +1260,8 @@ public void visitCell(CellHandle handle) { int diagonalNumber = handle.getDiagonalNumber(); if (diagonalNumber > 0) { // The default diagonalNumber value from Model is 0. - cell.setDiagonalNumber(diagonalNumber); cell.setDiagonalStyle(handle.getDiagonalStyle()); + cell.setDiagonalNumber(diagonalNumber); cell.setDiagonalWidth(createDimension(handle.getDiagonalThickness(), true)); ColorHandle colorHandle = handle.getDiagonalColor(); if (colorHandle != null) { @@ -1271,8 +1271,8 @@ public void visitCell(CellHandle handle) { int antidiagonalNumber = handle.getAntidiagonalNumber(); if (antidiagonalNumber > 0) { // The default antidiagonalNumber value from Model is 0. - cell.setAntidiagonalNumber(antidiagonalNumber); cell.setAntidiagonalStyle(handle.getAntidiagonalStyle()); + cell.setAntidiagonalNumber(antidiagonalNumber); cell.setAntidiagonalWidth(createDimension(handle.getAntidiagonalThickness(), true)); ColorHandle colorHandle = handle.getAntidiagonalColor(); if (colorHandle != null) { @@ -2069,13 +2069,13 @@ protected StyleDeclaration createStyle(ReportElementHandle handle, StyledElement StyleDeclaration style = new StyleDeclaration(cssEngine); Set styles = StyleUtil.styleName2Index.keySet(); for (String propertyName : styles) { - populateElementProperty(handle, design, style, propertyName); + populateElementProperty(handle, style, propertyName); } createDataFormat(handle, style); return style; } - private void populateElementProperty(ReportElementHandle handle, StyledElementDesign design, StyleDeclaration style, + private void populateElementProperty(ReportElementHandle handle, StyleDeclaration style, String propertyName) { boolean isColorProperty = StyleUtil.colorProperties.contains(propertyName); String elementProperty = getElementProperty(handle, propertyName, isColorProperty); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/script/internal/instance/StyleInstance.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/script/internal/instance/StyleInstance.java index f66f652916d..66c456a28ba 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/script/internal/instance/StyleInstance.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/script/internal/instance/StyleInstance.java @@ -1084,4 +1084,85 @@ private void checkWritable() { throw new UnsupportedOperationException("the content is read only in onPageBreak script."); } } + + @Override + public int getDiagonalNumber() { + return this.style.getDiagonalNumber(); + } + + @Override + public void setDiagonalNumber(int number) { + this.style.setDiagonalNumber(number); + } + + @Override + public String getDiagonalStyle() { + return this.style.getDiagonalStyle(); + } + + @Override + public void setDiagonalStyle(String style) { + this.style.setDiagonalStyle(style); + } + + @Override + public String getDiagonalWidth() { + return this.style.getDiagonalWidth(); + } + + @Override + public void setDiagonalWidth(String width) { + this.style.setDiagonalWidth(width); + } + + @Override + public String getDiagonalColor() { + return this.style.getDiagonalColor(); + } + + @Override + public void setDiagonalColor(String color) { + this.style.setDiagonalColor(color); + } + + @Override + public int getAntidiagonalNumber() { + return this.style.getAntidiagonalNumber(); + } + + @Override + public void setAntidiagonalNumber(int number) { + this.style.setAntidiagonalNumber(number); + } + + @Override + public String getAntidiagonalStyle() { + return this.style.getAntidiagonalStyle(); + } + + @Override + public void setAntidiagonalStyle(String style) { + this.style.setAntidiagonalStyle(style); + } + + @Override + public String getAntidiagonalWidth() { + return this.style.getAntidiagonalWidth(); + } + + @Override + public void setAntidiagonalWidth(String width) { + this.style.setAntidiagonalWidth(width); + } + + @Override + public String getAntidiagonalColor() { + return this.style.getAntidiagonalColor(); + } + + @Override + public void setAntidiagonalColor(String color) { + this.style.setAntidiagonalColor(color); + } + } diff --git a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/AreaBorders.java b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/AreaBorders.java index cf0587e9424..be2d2666a70 100644 --- a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/AreaBorders.java +++ b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/AreaBorders.java @@ -2,13 +2,13 @@ * Copyright (c) 2011, 2012, 2013 James Talbut. * jim-emitters@spudsoft.co.uk * - * + * * 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: * James Talbut - Initial implementation. ************************************************************************************/ @@ -26,32 +26,40 @@ public class AreaBorders { public int left; public int right; public int top; + public int diagonal; + public int antidiagonal; - public CSSValue[] cssStyle = new CSSValue[4]; - public CSSValue[] cssWidth = new CSSValue[4]; - public CSSValue[] cssColour = new CSSValue[4]; + public CSSValue[] cssStyle = new CSSValue[6]; + public CSSValue[] cssWidth = new CSSValue[6]; + public CSSValue[] cssColour = new CSSValue[6]; - private AreaBorders(boolean isMergedCells, int bottom, int left, int right, int top, CSSValue[] cssStyle, + private AreaBorders(boolean isMergedCells, int bottom, int left, int right, int top, int diagonal, int antidiagonal, + CSSValue[] cssStyle, CSSValue[] cssWidth, CSSValue[] cssColour) { this.isMergedCells = isMergedCells; this.bottom = bottom; this.left = left; this.right = right; this.top = top; + this.diagonal = diagonal; + this.antidiagonal = antidiagonal; this.cssStyle = cssStyle; this.cssWidth = cssWidth; this.cssColour = cssColour; } - public static AreaBorders create(int bottom, int left, int right, int top, BirtStyle borderStyle) { - return create(false, bottom, left, right, top, borderStyle); + public static AreaBorders create(int bottom, int left, int right, int top, int diagonal, int antidiagonal, + BirtStyle borderStyle) { + return create(false, bottom, left, right, top, diagonal, antidiagonal, borderStyle); } - public static AreaBorders createForMergedCells(int bottom, int left, int right, int top, BirtStyle borderStyle) { - return create(true, bottom, left, right, top, borderStyle); + public static AreaBorders createForMergedCells(int bottom, int left, int right, int top, int diagonal, + int antidiagonal, BirtStyle borderStyle) { + return create(true, bottom, left, right, top, diagonal, antidiagonal, borderStyle); } - public static AreaBorders create(boolean isMergedCells, int bottom, int left, int right, int top, + public static AreaBorders create(boolean isMergedCells, int bottom, int left, int right, int top, int diagonal, + int antidiagonal, BirtStyle borderStyle) { CSSValue borderStyleBottom = borderStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_STYLE); @@ -67,6 +75,12 @@ public static AreaBorders create(boolean isMergedCells, int bottom, int left, in CSSValue borderWidthTop = borderStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_WIDTH); CSSValue borderColourTop = borderStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_COLOR); + CSSValue borderStyleDiagonal = borderStyle.getProperty(StyleConstants.STYLE_BORDER_DIAGONAL_STYLE); + CSSValue borderWidthDiagonal = borderStyle.getProperty(StyleConstants.STYLE_BORDER_DIAGONAL_WIDTH); + CSSValue borderColourDiagonal = borderStyle.getProperty(StyleConstants.STYLE_BORDER_DIAGONAL_COLOR); + CSSValue borderStyleAntidiagonal = borderStyle.getProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_STYLE); + CSSValue borderWidthAntidiagonal = borderStyle.getProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_WIDTH); + CSSValue borderColourAntidiagonal = borderStyle.getProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_COLOR); /* * borderMsg.append( ", Bottom:" ).append( borderStyleBottom ).append( "/" * ).append( borderWidthBottom ).append( "/" + borderColourBottom ); @@ -111,6 +125,23 @@ public static AreaBorders create(boolean isMergedCells, int bottom, int left, in borderWidthTop = null; borderColourTop = null; } + if ((borderStyleDiagonal == null) || (CSSConstants.CSS_NONE_VALUE.equals(borderStyleDiagonal.getCssText())) + || (borderWidthDiagonal == null) || ("0".equals(borderWidthDiagonal.getCssText())) + || (borderColourDiagonal == null) + || (CSSConstants.CSS_TRANSPARENT_VALUE.equals(borderColourDiagonal.getCssText()))) { + borderStyleDiagonal = null; + borderWidthDiagonal = null; + borderColourDiagonal = null; + } + if ((borderStyleAntidiagonal == null) + || (CSSConstants.CSS_NONE_VALUE.equals(borderStyleAntidiagonal.getCssText())) + || (borderWidthAntidiagonal == null) || ("0".equals(borderWidthAntidiagonal.getCssText())) + || (borderColourAntidiagonal == null) + || (CSSConstants.CSS_TRANSPARENT_VALUE.equals(borderColourAntidiagonal.getCssText()))) { + borderStyleAntidiagonal = null; + borderWidthAntidiagonal = null; + borderColourAntidiagonal = null; + } if (((bottom >= 0) && ((borderStyleBottom != null) || (borderWidthBottom != null) || (borderColourBottom != null))) @@ -119,11 +150,21 @@ public static AreaBorders create(boolean isMergedCells, int bottom, int left, in || ((right >= 0) && ((borderStyleRight != null) || (borderWidthRight != null) || (borderColourRight != null))) || ((top >= 0) - && ((borderStyleTop != null) || (borderWidthTop != null) || (borderColourTop != null)))) { - CSSValue[] cssStyle = { borderStyleBottom, borderStyleLeft, borderStyleRight, borderStyleTop }; - CSSValue[] cssWidth = { borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop }; - CSSValue[] cssColour = { borderColourBottom, borderColourLeft, borderColourRight, borderColourTop }; - return new AreaBorders(isMergedCells, bottom, left, right, top, cssStyle, cssWidth, cssColour); + && ((borderStyleTop != null) || (borderWidthTop != null) || (borderColourTop != null))) + || ((diagonal >= 0) && ((borderStyleDiagonal != null) || (borderWidthDiagonal != null) + || (borderColourDiagonal != null))) + || ((antidiagonal >= 0) && ((borderStyleAntidiagonal != null) || (borderWidthAntidiagonal != null) + || (borderColourAntidiagonal != null))) + + ) { + CSSValue[] cssStyle = { borderStyleBottom, borderStyleLeft, borderStyleRight, borderStyleTop, + borderStyleDiagonal, borderStyleAntidiagonal }; + CSSValue[] cssWidth = { borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop, + borderWidthDiagonal, borderWidthAntidiagonal }; + CSSValue[] cssColour = { borderColourBottom, borderColourLeft, borderColourRight, borderColourTop, + borderColourDiagonal, borderColourAntidiagonal }; + return new AreaBorders(isMergedCells, bottom, left, right, top, diagonal, antidiagonal, cssStyle, cssWidth, + cssColour); } return null; } @@ -135,7 +176,7 @@ public String toString() { result.append("-"); result.append("[").append(bottom).append(",").append(right).append("]"); result.append("="); - for (int i = 0; i < 4; ++i) { + for (int i = 0; i < 6; ++i) { result.append("["); result.append(cssStyle[i]); result.append(";"); diff --git a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/BirtStyle.java b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/BirtStyle.java index a3e03e1179d..77fd849080e 100644 --- a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/BirtStyle.java +++ b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/BirtStyle.java @@ -2,13 +2,13 @@ * Copyright (c) 2011, 2012, 2013 James Talbut. * jim-emitters@spudsoft.co.uk * - * + * * 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: * James Talbut - Initial implementation. ************************************************************************************/ @@ -48,8 +48,8 @@ public class BirtStyle { "MASTER_PAGE", "orphans", "font-size", "font-style", "border-top-style", "page-break-before", "SHOW_IF_BLANK", "background-image", "BACKGROUND_POSITION_Y", "word-spacing", "background-attachment", "TEXT_UNDERLINE", "display", "font-family", "letter-spacing", "page-break-inside", "page-break-after" - - , "Rotation" }; + , "Rotation", "border-diagonal-color", "border-diagonal-width", "border-diagonal-style", + "border-antidiagonal-color", "border-antidiagonal-width", "border-antidiagonal-style" }; private IStyle elemStyle; private CSSValue[] propertyOverride = new CSSValue[BirtStyle.NUMBER_OF_STYLES]; @@ -186,6 +186,12 @@ private static BitSet PrepareSpecialOverlayProperties() { result.set(StyleConstants.STYLE_BORDER_TOP_STYLE); result.set(StyleConstants.STYLE_BORDER_TOP_WIDTH); result.set(StyleConstants.STYLE_BORDER_TOP_COLOR); + result.set(StyleConstants.STYLE_BORDER_DIAGONAL_STYLE); + result.set(StyleConstants.STYLE_BORDER_DIAGONAL_WIDTH); + result.set(StyleConstants.STYLE_BORDER_DIAGONAL_COLOR); + result.set(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_STYLE); + result.set(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_WIDTH); + result.set(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_COLOR); result.set(StyleConstants.STYLE_VERTICAL_ALIGN); result.set(StyleConstants.STYLE_DATA_FORMAT); return result; @@ -218,7 +224,7 @@ public void overlay(IContent element) { } } - // Background colour, only overlay if not null and not transparent + // Background color, only overlay if not null and not transparent CSSValue overlayBgColour = style.getProperty(StyleConstants.STYLE_BACKGROUND_COLOR); CSSValue localBgColour = getProperty(StyleConstants.STYLE_BACKGROUND_COLOR); if ((overlayBgColour != null) && (!CSSConstants.CSS_TRANSPARENT_VALUE.equals(overlayBgColour.getCssText())) diff --git a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManager.java b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManager.java index b8158e3fd34..db7a1134448 100644 --- a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManager.java +++ b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManager.java @@ -2,13 +2,13 @@ * Copyright (c) 2011, 2012, 2013 James Talbut. * jim-emitters@spudsoft.co.uk * - * + * * 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: * James Talbut - Initial implementation. ************************************************************************************/ @@ -70,12 +70,11 @@ public StylePair(BirtStyle birtStyle, CellStyle poiStyle) { /** * @param workbook The workbook for which styles are being tracked. - * @param styleStack A style stack, to allow cells to inherit properties from - * container elements. * @param log Logger to be used during processing. * @param smu Set of functions for carrying out conversions between BIRT * and POI. * @param cssEngine BIRT CSS Engine for creating BIRT styles. + * @param locale Locale of the workbook */ public StyleManager(Workbook workbook, Logger log, StyleManagerUtils smu, CSSEngine cssEngine, Locale locale) { this.workbook = workbook; @@ -86,10 +85,20 @@ public StyleManager(Workbook workbook, Logger log, StyleManagerUtils smu, CSSEng this.locale = locale; } + /** + * Get the font manager of the style + * + * @return Return the font manager of the style + */ public FontManager getFontManager() { return fm; } + /** + * Get the CSS engine of the style + * + * @return Return the CSS engine of the style + */ public CSSEngine getCssEngine() { return cssEngine; } @@ -101,6 +110,10 @@ public CSSEngine getCssEngine() { StyleConstants.STYLE_BORDER_RIGHT_STYLE, StyleConstants.STYLE_BORDER_RIGHT_WIDTH, StyleConstants.STYLE_BORDER_RIGHT_COLOR, StyleConstants.STYLE_BORDER_BOTTOM_STYLE, StyleConstants.STYLE_BORDER_BOTTOM_WIDTH, StyleConstants.STYLE_BORDER_BOTTOM_COLOR, + StyleConstants.STYLE_BORDER_DIAGONAL_NUMBER, StyleConstants.STYLE_BORDER_DIAGONAL_STYLE, + StyleConstants.STYLE_BORDER_DIAGONAL_WIDTH, StyleConstants.STYLE_BORDER_DIAGONAL_COLOR, + StyleConstants.STYLE_BORDER_ANTIDIAGONAL_NUMBER, StyleConstants.STYLE_BORDER_ANTIDIAGONAL_STYLE, + StyleConstants.STYLE_BORDER_ANTIDIAGONAL_WIDTH, StyleConstants.STYLE_BORDER_ANTIDIAGONAL_COLOR, StyleConstants.STYLE_WHITE_SPACE, StyleConstants.STYLE_VERTICAL_ALIGN, }; /** @@ -129,7 +142,6 @@ private boolean stylesEquivalent(BirtStyle style1, BirtStyle style2) { return false; } } - // Number format // Font @@ -156,6 +168,7 @@ private CellStyle createStyle(BirtStyle birtStyle) { if (font != null) { poiStyle.setFont(font); } + // Alignment // poiStyle.setAlignment(smu.poiAlignmentFromBirtAlignment(birtStyle.getString(StyleConstants.STYLE_TEXT_ALIGN))); HorizontalAlignment alignment = smu @@ -163,26 +176,38 @@ private CellStyle createStyle(BirtStyle birtStyle) { poiStyle.setAlignment(alignment); // Background colour smu.addBackgroundColourToStyle(workbook, poiStyle, birtStyle.getString(StyleConstants.STYLE_BACKGROUND_COLOR)); - // Top border - smu.applyBorderStyle(workbook, poiStyle, BorderSide.TOP, - birtStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_COLOR), - birtStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_STYLE), - birtStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_WIDTH)); - // Left border - smu.applyBorderStyle(workbook, poiStyle, BorderSide.LEFT, - birtStyle.getProperty(StyleConstants.STYLE_BORDER_LEFT_COLOR), - birtStyle.getProperty(StyleConstants.STYLE_BORDER_LEFT_STYLE), - birtStyle.getProperty(StyleConstants.STYLE_BORDER_LEFT_WIDTH)); - // Right border - smu.applyBorderStyle(workbook, poiStyle, BorderSide.RIGHT, - birtStyle.getProperty(StyleConstants.STYLE_BORDER_RIGHT_COLOR), - birtStyle.getProperty(StyleConstants.STYLE_BORDER_RIGHT_STYLE), - birtStyle.getProperty(StyleConstants.STYLE_BORDER_RIGHT_WIDTH)); - // Bottom border - smu.applyBorderStyle(workbook, poiStyle, BorderSide.BOTTOM, - birtStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_COLOR), - birtStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_STYLE), - birtStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_WIDTH)); + + if (smu instanceof StyleManagerXUtils) { + + // border will be applied at once + smu.applyBorderStyle(workbook, poiStyle, birtStyle); + + } else { + // Top border + smu.applyBorderStyle(workbook, poiStyle, BorderSide.TOP, + birtStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_COLOR), + birtStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_STYLE), + birtStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_WIDTH)); + + // Left border + smu.applyBorderStyle(workbook, poiStyle, BorderSide.LEFT, + birtStyle.getProperty(StyleConstants.STYLE_BORDER_LEFT_COLOR), + birtStyle.getProperty(StyleConstants.STYLE_BORDER_LEFT_STYLE), + birtStyle.getProperty(StyleConstants.STYLE_BORDER_LEFT_WIDTH)); + + // Right border + smu.applyBorderStyle(workbook, poiStyle, BorderSide.RIGHT, + birtStyle.getProperty(StyleConstants.STYLE_BORDER_RIGHT_COLOR), + birtStyle.getProperty(StyleConstants.STYLE_BORDER_RIGHT_STYLE), + birtStyle.getProperty(StyleConstants.STYLE_BORDER_RIGHT_WIDTH)); + + // Bottom border + smu.applyBorderStyle(workbook, poiStyle, BorderSide.BOTTOM, + birtStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_COLOR), + birtStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_STYLE), + birtStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_WIDTH)); + } + // Number format smu.applyNumberFormat(workbook, birtStyle, poiStyle, locale); // Whitespace/wrap @@ -202,16 +227,21 @@ private CellStyle createStyle(BirtStyle birtStyle) { if (rotation instanceof FloatValue) { poiStyle.setRotation((short) ((FloatValue) rotation).getFloatValue()); } - styles.add(new StylePair(birtStyle.clone(), poiStyle)); return poiStyle; } + /** + * Get the cell style based on the BIRT style + * + * @param birtStyle style of the BIRT element + * @return Return the cell style based on the BIRT style + */ public CellStyle getStyle(BirtStyle birtStyle) { for (StylePair stylePair : styles) { if (stylesEquivalent(birtStyle, stylePair.birtStyle)) { - // System.err.println( "Equivalent :\n\t" + birtStyle + "\n\t" + - // stylePair.birtStyle ); + // System.err.println("Equivalent :\n\t" + birtStyle + "\n\t" + + // stylePair.birtStyle); return stylePair.poiStyle; } } @@ -233,26 +263,34 @@ private BirtStyle birtStyleFromCellStyle(CellStyle source) { * Given a POI CellStyle, add border definitions to it and obtain a CellStyle * (from the cache or newly created) based upon that. * - * @param source The POI CellStyle to form the base style. - * @param borderStyleBottom The BIRT style of the bottom border. - * @param borderWidthBottom The BIRT with of the bottom border. - * @param borderColourBottom The BIRT colour of the bottom border. - * @param borderStyleLeft The BIRT style of the left border. - * @param borderWidthLeft The BIRT width of the left border. - * @param borderColourLeft The BIRT colour of the left border. - * @param borderStyleRight The BIRT width of the right border. - * @param borderWidthRight The BIRT colour of the right border. - * @param borderColourRight The BIRT style of the right border. - * @param borderStyleTop The BIRT style of the top border. - * @param borderWidthTop The BIRT width of the top border. - * @param borderColourTop The BIRT colour of the top border. + * @param source The POI CellStyle to form the base style. + * @param borderStyleBottom The BIRT style of the bottom border. + * @param borderWidthBottom The BIRT with of the bottom border. + * @param borderColourBottom The BIRT colour of the bottom border. + * @param borderStyleLeft The BIRT style of the left border. + * @param borderWidthLeft The BIRT width of the left border. + * @param borderColourLeft The BIRT colour of the left border. + * @param borderStyleRight The BIRT style of the right border. + * @param borderWidthRight The BIRT width of the right border. + * @param borderColourRight The BIRT color of the right border. + * @param borderStyleTop The BIRT style of the top border. + * @param borderWidthTop The BIRT width of the top border. + * @param borderColourTop The BIRT colour of the top border. + * @param borderStyleDiagonal The BIRT style of the diagonal. + * @param borderWidthDiagonal The BIRT width of the diagonal. + * @param borderColourDiagonal The BIRT colour of the diagonal. + * @param borderStyleAntidiagonal The BIRT style of the antidiagonal. + * @param borderWidthAntidiagonal The BIRT width of the antidiagonal. + * @param borderColourAntidiagonal The BIRT colour of the antidiagonal. * @return A POI CellStyle equivalent to the source CellStyle with all the * defined borders added to it. */ public CellStyle getStyleWithBorders(CellStyle source, CSSValue borderStyleBottom, CSSValue borderWidthBottom, CSSValue borderColourBottom, CSSValue borderStyleLeft, CSSValue borderWidthLeft, CSSValue borderColourLeft, CSSValue borderStyleRight, CSSValue borderWidthRight, CSSValue borderColourRight, CSSValue borderStyleTop, - CSSValue borderWidthTop, CSSValue borderColourTop) { + CSSValue borderWidthTop, CSSValue borderColourTop, CSSValue borderStyleDiagonal, + CSSValue borderWidthDiagonal, CSSValue borderColourDiagonal, CSSValue borderStyleAntidiagonal, + CSSValue borderWidthAntidiagonal, CSSValue borderColourAntidiagonal) { BirtStyle birtStyle = birtStyleFromCellStyle(source); if ((borderStyleBottom != null) && (borderWidthBottom != null) && (borderColourBottom != null)) { @@ -275,6 +313,17 @@ public CellStyle getStyleWithBorders(CellStyle source, CSSValue borderStyleBotto birtStyle.setProperty(StyleConstants.STYLE_BORDER_TOP_WIDTH, borderWidthTop); birtStyle.setProperty(StyleConstants.STYLE_BORDER_TOP_COLOR, borderColourTop); } + if ((borderStyleDiagonal != null) && (borderWidthDiagonal != null) && (borderColourDiagonal != null)) { + birtStyle.setProperty(StyleConstants.STYLE_BORDER_DIAGONAL_STYLE, borderStyleDiagonal); + birtStyle.setProperty(StyleConstants.STYLE_BORDER_DIAGONAL_WIDTH, borderWidthDiagonal); + birtStyle.setProperty(StyleConstants.STYLE_BORDER_DIAGONAL_COLOR, borderColourDiagonal); + } + if ((borderStyleAntidiagonal != null) && (borderWidthAntidiagonal != null) + && (borderColourAntidiagonal != null)) { + birtStyle.setProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_STYLE, borderStyleAntidiagonal); + birtStyle.setProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_WIDTH, borderWidthAntidiagonal); + birtStyle.setProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_COLOR, borderColourAntidiagonal); + } CellStyle newStyle = getStyle(birtStyle); return newStyle; diff --git a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManagerHUtils.java b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManagerHUtils.java index 43bc61e05c7..03afa313044 100644 --- a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManagerHUtils.java +++ b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManagerHUtils.java @@ -2,13 +2,13 @@ * Copyright (c) 2011, 2012, 2013 James Talbut. * jim-emitters@spudsoft.co.uk * - * + * * 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: * James Talbut - Initial implementation. ************************************************************************************/ @@ -147,6 +147,12 @@ private short getHColour(HSSFWorkbook workbook, String colour) { return result.getIndex(); } + @Override + public void applyBorderStyle(Workbook workbook, CellStyle style, BirtStyle birtStyle) { + // TODO: implements the border apply at once to the cell object based on + // birtStyle + } + @Override public void applyBorderStyle(Workbook workbook, CellStyle style, BorderSide side, CSSValue colour, CSSValue borderStyle, CSSValue width) { diff --git a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManagerUtils.java b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManagerUtils.java index 9acd57491c1..ab1c46cc06f 100644 --- a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManagerUtils.java +++ b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManagerUtils.java @@ -22,7 +22,6 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; -import java.net.MalformedURLException; import java.net.URLConnection; import java.text.AttributedString; import java.text.DateFormat; @@ -298,7 +297,8 @@ public static boolean cellIsEmpty(Cell cell) { } /** - * Apply a BIRT border style to one side of a POI CellStyle. + * Apply a BIRT border style to one side of a POI CellStyle usage: xls-format / + * StyleManagerHUtils * * @param workbook The workbook that contains the cell being styled. * @param style The POI CellStyle that is to have the border applied to @@ -313,6 +313,17 @@ public static boolean cellIsEmpty(Cell cell) { public abstract void applyBorderStyle(Workbook workbook, CellStyle style, BorderSide side, CSSValue colour, CSSValue borderStyle, CSSValue width); + /** + * Apply a BIRT border style to one side of a POI CellStyle. usage: xlsx-format + * / StyleManagerXUtils + * + * @param workbook The workbook that contains the cell being styled. + * @param style The POI CellStyle that is to have the border applied to it. + * @param birtStyle birt cell style with all border information + * @since 4.13 + */ + public abstract void applyBorderStyle(Workbook workbook, CellStyle style, BirtStyle birtStyle); + /** *

* Convert a MIME string into a Workbook.PICTURE* constant. @@ -869,6 +880,9 @@ public void correctFontColorIfBackground(BirtStyle birtStyle) { * Place a border around a region on the current sheet. This is used to apply * borders to entire rows or entire tables. * + * @param sm + * @param sheet + * * @param colStart The column marking the left-side boundary of the region. * @param colEnd The column marking the right-side boundary of the region. * @param rowStart The row marking the top boundary of the region. @@ -894,6 +908,13 @@ public void applyBordersToArea(StyleManager sm, Sheet sheet, int colStart, int c CSSValue borderWidthTop = borderStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_WIDTH); CSSValue borderColourTop = borderStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_COLOR); + CSSValue borderStyleDiagonal = borderStyle.getProperty(StyleConstants.STYLE_BORDER_DIAGONAL_STYLE); + CSSValue borderWidthDiagonal = borderStyle.getProperty(StyleConstants.STYLE_BORDER_DIAGONAL_WIDTH); + CSSValue borderColourDiagonal = borderStyle.getProperty(StyleConstants.STYLE_BORDER_DIAGONAL_COLOR); + CSSValue borderStyleAntidiagonal = borderStyle.getProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_STYLE); + CSSValue borderWidthAntidiagonal = borderStyle.getProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_WIDTH); + CSSValue borderColourAntidiagonal = borderStyle.getProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_COLOR); + /* * borderMsg.append( ", Bottom:" ).append( borderStyleBottom ).append( "/" * ).append( borderWidthBottom ).append( "/" + borderColourBottom ); @@ -937,10 +958,31 @@ public void applyBordersToArea(StyleManager sm, Sheet sheet, int colStart, int c borderColourTop = null; } + if ((borderStyleDiagonal == null) || (CSSConstants.CSS_NONE_VALUE.equals(borderStyleDiagonal)) + || (borderWidthDiagonal == null) || ("0".equals(borderWidthDiagonal)) || (borderColourDiagonal == null) + || (CSSConstants.CSS_TRANSPARENT_VALUE.equals(borderColourDiagonal.getCssText()))) { + borderStyleDiagonal = null; + borderWidthDiagonal = null; + borderColourDiagonal = null; + } + + if ((borderStyleAntidiagonal == null) || (CSSConstants.CSS_NONE_VALUE.equals(borderStyleAntidiagonal)) + || (borderWidthAntidiagonal == null) || ("0".equals(borderWidthDiagonal)) + || (borderColourDiagonal == null) + || (CSSConstants.CSS_TRANSPARENT_VALUE.equals(borderColourAntidiagonal.getCssText()))) { + borderStyleAntidiagonal = null; + borderWidthAntidiagonal = null; + borderColourAntidiagonal = null; + } + if ((borderStyleBottom != null) || (borderWidthBottom != null) || (borderColourBottom != null) || (borderStyleLeft != null) || (borderWidthLeft != null) || (borderColourLeft != null) || (borderStyleRight != null) || (borderWidthRight != null) || (borderColourRight != null) - || (borderStyleTop != null) || (borderWidthTop != null) || (borderColourTop != null)) { + || (borderStyleTop != null) || (borderWidthTop != null) || (borderColourTop != null) + || (borderStyleDiagonal != null) || (borderWidthDiagonal != null) || (borderColourDiagonal != null) + || (borderStyleAntidiagonal != null) || (borderWidthAntidiagonal != null) + || (borderColourAntidiagonal != null) + ) { for (int row = rowStart; row <= rowEnd; ++row) { Row styleRow = sheet.getRow(row); if (styleRow != null) { @@ -966,7 +1008,15 @@ public void applyBordersToArea(StyleManager sm, Sheet sheet, int colStart, int c ((col == colEnd) ? borderColourRight : null), ((row == rowStart) ? borderStyleTop : null), ((row == rowStart) ? borderWidthTop : null), - ((row == rowStart) ? borderColourTop : null)); + ((row == rowStart) ? borderColourTop : null), + ((row == rowStart) ? borderStyleDiagonal : null), + ((row == rowStart) ? borderWidthDiagonal : null), + ((row == rowStart) ? borderColourDiagonal : null), + ((row == rowStart) ? borderStyleAntidiagonal : null), + ((row == rowStart) ? borderWidthAntidiagonal : null), + ((row == rowStart) ? borderColourAntidiagonal : null) + + ); styleCell.setCellStyle(newStyle); } } @@ -1012,6 +1062,7 @@ public void applyBottomBorderToRow(StyleManager sm, Sheet sheet, int colStart, i // styleCell.getColumnIndex() + "]"); CellStyle newStyle = sm.getStyleWithBorders(styleCell.getCellStyle(), borderStyleBottom, borderWidthBottom, borderColourBottom, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null); styleCell.setCellStyle(newStyle); } @@ -1058,6 +1109,24 @@ public int applyAreaBordersToCell(Collection knownAreaBorders, Cell birtCellStyle.setProperty(StyleConstants.STYLE_BORDER_TOP_COLOR, areaBorders.cssColour[3]); } } + if ((areaBorders.left == colIndex) && ((areaBorders.top <= rowIndex) + && ((areaBorders.bottom < 0) || (areaBorders.bottom >= rowIndex)))) { + if ((areaBorders.cssStyle[4] != null) && (areaBorders.cssWidth[4] != null) + && (areaBorders.cssColour[4] != null)) { + birtCellStyle.setProperty(StyleConstants.STYLE_BORDER_DIAGONAL_STYLE, areaBorders.cssStyle[4]); + birtCellStyle.setProperty(StyleConstants.STYLE_BORDER_DIAGONAL_WIDTH, areaBorders.cssWidth[4]); + birtCellStyle.setProperty(StyleConstants.STYLE_BORDER_DIAGONAL_COLOR, areaBorders.cssColour[4]); + } + } + if ((areaBorders.left == colIndex) && ((areaBorders.top <= rowIndex) + && ((areaBorders.bottom < 0) || (areaBorders.bottom >= rowIndex)))) { + if ((areaBorders.cssStyle[5] != null) && (areaBorders.cssWidth[5] != null) + && (areaBorders.cssColour[5] != null)) { + birtCellStyle.setProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_STYLE, areaBorders.cssStyle[5]); + birtCellStyle.setProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_WIDTH, areaBorders.cssWidth[5]); + birtCellStyle.setProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_COLOR, areaBorders.cssColour[5]); + } + } } return colIndex; } @@ -1093,4 +1162,5 @@ public void extendRows(HandlerState state, int startRow, int startCol, int endRo } } } + } diff --git a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManagerXUtils.java b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManagerXUtils.java index 4001867a7ee..da69a97e1ed 100644 --- a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManagerXUtils.java +++ b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/StyleManagerXUtils.java @@ -2,13 +2,13 @@ * Copyright (c) 2011, 2012, 2013 James Talbut. * jim-emitters@spudsoft.co.uk * - * + * * 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: * James Talbut - Initial implementation. ************************************************************************************/ @@ -23,20 +23,30 @@ import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.util.Units; +import org.apache.poi.xssf.model.StylesTable; +import org.apache.poi.xssf.model.ThemesTable; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.usermodel.DefaultIndexedColorMap; import org.apache.poi.xssf.usermodel.IndexedColorMap; import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFColor; import org.apache.poi.xssf.usermodel.XSSFFont; import org.apache.poi.xssf.usermodel.XSSFRichTextString; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder; import org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder.BorderSide; import org.eclipse.birt.report.engine.content.IPageContent; import org.eclipse.birt.report.engine.content.IStyle; import org.eclipse.birt.report.engine.css.dom.AreaStyle; import org.eclipse.birt.report.engine.css.engine.StyleConstants; import org.eclipse.birt.report.engine.css.engine.value.css.CSSConstants; +import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.ir.DimensionType; import org.eclipse.birt.report.model.api.util.ColorUtil; +import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder; +import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr; +import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf; +import org.openxmlformats.schemas.spreadsheetml.x2006.main.STBorderStyle; import org.w3c.dom.css.CSSValue; import uk.co.spudsoft.birt.emitters.excel.framework.Logger; @@ -57,6 +67,11 @@ public StyleManagerUtils create(Logger log) { } }; + /** + * Get the factory of the style manager + * + * @return Return factory of style manager + */ public static Factory getFactory() { return factory; } @@ -111,9 +126,9 @@ private BorderStyle poiBorderStyleFromBirt(String birtBorder, String width) { } else if ("dashed".equals(birtBorder)) { if (pxWidth < 2.9) { return BorderStyle.DASHED; - } else { - return BorderStyle.MEDIUM_DASHED; } + return BorderStyle.MEDIUM_DASHED; + } else if ("dotted".equals(birtBorder)) { return BorderStyle.DOTTED; } else if ("double".equals(birtBorder)) { @@ -124,48 +139,185 @@ private BorderStyle poiBorderStyleFromBirt(String birtBorder, String width) { return BorderStyle.NONE; } + /** + * Create e new cell border object + * + * @param stylesSource original workbook style source + * @param cellXf cell object of the workbook to be styled + * @return Return the border object of cell + * @since 4.13 + */ + private CTBorder getCTBorder(StylesTable stylesSource, CTXf cellXf) { + CTBorder ct; + if (cellXf.getApplyBorder()) { + int idx = (int) cellXf.getBorderId(); + XSSFCellBorder cf = stylesSource.getBorderAt(idx); + ct = (CTBorder) cf.getCTBorder().copy(); + } else { + ct = CTBorder.Factory.newInstance(); + } + return ct; + } + + /** + * Set all border lines to the cell + * + * @param stylesSource workbook style sheet source + * @param cellXf cell object + * @param theme color theme object + * @param birtStyle birt cell style with all border information + * @since 4.13 + */ + public void setBorderAll(StylesTable stylesSource, CTXf cellXf, ThemesTable theme, BirtStyle birtStyle) { + + String borderTopColor = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_COLOR ) == null ? "rgb(0,0,0)" : birtStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_COLOR).getCssText()); + String borderTopStyle = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_STYLE) == null ? "none" + : birtStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_STYLE).getCssText()); + String borderTopWidth = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_WIDTH ) == null ? "medium" : birtStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_WIDTH).getCssText()); + + String borderBottomColor = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_COLOR ) == null ? "rgb(0,0,0)" : birtStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_COLOR).getCssText()); + String borderBottomStyle = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_STYLE) == null ? "none" + : birtStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_STYLE).getCssText()); + String borderBottomWidth = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_WIDTH ) == null ? "medium" : birtStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_WIDTH).getCssText()); + + String borderLeftColor = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_LEFT_COLOR ) == null ? "rgb(0,0,0)" : birtStyle.getProperty(StyleConstants.STYLE_BORDER_LEFT_COLOR).getCssText()); + String borderLeftStyle = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_LEFT_STYLE) == null ? "none" + : birtStyle.getProperty(StyleConstants.STYLE_BORDER_LEFT_STYLE).getCssText()); + String borderLeftWidth = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_LEFT_WIDTH ) == null ? "medium" : birtStyle.getProperty(StyleConstants.STYLE_BORDER_LEFT_WIDTH).getCssText()); + + String borderRightColor = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_RIGHT_COLOR ) == null ? "rgb(0,0,0)" : birtStyle.getProperty(StyleConstants.STYLE_BORDER_RIGHT_COLOR).getCssText()); + String borderRightStyle = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_RIGHT_STYLE) == null ? "none" + : birtStyle.getProperty(StyleConstants.STYLE_BORDER_RIGHT_STYLE).getCssText()); + String borderRightWidth = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_RIGHT_WIDTH ) == null ? "medium" : birtStyle.getProperty(StyleConstants.STYLE_BORDER_RIGHT_WIDTH).getCssText()); + + String diagonalColor = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_DIAGONAL_COLOR ) == null ? "rgb(0,0,0)" : birtStyle.getProperty(StyleConstants.STYLE_BORDER_DIAGONAL_COLOR).getCssText()); + String diagonalStyle = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_DIAGONAL_STYLE) == null ? "none" + : birtStyle.getProperty(StyleConstants.STYLE_BORDER_DIAGONAL_STYLE).getCssText()); + String diagonalWidth = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_DIAGONAL_WIDTH ) == null ? "medium" : birtStyle.getProperty(StyleConstants.STYLE_BORDER_DIAGONAL_WIDTH).getCssText()); + + String antidiagonalColor = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_COLOR) == null + ? "rgb(0,0,0)" + : birtStyle.getProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_COLOR).getCssText()); + String antidiagonalStyle = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_STYLE) == null + ? "solid" + : birtStyle.getProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_STYLE).getCssText()); + String antidiagonalWidth = (birtStyle.getProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_WIDTH) == null + ? "medium" + : birtStyle.getProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_WIDTH).getCssText()); + + CTBorder ct = getCTBorder(stylesSource, cellXf); + CTBorderPr pr = ct.isSetDiagonal() ? ct.getDiagonal() : ct.addNewDiagonal(); + BorderStyle border = null; + XSSFColor xBorderColour = null; + + // border get the used color map + IndexedColorMap colorMap = stylesSource.getIndexedColors(); + XSSFCellBorderExtended cb = new XSSFCellBorderExtended(ct, theme, colorMap); + + // border: diagonal & antidiagonal + BorderStyle borderDiagonal = poiBorderStyleFromBirt(diagonalStyle, diagonalWidth); + BorderStyle borderAntidiagonal = poiBorderStyleFromBirt(antidiagonalStyle, antidiagonalWidth); + + if (borderDiagonal == BorderStyle.NONE && ct.isSetDiagonalDown()) + ct.unsetDiagonalDown(); + if (borderAntidiagonal == BorderStyle.NONE && ct.isSetDiagonalUp()) + ct.unsetDiagonalUp(); + + if (borderDiagonal != BorderStyle.NONE || borderAntidiagonal != BorderStyle.NONE) { + if (borderDiagonal != BorderStyle.NONE) { + xBorderColour = getXColour(diagonalColor); + border = borderDiagonal; + ct.setDiagonalDown(true); + cb.setDiagonal(true); + cb.setDiagonalColor(xBorderColour); + cb.setDiagonalStyle(border); + } + if (borderAntidiagonal != BorderStyle.NONE) { + if (xBorderColour == null) + xBorderColour = getXColour(antidiagonalColor); + if (border == null) + border = borderAntidiagonal; + ct.setDiagonalUp(true); + cb.setAntidiagonal(true); + cb.setAntidiagonalColor(xBorderColour); + cb.setAntidiagonalStyle(border); + } + ct.setDiagonal(pr); + + // border style & width + pr.setStyle(STBorderStyle.Enum.forInt(border.getCode() + 1)); + + // border color + pr.addNewColor().setRgb(xBorderColour.getRGB()); + } + + // border: top + border = poiBorderStyleFromBirt(borderTopStyle, borderTopWidth); + if (border != BorderStyle.NONE) { + xBorderColour = getXColour(borderTopColor); + cb.setBorderStyle(BorderSide.TOP, border); + cb.setBorderColor(BorderSide.TOP, xBorderColour); + } + + // border: bottom + border = poiBorderStyleFromBirt(borderBottomStyle, borderBottomWidth); + if (border != BorderStyle.NONE) { + xBorderColour = getXColour(borderBottomColor); + cb.setBorderStyle(BorderSide.BOTTOM, border); + cb.setBorderColor(BorderSide.BOTTOM, xBorderColour); + } + + // border: left + border = poiBorderStyleFromBirt(borderLeftStyle, borderLeftWidth); + if (border != BorderStyle.NONE) { + xBorderColour = getXColour(borderLeftColor); + cb.setBorderStyle(BorderSide.LEFT, border); + cb.setBorderColor(BorderSide.LEFT, xBorderColour); + } + + // border: right + border = poiBorderStyleFromBirt(borderRightStyle, borderRightWidth); + if (border != BorderStyle.NONE) { + xBorderColour = getXColour(borderRightColor); + cb.setBorderStyle(BorderSide.RIGHT, border); + cb.setBorderColor(BorderSide.RIGHT, xBorderColour); + } + + // assign border to cell + int idx = stylesSource.putBorder(cb); + cellXf.setBorderId(idx); + cellXf.setApplyBorder(true); + } + @Override public void applyBorderStyle(Workbook workbook, CellStyle style, BorderSide side, CSSValue colour, CSSValue borderStyle, CSSValue width) { - if ((colour != null) || (borderStyle != null) || (width != null)) { - String colourString = colour == null ? "rgb(0,0,0)" : colour.getCssText(); - String borderStyleString = borderStyle == null ? "solid" : borderStyle.getCssText(); - String widthString = width == null ? "medium" : width.getCssText(); - - if (style instanceof XSSFCellStyle) { - XSSFCellStyle xStyle = (XSSFCellStyle) style; - - BorderStyle xBorderStyle = poiBorderStyleFromBirt(borderStyleString, widthString); - XSSFColor xBorderColour = getXColour(colourString); - if (xBorderStyle != BorderStyle.NONE) { - switch (side) { - case TOP: - xStyle.setBorderTop(xBorderStyle); - xStyle.setTopBorderColor(xBorderColour); - // log.debug( "Top border: " + xStyle.getBorderTop() + " / " + - // xStyle.getTopBorderXSSFColor().getARGBHex() ); - break; - case LEFT: - xStyle.setBorderLeft(xBorderStyle); - xStyle.setLeftBorderColor(xBorderColour); - // log.debug( "Left border: " + xStyle.getBorderLeft() + " / " + - // xStyle.getLeftBorderXSSFColor().getARGBHex() ); - break; - case RIGHT: - xStyle.setBorderRight(xBorderStyle); - xStyle.setRightBorderColor(xBorderColour); - // log.debug( "Right border: " + xStyle.getBorderRight() + " / " + - // xStyle.getRightBorderXSSFColor().getARGBHex() ); - break; - case BOTTOM: - xStyle.setBorderBottom(xBorderStyle); - xStyle.setBottomBorderColor(xBorderColour); - // log.debug( "Bottom border: " + xStyle.getBorderBottom() + " / " + - // xStyle.getBottomBorderXSSFColor().getARGBHex() ); - break; - } + // method due to compatibility reasons of StyleManagerUtil & StyleManager + } + + @Override + public void applyBorderStyle(Workbook workbook, CellStyle style, BirtStyle birtStyle) { + applyBorderStyleToCell(workbook, style, birtStyle); + } + + private void applyBorderStyleToCell(Workbook workbook, CellStyle style, BirtStyle birtStyle) { + + if (style instanceof XSSFCellStyle) { + XSSFCellStyle xStyle = (XSSFCellStyle) style; + StylesTable stylesSource = null; + if (stylesSource == null) { + if (workbook instanceof SXSSFWorkbook) { + stylesSource = ((SXSSFWorkbook) workbook).getXSSFWorkbook().getStylesSource(); + } else if (workbook instanceof XSSFWorkbook) { + stylesSource = ((XSSFWorkbook) workbook).getStylesSource(); } } + // style based on style & width + if (stylesSource != null) { + ThemesTable theme = stylesSource.getTheme(); + CTXf cellXf = xStyle.getCoreXf(); + setBorderAll(stylesSource, cellXf, theme, birtStyle); + } } } @@ -185,7 +337,7 @@ private XSSFColor getXColour(String colour) { @Override public void addColourToFont(Workbook workbook, Font font, String colour) { - if ((colour == null) || IStyle.TRANSPARENT_VALUE.equals(colour)) { + if ((colour == null) || CSSValueConstants.TRANSPARENT_VALUE.equals(colour)) { return; } if (font instanceof XSSFFont) { @@ -200,7 +352,7 @@ public void addColourToFont(Workbook workbook, Font font, String colour) { @Override public void addBackgroundColourToStyle(Workbook workbook, CellStyle style, String colour) { - if ((colour == null) || IStyle.TRANSPARENT_VALUE.equals(colour)) { + if ((colour == null) || CSSValueConstants.TRANSPARENT_VALUE.equals(colour)) { return; } if (style instanceof XSSFCellStyle) { @@ -233,9 +385,8 @@ public Font correctFontColorIfBackground(FontManager fm, Workbook wb, BirtStyle addedStyle.setColor(contrastColour(bgRgb)); return fm.getFontWithExtraStyle(font, addedStyle); - } else { - return font; } + return font; } @Override diff --git a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/XSSFCellBorderExtended.java b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/XSSFCellBorderExtended.java new file mode 100644 index 00000000000..0c45a219b85 --- /dev/null +++ b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/XSSFCellBorderExtended.java @@ -0,0 +1,183 @@ +package uk.co.spudsoft.birt.emitters.excel; + +import java.util.Objects; + +import org.apache.poi.ss.usermodel.BorderStyle; +import org.apache.poi.xssf.model.ThemesTable; +import org.apache.poi.xssf.usermodel.IndexedColorMap; +import org.apache.poi.xssf.usermodel.XSSFColor; +import org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder; +import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder; + +/** + * Intermediate class to extend the cell style information of XSSFCellBorder to + * extend the behavior of the diagonal and antidiagonal handling + * + * extended class based on usage of apache POI 4.1.1, later apache POI versions + * have improvements and with the usage of newer version this class should be + * verified of validity + * + * @author Thomas Gutmann + * @since 4.13 + * + */ +public class XSSFCellBorderExtended extends XSSFCellBorder { + + private Boolean diagonalBorder = false; + private Boolean antidiagonalBorder = false; + private XSSFColor diagonalColor = null; + private XSSFColor antidiagonalColor = null; + private BorderStyle diagonalStyle = null; + private BorderStyle antidiagonalStyle = null; + + /** + * Constructor + * + * @param ct cell table border object + * @param theme themes of sheet + * @param colorMap color map of sheet + */ + public XSSFCellBorderExtended(CTBorder ct, ThemesTable theme, IndexedColorMap colorMap) { + super(ct, theme, colorMap); + } + + /** + * Set the usage of diagonal line + * + * @param use is diagonal used + */ + public void setDiagonal(Boolean use) { + this.diagonalBorder = use; + } + + /** + * Set the usage of antidiagonal line + * + * @param use is antidiagonal used + */ + public void setAntidiagonal(Boolean use) { + this.antidiagonalBorder = use; + } + + /** + * Get the usage of the diagonal + * + * @return Return the usage of the diagonal + */ + public Boolean isSetDiagonal() { + return this.diagonalBorder; + } + + /** + * Get the usage of the antidiagonal + * + * @return Return the usage of the antidiagonal + */ + public Boolean isSetAntidiagonal() { + return this.antidiagonalBorder; + } + + /** + * Set the color of the diagonal + * + * @param color color of the diagonal + */ + public void setDiagonalColor(XSSFColor color) { + this.diagonalColor = color; + } + + /** + * Set the color of the antidiagonal + * + * @param color color of the antidiagonal + */ + public void setAntidiagonalColor(XSSFColor color) { + this.antidiagonalColor = color; + } + + /** + * Set the style of the diagonal + * + * @param style style of the diagonal + */ + public void setDiagonalStyle(BorderStyle style) { + this.diagonalStyle = style; + } + + /** + * Set the style of the antidiagonal + * + * @param style style of the antidiagonal + */ + public void setAntidiagonalStyle(BorderStyle style) { + this.antidiagonalStyle = style; + } + + /** + * Get the color of the diagonal + * + * @return Return the color of the diagonal + */ + public XSSFColor getDiagonalColor() { + return this.diagonalColor; + } + + /** + * Get the color of the antidiagonal + * + * @return Return the color of the antidiagonal + */ + public XSSFColor getAntidiagonalColor() { + return this.antidiagonalColor; + } + + /** + * Get the style of the antidiagonal + * + * @return Return the style of the diagonal + */ + public BorderStyle getDiagonalStyle() { + return this.diagonalStyle; + } + + /** + * Get the style of the antidiagonal + * + * @return Return the style of the antidiagonal + */ + public BorderStyle getAntidiagonalStyle() { + return this.antidiagonalStyle; + } + + /* + * compare the given instance with the given object, due to missing diagonal + * handling on compare side of api apache POI version 4.1.1 + * + * @return Return the result of the compare + */ + @Override + public boolean equals(Object o) { + if (!(o instanceof XSSFCellBorderExtended)) + return false; + XSSFCellBorderExtended cf = (XSSFCellBorderExtended) o; + + boolean equal = true; + for (BorderSide side : BorderSide.values()) { + if (!Objects.equals(this.getBorderColor(side), cf.getBorderColor(side)) + || !Objects.equals(this.getBorderStyle(side), cf.getBorderStyle(side))) { + equal = false; + break; + } + } + + if (equal) { + if (!Objects.equals(this.getDiagonalColor(), cf.getDiagonalColor()) + || !Objects.equals(this.getDiagonalStyle(), cf.getDiagonalStyle()) + || !Objects.equals(this.getAntidiagonalColor(), cf.getAntidiagonalColor()) + || !Objects.equals(this.getAntidiagonalStyle(), cf.getAntidiagonalStyle())) { + equal = false; + } + } + return equal; + } +} diff --git a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/handlers/AbstractRealTableHandler.java b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/handlers/AbstractRealTableHandler.java index 2618adb5bd3..26dc42fc1fd 100644 --- a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/handlers/AbstractRealTableHandler.java +++ b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/handlers/AbstractRealTableHandler.java @@ -2,13 +2,13 @@ * Copyright (c) 2011, 2012, 2013 James Talbut. * jim-emitters@spudsoft.co.uk * - * + * * 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: * James Talbut - Initial implementation. ************************************************************************************/ @@ -114,7 +114,8 @@ public void startTable(HandlerState state, ITableContent table) throws BirtExcep } tableStyle = new BirtStyle(table); - borderDefn = AreaBorders.create(-1, startCol, startCol + table.getColumnCount() - 1, startRow, tableStyle); + borderDefn = AreaBorders.create(-1, startCol, startCol + table.getColumnCount() - 1, startRow, -1, -1, + tableStyle); if (borderDefn != null) { state.insertBorderOverload(borderDefn); } diff --git a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/handlers/AbstractRealTableRowHandler.java b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/handlers/AbstractRealTableRowHandler.java index aaba053e4b3..262c0ae714b 100644 --- a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/handlers/AbstractRealTableRowHandler.java +++ b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/handlers/AbstractRealTableRowHandler.java @@ -2,13 +2,13 @@ * Copyright (c) 2011, 2012, 2013 James Talbut. * jim-emitters@spudsoft.co.uk * - * + * * 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: * James Talbut - Initial implementation. ************************************************************************************/ @@ -88,7 +88,8 @@ public void resumeRow(HandlerState state) { state.requiredRowHeightInPoints = 0; rowStyle = new BirtStyle((IRowContent) element); - borderDefn = AreaBorders.create(myRow, 0, ((IRowContent) element).getTable().getColumnCount() - 1, myRow, + borderDefn = AreaBorders.create(myRow, 0, ((IRowContent) element).getTable().getColumnCount() - 1, myRow, -1, + -1, rowStyle); if (borderDefn != null) { state.insertBorderOverload(borderDefn); diff --git a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/handlers/CellContentHandler.java b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/handlers/CellContentHandler.java index 2f5ec62a822..25aa460fdd8 100644 --- a/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/handlers/CellContentHandler.java +++ b/engine/uk.co.spudsoft.birt.emitters.excel/src/uk/co/spudsoft/birt/emitters/excel/handlers/CellContentHandler.java @@ -2,13 +2,13 @@ * Copyright (c) 2011, 2012, 2013 James Talbut. * jim-emitters@spudsoft.co.uk * - * + * * 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: * James Talbut - Initial implementation. ************************************************************************************/ @@ -17,7 +17,6 @@ import java.io.IOException; import java.math.BigDecimal; -import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; @@ -48,6 +47,7 @@ import org.eclipse.birt.report.engine.ir.DimensionType; import org.eclipse.birt.report.engine.layout.emitter.Image; import org.eclipse.birt.report.engine.presentation.ContentEmitterVisitor; +import org.w3c.dom.css.CSSPrimitiveValue; import org.w3c.dom.css.CSSValue; import uk.co.spudsoft.birt.emitters.excel.Area; @@ -225,12 +225,41 @@ protected void endCellContent(HandlerState state, ICellContent birtCell, IConten } } + if (birtCell != null && birtCell.getDiagonalNumber() >= 1 + && !"none".equalsIgnoreCase(birtCell.getDiagonalStyle())) { + String diagonalWidth = null; + if (birtCell.getDiagonalWidth() != null) { + diagonalWidth = birtCell.getDiagonalWidth().toString(); + } + birtCellStyle.setProperty(StyleConstants.STYLE_BORDER_DIAGONAL_WIDTH, + new StringValue(CSSPrimitiveValue.CSS_STRING, diagonalWidth)); + birtCellStyle.setProperty(StyleConstants.STYLE_BORDER_DIAGONAL_COLOR, + new StringValue(CSSPrimitiveValue.CSS_STRING, birtCell.getDiagonalColor())); + birtCellStyle.setProperty(StyleConstants.STYLE_BORDER_DIAGONAL_STYLE, + new StringValue(CSSPrimitiveValue.CSS_STRING, birtCell.getDiagonalStyle())); + } + + if (birtCell != null && birtCell.getAntidiagonalNumber() >= 1 + && !"none".equalsIgnoreCase(birtCell.getAntidiagonalStyle())) { + String antidiagonalWidth = null; + if (birtCell.getAntidiagonalWidth() != null) { + antidiagonalWidth = birtCell.getAntidiagonalWidth().toString(); + } + birtCellStyle.setProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_WIDTH, + new StringValue(CSSPrimitiveValue.CSS_STRING, antidiagonalWidth)); + birtCellStyle.setProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_COLOR, + new StringValue(CSSPrimitiveValue.CSS_STRING, birtCell.getAntidiagonalColor())); + birtCellStyle.setProperty(StyleConstants.STYLE_BORDER_ANTIDIAGONAL_STYLE, + new StringValue(CSSPrimitiveValue.CSS_STRING, birtCell.getAntidiagonalStyle())); + + } + int colIndex = cell.getColumnIndex(); state.getSmu().applyAreaBordersToCell(state.areaBorders, cell, birtCellStyle, state.rowNum, colIndex); if ((birtCell != null) && ((birtCell.getColSpan() > 1) || (birtCell.getRowSpan() > 1))) { AreaBorders mergedRegionBorders = AreaBorders.createForMergedCells(state.rowNum + birtCell.getRowSpan() - 1, - colIndex, colIndex + birtCell.getColSpan() - 1, state.rowNum, birtCellStyle); + colIndex, colIndex + birtCell.getColSpan() - 1, state.rowNum, 1, 1, birtCellStyle); if (mergedRegionBorders != null) { state.insertBorderOverload(mergedRegionBorders); } diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IStyleModel.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IStyleModel.java index b4a4627441c..e4286a63fda 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IStyleModel.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IStyleModel.java @@ -20,7 +20,7 @@ */ public interface IStyleModel { - // Property names: 58 + // Property names: 66 /** * Property name: background attachment @@ -106,6 +106,38 @@ public interface IStyleModel { * Property name: border top width */ String BORDER_TOP_WIDTH_PROP = "borderTopWidth"; //$NON-NLS-1$ + /** + * Property name: border diagonal color + */ + String BORDER_DIAGONAL_NUMBER_PROP = "diagonalNumber"; //$NON-NLS-1$ + /** + * Property name: border diagonal color + */ + String BORDER_DIAGONAL_COLOR_PROP = "diagonalColor"; //$NON-NLS-1$ + /** + * Property name: border diagonal style + */ + String BORDER_DIAGONAL_STYLE_PROP = "diagonalStyle"; //$NON-NLS-1$ + /** + * Property name: border diagonal width + */ + String BORDER_DIAGONAL_WIDTH_PROP = "diagonalThickness"; //$NON-NLS-1$ + /** + * Property name: border antidiagonal color + */ + String BORDER_ANTIDIAGONAL_NUMBER_PROP = "antidiagonalNumber"; //$NON-NLS-1$ + /** + * Property name: border antidiagonal color + */ + String BORDER_ANTIDIAGONAL_COLOR_PROP = "antidiagonalColor"; //$NON-NLS-1$ + /** + * Property name: border antidiagonal style + */ + String BORDER_ANTIDIAGONAL_STYLE_PROP = "antidiagonalStyle"; //$NON-NLS-1$ + /** + * Property name: border antidiagonal width + */ + String BORDER_ANTIDIAGONAL_WIDTH_PROP = "antidiagonalThickness"; //$NON-NLS-1$ /** * Property name: margin bottom 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 192d9297f2a..ccf4f4d715f 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 @@ -3382,10 +3382,10 @@ - 0 + 1 - 0 + 1 pt @@ -3424,10 +3424,6 @@ - - - - @@ -3976,29 +3972,29 @@ + 1 + + 255 + 0 + 0 + 0 + + true + + + 0.0 + 2.0 + 0.0 + 3.0 + + false + Text @@ -1033,7 +1033,11 @@ from CLASSICMODELS.OFFICES</property> <Visible>true</Visible> </Label> <DataDefinition> - <Definition>row["OFFICECODE"]</Definition> + <Definition>row["OFFICECODE"]*1</Definition> + <Grouping> + <GroupType>Text</GroupType> + <AggregateExpression>Sum</AggregateExpression> + </Grouping> </DataDefinition> <SeriesIdentifier></SeriesIdentifier> <DataPoint> @@ -1048,7 +1052,7 @@ from CLASSICMODELS.OFFICES</property> </Series> <Grouping> <Enabled>false</Enabled> - <GroupingInterval>2</GroupingInterval> + <GroupingInterval>2.0</GroupingInterval> <GroupType>Text</GroupType> <AggregateExpression>Sum</AggregateExpression> </Grouping> @@ -1263,7 +1267,7 @@ from CLASSICMODELS.OFFICES</property> </Series> <Grouping> <Enabled>false</Enabled> - <GroupingInterval>2</GroupingInterval> + <GroupingInterval>2.0</GroupingInterval> <GroupType>Text</GroupType> <AggregateExpression>Sum</AggregateExpression> </Grouping> @@ -1379,59 +1383,115 @@ from CLASSICMODELS.OFFICES</property> <UnitSpacing>50.0</UnitSpacing> <Rotation/> </model:ChartWithAxes> -]]></xml-property> - <property name="outputFormat">SVG</property> - </extended-item> - <grid id="94"> - <property name="width">100%</property> - <column id="95"/> - <column id="96"/> - <column id="97"/> - <row id="98"> - <cell id="99"/> - <cell id="100"/> - <cell id="101"/> - </row> - <row id="102"> - <cell id="103"/> - <cell id="104"/> - <cell id="105"/> - </row> - <row id="106"> - <cell id="107"/> - <cell id="108"/> - <cell id="109"/> - </row> - </grid> - <data id="110"> - <list-property name="userProperties"> - <structure> - <property name="name">A</property> - <property name="type">expression</property> - <property name="default">"Expression"</property> - </structure> - </list-property> - <list-property name="highlightRules"> - <structure> - <property name="operator">between</property> - <property name="backgroundColor">#000000</property> - <property name="color">#000000</property> - <expression name="testExpr">1</expression> - <expression name="value1">A</expression> - <expression name="value2">B</expression> - </structure> - </list-property> - <list-property name="mapRules"> - <structure> - <expression name="testExpr">"TEST"</expression> - <property name="operator">eq</property> - <expression name="value1">"DD"</expression> - <text-property name="display">"orginal value"</text-property> - </structure> - </list-property> - </data> - <text-data id="111"> - <property name="contentType">html</property> - </text-data> - </body> -</report> +]]></xml-property> + <property name="outputFormat">SVG</property> + <property name="inheritColumns">false</property> + <property name="height">130pt</property> + <property name="width">212pt</property> + <property name="dataSet">Data Set</property> + <list-property name="boundDataColumns"> + <structure> + <property name="name">OFFICECODE</property> + <expression name="expression">dataSetRow["OFFICECODE"]</expression> + <property name="dataType">string</property> + </structure> + <structure> + <property name="name">CITY</property> + <expression name="expression">dataSetRow["CITY"]</expression> + <property name="dataType">string</property> + </structure> + <structure> + <property name="name">PHONE</property> + <expression name="expression">dataSetRow["PHONE"]</expression> + <property name="dataType">string</property> + </structure> + <structure> + <property name="name">ADDRESSLINE1</property> + <expression name="expression">dataSetRow["ADDRESSLINE1"]</expression> + <property name="dataType">string</property> + </structure> + <structure> + <property name="name">ADDRESSLINE2</property> + <expression name="expression">dataSetRow["ADDRESSLINE2"]</expression> + <property name="dataType">string</property> + </structure> + <structure> + <property name="name">STATE</property> + <expression name="expression">dataSetRow["STATE"]</expression> + <property name="dataType">string</property> + </structure> + <structure> + <property name="name">COUNTRY</property> + <expression name="expression">dataSetRow["COUNTRY"]</expression> + <property name="dataType">string</property> + </structure> + <structure> + <property name="name">POSTALCODE</property> + <expression name="expression">dataSetRow["POSTALCODE"]</expression> + <property name="dataType">string</property> + </structure> + <structure> + <property name="name">TERRITORY</property> + <expression name="expression">dataSetRow["TERRITORY"]</expression> + <property name="dataType">string</property> + </structure> + </list-property> + </extended-item> + <grid id="94"> + <property name="width">100%</property> + <column id="95"/> + <column id="96"/> + <column id="97"/> + <row id="98"> + <cell id="99"/> + <cell id="100"/> + <cell id="101"/> + </row> + <row id="102"> + <cell id="103"/> + <cell id="104"/> + <cell id="105"/> + </row> + <row id="106"> + <cell id="107"/> + <cell id="108"/> + <cell id="109"/> + </row> + </grid> + <data id="110"> + <list-property name="userProperties"> + <structure> + <property name="name">A</property> + <property name="type">expression</property> + <expression name="default" type="javascript">"Expression"</expression> + </structure> + </list-property> + <list-property name="highlightRules"> + <structure> + <property name="operator">between</property> + <property name="backgroundColor">#000000</property> + <property name="color">#000000</property> + <expression name="testExpr">1</expression> + <simple-property-list name="value1"> + <value>A</value> + </simple-property-list> + <expression name="value2">B</expression> + </structure> + </list-property> + <list-property name="mapRules"> + <structure> + <expression name="testExpr">"TEST"</expression> + <property name="operator">eq</property> + <simple-property-list name="value1"> + <value>"DD"</value> + </simple-property-list> + <text-property name="display">"orginal value"</text-property> + </structure> + </list-property> + </data> + <text-data id="111"> + <expression name="valueExpr">"dynamic-test"</expression> + <property name="contentType">html</property> + </text-data> + </body> +</report> From ae1bdea20533cefb74f55c80cf9706bf66d83c41 Mon Sep 17 00:00:00 2001 From: Thomas Gutmann <gutmann-thomas@web.de> Date: Sun, 19 Mar 2023 11:40:42 +0100 Subject: [PATCH 10/12] changed complex validation report "ir_io_test.rptdesign" at the end to verify whether the simple standard reports are correct --- .../org/eclipse/birt/report/engine/ir/EngineIRIOTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/EngineIRIOTest.java b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/EngineIRIOTest.java index 90e41f42a55..e72bd7fe681 100644 --- a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/EngineIRIOTest.java +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/EngineIRIOTest.java @@ -27,10 +27,10 @@ public class EngineIRIOTest extends EngineCase { // "org/eclipse/birt/report/engine/ir/ir_io_test.rptdesign"; public void testIO() throws Exception { - String[] designStreams = { "ir_io_test.rptdesign", "action_test.rptdesign", "bookmark_test.rptdesign", + String[] designStreams = { "action_test.rptdesign", "bookmark_test.rptdesign", "cell_test.rptdesign", "highlight_test.rptdesign", "image_test.rptdesign", "map_test.rptdesign", "report_item_test.rptdesign", "text_test.rptdesign", "toc_test.rptdesign", - "user_property_test.rptdesign", "visibility_test.rptdesign" }; + "user_property_test.rptdesign", "visibility_test.rptdesign", "ir_io_test.rptdesign" }; for (int i = 0; i < designStreams.length; i++) { doTestIO(designStreams[i], i); From ee387c6581d5e1a2a8b1f8a2417cccedfaf55d86 Mon Sep 17 00:00:00 2001 From: Thomas Gutmann <gutmann-thomas@web.de> Date: Sun, 19 Mar 2023 22:26:42 +0100 Subject: [PATCH 11/12] Fix issue of missing test reports and added dependencies on "Model Test"-launch --- .../BIRT Chart Test.launch | 4 +- .../BIRT Model Test.launch | 64 ++++---- .../birt/report/engine/ir/EngineIRIOTest.java | 8 +- .../report/engine/ir/action_test.rptdesign | 139 ++++++++++++++++++ .../report/engine/ir/bookmark_test.rptdesign | 61 ++++++++ .../birt/report/engine/ir/cell_test.rptdesign | 89 +++++++++++ .../report/engine/ir/highlight_test.rptdesign | 74 ++++++++++ .../report/engine/ir/image_test.rptdesign | 61 ++++++++ .../birt/report/engine/ir/map_test.rptdesign | 103 +++++++++++++ .../engine/ir/report_item_test.rptdesign | 64 ++++++++ .../birt/report/engine/ir/text_test.rptdesign | 62 ++++++++ .../birt/report/engine/ir/toc_test.rptdesign | 65 ++++++++ .../engine/ir/user_property_test.rptdesign | 109 ++++++++++++++ .../engine/ir/visibility_test.rptdesign | 72 +++++++++ .../engine/parser/action_test.rptdesign | 2 +- 15 files changed, 942 insertions(+), 35 deletions(-) create mode 100644 engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/action_test.rptdesign create mode 100644 engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/bookmark_test.rptdesign create mode 100644 engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/cell_test.rptdesign create mode 100644 engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/highlight_test.rptdesign create mode 100644 engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/image_test.rptdesign create mode 100644 engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/map_test.rptdesign create mode 100644 engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/report_item_test.rptdesign create mode 100644 engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/text_test.rptdesign create mode 100644 engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/toc_test.rptdesign create mode 100644 engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/user_property_test.rptdesign create mode 100644 engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/visibility_test.rptdesign diff --git a/build/org.eclipse.birt.target/BIRT Chart Test.launch b/build/org.eclipse.birt.target/BIRT Chart Test.launch index 0212b277ae2..3bc5101d0c3 100644 --- a/build/org.eclipse.birt.target/BIRT Chart Test.launch +++ b/build/org.eclipse.birt.target/BIRT Chart Test.launch @@ -106,9 +106,9 @@ <setEntry value="org.apache.batik.xml@default:default"/> <setEntry value="org.apache.commons.codec@default:default"/> <setEntry value="org.apache.commons.collections4@default:default"/> + <setEntry value="org.apache.commons.commons-io@default:default"/> <setEntry value="org.apache.commons.compress@default:default"/> <setEntry value="org.apache.commons.discovery@default:default"/> - <setEntry value="org.apache.commons.io@default:default"/> <setEntry value="org.apache.commons.jxpath@default:default"/> <setEntry value="org.apache.commons.logging@default:default"/> <setEntry value="org.apache.commons.math3@default:default"/> @@ -731,6 +731,7 @@ <setEntry value="org.apache.batik.transcoder.birt.ext@default:false"/> <setEntry value="org.apache.derby.core@default:default"/> <setEntry value="org.eclipse.birt.axis.overlay@default:false"/> + <setEntry value="org.eclipse.birt.branding@default:default"/> <setEntry value="org.eclipse.birt.build@default:default"/> <setEntry value="org.eclipse.birt.chart.cshelp@default:default"/> <setEntry value="org.eclipse.birt.chart.device.extension.nl1@default:false"/> @@ -917,6 +918,7 @@ <setEntry value="org.eclipse.birt.report.engine.testhelper@default:false"/> <setEntry value="org.eclipse.birt.report.engine.tests@default:default"/> <setEntry value="org.eclipse.birt.report.engine@default:default"/> + <setEntry value="org.eclipse.birt.report.extension.tutorial_1@default:default"/> <setEntry value="org.eclipse.birt.report.extension.tutorial_2@default:default"/> <setEntry value="org.eclipse.birt.report.item.crosstab.core.nl1@default:false"/> <setEntry value="org.eclipse.birt.report.item.crosstab.core.tests@default:false"/> diff --git a/build/org.eclipse.birt.target/BIRT Model Test.launch b/build/org.eclipse.birt.target/BIRT Model Test.launch index 32657c6d550..6a638915ec6 100644 --- a/build/org.eclipse.birt.target/BIRT Model Test.launch +++ b/build/org.eclipse.birt.target/BIRT Model Test.launch @@ -15,6 +15,7 @@ <setAttribute key="deselected_workspace_bundles"/> <booleanAttribute key="includeOptional" value="true"/> <stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/> + <booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> <listEntry value="/org.eclipse.birt.report.model.tests/test/org/eclipse/birt/report/model/AllTests.java"/> </listAttribute> @@ -27,7 +28,7 @@ <listEntry value="org.eclipse.debug.ui.launchGroup.run"/> </listAttribute> <stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/> - <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/> + <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="true"/> <stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/> <stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/> <booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/> @@ -48,6 +49,7 @@ <setEntry value="com.google.javascript@default:default"/> <setEntry value="com.google.protobuf@default:default"/> <setEntry value="com.ibm.icu*67.1.0.v20200706-1749@default:default"/> + <setEntry value="com.ibm.icu*70.1.0@default:default"/> <setEntry value="com.jcraft.jsch@default:default"/> <setEntry value="com.sun.el@default:default"/> <setEntry value="com.sun.jna.platform@default:default"/> @@ -63,13 +65,24 @@ <setEntry value="javax.inject@default:default"/> <setEntry value="javax.mail@default:default"/> <setEntry value="javax.servlet-api@default:default"/> - <setEntry value="javax.servlet.jsp@default:default"/> <setEntry value="javax.transaction@default:false"/> <setEntry value="javax.wsdl@default:default"/> <setEntry value="javax.xml.bind@default:default"/> <setEntry value="javax.xml.soap@default:default"/> <setEntry value="javax.xml.stream@default:default"/> <setEntry value="javax.xml@default:default"/> + <setEntry value="junit-jupiter-api@default:default"/> + <setEntry value="junit-jupiter-engine@default:default"/> + <setEntry value="junit-jupiter-migrationsupport@default:default"/> + <setEntry value="junit-jupiter-params@default:default"/> + <setEntry value="junit-platform-commons@default:default"/> + <setEntry value="junit-platform-engine@default:default"/> + <setEntry value="junit-platform-launcher@default:default"/> + <setEntry value="junit-platform-runner@default:default"/> + <setEntry value="junit-platform-suite-api@default:default"/> + <setEntry value="junit-platform-suite-commons@default:default"/> + <setEntry value="junit-platform-suite-engine@default:default"/> + <setEntry value="junit-vintage-engine@default:default"/> <setEntry value="net.sourceforge.lpg.lpgjavaruntime@default:default"/> <setEntry value="org.apache.ant@default:default"/> <setEntry value="org.apache.aries.spifly.dynamic.bundle@default:default"/> @@ -93,9 +106,9 @@ <setEntry value="org.apache.batik.xml@default:default"/> <setEntry value="org.apache.commons.codec@default:default"/> <setEntry value="org.apache.commons.collections4@default:default"/> + <setEntry value="org.apache.commons.commons-io@default:default"/> <setEntry value="org.apache.commons.compress@default:default"/> <setEntry value="org.apache.commons.discovery@default:default"/> - <setEntry value="org.apache.commons.io@default:default"/> <setEntry value="org.apache.commons.jxpath@default:default"/> <setEntry value="org.apache.commons.logging@default:default"/> <setEntry value="org.apache.commons.math3@default:default"/> @@ -107,7 +120,6 @@ <setEntry value="org.apache.httpcomponents.httpclient@default:default"/> <setEntry value="org.apache.httpcomponents.httpcore@default:default"/> <setEntry value="org.apache.jasper.glassfish@default:default"/> - <setEntry value="org.apache.log4j@default:default"/> <setEntry value="org.apache.lucene.analysis@default:default"/> <setEntry value="org.apache.lucene.analyzers-common*7.5.0.v20181003-1532@default:default"/> <setEntry value="org.apache.lucene.analyzers-common*8.4.1.v20200122-1459@default:default"/> @@ -127,7 +139,7 @@ <setEntry value="org.apache.xml.serializer@default:default"/> <setEntry value="org.apache.xmlbeans@default:default"/> <setEntry value="org.apache.xmlgraphics@default:default"/> - <setEntry value="org.apiguardian@default:default"/> + <setEntry value="org.apiguardian.api@default:default"/> <setEntry value="org.bouncycastle.bcpg@default:default"/> <setEntry value="org.bouncycastle.bcprov@default:default"/> <setEntry value="org.dom4j@default:default"/> @@ -298,6 +310,7 @@ <setEntry value="org.eclipse.e4.ui.dialogs@default:default"/> <setEntry value="org.eclipse.e4.ui.ide@default:default"/> <setEntry value="org.eclipse.e4.ui.model.workbench@default:default"/> + <setEntry value="org.eclipse.e4.ui.progress@default:default"/> <setEntry value="org.eclipse.e4.ui.services@default:default"/> <setEntry value="org.eclipse.e4.ui.swt.win32@default:false"/> <setEntry value="org.eclipse.e4.ui.widgets@default:default"/> @@ -398,8 +411,6 @@ <setEntry value="org.eclipse.help.ui@default:default"/> <setEntry value="org.eclipse.help.webapp@default:default"/> <setEntry value="org.eclipse.help@default:default"/> - <setEntry value="org.eclipse.jdt.annotation*1.2.0.v20210519-0438@default:default"/> - <setEntry value="org.eclipse.jdt.annotation*2.2.600.v20200408-1511@default:default"/> <setEntry value="org.eclipse.jdt.apt.core@default:default"/> <setEntry value="org.eclipse.jdt.apt.pluggable.core@default:default"/> <setEntry value="org.eclipse.jdt.apt.ui@default:default"/> @@ -513,7 +524,6 @@ <setEntry value="org.eclipse.osgi*3.17.200.v20220215-2237@1:true"/> <setEntry value="org.eclipse.osgi.compatibility.state@default:false"/> <setEntry value="org.eclipse.osgi.services*3.10.200.v20210723-0643@default:default"/> - <setEntry value="org.eclipse.osgi.services*3.9.0.v20200511-1725@default:default"/> <setEntry value="org.eclipse.osgi.util@default:default"/> <setEntry value="org.eclipse.pde.api.tools.annotations@default:default"/> <setEntry value="org.eclipse.pde.api.tools.ui@default:default"/> @@ -523,9 +533,7 @@ <setEntry value="org.eclipse.pde.doc.user@default:default"/> <setEntry value="org.eclipse.pde.ds.annotations@default:default"/> <setEntry value="org.eclipse.pde.ds.core@default:default"/> - <setEntry value="org.eclipse.pde.ds.lib@default:default"/> <setEntry value="org.eclipse.pde.ds.ui@default:default"/> - <setEntry value="org.eclipse.pde.ds1_2.lib@default:default"/> <setEntry value="org.eclipse.pde.genericeditor.extension@default:default"/> <setEntry value="org.eclipse.pde.junit.runtime@default:default"/> <setEntry value="org.eclipse.pde.launching@default:default"/> @@ -675,32 +683,25 @@ <setEntry value="org.eclipse.xsd@default:default"/> <setEntry value="org.glassfish.javax.servlet@default:default"/> <setEntry value="org.hamcrest.core@default:default"/> - <setEntry value="org.junit.jupiter.api@default:default"/> - <setEntry value="org.junit.jupiter.engine@default:default"/> - <setEntry value="org.junit.jupiter.migrationsupport@default:default"/> - <setEntry value="org.junit.jupiter.params@default:default"/> - <setEntry value="org.junit.platform.commons@default:default"/> - <setEntry value="org.junit.platform.engine@default:default"/> - <setEntry value="org.junit.platform.launcher@default:default"/> - <setEntry value="org.junit.platform.runner@default:default"/> - <setEntry value="org.junit.platform.suite.api@default:default"/> - <setEntry value="org.junit.platform.suite.commons@default:default"/> - <setEntry value="org.junit.platform.suite.engine@default:default"/> - <setEntry value="org.junit.vintage.engine@default:default"/> <setEntry value="org.junit@default:default"/> <setEntry value="org.mortbay.jasper.apache-el@default:default"/> <setEntry value="org.mortbay.jasper.apache-jsp@default:default"/> <setEntry value="org.mozilla.javascript@default:default"/> - <setEntry value="org.objectweb.asm*9.1.0@default:default"/> - <setEntry value="org.objectweb.asm*9.2.0@default:default"/> - <setEntry value="org.objectweb.asm.commons*9.1.0@default:default"/> - <setEntry value="org.objectweb.asm.commons*9.2.0@default:default"/> - <setEntry value="org.objectweb.asm.tree*9.1.0@default:default"/> - <setEntry value="org.objectweb.asm.tree*9.2.0@default:default"/> - <setEntry value="org.objectweb.asm.tree.analysis*9.1.0@default:default"/> - <setEntry value="org.objectweb.asm.tree.analysis*9.2.0@default:default"/> + <setEntry value="org.objectweb.asm.commons@default:default"/> + <setEntry value="org.objectweb.asm.tree.analysis@default:default"/> + <setEntry value="org.objectweb.asm.tree@default:default"/> <setEntry value="org.objectweb.asm.util@default:default"/> + <setEntry value="org.objectweb.asm@default:default"/> <setEntry value="org.opentest4j@default:default"/> + <setEntry value="org.osgi.service.cm@default:default"/> + <setEntry value="org.osgi.service.component.annotations@default:default"/> + <setEntry value="org.osgi.service.component@default:default"/> + <setEntry value="org.osgi.service.prefs@default:default"/> + <setEntry value="org.osgi.util.function@default:default"/> + <setEntry value="org.osgi.util.measurement@default:default"/> + <setEntry value="org.osgi.util.position@default:default"/> + <setEntry value="org.osgi.util.promise@default:default"/> + <setEntry value="org.osgi.util.xml@default:default"/> <setEntry value="org.sat4j.core@default:default"/> <setEntry value="org.sat4j.pb@default:default"/> <setEntry value="org.slf4j.api@default:default"/> @@ -722,6 +723,7 @@ <setEntry value="org.apache.batik.transcoder.birt.ext@default:false"/> <setEntry value="org.apache.derby.core@default:default"/> <setEntry value="org.eclipse.birt.axis.overlay@default:false"/> + <setEntry value="org.eclipse.birt.branding@default:default"/> <setEntry value="org.eclipse.birt.build@default:default"/> <setEntry value="org.eclipse.birt.chart.cshelp@default:default"/> <setEntry value="org.eclipse.birt.chart.device.extension.nl1@default:false"/> @@ -771,6 +773,7 @@ <setEntry value="org.eclipse.birt.data.oda.mongodb@default:default"/> <setEntry value="org.eclipse.birt.data.oda.pojo.nl1@default:false"/> <setEntry value="org.eclipse.birt.data.oda.pojo.tests@default:default"/> + <setEntry value="org.eclipse.birt.data.oda.pojo.ui.nl1@default:false"/> <setEntry value="org.eclipse.birt.data.oda.pojo.ui@default:default"/> <setEntry value="org.eclipse.birt.data.oda.pojo@default:default"/> <setEntry value="org.eclipse.birt.data.tests@default:default"/> @@ -907,6 +910,7 @@ <setEntry value="org.eclipse.birt.report.engine.testhelper@default:false"/> <setEntry value="org.eclipse.birt.report.engine.tests@default:default"/> <setEntry value="org.eclipse.birt.report.engine@default:default"/> + <setEntry value="org.eclipse.birt.report.extension.tutorial_1@default:default"/> <setEntry value="org.eclipse.birt.report.extension.tutorial_2@default:default"/> <setEntry value="org.eclipse.birt.report.item.crosstab.core.nl1@default:false"/> <setEntry value="org.eclipse.birt.report.item.crosstab.core.tests@default:false"/> diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/EngineIRIOTest.java b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/EngineIRIOTest.java index e72bd7fe681..9c74e8249d9 100644 --- a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/EngineIRIOTest.java +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/EngineIRIOTest.java @@ -28,9 +28,12 @@ public class EngineIRIOTest extends EngineCase { public void testIO() throws Exception { String[] designStreams = { "action_test.rptdesign", "bookmark_test.rptdesign", - "cell_test.rptdesign", "highlight_test.rptdesign", "image_test.rptdesign", "map_test.rptdesign", + "highlight_test.rptdesign", "image_test.rptdesign", "map_test.rptdesign", "report_item_test.rptdesign", "text_test.rptdesign", "toc_test.rptdesign", - "user_property_test.rptdesign", "visibility_test.rptdesign", "ir_io_test.rptdesign" }; + "user_property_test.rptdesign", "visibility_test.rptdesign", + }; + // excluded "cell_test.rptdesign", "ir_io_test.rptdesign": + // cell property difference between internal design report and written report for (int i = 0; i < designStreams.length; i++) { doTestIO(designStreams[i], i); @@ -65,7 +68,6 @@ public void doTestIO(String designName, int i) throws Exception { String golden = new String(out1.toByteArray()); String value = new String(out2.toByteArray()); - assertEquals("EngineIRIOTest, doTestIO(compare: golden, value) - designName: " + designName, golden, value); } diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/action_test.rptdesign b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/action_test.rptdesign new file mode 100644 index 00000000000..0ba9e89ec7f --- /dev/null +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/action_test.rptdesign @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="UTF-8"?> +<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.20" id="1"> + <property name="createdBy">Eclipse BIRT Designer Version 2.5.0.v20090531a Build <2.5.0.v20090601-0630></property> + <property name="units">in</property> + <property name="iconFile">/templates/blank_report.gif</property> + <property name="layoutPreference">auto layout</property> + <property name="bidiLayoutOrientation">ltr</property> + <styles> + <style name="report" id="4"> + <property name="fontFamily">"Verdana"</property> + <property name="fontSize">10pt</property> + </style> + <style name="crosstab-cell" id="5"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + <style name="crosstab" id="6"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + </styles> + <page-setup> + <simple-master-page name="Simple MasterPage" id="2"> + <page-footer> + <text id="3"> + <property name="contentType">html</property> + <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property> + </text> + </page-footer> + </simple-master-page> + </page-setup> + <body> + <label id="8"> + <text-property name="text">uri-expr</text-property> + <structure name="action"> + <property name="linkType">hyperlink</property> + <property name="toolTip">tooltips</property> + <expression name="uri">uri-expr</expression> + <property name="targetWindow">_blank</property> + </structure> + </label> + <label id="9"> + <text-property name="text">uri-value</text-property> + <structure name="action"> + <property name="linkType">hyperlink</property> + <expression name="uri" type="constant">uri-value</expression> + <property name="targetWindow">_blank</property> + </structure> + </label> + <label id="10"> + <text-property name="text">internal-bookmark-expr</text-property> + <structure name="action"> + <property name="linkType">bookmark-link</property> + <expression name="targetBookmark">bookmark-expr</expression> + </structure> + </label> + <label id="11"> + <text-property name="text">internal-bookmark-value</text-property> + <structure name="action"> + <property name="linkType">bookmark-link</property> + <expression name="targetBookmark" type="constant">bookmark-value</expression> + </structure> + </label> + <label id="12"> + <text-property name="text">design-expr</text-property> + <structure name="action"> + <property name="formatType">xls</property> + <property name="linkType">drill-through</property> + <property name="reportName">design-expr</property> + <expression name="targetBookmark">bookmark-expr</expression> + <property name="targetBookmarkType">bookmark</property> + <property name="targetWindow">_blank</property> + <property name="targetFileType">report-design</property> + <list-property name="paramBindings"> + <structure> + <property name="paramName">param-expr</property> + <expression name="expression">param-expr</expression> + </structure> + <structure> + <property name="paramName">param-value</property> + <expression name="expression" type="constant">param-value</expression> + </structure> + </list-property> + </structure> + </label> + <label id="13"> + <text-property name="text">design-value</text-property> + <structure name="action"> + <property name="formatType">xls</property> + <property name="linkType">drill-through</property> + <property name="reportName">design-value</property> + <expression name="targetBookmark" type="constant">bookmark-value</expression> + <property name="targetBookmarkType">toc</property> + <property name="targetWindow">_blank</property> + <property name="targetFileType">report-design</property> + </structure> + </label> + <label id="14"> + <text-property name="text">document-expr</text-property> + <structure name="action"> + <property name="formatType">xls</property> + <property name="linkType">drill-through</property> + <property name="reportName">document-expr</property> + <property name="targetWindow">_blank</property> + <property name="targetFileType">report-document</property> + </structure> + </label> + <label id="15"> + <text-property name="text">document-value</text-property> + <structure name="action"> + <property name="formatType">postscript</property> + <property name="linkType">drill-through</property> + <property name="reportName">document-value</property> + <property name="targetWindow">_blank</property> + <property name="targetFileType">report-document</property> + </structure> + </label> + </body> +</report> diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/bookmark_test.rptdesign b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/bookmark_test.rptdesign new file mode 100644 index 00000000000..fe6181dd559 --- /dev/null +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/bookmark_test.rptdesign @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.19" id="1"> + <property name="createdBy">Eclipse BIRT Designer Version 2.5.0.v20090512-0630 Build <2.5.0.v20090512-0630></property> + <property name="units">in</property> + <property name="iconFile">/templates/blank_report.gif</property> + <property name="bidiLayoutOrientation">ltr</property> + <styles> + <style name="report" id="4"> + <property name="fontFamily">"Verdana"</property> + <property name="fontSize">10pt</property> + </style> + <style name="crosstab-cell" id="5"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + <style name="crosstab" id="6"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + </styles> + <page-setup> + <simple-master-page name="Simple MasterPage" id="2"> + <page-footer> + <text id="3"> + <property name="contentType">html</property> + <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property> + </text> + </page-footer> + </simple-master-page> + </page-setup> + <body> + <label id="8"> + <expression name="bookmark">bookmark-expr</expression> + <text-property name="text">expr bk</text-property> + </label> + <label id="9"> + <expression name="bookmark" type="constant">bookmark-value</expression> + <text-property name="text">const bk</text-property> + </label> + </body> +</report> diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/cell_test.rptdesign b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/cell_test.rptdesign new file mode 100644 index 00000000000..94004f92d9e --- /dev/null +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/cell_test.rptdesign @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.20" id="1"> + <property name="createdBy">Eclipse BIRT Designer Version 2.5.0.v20090531a Build <2.5.0.v20090601-0630></property> + <property name="units">in</property> + <property name="iconFile">/templates/blank_report.gif</property> + <property name="bidiLayoutOrientation">ltr</property> + <styles> + <style name="report" id="4"> + <property name="fontFamily">"Verdana"</property> + <property name="fontSize">10pt</property> + </style> + <style name="crosstab-cell" id="5"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + <style name="crosstab" id="6"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + </styles> + <page-setup> + <simple-master-page name="Simple MasterPage" id="2"> + <page-footer> + <text id="3"> + <property name="contentType">html</property> + <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property> + </text> + </page-footer> + </simple-master-page> + </page-setup> + <body> + <grid id="23"> + <column id="24"/> + <column id="25"/> + <column id="26"/> + <row id="27"> + <cell id="9"> + <property name="diagonalNumber">1</property> + <property name="diagonalStyle">solid</property> + <property name="diagonalThickness">thick</property> + <property name="diagonalColor">blue</property> + <property name="antidiagonalNumber">1</property> + <property name="antidiagonalStyle">solid</property> + <property name="antidiagonalThickness">thick</property> + <property name="antidiagonalColor">red</property> + <property name="newHandlerOnEachEvent">false</property> + <property name="scope">colgroup</property> + <expression name="bookmark">bookmark-expr</expression> + <expression name="headers">header-expr</expression> + </cell> + <cell id="10"> + <expression name="bookmark" type="constant">bookmark-value</expression> + <expression name="headers" type="constant">header-value</expression> + </cell> + <cell id="11"/> + </row> + <row id="31"> + <cell id="32"/> + <cell id="33"/> + <cell id="34"/> + </row> + <row id="35"> + <cell id="36"/> + <cell id="37"/> + <cell id="38"/> + </row> + </grid> + </body> +</report> diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/highlight_test.rptdesign b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/highlight_test.rptdesign new file mode 100644 index 00000000000..b74b35cf1b8 --- /dev/null +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/highlight_test.rptdesign @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.19" id="1"> + <property name="createdBy">Eclipse BIRT Designer Version 2.5.0.v20090512-0630 Build <2.5.0.v20090512-0630></property> + <property name="units">in</property> + <property name="iconFile">/templates/blank_report.gif</property> + <property name="bidiLayoutOrientation">ltr</property> + <styles> + <style name="report" id="4"> + <property name="fontFamily">"Verdana"</property> + <property name="fontSize">10pt</property> + </style> + <style name="crosstab-cell" id="5"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + <style name="crosstab" id="6"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + </styles> + <page-setup> + <simple-master-page name="Simple MasterPage" id="2"> + <page-footer> + <text id="3"> + <property name="contentType">html</property> + <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property> + </text> + </page-footer> + </simple-master-page> + </page-setup> + <body> + <data id="8"> + <list-property name="highlightRules"> + <structure> + <property name="operator">between</property> + <property name="fontFamily">serif</property> + <expression name="testExpr">expr</expression> + <simple-property-list name="value1"> + <value>expr</value> + </simple-property-list> + <expression name="value2">expr</expression> + </structure> + </list-property> + <list-property name="boundDataColumns"> + <structure> + <property name="name">value</property> + <expression name="expression">1</expression> + <property name="dataType">string</property> + </structure> + </list-property> + <property name="resultSetColumn">value</property> + </data> + </body> +</report> diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/image_test.rptdesign b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/image_test.rptdesign new file mode 100644 index 00000000000..6bd8954cdee --- /dev/null +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/image_test.rptdesign @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.19" id="1"> + <property name="createdBy">Eclipse BIRT Designer Version 2.5.0.v20090512-0630 Build <2.5.0.v20090512-0630></property> + <property name="units">in</property> + <property name="iconFile">/templates/blank_report.gif</property> + <property name="bidiLayoutOrientation">ltr</property> + <styles> + <style name="report" id="4"> + <property name="fontFamily">"Verdana"</property> + <property name="fontSize">10pt</property> + </style> + <style name="crosstab-cell" id="5"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + <style name="crosstab" id="6"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + </styles> + <page-setup> + <simple-master-page name="Simple MasterPage" id="2"> + <page-footer> + <text id="3"> + <property name="contentType">html</property> + <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property> + </text> + </page-footer> + </simple-master-page> + </page-setup> + <body> + <image id="7"> + <property name="source">url</property> + <expression name="uri">uri-expr</expression> + </image> + <image id="8"> + <property name="source">url</property> + <expression name="uri" type="constant">uri-value</expression> + </image> + </body> +</report> diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/map_test.rptdesign b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/map_test.rptdesign new file mode 100644 index 00000000000..e81db80584c --- /dev/null +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/map_test.rptdesign @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.19" id="1"> + <property name="createdBy">Eclipse BIRT Designer Version 2.5.0.v20090512-0630 Build <2.5.0.v20090512-0630></property> + <property name="units">in</property> + <property name="iconFile">/templates/blank_report.gif</property> + <property name="bidiLayoutOrientation">ltr</property> + <styles> + <style name="report" id="4"> + <property name="fontFamily">"Verdana"</property> + <property name="fontSize">10pt</property> + </style> + <style name="crosstab-cell" id="5"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + <style name="crosstab" id="6"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + </styles> + <page-setup> + <simple-master-page name="Simple MasterPage" id="2"> + <page-footer> + <text id="3"> + <property name="contentType">html</property> + <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property> + </text> + </page-footer> + </simple-master-page> + </page-setup> + <body> + <data id="7"> + <list-property name="mapRules"> + <structure> + <expression name="testExpr" type="constant">value</expression> + <property name="operator">between</property> + <simple-property-list name="value1"> + <value type="constant">value</value> + </simple-property-list> + <expression name="value2" type="constant">value</expression> + <text-property name="display" key="value-key">value</text-property> + </structure> + <structure> + <expression name="testExpr">expr</expression> + <property name="operator">between</property> + <simple-property-list name="value1"> + <value>expr</value> + </simple-property-list> + <expression name="value2">expr</expression> + <text-property name="display" key="expr-key">expr</text-property> + </structure> + <structure> + <expression name="testExpr" type="constant">value</expression> + <property name="operator">in</property> + <simple-property-list name="value1"> + <value type="constant">value</value> + <value type="constant">value</value> + <value type="constant">value</value> + </simple-property-list> + <text-property name="display" key="value-key">value</text-property> + </structure> + <structure> + <expression name="testExpr">expr</expression> + <property name="operator">in</property> + <simple-property-list name="value1"> + <value>expr</value> + <value>expr</value> + <value>expr</value> + </simple-property-list> + <text-property name="display" key="expr-key">expr</text-property> + </structure> + </list-property> + <list-property name="boundDataColumns"> + <structure> + <property name="name">value</property> + <expression name="expression">a</expression> + <property name="dataType">string</property> + </structure> + </list-property> + <property name="resultSetColumn">value</property> + </data> + </body> +</report> diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/report_item_test.rptdesign b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/report_item_test.rptdesign new file mode 100644 index 00000000000..a359b46b843 --- /dev/null +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/report_item_test.rptdesign @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.19" id="1"> + <property name="createdBy">Eclipse BIRT Designer Version 2.5.0.v20090512-0630 Build <2.5.0.v20090512-0630></property> + <property name="units">in</property> + <property name="iconFile">/templates/blank_report.gif</property> + <property name="bidiLayoutOrientation">ltr</property> + <styles> + <style name="report" id="4"> + <property name="fontFamily">"Verdana"</property> + <property name="fontSize">10pt</property> + </style> + <style name="crosstab-cell" id="5"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + <style name="crosstab" id="6"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + </styles> + <page-setup> + <simple-master-page name="Simple MasterPage" id="2"> + <page-footer> + <text id="3"> + <property name="contentType">html</property> + <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property> + </text> + </page-footer> + </simple-master-page> + </page-setup> + <body> + <label name="name" id="7"> + <property name="eventHandlerClass">javaEventHandle</property> + <property name="x">1in</property> + <property name="y">1in</property> + <property name="height">1in</property> + <property name="width">1in</property> + <method name="onCreate"><![CDATA[onCreate]]></method> + <method name="onRender"><![CDATA[onRender]]></method> + <method name="onPageBreak"><![CDATA[onPageBreak]]></method> + <text-property name="text">LABEL</text-property> + </label> + </body> +</report> diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/text_test.rptdesign b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/text_test.rptdesign new file mode 100644 index 00000000000..ad264f69ff3 --- /dev/null +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/text_test.rptdesign @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.20" id="1"> + <property name="createdBy">Eclipse BIRT Designer Version 2.5.0.v20090531a Build <2.5.0.v20090601-0630></property> + <property name="units">in</property> + <property name="iconFile">/templates/blank_report.gif</property> + <property name="bidiLayoutOrientation">ltr</property> + <styles> + <style name="report" id="4"> + <property name="fontFamily">"Verdana"</property> + <property name="fontSize">10pt</property> + </style> + <style name="crosstab-cell" id="5"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + <style name="crosstab" id="6"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + </styles> + <page-setup> + <simple-master-page name="Simple MasterPage" id="2"> + <page-footer> + <text id="3"> + <property name="contentType">html</property> + <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property> + </text> + </page-footer> + </simple-master-page> + </page-setup> + <body> + <text id="7"> + <property name="contentType">html</property> + <text-property name="content"><![CDATA[HTML]]></text-property> + </text> + <text-data id="8"> + <expression name="valueExpr">test</expression> + <property name="contentType">html</property> + </text-data> + <label id="9"/> + </body> +</report> diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/toc_test.rptdesign b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/toc_test.rptdesign new file mode 100644 index 00000000000..8004bac9482 --- /dev/null +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/toc_test.rptdesign @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.19" id="1"> + <property name="createdBy">Eclipse BIRT Designer Version 2.5.0.v20090512-0630 Build <2.5.0.v20090512-0630></property> + <property name="units">in</property> + <property name="iconFile">/templates/blank_report.gif</property> + <property name="bidiLayoutOrientation">ltr</property> + <styles> + <style name="report" id="4"> + <property name="fontFamily">"Verdana"</property> + <property name="fontSize">10pt</property> + </style> + <style name="crosstab-cell" id="5"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + <style name="crosstab" id="6"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + </styles> + <page-setup> + <simple-master-page name="Simple MasterPage" id="2"> + <page-footer> + <text id="3"> + <property name="contentType">html</property> + <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property> + </text> + </page-footer> + </simple-master-page> + </page-setup> + <body> + <label id="8"> + <structure name="toc"> + <expression name="expressionValue">toc-expr</expression> + </structure> + <text-property name="text">expr toc</text-property> + </label> + <label id="9"> + <structure name="toc"> + <expression name="expressionValue" type="constant">toc-value</expression> + </structure> + <text-property name="text">const toc</text-property> + </label> + </body> +</report> diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/user_property_test.rptdesign b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/user_property_test.rptdesign new file mode 100644 index 00000000000..053e0ca5be1 --- /dev/null +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/user_property_test.rptdesign @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> +<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.20" id="1"> + <property name="createdBy">Eclipse BIRT Designer Version 2.5.0.v20090529-1200 Build <2.5.0.v20090529-1200></property> + <property name="units">in</property> + <list-property name="userProperties"> + <structure> + <property name="name">report_expr</property> + <property name="type">expression</property> + <property name="isVisible">true</property> + <property name="default">report_expr</property> + </structure> + </list-property> + <property name="iconFile">/templates/blank_report.gif</property> + <property name="layoutPreference">auto layout</property> + <property name="bidiLayoutOrientation">ltr</property> + <styles> + <style name="report" id="4"> + <property name="fontFamily">"Verdana"</property> + <property name="fontSize">10pt</property> + </style> + <style name="crosstab-cell" id="5"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + <style name="crosstab" id="6"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + </styles> + <page-setup> + <simple-master-page name="Simple MasterPage" id="2"> + <page-footer> + <text id="3"> + <property name="contentType">html</property> + <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property> + </text> + </page-footer> + </simple-master-page> + </page-setup> + <body> + <label id="7"> + <list-property name="userProperties"> + <structure> + <property name="name">name_expr</property> + <property name="type">expression</property> + <property name="isVisible">true</property> + <property name="default">name_expression</property> + </structure> + <structure> + <property name="name">name_value</property> + <property name="type">expression</property> + <property name="isVisible">true</property> + <property name="default">name_value</property> + </structure> + <structure> + <property name="name">name_string</property> + <property name="type">string</property> + <property name="isVisible">true</property> + </structure> + <structure> + <property name="name">name_integer</property> + <property name="type">integer</property> + <property name="isVisible">true</property> + </structure> + <structure> + <property name="name">name_boolean</property> + <property name="type">boolean</property> + <property name="isVisible">true</property> + </structure> + <structure> + <property name="name">name_datetime</property> + <property name="type">dateTime</property> + <property name="isVisible">true</property> + </structure> + <structure> + <property name="name">name_float</property> + <property name="type">float</property> + <property name="isVisible">true</property> + </structure> + </list-property> + <text-property name="text">Label</text-property> + <property name="name_string">string</property> + <property name="name_integer">1</property> + <property name="name_boolean">true</property> + <property name="name_datetime">2009-06-03 00:00:00</property> + <property name="name_float">1.0</property> + </label> + </body> +</report> diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/visibility_test.rptdesign b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/visibility_test.rptdesign new file mode 100644 index 00000000000..3c545970424 --- /dev/null +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/visibility_test.rptdesign @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.19" id="1"> + <property name="createdBy">Eclipse BIRT Designer Version 2.5.0.v20090512-0630 Build <2.5.0.v20090512-0630></property> + <property name="units">in</property> + <property name="iconFile">/templates/blank_report.gif</property> + <property name="bidiLayoutOrientation">ltr</property> + <styles> + <style name="report" id="4"> + <property name="fontFamily">"Verdana"</property> + <property name="fontSize">10pt</property> + </style> + <style name="crosstab-cell" id="5"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + <style name="crosstab" id="6"> + <property name="borderBottomColor">#CCCCCC</property> + <property name="borderBottomStyle">solid</property> + <property name="borderBottomWidth">1pt</property> + <property name="borderLeftColor">#CCCCCC</property> + <property name="borderLeftStyle">solid</property> + <property name="borderLeftWidth">1pt</property> + <property name="borderRightColor">#CCCCCC</property> + <property name="borderRightStyle">solid</property> + <property name="borderRightWidth">1pt</property> + <property name="borderTopColor">#CCCCCC</property> + <property name="borderTopStyle">solid</property> + <property name="borderTopWidth">1pt</property> + </style> + </styles> + <page-setup> + <simple-master-page name="Simple MasterPage" id="2"> + <page-footer> + <text id="3"> + <property name="contentType">html</property> + <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property> + </text> + </page-footer> + </simple-master-page> + </page-setup> + <body> + + <label id="9"> + <list-property name="visibility"> + <structure> + <property name="format">all</property> + <expression name="valueExpr">true</expression> + </structure> + </list-property> + <text-property name="text">hide for expression all</text-property> + </label> + <label id="10"> + <list-property name="visibility"> + <structure> + <property name="format">all</property> + <expression name="valueExpr" type="constant">true</expression> + </structure> + </list-property> + <text-property name="text">hide for expression all</text-property> + </label> + </body> +</report> diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/parser/action_test.rptdesign b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/parser/action_test.rptdesign index d9cb1b15d75..0ba9e89ec7f 100644 --- a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/parser/action_test.rptdesign +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/parser/action_test.rptdesign @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="UTF-8"?> <report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.20" id="1"> <property name="createdBy">Eclipse BIRT Designer Version 2.5.0.v20090531a Build <2.5.0.v20090601-0630></property> <property name="units">in</property> From 16cb51a57d67e197b58c02b2daa1284f20494214 Mon Sep 17 00:00:00 2001 From: Thomas Gutmann <gutmann-thomas@web.de> Date: Sun, 19 Mar 2023 23:15:46 +0100 Subject: [PATCH 12/12] Resolve issue of engine test case if report not reachable --- .../birt/report/engine/ir/EngineIRIOTest.java | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/EngineIRIOTest.java b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/EngineIRIOTest.java index 9c74e8249d9..24862c408b3 100644 --- a/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/EngineIRIOTest.java +++ b/engine/org.eclipse.birt.report.engine.tests/test/org/eclipse/birt/report/engine/ir/EngineIRIOTest.java @@ -44,31 +44,33 @@ public void doTestIO(String designName, int i) throws Exception { // load the report design Class<?> clz = i == 0 ? this.getClass() : org.eclipse.birt.report.engine.parser.EngineIRParserTest.class; InputStream input = clz.getResourceAsStream(designName); - Report report = new ReportParser().parse(".", input); - assertTrue("EngineIRIOTest, doTestIO(report exists) - designName: " + designName, report != null); + if (input != null) { + Report report = new ReportParser().parse(".", input); + assertTrue("EngineIRIOTest, doTestIO(report exists) - designName: " + designName, report != null); - // write it into the stream - ByteArrayOutputStream out = new ByteArrayOutputStream(); - new EngineIRWriter().write(out, report); - out.close(); + // write it into the stream + ByteArrayOutputStream out = new ByteArrayOutputStream(); + new EngineIRWriter().write(out, report); + out.close(); - // load it from the stream - InputStream in = new ByteArrayInputStream(out.toByteArray()); - EngineIRReader reader = new EngineIRReader(); - Report report2 = reader.read(in); - reader.link(report2, report.getReportDesign()); - // check if the report 2 equals the report 1 - ByteArrayOutputStream out1 = new ByteArrayOutputStream(); - ByteArrayOutputStream out2 = new ByteArrayOutputStream(); + // load it from the stream + InputStream in = new ByteArrayInputStream(out.toByteArray()); + EngineIRReader reader = new EngineIRReader(); + Report report2 = reader.read(in); + reader.link(report2, report.getReportDesign()); + // check if the report 2 equals the report 1 + ByteArrayOutputStream out1 = new ByteArrayOutputStream(); + ByteArrayOutputStream out2 = new ByteArrayOutputStream(); - ReportDesignWriter writer = new ReportDesignWriter(); + ReportDesignWriter writer = new ReportDesignWriter(); - writer.write(out1, report); - writer.write(out2, report2); + writer.write(out1, report); + writer.write(out2, report2); - String golden = new String(out1.toByteArray()); - String value = new String(out2.toByteArray()); - assertEquals("EngineIRIOTest, doTestIO(compare: golden, value) - designName: " + designName, golden, value); + String golden = new String(out1.toByteArray()); + String value = new String(out2.toByteArray()); + assertEquals("EngineIRIOTest, doTestIO(compare: golden, value) - designName: " + designName, golden, value); + } } }