You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2008/07/09 14:58:19 UTC
svn commit: r675152 -
/xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java
Author: jeremias
Date: Wed Jul 9 05:58:18 2008
New Revision: 675152
URL: http://svn.apache.org/viewvc?rev=675152&view=rev
Log:
Don't generate commands for default values.
Modified:
xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java
Modified: xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java?rev=675152&r1=675151&r2=675152&view=diff
==============================================================================
--- xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java (original)
+++ xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java Wed Jul 9 05:58:18 2008
@@ -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 @@
*/
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 @@
//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);
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org