Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion main/DDF/AbstractEscherOptRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ public override int Serialize(int offset, byte[] data,
listener.AfterRecordSerialize(pos, RecordId, pos - offset, this);
return pos - offset;
}
internal class EscherPropertyComparer : IComparer<EscherProperty>

internal sealed class EscherPropertyComparer : IComparer<EscherProperty>
{
public int Compare(EscherProperty p1, EscherProperty p2)
{
Expand All @@ -136,6 +137,7 @@ public int Compare(EscherProperty p1, EscherProperty p2)
return s1 < s2 ? -1 : s1 == s2 ? 0 : 1;
}
}

/**
* Records should be sorted by property number before being stored.
*/
Expand Down
2 changes: 1 addition & 1 deletion main/DDF/EscherArrayProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
return this.GetEnumerator();
}

private class EscherArrayEnumerator : IEnumerator<byte[]>
private sealed class EscherArrayEnumerator : IEnumerator<byte[]>
{
EscherArrayProperty dataHolder;
public EscherArrayEnumerator(EscherArrayProperty eap)
Expand Down
2 changes: 1 addition & 1 deletion main/DDF/EscherDggRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public void AddCluster(int dgId, int numShapedUsed)
}


private class EscherDggRecordComparer : IComparer<FileIdCluster>
private sealed class EscherDggRecordComparer : IComparer<FileIdCluster>
{

#region IComparer Members
Expand Down
2 changes: 1 addition & 1 deletion main/DDF/EscherDump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public void DumpOld(long maxLength, Stream in1)
}
}

