All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.odftoolkit.odfdom.changes.CachedTable Maven / Gradle / Ivy

Go to download

ODFDOM is an OpenDocument Format (ODF) framework. Its purpose is to provide an easy common way to create, access and manipulate ODF files, without requiring detailed knowledge of the ODF specification. It is designed to provide the ODF developer community with an easy lightwork programming API portable to any object-oriented language. The current reference implementation is written in Java.

There is a newer version: 1.0.0-BETA1
Show newest version
/**
 * **********************************************************************
 *
 * 

DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * *

Copyright 2008, 2010 Oracle and/or its affiliates. All rights reserved. * *

Use is subject to license terms. * *

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. You can also obtain a copy of the License at * http://odftoolkit.org/docs/license.txt * *

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. * *

See the License for the specific language governing permissions and limitations under the * License. * *

********************************************************************** */ package org.odftoolkit.odfdom.changes; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.json.JSONArray; import org.json.JSONObject; @SuppressWarnings("serial") class CachedTable extends CachedComponent { private ArrayList mTableStack = new ArrayList(); public HashMap, CachedTable> mAllTables = new HashMap, CachedTable>(); // START *** SPREADSHEET PROPERTIES // required to track repeatedColumns rows for spreadsheets.. public int mPreviousRepeatedRows = 0; public int mRepeatedRowsOnly = 0; // spreadsheet range, representing a subset of a single row. // added cell data (content & format) neglecting starting/ending empty cells and within the row // any adjacent empty cells above MAX_REPEATING_EMPTY_CELLS public JSONArray mCurrentRange; // only cells with content should trigger an operation public int mFirstContentCellNo = -1; // equal cell contents can be given out compressed public int mFirstEqualCellNo = -1; public int mCurrentColumnNo = 0; // after there had been content, three following empty cells are being counted, before a new // insert operation is being triggered public int mEmptyCellCount = 0; public int mFirstEmptyCell = -1; // the JSONArray does not allow to delete empty cells, therefore they have to be counted public JSONObject mPreviousCell = null; private int mCellRepetition = 1; // get the sheetNo public Integer mSheetNo; public Integer mFirstRow = 0; public Integer mLastRow = 0; public ArrayList mCachedTableContentOps = null; // 1) Mapping the column's default cell style to empty cells for none max size OR // adding column's default cell style to column style // 2) Mapping the largest range of rows/columns to the table in case of MAX sheet public Integer rowCount = null; public Integer columnCount = null; // We want to compress two identical following row format operations public Boolean lastRowIsVisible = Boolean.TRUE; public String lastRowStyleName = null; public int lastRowRepetition = 0; public CachedInnerTableOperation lastRowFormatOperation = null; // List of the column properties with default cell styles public List mColumnDefaultCells = null; public ColumnDefaultCellProps mCurrentDefaultCellProps = null; public int nextColumnDefaultCellListPos = 0; public String mPreviousColumnCellStyleID = null; // Boolean object as three states: There is a default style and all columns covered with default // style (TRUE), there is a default style, but sometimes no style (FALSE) and no "Default" style // (NULL) public Boolean mHasOnlyDefaultColumnCellStyles = null; // Temporary map to count the most used column style, to move this in case of full column count to // the table style public Map columnStyleOccurrence = null; // the name of the column style being used most in the table public String mMostUsedColumnStyle = null; // Temporary map to count the most used row style, to move this in case of full row count to the // table style public Map rowStyleOccurrence = null; // the name of the column style being used most in the table public String mMostUsedRowStyle = null; // END *** SPREADSHEET PROPERTIES public int mColumnCount = 0; public int mRowCount = 0; public boolean mWhiteSpaceOnly = true; public int mCellCount = 0; public boolean mIsTooLarge = false; public List mTableGrid; public List mStart; public String tableName; public CachedTable() { super(); } public int getSubTableCount() { return mTableStack.size(); } public void addSubTable(CachedTable subTable, List position) { // TODO: Do we need two containers? mTableStack.add(subTable); mAllTables.put(position, subTable); } public CachedTable getSubTable(List position) { return mAllTables.get(position); } public void removeSubTable() { mTableStack.remove(mTableStack.size() - 1); } public int getCellRepetition() { return mCellRepetition; } public void setCellRepetition(int set) { mCellRepetition = set; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy