CVS: jfor/src/org/jfor/jfor/converter TextAttributesConverter.java,1.7,1.8 TableAttributesConverter.java,1.6,1.7
Marra Roberto <[email protected]> Wed, 17 Jul 2002 11:12:31 -0700
| Newsgroups | gmane.text.xml.jfor.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/jfor/jfor/src/org/jfor/jfor/converter In directory usw-pr-cvs1:/tmp/cvs-serv20705 Modified Files: TextAttributesConverter.java TableAttributesConverter.java Log Message: Contributions for background-color processing and space-before/space-after <[email protected]> Index: TextAttributesConverter.java =================================================================== RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/TextAttributesConverter.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TextAttributesConverter.java 12 Jul 2002 08:08:31 -0000 1.7 --- TextAttributesConverter.java 17 Jul 2002 18:12:28 -0000 1.8 *************** *** 51,55 **** * ==================================================================== * Contributor(s): ! * @author Andreas Putz [email protected] -----------------------------------------------------------------------------*/ --- 51,56 ---- * ==================================================================== * Contributor(s): ! * @author Andreas Putz [email protected] ! * Boris Poudérous [email protected] -----------------------------------------------------------------------------*/ *************** *** 62,65 **** --- 63,70 ---- // $Id$ // $Log$ + // Revision 1.8 2002/07/17 18:12:28 rmarra + // Contributions for background-color processing and + // space-before/space-after <[email protected]> + // // Revision 1.7 2002/07/12 08:08:31 bdelacretaz // License changed to jfor Apache-style license *************** *** 142,145 **** --- 147,188 ---- result.set(RtfText.ATTR_UNDERLINE); } + + + + /** + * Added by Boris POUDEROUS + */ + // background-color + final String backgroundColor = AbstractBuilder.getAttribute(attrs,null,"background-color",false); + if (backgroundColor != null) { + if (result == null) result = new RtfAttributes(); + final Integer colorNumber = FoColorConverter.getInstance().getRtfColorNumber(backgroundColor,log); + if (colorNumber != null) { + result.set(RtfText.ATTR_BACKGROUND_COLOR,colorNumber.intValue()); + } + } + + /** + * Added by Boris POUDEROUS + */ + // Space before + final String spaceBefore = AbstractBuilder.getAttribute(attrs,null,"space-before",false); + if ( (spaceBefore != null) && (spaceBefore.endsWith("pt") || spaceBefore.endsWith("mm")) ) { + if (result == null) result = new RtfAttributes(); + result.set(RtfText.SPACE_BEFORE, (int)FoUnitsConverter.getInstance().convertToTwips(spaceBefore)); + } + + /** + * Added by Boris POUDEROUS + */ + // Space after + final String spaceAfter = AbstractBuilder.getAttribute(attrs,null,"space-after",false); + if ( (spaceAfter != null) && (spaceAfter.endsWith("pt") || spaceAfter.endsWith("mm")) ) + { + if (result == null) result = new RtfAttributes(); + result.set(RtfText.SPACE_AFTER, (int)FoUnitsConverter.getInstance().convertToTwips(spaceAfter)); + } + + if (AbstractBuilder.hasAttributeValue (attrs, "text-align", "center")) Index: TableAttributesConverter.java =================================================================== RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/TableAttributesConverter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TableAttributesConverter.java 12 Jul 2002 08:08:31 -0000 1.6 --- TableAttributesConverter.java 17 Jul 2002 18:12:28 -0000 1.7 *************** *** 54,57 **** --- 54,58 ---- * Contributor(s): * @author Roberto Marra [email protected] + * Boris Poudérous [email protected] -----------------------------------------------------------------------------*/ *************** *** 63,66 **** --- 64,71 ---- // $Id$ // $Log$ + // Revision 1.7 2002/07/17 18:12:28 rmarra + // Contributions for background-color processing and + // space-before/space-after <[email protected]> + // // Revision 1.6 2002/07/12 08:08:31 bdelacretaz // License changed to jfor Apache-style license *************** *** 112,115 **** --- 117,160 ---- boolean isBorderPresent=false; //need to set a default width + + // Cell background color + /** + * Added by Boris POUDEROUS on 2002/06/25 + */ + if (AbstractBuilder.attributeIsSet(attrs,"background-color")) + { + attrValue = new String(attrs.getValue("background-color")); + attrib.set(ITableAttributes.CELL_COLOR_BACKGROUND, FoColorConverter.getInstance().getRtfColorNumber(attrValue, null).intValue()); + } + + // Cell borders : + /** + * Added by Boris POUDEROUS on 2002/06/27 + */ + if(AbstractBuilder.attributeIsSet(attrs,"border-color")){ + attrValue = new String(attrs.getValue("border-color")); + attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue)); + isBorderPresent=true; + } + if(AbstractBuilder.attributeIsSet(attrs,"border-top-color")){ + attrValue = new String(attrs.getValue("border-top-color")); + attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue)); + isBorderPresent=true; + } + if(AbstractBuilder.attributeIsSet(attrs,"border-bottom-color")){ + attrValue = new String(attrs.getValue("border-bottom-color")); + attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue)); + isBorderPresent=true; + } + if(AbstractBuilder.attributeIsSet(attrs,"border-left-color")){ + attrValue = new String(attrs.getValue("border-left-color")); + attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue)); + isBorderPresent=true; + } + if(AbstractBuilder.attributeIsSet(attrs,"border-right-color")){ + attrValue = new String(attrs.getValue("border-right-color")); + attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue)); + isBorderPresent=true; + } if(AbstractBuilder.attributeIsSet(attrs,"border-style")){ ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf