From c03fa1fb5ae74fb38767910e74e1a443b0c3b7e5 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Wed, 9 Jul 2008 12:58:18 +0000 Subject: [PATCH] Don't generate commands for default values. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95@675152 13f79535-47bb-0310-9956-ffa450edef68 --- .../render/rtf/BorderAttributesConverter.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java b/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java index 5d6a7f64e..10c4a9c92 100644 --- a/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java +++ b/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -42,12 +42,12 @@ public final class BorderAttributesConverter { */ private BorderAttributesConverter() { } - + /** - * Create a border control word in attributes, with border properties + * Create a border control word in attributes, with border properties * as specified in color, style and width. * @param border The CommonBorderPaddingBackground object. - * @param side The START, END, BEFORE, AFTER enum from CommonBorderPaddingBackground. + * @param side The START, END, BEFORE, AFTER enum from CommonBorderPaddingBackground. * @param attributes The attributes list to set the border control word. * @param controlWord The border control word. */ @@ -61,24 +61,26 @@ public final class BorderAttributesConverter { //division by 50 to convert millipoints to twips attrs.set(IBorderAttributes.BORDER_WIDTH, border.getBorderWidth(side, false) / 50); attributes.set(controlWord, attrs); - //Don't set BORDER_SPACE, because it makes the table look quite broken: + //Don't set BORDER_SPACE, because it makes the table look quite broken: //vertical and horizontal borders don't meet at corners. //attrs.setTwips(IBorderAttributes.BORDER_SPACE, border.getPadding(side, false, null)); //attributes.set(controlWord, attrs); } else { // Here padding specified, but corresponding border is not available - + // Padding in millipoints double paddingPt = border.getPadding(side, false, null) / 1000.0; // Padding in twips int padding = (int) Math.round(paddingPt * FoUnitsConverter.POINT_TO_TWIPS); - + // Add padding to corresponding space (space-before or space-after) // if side == START or END, do nothing - if (side == CommonBorderPaddingBackground.BEFORE) { - attributes.addIntegerValue(padding, RtfText.SPACE_BEFORE); - } else if (side == CommonBorderPaddingBackground.AFTER) { - attributes.addIntegerValue(padding, RtfText.SPACE_AFTER); + if (padding != 0) { + if (side == CommonBorderPaddingBackground.BEFORE) { + attributes.addIntegerValue(padding, RtfText.SPACE_BEFORE); + } else if (side == CommonBorderPaddingBackground.AFTER) { + attributes.addIntegerValue(padding, RtfText.SPACE_AFTER); + } } } } -- 2.39.5