This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push:
new 3d12bb4c80 Fixed typos (varaible -> variable) and some other
3d12bb4c80 is described below
commit 3d12bb4c8063d131d21d7316ab6bf172191cc131
Author: mseidel <[email protected]>
AuthorDate: Tue Sep 26 00:17:20 2023 +0200
Fixed typos (varaible -> variable) and some other
---
main/dbaccess/source/core/api/KeySet.cxx | 60 ++---
.../sxc/pexcel/records/formula/TokenDecoder.java | 222 ++++++++---------
.../sxc/pexcel/records/formula/TokenEncoder.java | 265 ++++++++++-----------
3 files changed, 273 insertions(+), 274 deletions(-)
diff --git a/main/dbaccess/source/core/api/KeySet.cxx
b/main/dbaccess/source/core/api/KeySet.cxx
index b8384e50a2..adfe9c39ad 100644
--- a/main/dbaccess/source/core/api/KeySet.cxx
+++ b/main/dbaccess/source/core/api/KeySet.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,16 +7,16 @@
* to you 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
- *
+ *
* 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.
- *
+ *
*************************************************************/
@@ -294,7 +294,7 @@ void OKeySet::construct(const Reference< XResultSet>&
_xDriverSet,const ::rtl::O
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "[email protected]",
"OKeySet::construct" );
OCacheSet::construct(_xDriverSet,i_sRowSetFilter);
initColumns();
-
+
Reference<XNameAccess> xKeyColumns = getKeyColumns();
Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
Reference<XColumnsSupplier> xQueryColSup(m_xComposer,UNO_QUERY);
@@ -302,7 +302,7 @@ void OKeySet::construct(const Reference< XResultSet>&
_xDriverSet,const ::rtl::O
findTableColumnsMatching_throw(makeAny(m_xTable),m_sUpdateTableName,xMeta,xQueryColumns,m_pKeyColumnNames);
// the first row is empty because it's now easier for us to distinguish
when we are beforefirst or first
- // without extra varaible to be set
+ // without extra variable to be set
m_aKeyMap.insert(OKeySetMatrix::value_type(0,OKeySetValue(NULL,::std::pair<sal_Int32,Reference<XRow>
>(0,NULL))));
m_aKeyIter = m_aKeyMap.begin();
@@ -330,14 +330,14 @@ void OKeySet::construct(const Reference< XResultSet>&
_xDriverSet,const ::rtl::O
connectivity::OSQLTable
xSelColSup(xSelectTables->getByName(*pIter),uno::UNO_QUERY);
Reference<XPropertySet> xProp(xSelColSup,uno::UNO_QUERY);
::rtl::OUString sSelectTableName =
::dbtools::composeTableName( xMeta, xProp, ::dbtools::eInDataManipulation,
false, false, false );
-
-
::dbaccess::getColumnPositions(xQueryColumns,xSelColSup->getColumns()->getElementNames(),sSelectTableName,(*m_pForeignColumnNames));
-
+
+
::dbaccess::getColumnPositions(xQueryColumns,xSelColSup->getColumns()->getElementNames(),sSelectTableName,(*m_pForeignColumnNames));
+
SelectColumnsMetaData::iterator aPosEnd =
(*m_pForeignColumnNames).end();
for(SelectColumnsMetaData::iterator aPosIter =
(*m_pForeignColumnNames).begin();aPosIter != aPosEnd;++aPosIter)
{
// look for columns not in the source
columns to use them as filter as well
- // if (
!xSourceColumns->hasByName(aPosIter->first) )
+ // if (
!xSourceColumns->hasByName(aPosIter->first) )
{
if ( aFilter.getLength() )
aFilter.append(aAnd);
@@ -450,14 +450,14 @@ Sequence< sal_Int32 > SAL_CALL OKeySet::deleteRows( const
Sequence< Any >& rows
aSql.append(m_aComposedTableName);
aSql.append(::rtl::OUString::createFromAscii(" WHERE "));
- // list all cloumns that should be set
+ // list all columns that should be set
const ::rtl::OUString aQuote = getIdentifierQuoteString();
static ::rtl::OUString aAnd =
::rtl::OUString::createFromAscii(" AND ");
static ::rtl::OUString aOr =
::rtl::OUString::createFromAscii(" OR ");
static ::rtl::OUString aEqual = ::rtl::OUString::createFromAscii(" =
?");
- // use keys and indexes for excat postioning
+ // use keys and indexes for exact positioning
// first the keys
Reference<XNameAccess> xKeyColumns = getKeyColumns();
@@ -537,14 +537,14 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow&
_rInsertRow ,const ORowSetRow
::rtl::OUStringBuffer aSql = ::rtl::OUString::createFromAscii("UPDATE
");
aSql.append(m_aComposedTableName);
aSql.append(::rtl::OUString::createFromAscii(" SET "));
- // list all cloumns that should be set
+ // list all columns that should be set
static ::rtl::OUString aPara = ::rtl::OUString::createFromAscii(" =
?,");
::rtl::OUString aQuote = getIdentifierQuoteString();
static ::rtl::OUString aAnd =
::rtl::OUString::createFromAscii(" AND ");
::rtl::OUString sIsNull(RTL_CONSTASCII_USTRINGPARAM(" IS NULL"));
::rtl::OUString sParam(RTL_CONSTASCII_USTRINGPARAM(" = ?"));
- // use keys and indexes for excat postioning
+ // use keys and indexes for exact positioning
// first the keys
Reference<XNameAccess> xKeyColumns = getKeyColumns();
@@ -636,7 +636,7 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow&
_rInsertRow ,const ORowSetRow
::dbtools::throwSQLException( DBACORE_RESSTRING(
RID_STR_NO_CONDITION_FOR_PK ), SQL_GENERAL_ERROR, m_xConnection );
// now create end execute the prepared statement
-
+
::rtl::OUString sEmpty;
executeUpdate(_rInsertRow
,_rOrginalRow,aSql.makeStringAndClear(),sEmpty,aIndexColumnPositions);
}
@@ -888,7 +888,7 @@ void OKeySet::executeInsert( const ORowSetRow&
_rInsertRow,const ::rtl::OUString
--aKeyIter;
ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue
>(m_pKeyColumnNames->size());
copyRowValue(_rInsertRow,aKeyRow,aKeyIter->first + 1);
-
+
m_aKeyIter =
m_aKeyMap.insert(OKeySetMatrix::value_type(aKeyIter->first +
1,OKeySetValue(aKeyRow,::std::pair<sal_Int32,Reference<XRow> >(1,NULL)))).first;
// now we set the bookmark for this row
(_rInsertRow->get())[0] = makeAny((sal_Int32)m_aKeyIter->first);
@@ -911,7 +911,7 @@ void OKeySet::tryRefetch(const ORowSetRow& _rInsertRow,bool
bRefetch)
connectivity::ORowVector< ORowSetValue >::Vector::const_iterator
aParaEnd;
OUpdatedParameter::iterator aUpdateFind =
m_aUpdatedParameter.find(m_aKeyIter->first);
if ( aUpdateFind == m_aUpdatedParameter.end() )
- {
+ {
aParaIter = m_aParameterValueForCache.get().begin();
aParaEnd = m_aParameterValueForCache.get().end();
}
@@ -920,7 +920,7 @@ void OKeySet::tryRefetch(const ORowSetRow& _rInsertRow,bool
bRefetch)
aParaIter = aUpdateFind->second.get().begin();
aParaEnd = aUpdateFind->second.get().end();
}
-
+
for(++aParaIter;aParaIter != aParaEnd;++aParaIter,++nPos)
{
::dbtools::setObjectWithInfo( xParameter, nPos,
aParaIter->makeAny(), aParaIter->getTypeKind() );
@@ -985,7 +985,7 @@ void OKeySet::copyRowValue(const ORowSetRow&
_rInsertRow,ORowSetRow& _rKeyRow,sa
for(;aPosIter != aPosEnd;++aPosIter,++aIter)
{
impl_convertValue_throw(_rInsertRow,aPosIter->second);
- *aIter = (_rInsertRow->get())[aPosIter->second.nPosition];
+ *aIter = (_rInsertRow->get())[aPosIter->second.nPosition];
aIter->setTypeKind(aPosIter->second.nType);
}
}
@@ -1000,11 +1000,11 @@ void SAL_CALL OKeySet::deleteRow(const ORowSetRow&
_rDeleteRow,const connectivit
aSql.append(m_aComposedTableName);
aSql.append(::rtl::OUString::createFromAscii(" WHERE "));
- // list all cloumns that should be set
+ // list all columns that should be set
::rtl::OUString aQuote = getIdentifierQuoteString();
static ::rtl::OUString aAnd =
::rtl::OUString::createFromAscii(" AND ");
- // use keys and indexes for excat postioning
+ // use keys and indexes for exact positioning
Reference<XNameAccess> xKeyColumns = getKeyColumns();
// second the indexes
Reference<XIndexesSupplier> xIndexSup(_xTable,UNO_QUERY);
@@ -1115,9 +1115,9 @@ void SAL_CALL OKeySet::moveToCurrentRow( )
throw(SQLException, RuntimeException
Reference<XNameAccess> OKeySet::getKeyColumns() const
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "[email protected]",
"OKeySet::getKeyColumns" );
- // use keys and indexes for excat postioning
+ // use keys and indexes for exact positioning
// first the keys
-
+
Reference<XIndexAccess> xKeys = m_xTableKeys;
if ( !xKeys.is() )
{
@@ -1361,7 +1361,7 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException,
RuntimeException)
m_xRow = m_aKeyIter->second.second.second;
return;
}
- // we just areassign the base members
+ // we just reassign the base members
Reference< XParameters > xParameter(m_xStatement,UNO_QUERY);
OSL_ENSURE(xParameter.is(),"No Parameter interface!");
xParameter->clearParameters();
@@ -1371,7 +1371,7 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException,
RuntimeException)
connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaEnd;
OUpdatedParameter::iterator aUpdateFind =
m_aUpdatedParameter.find(m_aKeyIter->first);
if ( aUpdateFind == m_aUpdatedParameter.end() )
- {
+ {
aParaIter = m_aParameterValueForCache.get().begin();
aParaEnd = m_aParameterValueForCache.get().end();
}
@@ -1380,7 +1380,7 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException,
RuntimeException)
aParaIter = aUpdateFind->second.get().begin();
aParaEnd = aUpdateFind->second.get().end();
}
-
+
for(++aParaIter;aParaIter != aParaEnd;++aParaIter,++nPos)
{
::dbtools::setObjectWithInfo( xParameter, nPos, aParaIter->makeAny(),
aParaIter->getTypeKind() );
@@ -1695,7 +1695,7 @@ void getColumnPositions(const Reference<XNameAccess>&
_rxQueryColumns,
sal_Int32 nNullable = ColumnValue::NULLABLE_UNKNOWN;
OSL_VERIFY( xQueryColumnProp->getPropertyValue(
PROPERTY_ISNULLABLE ) >>= nNullable );
-
+
if ( i_bAppendTableName )
{
::rtl::OUStringBuffer sName;
@@ -1705,11 +1705,11 @@ void getColumnPositions(const Reference<XNameAccess>&
_rxQueryColumns,
SelectColumnDescription aColDesc( nPos,
nType,nScale,nNullable != sdbc::ColumnValue::NO_NULLS, sColumnDefault );
aColDesc.sRealName = sRealName;
aColDesc.sTableName = sTableName;
- o_rColumnNames[sName.makeStringAndClear()] = aColDesc;
+ o_rColumnNames[sName.makeStringAndClear()] = aColDesc;
}
else
o_rColumnNames[sRealName] = SelectColumnDescription(
nPos, nType,nScale,nNullable != sdbc::ColumnValue::NO_NULLS, sColumnDefault );
-
+
break;
}
}
@@ -1738,5 +1738,5 @@ void OKeySet::impl_convertValue_throw(const ORowSetRow&
_rInsertRow,const Select
break;
}
}
-//
-----------------------------------------------------------------------------
+/* vim: set noet sw=4 ts=4: */
diff --git
a/main/xmerge/java/pexcel/src/main/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/formula/TokenDecoder.java
b/main/xmerge/java/pexcel/src/main/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/formula/TokenDecoder.java
index c1802cbefb..959bb4bf46 100644
---
a/main/xmerge/java/pexcel/src/main/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/formula/TokenDecoder.java
+++
b/main/xmerge/java/pexcel/src/main/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/formula/TokenDecoder.java
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,16 +7,16 @@
* to you 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
- *
+ *
* 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.
- *
+ *
*************************************************************/
@@ -36,15 +36,15 @@ import
org.openoffice.xmerge.converter.xml.sxc.pexcel.records.Workbook;
* The TokenDecoder decodes a byte[] to an equivalent <code>String</code>. The
only
* public method apart from the default constructor is the getTokenVector
method.
* This method takes an entire formula as a pexcel byte[] and decodes it into
- * a series of <code>Token</code>s. It adds these to a <code>Vector</code>
which
- * is returned once all the tokens have been decoded. The Decoder supports
+ * a series of <code>Token</code>s. It adds these to a <code>Vector</code>
which
+ * is returned once all the tokens have been decoded. The Decoder supports
* the following tokens.<br><br>
- *
- * Operands Floating point's, Cell references (absolute and
relative),
+ *
+ * Operands Floating point's, Cell references (absolute and
relative),
* cell ranges<br>
* Operators +,-,*,/,<,>.<=,>=,<><br>
- * Functions All pexcel fixed and varaible argument functions
- *
+ * Functions All pexcel fixed and variable argument functions
+ *
*/
public class TokenDecoder {
@@ -53,10 +53,10 @@ public class TokenDecoder {
private OperatorLookup operatorLookup;
private OperandLookup operandLookup;
private Workbook wb;
-
+
/**
- * Default Constructor initializes the <code>TokenFactory</code> for
generating
- * <code>Token</code> and the <code>SymbolLookup</code> for generating
+ * Default Constructor initializes the <code>TokenFactory</code> for
generating
+ * <code>Token</code> and the <code>SymbolLookup</code> for generating
* Strings from hex values.
*/
public TokenDecoder() {
@@ -65,82 +65,82 @@ public class TokenDecoder {
operatorLookup = new OperatorLookup();
operandLookup = new OperandLookup();
}
-
+
/**
* Sets global workbook data needed for defined names
*/
public void setWorkbook(Workbook wb) {
-
- Debug.log(Debug.TRACE, "TokenDecoder : setWorkbook");
+
+ Debug.log(Debug.TRACE, "TokenDecoder : setWorkbook");
this.wb = wb;
}
-
+
/**
* Returns a <code>Vector</code> of <code>Token</code> decoded from a
* byte[]. The byte[] is first converted to a
* <code>ByteArrayInputStream</code> as this is the easiest way of
reading
* bytes.
- *
+ *
* @param formula A Pocket Excel Formula byte[]
- * @return A <code>Vector</code> of deoded <code>Token</code>
+ * @return A <code>Vector</code> of decoded <code>Token</code>
*/
public Vector getTokenVector(byte[] formula) {
-
+
Vector v = new Vector();
-
+
ByteArrayInputStream bis = new ByteArrayInputStream(formula);
int b = 0 ;
Token t;
-
+
while ((b = bis.read())!=-1)
{
-
-
+
+
switch (b) {
-
- case TokenConstants.TAREA3D:
-
Debug.log(Debug.TRACE, "Decoded 3D Area Cell Reference: ");
+
+ case TokenConstants.TAREA3D:
+
Debug.log(Debug.TRACE, "Decoded 3D Area Cell Reference: ");
v.add(read3DCellAreaRefToken(bis));
-
Debug.log(Debug.TRACE, "Decoded 3D Area Cell Reference: " + v.lastElement());
+
Debug.log(Debug.TRACE, "Decoded 3D Area Cell Reference: " + v.lastElement());
break;
- case TokenConstants.TREF3D:
-
Debug.log(Debug.TRACE, "Decoded 3D Cell Reference: ");
+ case TokenConstants.TREF3D:
+
Debug.log(Debug.TRACE, "Decoded 3D Cell Reference: ");
v.add(read3DCellRefToken(bis));
-
Debug.log(Debug.TRACE, "Decoded 3D Cell Reference: " + v.lastElement());
+
Debug.log(Debug.TRACE, "Decoded 3D Cell Reference: " + v.lastElement());
break;
- case TokenConstants.TREF :
+ case TokenConstants.TREF :
v.add(readCellRefToken(bis));
-
Debug.log(Debug.TRACE, "Decoded Cell Reference: " + v.lastElement());
+
Debug.log(Debug.TRACE, "Decoded Cell Reference: " + v.lastElement());
break;
- case TokenConstants.TAREA :
+ case TokenConstants.TAREA :
v.add(readCellAreaRefToken(bis));
-
Debug.log(Debug.TRACE, "Decoded Cell Area Reference: " + v.lastElement());
- break;
+
Debug.log(Debug.TRACE, "Decoded Cell Area Reference: " + v.lastElement());
+ break;
case TokenConstants.TNUM :
v.add(readNumToken(bis));
-
Debug.log(Debug.TRACE, "Decoded number : " + v.lastElement());
+
Debug.log(Debug.TRACE, "Decoded number : " + v.lastElement());
break;
case TokenConstants.TFUNCVAR :
- v.add(readFunctionVarToken(bis));
-
Debug.log(Debug.TRACE, "Decoded variable argument function: " +
v.lastElement());
+ v.add(readFunctionVarToken(bis));
+
Debug.log(Debug.TRACE, "Decoded variable argument function: " +
v.lastElement());
break;
case TokenConstants.TFUNC :
- v.add(readFunctionToken(bis));
-
Debug.log(Debug.TRACE, "Decoded function: " + v.lastElement());
+ v.add(readFunctionToken(bis));
+
Debug.log(Debug.TRACE, "Decoded function: " + v.lastElement());
break;
case TokenConstants.TSTRING :
v.add(readStringToken(bis));
-
Debug.log(Debug.TRACE, "Decoded string: " + v.lastElement());
+
Debug.log(Debug.TRACE, "Decoded string: " + v.lastElement());
break;
case TokenConstants.TNAME :
v.add(readNameToken(bis));
-
Debug.log(Debug.TRACE, "Decoded defined name: " + v.lastElement());
+
Debug.log(Debug.TRACE, "Decoded defined name: " + v.lastElement());
break;
case TokenConstants.TUPLUS:
case TokenConstants.TUMINUS:
case TokenConstants.TPERCENT:
v.add(readOperatorToken(b, 1));
-
Debug.log(Debug.TRACE, "Decoded Unary operator : " + v.lastElement());
+
Debug.log(Debug.TRACE, "Decoded Unary operator : " + v.lastElement());
break;
case TokenConstants.TADD :
case TokenConstants.TSUB :
@@ -153,33 +153,33 @@ public class TokenDecoder {
case TokenConstants.TGREATER :
case TokenConstants.TNEQUALS :
v.add(readOperatorToken(b, 2));
-
Debug.log(Debug.TRACE, "Decoded Binary operator : " + v.lastElement());
+
Debug.log(Debug.TRACE, "Decoded Binary operator : " + v.lastElement());
break;
-
+
default :
-
Debug.log(Debug.TRACE, "Unrecognized byte : " + b);
+
Debug.log(Debug.TRACE, "Unrecognized byte : " + b);
}
}
return v;
}
-
+
/**
- * Converts a zero based integer to a char (eg. a=0, b=1).
+ * Converts a zero based integer to a char (e.g. a=0, b=1).
* It assumes the integer is less than 26.
*
* @param i A 0 based index
- * @return The equivalent character
+ * @return The equivalent character
*/
private char int2Char(int i) {
return (char) ('A' + i);
}
-
+
/**
* Reads a Cell Reference token from the <code>ByteArrayInputStream</code>
*
* @param bis The <code>ByteArrayInputStream</code> from which we read
the
* bytes.
- * @return The decoded String <code>Token</code>
+ * @return The decoded String <code>Token</code>
*/
private Token readStringToken(ByteArrayInputStream bis) {
@@ -192,25 +192,25 @@ public class TokenDecoder {
Debug.log(Debug.TRACE,"Expected " + len + " bytes.
Could only read " + numRead + " bytes.");
//throw new IOException("Expected " + len + " bytes.
Could only read " + numRead + " bytes.");
}
- StringBuffer outputString = new StringBuffer();
+ StringBuffer outputString = new StringBuffer();
outputString.append('"');
try {
Debug.log(Debug.TRACE,"Using LE encoding");
outputString.append(new String(stringBytes,
"UTF-16LE"));
} catch (IOException eIO) {
- outputString.append(new String(stringBytes)); //fall
back to default encoding
+ outputString.append(new String(stringBytes)); // fall
back to default encoding
}
outputString.append('"');
-
+
return (tf.getOperandToken(outputString.toString(), "STRING"));
}
-
+
/**
* Reads a Defined Name token from the <code>ByteArrayInputStream</code>
*
* @param bis The <code>ByteArrayInputStream</code> from which we read
the
* bytes.
- * @return The decoded Name <code>Token</code>
+ * @return The decoded Name <code>Token</code>
*/
private Token readNameToken(ByteArrayInputStream bis) {
byte buffer[] = new byte[2];
@@ -228,29 +228,29 @@ public class TokenDecoder {
DefinedName dn = (DefinedName)e.nextElement();
Debug.log(Debug.TRACE,"DefinedName is " + dn.getName());
return (tf.getOperandToken(dn.getName(), "NAME"));
- }
-
+ }
+
/**
* Reads a Cell Reference token from the <code>ByteArrayInputStream</code>
*
* @param bis The <code>ByteArrayInputStream</code> from which we read
the
* bytes.
- * @return The decoded Cell Reference <code>Token</code>
+ * @return The decoded Cell Reference <code>Token</code>
*/
private Token readCellRefToken(ByteArrayInputStream bis) {
-
+
byte buffer[] = new byte[2];
String outputString = new String();
-
+
buffer[0] = (byte) bis.read();
buffer[1] = (byte) bis.read();
int formulaRow = EndianConverter.readShort(buffer);
int relativeFlags = (formulaRow & 0xC000)>>14;
formulaRow &= 0x3FFF;
int formulaCol = (byte) bis.read();
-
+
outputString = int2CellStr(formulaRow, formulaCol, relativeFlags);
-
+
return (tf.getOperandToken(outputString,"CELL_REFERENCE"));
}
@@ -259,15 +259,15 @@ public class TokenDecoder {
*
* @param bis The <code>ByteArrayInputStream</code> from which we read
the
* bytes.
- * @return The decoded Cell Reference <code>Token</code>
+ * @return The decoded Cell Reference <code>Token</code>
*/
private Token read3DCellRefToken(ByteArrayInputStream bis) {
-
+
byte buffer[] = new byte[2];
- String outputString = new String();
+ String outputString = new String();
bis.skip(10);
-
+
buffer[0] = (byte) bis.read();
buffer[1] = (byte) bis.read();
int Sheet1 = EndianConverter.readShort(buffer);
@@ -286,25 +286,25 @@ public class TokenDecoder {
outputString = "$" + wb.getSheetName(Sheet1) + cellRef;
} else {
outputString = "$" + wb.getSheetName(Sheet1) + cellRef
+ ":$" + wb.getSheetName(Sheet2) + cellRef;
- }
-
+ }
+
return (tf.getOperandToken(outputString,"3D_CELL_REFERENCE"));
}
-
+
/**
* Reads a Cell Reference token from the <code>ByteArrayInputStream</code>
*
* @param bis The <code>ByteArrayInputStream</code> from which we read
the
* bytes.
- * @return The decoded Cell Reference <code>Token</code>
+ * @return The decoded Cell Reference <code>Token</code>
*/
private Token read3DCellAreaRefToken(ByteArrayInputStream bis) {
-
+
byte buffer[] = new byte[2];
- String outputString = new String();
+ String outputString = new String();
bis.skip(10);
-
+
buffer[0] = (byte) bis.read();
buffer[1] = (byte) bis.read();
int Sheet1 = EndianConverter.readShort(buffer);
@@ -317,7 +317,7 @@ public class TokenDecoder {
int formulaRow1 = EndianConverter.readShort(buffer);
int relativeFlags1 = (formulaRow1 & 0xC000)>>14;
formulaRow1 &= 0x3FFF;
-
+
buffer[0] = (byte) bis.read();
buffer[1] = (byte) bis.read();
int formulaRow2 = EndianConverter.readShort(buffer);
@@ -326,22 +326,22 @@ public class TokenDecoder {
int formulaCol1 = (byte) bis.read();
int formulaCol2 = (byte) bis.read();
-
+
String cellRef1 = "." + int2CellStr(formulaRow1, formulaCol1,
relativeFlags1);
String cellRef2 = int2CellStr(formulaRow2, formulaCol2,
relativeFlags2);
-
+
if(Sheet1 == Sheet2) {
outputString = "$" + wb.getSheetName(Sheet1) + cellRef1
+ ":" + cellRef2;
} else {
outputString = "$" + wb.getSheetName(Sheet1) + cellRef1
+ ":$" + wb.getSheetName(Sheet2) + "." + cellRef2;
- }
-
+ }
+
return (tf.getOperandToken(outputString,"3D_CELL_AREA_REFERENCE"));
}
/**
- * Converts a row and col 0 based index to a spreadsheet cell reference.
- * It also has a relativeFlags which indicates whether or not the
+ * Converts a row and col 0 based index to a spreadsheet cell reference.
+ * It also has a relativeFlags which indicates whether or not the
* Cell Reference is relative or absolute (Absolute is denoted with '$')
*
* 00 = absolute row, absolute col
@@ -351,7 +351,7 @@ public class TokenDecoder {
*
* @param row The cell reference 0 based index to the row
* @param col The cell reference 0 based index to the row
- * @param relativeFlags Flags indicating addressing of row and column
+ * @param relativeFlags Flags indicating addressing of row and column
* @return A <code>String</code> representing a cell reference
*/
private String int2CellStr(int row, int col, int relativeFlags) {
@@ -361,72 +361,72 @@ public class TokenDecoder {
if((relativeFlags & 1) == 0) {
outputString += "$";
}
-
+
if(firstChar>0) {
- int secondChar = (col + 1) % 26;
+ int secondChar = (col + 1) % 26;
outputString += Character.toString(int2Char(firstChar - 1)) +
Character.toString(int2Char(secondChar - 1));
} else {
outputString += Character.toString(int2Char(col));
- }
+ }
if((relativeFlags & 2) == 0) {
outputString += "$";
- }
+ }
outputString += Integer.toString(row+1);
return outputString;
}
-
+
/**
- * Reads a Cell Area Reference (cell range) <code>Token</code> from
+ * Reads a Cell Area Reference (cell range) <code>Token</code> from
* the <code>ByteArrayInputStream</code>
*
* @param bis The <code>ByteArrayInputStream</code> from which we read
the
* bytes.
* @return The equivalent Cell Area Reference (cell range)
- * <code>Token</code>
+ * <code>Token</code>
*/
private Token readCellAreaRefToken(ByteArrayInputStream bis) {
byte buffer[] = new byte[2];
int formulaRow1, formulaRow2;
int formulaCol1, formulaCol2;
-
+
String outputString = new String();
-
+
buffer[0] = (byte) bis.read();
buffer[1] = (byte) bis.read();
formulaRow1 = EndianConverter.readShort(buffer);
- int relativeFlags1 = (formulaRow1 & 0xC000)>>14;
+ int relativeFlags1 = (formulaRow1 & 0xC000)>>14;
formulaRow1 &= 0x3FFF;
buffer[0] = (byte) bis.read();
buffer[1] = (byte) bis.read();
formulaRow2 = EndianConverter.readShort(buffer);
int relativeFlags2 = (formulaRow2 & 0xC000)>>14;
formulaRow2 &= 0x3FFF;
-
+
formulaCol1 = (byte) bis.read();
formulaCol2 = (byte) bis.read();
outputString = int2CellStr(formulaRow1, formulaCol1, relativeFlags1);
outputString += (":" + int2CellStr(formulaRow2, formulaCol2,
relativeFlags2));
-
+
return (tf.getOperandToken(outputString,"CELL_AREA_REFERENCE"));
}
-
-
+
+
/**
* Reads a Number (floating point) token from the
<code>ByteArrayInputStream</code>
*
* @param bis The <code>ByteArrayInputStream</code> from which we read
the
* bytes.
- * @return The decoded Integer <code>Token</code>
+ * @return The decoded Integer <code>Token</code>
*/
private Token readNumToken(ByteArrayInputStream bis) {
-
+
byte numBuffer[] = new byte[8];
-
+
for(int j=0;j<8;j++) {
numBuffer[j]=(byte) bis.read();
}
-
+
return
(tf.getOperandToken(Double.toString(EndianConverter.readDouble(numBuffer)),"NUMBER"));
}
@@ -435,15 +435,15 @@ public class TokenDecoder {
*
* @param b A Pocket Excel number representing an operator.
* @param args The number of arguments this operator takes.
- * @return The decoded Operator <code>Token</code>
+ * @return The decoded Operator <code>Token</code>
*/
private Token readOperatorToken(int b, int args) {
Token t;
-
+
if(b==TokenConstants.TUPLUS) {
t = tf.getOperatorToken("+", args);
- } else if(b==TokenConstants.TUMINUS) {
+ } else if(b==TokenConstants.TUMINUS) {
t = tf.getOperatorToken("-", args);
} else {
t =
tf.getOperatorToken(operatorLookup.getStringFromID(b), args);
@@ -458,22 +458,22 @@ public class TokenDecoder {
*
* @param bis The <code>ByteArrayInputStream</code> from which we read
the
* bytes.
- * @return The decoded variable argument Function <code>Token</code>
+ * @return The decoded variable argument Function <code>Token</code>
*/
private Token readFunctionVarToken(ByteArrayInputStream bis) {
-
+
int numArgs = 0;
numArgs = bis.read();
byte buffer[] = new byte[2];
buffer[0] = (byte) bis.read();
buffer[1] = (byte) bis.read();
- int functionID = EndianConverter.readShort(buffer);
+ int functionID = EndianConverter.readShort(buffer);
return (tf.getFunctionToken(fl.getStringFromID(functionID),numArgs));
}
-
+
/**
* Read a Function token from the <code>ByteArrayInputStream</code>
- * This function has a fixed number of arguments which it will get
+ * This function has a fixed number of arguments which it will get
* from <code>FunctionLookup</code>.
*
* @param bis The <code>ByteArrayInputStream</code> from which we read
the
@@ -481,7 +481,7 @@ public class TokenDecoder {
* @return The decoded fixed argument Function <code>Token</code>
*/
private Token readFunctionToken(ByteArrayInputStream bis) {
-
+
byte buffer[] = new byte[2];
buffer[0] = (byte) bis.read();
buffer[1] = (byte) bis.read();
@@ -489,5 +489,5 @@ public class TokenDecoder {
String functionName = fl.getStringFromID(functionID);
return
(tf.getFunctionToken(functionName,fl.getArgCountFromString(functionName)));
}
-
+
}
diff --git
a/main/xmerge/java/pexcel/src/main/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/formula/TokenEncoder.java
b/main/xmerge/java/pexcel/src/main/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/formula/TokenEncoder.java
index 86ec99d2d3..035d141534 100644
---
a/main/xmerge/java/pexcel/src/main/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/formula/TokenEncoder.java
+++
b/main/xmerge/java/pexcel/src/main/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/formula/TokenEncoder.java
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,16 +7,16 @@
* to you 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
- *
+ *
* 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.
- *
+ *
*************************************************************/
@@ -35,21 +35,21 @@ import
org.openoffice.xmerge.converter.xml.sxc.pexcel.records.DefinedName;
/**
* The TokenEncoder encodes a Token to an equivalent pexcel byte[]. The only
* public method apart from the default constructor is the getByte method.
- * This method picks an encoder based onthe Token's type or id field and uses
+ * This method picks an encoder based on the Token's type or id field and uses
* that encoder to return a byte[] which it returns. This Encoder supports
- * Operands Floating point's, Cell references (absolute and
relative),
+ * Operands Floating point's, Cell references (absolute and
relative),
* cell ranges
* Operators +,-,*,/,<,>.<=,>=,<>
- * Functions All pexcel fixed and varaible argument functions
- *
+ * Functions All pexcel fixed and variable argument functions
+ *
*/
public class TokenEncoder {
-
+
private FunctionLookup fl;
private String parseString;
private int index;
private Workbook wb;
-
+
/**
* Default Constructor
*/
@@ -58,20 +58,20 @@ public class TokenEncoder {
parseString = new String();
fl = new FunctionLookup();
}
-
+
/**
* Sets global workbook data needed for defined names
*/
public void setWorkbook(Workbook wb) {
-
+
this.wb = wb;
}
-
-
+
+
/**
* Return the byte[] equivalent of a <code>Token</code>. The various
- * encoders return <code>Vector</code> of <code>Byte</code> instead
- * of byte[] because the number of bytes returned varies with each
+ * encoders return <code>Vector</code> of <code>Byte</code> instead
+ * of byte[] because the number of bytes returned varies with each
* <code>Token</code> encoded. After the encoding is finished the Vector
* in converted to a byte[].
*
@@ -79,8 +79,8 @@ public class TokenEncoder {
* @return An equivalent Pocket Excel byte[]
*/
public byte[] getByte(Token t) throws IOException {
-
- Vector tmpByteArray = null; // we use this cause we don't
know till after
+
+ Vector tmpByteArray = null; // we use this cause we don't
know till after
// the encoding takes place how big
the byte [] will be
//index=0; // This
class is declared static in
// FormulaHelper so better make sure our index is 0
@@ -88,21 +88,21 @@ public class TokenEncoder {
tmpByteArray = operatorEncoder(t);
} else if (t.getTokenType()==ParseToken.TOKEN_FUNCTION_VARIABLE ||
t.getTokenType()==ParseToken.TOKEN_FUNCTION_FIXED){
tmpByteArray = functionEncoder(t);
- } else { // Operands and functions
+ } else { // Operands and functions
switch(t.getTokenID()) {
- case TokenConstants.TNAME :
+ case TokenConstants.TNAME :
tmpByteArray = nameDefinitionEncoder(t);
break;
- case TokenConstants.TREF3D :
+ case TokenConstants.TREF3D :
tmpByteArray = threeDCellRefEncoder(t);
break;
- case TokenConstants.TAREA3D:
+ case TokenConstants.TAREA3D:
tmpByteArray = threeDAreaRefEncoder(t);
break;
- case TokenConstants.TREF :
+ case TokenConstants.TREF :
tmpByteArray = cellRefEncoder(t);
break;
- case TokenConstants.TAREA :
+ case TokenConstants.TAREA :
tmpByteArray = areaRefEncoder(t);
break;
case TokenConstants.TNUM :
@@ -112,7 +112,7 @@ public class TokenEncoder {
tmpByteArray = stringEncoder(t);
break;
default :
- Debug.log(Debug.ERROR, "Encoder found
unrecognized Token");
+ Debug.log(Debug.ERROR, "Encoder found
unrecognized Token");
}
}
@@ -126,12 +126,12 @@ public class TokenEncoder {
i++;
}
Debug.log(Debug.TRACE, "Encoding Token " + t.getValue() + " as
[" + s + "]");
- return cellRefArray;
+ return cellRefArray;
}
-
- /**
- * An Operator Encoder.
- *
+
+ /**
+ * An Operator Encoder.
+ *
* @param t <code>Token</code> to be encoded
* @return A <code>Vector</code> of pexcel <code>Byte</code>
*/
@@ -143,9 +143,9 @@ public class TokenEncoder {
}
- /**
- * A String Encoder.
- *
+ /**
+ * A String Encoder.
+ *
* @param t <code>Token</code> to be encoded
* @return A <code>Vector</code> of pexcel <code>Byte</code>
*/
@@ -163,16 +163,16 @@ public class TokenEncoder {
}
- /**
- * An Integer Encoder.
- *
+ /**
+ * An Integer Encoder.
+ *
* @param t <code>Token</code> to be encoded
* @return A <code>Vector</code> of pexcel <code>Byte</code>
*/
private Vector numEncoder(Token t) {
Vector tmpByteArray = new Vector();
-
+
double cellLong = (double) Double.parseDouble(t.getValue());
tmpByteArray.add(new Byte((byte)t.getTokenID()));
byte[] tempByte = EndianConverter.writeDouble(cellLong);
@@ -181,37 +181,37 @@ public class TokenEncoder {
}
return tmpByteArray;
}
-
- /**
+
+ /**
* Converts a char to an int. It is zero based
* so a=0, b=1 etc.
- *
+ *
* @param ch the character to be converted
* @return -1 if not a character otherwise a 0 based index
*/
private int char2int(char ch) {
- if(!Character.isLetter(ch))
+ if(!Character.isLetter(ch))
return -1;
-
+
ch = Character.toUpperCase(ch);
return ch-'A';
}
-
+
/**
* Identify letters
- *
+ *
* @param c The character which is to be identified
- * @return A boolean returning the result of the comparison
- */
+ * @return A boolean returning the result of the comparison
+ */
private boolean isAlpha(char c) {
return(Character.isLetter(c));
}
-
+
/**
* Identify numbers
- *
+ *
* @param c The character which is to be identified
- * @return A boolean returning the result of the comparison
+ * @return A boolean returning the result of the comparison
*/
private boolean isDigit(char c) {
return(Character.isDigit(c));
@@ -219,31 +219,31 @@ public class TokenEncoder {
/**
* Identify letters or numbers
- *
+ *
* @param c The character which is to be identified
- * @return A boolean returning the result of the comparison
- */
+ * @return A boolean returning the result of the comparison
+ */
private boolean isAlphaNum(char c) {
return(isAlpha(c) || isDigit(c));
}
-
+
/**
- * Parses a column reference and returns it's integer equivalent. (eg.
+ * Parses a column reference and returns its integer equivalent. (e.g.
* A=0, D=3, BA=27)
- *
+ *
* @return an 0 based index to a column
*/
private int column() {
char ch = parseString.charAt(index);
String columnStr = new String();
int col = 0;
-
+
while(isAlpha(ch)) {
columnStr += ch;
index++;
ch = parseString.charAt(index);
}
-
+
if(columnStr.length()==1) {
col = char2int(columnStr.charAt(0));
} else if (columnStr.length()==2) {
@@ -252,23 +252,23 @@ public class TokenEncoder {
} else {
Debug.log(Debug.ERROR, "Invalid Column Reference " +
columnStr );
}
-
+
return col;
}
/**
- * Parses a column reference and returns it's integer equivalent. (eg.
+ * Parses a column reference and returns its integer equivalent. (e.g.
* A=0, D=3, BA=27)
- *
+ *
* @return an 0 based index to a column
- */
+ */
private int row() {
char ch = parseString.charAt(index);
String rowStr = new String();
int row = 0;
boolean status = true;
-
+
do {
rowStr += ch;
index++;
@@ -281,14 +281,14 @@ public class TokenEncoder {
return Integer.parseInt(rowStr)-1; // Pexcel uses a 0 based index
}
- /**
+ /**
* A Cell Reference Encoder (It supports absolute and relative addressing)
- *
+ *
* @param cellCoordinates
* @return A <code>Vector</code> of pexcel <code>Byte</code>
*/
private byte[] encodeCellCoordinates(String cellCoordinates) {
- int col = 0, row = 0;
+ int col = 0, row = 0;
int addressing = 0xC000;
index = 0;
@@ -298,38 +298,38 @@ public class TokenEncoder {
addressing &= 0x8000;
index++;
}
- col = column();
+ col = column();
if(cellCoordinates.charAt(index)=='$') {
addressing &= 0x4000;
index++;
- }
+ }
row = row(); // Pexcel uses a 0 based index
row |= addressing;
- byte tokenBytes[] = new byte[3];
+ byte tokenBytes[] = new byte[3];
tokenBytes[0] = (byte)row;
tokenBytes[1] = (byte)(row>>8);
tokenBytes[2] = (byte)col;
return tokenBytes;
}
-
- /**
- * A name definition Encoder
- *
+
+ /**
+ * A name definition Encoder
+ *
* @param t <code>Token</code> to be encoded
* @return A <code>Vector</code> of pexcel <code>Byte</code>
*/
private Vector nameDefinitionEncoder(Token t) {
-
+
Vector tmpByteArray = new Vector();
-
+
String nameString = t.getValue();
Debug.log(Debug.TRACE,"NameDefinitionEncoder : " + nameString);
- tmpByteArray.add(new Byte((byte)t.getTokenID()));
+ tmpByteArray.add(new Byte((byte)t.getTokenID()));
Enumeration e = wb.getDefinedNames();
DefinedName dn;
String name;
int definedNameIndex = 0;
- do {
+ do {
dn = (DefinedName)e.nextElement();
name = dn.getName();
Debug.log(Debug.TRACE,"Name pulled from DefinedName : "
+ name);
@@ -338,25 +338,25 @@ public class TokenEncoder {
tmpByteArray.add(new Byte((byte)definedNameIndex));
tmpByteArray.add(new Byte((byte)0x00));
-
+
for(int i = 0;i < 12;i++) {
tmpByteArray.add(new Byte((byte)0x00));
}
return tmpByteArray;
- }
- /**
+ }
+ /**
* A Cell Reference Encoder. It supports absolute and relative addressing
* but not sheetnames.
- *
+ *
* @param t <code>Token</code> to be encoded
* @return A <code>Vector</code> of pexcel <code>Byte</code>
*/
private Vector cellRefEncoder(Token t) {
-
+
Vector tmpByteArray = new Vector();
-
- tmpByteArray.add(new Byte((byte)t.getTokenID()));
+
+ tmpByteArray.add(new Byte((byte)t.getTokenID()));
byte cellRefBytes[] = encodeCellCoordinates(t.getValue());
for(int i = 0;i < cellRefBytes.length;i++) {
tmpByteArray.add(new Byte(cellRefBytes[i]));
@@ -364,21 +364,21 @@ public class TokenEncoder {
return tmpByteArray;
}
- /**
- * This function will find the sheetname index for a given String
- *
+ /**
+ * This function will find the sheetname index for a given String
+ *
* @param s
* @return A <code>Vector</code> of pexcel <code>Byte</code>
*/
private short findSheetIndex(String s) {
-
+
short sheetIndex = 0;
String savedName;
- String sheetName;
+ String sheetName;
if (s.startsWith("$")) {
sheetName = s.substring(1,s.length()); // Remove $
} else {
- sheetName = s.substring(0,s.length());
+ sheetName = s.substring(0,s.length());
}
Debug.log(Debug.TRACE,"Searching for Worksheet : " + sheetName);
Vector names = wb.getWorksheetNames();
@@ -387,29 +387,29 @@ public class TokenEncoder {
savedName = (String) e.nextElement();
sheetIndex++;
} while(!savedName.equalsIgnoreCase(sheetName) &&
e.hasMoreElements());
-
+
Debug.log(Debug.TRACE,"Setting sheetindex to " + sheetIndex);
return (short)(sheetIndex-1);
}
- /**
- * A 3D Cell reference encoder
- *
+ /**
+ * A 3D Cell reference encoder
+ *
* @param t <code>Token</code> to be encoded
* @return A <code>Vector</code> of pexcel <code>Byte</code>
*/
private Vector threeDCellRefEncoder(Token t) {
-
+
Vector tmpByteArray = new Vector();
parseString = t.getValue();
Debug.log(Debug.TRACE,"Encoding 3D Cell reference " + t);
- tmpByteArray.add(new Byte((byte)t.getTokenID()));
+ tmpByteArray.add(new Byte((byte)t.getTokenID()));
tmpByteArray.add(new Byte((byte)0xFF));
tmpByteArray.add(new Byte((byte)0xFF));
for(int i = 0;i < 8;i++) {
tmpByteArray.add(new Byte((byte)0x00));
}
-
+
String sheetRef = parseString.substring(0,
parseString.indexOf('.') + 1);
if (sheetRef.indexOf(':')!=-1) {
sheetRef = parseString.substring(0,
parseString.indexOf(':'));
@@ -435,25 +435,25 @@ public class TokenEncoder {
tmpByteArray.add(new Byte(cellRefBytes[i]));
}
return tmpByteArray;
- }
- /**
- * A 3D Area Reference Encoder.
- *
+ }
+ /**
+ * A 3D Area Reference Encoder.
+ *
* @param t <code>Token</code> to be encoded
* @return A <code>Vector</code> of pexcel <code>Byte</code>
*/
private Vector threeDAreaRefEncoder(Token t) {
-
+
Vector tmpByteArray = new Vector();
parseString = t.getValue();
Debug.log(Debug.TRACE,"Encoding 3D Area reference " + t);
- tmpByteArray.add(new Byte((byte)t.getTokenID()));
+ tmpByteArray.add(new Byte((byte)t.getTokenID()));
tmpByteArray.add(new Byte((byte)0xFF));
tmpByteArray.add(new Byte((byte)0xFF));
for(int i = 0;i < 8;i++) {
tmpByteArray.add(new Byte((byte)0x00));
}
-
+
String param1= parseString.substring(0,
parseString.indexOf(':'));
String cellRef1 = param1.substring(parseString.indexOf('.') +
1, param1.length());
String sheetRef1 = param1.substring(0, param1.indexOf('.'));
@@ -470,86 +470,85 @@ public class TokenEncoder {
tmpByteArray.add(new Byte((byte)sheetNum1));
tmpByteArray.add(new Byte((byte)0x00));
} else {
- String sheetRef2 = param2.substring(0,
param2.indexOf('.'));
+ String sheetRef2 = param2.substring(0,
param2.indexOf('.'));
short sheetNum2 = findSheetIndex(sheetRef2);
tmpByteArray.add(new Byte((byte)sheetNum1));
tmpByteArray.add(new Byte((byte)0x00));
tmpByteArray.add(new Byte((byte)sheetNum2));
tmpByteArray.add(new Byte((byte)0x00));
}
-
+
byte cellRefBytes1[] = encodeCellCoordinates(cellRef1);
byte cellRefBytes2[] = encodeCellCoordinates(cellRef2);
-
+
tmpByteArray.add(new Byte(cellRefBytes1[0]));
tmpByteArray.add(new Byte(cellRefBytes1[1]));
-
+
tmpByteArray.add(new Byte(cellRefBytes2[0]));
tmpByteArray.add(new Byte(cellRefBytes2[1]));
-
+
tmpByteArray.add(new Byte(cellRefBytes1[2]));
tmpByteArray.add(new Byte(cellRefBytes2[2]));
return tmpByteArray;
- }
-
- /**
- * A Cell Range Encoder.
- *
+ }
+
+ /**
+ * A Cell Range Encoder.
+ *
* @param t <code>Token</code> to be encoded
* @return A <code>Vector</code> of pexcel <code>Byte</code>
- */
+ */
private Vector areaRefEncoder(Token t) {
Vector tmpByteArray = new Vector();
-
- tmpByteArray.add(new Byte((byte)t.getTokenID()));
+
+ tmpByteArray.add(new Byte((byte)t.getTokenID()));
String param = t.getValue();
String cellRef1 = new String();
String cellRef2 = new String();
if(param.indexOf(':')==-1) {
- Debug.log(Debug.ERROR, "Invalid Cell Range, could not
find :");
+ Debug.log(Debug.ERROR, "Invalid Cell Range, could not
find :");
} else {
cellRef1 = param.substring(0, param.indexOf(':'));
cellRef2 = param.substring(param.indexOf(':') + 1,
param.length());
}
byte cellRefBytes1[] = encodeCellCoordinates(cellRef1);
byte cellRefBytes2[] = encodeCellCoordinates(cellRef2);
-
+
tmpByteArray.add(new Byte(cellRefBytes1[0]));
tmpByteArray.add(new Byte(cellRefBytes1[1]));
-
+
tmpByteArray.add(new Byte(cellRefBytes2[0]));
tmpByteArray.add(new Byte(cellRefBytes2[1]));
-
+
tmpByteArray.add(new Byte(cellRefBytes1[2]));
tmpByteArray.add(new Byte(cellRefBytes2[2]));
return tmpByteArray;
}
-
- /**
- * A Function Encoder.
- *
+
+ /**
+ * A Function Encoder.
+ *
* @param t <code>Token</code> to be encoded
* @return A <code>Vector</code> of pexcel <code>Byte</code>
- */
+ */
private Vector functionEncoder(Token t) {
Vector tmpByteArray = new Vector();
-
+
int id = t.getTokenID();
if(t.getTokenType()==ParseToken.TOKEN_FUNCTION_VARIABLE) {
- tmpByteArray.add(new Byte((byte)TokenConstants.TFUNCVAR));
- tmpByteArray.add(new Byte((byte)t.getNumArgs()));
+ tmpByteArray.add(new Byte((byte)TokenConstants.TFUNCVAR));
+ tmpByteArray.add(new Byte((byte)t.getNumArgs()));
} else {
- tmpByteArray.add(new Byte((byte)TokenConstants.TFUNC));
+ tmpByteArray.add(new Byte((byte)TokenConstants.TFUNC));
}
-
- tmpByteArray.add(new Byte((byte)id));
- tmpByteArray.add(new Byte((byte)(id>>8)));
+
+ tmpByteArray.add(new Byte((byte)id));
+ tmpByteArray.add(new Byte((byte)(id>>8)));
return tmpByteArray;
}
-
}