Revision 60

View differences:

trunk/org.gvsig.app.document.layout.app/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/gui/dialogs/FConfigLayoutDialog.java
660 660

  
661 661
                    m_layout.getLayoutContext().getAttributes().setType(type);
662 662
                    m_layout.getLayoutContext().getAttributes()
663
                        .setSizeinUnits(isLand);
663
                        .resetSizeinUnits(isLand);
664 664
                    obtainArea();
665 665

  
666 666
                    double[] area = { sup, inf, izq, der };
trunk/org.gvsig.app.document.layout.app/org.gvsig.app.document.layout.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/Attributes.java
190 190
        m_NameUnit = PluginServices.getText(this, "Centimetros");
191 191
        m_Orientation = OrientationRequested.LANDSCAPE;
192 192
        m_type = MediaSizeName.ISO_A4;
193
        setSizeinUnits(isLandscape());
193
        resetSizeinUnits(isLandscape());
194 194

  
195 195
        hasmargin = false;
196 196
        attributes.add(new Copies(1));
......
213 213
                MediaPrintableArea.MM));
214 214
        }
215 215
    }
216
    
217
        
216 218

  
217 219
    /**
218 220
     * @return
......
247 249
        setResolution(resolution);
248 250
        area_tblr = _area_tplr;
249 251
    }
252
    
253
    /**
254
     * This field does not know about orientation.
255
     * It's value is the same for portrait and landscape
256
     * 
257
     * @return
258
     */
259
    public Size getPaperSize() {
260
        return m_sizePaper;
261
    }
250 262

  
251 263
    /**
252 264
     * Returns a PageFormat with the properties of printing.
......
766 778
            break;
767 779
        }
768 780
        attributes.add(m_type);
769
        setSizeinUnits(isLandscape());
781
        resetSizeinUnits(isLandscape());
770 782
    }
771 783

  
772 784
    /**
......
870 882
            break;
871 883
        }
872 884

  
873
        m_sizeinUnits =
874
            new Size(size.getAlto() / m_TypeUnit, size.getAncho() / m_TypeUnit);
885
        Size resp = new Size(
886
            size.getAlto() / m_TypeUnit, 
887
            size.getAncho() / m_TypeUnit);
875 888

  
876
        return m_sizeinUnits;
889
        return resp;
877 890
    }
878 891

  
892
    
893
    public static Size sizeForPaperType(int type) {
894
        Size size = null;
895

  
896
        switch (type) {
897
        case (PRINT):
898
            size = METRIC_A4_PAPER_SIZE;
899
            break;
900

  
901
        case (A4):
902
            size = METRIC_A4_PAPER_SIZE;
903
            break;
904

  
905
        case (A3):
906
            size = METRIC_A3_PAPER_SIZE;
907
            break;
908

  
909
        case (A2):
910
            size = METRIC_A2_PAPER_SIZE;
911
            break;
912

  
913
        case (A1):
914
            size = METRIC_A1_PAPER_SIZE;
915
            break;
916

  
917
        case (A0):
918
            size = METRIC_A0_PAPER_SIZE;
919
            break;
920

  
921
        case (CUSTOM):
922
            size = new Size(
923
                CUSTOM_PAPER_SIZE.getAlto(),
924
                CUSTOM_PAPER_SIZE.getAncho());
925
            break;
926
        }
927

  
928
        return size;
929
    }
930

  
931
    
932
    
933
    
879 934
    /**
880 935
     * Retunrs the type of units is in use.
881 936
     * 
......
916 971
     * @param b
917 972
     *            True if is horizontal.
918 973
     */
919
    public void setSizeinUnits(boolean is_landscape) {
974
    public void resetSizeinUnits(boolean is_landscape) {
920 975
        if (is_landscape) {
921 976
            m_sizeinUnits =
922 977
                new Size(m_sizePaper.getAlto() / m_TypeUnit,

Also available in: Unified diff