cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject cvs commit: cocoon-2.1 status.xml
Date Sun, 04 Jul 2004 20:57:03 GMT
antonio     2004/07/04 13:57:03

  Modified:    src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements
                        EP_Right.java EP_Grid.java Sheet.java
                        EP_Footer.java EP_HCenter.java EP_Orientation.java
                        EP_Top.java EPFooter.java EP_Monochrome.java
                        EP_VCenter.java EP_Header.java EPHeader.java
                        EP_Paper.java EP_Draft.java EP_Bottom.java
                        EP_Left.java
               .        status.xml
  Log:
  POI: Adding support for <gmr:PrintInformation>
  
  Revision  Changes    Path
  1.6       +11 -7     cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Right.java
  
  Index: EP_Right.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Right.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EP_Right.java	5 Mar 2004 13:02:04 -0000	1.5
  +++ EP_Right.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -26,8 +26,6 @@
    *
    * This element has two attributes: Points and PrefUnit
    *
  - * This element is not used in HSSFSerializer 1.0
  - *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
    * @version CVS $Id$
    */
  @@ -54,8 +52,7 @@
   
       double getPoints() throws IOException {
           if (_points == null) {
  -            _points =
  -                NumericConverter.extractDouble(getValue(_points_attribute));
  +            _points = NumericConverter.extractDouble(getValue(_points_attribute));
           }
           return _points.doubleValue();
       }
  @@ -68,9 +65,16 @@
   
       int getPrefUnit() throws IOException {
           if (_pref_unit == null) {
  -            _pref_unit =
  -                PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
  +            _pref_unit = PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
           }
           return _pref_unit.intValue();
  +    }
  +    
  +    /**
  +     * Setup the right margin
  +     * @exception IOException
  +     */
  +    public void endProcessing() throws IOException{
  +        this.getSheet().setRightMargin(getPoints());
       }
   }   // end public class EP_Right
  
  
  
  1.6       +19 -13    cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Grid.java
  
  Index: EP_Grid.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Grid.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EP_Grid.java	5 Mar 2004 13:02:04 -0000	1.5
  +++ EP_Grid.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -1,12 +1,12 @@
   /*
    * Copyright 1999-2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed 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.
  @@ -26,22 +26,21 @@
    *
    * This element has a single attribute, value, which is boolean.
    *
  - * This element is not used in HSSFSerializer 1.0
    *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
  + * @author Victor Skladovs (skladov@his.de)
    * @version CVS $Id$
    */
   public class EP_Grid extends BaseElementProcessor {
       private static final String _value_attribute = "value";
  -    private BooleanResult       _value;
  +    private BooleanResult showGrid;
   
       /**
        * constructor
        */
  -
       public EP_Grid() {
           super(null);
  -        _value = null;
  +        showGrid = null;
       }
   
       /**
  @@ -49,12 +48,19 @@
        *
        * @exception IOException if the value is malformed or missing
        */
  -
       public boolean getValue() throws IOException {
  -        if (_value == null) {
  -            _value =
  -                BooleanConverter.extractBoolean(getValue(_value_attribute));
  +        if (showGrid == null) {
  +            showGrid = BooleanConverter.extractBoolean(this.getValue(_value_attribute));
           }
  -        return _value.booleanValue();
  +        return showGrid.booleanValue();
       }
  +
  +    /**
  +     * set whether or not the grid is printed for the worksheet
  +     * @exception IOException
  +     */
  +    public void endProcessing() throws IOException{
  +        this.getSheet().setPrintGridLines(this.getValue());
  +    }
  +
   }   // end public class EP_Grid
  
  
  
  1.9       +140 -22   cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Sheet.java
  
  Index: Sheet.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Sheet.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Sheet.java	5 Mar 2004 13:02:04 -0000	1.8
  +++ Sheet.java	4 Jul 2004 20:57:02 -0000	1.9
  @@ -1,12 +1,12 @@
   /*
    * Copyright 1999-2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed 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.
  @@ -26,6 +26,8 @@
   import org.apache.poi.hssf.usermodel.HSSFCell;
   import org.apache.poi.hssf.usermodel.HSSFCellStyle;
   import org.apache.poi.hssf.usermodel.HSSFFont;
  +import org.apache.poi.hssf.usermodel.HSSFFooter;
  +import org.apache.poi.hssf.usermodel.HSSFHeader;
   import org.apache.poi.hssf.usermodel.HSSFRow;
   import org.apache.poi.hssf.usermodel.HSSFSheet;
   import org.apache.poi.hssf.util.HSSFColor;
  @@ -186,11 +188,6 @@
   
       HSSFCellStyle addStyleRegion(Region region) {
           HSSFCellStyle style = _workbook.createStyle();
  -        /*
  -         * getLogger().debug("region = "+ region.getRowFrom() +
  -         * ","+region.getColumnFrom()+
  -         * ","+region.getRowTo()+","+region.getColumnTo());
  -         */
           regions.put(region, style);
           return style;
       }
  @@ -205,14 +202,10 @@
           Iterator iregions = regions.keySet().iterator();
           while (iregions.hasNext()) {
               Region region = ((Region)iregions.next());
  -            //            if (col == 1)
  -            //                getLogger().debug("breakpoint support");
               if (region.contains(row, col)) {
  -                //getLogger().debug("Returning style for " + row +"," + col);
                   return (HSSFCellStyle)regions.get(region);
               }
           }
  -        //getLogger().debug("returning null for "+row+","+col);
           return null;
       }
   
  @@ -254,18 +247,13 @@
           Iterator iregions = regions.keySet().iterator();
           while (iregions.hasNext()) {
               Region region = ((Region)iregions.next());
  -            //getLogger().debug("fixing region
  -            // "+region.getRowFrom()+","+region.getColumnFrom()+"-"+
  -            //          region.getRowTo()+","+region.getColumnTo());
  -            for (int rownum = region.getRowFrom();
  -                        rownum < region.getRowTo() + 1; rownum++) {
  +            for (int rownum = region.getRowFrom(); rownum < region.getRowTo() + 1; rownum++)
{
                   HSSFRow row = _sheet.getRow(rownum);
                   for (short colnum = region.getColumnFrom();
                               colnum < region.getColumnTo() + 1; colnum++) {
                       HSSFCellStyle style = (HSSFCellStyle)regions.get(region);
                       if (!isBlank(style)) {
  -                        //don't waste time with huge blocks of blankly styled
  -                        // cells
  +                        //don't waste time with huge blocks of blankly styled cells
                           if (row == null) {
                               if (rownum > Short.MAX_VALUE) {
                                   rownum = Short.MAX_VALUE;
  @@ -274,8 +262,6 @@
                           }
                           HSSFCell cell = row.getCell(colnum);
                           if (cell == null) {
  -                            //getLogger().debug("creating blank cell at
  -                            // "+rownum + "," +colnum);
                               cell = row.createCell(colnum);
                               cell.setCellType(HSSFCell.CELL_TYPE_BLANK);
                               cell.setCellStyle(
  @@ -303,6 +289,138 @@
               return true;
           }
           return false;
  +    }
  +
  +    /**
  +     * Set the paper size.
  +     * @param paperSize the paper size.
  +     */
  +
  +    void setPaperSize(short paperSize) {
  +        _sheet.getPrintSetup().setPaperSize(paperSize);
  +    }
  +
  +    /**
  +     * Set whether to print in landscape
  +     * @param ls landscape
  +     */
  +
  +    void setOrientation(boolean ls) {
  +        _sheet.getPrintSetup().setLandscape(ls);
  +    }
  +
  +    /**
  +     * Set whether or not the grid is printed for the worksheet
  +     * @param gridLines boolean to turn on or off the printing of
  +     * gridlines
  +     */
  +
  +    void setPrintGridLines(boolean gridLines) {
  +        _sheet.setPrintGridlines(gridLines);
  +    }
  +    
  +    /**
  +     * Set whether or not the worksheet content is centered (horizontally)
  +     * on the page when it is printed
  +     * @param ls landscape
  +     */
  +    void setHCenter(boolean hCenter) {
  +        _sheet.setHorizontallyCenter(hCenter);
  +    }
  +
  +    /**
  +     * Setwhether or not the worksheet content is centered (vertically)
  +     * on the page when it is printed
  +     * @param ls landscape
  +     */
  +    void setVCenter(boolean vCenter) {
  +        _sheet.setVerticallyCenter(vCenter);
  +    }
  +    
  +    /**
  +     * Setup whether or not printing is in monochrome (no color)
  +     * @param ls landscape
  +     */
  +    void setMonochrome(boolean noColor) {
  +        _sheet.getPrintSetup().setNoColor(noColor);
  +    }
  +    
  +    /**
  +     * Setup whether or not the worksheet is printed in draft format
  +     * @param draftMode
  +     */
  +    void setDraft(boolean draftMode) {
  +        _sheet.getPrintSetup().setDraft(draftMode);
  +    }
  +    
  +    /**
  +     * Set text to be printed at the top of every page
  +     * @param ls landscape
  +     */
  +    void setHeader(String left, String middle, String right) {
  +        HSSFHeader header = _sheet.getHeader();
  +        header.setLeft(left);
  +        header.setCenter(middle);
  +        header.setRight(right);
  +    }
  +    
  +    /**
  +     * Set text to be printed at the bottom of every page
  +     * @param ls landscape
  +     */
  +    void setFooter(String left, String middle, String right) {
  +        HSSFFooter footer = _sheet.getFooter();
  +        footer.setLeft(left);
  +        footer.setCenter(middle);
  +        footer.setRight(right);
  +    }
  +    
  +    /**
  +     * Set the top margin of the page
  +     * @param ls landscape
  +     */
  +    void setTopMargin(double points) {
  +        _sheet.setMargin(HSSFSheet.TopMargin, points);
  +    }
  +    
  +    /**
  +     * Set the left margin of the page
  +     * @param ls landscape
  +     */
  +    void setLeftMargin(double points) {
  +        _sheet.setMargin(HSSFSheet.LeftMargin, points);
  +    }
  +    
  +    /**
  +     * Set the right margin of the page
  +     * @param ls landscape
  +     */
  +    void setRightMargin(double points) {
  +        _sheet.setMargin(HSSFSheet.RightMargin, points);
  +    }
  +    
  +    /**
  +     * Set the bottom margin of the page
  +     * @param ls landscape
  +     */
  +    void setBottomMargin(double points) {
  +        _sheet.setMargin(HSSFSheet.BottomMargin, points);
  +    }
  +    
  +    /**
  +     * Set the header margin of the page
  +     * @param ls landscape
  +     */
  +    void setHeaderMargin(double points) {
  +        _sheet.getPrintSetup().setHeaderMargin(points);
  +    }
  +    
  +    /**
  +     * Set the header margin of the page
  +     * @param ls landscape
  +     */
  +    void setFooterMargin(double points) {
  +        _sheet.getPrintSetup().setFooterMargin(points);
       }
   
   } // end package scope class Sheet
  
  
  
  1.6       +11 -7     cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Footer.java
  
  Index: EP_Footer.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Footer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EP_Footer.java	5 Mar 2004 13:02:04 -0000	1.5
  +++ EP_Footer.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -26,8 +26,6 @@
    *
    * This element has two attributes: Points and PrefUnit
    *
  - * This element is not used in HSSFSerializer 1.0
  - *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
    * @version CVS $Id$
    */
  @@ -55,8 +53,7 @@
   
       double getPoints() throws IOException {
           if (_points == null) {
  -            _points =
  -                NumericConverter.extractDouble(getValue(_points_attribute));
  +            _points = NumericConverter.extractDouble(getValue(_points_attribute));
           }
           return _points.doubleValue();
       }
  @@ -69,9 +66,16 @@
   
       int getPrefUnit() throws IOException {
           if (_pref_unit == null) {
  -            _pref_unit =
  -                PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
  +            _pref_unit = PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
           }
           return _pref_unit.intValue();
  +    }
  +    
  +    /**
  +     * Setup the footer margin
  +     * @exception IOException
  +     */
  +    public void endProcessing() throws IOException{
  +        this.getSheet().setFooterMargin(getPoints());
       }
   }   // end public class EP_Footer
  
  
  
  1.6       +12 -6     cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_HCenter.java
  
  Index: EP_HCenter.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_HCenter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EP_HCenter.java	5 Mar 2004 13:02:04 -0000	1.5
  +++ EP_HCenter.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -27,8 +27,6 @@
    *
    * This element has a single attribute, value, which is boolean.
    *
  - * This element is not used in HSSFSerializer 1.0
  - *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
    * @version CVS $Id$
    */
  @@ -50,12 +48,20 @@
        *
        * @exception IOException if the value is malformed or missing
        */
  -
       public boolean getValue() throws IOException {
           if (_value == null) {
  -            _value =
  -                BooleanConverter.extractBoolean(getValue(_value_attribute));
  +            _value = BooleanConverter.extractBoolean(this.getValue(_value_attribute));
           }
           return _value.booleanValue();
       }
  +    
  +    /**
  +     * Setup whether or not the worksheet content is centered (horizontally)
  +     * on the page when it is printed
  +     * @exception IOException
  +     */
  +    public void endProcessing() throws IOException{
  +        this.getSheet().setHCenter(this.getValue());
  +    }
  +
   }   // end public class EP_HCenter
  
  
  
  1.6       +15 -6     cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Orientation.java
  
  Index: EP_Orientation.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Orientation.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EP_Orientation.java	5 Mar 2004 13:02:04 -0000	1.5
  +++ EP_Orientation.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -1,12 +1,12 @@
   /*
    * Copyright 1999-2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed 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.
  @@ -27,9 +27,9 @@
    * This element has no attributes and contains a string describing the
    * print orientation (landscape or portrait)
    *
  - * This element is not used in HSSFSerializer 1.0
    *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
  + * @author Victor Skladovs (skladov@his.de)
    * @version CVS $Id$
    */
   public class EP_Orientation extends BaseElementProcessor {
  @@ -52,8 +52,17 @@
       int getPrintOrientation() throws IOException {
           if (_print_orientation == null) {
               _print_orientation =
  -                PrintOrientation.extractPrintOrientation(getData());
  +                PrintOrientation.extractPrintOrientation(this.getData());
           }
           return _print_orientation.intValue();
       }
  +
  +     /**
  +     * Setup the orientation:
  +     * @exception IOException
  +     */
  +    public void endProcessing() throws IOException{
  +        this.getSheet().setOrientation(getPrintOrientation() == 1 ? false : true);
  +    }
  +
   }   // end public class EP_Orientation
  
  
  
  1.6       +11 -7     cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Top.java
  
  Index: EP_Top.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Top.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EP_Top.java	5 Mar 2004 13:02:04 -0000	1.5
  +++ EP_Top.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -26,8 +26,6 @@
    *
    * This element has two attributes: Points and PrefUnit
    *
  - * This element is not used in HSSFSerializer 1.0
  - *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
    * @version CVS $Id$
    */
  @@ -53,8 +51,7 @@
        */
       double getPoints() throws IOException {
           if (_points == null) {
  -            _points =
  -                NumericConverter.extractDouble(getValue(_points_attribute));
  +            _points = NumericConverter.extractDouble(getValue(_points_attribute));
           }
           return _points.doubleValue();
       }
  @@ -67,9 +64,16 @@
   
       int getPrefUnit() throws IOException {
           if (_pref_unit == null) {
  -            _pref_unit =
  -                PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
  +            _pref_unit = PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
           }
           return _pref_unit.intValue();
  +    }
  +
  +    /**
  +     * Setup the top margin
  +     * @exception IOException
  +     */
  +    public void endProcessing() throws IOException{
  +        this.getSheet().setTopMargin(getPoints());
       }
   }   // end public class EP_Top
  
  
  
  1.6       +11 -3     cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPFooter.java
  
  Index: EPFooter.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPFooter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EPFooter.java	5 Mar 2004 13:02:03 -0000	1.5
  +++ EPFooter.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -16,14 +16,14 @@
   
   package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements;
   
  +import java.io.IOException;
  +
   /**
    * No-op implementation of ElementProcessor to handle the "Footer" tag
    *
    * This element has three attributes: Left, Middle, and Top, and no
    * contents.
    *
  - * This element is not used in HSSFSerializer 1.0
  - *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
    * @version CVS $Id$
    */
  @@ -82,5 +82,13 @@
               }
           }
           return _right;
  +    }
  +    
  +    /**
  +     * Setup the text to be printed at the bottom of every page
  +     * @exception IOException
  +     */
  +    public void endProcessing() throws IOException{
  +        this.getSheet().setFooter(getLeft(), getMiddle(), getRight());
       }
   } // end public class EPFooter
  
  
  
  1.6       +10 -7     cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Monochrome.java
  
  Index: EP_Monochrome.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Monochrome.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EP_Monochrome.java	5 Mar 2004 13:02:04 -0000	1.5
  +++ EP_Monochrome.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -27,8 +27,6 @@
    *
    * This element has a single attribute, value, which is boolean.
    *
  - * This element is not used in HSSFSerializer 1.0
  - *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
    * @version CVS $Id$
    */
  @@ -39,7 +37,6 @@
       /**
        * constructor
        */
  -
       public EP_Monochrome() {
           super(null);
           _value = null;
  @@ -50,12 +47,18 @@
        *
        * @exception IOException if the value is malformed or missing
        */
  -
       public boolean getValue() throws IOException {
           if (_value == null) {
  -            _value =
  -                BooleanConverter.extractBoolean(getValue(_value_attribute));
  +            _value = BooleanConverter.extractBoolean(getValue(_value_attribute));
           }
           return _value.booleanValue();
  +    }
  +    
  +    /**
  +     * Setup whether or not printing is in monochrome:
  +     * @exception IOException
  +     */
  +    public void endProcessing() throws IOException{
  +        this.getSheet().setMonochrome(this.getValue());
       }
   }   // end public class EP_Monochrome
  
  
  
  1.6       +11 -5     cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_VCenter.java
  
  Index: EP_VCenter.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_VCenter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EP_VCenter.java	5 Mar 2004 13:02:04 -0000	1.5
  +++ EP_VCenter.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -27,8 +27,6 @@
    *
    * This element has a single attribute, value, which is boolean.
    *
  - * This element is not used in HSSFSerializer 1.0
  - *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
    * @version CVS $Id$
    */
  @@ -51,9 +49,17 @@
        */
       public boolean getValue() throws IOException {
           if (_value == null) {
  -            _value =
  -                BooleanConverter.extractBoolean(getValue(_value_attribute));
  +            _value = BooleanConverter.extractBoolean(this.getValue(_value_attribute));
           }
           return _value.booleanValue();
  +    }
  +    
  +    /**
  +     * Setup whether or not the worksheet content is centered (vertically)
  +     * on the page when it is printed
  +     * @exception IOException
  +     */
  +    public void endProcessing() throws IOException{
  +        this.getSheet().setVCenter(this.getValue());
       }
   }   // end public class EP_VCenter
  
  
  
  1.6       +11 -7     cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Header.java
  
  Index: EP_Header.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Header.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EP_Header.java	5 Mar 2004 13:02:04 -0000	1.5
  +++ EP_Header.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -26,8 +26,6 @@
    *
    * This element has two attributes: Points and PrefUnit
    *
  - * This element is not used in HSSFSerializer 1.0
  - *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
    * @version CVS $Id$
    */
  @@ -55,8 +53,7 @@
   
       double getPoints() throws IOException {
           if (_points == null) {
  -            _points =
  -                NumericConverter.extractDouble(getValue(_points_attribute));
  +            _points = NumericConverter.extractDouble(getValue(_points_attribute));
           }
           return _points.doubleValue();
       }
  @@ -69,9 +66,16 @@
   
       int getPrefUnit() throws IOException {
           if (_pref_unit == null) {
  -            _pref_unit =
  -                PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
  +            _pref_unit = PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
           }
           return _pref_unit.intValue();
  +    }
  +    
  +    /**
  +     * Setup the header margin
  +     * @exception IOException
  +     */
  +    public void endProcessing() throws IOException{
  +        this.getSheet().setHeaderMargin(getPoints());
       }
   }   // end public class EP_Header
  
  
  
  1.6       +11 -3     cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPHeader.java
  
  Index: EPHeader.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPHeader.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EPHeader.java	5 Mar 2004 13:02:04 -0000	1.5
  +++ EPHeader.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -16,14 +16,14 @@
   
   package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements;
   
  +import java.io.IOException;
  +
   /**
    * No-op implementation of ElementProcessor to handle the "Header" tag
    *
    * This element has three attributes: Left, Middle, and Top, and no
    * contents.
    *
  - * This element is not used in HSSFSerializer 1.0
  - *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
    * @version CVS $Id$
    */
  @@ -82,5 +82,13 @@
               }
           }
           return _right;
  +    }
  +    
  +    /**
  +     * Setup the text to be printed at the top of every page
  +     * @exception IOException
  +     */
  +    public void endProcessing() throws IOException{
  +        this.getSheet().setHeader(getLeft(), getMiddle(), getRight());
       }
   } // end public class EPHeader
  
  
  
  1.6       +44 -5     cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Paper.java
  
  Index: EP_Paper.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Paper.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EP_Paper.java	5 Mar 2004 13:02:04 -0000	1.5
  +++ EP_Paper.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -1,12 +1,12 @@
   /*
    * Copyright 1999-2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed 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.
  @@ -16,23 +16,62 @@
   
   package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements;
   
  +import org.apache.commons.lang.StringUtils;
  +import org.apache.poi.hssf.usermodel.HSSFPrintSetup;
  +
  +import java.io.IOException;
  +
   /**
    * No-op implementation of ElementProcessor to handle the "paper" tag
    *
    * This element contains no other elements and has no attributes. Its
    * content describes the paper to be used (e.g., A4)
    *
  - * This element is not used in HSSFSerializer 1.0
    *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
  + * @author Victor Skladov (skladov@his.de)
    * @version CVS $Id$
    */
   public class EP_Paper extends BaseElementProcessor {
   
  +    private String _paper;
  +
       /**
        * constructor
        */
       public EP_Paper() {
           super(null);
       }
  +
  +    public String getPaper(){
  +        if (_paper == null) {
  +            _paper = StringUtils.strip(this.getData());
  +        }
  +        return this._paper;
  +    }
  +
  +    /**
  +     * Setup the paper size (Letter, Legal, Executive, A4, A5, A6, ).
  +     * Default Letter
  +     * @exception IOException
  +     */
  +
  +    public void endProcessing() throws IOException{
  +        _paper = getPaper();
  +        Sheet sheet = this.getSheet();
  +        short paperSize = HSSFPrintSetup.LETTER_PAPERSIZE;
  +        if (StringUtils.isNotEmpty(_paper)) {
  +            if ("A4".equalsIgnoreCase(_paper)) {
  +                paperSize = HSSFPrintSetup.A4_PAPERSIZE;
  +            } else if ("A5".equalsIgnoreCase(_paper)) {
  +                paperSize = HSSFPrintSetup.A5_PAPERSIZE;
  +            } else if ("Legal".equalsIgnoreCase(_paper)) {
  +                paperSize = HSSFPrintSetup.LEGAL_PAPERSIZE;
  +            } else if ("Executive".equalsIgnoreCase(_paper)) {
  +                paperSize = HSSFPrintSetup.EXECUTIVE_PAPERSIZE;
  +            }
  +        }
  +        sheet.setPaperSize(paperSize);
  +    }
  +
   }   // end public class EP_Paper
  
  
  
  1.6       +10 -7     cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Draft.java
  
  Index: EP_Draft.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Draft.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EP_Draft.java	5 Mar 2004 13:02:04 -0000	1.5
  +++ EP_Draft.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -28,8 +28,6 @@
    *
    * This element has a single attribute, value, which is boolean.
    *
  - * This element is not used in HSSFSerializer 1.0
  - *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
    * @version CVS $Id$
    */
  @@ -40,7 +38,6 @@
       /**
        * constructor
        */
  -
       public EP_Draft() {
           super(null);
           _value = null;
  @@ -51,12 +48,18 @@
        *
        * @exception IOException if the value is malformed or missing
        */
  -
       public boolean getValue() throws IOException {
           if (_value == null) {
  -            _value =
  -                BooleanConverter.extractBoolean(getValue(_value_attribute));
  +            _value = BooleanConverter.extractBoolean(getValue(_value_attribute));
           }
           return _value.booleanValue();
  +    }
  +
  +    /**
  +     * Setup whether or not the worksheet is printed in draft format
  +     * @exception IOException
  +     */
  +    public void endProcessing() throws IOException{
  +        this.getSheet().setDraft(this.getValue());
       }
   }   // end public class EP_Draft
  
  
  
  1.6       +11 -7     cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Bottom.java
  
  Index: EP_Bottom.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Bottom.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EP_Bottom.java	5 Mar 2004 13:02:04 -0000	1.5
  +++ EP_Bottom.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -28,8 +28,6 @@
    *
    * This element has two attributes: Points and PrefUnit
    *
  - * This element is not used in HSSFSerializer 1.0
  - *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
    * @version CVS $Id$
    */
  @@ -57,8 +55,7 @@
   
       double getPoints() throws IOException {
           if (_points == null) {
  -            _points =
  -                NumericConverter.extractDouble(getValue(_points_attribute));
  +            _points = NumericConverter.extractDouble(getValue(_points_attribute));
           }
           return _points.doubleValue();
       }
  @@ -71,9 +68,16 @@
   
       int getPrefUnit() throws IOException {
           if (_pref_unit == null) {
  -            _pref_unit =
  -                PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
  +            _pref_unit = PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
           }
           return _pref_unit.intValue();
  +    }
  +    
  +    /**
  +     * Setup the bottom margin
  +     * @exception IOException
  +     */
  +    public void endProcessing() throws IOException{
  +        this.getSheet().setBottomMargin(getPoints());
       }
   }   // end public class EP_Bottom
  
  
  
  1.6       +11 -7     cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Left.java
  
  Index: EP_Left.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Left.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EP_Left.java	5 Mar 2004 13:02:04 -0000	1.5
  +++ EP_Left.java	4 Jul 2004 20:57:02 -0000	1.6
  @@ -26,8 +26,6 @@
    *
    * This element has two attributes: Points and PrefUnit
    *
  - * This element is not used in HSSFSerializer 1.0
  - *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
    * @version CVS $Id$
    */
  @@ -55,8 +53,7 @@
   
       double getPoints() throws IOException {
           if (_points == null) {
  -            _points =
  -                NumericConverter.extractDouble(getValue(_points_attribute));
  +            _points = NumericConverter.extractDouble(getValue(_points_attribute));
           }
           return _points.doubleValue();
       }
  @@ -69,9 +66,16 @@
   
       int getPrefUnit() throws IOException {
           if (_pref_unit == null) {
  -            _pref_unit =
  -                PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
  +            _pref_unit = PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
           }
           return _pref_unit.intValue();
  +    }
  +
  +    /**
  +     * Setup the left margin
  +     * @exception IOException
  +     */
  +    public void endProcessing() throws IOException{
  +        this.getSheet().setLeftMargin(getPoints());
       }
   }   // end public class EP_Left
  
  
  
  1.384     +8 -1      cocoon-2.1/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/status.xml,v
  retrieving revision 1.383
  retrieving revision 1.384
  diff -u -r1.383 -r1.384
  --- status.xml	4 Jul 2004 15:22:00 -0000	1.383
  +++ status.xml	4 Jul 2004 20:57:02 -0000	1.384
  @@ -204,6 +204,13 @@
   
     <changes>
    <release version="@version@" date="@date@">
  +   <action dev="AG" type="fix" fixes-bug="23002" due-to="Viktor Skladovs" due-to-email="skladov@his.de">
  +     POI: processing of tags "vcenter", "hcenter", "monochrome", "draft", "Header", "Footer"
in "gmr:PrintInformation".
  +     Initial support for "Margins" ("top", "bottom", "left", "right", "header", "footer").
  +   </action>
  +   <action dev="AG" type="fix" fixes-bug="23002" due-to="Viktor Skladovs" due-to-email="skladov@his.de">
  +     POI: processing of tags "grid", "orientation and "paper" in "gmr:PrintInformation".
  +   </action>
      <action dev="AG" type="fix" fixes-bug="24433">
        Fix JXTemplate generator does not handle format-number(number, '$#,##0.00').
      </action>
  
  
  

Mime
View raw message