Пример #1
0
        /**
         * Constructor used when creating a writable cell from a read-only cell
         * (when copying a workbook)
         *
         * @param c the cell to clone
         * @param t the type of this cell
         */
        protected CellValue(Type t, Cell c)
            : this(t, c.getColumn(), c.getRow())
        {
            copied = true;

            format = (XFRecord)c.getCellFormat();

            if (c.getCellFeatures() != null)
            {
                features = new WritableCellFeatures(c.getCellFeatures());
                features.setWritableCell(this);
            }
        }
Пример #2
0
        /**
         * Copy constructor
         *
         * @param c the column
         * @param t the cell type
         * @param r the row
         * @param cv the value to copy
         */
        protected CellValue(Type t, int c, int r, CellValue cv)
            : base(t)
        {
            row        = r;
            column     = c;
            format     = cv.format;
            referenced = false;
            copied     = false;         // used during a deep copy, so the cell features need
            // to be added again

            if (cv.features != null)
            {
                features = new WritableCellFeatures(cv.features);
                features.setWritableCell(this);
            }
        }
Пример #3
0
        /**
         * Sets the cell features
         *
         * @param cf the cell features
         */
        public void setCellFeatures(WritableCellFeatures cf)
        {
            if (features != null)
            {
                //logger.warn("current cell features for " +
                //            CellReferenceHelper.getCellReference(this) +
                //            " not null - overwriting");

                // Check to see if the features include a shared data validation
                if (features.hasDataValidation() &&
                    features.getDVParser() != null &&
                    features.getDVParser().extendedCellsValidation())
                {
                    DVParser dvp = features.getDVParser();
                    //logger.warn("Cannot add cell features to " +
                    //            CellReferenceHelper.getCellReference(this) +
                    //            " because it is part of the shared cell validation " +
                    //            "group " +
                    //            CellReferenceHelper.getCellReference(dvp.getFirstColumn(),
                    //                                                 dvp.getFirstRow()) +
                    //            "-" +
                    //            CellReferenceHelper.getCellReference(dvp.getLastColumn(),
                    //                                                 dvp.getLastRow()));
                    return;
                }
            }

            features = cf;
            cf.setWritableCell(this);

            // If the cell is already on the worksheet, then add the cell features
            // to the workbook
            if (referenced)
            {
                addCellFeatures();
            }
        }
Пример #4
0
        /**
         * Sets the cell features
         *
         * @param cf the cell features
         */
        public void setCellFeatures(WritableCellFeatures cf)
        {
            if (features != null)
                {
                //logger.warn("current cell features for " +
                //            CellReferenceHelper.getCellReference(this) +
                //            " not null - overwriting");

                // Check to see if the features include a shared data validation
                if (features.hasDataValidation() &&
                    features.getDVParser() != null &&
                    features.getDVParser().extendedCellsValidation())
                    {
                    DVParser dvp = features.getDVParser();
                    //logger.warn("Cannot add cell features to " +
                    //            CellReferenceHelper.getCellReference(this) +
                    //            " because it is part of the shared cell validation " +
                    //            "group " +
                    //            CellReferenceHelper.getCellReference(dvp.getFirstColumn(),
                    //                                                 dvp.getFirstRow()) +
                    //            "-" +
                    //            CellReferenceHelper.getCellReference(dvp.getLastColumn(),
                    //                                                 dvp.getLastRow()));
                    return;
                    }
                }

            features = cf;
            cf.setWritableCell(this);

            // If the cell is already on the worksheet, then add the cell features
            // to the workbook
            if (referenced)
                {
                addCellFeatures();
                }
        }
Пример #5
0
        /**
         * Copy constructor
         *
         * @param c the column
         * @param t the cell type
         * @param r the row
         * @param cv the value to copy
         */
        protected CellValue(Type t, int c, int r, CellValue cv)
            : base(t)
        {
            row = r;
            column = c;
            format = cv.format;
            referenced = false;
            copied = false; // used during a deep copy, so the cell features need
            // to be added again

            if (cv.features != null)
                {
                features = new WritableCellFeatures(cv.features);
                features.setWritableCell(this);
                }
        }
Пример #6
0
        /**
         * Constructor used when creating a writable cell from a read-only cell
         * (when copying a workbook)
         *
         * @param c the cell to clone
         * @param t the type of this cell
         */
        protected CellValue(Type t, Cell c)
            : this(t, c.getColumn(), c.getRow())
        {
            copied = true;

            format = (XFRecord)c.getCellFormat();

            if (c.getCellFeatures() != null)
                {
                features = new WritableCellFeatures(c.getCellFeatures());
                features.setWritableCell(this);
                }
        }