private class PropName
private sealed class PropName
{
public PropName(int id, String name)
{
Expand Down
4 changes: 2 additions & 2 deletions main/DDF/EscherRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public virtual void Display(int indent)
/// <summary>
/// This class Reads the standard escher header.
/// </summary>
internal class DeleteEscherRecordHeader
internal sealed class DeleteEscherRecordHeader
{
private short options;
private short recordId;
Expand Down Expand Up @@ -275,7 +275,7 @@ public short Options
/// Gets the record id.
/// </summary>
/// <value>The record id.</value>
public virtual short RecordId
public short RecordId
{
get { return recordId; }
}
Expand Down
170 changes: 85 additions & 85 deletions main/HPSF/Array.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,123 +22,123 @@ namespace NPOI.HPSF
{
public class Array
{
internal class ArrayDimension
{
public const int SIZE = 8;
internal sealed class ArrayDimension
{
public const int SIZE = 8;

private int _indexOffset;
internal long _size;
private int _indexOffset;
internal long _size;

public ArrayDimension( byte[] data, int offset )
{
_size = LittleEndian.GetUInt( data, offset );
_indexOffset = LittleEndian.GetInt( data, offset
+ LittleEndian.INT_SIZE );
public ArrayDimension(byte[] data, int offset)
{
_size = LittleEndian.GetUInt(data, offset);
_indexOffset = LittleEndian.GetInt(data, offset
+ LittleEndian.INT_SIZE);
}
}
}

internal class ArrayHeader
{
private readonly ArrayDimension[] _dimensions;
internal int _type;

public ArrayHeader( byte[] data, int startOffset )
internal sealed class ArrayHeader
{
int offset = startOffset;
private readonly ArrayDimension[] _dimensions;
internal int _type;

_type = LittleEndian.GetInt( data, offset );
offset += LittleEndian.INT_SIZE;
public ArrayHeader(byte[] data, int startOffset)
{
int offset = startOffset;

_type = LittleEndian.GetInt(data, offset);
offset += LittleEndian.INT_SIZE;

long numDimensionsUnsigned = LittleEndian.GetUInt( data, offset );
offset += LittleEndian.INT_SIZE;
long numDimensionsUnsigned = LittleEndian.GetUInt(data, offset);
offset += LittleEndian.INT_SIZE;

if ( !( 1 <= numDimensionsUnsigned && numDimensionsUnsigned <= 31 ) )
throw new IllegalPropertySetDataException(
if(!(1 <= numDimensionsUnsigned && numDimensionsUnsigned <= 31))
throw new IllegalPropertySetDataException(
"Array dimension number " + numDimensionsUnsigned
+ " is not in [1; 31] range" );
int numDimensions = (int) numDimensionsUnsigned;
+ " is not in [1; 31] range");
int numDimensions = (int) numDimensionsUnsigned;

_dimensions = new ArrayDimension[numDimensions];
for(int i = 0; i < numDimensions; i++)
{
_dimensions[i] = new ArrayDimension(data, offset);
offset += ArrayDimension.SIZE;
}
}

_dimensions = new ArrayDimension[numDimensions];
for ( int i = 0; i < numDimensions; i++ )
public long NumberOfScalarValues
{
_dimensions[i] = new ArrayDimension( data, offset );
offset += ArrayDimension.SIZE;
get
{
long result = 1;
foreach(ArrayDimension dimension in _dimensions)
result *= dimension._size;
return result;
}
}
}

public long NumberOfScalarValues
{
get
public int Size
{
long result = 1;
foreach (ArrayDimension dimension in _dimensions)
result *= dimension._size;
return result;
get
{
return LittleEndian.INT_SIZE * 2 + _dimensions.Length
* ArrayDimension.SIZE;
}
}
}

public int Size
{
get
public int Type
{
return LittleEndian.INT_SIZE*2 + _dimensions.Length
*ArrayDimension.SIZE;
get { return _type; }
}
}

public int Type
private ArrayHeader _header;
private TypedPropertyValue[] _values;

public Array()
{
get { return _type; }
}
}

private ArrayHeader _header;
private TypedPropertyValue[] _values;

public Array()
{
}

public Array( byte[] data, int offset )
{
Read(data, offset);
}
public Array(byte[] data, int offset)
{
Read(data, offset);
}

public int Read( byte[] data, int startOffset )
{
int offset = startOffset;
public int Read(byte[] data, int startOffset)
{
int offset = startOffset;

_header = new ArrayHeader( data, offset );
offset += _header.Size;
_header = new ArrayHeader(data, offset);
offset += _header.Size;

long numberOfScalarsLong = _header.NumberOfScalarValues;
if ( numberOfScalarsLong > int.MaxValue )
throw new InvalidOperationException(
long numberOfScalarsLong = _header.NumberOfScalarValues;
if(numberOfScalarsLong > int.MaxValue)
throw new InvalidOperationException(
"Sorry, but POI can't store array of properties with size of "
+ numberOfScalarsLong + " in memory" );
int numberOfScalars = (int) numberOfScalarsLong;
+ numberOfScalarsLong + " in memory");
int numberOfScalars = (int) numberOfScalarsLong;

_values = new TypedPropertyValue[numberOfScalars];
int type = _header._type;
if ( type == Variant.VT_VARIANT )
{
for ( int i = 0; i < numberOfScalars; i++ )
_values = new TypedPropertyValue[numberOfScalars];
int type = _header._type;
if(type == Variant.VT_VARIANT)
{
TypedPropertyValue typedPropertyValue = new TypedPropertyValue();
offset += typedPropertyValue.Read( data, offset );
for(int i = 0; i < numberOfScalars; i++)
{
TypedPropertyValue typedPropertyValue = new TypedPropertyValue();
offset += typedPropertyValue.Read(data, offset);
}
}
}
else
{
for ( int i = 0; i < numberOfScalars; i++ )
else
{
TypedPropertyValue typedPropertyValue = new TypedPropertyValue(
type, null );
offset += typedPropertyValue.ReadValuePadded( data, offset );
for(int i = 0; i < numberOfScalars; i++)
{
TypedPropertyValue typedPropertyValue = new TypedPropertyValue(
type, null);
offset += typedPropertyValue.ReadValuePadded(data, offset);
}
}
}

return offset - startOffset;
}
return offset - startOffset;
}
}
}
2 changes: 1 addition & 1 deletion main/HPSF/Blob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace NPOI.HPSF
{
internal class Blob
internal sealed class Blob
{
private readonly byte[] _value;

Expand Down
2 changes: 1 addition & 1 deletion main/HPSF/Currency.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ limitations Under the License.

namespace NPOI.HPSF
{
internal class Currency
internal sealed class Currency
{
public const int SIZE = 8;

Expand Down
2 changes: 1 addition & 1 deletion main/HPSF/Date.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ limitations Under the License.

namespace NPOI.HPSF
{
internal class Date
internal sealed class Date
{
public const int SIZE = 8;

Expand Down
2 changes: 1 addition & 1 deletion main/HPSF/MutableSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ private int CalcSize()
}


private class PropertyComparer : IComparer
private sealed class PropertyComparer : IComparer
{
#region IComparer Members

Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Extractor/EventBasedExcelExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private TextListener TriggerExtraction()
return tl;
}

private class TextListener : IHSSFListener
private sealed class TextListener : IHSSFListener
{
public FormatTrackingHSSFListener ft;
private SSTRecord sstRecord;
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Model/InternalChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public InternalChart(RecordStream rs)
}

}
private class PLSAggregateVisitor : RecordVisitor
private sealed class PLSAggregateVisitor : RecordVisitor
{
private List<RecordBase> container;
public PLSAggregateVisitor(List<RecordBase> container)
Expand Down
4 changes: 2 additions & 2 deletions main/HSSF/Model/InternalSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public static InternalSheet CreateSheet(RecordStream rs)
return new InternalSheet(rs);
}

private class RecordCloner : RecordVisitor
private sealed class RecordCloner : RecordVisitor
{
private readonly IList<Record> _destList;

Expand Down Expand Up @@ -450,7 +450,7 @@ private InternalSheet(RecordStream rs)
// log.Log(POILogger.DEBUG, "sheet createSheet (existing file) exited");

}
private class RecordVisitor1:RecordVisitor
private sealed class RecordVisitor1:RecordVisitor
{
readonly List<RecordBase> _records;
public RecordVisitor1(List<RecordBase> recs)
Expand Down
4 changes: 2 additions & 2 deletions main/HSSF/Model/LinkTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private static ExternSheetRecord ReadExtSheetRecord(RecordStream rs)
return ExternSheetRecord.Combine(esrs);
}

private class CRNBlock
private sealed class CRNBlock
{

private readonly CRNCountRecord _countRecord;
Expand All @@ -111,7 +111,7 @@ public CRNRecord[] GetCrns()
}
}

private class ExternalBookBlock
private sealed class ExternalBookBlock
{
private readonly SupBookRecord _externalBookRecord;
internal ExternalNameRecord[] _externalNameRecords;
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Model/ParseNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public ParseNode[] Children
get { return _children; }
}

private class TokenCollector
private sealed class TokenCollector
{

private readonly Ptg[] _ptgs;
Expand Down
3 changes: 2 additions & 1 deletion main/HSSF/Record/Aggregates/Chart/ChartFormatsAggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ public override void VisitContainedRecords(RecordVisitor rv)
WriteEndBlock(rv);
rv.VisitRecord(EndRecord.instance);
}
private class ChartFormatsAttachedLabelAggregate : ChartRecordAggregate

private sealed class ChartFormatsAttachedLabelAggregate : ChartRecordAggregate
{
private DataLabExtRecord dataLabExt;
private ChartStartObjectRecord startObject;
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Record/Aggregates/Chart/ChartRecordAggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ protected void WriteEndBlock(RecordVisitor rv)
}
}

private class StartBlockStack
private sealed class StartBlockStack
{
private List<StartBlockRecord> blockList = new List<StartBlockRecord>(16);
public void Push(StartBlockRecord item)
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Record/Aggregates/ColumnInfoRecordsAggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace NPOI.HSSF.Record.Aggregates
/// </summary>
public class ColumnInfoRecordsAggregate : RecordAggregate, ICloneable
{
private class CIRComparator : IComparer<ColumnInfoRecord>
private sealed class CIRComparator : IComparer<ColumnInfoRecord>
{
public static IComparer<ColumnInfoRecord> instance = new CIRComparator();
private CIRComparator()
Expand Down
Loading