done. I dislike "currentBook" and would prefer some kind of context
mechanism or directly passing the book to the PTGs etc. Perhaps a
"PTGWorkbookContextInterface" that defines set/getWorkbook etc etc.
PR:
Obtained from:
Submitted by:
Reviewed by:
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352760
13f79535-47bb-0310-9956-
ffa450edef68
public class Workbook {
private static final int DEBUG = POILogger.DEBUG;
- public static ThreadLocal currentBook = new ThreadLocal();
+ public static Workbook currentBook = null;
/**
* constant used to set the "codepage" wherever "codepage" is set in records
public String toFormulaString()
{
StringBuffer retval = new StringBuffer();
- Object book = Workbook.currentBook.get();
+ Object book = Workbook.currentBook;
if (book != null) {
retval.append(((Workbook) book).findSheetNameFromExternSheet(this.field_1_index_extern_sheet));
retval.append('!');
* later call the parse() method to return ptg list in rpn order
* then call the getRPNPtg() to retrive the parse results
* This class is recommended only for single threaded use
- * The parse and getPRNPtg are internally synchronized for safety, thus
- * while it is safe to use in a multithreaded environment, you will get long lock waits.
*/
public FormulaParser(String formula, Workbook book){
formulaString = formula;
public String toFormulaString() {
StringBuffer retval = new StringBuffer();
- Object book = Workbook.currentBook.get();
+ Object book = Workbook.currentBook;
if (book != null) {
retval.append(((Workbook) book).findSheetNameFromExternSheet(this.field_1_index_extern_sheet));
retval.append('!');
}
public void setCellFormula(String formula) {
- Workbook.currentBook.set(book);
+ Workbook.currentBook=book;
if (formula==null) {
setCellType(CELL_TYPE_BLANK,false);
} else {
rec.pushExpressionToken(ptg[ k ]);
}
rec.setExpressionLength(( short ) size);
- Workbook.currentBook.set(null);
+ Workbook.currentBook = null;
}
}
public String getCellFormula() {
- Workbook.currentBook.set(book);
+ Workbook.currentBook=book;
String retval = FormulaParser.toFormulaString(((FormulaRecord)record).getParsedExpression());
- Workbook.currentBook.set(null);
+ Workbook.currentBook=null;
return retval;
}
*/
public String getReference() {
- Workbook.currentBook.set(book);
+ Workbook.currentBook=book;
String result;
result = name.getAreaReference();
- Workbook.currentBook.set(null);
+ Workbook.currentBook=null;
return result;