⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zcommandx.java

📁 用Java写的报表.功能如下: 0.内建网络打印,网络预览功能! 1.文件操作。包括url 指定的文件。 2.全功能打印支持。包括打印预览。 3.Undo 和 redo。 4.合并单元格。 5.Cel
💻 JAVA
字号:
/*
 * Copyright 2002 EZCell , Inc. All rights reserved.
 * Version  1.0.
 * Author   W.John
 */
package ezcell;

import java.util.Enumeration;
import java.util.Vector;


/**
 * DOCUMENT ME!
 *
 * @version 1.00
 * @author W.John
 */
class ZCommandX extends ZCmdFormat {
    Vector rows = new Vector();
    Vector cols = new Vector();
    Vector cells = new Vector();
    Vector blankObjs = new Vector();

    /**
 * put your documentation comment here
 * @param     ZDefaultSheet sheet
 * @param     ZRect effectCells
 */
    public ZCommandX(ZDefaultSheet sheet, ZRect effectCells) {
        super(sheet, effectCells, 0, null, null);
    }

    /**
 * put your documentation comment here
 */
    public void prepareUndo() {
    }

    /**
 * put your documentation comment here
 */
    public void redo() {
        int r;
        int c;
        ZDefaultCell cell;
        ZRow row;
        ZCol col;
        Enumeration enum;

        //  bool needUndo = ((CEZCellApp *) AfxGetApp())->book()->needUndo();
        //  ((CEZCellApp *) AfxGetApp())->book()->setNeedUndo(false);
        ZRect inflateEC = (ZRect) effectCells.clone();
        inflateEC.inflate(1, 1);

        switch (effectCells.type(sheet)) {
        case ZRect.CELLS:
            redoForCells();

            break;

        case ZRect.ROWS:
        {
            // make rows in the area, and set property one by one
            for (r = inflateEC.top; r <= inflateEC.bottom; r++) {
                row = sheet.getExistRow(r);

                if (row != null) {
                    rows.add(row);

                    if ((r >= effectCells.top) && (r <= effectCells.bottom)) {
                        sheet.remove(row);
                    }
                }
            }


            // if cell in the row ,and its property exists ,then change it
            enum = sheet.getCellsEnum(effectCells);

            while (enum.hasMoreElements()) {
                cell = (ZDefaultCell) enum.nextElement();
                cells.add(cell);
            }

            enum = cells.elements();

            while (enum.hasMoreElements())
                sheet.remove((ZDefaultCell) enum.nextElement());

            workOnBlankRows();
        }

        break;

        case ZRect.COLUMNS:
        {
            for (c = inflateEC.left; c <= inflateEC.right; c++) {
                col = sheet.getExistCol(c);

                if (col != null) {
                    cols.add(col);

                    if ((c >= effectCells.left) && (c <= effectCells.right)) {
                        sheet.remove(col);
                    }
                }
            }

            enum = sheet.getCellsEnum(effectCells);

            while (enum.hasMoreElements()) {
                cell = (ZDefaultCell) enum.nextElement();
                cells.add(cell);
            }

            enum = cells.elements();

            while (enum.hasMoreElements())
                sheet.remove((ZDefaultCell) enum.nextElement());

            workOnBlankCols();
        }

        break;
        }
    }

    /**
 * put your documentation comment here
 */
    public void redoForCells() {
    }

    /**
 * put your documentation comment here
 */
    public void undo() {
        prepareUndo();

        Enumeration enum = blankObjs.elements();

        while (enum.hasMoreElements())
            sheet.remove((ZBase) enum.nextElement());

        enum = cells.elements();

        while (enum.hasMoreElements())
            sheet.add((ZBase) enum.nextElement());

        enum = rows.elements();

        while (enum.hasMoreElements())
            sheet.add((ZBase) enum.nextElement());

        enum = cols.elements();

        while (enum.hasMoreElements())
            sheet.add((ZBase) enum.nextElement());

        cells.clear();
        rows.clear();
        cols.clear();
        blankObjs.clear();
    }

    /**
 * put your documentation comment here
 */
    public void workOnBlankCols() {
    }

    /**
 * put your documentation comment here
 */
    public void workOnBlankRows() {
    }

    /**
 * put your documentation comment here
 */
    void save() {
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -